Move the GSM SMS dissection to a dedicated subdissector (currently still within
[obnox/wireshark/wip.git] / pcap-util.h
1 /* pcap-util.h
2  * Utility definitions for packet capture
3  *
4  * $Id: pcap-util.h,v 1.6 2003/11/01 02:30:14 guy Exp $
5  *
6  * Ethereal - Network traffic analyzer
7  * By Gerald Combs <gerald@ethereal.com>
8  * Copyright 1998 Gerald Combs
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #ifndef __PCAP_UTIL_H__
26 #define __PCAP_UTIL_H__
27
28 #ifdef HAVE_LIBPCAP
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
33
34 /*
35  * XXX - this is also the traditional default snapshot size in
36  * tcpdump - but, if IPv6 is enabled, it defaults to 96, to get an
37  * IPv6 header + TCP + 22 extra bytes.
38  *
39  * Some libpcap versions for particular capture devices might happen
40  * to impose a minimum, but it's not always 68.
41  */
42 #define MIN_PACKET_SIZE 68      /* minimum amount of packet data we can read */
43
44 #define MAX_WIN_IF_NAME_LEN 511
45
46 /*
47  * The list of interfaces returned by "get_interface_list()" is
48  * a list of these structures.
49  */
50 typedef struct {
51         char    *name;
52         char    *description;
53 } if_info_t;
54
55 GList *get_interface_list(int *err, char *err_str);
56
57 /* Error values from "get_interface_list()". */
58 #define CANT_GET_INTERFACE_LIST 0       /* error getting list */
59 #define NO_INTERFACES_FOUND     1       /* list is empty */
60
61 void free_interface_list(GList *if_list);
62
63 /*
64  * The list of data link types returned by "get_pcap_linktype_list()" is
65  * a list of these structures.
66  */
67 typedef struct {
68         int     dlt;
69         char    *name;
70         char    *description;
71 } data_link_info_t;
72
73 int get_pcap_linktype(pcap_t *pch, char *devname);
74 GList *get_pcap_linktype_list(char *devname, char *err_buf);
75 void free_pcap_linktype_list(GList *linktype_list);
76 const char *set_pcap_linktype(pcap_t *pch, char *devname, int dlt);
77
78 #ifdef __cplusplus
79 }
80 #endif /* __cplusplus */
81
82 #endif /* HAVE_LIBPCAP */
83
84 /*
85  * Append to a GString an indication of the version of libpcap/WinPcap
86  * with which we were compiled, if we were, or an indication that we
87  * weren't compiled with libpcap/WinPcap, if we weren't.
88  */
89 extern void get_compiled_pcap_version(GString *str);
90
91 /*
92  * Append to a GString an indication of the version of libpcap/WinPcap
93  * with which we're running, or an indication that we're not running
94  * with libpcap/WinPcap, if we were compiled with libpcap/WinPcap,
95  * or nothing, if we weren't compiled with libpcap/WinPcap.
96  */
97 extern void get_runtime_pcap_version(GString *str);
98
99 #endif /* __PCAP_UTIL_H__ */