ripLib.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:7k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* ripLib.h - primary include file for Routing Information Protocol (RIP) */
  2. /* Copyright 1996 - 2001 Wind River Systems, Inc. */
  3. /*-
  4.  * Copyright (c) 1983, 1989, 1993
  5.  * The Regents of the University of California.  All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  * 1. Redistributions of source code must retain the above copyright
  11.  *    notice, this list of conditions and the following disclaimer.
  12.  * 2. Redistributions in binary form must reproduce the above copyright
  13.  *    notice, this list of conditions and the following disclaimer in the
  14.  *    documentation and/or other materials provided with the distribution.
  15.  * 3. All advertising materials mentioning features or use of this software
  16.  *    must display the following acknowledgement:
  17.  * This product includes software developed by the University of
  18.  * California, Berkeley and its contributors.
  19.  * 4. Neither the name of the University nor the names of its contributors
  20.  *    may be used to endorse or promote products derived from this software
  21.  *    without specific prior written permission.
  22.  *
  23.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  24.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  25.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  27.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  28.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  29.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  30.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  31.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  32.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  33.  * SUCH DAMAGE.
  34.  *
  35.  * @(#)routed.h 8.1 (Berkeley) 6/2/93
  36.  */
  37. /*
  38. modification history
  39. --------------------
  40. 01f,22mar02,niq  Merged from Synth view, tor3_x.synth branch, ver 01h
  41. 01e,12oct01,rae  merge from truestack
  42. 01d,11sep98,spm  updated contents to prevent compilation problems (SPR #22352);
  43.                  removed references to bloated trace commands (SPR #22350)
  44. 01c,12mar97,gnn  added multicast support
  45.                  added timer variables
  46. 01b,24feb97,gnn  Changed include protection.
  47.                  Added prototype for ripLibInit.
  48.                  Put in WRS proper typedefs.
  49. 01a,26nov96,gnn  created from BSD4.4 routed
  50. */
  51. #ifndef __INCripLibh
  52. #define __INCripLibh
  53. #ifdef __cplusplus
  54. extern "C" {
  55. #endif
  56. #include "sys/socket.h"
  57. #include "net/route.h"
  58. #include "net/if.h"
  59. #include "rip/table.h"
  60. #include "rip/interface.h"
  61. #include "rip/rip2.h"
  62. /*
  63.  * Routing Information Protocol
  64.  *
  65.  * Derived from Xerox NS Routing Information Protocol
  66.  * by changing 32-bit net numbers to sockaddr's and
  67.  * padding stuff to 32-bit boundaries.
  68.  */
  69. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  70. #pragma align 1                 /* tell gcc960 not to optimize alignments */
  71. #endif  /* CPU_FAMILY==I960 */
  72. typedef struct route_info 
  73.     {
  74.     struct rt_msghdr rtm; /* Route message header */
  75.     struct sockaddr  addrs [RTAX_MAX]; /* Array of sockaddrs */
  76.     } ROUTE_INFO;
  77. typedef struct netinfo {
  78. struct sockaddr rip_dst; /* destination net/host */
  79. int rip_metric; /* cost of route */
  80. } NETINFO;
  81. typedef struct rip_pkt {
  82. u_char rip_cmd; /* request/response */
  83. u_char rip_vers; /* protocol version # */
  84. u_char rip_domain[2]; /* Version 2 routing domain. */
  85. union {
  86. struct netinfo ru_nets[1]; /* variable length... */
  87. } ripun;
  88. #define rip_nets ripun.ru_nets
  89. } RIP_PKT;
  90. typedef struct rt_iflist
  91.     {
  92.     NODE node;
  93.     char  rtif_name [IFNAMSIZ];
  94.     } RT_IFLIST;
  95. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  96. #pragma align 0                 /* turn off alignment requirement */
  97. #endif  /* CPU_FAMILY==I960 */
  98.  
  99. /*
  100.  * Packet types.
  101.  */
  102. #define RIPCMD_REQUEST 1 /* want info */
  103. #define RIPCMD_RESPONSE 2 /* responding to request */
  104. #define RIPCMD_TRACEON 3 /* obsolete: turn tracing on */
  105. #define RIPCMD_TRACEOFF 4 /* obsolete: turn tracing off */
  106. #define RIPCMD_MAX 5
  107. #define HOPCNT_INFINITY 16 /* per Xerox NS */
  108. #define MAXPACKETSIZE 512 /* max broadcast size */
  109. /*
  110.  * Flag values for the route hook routine
  111.  */
  112. #define RIP_REDIRECT_RECD 0x1 /* Received redirect message */
  113. #define RIP_ROUTE_CHANGE_RECD 0x2 /* Received route change message */
  114. /*
  115. * Timer values used in managing the routing table. Complete tables are 
  116. * broadcast at periodic intervals (30 seconds by default). If changes occur 
  117. * between updates, triggered updates containing the changed entries may be 
  118. * sent to speed convergence of the routing tables. The MIN_WAITTIME and 
  119. * MAX_WAITTIME constants control the scheduling of these updates. No 
  120. * triggered update will occur within MAX_WAITTIME of a regular update. 
  121. * After the update is sent, further triggered updates will be supressed 
  122. * for a random interval between MIN_WAITTIME and MAX_WAITTIME to avoid 
  123. * flooding the network.
  124. */
  125. #define MIN_WAITTIME 1 /* min. interval to broadcast changes */
  126. #define MAX_WAITTIME 5 /* max. time to delay changes */
  127. /* Forward declarations for user callable routines. */
  128. STATUS ripLibInit (BOOL, BOOL, BOOL, int, int, int, int, int, int);
  129. void ripRouteShow (void);
  130. STATUS ripAuthHookAdd (char *, FUNCPTR);
  131. IMPORT STATUS ripAuthHook (char *, RIP_PKT *);
  132. STATUS ripAuthHookDelete (char *);
  133. STATUS ripLeakHookAdd (char *, FUNCPTR);
  134. STATUS ripLeakHookDelete (char *);
  135. STATUS ripSendHookAdd (char *, BOOL (*sendHook) (struct rt_entry *));
  136. STATUS ripSendHookDelete (char *);
  137. void ripIfSearch (void);
  138. STATUS ripIfReset (char *);
  139. void ripFilterEnable (void);
  140. void ripFilterDisable (void);
  141. STATUS ripShutdown (void);
  142. void ripDebugLevelSet (int);
  143. void ripAuthKeyShow (UINT);
  144. STATUS ripAuthKeyAdd (char *, UINT16, char *, UINT, UINT, ULONG);
  145. STATUS ripAuthKeyDelete (char *, UINT16);
  146. STATUS ripAuthKeyFind (struct interface *, UINT16, RIP_AUTH_KEY **);
  147. STATUS ripAuthKeyFindFirst (struct interface *, RIP_AUTH_KEY **);
  148. STATUS ripAuthKeyInMD5 (struct interface *, RIP_PKT *, UINT);
  149. STATUS ripAuthKeyOut1MD5 (struct interface *, struct netinfo *,
  150.                           RIP2_AUTH_PKT_HDR **, RIP_AUTH_KEY **);
  151. void ripAuthKeyOut2MD5 (RIP_PKT *, UINT *, struct netinfo *,
  152.                         RIP2_AUTH_PKT_HDR *, RIP_AUTH_KEY *);
  153. STATUS ripRouteHookAdd (FUNCPTR);
  154. STATUS ripRouteHookDelete (void);
  155. STATUS ripRouteHook (ROUTE_INFO *, int, BOOL, int);
  156. void ripAddrsXtract (ROUTE_INFO *, struct sockaddr **, struct sockaddr **, 
  157.      struct sockaddr **, struct sockaddr **);
  158. STATUS ripIfExcludeListAdd (char *);
  159. STATUS ripIfExcludeListDelete (char *);
  160. STATUS ripIfExcludeListCheck (char *);
  161. void ripIfExcludeListShow (void);
  162. #ifdef __cplusplus
  163. }
  164. #endif
  165. #endif /* __INCripLibh */