summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'libnetutils')
-rw-r--r--libnetutils/Android.mk3
-rw-r--r--libnetutils/include/netutils/dhcp.h44
-rw-r--r--libnetutils/include/netutils/ifc.h66
3 files changed, 113 insertions, 0 deletions
diff --git a/libnetutils/Android.mk b/libnetutils/Android.mk
index 2060df499..281b6c8e1 100644
--- a/libnetutils/Android.mk
+++ b/libnetutils/Android.mk
@@ -16,6 +16,9 @@ LOCAL_MODULE := libnetutils
16 16
17LOCAL_CFLAGS := -Werror 17LOCAL_CFLAGS := -Werror
18 18
19LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
20LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
21
19include $(BUILD_SHARED_LIBRARY) 22include $(BUILD_SHARED_LIBRARY)
20 23
21include $(CLEAR_VARS) 24include $(CLEAR_VARS)
diff --git a/libnetutils/include/netutils/dhcp.h b/libnetutils/include/netutils/dhcp.h
new file mode 100644
index 000000000..008dbd887
--- /dev/null
+++ b/libnetutils/include/netutils/dhcp.h
@@ -0,0 +1,44 @@
1/*
2 * Copyright 2010, 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_DHCP_H_
18#define _NETUTILS_DHCP_H_
19
20#include <sys/cdefs.h>
21#include <arpa/inet.h>
22
23__BEGIN_DECLS
24
25extern int do_dhcp(char *iname);
26extern int dhcp_start(const char *ifname);
27extern int dhcp_start_renew(const char *ifname);
28extern int dhcp_get_results(const char *ifname,
29 char *ipaddr,
30 char *gateway,
31 uint32_t *prefixLength,
32 char *dns[],
33 char *server,
34 uint32_t *lease,
35 char *vendorInfo,
36 char *domain,
37 char *mtu);
38extern int dhcp_stop(const char *ifname);
39extern int dhcp_release_lease(const char *ifname);
40extern char *dhcp_get_errmsg();
41
42__END_DECLS
43
44#endif /* _NETUTILS_DHCP_H_ */
diff --git a/libnetutils/include/netutils/ifc.h b/libnetutils/include/netutils/ifc.h
new file mode 100644
index 000000000..3b272343d
--- /dev/null
+++ b/libnetutils/include/netutils/ifc.h
@@ -0,0 +1,66 @@
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
25extern int ifc_init(void);
26extern void ifc_close(void);
27
28extern int ifc_get_ifindex(const char *name, int *if_indexp);
29extern int ifc_get_hwaddr(const char *name, void *ptr);
30
31extern int ifc_up(const char *name);
32extern int ifc_down(const char *name);
33
34extern int ifc_enable(const char *ifname);
35extern int ifc_disable(const char *ifname);
36
37#define RESET_IPV4_ADDRESSES 0x01
38#define RESET_IPV6_ADDRESSES 0x02
39#define RESET_IGNORE_INTERFACE_ADDRESS 0x04
40#define RESET_ALL_ADDRESSES (RESET_IPV4_ADDRESSES | RESET_IPV6_ADDRESSES)
41extern int ifc_reset_connections(const char *ifname, const int reset_mask);
42
43extern int ifc_get_addr(const char *name, in_addr_t *addr);
44extern int ifc_set_addr(const char *name, in_addr_t addr);
45extern int ifc_add_address(const char *name, const char *address,
46 int prefixlen);
47extern int ifc_del_address(const char *name, const char *address,
48 int prefixlen);
49extern int ifc_set_prefixLength(const char *name, int prefixLength);
50extern int ifc_set_hwaddr(const char *name, const void *ptr);
51extern int ifc_clear_addresses(const char *name);
52
53extern int ifc_create_default_route(const char *name, in_addr_t addr);
54extern int ifc_remove_default_route(const char *ifname);
55extern int ifc_get_info(const char *name, in_addr_t *addr, int *prefixLength,
56 unsigned *flags);
57
58extern int ifc_configure(const char *ifname, in_addr_t address,
59 uint32_t prefixLength, in_addr_t gateway,
60 in_addr_t dns1, in_addr_t dns2);
61
62extern in_addr_t prefixLengthToIpv4Netmask(int prefix_length);
63
64__END_DECLS
65
66#endif /* _NETUTILS_IFC_H_ */