rip.h revision 1.2
1/* $OpenBSD: rip.h,v 1.2 2007/01/15 18:23:43 michele Exp $ */ 2 3/* 4 * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19/* RIP protocol definitions */ 20 21#ifndef _RIP_H_ 22#define _RIP_H_ 23 24/* misc */ 25#define RIP_VERSION 2 26#define ALL_RIP_ROUTERS "224.0.0.9" 27#define RIP_PORT 520 28 29#define MIN_MD_ID 0 30#define MAX_MD_ID 255 31 32/* metric */ 33#define INFINITY 16 34#define DEFAULT_COST 1 35 36/* timers */ 37#define KEEPALIVE 30 38#define OFFSET 10 39 40#define MAX_RIP_ENTRIES 25 41 42/* RIP command */ 43#define COMMAND_REQUEST 1 44#define COMMAND_RESPONSE 2 45 46#define RIP_HDR_LEN sizeof(struct rip_hdr) 47#define RIP_ENTRY_LEN sizeof(struct rip_entry) 48 49struct rip_hdr { 50 u_int8_t command; 51 u_int8_t version; 52 u_int16_t dummy; 53}; 54 55struct rip_entry { 56 u_int16_t AFI; 57 u_int16_t route_tag; 58 u_int32_t address; 59 u_int32_t mask; 60 u_int32_t nexthop; 61 u_int32_t metric; 62}; 63 64/* auth */ 65#define AUTH 0xFFFF 66#define AUTH_TRLR_HDR_LEN 4 67 68/* auth general struct */ 69struct rip_auth { 70 u_int16_t auth_fixed; 71 u_int16_t auth_type; 72}; 73 74/* Keyed MD5 auth struct */ 75struct md5_auth { 76 u_int16_t auth_offset; 77 u_int8_t auth_keyid; 78 u_int8_t auth_length; 79 u_int32_t auth_seq; 80 u_int64_t auth_reserved; 81}; 82 83#endif /* _RIP_H_ */ 84