Wireshark-dev: [Wireshark-dev] [PATCH] COS DSCP Column patch
From: "Thomas Sillaber" <Thomas.Sillaber@xxxxxx>
Date: Sun, 10 Dec 2006 16:00:39 +0100
Hello,


here's the working patch/diff.
Please test and apply!

<sorry for the wrong mails...thanks>

Thanks

TS


Index: epan/column.c
===================================================================
--- epan/column.c	(revision 20080)
+++ epan/column.c	(working copy)
@@ -91,12 +91,16 @@
     "%H", 
     "%P", 
     "%y", 
-    "%z", 
-    "%v", 
+	"%v",
+	"%q",
+	"%f",
+    "%U",  
     "%E",
 	"%C",
-	"%l"
+	"%l",
+	"%z"
 };
+
                      
   if (fmt < 0 || fmt >= NUM_COL_FMTS)
     return NULL;
@@ -155,6 +159,8 @@
 	"DCE/RPC call (cn_call_id / dg_seqnum)",    /* COL_DCE_CALL */
 	"DCE/RPC context ID (cn_ctx_id)",           /* COL_DCE_CTX */
 	"802.1Q VLAN id",                           /* COL_8021Q_VLAN_ID */
+	"IP DSCP Value",							/* COL_DSCP_VALUE */
+	"L2 COS Value",								/* COL_COS_VALUE */
 	"TEI",                                      /* XXX - why is it missing in column_utils.c and elsewhere? */
 	"Frame Relay DLCI",							/* COL_FR_DLCI */
 	"GPRS BSSGP TLLI",							/* COL_BSSGP_TLLI */
@@ -261,6 +267,12 @@
     case COL_8021Q_VLAN_ID:
       fmt_list[COL_8021Q_VLAN_ID] = TRUE;
       break;
+	case COL_DSCP_VALUE:
+	  fmt_list[COL_DSCP_VALUE] = TRUE;
+	  break;
+	case COL_COS_VALUE:
+      fmt_list[COL_COS_VALUE] = TRUE;
+	  break;
     case COL_TEI:
       fmt_list[COL_TEI] = TRUE;
       break;
@@ -524,6 +536,12 @@
     case COL_8021Q_VLAN_ID:
       return "0000";
       break;
+	case COL_DSCP_VALUE:
+	  return "00";
+	  break;
+    case COL_COS_VALUE:
+	  return "0";
+	  break;
     case COL_TEI:
       return "127";
       break;
@@ -682,9 +700,15 @@
       case 'z':
 	return COL_DCE_CTX;
 	break;
-      case 'v':
+      case 'q':
 	return COL_8021Q_VLAN_ID;
 	break;
+	  case 'f':
+    return COL_DSCP_VALUE;
+    break;
+	  case 'U':
+    return COL_COS_VALUE;
+    break;
       case 'E':
 	return COL_TEI;
       case 'C':
Index: epan/column-utils.c
===================================================================
--- epan/column-utils.c	(revision 20080)
+++ epan/column-utils.c	(working copy)
@@ -1288,7 +1288,14 @@
 
     case COL_8021Q_VLAN_ID:
         break;
+    
+	case COL_DSCP_VALUE:	/* done by packet-ip */
+		break;
 
+
+	case COL_COS_VALUE:		/* done by packet-vlan */
+		break;
+
     case COL_FR_DLCI:	/* done by packet-fr.c */
     case COL_BSSGP_TLLI: /* done by packet-bssgp.c */
         break;
Index: epan/dissectors/packet-vlan.c
===================================================================
--- epan/dissectors/packet-vlan.c	(revision 20080)
+++ epan/dissectors/packet-vlan.c	(working copy)
@@ -91,6 +91,9 @@
   if ( check_col(pinfo->cinfo, COL_8021Q_VLAN_ID)) {
       col_add_fstr(pinfo->cinfo, COL_8021Q_VLAN_ID, "%u", (tci & 0xFFF));
   }
+  if ( check_col(pinfo->cinfo, COL_COS_VALUE)) {
+      col_add_fstr(pinfo->cinfo, COL_COS_VALUE, "%u", (tci >> 13));
+    }
 
   vlan_tree = NULL;
 
Index: epan/dissectors/packet-ip.c
===================================================================
--- epan/dissectors/packet-ip.c	(revision 20080)
+++ epan/dissectors/packet-ip.c	(working copy)
@@ -929,7 +929,11 @@
 
   iph->ip_tos = tvb_get_guint8(tvb, offset + 1);
   if (tree) {
-    if (g_ip_dscp_actif) {
+      
+	  if ( check_col(pinfo->cinfo, COL_DSCP_VALUE)) {
+		col_add_fstr(pinfo->cinfo, COL_DSCP_VALUE, "%u", IPDSFIELD_DSCP(iph->ip_tos));
+      }
+	  if (g_ip_dscp_actif) {
       tf = proto_tree_add_uint_format(ip_tree, hf_ip_dsfield, tvb, offset + 1, 1, iph->ip_tos,
 	   "Differentiated Services Field: 0x%02x (DSCP 0x%02x: %s; ECN: 0x%02x)", iph->ip_tos,
 	   IPDSFIELD_DSCP(iph->ip_tos), val_to_str(IPDSFIELD_DSCP(iph->ip_tos), dscp_vals,
Index: epan/column_info.h
===================================================================
--- epan/column_info.h	(revision 20080)
+++ epan/column_info.h	(working copy)
@@ -100,6 +100,8 @@
   COL_DCE_CALL,       /* DCE/RPC connection oriented call id OR datagram sequence number */
   COL_DCE_CTX,        /* DCE/RPC connection oriented context id */
   COL_8021Q_VLAN_ID,  /* 802.1Q vlan ID */
+  COL_DSCP_VALUE,     /* IP DSCP Value */
+  COL_COS_VALUE,      /* L2 COS Value */
   COL_TEI,            /* q.921 TEI */
   COL_FR_DLCI,		  /* Frame Relay DLCI */
   COL_BSSGP_TLLI,	  /* GPRS BSSGP IE TLLI */
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer