📄 riplib.h
字号:
/* ripLib.h - primary include file for Routing Information Protocol (RIP) *//* Copyright 1996 - 2005 Wind River Systems, Inc. *//*- * Copyright (c) 1983, 1989, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)routed.h 8.1 (Berkeley) 6/2/93 *//*modification history--------------------01r,04mar05,vvv fixed warning01q,07oct04,spm restored internal route classification; removed related SPR #88035 changes [additional class-based routes] (SPR #102398)01p,15mar04,rp merged from orion01o,06dec03,niq Merge from base6_itn3_networking-dev.al branch01n,20nov03,niq osdep.h cleanup01m,04nov03,rlm Ran batch header path update for header re-org.01l,03nov03,rlm Removed wrn/coreip/ prefix from #includes for header re-org.01k,24oct03,cdw update include statements post header re-org.01j,01may03,spm Tornado 2.2 CP1 merge (from ver 01g,13jan03,rae: TOR2_2-CP1-F label, tor2_2-patch branch, /wind/river VOB)01i,20dec01,hgo modification of header files01h,23oct01,niq Added interface exclusion list - SPR 7109301g,07aug01,niq Change ripRouteHook prototype01f,10jul01,niq Changes for supporting the route hook.01e,23mar01,spm merged changes from version 01f of tor2_0.open_stack branch (wpwr VOB, base 01d) for unified code base; added title and copyright01d,11sep98,spm updated contents to prevent compilation problems (SPR #22352); removed references to bloated trace commands (SPR #22350)01c,12mar97,gnn added multicast support added timer variables01b,24feb97,gnn Changed include protection. Added prototype for ripLibInit. Put in WRS proper typedefs.01a,26nov96,gnn created from BSD4.4 routed*/#ifndef __INCripLibh#define __INCripLibh#ifdef __cplusplusextern "C" {#endif#include <sys/socket.h>#include <net/route.h>#include <net/if.h>#include <netinet/in.h>#include <rip/table.h>#include <rip/interface.h>#include <rip/rip2.h>#include <cfgDefs.h>#ifdef VIRTUAL_STACK#include <netinet/vsLib.h>#endif#include <lstLib.h>/* * Routing Information Protocol * * Derived from Xerox NS Routing Information Protocol * by changing 32-bit net numbers to sockaddr's and * padding stuff to 32-bit boundaries. */#if ((CPU_FAMILY==I960) && (defined __GNUC__))#pragma align 1 /* tell gcc960 not to optimize alignments */#endif /* CPU_FAMILY==I960 */typedef struct route_info { struct rt_msghdr rtm; /* Route message header */ struct sockaddr addrs [RTAX_MAX]; /* Array of sockaddrs */ } ROUTE_INFO;typedef struct netinfo { struct sockaddr rip_dst; /* destination net/host */ int rip_metric; /* cost of route */} NETINFO;typedef struct rip_pkt { u_char rip_cmd; /* request/response */ u_char rip_vers; /* protocol version # */ u_char rip_domain[2]; /* Version 2 routing domain. */ union { struct netinfo ru_nets[1]; /* variable length... */ } ripun;#define rip_nets ripun.ru_nets} RIP_PKT;typedef struct rt_iflist { NODE node; char rtif_name [IFNAMSIZ]; u_long rtif_ipaddr; u_long rtif_subnetmask; } RT_IFLIST;#if ((CPU_FAMILY==I960) && (defined __GNUC__))#pragma align 0 /* turn off alignment requirement */#endif /* CPU_FAMILY==I960 */ /* * Packet types. */#define RIPCMD_REQUEST 1 /* want info */#define RIPCMD_RESPONSE 2 /* responding to request */#define RIPCMD_TRACEON 3 /* obsolete: turn tracing on */#define RIPCMD_TRACEOFF 4 /* obsolete: turn tracing off */#define RIPCMD_MAX 5#define HOPCNT_INFINITY 16 /* per Xerox NS */#if 0 /* accordion -> moved to defs.h because of hen/egg problem with rip_globals */#define MAXPACKETSIZE 512 /* max broadcast size */#endif/* * Flag values for the route hook routine */#define RIP_REDIRECT_RECD 0x1 /* Received redirect message */#define RIP_ROUTE_CHANGE_RECD 0x2 /* Received route change message *//** Timer values used in managing the routing table. Complete tables are * broadcast at periodic intervals (30 seconds by default). If changes occur * between updates, triggered updates containing the changed entries may be * sent to speed convergence of the routing tables. The MIN_WAITTIME and * MAX_WAITTIME constants control the scheduling of these updates. No * triggered update will occur within MAX_WAITTIME of a regular update. * After the update is sent, further triggered updates will be supressed * for a random interval between MIN_WAITTIME and MAX_WAITTIME to avoid * flooding the network.*/#define MIN_WAITTIME 1 /* min. interval to broadcast changes */#define MAX_WAITTIME 5 /* max. time to delay changes */typedef struct rip_config_params { CFG_DATA_HDR cfgh; BOOL cfg_supplier; /* operate in silent mode? */ BOOL cfg_gateway; /* act as gateway to the Internet? */ BOOL cfg_multicast; /* use multicast or broadcast addresses? */ int cfg_version; /* 1 or 2: selects format of outgoing messages */ int cfg_timerRate; /* update frequency for internal routing table */ int cfg_supplyInterval; /* update frequency for neighboring routers */ int cfg_expire; /* maximum interval for renewing learned routes */ int cfg_garbage; /* elapsed time before deleting stale route */ int cfg_authType; /* default authentication type to use */ } RIP_CONFIG_PARAMS;/* externs *//* Forward declarations for user callable routines. */STATUS ripLibInit (BOOL, BOOL, BOOL, int, int, int, int, int, int);void ripRouteShow (void);STATUS ripAuthHookAdd (char *, FUNCPTR);IMPORT STATUS ripAuthHook (char *, RIP_PKT *);STATUS ripAuthHookDelete (char *);STATUS ripLeakHookAdd (char *, FUNCPTR);STATUS ripLeakHookDelete (char *);STATUS ripSendHookAdd (char *, BOOL (*sendHook) (struct rt_entry *));STATUS ripSendHookDelete (char *);void ripIfSearch (void);STATUS ripIfReset (char *);STATUS ripIfAddrReset (char *, char *, u_long);void ripFilterEnable (void);void ripFilterDisable (void);STATUS ripShutdown (void);void ripDebugLevelSet (int);void ripAuthKeyShow (UINT);STATUS ripAuthKeyAdd (char *, UINT16, char *, UINT, UINT, ULONG);STATUS ripAuthKeyDelete (char *, UINT16);STATUS ripAuthKeyFind (struct interface *, UINT16, RIP_AUTH_KEY **);STATUS ripAuthKeyFindFirst (struct interface *, RIP_AUTH_KEY **);STATUS ripAuthKeyInMD5 (struct interface *, RIP_PKT *, UINT);STATUS ripAuthKeyOut1MD5 (struct interface *, struct netinfo *, RIP2_AUTH_PKT_HDR **, RIP_AUTH_KEY **);void ripAuthKeyOut2MD5 (RIP_PKT *, UINT *, struct netinfo *, RIP2_AUTH_PKT_HDR *, RIP_AUTH_KEY *);STATUS ripRouteHookAdd (FUNCPTR);STATUS ripRouteHookDelete (void);STATUS ripRouteHook (ROUTE_INFO *, int, BOOL, int);void ripAddrsXtract (ROUTE_INFO *, struct sockaddr **, struct sockaddr **, struct sockaddr **, struct sockaddr **);STATUS ripIfExcludeListAdd (char *);STATUS ripIfExcludeListDelete (char *);STATUS ripIfExcludeListCheck (char *, u_long, u_long);void ripIfExcludeListShow (void);STATUS ripIfAddrExcludeListAdd (char *, char *, u_long);STATUS ripIfAddrExcludeListDelete (char *, u_long);void ripRtEntryPrint(struct rt_entry *rt, BOOL verbose, char *pStr);int inet_rtflags(struct sockaddr_in *sin);#ifdef __cplusplus}#endif#endif /* __INCripLibh */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -