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)
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;
}
int *err,
gchar **err_info)
{
- union wtap_pseudo_header *pseudo_header = &phdr->pseudo_header;
int num_bytes;
direction_enum direction;
pppdump_t *state;
return FALSE;
}
- pseudo_header->p2p.sent = (pid->dir == DIRECTION_SENT ? TRUE : FALSE);
+ pppdump_set_phdr(phdr, num_bytes, pid->dir);
return TRUE;
}