1 /* @(#) $Header: /tcpdump/master/tcpdump/ospf.h,v 1.13 2004-01-27 13:33:24 hannes 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_DD 2 /* Database Description */
27 #define OSPF_TYPE_LS_REQ 3 /* Link State Request */
28 #define OSPF_TYPE_LS_UPDATE 4 /* Link State Update */
29 #define OSPF_TYPE_LS_ACK 5 /* Link State Ack */
33 * +------------------------------------+
34 * | * | O | DC | EA | N/P | MC | E | T |
35 * +------------------------------------+
39 #define OSPF_OPTION_T 0x01 /* T bit: TOS support */
40 #define OSPF_OPTION_E 0x02 /* E bit: External routes advertised */
41 #define OSPF_OPTION_MC 0x04 /* MC bit: Multicast capable */
42 #define OSPF_OPTION_NP 0x08 /* N/P bit: NSSA capable */
43 #define OSPF_OPTION_EA 0x10 /* EA bit: External Attribute capable */
44 #define OSPF_OPTION_DC 0x20 /* DC bit: Demand circuit capable */
45 #define OSPF_OPTION_O 0x40 /* O bit: Opaque LSA capable */
48 #define OSPF_AUTH_NONE 0 /* No auth-data */
49 #define OSPF_AUTH_SIMPLE 1 /* Simple password */
50 #define OSPF_AUTH_MD5 2 /* MD5 authentication */
51 #define OSPF_AUTH_MD5_LEN 16 /* length of MD5 authentication */
54 #define OSPF_DB_INIT 0x04 /* */
55 #define OSPF_DB_MORE 0x02
56 #define OSPF_DB_MASTER 0x01
59 #define LS_TYPE_ROUTER 1 /* router link */
60 #define LS_TYPE_NETWORK 2 /* network link */
61 #define LS_TYPE_SUM_IP 3 /* summary link */
62 #define LS_TYPE_SUM_ABR 4 /* summary area link */
63 #define LS_TYPE_ASE 5 /* ASE */
64 #define LS_TYPE_GROUP 6 /* Group membership (multicast */
65 /* extensions 23 July 1991) */
66 #define LS_TYPE_NSSA 7 /* rfc1587 - Not so Stubby Areas */
67 #define LS_TYPE_OPAQUE_LL 9 /* rfc2370 - Opaque Link Local */
68 #define LS_TYPE_OPAQUE_AL 10 /* rfc2370 - Opaque Link Local */
69 #define LS_TYPE_OPAQUE_DW 11 /* rfc2370 - Opaque Domain Wide */
71 #define LS_OPAQUE_TYPE_TE 1 /* rfc3630 */
72 #define LS_OPAQUE_TYPE_GRACE 3 /* rfc3623 */
74 #define LS_OPAQUE_TE_TLV_ROUTER 1 /* rfc3630 */
75 #define LS_OPAQUE_TE_TLV_LINK 2 /* rfc3630 */
77 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE 1 /* rfc3630 */
78 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_ID 2 /* rfc3630 */
79 #define LS_OPAQUE_TE_LINK_SUBTLV_LOCAL_IP 3 /* rfc3630 */
80 #define LS_OPAQUE_TE_LINK_SUBTLV_REMOTE_IP 4 /* rfc3630 */
81 #define LS_OPAQUE_TE_LINK_SUBTLV_TE_METRIC 5 /* rfc3630 */
82 #define LS_OPAQUE_TE_LINK_SUBTLV_MAX_BW 6 /* rfc3630 */
83 #define LS_OPAQUE_TE_LINK_SUBTLV_MAX_RES_BW 7 /* rfc3630 */
84 #define LS_OPAQUE_TE_LINK_SUBTLV_UNRES_BW 8 /* rfc3630 */
85 #define LS_OPAQUE_TE_LINK_SUBTLV_ADMIN_GROUP 9 /* rfc3630 */
86 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID 11 /* draft-ietf-ccamp-ospf-gmpls-extensions */
87 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_PROTECTION_TYPE 14 /* draft-ietf-ccamp-ospf-gmpls-extensions */
88 #define LS_OPAQUE_TE_LINK_SUBTLV_INTF_SW_CAP_DESCR 15 /* draft-ietf-ccamp-ospf-gmpls-extensions */
89 #define LS_OPAQUE_TE_LINK_SUBTLV_SHARED_RISK_GROUP 16 /* draft-ietf-ccamp-ospf-gmpls-extensions */
90 #define LS_OPAQUE_TE_LINK_SUBTLV_DIFFSERV_TE 17 /* draft-ietf-tewg-diff-te-proto-06 */
92 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_PTP 1 /* rfc3630 */
93 #define LS_OPAQUE_TE_LINK_SUBTLV_LINK_TYPE_MA 2 /* rfc3630 */
95 #define LS_OPAQUE_GRACE_TLV_PERIOD 1 /* rfc3623 */
96 #define LS_OPAQUE_GRACE_TLV_REASON 2 /* rfc3623 */
97 #define LS_OPAQUE_GRACE_TLV_INT_ADDRESS 3 /* rfc3623 */
99 #define LS_OPAQUE_GRACE_TLV_REASON_UNKNOWN 0 /* rfc3623 */
100 #define LS_OPAQUE_GRACE_TLV_REASON_SW_RESTART 1 /* rfc3623 */
101 #define LS_OPAQUE_GRACE_TLV_REASON_SW_UPGRADE 2 /* rfc3623 */
102 #define LS_OPAQUE_GRACE_TLV_REASON_CP_SWITCH 3 /* rfc3623 */
104 /*************************************************
106 * is the above a bug in the documentation?
108 *************************************************/
111 /* rla_link.link_type */
112 #define RLA_TYPE_ROUTER 1 /* point-to-point to another router */
113 #define RLA_TYPE_TRANSIT 2 /* connection to transit network */
114 #define RLA_TYPE_STUB 3 /* connection to stub network */
115 #define RLA_TYPE_VIRTUAL 4 /* virtual link */
118 #define RLA_FLAG_B 0x01
119 #define RLA_FLAG_E 0x02
120 #define RLA_FLAG_W1 0x04
121 #define RLA_FLAG_W2 0x08
123 /* sla_tosmetric breakdown */
124 #define SLA_MASK_TOS 0x7f000000
125 #define SLA_MASK_METRIC 0x00ffffff
126 #define SLA_SHIFT_TOS 24
128 /* asla_tosmetric breakdown */
129 #define ASLA_FLAG_EXTERNAL 0x80000000
130 #define ASLA_MASK_TOS 0x7f000000
131 #define ASLA_SHIFT_TOS 24
132 #define ASLA_MASK_METRIC 0x00ffffff
134 /* multicast vertex type */
135 #define MCLA_VERTEX_ROUTER 1
136 #define MCLA_VERTEX_NETWORK 2
138 /* link state advertisement header */
144 struct in_addr lsa_id
;
145 struct { /* opaque LSAs change the LSA-ID field */
146 u_int8_t opaque_type
;
147 u_int8_t opaque_id
[3];
150 struct in_addr ls_router
;
156 /* link state advertisement */
158 struct lsa_hdr ls_hdr
;
160 /* Link state types */
162 /* Router links advertisements */
165 u_int8_t rla_zero
[1];
168 struct in_addr link_id
;
169 struct in_addr link_data
;
171 u_int8_t link_toscount
;
172 u_int16_t link_tos0metric
;
173 } rla_link
[1]; /* may repeat */
176 /* Network links advertisements */
178 struct in_addr nla_mask
;
179 struct in_addr nla_router
[1]; /* may repeat */
182 /* Summary links advertisements */
184 struct in_addr sla_mask
;
185 u_int32_t sla_tosmetric
[1]; /* may repeat */
188 /* AS external links advertisements */
190 struct in_addr asla_mask
;
192 u_int32_t asla_tosmetric
;
193 struct in_addr asla_forward
;
194 struct in_addr asla_tag
;
195 } asla_metric
[1]; /* may repeat */
198 /* Multicast group membership */
200 u_int32_t mcla_vtype
;
201 struct in_addr mcla_vid
;
208 u_int8_t data
[1]; /* may repeat */
215 u_int8_t data
[1]; /* may repeat */
220 u_int8_t data
[1]; /* may repeat */
228 * TOS metric struct (will be 0 or more in router links update)
233 u_int16_t tos_metric
;
236 #define OSPF_AUTH_SIZE 8
242 u_int8_t ospf_version
;
245 struct in_addr ospf_routerid
;
246 struct in_addr ospf_areaid
;
247 u_int16_t ospf_chksum
;
248 u_int16_t ospf_authtype
;
249 u_int8_t ospf_authdata
[OSPF_AUTH_SIZE
];
254 struct in_addr hello_mask
;
255 u_int16_t hello_helloint
;
256 u_int8_t hello_options
;
257 u_int8_t hello_priority
;
258 u_int32_t hello_deadint
;
259 struct in_addr hello_dr
;
260 struct in_addr hello_bdr
;
261 struct in_addr hello_neighbor
[1]; /* may repeat */
264 /* Database Description packet */
270 struct lsa_hdr db_lshdr
[1]; /* may repeat */
273 /* Link State Request */
277 struct in_addr ls_stateid
;
278 struct { /* opaque LSAs change the LSA-ID field */
279 u_int8_t opaque_type
;
280 u_int8_t opaque_id
[3];
283 struct in_addr ls_router
;
284 } un_lsr
[1]; /* may repeat */
286 /* Link State Update */
289 struct lsa lsu_lsa
[1]; /* may repeat */
292 /* Link State Acknowledgement */
294 struct lsa_hdr lsa_lshdr
[1]; /* may repeat */
299 #define ospf_hello ospf_un.un_hello
300 #define ospf_db ospf_un.un_db
301 #define ospf_lsr ospf_un.un_lsr
302 #define ospf_lsu ospf_un.un_lsu
303 #define ospf_lsa ospf_un.un_lsa