root/include/linux/if.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * INET         An implementation of the TCP/IP protocol suite for the LINUX
   3  *              operating system.  INET is implemented using the  BSD Socket
   4  *              interface as the means of communication with the user level.
   5  *
   6  *              Global definitions for the INET interface module.
   7  *
   8  * Version:     @(#)if.h        1.0.2   04/18/93
   9  *
  10  * Authors:     Original taken from Berkeley UNIX 4.3, (c) UCB 1982-1988
  11  *              Ross Biro, <bir7@leland.Stanford.Edu>
  12  *              Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  13  *
  14  *              This program is free software; you can redistribute it and/or
  15  *              modify it under the terms of the GNU General Public License
  16  *              as published by the Free Software Foundation; either version
  17  *              2 of the License, or (at your option) any later version.
  18  */
  19 #ifndef _LINUX_IF_H
  20 #define _LINUX_IF_H
  21 
  22 #include <linux/types.h>                /* for "caddr_t" et al          */
  23 #include <linux/socket.h>               /* for "struct sockaddr" et al  */
  24 
  25 /* Standard interface flags. */
  26 #define IFF_UP          0x1             /* interface is up              */
  27 #define IFF_BROADCAST   0x2             /* broadcast address valid      */
  28 #define IFF_DEBUG       0x4             /* turn on debugging            */
  29 #define IFF_LOOPBACK    0x8             /* is a loopback net            */
  30 #define IFF_POINTOPOINT 0x10            /* interface is has p-p link    */
  31 #define IFF_NOTRAILERS  0x20            /* avoid use of trailers        */
  32 #define IFF_RUNNING     0x40            /* resources allocated          */
  33 #define IFF_NOARP       0x80            /* no ARP protocol              */
  34 
  35 /* These are not yet used: */
  36 #define IFF_PROMISC     0x100           /* recve all packets            */
  37 #define IFF_ALLMULTI    0x200           /* recve all multicast packets  */
  38 
  39 
  40 /*
  41  * The ifaddr structure contains information about one address
  42  * of an interface.  They are maintained by the different address
  43  * families, are allocated and attached when an address is set,
  44  * and are linked together so all addresses for an interface can
  45  * be located.
  46  */
  47 struct ifaddr {
  48   struct sockaddr       ifa_addr;       /* address of interface         */
  49   union {
  50         struct sockaddr ifu_broadaddr;
  51         struct sockaddr ifu_dstaddr;
  52   } ifa_ifu;
  53   struct iface          *ifa_ifp;       /* back-pointer to interface    */
  54   struct ifaddr         *ifa_next;      /* next address for interface   */
  55 };
  56 #define ifa_broadaddr   ifa_ifu.ifu_broadaddr   /* broadcast address    */
  57 #define ifa_dstaddr     ifa_ifu.ifu_dstaddr     /* other end of link    */
  58 
  59 /*
  60  * Interface request structure used for socket
  61  * ioctl's.  All interface ioctl's must have parameter
  62  * definitions which begin with ifr_name.  The
  63  * remainder may be interface specific.
  64  */
  65 struct ifreq {
  66 #define IFHWADDRLEN     6
  67 #define IFNAMSIZ        16
  68         union
  69         {
  70                 char    ifrn_name[IFNAMSIZ];            /* if name, e.g. "en0" */
  71                 char    ifrn_hwaddr[IFHWADDRLEN];       /* Obsolete */
  72         } ifr_ifrn;
  73         
  74         union {
  75                 struct  sockaddr ifru_addr;
  76                 struct  sockaddr ifru_dstaddr;
  77                 struct  sockaddr ifru_broadaddr;
  78                 struct  sockaddr ifru_netmask;
  79                 struct  sockaddr ifru_hwaddr;
  80                 short   ifru_flags;
  81                 int     ifru_metric;
  82                 int     ifru_mtu;
  83                 caddr_t ifru_data;
  84         } ifr_ifru;
  85 };
  86 
  87 #define ifr_name        ifr_ifrn.ifrn_name      /* interface name       */
  88 #define old_ifr_hwaddr  ifr_ifrn.ifrn_hwaddr    /* interface hardware   */
  89 #define ifr_hwaddr      ifr_ifru.ifru_hwaddr    /* MAC address          */
  90 #define ifr_addr        ifr_ifru.ifru_addr      /* address              */
  91 #define ifr_dstaddr     ifr_ifru.ifru_dstaddr   /* other end of p-p lnk */
  92 #define ifr_broadaddr   ifr_ifru.ifru_broadaddr /* broadcast address    */
  93 #define ifr_netmask     ifr_ifru.ifru_netmask   /* interface net mask   */
  94 #define ifr_flags       ifr_ifru.ifru_flags     /* flags                */
  95 #define ifr_metric      ifr_ifru.ifru_metric    /* metric               */
  96 #define ifr_mtu         ifr_ifru.ifru_mtu       /* mtu                  */
  97 #define ifr_data        ifr_ifru.ifru_data      /* for use by interface */
  98 
  99 /*
 100  * Structure used in SIOCGIFCONF request.
 101  * Used to retrieve interface configuration
 102  * for machine (useful for programs which
 103  * must know all networks accessible).
 104  */
 105 struct ifconf {
 106         int     ifc_len;                        /* size of buffer       */
 107         union {
 108                 caddr_t ifcu_buf;
 109                 struct  ifreq *ifcu_req;
 110         } ifc_ifcu;
 111 };
 112 #define ifc_buf ifc_ifcu.ifcu_buf               /* buffer address       */
 113 #define ifc_req ifc_ifcu.ifcu_req               /* array of structures  */
 114 
 115 
 116 /* BSD UNIX expects to find these here, so here we go: */
 117 #include <linux/if_arp.h>
 118 #include <linux/route.h>
 119 
 120 #endif /* _NET_IF_H */

/* [previous][next][first][last][top][bottom][index][help] */