HAMMER: MFC to 2.0
[dragonfly.git] / contrib / tcpdump-3.9 / ospf6.h
blobb8298ead91650b3e6edc87d299d015b900abc33c
1 /* @(#) $Header: /tcpdump/master/tcpdump/ospf6.h,v 1.6 2002/12/11 07:13:56 guy Exp $ (LBL) */
2 /*
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
17 * written permission.
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 OSPF6_OPTION_V6 0x01 /* V6 bit: A bit for peeping tom */
34 #define OSPF6_OPTION_E 0x02 /* E bit: External routes advertised */
35 #define OSPF6_OPTION_MC 0x04 /* MC bit: Multicast capable */
36 #define OSPF6_OPTION_N 0x08 /* N bit: For type-7 LSA */
37 #define OSPF6_OPTION_R 0x10 /* R bit: Router bit */
38 #define OSPF6_OPTION_DC 0x20 /* DC bit: Demand circuits */
41 /* db_flags */
42 #define OSPF6_DB_INIT 0x04 /* */
43 #define OSPF6_DB_MORE 0x02
44 #define OSPF6_DB_MASTER 0x01
46 /* ls_type */
47 #define LS_TYPE_ROUTER 1 /* router link */
48 #define LS_TYPE_NETWORK 2 /* network link */
49 #define LS_TYPE_INTER_AP 3 /* Inter-Area-Prefix */
50 #define LS_TYPE_INTER_AR 4 /* Inter-Area-Router */
51 #define LS_TYPE_ASE 5 /* ASE */
52 #define LS_TYPE_GROUP 6 /* Group membership */
53 #define LS_TYPE_TYPE7 7 /* Type 7 LSA */
54 #define LS_TYPE_LINK 8 /* Link LSA */
55 #define LS_TYPE_INTRA_AP 9 /* Intra-Area-Prefix */
56 #define LS_TYPE_MAX 10
57 #define LS_TYPE_MASK 0x1fff
59 #define LS_SCOPE_LINKLOCAL 0x0000
60 #define LS_SCOPE_AREA 0x2000
61 #define LS_SCOPE_AS 0x4000
62 #define LS_SCOPE_MASK 0x6000
64 /*************************************************
66 * is the above a bug in the documentation?
68 *************************************************/
71 /* rla_link.link_type */
72 #define RLA_TYPE_ROUTER 1 /* point-to-point to another router */
73 #define RLA_TYPE_TRANSIT 2 /* connection to transit network */
74 #define RLA_TYPE_VIRTUAL 4 /* virtual link */
76 /* rla_flags */
77 #define RLA_FLAG_B 0x01
78 #define RLA_FLAG_E 0x02
79 #define RLA_FLAG_V 0x04
80 #define RLA_FLAG_W 0x08
82 /* sla_tosmetric breakdown */
83 #define SLA_MASK_TOS 0x7f000000
84 #define SLA_MASK_METRIC 0x00ffffff
85 #define SLA_SHIFT_TOS 24
87 /* asla_metric */
88 #define ASLA_FLAG_EXTERNAL 0x04000000
89 #define ASLA_FLAG_FWDADDR 0x02000000
90 #define ASLA_FLAG_ROUTETAG 0x01000000
91 #define ASLA_MASK_METRIC 0x00ffffff
93 /* multicast vertex type */
94 #define MCLA_VERTEX_ROUTER 1
95 #define MCLA_VERTEX_NETWORK 2
97 typedef u_int32_t rtrid_t;
99 /* link state advertisement header */
100 struct lsa_hdr {
101 u_int16_t ls_age;
102 u_int16_t ls_type;
103 rtrid_t ls_stateid;
104 rtrid_t ls_router;
105 u_int32_t ls_seq;
106 u_int16_t ls_chksum;
107 u_int16_t ls_length;
110 struct lsa_prefix {
111 u_int8_t lsa_p_len;
112 u_int8_t lsa_p_opt;
113 u_int16_t lsa_p_mbz;
114 u_int8_t lsa_p_prefix[4];
117 /* link state advertisement */
118 struct lsa {
119 struct lsa_hdr ls_hdr;
121 /* Link state types */
122 union {
123 /* Router links advertisements */
124 struct {
125 union {
126 u_int8_t flg;
127 u_int32_t opt;
128 } rla_flgandopt;
129 #define rla_flags rla_flgandopt.flg
130 #define rla_options rla_flgandopt.opt
131 struct rlalink {
132 u_int8_t link_type;
133 u_int8_t link_zero[1];
134 u_int16_t link_metric;
135 u_int32_t link_ifid;
136 u_int32_t link_nifid;
137 rtrid_t link_nrtid;
138 } rla_link[1]; /* may repeat */
139 } un_rla;
141 /* Network links advertisements */
142 struct {
143 u_int32_t nla_options;
144 rtrid_t nla_router[1]; /* may repeat */
145 } un_nla;
147 /* Inter Area Prefix LSA */
148 struct {
149 u_int32_t inter_ap_metric;
150 struct lsa_prefix inter_ap_prefix[1];
151 } un_inter_ap;
153 /* AS external links advertisements */
154 struct {
155 u_int32_t asla_metric;
156 struct lsa_prefix asla_prefix[1];
157 /* some optional fields follow */
158 } un_asla;
160 #if 0
161 /* Summary links advertisements */
162 struct {
163 struct in_addr sla_mask;
164 u_int32_t sla_tosmetric[1]; /* may repeat */
165 } un_sla;
167 /* Multicast group membership */
168 struct mcla {
169 u_int32_t mcla_vtype;
170 struct in_addr mcla_vid;
171 } un_mcla[1];
172 #endif
174 /* Type 7 LSA */
176 /* Link LSA */
177 struct llsa {
178 union {
179 u_int8_t pri;
180 u_int32_t opt;
181 } llsa_priandopt;
182 #define llsa_priority llsa_priandopt.pri
183 #define llsa_options llsa_priandopt.opt
184 struct in6_addr llsa_lladdr;
185 u_int32_t llsa_nprefix;
186 struct lsa_prefix llsa_prefix[1];
187 } un_llsa;
189 /* Intra-Area-Prefix */
190 struct {
191 u_int16_t intra_ap_nprefix;
192 u_int16_t intra_ap_lstype;
193 rtrid_t intra_ap_lsid;
194 rtrid_t intra_ap_rtid;
195 struct lsa_prefix intra_ap_prefix[1];
196 } un_intra_ap;
197 } lsa_un;
202 * TOS metric struct (will be 0 or more in router links update)
204 struct tos_metric {
205 u_int8_t tos_type;
206 u_int8_t tos_zero;
207 u_int16_t tos_metric;
210 #define OSPF_AUTH_SIZE 8
213 * the main header
215 struct ospf6hdr {
216 u_int8_t ospf6_version;
217 u_int8_t ospf6_type;
218 u_int16_t ospf6_len;
219 rtrid_t ospf6_routerid;
220 rtrid_t ospf6_areaid;
221 u_int16_t ospf6_chksum;
222 u_int8_t ospf6_instanceid;
223 u_int8_t ospf6_rsvd;
224 union {
226 /* Hello packet */
227 struct {
228 u_int32_t hello_ifid;
229 union {
230 u_int8_t pri;
231 u_int32_t opt;
232 } hello_priandopt;
233 #define hello_priority hello_priandopt.pri
234 #define hello_options hello_priandopt.opt
235 u_int16_t hello_helloint;
236 u_int16_t hello_deadint;
237 rtrid_t hello_dr;
238 rtrid_t hello_bdr;
239 rtrid_t hello_neighbor[1]; /* may repeat */
240 } un_hello;
242 /* Database Description packet */
243 struct {
244 u_int32_t db_options;
245 u_int16_t db_mtu;
246 u_int8_t db_mbz;
247 u_int8_t db_flags;
248 u_int32_t db_seq;
249 struct lsa_hdr db_lshdr[1]; /* may repeat */
250 } un_db;
252 /* Link State Request */
253 struct lsr {
254 u_int16_t ls_mbz;
255 u_int16_t ls_type;
256 rtrid_t ls_stateid;
257 rtrid_t ls_router;
258 } un_lsr[1]; /* may repeat */
260 /* Link State Update */
261 struct {
262 u_int32_t lsu_count;
263 struct lsa lsu_lsa[1]; /* may repeat */
264 } un_lsu;
266 /* Link State Acknowledgement */
267 struct {
268 struct lsa_hdr lsa_lshdr[1]; /* may repeat */
269 } un_lsa ;
270 } ospf6_un ;
273 #define ospf6_hello ospf6_un.un_hello
274 #define ospf6_db ospf6_un.un_db
275 #define ospf6_lsr ospf6_un.un_lsr
276 #define ospf6_lsu ospf6_un.un_lsu
277 #define ospf6_lsa ospf6_un.un_lsa