2016-01-26 01:17:21 +00:00
|
|
|
/* wtap_opttypes.h
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 2001 Gerald Combs
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2016-01-26 01:17:21 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WTAP_OPT_TYPES_H
|
|
|
|
#define WTAP_OPT_TYPES_H
|
|
|
|
|
|
|
|
#include "ws_symbol_export.h"
|
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
#include <wsutil/inet_ipv6.h>
|
|
|
|
|
2016-06-06 00:21:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We use the pcapng option codes for option type values.
|
|
|
|
*/
|
2016-07-15 20:57:35 +00:00
|
|
|
|
|
|
|
/* Options for all blocks */
|
2016-07-16 00:33:25 +00:00
|
|
|
#define OPT_EOFOPT 0 /**< Appears in pcapng files, but not in blocks. */
|
|
|
|
#define OPT_COMMENT 1 /**< A UTF-8 string containing a human-readable comment. */
|
2016-06-06 00:21:23 +00:00
|
|
|
|
|
|
|
/* Section Header block (SHB) */
|
2016-07-15 20:57:35 +00:00
|
|
|
#define OPT_SHB_HARDWARE 2 /**< A UTF-8 string containing the description of the
|
2016-06-06 00:21:23 +00:00
|
|
|
* hardware used to create this section.
|
|
|
|
*/
|
2016-07-15 20:57:35 +00:00
|
|
|
#define OPT_SHB_OS 3 /**< A UTF-8 string containing the
|
2016-06-06 00:21:23 +00:00
|
|
|
* name of the operating system used to create this section.
|
|
|
|
*/
|
2016-07-15 20:57:35 +00:00
|
|
|
#define OPT_SHB_USERAPPL 4 /**< A UTF-8 string containing the
|
2016-06-06 00:21:23 +00:00
|
|
|
* name of the application used to create this section.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Interface Description block (IDB) */
|
2016-07-15 20:57:35 +00:00
|
|
|
#define OPT_IDB_NAME 2 /**< A UTF-8 string containing the name
|
2016-06-06 00:21:23 +00:00
|
|
|
* of the device used to capture data.
|
|
|
|
* "eth0" / "\Device\NPF_{AD1CE675-96D0-47C5-ADD0-2504B9126B68}"
|
|
|
|
*/
|
2016-07-15 20:57:35 +00:00
|
|
|
#define OPT_IDB_DESCR 3 /**< A UTF-8 string containing the description
|
2016-06-06 00:21:23 +00:00
|
|
|
* of the device used to capture data.
|
2018-08-11 02:08:40 +00:00
|
|
|
* "Wi-Fi" / "Local Area Connection" /
|
|
|
|
* "Wireless Network Connection" /
|
|
|
|
* "First Ethernet Interface"
|
2016-06-06 00:21:23 +00:00
|
|
|
*/
|
2016-07-15 20:57:35 +00:00
|
|
|
#define OPT_IDB_IP4ADDR 4 /**< XXX: if_IPv4addr Interface network address and netmask.
|
2016-06-06 00:21:23 +00:00
|
|
|
* This option can be repeated multiple times within the same Interface Description Block
|
|
|
|
* when multiple IPv4 addresses are assigned to the interface.
|
|
|
|
* 192 168 1 1 255 255 255 0
|
|
|
|
*/
|
2016-07-15 20:57:35 +00:00
|
|
|
#define OPT_IDB_IP6ADDR 5 /* XXX: if_IPv6addr Interface network address and prefix length (stored in the last byte).
|
2016-06-06 00:21:23 +00:00
|
|
|
* This option can be repeated multiple times within the same Interface
|
|
|
|
* Description Block when multiple IPv6 addresses are assigned to the interface.
|
|
|
|
* 2001:0db8:85a3:08d3:1319:8a2e:0370:7344/64 is written (in hex) as
|
|
|
|
* "20 01 0d b8 85 a3 08 d3 13 19 8a 2e 03 70 73 44 40"*/
|
2016-07-15 20:57:35 +00:00
|
|
|
#define OPT_IDB_MACADDR 6 /* XXX: if_MACaddr Interface Hardware MAC address (48 bits). */
|
|
|
|
#define OPT_IDB_EUIADDR 7 /* XXX: if_EUIaddr Interface Hardware EUI address (64 bits) */
|
|
|
|
#define OPT_IDB_SPEED 8 /**< Interface speed (in bps). 100000000 for 100Mbps
|
2016-06-06 00:21:23 +00:00
|
|
|
*/
|
2016-07-15 20:57:35 +00:00
|
|
|
#define OPT_IDB_TSRESOL 9 /**< Resolution of timestamps. If the Most Significant Bit is equal to zero,
|
2016-06-06 00:21:23 +00:00
|
|
|
* the remaining bits indicates the resolution of the timestamp as as a
|
|
|
|
* negative power of 10 (e.g. 6 means microsecond resolution, timestamps
|
|
|
|
* are the number of microseconds since 1/1/1970). If the Most Significant Bit
|
|
|
|
* is equal to one, the remaining bits indicates the resolution has a
|
|
|
|
* negative power of 2 (e.g. 10 means 1/1024 of second).
|
|
|
|
* If this option is not present, a resolution of 10^-6 is assumed
|
|
|
|
* (i.e. timestamps have the same resolution of the standard 'libpcap' timestamps).
|
|
|
|
*/
|
2016-07-15 20:57:35 +00:00
|
|
|
#define OPT_IDB_TZONE 10 /* XXX: if_tzone Time zone for GMT support (TODO: specify better). */
|
|
|
|
#define OPT_IDB_FILTER 11 /**< The filter (e.g. "capture only TCP traffic") used to capture traffic.
|
2016-06-06 00:21:23 +00:00
|
|
|
* The first byte of the Option Data keeps a code of the filter used
|
|
|
|
* (e.g. if this is a libpcap string, or BPF bytecode, and more).
|
|
|
|
* More details about this format will be presented in Appendix XXX (TODO).
|
|
|
|
* (TODO: better use different options for different fields?
|
|
|
|
* e.g. if_filter_pcap, if_filter_bpf, ...) 00 "tcp port 23 and host 10.0.0.5"
|
|
|
|
*/
|
2016-07-16 00:33:25 +00:00
|
|
|
#define OPT_IDB_OS 12 /**< A UTF-8 string containing the name of the operating system of the
|
2016-06-06 00:21:23 +00:00
|
|
|
* machine in which this interface is installed.
|
|
|
|
* This can be different from the same information that can be
|
|
|
|
* contained by the Section Header Block
|
|
|
|
* (Section 3.1 (Section Header Block (mandatory))) because
|
|
|
|
* the capture can have been done on a remote machine.
|
|
|
|
* "Windows XP SP2" / "openSUSE 10.2"
|
|
|
|
*/
|
2016-07-15 20:57:35 +00:00
|
|
|
#define OPT_IDB_FCSLEN 13 /**< An integer value that specified the length of the
|
2016-06-06 00:21:23 +00:00
|
|
|
* Frame Check Sequence (in bits) for this interface.
|
|
|
|
* For link layers whose FCS length can change during time,
|
|
|
|
* the Packet Block Flags Word can be used (see Appendix A (Packet Block Flags Word))
|
|
|
|
*/
|
2016-07-15 20:57:35 +00:00
|
|
|
#define OPT_IDB_TSOFFSET 14 /**< XXX: A 64 bits integer value that specifies an offset (in seconds)
|
2016-07-16 00:33:25 +00:00
|
|
|
* that must be added to the timestamp of each packet to obtain
|
|
|
|
* the absolute timestamp of a packet. If the option is missing,
|
|
|
|
* the timestamps stored in the packet must be considered absolute
|
|
|
|
* timestamps. The time zone of the offset can be specified with the
|
|
|
|
* option if_tzone. TODO: won't a if_tsoffset_low for fractional
|
2020-10-10 23:42:05 +00:00
|
|
|
* second offsets be useful for highly synchronized capture systems?
|
2016-06-06 00:21:23 +00:00
|
|
|
*/
|
2018-08-11 02:08:40 +00:00
|
|
|
#define OPT_IDB_HARDWARE 15 /**< A UTF-8 string containing the description
|
|
|
|
* of the hardware of the device used
|
|
|
|
* to capture data.
|
|
|
|
* "Broadcom NetXtreme" /
|
|
|
|
* "Intel(R) PRO/1000 MT Network Connection" /
|
|
|
|
* "NETGEAR WNA1000Mv2 N150 Wireless USB Micro Adapter"
|
|
|
|
*/
|
|
|
|
|
2016-06-06 00:21:23 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
#define OPT_NS_DNSNAME 2
|
|
|
|
#define OPT_NS_DNSIP4ADDR 3
|
|
|
|
#define OPT_NS_DNSIP6ADDR 4
|
|
|
|
|
2016-07-15 20:57:35 +00:00
|
|
|
#define OPT_ISB_STARTTIME 2
|
|
|
|
#define OPT_ISB_ENDTIME 3
|
|
|
|
#define OPT_ISB_IFRECV 4
|
|
|
|
#define OPT_ISB_IFDROP 5
|
|
|
|
#define OPT_ISB_FILTERACCEPT 6
|
|
|
|
#define OPT_ISB_OSDROP 7
|
|
|
|
#define OPT_ISB_USRDELIV 8
|
2016-06-06 00:21:23 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
struct wtap_block;
|
|
|
|
typedef struct wtap_block *wtap_block_t;
|
2016-03-04 13:52:48 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/*
|
|
|
|
* Currently supported blocks; these are not the pcapng block type values
|
2021-02-09 21:40:59 +00:00
|
|
|
* for them, they're identifiers used internally, and more than one
|
|
|
|
* pcapng block type may use a given block type.
|
|
|
|
*
|
wiretap: have file handlers advertise blocks and options supported.
Instead of a "supports name resolution" Boolean and bitflags for types of
comments supported, provide a list of block types that the file
type/subtype supports, with each block type having a list of options
supported. Indicate whether "supported" means "one instance" or
"multiple instances".
"Supports" doesn't just mean "can be written", it also means "could be
read".
Rename WTAP_BLOCK_IF_DESCRIPTION to WTAP_BLOCK_IF_ID_AND_INFO, to
indicate that it provides, in addition to information about the
interface, an ID (implicitly, in pcapng files, by its ordinal number)
that is associated with every packet in the file. Emphasize that in
comments - just because your capture file format can list the interfaces
on which a capture was done, that doesn't mean it supports this; it
doesn't do so if the file doesn't indicate, for every packet, on which
of those interfaces it was captured (I'm looking at *you*, Microsoft
Network Monitor...).
Use APIs to query that information to do what the "does this file
type/subtype support name resolution information", "does this file
type/subtype support all of these comment types", and "does this file
type/subtype support - and require - interface IDs" APIs did.
Provide backwards compatibility for Lua.
This allows us to eliminate the WTAP_FILE_TYPE_SUBTYPE_ values for IBM's
iptrace; do so.
2021-02-21 22:18:04 +00:00
|
|
|
* Note that, in a given file format, this information won't necessarily
|
|
|
|
* appear in the form of blocks in the file, even though they're presented
|
|
|
|
* to the caller of libwiretap as blocks when reading and and are presented
|
|
|
|
* by the caller of libwiretap as blocks when writing. See, for example,
|
|
|
|
* the iptrace file format, in which the interface name is given as part
|
|
|
|
* of the packet record header; we synthesize those blocks when reading
|
|
|
|
* (we don't currently support writing that format, but if we did, we'd
|
|
|
|
* get the interface name from the block and put it in the packet record
|
|
|
|
* header).
|
|
|
|
*
|
|
|
|
* WTAP_BLOCK_IF_ID_AND_INFO is a block that not only gives
|
|
|
|
* descriptive information about an interface but *also* assigns an
|
|
|
|
* ID to the interface, so that every packet has either an explicit
|
|
|
|
* or implicit interface ID indicating on which the packet arrived.
|
|
|
|
*
|
|
|
|
* It does *not* refer to information about interfaces that does not
|
|
|
|
* allow identification of the interface on which a packet arrives
|
|
|
|
* (I'm looking at *you*, Microsoft Network Monitor...). Do *not*
|
|
|
|
* indicate support for that block if your capture format merely
|
|
|
|
* gives a list of interface information without having every packet
|
|
|
|
* explicitly or implicitly (as in, for example, the pcapng Simple
|
|
|
|
* Packet Block) indicate on which of those interfaces the packet
|
|
|
|
* arrived.
|
|
|
|
*
|
2021-02-09 21:40:59 +00:00
|
|
|
* WTAP_BLOCK_PACKET (which corresponds to the Enhanced Packet Block,
|
|
|
|
* the Simple Packet Block, and the deprecated Packet Block) is not
|
2021-02-24 11:09:03 +00:00
|
|
|
* currently used; it's reserved for future use. The same applies
|
2021-06-17 20:52:45 +00:00
|
|
|
* to WTAP_BLOCK_SYSTEMD_JOURNAL_EXPORT.
|
2016-07-14 23:01:57 +00:00
|
|
|
*/
|
2016-01-26 01:17:21 +00:00
|
|
|
typedef enum {
|
2021-02-09 21:40:59 +00:00
|
|
|
WTAP_BLOCK_SECTION = 0,
|
wiretap: have file handlers advertise blocks and options supported.
Instead of a "supports name resolution" Boolean and bitflags for types of
comments supported, provide a list of block types that the file
type/subtype supports, with each block type having a list of options
supported. Indicate whether "supported" means "one instance" or
"multiple instances".
"Supports" doesn't just mean "can be written", it also means "could be
read".
Rename WTAP_BLOCK_IF_DESCRIPTION to WTAP_BLOCK_IF_ID_AND_INFO, to
indicate that it provides, in addition to information about the
interface, an ID (implicitly, in pcapng files, by its ordinal number)
that is associated with every packet in the file. Emphasize that in
comments - just because your capture file format can list the interfaces
on which a capture was done, that doesn't mean it supports this; it
doesn't do so if the file doesn't indicate, for every packet, on which
of those interfaces it was captured (I'm looking at *you*, Microsoft
Network Monitor...).
Use APIs to query that information to do what the "does this file
type/subtype support name resolution information", "does this file
type/subtype support all of these comment types", and "does this file
type/subtype support - and require - interface IDs" APIs did.
Provide backwards compatibility for Lua.
This allows us to eliminate the WTAP_FILE_TYPE_SUBTYPE_ values for IBM's
iptrace; do so.
2021-02-21 22:18:04 +00:00
|
|
|
WTAP_BLOCK_IF_ID_AND_INFO,
|
2021-02-09 21:40:59 +00:00
|
|
|
WTAP_BLOCK_NAME_RESOLUTION,
|
|
|
|
WTAP_BLOCK_IF_STATISTICS,
|
|
|
|
WTAP_BLOCK_DECRYPTION_SECRETS,
|
|
|
|
WTAP_BLOCK_PACKET,
|
Remove the existing "custom block" mechanism:
For most file types, blocks for which we don't have a wtap_block_type_t
aren't "custom", they're just "file-type specific". Add
WTAP_BLOCK_FT_SPECIFIC_REPORT and WTAP_BLOCK_FT_SPECIFIC_EVENT block
types; the "mandatory" part of those blocks includes a
file-type-specific block type value, with specific values assigned to
specific block types (either as part of the file type's definition, or
by us if necessary).
For pcapng files, blocks for which we don't have a wtap_block_type_t are
either "local" (block type has the high-order bit set), are defined in
the current spec but aren't supported yet (which we should fix), or are
*not* defined in the current spec and are *not* "local" (in which case
whoever's using the block number should submit a pull request to the
spec to register the block type *and* give it a specification, so we can
add support). For "local" block types and for not-yet-supported
non-"local" block types, they should be handled as file-type-specific
blocks with the file-type-specific block value being the pcapng block
type code, with plugin support in the pcapng code to read *and* write
those blocks.
Move the structures for the "mandatory" parts of blocks to
wiretap/wtap_opttypes.h, right after the definition of
wtap_block_type_t.
2021-02-10 07:21:49 +00:00
|
|
|
WTAP_BLOCK_FT_SPECIFIC_REPORT,
|
|
|
|
WTAP_BLOCK_FT_SPECIFIC_EVENT,
|
2021-06-17 20:52:45 +00:00
|
|
|
WTAP_BLOCK_SYSTEMD_JOURNAL_EXPORT,
|
2021-06-17 22:04:44 +00:00
|
|
|
WTAP_BLOCK_CUSTOM,
|
Remove the existing "custom block" mechanism:
For most file types, blocks for which we don't have a wtap_block_type_t
aren't "custom", they're just "file-type specific". Add
WTAP_BLOCK_FT_SPECIFIC_REPORT and WTAP_BLOCK_FT_SPECIFIC_EVENT block
types; the "mandatory" part of those blocks includes a
file-type-specific block type value, with specific values assigned to
specific block types (either as part of the file type's definition, or
by us if necessary).
For pcapng files, blocks for which we don't have a wtap_block_type_t are
either "local" (block type has the high-order bit set), are defined in
the current spec but aren't supported yet (which we should fix), or are
*not* defined in the current spec and are *not* "local" (in which case
whoever's using the block number should submit a pull request to the
spec to register the block type *and* give it a specification, so we can
add support). For "local" block types and for not-yet-supported
non-"local" block types, they should be handled as file-type-specific
blocks with the file-type-specific block value being the pcapng block
type code, with plugin support in the pcapng code to read *and* write
those blocks.
Move the structures for the "mandatory" parts of blocks to
wiretap/wtap_opttypes.h, right after the definition of
wtap_block_type_t.
2021-02-10 07:21:49 +00:00
|
|
|
MAX_WTAP_BLOCK_TYPE_VALUE
|
2016-07-14 23:01:57 +00:00
|
|
|
} wtap_block_type_t;
|
2016-01-26 01:17:21 +00:00
|
|
|
|
Remove the existing "custom block" mechanism:
For most file types, blocks for which we don't have a wtap_block_type_t
aren't "custom", they're just "file-type specific". Add
WTAP_BLOCK_FT_SPECIFIC_REPORT and WTAP_BLOCK_FT_SPECIFIC_EVENT block
types; the "mandatory" part of those blocks includes a
file-type-specific block type value, with specific values assigned to
specific block types (either as part of the file type's definition, or
by us if necessary).
For pcapng files, blocks for which we don't have a wtap_block_type_t are
either "local" (block type has the high-order bit set), are defined in
the current spec but aren't supported yet (which we should fix), or are
*not* defined in the current spec and are *not* "local" (in which case
whoever's using the block number should submit a pull request to the
spec to register the block type *and* give it a specification, so we can
add support). For "local" block types and for not-yet-supported
non-"local" block types, they should be handled as file-type-specific
blocks with the file-type-specific block value being the pcapng block
type code, with plugin support in the pcapng code to read *and* write
those blocks.
Move the structures for the "mandatory" parts of blocks to
wiretap/wtap_opttypes.h, right after the definition of
wtap_block_type_t.
2021-02-10 07:21:49 +00:00
|
|
|
/**
|
|
|
|
* Holds the required data from a WTAP_BLOCK_SECTION.
|
|
|
|
*/
|
|
|
|
typedef struct wtapng_section_mandatory_s {
|
|
|
|
guint64 section_length; /**< 64-bit value specifying the length in bytes of the
|
|
|
|
* following section.
|
|
|
|
* Section Length equal -1 (0xFFFFFFFFFFFFFFFF) means
|
|
|
|
* that the size of the section is not specified
|
|
|
|
* Note: if writing to a new file, this length will
|
|
|
|
* be invalid if anything changes, such as the other
|
|
|
|
* members of this struct, or the packets written.
|
|
|
|
*/
|
2021-05-24 09:25:02 +00:00
|
|
|
} wtapng_section_mandatory_t;
|
Remove the existing "custom block" mechanism:
For most file types, blocks for which we don't have a wtap_block_type_t
aren't "custom", they're just "file-type specific". Add
WTAP_BLOCK_FT_SPECIFIC_REPORT and WTAP_BLOCK_FT_SPECIFIC_EVENT block
types; the "mandatory" part of those blocks includes a
file-type-specific block type value, with specific values assigned to
specific block types (either as part of the file type's definition, or
by us if necessary).
For pcapng files, blocks for which we don't have a wtap_block_type_t are
either "local" (block type has the high-order bit set), are defined in
the current spec but aren't supported yet (which we should fix), or are
*not* defined in the current spec and are *not* "local" (in which case
whoever's using the block number should submit a pull request to the
spec to register the block type *and* give it a specification, so we can
add support). For "local" block types and for not-yet-supported
non-"local" block types, they should be handled as file-type-specific
blocks with the file-type-specific block value being the pcapng block
type code, with plugin support in the pcapng code to read *and* write
those blocks.
Move the structures for the "mandatory" parts of blocks to
wiretap/wtap_opttypes.h, right after the definition of
wtap_block_type_t.
2021-02-10 07:21:49 +00:00
|
|
|
|
wiretap: have file handlers advertise blocks and options supported.
Instead of a "supports name resolution" Boolean and bitflags for types of
comments supported, provide a list of block types that the file
type/subtype supports, with each block type having a list of options
supported. Indicate whether "supported" means "one instance" or
"multiple instances".
"Supports" doesn't just mean "can be written", it also means "could be
read".
Rename WTAP_BLOCK_IF_DESCRIPTION to WTAP_BLOCK_IF_ID_AND_INFO, to
indicate that it provides, in addition to information about the
interface, an ID (implicitly, in pcapng files, by its ordinal number)
that is associated with every packet in the file. Emphasize that in
comments - just because your capture file format can list the interfaces
on which a capture was done, that doesn't mean it supports this; it
doesn't do so if the file doesn't indicate, for every packet, on which
of those interfaces it was captured (I'm looking at *you*, Microsoft
Network Monitor...).
Use APIs to query that information to do what the "does this file
type/subtype support name resolution information", "does this file
type/subtype support all of these comment types", and "does this file
type/subtype support - and require - interface IDs" APIs did.
Provide backwards compatibility for Lua.
This allows us to eliminate the WTAP_FILE_TYPE_SUBTYPE_ values for IBM's
iptrace; do so.
2021-02-21 22:18:04 +00:00
|
|
|
/** struct holding the information to build an WTAP_BLOCK_IF_ID_AND_INFO.
|
Remove the existing "custom block" mechanism:
For most file types, blocks for which we don't have a wtap_block_type_t
aren't "custom", they're just "file-type specific". Add
WTAP_BLOCK_FT_SPECIFIC_REPORT and WTAP_BLOCK_FT_SPECIFIC_EVENT block
types; the "mandatory" part of those blocks includes a
file-type-specific block type value, with specific values assigned to
specific block types (either as part of the file type's definition, or
by us if necessary).
For pcapng files, blocks for which we don't have a wtap_block_type_t are
either "local" (block type has the high-order bit set), are defined in
the current spec but aren't supported yet (which we should fix), or are
*not* defined in the current spec and are *not* "local" (in which case
whoever's using the block number should submit a pull request to the
spec to register the block type *and* give it a specification, so we can
add support). For "local" block types and for not-yet-supported
non-"local" block types, they should be handled as file-type-specific
blocks with the file-type-specific block value being the pcapng block
type code, with plugin support in the pcapng code to read *and* write
those blocks.
Move the structures for the "mandatory" parts of blocks to
wiretap/wtap_opttypes.h, right after the definition of
wtap_block_type_t.
2021-02-10 07:21:49 +00:00
|
|
|
* the interface_data array holds an array of wtap_block_t
|
|
|
|
* representing interfacs, one per interface.
|
|
|
|
*/
|
|
|
|
typedef struct wtapng_iface_descriptions_s {
|
|
|
|
GArray *interface_data;
|
|
|
|
} wtapng_iface_descriptions_t;
|
|
|
|
|
|
|
|
/**
|
wiretap: have file handlers advertise blocks and options supported.
Instead of a "supports name resolution" Boolean and bitflags for types of
comments supported, provide a list of block types that the file
type/subtype supports, with each block type having a list of options
supported. Indicate whether "supported" means "one instance" or
"multiple instances".
"Supports" doesn't just mean "can be written", it also means "could be
read".
Rename WTAP_BLOCK_IF_DESCRIPTION to WTAP_BLOCK_IF_ID_AND_INFO, to
indicate that it provides, in addition to information about the
interface, an ID (implicitly, in pcapng files, by its ordinal number)
that is associated with every packet in the file. Emphasize that in
comments - just because your capture file format can list the interfaces
on which a capture was done, that doesn't mean it supports this; it
doesn't do so if the file doesn't indicate, for every packet, on which
of those interfaces it was captured (I'm looking at *you*, Microsoft
Network Monitor...).
Use APIs to query that information to do what the "does this file
type/subtype support name resolution information", "does this file
type/subtype support all of these comment types", and "does this file
type/subtype support - and require - interface IDs" APIs did.
Provide backwards compatibility for Lua.
This allows us to eliminate the WTAP_FILE_TYPE_SUBTYPE_ values for IBM's
iptrace; do so.
2021-02-21 22:18:04 +00:00
|
|
|
* Holds the required data from a WTAP_BLOCK_IF_ID_AND_INFO.
|
Remove the existing "custom block" mechanism:
For most file types, blocks for which we don't have a wtap_block_type_t
aren't "custom", they're just "file-type specific". Add
WTAP_BLOCK_FT_SPECIFIC_REPORT and WTAP_BLOCK_FT_SPECIFIC_EVENT block
types; the "mandatory" part of those blocks includes a
file-type-specific block type value, with specific values assigned to
specific block types (either as part of the file type's definition, or
by us if necessary).
For pcapng files, blocks for which we don't have a wtap_block_type_t are
either "local" (block type has the high-order bit set), are defined in
the current spec but aren't supported yet (which we should fix), or are
*not* defined in the current spec and are *not* "local" (in which case
whoever's using the block number should submit a pull request to the
spec to register the block type *and* give it a specification, so we can
add support). For "local" block types and for not-yet-supported
non-"local" block types, they should be handled as file-type-specific
blocks with the file-type-specific block value being the pcapng block
type code, with plugin support in the pcapng code to read *and* write
those blocks.
Move the structures for the "mandatory" parts of blocks to
wiretap/wtap_opttypes.h, right after the definition of
wtap_block_type_t.
2021-02-10 07:21:49 +00:00
|
|
|
*/
|
|
|
|
typedef struct wtapng_if_descr_mandatory_s {
|
|
|
|
int wtap_encap; /**< link_type translated to wtap_encap */
|
|
|
|
guint64 time_units_per_second;
|
|
|
|
int tsprecision; /**< WTAP_TSPREC_ value for this interface */
|
|
|
|
|
|
|
|
guint32 snap_len;
|
|
|
|
|
|
|
|
guint8 num_stat_entries;
|
|
|
|
GArray *interface_statistics; /**< An array holding the interface statistics from
|
|
|
|
* pcapng ISB:s or equivalent(?)*/
|
|
|
|
} wtapng_if_descr_mandatory_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Holds the required data from a WTAP_BLOCK_IF_STATISTICS.
|
|
|
|
*/
|
|
|
|
typedef struct wtapng_if_stats_mandatory_s {
|
|
|
|
guint32 interface_id;
|
|
|
|
guint32 ts_high;
|
|
|
|
guint32 ts_low;
|
|
|
|
} wtapng_if_stats_mandatory_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Holds the required data from a WTAP_BLOCK_DECRYPTION_SECRETS.
|
|
|
|
*/
|
|
|
|
typedef struct wtapng_dsb_mandatory_s {
|
|
|
|
guint32 secrets_type; /** Type of secrets stored in data (see secrets-types.h) */
|
|
|
|
guint32 secrets_len; /** Length of the secrets data in bytes */
|
|
|
|
guint8 *secrets_data; /** Buffer of secrets (not NUL-terminated) */
|
|
|
|
} wtapng_dsb_mandatory_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Holds the required data from a WTAP_BLOCK_FT_SPECIFIC_REPORT.
|
|
|
|
*/
|
|
|
|
typedef struct wtapng_ft_specific_mandatory_s {
|
|
|
|
guint record_type; /* the type of record this is - file type-specific value */
|
|
|
|
} wtapng_ft_specific_mandatory_t;
|
|
|
|
|
2016-01-26 01:17:21 +00:00
|
|
|
/* Currently supported option types */
|
|
|
|
typedef enum {
|
|
|
|
WTAP_OPTTYPE_UINT8,
|
|
|
|
WTAP_OPTTYPE_UINT64,
|
|
|
|
WTAP_OPTTYPE_STRING,
|
2016-07-14 23:01:57 +00:00
|
|
|
WTAP_OPTTYPE_IPv4,
|
|
|
|
WTAP_OPTTYPE_IPv6,
|
2021-02-01 23:56:47 +00:00
|
|
|
WTAP_OPTTYPE_IF_FILTER
|
2016-01-26 01:17:21 +00:00
|
|
|
} wtap_opttype_e;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
WTAP_OPTTYPE_SUCCESS = 0,
|
2016-07-14 23:01:57 +00:00
|
|
|
WTAP_OPTTYPE_NO_SUCH_OPTION = -1,
|
|
|
|
WTAP_OPTTYPE_NOT_FOUND = -2,
|
|
|
|
WTAP_OPTTYPE_TYPE_MISMATCH = -3,
|
|
|
|
WTAP_OPTTYPE_NUMBER_MISMATCH = -4,
|
2017-02-20 13:24:30 +00:00
|
|
|
WTAP_OPTTYPE_ALREADY_EXISTS = -5
|
2016-01-26 01:17:21 +00:00
|
|
|
} wtap_opttype_return_val;
|
|
|
|
|
2021-02-01 23:56:47 +00:00
|
|
|
/* Interface description data - if_filter option structure */
|
|
|
|
|
|
|
|
/* BPF instruction */
|
|
|
|
typedef struct wtap_bpf_insn_s {
|
|
|
|
guint16 code;
|
|
|
|
guint8 jt;
|
|
|
|
guint8 jf;
|
|
|
|
guint32 k;
|
|
|
|
} wtap_bpf_insn_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Type of filter.
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
if_filter_pcap = 0, /* pcap filter string */
|
|
|
|
if_filter_bpf = 1 /* BPF program */
|
|
|
|
} if_filter_type_e;
|
|
|
|
|
|
|
|
typedef struct if_filter_opt_s {
|
|
|
|
if_filter_type_e type;
|
|
|
|
union {
|
|
|
|
gchar *filter_str; /**< pcap filter string */
|
|
|
|
struct wtap_bpf_insns {
|
|
|
|
guint bpf_prog_len; /**< number of BPF instructions */
|
|
|
|
wtap_bpf_insn_t *bpf_prog; /**< BPF instructions */
|
|
|
|
} bpf_prog; /**< BPF program */
|
|
|
|
} data;
|
|
|
|
} if_filter_opt_t;
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/*
|
|
|
|
* Structure describing a value of an option.
|
|
|
|
*/
|
2016-03-04 13:52:48 +00:00
|
|
|
typedef union {
|
|
|
|
guint8 uint8val;
|
|
|
|
guint64 uint64val;
|
2016-07-14 23:01:57 +00:00
|
|
|
guint32 ipv4val; /* network byte order */
|
2017-10-26 08:50:00 +00:00
|
|
|
ws_in6_addr ipv6val;
|
2016-03-04 13:52:48 +00:00
|
|
|
char *stringval;
|
2021-02-01 23:56:47 +00:00
|
|
|
if_filter_opt_t if_filterval;
|
2016-07-14 23:01:57 +00:00
|
|
|
} wtap_optval_t;
|
2016-03-04 13:52:48 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/*
|
|
|
|
* Structure describing an option in a block.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
guint option_id; /**< option code for the option */
|
|
|
|
wtap_optval_t value; /**< value */
|
|
|
|
} wtap_option_t;
|
2016-03-04 13:52:48 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
struct wtap_dumper;
|
2016-03-04 13:52:48 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
typedef void (*wtap_block_create_func)(wtap_block_t block);
|
|
|
|
typedef void (*wtap_mand_free_func)(wtap_block_t block);
|
|
|
|
typedef void (*wtap_mand_copy_func)(wtap_block_t dest_block, wtap_block_t src_block);
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Initialize block types.
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
|
|
|
* This is currently just a placeholder as nothing needs to be
|
|
|
|
* initialized yet. Should handle "registration" when code is
|
|
|
|
* refactored to do so.
|
|
|
|
*/
|
2016-06-15 23:25:03 +00:00
|
|
|
WS_DLL_PUBLIC void wtap_opttypes_initialize(void);
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Create a block by type
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
2016-07-14 23:01:57 +00:00
|
|
|
* Return a newly allocated block with default options provided
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
2016-07-14 23:01:57 +00:00
|
|
|
* @param[in] block_type Block type to be created
|
|
|
|
* @return Newly allocated block
|
2016-01-26 01:17:21 +00:00
|
|
|
*/
|
2016-07-14 23:01:57 +00:00
|
|
|
WS_DLL_PUBLIC wtap_block_t wtap_block_create(wtap_block_type_t block_type);
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Free a block
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
2016-07-14 23:01:57 +00:00
|
|
|
* Needs to be called to clean up any allocated block
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
|
|
|
* @param[in] block Block to be freed
|
|
|
|
*/
|
2016-07-14 23:01:57 +00:00
|
|
|
WS_DLL_PUBLIC void wtap_block_free(wtap_block_t block);
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Free an array of blocks
|
2016-05-31 03:42:41 +00:00
|
|
|
*
|
2016-07-14 23:01:57 +00:00
|
|
|
* Needs to be called to clean up blocks allocated
|
2016-05-31 03:42:41 +00:00
|
|
|
* through GArray (for multiple blocks of same type)
|
|
|
|
* Includes freeing the GArray
|
|
|
|
*
|
|
|
|
* @param[in] block_array Array of blocks to be freed
|
|
|
|
*/
|
2016-07-14 23:01:57 +00:00
|
|
|
WS_DLL_PUBLIC void wtap_block_array_free(GArray* block_array);
|
2016-05-31 03:42:41 +00:00
|
|
|
|
2021-02-10 02:46:29 +00:00
|
|
|
/** Provide type of a block
|
|
|
|
*
|
|
|
|
* @param[in] block Block from which to retrieve mandatory data
|
|
|
|
* @return Block type.
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_block_type_t wtap_block_get_type(wtap_block_t block);
|
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Provide mandatory data of a block
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
2016-05-30 22:22:15 +00:00
|
|
|
* @param[in] block Block from which to retrieve mandatory data
|
2016-07-14 23:01:57 +00:00
|
|
|
* @return Block mandatory data. Structure varies based on block type
|
2016-01-26 01:17:21 +00:00
|
|
|
*/
|
2016-07-14 23:01:57 +00:00
|
|
|
WS_DLL_PUBLIC void* wtap_block_get_mandatory_data(wtap_block_t block);
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Add UINT8 option value to a block
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
2016-07-14 23:01:57 +00:00
|
|
|
* @param[in] block Block to which to add the option
|
2016-01-26 01:17:21 +00:00
|
|
|
* @param[in] option_id Identifier value for option
|
2016-07-14 23:01:57 +00:00
|
|
|
* @param[in] value Value of option
|
2016-05-30 22:22:15 +00:00
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
2016-01-26 01:17:21 +00:00
|
|
|
*/
|
2016-05-30 22:22:15 +00:00
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
2016-07-14 23:01:57 +00:00
|
|
|
wtap_block_add_uint8_option(wtap_block_t block, guint option_id, guint8 value);
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Set UINT8 option value in a block
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
2016-05-30 22:22:15 +00:00
|
|
|
* @param[in] block Block in which to set the option value
|
2016-01-26 01:17:21 +00:00
|
|
|
* @param[in] option_id Identifier value for option
|
2016-03-04 13:52:48 +00:00
|
|
|
* @param[in] value New value of option
|
2016-05-30 22:22:15 +00:00
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
2016-01-26 01:17:21 +00:00
|
|
|
*/
|
2016-05-30 22:22:15 +00:00
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
2016-07-14 23:01:57 +00:00
|
|
|
wtap_block_set_uint8_option_value(wtap_block_t block, guint option_id, guint8 value);
|
|
|
|
|
|
|
|
/** Get UINT8 option value from a block
|
|
|
|
*
|
|
|
|
* @param[in] block Block from which to get the option value
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @param[out] value Returned value of option
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
|
|
|
wtap_block_get_uint8_option_value(wtap_block_t block, guint option_id, guint8* value) G_GNUC_WARN_UNUSED_RESULT;
|
|
|
|
|
|
|
|
/** Add UINT64 option value to a block
|
|
|
|
*
|
|
|
|
* @param[in] block Block to which to add the option
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @param[in] value Value of option
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
|
|
|
wtap_block_add_uint64_option(wtap_block_t block, guint option_id, guint64 value);
|
2016-05-20 02:28:43 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Set UINT64 option value in a block
|
2016-05-20 02:28:43 +00:00
|
|
|
*
|
2016-05-30 22:22:15 +00:00
|
|
|
* @param[in] block Block in which to set the option value
|
2016-05-20 02:28:43 +00:00
|
|
|
* @param[in] option_id Identifier value for option
|
2016-07-14 23:01:57 +00:00
|
|
|
* @param[in] value New value of option
|
2016-05-30 22:22:15 +00:00
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
2016-05-20 02:28:43 +00:00
|
|
|
*/
|
2016-05-30 22:22:15 +00:00
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
2016-07-14 23:01:57 +00:00
|
|
|
wtap_block_set_uint64_option_value(wtap_block_t block, guint option_id, guint64 value);
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Get UINT64 option value from a block
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
2016-05-30 22:22:15 +00:00
|
|
|
* @param[in] block Block from which to get the option value
|
2016-01-26 01:17:21 +00:00
|
|
|
* @param[in] option_id Identifier value for option
|
2016-03-04 13:52:48 +00:00
|
|
|
* @param[out] value Returned value of option
|
2016-05-30 22:22:15 +00:00
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
2016-01-26 01:17:21 +00:00
|
|
|
*/
|
2016-05-30 22:22:15 +00:00
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
2016-07-14 23:01:57 +00:00
|
|
|
wtap_block_get_uint64_option_value(wtap_block_t block, guint option_id, guint64* value) G_GNUC_WARN_UNUSED_RESULT;
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Add IPv4 address option value to a block
|
2016-06-06 01:04:23 +00:00
|
|
|
*
|
2016-07-14 23:01:57 +00:00
|
|
|
* @param[in] block Block to which to add the option
|
2016-06-06 01:04:23 +00:00
|
|
|
* @param[in] option_id Identifier value for option
|
2016-07-14 23:01:57 +00:00
|
|
|
* @param[in] value Value of option
|
2016-06-06 01:04:23 +00:00
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
2016-07-14 23:01:57 +00:00
|
|
|
wtap_block_add_ipv4_option(wtap_block_t block, guint option_id, guint32 value);
|
2016-06-06 01:04:23 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Set IPv4 option value in a block
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
2016-05-30 22:22:15 +00:00
|
|
|
* @param[in] block Block in which to set the option value
|
2016-01-26 01:17:21 +00:00
|
|
|
* @param[in] option_id Identifier value for option
|
2016-03-04 13:52:48 +00:00
|
|
|
* @param[in] value New value of option
|
2016-05-30 22:22:15 +00:00
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
2016-01-26 01:17:21 +00:00
|
|
|
*/
|
2016-05-30 22:22:15 +00:00
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
2016-07-14 23:01:57 +00:00
|
|
|
wtap_block_set_ipv4_option_value(wtap_block_t block, guint option_id, guint32 value);
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Get IPv4 option value from a block
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
2016-05-30 22:22:15 +00:00
|
|
|
* @param[in] block Block from which to get the option value
|
2016-01-26 01:17:21 +00:00
|
|
|
* @param[in] option_id Identifier value for option
|
2016-03-04 13:52:48 +00:00
|
|
|
* @param[out] value Returned value of option
|
2016-05-30 22:22:15 +00:00
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
2016-01-26 01:17:21 +00:00
|
|
|
*/
|
2016-05-30 22:22:15 +00:00
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
2016-07-14 23:01:57 +00:00
|
|
|
wtap_block_get_ipv4_option_value(wtap_block_t block, guint option_id, guint32* value) G_GNUC_WARN_UNUSED_RESULT;
|
|
|
|
|
|
|
|
/** Add IPv6 address option value to a block
|
|
|
|
*
|
|
|
|
* @param[in] block Block to which to add the option
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @param[in] value Value of option
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
2017-10-26 08:50:00 +00:00
|
|
|
wtap_block_add_ipv6_option(wtap_block_t block, guint option_id, ws_in6_addr *value);
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Set IPv6 option value in a block
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
2016-05-30 22:22:15 +00:00
|
|
|
* @param[in] block Block in which to set the option value
|
2016-01-26 01:17:21 +00:00
|
|
|
* @param[in] option_id Identifier value for option
|
2016-03-04 13:52:48 +00:00
|
|
|
* @param[in] value New value of option
|
2016-05-30 22:22:15 +00:00
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
2016-01-26 01:17:21 +00:00
|
|
|
*/
|
2016-05-30 22:22:15 +00:00
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
2017-10-26 08:50:00 +00:00
|
|
|
wtap_block_set_ipv6_option_value(wtap_block_t block, guint option_id, ws_in6_addr *value);
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Get IPv6 option value from a block
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
2016-05-30 22:22:15 +00:00
|
|
|
* @param[in] block Block from which to get the option value
|
2016-01-26 01:17:21 +00:00
|
|
|
* @param[in] option_id Identifier value for option
|
2016-03-04 13:52:48 +00:00
|
|
|
* @param[out] value Returned value of option
|
2016-05-30 22:22:15 +00:00
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
2016-01-26 01:17:21 +00:00
|
|
|
*/
|
2016-05-30 22:22:15 +00:00
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
2017-10-26 08:50:00 +00:00
|
|
|
wtap_block_get_ipv6_option_value(wtap_block_t block, guint option_id, ws_in6_addr* value) G_GNUC_WARN_UNUSED_RESULT;
|
2016-07-14 23:01:57 +00:00
|
|
|
|
|
|
|
/** Add a string option to a block
|
|
|
|
*
|
|
|
|
* @param[in] block Block to which to add the option
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @param[in] value Value of option
|
|
|
|
* @param[in] value_length Maximum length of string to copy.
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
|
|
|
wtap_block_add_string_option(wtap_block_t block, guint option_id, const char *value, gsize value_length);
|
|
|
|
|
2020-10-10 23:42:05 +00:00
|
|
|
/** Add a string option to a block with a printf-formatted string as its value
|
2016-07-14 23:01:57 +00:00
|
|
|
*
|
|
|
|
* @param[in] block Block to which to add the option
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @param[in] format printf-like format string
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
|
|
|
wtap_block_add_string_option_format(wtap_block_t block, guint option_id, const char *format, ...)
|
|
|
|
G_GNUC_PRINTF(3,4);
|
|
|
|
|
|
|
|
/** Set string option value in a block
|
|
|
|
*
|
|
|
|
* @param[in] block Block in which to set the option value
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @param[in] value New value of option
|
|
|
|
* @param[in] value_length Maximum length of string to copy.
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
|
|
|
wtap_block_set_string_option_value(wtap_block_t block, guint option_id, const char* value, gsize value_length);
|
|
|
|
|
|
|
|
/** Set string option value for nth instance of a particular option in a block
|
|
|
|
*
|
|
|
|
* @param[in] block Block in which to set the option value
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @param[in] idx Instance number of option with that ID
|
|
|
|
* @param[in] value New value of option
|
|
|
|
* @param[in] value_length Maximum length of string to copy.
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
|
|
|
wtap_block_set_nth_string_option_value(wtap_block_t block, guint option_id, guint idx, const char* value, gsize value_length);
|
|
|
|
|
|
|
|
/** Set string option value in a block to a printf-formatted string
|
|
|
|
*
|
|
|
|
* @param[in] block Block in which to set the option value
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @param[in] format printf-like format string
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
|
|
|
wtap_block_set_string_option_value_format(wtap_block_t block, guint option_id, const char *format, ...)
|
|
|
|
G_GNUC_PRINTF(3,4);
|
|
|
|
|
2021-01-30 09:49:45 +00:00
|
|
|
/** Set string option value for nth instance of a particular option in a block
|
|
|
|
* to a printf-formatted string
|
|
|
|
*
|
|
|
|
* @param[in] block Block in which to set the option value
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @param[in] idx Instance number of option with that ID
|
|
|
|
* @param[in] format printf-like format string
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
|
|
|
wtap_block_set_nth_string_option_value_format(wtap_block_t block, guint option_id, guint idx, const char *format, ...)
|
2021-01-30 20:05:54 +00:00
|
|
|
G_GNUC_PRINTF(4,5);
|
2021-01-30 09:49:45 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Get string option value from a block
|
|
|
|
*
|
|
|
|
* @param[in] block Block from which to get the option value
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @param[out] value Returned value of option
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
|
|
|
wtap_block_get_string_option_value(wtap_block_t block, guint option_id, char** value) G_GNUC_WARN_UNUSED_RESULT;
|
|
|
|
|
|
|
|
/** Get string option value for nth instance of a particular option in a block
|
|
|
|
*
|
|
|
|
* @param[in] block Block from which to get the option value
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @param[in] idx Instance number of option with that ID
|
|
|
|
* @param[out] value Returned value of option
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
|
|
|
wtap_block_get_nth_string_option_value(wtap_block_t block, guint option_id, guint idx, char** value) G_GNUC_WARN_UNUSED_RESULT;
|
|
|
|
|
2021-02-01 23:56:47 +00:00
|
|
|
/** Add an if_filter option value to a block
|
2016-07-14 23:01:57 +00:00
|
|
|
*
|
|
|
|
* @param[in] block Block to which to add the option
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @param[in] value Value of option
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
2021-02-01 23:56:47 +00:00
|
|
|
wtap_block_add_if_filter_option(wtap_block_t block, guint option_id, if_filter_opt_t* value);
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2021-02-01 23:56:47 +00:00
|
|
|
/** Set an if_filter option value in a block
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
2016-05-30 22:22:15 +00:00
|
|
|
* @param[in] block Block in which to set the option value
|
2016-01-26 01:17:21 +00:00
|
|
|
* @param[in] option_id Identifier value for option
|
2016-03-04 13:52:48 +00:00
|
|
|
* @param[in] value New value of option
|
2016-05-30 22:22:15 +00:00
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
2016-01-26 01:17:21 +00:00
|
|
|
*/
|
2016-05-30 22:22:15 +00:00
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
2021-02-01 23:56:47 +00:00
|
|
|
wtap_block_set_if_filter_option_value(wtap_block_t block, guint option_id, if_filter_opt_t* value);
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2021-02-01 23:56:47 +00:00
|
|
|
/** Get an if_filter option value from a block
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
2016-05-30 22:22:15 +00:00
|
|
|
* @param[in] block Block from which to get the option value
|
2016-01-26 01:17:21 +00:00
|
|
|
* @param[in] option_id Identifier value for option
|
2021-02-01 23:56:47 +00:00
|
|
|
* @param[out] value Returned value of option value
|
2016-05-30 22:22:15 +00:00
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
2016-01-26 01:17:21 +00:00
|
|
|
*/
|
2016-05-30 22:22:15 +00:00
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
2021-02-01 23:56:47 +00:00
|
|
|
wtap_block_get_if_filter_option_value(wtap_block_t block, guint option_id, if_filter_opt_t* value) G_GNUC_WARN_UNUSED_RESULT;
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2016-07-16 00:25:41 +00:00
|
|
|
/** Remove an option from a block
|
|
|
|
*
|
|
|
|
* @param[in] block Block from which to remove the option
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
|
|
|
wtap_block_remove_option(wtap_block_t block, guint option_id);
|
|
|
|
|
|
|
|
/** Remove the nth instance of an option from a block
|
|
|
|
*
|
|
|
|
* @param[in] block Block from which to remove the option instance
|
|
|
|
* @param[in] option_id Identifier value for option
|
|
|
|
* @param[in] idx Instance number of option with that ID
|
|
|
|
* @return wtap_opttype_return_val - WTAP_OPTTYPE_SUCCESS if successful,
|
|
|
|
* error code otherwise
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_opttype_return_val
|
|
|
|
wtap_block_remove_nth_option_instance(wtap_block_t block, guint option_id,
|
|
|
|
guint idx);
|
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
/** Copy a block to another.
|
2016-01-26 01:17:21 +00:00
|
|
|
*
|
|
|
|
* Any options that are in the destination but not the source are not removed.
|
|
|
|
* Options that are just in source will be added to destination
|
|
|
|
*
|
|
|
|
* @param[in] dest_block Block to be copied to
|
|
|
|
* @param[in] src_block Block to be copied from
|
|
|
|
*/
|
2016-07-14 23:01:57 +00:00
|
|
|
WS_DLL_PUBLIC void wtap_block_copy(wtap_block_t dest_block, wtap_block_t src_block);
|
2016-01-26 01:17:21 +00:00
|
|
|
|
2020-10-22 02:10:49 +00:00
|
|
|
/** Make a copy of a block.
|
|
|
|
*
|
|
|
|
* @param[in] block Block to be copied from
|
|
|
|
* @return Newly allocated copy of that block
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC wtap_block_t wtap_block_make_copy(wtap_block_t block);
|
2016-03-04 13:52:48 +00:00
|
|
|
|
2016-07-14 23:01:57 +00:00
|
|
|
typedef void (*wtap_block_foreach_func)(wtap_block_t block, guint option_id, wtap_opttype_e option_type, wtap_optval_t *option, void *user_data);
|
|
|
|
WS_DLL_PUBLIC void wtap_block_foreach_option(wtap_block_t block, wtap_block_foreach_func func, void* user_data);
|
2016-03-04 13:52:48 +00:00
|
|
|
|
2017-02-04 15:26:34 +00:00
|
|
|
/** Cleanup the internal structures
|
|
|
|
*/
|
|
|
|
WS_DLL_PUBLIC void wtap_opttypes_cleanup(void);
|
|
|
|
|
2016-06-06 00:21:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
2016-05-18 02:50:51 +00:00
|
|
|
|
2016-02-27 08:05:43 +00:00
|
|
|
#endif /* WTAP_OPT_TYPES_H */
|