Ethereal-dev: Re: [Ethereal-dev] Re: BACnet: display invoke-id in main datagramme list

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

From: "Karsten P. Hoffmann" <kphoffmann@xxxxxx>
Date: Wed, 19 Apr 2006 19:25:23 +0200
Steve Karg wrote:
>> I anybody interested in this feature as well?
> 
> I would be interested in that feature.

Here we go: the patch has been diff'ed against the svn versionn '17907'.

I checked it with some working devices and it worked for me with
'ethereal' build in a Linux i686 environement. I'll setup some more
complex tests next week, in a very dirty, BACnet development network,
when I'm back in my office :-)

Best regards,

  Karsten Hoffmann.

-- 
Karsten P. Hoffmann                     <kphoffmann@xxxxxx>
"I love deadlines. I especially like the whooshing sound
they make as they go flying by."
                     [In memoriam Douglas Adams, 1952-2001]
Index: epan/dissectors/packet-bacapp.c
===================================================================
--- epan/dissectors/packet-bacapp.c	(revision 17907)
+++ epan/dissectors/packet-bacapp.c	(working copy)
@@ -5469,7 +5469,8 @@
 	gint8 tmp, bacapp_type;
 	tvbuff_t *next_tvb;
 	guint offset = 0;
-    guint8 bacapp_service, bacapp_reason;
+	guint8 bacapp_service, bacapp_reason;
+	guint8 bacapp_invoke_id;
 	proto_item *ti;
 	proto_tree *bacapp_tree;
 
@@ -5478,7 +5479,7 @@
 	if (check_col(pinfo->cinfo, COL_INFO))
 		col_add_str(pinfo->cinfo, COL_INFO, "BACnet APDU ");
 	
-    tmp = (gint) tvb_get_guint8(tvb, 0);
+	tmp = (gint) tvb_get_guint8(tvb, 0);
 	bacapp_type = (tmp >> 4) & 0x0f;
 
 	/* show some descriptive text in the INFO column */
@@ -5492,10 +5493,17 @@
 			case BACAPP_TYPE_CONFIRMED_SERVICE_REQUEST:
 				/* segmented messages have 2 additional bytes */
 				if (tmp & BACAPP_SEGMENTED_REQUEST)
+				{
+					bacapp_invoke_id = tvb_get_guint8(tvb, offset + 4);
 					bacapp_service = tvb_get_guint8(tvb, offset + 5);
+				}
 				else
+				{
+					bacapp_invoke_id = tvb_get_guint8(tvb, offset + 2);
 					bacapp_service = tvb_get_guint8(tvb, offset + 3);
-				col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+				}
+				col_append_fstr(pinfo->cinfo, COL_INFO, "[invoke:%d]: %s",
+					bacapp_invoke_id,
 					val_to_str(bacapp_service, 
 						BACnetConfirmedServiceChoice,
 						bacapp_unknown_service_str));
@@ -5508,8 +5516,10 @@
 						bacapp_unknown_service_str));
 				break;
 			case BACAPP_TYPE_SIMPLE_ACK:
+				bacapp_invoke_id = tvb_get_guint8(tvb, offset + 1);
 				bacapp_service = tvb_get_guint8(tvb, offset + 2);
-				col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+				col_append_fstr(pinfo->cinfo, COL_INFO, "[invoke:%d]: %s",
+					bacapp_invoke_id,
 					val_to_str(bacapp_service, 
 						BACnetConfirmedServiceChoice,
 						bacapp_unknown_service_str));
@@ -5517,10 +5527,17 @@
 			case BACAPP_TYPE_COMPLEX_ACK:
 				/* segmented messages have 2 additional bytes */
 				if (tmp & BACAPP_SEGMENTED_REQUEST)
+				{
+					bacapp_invoke_id = tvb_get_guint8(tvb, offset + 3);
 					bacapp_service = tvb_get_guint8(tvb, offset + 4);
+				}
 				else
+				{
+					bacapp_invoke_id = tvb_get_guint8(tvb, offset + 1);
 					bacapp_service = tvb_get_guint8(tvb, offset + 2);
-				col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+				}
+				col_append_fstr(pinfo->cinfo, COL_INFO, "[invoke:%d]: %s",
+					bacapp_invoke_id,
 					val_to_str(bacapp_service, 
 						BACnetConfirmedServiceChoice,
 						bacapp_unknown_service_str));
@@ -5529,15 +5546,19 @@
 				/* nothing more to add */
 				break;
 			case BACAPP_TYPE_ERROR:
+				bacapp_invoke_id = tvb_get_guint8(tvb, offset + 1);
 				bacapp_service = tvb_get_guint8(tvb, offset + 2);
-				col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+				col_append_fstr(pinfo->cinfo, COL_INFO, "[invoke:%d]: %s",
+					bacapp_invoke_id,
 					val_to_str(bacapp_service, 
 						BACnetConfirmedServiceChoice,
 						bacapp_unknown_service_str));
 				break;
 			case BACAPP_TYPE_REJECT:
+				bacapp_invoke_id = tvb_get_guint8(tvb, offset + 1);
 				bacapp_reason = tvb_get_guint8(tvb, offset + 2);
-				col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", 
+				col_append_fstr(pinfo->cinfo, COL_INFO, "[invoke:%d]: %s", 
+					bacapp_invoke_id,
 					val_to_split_str(bacapp_reason,
 						64,
 						BACnetRejectReason,
@@ -5545,8 +5566,10 @@
 						Vendor_Proprietary_Fmt));
 				break;
 			case BACAPP_TYPE_ABORT:
+				bacapp_invoke_id = tvb_get_guint8(tvb, offset + 1);
 				bacapp_reason = tvb_get_guint8(tvb, offset + 2);
-				col_append_fstr(pinfo->cinfo, COL_INFO, ": %s",
+				col_append_fstr(pinfo->cinfo, COL_INFO, "[invoke:%d]: %s",
+					bacapp_invoke_id,
 					val_to_split_str(bacapp_reason,
 						64,
 						BACnetAbortReason,