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