Ethereal-dev: [Ethereal-dev] [patch] packet-afp.c

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

From: didier <dgautheron@xxxxxxxx>
Date: Wed, 12 Feb 2003 20:54:39 +0000
Hi
add AFP3 setforkparam 64 bits parameters.

Didier
Index: packet-afp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-afp.c,v
retrieving revision 1.27
diff -u -r1.27 packet-afp.c
--- packet-afp.c	19 Jan 2003 21:21:32 -0000	1.27
+++ packet-afp.c	12 Feb 2003 20:48:35 -0000
@@ -293,6 +296,7 @@
 
 static int hf_afp_last_written64	= -1;
 
+static int hf_afp_ofork_len64           = -1;
 static int hf_afp_session_token_type	= -1;
 static int hf_afp_session_token_len	= -1;
 static int hf_afp_session_token		= -1;
@@ -2561,17 +2565,24 @@
 static gint
 dissect_query_afp_set_fork_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
 {
+	guint16 bitmap;
 
 	PAD(1);
         add_info_fork(tvb, pinfo, offset);
 	proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
 	offset += 2;
 
-	decode_file_bitmap(tree, tvb, offset);
+	bitmap = decode_file_bitmap(tree, tvb, offset);
 	offset += 2;
 
-	proto_tree_add_item(tree, hf_afp_ofork_len, tvb, offset, 4,FALSE);
-	offset += 4;
+	if ((bitmap & kFPExtDataForkLenBit) || (bitmap & kFPExtRsrcForkLenBit)) {
+		proto_tree_add_item(tree, hf_afp_ofork_len64, tvb, offset, 8, FALSE);
+		offset += 8;
+	}
+	else {
+		proto_tree_add_item(tree, hf_afp_ofork_len, tvb, offset, 4,FALSE);
+		offset += 4;
+	}
 	return offset;
 }
 
@@ -4393,6 +4404,10 @@
 		FT_UINT64, BASE_DEC, NULL, 0x0,
       	"Offset of the last byte written (64 bits)", HFILL }},
 
+    { &hf_afp_ofork_len64,
+      { "New length",         "afp.ofork_len64",
+		FT_INT64, BASE_DEC, NULL, 0x0,
+      	"New length (64 bits)", HFILL }},
     { &hf_afp_session_token_type,
       { "Type",         "afp.session_token_type",
 		FT_UINT16, BASE_HEX, NULL, 0x0,