2002-09-06 23:14:04 +00:00
|
|
|
/* cfile.c
|
2009-09-21 18:09:19 +00:00
|
|
|
* capture_file GUI-independent manipulation
|
2002-09-06 23:14:04 +00:00
|
|
|
* Vassilii Khachaturov <vassilii@tarunz.org>
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2002-09-06 23:14:04 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2002-09-06 23:14:04 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2002-09-06 23:14:04 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 01:29:52 +00:00
|
|
|
#include "config.h"
|
2002-09-06 23:14:04 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
|
|
|
|
#include "cfile.h"
|
|
|
|
|
2013-07-22 19:38:38 +00:00
|
|
|
const char *
|
|
|
|
cap_file_get_interface_name(void *data, guint32 interface_id)
|
|
|
|
{
|
|
|
|
capture_file *cf = (capture_file *) data;
|
|
|
|
wtapng_iface_descriptions_t *idb_info;
|
|
|
|
const wtapng_if_descr_t *wtapng_if_descr = NULL;
|
|
|
|
|
|
|
|
idb_info = wtap_file_get_idb_info(cf->wth);
|
|
|
|
|
|
|
|
if (interface_id < idb_info->number_of_interfaces)
|
|
|
|
wtapng_if_descr = &g_array_index(idb_info->interface_data, wtapng_if_descr_t, interface_id);
|
|
|
|
|
|
|
|
g_free(idb_info);
|
|
|
|
|
|
|
|
if (wtapng_if_descr) {
|
|
|
|
if (wtapng_if_descr->if_name)
|
|
|
|
return wtapng_if_descr->if_name;
|
|
|
|
else if (wtapng_if_descr->if_description)
|
|
|
|
return wtapng_if_descr->if_description;
|
|
|
|
}
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
2002-09-06 23:14:04 +00:00
|
|
|
void
|
2009-09-22 16:53:11 +00:00
|
|
|
cap_file_init(capture_file *cf)
|
2002-09-06 23:14:04 +00:00
|
|
|
{
|
|
|
|
/* Initialize the capture file struct */
|
2012-07-19 22:09:44 +00:00
|
|
|
memset(cf, 0, sizeof(capture_file));
|
2012-05-20 08:56:06 +00:00
|
|
|
cf->snap = WTAP_MAX_PACKET_SIZE;
|
2011-04-25 05:33:07 +00:00
|
|
|
}
|