Fix some copy+pasted tooltip text.
[metze/wireshark/wip.git] / cfile.c
1 /* cfile.c
2  * capture_file GUI-independent manipulation
3  * Vassilii Khachaturov <vassilii@tarunz.org>
4  *
5  * Wireshark - Network traffic analyzer
6  * By Gerald Combs <gerald@wireshark.org>
7  * Copyright 1998 Gerald Combs
8  *
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.
13  *
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.
18  *
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.
22  */
23
24 #include <config.h>
25
26 #include <glib.h>
27
28 #include <epan/packet.h>
29
30 #include "cfile.h"
31
32 const char *
33 cap_file_get_interface_name(void *data, guint32 interface_id)
34 {
35   capture_file *cf = (capture_file *) data;
36   wtapng_iface_descriptions_t *idb_info;
37   const wtapng_if_descr_t *wtapng_if_descr = NULL;
38
39   idb_info = wtap_file_get_idb_info(cf->wth);
40
41   if (interface_id < idb_info->interface_data->len)
42     wtapng_if_descr = &g_array_index(idb_info->interface_data, wtapng_if_descr_t, interface_id);
43
44   g_free(idb_info);
45
46   if (wtapng_if_descr) {
47     if (wtapng_if_descr->if_name)
48       return wtapng_if_descr->if_name;
49     else if (wtapng_if_descr->if_description)
50       return wtapng_if_descr->if_description;
51   }
52   return "unknown";
53 }
54
55 void
56 cap_file_init(capture_file *cf)
57 {
58   /* Initialize the capture file struct */
59   memset(cf, 0, sizeof(capture_file));
60   cf->snap            = WTAP_MAX_PACKET_SIZE;
61 }
62
63 /*
64  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
65  *
66  * Local Variables:
67  * c-basic-offset: 2
68  * tab-width: 8
69  * indent-tabs-mode: nil
70  * End:
71  *
72  * ex: set shiftwidth=2 tabstop=8 expandtab:
73  * :indentSize=2:tabSize=8:noTabs=true:
74  */