]> git.saurik.com Git - apple/network_cmds.git/blob - tcpdump.tproj/ospf.h
network_cmds-76.tar.gz
[apple/network_cmds.git] / tcpdump.tproj / ospf.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
12 * this file.
13 *
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
20 * under the License."
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24 /*
25 * Copyright (c) 1991, 1993, 1994, 1995, 1996
26 * The Regents of the University of California. All rights reserved.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that: (1) source code distributions
30 * retain the above copyright notice and this paragraph in its entirety, (2)
31 * distributions including binary code include the above copyright notice and
32 * this paragraph in its entirety in the documentation or other materials
33 * provided with the distribution, and (3) all advertising materials mentioning
34 * features or use of this software display the following acknowledgement:
35 * ``This product includes software developed by the University of California,
36 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
37 * the University nor the names of its contributors may be used to endorse
38 * or promote products derived from this software without specific prior
39 * written permission.
40 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
41 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
42 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
43 *
44 * OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu)
45 */
46 #define OSPF_TYPE_UMD 0 /* UMd's special monitoring packets */
47 #define OSPF_TYPE_HELLO 1 /* Hello */
48 #define OSPF_TYPE_DB 2 /* Database Description */
49 #define OSPF_TYPE_LSR 3 /* Link State Request */
50 #define OSPF_TYPE_LSU 4 /* Link State Update */
51 #define OSPF_TYPE_LSA 5 /* Link State Ack */
52 #define OSPF_TYPE_MAX 6
53
54 /* Options *_options */
55 #define OSPF_OPTION_T 0x01 /* T bit: TOS support */
56 #define OSPF_OPTION_E 0x02 /* E bit: External routes advertised */
57 #define OSPF_OPTION_MC 0x04 /* MC bit: Multicast capable */
58
59 /* ospf_authtype */
60 #define OSPF_AUTH_NONE 0 /* No auth-data */
61 #define OSPF_AUTH_SIMPLE 1 /* Simple password */
62
63 /* db_flags */
64 #define OSPF_DB_INIT 0x04 /* */
65 #define OSPF_DB_MORE 0x02
66 #define OSPF_DB_MASTER 0x01
67
68 /* ls_type */
69 #define LS_TYPE_ROUTER 1 /* router link */
70 #define LS_TYPE_NETWORK 2 /* network link */
71 #define LS_TYPE_SUM_IP 3 /* summary link */
72 #define LS_TYPE_SUM_ABR 4 /* summary area link */
73 #define LS_TYPE_ASE 5 /* ASE */
74 #define LS_TYPE_GROUP 6 /* Group membership (multicast */
75 /* extensions 23 July 1991) */
76 #define LS_TYPE_MAX 7
77
78 /*************************************************
79 *
80 * is the above a bug in the documentation?
81 *
82 *************************************************/
83
84
85 /* rla_link.link_type */
86 #define RLA_TYPE_ROUTER 1 /* point-to-point to another router */
87 #define RLA_TYPE_TRANSIT 2 /* connection to transit network */
88 #define RLA_TYPE_STUB 3 /* connection to stub network */
89 #define RLA_TYPE_VIRTUAL 4 /* virtual link */
90
91 /* rla_flags */
92 #define RLA_FLAG_B 0x01
93 #define RLA_FLAG_E 0x02
94 #define RLA_FLAG_W1 0x04
95 #define RLA_FLAG_W2 0x08
96
97 /* sla_tosmetric breakdown */
98 #define SLA_MASK_TOS 0x7f000000
99 #define SLA_MASK_METRIC 0x00ffffff
100 #define SLA_SHIFT_TOS 24
101
102 /* asla_tosmetric breakdown */
103 #define ASLA_FLAG_EXTERNAL 0x80000000
104 #define ASLA_MASK_TOS 0x7f000000
105 #define ASLA_SHIFT_TOS 24
106 #define ASLA_MASK_METRIC 0x00ffffff
107
108 /* multicast vertex type */
109 #define MCLA_VERTEX_ROUTER 1
110 #define MCLA_VERTEX_NETWORK 2
111
112 /* link state advertisement header */
113 struct lsa_hdr {
114 u_short ls_age;
115 u_char ls_options;
116 u_char ls_type;
117 struct in_addr ls_stateid;
118 struct in_addr ls_router;
119 u_int32_t ls_seq;
120 u_short ls_chksum;
121 u_short ls_length;
122 } ;
123
124 /* link state advertisement */
125 struct lsa {
126 struct lsa_hdr ls_hdr;
127
128 /* Link state types */
129 union {
130 /* Router links advertisements */
131 struct {
132 u_char rla_flags;
133 u_char rla_zero[1];
134 u_short rla_count;
135 struct rlalink {
136 struct in_addr link_id;
137 struct in_addr link_data;
138 u_char link_type;
139 u_char link_toscount;
140 u_short link_tos0metric;
141 } rla_link[1]; /* may repeat */
142 } un_rla;
143
144 /* Network links advertisements */
145 struct {
146 struct in_addr nla_mask;
147 struct in_addr nla_router[1]; /* may repeat */
148 } un_nla;
149
150 /* Summary links advertisements */
151 struct {
152 struct in_addr sla_mask;
153 u_int32_t sla_tosmetric[1]; /* may repeat */
154 } un_sla;
155
156 /* AS external links advertisements */
157 struct {
158 struct in_addr asla_mask;
159 struct aslametric {
160 u_int32_t asla_tosmetric;
161 struct in_addr asla_forward;
162 struct in_addr asla_tag;
163 } asla_metric[1]; /* may repeat */
164 } un_asla;
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 } lsa_un;
172 } ;
173
174
175 /*
176 * TOS metric struct (will be 0 or more in router links update)
177 */
178 struct tos_metric {
179 u_char tos_type;
180 u_char tos_zero;
181 u_short tos_metric;
182 } ;
183
184 #define OSPF_AUTH_SIZE 8
185
186 /*
187 * the main header
188 */
189 struct ospfhdr {
190 u_char ospf_version;
191 u_char ospf_type;
192 u_short ospf_len;
193 struct in_addr ospf_routerid;
194 struct in_addr ospf_areaid;
195 u_short ospf_chksum;
196 u_short ospf_authtype;
197 u_char ospf_authdata[OSPF_AUTH_SIZE];
198 union {
199
200 /* Hello packet */
201 struct {
202 struct in_addr hello_mask;
203 u_short hello_helloint;
204 u_char hello_options;
205 u_char hello_priority;
206 u_int32_t hello_deadint;
207 struct in_addr hello_dr;
208 struct in_addr hello_bdr;
209 struct in_addr hello_neighbor[1]; /* may repeat */
210 } un_hello;
211
212 /* Database Description packet */
213 struct {
214 u_char db_zero[2];
215 u_char db_options;
216 u_char db_flags;
217 u_int32_t db_seq;
218 struct lsa_hdr db_lshdr[1]; /* may repeat */
219 } un_db;
220
221 /* Link State Request */
222 struct lsr {
223 u_int32_t ls_type;
224 struct in_addr ls_stateid;
225 struct in_addr ls_router;
226 } un_lsr[1]; /* may repeat */
227
228 /* Link State Update */
229 struct {
230 u_int32_t lsu_count;
231 struct lsa lsu_lsa[1]; /* may repeat */
232 } un_lsu;
233
234 /* Link State Acknowledgement */
235 struct {
236 struct lsa_hdr lsa_lshdr[1]; /* may repeat */
237 } un_lsa ;
238 } ospf_un ;
239 } ;
240
241 #define ospf_hello ospf_un.un_hello
242 #define ospf_db ospf_un.un_db
243 #define ospf_lsr ospf_un.un_lsr
244 #define ospf_lsu ospf_un.un_lsu
245 #define ospf_lsa ospf_un.un_lsa
246