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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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  */
    17 #ifndef IFADDRS_ANDROID_EXT_H_included
    18 #define IFADDRS_ANDROID_EXT_H_included
    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>
    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.
    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;
    40     // Interface name.
    41     char* ifa_name;
    43     // Interface flags.
    44     unsigned int ifa_flags;
    46     // Interface network address.
    47     struct sockaddr* ifa_addr;
    49     // Interface netmask.
    50     struct sockaddr* ifa_netmask;
    51 } ifaddrs;
    53 #ifdef __cplusplus
    54 extern "C" {
    55 #endif
    56     int getifaddrs(ifaddrs** result);
    57     void freeifaddrs(ifaddrs* addresses);
    58 #ifdef __cplusplus
    59 }
    60 #endif
    62 #endif  // IFADDRS_ANDROID_H_included

mercurial