home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / detk45he.zip / stack16 / net / route.h < prev   
Text File  |  1999-05-11  |  5KB  |  113 lines

  1. /********************************************************copyrite.xmc***/
  2. /*                                                                     */
  3. /*   Licensed Materials - Property of IBM                              */
  4. /*                                                                     */
  5. /*   This module is "Restricted Materials of IBM":                     */
  6. /*      Program Number:   5798RXW                                      */
  7. /*      Program Name:     IBM TCP/IP Version 1.2 for OS/2              */
  8. /*   (C) Copyright IBM Corporation. 1990, 1991.                        */
  9. /*                                                                     */
  10. /*   See IBM Copyright Instructions.                                   */
  11. /*                                                                     */
  12. /********************************************************copyrite.xmc***/
  13. #ifndef __ROUTE_32H
  14. #define __ROUTE_32H
  15.  
  16. /*
  17.  * Copyright (c) 1980, 1986 Regents of the University of California.
  18.  * All rights reserved.
  19.  *
  20.  * Redistribution and use in source and binary forms are permitted
  21.  * provided that this notice is preserved and that due credit is given
  22.  * to the University of California at Berkeley. The name of the University
  23.  * may not be used to endorse or promote products derived from this
  24.  * software without specific prior written permission. This software
  25.  * is provided ``as is'' without express or implied warranty.
  26.  *
  27.  *      @(#)route.h     7.3 (Berkeley) 12/30/87
  28.  */
  29.  
  30. /*
  31.  * Kernel resident routing tables.
  32.  *
  33.  * The routing tables are initialized when interface addresses
  34.  * are set by making entries for all directly connected interfaces.
  35.  */
  36.  
  37. /*
  38.  * We distinguish between routes to hosts and routes to networks,
  39.  * preferring the former if available.  For each route we infer
  40.  * the interface to use from the gateway address supplied when
  41.  * the route was entered.  Routes that forward packets through
  42.  * gateways are marked so that the output routines know to address the
  43.  * gateway rather than the ultimate destination.
  44.  */
  45.  
  46. #ifndef __IF_32H
  47. #include <net/if.h>
  48. #endif
  49.  
  50. struct rtentry {
  51.         u_long  rt_hash;                /* to speed lookups */
  52.         struct  sockaddr rt_dst;        /* key */
  53.         struct  sockaddr rt_gateway;    /* value */
  54.         short   rt_flags;               /* up/down?, host/net */
  55.         short   rt_refcnt;              /* # held references */
  56.         u_long  rt_use;                 /* raw # packets forwarded */
  57.         struct  ifnet *rt_ifp;          /* the answer: interface to use */
  58.         long  metric1;                  /* routing metrics for SNMP and Co */
  59.         long  metric2;
  60.         long  metric3;
  61.         long  metric4;
  62. };
  63.  
  64. /*
  65.  * A route consists of a destination address and a reference
  66.  * to a routing entry.  These are often held by protocols
  67.  * in their control blocks, e.g. inpcb.
  68.  */
  69. struct route {
  70.         struct  rtentry *ro_rt;
  71.         struct  sockaddr ro_dst;
  72. };
  73.  
  74.  
  75. #define RTF_UP          0x1             /* route usable */
  76. #define RTF_GATEWAY     0x2             /* destination is a gateway */
  77. #define RTF_HOST        0x4             /* host entry (net otherwise) */
  78. #define RTF_REJECT      0x8             /* host or net unreachable */
  79. #define RTF_DYNAMIC     0x10            /* created dynamically (by redirect) */
  80. #define RTF_MODIFIED    0x20            /* modified dynamically (by redirect) */
  81. #define RTF_DONE        0x40            /* message confirmed */
  82. #define RTF_MASK        0x80            /* subnet mask present */
  83. #define RTF_CLONING     0x100           /* generate new routes on use */
  84. #define RTF_XRESOLVE    0x200           /* external daemon resolves name */
  85. #define RTF_LLINFO      0x400           /* generated by ARP or ESIS */
  86. #define RTF_STATIC      0x800           /* manually added */
  87. #define RTF_BLACKHOLE   0x1000          /* just discard pkts(during updates) */
  88. #define RTF_PROTO2      0x4000          /* protocol specific routing flag */
  89. #define RTF_PROTO1      0x8000          /* protocol specific routing flag */
  90.  
  91.  
  92. /*
  93.  * Routing statistics.
  94.  */
  95. struct  rtstat {
  96.         short   rts_badredirect;        /* bogus redirect calls */
  97.         short   rts_dynamic;            /* routes created by redirects */
  98.         short   rts_newgateway;         /* routes modified by redirects */
  99.         short   rts_unreach;            /* lookups which failed */
  100.         short   rts_wildcard;           /* lookups satisfied by a wildcard */
  101. };
  102.  
  103. #define RTENTRY_COUNT 512
  104. #pragma pack(1)
  105. struct rtentries {
  106.   short hostcount;
  107.   short netcount;
  108.   struct rtentry rttable[RTENTRY_COUNT];
  109. };
  110. #pragma pack()
  111.  
  112. #endif /* __ROUTE_32H */
  113.