OSDN Git Service

224e0482663416af96ff95191da0acf2dff85301
[android-x86/external-wireless-tools.git] / wireless_tools / compat.h
1 /* This whole file is flaky */
2 /* This is all we need to compile and can't find only in linux headers.
3  * So, I did copy past here...
4  */
5 #define __u8    unsigned char
6 #define __u16   unsigned short
7 #define __u32   unsigned long           /* Hum, and on Alpha ? */
8 #define __u64   unsigned long long      /* Unsure about this one */
9
10 #define IFNAMSIZ        16
11 #define ARPHRD_ETHER    1               /* Ethernet 10Mbps              */
12 #define ETH_ALEN        6               /* Octets in one ethernet addr   */
13
14 /*
15  * Interface request structure used for socket
16  * ioctl's.  All interface ioctl's must have parameter
17  * definitions which begin with ifr_name.  The
18  * remainder may be interface specific.
19  */
20 struct ifreq 
21 {
22 #define IFHWADDRLEN     6
23 #define IFNAMSIZ        16
24         union
25         {
26                 char    ifrn_name[IFNAMSIZ];            /* if name, e.g. "en0" */
27         } ifr_ifrn;
28         
29         union {
30                 struct  sockaddr ifru_addr;
31                 struct  sockaddr ifru_dstaddr;
32                 struct  sockaddr ifru_broadaddr;
33                 struct  sockaddr ifru_netmask;
34                 struct  sockaddr ifru_hwaddr;
35                 short   ifru_flags;
36                 int     ifru_metric;
37                 int     ifru_mtu;
38 #if 0
39                 struct  ifmap ifru_map;
40 #endif
41                 char    ifru_slave[IFNAMSIZ];   /* Just fits the size */
42                 caddr_t ifru_data;
43         } ifr_ifru;
44 };
45 #define ifr_name        ifr_ifrn.ifrn_name      /* interface name       */
46 #define ifr_hwaddr      ifr_ifru.ifru_hwaddr    /* MAC address          */
47 #define ifr_addr        ifr_ifru.ifru_addr      /* address              */
48
49 /*
50  * Structure used in SIOCGIFCONF request.
51  * Used to retrieve interface configuration
52  * for machine (useful for programs which
53  * must know all networks accessible).
54  */
55 struct ifconf 
56 {
57         int     ifc_len;                        /* size of buffer       */
58         union 
59         {
60                 caddr_t ifcu_buf;
61                 struct  ifreq *ifcu_req;
62         } ifc_ifcu;
63 };
64 #define ifc_buf ifc_ifcu.ifcu_buf               /* buffer address       */
65 #define ifc_req ifc_ifcu.ifcu_req               /* array of structures  */
66
67 /* Internet address. */
68 struct in_addr {
69         __u32   s_addr;
70 };
71
72 /* Address to accept any incoming messages. */
73 #define INADDR_ANY              ((unsigned long int) 0x00000000)
74
75 /* Structure describing an Internet (IP) socket address. */
76 #define __SOCK_SIZE__   16              /* sizeof(struct sockaddr)      */
77 struct sockaddr_in {
78   short int             sin_family;     /* Address family               */
79   unsigned short int    sin_port;       /* Port number                  */
80   struct in_addr        sin_addr;       /* Internet address             */
81
82   /* Pad to size of `struct sockaddr'. */
83   unsigned char         __pad[__SOCK_SIZE__ - sizeof(short int) -
84                         sizeof(unsigned short int) - sizeof(struct in_addr)];
85 };
86
87 #define ATF_COM         0x02            /* completed entry (ha valid)   */
88 /* ARP ioctl request. */
89 struct arpreq {
90   struct sockaddr       arp_pa;         /* protocol address             */
91   struct sockaddr       arp_ha;         /* hardware address             */
92   int                   arp_flags;      /* flags                        */
93   struct sockaddr       arp_netmask;    /* netmask (only for proxy arps) */
94   char                  arp_dev[16];
95 };
96