2 * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
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
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.
21 * OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu)
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
31 /* Options *_options */
32 #define OSPF_OPTION_T 0x01 /* T bit: TOS support */
33 #define OSPF_OPTION_E 0x02 /* E bit: External routes advertised */
34 #define OSPF_OPTION_MC 0x04 /* MC bit: Multicast capable */
37 #define OSPF_AUTH_NONE 0 /* No auth-data */
38 #define OSPF_AUTH_SIMPLE 1 /* Simple password */
39 #define OSPF_AUTH_MD5 2 /* MD5 authentication */
40 #define OSPF_AUTH_MD5_LEN 16 /* length of MD5 authentication */
44 #define OSPF_DB_INIT 0x04 /* */
45 #define OSPF_DB_MORE 0x02
46 #define OSPF_DB_MASTER 0x01
49 #define LS_TYPE_ROUTER 1 /* router link */
50 #define LS_TYPE_NETWORK 2 /* network link */
51 #define LS_TYPE_SUM_IP 3 /* summary link */
52 #define LS_TYPE_SUM_ABR 4 /* summary area link */
53 #define LS_TYPE_ASE 5 /* ASE */
54 #define LS_TYPE_GROUP 6 /* Group membership (multicast */
55 /* extensions 23 July 1991) */
58 /*************************************************
60 * is the above a bug in the documentation?
62 *************************************************/
65 /* rla_link.link_type */
66 #define RLA_TYPE_ROUTER 1 /* point-to-point to another router */
67 #define RLA_TYPE_TRANSIT 2 /* connection to transit network */
68 #define RLA_TYPE_STUB 3 /* connection to stub network */
69 #define RLA_TYPE_VIRTUAL 4 /* virtual link */
72 #define RLA_FLAG_B 0x01
73 #define RLA_FLAG_E 0x02
74 #define RLA_FLAG_W1 0x04
75 #define RLA_FLAG_W2 0x08
77 /* sla_tosmetric breakdown */
78 #define SLA_MASK_TOS 0x7f000000
79 #define SLA_MASK_METRIC 0x00ffffff
80 #define SLA_SHIFT_TOS 24
82 /* asla_tosmetric breakdown */
83 #define ASLA_FLAG_EXTERNAL 0x80000000
84 #define ASLA_MASK_TOS 0x7f000000
85 #define ASLA_SHIFT_TOS 24
86 #define ASLA_MASK_METRIC 0x00ffffff
88 /* multicast vertex type */
89 #define MCLA_VERTEX_ROUTER 1
90 #define MCLA_VERTEX_NETWORK 2
92 /* link state advertisement header */
97 struct in_addr ls_stateid;
98 struct in_addr ls_router;
104 /* link state advertisement */
106 struct lsa_hdr ls_hdr;
108 /* Link state types */
110 /* Router links advertisements */
116 struct in_addr link_id;
117 struct in_addr link_data;
119 u_char link_toscount;
120 u_short link_tos0metric;
121 } rla_link[1]; /* may repeat */
124 /* Network links advertisements */
126 struct in_addr nla_mask;
127 struct in_addr nla_router[1]; /* may repeat */
130 /* Summary links advertisements */
132 struct in_addr sla_mask;
133 u_int32_t sla_tosmetric[1]; /* may repeat */
136 /* AS external links advertisements */
138 struct in_addr asla_mask;
140 u_int32_t asla_tosmetric;
141 struct in_addr asla_forward;
142 struct in_addr asla_tag;
143 } asla_metric[1]; /* may repeat */
146 /* Multicast group membership */
148 u_int32_t mcla_vtype;
149 struct in_addr mcla_vid;
156 * TOS metric struct (will be 0 or more in router links update)
164 #define OSPF_AUTH_SIZE 8
173 struct in_addr ospf_routerid;
174 struct in_addr ospf_areaid;
176 u_short ospf_authtype;
177 u_char ospf_authdata[OSPF_AUTH_SIZE];
182 struct in_addr hello_mask;
183 u_short hello_helloint;
184 u_char hello_options;
185 u_char hello_priority;
186 u_int32_t hello_deadint;
187 struct in_addr hello_dr;
188 struct in_addr hello_bdr;
189 struct in_addr hello_neighbor[1]; /* may repeat */
192 /* Database Description packet */
198 struct lsa_hdr db_lshdr[1]; /* may repeat */
201 /* Link State Request */
204 struct in_addr ls_stateid;
205 struct in_addr ls_router;
206 } un_lsr[1]; /* may repeat */
208 /* Link State Update */
211 struct lsa lsu_lsa[1]; /* may repeat */
214 /* Link State Acknowledgement */
216 struct lsa_hdr lsa_lshdr[1]; /* may repeat */
221 #define ospf_hello ospf_un.un_hello
222 #define ospf_db ospf_un.un_db
223 #define ospf_lsr ospf_un.un_lsr
224 #define ospf_lsu ospf_un.un_lsu
225 #define ospf_lsa ospf_un.un_lsa