|
|
1.1 root 1: /*-
2: * Copyright (c) 1983, 1989 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted provided
6: * that: (1) source distributions retain this entire copyright notice and
7: * comment, and (2) distributions including binaries display the following
8: * acknowledgement: ``This product includes software developed by the
9: * University of California, Berkeley and its contributors'' in the
10: * documentation or other materials provided with the distribution and in
11: * all advertising materials mentioning features or use of this software.
12: * Neither the name of the University nor the names of its contributors may
13: * be used to endorse or promote products derived from this software without
14: * specific prior written permission.
15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
16: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
17: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18: *
19: * @(#)routed.h 5.2 (Berkeley) 6/25/90
20: */
21:
22: /*
23: * Routing Information Protocol
24: *
25: * Derived from Xerox NS Routing Information Protocol
26: * by changing 32-bit net numbers to sockaddr's and
27: * padding stuff to 32-bit boundaries.
28: */
29: #define RIPVERSION 1
30:
31: struct netinfo {
32: struct sockaddr rip_dst; /* destination net/host */
33: int rip_metric; /* cost of route */
34: };
35:
36: struct rip {
37: u_char rip_cmd; /* request/response */
38: u_char rip_vers; /* protocol version # */
39: u_char rip_res1[2]; /* pad to 32-bit boundary */
40: union {
41: struct netinfo ru_nets[1]; /* variable length... */
42: char ru_tracefile[1]; /* ditto ... */
43: } ripun;
44: #define rip_nets ripun.ru_nets
45: #define rip_tracefile ripun.ru_tracefile
46: };
47:
48: /*
49: * Packet types.
50: */
51: #define RIPCMD_REQUEST 1 /* want info */
52: #define RIPCMD_RESPONSE 2 /* responding to request */
53: #define RIPCMD_TRACEON 3 /* turn tracing on */
54: #define RIPCMD_TRACEOFF 4 /* turn it off */
55:
56: #define RIPCMD_MAX 5
57: #ifdef RIPCMDS
58: char *ripcmds[RIPCMD_MAX] =
59: { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" };
60: #endif
61:
62: #define HOPCNT_INFINITY 16 /* per Xerox NS */
63: #define MAXPACKETSIZE 512 /* max broadcast size */
64:
65: /*
66: * Timer values used in managing the routing table.
67: * Complete tables are broadcast every SUPPLY_INTERVAL seconds.
68: * If changes occur between updates, dynamic updates containing only changes
69: * may be sent. When these are sent, a timer is set for a random value
70: * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates
71: * are sent until the timer expires.
72: *
73: * Every update of a routing entry forces an entry's timer to be reset.
74: * After EXPIRE_TIME without updates, the entry is marked invalid,
75: * but held onto until GARBAGE_TIME so that others may
76: * see it "be deleted".
77: */
78: #define TIMER_RATE 30 /* alarm clocks every 30 seconds */
79:
80: #define SUPPLY_INTERVAL 30 /* time to supply tables */
81: #define MIN_WAITTIME 2 /* min. interval to broadcast changes */
82: #define MAX_WAITTIME 5 /* max. time to delay changes */
83:
84: #define EXPIRE_TIME 180 /* time to mark entry invalid */
85: #define GARBAGE_TIME 240 /* time to garbage collect */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.