Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright (C) 2009 The Android Open Source Project |
michael@0 | 3 | * |
michael@0 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
michael@0 | 5 | * you may not use this file except in compliance with the License. |
michael@0 | 6 | * You may obtain a copy of the License at |
michael@0 | 7 | * |
michael@0 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
michael@0 | 9 | * |
michael@0 | 10 | * Unless required by applicable law or agreed to in writing, software |
michael@0 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
michael@0 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
michael@0 | 13 | * See the License for the specific language governing permissions and |
michael@0 | 14 | * limitations under the License. |
michael@0 | 15 | */ |
michael@0 | 16 | |
michael@0 | 17 | #ifndef IFADDRS_ANDROID_EXT_H_included |
michael@0 | 18 | #define IFADDRS_ANDROID_EXT_H_included |
michael@0 | 19 | |
michael@0 | 20 | #include <arpa/inet.h> |
michael@0 | 21 | #include <errno.h> |
michael@0 | 22 | #include <net/if.h> |
michael@0 | 23 | #include <netinet/in.h> |
michael@0 | 24 | #include <sys/ioctl.h> |
michael@0 | 25 | #include <sys/types.h> |
michael@0 | 26 | #include <sys/socket.h> |
michael@0 | 27 | #include <stdio.h> |
michael@0 | 28 | #include <linux/netlink.h> |
michael@0 | 29 | #include <linux/rtnetlink.h> |
michael@0 | 30 | |
michael@0 | 31 | // Android (bionic) doesn't have getifaddrs(3)/freeifaddrs(3). |
michael@0 | 32 | // We fake it here, so java_net_NetworkInterface.cpp can use that API |
michael@0 | 33 | // with all the non-portable code being in this file. |
michael@0 | 34 | |
michael@0 | 35 | // Source-compatible subset of the BSD struct. |
michael@0 | 36 | typedef struct ifaddrs { |
michael@0 | 37 | // Pointer to next struct in list, or NULL at end. |
michael@0 | 38 | struct ifaddrs* ifa_next; |
michael@0 | 39 | |
michael@0 | 40 | // Interface name. |
michael@0 | 41 | char* ifa_name; |
michael@0 | 42 | |
michael@0 | 43 | // Interface flags. |
michael@0 | 44 | unsigned int ifa_flags; |
michael@0 | 45 | |
michael@0 | 46 | // Interface network address. |
michael@0 | 47 | struct sockaddr* ifa_addr; |
michael@0 | 48 | |
michael@0 | 49 | // Interface netmask. |
michael@0 | 50 | struct sockaddr* ifa_netmask; |
michael@0 | 51 | } ifaddrs; |
michael@0 | 52 | |
michael@0 | 53 | #ifdef __cplusplus |
michael@0 | 54 | extern "C" { |
michael@0 | 55 | #endif |
michael@0 | 56 | int getifaddrs(ifaddrs** result); |
michael@0 | 57 | void freeifaddrs(ifaddrs* addresses); |
michael@0 | 58 | #ifdef __cplusplus |
michael@0 | 59 | } |
michael@0 | 60 | #endif |
michael@0 | 61 | |
michael@0 | 62 | #endif // IFADDRS_ANDROID_H_included |