]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isis_pdu.h
lib: enforce vrf_name_to_id by returning default_vrf when name is null
[mirror_frr.git] / isisd / isis_pdu.h
CommitLineData
eb5d44eb 1/*
2 * IS-IS Rout(e)ing protocol - isis_pdu.h
3 * PDU processing
4 *
5 * Copyright (C) 2001,2002 Sampo Saaristo
d62a17ae 6 * Tampere University of Technology
eb5d44eb 7 * Institute of Communications Engineering
8 *
d62a17ae 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)
eb5d44eb 12 * any later version.
13 *
d62a17ae 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
eb5d44eb 17 * more details.
896014f4
DL
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; see the file COPYING; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
eb5d44eb 22 */
23
24#ifndef _ZEBRA_ISIS_PDU_H
25#define _ZEBRA_ISIS_PDU_H
26
9b39405f
CF
27#include "isisd/isis_tx_queue.h"
28
238497fc
PJ
29#ifdef __SUNPRO_C
30#pragma pack(1)
31#endif
32
eb5d44eb 33/*
34 * ISO 9542 - 7.5,7.6
35 *
36 * ES to IS Fixed Header
37 * +-------+-------+-------+-------+-------+-------+-------+-------+
38 * | Intradomain Routeing Protocol Discriminator |
39 * +-------+-------+-------+-------+-------+-------+-------+-------+
40 * | Length Indicator |
41 * +-------+-------+-------+-------+-------+-------+-------+-------+
42 * | Version/Protocol ID extension |
43 * +-------+-------+-------+-------+-------+-------+-------+-------+
44 * | Reserved = 0 |
45 * +-------+-------+-------+-------+-------+-------+-------+-------+
46 * | 0 | 0 | 0 | PDU Type |
47 * +-------+-------+-------+-------+-------+-------+-------+-------+
48 * | Holding Time | 2
49 * +-------+-------+-------+-------+-------+-------+-------+-------+
50 * | Checksum | 2
51 * +-------+-------+-------+-------+-------+-------+-------+-------+
52 */
53
d62a17ae 54struct esis_fixed_hdr {
d7c0a89a
QY
55 uint8_t idrp;
56 uint8_t length;
57 uint8_t version;
58 uint8_t id_len;
59 uint8_t pdu_type;
60 uint16_t holdtime;
61 uint16_t checksum;
d62a17ae 62} __attribute__((packed));
eb5d44eb 63
64#define ESIS_FIXED_HDR_LEN 9
65
66#define ESH_PDU 2
67#define ISH_PDU 4
68#define RD_PDU 5
69
eb5d44eb 70#define ISIS_FIXED_HDR_LEN 8
71
72/*
73 * IS-IS PDU types.
74 */
75
76#define L1_LAN_HELLO 15
77#define L2_LAN_HELLO 16
78/*
79 * L1 and L2 LAN IS to IS Hello PDU header
80 * +-------+-------+-------+-------+-------+-------+-------+-------+
81 * | Reserved | Circuit Type | 1
82 * +-------+-------+-------+-------+-------+-------+-------+-------+
d62a17ae 83 * + Source ID + id_len
eb5d44eb 84 * +-------+-------+-------+-------+-------+-------+-------+-------+
d62a17ae 85 * | Holding Time | 2
eb5d44eb 86 * +-------+-------+-------+-------+-------+-------+-------+-------+
d62a17ae 87 * | PDU Length | 2
eb5d44eb 88 * +-------+-------+-------+-------+-------+-------+-------+-------+
89 * | R | Priority | 1
90 * +-------+-------+-------+-------+-------+-------+-------+-------+
91 * | LAN ID | id_len + 1
92 * +-------+-------+-------+-------+-------+-------+-------+-------+
93 */
d62a17ae 94struct isis_lan_hello_hdr {
d7c0a89a
QY
95 uint8_t circuit_t;
96 uint8_t source_id[ISIS_SYS_ID_LEN];
97 uint16_t hold_time;
98 uint16_t pdu_len;
99 uint8_t prio;
100 uint8_t lan_id[ISIS_SYS_ID_LEN + 1];
d62a17ae 101} __attribute__((packed));
eb5d44eb 102#define ISIS_LANHELLO_HDRLEN 19
103
104#define P2P_HELLO 17
105/*
106 * Point-to-point IS to IS hello PDU header
107 * +-------+-------+-------+-------+-------+-------+-------+-------+
108 * | Reserved | Circuit Type | 1
109 * +-------+-------+-------+-------+-------+-------+-------+-------+
d62a17ae 110 * + Source ID + id_len
eb5d44eb 111 * +-------+-------+-------+-------+-------+-------+-------+-------+
d62a17ae 112 * + Holding Time + 2
eb5d44eb 113 * +-------+-------+-------+-------+-------+-------+-------+-------+
d62a17ae 114 * + PDU Length + 2
eb5d44eb 115 * +-------+-------+-------+-------+-------+-------+-------+-------+
116 * | Local Circuit ID | 1
117 * +-------+-------+-------+-------+-------+-------+-------+-------+
118 */
d62a17ae 119struct isis_p2p_hello_hdr {
d7c0a89a
QY
120 uint8_t circuit_t;
121 uint8_t source_id[ISIS_SYS_ID_LEN];
122 uint16_t hold_time;
123 uint16_t pdu_len;
124 uint8_t local_id;
d62a17ae 125} __attribute__((packed));
eb5d44eb 126#define ISIS_P2PHELLO_HDRLEN 12
127
128#define L1_LINK_STATE 18
129#define L2_LINK_STATE 20
1cbd5b37
CF
130#define FS_LINK_STATE 10
131#define L2_CIRCUIT_FLOODING_SCOPE 2
af8ac8f9
CF
132struct isis_lsp_hdr {
133 uint16_t pdu_len;
134 uint16_t rem_lifetime;
135 uint8_t lsp_id[ISIS_SYS_ID_LEN + 2];
136 uint32_t seqno;
137 uint16_t checksum;
138 uint8_t lsp_bits;
139};
eb5d44eb 140#define ISIS_LSP_HDR_LEN 19
141
3f045a08
JB
142/*
143 * Since the length field of LSP Entries TLV is one byte long, and each LSP
144 * entry is LSP_ENTRIES_LEN (16) bytes long, the maximum number of LSP entries
145 * can be accomodated in a TLV is
146 * 255 / 16 = 15.
d62a17ae 147 *
3f045a08
JB
148 * Therefore, the maximum length of the LSP Entries TLV is
149 * 16 * 15 + 2 (header) = 242 bytes.
150 */
151#define MAX_LSP_ENTRIES_TLV_SIZE 242
152
eb5d44eb 153#define L1_COMPLETE_SEQ_NUM 24
154#define L2_COMPLETE_SEQ_NUM 25
155/*
156 * L1 and L2 IS to IS complete sequence numbers PDU header
157 * +-------+-------+-------+-------+-------+-------+-------+-------+
d62a17ae 158 * + PDU Length + 2
eb5d44eb 159 * +-------+-------+-------+-------+-------+-------+-------+-------+
160 * + Source ID + id_len + 1
161 * +-------+-------+-------+-------+-------+-------+-------+-------+
162 * + Start LSP ID + id_len + 2
163 * +-------+-------+-------+-------+-------+-------+-------+-------+
164 * + End LSP ID + id_len + 2
165 * +-------+-------+-------+-------+-------+-------+-------+-------+
166 */
d62a17ae 167struct isis_complete_seqnum_hdr {
d7c0a89a
QY
168 uint16_t pdu_len;
169 uint8_t source_id[ISIS_SYS_ID_LEN + 1];
170 uint8_t start_lsp_id[ISIS_SYS_ID_LEN + 2];
171 uint8_t stop_lsp_id[ISIS_SYS_ID_LEN + 2];
eb5d44eb 172};
173#define ISIS_CSNP_HDRLEN 25
174
175#define L1_PARTIAL_SEQ_NUM 26
176#define L2_PARTIAL_SEQ_NUM 27
177/*
178 * L1 and L2 IS to IS partial sequence numbers PDU header
179 * +-------+-------+-------+-------+-------+-------+-------+-------+
180 * + PDU Length + 2
181 * +-------+-------+-------+-------+-------+-------+-------+-------+
182 * + Source ID + id_len + 1
183 * +---------------------------------------------------------------+
184 */
d62a17ae 185struct isis_partial_seqnum_hdr {
d7c0a89a
QY
186 uint16_t pdu_len;
187 uint8_t source_id[ISIS_SYS_ID_LEN + 1];
eb5d44eb 188};
189#define ISIS_PSNP_HDRLEN 9
190
238497fc
PJ
191#ifdef __SUNPRO_C
192#pragma pack()
193#endif
194
eb5d44eb 195/*
196 * Function for receiving IS-IS PDUs
197 */
d62a17ae 198int isis_receive(struct thread *thread);
eb5d44eb 199
200/*
201 * calling arguments for snp_process ()
202 */
203#define ISIS_SNP_PSNP_FLAG 0
204#define ISIS_SNP_CSNP_FLAG 1
205
3f045a08
JB
206#define ISIS_AUTH_MD5_SIZE 16U
207
eb5d44eb 208/*
209 * Sending functions
210 */
a0a707ee 211void send_hello_sched(struct isis_circuit *circuit, int level, long delay);
d62a17ae 212int send_csnp(struct isis_circuit *circuit, int level);
213int send_l1_csnp(struct thread *thread);
214int send_l2_csnp(struct thread *thread);
215int send_l1_psnp(struct thread *thread);
216int send_l2_psnp(struct thread *thread);
161fa356
CF
217void send_lsp(struct isis_circuit *circuit,
218 struct isis_lsp *lsp, enum isis_tx_type tx_type);
88f9d911 219void fill_fixed_hdr(uint8_t pdu_type, struct stream *stream);
d62a17ae 220int send_hello(struct isis_circuit *circuit, int level);
d7c0a89a 221int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa);
eb5d44eb 222#endif /* _ZEBRA_ISIS_PDU_H */