FIX bytes highlight ?
[wireshark-wip.git] / cfile.c
blob50c532eb6267038bbe975abfab99b9606847cc79
1 /* cfile.c
2 * capture_file GUI-independent manipulation
3 * Vassilii Khachaturov <vassilii@tarunz.org>
5 * $Id$
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include "config.h"
28 #include <glib.h>
30 #include <epan/packet.h>
32 #include "cfile.h"
34 const char *
35 cap_file_get_interface_name(void *data, guint32 interface_id)
37 capture_file *cf = (capture_file *) data;
38 wtapng_iface_descriptions_t *idb_info;
39 const wtapng_if_descr_t *wtapng_if_descr = NULL;
41 idb_info = wtap_file_get_idb_info(cf->wth);
43 if (interface_id < idb_info->number_of_interfaces)
44 wtapng_if_descr = &g_array_index(idb_info->interface_data, wtapng_if_descr_t, interface_id);
46 g_free(idb_info);
48 if (wtapng_if_descr) {
49 if (wtapng_if_descr->if_name)
50 return wtapng_if_descr->if_name;
51 else if (wtapng_if_descr->if_description)
52 return wtapng_if_descr->if_description;
54 return "unknown";
57 void
58 cap_file_init(capture_file *cf)
60 /* Initialize the capture file struct */
61 memset(cf, 0, sizeof(capture_file));
62 cf->snap = WTAP_MAX_PACKET_SIZE;