]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_pdu.h
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / isisd / isis_pdu.h
1 /*
2 * IS-IS Rout(e)ing protocol - isis_pdu.h
3 * PDU processing
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; see the file COPYING; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #ifndef _ZEBRA_ISIS_PDU_H
25 #define _ZEBRA_ISIS_PDU_H
26
27 #include "isisd/isis_tx_queue.h"
28
29 #ifdef __SUNPRO_C
30 #pragma pack(1)
31 #endif
32
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
54 struct esis_fixed_hdr {
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;
62 } __attribute__((packed));
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
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 * +-------+-------+-------+-------+-------+-------+-------+-------+
83 * + Source ID + id_len
84 * +-------+-------+-------+-------+-------+-------+-------+-------+
85 * | Holding Time | 2
86 * +-------+-------+-------+-------+-------+-------+-------+-------+
87 * | PDU Length | 2
88 * +-------+-------+-------+-------+-------+-------+-------+-------+
89 * | R | Priority | 1
90 * +-------+-------+-------+-------+-------+-------+-------+-------+
91 * | LAN ID | id_len + 1
92 * +-------+-------+-------+-------+-------+-------+-------+-------+
93 */
94 struct isis_lan_hello_hdr {
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];
101 } __attribute__((packed));
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 * +-------+-------+-------+-------+-------+-------+-------+-------+
110 * + Source ID + id_len
111 * +-------+-------+-------+-------+-------+-------+-------+-------+
112 * + Holding Time + 2
113 * +-------+-------+-------+-------+-------+-------+-------+-------+
114 * + PDU Length + 2
115 * +-------+-------+-------+-------+-------+-------+-------+-------+
116 * | Local Circuit ID | 1
117 * +-------+-------+-------+-------+-------+-------+-------+-------+
118 */
119 struct isis_p2p_hello_hdr {
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;
125 } __attribute__((packed));
126 #define ISIS_P2PHELLO_HDRLEN 12
127
128 #define L1_LINK_STATE 18
129 #define L2_LINK_STATE 20
130 #define FS_LINK_STATE 10
131 #define L2_CIRCUIT_FLOODING_SCOPE 2
132 struct 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 };
140 #define ISIS_LSP_HDR_LEN 19
141
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.
147 *
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
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 * +-------+-------+-------+-------+-------+-------+-------+-------+
158 * + PDU Length + 2
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 */
167 struct isis_complete_seqnum_hdr {
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];
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 */
185 struct isis_partial_seqnum_hdr {
186 uint16_t pdu_len;
187 uint8_t source_id[ISIS_SYS_ID_LEN + 1];
188 };
189 #define ISIS_PSNP_HDRLEN 9
190
191 #ifdef __SUNPRO_C
192 #pragma pack()
193 #endif
194
195 /*
196 * Function for receiving IS-IS PDUs
197 */
198 int isis_receive(struct thread *thread);
199
200 /*
201 * calling arguments for snp_process ()
202 */
203 #define ISIS_SNP_PSNP_FLAG 0
204 #define ISIS_SNP_CSNP_FLAG 1
205
206 #define ISIS_AUTH_MD5_SIZE 16U
207
208 /*
209 * Sending functions
210 */
211 void send_hello_sched(struct isis_circuit *circuit, int level, long delay);
212 int send_csnp(struct isis_circuit *circuit, int level);
213 int send_l1_csnp(struct thread *thread);
214 int send_l2_csnp(struct thread *thread);
215 int send_l1_psnp(struct thread *thread);
216 int send_l2_psnp(struct thread *thread);
217 void send_lsp(struct isis_circuit *circuit,
218 struct isis_lsp *lsp, enum isis_tx_type tx_type);
219 void fill_fixed_hdr(uint8_t pdu_type, struct stream *stream);
220 int send_hello(struct isis_circuit *circuit, int level);
221 int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa);
222 #endif /* _ZEBRA_ISIS_PDU_H */