1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/sctp/src/ifaddrs-android-ext.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +/* 1.5 + * Copyright (C) 2009 The Android Open Source Project 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 +#ifndef IFADDRS_ANDROID_EXT_H_included 1.21 +#define IFADDRS_ANDROID_EXT_H_included 1.22 + 1.23 +#include <arpa/inet.h> 1.24 +#include <errno.h> 1.25 +#include <net/if.h> 1.26 +#include <netinet/in.h> 1.27 +#include <sys/ioctl.h> 1.28 +#include <sys/types.h> 1.29 +#include <sys/socket.h> 1.30 +#include <stdio.h> 1.31 +#include <linux/netlink.h> 1.32 +#include <linux/rtnetlink.h> 1.33 + 1.34 +// Android (bionic) doesn't have getifaddrs(3)/freeifaddrs(3). 1.35 +// We fake it here, so java_net_NetworkInterface.cpp can use that API 1.36 +// with all the non-portable code being in this file. 1.37 + 1.38 +// Source-compatible subset of the BSD struct. 1.39 +typedef struct ifaddrs { 1.40 + // Pointer to next struct in list, or NULL at end. 1.41 + struct ifaddrs* ifa_next; 1.42 + 1.43 + // Interface name. 1.44 + char* ifa_name; 1.45 + 1.46 + // Interface flags. 1.47 + unsigned int ifa_flags; 1.48 + 1.49 + // Interface network address. 1.50 + struct sockaddr* ifa_addr; 1.51 + 1.52 + // Interface netmask. 1.53 + struct sockaddr* ifa_netmask; 1.54 +} ifaddrs; 1.55 + 1.56 +#ifdef __cplusplus 1.57 +extern "C" { 1.58 +#endif 1.59 + int getifaddrs(ifaddrs** result); 1.60 + void freeifaddrs(ifaddrs* addresses); 1.61 +#ifdef __cplusplus 1.62 +} 1.63 +#endif 1.64 + 1.65 +#endif // IFADDRS_ANDROID_H_included