Rename ntp_fmt_ts() to tvb_ntp_fmt_ts() and make it take a pointer to a TVB and
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 9 Feb 2011 03:00:51 +0000 (03:00 +0000)
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 9 Feb 2011 03:00:51 +0000 (03:00 +0000)
an offset instead of (generally) a pointer into the TVB. Then use the standard
accessor functions to get data out of the TVB.

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

epan/dissectors/packet-ntp.c
epan/dissectors/packet-ntp.h
epan/dissectors/packet-rtcp.c

index 2bfacdb42f753181deab9c01169272feab600d4b..a88e6be3db416b120d538e7b9f2b11f27b802fab 100644 (file)
@@ -573,7 +573,7 @@ static tvbparse_wanted_t* want_ignore;
  * dissection of the next packet occurs.
  */
 const char *
-ntp_fmt_ts(const guint8 *reftime)
+tvb_ntp_fmt_ts(tvbuff_t *tvb, gint offset)
 {
        guint32 tempstmp, tempfrac;
        time_t temptime;
@@ -581,8 +581,8 @@ ntp_fmt_ts(const guint8 *reftime)
        double fractime;
        char *buff;
 
-       tempstmp = pntohl(&reftime[0]);
-       tempfrac = pntohl(&reftime[4]);
+       tempstmp = tvb_get_ntohl(tvb, offset);
+       tempfrac = tvb_get_ntohl(tvb, offset+4);
        if ((tempstmp == 0) && (tempfrac == 0)) {
                return "NULL";
        }
index 6f5bd435d2693d48a186515aac743cdf0c4a0966..8906cca963c89c2103933a4304e81e6503dae463 100644 (file)
@@ -32,6 +32,6 @@
 #define NTP_BASETIME 2208988800ul
 #define NTP_TS_SIZE 100
 
-extern const char * ntp_fmt_ts(const guint8 *reftime);
+extern const char *tvb_ntp_fmt_ts(tvbuff_t *tvb, gint offset);
 
 #endif
index 965ed23c942735f7a05c37132159006e9a221c58..019178c9b30964a33e9340fd052b25fdbe298611 100644 (file)
@@ -1069,7 +1069,7 @@ dissect_rtcp_app( tvbuff_t *tvb,packet_info *pinfo, int offset, proto_tree *tree
 
                                        proto_tree_add_item(PoC1_tree, hf_rtcp_app_poc1_request_ts,
                                                            tvb, offset, 8, ENC_TIME_NTP|ENC_BIG_ENDIAN);
-                                       buff = ntp_fmt_ts(tvb_get_ptr(tvb, offset, 8));
+                                       buff = tvb_ntp_fmt_ts(tvb, offset);
 
                                        offset += 8;
                                        packet_len -=8;