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

#434: Initial tcpip header merges.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.