aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/pcap-common.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-05-18 02:36:00 +0000
committerGuy Harris <guy@alum.mit.edu>2013-05-18 02:36:00 +0000
commit33e1232f23a98b15e1d3e8fc2ca2e36a86f067bb (patch)
treef6ce3c6d55f245fcdec5cb4c0315b1df632ec069 /wiretap/pcap-common.c
parentba8ead5e61bb8541adf283e0a15e3368f8ef6400 (diff)
In the pcapng seek-read routine, *don't* fill in wth->phdr; seek-read
routines are passed a separate struct wtap_pkthdr to be filled in. Get rid of the pseudo_header member of the wblock structure - the pseudo-header is part of the struct wtap_pkthdr. Get rid of the union wtap_pseudo_header * argument to pcap_process_pseudo_header() - it's passed a pointer to a struct pcap_pkthdr, and that structure contains the union in question. Have libpcap_read_header() take a FILE_T argument, rather than using only the "sequential" handle of the wtap it's handed. Have the libpcap read routine return the offset of the beginning of the pcap record, and have the seek-read routine read the header and fill in the struct wtap_pkthdr handed to it. svn path=/trunk/; revision=49401
Diffstat (limited to 'wiretap/pcap-common.c')
-rw-r--r--wiretap/pcap-common.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c
index 682c822a58..3fc6502441 100644
--- a/wiretap/pcap-common.c
+++ b/wiretap/pcap-common.c
@@ -1484,8 +1484,8 @@ pcap_read_i2c_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, i
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)
+ guint packet_size, gboolean check_packet_size,
+ struct wtap_pkthdr *phdr, int *err, gchar **err_info)
{
int phdr_len = 0;
guint size;
@@ -1508,7 +1508,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
return -1;
}
if (!pcap_read_nokiaatm_pseudoheader(fh,
- pseudo_header, err, err_info))
+ &phdr->pseudo_header, err, err_info))
return -1; /* Read error */
phdr_len = NOKIAATM_LEN;
@@ -1527,7 +1527,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
return -1;
}
if (!pcap_read_sunatm_pseudoheader(fh,
- pseudo_header, err, err_info))
+ &phdr->pseudo_header, err, err_info))
return -1; /* Read error */
phdr_len = SUNATM_LEN;
@@ -1540,14 +1540,14 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
* Nokia IPSO. Psuedo header has already been read, but it's not considered
* part of the packet size, so reread it to store the data for later (when saving)
*/
- if (!pcap_read_nokia_pseudoheader(fh, pseudo_header, err, err_info))
+ if (!pcap_read_nokia_pseudoheader(fh, &phdr->pseudo_header, err, err_info))
return -1; /* Read error */
}
/*
* We don't know whether there's an FCS in this frame or not.
*/
- pseudo_header->eth.fcs_len = -1;
+ phdr->pseudo_header.eth.fcs_len = -1;
break;
case WTAP_ENCAP_IEEE_802_11:
@@ -1559,11 +1559,11 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
* XXX - are there any OSes where the capture mechanism
* supplies an FCS?
*/
- pseudo_header->ieee_802_11.fcs_len = -1;
- pseudo_header->ieee_802_11.decrypted = FALSE;
- pseudo_header->ieee_802_11.channel = 0;
- pseudo_header->ieee_802_11.data_rate = 0;
- pseudo_header->ieee_802_11.signal_level = 0;
+ phdr->pseudo_header.ieee_802_11.fcs_len = -1;
+ phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
+ phdr->pseudo_header.ieee_802_11.channel = 0;
+ phdr->pseudo_header.ieee_802_11.data_rate = 0;
+ phdr->pseudo_header.ieee_802_11.signal_level = 0;
break;
case WTAP_ENCAP_IRDA:
@@ -1577,7 +1577,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
packet_size);
return -1;
}
- if (!pcap_read_irda_pseudoheader(fh, pseudo_header,
+ if (!pcap_read_irda_pseudoheader(fh, &phdr->pseudo_header,
err, err_info))
return -1; /* Read error */
@@ -1595,7 +1595,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
packet_size);
return -1;
}
- if (!pcap_read_mtp2_pseudoheader(fh, pseudo_header,
+ if (!pcap_read_mtp2_pseudoheader(fh, &phdr->pseudo_header,
err, err_info))
return -1; /* Read error */
@@ -1613,7 +1613,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
packet_size);
return -1;
}
- if (!pcap_read_lapd_pseudoheader(fh, pseudo_header,
+ if (!pcap_read_lapd_pseudoheader(fh, &phdr->pseudo_header,
err, err_info))
return -1; /* Read error */
@@ -1631,7 +1631,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
packet_size);
return -1;
}
- if (!pcap_read_sita_pseudoheader(fh, pseudo_header,
+ if (!pcap_read_sita_pseudoheader(fh, &phdr->pseudo_header,
err, err_info))
return -1; /* Read error */
@@ -1640,7 +1640,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
case WTAP_ENCAP_BLUETOOTH_H4:
/* We don't have pseudoheader, so just pretend we received everything. */
- pseudo_header->p2p.sent = FALSE;
+ phdr->pseudo_header.p2p.sent = FALSE;
break;
case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR:
@@ -1656,7 +1656,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
return -1;
}
if (!pcap_read_bt_pseudoheader(fh,
- pseudo_header, err, err_info))
+ &phdr->pseudo_header, err, err_info))
return -1; /* Read error */
phdr_len = (int)sizeof (struct libpcap_bt_phdr);
@@ -1668,7 +1668,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
*err_info = g_strdup_printf("pcap: libpcap llcp file too short");
return -1;
}
- if (!pcap_read_llcp_pseudoheader(fh, pseudo_header, err, err_info))
+ if (!pcap_read_llcp_pseudoheader(fh, &phdr->pseudo_header, err, err_info))
return -1; /* Read error */
phdr_len = LLCP_HEADER_LEN;
break;
@@ -1686,7 +1686,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
return -1;
}
if (!pcap_read_ppp_pseudoheader(fh,
- pseudo_header, err, err_info))
+ &phdr->pseudo_header, err, err_info))
return -1; /* Read error */
phdr_len = (int)sizeof (struct libpcap_ppp_phdr);
@@ -1705,21 +1705,21 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
return -1;
}
- if (!pcap_read_erf_pseudoheader(fh, phdr, pseudo_header,
+ if (!pcap_read_erf_pseudoheader(fh, phdr, &phdr->pseudo_header,
err, err_info))
return -1; /* Read error */
phdr_len = (int)sizeof(struct erf_phdr);
/* check the optional Extension header */
- if (!pcap_read_erf_exheader(fh, pseudo_header, err, err_info,
+ if (!pcap_read_erf_exheader(fh, &phdr->pseudo_header, err, err_info,
&size))
return -1; /* Read error */
phdr_len += size;
/* check the optional Multi Channel header */
- if (!pcap_read_erf_subheader(fh, pseudo_header, err, err_info,
+ if (!pcap_read_erf_subheader(fh, &phdr->pseudo_header, err, err_info,
&size))
return -1; /* Read error */
@@ -1750,7 +1750,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
packet_size);
return -1;
}
- if (!pcap_read_i2c_pseudoheader(fh, pseudo_header,
+ if (!pcap_read_i2c_pseudoheader(fh, &phdr->pseudo_header,
err, err_info))
return -1; /* Read error */