wiretap: add a routine that adds a wtap_block_t for an IDB to a wtap.

Change-Id: I0a2e09bc3d1a858a304ded0c42be6bf09034812e
Reviewed-on: https://code.wireshark.org/review/37019
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
This commit is contained in:
Guy Harris 2020-05-01 18:19:00 -07:00 committed by Guy Harris
parent 43b945d116
commit 0e0f20bc7d
5 changed files with 15 additions and 4 deletions

View File

@ -2068,7 +2068,7 @@ int erf_populate_interfaces(wtap *wth)
wtap_block_add_string_option_format(int_data, OPT_IDB_NAME, "Port %c", 'A'+i);
wtap_block_add_string_option_format(int_data, OPT_IDB_DESCR, "ERF Interface Id %d (Port %c)", i, 'A'+i);
g_array_append_val(wth->interface_data, int_data);
wtap_add_idb(wth, int_data);
}
return 0;
@ -2499,7 +2499,7 @@ int erf_populate_interface(erf_t *erf_priv, wtap *wth, union wtap_pseudo_header
erf_set_interface_descr(int_data, OPT_IDB_DESCR, host_id, source_id, if_num, NULL);
if_map->interfaces[if_num].if_index = (int) wth->interface_data->len;
g_array_append_val(wth->interface_data, int_data);
wtap_add_idb(wth, int_data);
return if_map->interfaces[if_num].if_index;
}

View File

@ -1159,7 +1159,7 @@ success:
descr_mand->num_stat_entries = 0; /* Number of ISB:s */
descr_mand->interface_statistics = NULL;
g_array_append_val(wth->interface_data, descr);
wtap_add_idb(wth, descr);
}
return wth;

View File

@ -2687,7 +2687,7 @@ pcapng_process_idb(wtap *wth, section_info_t *section_info,
if_descr_mand->num_stat_entries = 0;
if_descr_mand->interface_statistics = NULL;
g_array_append_val(wth->interface_data, int_data);
wtap_add_idb(wth, int_data);
iface_info.wtap_encap = wblock_if_descr_mand->wtap_encap;
iface_info.snap_len = wblock_if_descr_mand->snap_len;

View File

@ -327,6 +327,12 @@ wtap_full_file_read(wtap *wth, wtap_rec *rec, Buffer *buf,
gboolean
wtap_full_file_seek_read(wtap *wth, gint64 seek_off, wtap_rec *rec, Buffer *buf, int *err, gchar **err_info);
/**
* Add an IDB to the interface data for a file.
*/
void
wtap_add_idb(wtap *wth, wtap_block_t idb);
/**
* Invokes the callback with the given decryption secrets block.
*/

View File

@ -155,6 +155,11 @@ wtap_file_get_idb_info(wtap *wth)
return idb_info;
}
void
wtap_add_idb(wtap *wth, wtap_block_t idb)
{
g_array_append_val(wth->interface_data, idb);
}
void
wtap_free_idb_info(wtapng_iface_descriptions_t *idb_info)