X-Git-Url: http://git.samba.org/samba.git/?a=blobdiff_plain;f=capture-pcap-util.h;h=fa16c5c74e98db7e06d4952409c845017a58290a;hb=b80345ccdaf0af6dee1bf429dea2f0ab3e94b887;hp=d9cd527364e4fa514451c591f3051c6d44742ee2;hpb=91e56221f58776d634d7088b0bc6070e26c9657e;p=obnox%2Fwireshark%2Fwip.git diff --git a/capture-pcap-util.h b/capture-pcap-util.h index d9cd527364..fa16c5c74e 100644 --- a/capture-pcap-util.h +++ b/capture-pcap-util.h @@ -3,8 +3,8 @@ * * $Id$ * - * Ethereal - Network traffic analyzer - * By Gerald Combs + * Wireshark - Network traffic analyzer + * By Gerald Combs * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or @@ -22,8 +22,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __PCAP_UTIL_H__ -#define __PCAP_UTIL_H__ +#ifndef __CAPTURE_PCAP_UTIL_H__ +#define __CAPTURE_PCAP_UTIL_H__ #ifdef HAVE_LIBPCAP @@ -31,70 +31,26 @@ extern "C" { #endif /* __cplusplus */ -#include +#include /* - * XXX - this is also the traditional default snapshot size in - * tcpdump - but, if IPv6 is enabled, it defaults to 96, to get an - * IPv6 header + TCP + 22 extra bytes. - * - * Some libpcap versions for particular capture devices might happen - * to impose a minimum, but it's not always 68. - */ -#define MIN_PACKET_SIZE 68 /* minimum amount of packet data we can read */ - -#define MAX_WIN_IF_NAME_LEN 511 - -/* - * The list of interfaces returned by "get_interface_list()" is - * a list of these structures. - */ -typedef struct { - char *name; - char *description; - GSList *ip_addr; /* containing address values */ - gboolean loopback; -} if_info_t; - -/* - * An address in the "ip_addr" list. + * A snapshot length of 0 is useless - and libpcap/WinPcap don't guarantee + * that a snapshot length of 0 will work, and, on some platforms, it won't + * (with BPF, for example, the kernel is told the snapshot length via the + * return value of the BPF program, and a return value of 0 means "drop + * the packet"), so the minimum packet size is 1 byte. */ -typedef struct { - address_type type; - union { - guint32 ip4_addr; - guint8 ip6_addr[16]; - } ip_addr; -} if_addr_t; +#define MIN_PACKET_SIZE 1 /* minimum amount of packet data we can read */ -GList *get_interface_list(int *err, char *err_str); - -/* Error values from "get_interface_list()". */ -#define CANT_GET_INTERFACE_LIST 0 /* error getting list */ -#define NO_INTERFACES_FOUND 1 /* list is empty */ - -void free_interface_list(GList *if_list); - -/* - * Get an error message string for a CANT_GET_INTERFACE_LIST error from - * "get_interface_list()". - */ -gchar *cant_get_if_list_error_message(const char *err_str); - -/* - * The list of data link types returned by "get_pcap_linktype_list()" is - * a list of these structures. - */ -typedef struct { - int dlt; - char *name; - char *description; -} data_link_info_t; +GList *get_interface_list(int *err, char **err_str); +#ifdef HAVE_PCAP_REMOTE +GList *get_remote_interface_list(const char *hostname, const char *port, + int auth_type, const char *username, + const char *passwd, int *err, char **err_str); +#endif -int get_pcap_linktype(pcap_t *pch, char *devname); -GList *get_pcap_linktype_list(char *devname, char *err_buf); -void free_pcap_linktype_list(GList *linktype_list); -const char *set_pcap_linktype(pcap_t *pch, char *devname, int dlt); +const char *linktype_val_to_name(int dlt); +int linktype_name_to_val(const char *linktype); #ifdef __cplusplus } @@ -117,4 +73,4 @@ extern void get_compiled_pcap_version(GString *str); */ extern void get_runtime_pcap_version(GString *str); -#endif /* __PCAP_UTIL_H__ */ +#endif /* __CAPTURE_PCAP_UTIL_H__ */