I finally got some time to work on this. Patch is attached.
I don't have any IPv6 pcap files, to test with. also I did not test on any other platform than Cygwin.

The following still applies:

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.

Regards,
Lars

Lars Roland schrieb:
I must admit that I borrowed ip6.h and net/ethernet.h from the FreeBSD sources, which I found somewhere via google.

However, those files are only needed to get the platform independent structure of an Ethernet and an IPv6 Header.
Instead, we can define our own:

A minimal definition that would be sufficient for SIPp would be:

typedef struct _ether_hdr {
      char dontcare[12];
u_int16_t type; /* we only need the type, so we can determine, if the next header is IPv4 or IPv6 */
} _ether_hdr;

struct _ip6_hdr {
    char dontcare[6];
u_int8_t nxt_header; /* we only need the next header, so we can determine, if the next header is UDP or not */
    char dontcare2[33];
} ip6_hdr;

We could do the same for the ipv4 and the udp header structure, but it is not necessary to get prepare_pcap.c compiled on cygwin.

I'll prepare a new patch.

Regards,
Lars

Lars Roland schrieb:
I knew I forgot something.

That was an evil hack.
I try to reproduce, which cygwin sources I used.

I can send the missing file to you, but obviously you'd like to know, where I got it from. And I'd like to know it as well.

Regards,
Lars

Olivier Jacques schrieb:
Hi Lars,

I am wondering which IPv6 on Cygwin you are using. With the one I used until now (http://win6.jp/Cygwin/index.html), the "make pcapplay_cygwin" doesn't compile: netinet/ip6.h is not found.

Are you using something else?
Olivier.

Olivier Jacques wrote:
Hi Lars,

glad to see you on this mailing list too :)
This is great news!
I'll try to integrate that quickly.

Thanks,
Olivier.

Lars Roland wrote:
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
-------------------------------------------------------------------------
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


-------------------------------------------------------------------------
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

diff -bruN sipp.2006-10-12/Makefile sipp.2006-10-12-new/Makefile
--- sipp.2006-10-12/Makefile    2006-09-12 16:29:26.000000000 +0200
+++ sipp.2006-10-12-new/Makefile        2006-10-12 19:26:26.455748100 +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-10-12/prepare_pcap.c sipp.2006-10-12-new/prepare_pcap.c
--- sipp.2006-10-12/prepare_pcap.c      2006-08-29 10:03:34.000000000 +0200
+++ sipp.2006-10-12-new/prepare_pcap.c  2006-10-12 19:26:26.518086100 +0200
@@ -19,23 +19,37 @@
 #include <stdlib.h>
 #include <netinet/in.h>
 #include <netinet/udp.h>
-#ifdef __HPUX
+#if defined(__HPUX) || defined(__CYGWIN)
 #include <netinet/in_systm.h>
 #endif
 #include <netinet/ip.h>
+#ifndef __CYGWIN
 #include <netinet/ip6.h>
-#ifdef __HPUX
-#include <sys/socket.h>
-#include <net/if_arp.h>
-#include <netinet/if_ether.h>
-#else
-#include <net/ethernet.h>
 #endif
 #include <string.h>
 
 #include "prepare_pcap.h"
 #include "screen.hpp"
 
+/* We define our own structures for Ethernet Header and IPv6 Header as they 
are not available on CYGWIN.
+ * We only need the fields, which are necessary to determine the type of the 
next header.
+ * we could also define our own structures for UDP and IPv4. We currently use 
the structures
+ * made available by the platform, as we had no problems to get them on all 
supported platforms.
+ */
+
+typedef struct _ether_hdr {
+      char ether_dst[6];
+      char ether_src[6];
+      u_int16_t ether_type; /* we only need the type, so we can determine, if 
the next header is IPv4 or IPv6 */
+} ether_hdr;
+
+typedef struct _ipv6_hdr {
+    char dontcare[6];
+    u_int8_t nxt_header; /* we only need the next header, so we can determine, 
if the next header is UDP or not */
+    char dontcare2[33];
+} ipv6_hdr;
+
+
 #ifdef __HPUX
 int check(u_int16_t *buffer, int len){
 #else
@@ -77,9 +91,9 @@
   u_int16_t *chk_buffer;
   u_long pktlen;
   pcap_pkt *pkt_index;
-  struct ether_header *ethhdr;
+  ether_hdr *ethhdr;
   struct iphdr *iphdr;
-  struct ip6_hdr *ip6hdr;
+  ipv6_hdr *ip6hdr;
   struct udphdr *udphdr;
 
   // to be suppressed
@@ -106,9 +120,9 @@
   while ((pktdata = (u_char *) pcap_next (pcap, pkthdr)) != NULL)
   {
 #endif
-    ethhdr = (struct ether_header *)pktdata;
-    if (ntohs(ethhdr->ether_type) != ETHERTYPE_IP
-          && ntohs(ethhdr->ether_type) != 0x86dd) {
+    ethhdr = (ether_hdr *)pktdata;
+    if (ntohs(ethhdr->ether_type) != 0x0800 /* IPv4 */
+          && ntohs(ethhdr->ether_type) != 0x86dd) /* IPv6 */ {
       fprintf(stderr, "Ignoring non IP{4,6} packet!\n");
       continue;
     }
@@ -116,8 +130,8 @@
     if (iphdr && iphdr->version == 6) {
       //ipv6
       pktlen = (u_long) pkthdr->len - sizeof(*ethhdr) - sizeof(*ip6hdr);
-      ip6hdr = (struct ip6_hdr *)(void *) iphdr;
-      if (ip6hdr->ip6_nxt != IPPROTO_UDP) {
+      ip6hdr = (ipv6_hdr *)(void *) iphdr;
+      if (ip6hdr->nxt_header != IPPROTO_UDP) {
         fprintf(stderr, "prepare_pcap.c: Ignoring non UDP packet!\n");
             continue;
       }
@@ -129,7 +143,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 +163,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 +172,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-10-12/prepare_pcap.h sipp.2006-10-12-new/prepare_pcap.h
--- sipp.2006-10-12/prepare_pcap.h      2006-08-29 10:03:34.000000000 +0200
+++ sipp.2006-10-12-new/prepare_pcap.h  2006-10-12 19:26:26.642762100 +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-10-12/send_packets.c sipp.2006-10-12-new/send_packets.c
--- sipp.2006-10-12/send_packets.c      2006-08-29 10:03:34.000000000 +0200
+++ sipp.2006-10-12-new/send_packets.c  2006-10-12 19:26:26.705100100 +0200
@@ -45,12 +45,15 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <netinet/udp.h>
-#ifdef __DARWIN
+#if defined(__DARWIN) || defined(__CYGWIN)
 #include <netinet/in.h>
 #endif
+#ifndef __CYGWIN
 #include <netinet/ip6.h>
+#endif
 #include <errno.h>
 #include <string.h>
+#include <fcntl.h>
 
 #include "send_packets.h"
 #include "prepare_pcap.h"
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to