2
* IS-IS Rout(e)ing protocol - isis_tlv.h
3
* IS-IS TLV related routines
5
* Copyright (C) 2001,2002 Sampo Saaristo
6
* Tampere University of Technology
7
* Institute of Communications Engineering
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)
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
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.
24
#ifndef _ZEBRA_ISIS_TLV_H
25
#define _ZEBRA_ISIS_TLV_H
28
* Structures found in TLV's.
29
* this header is fully complient with
30
* draft-ietf-isis-wg-tlv-codepoints-02.txt
31
1. TLV Codepoints reserved
32
____________________________________________________
33
Name Value IIH LSP SNP Status
34
____________________________________________________
36
Area Addresses 1 y y n ISO 10589
37
IIS Neighbors 2 n y n ISO 10589
38
ES Neighbors 3 n y n ISO 10589
39
Part. DIS 4 n y n ISO 10589
40
Prefix Neighbors 5 n y n ISO 10589
41
IIS Neighbors 6 y n n ISO 10589
42
Padding 8 y n n ISO 10589
43
LSP Entries 9 n n y ISO 10589
44
Authentication 10 y y y ISO 10589
45
Opt. Checksum 12 y n y IETF-draft
46
LSPBufferSize 14 n y n ISO 10589 Rev 2 Draft
47
TE IIS Neigh. 22 n y n IETF-draft
48
DECnet Phase IV 42 y n n DEC (ancient)
49
IP Int. Reach 128 n y n RFC 1195
50
Prot. Supported 129 y y n RFC 1195
51
IP Ext. Address 130 n y n RFC 1195
52
IDRPI 131 n y y RFC 1195
53
IP Intf. Address 132 y y n RFC 1195
54
Illegal 133 n n n RFC 1195 (not used)
55
Router ID 134 n y n IETF-draft
56
TE IP. Reach 135 n y n IETF-draft
57
Dynamic Name 137 n y n RFC 2763
58
Nortel Proprietary 176 n y n
59
Nortel Proprietary 177 n y n
60
Restart TLV 211 y n n IETF-draft
61
MT-ISN 222 n y n IETF-draft
62
M-Topologies 229 y y n IETF-draft
63
IPv6 Intf. Addr. 232 y y n IETF-draft
64
MT IP. Reach 235 n y n IETF-draft
65
IPv6 IP. Reach 236 n y n IETF-draft
66
MT IPv6 IP. Reach 237 n y n IETF-draft
67
P2P Adjacency State 240 y n n IETF-draft
71
#define AREA_ADDRESSES 1
72
#define IS_NEIGHBOURS 2
73
#define ES_NEIGHBOURS 3
74
#define PARTITION_DESIG_LEVEL2_IS 4
75
#define PREFIX_NEIGHBOURS 5
76
#define LAN_NEIGHBOURS 6
81
#define TE_IS_NEIGHBOURS 22
82
#define IPV4_INT_REACHABILITY 128
83
#define IPV4_EXT_REACHABILITY 130
84
#define PROTOCOLS_SUPPORTED 129
87
#define TE_ROUTER_ID 134
88
#define TE_IPV4_REACHABILITY 135
89
#define DYNAMIC_HOSTNAME 137
90
#define IPV6_REACHABILITY 236
92
#define WAY3_HELLO 240
94
#define IS_NEIGHBOURS_LEN (ISIS_SYS_ID_LEN + 5)
95
#define LAN_NEIGHBOURS_LEN 6
96
#define LSP_ENTRIES_LEN (10 + ISIS_SYS_ID_LEN) /* FIXME: should be entry */
97
#define IPV4_REACH_LEN 12
98
#define IPV6_REACH_LEN 22
100
/* struct for neighbor */
102
struct metric metrics;
103
u_char neigh_id[ISIS_SYS_ID_LEN + 1];
106
/* struct for te is neighbor */
108
u_char neigh_id[ISIS_SYS_ID_LEN + 1];
110
u_char sub_tlvs_length;
113
/* struct for es neighbors */
115
struct metric metrics;
116
/* approximate position of first, we use the
117
* length ((uchar*)metric-1) to know all */
118
u_char first_es_neigh[ISIS_SYS_ID_LEN];
122
struct partition_desig_level2_is{
123
struct list *isis_system_ids;
126
/* struct for lan neighbors */
131
/* struct for LSP entry */
133
u_int16_t rem_lifetime;
134
u_char lsp_id[ISIS_SYS_ID_LEN + 2];
137
} __attribute__((packed));
139
/* struct for checksum */
144
/* ipv4 reachability */
145
struct ipv4_reachability {
146
struct metric metrics;
147
struct in_addr prefix;
152
struct te_router_id {
156
/* te ipv4 reachability */
157
struct te_ipv4_reachability {
160
u_char prefix_start; /* since this is variable length by nature it only */
161
}; /* points to an approximate location */
171
struct ipv6_reachability {
177
#endif /* HAVE_IPV6 */
179
/* bits in control_info */
180
#define CTRL_INFO_DIRECTION 0x80
181
#define DIRECTION_UP 0
182
#define DIRECTION_DOWN 1
183
#define CTRL_INFO_DISTRIBUTION 0x40
184
#define DISTRIBUTION_INTERNAL 0
185
#define DISTRIBUTION_EXTERNAL 1
186
#define CTRL_INFO_SUBTLVS 0x20
189
* Pointer to each tlv type, filled by parse_tlvs()
192
struct list *area_addrs;
193
struct list *is_neighs;
194
struct list *te_is_neighs;
195
struct list *es_neighs;
196
struct list *lsp_entries;
197
struct list *prefix_neighs;
198
struct list *lan_neighs;
199
struct checksum *checksum;
200
struct nlpids *nlpids;
201
struct list *ipv4_addrs;
202
struct list *ipv4_int_reachs;
203
struct list *ipv4_ext_reachs;
204
struct list *te_ipv4_reachs;
205
struct hostname *hostname;
206
struct te_router_id *router_id;
208
struct list *ipv6_addrs;
209
struct list *ipv6_reachs;
211
struct isis_passwd auth_info;
215
* Own definitions - used to bitmask found and expected
218
#define TLVFLAG_AREA_ADDRS (1<<0)
219
#define TLVFLAG_IS_NEIGHS (1<<1)
220
#define TLVFLAG_ES_NEIGHS (1<<2)
221
#define TLVFLAG_PARTITION_DESIG_LEVEL2_IS (1<<3)
222
#define TLVFLAG_PREFIX_NEIGHS (1<<4)
223
#define TLVFLAG_LAN_NEIGHS (1<<5)
224
#define TLVFLAG_LSP_ENTRIES (1<<6)
225
#define TLVFLAG_PADDING (1<<7)
226
#define TLVFLAG_AUTH_INFO (1<<8)
227
#define TLVFLAG_IPV4_INT_REACHABILITY (1<<9)
228
#define TLVFLAG_NLPID (1<<10)
229
#define TLVFLAG_IPV4_EXT_REACHABILITY (1<<11)
230
#define TLVFLAG_IPV4_ADDR (1<<12)
231
#define TLVFLAG_DYN_HOSTNAME (1<<13)
232
#define TLVFLAG_IPV6_ADDR (1<<14)
233
#define TLVFLAG_IPV6_REACHABILITY (1<<15)
234
#define TLVFLAG_TE_IS_NEIGHS (1<<16)
235
#define TLVFLAG_TE_IPV4_REACHABILITY (1<<17)
236
#define TLVFLAG_3WAY_HELLO (1<<18)
237
#define TLVFLAG_TE_ROUTER_ID (1<<19)
238
#define TLVFLAG_CHECKSUM (1<<20)
240
void init_tlvs (struct tlvs *tlvs, uint32_t expected);
241
void free_tlvs (struct tlvs *tlvs);
242
int parse_tlvs (char *areatag, u_char *stream, int size, u_int32_t *expected,
243
u_int32_t *found, struct tlvs *tlvs);
244
void free_tlv (void *val);
246
int tlv_add_area_addrs (struct list *area_addrs, struct stream *stream);
247
int tlv_add_is_neighs (struct list *is_neighs, struct stream *stream);
248
int tlv_add_lan_neighs (struct list *lan_neighs, struct stream *stream);
249
int tlv_add_nlpid (struct nlpids *nlpids, struct stream *stream);
250
int tlv_add_checksum (struct checksum *checksum,
251
struct stream *stream);
252
int tlv_add_authinfo (char auth_type, char authlen, char *auth_value,
253
struct stream *stream);
254
int tlv_add_ip_addrs (struct list *ip_addrs, struct stream *stream);
255
int tlv_add_dynamic_hostname (struct hostname *hostname,struct stream *stream);
256
int tlv_add_lsp_entries (struct list *lsps, struct stream *stream);
257
int tlv_add_ipv4_reachs (struct list *ipv4_reachs, struct stream *stream);
259
int tlv_add_ipv6_addrs (struct list *ipv6_addrs, struct stream *stream);
260
int tlv_add_ipv6_reachs (struct list *ipv6_reachs, struct stream *stream);
261
#endif /* HAVE_IPV6 */
263
int tlv_add_padding (struct stream *stream);
265
#endif /* _ZEBRA_ISIS_TLV_H */