summaryrefslogtreecommitdiff
path: root/wiretap
diff options
context:
space:
mode:
authorLaurent Deniel <laurent.deniel@free.fr>2000-08-11 13:37:21 +0000
committerLaurent Deniel <laurent.deniel@free.fr>2000-08-11 13:37:21 +0000
commit6a480953a956a2486e0b618bb02bed56faeac7bf (patch)
tree06a0d0c6356d97dfea11180d4ce22f5b278eefd6 /wiretap
parent6ad00fc256b351823138519e5a594b3f0f068319 (diff)
downloadwireshark-6a480953a956a2486e0b618bb02bed56faeac7bf.tar.gz
Miscellaneous code cleaning
- add <stdarg.h> or <varargs.h> in snprintf.h and remove those inclusions in the other #ifdef NEED_SNPRINTF_H codes - remove the check of multiple inclusions in source (.c) code (there is a bit loss of _cpp_ performance, but I prefer the gain of code reading and maintenance; and nowadays, disk caches and VM are correctly optimized ;-). - protect all (well almost) header files against multiple inclusions - add header (i.e. GPL license) in some include files - reorganize a bit the way header files are included: First: #include <system_include_files> #include <external_package_include_files (e.g. gtk, glib etc.)> Then #include "ethereal_include_files" with the correct HAVE_XXX or NEED_XXX protections. - add some HAVE_XXX checks before including some system header files - add the same HAVE_XXX in wiretap as in ethereal Please forgive me, if I break something (I've only compiled and regression tested on Linux). svn path=/trunk/; revision=2254
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/ascend.c4
-rw-r--r--wiretap/ascend.h7
-rw-r--r--wiretap/buffer.c4
-rw-r--r--wiretap/buffer.h7
-rw-r--r--wiretap/config.h.win329
-rw-r--r--wiretap/configure.in4
-rw-r--r--wiretap/csids.h7
-rw-r--r--wiretap/file.c11
-rw-r--r--wiretap/i4btrace.h7
-rw-r--r--wiretap/iptrace.h7
-rw-r--r--wiretap/lanalyzer.h7
-rw-r--r--wiretap/libpcap.h7
-rw-r--r--wiretap/netmon.h7
-rw-r--r--wiretap/nettl.h7
-rw-r--r--wiretap/netxray.h7
-rw-r--r--wiretap/ngsniffer.h7
-rw-r--r--wiretap/radcom.h7
-rw-r--r--wiretap/snoop.h7
-rw-r--r--wiretap/toshiba.h7
-rw-r--r--wiretap/wtap-int.h5
-rw-r--r--wiretap/wtap.h4
21 files changed, 116 insertions, 23 deletions
diff --git a/wiretap/ascend.c b/wiretap/ascend.c
index 84fafc2f33..ae66b75f6b 100644
--- a/wiretap/ascend.c
+++ b/wiretap/ascend.c
@@ -1,6 +1,6 @@
/* ascend.c
*
- * $Id: ascend.c,v 1.16 2000/05/19 23:06:47 gram Exp $
+ * $Id: ascend.c,v 1.17 2000/08/11 13:32:37 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -29,7 +29,9 @@
#include "ascend-int.h"
#include "file_wrappers.h"
+#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
+#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
diff --git a/wiretap/ascend.h b/wiretap/ascend.h
index 5b908b9e93..fe732ec9b4 100644
--- a/wiretap/ascend.h
+++ b/wiretap/ascend.h
@@ -1,6 +1,6 @@
/* ascend.h
*
- * $Id: ascend.h,v 1.6 2000/05/18 09:09:24 guy Exp $
+ * $Id: ascend.h,v 1.7 2000/08/11 13:32:35 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -21,8 +21,13 @@
*
*/
+#ifndef __ASCEND_H__
+#define __ASCEND_H__
+
#define ASCEND_MAX_DATA_ROWS 8
#define ASCEND_MAX_DATA_COLS 16
#define ASCEND_MAX_PKT_LEN (ASCEND_MAX_DATA_ROWS * ASCEND_MAX_DATA_COLS)
int ascend_open(wtap *wth, int *err);
+
+#endif
diff --git a/wiretap/buffer.c b/wiretap/buffer.c
index b513d39377..2ce99c6053 100644
--- a/wiretap/buffer.c
+++ b/wiretap/buffer.c
@@ -1,6 +1,6 @@
/* buffer.c
*
- * $Id: buffer.c,v 1.9 2000/07/31 04:15:58 guy Exp $
+ * $Id: buffer.c,v 1.10 2000/08/11 13:32:37 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -29,7 +29,9 @@
#include <string.h>
#include <glib.h>
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
+#endif
#include "buffer.h"
diff --git a/wiretap/buffer.h b/wiretap/buffer.h
index 5ca1cca239..385e4cb679 100644
--- a/wiretap/buffer.h
+++ b/wiretap/buffer.h
@@ -1,6 +1,6 @@
/* buffer.h
*
- * $Id: buffer.h,v 1.6 2000/07/31 04:15:58 guy Exp $
+ * $Id: buffer.h,v 1.7 2000/08/11 13:32:35 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -21,6 +21,9 @@
*
*/
+#ifndef __W_BUFFER_H__
+#define __W_BUFFER_H__
+
#define SOME_FUNCTIONS_ARE_DEFINES
#ifdef HAVE_WINSOCK_H
@@ -51,3 +54,5 @@ void buffer_remove_start(Buffer* buffer, unsigned int bytes);
u_char* buffer_start_ptr(Buffer* buffer);
u_char* buffer_end_ptr(Buffer* buffer);
#endif
+
+#endif
diff --git a/wiretap/config.h.win32 b/wiretap/config.h.win32
index 4c3529aca6..f2ba12e4f3 100644
--- a/wiretap/config.h.win32
+++ b/wiretap/config.h.win32
@@ -8,6 +8,15 @@
/* Define if you have the z library (-lz). */
/*#define HAVE_LIBZ 1*/
+/* Define if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
/* Name of package */
#define PACKAGE "libwtap.a"
diff --git a/wiretap/configure.in b/wiretap/configure.in
index 5b3f986c51..2d4334c054 100644
--- a/wiretap/configure.in
+++ b/wiretap/configure.in
@@ -1,4 +1,4 @@
-# $Id: configure.in,v 1.21 2000/02/12 08:54:32 guy Exp $
+# $Id: configure.in,v 1.22 2000/08/11 13:32:35 deniel Exp $
dnl
dnl Process this file with autoconf 2.13 or later to produce a
dnl configure script; 2.12 doesn't generate a "configure" script that
@@ -46,7 +46,7 @@ fi
dnl Checks for header files
AC_HEADER_STDC
-AC_CHECK_HEADERS(sys/time.h netinet/in.h unistd.h)
+AC_CHECK_HEADERS(sys/time.h netinet/in.h unistd.h fcntl.h sys/stat.h sys/types.h)
AC_CANONICAL_HOST
diff --git a/wiretap/csids.h b/wiretap/csids.h
index 1adcf2d058..b40962abee 100644
--- a/wiretap/csids.h
+++ b/wiretap/csids.h
@@ -1,6 +1,6 @@
/* csids.h
*
- * $Id: csids.h,v 1.1 2000/08/08 22:16:42 mhall Exp $
+ * $Id: csids.h,v 1.2 2000/08/11 13:32:35 deniel Exp $
*
* Copyright (c) 2000 by Mike Hall <mlh@io.com>
* Copyright (c) Cisco Systems
@@ -21,4 +21,9 @@
*
*/
+#ifndef __CSIDS_H__
+#define __CSIDS_H__
+
int csids_open(wtap *wth, int *err);
+
+#endif
diff --git a/wiretap/file.c b/wiretap/file.c
index d37d48172a..63649b9590 100644
--- a/wiretap/file.c
+++ b/wiretap/file.c
@@ -1,6 +1,6 @@
/* file.c
*
- * $Id: file.c,v 1.59 2000/08/08 22:16:42 mhall Exp $
+ * $Id: file.c,v 1.60 2000/08/11 13:32:36 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -25,10 +25,17 @@
#endif
#include <stdio.h>
-#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
+#endif
+
#include <errno.h>
#ifdef HAVE_IO_H
diff --git a/wiretap/i4btrace.h b/wiretap/i4btrace.h
index ca5ca7b1cd..9911a6c45e 100644
--- a/wiretap/i4btrace.h
+++ b/wiretap/i4btrace.h
@@ -1,6 +1,6 @@
/* i4btrace.h
*
- * $Id: i4btrace.h,v 1.1 1999/12/12 22:40:09 gram Exp $
+ * $Id: i4btrace.h,v 1.2 2000/08/11 13:32:35 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1999 by Bert Driehuis <driehuis@playbeing.org>
@@ -21,4 +21,9 @@
*
*/
+#ifndef __I4BTRACE_H__
+#define __I4BTRACE_H__
+
int i4btrace_open(wtap *wth, int *err);
+
+#endif
diff --git a/wiretap/iptrace.h b/wiretap/iptrace.h
index 38c37899a0..f49449319b 100644
--- a/wiretap/iptrace.h
+++ b/wiretap/iptrace.h
@@ -1,6 +1,6 @@
/* iptrace.h
*
- * $Id: iptrace.h,v 1.4 2000/01/22 06:22:38 guy Exp $
+ * $Id: iptrace.h,v 1.5 2000/08/11 13:32:35 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -21,4 +21,9 @@
*
*/
+#ifndef __IPTRACE_H__
+#define __IPTRACE_H__
+
int iptrace_open(wtap *wth, int *err);
+
+#endif
diff --git a/wiretap/lanalyzer.h b/wiretap/lanalyzer.h
index 443754ae69..e6c6aa3893 100644
--- a/wiretap/lanalyzer.h
+++ b/wiretap/lanalyzer.h
@@ -1,6 +1,6 @@
/* lanalyzer.h
*
- * $Id: lanalyzer.h,v 1.3 2000/01/22 06:22:38 guy Exp $
+ * $Id: lanalyzer.h,v 1.4 2000/08/11 13:32:35 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -21,4 +21,9 @@
*
*/
+#ifndef __LANALYZER_H__
+#define __LANALYZER_H__
+
int lanalyzer_open(wtap *wth, int *err);
+
+#endif
diff --git a/wiretap/libpcap.h b/wiretap/libpcap.h
index 1e4e409ac0..28b50a8f89 100644
--- a/wiretap/libpcap.h
+++ b/wiretap/libpcap.h
@@ -1,6 +1,6 @@
/* libpcap.h
*
- * $Id: libpcap.h,v 1.8 2000/07/30 16:54:12 oabad Exp $
+ * $Id: libpcap.h,v 1.9 2000/08/11 13:32:35 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -21,6 +21,9 @@
*
*/
+#ifndef __W_LIBPCAP_H__
+#define __W_LIBPCAP_H__
+
/* Magic numbers in "libpcap" files.
"libpcap" file records are written in the byte order of the host that
@@ -86,3 +89,5 @@ struct pcaprec_ss990915_hdr {
int libpcap_open(wtap *wth, int *err);
gboolean libpcap_dump_open(wtap_dumper *wdh, int *err);
int libpcap_dump_can_write_encap(int filetype, int encap);
+
+#endif
diff --git a/wiretap/netmon.h b/wiretap/netmon.h
index 741e1118fb..859834f68c 100644
--- a/wiretap/netmon.h
+++ b/wiretap/netmon.h
@@ -1,6 +1,6 @@
/* netmon.h
*
- * $Id: netmon.h,v 1.6 2000/01/22 06:22:40 guy Exp $
+ * $Id: netmon.h,v 1.7 2000/08/11 13:32:34 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -21,6 +21,11 @@
*
*/
+#ifndef __NETMON_H__
+#define __NETMON_H__
+
int netmon_open(wtap *wth, int *err);
gboolean netmon_dump_open(wtap_dumper *wdh, int *err);
int netmon_dump_can_write_encap(int filetype, int encap);
+
+#endif
diff --git a/wiretap/nettl.h b/wiretap/nettl.h
index 5e9fc469f9..397e544d14 100644
--- a/wiretap/nettl.h
+++ b/wiretap/nettl.h
@@ -1,6 +1,6 @@
/* nettl.h
*
- * $Id: nettl.h,v 1.4 2000/02/17 21:08:15 oabad Exp $
+ * $Id: nettl.h,v 1.5 2000/08/11 13:32:34 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -21,6 +21,9 @@
*
*/
+#ifndef __NETTL_H__
+#define __NETTL_H__
+
#define NETTL_SUBSYS_NS_LS_LOGGING 0x00
#define NETTL_SUBSYS_NS_LS_NFT 0x01
#define NETTL_SUBSYS_NS_LS_LOOPBACK 0x02
@@ -66,3 +69,5 @@
#define NETTL_SUBSYS_EM 0x7C
int nettl_open(wtap *wth, int *err);
+
+#endif
diff --git a/wiretap/netxray.h b/wiretap/netxray.h
index 89397a5b7b..8e3d76738a 100644
--- a/wiretap/netxray.h
+++ b/wiretap/netxray.h
@@ -1,6 +1,6 @@
/* netxray.h
*
- * $Id: netxray.h,v 1.4 2000/01/22 06:22:41 guy Exp $
+ * $Id: netxray.h,v 1.5 2000/08/11 13:32:34 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -21,6 +21,11 @@
*
*/
+#ifndef __NETXRAY_H__
+#define __NETXRAY_H__
+
int netxray_open(wtap *wth, int *err);
gboolean netxray_dump_open_1_1(wtap_dumper *wdh, int *err);
int netxray_dump_can_write_encap(int filetype, int encap);
+
+#endif
diff --git a/wiretap/ngsniffer.h b/wiretap/ngsniffer.h
index 4d412debed..0dbbc70445 100644
--- a/wiretap/ngsniffer.h
+++ b/wiretap/ngsniffer.h
@@ -1,6 +1,6 @@
/* ngsniffer.h
*
- * $Id: ngsniffer.h,v 1.7 2000/01/22 06:22:43 guy Exp $
+ * $Id: ngsniffer.h,v 1.8 2000/08/11 13:32:34 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -21,6 +21,11 @@
*
*/
+#ifndef __NGSNIFFER_H__
+#define __NGSNIFFER_H__
+
int ngsniffer_open(wtap *wth, int *err);
gboolean ngsniffer_dump_open(wtap_dumper *wdh, int *err);
int ngsniffer_dump_can_write_encap(int filetype, int encap);
+
+#endif
diff --git a/wiretap/radcom.h b/wiretap/radcom.h
index 61ca18b008..f89c03d81c 100644
--- a/wiretap/radcom.h
+++ b/wiretap/radcom.h
@@ -1,6 +1,6 @@
/* radcom.h
*
- * $Id: radcom.h,v 1.4 2000/01/22 06:22:43 guy Exp $
+ * $Id: radcom.h,v 1.5 2000/08/11 13:32:34 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -21,4 +21,9 @@
*
*/
+#ifndef __RADCOM_H__
+#define __RADCOM_H__
+
int radcom_open(wtap *wth, int *err);
+
+#endif
diff --git a/wiretap/snoop.h b/wiretap/snoop.h
index 31b184868e..5505cf51db 100644
--- a/wiretap/snoop.h
+++ b/wiretap/snoop.h
@@ -1,6 +1,6 @@
/* snoop.h
*
- * $Id: snoop.h,v 1.7 2000/01/22 06:22:44 guy Exp $
+ * $Id: snoop.h,v 1.8 2000/08/11 13:32:34 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -21,6 +21,11 @@
*
*/
+#ifndef __W_SNOOP_H__
+#define __W_SNOOP_H__
+
int snoop_open(wtap *wth, int *err);
gboolean snoop_dump_open(wtap_dumper *wdh, int *err);
int snoop_dump_can_write_encap(int filetype, int encap);
+
+#endif
diff --git a/wiretap/toshiba.h b/wiretap/toshiba.h
index f4127ba969..bce4dd5be4 100644
--- a/wiretap/toshiba.h
+++ b/wiretap/toshiba.h
@@ -1,6 +1,6 @@
/* toshiba.h
*
- * $Id: toshiba.h,v 1.2 2000/05/18 09:09:48 guy Exp $
+ * $Id: toshiba.h,v 1.3 2000/08/11 13:32:33 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -21,4 +21,9 @@
*
*/
+#ifndef __W_TOSHIBA_H__
+#define __W_TOSHIBA_H__
+
int toshiba_open(wtap *wth, int *err);
+
+#endif
diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h
index e0f04de195..55e652f443 100644
--- a/wiretap/wtap-int.h
+++ b/wiretap/wtap-int.h
@@ -1,6 +1,6 @@
/* wtap-int.h
*
- * $Id: wtap-int.h,v 1.5 2000/08/11 07:28:12 guy Exp $
+ * $Id: wtap-int.h,v 1.6 2000/08/11 13:32:36 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -24,8 +24,9 @@
#ifndef __WTAP_INT_H__
#define __WTAP_INT_H__
-
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
+#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index f2268ea7da..3b248e9ff1 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -1,6 +1,6 @@
/* wtap.h
*
- * $Id: wtap.h,v 1.76 2000/08/08 22:16:42 mhall Exp $
+ * $Id: wtap.h,v 1.77 2000/08/11 13:32:37 deniel Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -132,7 +132,9 @@
*/
#define WTAP_MAX_PACKET_SIZE 65535
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
+#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>