Blame inet/protocols/routed.h

Packit 6c4009
/*-
Packit 6c4009
 * Copyright (c) 1983, 1989, 1993
Packit 6c4009
 *	The Regents of the University of California.  All rights reserved.
Packit 6c4009
 *
Packit 6c4009
 * Redistribution and use in source and binary forms, with or without
Packit 6c4009
 * modification, are permitted provided that the following conditions
Packit 6c4009
 * are met:
Packit 6c4009
 * 1. Redistributions of source code must retain the above copyright
Packit 6c4009
 *    notice, this list of conditions and the following disclaimer.
Packit 6c4009
 * 2. Redistributions in binary form must reproduce the above copyright
Packit 6c4009
 *    notice, this list of conditions and the following disclaimer in the
Packit 6c4009
 *    documentation and/or other materials provided with the distribution.
Packit 6c4009
 * 4. Neither the name of the University nor the names of its contributors
Packit 6c4009
 *    may be used to endorse or promote products derived from this software
Packit 6c4009
 *    without specific prior written permission.
Packit 6c4009
 *
Packit 6c4009
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
Packit 6c4009
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit 6c4009
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit 6c4009
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
Packit 6c4009
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Packit 6c4009
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
Packit 6c4009
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
Packit 6c4009
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
Packit 6c4009
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
Packit 6c4009
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
Packit 6c4009
 * SUCH DAMAGE.
Packit 6c4009
 *
Packit 6c4009
 *	@(#)routed.h	8.1 (Berkeley) 6/2/93
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifndef _PROTOCOLS_ROUTED_H
Packit 6c4009
#define	_PROTOCOLS_ROUTED_H 1
Packit 6c4009
Packit 6c4009
#include <sys/socket.h>
Packit 6c4009
/*
Packit 6c4009
 * Routing Information Protocol
Packit 6c4009
 *
Packit 6c4009
 * Derived from Xerox NS Routing Information Protocol
Packit 6c4009
 * by changing 32-bit net numbers to sockaddr's and
Packit 6c4009
 * padding stuff to 32-bit boundaries.
Packit 6c4009
 */
Packit 6c4009
#define	RIPVERSION	1
Packit 6c4009
Packit 6c4009
struct netinfo {
Packit 6c4009
	struct	sockaddr rip_dst;	/* destination net/host */
Packit 6c4009
	int	rip_metric;		/* cost of route */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
struct rip {
Packit 6c4009
	unsigned char	rip_cmd;		/* request/response */
Packit 6c4009
	unsigned char	rip_vers;		/* protocol version # */
Packit 6c4009
	unsigned char	rip_res1[2];		/* pad to 32-bit boundary */
Packit 6c4009
	union {
Packit 6c4009
		struct	netinfo ru_nets[1];	/* variable length... */
Packit 6c4009
		char	ru_tracefile[1];	/* ditto ... */
Packit 6c4009
	} ripun;
Packit 6c4009
#define	rip_nets	ripun.ru_nets
Packit 6c4009
#define	rip_tracefile	ripun.ru_tracefile
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Packet types.
Packit 6c4009
 */
Packit 6c4009
#define	RIPCMD_REQUEST		1	/* want info */
Packit 6c4009
#define	RIPCMD_RESPONSE		2	/* responding to request */
Packit 6c4009
#define	RIPCMD_TRACEON		3	/* turn tracing on */
Packit 6c4009
#define	RIPCMD_TRACEOFF		4	/* turn it off */
Packit 6c4009
Packit 6c4009
#define	RIPCMD_MAX		5
Packit 6c4009
#ifdef RIPCMDS
Packit 6c4009
char *ripcmds[RIPCMD_MAX] =
Packit 6c4009
  { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" };
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#define	HOPCNT_INFINITY		16	/* per Xerox NS */
Packit 6c4009
#define	MAXPACKETSIZE		512	/* max broadcast size */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * Timer values used in managing the routing table.
Packit 6c4009
 * Complete tables are broadcast every SUPPLY_INTERVAL seconds.
Packit 6c4009
 * If changes occur between updates, dynamic updates containing only changes
Packit 6c4009
 * may be sent.  When these are sent, a timer is set for a random value
Packit 6c4009
 * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates
Packit 6c4009
 * are sent until the timer expires.
Packit 6c4009
 *
Packit 6c4009
 * Every update of a routing entry forces an entry's timer to be reset.
Packit 6c4009
 * After EXPIRE_TIME without updates, the entry is marked invalid,
Packit 6c4009
 * but held onto until GARBAGE_TIME so that others may
Packit 6c4009
 * see it "be deleted".
Packit 6c4009
 */
Packit 6c4009
#define	TIMER_RATE		30	/* alarm clocks every 30 seconds */
Packit 6c4009
Packit 6c4009
#define	SUPPLY_INTERVAL		30	/* time to supply tables */
Packit 6c4009
#define	MIN_WAITTIME		2	/* min. interval to broadcast changes */
Packit 6c4009
#define	MAX_WAITTIME		5	/* max. time to delay changes */
Packit 6c4009
Packit 6c4009
#define	EXPIRE_TIME		180	/* time to mark entry invalid */
Packit 6c4009
#define	GARBAGE_TIME		240	/* time to garbage collect */
Packit 6c4009
Packit 6c4009
#endif /* protocols/routed.h */