Blame inet/ifaddrs.h

Packit 6c4009
/* ifaddrs.h -- declarations for getting network interface addresses
Packit 6c4009
   Copyright (C) 2002-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _IFADDRS_H
Packit 6c4009
#define _IFADDRS_H	1
Packit 6c4009
Packit 6c4009
#include <features.h>
Packit 6c4009
#include <sys/socket.h>
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
Packit 6c4009
/* The `getifaddrs' function generates a linked list of these structures.
Packit 6c4009
   Each element of the list describes one network interface.  */
Packit 6c4009
struct ifaddrs
Packit 6c4009
{
Packit 6c4009
  struct ifaddrs *ifa_next;	/* Pointer to the next structure.  */
Packit 6c4009
Packit 6c4009
  char *ifa_name;		/* Name of this network interface.  */
Packit 6c4009
  unsigned int ifa_flags;	/* Flags as from SIOCGIFFLAGS ioctl.  */
Packit 6c4009
Packit 6c4009
  struct sockaddr *ifa_addr;	/* Network address of this interface.  */
Packit 6c4009
  struct sockaddr *ifa_netmask; /* Netmask of this interface.  */
Packit 6c4009
  union
Packit 6c4009
  {
Packit 6c4009
    /* At most one of the following two is valid.  If the IFF_BROADCAST
Packit 6c4009
       bit is set in `ifa_flags', then `ifa_broadaddr' is valid.  If the
Packit 6c4009
       IFF_POINTOPOINT bit is set, then `ifa_dstaddr' is valid.
Packit 6c4009
       It is never the case that both these bits are set at once.  */
Packit 6c4009
    struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */
Packit 6c4009
    struct sockaddr *ifu_dstaddr; /* Point-to-point destination address.  */
Packit 6c4009
  } ifa_ifu;
Packit 6c4009
  /* These very same macros are defined by <net/if.h> for `struct ifaddr'.
Packit 6c4009
     So if they are defined already, the existing definitions will be fine.  */
Packit 6c4009
# ifndef ifa_broadaddr
Packit 6c4009
#  define ifa_broadaddr	ifa_ifu.ifu_broadaddr
Packit 6c4009
# endif
Packit 6c4009
# ifndef ifa_dstaddr
Packit 6c4009
#  define ifa_dstaddr	ifa_ifu.ifu_dstaddr
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
  void *ifa_data;		/* Address-specific data (may be unused).  */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Create a linked list of `struct ifaddrs' structures, one for each
Packit 6c4009
   network interface on the host machine.  If successful, store the
Packit 6c4009
   list in *IFAP and return 0.  On errors, return -1 and set `errno'.
Packit 6c4009
Packit 6c4009
   The storage returned in *IFAP is allocated dynamically and can
Packit 6c4009
   only be properly freed by passing it to `freeifaddrs'.  */
Packit 6c4009
extern int getifaddrs (struct ifaddrs **__ifap) __THROW;
Packit 6c4009
Packit 6c4009
/* Reclaim the storage allocated by a previous `getifaddrs' call.  */
Packit 6c4009
extern void freeifaddrs (struct ifaddrs *__ifa)  __THROW;
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif /* ifaddrs.h */