~ubuntu-branches/ubuntu/precise/eglibc/precise-201308281639

« back to all changes in this revision

Viewing changes to ports/sysdeps/unix/sysv/aix/net/if.h

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-02-08 01:58:09 UTC
  • mfrom: (1.5.3) (288.1.12 precise)
  • Revision ID: package-import@ubuntu.com-20120208015809-ulscst7uteq3e22z
Tags: 2.15~pre6-0ubuntu10
Merge from Debian (r5151, 2.13-26).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
2
 
   This file is part of the GNU C Library.
3
 
 
4
 
   The GNU C Library is free software; you can redistribute it and/or
5
 
   modify it under the terms of the GNU Lesser General Public
6
 
   License as published by the Free Software Foundation; either
7
 
   version 2.1 of the License, or (at your option) any later version.
8
 
 
9
 
   The GNU C Library is distributed in the hope that it will be useful,
10
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 
   Lesser General Public License for more details.
13
 
 
14
 
   You should have received a copy of the GNU Lesser General Public
15
 
   License along with the GNU C Library; if not, write to the Free
16
 
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17
 
   02111-1307 USA.  */
18
 
 
19
 
#ifndef _NET_IF_H
20
 
 
21
 
#define _NET_IF_H       1
22
 
#include <features.h>
23
 
 
24
 
#include <sys/types.h>
25
 
#include <sys/socket.h>
26
 
 
27
 
/* Standard interface flags. */
28
 
enum
29
 
  {
30
 
    IFF_UP = 0x1,               /* Interface is up.  */
31
 
#define IFF_UP  IFF_UP
32
 
    IFF_BROADCAST = 0x2,        /* Broadcast address valid.  */
33
 
#define IFF_BROADCAST   IFF_BROADCAST
34
 
    IFF_DEBUG = 0x4,            /* Turn on debugging.  */
35
 
#define IFF_DEBUG       IFF_DEBUG
36
 
    IFF_LOOPBACK = 0x8,         /* Is a loopback net.  */
37
 
#define IFF_LOOPBACK    IFF_LOOPBACK
38
 
    IFF_POINTOPOINT = 0x10,     /* Interface is point-to-point link.  */
39
 
#define IFF_POINTOPOINT IFF_POINTOPOINT
40
 
    IFF_NOTRAILERS = 0x20,      /* Avoid use of trailers.  */
41
 
#define IFF_NOTRAILERS  IFF_NOTRAILERS
42
 
    IFF_RUNNING = 0x40,         /* Resources allocated.  */
43
 
#define IFF_RUNNING     IFF_RUNNING
44
 
    IFF_NOARP = 0x80,           /* No address resolution protocol.  */
45
 
#define IFF_NOARP       IFF_NOARP
46
 
    IFF_PROMISC = 0x100,        /* Receive all packets.  */
47
 
#define IFF_PROMISC     IFF_PROMISC
48
 
 
49
 
    /* Not supported */
50
 
    IFF_ALLMULTI = 0x200,       /* Receive all multicast packets.  */
51
 
#define IFF_ALLMULTI    IFF_ALLMULTI
52
 
 
53
 
    IFF_OACTIVE = 0x400,        /* Transmission in progress.  */
54
 
#define IFF_OACTIVE     IFF_OACTIVE
55
 
    IFF_SIMPLEX = 0x800,        /* Cannot hear own transmissions.  */
56
 
#define IFF_SIMPLEX     IFF_SIMPLEX
57
 
    IFF_DO_HW_LOOPBACK = 0x10000, /* Force loopback through hardware.  */
58
 
#define IFF_DO_HW_LOOPBACK      IFF_DO_HW_LOOPBACK
59
 
    IFF_ALLCAST = 0x20000,      /* Global broadcast.  */
60
 
#define IFF_ALLCAST     IFF_ALLCAST
61
 
    IFF_BRIDGE = 0x40000,       /* Receive all bridge packets.  */
62
 
#define IFF_BRIDGE      IFF_BRIDGE
63
 
    IFF_NOECHO = IFF_SIMPLEX,   /* Reeives echo packets.  */
64
 
#define IFF_NOECHO      IFF_NOECHO
65
 
  };
66
 
 
67
 
/* The ifaddr structure contains information about one address of an
68
 
   interface.  They are maintained by the different address families,
69
 
   are allocated and attached when an address is set, and are linked
70
 
   together so all addresses for an interface can be located.  */
71
 
 
72
 
struct ifaddr
73
 
  {
74
 
    struct sockaddr ifa_addr;   /* Address of interface.  */
75
 
    union
76
 
      {
77
 
        struct sockaddr ifu_broadaddr;
78
 
        struct sockaddr ifu_dstaddr;
79
 
      } ifa_ifu;
80
 
    struct sockaddr *ifa_netmask; /* Used to determine subnet.  */
81
 
    struct iface *ifa_ifp;      /* Back-pointer to interface.  */
82
 
    struct ifaddr *ifa_next;    /* Next address for interface.  */
83
 
    void (*ifa_rtrequest) (void);
84
 
    struct rtentry *ifa_rt;
85
 
    unsigned short int ifa_flags;
86
 
    short int ifa_refcnt;
87
 
  };
88
 
 
89
 
#define ifa_broadaddr   ifa_ifu.ifu_broadaddr   /* broadcast address    */
90
 
#define ifa_dstaddr     ifa_ifu.ifu_dstaddr     /* other end of link    */
91
 
 
92
 
/* Interface request structure used for socket ioctl's.  All interface
93
 
   ioctl's must have parameter definitions which begin with ifr_name.
94
 
   The remainder may be interface specific.  */
95
 
 
96
 
struct ifreq
97
 
  {
98
 
#define IFHWADDRLEN     6
99
 
#define IFNAMSIZ        16
100
 
    union
101
 
      {
102
 
        char ifrn_name[IFNAMSIZ];       /* Interface name, e.g. "en0".  */
103
 
      } ifr_ifrn;
104
 
 
105
 
    union
106
 
      {
107
 
        struct sockaddr ifru_addr;
108
 
        struct sockaddr ifru_dstaddr;
109
 
        struct sockaddr ifru_broadaddr;
110
 
        struct sockaddr ifru_netmask;
111
 
        struct sockaddr ifru_hwaddr;
112
 
        short int ifru_flags;
113
 
        int ifru_ivalue;
114
 
        unsigned int ifru_mtu;
115
 
        char ifru_slave[IFNAMSIZ];      /* Just fits the size */
116
 
        __caddr_t ifru_data;
117
 
        unsigned short int ifru_site6;
118
 
      } ifr_ifru;
119
 
  };
120
 
 
121
 
/* Old AIX 3.1 version.  */
122
 
struct oifreq
123
 
{
124
 
  char ifr_name[IFNAMSIZ];              /* if name, e.g. "en0" */
125
 
  union
126
 
  {
127
 
    struct  sockaddr ifru_addr;
128
 
    struct  sockaddr ifru_dstaddr;
129
 
    struct  sockaddr ifru_broadaddr;
130
 
    int ifru_flags;
131
 
    int ifru_metric;
132
 
    caddr_t ifru_data;
133
 
    unsigned int ifru_mtu;
134
 
  } ifr_ifru;
135
 
  unsigned char reserved[8];
136
 
};
137
 
 
138
 
 
139
 
#define ifr_name        ifr_ifrn.ifrn_name      /* interface name       */
140
 
#define ifr_hwaddr      ifr_ifru.ifru_hwaddr    /* MAC address          */
141
 
#define ifr_addr        ifr_ifru.ifru_addr      /* address              */
142
 
#define ifr_dstaddr     ifr_ifru.ifru_dstaddr   /* other end of p-p lnk */
143
 
#define ifr_broadaddr   ifr_ifru.ifru_broadaddr /* broadcast address    */
144
 
#define ifr_netmask     ifr_ifru.ifru_netmask   /* interface net mask   */
145
 
#define ifr_flags       ifr_ifru.ifru_flags     /* flags                */
146
 
#define ifr_metric      ifr_ifru.ifru_ivalue    /* metric               */
147
 
#define ifr_mtu         ifr_ifru.ifru_mtu       /* mtu                  */
148
 
#define ifr_slave       ifr_ifru.ifru_slave     /* slave device         */
149
 
#define ifr_data        ifr_ifru.ifru_data      /* for use by interface */
150
 
#define ifr_ifindex     ifr_ifru.ifru_ivalue    /* interface index      */
151
 
#define ifr_bandwidth   ifr_ifru.ifru_ivalue    /* link bandwidth       */
152
 
#define ifr_baudrate    ifr_ifru.ifru_ivalue    /* link bandwidth       */
153
 
#define ifr_qlen        ifr_ifru.ifru_ivalue    /* queue length         */
154
 
#define ifr_site6       ifr_ifru.ifru_site6     /* IPv6 site index      */
155
 
 
156
 
 
157
 
/* Structure used in SIOCGIFCONF request.  Used to retrieve interface
158
 
   configuration for machine (useful for programs which must know all
159
 
   networks accessible).  */
160
 
 
161
 
struct ifconf
162
 
  {
163
 
    int ifc_len;                        /* Size of buffer.  */
164
 
    union
165
 
      {
166
 
        __caddr_t ifcu_buf;
167
 
        struct ifreq *ifcu_req;
168
 
      } ifc_ifcu;
169
 
  };
170
 
#define ifc_buf ifc_ifcu.ifcu_buf       /* Buffer address.  */
171
 
#define ifc_req ifc_ifcu.ifcu_req       /* Array of structures.  */
172
 
 
173
 
__BEGIN_DECLS
174
 
 
175
 
/* Convert an interface name to an index, and vice versa.  */
176
 
 
177
 
extern unsigned int if_nametoindex (__const char *__ifname) __THROW;
178
 
extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW;
179
 
 
180
 
/* Return a list of all interfaces and their indices.  */
181
 
 
182
 
struct if_nameindex
183
 
  {
184
 
    unsigned int if_index;      /* 1, 2, ... */
185
 
    char *if_name;              /* null terminated name: "eth0", ... */
186
 
  };
187
 
 
188
 
extern struct if_nameindex *if_nameindex (void) __THROW;
189
 
 
190
 
/* Free the data returned from if_nameindex.  */
191
 
 
192
 
extern void if_freenameindex (struct if_nameindex *__ptr) __THROW;
193
 
 
194
 
__END_DECLS
195
 
 
196
 
#endif /* net/if.h */