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;
}
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;
}
}
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) {
* 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.
* 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;
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);
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);
}
}
- 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;
}
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;
}