159deaec5SRodney W. Grimes /*- 259deaec5SRodney W. Grimes * Copyright (c) 1983, 1989, 1993 359deaec5SRodney W. Grimes * The Regents of the University of California. All rights reserved. 459deaec5SRodney W. Grimes * 559deaec5SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 659deaec5SRodney W. Grimes * modification, are permitted provided that the following conditions 759deaec5SRodney W. Grimes * are met: 859deaec5SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 959deaec5SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 1059deaec5SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 1159deaec5SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 1259deaec5SRodney W. Grimes * documentation and/or other materials provided with the distribution. 1359deaec5SRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 1459deaec5SRodney W. Grimes * must display the following acknowledgement: 1559deaec5SRodney W. Grimes * This product includes software developed by the University of 1659deaec5SRodney W. Grimes * California, Berkeley and its contributors. 1759deaec5SRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 1859deaec5SRodney W. Grimes * may be used to endorse or promote products derived from this software 1959deaec5SRodney W. Grimes * without specific prior written permission. 2059deaec5SRodney W. Grimes * 2159deaec5SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2259deaec5SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2359deaec5SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2459deaec5SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2559deaec5SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2659deaec5SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2759deaec5SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2859deaec5SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2959deaec5SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3059deaec5SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3159deaec5SRodney W. Grimes * SUCH DAMAGE. 3259deaec5SRodney W. Grimes * 3359deaec5SRodney W. Grimes * @(#)routed.h 8.1 (Berkeley) 6/2/93 3459deaec5SRodney W. Grimes */ 3559deaec5SRodney W. Grimes 3659deaec5SRodney W. Grimes #ifndef _ROUTED_H_ 3759deaec5SRodney W. Grimes #define _ROUTED_H_ 3859deaec5SRodney W. Grimes 3959deaec5SRodney W. Grimes /* 4059deaec5SRodney W. Grimes * Routing Information Protocol 4159deaec5SRodney W. Grimes * 4259deaec5SRodney W. Grimes * Derived from Xerox NS Routing Information Protocol 4359deaec5SRodney W. Grimes * by changing 32-bit net numbers to sockaddr's and 4459deaec5SRodney W. Grimes * padding stuff to 32-bit boundaries. 4559deaec5SRodney W. Grimes */ 4659deaec5SRodney W. Grimes #define RIPVERSION 1 4759deaec5SRodney W. Grimes 4859deaec5SRodney W. Grimes struct netinfo { 4959deaec5SRodney W. Grimes struct sockaddr rip_dst; /* destination net/host */ 5059deaec5SRodney W. Grimes int rip_metric; /* cost of route */ 5159deaec5SRodney W. Grimes }; 5259deaec5SRodney W. Grimes 5359deaec5SRodney W. Grimes struct rip { 5459deaec5SRodney W. Grimes u_char rip_cmd; /* request/response */ 5559deaec5SRodney W. Grimes u_char rip_vers; /* protocol version # */ 5659deaec5SRodney W. Grimes u_char rip_res1[2]; /* pad to 32-bit boundary */ 5759deaec5SRodney W. Grimes union { 5859deaec5SRodney W. Grimes struct netinfo ru_nets[1]; /* variable length... */ 5959deaec5SRodney W. Grimes char ru_tracefile[1]; /* ditto ... */ 6059deaec5SRodney W. Grimes } ripun; 6159deaec5SRodney W. Grimes #define rip_nets ripun.ru_nets 6259deaec5SRodney W. Grimes #define rip_tracefile ripun.ru_tracefile 6359deaec5SRodney W. Grimes }; 6459deaec5SRodney W. Grimes 6559deaec5SRodney W. Grimes /* 6659deaec5SRodney W. Grimes * Packet types. 6759deaec5SRodney W. Grimes */ 6859deaec5SRodney W. Grimes #define RIPCMD_REQUEST 1 /* want info */ 6959deaec5SRodney W. Grimes #define RIPCMD_RESPONSE 2 /* responding to request */ 7059deaec5SRodney W. Grimes #define RIPCMD_TRACEON 3 /* turn tracing on */ 7159deaec5SRodney W. Grimes #define RIPCMD_TRACEOFF 4 /* turn it off */ 7259deaec5SRodney W. Grimes 7359deaec5SRodney W. Grimes #define RIPCMD_MAX 5 7459deaec5SRodney W. Grimes #ifdef RIPCMDS 7559deaec5SRodney W. Grimes char *ripcmds[RIPCMD_MAX] = 7659deaec5SRodney W. Grimes { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" }; 7759deaec5SRodney W. Grimes #endif 7859deaec5SRodney W. Grimes 7959deaec5SRodney W. Grimes #define HOPCNT_INFINITY 16 /* per Xerox NS */ 8059deaec5SRodney W. Grimes #define MAXPACKETSIZE 512 /* max broadcast size */ 8159deaec5SRodney W. Grimes 8259deaec5SRodney W. Grimes /* 8359deaec5SRodney W. Grimes * Timer values used in managing the routing table. 8459deaec5SRodney W. Grimes * Complete tables are broadcast every SUPPLY_INTERVAL seconds. 8559deaec5SRodney W. Grimes * If changes occur between updates, dynamic updates containing only changes 8659deaec5SRodney W. Grimes * may be sent. When these are sent, a timer is set for a random value 8759deaec5SRodney W. Grimes * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates 8859deaec5SRodney W. Grimes * are sent until the timer expires. 8959deaec5SRodney W. Grimes * 9059deaec5SRodney W. Grimes * Every update of a routing entry forces an entry's timer to be reset. 9159deaec5SRodney W. Grimes * After EXPIRE_TIME without updates, the entry is marked invalid, 9259deaec5SRodney W. Grimes * but held onto until GARBAGE_TIME so that others may 9359deaec5SRodney W. Grimes * see it "be deleted". 9459deaec5SRodney W. Grimes */ 9559deaec5SRodney W. Grimes #define TIMER_RATE 30 /* alarm clocks every 30 seconds */ 9659deaec5SRodney W. Grimes 9759deaec5SRodney W. Grimes #define SUPPLY_INTERVAL 30 /* time to supply tables */ 9859deaec5SRodney W. Grimes #define MIN_WAITTIME 2 /* min. interval to broadcast changes */ 9959deaec5SRodney W. Grimes #define MAX_WAITTIME 5 /* max. time to delay changes */ 10059deaec5SRodney W. Grimes 10159deaec5SRodney W. Grimes #define EXPIRE_TIME 180 /* time to mark entry invalid */ 10259deaec5SRodney W. Grimes #define GARBAGE_TIME 240 /* time to garbage collect */ 10359deaec5SRodney W. Grimes 10459deaec5SRodney W. Grimes #endif /* !_ROUTED_H_ */ 105