diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-11-11 06:36:09 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-11-11 06:36:09 +0000 |
commit | 62b3490af4f243e2daa72dd864836fe1f902ce55 (patch) | |
tree | acbc62c278b64698366b000edce9dede7de60237 /wiretap/ngsniffer.c | |
parent | 81566ec823aba71bd7fdd8803e999131d02367eb (diff) |
We have to set "x25.flags" in the Wiretap pseudo-header if the capture
is WTAP_ENCAP_LAPB *or* WTAP_ENCAP_V120, and we have to set "p2p.sent"
in the capture file for *all* WTAP_ENCAP_LAPD captures; fix the
i4btrace and Sniffer capture file readers to do so.
(XXX - should we eliminate "x25.flags", and use "p2p.sent" instead? The
directions for X.25 are DTE->DCE and DCE->DTE, not "sent" and
"received", but I suspect that "sent" and "received" should be thought
of from the point of view of the DTE, so DTE->DCE is "sent" and DCE->DTE
is "received"; the directions for ISDN are user->network and
network->user, but I suspect that "sent" and "received" should be
thought of from the standpoint of the user equipment, so user->network
is "sent" and network->user is "received".)
svn path=/trunk/; revision=2606
Diffstat (limited to 'wiretap/ngsniffer.c')
-rw-r--r-- | wiretap/ngsniffer.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c index 42b1bc1090..5f8294c36a 100644 --- a/wiretap/ngsniffer.c +++ b/wiretap/ngsniffer.c @@ -1,6 +1,6 @@ /* ngsniffer.c * - * $Id: ngsniffer.c,v 1.53 2000/10/17 18:07:52 gerald Exp $ + * $Id: ngsniffer.c,v 1.54 2000/11/11 06:36:09 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org> @@ -294,6 +294,8 @@ static void set_pseudo_header_frame6(union wtap_pseudo_header *pseudo_header, struct frame6_rec *frame6); static int ngsniffer_read_rec_data(wtap *wth, gboolean is_random, u_char *pd, int length, int *err); +static void fix_pseudo_header(wtap *wth, + union wtap_pseudo_header *pseudo_header); static void ngsniffer_sequential_close(wtap *wth); static void ngsniffer_close(wtap *wth); static gboolean ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, @@ -737,6 +739,12 @@ found: } } + /* + * Fix up the pseudo-header; we may have set "x25.flags", + * but, for some traffic, we should set "p2p.sent" instead. + */ + fix_pseudo_header(wth, &wth->pseudo_header); + t = t/1000000.0 * wth->capture.ngsniffer->timeunit; /* t = # of secs */ t += wth->capture.ngsniffer->start; wth->phdr.ts.tv_sec = (long)t; @@ -806,6 +814,12 @@ static int ngsniffer_seek_read(wtap *wth, int seek_off, } /* + * Fix up the pseudo-header; we may have set "x25.flags", + * but, for some traffic, we should set "p2p.sent" instead. + */ + fix_pseudo_header(wth, pseudo_header); + + /* * Got the pseudo-header (if any), now get the data. */ return ngsniffer_read_rec_data(wth, TRUE, pd, packet_size, &err); @@ -953,6 +967,20 @@ static int ngsniffer_read_rec_data(wtap *wth, gboolean is_random, u_char *pd, return 0; } +static void fix_pseudo_header(wtap *wth, + union wtap_pseudo_header *pseudo_header) +{ + switch (wth->file_encap) { + + case WTAP_ENCAP_LAPD: + if (pseudo_header->x25.flags == 0x00) + pseudo_header->p2p.sent = TRUE; + else + pseudo_header->p2p.sent = FALSE; + break; + } +} + /* Throw away the buffers used by the sequential I/O stream, but not those used by the random I/O stream. */ static void ngsniffer_sequential_close(wtap *wth) |