OSDN Git Service

Simplified check_pf() so it returns a bit vector in an unsigned int,
[uclinux-h8/uClibc.git] / libc / inet / ifaddrs.h
1 /* ifaddrs.h -- declarations for getting network interface addresses
2    Copyright (C) 2002 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19
20 #ifndef _IFADDRS_H
21 #define _IFADDRS_H      1
22
23 #include <features.h>
24 #include <sys/socket.h>
25 #include <stdbool.h>
26 #include <stdint.h>
27
28 __BEGIN_DECLS
29
30 /* The `getifaddrs' function generates a linked list of these structures.
31    Each element of the list describes one network interface.  */
32 struct ifaddrs
33 {
34   struct ifaddrs *ifa_next;     /* Pointer to the next structure.  */
35
36   char *ifa_name;               /* Name of this network interface.  */
37   unsigned int ifa_flags;       /* Flags as from SIOCGIFFLAGS ioctl.  */
38
39   struct sockaddr *ifa_addr;    /* Network address of this interface.  */
40   struct sockaddr *ifa_netmask; /* Netmask of this interface.  */
41   union
42   {
43     /* At most one of the following two is valid.  If the IFF_BROADCAST
44        bit is set in `ifa_flags', then `ifa_broadaddr' is valid.  If the
45        IFF_POINTOPOINT bit is set, then `ifa_dstaddr' is valid.
46        It is never the case that both these bits are set at once.  */
47     struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */
48     struct sockaddr *ifu_dstaddr; /* Point-to-point destination address.  */
49   } ifa_ifu;
50   /* These very same macros are defined by <net/if.h> for `struct ifaddr'.
51      So if they are defined already, the existing definitions will be fine.  */
52 # ifndef ifa_broadaddr
53 #  define ifa_broadaddr ifa_ifu.ifu_broadaddr
54 # endif
55 # ifndef ifa_dstaddr
56 #  define ifa_dstaddr   ifa_ifu.ifu_dstaddr
57 # endif
58
59   void *ifa_data;               /* Address-specific data (may be unused).  */
60 };
61
62
63 /* Create a linked list of `struct ifaddrs' structures, one for each
64    network interface on the host machine.  If successful, store the
65    list in *IFAP and return 0.  On errors, return -1 and set `errno'.
66
67    The storage returned in *IFAP is allocated dynamically and can
68    only be properly freed by passing it to `freeifaddrs'.  */
69 extern int getifaddrs (struct ifaddrs **__ifap) __THROW;
70
71 /* Reclaim the storage allocated by a previous `getifaddrs' call.  */
72 extern void freeifaddrs (struct ifaddrs *__ifa)  __THROW;
73
74 __END_DECLS
75
76 #endif /* ifaddrs.h */