Update to FC to store the source and destination id in a guint
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 23 Jun 2003 09:15:08 +0000 (09:15 +0000)
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 23 Jun 2003 09:15:08 +0000 (09:15 +0000)
to make it easier to add matching and response times later.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@7916 f5534014-38df-0310-8fa8-9805f1628bb7

epan/to_str.c
epan/to_str.h
packet-fc.c

index 5819d2b4f7545ec35c77afe298e893e5d11919b3..69c01e6ca7457792f3576574bb1861d94e74af50 100644 (file)
@@ -1,7 +1,7 @@
 /* to_str.c
  * Routines for utilities to convert various other types to strings.
  *
- * $Id: to_str.c,v 1.25 2003/02/12 00:44:04 guy Exp $
+ * $Id: to_str.c,v 1.26 2003/06/23 09:15:08 sahlberg Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -575,12 +575,22 @@ rel_time_to_secs_str(nstime_t *rel_time)
         return cur;
 }
 
+
 gchar *
 fc_to_str(const guint8 *ad)
 {
     return bytestring_to_str (ad, 3, '.');
 }
 
+/* convert the fc id stored in the three high order bytes of a guint32 into a 
+   fc id string*/
+gchar *
+fc32_to_str(const guint32 ad32)
+{
+    const guint8 *ad=(guint8 *)&ad32;
+    return bytestring_to_str (ad, 3, '.');
+}
+
 /* FC Network Header Network Address Authority Identifiers */
 
 #define FC_NH_NAA_IEEE         1       /* IEEE 802.1a */
index fcc474325d91eb8840003158f69b763967fe5629..5bb2150ac9e790a6216ca9eae38dede13df96aa5 100644 (file)
@@ -1,7 +1,7 @@
 /* to_str.h
  * Definitions for utilities to convert various other types to strings.
  *
- * $Id: to_str.h,v 1.14 2003/02/12 00:44:04 guy Exp $
+ * $Id: to_str.h,v 1.15 2003/06/23 09:15:08 sahlberg Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -49,6 +49,7 @@ extern gchar* ether_to_str(const guint8 *);
 extern gchar*  ip_to_str(const guint8 *);
 extern void    ip_to_str_buf(const guint8 *, gchar *);
 extern gchar*  fc_to_str(const guint8 *);
+extern gchar*  fc32_to_str(guint32);
 extern gchar*  fcwwn_to_str (const guint8 *);
 extern char*   ip6_to_str(const struct e_in6_addr *);
 extern gchar*  ipx_addr_to_str(guint32, const guint8 *);
index 40a07c63dffe41fc93f67d8f671b38909e783383..70e3cc5f8dcbbf9463e9ca9420338bd96b4f1ceb 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for Fibre Channel Decoding (FC Header, Link Ctl & Basic Link Svc) 
  * Copyright 2001, Dinesh G Dutt <ddutt@cisco.com>
  *
- * $Id: packet-fc.c,v 1.6 2003/06/23 08:45:08 sahlberg Exp $
+ * $Id: packet-fc.c,v 1.7 2003/06/23 09:15:08 sahlberg Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -454,7 +454,10 @@ dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     guint16 seqcnt;
     guint8 ftype;
     gboolean is_ack;
-    
+
+    guint32 s_id;
+    guint32 d_id;
+
     /* Make entries in Protocol column and Info column on summary display */
     if (check_col(pinfo->cinfo, COL_PROTOCOL)) 
         col_set_str(pinfo->cinfo, COL_PROTOCOL, "FC");
@@ -524,22 +527,20 @@ dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
         
         proto_tree_add_uint_hidden (fc_tree, hf_fc_ftype, tvb, offset, 1,
                                     ftype); 
+
+       d_id=tvb_get_letoh24(tvb, offset+1);
         proto_tree_add_string (fc_tree, hf_fc_did, tvb, offset+1, 3,
-                               fc_to_str ((guint8 *)tvb_get_ptr (tvb,
-                                                                 offset+1, 3)));
+                               fc32_to_str (d_id));
         proto_tree_add_string_hidden (fc_tree, hf_fc_id, tvb, offset+1, 3,
-                               fc_to_str ((guint8 *)tvb_get_ptr (tvb,
-                                                                 offset+1, 3)));
+                               fc32_to_str (d_id));
 
         proto_tree_add_item (fc_tree, hf_fc_csctl, tvb, offset+4, 1, FALSE);
 
+       s_id=tvb_get_letoh24(tvb, offset+5);
         proto_tree_add_string (fc_tree, hf_fc_sid, tvb, offset+5, 3,
-                               fc_to_str ((guint8 *)tvb_get_ptr (tvb,
-                                                                 offset+5, 3)));
+                               fc32_to_str (s_id));
         proto_tree_add_string_hidden (fc_tree, hf_fc_id, tvb, offset+5, 3,
-                               fc_to_str ((guint8 *)tvb_get_ptr (tvb,
-                                                                 offset+5, 3)));
-
+                               fc32_to_str (s_id));
         
         if (ftype == FC_FTYPE_LINKCTL) {
             if (((r_ctl & 0x0F) == FC_LCTL_FBSYB) ||