summaryrefslogtreecommitdiffstats
path: root/isisd/isis_pdu.h
diff options
context:
space:
mode:
authorjardin <jardin>2003-12-23 09:09:43 +0100
committerjardin <jardin>2003-12-23 09:09:43 +0100
commiteb5d44eb8dcf25a1b328e57d1eabb1f89e3bc59b (patch)
tree2973e8563fcbd4a8cf901d211ff4f8de00c36381 /isisd/isis_pdu.h
parentReorder free(f); unlink(f); to unlink before freeing. (diff)
downloadfrr-eb5d44eb8dcf25a1b328e57d1eabb1f89e3bc59b.tar.xz
frr-eb5d44eb8dcf25a1b328e57d1eabb1f89e3bc59b.zip
Initial revision
Diffstat (limited to 'isisd/isis_pdu.h')
-rw-r--r--isisd/isis_pdu.h257
1 files changed, 257 insertions, 0 deletions
diff --git a/isisd/isis_pdu.h b/isisd/isis_pdu.h
new file mode 100644
index 000000000..994036801
--- /dev/null
+++ b/isisd/isis_pdu.h
@@ -0,0 +1,257 @@
+/*
+ * IS-IS Rout(e)ing protocol - isis_pdu.h
+ * PDU processing
+ *
+ * Copyright (C) 2001,2002 Sampo Saaristo
+ * Tampere University of Technology
+ * Institute of Communications Engineering
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public Licenseas published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _ZEBRA_ISIS_PDU_H
+#define _ZEBRA_ISIS_PDU_H
+
+/*
+ * ISO 9542 - 7.5,7.6
+ *
+ * ES to IS Fixed Header
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Intradomain Routeing Protocol Discriminator |
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Length Indicator |
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Version/Protocol ID extension |
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Reserved = 0 |
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | 0 | 0 | 0 | PDU Type |
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Holding Time | 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Checksum | 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ */
+
+struct esis_fixed_hdr
+{
+ u_char idrp;
+ u_char length;
+ u_char version;
+ u_char id_len;
+ u_char pdu_type;
+ u_int16_t holdtime;
+ u_int16_t checksum;
+} __attribute__((packed));
+
+#define ESIS_FIXED_HDR_LEN 9
+
+#define ESH_PDU 2
+#define ISH_PDU 4
+#define RD_PDU 5
+
+/*
+ * IS to IS Fixed Header
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Intradomain Routeing Protocol Discriminator |
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Length Indicator |
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Version/Protocol ID extension |
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | R | R | R | PDU Type |
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Version |
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Reserved |
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Maximum Area Addresses |
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ */
+
+struct isis_fixed_hdr
+{
+ u_char idrp;
+ u_char length;
+ u_char version1;
+ u_char id_len;
+ u_char pdu_type;
+ u_char version2;
+ u_char reserved;
+ u_char max_area_addrs;
+};
+
+#define ISIS_FIXED_HDR_LEN 8
+
+/*
+ * IS-IS PDU types.
+ */
+
+#define L1_LAN_HELLO 15
+#define L2_LAN_HELLO 16
+/*
+ * L1 and L2 LAN IS to IS Hello PDU header
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Reserved | Circuit Type | 1
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + Source ID + id_len
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Holding Time | 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | PDU Lenght | 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | R | Priority | 1
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | LAN ID | id_len + 1
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ */
+struct isis_lan_hello_hdr {
+ u_char circuit_t;
+ u_char source_id[ISIS_SYS_ID_LEN];
+ u_int16_t hold_time;
+ u_int16_t pdu_len;
+ u_char prio;
+ u_char lan_id[ISIS_SYS_ID_LEN + 1];
+} __attribute__((packed));
+#define ISIS_LANHELLO_HDRLEN 19
+
+#define P2P_HELLO 17
+/*
+ * Point-to-point IS to IS hello PDU header
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Reserved | Circuit Type | 1
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + Source ID + id_len
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + Holding Time + 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + PDU Lenght + 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | Local Circuit ID | 1
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ */
+struct isis_p2p_hello_hdr {
+ u_char circuit_t;
+ u_char source_id[ISIS_SYS_ID_LEN];
+ u_int16_t hold_time;
+ u_int16_t pdu_len;
+ u_char local_id;
+} __attribute__((packed));
+#define ISIS_P2PHELLO_HDRLEN 12
+
+#define L1_LINK_STATE 18
+#define L2_LINK_STATE 20
+/*
+ * L1 and L2 IS to IS link state PDU header
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + PDU Length + 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + Remaining Lifetime + 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | LSP ID | id_len + 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + Sequence Number + 4
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + Checksum + 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * | P | ATT |LSPDBOL| ISTYPE |
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ */
+struct isis_link_state_hdr {
+ u_int16_t pdu_len;
+ u_int16_t rem_lifetime;
+ u_char lsp_id[ISIS_SYS_ID_LEN + 2];
+ u_int32_t seq_num;
+ u_int16_t checksum;
+ u_int8_t lsp_bits;
+} __attribute__((packed));
+#define ISIS_LSP_HDR_LEN 19
+
+#define L1_COMPLETE_SEQ_NUM 24
+#define L2_COMPLETE_SEQ_NUM 25
+/*
+ * L1 and L2 IS to IS complete sequence numbers PDU header
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + PDU Lenght + 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + Source ID + id_len + 1
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + Start LSP ID + id_len + 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + End LSP ID + id_len + 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ */
+struct isis_complete_seqnum_hdr {
+ u_int16_t pdu_len;
+ u_char source_id[ISIS_SYS_ID_LEN + 1];
+ u_char start_lsp_id[ISIS_SYS_ID_LEN + 2];
+ u_char stop_lsp_id[ISIS_SYS_ID_LEN + 2];
+};
+#define ISIS_CSNP_HDRLEN 25
+
+#define L1_PARTIAL_SEQ_NUM 26
+#define L2_PARTIAL_SEQ_NUM 27
+/*
+ * L1 and L2 IS to IS partial sequence numbers PDU header
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + PDU Length + 2
+ * +-------+-------+-------+-------+-------+-------+-------+-------+
+ * + Source ID + id_len + 1
+ * +---------------------------------------------------------------+
+ */
+struct isis_partial_seqnum_hdr {
+ u_int16_t pdu_len;
+ u_char source_id[ISIS_SYS_ID_LEN + 1];
+};
+#define ISIS_PSNP_HDRLEN 9
+
+/*
+ * Function for receiving IS-IS PDUs
+ */
+int isis_receive (struct thread *thread);
+
+/*
+ * calling arguments for snp_process ()
+ */
+#define ISIS_SNP_PSNP_FLAG 0
+#define ISIS_SNP_CSNP_FLAG 1
+
+/*
+ * Sending functions
+ */
+int send_lan_l1_hello (struct thread *thread);
+int send_lan_l2_hello (struct thread *thread);
+int send_p2p_hello (struct thread *thread);
+int send_csnp (struct isis_circuit *circuit, int level);
+int send_l1_csnp (struct thread *thread);
+int send_l2_csnp (struct thread *thread);
+int send_l1_psnp (struct thread *thread);
+int send_l2_psnp (struct thread *thread);
+int send_lsp (struct thread *thread);
+int ack_lsp (struct isis_link_state_hdr *hdr,
+ struct isis_circuit *circuit, int level);
+void fill_fixed_hdr (struct isis_fixed_hdr *hdr, u_char pdu_type);
+int send_hello (struct isis_circuit *circuit, int level);
+
+
+int authentication_check (struct isis_passwd *one,
+ struct isis_passwd *theother);
+
+#endif /* _ZEBRA_ISIS_PDU_H */
+
+
+
+
+