forked from osmocom/wireshark
Cleanup. Should be included in Wireshark 1.2.1 and higher to keep
merging future bug fixes simple. svn path=/trunk/; revision=28863
This commit is contained in:
parent
a41d93603c
commit
dce1889fd7
|
@ -636,7 +636,7 @@ static gboolean libpcap_read(wtap *wth, int *err, gchar **err_info,
|
|||
|
||||
*data_offset = wth->data_offset;
|
||||
|
||||
phdr_len = pcap_process_pseudo_header(wth, wth->file_encap, wth->fh, packet_size,
|
||||
phdr_len = pcap_process_pseudo_header(wth->fh, wth->file_type, wth->file_encap, wth->capture.pcap->byte_swapped, packet_size,
|
||||
TRUE, &wth->phdr, &wth->pseudo_header, err, err_info);
|
||||
if (phdr_len < 0)
|
||||
return FALSE; /* error */
|
||||
|
@ -704,7 +704,7 @@ libpcap_seek_read(wtap *wth, gint64 seek_off,
|
|||
if (file_seek(wth->random_fh, seek_off, SEEK_SET, err) == -1)
|
||||
return FALSE;
|
||||
|
||||
phdr_len = pcap_process_pseudo_header(wth, wth->file_encap, wth->random_fh, length,
|
||||
phdr_len = pcap_process_pseudo_header(wth->fh, wth->file_type, wth->file_encap, wth->capture.pcap->byte_swapped, length,
|
||||
FALSE, NULL, pseudo_header, err, err_info);
|
||||
if (phdr_len < 0)
|
||||
return FALSE; /* error */
|
||||
|
|
|
@ -916,8 +916,8 @@ pcap_read_sita_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
pcap_read_linux_usb_pseudoheader(wtap *wth, FILE_T fh,
|
||||
union wtap_pseudo_header *pseudo_header, int *err)
|
||||
pcap_read_linux_usb_pseudoheader(FILE_T fh,
|
||||
union wtap_pseudo_header *pseudo_header, gboolean byte_swapped, int *err)
|
||||
{
|
||||
int bytes_read;
|
||||
|
||||
|
@ -931,7 +931,7 @@ pcap_read_linux_usb_pseudoheader(wtap *wth, FILE_T fh,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (wth->capture.pcap->byte_swapped) {
|
||||
if (byte_swapped) {
|
||||
pseudo_header->linux_usb.id = GUINT64_SWAP_LE_BE(pseudo_header->linux_usb.id);
|
||||
pseudo_header->linux_usb.bus_id = GUINT16_SWAP_LE_BE(pseudo_header->linux_usb.bus_id);
|
||||
pseudo_header->linux_usb.ts_sec = GUINT64_SWAP_LE_BE(pseudo_header->linux_usb.ts_sec);
|
||||
|
@ -1115,17 +1115,17 @@ pcap_read_i2c_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, i
|
|||
}
|
||||
|
||||
int
|
||||
pcap_process_pseudo_header(wtap *wth, int encap, FILE_T fh, guint packet_size,
|
||||
pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap, gboolean bytes_swapped, guint packet_size,
|
||||
gboolean check_packet_size, struct wtap_pkthdr *phdr,
|
||||
union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info)
|
||||
{
|
||||
int phdr_len = 0;
|
||||
guint size;
|
||||
|
||||
switch (encap) {
|
||||
switch (wtap_encap) {
|
||||
|
||||
case WTAP_ENCAP_ATM_PDUS:
|
||||
if (wth->file_type == WTAP_FILE_PCAP_NOKIA) {
|
||||
if (file_type == WTAP_FILE_PCAP_NOKIA) {
|
||||
/*
|
||||
* Nokia IPSO ATM.
|
||||
*/
|
||||
|
@ -1273,8 +1273,8 @@ pcap_process_pseudo_header(wtap *wth, int encap, FILE_T fh, guint packet_size,
|
|||
packet_size);
|
||||
return -1;
|
||||
}
|
||||
if (!pcap_read_linux_usb_pseudoheader(wth, fh,
|
||||
pseudo_header, err))
|
||||
if (!pcap_read_linux_usb_pseudoheader(fh,
|
||||
pseudo_header, bytes_swapped, err))
|
||||
return -1; /* Read error */
|
||||
|
||||
phdr_len = (int)sizeof (struct linux_usb_phdr);
|
||||
|
|
|
@ -26,12 +26,13 @@
|
|||
|
||||
extern int wtap_wtap_encap_to_pcap_encap(int encap);
|
||||
|
||||
extern int pcap_process_pseudo_header(wtap *wth, int encap, FILE_T fh, guint packet_size,
|
||||
extern int pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||
gboolean byte_swapped, guint packet_size,
|
||||
gboolean check_packet_size, struct wtap_pkthdr *phdr,
|
||||
union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info);
|
||||
|
||||
extern int pcap_get_phdr_size(int encap,
|
||||
const union wtap_pseudo_header *pseudo_header);
|
||||
|
||||
extern gboolean pcap_write_phdr(wtap_dumper *wdh, int encap,
|
||||
extern gboolean pcap_write_phdr(wtap_dumper *wdh, int wtap_encap,
|
||||
const union wtap_pseudo_header *pseudo_header, int *err);
|
||||
|
|
|
@ -773,9 +773,10 @@ pcapng_read_packet_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh, pcapng
|
|||
pcap_get_phdr_size(encap, wblock->pseudo_header));
|
||||
|
||||
memset((void *)wblock->pseudo_header, 0, sizeof(union wtap_pseudo_header));
|
||||
pseudo_header_len = pcap_process_pseudo_header(wth, /* XXX get rid of... */
|
||||
pseudo_header_len = pcap_process_pseudo_header(fh,
|
||||
WTAP_FILE_PCAPNG,
|
||||
encap,
|
||||
fh,
|
||||
pn->byte_swapped,
|
||||
wblock->data.packet.cap_len,
|
||||
TRUE,
|
||||
&wth->phdr,
|
||||
|
@ -930,9 +931,10 @@ pcapng_read_simple_packet_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh,
|
|||
pcap_get_phdr_size(encap, wblock->pseudo_header));
|
||||
|
||||
memset((void *)wblock->pseudo_header, 0, sizeof(union wtap_pseudo_header));
|
||||
pseudo_header_len = pcap_process_pseudo_header(wth, /* XXX get rid of... */
|
||||
pseudo_header_len = pcap_process_pseudo_header(fh,
|
||||
WTAP_FILE_PCAPNG,
|
||||
encap,
|
||||
fh,
|
||||
pn->byte_swapped,
|
||||
wblock->data.simple_packet.cap_len,
|
||||
TRUE,
|
||||
&wth->phdr,
|
||||
|
@ -1770,7 +1772,7 @@ pcapng_dump_open(wtap_dumper *wdh, gboolean cant_seek _U_, int *err)
|
|||
int pcapng_dump_can_write_encap(int wtap_encap)
|
||||
{
|
||||
pcapng_debug2("pcapng_dump_can_write_encap: encap = %d (%s)",
|
||||
encap,
|
||||
wtap_encap,
|
||||
wtap_encap_string(wtap_encap));
|
||||
|
||||
/* Per-packet encapsulations is supported. */
|
||||
|
|
Loading…
Reference in New Issue