/*
* To repeat:
*
- * If you need a new encapsulation type for libpcap files, do
- * *N*O*T* use *ANY* of the values listed here! I.e., do *NOT*
+ * If you need a new encapsulation type for pcap and pcapng files,
+ * do *N*O*T* use *ANY* of the values listed here! I.e., do *NOT*
* add a new encapsulation type by changing an existing entry;
* leave the existing entries alone.
*
*/
/*
- * 11 is DLT_ATM_RFC1483 on most platforms; the only libpcaps I've
- * seen that define anything other than DLT_ATM_RFC1483 as 11 are
- * the BSD/OS one, which defines DLT_FR as 11. We handle it as
- * Frame Relay on BSD/OS and LLC-encapsulated ATM on all other
+ * 11 is DLT_ATM_RFC1483 on most platforms; the only version of
+ * libpcap I've seen that define anything other than DLT_ATM_RFC1483
+ * as 11 is the BSD/OS one, which defines DLT_FR as 11. We handle
+ * it as Frame Relay on BSD/OS and LLC-encapsulated ATM on all other
* platforms.
*/
#if defined(__bsdi__) /* BSD/OS */
* 18 is DLT_CIP in SuSE 6.3 libpcap; if it's the same as the
* DLT_CIP of 16 that the Alexey Kuznetzov patches for
* libpcap/tcpdump define, it's WTAP_ENCAP_LINUX_ATM_CLIP.
- * I've not found any libpcap that uses it for any other purpose -
- * hopefully nobody will do so in the future.
+ * I've not found any version of libpcap that uses it for any
+ * other purpose - hopefully nobody will do so in the future.
*/
{ 18, WTAP_ENCAP_LINUX_ATM_CLIP },
/*
* 19 is DLT_ATM_CLIP in the libpcap/tcpdump patches in the
* recent versions I've seen of the Linux ATM distribution;
- * I've not yet found any libpcap that uses it for any other
- * purpose - hopefully nobody will do so in the future.
+ * I've not yet found any version of libpcap file that uses it
+ * for any other purpose - hopefully nobody will do so in
+ * the future.
*/
{ 19, WTAP_ENCAP_LINUX_ATM_CLIP },
/*
* To repeat:
*
- * If you need a new encapsulation type for libpcap files, do
- * *N*O*T* use *ANY* of the values listed here! I.e., do *NOT*
+ * If you need a new encapsulation type for pcap and pcapng files,
+ * do *N*O*T* use *ANY* of the values listed here! I.e., do *NOT*
* add a new encapsulation type by changing an existing entry;
* leave the existing entries alone.
*
if (pntoh16(&irda_phdr[IRDA_SLL_PROTOCOL_OFFSET]) != 0x0017) {
*err = WTAP_ERR_BAD_FILE;
if (err_info != NULL)
- *err_info = g_strdup("libpcap: IrDA capture has a packet with an invalid sll_protocol field");
+ *err_info = g_strdup("pcap/pcapng: IrDA capture has a packet with an invalid sll_protocol field");
return FALSE;
}
if (pntoh16(&lapd_phdr[LAPD_SLL_PROTOCOL_OFFSET]) != ETH_P_LAPD) {
*err = WTAP_ERR_BAD_FILE;
if (err_info != NULL)
- *err_info = g_strdup("libpcap: LAPD capture has a packet with an invalid sll_protocol field");
+ *err_info = g_strdup("pcap/pcapng: LAPD capture has a packet with an invalid sll_protocol field");
return FALSE;
}
* Pseudo-header at the beginning of DLT_BLUETOOTH_HCI_H4_WITH_PHDR frames.
* Values in network byte order.
*/
-struct libpcap_bt_phdr {
+struct pcap_bt_phdr {
guint32 direction; /* Bit 0 hold the frame direction. */
};
pcap_read_bt_pseudoheader(FILE_T fh,
union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info)
{
- struct libpcap_bt_phdr phdr;
+ struct pcap_bt_phdr phdr;
- if (!wtap_read_bytes(fh, &phdr, sizeof (struct libpcap_bt_phdr),
+ if (!wtap_read_bytes(fh, &phdr, sizeof (struct pcap_bt_phdr),
err, err_info))
return FALSE;
pseudo_header->p2p.sent = ((g_ntohl(phdr.direction) & LIBPCAP_BT_PHDR_RECV) == 0)? TRUE: FALSE;
* Pseudo-header at the beginning of DLT_BLUETOOTH_LINUX_MONITOR frames.
* Values in network byte order.
*/
-struct libpcap_bt_monitor_phdr {
+struct pcap_bt_monitor_phdr {
guint16 adapter_id;
guint16 opcode;
};
pcap_read_bt_monitor_pseudoheader(FILE_T fh,
union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info)
{
- struct libpcap_bt_monitor_phdr phdr;
+ struct pcap_bt_monitor_phdr phdr;
- if (!wtap_read_bytes(fh, &phdr, sizeof (struct libpcap_bt_monitor_phdr),
+ if (!wtap_read_bytes(fh, &phdr, sizeof (struct pcap_bt_monitor_phdr),
err, err_info))
return FALSE;
/*
* Pseudo-header at the beginning of DLT_PPP_WITH_DIR frames.
*/
-struct libpcap_ppp_phdr {
+struct pcap_ppp_phdr {
guint8 direction;
};
pcap_read_ppp_pseudoheader(FILE_T fh,
union wtap_pseudo_header *pseudo_header, int *err, gchar **err_info)
{
- struct libpcap_ppp_phdr phdr;
+ struct pcap_ppp_phdr phdr;
- if (!wtap_read_bytes(fh, &phdr, sizeof (struct libpcap_ppp_phdr),
+ if (!wtap_read_bytes(fh, &phdr, sizeof (struct pcap_ppp_phdr),
err, err_info))
return FALSE;
pseudo_header->p2p.sent = (phdr.direction == LIBPCAP_PPP_PHDR_SENT) ? TRUE: FALSE;
* have a pseudo-header.
*/
*err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("pcap: Nokia IPSO ATM file has a %u-byte packet, too small to have even an ATM pseudo-header",
+ *err_info = g_strdup_printf("pcap/pcapng: Nokia IPSO ATM file has a %u-byte packet, too small to have even an ATM pseudo-header",
packet_size);
return -1;
}
* have a pseudo-header.
*/
*err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("pcap: SunATM file has a %u-byte packet, too small to have even an ATM pseudo-header",
+ *err_info = g_strdup_printf("pcap/pcapng: SunATM file has a %u-byte packet, too small to have even an ATM pseudo-header",
packet_size);
return -1;
}
* have a pseudo-header.
*/
*err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("pcap: IrDA file has a %u-byte packet, too small to have even an IrDA pseudo-header",
+ *err_info = g_strdup_printf("pcap/pcapng: IrDA file has a %u-byte packet, too small to have even an IrDA pseudo-header",
packet_size);
return -1;
}
* have a pseudo-header.
*/
*err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("pcap: MTP2 file has a %u-byte packet, too small to have even an MTP2 pseudo-header",
+ *err_info = g_strdup_printf("pcap/pcapng: MTP2 file has a %u-byte packet, too small to have even an MTP2 pseudo-header",
packet_size);
return -1;
}
* have a pseudo-header.
*/
*err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("pcap: LAPD file has a %u-byte packet, too small to have even a LAPD pseudo-header",
+ *err_info = g_strdup_printf("pcap/pcapng: LAPD file has a %u-byte packet, too small to have even a LAPD pseudo-header",
packet_size);
return -1;
}
* have a pseudo-header.
*/
*err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("pcap: SITA file has a %u-byte packet, too small to have even a SITA pseudo-header",
+ *err_info = g_strdup_printf("pcap/pcapng: SITA file has a %u-byte packet, too small to have even a SITA pseudo-header",
packet_size);
return -1;
}
break;
case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR:
- if (packet_size < sizeof (struct libpcap_bt_phdr)) {
+ if (packet_size < sizeof (struct pcap_bt_phdr)) {
/*
* Uh-oh, the packet isn't big enough to even
* have a pseudo-header.
*/
*err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("pcap: libpcap bluetooth file has a %u-byte packet, too small to have even a pseudo-header",
+ *err_info = g_strdup_printf("pcap/pcapng: Bluetooth file has a %u-byte packet, too small to have even a pseudo-header",
packet_size);
return -1;
}
&rec->rec_header.packet_header.pseudo_header, err, err_info))
return -1; /* Read error */
- phdr_len = (int)sizeof (struct libpcap_bt_phdr);
+ phdr_len = (int)sizeof (struct pcap_bt_phdr);
break;
case WTAP_ENCAP_BLUETOOTH_LINUX_MONITOR:
- if (packet_size < sizeof (struct libpcap_bt_monitor_phdr)) {
+ if (packet_size < sizeof (struct pcap_bt_monitor_phdr)) {
/*
* Uh-oh, the packet isn't big enough to even
* have a pseudo-header.
*/
*err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("pcap: libpcap bluetooth monitor file has a %u-byte packet, too small to have even a pseudo-header",
+ *err_info = g_strdup_printf("pcap/pcapng: Bluetooth monitor file has a %u-byte packet, too small to have even a pseudo-header",
packet_size);
return -1;
}
&rec->rec_header.packet_header.pseudo_header, err, err_info))
return -1; /* Read error */
- phdr_len = (int)sizeof (struct libpcap_bt_monitor_phdr);
+ phdr_len = (int)sizeof (struct pcap_bt_monitor_phdr);
break;
case WTAP_ENCAP_NFC_LLCP:
if (packet_size < LLCP_HEADER_LEN) {
*err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup("pcap: libpcap llcp file too short");
+ *err_info = g_strdup_printf("pcap/pcapng: NFC LLCP file has a %u-byte packet, too small to have even a pseudo-header",
+ packet_size);
return -1;
}
if (!pcap_read_llcp_pseudoheader(fh, &rec->rec_header.packet_header.pseudo_header, err, err_info))
break;
case WTAP_ENCAP_PPP_WITH_PHDR:
- if (packet_size < sizeof (struct libpcap_ppp_phdr)) {
+ if (packet_size < sizeof (struct pcap_ppp_phdr)) {
/*
* Uh-oh, the packet isn't big enough to even
* have a pseudo-header.
*/
*err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("pcap: libpcap ppp file has a %u-byte packet, too small to have even a pseudo-header",
+ *err_info = g_strdup_printf("pcap/pcapng: PPP file has a %u-byte packet, too small to have even a pseudo-header",
packet_size);
return -1;
}
&rec->rec_header.packet_header.pseudo_header, err, err_info))
return -1; /* Read error */
- phdr_len = (int)sizeof (struct libpcap_ppp_phdr);
+ phdr_len = (int)sizeof (struct pcap_ppp_phdr);
break;
case WTAP_ENCAP_ERF:
* have a pseudo-header.
*/
*err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("pcap: ERF file has a %u-byte packet, too small to have even an ERF pseudo-header",
+ *err_info = g_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small to have even an ERF pseudo-header",
packet_size);
return -1;
}
* header.
*/
*err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("pcap: ERF file has a %u-byte packet, too small for a pseudo-header with ex- and sub-headers (%d)",
+ *err_info = g_strdup_printf("pcap/pcapng: ERF file has a %u-byte packet, too small for a pseudo-header with ex- and sub-headers (%d)",
packet_size, phdr_len);
return -1;
}
* have a pseudo-header.
*/
*err = WTAP_ERR_BAD_FILE;
- *err_info = g_strdup_printf("pcap: I2C file has a %u-byte packet, too small to have even a I2C pseudo-header",
+ *err_info = g_strdup_printf("pcap/pcapng: I2C file has a %u-byte packet, too small to have even a I2C pseudo-header",
packet_size);
return -1;
}
break;
case WTAP_ENCAP_BLUETOOTH_H4_WITH_PHDR:
- hdrsize = (int)sizeof (struct libpcap_bt_phdr);
+ hdrsize = (int)sizeof (struct pcap_bt_phdr);
break;
case WTAP_ENCAP_PPP_WITH_PHDR:
- hdrsize = (int)sizeof (struct libpcap_ppp_phdr);
+ hdrsize = (int)sizeof (struct pcap_ppp_phdr);
break;
case WTAP_ENCAP_BLUETOOTH_LINUX_MONITOR:
- hdrsize = (int)sizeof (struct libpcap_bt_monitor_phdr);
+ hdrsize = (int)sizeof (struct pcap_bt_monitor_phdr);
break;
default:
guint8 erf_hdr[ sizeof(struct erf_mc_phdr)];
guint8 erf_subhdr[sizeof(union erf_subhdr)];
struct i2c_file_hdr i2c_hdr;
- struct libpcap_bt_phdr bt_hdr;
- struct libpcap_bt_monitor_phdr bt_monitor_hdr;
- struct libpcap_ppp_phdr ppp_hdr;
+ struct pcap_bt_phdr bt_hdr;
+ struct pcap_bt_monitor_phdr bt_monitor_hdr;
+ struct pcap_ppp_phdr ppp_hdr;
size_t size;
size_t subhdr_size = 0;