diff options
-rw-r--r-- | capture.c | 63 | ||||
-rw-r--r-- | capture_loop.c | 23 | ||||
-rw-r--r-- | capture_sync.c | 40 |
3 files changed, 67 insertions, 59 deletions
@@ -32,75 +32,24 @@ #ifdef HAVE_LIBPCAP -#ifdef HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif - -#ifdef HAVE_SYS_WAIT_H -# include <sys/wait.h> -#endif - -#ifndef _WIN32 -/* - * Define various POSIX macros (and, in the case of WCOREDUMP, non-POSIX - * macros) on UNIX systems that don't have them. - */ -#ifndef WIFEXITED -# define WIFEXITED(status) (((status) & 0177) == 0) -#endif -#ifndef WIFSTOPPED -# define WIFSTOPPED(status) (((status) & 0177) == 0177) -#endif -#ifndef WIFSIGNALED -# define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status)) -#endif -#ifndef WEXITSTATUS -# define WEXITSTATUS(status) ((status) >> 8) -#endif -#ifndef WTERMSIG -# define WTERMSIG(status) ((status) & 0177) -#endif -#ifndef WCOREDUMP -# define WCOREDUMP(status) ((status) & 0200) -#endif -#ifndef WSTOPSIG -# define WSTOPSIG(status) ((status) >> 8) -#endif -#endif /* _WIN32 */ - -#ifdef HAVE_IO_H -# include <io.h> -#endif - -#include <pcap.h> - -#include <glib.h> #include <stdlib.h> -#include <stdio.h> -#include <ctype.h> #include <string.h> #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -#include <time.h> - -#ifdef HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif - -#ifdef HAVE_SYS_IOCTL_H -#include <sys/ioctl.h> +#ifdef HAVE_IO_H +# include <io.h> #endif #include <signal.h> #include <errno.h> +#include <pcap.h> + +#include <glib.h> + #include <epan/packet.h> #include <epan/dfilter/dfilter.h> #include "file.h" diff --git a/capture_loop.c b/capture_loop.c index b0e6baebfc..602ee8fcda 100644 --- a/capture_loop.c +++ b/capture_loop.c @@ -35,13 +35,31 @@ #ifdef HAVE_LIBPCAP -#include <pcap.h> +#include <string.h> -#include <glib.h> +#ifdef HAVE_FCNTL_H +#include <fcntl.h> +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif #include <signal.h> #include <errno.h> +#include <pcap.h> + +#include <glib.h> + #include <epan/packet.h> #include "capture.h" #include "capture_sync.h" @@ -53,6 +71,7 @@ #include "capture_stop_conditions.h" #include "ringbuffer.h" +#include "wiretap/libpcap.h" #include "wiretap/wtap.h" #include "wiretap/wtap-capture.h" diff --git a/capture_sync.c b/capture_sync.c index 11d8007177..e1affe02ac 100644 --- a/capture_sync.c +++ b/capture_sync.c @@ -32,11 +32,51 @@ #ifdef HAVE_LIBPCAP +#include <pcap.h> #include <glib.h> #include <stdio.h> +#include <ctype.h> #include <string.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#include <signal.h> + +#ifdef HAVE_SYS_WAIT_H +# include <sys/wait.h> +#endif + +#ifndef _WIN32 +/* + * Define various POSIX macros (and, in the case of WCOREDUMP, non-POSIX + * macros) on UNIX systems that don't have them. + */ +#ifndef WIFEXITED +# define WIFEXITED(status) (((status) & 0177) == 0) +#endif +#ifndef WIFSTOPPED +# define WIFSTOPPED(status) (((status) & 0177) == 0177) +#endif +#ifndef WIFSIGNALED +# define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status)) +#endif +#ifndef WEXITSTATUS +# define WEXITSTATUS(status) ((status) >> 8) +#endif +#ifndef WTERMSIG +# define WTERMSIG(status) ((status) & 0177) +#endif +#ifndef WCOREDUMP +# define WCOREDUMP(status) ((status) & 0200) +#endif +#ifndef WSTOPSIG +# define WSTOPSIG(status) ((status) >> 8) +#endif +#endif /* _WIN32 */ + #include <epan/packet.h> #include <epan/prefs.h> |