routed.h revision 1539
11539Srgrimes/*- 21539Srgrimes * Copyright (c) 1983, 1989, 1993 31539Srgrimes * The Regents of the University of California. All rights reserved. 41539Srgrimes * 51539Srgrimes * Redistribution and use in source and binary forms, with or without 61539Srgrimes * modification, are permitted provided that the following conditions 71539Srgrimes * are met: 81539Srgrimes * 1. Redistributions of source code must retain the above copyright 91539Srgrimes * notice, this list of conditions and the following disclaimer. 101539Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111539Srgrimes * notice, this list of conditions and the following disclaimer in the 121539Srgrimes * documentation and/or other materials provided with the distribution. 131539Srgrimes * 3. All advertising materials mentioning features or use of this software 141539Srgrimes * must display the following acknowledgement: 151539Srgrimes * This product includes software developed by the University of 161539Srgrimes * California, Berkeley and its contributors. 171539Srgrimes * 4. Neither the name of the University nor the names of its contributors 181539Srgrimes * may be used to endorse or promote products derived from this software 191539Srgrimes * without specific prior written permission. 201539Srgrimes * 211539Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221539Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231539Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241539Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251539Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261539Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271539Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281539Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291539Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301539Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311539Srgrimes * SUCH DAMAGE. 321539Srgrimes * 331539Srgrimes * @(#)routed.h 8.1 (Berkeley) 6/2/93 341539Srgrimes */ 351539Srgrimes 361539Srgrimes#ifndef _ROUTED_H_ 371539Srgrimes#define _ROUTED_H_ 381539Srgrimes 391539Srgrimes/* 401539Srgrimes * Routing Information Protocol 411539Srgrimes * 421539Srgrimes * Derived from Xerox NS Routing Information Protocol 431539Srgrimes * by changing 32-bit net numbers to sockaddr's and 441539Srgrimes * padding stuff to 32-bit boundaries. 451539Srgrimes */ 461539Srgrimes#define RIPVERSION 1 471539Srgrimes 481539Srgrimesstruct netinfo { 491539Srgrimes struct sockaddr rip_dst; /* destination net/host */ 501539Srgrimes int rip_metric; /* cost of route */ 511539Srgrimes}; 521539Srgrimes 531539Srgrimesstruct rip { 541539Srgrimes u_char rip_cmd; /* request/response */ 551539Srgrimes u_char rip_vers; /* protocol version # */ 561539Srgrimes u_char rip_res1[2]; /* pad to 32-bit boundary */ 571539Srgrimes union { 581539Srgrimes struct netinfo ru_nets[1]; /* variable length... */ 591539Srgrimes char ru_tracefile[1]; /* ditto ... */ 601539Srgrimes } ripun; 611539Srgrimes#define rip_nets ripun.ru_nets 621539Srgrimes#define rip_tracefile ripun.ru_tracefile 631539Srgrimes}; 641539Srgrimes 651539Srgrimes/* 661539Srgrimes * Packet types. 671539Srgrimes */ 681539Srgrimes#define RIPCMD_REQUEST 1 /* want info */ 691539Srgrimes#define RIPCMD_RESPONSE 2 /* responding to request */ 701539Srgrimes#define RIPCMD_TRACEON 3 /* turn tracing on */ 711539Srgrimes#define RIPCMD_TRACEOFF 4 /* turn it off */ 721539Srgrimes 731539Srgrimes#define RIPCMD_MAX 5 741539Srgrimes#ifdef RIPCMDS 751539Srgrimeschar *ripcmds[RIPCMD_MAX] = 761539Srgrimes { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" }; 771539Srgrimes#endif 781539Srgrimes 791539Srgrimes#define HOPCNT_INFINITY 16 /* per Xerox NS */ 801539Srgrimes#define MAXPACKETSIZE 512 /* max broadcast size */ 811539Srgrimes 821539Srgrimes/* 831539Srgrimes * Timer values used in managing the routing table. 841539Srgrimes * Complete tables are broadcast every SUPPLY_INTERVAL seconds. 851539Srgrimes * If changes occur between updates, dynamic updates containing only changes 861539Srgrimes * may be sent. When these are sent, a timer is set for a random value 871539Srgrimes * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates 881539Srgrimes * are sent until the timer expires. 891539Srgrimes * 901539Srgrimes * Every update of a routing entry forces an entry's timer to be reset. 911539Srgrimes * After EXPIRE_TIME without updates, the entry is marked invalid, 921539Srgrimes * but held onto until GARBAGE_TIME so that others may 931539Srgrimes * see it "be deleted". 941539Srgrimes */ 951539Srgrimes#define TIMER_RATE 30 /* alarm clocks every 30 seconds */ 961539Srgrimes 971539Srgrimes#define SUPPLY_INTERVAL 30 /* time to supply tables */ 981539Srgrimes#define MIN_WAITTIME 2 /* min. interval to broadcast changes */ 991539Srgrimes#define MAX_WAITTIME 5 /* max. time to delay changes */ 1001539Srgrimes 1011539Srgrimes#define EXPIRE_TIME 180 /* time to mark entry invalid */ 1021539Srgrimes#define GARBAGE_TIME 240 /* time to garbage collect */ 1031539Srgrimes 1041539Srgrimes#endif /* !_ROUTED_H_ */ 105