Here are some patches to built the programs under utils\
on Win32/MingW.
Makefile.mingw updated to build these utils and now uses
import-libraries for libpcap, libgd (not static libs).
Also some patches to myrrd\rrd_tool.h to suppress redefinition
warnings. There are still way too many warnings IMHO. Try
with "gcc -Wall -W" sometimes.
--gv
diff -u3 -Hb -r CVS-latest\myrrd\rrd_tool.h .\myrrd\rrd_tool.h
--- CVS-latest\myrrd\rrd_tool.h Thu Aug 07 15:21:51 2003
+++ .\myrrd\rrd_tool.h Fri Jun 18 13:25:47 2004
@@ -90,10 +90,19 @@
/* Win32 only includes */
#include <float.h> /* for _isnan */
+
+#ifndef isnan
#define isnan _isnan
+#endif
+
+#ifndef finite
#define finite _finite
+#endif
+
+#ifndef isinf
#define isinf(a) (_fpclass(a) == _FPCLASS_NINF || _fpclass(a) == _FPCLASS_PINF)
#endif
+#endif
/* local include files -- need to be after the system ones */
#include "getopt.h"
diff -u3 -Hb -r CVS-latest\utils\inetnum2countryalloc.c .\utils\inetnum2countryalloc.c
--- CVS-latest\utils\inetnum2countryalloc.c Sun Sep 07 05:53:20 2003
+++ .\utils\inetnum2countryalloc.c Wed May 26 01:45:07 2004
@@ -22,9 +22,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <getopt.h>
+#include "ntop.h"
#include "p2clib.h"
+#undef getopt
#define VERSION "2.0"
#define FLAG_HAVE_INETNUM 1
@@ -70,14 +71,14 @@
/* ************************************************************************* */
-void usage(void)
+void usage(FILE *fp)
{
- fprintf(stderr, "inetnum2countryalloc %s\n", VERSION);
- fprintf(stderr, "Usage: inetnum2countryalloc\n");
- fprintf(stderr, "Convert whois address file (e.g ripe.db.inetnum.gz) to
standard\n");
- fprintf(stderr, "format which can be processed by prefixtablegen\n\n");
- fprintf(stderr, "Example:\n");
- fprintf(stderr, " zcat ripe.db.inetnum.gz | ./inetnum2countryalloc
>ripe.inetnum.data\n");
+ fprintf(fp, "inetnum2countryalloc %s\n", VERSION);
+ fprintf(fp, "Usage: inetnum2countryalloc\n");
+ fprintf(fp, "Convert whois address file (e.g ripe.db.inetnum.gz) to standard\n");
+ fprintf(fp, "format which can be processed by prefixtablegen\n\n");
+ fprintf(fp, "Example:\n");
+ fprintf(fp, " zcat ripe.db.inetnum.gz | ./inetnum2countryalloc
>ripe.inetnum.data\n");
exit(EXIT_FAILURE);
}
@@ -92,7 +93,7 @@
case '?':
case 'h':
default:
- usage();
+ usage(stderr);
break;
}
}
diff -u3 -Hb -r CVS-latest\utils\lookuptest.c .\utils\lookuptest.c
--- CVS-latest\utils\lookuptest.c Sun Sep 07 05:53:20 2003
+++ .\utils\lookuptest.c Wed May 26 01:54:29 2004
@@ -19,15 +19,22 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#define VERSION "2.0"
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
-#include <getopt.h>
+
+#ifdef WIN32
+ #define u_int32_t unsigned long
+ #define strtok_r(str,del,save) strtok(str,del)
+ extern char *optarg;
+ extern char optind;
+#endif
+
#include "p2clib.h"
+#define VERSION "2.0"
+
typedef struct IPNode
{
struct IPNode *b[2];
diff -u3 -Hb -r CVS-latest\utils\p2clib.c .\utils\p2clib.c
--- CVS-latest\utils\p2clib.c Sun Sep 07 05:53:20 2003
+++ .\utils\p2clib.c Wed May 26 01:39:43 2004
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
+#include "ntop.h"
#include "p2clib.h"
/* ************************************************************************* */
diff -u3 -Hb -r CVS-latest\utils\prefixtablegen.c .\utils\prefixtablegen.c
--- CVS-latest\utils\prefixtablegen.c Sun Sep 07 05:53:20 2003
+++ .\utils\prefixtablegen.c Wed May 26 01:56:04 2004
@@ -28,6 +28,12 @@
#include <ctype.h>
#include <math.h>
#include <getopt.h>
+
+#ifdef WIN32
+ #define u_int32_t unsigned long
+ #define strtok_r(str,del,save) strtok(str,del)
+#endif
+
#include "p2clib.h"
/* Note: Setting DO_FREES to 0 skips free() calls for performance reasons.
--- CVS-latest\Makefile.mingw Mon May 24 09:20:23 2004
+++ Makefile.mingw Fri Jun 18 13:22:34 2004
@@ -27,30 +27,32 @@
-DHAVE_FCNTL_H -DHAVE_PCAP_H -DHAVE_STDARG_H -DHAVE_PCAP_OPEN_DEAD \
-DHAVE_PCAP_LIB_VERSION -DHAVE_STRFTIME -DHAVE_MATH_H -DHAVE_INT8_T \
-DHAVE_INT16_T -DHAVE_INT32_T -DHAVE_UINT8_T -DHAVE_UINT16_T \
- -DHAVE_UINT32_T
+ -DHAVE_UINT32_T -D_DEVIOCTL_
LDFLAGS = -s
-LIBS = $(PCAP_ROOT)/libwpcap.a $(ZLIB_ROOT)/libz.a \
- $(GDCHART_ROOT)/libgdchart.a $(GD_ROOT)/libgd.a \
- $(PNG_ROOT)/lib/libpng.a $(GDBM_ROOT)/libgdbm.a \
+LIBS = $(PCAP_ROOT)/libwpcap.dll.a $(ZLIB_ROOT)/libz.a \
+ $(GDCHART_ROOT)/libgdchart.a $(GD_ROOT)/libgd.dll.a \
+ $(PNG_ROOT)/libpng.a $(GDBM_ROOT)/libgdbm.a \
-lversion -lws2_32
-PROGRAM = ntop.exe
+PROGRAMS = ntop.exe addMacAddress.exe inetnum2countryalloc.exe \
+ lookuptest.exe prefixtablegen.exe
SOURCE = ntop.c ntop_win32.c main.c address.c admin.c dataFormat.c emitter.c \
globals-core.c globals-report.c graph.c hash.c http.c initialize.c leaks.c \
- fcUtils.c pbuf.c plugin.c protocols.c iface.c qsort.c report.c reportUtils.c
\
+ fcUtils.c pbuf.c plugin.c protocols.c iface.c report.c reportUtils.c \
sessions.c term.c traffic.c util.c vendor.c version.c webInterface.c \
- getopt.c getopt1.c ssl.c \
+ fcReport.c getopt.c getopt1.c ssl.c \
\
$(addprefix plugins/, icmpPlugin.c lastSeenPlugin.c netflowPlugin.c \
pdaPlugin.c sflowPlugin.c rrdPlugin.c) \
\
$(addprefix myrrd/, gdlucidab10.c gdlucidab12.c gdlucidab12l2.c
gdlucidab14.c \
- gdlucidan10.c gdlucidan10l2.c gdlucidan12.c gdlucidan14.c gdpng.c
gifsize.c \
+ gdlucidan10.c gdlucidan10l2.c gdlucidan12.c gdlucidan14.c gifsize.c \
parsetime.c pngsize.c rrd_create.c rrd_diff.c rrd_error.c rrd_fetch.c \
rrd_format.c rrd_graph.c rrd_last.c rrd_open.c rrd_update.c dummy.c)
+ # gdpng.c
OBJECTS = $(addprefix $(OBJ_DIR)/, $(notdir $(SOURCE:.c=.o)))
@@ -59,21 +61,38 @@
LIBS += $(OPENSSL_ROOT)/out/libeay32.dll.a $(OPENSSL_ROOT)/out/libssl32.dll.a
endif
-all: ./config.h $(OBJ_DIR) $(PROGRAM) ntop.html
+all: ./config.h $(OBJ_DIR) $(PROGRAMS) ntop.html
@echo Welcome to ntop
$(OBJ_DIR):
mkdir $(OBJ_DIR)
-$(PROGRAM): $(OBJECTS)
+ntop.exe: $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+ @echo
+
+addMacAddress.exe: utils/addMacAddress.c
+ $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(GDBM_ROOT)/libgdbm.a
+ @echo
+
+inetnum2countryalloc.exe: utils/inetnum2countryalloc.c utils/p2clib.c
+ $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^
+ @echo
+
+lookuptest.exe: utils/lookuptest.c utils/p2clib.c
+ $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^
+ @echo
+
+prefixtablegen.exe: utils/prefixtablegen.c utils/p2clib.c
+ $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^
+ @echo
$(OBJ_DIR)/%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
@echo
./config.h:
- @echo '/* config.h for MingW */' > $@
+ @echo '/* Generated for MingW. DO NOT EDIT */' > $@
@echo '#include <winsock2.h>' >> $@
@echo '#include <ws2tcpip.h>' >> $@
@@ -93,7 +112,7 @@
rm -f $(OBJECTS)
vclean distclean: clean
- rm -f $(PROGRAM) version.c ./config.h .depend
+ rm -f $(PROGRAMS) version.c ./config.h .depend
ntop.html: ntop.8
man2html < $^ | sed -e 's/Content-type: text\/html//g' > $@
_______________________________________________
Ntop-dev mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop-dev