Back to index

glibc  2.9
routed.h
Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 1983, 1989, 1993
00003  *     The Regents of the University of California.  All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 4. Neither the name of the University nor the names of its contributors
00014  *    may be used to endorse or promote products derived from this software
00015  *    without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00027  * SUCH DAMAGE.
00028  *
00029  *     @(#)routed.h  8.1 (Berkeley) 6/2/93
00030  */
00031 
00032 #ifndef _PROTOCOLS_ROUTED_H
00033 #define       _PROTOCOLS_ROUTED_H 1
00034 
00035 #include <sys/socket.h>
00036 /*
00037  * Routing Information Protocol
00038  *
00039  * Derived from Xerox NS Routing Information Protocol
00040  * by changing 32-bit net numbers to sockaddr's and
00041  * padding stuff to 32-bit boundaries.
00042  */
00043 #define       RIPVERSION    1
00044 
00045 struct netinfo {
00046        struct sockaddr rip_dst;    /* destination net/host */
00047        int    rip_metric;          /* cost of route */
00048 };
00049 
00050 struct rip {
00051        u_char rip_cmd;             /* request/response */
00052        u_char rip_vers;            /* protocol version # */
00053        u_char rip_res1[2];         /* pad to 32-bit boundary */
00054        union {
00055               struct netinfo ru_nets[1];  /* variable length... */
00056               char   ru_tracefile[1];     /* ditto ... */
00057        } ripun;
00058 #define       rip_nets      ripun.ru_nets
00059 #define       rip_tracefile ripun.ru_tracefile
00060 };
00061 
00062 /*
00063  * Packet types.
00064  */
00065 #define       RIPCMD_REQUEST              1      /* want info */
00066 #define       RIPCMD_RESPONSE             2      /* responding to request */
00067 #define       RIPCMD_TRACEON              3      /* turn tracing on */
00068 #define       RIPCMD_TRACEOFF             4      /* turn it off */
00069 
00070 #define       RIPCMD_MAX           5
00071 #ifdef RIPCMDS
00072 char *ripcmds[RIPCMD_MAX] =
00073   { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" };
00074 #endif
00075 
00076 #define       HOPCNT_INFINITY             16     /* per Xerox NS */
00077 #define       MAXPACKETSIZE        512    /* max broadcast size */
00078 
00079 /*
00080  * Timer values used in managing the routing table.
00081  * Complete tables are broadcast every SUPPLY_INTERVAL seconds.
00082  * If changes occur between updates, dynamic updates containing only changes
00083  * may be sent.  When these are sent, a timer is set for a random value
00084  * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates
00085  * are sent until the timer expires.
00086  *
00087  * Every update of a routing entry forces an entry's timer to be reset.
00088  * After EXPIRE_TIME without updates, the entry is marked invalid,
00089  * but held onto until GARBAGE_TIME so that others may
00090  * see it "be deleted".
00091  */
00092 #define       TIMER_RATE           30     /* alarm clocks every 30 seconds */
00093 
00094 #define       SUPPLY_INTERVAL             30     /* time to supply tables */
00095 #define       MIN_WAITTIME         2      /* min. interval to broadcast changes */
00096 #define       MAX_WAITTIME         5      /* max. time to delay changes */
00097 
00098 #define       EXPIRE_TIME          180    /* time to mark entry invalid */
00099 #define       GARBAGE_TIME         240    /* time to garbage collect */
00100 
00101 #endif /* protocols/routed.h */