aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/snoop.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2021-02-21 14:18:04 -0800
committerGuy Harris <gharris@sonic.net>2021-02-21 23:18:35 +0000
commit842a7cccf9ec96ab7ce8945d4de77537f69efc2f (patch)
tree8e27dfa6aed434b1e0cd5e6ba7a0078c310ab829 /wiretap/snoop.c
parentb8ce02e6fb43dedb8d1a480a154cc7cca0c5c353 (diff)
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.
Diffstat (limited to 'wiretap/snoop.c')
-rw-r--r--wiretap/snoop.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/wiretap/snoop.c b/wiretap/snoop.c
index 6fa7ac9cd7..30cf84648d 100644
--- a/wiretap/snoop.c
+++ b/wiretap/snoop.c
@@ -917,15 +917,29 @@ static gboolean snoop_dump(wtap_dumper *wdh,
return TRUE;
}
+static const struct supported_block_type snoop_blocks_supported[] = {
+ /*
+ * We support packet blocks, with no comments or other options.
+ */
+ { WTAP_BLOCK_PACKET, MULTIPLE_BLOCKS_SUPPORTED, NO_OPTIONS_SUPPORTED }
+};
+
static const struct file_type_subtype_info snoop_info = {
"Sun snoop", "snoop", "snoop", "cap",
- FALSE, FALSE, 0,
+ FALSE, BLOCKS_SUPPORTED(snoop_blocks_supported),
snoop_dump_can_write_encap, snoop_dump_open, NULL
};
+static const struct supported_block_type shomiti_blocks_supported[] = {
+ /*
+ * We support packet blocks, with no comments or other options.
+ */
+ { WTAP_BLOCK_PACKET, MULTIPLE_BLOCKS_SUPPORTED, NO_OPTIONS_SUPPORTED }
+};
+
static const struct file_type_subtype_info shomiti_info = {
"Shomiti/Finisar Surveyor", "shomiti", "cap", NULL,
- FALSE, FALSE, 0,
+ FALSE, BLOCKS_SUPPORTED(shomiti_blocks_supported),
NULL, NULL, NULL
};