diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-01-31 01:02:14 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-01-31 01:02:14 +0000 |
commit | f88816e60f1f14f2662c20740db6ecf3764e82b6 (patch) | |
tree | 4fc64f4ea929901c9f1cc62467bfce72435baa2b /wiretap/libpcap.c | |
parent | 1c898c8a11d0d008719d2d563b65d7c362e530ce (diff) |
Add WTAP_ENCAP_FRELAY_WITH_PHDR for use with Frame Relay capture files
that have direction information.
Support writing WTAP_ENCAP_FRELAY_WITH_PHDR and WTAP_ENCAP_PPP_WITH_PHDR
captures out in libpcap format - we throw away the direction
information, but so it goes.
When reading/writing Windows Sniffer format, read and write the
direction flag.
svn path=/trunk/; revision=7052
Diffstat (limited to 'wiretap/libpcap.c')
-rw-r--r-- | wiretap/libpcap.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index 7e74bbec42..b7d633817a 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -1,6 +1,6 @@ /* libpcap.c * - * $Id: libpcap.c,v 1.91 2003/01/23 04:04:00 guy Exp $ + * $Id: libpcap.c,v 1.92 2003/01/31 01:02:07 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> @@ -1217,15 +1217,32 @@ static int wtap_wtap_encap_to_pcap_encap(int encap) { unsigned int i; - /* - * Special-case WTAP_ENCAP_FDDI and WTAP_ENCAP_FDDI_BITSWAPPED; - * both of them get mapped to DLT_FDDI (even though that may - * mean that the bit order in the FDDI MAC addresses is wrong; - * so it goes - libpcap format doesn't record the byte order, - * so that's not fixable). - */ - if (encap == WTAP_ENCAP_FDDI || encap == WTAP_ENCAP_FDDI_BITSWAPPED) + switch (encap) { + + case WTAP_ENCAP_FDDI: + case WTAP_ENCAP_FDDI_BITSWAPPED: + /* + * Special-case WTAP_ENCAP_FDDI and + * WTAP_ENCAP_FDDI_BITSWAPPED; both of them get mapped + * to DLT_FDDI (even though that may mean that the bit + * order in the FDDI MAC addresses is wrong; so it goes + * - libpcap format doesn't record the byte order, + * so that's not fixable). + */ return 10; /* that's DLT_FDDI */ + + case WTAP_ENCAP_PPP_WITH_PHDR: + /* + * Also special-case PPP and Frame Relay with direction + * bits; map them to PPP and Frame Relay, even though + * that means that the direction of the packet is lost. + */ + return 9; + + case WTAP_ENCAP_FRELAY_WITH_PHDR: + return 107; + } + for (i = 0; i < NUM_PCAP_ENCAPS; i++) { if (pcap_to_wtap_map[i].wtap_encap_value == encap) return pcap_to_wtap_map[i].dlt_value; |