rip.h revision 1.1
1/* $OpenBSD: rip.h,v 1.1 2006/10/18 16:11:58 norby 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 35/* timers */ 36#define KEEPALIVE 30 37#define OFFSET 10 38 39#define MAX_RIP_ENTRIES 25 40 41/* RIP command */ 42#define COMMAND_REQUEST 1 43#define COMMAND_RESPONSE 2 44 45#define RIP_HDR_LEN sizeof(struct rip_hdr) 46#define RIP_ENTRY_LEN sizeof(struct rip_entry) 47 48struct rip_hdr { 49 u_int8_t command; 50 u_int8_t version; 51 u_int16_t dummy; 52}; 53 54struct rip_entry { 55 u_int16_t AFI; 56 u_int16_t route_tag; 57 u_int32_t address; 58 u_int32_t mask; 59 u_int32_t nexthop; 60 u_int32_t metric; 61}; 62 63/* auth */ 64#define AUTH 0xFFFF 65#define AUTH_TRLR_HDR_LEN 4 66 67/* auth general struct */ 68struct rip_auth { 69 u_int16_t auth_fixed; 70 u_int16_t auth_type; 71}; 72 73/* Keyed MD5 auth struct */ 74struct md5_auth { 75 u_int16_t auth_offset; 76 u_int8_t auth_keyid; 77 u_int8_t auth_length; 78 u_int32_t auth_seq; 79 u_int64_t auth_reserved; 80}; 81 82#endif /* _RIP_H_ */ 83