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