DCERPC: factor out proto_tree_add_dcerpc_drep()
[wireshark-wip.git] / wiretap / libpcap.h
blobb0ac45f7a0edabec6253f543e942f82f9b513959
1 /* libpcap.h
3 * $Id$
5 * Wiretap Library
6 * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef __W_LIBPCAP_H__
24 #define __W_LIBPCAP_H__
26 #include <glib.h>
27 #include <wtap.h>
28 #include "ws_symbol_export.h"
30 /* Magic numbers in "libpcap" files.
32 "libpcap" file records are written in the byte order of the host that
33 writes them, and the reader is expected to fix this up.
35 PCAP_MAGIC is the magic number, in host byte order; PCAP_SWAPPED_MAGIC
36 is a byte-swapped version of that.
38 PCAP_MODIFIED_MAGIC is for Alexey Kuznetsov's modified "libpcap"
39 format, as generated on Linux systems that have a "libpcap" with
40 his patches, at
42 http://ftp.sunet.se/pub/os/Linux/ip-routing/lbl-tools/
44 applied; PCAP_SWAPPED_MODIFIED_MAGIC is the byte-swapped version.
46 PCAP_NSEC_MAGIC is for Ulf Lamping's modified "libpcap" format,
47 which uses the same common file format as PCAP_MAGIC, but the
48 timestamps are saved in nanosecond resolution instead of microseconds.
49 PCAP_SWAPPED_NSEC_MAGIC is a byte-swapped version of that. */
50 #define PCAP_MAGIC 0xa1b2c3d4
51 #define PCAP_SWAPPED_MAGIC 0xd4c3b2a1
52 #define PCAP_MODIFIED_MAGIC 0xa1b2cd34
53 #define PCAP_SWAPPED_MODIFIED_MAGIC 0x34cdb2a1
54 #define PCAP_NSEC_MAGIC 0xa1b23c4d
55 #define PCAP_SWAPPED_NSEC_MAGIC 0x4d3cb2a1
57 /* "libpcap" file header (minus magic number). */
58 struct pcap_hdr {
59 guint16 version_major; /* major version number */
60 guint16 version_minor; /* minor version number */
61 gint32 thiszone; /* GMT to local correction */
62 guint32 sigfigs; /* accuracy of timestamps */
63 guint32 snaplen; /* max length of captured packets, in octets */
64 guint32 network; /* data link type */
67 /* "libpcap" record header. */
68 struct pcaprec_hdr {
69 guint32 ts_sec; /* timestamp seconds */
70 guint32 ts_usec; /* timestamp microseconds (nsecs for PCAP_NSEC_MAGIC) */
71 guint32 incl_len; /* number of octets of packet saved in file */
72 guint32 orig_len; /* actual length of packet */
75 /* "libpcap" record header for Alexey's patched version. */
76 struct pcaprec_modified_hdr {
77 struct pcaprec_hdr hdr; /* the regular header */
78 guint32 ifindex; /* index, in *capturing* machine's list of
79 interfaces, of the interface on which this
80 packet came in. */
81 guint16 protocol; /* Ethernet packet type */
82 guint8 pkt_type; /* broadcast/multicast/etc. indication */
83 guint8 pad; /* pad to a 4-byte boundary */
86 /* "libpcap" record header for Alexey's patched version in its ss990915
87 incarnation; this version shows up in SuSE Linux 6.3. */
88 struct pcaprec_ss990915_hdr {
89 struct pcaprec_hdr hdr; /* the regular header */
90 guint32 ifindex; /* index, in *capturing* machine's list of
91 interfaces, of the interface on which this
92 packet came in. */
93 guint16 protocol; /* Ethernet packet type */
94 guint8 pkt_type; /* broadcast/multicast/etc. indication */
95 guint8 cpu1, cpu2; /* SMP debugging gunk? */
96 guint8 pad[3]; /* pad to a 4-byte boundary */
99 /* "libpcap" record header for version used on some Nokia boxes (firewalls?) */
100 struct pcaprec_nokia_hdr {
101 struct pcaprec_hdr hdr; /* the regular header */
102 guint8 stuff[4]; /* mysterious stuff */
105 int libpcap_open(wtap *wth, int *err, gchar **err_info);
106 gboolean libpcap_dump_open(wtap_dumper *wdh, int *err);
107 int libpcap_dump_can_write_encap(int encap);
109 #endif