2 * capture_file GUI-independent manipulation
3 * Vassilii Khachaturov <vassilii@tarunz.org>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #include <epan/packet.h>
29 #include <wiretap/pcapng.h>
34 cap_file_get_interface_name(void *data, guint32 interface_id)
36 capture_file *cf = (capture_file *) data;
37 wtapng_iface_descriptions_t *idb_info;
38 wtap_block_t wtapng_if_descr = NULL;
41 idb_info = wtap_file_get_idb_info(cf->wth);
43 if (interface_id < idb_info->interface_data->len)
44 wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, interface_id);
48 if (wtapng_if_descr) {
49 if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_NAME, &interface_name) == WTAP_OPTTYPE_SUCCESS)
50 return interface_name;
51 if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &interface_name) == WTAP_OPTTYPE_SUCCESS)
52 return interface_name;
58 cap_file_get_interface_description(void *data, guint32 interface_id)
60 capture_file *cf = (capture_file *) data;
61 wtapng_iface_descriptions_t *idb_info;
62 wtap_block_t wtapng_if_descr = NULL;
65 idb_info = wtap_file_get_idb_info(cf->wth);
67 if (interface_id < idb_info->interface_data->len)
68 wtapng_if_descr = g_array_index(idb_info->interface_data, wtap_block_t, interface_id);
72 if (wtapng_if_descr) {
73 if (wtap_block_get_string_option_value(wtapng_if_descr, OPT_IDB_DESCR, &interface_name) == WTAP_OPTTYPE_SUCCESS)
74 return interface_name;
80 cap_file_init(capture_file *cf)
82 /* Initialize the capture file struct */
83 memset(cf, 0, sizeof(capture_file));
87 * Editor modelines - http://www.wireshark.org/tools/modelines.html
92 * indent-tabs-mode: nil
95 * ex: set shiftwidth=2 tabstop=8 expandtab:
96 * :indentSize=2:tabSize=8:noTabs=true: