Ethereal-dev: Re: [Ethereal-dev] trouble with afs and cinfo

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

From: Jaime Fournier <jafour1@xxxxxxxxx>
Date: Tue, 8 Apr 2003 21:14:00 -0700 (PDT)
Yeah, I commented out the col_clear at the top
dissector for afs. I have attached a diff of
packet-afs.c of what I did to try to get it to work. 
There is also a trace of a create-file for afs.
The problem is that despite having included the pinfo
to each function, no additional col_appends seem to
work. As you can see if the diff.

This is what I get on this trace file.
1   0.000000 192.168.0.69 -> 192.168.0.22 AFS (RX) FS
Request: create-file (137)
What I expected with that diff is 
  1   0.000000 192.168.0.69 -> 192.168.0.22 AFS (RX)
FS Request: create-file (137): Testing 1 2 3

Is this possible? Or am I just doing this the wrong
way?

Thanks again.

--- Guy Harris <guy@xxxxxxxxxx> wrote:
> On Tue, Apr 08, 2003 at 05:45:19PM -0700, Jaime
> Fournier wrote:
> > I have been trying to get the afs
> > code to print more info on colinfo.
> > Using the -z options for all the vars that I want
> is
> > not real feasible with so many vars. I have even
> > modified the packet-afs.c to pass
> > pinfo to all subdisectors.
> > However this does not seem to work.
> 
> What doesn't work?  Passing pinfo is
> straightforward, so that presumably
> works, and there's something else, e.g. some call to
> "col_add_str()" or
> "col_append_fstr()" or something such as that,
> that's not working.
> 
> If so, what are the calls you're making in the
> subdissectors?  They
> should be something like
> 
> 	if (check_col(pinfo->cinfo, COL_INFO)) {
> 		col_append_fstr(pinfo->cinfo, COL_INFO, ", Foo
> %s",
> 		    op_string);
> 	}
> 
> Note that "col_add_str()" and "col_add_fstr()" will
> *overwrite* what
> "dissect_afs()" puts into the column, so, unless you
> *want* to trash the
> operation name, etc., you need to use
> "col_append_str()" or
> "col_append_fstr()", to *append* to what
> "dissect_afs()" put into the
> column.

=====
Jaime Fournier

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com
--- ethereal/packet-afs.c	Fri Jan 17 20:18:39 2003
+++ ethnew/packet-afs.c	Tue Apr  8 22:57:36 2003
@@ -75,43 +75,43 @@
  * Dissector prototypes
  */
 static int dissect_acl(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset);
+	proto_tree *tree, int offset, packet_info * pinfo);
 static void dissect_fs_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_fs_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_bos_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_bos_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_vol_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_vol_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_kauth_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_kauth_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_cb_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_cb_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_prot_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_prot_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_vldb_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_vldb_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_ubik_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_ubik_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_backup_reply(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 static void dissect_backup_request(tvbuff_t *tvb, struct rxinfo *rxinfo,
-	proto_tree *tree, int offset, int opcode);
+	proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 
 /*
  * Hash Functions
@@ -185,15 +185,16 @@
 	int port, node, typenode, opcode;
 	value_string const *vals;
 	int offset = 0;
-	void (*dissector)(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode);
-
+	void (*dissector)(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode, packet_info * pinfo);
 
 	if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
-		col_set_str(pinfo->cinfo, COL_PROTOCOL, "AFS (RX)");
+		col_add_str(pinfo->cinfo, COL_PROTOCOL, "AFS (RX)");
 	}
+	/*
 	if (check_col(pinfo->cinfo, COL_INFO)) {
 		col_clear(pinfo->cinfo, COL_INFO);
 	}
+	*/
 
 	reply = (rxinfo->flags & RX_CLIENT_INITIATED) == 0;
 	port = ((reply == 0) ? pinfo->destport : pinfo->srcport );
@@ -332,6 +333,7 @@
 				val_to_str(port, port_types_short, "Unknown(%d)"),
 				reply ? "Reply" : "Request",
 				val_to_str(opcode, vals, "Unknown(%d)"), opcode);
+
 		} else {
 			if (check_col(pinfo->cinfo, COL_INFO))
 				col_add_fstr(pinfo->cinfo, COL_INFO, "%s%s %s: Unknown(%d)",
@@ -391,8 +393,9 @@
 			}
 
 			/* Process the packet according to what service it is */
+			/* JAF make sure we pass *pinfo to the sub dissectors */
 			if ( dissector ) {
-				(*dissector)(tvb, rxinfo, afs_op_tree, offset, opcode);
+				(*dissector)(tvb, rxinfo, afs_op_tree, offset, opcode, pinfo);
 			}
 		}
 	}
@@ -432,7 +435,7 @@
  * Should this just scan the string itself, rather than using "sscanf()"?
  */
 static int
-dissect_acl(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset)
+dissect_acl(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, packet_info * pinfo)
 {
 	int old_offset;
 	gint32 bytes;
@@ -491,7 +494,7 @@
  */
 
 static void
-dissect_fs_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
+dissect_fs_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	if ( rxinfo->type == RX_PACKET_TYPE_DATA )
 	{
@@ -508,7 +511,7 @@
 				OUT_BYTES_ALL(hf_afs_fs_data);
 				break;
 			case 131: /* fetch acl */
-				offset = dissect_acl(tvb, rxinfo, tree, offset);
+				offset = dissect_acl(tvb, rxinfo, tree, offset, pinfo);
 				OUT_FS_AFSFetchStatus("Status");
 				OUT_FS_AFSVolSync();
 				break;
@@ -606,18 +609,21 @@
 }
 
 static void
-dissect_fs_request(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
+dissect_fs_request(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	/* skip the opcode if this is the first packet in the stream */
 	if ( rxinfo->seq == 1 )
 	{
 		offset += 4;  /* skip the opcode */
 	}
+	/* JAF in here */
+ if (check_col (pinfo->cinfo, COL_INFO))  
+	  col_append_str (pinfo->cinfo, COL_INFO, ": Testing 1 2 3");
 
 	switch ( opcode )
 	{
 		case 130: /* Fetch data */
-			OUT_FS_AFSFid("Source");
+			OUT_FS_AFSFid("Source"); 
 			OUT_UINT(hf_afs_fs_offset);
 			OUT_UINT(hf_afs_fs_length);
 			break;
@@ -640,7 +646,7 @@
 			break;
 		case 134: /* Store ACL */
 			OUT_FS_AFSFid("Target");
-			offset = dissect_acl(tvb, rxinfo, tree, offset);
+			offset = dissect_acl(tvb, rxinfo, tree, offset, pinfo);
 			break;
 		case 135: /* Store Status */
 			OUT_FS_AFSFid("Target");
@@ -769,7 +775,7 @@
  * BOS Helpers
  */
 static void
-dissect_bos_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
+dissect_bos_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	if ( rxinfo->type == RX_PACKET_TYPE_DATA )
 	{
@@ -899,7 +905,7 @@
 }
 
 static void
-dissect_bos_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
+dissect_bos_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	offset += 4;  /* skip the opcode */
 
@@ -1029,7 +1035,7 @@
  * VOL Helpers
  */
 static void
-dissect_vol_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
+dissect_vol_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	if ( rxinfo->type == RX_PACKET_TYPE_DATA )
 	{
@@ -1049,7 +1055,7 @@
 }
 
 static void
-dissect_vol_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
+dissect_vol_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	offset += 4;  /* skip the opcode */
 
@@ -1066,7 +1072,7 @@
  * KAUTH Helpers
  */
 static void
-dissect_kauth_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
+dissect_kauth_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	if ( rxinfo->type == RX_PACKET_TYPE_DATA )
 	{
@@ -1081,7 +1087,7 @@
 }
 
 static void
-dissect_kauth_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
+dissect_kauth_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	offset += 4;  /* skip the opcode */
 
@@ -1120,7 +1126,7 @@
  * CB Helpers
  */
 static void
-dissect_cb_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
+dissect_cb_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	if ( rxinfo->type == RX_PACKET_TYPE_DATA )
 	{
@@ -1135,7 +1141,7 @@
 }
 
 static void
-dissect_cb_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
+dissect_cb_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	offset += 4;  /* skip the opcode */
 
@@ -1167,7 +1173,7 @@
  * PROT Helpers
  */
 static void
-dissect_prot_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
+dissect_prot_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	if ( rxinfo->type == RX_PACKET_TYPE_DATA )
 	{
@@ -1229,7 +1235,7 @@
 }
 
 static void
-dissect_prot_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
+dissect_prot_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	offset += 4;  /* skip the opcode */
 
@@ -1310,7 +1316,7 @@
  * VLDB Helpers
  */
 static void
-dissect_vldb_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
+dissect_vldb_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	if ( rxinfo->type == RX_PACKET_TYPE_DATA )
 	{
@@ -1483,7 +1489,7 @@
 }
 
 static void
-dissect_vldb_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
+dissect_vldb_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	offset += 4;  /* skip the opcode */
 
@@ -1533,7 +1539,7 @@
  * UBIK Helpers
  */
 static void
-dissect_ubik_reply(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
+dissect_ubik_reply(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	switch ( opcode )
 	{
@@ -1579,7 +1585,7 @@
 }
 
 static void
-dissect_ubik_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode)
+dissect_ubik_request(tvbuff_t *tvb, struct rxinfo *rxinfo _U_, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	offset += 4;  /* skip the opcode */
 
@@ -1658,7 +1664,7 @@
  * BACKUP Helpers
  */
 static void
-dissect_backup_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode)
+dissect_backup_reply(tvbuff_t *tvb, struct rxinfo *rxinfo, proto_tree *tree, int offset, int opcode, packet_info * pinfo)
 {
 	if ( rxinfo->type == RX_PACKET_TYPE_DATA )
 	{
@@ -1673,7 +1679,7 @@
 }
 
 static void
-dissect_backup_request(tvbuff_t *tvb _U_, struct rxinfo *rxinfo _U_, proto_tree *tree _U_, int offset, int opcode)
+dissect_backup_request(tvbuff_t *tvb _U_, struct rxinfo *rxinfo _U_, proto_tree *tree _U_, int offset, int opcode, packet_info * pinfo)
 {
 	offset += 4;  /* skip the opcode */
 

Attachment: trace1
Description: trace1