xref: /original-bsd/include/protocols/routed.h (revision e0c0d005)
1 /*-
2  * Copyright (c) 1983, 1989 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)routed.h	5.2 (Berkeley) 06/25/90
8  */
9 
10 /*
11  * Routing Information Protocol
12  *
13  * Derived from Xerox NS Routing Information Protocol
14  * by changing 32-bit net numbers to sockaddr's and
15  * padding stuff to 32-bit boundaries.
16  */
17 #define	RIPVERSION	1
18 
19 struct netinfo {
20 	struct	sockaddr rip_dst;	/* destination net/host */
21 	int	rip_metric;		/* cost of route */
22 };
23 
24 struct rip {
25 	u_char	rip_cmd;		/* request/response */
26 	u_char	rip_vers;		/* protocol version # */
27 	u_char	rip_res1[2];		/* pad to 32-bit boundary */
28 	union {
29 		struct	netinfo ru_nets[1];	/* variable length... */
30 		char	ru_tracefile[1];	/* ditto ... */
31 	} ripun;
32 #define	rip_nets	ripun.ru_nets
33 #define	rip_tracefile	ripun.ru_tracefile
34 };
35 
36 /*
37  * Packet types.
38  */
39 #define	RIPCMD_REQUEST		1	/* want info */
40 #define	RIPCMD_RESPONSE		2	/* responding to request */
41 #define	RIPCMD_TRACEON		3	/* turn tracing on */
42 #define	RIPCMD_TRACEOFF		4	/* turn it off */
43 
44 #define	RIPCMD_MAX		5
45 #ifdef RIPCMDS
46 char *ripcmds[RIPCMD_MAX] =
47   { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" };
48 #endif
49 
50 #define	HOPCNT_INFINITY		16	/* per Xerox NS */
51 #define	MAXPACKETSIZE		512	/* max broadcast size */
52 
53 /*
54  * Timer values used in managing the routing table.
55  * Complete tables are broadcast every SUPPLY_INTERVAL seconds.
56  * If changes occur between updates, dynamic updates containing only changes
57  * may be sent.  When these are sent, a timer is set for a random value
58  * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates
59  * are sent until the timer expires.
60  *
61  * Every update of a routing entry forces an entry's timer to be reset.
62  * After EXPIRE_TIME without updates, the entry is marked invalid,
63  * but held onto until GARBAGE_TIME so that others may
64  * see it "be deleted".
65  */
66 #define	TIMER_RATE		30	/* alarm clocks every 30 seconds */
67 
68 #define	SUPPLY_INTERVAL		30	/* time to supply tables */
69 #define	MIN_WAITTIME		2	/* min. interval to broadcast changes */
70 #define	MAX_WAITTIME		5	/* max. time to delay changes */
71 
72 #define	EXPIRE_TIME		180	/* time to mark entry invalid */
73 #define	GARBAGE_TIME		240	/* time to garbage collect */
74