Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / tcpdump / ospf.h
blob178579fc1d5712eb017bde09f6c62c411ed715d1
1 /* $NetBSD$ */
3 /* @(#) Header: /tcpdump/master/tcpdump/ospf.h,v 1.16.2.2 2006/12/13 08:24:27 hannes Exp (LBL) */
4 /*
5 * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
6 * The Regents of the University of California. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that: (1) source code distributions
10 * retain the above copyright notice and this paragraph in its entirety, (2)
11 * distributions including binary code include the above copyright notice and
12 * this paragraph in its entirety in the documentation or other materials
13 * provided with the distribution, and (3) all advertising materials mentioning
14 * features or use of this software display the following acknowledgement:
15 * ``This product includes software developed by the University of California,
16 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
17 * the University nor the names of its contributors may be used to endorse
18 * or promote products derived from this software without specific prior
19 * written permission.
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
24 * OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu)
26 #define OSPF_TYPE_UMD 0 /* UMd's special monitoring packets */
27 #define OSPF_TYPE_HELLO 1 /* Hello */
28 #define OSPF_TYPE_DD 2 /* Database Description */
29 #define OSPF_TYPE_LS_REQ 3 /* Link State Request */
30 #define OSPF_TYPE_LS_UPDATE 4 /* Link State Update */
31 #define OSPF_TYPE_LS_ACK 5 /* Link State Ack */
33 /* Options field
35 * +------------------------------------+
36 * | * | O | DC | EA | N/P | MC | E | T |
37 * +------------------------------------+
41 #define OSPF_OPTION_T 0x01 /* T bit: TOS support */
42 #define OSPF_OPTION_E 0x02 /* E bit: External routes advertised */
43 #define OSPF_OPTION_MC 0x04 /* MC bit: Multicast capable */
44 #define OSPF_OPTION_NP 0x08 /* N/P bit: NSSA capable */
45 #define OSPF_OPTION_EA 0x10 /* EA bit: External Attribute capable */
46 #define OSPF_OPTION_DC 0x20 /* DC bit: Demand circuit capable */
47 #define OSPF_OPTION_O 0x40 /* O bit: Opaque LSA capable */
48 #define OSPF_OPTION_DN 0x80 /* DN bit: Up/Down Bit capable - draft-ietf-ospf-2547-dnbit-04 */
50 /* ospf_authtype */
51 #define OSPF_AUTH_NONE 0 /* No auth-data */
52 #define OSPF_AUTH_SIMPLE 1 /* Simple password */
53 #define OSPF_AUTH_SIMPLE_LEN 8 /* max length of simple authentication */
54 #define OSPF_AUTH_MD5 2 /* MD5 authentication */
55 #define OSPF_AUTH_MD5_LEN 16 /* length of MD5 authentication */
57 /* db_flags */
58 #define OSPF_DB_INIT 0x04 /* */
59 #define OSPF_DB_MORE 0x02
60 #define OSPF_DB_MASTER 0x01
62 /* ls_type */
63 #define LS_TYPE_ROUTER 1 /* router link */
64 #define LS_TYPE_NETWORK 2 /* network link */
65 #define LS_TYPE_SUM_IP 3 /* summary link */
66 #define LS_TYPE_SUM_ABR 4 /* summary area link */
67 #define LS_TYPE_ASE 5 /* ASE */
68 #define LS_TYPE_GROUP 6 /* Group membership (multicast */
69 /* extensions 23 July 1991) */
70 #define LS_TYPE_NSSA 7 /* rfc3101 - Not so Stubby Areas */
71 #define LS_TYPE_OPAQUE_LL 9 /* rfc2370 - Opaque Link Local */
72 #define LS_TYPE_OPAQUE_AL 10 /* rfc2370 - Opaque Link Local */
73 #define LS_TYPE_OPAQUE_DW 11 /* rfc2370 - Opaque Domain Wide */
75 #define LS_OPAQUE_TYPE_TE 1 /* rfc3630 */
76 #define LS_OPAQUE_TYPE_GRACE 3 /* rfc3623 */
77 #define LS_OPAQUE_TYPE_RI 4 /* draft-ietf-ospf-cap-03 */
79 #define LS_OPAQUE_TE_TLV_ROUTER 1 /* rfc3630 */
80 #define LS_OPAQUE_TE_TLV_LINK 2 /* rfc3630 */
82 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE 1 /* rfc3630 */
83 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_ID 2 /* rfc3630 */
84 #define LS_OPAQUE_TE_LINK_SUBTLV_LOCAL_IP 3 /* rfc3630 */
85 #define LS_OPAQUE_TE_LINK_SUBTLV_REMOTE_IP 4 /* rfc3630 */
86 #define LS_OPAQUE_TE_LINK_SUBTLV_TE_METRIC 5 /* rfc3630 */
87 #define LS_OPAQUE_TE_LINK_SUBTLV_MAX_BW 6 /* rfc3630 */
88 #define LS_OPAQUE_TE_LINK_SUBTLV_MAX_RES_BW 7 /* rfc3630 */
89 #define LS_OPAQUE_TE_LINK_SUBTLV_UNRES_BW 8 /* rfc3630 */
90 #define LS_OPAQUE_TE_LINK_SUBTLV_ADMIN_GROUP 9 /* rfc3630 */
91 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID 11 /* draft-ietf-ccamp-ospf-gmpls-extensions */
92 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE 14 /* draft-ietf-ccamp-ospf-gmpls-extensions */
93 #define LS_OPAQUE_TE_LINK_SUBTLV_INTF_SW_CAP_DESCR 15 /* draft-ietf-ccamp-ospf-gmpls-extensions */
94 #define LS_OPAQUE_TE_LINK_SUBTLV_SHARED_RISK_GROUP 16 /* draft-ietf-ccamp-ospf-gmpls-extensions */
95 #define LS_OPAQUE_TE_LINK_SUBTLV_BW_CONSTRAINTS 17 /* rfc4124 */
97 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_PTP 1 /* rfc3630 */
98 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_MA 2 /* rfc3630 */
100 #define LS_OPAQUE_GRACE_TLV_PERIOD 1 /* rfc3623 */
101 #define LS_OPAQUE_GRACE_TLV_REASON 2 /* rfc3623 */
102 #define LS_OPAQUE_GRACE_TLV_INT_ADDRESS 3 /* rfc3623 */
104 #define LS_OPAQUE_GRACE_TLV_REASON_UNKNOWN 0 /* rfc3623 */
105 #define LS_OPAQUE_GRACE_TLV_REASON_SW_RESTART 1 /* rfc3623 */
106 #define LS_OPAQUE_GRACE_TLV_REASON_SW_UPGRADE 2 /* rfc3623 */
107 #define LS_OPAQUE_GRACE_TLV_REASON_CP_SWITCH 3 /* rfc3623 */
109 #define LS_OPAQUE_RI_TLV_CAP 1 /* draft-ietf-ospf-cap-03 */
111 /*************************************************
113 * is the above a bug in the documentation?
115 *************************************************/
118 /* rla_link.link_type */
119 #define RLA_TYPE_ROUTER 1 /* point-to-point to another router */
120 #define RLA_TYPE_TRANSIT 2 /* connection to transit network */
121 #define RLA_TYPE_STUB 3 /* connection to stub network */
122 #define RLA_TYPE_VIRTUAL 4 /* virtual link */
124 /* rla_flags */
125 #define RLA_FLAG_B 0x01
126 #define RLA_FLAG_E 0x02
127 #define RLA_FLAG_W1 0x04
128 #define RLA_FLAG_W2 0x08
130 /* sla_tosmetric breakdown */
131 #define SLA_MASK_TOS 0x7f000000
132 #define SLA_MASK_METRIC 0x00ffffff
133 #define SLA_SHIFT_TOS 24
135 /* asla_tosmetric breakdown */
136 #define ASLA_FLAG_EXTERNAL 0x80000000
137 #define ASLA_MASK_TOS 0x7f000000
138 #define ASLA_SHIFT_TOS 24
139 #define ASLA_MASK_METRIC 0x00ffffff
141 /* multicast vertex type */
142 #define MCLA_VERTEX_ROUTER 1
143 #define MCLA_VERTEX_NETWORK 2
145 /* link state advertisement header */
146 struct lsa_hdr {
147 u_int16_t ls_age;
148 u_int8_t ls_options;
149 u_int8_t ls_type;
150 union {
151 struct in_addr lsa_id;
152 struct { /* opaque LSAs change the LSA-ID field */
153 u_int8_t opaque_type;
154 u_int8_t opaque_id[3];
155 } opaque_field;
156 } un_lsa_id;
157 struct in_addr ls_router;
158 u_int32_t ls_seq;
159 u_int16_t ls_chksum;
160 u_int16_t ls_length;
163 /* link state advertisement */
164 struct lsa {
165 struct lsa_hdr ls_hdr;
167 /* Link state types */
168 union {
169 /* Router links advertisements */
170 struct {
171 u_int8_t rla_flags;
172 u_int8_t rla_zero[1];
173 u_int16_t rla_count;
174 struct rlalink {
175 struct in_addr link_id;
176 struct in_addr link_data;
177 u_int8_t link_type;
178 u_int8_t link_toscount;
179 u_int16_t link_tos0metric;
180 } rla_link[1]; /* may repeat */
181 } un_rla;
183 /* Network links advertisements */
184 struct {
185 struct in_addr nla_mask;
186 struct in_addr nla_router[1]; /* may repeat */
187 } un_nla;
189 /* Summary links advertisements */
190 struct {
191 struct in_addr sla_mask;
192 u_int32_t sla_tosmetric[1]; /* may repeat */
193 } un_sla;
195 /* AS external links advertisements */
196 struct {
197 struct in_addr asla_mask;
198 struct aslametric {
199 u_int32_t asla_tosmetric;
200 struct in_addr asla_forward;
201 struct in_addr asla_tag;
202 } asla_metric[1]; /* may repeat */
203 } un_asla;
205 /* Multicast group membership */
206 struct mcla {
207 u_int32_t mcla_vtype;
208 struct in_addr mcla_vid;
209 } un_mcla[1];
211 /* Opaque TE LSA */
212 struct {
213 u_int16_t type;
214 u_int16_t length;
215 u_int8_t data[1]; /* may repeat */
216 } un_te_lsa_tlv;
218 /* Opaque Grace LSA */
219 struct {
220 u_int16_t type;
221 u_int16_t length;
222 u_int8_t data[1]; /* may repeat */
223 } un_grace_tlv;
225 /* Opaque Router information LSA */
226 struct {
227 u_int16_t type;
228 u_int16_t length;
229 u_int8_t data[1]; /* may repeat */
230 } un_ri_tlv;
232 /* Unknown LSA */
233 struct unknown {
234 u_int8_t data[1]; /* may repeat */
235 } un_unknown[1];
237 } lsa_un;
242 * TOS metric struct (will be 0 or more in router links update)
244 struct tos_metric {
245 u_int8_t tos_type;
246 u_int8_t tos_zero;
247 u_int16_t tos_metric;
250 #define OSPF_AUTH_SIZE 8
253 * the main header
255 struct ospfhdr {
256 u_int8_t ospf_version;
257 u_int8_t ospf_type;
258 u_int16_t ospf_len;
259 struct in_addr ospf_routerid;
260 struct in_addr ospf_areaid;
261 u_int16_t ospf_chksum;
262 u_int16_t ospf_authtype;
263 u_int8_t ospf_authdata[OSPF_AUTH_SIZE];
264 union {
266 /* Hello packet */
267 struct {
268 struct in_addr hello_mask;
269 u_int16_t hello_helloint;
270 u_int8_t hello_options;
271 u_int8_t hello_priority;
272 u_int32_t hello_deadint;
273 struct in_addr hello_dr;
274 struct in_addr hello_bdr;
275 struct in_addr hello_neighbor[1]; /* may repeat */
276 } un_hello;
278 /* Database Description packet */
279 struct {
280 u_int8_t db_zero[2];
281 u_int8_t db_options;
282 u_int8_t db_flags;
283 u_int32_t db_seq;
284 struct lsa_hdr db_lshdr[1]; /* may repeat */
285 } un_db;
287 /* Link State Request */
288 struct lsr {
289 u_int8_t ls_type[4];
290 union {
291 struct in_addr ls_stateid;
292 struct { /* opaque LSAs change the LSA-ID field */
293 u_int8_t opaque_type;
294 u_int8_t opaque_id[3];
295 } opaque_field;
296 } un_ls_stateid;
297 struct in_addr ls_router;
298 } un_lsr[1]; /* may repeat */
300 /* Link State Update */
301 struct {
302 u_int32_t lsu_count;
303 struct lsa lsu_lsa[1]; /* may repeat */
304 } un_lsu;
306 /* Link State Acknowledgement */
307 struct {
308 struct lsa_hdr lsa_lshdr[1]; /* may repeat */
309 } un_lsa ;
310 } ospf_un ;
313 #define ospf_hello ospf_un.un_hello
314 #define ospf_db ospf_un.un_db
315 #define ospf_lsr ospf_un.un_lsr
316 #define ospf_lsu ospf_un.un_lsu
317 #define ospf_lsa ospf_un.un_lsa