netwerk/sctp/src/ifaddrs-android-ext.h

changeset 1
ca08bd8f51b2
equal deleted inserted replaced
-1:000000000000 0:9585c43b0a52
1 /*
2 * Copyright (C) 2009 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 IFADDRS_ANDROID_EXT_H_included
18 #define IFADDRS_ANDROID_EXT_H_included
19
20 #include <arpa/inet.h>
21 #include <errno.h>
22 #include <net/if.h>
23 #include <netinet/in.h>
24 #include <sys/ioctl.h>
25 #include <sys/types.h>
26 #include <sys/socket.h>
27 #include <stdio.h>
28 #include <linux/netlink.h>
29 #include <linux/rtnetlink.h>
30
31 // Android (bionic) doesn't have getifaddrs(3)/freeifaddrs(3).
32 // We fake it here, so java_net_NetworkInterface.cpp can use that API
33 // with all the non-portable code being in this file.
34
35 // Source-compatible subset of the BSD struct.
36 typedef struct ifaddrs {
37 // Pointer to next struct in list, or NULL at end.
38 struct ifaddrs* ifa_next;
39
40 // Interface name.
41 char* ifa_name;
42
43 // Interface flags.
44 unsigned int ifa_flags;
45
46 // Interface network address.
47 struct sockaddr* ifa_addr;
48
49 // Interface netmask.
50 struct sockaddr* ifa_netmask;
51 } ifaddrs;
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 int getifaddrs(ifaddrs** result);
57 void freeifaddrs(ifaddrs* addresses);
58 #ifdef __cplusplus
59 }
60 #endif
61
62 #endif // IFADDRS_ANDROID_H_included

mercurial