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