Show NTP times correctly.
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 1 Mar 2005 06:03:08 +0000 (06:03 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 1 Mar 2005 06:03:08 +0000 (06:03 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@13560 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-mip.c

index ce2e46bd80d83b9a6e54fee720607f944509dc6b..9444c471b2f4933456876fc7e07fb4d4e00a6b29 100644 (file)
@@ -35,6 +35,7 @@
 #include <time.h>
 
 #include <epan/packet.h>
+#include "packet-ntp.h"
 
 /* Initialize the protocol and registered fields */
 static int proto_mip = -1;
@@ -69,7 +70,6 @@ static gint ett_mip_exts = -1;
 
 /* Port used for Mobile IP */
 #define UDP_PORT_MIP    434
-#define NTP_BASETIME 2208988800ul
 
 typedef enum {
     REGISTRATION_REQUEST = 1,
@@ -260,8 +260,9 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
   proto_tree    *flags_tree;
   guint8         type;
   guint8         flags;
-  nstime_t       ident_time;
   size_t         offset=0;
+  const guint8  *reftime;
+  gchar          buff[NTP_TS_SIZE];
 
   /* Make entries in Protocol column and Info column on summary display */
 
@@ -316,10 +317,12 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
          proto_tree_add_item(mip_tree, hf_mip_coa, tvb, offset, 4, FALSE);
          offset += 4;
 
-         /* Identifier */
-         ident_time.secs =  tvb_get_ntohl(tvb,16)-(guint32) NTP_BASETIME;
-         ident_time.nsecs = tvb_get_ntohl(tvb,20)*1000;
-         proto_tree_add_time(mip_tree, hf_mip_ident, tvb, offset, 8, &ident_time);
+         /* Identifier - assumed to be an NTP time here */
+         reftime = tvb_get_ptr(tvb, offset, 8);
+         proto_tree_add_bytes_format(mip_tree, hf_mip_ident, tvb, offset, 8,
+                                     reftime,
+                                     "Identification: %s",
+                                     ntp_fmt_ts(reftime, buff));
          offset += 8;
 
        } /* if tree */
@@ -354,10 +357,12 @@ dissect_mip( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
          proto_tree_add_item(mip_tree, hf_mip_haaddr, tvb, offset, 4, FALSE);
          offset += 4;
 
-         /* Identifier */
-         ident_time.secs =  tvb_get_ntohl(tvb,12)-(guint32) NTP_BASETIME;
-         ident_time.nsecs = tvb_get_ntohl(tvb,16)*1000;
-         proto_tree_add_time(mip_tree, hf_mip_ident, tvb, offset, 8, &ident_time);
+         /* Identifier - assumed to be an NTP time here */
+         reftime = tvb_get_ptr(tvb, offset, 8);
+         proto_tree_add_bytes_format(mip_tree, hf_mip_ident, tvb, offset, 8,
+                                     reftime,
+                                     "Identification: %s",
+                                     ntp_fmt_ts(reftime, buff));
          offset += 8;
        } /* if tree */
 
@@ -450,7 +455,7 @@ void proto_register_mip(void)
          },
          { &hf_mip_ident,
                 { "Identification",           "mip.ident",
-                       FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0,
+                       FT_BYTES, BASE_NONE, NULL, 0,
                        "MN Identification.", HFILL }
          },
          { &hf_mip_ext_type,