Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] FW1 monitor dissector patch for additional column

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

From: Alfred Koebler <ak@xxxxxxxxxxxx>
Date: Mon, 9 Dec 2002 22:41:27 +0100
Hallo everybody,
 

there is a addition to the FW1 monitor dissector patch.

It allows to show the information in a additional column.

Try to switch on:
- Edit - Preferences - Column - Add New
  Column title:  IF/DIR
  Column format: FW-1 monitor if/direction
  - Save - Apply - OK



Greetings from Germany

Alfred Koebler
 
---
ICON Systems GmbH - 85399 Hallbergmoos, Am Söldnermoos 37, Germany
Zentrale: 0811-55515-0 Fax: 0811-55515-15 Hotline: 0811-55515-90
Dipl. Ing. Alfred Koebler                        mailto:   ak@xxxxxxxxxxxx
CCSA/CCSE-2000, CCSA/CCSE/CCSE+ -NG, CCSI, CSGE/CSGA, ACA
Breitwiesenstr. 6                                   Fon: +49 711 787808-13
70565 Stuttgart                                     Fax: +49 711 787808-11

PGP Fingerprint = 0C15 BB1B 7E87 19F6 EDCC  539D AB04 BEB7 3409 9A09
Publickey:  http://www.pca.dfn.de/dfnpca/pgpkserv/  - KeyID: ak@xxxxxxxxxxxx 

X509/Certificate Fingerprint = 5E:2C:CF:46:91:96:0D:BD:B0:52:8C:E2:BE:3B:D7:60
diff -Naur ethereal-0.9.8/epan/packet_info.h ethereal-0.9.8-fw1/epan/packet_info.h
diff -Naur ethereal-0.9.8/epan/column-utils.c ethereal-0.9.8-fw1/epan/column-utils.c
--- ethereal-0.9.8/epan/column-utils.c	Sun Dec  8 03:32:35 2002
+++ ethereal-0.9.8-fw1/epan/column-utils.c	Mon Dec  9 22:21:36 2002
@@ -678,6 +678,7 @@
 
     case COL_PROTOCOL:	/* currently done by dissectors */
     case COL_INFO:	/* currently done by dissectors */
+    case COL_IF_DIR:	/* currently done by dissectors */
       break;
 
     case COL_PACKET_LENGTH:
diff -Naur ethereal-0.9.8/epan/column_info.h ethereal-0.9.8-fw1/epan/column_info.h
--- ethereal-0.9.8/epan/column_info.h	Sun Dec  8 03:32:36 2002
+++ ethereal-0.9.8-fw1/epan/column_info.h	Mon Dec  9 22:24:58 2002
@@ -87,6 +87,7 @@
   COL_PACKET_LENGTH,  /* Packet length in bytes */
   COL_OXID,           /* Fibre Channel OXID */
   COL_RXID,           /* Fibre Channel RXID */
+  COL_IF_DIR,         /* FW-1 monitor interface/direction */
   NUM_COL_FMTS        /* Should always be last */
 };
 
diff -Naur ethereal-0.9.8/packet-fw1.c ethereal-0.9.8-fw1/packet-fw1.c
--- ethereal-0.9.8/packet-fw1.c	Thu Aug 29 02:39:52 2002
+++ ethereal-0.9.8-fw1/packet-fw1.c	Mon Dec  9 22:21:36 2002
@@ -6,7 +6,7 @@
  *
  * Ethereal - Network traffic analyzer
  * By Alfred Koebler <ak@xxxxxxxxxxxx>
- * Copyright 2002 I.Consult
+ * Copyright 2002 Alfred Koebler
  *
  * To use this dissector use the command line option
  * -o eth.interpret_as_fw1_monitor:TRUE
@@ -57,6 +57,8 @@
  *    El90x1      o E190x2
  *    El90x1        E190x2 O
  *
+ * 9.12.2002
+ * Add new column with summary of FW-1 interface/direction
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -118,6 +120,18 @@
   #define	MAX_INTERFACES	20
   static char	*p_interfaces[MAX_INTERFACES];
   static int	interface_anzahl=0;
+  static char	header1[] = "FW1 Monitor";
+
+#ifdef	DID_NOT_FIND_A_PLACE_TO_START_THE_RESET_LIST_OF_INTERFACES
+  if (fw1_reset_list_of_if_on_next_begin) {
+    /* without FW1 summary delete all remembered names of interfaces */
+    for (i=0; i<interface_anzahl && i<MAX_INTERFACES; i++) {
+      free(p_interfaces[i]);
+    }
+    interface_anzahl = 0;
+    fw1_reset_list_of_if_on_next_begin = FALSE;
+  }
+#endif
 
   /* Make entries in Protocol column and Info column on summary display */
   if (check_col(pinfo->cinfo, COL_PROTOCOL))
@@ -127,47 +141,46 @@
 
   etype = tvb_get_ntohs(tvb, 12);
 
-  if (tree) {
-    sprintf(header, "FW1 Monitor");
+  sprintf(header, header1);
 
-    /* fetch info to local variable */
-    direction[0] = tvb_get_guint8(tvb, 0);
-    direction[1] = 0;
-    tvb_get_nstringz0(tvb, 2, 10, interface_name);
-
-    if (fw1_summary_in_tree) {
-      /* Known interface name - if not, remember it */
-      found=1;
-      for (i=0; i<interface_anzahl && i<MAX_INTERFACES; i++) {
-        if ( strcmp(p_interfaces[i], interface_name) == 0 ) {
-          found=0;
-        }
-      }
-      if (found == 1 ) {
-        p_interfaces[interface_anzahl] = strdup(interface_name);
-        interface_anzahl++;
-      }
-      /* display all interfaces always in the same order */
-      for (i=0; i<interface_anzahl; i++) {
-        found=1;
-        if ( strcmp(p_interfaces[i], interface_name) == 0 ) {
-          found=0;
-        }
-        p_header = header + strlen(header);
-        sprintf(p_header, "  %c %s %c",
-  	  found==0 ? (direction[0]=='i' ? 'i' : (direction[0]=='O' ? 'O' : ' ')) : ' ',
-	  p_interfaces[i],
-	  found==0 ? (direction[0]=='I' ? 'I' : (direction[0]=='o' ? 'o' : ' ')) : ' '
-	  );
-      }
-    } else {
-      /* without FW1 summary delete all remembered names of interfaces */
-      for (i=0; i<interface_anzahl && i<MAX_INTERFACES; i++) {
-        free(p_interfaces[i]);
-      }
-      interface_anzahl = 0;
+  /* fetch info to local variable */
+  direction[0] = tvb_get_guint8(tvb, 0);
+  direction[1] = 0;
+  tvb_get_nstringz0(tvb, 2, 10, interface_name);
+
+  /* Known interface name - if not, remember it */
+  found=1;
+  for (i=0; i<interface_anzahl && i<MAX_INTERFACES; i++) {
+    if ( strcmp(p_interfaces[i], interface_name) == 0 ) {
+      found=0;
+    }
+  }
+  if (found == 1 ) {
+    p_interfaces[interface_anzahl] = strdup(interface_name);
+    interface_anzahl++;
+  }
+  /* display all interfaces always in the same order */
+  for (i=0; i<interface_anzahl; i++) {
+    found=1;
+    if ( strcmp(p_interfaces[i], interface_name) == 0 ) {
+      found=0;
     }
+    p_header = header + strlen(header);
+    sprintf(p_header, "  %c %s %c",
+	found==0 ? (direction[0]=='i' ? 'i' : (direction[0]=='O' ? 'O' : ' ')) : ' ',
+	p_interfaces[i],
+	found==0 ? (direction[0]=='I' ? 'I' : (direction[0]=='o' ? 'o' : ' ')) : ' '
+	);
+  }
 
+  if (check_col(pinfo->cinfo, COL_IF_DIR))
+    col_add_str(pinfo->cinfo, COL_IF_DIR, header + strlen(header1) + 1);
+
+  if (tree) {
+    if (!fw1_summary_in_tree) {
+      /* Do not show the summary in Protocol Tree */
+      sprintf(header, header1);
+    }
     ti = proto_tree_add_protocol_format(tree, proto_fw1, tvb, 0, ETH_HEADER_SIZE, header);
 
     /* create display subtree for the protocol */
@@ -214,7 +227,7 @@
   fw1_module = prefs_register_protocol(proto_fw1, NULL);
   prefs_register_bool_preference(fw1_module, "summary_in_tree",
             "Show FireWall-1 summary in protocol tree",
-"Whether the FireWall-1 summary line should be shown in the protocol tree",
+	    "Whether the FireWall-1 summary line should be shown in the protocol tree",
             &fw1_summary_in_tree);
 
   register_dissector("fw1", dissect_fw1, proto_fw1);
diff -Naur ethereal-0.9.8/column.c ethereal-0.9.8-fw1/column.c
--- ethereal-0.9.8/column.c	Sun Dec  8 03:32:17 2002
+++ ethereal-0.9.8-fw1/column.c	Mon Dec  9 22:26:25 2002
@@ -52,7 +52,7 @@
                      "%us","%hs", "%rhs", "%uhs", "%ns", "%rns", "%uns", "%d",
                      "%rd", "%ud", "%hd", "%rhd", "%uhd", "%nd", "%rnd",
                      "%und", "%S", "%rS", "%uS", "%D", "%rD", "%uD", "%p",
-                     "%i", "%L", "%XO", "%XR" };
+                     "%i", "%L", "%XO", "%XR", "%I" };
                      
   if (fmt < 0 || fmt > NUM_COL_FMTS)
     return NULL;
@@ -80,7 +80,7 @@
                      "Src port (unresolved)", "Destination port",
                      "Dest port (resolved)", "Dest port (unresolved)",
                      "Protocol", "Information", "Packet length (bytes)" ,
-                     "OXID", "RXID", };
+                     "OXID", "RXID", "FW-1 monitor if/direction" };
 
   return(dlist[fmt]);
 }
@@ -144,6 +144,9 @@
     case COL_RXID:
       fmt_list[COL_RXID] = TRUE;
       break;
+    case COL_IF_DIR:
+      fmt_list[COL_IF_DIR] = TRUE;
+      break;
     default:
       break;
   }
@@ -224,6 +227,9 @@
     case COL_OXID:
       return "000000";
       break;
+    case COL_IF_DIR:
+      return "i 00000000 I";
+      break;
     default: /* COL_INFO */
       return "Source port: kerberos-master  Destination port: kerberos-master";
       break;
@@ -255,6 +261,7 @@
     case COL_UNRES_DST_PORT:
     case COL_PROTOCOL:
     case COL_PACKET_LENGTH:
+    case COL_IF_DIR:
       /* We don't want these to resize during a live capture, as that
          gets in the way of trying to look at the data while it's being
 	 captured. */
@@ -383,6 +390,9 @@
         break;
       case 'L':
         return COL_PACKET_LENGTH;
+        break;
+      case 'I':
+        return COL_IF_DIR;
         break;
       case 'X':
         prev_code = COL_OXID;

Attachment: pgptmkoXhjKtv.pgp
Description: PGP signature