forked from osmocom/wireshark
58 lines
1.5 KiB
C
58 lines
1.5 KiB
C
|
/* frame_set.c
|
||
|
* fdfdkfslf;ajkdf
|
||
|
*
|
||
|
* Wireshark - Network traffic analyzer
|
||
|
* By Gerald Combs <gerald@wireshark.org>
|
||
|
* Copyright 1998 Gerald Combs
|
||
|
*
|
||
|
* SPDX-License-Identifier: GPL-2.0+
|
||
|
*/
|
||
|
|
||
|
#include <glib.h>
|
||
|
|
||
|
#include <epan/frame_set.h>
|
||
|
|
||
|
const char *
|
||
|
frame_set_get_interface_name(frame_set *fs, guint32 interface_id)
|
||
|
{
|
||
|
wtapng_iface_descriptions_t *idb_info;
|
||
|
wtap_block_t wtapng_if_descr = NULL;
|
||
|
char* interface_name;
|
||
|
|
||
|
idb_info = wtap_file_get_idb_info(fs->wth);
|
||
|
|
||
|
if (interface_id < idb_info->interface_data->len)
|
||
|
wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, interface_id);
|
||
|
|
||
|
g_free(idb_info);
|
||
|
|
||
|
if (wtapng_if_descr) {
|
||
|
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_NAME, &interface_name) == WTAP_OPTTYPE_SUCCESS)
|
||
|
return interface_name;
|
||
|
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &interface_name) == WTAP_OPTTYPE_SUCCESS)
|
||
|
return interface_name;
|
||
|
}
|
||
|
return "unknown";
|
||
|
}
|
||
|
|
||
|
const char *
|
||
|
frame_set_get_interface_description(frame_set *fs, guint32 interface_id)
|
||
|
{
|
||
|
wtapng_iface_descriptions_t *idb_info;
|
||
|
wtap_block_t wtapng_if_descr = NULL;
|
||
|
char* interface_name;
|
||
|
|
||
|
idb_info = wtap_file_get_idb_info(fs->wth);
|
||
|
|
||
|
if (interface_id < idb_info->interface_data->len)
|
||
|
wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, interface_id);
|
||
|
|
||
|
g_free(idb_info);
|
||
|
|
||
|
if (wtapng_if_descr) {
|
||
|
if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &interface_name) == WTAP_OPTTYPE_SUCCESS)
|
||
|
return interface_name;
|
||
|
}
|
||
|
return NULL;
|
||
|
}
|