Ethereal-dev: [Ethereal-dev] [PATCH] ACN plugin update

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

From: Erwin Rol <mailinglists@xxxxxxxxxxxx>
Date: Wed, 05 Nov 2003 17:17:52 +0100
Attached an update for the ACN plugin. With this Patch the SDT part of
the ACN protocol is "complete". The next step will be DMP.

- Erwin

-- 
       Erwin Rol Software Engineering - http://www.erwinrol.com/

? acn.diff
? acn.dump
? acn.dump1
Index: packet-acn.c
===================================================================
RCS file: /cvsroot/ethereal/plugins/acn/packet-acn.c,v
retrieving revision 1.2
diff -u -r1.2 packet-acn.c
--- packet-acn.c	31 Oct 2003 18:28:32 -0000	1.2
+++ packet-acn.c	5 Nov 2003 16:14:02 -0000
@@ -86,7 +86,7 @@
 	{ ACN_SDT_TYPE_REPLOSTSEQON,	"REPLOSTSEQON"},
 	{ ACN_SDT_TYPE_REPLOSTSEQOFF,	"REPLOSTSEQOFF"},
 	{ ACN_SDT_TYPE_SESSEXPIRY,	"SESEXPIRY"},
-	{ ACN_SDT_TYPE_MAK,		"MAC"},
+	{ ACN_SDT_TYPE_MAK,		"MAK"},
 	{ ACN_SDT_TYPE_ACK,		"ACK"},
 	{ ACN_SDT_TYPE_NAK,		"NAK"},
 	{ ACN_SDT_TYPE_SEQLOST,		"SEQLOST"},
@@ -107,6 +107,23 @@
 	{ 0,				NULL }
 };
 
+static const value_string acn_sdt_des_flag_vals[] = {
+	{ 0,				"Default"},
+	{ 1,				"Protocol Specific"},
+	{ 2,				"CID"},
+	{ 3,				"All"}, 
+	{ 0,				NULL }
+};
+
+static const value_string acn_sdt_src_flag_vals[] = {
+	{ 0,				"Default"},
+	{ 1,				"Protocol Specific"},
+	{ 2,				"CID"},
+	{ 3,				"Unspecified"}, 
+	{ 0,				NULL }
+};
+
+
 void proto_reg_handoff_acn(void);
 
 /* Define the acn proto */
@@ -140,6 +157,7 @@
 static int hf_acn_pdu_type_sdt = -1;
 static int hf_acn_pdu_type_dmp = -1;
 static int hf_acn_pdu_data = -1;
+static int hf_acn_pdu_unknown_data = -1;
 
 static int hf_acn_pdu_padding = -1;
 
@@ -150,7 +168,9 @@
 static int hf_acn_sdt_unavailable_wrappers = -1;
 static int hf_acn_sdt_refuse_code = -1;
 static int hf_acn_sdt_last_rel_seq = -1;
+static int hf_acn_sdt_new_rel_seq = -1;
 static int hf_acn_sdt_last_rel_wrapper = -1;
+static int hf_acn_sdt_nr_lost_wrappers = -1;
 static int hf_acn_sdt_session_exp_time = -1;
 static int hf_acn_sdt_upstream_address_type = -1;
 static int hf_acn_sdt_upstream_ipv4_address = -1;
@@ -198,6 +218,7 @@
 	guint size = 0;
 	guint flags;
 	guint type;
+	guint count;
 
 	hist = *parent_hist;
 
@@ -368,6 +389,8 @@
 						offset, 2, FALSE);
 			offset += 2;
 					
+			size = offset - start_offset;
+
 			break;
 
 		case ACN_SDT_TYPE_TRANSFER:
@@ -492,7 +515,21 @@
 			offset += 2;
 			
 			/* CID+MID list */
+			count = (max_size - (offset - start_offset)) / 18;
+			while( count > 0) {
+				proto_tree_add_item(tree, hf_acn_sdt_member_cid, tvb,
+							offset, 16, FALSE);
+				offset += 16;
+
+				proto_tree_add_item(tree, hf_acn_sdt_mid, tvb,
+							offset, 2, FALSE);
+				offset += 2;
+
+				count--;
+			}
 			
+			size = offset - start_offset;
+
 			break;
 
 		case ACN_SDT_TYPE_JOINREF:
@@ -514,7 +551,6 @@
 			offset += 4;
 
 			size = offset - start_offset;
-
 			break;
 
 		case ACN_SDT_TYPE_LEAVING:
@@ -535,13 +571,51 @@
 			break;
 
 		case ACN_SDT_TYPE_MAK:
+			proto_tree_add_item(tree, hf_acn_sdt_ack_threshold, tvb,
+						offset, 2, FALSE);
+			offset += 2;
+
+			count = (max_size - (offset - start_offset)) / 2;
+			while( count > 0) {
+				proto_tree_add_item(tree, hf_acn_sdt_mid, tvb,
+							offset, 2, FALSE);
+				offset += 2;
+
+				count--;
+			}
+			
+			size = offset - start_offset;
 			break;
 			
-		case ACN_SDT_TYPE_NAK:
-				
+		case ACN_SDT_TYPE_NAK:				
+			proto_tree_add_item(tree, hf_acn_sdt_session_nr, tvb,
+						offset, 2, FALSE);
+			offset += 2;
+
+			proto_tree_add_item(tree, hf_acn_sdt_mid, tvb,
+						offset, 2, FALSE);
+			offset += 2;
+
+			proto_tree_add_item(tree, hf_acn_sdt_last_rel_seq, tvb,
+						offset, 4, FALSE);
+			offset += 4;
+
+			proto_tree_add_item(tree, hf_acn_sdt_nr_lost_wrappers, tvb,
+						offset, 2, FALSE);
+			offset += 2;
+
+			size = offset - start_offset;
 			break;
 			
 		case ACN_SDT_TYPE_SEQLOST:
+			proto_tree_add_item(tree, hf_acn_sdt_last_rel_seq, tvb,
+						offset, 4, FALSE);
+			offset += 4;
+
+			proto_tree_add_item(tree, hf_acn_sdt_new_rel_seq, tvb,
+						offset, 4, FALSE);
+			offset += 4;
+			size = offset - start_offset;
 			break;
 
 		case ACN_SDT_TYPE_NAKPARAMS:
@@ -556,6 +630,8 @@
 			proto_tree_add_item(tree, hf_acn_sdt_max_nak_wait_time, tvb,
 						offset, 2, FALSE);
 			offset += 2;
+
+			size = offset - start_offset;
 			break;
 
 		case ACN_SDT_TYPE_LEAVEREQ:
@@ -567,6 +643,7 @@
 		case ACN_SDT_TYPE_REPLOSTSEQON:
 		case ACN_SDT_TYPE_REPLOSTSEQOFF:
 			/* no data */
+			size = offset - start_offset;
 			break;
 
 		default:
@@ -590,7 +667,7 @@
 	guint src,des;
 	proto_tree *ti, *si, *flags_tree, *flags_item, *data_tree, *data_item;
 	guint start_offset = offset;
-	acn_pdu_history_t hist;
+	acn_pdu_history_t hist = *parent_hist;
 	
 
 	ti = proto_tree_add_item(tree,
@@ -634,6 +711,9 @@
 					offset, 4, size);	
 		offset += 4;
 	}
+	
+	if(size > max_size )
+		size = max_size;
 
 	switch( flags & ACN_PDU_DES )
 	{	
@@ -727,8 +807,6 @@
 		offset += 2;
 	}
 
-	/*hist = *parent_hist;*/
-
 	if( flags & ACN_PDU_FLAG_Z )
 	{
 		data_size = size - (offset - start_offset);
@@ -740,7 +818,6 @@
 		data_tree=proto_item_add_subtree(data_item, ett_acn);
 
 
-		
 		switch( hist.protocol ) {
 			case ACN_PDU_PROTO_SDT:
 				dissect_sdt( tvb, offset, data_tree, &hist, data_size);
@@ -751,8 +828,8 @@
 				break;
 	
 			default:
-				/*proto_tree_add_item(si, hf_acn_pdu_data, tvb,*/
-				/*			offset, data_size, FALSE );*/
+				proto_tree_add_item(si, hf_acn_pdu_unknown_data, tvb,
+							offset, data_size, FALSE );
 				break;	
 		}
 
@@ -824,12 +901,12 @@
 
 	{ &hf_acn_pdu_des,
 	    { "des","acn.pdu.des",
-		FT_UINT8, BASE_HEX, NULL, 0xC0,
+		FT_UINT8, BASE_HEX, VALS( acn_sdt_des_flag_vals ), 0xC0,
 		"des", HFILL }},
 
 	{ &hf_acn_pdu_src,
 	    { "src","acn.pdu.src",
-		FT_UINT8, BASE_HEX, NULL, 0x30,
+		FT_UINT8, BASE_HEX, VALS( acn_sdt_src_flag_vals ), 0x30,
 		"src", HFILL }},
 
 	{ &hf_acn_pdu_flag_p,
@@ -912,6 +989,11 @@
 		FT_NONE, BASE_HEX, NULL, 0x0,
 		"Data", HFILL }},
 
+	{ &hf_acn_pdu_unknown_data,
+	    { "Unknown Data","acn.pdu.unknown_data",
+		FT_BYTES, BASE_HEX, NULL, 0x0,
+		"Unknown Data", HFILL }},
+
 	{ &hf_acn_pdu_padding,
 	    { "Padding","acn.pdu.padding",
 		FT_UINT8, BASE_DEC, NULL, 0x0,
@@ -947,10 +1029,20 @@
 		FT_UINT32, BASE_DEC, NULL, 0x0,
 		"SDT Last reliable seq nr", HFILL }},
 
+	{ &hf_acn_sdt_new_rel_seq,
+	    { "SDT reliable seq nr to continue with","acn.sdt.new_rel_seq",
+		FT_UINT32, BASE_DEC, NULL, 0x0,
+		"SDT reliable seq nr to continue with", HFILL }},
+
 	{ &hf_acn_sdt_last_rel_wrapper,
 	    { "SDT Last reliable Wrapper","acn.sdt.last_rel_wrapper",
 		FT_UINT32, BASE_DEC, NULL, 0x0,
 		"SDT Last reliable Wrapper", HFILL }},
+
+	{ &hf_acn_sdt_nr_lost_wrappers,
+	    { "SDT Nr of lost Wrappers","acn.sdt.nr_lost_wrappers",
+		FT_UINT32, BASE_DEC, NULL, 0x0,
+		"SDT Nr of lost  Wrappers", HFILL }},
 
 	{ &hf_acn_sdt_session_exp_time,
 	    { "SDT Session expire time","acn.sdt.session_exp_time",