]> The Tcpdump Group git mirrors - tcpdump/blob - ospf6.h
Move stuff from tftp.h to print-tftp.c; it's not used elsewhere.
[tcpdump] / ospf6.h
1 /* @(#) $Header: /tcpdump/master/tcpdump/ospf6.h,v 1.7 2006-09-05 15:50:26 hannes Exp $ (LBL) */
2 /*
3 * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
4 * The Regents of the University of California. All rights reserved.
5 *
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.
21 *
22 * OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu)
23 */
24 #define OSPF_TYPE_HELLO 1 /* Hello */
25 #define OSPF_TYPE_DD 2 /* Database Description */
26 #define OSPF_TYPE_LS_REQ 3 /* Link State Request */
27 #define OSPF_TYPE_LS_UPDATE 4 /* Link State Update */
28 #define OSPF_TYPE_LS_ACK 5 /* Link State Ack */
29
30 /* Options *_options */
31 #define OSPF6_OPTION_V6 0x01 /* V6 bit: A bit for peeping tom */
32 #define OSPF6_OPTION_E 0x02 /* E bit: External routes advertised */
33 #define OSPF6_OPTION_MC 0x04 /* MC bit: Multicast capable */
34 #define OSPF6_OPTION_N 0x08 /* N bit: For type-7 LSA */
35 #define OSPF6_OPTION_R 0x10 /* R bit: Router bit */
36 #define OSPF6_OPTION_DC 0x20 /* DC bit: Demand circuits */
37 /* The field is actually 24-bit (RFC5340 Section A.2). */
38 #define OSPF6_OPTION_AF 0x0100 /* AF bit: Multiple address families */
39 #define OSPF6_OPTION_L 0x0200 /* L bit: Link-local signaling (LLS) */
40 #define OSPF6_OPTION_AT 0x0400 /* AT bit: Authentication trailer */
41
42
43 /* db_flags */
44 #define OSPF6_DB_INIT 0x04 /* */
45 #define OSPF6_DB_MORE 0x02
46 #define OSPF6_DB_MASTER 0x01
47 #define OSPF6_DB_M6 0x10 /* IPv6 MTU */
48
49 /* ls_type */
50 #define LS_TYPE_ROUTER 1 /* router link */
51 #define LS_TYPE_NETWORK 2 /* network link */
52 #define LS_TYPE_INTER_AP 3 /* Inter-Area-Prefix */
53 #define LS_TYPE_INTER_AR 4 /* Inter-Area-Router */
54 #define LS_TYPE_ASE 5 /* ASE */
55 #define LS_TYPE_GROUP 6 /* Group membership */
56 #define LS_TYPE_NSSA 7 /* NSSA */
57 #define LS_TYPE_LINK 8 /* Link LSA */
58 #define LS_TYPE_INTRA_AP 9 /* Intra-Area-Prefix */
59 #define LS_TYPE_INTRA_ATE 10 /* Intra-Area-TE */
60 #define LS_TYPE_GRACE 11 /* Grace LSA */
61 #define LS_TYPE_RI 12 /* Router information */
62 #define LS_TYPE_INTER_ASTE 13 /* Inter-AS-TE */
63 #define LS_TYPE_L1VPN 14 /* L1VPN */
64 #define LS_TYPE_MASK 0x1fff
65
66 #define LS_SCOPE_LINKLOCAL 0x0000
67 #define LS_SCOPE_AREA 0x2000
68 #define LS_SCOPE_AS 0x4000
69 #define LS_SCOPE_MASK 0x6000
70 #define LS_SCOPE_U 0x8000
71
72 /* rla_link.link_type */
73 #define RLA_TYPE_ROUTER 1 /* point-to-point to another router */
74 #define RLA_TYPE_TRANSIT 2 /* connection to transit network */
75 #define RLA_TYPE_VIRTUAL 4 /* virtual link */
76
77 /* rla_flags */
78 #define RLA_FLAG_B 0x01
79 #define RLA_FLAG_E 0x02
80 #define RLA_FLAG_V 0x04
81 #define RLA_FLAG_W 0x08
82 #define RLA_FLAG_N 0x10
83
84 /* lsa_prefix options */
85 #define LSA_PREFIX_OPT_NU 0x01
86 #define LSA_PREFIX_OPT_LA 0x02
87 #define LSA_PREFIX_OPT_MC 0x04
88 #define LSA_PREFIX_OPT_P 0x08
89 #define LSA_PREFIX_OPT_DN 0x10
90
91 /* sla_tosmetric breakdown */
92 #define SLA_MASK_TOS 0x7f000000
93 #define SLA_MASK_METRIC 0x00ffffff
94 #define SLA_SHIFT_TOS 24
95
96 /* asla_metric */
97 #define ASLA_FLAG_FWDADDR 0x02000000
98 #define ASLA_FLAG_ROUTETAG 0x01000000
99 #define ASLA_MASK_METRIC 0x00ffffff
100
101 /* RFC6506 Section 4.1 */
102 #define OSPF6_AT_HDRLEN 16U
103 #define OSPF6_AUTH_TYPE_HMAC 0x0001
104
105 typedef u_int32_t rtrid_t;
106
107 /* link state advertisement header */
108 struct lsa6_hdr {
109 u_int16_t ls_age;
110 u_int16_t ls_type;
111 rtrid_t ls_stateid;
112 rtrid_t ls_router;
113 u_int32_t ls_seq;
114 u_int16_t ls_chksum;
115 u_int16_t ls_length;
116 };
117
118 struct lsa6_prefix {
119 u_int8_t lsa_p_len;
120 u_int8_t lsa_p_opt;
121 u_int16_t lsa_p_metric;
122 u_int8_t lsa_p_prefix[4];
123 };
124
125 /* link state advertisement */
126 struct lsa6 {
127 struct lsa6_hdr ls_hdr;
128
129 /* Link state types */
130 union {
131 /* Router links advertisements */
132 struct {
133 union {
134 u_int8_t flg;
135 u_int32_t opt;
136 } rla_flgandopt;
137 #define rla_flags rla_flgandopt.flg
138 #define rla_options rla_flgandopt.opt
139 struct rlalink6 {
140 u_int8_t link_type;
141 u_int8_t link_zero[1];
142 u_int16_t link_metric;
143 u_int32_t link_ifid;
144 u_int32_t link_nifid;
145 rtrid_t link_nrtid;
146 } rla_link[1]; /* may repeat */
147 } un_rla;
148
149 /* Network links advertisements */
150 struct {
151 u_int32_t nla_options;
152 rtrid_t nla_router[1]; /* may repeat */
153 } un_nla;
154
155 /* Inter Area Prefix LSA */
156 struct {
157 u_int32_t inter_ap_metric;
158 struct lsa6_prefix inter_ap_prefix[1];
159 } un_inter_ap;
160
161 /* AS external links advertisements */
162 struct {
163 u_int32_t asla_metric;
164 struct lsa6_prefix asla_prefix[1];
165 /* some optional fields follow */
166 } un_asla;
167
168 #if 0
169 /* Summary links advertisements */
170 struct {
171 struct in_addr sla_mask;
172 u_int32_t sla_tosmetric[1]; /* may repeat */
173 } un_sla;
174
175 /* Multicast group membership */
176 struct mcla {
177 u_int32_t mcla_vtype;
178 struct in_addr mcla_vid;
179 } un_mcla[1];
180 #endif
181
182 /* Type 7 LSA */
183
184 /* Link LSA */
185 struct llsa {
186 union {
187 u_int8_t pri;
188 u_int32_t opt;
189 } llsa_priandopt;
190 #define llsa_priority llsa_priandopt.pri
191 #define llsa_options llsa_priandopt.opt
192 struct in6_addr llsa_lladdr;
193 u_int32_t llsa_nprefix;
194 struct lsa6_prefix llsa_prefix[1];
195 } un_llsa;
196
197 /* Intra-Area-Prefix */
198 struct {
199 u_int16_t intra_ap_nprefix;
200 u_int16_t intra_ap_lstype;
201 rtrid_t intra_ap_lsid;
202 rtrid_t intra_ap_rtid;
203 struct lsa6_prefix intra_ap_prefix[1];
204 } un_intra_ap;
205 } lsa_un;
206 };
207
208 /*
209 * the main header
210 */
211 struct ospf6hdr {
212 u_int8_t ospf6_version;
213 u_int8_t ospf6_type;
214 u_int16_t ospf6_len;
215 rtrid_t ospf6_routerid;
216 rtrid_t ospf6_areaid;
217 u_int16_t ospf6_chksum;
218 u_int8_t ospf6_instanceid;
219 u_int8_t ospf6_rsvd;
220 union {
221
222 /* Hello packet */
223 struct {
224 u_int32_t hello_ifid;
225 union {
226 u_int8_t pri;
227 u_int32_t opt;
228 } hello_priandopt;
229 #define hello_priority hello_priandopt.pri
230 #define hello_options hello_priandopt.opt
231 u_int16_t hello_helloint;
232 u_int16_t hello_deadint;
233 rtrid_t hello_dr;
234 rtrid_t hello_bdr;
235 rtrid_t hello_neighbor[1]; /* may repeat */
236 } un_hello;
237
238 /* Database Description packet */
239 struct {
240 u_int32_t db_options;
241 u_int16_t db_mtu;
242 u_int8_t db_mbz;
243 u_int8_t db_flags;
244 u_int32_t db_seq;
245 struct lsa6_hdr db_lshdr[1]; /* may repeat */
246 } un_db;
247
248 /* Link State Request */
249 struct lsr6 {
250 u_int16_t ls_mbz;
251 u_int16_t ls_type;
252 rtrid_t ls_stateid;
253 rtrid_t ls_router;
254 } un_lsr[1]; /* may repeat */
255
256 /* Link State Update */
257 struct {
258 u_int32_t lsu_count;
259 struct lsa6 lsu_lsa[1]; /* may repeat */
260 } un_lsu;
261
262 /* Link State Acknowledgement */
263 struct {
264 struct lsa6_hdr lsa_lshdr[1]; /* may repeat */
265 } un_lsa ;
266 } ospf6_un ;
267 };
268
269 #define ospf6_hello ospf6_un.un_hello
270 #define ospf6_db ospf6_un.un_db
271 #define ospf6_lsr ospf6_un.un_lsr
272 #define ospf6_lsu ospf6_un.un_lsu
273 #define ospf6_lsa ospf6_un.un_lsa
274