]>
Commit | Line | Data |
---|---|---|
0ef4bcdc OD |
1 | /* |
2 | * This is an implementation of RFC4970 Router Information | |
3 | * with support of RFC5088 PCE Capabilites announcement | |
4 | * | |
5 | * Module name: Router Information | |
6 | * Version: 0.99.22 | |
7 | * Created: 2012-02-01 by Olivier Dugeon | |
8 | * Copyright (C) 2012 Orange Labs http://www.orange.com/ | |
9 | * | |
10 | * This file is part of GNU Zebra. | |
11 | * | |
12 | * GNU Zebra is free software; you can redistribute it and/or modify it | |
13 | * under the terms of the GNU General Public License as published by the | |
14 | * Free Software Foundation; either version 2, or (at your option) any | |
15 | * later version. | |
16 | * | |
17 | * GNU Zebra is distributed in the hope that it will be useful, but | |
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
20 | * General Public License for more details. | |
21 | * | |
896014f4 DL |
22 | * You should have received a copy of the GNU General Public License along |
23 | * with this program; see the file COPYING; if not, write to the Free Software | |
24 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
0ef4bcdc OD |
25 | */ |
26 | ||
27 | #ifndef _ZEBRA_OSPF_ROUTER_INFO_H | |
28 | #define _ZEBRA_OSPF_ROUTER_INFO_H | |
29 | ||
30 | /* | |
31 | * Opaque LSA's link state ID for Router Information is | |
32 | * structured as follows. | |
33 | * | |
34 | * 24 16 8 0 | |
35 | * +--------+--------+--------+--------+ | |
36 | * | 1 | MBZ |........|........| | |
37 | * +--------+--------+--------+--------+ | |
38 | * |<-Type->|<Resv'd>|<-- Instance --->| | |
39 | * | |
40 | * | |
41 | * Type: IANA has assigned '4' for Router Information. | |
42 | * MBZ: Reserved, must be set to zero. | |
43 | * Instance: User may select an arbitrary 16-bit value. | |
44 | * | |
45 | */ | |
46 | ||
47 | /* | |
48 | * 24 16 8 0 | |
49 | * +--------+--------+--------+--------+ --- | |
50 | * | LS age |Options | 9,10,11| A | |
51 | * +--------+--------+--------+--------+ | | |
52 | * | 4 | 0 | Instance | | | |
53 | * +--------+--------+--------+--------+ | | |
54 | * | Advertising router | | Standard (Opaque) LSA header; | |
55 | * +--------+--------+--------+--------+ | Type 9,10 or 11 are used. | |
56 | * | LS sequence number | | | |
57 | * +--------+--------+--------+--------+ | | |
58 | * | LS checksum | Length | V | |
59 | * +--------+--------+--------+--------+ --- | |
60 | * | Type | Length | A | |
61 | * +--------+--------+--------+--------+ | TLV part for Router Information; Values might be | |
62 | * | Values ... | V structured as a set of sub-TLVs. | |
63 | * +--------+--------+--------+--------+ --- | |
64 | */ | |
65 | ||
66 | /* | |
67 | * Following section defines TLV (tag, length, value) structures, | |
68 | * used for Router Information. | |
69 | */ | |
70 | struct ri_tlv_header | |
71 | { | |
72 | u_int16_t type; /* RI_TLV_XXX (see below) */ | |
73 | u_int16_t length; /* Value portion only, in byte */ | |
74 | }; | |
75 | ||
76 | #define RI_TLV_HDR_SIZE (sizeof (struct ri_tlv_header)) | |
77 | #define RI_TLV_BODY_SIZE(tlvh) (ROUNDUP (ntohs ((tlvh)->length), sizeof (u_int32_t))) | |
78 | #define RI_TLV_SIZE(tlvh) (RI_TLV_HDR_SIZE + RI_TLV_BODY_SIZE(tlvh)) | |
79 | #define RI_TLV_HDR_TOP(lsah) (struct ri_tlv_header *)((char *)(lsah) + OSPF_LSA_HEADER_SIZE) | |
80 | #define RI_TLV_HDR_NEXT(tlvh) (struct ri_tlv_header *)((char *)(tlvh) + RI_TLV_SIZE(tlvh)) | |
81 | ||
82 | /* | |
83 | * Following section defines TLV body parts. | |
84 | */ | |
85 | ||
86 | /* Up to now, 8 code point have been assigned to Router Information */ | |
87 | /* Only type 1 Router Capabilities and 6 PCE are supported with this code */ | |
88 | #define RI_IANA_MAX_TYPE 8 | |
89 | ||
90 | /* RFC4970: Router Information Capabilities TLV */ /* Mandatory */ | |
91 | #define RI_TLV_CAPABILITIES 1 | |
92 | ||
93 | struct ri_tlv_router_cap | |
94 | { | |
95 | struct ri_tlv_header header; /* Value length is 4 bytes. */ | |
96 | u_int32_t value; | |
97 | }; | |
98 | ||
99 | #define RI_GRACE_RESTART 0x01 | |
100 | #define RI_GRACE_HELPER 0x02 | |
101 | #define RI_STUB_SUPPORT 0x04 | |
102 | #define RI_TE_SUPPORT 0x08 | |
103 | #define RI_P2P_OVER_LAN 0x10 | |
104 | #define RI_TE_EXPERIMENTAL 0x20 | |
105 | ||
106 | #define RI_TLV_LENGTH 4 | |
107 | ||
108 | /* RFC5088: PCE Capabilities TLV */ /* Optional */ | |
109 | /* RI PCE TLV */ | |
110 | #define RI_TLV_PCE 6 | |
111 | ||
112 | struct ri_tlv_pce | |
113 | { | |
114 | struct ri_tlv_header header; | |
115 | /* A set of PCE-sub-TLVs will follow. */ | |
116 | }; | |
117 | ||
118 | /* PCE Address Sub-TLV */ /* Mandatory */ | |
119 | #define RI_PCE_SUBTLV_ADDRESS 1 | |
120 | struct ri_pce_subtlv_address | |
121 | { | |
122 | struct ri_tlv_header header; /* Type = 1; Length is 8 (IPv4) or 20 (IPv6) bytes. */ | |
123 | #define PCE_ADDRESS_LENGTH_IPV4 8 | |
124 | #define PCE_ADDRESS_LENGTH_IPV6 20 | |
125 | struct | |
126 | { | |
127 | u_int16_t type; /* Address type: 1 = IPv4, 2 = IPv6 */ | |
128 | #define PCE_ADDRESS_TYPE_IPV4 1 | |
129 | #define PCE_ADDRESS_TYPE_IPV6 2 | |
130 | u_int16_t reserved; | |
131 | struct in_addr value; /* PCE address */ | |
132 | } address; | |
133 | }; | |
134 | ||
135 | /* PCE Path-Scope Sub-TLV */ /* Mandatory */ | |
136 | #define RI_PCE_SUBTLV_PATH_SCOPE 2 | |
137 | struct ri_pce_subtlv_path_scope | |
138 | { | |
139 | struct ri_tlv_header header; /* Type = 2; Length = 4 bytes. */ | |
140 | u_int32_t value; /* L, R, Rd, S, Sd, Y, PrefL, PrefR, PrefS and PrefY bits see RFC5088 page 9 */ | |
141 | }; | |
142 | ||
143 | /* PCE Domain Sub-TLV */ /* Optional */ | |
144 | #define RI_PCE_SUBTLV_DOMAIN 3 | |
145 | ||
146 | #define PCE_DOMAIN_TYPE_AREA 1 | |
147 | #define PCE_DOMAIN_TYPE_AS 2 | |
148 | ||
149 | struct ri_pce_subtlv_domain | |
150 | { | |
151 | struct ri_tlv_header header; /* Type = 3; Length = 8 bytes. */ | |
152 | u_int16_t type; /* Domain type: 1 = OSPF Area ID, 2 = AS Number */ | |
153 | u_int16_t reserved; | |
154 | u_int32_t value; | |
155 | }; | |
156 | ||
157 | /* PCE Neighbor Sub-TLV */ /* Mandatory if R or S bit is set */ | |
158 | #define RI_PCE_SUBTLV_NEIGHBOR 4 | |
159 | struct ri_pce_subtlv_neighbor | |
160 | { | |
161 | struct ri_tlv_header header; /* Type = 4; Length = 8 bytes. */ | |
162 | u_int16_t type; /* Domain type: 1 = OSPF Area ID, 2 = AS Number */ | |
163 | u_int16_t reserved; | |
164 | u_int32_t value; | |
165 | }; | |
166 | ||
167 | /* PCE Capabilities Flags Sub-TLV */ /* Optional */ | |
168 | #define RI_PCE_SUBTLV_CAP_FLAG 5 | |
169 | ||
170 | #define PCE_CAP_GMPLS_LINK 0x0001 | |
171 | #define PCE_CAP_BIDIRECTIONAL 0x0002 | |
172 | #define PCE_CAP_DIVERSE_PATH 0x0004 | |
173 | #define PCE_CAP_LOAD_BALANCE 0x0008 | |
174 | #define PCE_CAP_SYNCHRONIZED 0x0010 | |
175 | #define PCE_CAP_OBJECTIVES 0x0020 | |
176 | #define PCE_CAP_ADDITIVE 0x0040 | |
177 | #define PCE_CAP_PRIORIZATION 0x0080 | |
178 | #define PCE_CAP_MULTIPLE_REQ 0x0100 | |
179 | ||
180 | struct ri_pce_subtlv_cap_flag | |
181 | { | |
182 | struct ri_tlv_header header; /* Type = 5; Length = n x 4 bytes. */ | |
183 | u_int32_t value; | |
184 | }; | |
185 | ||
186 | /* Prototypes. */ | |
187 | extern int ospf_router_info_init (void); | |
188 | extern void ospf_router_info_term (void); | |
189 | ||
190 | #endif /* _ZEBRA_OSPF_ROUTER_INFO_H */ |