]> The Tcpdump Group git mirrors - tcpdump/blob - ospf6.h
Patch sent to Debian by Roderick Schertler <[email protected]> to print
[tcpdump] / ospf6.h
1 /*
2 * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
16 * written permission.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu)
22 */
23 #define OSPF_TYPE_UMD 0 /* UMd's special monitoring packets */
24 #define OSPF_TYPE_HELLO 1 /* Hello */
25 #define OSPF_TYPE_DB 2 /* Database Description */
26 #define OSPF_TYPE_LSR 3 /* Link State Request */
27 #define OSPF_TYPE_LSU 4 /* Link State Update */
28 #define OSPF_TYPE_LSA 5 /* Link State Ack */
29 #define OSPF_TYPE_MAX 6
30
31 /* Options *_options */
32 #define OSPF6_OPTION_V6 0x01 /* V6 bit: A bit for peeping tom */
33 #define OSPF6_OPTION_E 0x02 /* E bit: External routes advertised */
34 #define OSPF6_OPTION_MC 0x04 /* MC bit: Multicast capable */
35 #define OSPF6_OPTION_N 0x08 /* N bit: For type-7 LSA */
36 #define OSPF6_OPTION_R 0x10 /* R bit: Router bit */
37 #define OSPF6_OPTION_DC 0x20 /* DC bit: Demand circuits */
38
39
40 /* db_flags */
41 #define OSPF6_DB_INIT 0x04 /* */
42 #define OSPF6_DB_MORE 0x02
43 #define OSPF6_DB_MASTER 0x01
44
45 /* ls_type */
46 #define LS_TYPE_ROUTER 1 /* router link */
47 #define LS_TYPE_NETWORK 2 /* network link */
48 #define LS_TYPE_INTER_AP 3 /* Inter-Area-Prefix */
49 #define LS_TYPE_INTER_AR 4 /* Inter-Area-Router */
50 #define LS_TYPE_ASE 5 /* ASE */
51 #define LS_TYPE_GROUP 6 /* Group membership */
52 #define LS_TYPE_TYPE7 7 /* Type 7 LSA */
53 #define LS_TYPE_LINK 8 /* Link LSA */
54 #define LS_TYPE_INTRA_AP 9 /* Intra-Area-Prefix */
55 #define LS_TYPE_MAX 10
56 #define LS_TYPE_MASK 0x1fff
57
58 #define LS_SCOPE_LINKLOCAL 0x0000
59 #define LS_SCOPE_AREA 0x2000
60 #define LS_SCOPE_AS 0x4000
61 #define LS_SCOPE_MASK 0x6000
62
63 /*************************************************
64 *
65 * is the above a bug in the documentation?
66 *
67 *************************************************/
68
69
70 /* rla_link.link_type */
71 #define RLA_TYPE_ROUTER 1 /* point-to-point to another router */
72 #define RLA_TYPE_TRANSIT 2 /* connection to transit network */
73 #define RLA_TYPE_VIRTUAL 4 /* virtual link */
74
75 /* rla_flags */
76 #define RLA_FLAG_B 0x01
77 #define RLA_FLAG_E 0x02
78 #define RLA_FLAG_V 0x04
79 #define RLA_FLAG_W 0x08
80
81 /* sla_tosmetric breakdown */
82 #define SLA_MASK_TOS 0x7f000000
83 #define SLA_MASK_METRIC 0x00ffffff
84 #define SLA_SHIFT_TOS 24
85
86 /* asla_metric */
87 #define ASLA_FLAG_EXTERNAL 0x04000000
88 #define ASLA_FLAG_FWDADDR 0x02000000
89 #define ASLA_FLAG_ROUTETAG 0x01000000
90 #define ASLA_MASK_METRIC 0x00ffffff
91
92 /* multicast vertex type */
93 #define MCLA_VERTEX_ROUTER 1
94 #define MCLA_VERTEX_NETWORK 2
95
96 typedef u_int32_t rtrid_t;
97
98 /* link state advertisement header */
99 struct lsa_hdr {
100 u_int16_t ls_age;
101 u_int16_t ls_type;
102 rtrid_t ls_stateid;
103 rtrid_t ls_router;
104 u_int32_t ls_seq;
105 u_int16_t ls_chksum;
106 u_int16_t ls_length;
107 } ;
108
109 struct lsa_prefix {
110 u_int8_t lsa_p_len;
111 u_int8_t lsa_p_opt;
112 u_int16_t lsa_p_mbz;
113 u_int8_t lsa_p_prefix[4];
114 };
115
116 /* link state advertisement */
117 struct lsa {
118 struct lsa_hdr ls_hdr;
119
120 /* Link state types */
121 union {
122 /* Router links advertisements */
123 struct {
124 union {
125 u_int8_t flg;
126 u_int32_t opt;
127 } rla_flgandopt;
128 #define rla_flags rla_flgandopt.flg
129 #define rla_options rla_flgandopt.opt
130 struct rlalink {
131 u_int8_t link_type;
132 u_int8_t link_zero[1];
133 u_int16_t link_metric;
134 u_int32_t link_ifid;
135 u_int32_t link_nifid;
136 rtrid_t link_nrtid;
137 } rla_link[1]; /* may repeat */
138 } un_rla;
139
140 /* Network links advertisements */
141 struct {
142 u_int32_t nla_options;
143 rtrid_t nla_router[1]; /* may repeat */
144 } un_nla;
145
146 /* Inter Area Prefix LSA */
147 struct {
148 u_int32_t inter_ap_metric;
149 struct lsa_prefix inter_ap_prefix[1];
150 } un_inter_ap;
151
152 /* AS external links advertisements */
153 struct {
154 u_int32_t asla_metric;
155 struct lsa_prefix asla_prefix[1];
156 /* some optional fields follow */
157 } un_asla;
158
159 #if 0
160 /* Summary links advertisements */
161 struct {
162 struct in_addr sla_mask;
163 u_int32_t sla_tosmetric[1]; /* may repeat */
164 } un_sla;
165
166 /* Multicast group membership */
167 struct mcla {
168 u_int32_t mcla_vtype;
169 struct in_addr mcla_vid;
170 } un_mcla[1];
171 #endif
172
173 /* Type 7 LSA */
174
175 /* Link LSA */
176 struct llsa {
177 union {
178 u_int8_t pri;
179 u_int32_t opt;
180 } llsa_priandopt;
181 #define llsa_priority llsa_priandopt.pri
182 #define llsa_options llsa_priandopt.opt
183 struct in6_addr llsa_lladdr;
184 u_int32_t llsa_nprefix;
185 struct lsa_prefix llsa_prefix[1];
186 } un_llsa;
187
188 /* Intra-Area-Prefix */
189 struct {
190 u_int16_t intra_ap_nprefix;
191 u_int16_t intra_ap_lstype;
192 rtrid_t intra_ap_lsid;
193 rtrid_t intra_ap_rtid;
194 struct lsa_prefix intra_ap_prefix[1];
195 } un_intra_ap;
196 } lsa_un;
197 } ;
198
199
200 /*
201 * TOS metric struct (will be 0 or more in router links update)
202 */
203 struct tos_metric {
204 u_int8_t tos_type;
205 u_int8_t tos_zero;
206 u_int16_t tos_metric;
207 } ;
208
209 #define OSPF_AUTH_SIZE 8
210
211 /*
212 * the main header
213 */
214 struct ospf6hdr {
215 u_int8_t ospf6_version;
216 u_int8_t ospf6_type;
217 u_int16_t ospf6_len;
218 rtrid_t ospf6_routerid;
219 rtrid_t ospf6_areaid;
220 u_int16_t ospf6_chksum;
221 u_int8_t ospf6_instanceid;
222 u_int8_t ospf6_rsvd;
223 union {
224
225 /* Hello packet */
226 struct {
227 u_int32_t hello_ifid;
228 union {
229 u_int8_t pri;
230 u_int32_t opt;
231 } hello_priandopt;
232 #define hello_priority hello_priandopt.pri
233 #define hello_options hello_priandopt.opt
234 u_int16_t hello_helloint;
235 u_int16_t hello_deadint;
236 rtrid_t hello_dr;
237 rtrid_t hello_bdr;
238 rtrid_t hello_neighbor[1]; /* may repeat */
239 } un_hello;
240
241 /* Database Description packet */
242 struct {
243 u_int32_t db_options;
244 u_int16_t db_mtu;
245 u_int8_t db_mbz;
246 u_int8_t db_flags;
247 u_int32_t db_seq;
248 struct lsa_hdr db_lshdr[1]; /* may repeat */
249 } un_db;
250
251 /* Link State Request */
252 struct lsr {
253 u_int16_t ls_mbz;
254 u_int16_t ls_type;
255 rtrid_t ls_stateid;
256 rtrid_t ls_router;
257 } un_lsr[1]; /* may repeat */
258
259 /* Link State Update */
260 struct {
261 u_int32_t lsu_count;
262 struct lsa lsu_lsa[1]; /* may repeat */
263 } un_lsu;
264
265 /* Link State Acknowledgement */
266 struct {
267 struct lsa_hdr lsa_lshdr[1]; /* may repeat */
268 } un_lsa ;
269 } ospf6_un ;
270 } ;
271
272 #define ospf6_hello ospf6_un.un_hello
273 #define ospf6_db ospf6_un.un_db
274 #define ospf6_lsr ospf6_un.un_lsr
275 #define ospf6_lsu ospf6_un.un_lsu
276 #define ospf6_lsa ospf6_un.un_lsa
277