]> git.proxmox.com Git - mirror_frr.git/blame - isisd/isis_pdu.h
fabricd: reimplement LSP transmission logic
[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
af8ac8f9
CF
130struct isis_lsp_hdr {
131 uint16_t pdu_len;
132 uint16_t rem_lifetime;
133 uint8_t lsp_id[ISIS_SYS_ID_LEN + 2];
134 uint32_t seqno;
135 uint16_t checksum;
136 uint8_t lsp_bits;
137};
eb5d44eb 138#define ISIS_LSP_HDR_LEN 19
139
3f045a08
JB
140/*
141 * Since the length field of LSP Entries TLV is one byte long, and each LSP
142 * entry is LSP_ENTRIES_LEN (16) bytes long, the maximum number of LSP entries
143 * can be accomodated in a TLV is
144 * 255 / 16 = 15.
d62a17ae 145 *
3f045a08
JB
146 * Therefore, the maximum length of the LSP Entries TLV is
147 * 16 * 15 + 2 (header) = 242 bytes.
148 */
149#define MAX_LSP_ENTRIES_TLV_SIZE 242
150
eb5d44eb 151#define L1_COMPLETE_SEQ_NUM 24
152#define L2_COMPLETE_SEQ_NUM 25
153/*
154 * L1 and L2 IS to IS complete sequence numbers PDU header
155 * +-------+-------+-------+-------+-------+-------+-------+-------+
d62a17ae 156 * + PDU Length + 2
eb5d44eb 157 * +-------+-------+-------+-------+-------+-------+-------+-------+
158 * + Source ID + id_len + 1
159 * +-------+-------+-------+-------+-------+-------+-------+-------+
160 * + Start LSP ID + id_len + 2
161 * +-------+-------+-------+-------+-------+-------+-------+-------+
162 * + End LSP ID + id_len + 2
163 * +-------+-------+-------+-------+-------+-------+-------+-------+
164 */
d62a17ae 165struct isis_complete_seqnum_hdr {
d7c0a89a
QY
166 uint16_t pdu_len;
167 uint8_t source_id[ISIS_SYS_ID_LEN + 1];
168 uint8_t start_lsp_id[ISIS_SYS_ID_LEN + 2];
169 uint8_t stop_lsp_id[ISIS_SYS_ID_LEN + 2];
eb5d44eb 170};
171#define ISIS_CSNP_HDRLEN 25
172
173#define L1_PARTIAL_SEQ_NUM 26
174#define L2_PARTIAL_SEQ_NUM 27
175/*
176 * L1 and L2 IS to IS partial sequence numbers PDU header
177 * +-------+-------+-------+-------+-------+-------+-------+-------+
178 * + PDU Length + 2
179 * +-------+-------+-------+-------+-------+-------+-------+-------+
180 * + Source ID + id_len + 1
181 * +---------------------------------------------------------------+
182 */
d62a17ae 183struct isis_partial_seqnum_hdr {
d7c0a89a
QY
184 uint16_t pdu_len;
185 uint8_t source_id[ISIS_SYS_ID_LEN + 1];
eb5d44eb 186};
187#define ISIS_PSNP_HDRLEN 9
188
238497fc
PJ
189#ifdef __SUNPRO_C
190#pragma pack()
191#endif
192
eb5d44eb 193/*
194 * Function for receiving IS-IS PDUs
195 */
d62a17ae 196int isis_receive(struct thread *thread);
eb5d44eb 197
198/*
199 * calling arguments for snp_process ()
200 */
201#define ISIS_SNP_PSNP_FLAG 0
202#define ISIS_SNP_CSNP_FLAG 1
203
3f045a08
JB
204#define ISIS_AUTH_MD5_SIZE 16U
205
eb5d44eb 206/*
207 * Sending functions
208 */
d62a17ae 209int send_lan_l1_hello(struct thread *thread);
210int send_lan_l2_hello(struct thread *thread);
211int send_p2p_hello(struct thread *thread);
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);
9b39405f 217void send_lsp(void *arg, struct isis_lsp *lsp, enum isis_tx_type tx_type);
88f9d911 218void fill_fixed_hdr(uint8_t pdu_type, struct stream *stream);
d62a17ae 219int send_hello(struct isis_circuit *circuit, int level);
d7c0a89a 220int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa);
eb5d44eb 221#endif /* _ZEBRA_ISIS_PDU_H */