summaryrefslogtreecommitdiff
path: root/wiretap/pppdump.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-06-15 01:51:21 +0000
committerGuy Harris <guy@alum.mit.edu>2013-06-15 01:51:21 +0000
commit2b5344666a8bcf3646ca8e27f872a7e5ba35e3bc (patch)
tree1206c3cfbf9b9cd355fd84e9d234f36355e4cd26 /wiretap/pppdump.c
parent25d9d55cefdad3e99e860b818e0886da8bc952e1 (diff)
downloadwireshark-2b5344666a8bcf3646ca8e27f872a7e5ba35e3bc.tar.gz
Fill in at least some of the struct wtap_pkthdr in both the read and
seek-read routines. svn path=/trunk/; revision=49943
Diffstat (limited to 'wiretap/pppdump.c')
-rw-r--r--wiretap/pppdump.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c
index 239f1a8e34..9a7cc4ed9e 100644
--- a/wiretap/pppdump.c
+++ b/wiretap/pppdump.c
@@ -317,6 +317,18 @@ pppdump_open(wtap *wth, int *err, gchar **err_info)
return 1;
}
+/* Set part of the struct wtap_pkthdr. */
+static void
+pppdump_set_phdr(struct wtap_pkthdr *phdr, int num_bytes,
+ direction_enum direction)
+{
+ phdr->len = num_bytes;
+ phdr->caplen = num_bytes;
+ phdr->pkt_encap = WTAP_ENCAP_PPP_WITH_PHDR;
+
+ phdr->pseudo_header.p2p.sent = (direction == DIRECTION_SENT ? TRUE : FALSE);
+}
+
/* Find the next packet and parse it; called from wtap_read(). */
static gboolean
pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
@@ -361,13 +373,9 @@ pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
state->pkt_cnt++;
wth->phdr.presence_flags = WTAP_HAS_TS;
- wth->phdr.len = num_bytes;
- wth->phdr.caplen = num_bytes;
wth->phdr.ts.secs = state->timestamp;
wth->phdr.ts.nsecs = state->tenths * 100000000;
- wth->phdr.pkt_encap = WTAP_ENCAP_PPP_WITH_PHDR;
-
- wth->phdr.pseudo_header.p2p.sent = (direction == DIRECTION_SENT ? TRUE : FALSE);
+ pppdump_set_phdr(&wth->phdr, num_bytes, direction);
return TRUE;
}
@@ -719,7 +727,6 @@ pppdump_seek_read(wtap *wth,
int *err,
gchar **err_info)
{
- union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
int num_bytes;
direction_enum direction;
pppdump_t *state;
@@ -767,7 +774,7 @@ pppdump_seek_read(wtap *wth,
return FALSE;
}
- pseudo_header->p2p.sent = (pid->dir == DIRECTION_SENT ? TRUE : FALSE);
+ pppdump_set_phdr(phdr, num_bytes, pid->dir);
return TRUE;
}