[BACK]Return to rip.h CVS log [TXT][DIR] Up to [local] / src / usr.sbin / ripd

File: [local] / src / usr.sbin / ripd / rip.h (download)

Revision 1.4, Thu Oct 18 17:00:59 2007 UTC (16 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7, OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, HEAD
Changes since 1.3: +2 -2 lines

spacing

/*	$OpenBSD: rip.h,v 1.4 2007/10/18 17:00:59 deraadt Exp $ */

/*
 * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

/* RIP protocol definitions */

#ifndef	_RIP_H_
#define	_RIP_H_

/* misc */
#define	RIP_VERSION		2
#define ALL_RIP_ROUTERS		"224.0.0.9"
#define	RIP_PORT		520

#define	MIN_MD_ID		0
#define	MAX_MD_ID		255

/* metric */
#define	INFINITY		16
#define	DEFAULT_COST		1

/* timers */
#define	KEEPALIVE		30
#define	OFFSET			10
#define	FAILED_NBR_TIMEOUT	86400

#define MAX_RIP_ENTRIES		25

/* RIP command */
#define	COMMAND_REQUEST		1
#define	COMMAND_RESPONSE	2

#define	RIP_HDR_LEN		sizeof(struct rip_hdr)
#define	RIP_ENTRY_LEN		sizeof(struct rip_entry)

struct rip_hdr {
	u_int8_t	command;
	u_int8_t	version;
	u_int16_t	dummy;
};

struct rip_entry {
	u_int16_t	AFI;
	u_int16_t	route_tag;
	u_int32_t	address;
	u_int32_t	mask;
	u_int32_t	nexthop;
	u_int32_t	metric;
};

/* auth */
#define AUTH			0xFFFF
#define	AUTH_TRLR_HDR_LEN	4

/* auth general struct */
struct rip_auth {
	u_int16_t	 auth_fixed;
	u_int16_t	 auth_type;
};

/* Keyed MD5 auth struct */
struct md5_auth {
	u_int16_t	 auth_offset;
	u_int8_t	 auth_keyid;
	u_int8_t	 auth_length;
	u_int32_t	 auth_seq;
	u_int64_t	 auth_reserved;
};

#endif /* _RIP_H_ */