(root)/
glibc-2.38/
inet/
protocols/
routed.h
       1  /*-
       2   * Copyright (c) 1983, 1989, 1993
       3   *	The Regents of the University of California.  All rights reserved.
       4   *
       5   * Redistribution and use in source and binary forms, with or without
       6   * modification, are permitted provided that the following conditions
       7   * are met:
       8   * 1. Redistributions of source code must retain the above copyright
       9   *    notice, this list of conditions and the following disclaimer.
      10   * 2. Redistributions in binary form must reproduce the above copyright
      11   *    notice, this list of conditions and the following disclaimer in the
      12   *    documentation and/or other materials provided with the distribution.
      13   * 4. Neither the name of the University nor the names of its contributors
      14   *    may be used to endorse or promote products derived from this software
      15   *    without specific prior written permission.
      16   *
      17   * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
      18   * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
      19   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
      20   * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
      21   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
      22   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
      23   * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
      24   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
      25   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
      26   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
      27   * SUCH DAMAGE.
      28   *
      29   *	@(#)routed.h	8.1 (Berkeley) 6/2/93
      30   */
      31  
      32  #ifndef _PROTOCOLS_ROUTED_H
      33  #define	_PROTOCOLS_ROUTED_H 1
      34  
      35  #include <sys/socket.h>
      36  /*
      37   * Routing Information Protocol
      38   *
      39   * Derived from Xerox NS Routing Information Protocol
      40   * by changing 32-bit net numbers to sockaddr's and
      41   * padding stuff to 32-bit boundaries.
      42   */
      43  #define	RIPVERSION	1
      44  
      45  struct netinfo {
      46  	struct	sockaddr rip_dst;	/* destination net/host */
      47  	int	rip_metric;		/* cost of route */
      48  };
      49  
      50  struct rip {
      51  	unsigned char	rip_cmd;		/* request/response */
      52  	unsigned char	rip_vers;		/* protocol version # */
      53  	unsigned char	rip_res1[2];		/* pad to 32-bit boundary */
      54  	union {
      55  		struct	netinfo ru_nets[1];	/* variable length... */
      56  		char	ru_tracefile[1];	/* ditto ... */
      57  	} ripun;
      58  #define	rip_nets	ripun.ru_nets
      59  #define	rip_tracefile	ripun.ru_tracefile
      60  };
      61  
      62  /*
      63   * Packet types.
      64   */
      65  #define	RIPCMD_REQUEST		1	/* want info */
      66  #define	RIPCMD_RESPONSE		2	/* responding to request */
      67  #define	RIPCMD_TRACEON		3	/* turn tracing on */
      68  #define	RIPCMD_TRACEOFF		4	/* turn it off */
      69  
      70  #define	RIPCMD_MAX		5
      71  #ifdef RIPCMDS
      72  char *ripcmds[RIPCMD_MAX] =
      73    { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" };
      74  #endif
      75  
      76  #define	HOPCNT_INFINITY		16	/* per Xerox NS */
      77  #define	MAXPACKETSIZE		512	/* max broadcast size */
      78  
      79  /*
      80   * Timer values used in managing the routing table.
      81   * Complete tables are broadcast every SUPPLY_INTERVAL seconds.
      82   * If changes occur between updates, dynamic updates containing only changes
      83   * may be sent.  When these are sent, a timer is set for a random value
      84   * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates
      85   * are sent until the timer expires.
      86   *
      87   * Every update of a routing entry forces an entry's timer to be reset.
      88   * After EXPIRE_TIME without updates, the entry is marked invalid,
      89   * but held onto until GARBAGE_TIME so that others may
      90   * see it "be deleted".
      91   */
      92  #define	TIMER_RATE		30	/* alarm clocks every 30 seconds */
      93  
      94  #define	SUPPLY_INTERVAL		30	/* time to supply tables */
      95  #define	MIN_WAITTIME		2	/* min. interval to broadcast changes */
      96  #define	MAX_WAITTIME		5	/* max. time to delay changes */
      97  
      98  #define	EXPIRE_TIME		180	/* time to mark entry invalid */
      99  #define	GARBAGE_TIME		240	/* time to garbage collect */
     100  
     101  #endif /* protocols/routed.h */