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 #define IFF_PROMISC     0x100           /* recve all packets            */
  35 /* These are not yet used: */
  36 #define IFF_ALLMULTI    0x200           /* recve all multicast packets  */
  37 
  38 #define IFF_MASTER      0x400           /* master of a load balancer    */
  39 #define IFF_SLAVE       0x800           /* slave of a load balancer     */
  40 
  41 /*
  42  * The ifaddr structure contains information about one address
  43  * of an interface.  They are maintained by the different address
  44  * families, are allocated and attached when an address is set,
  45  * and are linked together so all addresses for an interface can
  46  * be located.
  47  */
  48 struct ifaddr {
  49   struct sockaddr       ifa_addr;       /* address of interface         */
  50   union {
  51         struct sockaddr ifu_broadaddr;
  52         struct sockaddr ifu_dstaddr;
  53   } ifa_ifu;
  54   struct iface          *ifa_ifp;       /* back-pointer to interface    */
  55   struct ifaddr         *ifa_next;      /* next address for interface   */
  56 };
  57 #define ifa_broadaddr   ifa_ifu.ifu_broadaddr   /* broadcast address    */
  58 #define ifa_dstaddr     ifa_ifu.ifu_dstaddr     /* other end of link    */
  59 
  60 /*
  61  *      Device mapping structure. I'd just gone off and designed a 
  62  *      beautiful scheme using only loadable modules with arguments
  63  *      for driver options and along come the PCMCIA people 8)
  64  *
  65  *      Ah well. The get() side of this is good for WDSETUP, and it'll
  66  *      be handy for debugging things. The set side is fine for now and
  67  *      being very small might be worth keeping for clean configuration.
  68  */
  69 
  70 struct ifmap {
  71         unsigned long mem_start;
  72         unsigned long mem_end;
  73         unsigned short base_addr; 
  74         unsigned char irq;
  75         unsigned char dma;
  76         unsigned char port;
  77         /* 3 bytes spare */
  78 };
  79 
  80 /*
  81  * Interface request structure used for socket
  82  * ioctl's.  All interface ioctl's must have parameter
  83  * definitions which begin with ifr_name.  The
  84  * remainder may be interface specific.
  85  */
  86 struct ifreq {
  87 #define IFHWADDRLEN     6
  88 #define IFNAMSIZ        16
  89         union
  90         {
  91                 char    ifrn_name[IFNAMSIZ];            /* if name, e.g. "en0" */
  92                 char    ifrn_hwaddr[IFHWADDRLEN];       /* Obsolete */
  93         } ifr_ifrn;
  94         
  95         union {
  96                 struct  sockaddr ifru_addr;
  97                 struct  sockaddr ifru_dstaddr;
  98                 struct  sockaddr ifru_broadaddr;
  99                 struct  sockaddr ifru_netmask;
 100                 struct  sockaddr ifru_hwaddr;
 101                 short   ifru_flags;
 102                 int     ifru_metric;
 103                 int     ifru_mtu;
 104                 struct  ifmap ifru_map;
 105                 char    ifru_slave[IFNAMSIZ];   /* Just fits the size */
 106                 caddr_t ifru_data;
 107         } ifr_ifru;
 108 };
 109 
 110 #define ifr_name        ifr_ifrn.ifrn_name      /* interface name       */
 111 #define old_ifr_hwaddr  ifr_ifrn.ifrn_hwaddr    /* interface hardware   */
 112 #define ifr_hwaddr      ifr_ifru.ifru_hwaddr    /* MAC address          */
 113 #define ifr_addr        ifr_ifru.ifru_addr      /* address              */
 114 #define ifr_dstaddr     ifr_ifru.ifru_dstaddr   /* other end of p-p lnk */
 115 #define ifr_broadaddr   ifr_ifru.ifru_broadaddr /* broadcast address    */
 116 #define ifr_netmask     ifr_ifru.ifru_netmask   /* interface net mask   */
 117 #define ifr_flags       ifr_ifru.ifru_flags     /* flags                */
 118 #define ifr_metric      ifr_ifru.ifru_metric    /* metric               */
 119 #define ifr_mtu         ifr_ifru.ifru_mtu       /* mtu                  */
 120 #define ifr_map         ifr_ifru.ifru_map       /* device map           */
 121 #define ifr_slave       ifr_ifru.ifru_slave     /* slave device         */
 122 #define ifr_data        ifr_ifru.ifru_data      /* for use by interface */
 123 
 124 /*
 125  * Structure used in SIOCGIFCONF request.
 126  * Used to retrieve interface configuration
 127  * for machine (useful for programs which
 128  * must know all networks accessible).
 129  */
 130 struct ifconf {
 131         int     ifc_len;                        /* size of buffer       */
 132         union {
 133                 caddr_t ifcu_buf;
 134                 struct  ifreq *ifcu_req;
 135         } ifc_ifcu;
 136 };
 137 #define ifc_buf ifc_ifcu.ifcu_buf               /* buffer address       */
 138 #define ifc_req ifc_ifcu.ifcu_req               /* array of structures  */
 139 
 140 
 141 /* BSD UNIX expects to find these here, so here we go: */
 142 #include <linux/if_arp.h>
 143 #include <linux/route.h>
 144 
 145 #endif /* _NET_IF_H */

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