]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_tlv.h
1dc030e00706c51167b95694f171ea6d2b26079b
[mirror_frr.git] / isisd / isis_tlv.h
1 /*
2 * IS-IS Rout(e)ing protocol - isis_tlv.h
3 * IS-IS TLV related routines
4 *
5 * Copyright (C) 2001,2002 Sampo Saaristo
6 * Tampere University of Technology
7 * Institute of Communications Engineering
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public Licenseas published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24 #ifndef _ZEBRA_ISIS_TLV_H
25 #define _ZEBRA_ISIS_TLV_H
26
27 /*
28 * The list of TLVs we (should) support.
29 * ____________________________________________________________________________
30 * Name Value IIH LSP SNP Status
31 * LAN
32 * ____________________________________________________________________________
33 *
34 * Area Addresses 1 y y n ISO10589
35 * IIS Neighbors 2 n y n ISO10589
36 * ES Neighbors 3 n y n ISO10589
37 * IIS Neighbors 6 y n n ISO10589
38 * Padding 8 y n n ISO10589
39 * LSP Entries 9 n n y ISO10589
40 * Authentication 10 y y y ISO10589, RFC3567
41 * Checksum 12 y n y RFC3358
42 * TE IS Reachability 22 n y n RFC3784
43 * IS Alias 24 n y n RFC3786
44 * IP Int. Reachability 128 n y n RFC1195
45 * Protocols Supported 129 y y n RFC1195
46 * IP Ext. Reachability 130 n y n RFC1195
47 * IDRPI 131 n y y RFC1195
48 * IP Interface Address 132 y y n RFC1195
49 * TE Router ID 134 n y n RFC3784
50 * Extended IP Reachability 135 n y n RFC3784
51 * Dynamic Hostname 137 n y n RFC2763
52 * Shared Risk Link Group 138 n y y draft-ietf-isis-gmpls-extensions
53 * Restart TLV 211 y n n RFC3847
54 * MT IS Reachability 222 n y n draft-ietf-isis-wg-multi-topology
55 * MT Supported 229 y y n draft-ietf-isis-wg-multi-topology
56 * IPv6 Interface Address 232 y y n draft-ietf-isis_ipv6
57 * MT IP Reachability 235 n y n draft-ietf-isis-wg-multi-topology
58 * IPv6 IP Reachability 236 n y n draft-ietf-isis_ipv6
59 * MT IPv6 IP Reachability 237 n y n draft-ietf-isis-wg-multi-topology
60 * P2P Adjacency State 240 y n n RFC3373
61 * IIH Sequence Number 241 y n n draft-shen-isis-iih-sequence
62 * Router Capability 242 - - - draft-ietf-isis-caps
63 *
64 *
65 * IS Reachability sub-TLVs we (should) support.
66 * ____________________________________________________________________________
67 * Name Value Status
68 * ____________________________________________________________________________
69 * Administartive group (color) 3 RFC3784
70 * Link Local/Remote Identifiers 4 draft-ietf-isis-gmpls-extensions
71 * IPv4 interface address 6 RFC3784
72 * IPv4 neighbor address 8 RFC3784
73 * Maximum link bandwidth 9 RFC3784
74 * Reservable link bandwidth 10 RFC3784
75 * Unreserved bandwidth 11 RFC3784
76 * TE Default metric 18 RFC3784
77 * Link Protection Type 20 draft-ietf-isis-gmpls-extensions
78 * Interface Switching Capability 21 draft-ietf-isis-gmpls-extensions
79 *
80 *
81 * IP Reachability sub-TLVs we (should) support.
82 * ____________________________________________________________________________
83 * Name Value Status
84 * ____________________________________________________________________________
85 * 32bit administrative tag 1 draft-ietf-isis-admin-tags
86 * 64bit administrative tag 2 draft-ietf-isis-admin-tags
87 * Management prefix color 117 draft-ietf-isis-wg-multi-topology
88 */
89
90 #define AREA_ADDRESSES 1
91 #define IS_NEIGHBOURS 2
92 #define ES_NEIGHBOURS 3
93 #define LAN_NEIGHBOURS 6
94 #define PADDING 8
95 #define LSP_ENTRIES 9
96 #define AUTH_INFO 10
97 #define CHECKSUM 12
98 #define TE_IS_NEIGHBOURS 22
99 #define IS_ALIAS 24
100 #define IPV4_INT_REACHABILITY 128
101 #define PROTOCOLS_SUPPORTED 129
102 #define IPV4_EXT_REACHABILITY 130
103 #define IDRP_INFO 131
104 #define IPV4_ADDR 132
105 #define TE_ROUTER_ID 134
106 #define TE_IPV4_REACHABILITY 135
107 #define DYNAMIC_HOSTNAME 137
108 #define GRACEFUL_RESTART 211
109 #define IPV6_ADDR 232
110 #define IPV6_REACHABILITY 236
111 #define WAY3_HELLO 240
112
113 #define IS_NEIGHBOURS_LEN (ISIS_SYS_ID_LEN + 5)
114 #define LAN_NEIGHBOURS_LEN 6
115 #define LSP_ENTRIES_LEN (10 + ISIS_SYS_ID_LEN) /* FIXME: should be entry */
116 #define IPV4_REACH_LEN 12
117 #define IPV6_REACH_LEN 22
118
119 /* struct for neighbor */
120 struct is_neigh
121 {
122 struct metric metrics;
123 u_char neigh_id[ISIS_SYS_ID_LEN + 1];
124 };
125
126 /* struct for te is neighbor */
127 struct te_is_neigh
128 {
129 u_char neigh_id[ISIS_SYS_ID_LEN + 1];
130 u_char te_metric[3];
131 u_char sub_tlvs_length;
132 };
133
134 /* struct for es neighbors */
135 struct es_neigh
136 {
137 struct metric metrics;
138 /* approximate position of first, we use the
139 * length ((uchar*)metric-1) to know all */
140 u_char first_es_neigh[ISIS_SYS_ID_LEN];
141
142 };
143
144 struct partition_desig_level2_is
145 {
146 struct list *isis_system_ids;
147 };
148
149 /* struct for lan neighbors */
150 struct lan_neigh
151 {
152 u_char LAN_addr[6];
153 };
154
155 /* struct for LSP entry */
156 struct lsp_entry
157 {
158 u_int16_t rem_lifetime;
159 u_char lsp_id[ISIS_SYS_ID_LEN + 2];
160 u_int32_t seq_num;
161 u_int16_t checksum;
162 } __attribute__ ((packed));
163
164 /* struct for checksum */
165 struct checksum
166 {
167 u_int16_t checksum;
168 };
169
170 /* ipv4 reachability */
171 struct ipv4_reachability
172 {
173 struct metric metrics;
174 struct in_addr prefix;
175 struct in_addr mask;
176 };
177
178 /* te router id */
179 struct te_router_id
180 {
181 struct in_addr id;
182 };
183
184 /* te ipv4 reachability */
185 struct te_ipv4_reachability
186 {
187 u_int32_t te_metric;
188 u_char control;
189 u_char prefix_start; /* since this is variable length by nature it only */
190 }; /* points to an approximate location */
191
192
193
194 struct idrp_info
195 {
196 u_char len;
197 u_char *value;
198 };
199
200 #ifdef HAVE_IPV6
201 struct ipv6_reachability
202 {
203 u_int32_t metric;
204 u_char control_info;
205 u_char prefix_len;
206 u_char prefix[16];
207 };
208 #endif /* HAVE_IPV6 */
209
210 /* bits in control_info */
211 #define CTRL_INFO_DIRECTION 0x80
212 #define DIRECTION_UP 0
213 #define DIRECTION_DOWN 1
214 #define CTRL_INFO_DISTRIBUTION 0x40
215 #define DISTRIBUTION_INTERNAL 0
216 #define DISTRIBUTION_EXTERNAL 1
217 #define CTRL_INFO_SUBTLVS 0x20
218
219 /*
220 * Pointer to each tlv type, filled by parse_tlvs()
221 */
222 struct tlvs
223 {
224 struct list *area_addrs;
225 struct list *is_neighs;
226 struct list *te_is_neighs;
227 struct list *es_neighs;
228 struct list *lsp_entries;
229 struct list *prefix_neighs;
230 struct list *lan_neighs;
231 struct checksum *checksum;
232 struct nlpids *nlpids;
233 struct list *ipv4_addrs;
234 struct list *ipv4_int_reachs;
235 struct list *ipv4_ext_reachs;
236 struct list *te_ipv4_reachs;
237 struct hostname *hostname;
238 struct te_router_id *router_id;
239 #ifdef HAVE_IPV6
240 struct list *ipv6_addrs;
241 struct list *ipv6_reachs;
242 #endif
243 struct isis_passwd auth_info;
244 };
245
246 /*
247 * Own definitions - used to bitmask found and expected
248 */
249
250 #define TLVFLAG_AREA_ADDRS (1<<0)
251 #define TLVFLAG_IS_NEIGHS (1<<1)
252 #define TLVFLAG_ES_NEIGHS (1<<2)
253 #define TLVFLAG_PARTITION_DESIG_LEVEL2_IS (1<<3)
254 #define TLVFLAG_PREFIX_NEIGHS (1<<4)
255 #define TLVFLAG_LAN_NEIGHS (1<<5)
256 #define TLVFLAG_LSP_ENTRIES (1<<6)
257 #define TLVFLAG_PADDING (1<<7)
258 #define TLVFLAG_AUTH_INFO (1<<8)
259 #define TLVFLAG_IPV4_INT_REACHABILITY (1<<9)
260 #define TLVFLAG_NLPID (1<<10)
261 #define TLVFLAG_IPV4_EXT_REACHABILITY (1<<11)
262 #define TLVFLAG_IPV4_ADDR (1<<12)
263 #define TLVFLAG_DYN_HOSTNAME (1<<13)
264 #define TLVFLAG_IPV6_ADDR (1<<14)
265 #define TLVFLAG_IPV6_REACHABILITY (1<<15)
266 #define TLVFLAG_TE_IS_NEIGHS (1<<16)
267 #define TLVFLAG_TE_IPV4_REACHABILITY (1<<17)
268 #define TLVFLAG_3WAY_HELLO (1<<18)
269 #define TLVFLAG_TE_ROUTER_ID (1<<19)
270 #define TLVFLAG_CHECKSUM (1<<20)
271 #define TLVFLAG_GRACEFUL_RESTART (1<<21)
272
273 void init_tlvs (struct tlvs *tlvs, uint32_t expected);
274 void free_tlvs (struct tlvs *tlvs);
275 int parse_tlvs (char *areatag, u_char * stream, int size,
276 u_int32_t * expected, u_int32_t * found, struct tlvs *tlvs);
277 void free_tlv (void *val);
278
279 int add_tlv (u_char, u_char, u_char *, struct stream *);
280 int tlv_add_area_addrs (struct list *area_addrs, struct stream *stream);
281 int tlv_add_is_neighs (struct list *is_neighs, struct stream *stream);
282 int tlv_add_te_is_neighs (struct list *te_is_neighs, struct stream *stream);
283 int tlv_add_lan_neighs (struct list *lan_neighs, struct stream *stream);
284 int tlv_add_nlpid (struct nlpids *nlpids, struct stream *stream);
285 int tlv_add_checksum (struct checksum *checksum, struct stream *stream);
286 int tlv_add_authinfo (char auth_type, char authlen, u_char *auth_value,
287 struct stream *stream);
288 int tlv_add_ip_addrs (struct list *ip_addrs, struct stream *stream);
289 int tlv_add_dynamic_hostname (struct hostname *hostname,
290 struct stream *stream);
291 int tlv_add_lsp_entries (struct list *lsps, struct stream *stream);
292 int tlv_add_ipv4_reachs (struct list *ipv4_reachs, struct stream *stream);
293 int tlv_add_te_ipv4_reachs (struct list *te_ipv4_reachs, struct stream *stream);
294 #ifdef HAVE_IPV6
295 int tlv_add_ipv6_addrs (struct list *ipv6_addrs, struct stream *stream);
296 int tlv_add_ipv6_reachs (struct list *ipv6_reachs, struct stream *stream);
297 #endif /* HAVE_IPV6 */
298
299 int tlv_add_padding (struct stream *stream);
300
301 #endif /* _ZEBRA_ISIS_TLV_H */