diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-07-04 00:24:02 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-07-04 07:25:26 +0000 |
commit | 9e6487f24751d1c1a047ee82e158077ac67c9c68 (patch) | |
tree | 3cc4a8524062948f4951914dc9af489e0d7c4572 /capchild | |
parent | c5643a3d257909ed3e8752cd729b9192ae719683 (diff) | |
download | wireshark-9e6487f24751d1c1a047ee82e158077ac67c9c68.tar.gz wireshark-9e6487f24751d1c1a047ee82e158077ac67c9c68.tar.bz2 wireshark-9e6487f24751d1c1a047ee82e158077ac67c9c68.zip |
Move utility routines for capturing into a libcaputils static library.
Some of those routines are used only in dumpcap; others are used in
TShark and Wireshark as well.
Change-Id: I9d92483f2fcff57a7d8b6bf6bdf2870505d19fb7
Reviewed-on: https://code.wireshark.org/review/2841
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'capchild')
-rw-r--r-- | capchild/Makefile.common | 1 | ||||
-rw-r--r-- | capchild/capture_ifinfo.c | 2 | ||||
-rw-r--r-- | capchild/capture_ifinfo.h | 121 | ||||
-rw-r--r-- | capchild/capture_sync.c | 4 |
4 files changed, 3 insertions, 125 deletions
diff --git a/capchild/Makefile.common b/capchild/Makefile.common index 740898299c..bc6af7edbe 100644 --- a/capchild/Makefile.common +++ b/capchild/Makefile.common @@ -26,6 +26,5 @@ CAPCHILD_SRC = \ capture_sync.c noinst_HEADERS = \ - capture_ifinfo.h \ capture_session.h \ capture_sync.h diff --git a/capchild/capture_ifinfo.c b/capchild/capture_ifinfo.c index 3d758c2f67..984fa664fe 100644 --- a/capchild/capture_ifinfo.c +++ b/capchild/capture_ifinfo.c @@ -51,7 +51,7 @@ #include <capchild/capture_sync.h> #include "log.h" -#include <capchild/capture_ifinfo.h> +#include <caputils/capture_ifinfo.h> #ifdef HAVE_PCAP_REMOTE static GList *remote_interface_list = NULL; diff --git a/capchild/capture_ifinfo.h b/capchild/capture_ifinfo.h deleted file mode 100644 index f70bdf4ba5..0000000000 --- a/capchild/capture_ifinfo.h +++ /dev/null @@ -1,121 +0,0 @@ -/* capture_ifinfo.h - * Definitions for routines to get information about capture interfaces - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 1998 Gerald Combs - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __CAPTURE_IFINFO_H__ -#define __CAPTURE_IFINFO_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef enum { - IF_WIRED, - IF_AIRPCAP, - IF_PIPE, - IF_STDIN, - IF_BLUETOOTH, - IF_WIRELESS, - IF_DIALUP, - IF_USB, - IF_VIRTUAL -} interface_type; - -/* - * The list of interfaces returned by "get_interface_list()" is - * a list of these structures. - */ -typedef struct { - char *name; /* e.g. "eth0" */ - char *friendly_name; /* from OS, e.g. "Local Area Connection", or - NULL if not available */ - char *vendor_description; - /* vendor description from pcap_findalldevs(), - e.g. "Realtek PCIe GBE Family Controller", - or NULL if not available */ - GSList *addrs; /* containing address values of if_addr_t */ - interface_type type; /* type of interface */ - gboolean loopback; /* TRUE if loopback, FALSE otherwise */ -} if_info_t; - -/* - * An address in the "addrs" list. - */ -typedef enum { - IF_AT_IPv4, - IF_AT_IPv6 -} if_address_type; - -typedef struct { - if_address_type ifat_type; - union { - guint32 ip4_addr; /* 4 byte IP V4 address, or */ - guint8 ip6_addr[16];/* 16 byte IP V6 address */ - } addr; -} if_addr_t; - -/** - * Fetch the interface list from a child process. - */ -extern GList *capture_interface_list(int *err, char **err_str, void (*update_cb)(void)); - -/* Error values from "get_interface_list()/capture_interface_list()". */ -#define CANT_GET_INTERFACE_LIST 1 /* error getting list */ -#define NO_INTERFACES_FOUND 2 /* list is empty */ -#define DONT_HAVE_PCAP 3 /* couldn't load WinPcap */ - -void free_interface_list(GList *if_list); - -/* - * "get_if_capabilities()" and "capture_if_capabilities()" return a pointer - * to an allocated instance of this structure. "free_if_capabilities()" - * frees the returned instance. - */ -typedef struct { - gboolean can_set_rfmon; /* TRUE if can be put into monitor mode */ - GList *data_link_types; /* GList of data_link_info_t's */ -} if_capabilities_t; - -/* - * Information about data link types. - */ -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; - -/** - * Fetch the linktype list for the specified interface from a child process. - */ -extern if_capabilities_t * -capture_get_if_capabilities(const char *devname, gboolean monitor_mode, - char **err_str, void (*update_cb)(void)); - -void free_if_capabilities(if_capabilities_t *caps); - -void add_interface_to_remote_list(if_info_t *if_info); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __CAPTURE_IFINFO_H__ */ diff --git a/capchild/capture_sync.c b/capchild/capture_sync.c index f75ca556f0..f744b1a92d 100644 --- a/capchild/capture_sync.c +++ b/capchild/capture_sync.c @@ -48,7 +48,7 @@ # include <sys/wait.h> #endif -#include "capture-pcap-util.h" +#include "caputils/capture-pcap-util.h" #ifndef _WIN32 /* @@ -90,7 +90,7 @@ #include "sync_pipe.h" #ifdef _WIN32 -#include "capture-wpcap.h" +#include "caputils/capture-wpcap.h" #endif #include "ui/ui_util.h" |