Hello,

I've attached a patch, which allows you to compile SIPp with pcap support on Windows by linking it with WinPcap. On my system I've copied the WinPcap developer package to "C:\cygwin\lib\WpdPack".

Additionally I had to remove or rename "pthread.h" in "C:\cygwin\lib\WpdPack\Include", as it interfered with pthread.h from cygwin. Perhaps someone who knows more about makefiles for GNU make can solve this issue in a better way.

Best regards,
Lars
diff -bruN sipp.2006-09-21/Makefile sipp.2006-09-21-new/Makefile
--- sipp.2006-09-21/Makefile    2006-09-12 16:29:26.000000000 +0200
+++ sipp.2006-09-21-new/Makefile        2006-09-27 10:50:10.299252200 +0200
@@ -138,7 +138,7 @@
 LIBS_tru64= -lcurses -lpthread
 LIBS_freebsd= -lcurses -pthread
 LIBS_SunOS= -lcurses -lpthread -lnsl -lsocket -lstdc++ -lm -ldl -L 
/usr/local/ssl/lib/
-LIBS_Cygwin= -lcurses -lpthread -lstdc++ 
+LIBS_Cygwin= -lcurses -lpthread -lstdc++ -L /usr/lib/WpdPack/Lib
 LIBS_Darwin= -lcurses
 LIBS=$(LIBS_$(SYSTEM))
 
@@ -148,7 +148,7 @@
 INCDIR_hpux=-I. -I/usr/local/include -I/opt/openssl/include
 INCDIR_tru64=-I. -I/opt/openssl/include
 INCDIR_SunOS=-I. -I/usr/local/ssl/include/
-INCDIR_Cygwin=-I. -I/usr/include/openssl -I/usr/include
+INCDIR_Cygwin=-I. -I/usr/include/openssl -I/usr/include 
-I/usr/lib/WpdPack/Include
 INCDIR_Darwin=-I. -I/usr/local/ssl/include
 INCDIR=$(INCDIR_$(SYSTEM)) 
 
@@ -173,6 +173,12 @@
 pcapplay_ossl_hp_li_ia:
        @_HPUX_LI_FLAG=-D_HPUX_LI ; export _HPUX_LI_FLAG ; make pcapplay_ossl
 
+pcapplay_cygwin:
+       make OSNAME=`uname|sed -e "s/CYGWIN.*/CYGWIN/"` MODELNAME=`uname -m|sed 
"s/Power Macintosh/ppc/"` OBJ_PCAPPLAY="send_packets.o prepare_pcap.o" 
PCAPPLAY_LIBS="-lwpcap" PCAPPLAY="-DPCAPPLAY" $(OUTPUT)
+
+pcapplay_ossl_cygwin:
+       make OSNAME=`uname|sed -e "s/CYGWIN.*/CYGWIN/"` MODELNAME=`uname -m|sed 
"s/Power Macintosh/ppc/"` OBJ_TLS="auth.o sslinit.o sslthreadsafe.o  milenage.o 
rijndael.o" TLS_LIBS="-lssl -lcrypto" TLS="-D_USE_OPENSSL -DOPENSSL_NO_KRB5"  
OBJ_PCAPPLAY="send_packets.o prepare_pcap.o" PCAPPLAY_LIBS="-lwpcap" 
PCAPPLAY="-DPCAPPLAY" $(OUTPUT)
+
 $(OUTPUT): $(OBJ_TLS) $(OBJ_PCAPPLAY) $(OBJ)
        $(CCLINK) $(LFLAGS) $(MFLAGS) $(LIBDIR_$(SYSTEM)) \
        $(DEBUG_FLAGS) -o $@ $(OBJ_TLS) $(OBJ_PCAPPLAY) $(OBJ) $(LIBS) 
$(TLS_LIBS) $(PCAPPLAY_LIBS)
diff -bruN sipp.2006-09-21/prepare_pcap.c sipp.2006-09-21-new/prepare_pcap.c
--- sipp.2006-09-21/prepare_pcap.c      2006-08-29 10:03:34.000000000 +0200
+++ sipp.2006-09-21-new/prepare_pcap.c  2006-09-27 10:48:39.961039000 +0200
@@ -129,7 +129,7 @@
         fprintf(stderr, "prepare_pcap.c: Ignoring non UDP packet!\n");
         continue;
       }
-#ifdef __DARWIN
+#if defined(__DARWIN) || defined(__CYGWIN)
       udphdr = (struct udphdr *)((char *)iphdr + (iphdr->ihl << 2) + 4);
 #else
       udphdr = (struct udphdr *)((char *)iphdr + (iphdr->ihl << 2));
@@ -149,7 +149,7 @@
       ERROR("Can't allocate memory for pcap pkt data");
     memcpy(pkt_index->data, udphdr, pktlen);
 
-#if defined(__HPUX) || defined(__DARWIN)
+#if defined(__HPUX) || defined(__DARWIN) || (defined __CYGWIN)
     udphdr->uh_sum = 0 ;      
 #else
     udphdr->check = 0;
@@ -158,14 +158,14 @@
       // compute a partial udp checksum
       // not including port that will be changed
       // when sending RTP
-#if defined(__HPUX) || defined(__DARWIN)
+#if defined(__HPUX) || defined(__DARWIN) || (defined __CYGWIN)
     pkt_index->partial_check = check((u_int16_t *) &udphdr->uh_ulen, pktlen - 
4) + ntohs(IPPROTO_UDP + pktlen);
 #else
     pkt_index->partial_check = check((u_int16_t *) &udphdr->len, pktlen - 4) + 
ntohs(IPPROTO_UDP + pktlen);
 #endif
     if (max_length < pktlen)
       max_length = pktlen;
-#if defined(__HPUX) || defined(__DARWIN)
+#if defined(__HPUX) || defined(__DARWIN) || (defined __CYGWIN)
     if (base > ntohs(udphdr->uh_dport))
       base = ntohs(udphdr->uh_dport);
 #else
diff -bruN sipp.2006-09-21/prepare_pcap.h sipp.2006-09-21-new/prepare_pcap.h
--- sipp.2006-09-21/prepare_pcap.h      2006-08-29 10:03:34.000000000 +0200
+++ sipp.2006-09-21-new/prepare_pcap.h  2006-09-27 10:48:40.007984200 +0200
@@ -22,7 +22,7 @@
 #include <netinet/udp.h>
 #include <time.h>
 
-#if defined(__HPUX) || defined(__DARWIN)
+#if defined(__HPUX) || defined(__DARWIN) || defined(__CYGWIN)
 #define u_int8_t uint8_t
 #define u_int16_t uint16_t
 #define u_int32_t uint32_t
diff -bruN sipp.2006-09-21/send_packets.c sipp.2006-09-21-new/send_packets.c
--- sipp.2006-09-21/send_packets.c      2006-08-29 10:03:34.000000000 +0200
+++ sipp.2006-09-21-new/send_packets.c  2006-09-27 10:48:40.086226200 +0200
@@ -45,12 +45,13 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <netinet/udp.h>
-#ifdef __DARWIN
+#if defined(__DARWIN) || defined(__CYGWIN)
 #include <netinet/in.h>
 #endif
 #include <netinet/ip6.h>
 #include <errno.h>
 #include <string.h>
+#include <fcntl.h>
 
 #include "send_packets.h"
 #include "prepare_pcap.h"
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to