]> The Tcpdump Group git mirrors - libpcap/commitdiff
Add a pcap-dbus.h header and include it in pcap-dbus.c and pcap.c.
authorGuy Harris <[email protected]>
Fri, 12 Apr 2013 17:58:08 +0000 (10:58 -0700)
committerGuy Harris <[email protected]>
Fri, 12 Apr 2013 17:58:08 +0000 (10:58 -0700)
That way, we ensure that the same function prototypes are seen when
dbus_create() and dbus_findalldevs() are defined and when they're used.

Also, add pcap-dbus.c to the list of "extra" files in Makefile.in, so it
goes into the release tarball.

Makefile.in
pcap-dbus.c
pcap-dbus.h [new file with mode: 0644]
pcap.c

index 58fbd5cbf096d86c5ddbccff8771f9c575665866..bfc224c01d45601277d1e561b2353b225b416554 100644 (file)
@@ -296,6 +296,8 @@ EXTRA_DIST = \
        pcap-config.in \
        pcap-dag.c \
        pcap-dag.h \
+       pcap-dbus.c \
+       pcap-dbus.h \
        pcap-dlpi.c \
        pcap-dos.c \
        pcap-dos.h \
index 91b6102f9d437f4d4bf37acc5969c2e90b9b2492..b6679e4308241574d7c48b06e5d9ed904985338d 100644 (file)
@@ -32,8 +32,6 @@
 #include "config.h"
 #endif
 
-#include "pcap-int.h"
-
 #include <string.h>
 
 #include <time.h>
@@ -41,6 +39,9 @@
 
 #include <dbus/dbus.h>
 
+#include "pcap-dbus.h"
+#include "pcap-int.h"
+
 static int
 dbus_read(pcap_t *handle, int max_packets, pcap_handler callback, u_char *user)
 {
@@ -81,9 +82,10 @@ dbus_read(pcap_t *handle, int max_packets, pcap_handler callback, u_char *user)
                /* pkth.caplen = min (payload_len, handle->snapshot); */
 
                gettimeofday(&pkth.ts, NULL);
-               if (handle->fcode.bf_insns == NULL || bpf_filter(handle->fcode.bf_insns, raw_msg, pkth.len, pkth.caplen)) {
+               if (handle->fcode.bf_insns == NULL ||
+                   bpf_filter(handle->fcode.bf_insns, (u_char *)raw_msg, pkth.len, pkth.caplen)) {
                        handle->md.packets_read++;
-                       callback(user, &pkth, raw_msg);
+                       callback(user, &pkth, (u_char *)raw_msg);
                        count++;
                }
 
diff --git a/pcap-dbus.h b/pcap-dbus.h
new file mode 100644 (file)
index 0000000..67493cc
--- /dev/null
@@ -0,0 +1,2 @@
+pcap_t *dbus_create(const char *, char *, int *);
+int dbus_findalldevs(pcap_if_t **devlistp, char *errbuf);
diff --git a/pcap.c b/pcap.c
index 7e70bde53c8341ce1baa45603be683e071102bb9..491537d2dc72fca32395ab7accb035503bf50939 100644 (file)
--- a/pcap.c
+++ b/pcap.c
@@ -106,8 +106,7 @@ static const char rcsid[] _U_ =
 #endif
 
 #ifdef PCAP_SUPPORT_DBUS
-int dbus_findalldevs(pcap_if_t **alldevsp, char *err_str);
-pcap_t *dbus_create(const char *device, char *ebuf, int *is_ours);
+#include "pcap-dbus.h"
 #endif
 
 int