1 /* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.3 2000-12-17 23:07:50 guy Exp $ (LBL) */
3 * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
4 * The Regents of the University of California. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that: (1) source code distributions
8 * retain the above copyright notice and this paragraph in its entirety, (2)
9 * distributions including binary code include the above copyright notice and
10 * this paragraph in its entirety in the documentation or other materials
11 * provided with the distribution, and (3) all advertising materials mentioning
12 * features or use of this software display the following acknowledgement:
13 * ``This product includes software developed by the University of California,
14 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15 * the University nor the names of its contributors may be used to endorse
16 * or promote products derived from this software without specific prior
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 * OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu)
24 #define OSPF_TYPE_UMD 0 /* UMd's special monitoring packets */
25 #define OSPF_TYPE_HELLO 1 /* Hello */
26 #define OSPF_TYPE_DB 2 /* Database Description */
27 #define OSPF_TYPE_LSR 3 /* Link State Request */
28 #define OSPF_TYPE_LSU 4 /* Link State Update */
29 #define OSPF_TYPE_LSA 5 /* Link State Ack */
30 #define OSPF_TYPE_MAX 6
32 /* Options *_options */
33 #define OSPF_OPTION_T 0x01 /* T bit: TOS support */
34 #define OSPF_OPTION_E 0x02 /* E bit: External routes advertised */
35 #define OSPF_OPTION_MC 0x04 /* MC bit: Multicast capable */
38 #define OSPF_AUTH_NONE 0 /* No auth-data */
39 #define OSPF_AUTH_SIMPLE 1 /* Simple password */
40 #define OSPF_AUTH_MD5 2 /* MD5 authentication */
41 #define OSPF_AUTH_MD5_LEN 16 /* length of MD5 authentication */
45 #define OSPF_DB_INIT 0x04 /* */
46 #define OSPF_DB_MORE 0x02
47 #define OSPF_DB_MASTER 0x01
50 #define LS_TYPE_ROUTER 1 /* router link */
51 #define LS_TYPE_NETWORK 2 /* network link */
52 #define LS_TYPE_SUM_IP 3 /* summary link */
53 #define LS_TYPE_SUM_ABR 4 /* summary area link */
54 #define LS_TYPE_ASE 5 /* ASE */
55 #define LS_TYPE_GROUP 6 /* Group membership (multicast */
56 /* extensions 23 July 1991) */
59 /*************************************************
61 * is the above a bug in the documentation?
63 *************************************************/
66 /* rla_link.link_type */
67 #define RLA_TYPE_ROUTER 1 /* point-to-point to another router */
68 #define RLA_TYPE_TRANSIT 2 /* connection to transit network */
69 #define RLA_TYPE_STUB 3 /* connection to stub network */
70 #define RLA_TYPE_VIRTUAL 4 /* virtual link */
73 #define RLA_FLAG_B 0x01
74 #define RLA_FLAG_E 0x02
75 #define RLA_FLAG_W1 0x04
76 #define RLA_FLAG_W2 0x08
78 /* sla_tosmetric breakdown */
79 #define SLA_MASK_TOS 0x7f000000
80 #define SLA_MASK_METRIC 0x00ffffff
81 #define SLA_SHIFT_TOS 24
83 /* asla_tosmetric breakdown */
84 #define ASLA_FLAG_EXTERNAL 0x80000000
85 #define ASLA_MASK_TOS 0x7f000000
86 #define ASLA_SHIFT_TOS 24
87 #define ASLA_MASK_METRIC 0x00ffffff
89 /* multicast vertex type */
90 #define MCLA_VERTEX_ROUTER 1
91 #define MCLA_VERTEX_NETWORK 2
93 /* link state advertisement header */
98 struct in_addr ls_stateid
;
99 struct in_addr ls_router
;
105 /* link state advertisement */
107 struct lsa_hdr ls_hdr
;
109 /* Link state types */
111 /* Router links advertisements */
114 u_int8_t rla_zero
[1];
117 struct in_addr link_id
;
118 struct in_addr link_data
;
120 u_int8_t link_toscount
;
121 u_int16_t link_tos0metric
;
122 } rla_link
[1]; /* may repeat */
125 /* Network links advertisements */
127 struct in_addr nla_mask
;
128 struct in_addr nla_router
[1]; /* may repeat */
131 /* Summary links advertisements */
133 struct in_addr sla_mask
;
134 u_int32_t sla_tosmetric
[1]; /* may repeat */
137 /* AS external links advertisements */
139 struct in_addr asla_mask
;
141 u_int32_t asla_tosmetric
;
142 struct in_addr asla_forward
;
143 struct in_addr asla_tag
;
144 } asla_metric
[1]; /* may repeat */
147 /* Multicast group membership */
149 u_int32_t mcla_vtype
;
150 struct in_addr mcla_vid
;
157 * TOS metric struct (will be 0 or more in router links update)
162 u_int16_t tos_metric
;
165 #define OSPF_AUTH_SIZE 8
171 u_int8_t ospf_version
;
174 struct in_addr ospf_routerid
;
175 struct in_addr ospf_areaid
;
176 u_int16_t ospf_chksum
;
177 u_int16_t ospf_authtype
;
178 u_int8_t ospf_authdata
[OSPF_AUTH_SIZE
];
183 struct in_addr hello_mask
;
184 u_int16_t hello_helloint
;
185 u_int8_t hello_options
;
186 u_int8_t hello_priority
;
187 u_int32_t hello_deadint
;
188 struct in_addr hello_dr
;
189 struct in_addr hello_bdr
;
190 struct in_addr hello_neighbor
[1]; /* may repeat */
193 /* Database Description packet */
199 struct lsa_hdr db_lshdr
[1]; /* may repeat */
202 /* Link State Request */
205 struct in_addr ls_stateid
;
206 struct in_addr ls_router
;
207 } un_lsr
[1]; /* may repeat */
209 /* Link State Update */
212 struct lsa lsu_lsa
[1]; /* may repeat */
215 /* Link State Acknowledgement */
217 struct lsa_hdr lsa_lshdr
[1]; /* may repeat */
222 #define ospf_hello ospf_un.un_hello
223 #define ospf_db ospf_un.un_db
224 #define ospf_lsr ospf_un.un_lsr
225 #define ospf_lsu ospf_un.un_lsu
226 #define ospf_lsa ospf_un.un_lsa