diff options
author | Guy Harris <guy@alum.mit.edu> | 2011-09-01 09:43:10 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2011-09-01 09:43:10 +0000 |
commit | e9fc1b72aabaae01cd6cad613dfc88168d8aed9a (patch) | |
tree | c1bdbe16d5579966f05db9cb334a115e011e08ff /wiretap/pcap-common.c | |
parent | 10a3cb6e0f30290ccce97c01d482f05d083915a6 (diff) | |
download | wireshark-e9fc1b72aabaae01cd6cad613dfc88168d8aed9a.tar.gz |
Use guint8 rather than guchar for raw octets and pointers to arrays of
same.
Add to wiretap/pcap-common.c a routine to fill in the pseudo-header for
ATM (by looking at the VPI, VCI, and packet data, and guessing) and
Ethernet (setting the FCS length appropriately). Use it for both pcap
and pcap-ng files.
svn path=/trunk/; revision=38840
Diffstat (limited to 'wiretap/pcap-common.c')
-rw-r--r-- | wiretap/pcap-common.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c index afc1fa7118..c9b9ba27dc 100644 --- a/wiretap/pcap-common.c +++ b/wiretap/pcap-common.c @@ -33,6 +33,7 @@ #include <errno.h> #include "wtap-int.h" #include "file_wrappers.h" +#include "atm.h" #include "erf.h" #include "pcap-encap.h" #include "pcap-common.h" @@ -1622,8 +1623,45 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap, } void +pcap_fill_in_pseudo_header(int file_type, int wtap_encap, guint8 *pd, int length, + union wtap_pseudo_header *pseudo_header, int fcs_len) +{ + switch (wtap_encap) { + + case WTAP_ENCAP_ATM_PDUS: + if (file_type == WTAP_FILE_PCAP_NOKIA) { + /* + * Nokia IPSO ATM. + * + * Guess the traffic type based on the packet + * contents. + */ + atm_guess_traffic_type(pd, length, pseudo_header); + } else { + /* + * SunATM. + * + * If this is ATM LANE traffic, try to guess what + * type of LANE traffic it is based on the packet + * contents. + */ + if (pseudo_header->atm.type == TRAF_LANE) + atm_guess_lane_type(pd, length, pseudo_header); + } + break; + + case WTAP_ENCAP_ETHERNET: + pseudo_header->eth.fcs_len = fcs_len; + break; + + default: + break; + } +} + +void pcap_read_post_process(int wtap_encap, guint packet_size, - gboolean bytes_swapped, guchar *pd) + gboolean bytes_swapped, guint8 *pd) { switch (wtap_encap) { |