From Sven Eckelmann:
[metze/wireshark/wip.git] / wiretap / pppdump.c
index 72061bdcd969a348b862d4aa4080ea2cc25173ea..41efe04a1b9fb1c2cb997ee9b13c724a00958b72 100644 (file)
@@ -100,8 +100,8 @@ typedef enum {
 } direction_enum;
 
 static gboolean pppdump_read(wtap *wth, int *err, gchar **err_info,
-       long *data_offset);
-static gboolean pppdump_seek_read(wtap *wth, long seek_off,
+       gint64 *data_offset);
+static gboolean pppdump_seek_read(wtap *wth, gint64 seek_off,
        union wtap_pseudo_header *pseudo_header, guint8 *pd, int len,
        int *err, gchar **err_info);
 
@@ -295,6 +295,7 @@ pppdump_open(wtap *wth, int *err, gchar **err_info _U_)
        wth->subtype_read = pppdump_read;
        wth->subtype_seek_read = pppdump_seek_read;
        wth->subtype_close = pppdump_close;
+       wth->tsprecision = WTAP_FILE_TSPREC_DSEC;
 
        state->seek_state = g_malloc(sizeof(pppdump_t));
 
@@ -312,7 +313,7 @@ pppdump_open(wtap *wth, int *err, gchar **err_info _U_)
 
 /* Find the next packet and parse it; called from wtap_read(). */
 static gboolean
-pppdump_read(wtap *wth, int *err, gchar **err_info, long *data_offset)
+pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
 {
        int             num_bytes;
        direction_enum  direction;
@@ -355,8 +356,8 @@ pppdump_read(wtap *wth, int *err, gchar **err_info, long *data_offset)
 
        wth->phdr.len           = num_bytes;
        wth->phdr.caplen        = num_bytes;
-       wth->phdr.ts.tv_sec     = state->timestamp;
-       wth->phdr.ts.tv_usec    = state->tenths * 100000;
+       wth->phdr.ts.secs       = state->timestamp;
+       wth->phdr.ts.nsecs      = state->tenths * 100000000;
        wth->phdr.pkt_encap     = WTAP_ENCAP_PPP_WITH_PHDR;
 
        wth->pseudo_header.p2p.sent = (direction == DIRECTION_SENT ? TRUE : FALSE);
@@ -614,6 +615,9 @@ collate(pppdump_t* state, FILE_T fh, int *err, gchar **err_info, guint8 *pd,
                                        pkt->sd_offset = state->offset;
                                }
 
+                               if (n == 0)
+                                       continue;
+
                                g_assert(num_bytes_to_skip < n);
                                while (num_bytes_to_skip) {
                                        if (file_getc(fh) == EOF)
@@ -701,7 +705,7 @@ done:
 /* Used to read packets in random-access fashion */
 static gboolean
 pppdump_seek_read(wtap *wth,
-                long seek_off,
+                gint64 seek_off,
                 union wtap_pseudo_header *pseudo_header,
                 guint8 *pd,
                 int len,