diff options
author | Guy Harris <guy@alum.mit.edu> | 2011-09-01 19:58:25 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2011-09-01 19:58:25 +0000 |
commit | 6ac265b51248462ffb810fd54bd6d36d35799841 (patch) | |
tree | 3d944cfa96b8c06dc4620d3c4eabe5eea3926dcf | |
parent | 11d248331218fa16dc2622ee9794115dbf0b39c1 (diff) |
Merge pcap_fill_in_pseudo_header() into pcap_read_post_process().
svn path=/trunk/; revision=38844
-rw-r--r-- | wiretap/libpcap.c | 16 | ||||
-rw-r--r-- | wiretap/pcap-common.c | 21 | ||||
-rw-r--r-- | wiretap/pcap-common.h | 9 | ||||
-rw-r--r-- | wiretap/pcapng.c | 18 |
4 files changed, 20 insertions, 44 deletions
diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index 424f4324c1..c8e5cb7d74 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -673,12 +673,9 @@ static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info, wth->phdr.caplen = packet_size; wth->phdr.len = orig_size; - pcap_fill_in_pseudo_header(wth->file_type, wth->file_encap, - buffer_start_ptr(wth->frame_buffer), wth->phdr.caplen, - &wth->pseudo_header, -1); - - pcap_read_post_process(wth->file_encap, wth->phdr.caplen, - libpcap->byte_swapped, buffer_start_ptr(wth->frame_buffer)); + pcap_read_post_process(wth->file_type, wth->file_encap, + &wth->pseudo_header, buffer_start_ptr(wth->frame_buffer), + wth->phdr.caplen, libpcap->byte_swapped, -1); return TRUE; } @@ -705,11 +702,8 @@ libpcap_seek_read(wtap *wth, gint64 seek_off, if (!libpcap_read_rec_data(wth->random_fh, pd, length, err, err_info)) return FALSE; /* failed */ - pcap_fill_in_pseudo_header(wth->file_type, wth->file_encap, pd, - length, pseudo_header, -1); - - pcap_read_post_process(wth->file_encap, length, - libpcap->byte_swapped, pd); + pcap_read_post_process(wth->file_type, wth->file_encap, + pseudo_header, pd, length, libpcap->byte_swapped, -1); return TRUE; } diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c index c9b9ba27dc..899ad9a111 100644 --- a/wiretap/pcap-common.c +++ b/wiretap/pcap-common.c @@ -1623,8 +1623,9 @@ 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) +pcap_read_post_process(int file_type, int wtap_encap, + union wtap_pseudo_header *pseudo_header, + guint8 *pd, guint packet_size, gboolean bytes_swapped, int fcs_len) { switch (wtap_encap) { @@ -1636,7 +1637,7 @@ pcap_fill_in_pseudo_header(int file_type, int wtap_encap, guint8 *pd, int length * Guess the traffic type based on the packet * contents. */ - atm_guess_traffic_type(pd, length, pseudo_header); + atm_guess_traffic_type(pd, packet_size, pseudo_header); } else { /* * SunATM. @@ -1646,7 +1647,8 @@ pcap_fill_in_pseudo_header(int file_type, int wtap_encap, guint8 *pd, int length * contents. */ if (pseudo_header->atm.type == TRAF_LANE) - atm_guess_lane_type(pd, length, pseudo_header); + atm_guess_lane_type(pd, packet_size, + pseudo_header); } break; @@ -1654,17 +1656,6 @@ pcap_fill_in_pseudo_header(int file_type, int wtap_encap, guint8 *pd, int length pseudo_header->eth.fcs_len = fcs_len; break; - default: - break; - } -} - -void -pcap_read_post_process(int wtap_encap, guint packet_size, - gboolean bytes_swapped, guint8 *pd) -{ - switch (wtap_encap) { - case WTAP_ENCAP_USB_LINUX: pcap_process_linux_usb_pseudoheader(packet_size, bytes_swapped, FALSE, pd); diff --git a/wiretap/pcap-common.h b/wiretap/pcap-common.h index 587fdfb837..2b4d7cad88 100644 --- a/wiretap/pcap-common.h +++ b/wiretap/pcap-common.h @@ -34,12 +34,9 @@ extern int pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap, guint packet_size, gboolean check_packet_size, struct wtap_pkthdr *phdr, union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info); -extern 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); - -extern void pcap_read_post_process(int wtap_encap, guint packet_size, - gboolean bytes_swapped, guint8 *pd); +extern void pcap_read_post_process(int file_type, int wtap_encap, + union wtap_pseudo_header *pseudo_header, + guint8 *pd, guint packet_size, gboolean bytes_swapped, int fcs_len); extern int pcap_get_phdr_size(int encap, const union wtap_pseudo_header *pseudo_header); diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index c7aec3035f..c1b4efe0d2 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -981,14 +981,11 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta } } - pcap_fill_in_pseudo_header(WTAP_FILE_PCAPNG, wtap_encap, + pcap_read_post_process(WTAP_FILE_PCAPNG, wtap_encap, + (union wtap_pseudo_header *)wblock->pseudo_header, (guint8 *) (wblock->frame_buffer), (int) (wblock->data.packet.cap_len - pseudo_header_len), - (union wtap_pseudo_header *)wblock->pseudo_header, fcslen); - - pcap_read_post_process(wtap_encap, - (int) (wblock->data.packet.cap_len - pseudo_header_len), - pn->byte_swapped, (guint8 *) (wblock->frame_buffer)); + pn->byte_swapped, fcslen); return block_read; } @@ -1089,14 +1086,11 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t * block_read += 4 - (wblock->data.simple_packet.cap_len % 4); } - pcap_fill_in_pseudo_header(WTAP_FILE_PCAPNG, encap, + pcap_read_post_process(WTAP_FILE_PCAPNG, encap, + (union wtap_pseudo_header *)wblock->pseudo_header, (guint8 *) (wblock->frame_buffer), (int) wblock->data.simple_packet.cap_len, - (union wtap_pseudo_header *)wblock->pseudo_header, - pn->if_fcslen); - - pcap_read_post_process(encap, (int) wblock->data.simple_packet.cap_len, - pn->byte_swapped, (guint8 *) (wblock->frame_buffer)); + pn->byte_swapped, pn->if_fcslen); return block_read; } |