diff options
author | Guy Harris <guy@alum.mit.edu> | 2020-05-01 18:19:00 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2020-05-02 02:50:50 +0000 |
commit | 0e0f20bc7d9cd3f41cea1ad58b2cd71e849aab2e (patch) | |
tree | a9cd8d4f1b6f4372d5d4a2c51cbf5c822c7eb837 /wiretap | |
parent | 43b945d11658d1a5d0099198d275a0092d71f5b2 (diff) |
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>
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/erf.c | 4 | ||||
-rw-r--r-- | wiretap/file_access.c | 2 | ||||
-rw-r--r-- | wiretap/pcapng.c | 2 | ||||
-rw-r--r-- | wiretap/wtap-int.h | 6 | ||||
-rw-r--r-- | wiretap/wtap.c | 5 |
5 files changed, 15 insertions, 4 deletions
diff --git a/wiretap/erf.c b/wiretap/erf.c index 6f68b03577..b56c180c5f 100644 --- a/wiretap/erf.c +++ b/wiretap/erf.c @@ -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; } diff --git a/wiretap/file_access.c b/wiretap/file_access.c index edb83a15b5..5a49a38fd2 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -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; diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index 9ac8b30933..53cf4acf71 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -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; diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h index 11cf310809..898e8b414e 100644 --- a/wiretap/wtap-int.h +++ b/wiretap/wtap-int.h @@ -328,6 +328,12 @@ 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. */ void diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 3d9ebb44af..e6996534b0 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -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) |