aboutsummaryrefslogtreecommitdiffstats
path: root/capture-pcap-util-unix.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-01-14 01:40:09 +0000
committerGuy Harris <guy@alum.mit.edu>2014-01-14 01:40:09 +0000
commitafef2cd8f4449f911d4c374e55c002727aa1057a (patch)
tree775547e184b76aa22703e98fdee1026156e04296 /capture-pcap-util-unix.c
parent2e5c54935b8cbeac6a7dea3c2fe5077588216b9a (diff)
Detangle the #ifdefs a bit.
svn path=/trunk/; revision=54748
Diffstat (limited to 'capture-pcap-util-unix.c')
-rw-r--r--capture-pcap-util-unix.c55
1 files changed, 26 insertions, 29 deletions
diff --git a/capture-pcap-util-unix.c b/capture-pcap-util-unix.c
index f0b6825ce0..cab745184b 100644
--- a/capture-pcap-util-unix.c
+++ b/capture-pcap-util-unix.c
@@ -28,7 +28,11 @@
#ifdef HAVE_LIBPCAP
-#ifndef HAVE_PCAP_FINDALLDEVS
+#ifdef HAVE_PCAP_FINDALLDEVS
+
+#include <pcap.h>
+
+#else /* HAVE_PCAP_FINDALLDEVS */
#include <stdlib.h>
#include <string.h>
@@ -60,25 +64,11 @@ struct rtentry;
#include "capture-pcap-util.h"
-#else
-
-#include <pcap.h>
-
#endif /* HAVE_PCAP_FINDALLDEVS */
#include "capture_ifinfo.h"
#include "capture-pcap-util-int.h"
-#ifndef HAVE_PCAP_FINDALLDEVS
-struct search_user_data {
- char *name;
- if_info_t *if_info;
-};
-
-static void
-search_for_if_cb(gpointer data, gpointer user_data);
-#endif
-
#ifdef HAVE_PCAP_REMOTE
GList *
get_remote_interface_list(const char *hostname, const char *port,
@@ -110,12 +100,31 @@ get_remote_interface_list(const char *hostname, const char *port,
}
#endif
+#ifdef HAVE_PCAP_FINDALLDEVS
GList *
get_interface_list(int *err, char **err_str)
{
-#ifdef HAVE_PCAP_FINDALLDEVS
return get_interface_list_findalldevs(err, err_str);
-#else
+}
+#else /* HAVE_PCAP_FINDALLDEVS */
+struct search_user_data {
+ char *name;
+ if_info_t *if_info;
+};
+
+static void
+search_for_if_cb(gpointer data, gpointer user_data)
+{
+ struct search_user_data *search_user_data = user_data;
+ if_info_t *if_info = data;
+
+ if (strcmp(if_info->name, search_user_data->name) == 0)
+ search_user_data->if_info = if_info;
+}
+
+GList *
+get_interface_list(int *err, char **err_str)
+{
GList *il = NULL;
gint nonloopback_pos = 0;
struct ifreq *ifr, *last;
@@ -309,18 +318,6 @@ fail:
close(sock);
*err = CANT_GET_INTERFACE_LIST;
return NULL;
-#endif /* HAVE_PCAP_FINDALLDEVS */
-}
-
-#ifndef HAVE_PCAP_FINDALLDEVS
-static void
-search_for_if_cb(gpointer data, gpointer user_data)
-{
- struct search_user_data *search_user_data = user_data;
- if_info_t *if_info = data;
-
- if (strcmp(if_info->name, search_user_data->name) == 0)
- search_user_data->if_info = if_info;
}
#endif /* HAVE_PCAP_FINDALLDEVS */