xref: /original-bsd/include/protocols/routed.h (revision a0a7d8f4)
1 /*	routed.h	4.11	84/04/09	*/
2 /*
3  * Routing Information Protocol
4  *
5  * Derived from Xerox NS Routing Information Protocol
6  * by changing 32-bit net numbers to sockaddr's and
7  * padding stuff to 32-bit boundaries.
8  */
9 #define	RIPVERSION	1
10 
11 struct netinfo {
12 	struct	sockaddr rip_dst;	/* destination net/host */
13 	int	rip_metric;		/* cost of route */
14 };
15 
16 struct rip {
17 	u_char	rip_cmd;		/* request/response */
18 	u_char	rip_vers;		/* protocol version # */
19 	u_char	rip_res1[2];		/* pad to 32-bit boundary */
20 	union {
21 		struct	netinfo ru_nets[1];	/* variable length... */
22 		char	ru_tracefile[1];	/* ditto ... */
23 	} ripun;
24 #define	rip_nets	ripun.ru_nets
25 #define	rip_tracefile	ripun.ru_tracefile
26 };
27 
28 /*
29  * Packet types.
30  */
31 #define	RIPCMD_REQUEST		1	/* want info */
32 #define	RIPCMD_RESPONSE		2	/* responding to request */
33 #define	RIPCMD_TRACEON		3	/* turn tracing on */
34 #define	RIPCMD_TRACEOFF		4	/* turn it off */
35 
36 #define	RIPCMD_MAX		5
37 #ifdef RIPCMDS
38 char *ripcmds[RIPCMD_MAX] =
39   { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" };
40 #endif
41 
42 #define	HOPCNT_INFINITY		16	/* per Xerox NS */
43 #define	MAXPACKETSIZE		512	/* max broadcast size */
44 
45 /*
46  * Timer values used in managing the routing table.
47  * Every update forces an entry's timer to be reset.  After
48  * EXPIRE_TIME without updates, the entry is marked invalid,
49  * but held onto until GARBAGE_TIME so that others may
50  * see it "be deleted".
51  */
52 #define	TIMER_RATE		30	/* alarm clocks every 30 seconds */
53 
54 #define	SUPPLY_INTERVAL		30	/* time to supply tables */
55 
56 #define	EXPIRE_TIME		180	/* time to mark entry invalid */
57 #define	GARBAGE_TIME		240	/* time to garbage collect */
58