Timestamp:
May 19, 2003, 4:41:00 AM (23 years ago)
Author:
bird
Message:

#434: Initial tcpip header merges.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/net/if.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modifed for emx by hv 1994,1996
     2
    23 *
    34 * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
     
    4344#endif
    4445
     46
     47
     48
     49
     50
    4551/*
    4652 * Structures defining a network interface, providing a packet
     
    6773 * interfaces.  These routines live in the files if.c and route.c
    6874 */
    69 /*  XXX fast fix for SNMP, going away soon */
    70 #include <sys/time.h>
    71 
    72 #ifdef TCPIPV4
    73 #pragma pack(1)
    74 #else
    75 #pragma pack(4)
    76 #endif
    77 
    7875
    7976/*
     
    8279 * (Would like to call this struct ``if'', but C isn't PL/1.)
    8380 */
    84 /*forward*/ struct mbuf;
    85 /*forward*/ struct ifaddr;
     81#pragma pack(1)
     82struct mbuf;
     83struct ifaddr;
    8684struct ifnet {
    8785        char    *if_name;               /* name, e.g. ``en'' or ``lo'' */
     
    9593                struct  mbuf *ifq_head;
    9694                struct  mbuf *ifq_tail;
    97 #ifndef TCPIPV4
    98                 int     ifq_len;
    99                 int     ifq_maxlen;
    100                 int     ifq_drops;
    101 #else
    10295                short   ifq_len;
    10396                short   ifq_maxlen;
    10497                u_short ifq_drops;
    105 #endif
    10698        } if_snd;                       /* output queue */
    10799/* procedure handles */
     
    112104        int     (*if_watchdog)(void);   /* timer routine */
    113105/* generic interface statistics */
    114 #ifndef TCPIPV4
    115         int     if_ipackets;            /* packets received on interface */
    116         int     if_ierrors;             /* input errors on interface */
    117         int     if_opackets;            /* packets sent on interface */
    118         int     if_oerrors;             /* output errors on interface */
    119         int     if_collisions;          /* collisions on csma interfaces */
    120 #else
    121106        u_short if_ipackets;            /* packets received on interface */
    122107        u_short if_ierrors;             /* input errors on interface */
     
    124109        u_short if_oerrors;             /* output errors on interface */
    125110        u_short if_collisions;          /* collisions on csma interfaces */
    126 #endif
    127111/* end statistics */
    128112        struct  ifnet *if_next;
    129113
     114
    130115/* the following structures are special for OS/2 TCP/IP only */
    131116        u_char  if_adapternum;          /* adapter number */
     
    134119        u_long  if_speed;
    135120
    136 #define IF_RTTSCALE     1000
    137         u_short if_rtt;                 /* Est interface rtt in ms */
    138         u_short if_rttvar;              /* Est interface rttvar in ms */
    139         u_short if_rttmin;              /* Fixed interface rttmin in ms */
    140         u_short if_sendpipe;            /* Send socket buffer/window size */
    141         u_short if_recvpipe;            /* Recv socket buffer/window size */
    142         u_short if_ssthresh;            /* Gateway buffer limit (slow strt) */
    143 #ifdef TCPIPV4
    144         u_long  if_eflags;              /* Extended flags */
    145         struct ifqueue if_traceq;       /* packet trace queue */
    146         u_short if_segsize;             /* segment size for interface */
    147         u_short if_use576;              /* use 576 or 1460 as def. mss if */
    148                                         /* going through a router */
    149         u_short if_rfc1469;             /* using broadcast or functional */
    150                                         /* addr for IP Multicast */
    151 #define IFF_RFC1469_BC  1               /* use broadcast */
    152 #define IFF_RFC1469_FA  2               /* use functional address */
    153 #define IFF_RFC1469_MA  3               /* use multicast address */
    154 #endif
    155 };
    156 
    157 #ifndef TCPIPV4
    158 struct ifmib {
    159         int     ifNumber;               /* number of network interfaces */
    160         struct iftable {
    161                 int     ifIndex;        /* index of this interface */
    162                 char    ifDescr[45];    /* description */
    163                 int     ifType;         /* type of the interface */
    164                 int     ifMtu;          /* MTU of the interface */
    165                 char    ifPhysAddr[6];  /* MTU of the interface */
    166                 int     ifOperStatus;
    167                 u_long  ifSpeed;
    168                 u_long  ifLastChange;
    169                 u_long  ifInOctets;
    170                 u_long  ifOutOctets;
    171                 u_long  ifOutDiscards;
    172                 u_long  ifInDiscards;
    173                 u_long  ifInErrors;
    174                 u_long  ifOutErrors;
    175                 u_long  ifInUnknownProtos;
    176                 u_long  ifInUcastPkts;
    177                 u_long  ifOutUcastPkts;
    178                 u_long  ifInNUcastPkts;
    179                 u_long  ifOutNUcastPkts;
    180         } iftable[20];
    181 };
    182 #else /* TCP/IP V4 */
     121        /* Interface TCP estimates/controls.  Serves the same */
     122        /* purpose as the per-route values in BSD-Reno, but I didn't */
     123        /* have to touch any of the route manipulation code.         */
     124        u_short if_rtt;                 /* Est interface rtt in ms */
     125        u_short if_rttvar;              /* Est interface rttvar in ms */
     126        u_short if_rttmin;              /* Fixed interface rttmin in ms */
     127        u_short if_sendpipe;            /* Send socket buffer/window size */
     128        u_short if_recvpipe;            /* Recv socket buffer/window size */
     129        u_short if_ssthresh;            /* Gateway buffer limit (slow strt) */
     130        u_long  if_eflags;              /* Extended Flags */
     131        struct ifqueue if_traceq;       /* packet trace queue */
     132        u_short if_segsize;             /* segment size for interface*/
     133        u_short if_use576;              /* use 576 or 1460 as def. mss if going thru a router */
     134        /* Token Ring IP multicast flag */
     135        u_short if_rfc1469;             /* using broadcast or functional address */
     136                                        /* for IP Mulitcast */
     137#define IF_RTTSCALE 1000
     138#endif /* __OS2__ */
     139};
     140#pragma pack()
     141#endif /*TCPV40HDRS*/
    183142
    184143#ifndef IFMIB_ENTRIES
     
    186145#endif
    187146
     147
     148
    188149struct ifmib {
    189150        short   ifNumber;               /* number of network interfaces */
     
    210171        } iftable[IFMIB_ENTRIES];
    211172};
    212 #endif /* TCP/IP V4 */
    213 #pragma pack()
     173#pragma pack()
     174
     175#else /*TCPV40HDRS*/
     176
     177#pragma pack(1) /* force on doubleword boundary */
     178struct iftable {
     179    short  iftIndex;        /* index of this interface */
     180    char   iftDescr[45];    /* description             */
     181    short  iftType;         /* type of the interface   */
     182    short  iftMtu;          /* MTU of the interface   */
     183    char   iftPhysAddr[6];  /* MTU of the interface   */
     184    short  iftOperStatus;
     185    u_long iftSpeed;
     186    u_long iftLastChange;
     187    u_long iftInOctets;
     188    u_long iftOutOctets;
     189    u_long iftOutDiscards;
     190    u_long iftInDiscards;
     191    u_long iftInErrors;
     192    u_long iftOutErrors;
     193    u_long iftInUnknownProtos;
     194    u_long iftInUcastPkts;
     195    u_long iftOutUcastPkts;
     196    u_long iftInNUcastPkts;
     197    u_long iftOutNUcastPkts;
     198};
     199struct ifmib {
     200    short ifNumber;
     201    struct iftable iftable[IFMIB_ENTRIES];
     202};
     203#pragma pack()   /* reset to default packing */
     204
     205#define IFC_ALLRTSBCAST    0x0001
     206#define IFC_802_3          0x0002
     207#define IFC_FDDI           0x0004
     208#define IFC_NOREDIR        0x0010
     209
     210#define OPERSTATUS_UP      0x1
     211#define OPERSTATUS_DOWN    0x2
     212#define OPERSTATUS_TESTING 0x3
     213#endif /*TCPV40HDRS*/
    214214
    215215#define IFF_UP          0x1             /* interface is up */
     
    219219#define IFF_POINTOPOINT 0x10            /* interface is point-to-point link */
    220220#define IFF_NOTRAILERS  0x20            /* avoid use of trailers */
     221
     222
     223
    221224#define IFF_RUNNING     0x40            /* resources allocated */
    222225#define IFF_NOARP       0x80            /* no address resolution protocol */
    223 /* next two not supported now, but reserved: */
    224226#define IFF_PROMISC     0x100           /* receive all packets */
    225227#define IFF_ALLMULTI    0x200           /* receive all multicast packets */
    226 #define IFF_OACTIVE     0x400           /* transmission in progress */
    227 #define IFF_SIMPLEX     0x800           /* can't hear own transmissions */
     228#define IFF_DEFMTU      0x400           /* default mtu of 1500 */
     229#define IFF_MULTICAST   0x800           /* supports multicast */
     230/*
     231 * The IFF_MULTICAST flag indicates that the network can support the
     232 * transmission and reception of higher-level (e.g., IP) multicast packets.
     233 * It is independent of hardware support for multicasting; for example,
     234 * point-to-point links or pure broadcast networks may well support
     235 * higher-level multicasts.
     236 */
    228237#define IFF_BRIDGE      0x1000          /* support token ring routine field */
    229 #define IFF_SNAP        0x2000          /* support extended SNAP header */
     238#define IFF_SNAP        0x2000          /* support extended SAP header */
    230239#define IFF_ETHER       0x4000          /* ethernet interface */
    231240#define IFF_LOOPBRD     0x8000          /* ethernet interface */
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
    232252
    233253/*hv: flags set internally only */
    234 #ifdef BSD_TCPCOMPAT
     254#ifdef TCPV40HDRS
     255#define IFF_CANTCHANGE  (IFF_BROADCAST | IFF_POINTOPOINT | IFF_RUNNING)
     256#else
    235257#define IFF_CANTCHANGE \
    236258        (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE| \
    237         IFF_SIMPLEX|IFF_MULTICAST)
    238 #else
    239 #define IFF_CANTCHANGE  (IFF_BROADCAST | IFF_POINTOPOINT | IFF_RUNNING)
    240 #endif
    241 
    242 #ifdef TCPIPV4
     259            IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI)
     260#endif
     261
    243262/* packet tracing extension */
    244263#define IFFE_PKTTRACE   0x00000001      /* trace datalink where possible */
    245264#define IFFE_IPTRACE    0x00000002      /* trace ONLY IP packets */
    246265
     266
     267
     268
    247269struct pkt_trace_hdr {
    248270        u_short         pt_htype;       /* header type */
    249 #define         HT_IP           0x01    /*      IP */
    250 #define         HT_ETHER        0x06    /*      Ethernet */
    251 #define         HT_ISO88023     0x07    /*      CSMA CD */
    252 #define         HT_ISO88025     0x09    /*      Token Ring */
    253 #define         HT_SLIP         0x1c    /*      Serial Line IP */
    254 #define         HT_PPP          0x18    /*      PPP IP */
    255271        u_short         pt_len;         /* in: pt_buf len, out: packet len */
    256272        caddr_t         pt_data;        /* packet ATTN: This is a _Seg16 addr! */
    257273        u_long          pt_tstamp;      /* time stamp in milliseconds */
    258274};
    259 
    260 #endif /* TCP/IP V4 */
    261 
     275#ifndef TCPV40HDRS
     276#pragma pack()
     277#endif
     278#define HT_IP           0x01 /* IP */
     279#define HT_ETHER        0x06 /* Ethernet */
     280#define HT_ISO88023     0x07 /* CSMA CD */
     281#define HT_ISO88025     0x09 /* Token Ring */
     282#define HT_SLIP         0x1c /* Serial Line IP */
     283#define HT_PPP          0x18 /* PPP IP */
     284
     285#ifndef TCPV40HDRS
     286/* genric interface information */
     287#pragma pack(1)
     288struct  if_data {
     289                u_char  ifi_type;       /* ethernet, tokenring, etc */
     290                u_char  ifi_addrlen;    /* media address length */
     291                u_char  ifi_hdrlen;     /* media header length */
     292                u_long  ifi_mtu;        /* maximum transmission unit */
     293                u_long  ifi_metric;     /* routing metric (external only) */
     294                u_long  ifi_baudrate;   /* linespeed */
     295                                        /* volatile statistics */
     296                u_long  ifi_collisions; /* collisions on csma interfaces */
     297                u_long  ifi_ibytes;     /* total number of octets received */
     298                u_long  ifi_obytes;     /* total number of octets sent */
     299                u_long  ifi_oqdrops;    /* dropped on output, this interface */
     300                u_long  ifi_iqdrops;    /* dropped on input, this interface */
     301                u_long  ifi_ierrors;    /* input errors on interface */
     302                u_long  ifi_oerrors;    /* output errors on interface */
     303                u_long  ifi_noproto;    /* destined for unsupported protocol */
     304                u_long  ifi_ipackets;   /* packets received on interface */
     305                u_long  ifi_opackets;   /* packets sent on interface */
     306                u_long  ifi_imcasts;    /* packets received via multicast */
     307                u_long  ifi_omcasts;    /* packets sent via multicast */
     308                short   ifi_OperStatus; /* SNMP Oper Status */
     309                struct  timeval ifi_lastchange;/* last updated */
     310                u_char  ifi_descr[45];  /* description of the interface */
     311};
     312#pragma pack()
     313
     314/*
     315 * Message format for use in obtaining information about interfaces
     316 * from getkerninfo and the routing socket
     317 */
     318#pragma pack(1)
     319struct if_msghdr {
     320        u_short ifm_msglen;     /* to skip over non-understood messages */
     321        u_char  ifm_version;    /* future binary compatability */
     322        u_char  ifm_type;       /* message type */
     323        int     ifm_addrs;      /* like rtm_addrs */
     324        int     ifm_flags;      /* value of if_flags */
     325        u_short ifm_index;      /* index for associated ifp */
     326        struct  if_data ifm_data;/* statistics and other data about if */
     327};
     328#pragma pack()
     329
     330/*
     331 * Message format for use in obtaining information about interface addresses
     332 * from getkerninfo and the routing socket
     333 */
     334#pragma pack(1)
     335struct ifa_msghdr {
     336        u_short ifam_msglen;    /* to skip over non-understood messages */
     337        u_char  ifam_version;   /* future binary compatability */
     338        u_char  ifam_type;      /* message type */
     339        int     ifam_addrs;     /* like rtm_addrs */
     340        int     ifam_flags;     /* value of ifa_flags */
     341        u_short ifam_index;     /* index for associated ifp */
     342        int     ifam_metric;    /* value of ifa_metric */
     343};
     344#pragma pack()
     345#endif /*!TCPV40HDRS*/
     346
     347#ifdef TCPV40HDRS
    262348/*
    263349 * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
     
    284370        (ifq)->ifq_len++;\
    285371}
    286 #define IF_DEQUEUE(ifq, m) {\
    287         (m)=(ifq)->ifq_head;\
    288         if (m) {\
    289                 if (((ifq)->ifq_head=(m)->m_act)==0)\
    290                         (ifq)->ifq_tail=0;\
    291                 (m)->m_act=0;\
    292                 (ifq)->ifq_len--;\
    293         }\
    294 }
     372/*
     373 * Packets destined for level-1 protocol input routines
     374 * have a pointer to the receiving interface prepended to the data.
     375 * IF_DEQUEUEIF extracts and returns this pointer when dequeueing the packet.
     376 * IF_ADJ should be used otherwise to adjust for its presence.
     377 */
    295378#define IF_ADJ(m) {\
    296379        (m)->m_off+=sizeof(struct ifnet*);\
     
    313396        }\
    314397}
     398
     399
     400
     401
     402
     403
     404
     405
     406
    315407
    316408#define IFQ_MAXLEN      50
     
    334426        struct ifaddr   *ifa_next;              /* next address for interface */
    335427};
     428
    336429
    337430/*
     
    341434 * remainder may be interface specific.
    342435 */
     436
     437
     438
    343439struct  ifreq {
    344440#define IFNAMSIZ        16
     
    358454#define ifr_metric      ifr_ifru.ifru_metric    /* metric */
    359455#define ifr_data        ifr_ifru.ifru_data      /* for use by interface */
    360 };
     456#ifndef TCPV40HDRS
     457#define ifr_eflags      ifr_ifru.ifru_data      /* Extended flags */
     458#endif
     459};
     460#ifndef TCPV40HDRS
     461#pragma pack()
     462#endif
     463
     464#ifndef TCPV40HDRS
     465#pragma pack(1)
     466struct ifaliasreq {
     467  char    ifra_name[IFNAMSIZ];            /* if name, e.g. "en0" */
     468  struct  sockaddr ifra_addr;
     469  struct  sockaddr ifra_broadaddr;
     470  struct  sockaddr ifra_mask;
     471};
     472#pragma pack()
     473#endif
    361474
    362475/*
     
    366479 * must know all networks accessible).
    367480 */
     481
     482
     483
    368484struct  ifconf {
    369485        int     ifc_len;                /* size of associated buffer */
     
    375491#define ifc_req ifc_ifcu.ifcu_req       /* array of structures returned */
    376492};
     493
     494
     495
    377496
    378497#include <net/if_arp.h>
     
    382501#endif
    383502
     503
     504
     505
     506
     507
     508
     509
     510
     511
     512
     513
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
     527
     528
     529
     530
     531
     532
     533
     534
     535
     536
     537
     538
     539
     540
     541
     542
     543
     544
     545
     546
     547
     548
     549
    384550#endif /* _NET_IF_H_ */
Note: See TracChangeset for help on using the changeset viewer.