summaryrefslogtreecommitdiff
path: root/wiretap/pppdump.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-06-16 00:20:00 +0000
committerGuy Harris <guy@alum.mit.edu>2013-06-16 00:20:00 +0000
commit8c9edf12800bc6d68894dc457e7ebaf994429da8 (patch)
treeec6efefbd4e7f8227a7b96661f721ff4ba2986c3 /wiretap/pppdump.c
parent3846abe34d6861c6ee0bba61fcd5baa4d213885c (diff)
downloadwireshark-8c9edf12800bc6d68894dc457e7ebaf994429da8.tar.gz
Have the seek-read routines take a Buffer rather than a guint8 pointer
as the "where to put the packet data" argument. This lets more of the libwiretap code be common between the read and seek-read code paths, and also allows for more flexibility in the "fill in the data" path - we can expand the buffer as needed in both cases. svn path=/trunk/; revision=49949
Diffstat (limited to 'wiretap/pppdump.c')
-rw-r--r--wiretap/pppdump.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c
index 9a7cc4ed9e..2993e7f8f5 100644
--- a/wiretap/pppdump.c
+++ b/wiretap/pppdump.c
@@ -100,7 +100,7 @@ typedef enum {
static gboolean pppdump_read(wtap *wth, int *err, gchar **err_info,
gint64 *data_offset);
static gboolean pppdump_seek_read(wtap *wth, gint64 seek_off,
- struct wtap_pkthdr *phdr, guint8 *pd, int len,
+ struct wtap_pkthdr *phdr, Buffer *buf, int len,
int *err, gchar **err_info);
/*
@@ -339,9 +339,6 @@ pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
pppdump_t *state;
pkt_id *pid;
- buffer_assure_space(wth->frame_buffer, PPPD_BUF_SIZE);
- buf = buffer_start_ptr(wth->frame_buffer);
-
state = (pppdump_t *)wth->priv;
/* If we have a random stream open, allocate a structure to hold
@@ -356,6 +353,9 @@ pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
} else
pid = NULL; /* sequential only */
+ buffer_assure_space(wth->frame_buffer, PPPD_BUF_SIZE);
+ buf = buffer_start_ptr(wth->frame_buffer);
+
if (!collate(state, wth->fh, err, err_info, buf, &num_bytes, &direction,
pid, 0)) {
if (pid != NULL)
@@ -722,12 +722,13 @@ static gboolean
pppdump_seek_read(wtap *wth,
gint64 seek_off,
struct wtap_pkthdr *phdr,
- guint8 *pd,
+ Buffer *buf,
int len,
int *err,
gchar **err_info)
{
int num_bytes;
+ guint8 *pd;
direction_enum direction;
pppdump_t *state;
pkt_id *pid;
@@ -748,6 +749,9 @@ pppdump_seek_read(wtap *wth,
init_state(state->seek_state);
state->seek_state->offset = pid->offset;
+ buffer_assure_space(buf, PPPD_BUF_SIZE);
+ pd = buffer_start_ptr(buf);
+
/*
* We'll start reading at the first record containing data from
* this packet; however, that doesn't mean "collate()" will