test/kq_connect_client: Make result accurate
[dragonfly.git] / contrib / tcpdump / ospf6.h
blobe2eabee1815cc21e9da1c4d037b7420a5a1e85fd
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.
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_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 */
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 */
39 /* db_flags */
40 #define OSPF6_DB_INIT 0x04 /* */
41 #define OSPF6_DB_MORE 0x02
42 #define OSPF6_DB_MASTER 0x01
44 /* ls_type */
45 #define LS_TYPE_ROUTER 1 /* router link */
46 #define LS_TYPE_NETWORK 2 /* network link */
47 #define LS_TYPE_INTER_AP 3 /* Inter-Area-Prefix */
48 #define LS_TYPE_INTER_AR 4 /* Inter-Area-Router */
49 #define LS_TYPE_ASE 5 /* ASE */
50 #define LS_TYPE_GROUP 6 /* Group membership */
51 #define LS_TYPE_NSSA 7 /* NSSA */
52 #define LS_TYPE_LINK 8 /* Link LSA */
53 #define LS_TYPE_INTRA_AP 9 /* Intra-Area-Prefix */
54 #define LS_TYPE_INTRA_ATE 10 /* Intra-Area-TE */
55 #define LS_TYPE_GRACE 11 /* Grace LSA */
56 #define LS_TYPE_MASK 0x1fff
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 #define LS_SCOPE_U 0x8000
64 /* rla_link.link_type */
65 #define RLA_TYPE_ROUTER 1 /* point-to-point to another router */
66 #define RLA_TYPE_TRANSIT 2 /* connection to transit network */
67 #define RLA_TYPE_VIRTUAL 4 /* virtual link */
69 /* rla_flags */
70 #define RLA_FLAG_B 0x01
71 #define RLA_FLAG_E 0x02
72 #define RLA_FLAG_V 0x04
73 #define RLA_FLAG_W 0x08
74 #define RLA_FLAG_N 0x10
76 /* lsa_prefix options */
77 #define LSA_PREFIX_OPT_NU 0x01
78 #define LSA_PREFIX_OPT_LA 0x02
79 #define LSA_PREFIX_OPT_MC 0x04
80 #define LSA_PREFIX_OPT_P 0x08
81 #define LSA_PREFIX_OPT_DN 0x10
83 /* sla_tosmetric breakdown */
84 #define SLA_MASK_TOS 0x7f000000
85 #define SLA_MASK_METRIC 0x00ffffff
86 #define SLA_SHIFT_TOS 24
88 /* asla_metric */
89 #define ASLA_FLAG_FWDADDR 0x02000000
90 #define ASLA_FLAG_ROUTETAG 0x01000000
91 #define ASLA_MASK_METRIC 0x00ffffff
93 typedef u_int32_t rtrid_t;
95 /* link state advertisement header */
96 struct lsa6_hdr {
97 u_int16_t ls_age;
98 u_int16_t ls_type;
99 rtrid_t ls_stateid;
100 rtrid_t ls_router;
101 u_int32_t ls_seq;
102 u_int16_t ls_chksum;
103 u_int16_t ls_length;
106 struct lsa6_prefix {
107 u_int8_t lsa_p_len;
108 u_int8_t lsa_p_opt;
109 u_int16_t lsa_p_metric;
110 u_int8_t lsa_p_prefix[4];
113 /* link state advertisement */
114 struct lsa6 {
115 struct lsa6_hdr ls_hdr;
117 /* Link state types */
118 union {
119 /* Router links advertisements */
120 struct {
121 union {
122 u_int8_t flg;
123 u_int32_t opt;
124 } rla_flgandopt;
125 #define rla_flags rla_flgandopt.flg
126 #define rla_options rla_flgandopt.opt
127 struct rlalink6 {
128 u_int8_t link_type;
129 u_int8_t link_zero[1];
130 u_int16_t link_metric;
131 u_int32_t link_ifid;
132 u_int32_t link_nifid;
133 rtrid_t link_nrtid;
134 } rla_link[1]; /* may repeat */
135 } un_rla;
137 /* Network links advertisements */
138 struct {
139 u_int32_t nla_options;
140 rtrid_t nla_router[1]; /* may repeat */
141 } un_nla;
143 /* Inter Area Prefix LSA */
144 struct {
145 u_int32_t inter_ap_metric;
146 struct lsa6_prefix inter_ap_prefix[1];
147 } un_inter_ap;
149 /* AS external links advertisements */
150 struct {
151 u_int32_t asla_metric;
152 struct lsa6_prefix asla_prefix[1];
153 /* some optional fields follow */
154 } un_asla;
156 #if 0
157 /* Summary links advertisements */
158 struct {
159 struct in_addr sla_mask;
160 u_int32_t sla_tosmetric[1]; /* may repeat */
161 } un_sla;
163 /* Multicast group membership */
164 struct mcla {
165 u_int32_t mcla_vtype;
166 struct in_addr mcla_vid;
167 } un_mcla[1];
168 #endif
170 /* Type 7 LSA */
172 /* Link LSA */
173 struct llsa {
174 union {
175 u_int8_t pri;
176 u_int32_t opt;
177 } llsa_priandopt;
178 #define llsa_priority llsa_priandopt.pri
179 #define llsa_options llsa_priandopt.opt
180 struct in6_addr llsa_lladdr;
181 u_int32_t llsa_nprefix;
182 struct lsa6_prefix llsa_prefix[1];
183 } un_llsa;
185 /* Intra-Area-Prefix */
186 struct {
187 u_int16_t intra_ap_nprefix;
188 u_int16_t intra_ap_lstype;
189 rtrid_t intra_ap_lsid;
190 rtrid_t intra_ap_rtid;
191 struct lsa6_prefix intra_ap_prefix[1];
192 } un_intra_ap;
193 } lsa_un;
197 #define OSPF_AUTH_SIZE 8
200 * the main header
202 struct ospf6hdr {
203 u_int8_t ospf6_version;
204 u_int8_t ospf6_type;
205 u_int16_t ospf6_len;
206 rtrid_t ospf6_routerid;
207 rtrid_t ospf6_areaid;
208 u_int16_t ospf6_chksum;
209 u_int8_t ospf6_instanceid;
210 u_int8_t ospf6_rsvd;
211 union {
213 /* Hello packet */
214 struct {
215 u_int32_t hello_ifid;
216 union {
217 u_int8_t pri;
218 u_int32_t opt;
219 } hello_priandopt;
220 #define hello_priority hello_priandopt.pri
221 #define hello_options hello_priandopt.opt
222 u_int16_t hello_helloint;
223 u_int16_t hello_deadint;
224 rtrid_t hello_dr;
225 rtrid_t hello_bdr;
226 rtrid_t hello_neighbor[1]; /* may repeat */
227 } un_hello;
229 /* Database Description packet */
230 struct {
231 u_int32_t db_options;
232 u_int16_t db_mtu;
233 u_int8_t db_mbz;
234 u_int8_t db_flags;
235 u_int32_t db_seq;
236 struct lsa6_hdr db_lshdr[1]; /* may repeat */
237 } un_db;
239 /* Link State Request */
240 struct lsr6 {
241 u_int16_t ls_mbz;
242 u_int16_t ls_type;
243 rtrid_t ls_stateid;
244 rtrid_t ls_router;
245 } un_lsr[1]; /* may repeat */
247 /* Link State Update */
248 struct {
249 u_int32_t lsu_count;
250 struct lsa6 lsu_lsa[1]; /* may repeat */
251 } un_lsu;
253 /* Link State Acknowledgement */
254 struct {
255 struct lsa6_hdr lsa_lshdr[1]; /* may repeat */
256 } un_lsa ;
257 } ospf6_un ;
260 #define ospf6_hello ospf6_un.un_hello
261 #define ospf6_db ospf6_un.un_db
262 #define ospf6_lsr ospf6_un.un_lsr
263 #define ospf6_lsu ospf6_un.un_lsu
264 #define ospf6_lsa ospf6_un.un_lsa