Clean comments and indentation.
[obnox/wireshark/wip.git] / capture-pcap-util.h
index 96873ed1d8362d0b9a0113e723b39261c2b80047..035da2f69bc3954b11bb959d9140564ed5dd5cf4 100644 (file)
@@ -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
 
 extern "C" {
 #endif /* __cplusplus */
 
-#include <epan/address.h>
-
 #include <pcap.h>
 
-/* declaration of pcap_t here, to reduce pcap dependencies */
-/*typedef struct pcap pcap_t;*/
-
-
-/*
- * 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 */
-
-/* XXX - this must be optimized, removing the dependency!!! */
-#define CAPTURE_PCAP_ERRBUF_SIZE PCAP_ERRBUF_SIZE
-
-/*
- * The list of interfaces returned by "get_interface_list()" is
- * a list of these structures.
- */
-typedef struct {
-       char    *name;          /* e.g. "eth0" */
-       char    *description;   /* from OS, e.g. "Local Area Connection" or NULL */
-       GSList  *ip_addr;       /* containing address values of if_addr_t */
-       gboolean loopback;      /* TRUE if loopback, FALSE otherwise */
-} 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;      /* AT_IPv4 or AT_IPv6 */
-       union {
-               guint32 ip4_addr;   /*  4 byte IP V4 address, or */
-               guint8 ip6_addr[16];/* 16 byte IP V6 address */
-       } ip_addr;
-} if_addr_t;
-
-GList *get_interface_list(int *err, char *err_str);
+#define MIN_PACKET_SIZE 1      /* minimum amount of packet data we can read */
 
-/* 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;                /* e.g. DLT_EN10MB (which is 1) */
-       char    *name;          /* e.g. "EN10MB" or "DLT 1" */
-       char    *description;   /* descriptive name from wiretap e.g. "Ethernet", NULL if unknown */
-} data_link_info_t;
-
-GList *get_pcap_linktype_list(const char *devname, char *err_buf);
-void free_pcap_linktype_list(GList *linktype_list);
+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
 
 /* get/set the link type of an interface */
 /* (only used in capture_loop.c / capture-pcap-util.c) */
 int get_pcap_linktype(pcap_t *pch, const char *devname);
-const char *set_pcap_linktype(pcap_t *pch, char *devname, int dlt);
 
 
-#ifdef HAVE_PCAP_DATALINK_VAL_TO_NAME
 const char *linktype_val_to_name(int dlt);
-#endif
-#ifdef HAVE_PCAP_DATALINK_NAME_TO_VAL
 int linktype_name_to_val(const char *linktype);
-#endif
 
 #ifdef __cplusplus
 }
@@ -135,4 +78,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__ */