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

#434: Initial tcpip header merges.

Location:
trunk/src/emx/include/net
Files:
3 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 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
     
    4344#endif
    4445
     46/*  XXX fast fix for SNMP, going away soon */
     47#include <sys/time.h>
     48
     49
     50#ifdef TCPV40HDRS
    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#ifdef __OS2__
    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#ifdef TCPV40HDRS
     148#pragma pack(1)
    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#ifndef TCPV40HDRS
     222#define IFF_LINK2       IFF_NOTRAILERS  /* was trailers, not used */
     223#endif
    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#ifndef TCPV40HDRS
     242#define IFF_SIMPLEX     0x10000         /* can't hear own transmissions */
     243#define IFF_OACTIVE     0x20000         /* transmission in progress */
     244#define IFF_802_3       0x40000         /* */
     245#define IFF_CANONICAL   0x80000         /* */
     246#define IFF_RUNNINGBLK  0x100000        /* threads waited for intf running */
     247#endif
     248
     249#define IFF_RFC1469_BC 1  /* using broadcast */
     250#define IFF_RFC1469_FA 2  /* using functional address */
     251#define IFF_RFC1469_MA 3  /* using mulitcast address */
    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#ifndef TCPV40HDRS
     267#pragma pack(1)
     268#endif
    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#define IF_DEQUEUE(ifq, m) {\
     399        (m)=(ifq)->ifq_head;\
     400        if (m) {\
     401                if (((ifq)->ifq_head=(m)->m_act)==0)\
     402                        (ifq)->ifq_tail=0;\
     403                (m)->m_act=0;\
     404                (ifq)->ifq_len--;\
     405        }\
     406}
    315407
    316408#define IFQ_MAXLEN      50
     
    334426        struct ifaddr   *ifa_next;              /* next address for interface */
    335427};
     428#endif /*TCPV40HDRS*/
    336429
    337430/*
     
    341434 * remainder may be interface specific.
    342435 */
     436#ifndef TCPV40HDRS
     437#pragma pack(1)
     438#endif
    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#ifndef TCPV40HDRS
     482#pragma pack(1) /* paranoia I believe */
     483#endif
    368484struct  ifconf {
    369485        int     ifc_len;                /* size of associated buffer */
     
    375491#define ifc_req ifc_ifcu.ifcu_req       /* array of structures returned */
    376492};
     493#ifndef TCPV40HDRS
     494#pragma pack()
     495#endif
    377496
    378497#include <net/if_arp.h>
     
    382501#endif
    383502
     503#ifndef TCPV40HDRS
     504#include <netinet/in.h>
     505
     506#pragma pack(1)
     507struct  in_aliasreq {
     508        char    ifra_name[IFNAMSIZ];            /* if name, e.g. "en0" */
     509        struct  sockaddr_in ifra_addr;
     510        struct  sockaddr_in ifra_broadaddr;
     511#define ifra_dstaddr ifra_broadaddr
     512        struct  sockaddr_in ifra_mask;
     513};
     514#pragma pack()
     515
     516#pragma pack(1)
     517struct  addrreq  {                              /* get multicast addresses */
     518        char    ifr_name[IFNAMSIZ];
     519        struct  sockaddr ifr_addrs;
     520        u_long  maddr[MAX_IN_MULTI];
     521};
     522#pragma pack()
     523
     524#pragma pack(1)
     525struct  statatreq {
     526        u_long addr;
     527        short interface;
     528        u_long mask;
     529        u_long broadcast;
     530};
     531#pragma pack()
     532
     533/* PPP statistics table. Moved here from previous ifstat.h */
     534struct ifstat {
     535    u_long iftLastChange;
     536    u_long iftInOctets;
     537    u_long iftOutOctets;
     538    u_long iftOutDiscards;
     539    u_long iftInDiscards;
     540    u_long iftInErrors;
     541    u_long iftOutErrors;
     542    u_long iftInUnknownProtos;
     543    u_long iftInUcastPkts;
     544    u_long iftOutUcastPkts;
     545    u_long iftInNUcastPkts;
     546    u_long iftOutNUcastPkts;
     547};
     548#endif /*!TCPV40HDRS*/
     549
    384550#endif /* _NET_IF_H_ */
  • trunk/src/emx/include/net/if_arp.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv 1994,1996
     2 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1986 Regents of the University of California.
     
    4950 * specified.  Field names used correspond to RFC 826.
    5051 */
     52#ifndef TCPV40HDR
     53#pragma pack(1)
     54#endif
    5155struct  arphdr {
    5256        u_short ar_hrd;         /* format of hardware address */
    5357#define ARPHRD_ETHER    1       /* ethernet hardware address */
    5458#define ARPHRD_802      6       /* 802 net hardware address */
     59#ifndef TCPV40HDRS
     60#define ARPHRD_FRELAY   15      /* frame relay hardware format */
     61#endif
    5562        u_short ar_pro;         /* format of protocol address */
    5663        u_char  ar_hln;         /* length of hardware address */
     
    5966#define ARPOP_REQUEST   1       /* request to resolve address */
    6067#define ARPOP_REPLY     2       /* response to previous request */
     68#ifndef TCPV40HDRS
     69#define ARPOP_REVREQUEST 3      /* request protocol address given hardware */
     70#define ARPOP_REVREPLY   4      /* response giving protocol address */
     71#define ARPOP_INVREQUEST 8      /* request to identify peer */
     72#define ARPOP_INVREPLY   9      /* response identifying peer */
     73#endif
     74#if 0 /* not OS/2 */
    6175#define REVARP_REQUEST  3       /* reverse ARP request (not IBM) */
    6276#define REVARP_REPLY    4       /* reverse ARP reply (not IBM) */
     77#endif
    6378/*
    6479 * The remaining fields are variable in size,
     
    7085/*      u_char  ar_tpa[];        * target protocol address */
    7186};
     87#ifndef TCPV40HDRS
     88#pragma pack()
     89#endif
    7290
    7391/*
    7492 * ARP ioctl request
    7593 */
     94#ifndef TCPV40HDRS
     95#pragma pack(4)
     96#endif
    7697struct arpreq {
    7798        struct  sockaddr arp_pa;                /* protocol address */
     
    79100        int     arp_flags;                      /* flags */
    80101};
     102#ifndef TCPV40HDRS
     103#pragma pack()
     104#endif
     105
     106#ifndef TCPV40HDRS
     107/*
     108 * Token ring ARP ioctl request
     109 */
     110#pragma pack(4)
     111struct arpreq_tr {
     112        struct  sockaddr arp_pa;                /* protocol address */
     113        struct  sockaddr arp_ha;                /* hardware address */
     114        long    arp_flags;                     /* flags */
     115        u_short arp_rcf;                        /* token ring routing control field */
     116        u_short arp_rseg[8];                    /* token ring routing segments */
     117};
     118#endif /*!TCPV40HDRS*/
     119
     120
    81121/*  arp_flags and at_flags field values */
    82122#define ATF_INUSE       0x01    /* entry in use */
     
    85125#define ATF_PUBL        0x08    /* publish entry (respond for other host) */
    86126#define ATF_USETRAILERS 0x10    /* has requested trailers */
     127#ifndef TCPV40HDRS
     128#define ATF_802_3       0x20    /* sender's ether if set to 802.3 */
     129#endif
    87130
    88131#endif /* !_NET_IF_ARP_H_ */
  • trunk/src/emx/include/net/route.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv and em 1994,1996
    2  *
     2 * Modified for gcc/os2 by bird 2003
     3 *
    34 * Copyright (c) 1980, 1986 Regents of the University of California.
    45 * All rights reserved.
     
    4748/*
    4849 * Kernel resident routing tables.
    49  * 
     50 *
    5051 * The routing tables are initialized when interface addresses
    5152 * are set by making entries for all directly connected interfaces.
     
    6263};
    6364
     65
     66#ifndef TCPV40HDRS
     67/*
     68 * These numbers are used by reliable protocols for determining
     69 * retransmission behavior and are included in the routing structure.
     70 */
     71struct rt_metrics {
     72        u_long  rmx_locks;      /* Kernel must leave these values alone */
     73        u_long  rmx_mtu;        /* MTU for this path */
     74        u_long  rmx_hopcount;   /* max hops expected */
     75        u_long  rmx_expire;     /* lifetime for route, e.g. redirect */
     76        u_long  rmx_recvpipe;   /* inbound delay-bandwith product */
     77        u_long  rmx_sendpipe;   /* outbound delay-bandwith product */
     78        u_long  rmx_ssthresh;   /* outbound gateway buffer limit */
     79        u_long  rmx_rtt;        /* estimated round trip time */
     80        u_long  rmx_rttvar;     /* estimated rtt variance */
     81        u_long  rmx_pksent;     /* packets sent using this route */
     82        u_long  rmx_filler[4];  /* will be used for T/TCP later */
     83};
     84
    6485/*
    6586 * rmx_rtt and rmx_rttvar are stored as microseconds;
     
    6990#define RTM_RTTUNIT     1000000 /* units for rtt, rttvar, as units per sec */
    7091#define RTTTOPRHZ(r)    ((r) / (RTM_RTTUNIT / PR_SLOWHZ))
     92#endif /* !TCPV40HDRS */
     93
    7194
    7295/*
     
    80103 * Following structure necessary for 4.3 compatibility;
    81104 */
    82 struct rtentry {
     105#pragma pack(1)
     106#ifdef TCPV40HDRS
     107struct rtentry
     108#else
     109struct ortentry
     110#endif
     111{
    83112        u_long  rt_hash;                /* to speed lookups */
    84113        struct  sockaddr rt_dst;        /* key */
     
    90119        long metric1,metric2,metric3,metric4; /*IBM special */
    91120};
    92 
    93 #define RTF_UP          0x1             /* route useable */
     121#pragma pack()
     122
     123/* IBM: hv: I think this is the internal structure of the RT table of the
     124 * router daemon. Don't think it belongs here, but the toolkit has it as well
     125 */
     126#define RTENTRY_COUNT   512
     127#pragma pack(1)
     128struct rtentries {
     129        short   hostcount;
     130        short   netcount;
     131        #ifdef TCPV40HDRS
     132        struct rtentry  rttable[RTENTRY_COUNT];
     133        #else
     134        struct ortentry rttable[RTENTRY_COUNT];
     135        #endif
     136};
     137#pragma pack()
     138
     139
     140#define RTF_UP          0x1             /* route usable */
    94141#define RTF_GATEWAY     0x2             /* destination is a gateway */
    95142#define RTF_HOST        0x4             /* host entry (net otherwise) */
     
    104151#define RTF_STATIC      0x800           /* route manually added */
    105152#define RTF_BLACKHOLE   0x1000          /* discard packets during updates */
     153#ifndef TCPV40HDRS
     154#define RTF_LLTEMP      0x2000          /* manually added temporary arp entry */
     155#endif
    106156#define RTF_PROTO2      0x4000          /* protocol specific routing flag */
    107157#define RTF_PROTO1      0x8000          /* protocol specific routing flag */
     158#ifndef TCPV40HDRS
     159#define RTF_PRCLONING   0x10000         /* protocol requires cloning */
     160#define RTF_WASCLONED   0x20000         /* route generated through cloning */
     161#define RTF_PROTO3      0x40000         /* protocol specific routing flag */
     162#define RTF_CHAINDELETE 0x80000         /* chain is being deleted (internal) */
     163#define RTF_PINNED      0x100000        /* future use */
     164#define RTF_TUNNEL      0x200000        /* tunnelling bit */
     165#define RTF_CRYPT       0x400000        /* encrypting tunnel */
     166#define RTF_AUTH        0x800000        /* authenticating tunnel */
     167#endif
    108168
    109169
     
    118178        short   rts_wildcard;           /* lookups satisfied by a wildcard */
    119179};
     180#ifndef TCPV40HDRS
    120181/*
    121182 * Structures for routing messages.
    122183 */
    123 #ifndef __EMX__
     184#pragma pack(1)
    124185struct rt_msghdr {
    125         u_short rtm_msglen;     /* to skip over non-understood messages */
    126         u_char  rtm_version;    /* future binary compatability */
    127         u_char  rtm_type;       /* message type */
    128         u_short rtm_index;      /* index for associated ifp */
    129         pid_t   rtm_pid;        /* identify sender */
    130         int     rtm_addrs;      /* bitmask identifying sockaddrs in msg */
    131         int     rtm_seq;        /* for sender to identify action */
    132         int     rtm_errno;      /* why failed */
    133         int     rtm_flags;      /* flags, incl. kern & message, e.g. DONE */
    134         int     rtm_use;        /* from rtentry */
    135         u_long  rtm_inits;      /* which metrics we are initializing */
    136         struct  rt_metrics rtm_rmx; /* metrics themselves */
     186#define IFNAMSIZ        16
     187        u_short rtm_msglen;     /* to skip over non-understood messages */
     188        u_char  rtm_version;    /* future binary compatibility */
     189        u_char  rtm_type;       /* message type */
     190        u_short rtm_index;      /* index for associated ifp */
     191        short   rtm_unit;       /* new field for subnet routing */
     192        int     rtm_flags;      /* flags, incl. kern & message, e.g. DONE */
     193        int     rtm_addrs;      /* bitmask identifying sockaddrs in msg */
     194        pid_t   rtm_pid;        /* identify sender */
     195        int     rtm_seq;        /* for sender to identify action */
     196        int     rtm_errno;      /* why failed */
     197        int     rtm_use;        /* from rtentry */
     198        u_long  rtm_inits;      /* which metrics we are initializing */
     199        u_long  rtm_netmask;    /* new field for subnet routing */
     200        char    rtm_name[IFNAMSIZ]; /* new field for subnet routing */
     201        struct  rt_metrics rtm_rmx; /* metrics themselves */
     202};
     203#pragma pack()
     204
     205#define RTM_VERSION     4       /* Up the ante and ignore older versions */
     206
     207#define RTM_ADD         0x1     /* Add Route */
     208#define RTM_DELETE      0x2     /* Delete Route */
     209#define RTM_CHANGE      0x3     /* Change Metrics or flags */
     210#define RTM_GET         0x4     /* Report Metrics */
     211#define RTM_LOSING      0x5     /* Kernel Suspects Partitioning */
     212#define RTM_REDIRECT    0x6     /* Told to use different route */
     213#define RTM_MISS        0x7     /* Lookup failed on this address */
     214#define RTM_LOCK        0x8     /* fix specified metrics */
     215#define RTM_OLDADD      0x9     /* caused by SIOCADDRT */
     216#define RTM_OLDDEL      0xa     /* caused by SIOCDELRT */
     217#define RTM_RESOLVE     0xb     /* req to resolve dst to LL addr */
     218#define RTM_NEWADDR     0xc     /* address being added to iface */
     219#define RTM_DELADDR     0xd     /* address being removed from iface */
     220#define RTM_IFINFO      0xe     /* iface going up/down etc. */
     221
     222#define RTV_MTU         0x1     /* init or lock _mtu */
     223#define RTV_HOPCOUNT    0x2     /* init or lock _hopcount */
     224#define RTV_EXPIRE      0x4     /* init or lock _hopcount */
     225#define RTV_RPIPE       0x8     /* init or lock _recvpipe */
     226#define RTV_SPIPE       0x10    /* init or lock _sendpipe */
     227#define RTV_SSTHRESH    0x20    /* init or lock _ssthresh */
     228#define RTV_RTT         0x40    /* init or lock _rtt */
     229#define RTV_RTTVAR      0x80    /* init or lock _rttvar */
     230
     231/*
     232 * Bitmask values for rtm_addr.
     233 */
     234#define RTA_DST         0x1     /* destination sockaddr present */
     235#define RTA_GATEWAY     0x2     /* gateway sockaddr present */
     236#define RTA_NETMASK     0x4     /* netmask sockaddr present */
     237#define RTA_GENMASK     0x8     /* cloning mask sockaddr present */
     238#define RTA_IFP         0x10    /* interface name sockaddr present */
     239#define RTA_IFA         0x20    /* interface addr sockaddr present */
     240#define RTA_AUTHOR      0x40    /* sockaddr for author of redirect */
     241#define RTA_BRD         0x80    /* for NEWADDR, broadcast or p-p dest addr */
     242
     243/*
     244 * Index offsets for sockaddr array for alternate internal encoding.
     245 */
     246#define RTAX_DST        0       /* destination sockaddr present */
     247#define RTAX_GATEWAY    1       /* gateway sockaddr present */
     248#define RTAX_NETMASK    2       /* netmask sockaddr present */
     249#define RTAX_GENMASK    3       /* cloning mask sockaddr present */
     250#define RTAX_IFP        4       /* interface name sockaddr present */
     251#define RTAX_IFA        5       /* interface addr sockaddr present */
     252#define RTAX_AUTHOR     6       /* sockaddr for author of redirect */
     253#define RTAX_BRD        7       /* for NEWADDR, broadcast or p-p dest addr */
     254#define RTAX_MAX        8       /* size of array to allocate */
     255
     256struct rt_addrinfo {
     257        int     rti_addrs;
     258        struct  sockaddr *rti_info[RTAX_MAX];
    137259};
    138260
    139261struct route_cb {
    140         int     ip_count;
    141         int     ns_count;
    142         int     iso_count;
    143         int     any_count;
    144 };
    145 #define RTM_VERSION     2       /* Up the ante and ignore older versions */
    146 
    147 #define RTM_ADD         0x1     /* Add Route */
    148 #define RTM_DELETE      0x2     /* Delete Route */
    149 #define RTM_CHANGE      0x3     /* Change Metrics or flags */
    150 #define RTM_GET         0x4     /* Report Metrics */
    151 #define RTM_LOSING      0x5     /* Kernel Suspects Partitioning */
    152 #define RTM_REDIRECT    0x6     /* Told to use different route */
    153 #define RTM_MISS        0x7     /* Lookup failed on this address */
    154 #define RTM_LOCK        0x8     /* fix specified metrics */
    155 #define RTM_OLDADD      0x9     /* caused by SIOCADDRT */
    156 #define RTM_OLDDEL      0xa     /* caused by SIOCDELRT */
    157 #define RTM_RESOLVE     0xb     /* req to resolve dst to LL addr */
    158 
    159 #define RTV_MTU         0x1     /* init or lock _mtu */
    160 #define RTV_HOPCOUNT    0x2     /* init or lock _hopcount */
    161 #define RTV_EXPIRE      0x4     /* init or lock _hopcount */
    162 #define RTV_RPIPE       0x8     /* init or lock _recvpipe */
    163 #define RTV_SPIPE       0x10    /* init or lock _sendpipe */
    164 #define RTV_SSTHRESH    0x20    /* init or lock _ssthresh */
    165 #define RTV_RTT         0x40    /* init or lock _rtt */
    166 #define RTV_RTTVAR      0x80    /* init or lock _rttvar */
    167 
    168 #define RTA_DST         0x1     /* destination sockaddr present */
    169 #define RTA_GATEWAY     0x2     /* gateway sockaddr present */
    170 #define RTA_NETMASK     0x4     /* netmask sockaddr present */
    171 #define RTA_GENMASK     0x8     /* cloning mask sockaddr present */
    172 #define RTA_IFP         0x10    /* interface name sockaddr present */
    173 #define RTA_IFA         0x20    /* interface addr sockaddr present */
    174 #define RTA_AUTHOR      0x40    /* sockaddr for author of redirect */
    175 #endif
    176 
    177 /* IBM: hv: I think this is the internal structure of the RT table of the
    178  * router daemon. Don't think it belongs here, but the toolkit has it as well
    179  */
    180 #define RTENTRY_COUNT   512
    181 struct rtentries {
    182         short   hostcount;
    183         short   netcount;
    184         struct rtentry rttable[RTENTRY_COUNT];
    185 };
     262        int     ip_count;
     263        int     ns_count;
     264        int     iso_count;
     265        int     any_count;
     266};
     267#endif /* !TCPV40HDRS */
    186268
    187269#if defined (__cplusplus)
Note: See TracChangeset for help on using the changeset viewer.