aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.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 /tshark.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 'tshark.c')
-rw-r--r--tshark.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tshark.c b/tshark.c
index f8c9646a3e..d71ced4c57 100644
--- a/tshark.c
+++ b/tshark.c
@@ -3287,11 +3287,14 @@ process_new_idbs(wtap *wth, wtap_dumper *pdh, int *err, gchar **err_info)
while ((if_data = wtap_get_next_interface_description(wth)) != NULL) {
/*
- * Only add IDBs if we're writing to a file and the output file
- * requires interface IDs; otherwise, it doesn't support writing IDBs.
+ * Only add interface blocks if the output file supports (meaning
+ * *requires*) them.
+ *
+ * That mean that the abstract interface provided by libwiretap
+ * involves WTAP_BLOCK_IF_ID_AND_INFO blocks.
*/
if (pdh != NULL) {
- if (wtap_uses_interface_ids(wtap_dump_file_type_subtype(pdh))) {
+ if (wtap_file_type_subtype_supports_block(wtap_dump_file_type_subtype(pdh), WTAP_BLOCK_IF_ID_AND_INFO) != BLOCK_NOT_SUPPORTED) {
if (!wtap_dump_add_idb(pdh, if_data, err, err_info))
return FALSE;
}