Move the declarations of wtap_pcap_encap_to_wtap_encap() and
wtap_wtap_encap_to_pcap_encap() to wiretap/pcap-encap.h. Include it where it's needed; don't include other Wiretap headers where they're not needed. Include pcapng.h in pcapng.c, to declare the functions defined in pcapng.c. Add some casts to squelch some warnings, and add to a comment to indicate one of the problems. svn path=/trunk/; revision=31960
This commit is contained in:
parent
add4e4dfbd
commit
c85899e946
|
@ -61,7 +61,7 @@
|
|||
#include <epan/frequency-utils.h>
|
||||
|
||||
/* Needed for wtap_pcap_encap_to_wtap_encap(). */
|
||||
#include <wiretap/libpcap.h>
|
||||
#include <wiretap/pcap-encap.h>
|
||||
|
||||
#include "packet-frame.h"
|
||||
#include "packet-eth.h"
|
||||
|
|
|
@ -102,8 +102,9 @@
|
|||
#include "epan/proto.h"
|
||||
#include <epan/tap.h>
|
||||
|
||||
#include <wtap.h>
|
||||
#include <libpcap.h>
|
||||
#include <wiretap/wtap.h>
|
||||
#include <wiretap/libpcap.h>
|
||||
#include <wiretap/pcap-encap.h>
|
||||
|
||||
#ifdef HAVE_LIBPCAP
|
||||
#include <pcap.h>
|
||||
|
|
|
@ -116,6 +116,7 @@ NONGENERATED_HEADER_FILES = \
|
|||
ngsniffer.h \
|
||||
packetlogger.h \
|
||||
pcap-common.h \
|
||||
pcap-encap.h \
|
||||
pcapng.h \
|
||||
pppdump.h \
|
||||
radcom.h \
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "buffer.h"
|
||||
#include "atm.h"
|
||||
#include "pcap-common.h"
|
||||
#include "pcap-encap.h"
|
||||
#include "libpcap.h"
|
||||
|
||||
/* See source to the "libpcap" library for information on the "libpcap"
|
||||
|
|
|
@ -101,6 +101,5 @@ struct pcaprec_nokia_hdr {
|
|||
int libpcap_open(wtap *wth, int *err, gchar **err_info);
|
||||
gboolean libpcap_dump_open(wtap_dumper *wdh, gboolean cant_seek, int *err);
|
||||
int libpcap_dump_can_write_encap(int encap);
|
||||
int wtap_pcap_encap_to_wtap_encap(int encap);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "wtap-int.h"
|
||||
#include "file_wrappers.h"
|
||||
#include "erf.h"
|
||||
#include "pcap-encap.h"
|
||||
#include "pcap-common.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
extern int wtap_wtap_encap_to_pcap_encap(int encap);
|
||||
|
||||
extern int pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
|
||||
gboolean byte_swapped, guint packet_size,
|
||||
gboolean check_packet_size, struct wtap_pkthdr *phdr,
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/* pcap-encap.h
|
||||
* Declarations for routines to handle libpcap/pcap-NG linktype values
|
||||
*
|
||||
* $Id: pcap-common.h 28863 2009-06-27 16:08:18Z tuexen $
|
||||
*
|
||||
* Wiretap Library
|
||||
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
|
||||
*
|
||||
* File format support for pcap-ng file format
|
||||
* Copyright (c) 2007 by Ulf Lamping <ulf.lamping@web.de>
|
||||
*
|
||||
* 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
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
extern int wtap_pcap_encap_to_wtap_encap(int encap);
|
||||
extern int wtap_wtap_encap_to_pcap_encap(int encap);
|
|
@ -41,6 +41,8 @@
|
|||
#include "buffer.h"
|
||||
#include "libpcap.h"
|
||||
#include "pcap-common.h"
|
||||
#include "pcap-encap.h"
|
||||
#include "pcapng.h"
|
||||
|
||||
#if 0
|
||||
#define pcapng_debug0(str) g_warning(str)
|
||||
|
@ -252,7 +254,14 @@ typedef struct wtapng_block_s {
|
|||
wtapng_if_stats_t if_stats;
|
||||
} data;
|
||||
|
||||
/* XXX - currently don't know how to handle these! */
|
||||
/*
|
||||
* XXX - currently don't know how to handle these!
|
||||
*
|
||||
* For one thing, when we're reading a block, they must be
|
||||
* writable, i.e. not const, so that we can read into them,
|
||||
* but, when we're writing a block, they can be const, and,
|
||||
* in fact, they sometimes point to const values.
|
||||
*/
|
||||
const union wtap_pseudo_header *pseudo_header;
|
||||
struct wtap_pkthdr *packet_header;
|
||||
const guchar *frame_buffer;
|
||||
|
@ -1264,7 +1273,7 @@ pcapng_open(wtap *wth, int *err, gchar **err_info)
|
|||
wth->file_encap = WTAP_ENCAP_UNKNOWN;
|
||||
wth->snapshot_length = 0;
|
||||
wth->tsprecision = WTAP_FILE_TSPREC_NSEC;
|
||||
wth->capture.pcapng = g_malloc(sizeof(pcapng_t));
|
||||
wth->capture.pcapng = (pcapng_t *)g_malloc(sizeof(pcapng_t));
|
||||
*wth->capture.pcapng = pn;
|
||||
wth->subtype_read = pcapng_read;
|
||||
wth->subtype_seek_read = pcapng_seek_read;
|
||||
|
@ -1766,7 +1775,7 @@ pcapng_dump_open(wtap_dumper *wdh, gboolean cant_seek _U_, int *err)
|
|||
/* This is a pcapng file */
|
||||
wdh->subtype_write = pcapng_dump;
|
||||
wdh->subtype_close = pcapng_dump_close;
|
||||
wdh->dump.pcapng = g_malloc(sizeof(pcapng_dump_t));
|
||||
wdh->dump.pcapng = (pcapng_dump_t *)g_malloc(sizeof(pcapng_dump_t));
|
||||
wdh->dump.pcapng->interface_data = g_array_new(FALSE, FALSE, sizeof(interface_data_t));
|
||||
wdh->dump.pcapng->number_of_interfaces = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue