]>
Commit | Line | Data |
---|---|---|
eb5d44eb | 1 | /* |
2 | * IS-IS Rout(e)ing protocol - isis_pdu.h | |
3 | * PDU processing | |
4 | * | |
5 | * Copyright (C) 2001,2002 Sampo Saaristo | |
ac4d0be5 | 6 | * Tampere University of Technology |
eb5d44eb | 7 | * Institute of Communications Engineering |
8 | * | |
ac4d0be5 | 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 | * | |
ac4d0be5 | 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. |
18 | ||
ac4d0be5 | 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., | |
eb5d44eb | 21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22 | */ | |
23 | ||
24 | #ifndef _ZEBRA_ISIS_PDU_H | |
25 | #define _ZEBRA_ISIS_PDU_H | |
26 | ||
238497fc PJ |
27 | #ifdef __SUNPRO_C |
28 | #pragma pack(1) | |
29 | #endif | |
30 | ||
eb5d44eb | 31 | /* |
32 | * ISO 9542 - 7.5,7.6 | |
33 | * | |
34 | * ES to IS Fixed Header | |
35 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
36 | * | Intradomain Routeing Protocol Discriminator | | |
37 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
38 | * | Length Indicator | | |
39 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
40 | * | Version/Protocol ID extension | | |
41 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
42 | * | Reserved = 0 | | |
43 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
44 | * | 0 | 0 | 0 | PDU Type | | |
45 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
46 | * | Holding Time | 2 | |
47 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
48 | * | Checksum | 2 | |
49 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
50 | */ | |
51 | ||
ac4d0be5 | 52 | struct esis_fixed_hdr { |
53 | u_char idrp; | |
54 | u_char length; | |
55 | u_char version; | |
56 | u_char id_len; | |
57 | u_char pdu_type; | |
58 | u_int16_t holdtime; | |
59 | u_int16_t checksum; | |
60 | } __attribute__((packed)); | |
eb5d44eb | 61 | |
62 | #define ESIS_FIXED_HDR_LEN 9 | |
63 | ||
64 | #define ESH_PDU 2 | |
65 | #define ISH_PDU 4 | |
66 | #define RD_PDU 5 | |
67 | ||
68 | /* | |
69 | * IS to IS Fixed Header | |
70 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
ac4d0be5 | 71 | * | Intradomain Routeing Protocol Discriminator | |
eb5d44eb | 72 | * +-------+-------+-------+-------+-------+-------+-------+-------+ |
73 | * | Length Indicator | | |
74 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
75 | * | Version/Protocol ID extension | | |
76 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
ac4d0be5 | 77 | * | R | R | R | PDU Type | |
eb5d44eb | 78 | * +-------+-------+-------+-------+-------+-------+-------+-------+ |
79 | * | Version | | |
80 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
81 | * | Reserved | | |
82 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
ac4d0be5 | 83 | * | Maximum Area Addresses | |
eb5d44eb | 84 | * +-------+-------+-------+-------+-------+-------+-------+-------+ |
85 | */ | |
86 | ||
ac4d0be5 | 87 | struct isis_fixed_hdr { |
88 | u_char idrp; | |
89 | u_char length; | |
90 | u_char version1; | |
91 | u_char id_len; | |
92 | u_char pdu_type; | |
93 | u_char version2; | |
94 | u_char reserved; | |
95 | u_char max_area_addrs; | |
96 | } __attribute__((packed)); | |
eb5d44eb | 97 | |
98 | #define ISIS_FIXED_HDR_LEN 8 | |
99 | ||
100 | /* | |
101 | * IS-IS PDU types. | |
102 | */ | |
103 | ||
104 | #define L1_LAN_HELLO 15 | |
105 | #define L2_LAN_HELLO 16 | |
106 | /* | |
107 | * L1 and L2 LAN IS to IS Hello PDU header | |
108 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
109 | * | Reserved | Circuit Type | 1 | |
110 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
ac4d0be5 | 111 | * + Source ID + id_len |
eb5d44eb | 112 | * +-------+-------+-------+-------+-------+-------+-------+-------+ |
ac4d0be5 | 113 | * | Holding Time | 2 |
eb5d44eb | 114 | * +-------+-------+-------+-------+-------+-------+-------+-------+ |
ac4d0be5 | 115 | * | PDU Length | 2 |
eb5d44eb | 116 | * +-------+-------+-------+-------+-------+-------+-------+-------+ |
117 | * | R | Priority | 1 | |
118 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
119 | * | LAN ID | id_len + 1 | |
120 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
121 | */ | |
ac4d0be5 | 122 | struct isis_lan_hello_hdr { |
123 | u_char circuit_t; | |
124 | u_char source_id[ISIS_SYS_ID_LEN]; | |
125 | u_int16_t hold_time; | |
126 | u_int16_t pdu_len; | |
127 | u_char prio; | |
128 | u_char lan_id[ISIS_SYS_ID_LEN + 1]; | |
129 | } __attribute__((packed)); | |
eb5d44eb | 130 | #define ISIS_LANHELLO_HDRLEN 19 |
131 | ||
132 | #define P2P_HELLO 17 | |
133 | /* | |
134 | * Point-to-point IS to IS hello PDU header | |
135 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
136 | * | Reserved | Circuit Type | 1 | |
137 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
ac4d0be5 | 138 | * + Source ID + id_len |
eb5d44eb | 139 | * +-------+-------+-------+-------+-------+-------+-------+-------+ |
ac4d0be5 | 140 | * + Holding Time + 2 |
eb5d44eb | 141 | * +-------+-------+-------+-------+-------+-------+-------+-------+ |
ac4d0be5 | 142 | * + PDU Length + 2 |
eb5d44eb | 143 | * +-------+-------+-------+-------+-------+-------+-------+-------+ |
144 | * | Local Circuit ID | 1 | |
145 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
146 | */ | |
ac4d0be5 | 147 | struct isis_p2p_hello_hdr { |
148 | u_char circuit_t; | |
149 | u_char source_id[ISIS_SYS_ID_LEN]; | |
150 | u_int16_t hold_time; | |
151 | u_int16_t pdu_len; | |
152 | u_char local_id; | |
153 | } __attribute__((packed)); | |
eb5d44eb | 154 | #define ISIS_P2PHELLO_HDRLEN 12 |
155 | ||
156 | #define L1_LINK_STATE 18 | |
157 | #define L2_LINK_STATE 20 | |
158 | /* | |
159 | * L1 and L2 IS to IS link state PDU header | |
160 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
161 | * + PDU Length + 2 | |
162 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
ac4d0be5 | 163 | * + Remaining Lifetime + 2 |
eb5d44eb | 164 | * +-------+-------+-------+-------+-------+-------+-------+-------+ |
165 | * | LSP ID | id_len + 2 | |
166 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
167 | * + Sequence Number + 4 | |
168 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
169 | * + Checksum + 2 | |
170 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
171 | * | P | ATT |LSPDBOL| ISTYPE | | |
172 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
173 | */ | |
ac4d0be5 | 174 | struct isis_link_state_hdr { |
175 | u_int16_t pdu_len; | |
176 | u_int16_t rem_lifetime; | |
177 | u_char lsp_id[ISIS_SYS_ID_LEN + 2]; | |
178 | u_int32_t seq_num; | |
179 | u_int16_t checksum; | |
180 | u_int8_t lsp_bits; | |
181 | } __attribute__((packed)); | |
eb5d44eb | 182 | #define ISIS_LSP_HDR_LEN 19 |
183 | ||
3f045a08 JB |
184 | /* |
185 | * Since the length field of LSP Entries TLV is one byte long, and each LSP | |
186 | * entry is LSP_ENTRIES_LEN (16) bytes long, the maximum number of LSP entries | |
187 | * can be accomodated in a TLV is | |
188 | * 255 / 16 = 15. | |
ac4d0be5 | 189 | * |
3f045a08 JB |
190 | * Therefore, the maximum length of the LSP Entries TLV is |
191 | * 16 * 15 + 2 (header) = 242 bytes. | |
192 | */ | |
193 | #define MAX_LSP_ENTRIES_TLV_SIZE 242 | |
194 | ||
eb5d44eb | 195 | #define L1_COMPLETE_SEQ_NUM 24 |
196 | #define L2_COMPLETE_SEQ_NUM 25 | |
197 | /* | |
198 | * L1 and L2 IS to IS complete sequence numbers PDU header | |
199 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
ac4d0be5 | 200 | * + PDU Length + 2 |
eb5d44eb | 201 | * +-------+-------+-------+-------+-------+-------+-------+-------+ |
202 | * + Source ID + id_len + 1 | |
203 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
204 | * + Start LSP ID + id_len + 2 | |
205 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
206 | * + End LSP ID + id_len + 2 | |
207 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
208 | */ | |
ac4d0be5 | 209 | struct isis_complete_seqnum_hdr { |
210 | u_int16_t pdu_len; | |
211 | u_char source_id[ISIS_SYS_ID_LEN + 1]; | |
212 | u_char start_lsp_id[ISIS_SYS_ID_LEN + 2]; | |
213 | u_char stop_lsp_id[ISIS_SYS_ID_LEN + 2]; | |
eb5d44eb | 214 | }; |
215 | #define ISIS_CSNP_HDRLEN 25 | |
216 | ||
217 | #define L1_PARTIAL_SEQ_NUM 26 | |
218 | #define L2_PARTIAL_SEQ_NUM 27 | |
219 | /* | |
220 | * L1 and L2 IS to IS partial sequence numbers PDU header | |
221 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
222 | * + PDU Length + 2 | |
223 | * +-------+-------+-------+-------+-------+-------+-------+-------+ | |
224 | * + Source ID + id_len + 1 | |
225 | * +---------------------------------------------------------------+ | |
226 | */ | |
ac4d0be5 | 227 | struct isis_partial_seqnum_hdr { |
228 | u_int16_t pdu_len; | |
229 | u_char source_id[ISIS_SYS_ID_LEN + 1]; | |
eb5d44eb | 230 | }; |
231 | #define ISIS_PSNP_HDRLEN 9 | |
232 | ||
238497fc PJ |
233 | #ifdef __SUNPRO_C |
234 | #pragma pack() | |
235 | #endif | |
236 | ||
eb5d44eb | 237 | /* |
238 | * Function for receiving IS-IS PDUs | |
239 | */ | |
ac4d0be5 | 240 | int isis_receive(struct thread *thread); |
eb5d44eb | 241 | |
242 | /* | |
243 | * calling arguments for snp_process () | |
244 | */ | |
245 | #define ISIS_SNP_PSNP_FLAG 0 | |
246 | #define ISIS_SNP_CSNP_FLAG 1 | |
247 | ||
3f045a08 JB |
248 | #define ISIS_AUTH_MD5_SIZE 16U |
249 | ||
eb5d44eb | 250 | /* |
251 | * Sending functions | |
252 | */ | |
ac4d0be5 | 253 | int send_lan_l1_hello(struct thread *thread); |
254 | int send_lan_l2_hello(struct thread *thread); | |
255 | int send_p2p_hello(struct thread *thread); | |
256 | int send_csnp(struct isis_circuit *circuit, int level); | |
257 | int send_l1_csnp(struct thread *thread); | |
258 | int send_l2_csnp(struct thread *thread); | |
259 | int send_l1_psnp(struct thread *thread); | |
260 | int send_l2_psnp(struct thread *thread); | |
261 | int send_lsp(struct thread *thread); | |
262 | int ack_lsp(struct isis_link_state_hdr *hdr, struct isis_circuit *circuit, | |
263 | int level); | |
264 | void fill_fixed_hdr(struct isis_fixed_hdr *hdr, u_char pdu_type); | |
265 | int send_hello(struct isis_circuit *circuit, int level); | |
eb5d44eb | 266 | |
eb5d44eb | 267 | #endif /* _ZEBRA_ISIS_PDU_H */ |