Ethereal-dev: [Ethereal-dev] patch: tftp last block indicator

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

From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Fri, 24 May 2002 18:25:54 +0200
see subject/changelog
I've one thing about this patch I'm not feeling comfortable with:
Is the method used to obtain the block size ok, or is this only the
captured size?

        ciao
             Jörg
--
Joerg Mayer                                          <jmayer@xxxxxxxxx>
I found out that "pro" means "instead of" (as in proconsul). Now I know
what proactive means.
Changelog: <jmayer@xxxxxxxxx>
	Print indication iff packet is last packet in current transfer.

Index: ethereal/packet-tftp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-tftp.c,v
retrieving revision 1.36
diff -u -r1.36 packet-tftp.c
--- packet-tftp.c	2002/01/24 09:20:52	1.36
+++ packet-tftp.c	2002/05/24 16:19:18
@@ -98,6 +98,7 @@
 	conversation_t  *conversation;
 	gint		offset = 0;
 	guint16		opcode;
+	guint16		bytes;
 	u_int           i1;
 	guint16         error;
 
@@ -212,15 +213,18 @@
 	    proto_tree_add_item(tftp_tree, hf_tftp_blocknum, tvb, offset, 2,
 	    		    FALSE);
 	  }
+
+	  bytes = tvb_reported_length_remaining(tvb, offset+2);
+
 	  if (check_col(pinfo->cinfo, COL_INFO)) {
-	    col_append_fstr(pinfo->cinfo, COL_INFO, ", Block: %i",
-			    tvb_get_ntohs(tvb, offset));
+	    col_append_fstr(pinfo->cinfo, COL_INFO, ", Block: %i%s",
+		    tvb_get_ntohs(tvb, offset),
+		    (bytes < 0x200)?" (last)":"" );
 	  }
-	  offset += 2;
 
 	  if (tree) {
 	    proto_tree_add_text(tftp_tree, tvb, offset, -1,
-		"Data (%d bytes)", tvb_reported_length_remaining(tvb, offset));
+		"Data (%d bytes)", bytes);
 	  }
 	  break;