Szymon Jakubczak | c88e09c | 2010-06-09 16:11:09 -0400 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2008, The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef _NETUTILS_IFC_H_ |
| 18 | #define _NETUTILS_IFC_H_ |
| 19 | |
| 20 | #include <sys/cdefs.h> |
| 21 | #include <arpa/inet.h> |
| 22 | |
| 23 | __BEGIN_DECLS |
| 24 | |
| 25 | extern int ifc_init(void); |
| 26 | extern void ifc_close(void); |
| 27 | |
| 28 | extern int ifc_get_ifindex(const char *name, int *if_indexp); |
| 29 | extern int ifc_get_hwaddr(const char *name, void *ptr); |
| 30 | |
| 31 | extern int ifc_up(const char *name); |
| 32 | extern int ifc_down(const char *name); |
| 33 | |
| 34 | extern int ifc_enable(const char *ifname); |
| 35 | extern int ifc_disable(const char *ifname); |
| 36 | |
| 37 | extern int ifc_reset_connections(const char *ifname); |
| 38 | |
| 39 | extern int ifc_set_addr(const char *name, in_addr_t addr); |
| 40 | extern int ifc_set_mask(const char *name, in_addr_t mask); |
| 41 | extern int ifc_set_hwaddr(const char *name, const void *ptr); |
| 42 | |
| 43 | extern int ifc_add_host_route(const char *name, in_addr_t addr); |
| 44 | extern int ifc_remove_host_routes(const char *name); |
| 45 | extern int ifc_get_default_route(const char *ifname); |
| 46 | extern int ifc_set_default_route(const char *ifname, in_addr_t gateway); |
| 47 | extern int ifc_create_default_route(const char *name, in_addr_t addr); |
| 48 | extern int ifc_remove_default_route(const char *ifname); |
| 49 | |
| 50 | extern int ifc_get_info(const char *name, in_addr_t *addr, in_addr_t *mask, |
| 51 | in_addr_t *flags); |
| 52 | |
| 53 | extern int ifc_configure(const char *ifname, in_addr_t address, |
| 54 | in_addr_t netmask, in_addr_t gateway, |
| 55 | in_addr_t dns1, in_addr_t dns2); |
| 56 | |
| 57 | __END_DECLS |
| 58 | |
| 59 | #endif /* _NETUTILS_IFC_H_ */ |