Ethereal-dev: [Ethereal-dev] IS-IS restart TLV support

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Hannes Gredler <hannes@xxxxxxxxxxx>
Date: Sun, 10 Feb 2002 00:04:02 +0100
ethereal developers,

pls find attached a patch to support
the new restart TLV for IS-IS;

/hannes  
Index: packet-isis-hello.c
===================================================================
RCS file: /cvsroot/ethereal/packet-isis-hello.c,v
retrieving revision 1.26
diff -u -r1.26 packet-isis-hello.c
--- packet-isis-hello.c	2002/01/24 09:20:49	1.26
+++ packet-isis-hello.c	2002/02/09 22:59:23
@@ -53,6 +53,7 @@
 static int hf_isis_hello_clv_ipv6_int_addr   = -1;
 static int hf_isis_hello_clv_ptp_adj         = -1;
 static int hf_isis_hello_clv_mt              = -1;
+static int hf_isis_hello_clv_restart         = -1;
 
 static gint ett_isis_hello                   = -1;
 static gint ett_isis_hello_clv_area_addr     = -1;
@@ -65,6 +66,7 @@
 static gint ett_isis_hello_clv_ipv6_int_addr = -1;
 static gint ett_isis_hello_clv_ptp_adj       = -1;
 static gint ett_isis_hello_clv_mt            = -1;
+static gint ett_isis_hello_clv_restart       = -1;
 
 static const value_string isis_hello_circuit_type_vals[] = {
 	{ ISIS_HELLO_TYPE_RESERVED,	"Reserved 0 (discard PDU)"},
@@ -103,6 +105,9 @@
 static void dissect_hello_nlpid_clv(tvbuff_t *tvb, 
 		packet_info *pinfo, proto_tree *tree, int offset, 
 		int id_length, int length);
+static void dissect_hello_restart_clv(tvbuff_t *tvb, 
+		packet_info *pinfo, proto_tree *tree, int offset, 
+		int id_length, int length);
 
 
 static const isis_clv_handle_t clv_l1_hello_opts[] = {
@@ -143,6 +148,12 @@
 		dissect_hello_ipv6_int_addr_clv
 	},
 	{
+		ISIS_CLV_L1H_RESTART,
+		"Restart Signaling",
+		&ett_isis_hello_clv_restart,
+		dissect_hello_restart_clv
+	},
+	{
 		ISIS_CLV_L1H_AUTHENTICATION_NS,
 		"Authentication(non spec)",
 		&ett_isis_hello_clv_auth,
@@ -212,6 +223,12 @@
 		dissect_hello_auth_clv
 	},
 	{
+		ISIS_CLV_L2H_RESTART,
+		"Restart Signaling",
+		&ett_isis_hello_clv_restart,
+		dissect_hello_restart_clv
+	},
+	{
 		ISIS_CLV_L2H_AUTHENTICATION,
 		"Authentication",
 		&ett_isis_hello_clv_auth,
@@ -275,6 +292,12 @@
 		dissect_hello_auth_clv
 	},
 	{
+		ISIS_CLV_PTP_RESTART,
+		"Restart Option",
+		&ett_isis_hello_clv_restart,
+		dissect_hello_restart_clv
+	},
+	{
 		ISIS_CLV_PTP_ADJ,
 		"Point-to-point Adjacency State",
 		&ett_isis_hello_clv_ptp_adj,
@@ -294,6 +317,35 @@
 	}
 };
 
+
+/*
+ * Name: dissect_hello_restart_clv()
+ *
+ * Description:
+ *	Decode for a restart clv - only found in IIHs
+ *      hence no call in the common clv dissector
+ *
+ */
+
+static void 
+dissect_hello_restart_clv(tvbuff_t *tvb, 
+		packet_info *pinfo, proto_tree *tree, int offset, 
+		int id_length, int length)
+{
+        int restart_options;
+
+	restart_options = tvb_get_guint8(tvb, offset);
+
+	proto_tree_add_text ( tree, tvb, offset, 1,        
+			      "Restart Request bit %s, "
+			      "Restart Acknowledgement bit %s",
+			      ISIS_MASK_RESTART_RR(restart_options) ? "set" : "clear",
+			      ISIS_MASK_RESTART_RA(restart_options) ? "set" : "clear"); 
+	proto_tree_add_text ( tree, tvb, offset+1, 2,        
+			      "Remaining holding time: %us",
+			      tvb_get_ntohs(tvb, offset+1) );
+}
+
 /*
  * Name: dissect_hello_nlpid_clv()
  *
@@ -774,9 +826,14 @@
 		&ett_isis_hello_clv_ipv4_int_addr,
 		&ett_isis_hello_clv_ipv6_int_addr,
 		&ett_isis_hello_clv_ptp_adj,
-		&ett_isis_hello_clv_mt
+		&ett_isis_hello_clv_mt,
+		&ett_isis_hello_clv_restart
 	};
 
 	proto_register_field_array(proto_isis, hf, array_length(hf));
 	proto_register_subtree_array(ett, array_length(ett));
 }
+
+
+
+
Index: packet-isis-hello.h
===================================================================
RCS file: /cvsroot/ethereal/packet-isis-hello.h,v
retrieving revision 1.6
diff -u -r1.6 packet-isis-hello.h
--- packet-isis-hello.h	2001/12/20 07:33:21	1.6
+++ packet-isis-hello.h	2002/02/09 22:59:23
@@ -47,6 +47,7 @@
 #define ISIS_CLV_L1H_PADDING		 8
 #define ISIS_CLV_L1H_NLPID		 129
 #define ISIS_CLV_L1H_IP_INTERFACE_ADDR	 132
+#define ISIS_CLV_L1H_RESTART             211
 #define ISIS_CLV_L1H_MT                  229
 #define ISIS_CLV_L1H_IPv6_INTERFACE_ADDR 232
 
@@ -65,6 +66,7 @@
 #define ISIS_CLV_L2H_PADDING		 8
 #define ISIS_CLV_L2H_NLPID		 129
 #define ISIS_CLV_L2H_IP_INTERFACE_ADDR	 132
+#define ISIS_CLV_L2H_RESTART             211
 #define ISIS_CLV_L2H_MT                  229
 #define ISIS_CLV_L2H_IPv6_INTERFACE_ADDR 232
 /*
@@ -81,6 +83,7 @@
 #define ISIS_CLV_PTP_PADDING		 8
 #define ISIS_CLV_PTP_NLPID		 129
 #define ISIS_CLV_PTP_IP_INTERFACE_ADDR	 132
+#define ISIS_CLV_PTP_RESTART             211
 #define ISIS_CLV_PTP_MT                  229
 #define ISIS_CLV_PTP_IPv6_INTERFACE_ADDR 232
 #define ISIS_CLV_PTP_ADJ                 240
@@ -92,6 +95,13 @@
 #define ISIS_CLV_PTP_AUTHENTICATION	133
 
 /*
+ * misc. bittest macros
+ */
+
+#define ISIS_MASK_RESTART_RR(x)            ((x)&0x1)
+#define ISIS_MASK_RESTART_RA(x)            ((x)&0x2)
+
+/*
  * Published API functions.  NOTE, this are "local" API functions and
  * are only valid from with isis decodes.
  */
@@ -101,3 +111,10 @@
 extern void isis_register_hello(int proto_isis);
 
 #endif /* _PACKET_ISIS_HELLO_H */
+
+
+
+
+
+
+