... and now with the attachment. (grumble)

-James

On Fri, Oct 14, 2011 at 10:04 AM, James Van Vleet
<ja...@bolderthinking.com>wrote:

> Hi all.  I would like to submit some patches that enable pcapplay to work
> with ims_bench.  I have tested these patches on multiple 32 and 64 bit Linux
> systems and I have run hundreds of thousands of test calls using them.
>
> The Makefile included with ims_bench is a little wacky but unchanged by me.
> To get the binaries necessary to run with pcapplay, I do the following:
>
> # make pcappplay_ossl does not make rmt first even though it requires rmt
> cd rmt/
> make
> cd ..
>
> #this makes the sipp with pcapplay.  note that just "make pcapplay" appears
> broken in the Makefile but pcap_play_ossl works fine
> make pcaplay_ossl
>
> #this makes the manager
> make
>
> Perhaps someone with more make-fu can help clean that up the Makefile.
>
> Thanks for the great products that are sipp and ims_bench.  I appreciate
> the effort put into them.
>
> -James
>
>
diff -bruN -x '*.o' -x entries -x .cproject -x .project -x .git ./actions.hpp /mnt/Eclipse/ims_bench/actions.hpp
--- ./actions.hpp	2011-10-14 08:30:51.649310135 -0500
+++ /mnt/Eclipse/ims_bench/actions.hpp	2011-07-11 13:54:20.646623354 -0500
@@ -151,7 +151,7 @@
 class CPcapAction : public CAction
 {
 public:
-  CPcapAction(T_ActionType P_type) : CAction(P_type) { }
+  CPcapAction(T_ActionType P_type) : CAction(P_type), M_pcapArgs(NULL) { }
   virtual ~CPcapAction();
   virtual void showInfo();
 
diff -bruN -x '*.o' -x entries -x .cproject -x .project -x .git ./call.cpp /mnt/Eclipse/ims_bench/call.cpp
--- ./call.cpp	2011-10-14 08:30:51.659310135 -0500
+++ /mnt/Eclipse/ims_bench/call.cpp	2011-10-13 15:17:40.884824676 -0500
@@ -683,7 +683,7 @@
   m_ctx_ssl(NULL), m_bio(NULL),
 #endif
 #ifdef PCAPPLAY
-  hasMediaInformation(0), play_args_a(0), play_args_v(0),
+  hasMediaInformation(0), play_args_a(), play_args_v(),
 #endif
 #ifdef _USE_OPENSSL
   dialog_authentication(NULL), dialog_challenge_type(0),
@@ -3907,13 +3907,14 @@
           case CAction::E_AT_PLAY_PCAP_AUDIO:
           case CAction::E_AT_PLAY_PCAP_VIDEO:
             {
+              CPcapAction* pAction = static_cast<CPcapAction*>(currentAction);
               play_args_t *play_args;
-              if (currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_AUDIO) {
+              if (pAction->getActionType() == CAction::E_AT_PLAY_PCAP_AUDIO) {
                 play_args = &(this->play_args_a);
-              } else if (currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_VIDEO) {
+              } else if (pAction->getActionType() == CAction::E_AT_PLAY_PCAP_VIDEO) {
                 play_args = &(this->play_args_v);
               }
-              play_args->pcap = currentAction->getPcapPkts();
+              play_args->pcap = pAction->getPcapPkts();
               /* port number is set in [auto_]media_port interpolation */
               if (media_ip_is_ipv6) {
                 struct sockaddr_in6 *from = (struct sockaddr_in6 *)(void *) &(play_args->from);
diff -bruN -x '*.o' -x entries -x .cproject -x .project -x .git ./ims_bench_pcap.diff /mnt/Eclipse/ims_bench/ims_bench_pcap.diff
--- ./ims_bench_pcap.diff	2011-10-14 09:46:55.849311772 -0500
+++ /mnt/Eclipse/ims_bench/ims_bench_pcap.diff	1969-12-31 18:00:00.000000000 -0600
@@ -1,42 +0,0 @@
-diff -bruN -x '*.o' -x entries -x .cproject -x .project -x .git ./actions.hpp /mnt/Eclipse/ims_bench/actions.hpp
---- ./actions.hpp	2011-10-14 08:30:51.649310135 -0500
-+++ /mnt/Eclipse/ims_bench/actions.hpp	2011-07-11 13:54:20.646623354 -0500
-@@ -151,7 +151,7 @@
- class CPcapAction : public CAction
- {
- public:
--  CPcapAction(T_ActionType P_type) : CAction(P_type) { }
-+  CPcapAction(T_ActionType P_type) : CAction(P_type), M_pcapArgs(NULL) { }
-   virtual ~CPcapAction();
-   virtual void showInfo();
- 
-diff -bruN -x '*.o' -x entries -x .cproject -x .project -x .git ./call.cpp /mnt/Eclipse/ims_bench/call.cpp
---- ./call.cpp	2011-10-14 08:30:51.659310135 -0500
-+++ /mnt/Eclipse/ims_bench/call.cpp	2011-10-13 15:17:40.884824676 -0500
-@@ -683,7 +683,7 @@
-   m_ctx_ssl(NULL), m_bio(NULL),
- #endif
- #ifdef PCAPPLAY
--  hasMediaInformation(0), play_args_a(0), play_args_v(0),
-+  hasMediaInformation(0), play_args_a(), play_args_v(),
- #endif
- #ifdef _USE_OPENSSL
-   dialog_authentication(NULL), dialog_challenge_type(0),
-@@ -3907,13 +3907,14 @@
-           case CAction::E_AT_PLAY_PCAP_AUDIO:
-           case CAction::E_AT_PLAY_PCAP_VIDEO:
-             {
-+              CPcapAction* pAction = static_cast<CPcapAction*>(currentAction);
-               play_args_t *play_args;
--              if (currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_AUDIO) {
-+              if (pAction->getActionType() == CAction::E_AT_PLAY_PCAP_AUDIO) {
-                 play_args = &(this->play_args_a);
--              } else if (currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_VIDEO) {
-+              } else if (pAction->getActionType() == CAction::E_AT_PLAY_PCAP_VIDEO) {
-                 play_args = &(this->play_args_v);
-               }
--              play_args->pcap = currentAction->getPcapPkts();
-+              play_args->pcap = pAction->getPcapPkts();
-               /* port number is set in [auto_]media_port interpolation */
-               if (media_ip_is_ipv6) {
-                 struct sockaddr_in6 *from = (struct sockaddr_in6 *)(void *) &(play_args->from);
diff -bruN -x '*.o' -x entries -x .cproject -x .project -x .git ./prepare_pcap.cpp /mnt/Eclipse/ims_bench/prepare_pcap.cpp
--- ./prepare_pcap.cpp	2011-10-14 08:30:51.659310135 -0500
+++ /mnt/Eclipse/ims_bench/prepare_pcap.cpp	2011-10-13 15:18:15.084824666 -0500
@@ -108,7 +108,7 @@
 #ifdef __HPUX
   pkthdr = (pcap_pkthdr *) malloc (sizeof (*pkthdr));
 #else
-  pkthdr = malloc (sizeof (*pkthdr));
+  pkthdr = (pcap_pkthdr *) malloc (sizeof (*pkthdr));
 #endif
   if (!pkthdr)
     ERROR("Can't allocate memory for pcap pkthdr");
diff -bruN -x '*.o' -x entries -x .cproject -x .project -x .git ./rmt_parms.cpp /mnt/Eclipse/ims_bench/rmt_parms.cpp
--- ./rmt_parms.cpp	2011-10-14 08:30:51.649310135 -0500
+++ /mnt/Eclipse/ims_bench/rmt_parms.cpp	2011-10-14 08:41:18.849310360 -0500
@@ -36,6 +36,7 @@
   RMT_PARM_MAP_ENTRY( SIPP_PARM_USER_NAME2,   "user_name2",    RmtParmInfo::TYPE_STR ),
   RMT_PARM_MAP_ENTRY( SIPP_PARM_USER_DOMAIN2, "user_domain2",  RmtParmInfo::TYPE_STR ),
   RMT_PARM_MAP_ENTRY( SIPP_PARM_PARTNER_ID, "partner_id",  RmtParmInfo::TYPE_INT16 ),
+  RMT_PARM_MAP_ENTRY( SIPP_PARM_USER_NAME,   "extension",    RmtParmInfo::TYPE_STR ),
   /*>>> Insert new ones above this line <<<*/
   RMT_PARM_MAP_ENTRY( SIPP_PARM_ID_MAX,      "",             RmtParmInfo::TYPE_NONE )
 };
diff -bruN -x '*.o' -x entries -x .cproject -x .project -x .git ./scenario.cpp /mnt/Eclipse/ims_bench/scenario.cpp
--- ./scenario.cpp	2011-10-14 08:30:51.659310135 -0500
+++ /mnt/Eclipse/ims_bench/scenario.cpp	2011-10-13 15:19:31.914824643 -0500
@@ -733,7 +733,7 @@
   }
 
 #ifdef PCAPPLAY
-  parseActions(a_rScen);
+  parseActions(a_ParseCtx);
 #endif
 }
 
@@ -1640,12 +1640,14 @@
 #ifdef PCAPPLAY
           } else if (ptr = xp_get_value((char *) "play_pcap_audio")) {
             CPcapAction* pAction = new CPcapAction(CAction::E_AT_PLAY_PCAP_AUDIO);
-            pAction->setPcapArgs(ptr);
+            char *FileExt = const_cast<char*> ( ptr );
+            pAction->setPcapArgs(FileExt);
             tmpActions->addAction(pAction);
             hasMedia = 1;
           } else if (ptr = xp_get_value((char *) "play_pcap_video")) {
             CPcapAction* pAction = new CPcapAction(CAction::E_AT_PLAY_PCAP_VIDEO);
-            pAction->setPcapArgs(ptr);
+            char *FileExt = const_cast<char*> ( ptr );
+            pAction->setPcapArgs(FileExt);
             tmpActions->addAction(pAction);
             hasMedia = 1;
 #else
diff -bruN -x '*.o' -x entries -x .cproject -x .project -x .git ./send_packets.cpp /mnt/Eclipse/ims_bench/send_packets.cpp
--- ./send_packets.cpp	2011-10-14 08:30:51.649310135 -0500
+++ /mnt/Eclipse/ims_bench/send_packets.cpp	2011-07-06 22:37:05.413313314 -0500
@@ -113,6 +113,15 @@
 void do_sleep (struct timeval *, struct timeval *,
                struct timeval *, struct timeval *);
 
+#ifdef __HPUX
+u_int16_t checksum_carry(int s) {
+#else
+inline u_int16_t checksum_carry(int s) {
+#endif
+	int s_c = (s >> 16) + (s & 0xffff);
+	return (~(s_c + (s_c >> 16)) & 0xffff);
+}
+
 int
 send_packets (play_args_t * play_args)
 {
@@ -173,26 +182,26 @@
 	
   while (pkt_index < pkt_max) {
     memcpy(udp, pkt_index->data, pkt_index->pktlen);
-    port_diff = ntohs (udp->uh_dport) - pkts->base;
+    port_diff = ntohs (udp->dest) - pkts->base;
     // modify UDP ports
-    udp->uh_sport = htons(port_diff + *from_port);
-    udp->uh_dport = htons(port_diff + *to_port);
+    udp->source = htons(port_diff + *from_port);
+    udp->dest = htons(port_diff + *to_port);
 
     if (!media_ip_is_ipv6) {
-      temp_sum = checksum_carry(pkt_index->partial_check + check((u_int16_t *) &(((struct sockaddr_in *)(void *) from)->sin_addr.s_addr), 4) + check((u_int16_t *) &(((struct sockaddr_in *)(void *) to)->sin_addr.s_addr), 4) + check((u_int16_t *) &udp->uh_sport, 4));
+      temp_sum = checksum_carry(pkt_index->partial_check + check((u_int16_t *) &(((struct sockaddr_in *)(void *) from)->sin_addr.s_addr), 4) + check((u_int16_t *) &(((struct sockaddr_in *)(void *) to)->sin_addr.s_addr), 4) + check((u_int16_t *) &udp->source, 4));
     }
     else {
-      temp_sum = checksum_carry(pkt_index->partial_check + check((u_int16_t *) &(from6.sin6_addr.s6_addr), 16) + check((u_int16_t *) &(to6.sin6_addr.s6_addr), 16) + check((u_int16_t *) &udp->uh_sport, 4));
+      temp_sum = checksum_carry(pkt_index->partial_check + check((u_int16_t *) &(from6.sin6_addr.s6_addr), 16) + check((u_int16_t *) &(to6.sin6_addr.s6_addr), 16) + check((u_int16_t *) &udp->source, 4));
     }
 
 #ifndef _HPUX_LI
 #ifdef __HPUX
-    udp->uh_sum = (temp_sum>>16)+((temp_sum & 0xffff)<<16);
+    udp->check = (temp_sum>>16)+((temp_sum & 0xffff)<<16);
 #else
-    udp->uh_sum = temp_sum;
+    udp->check = temp_sum;
 #endif
 #else
-    udp->uh_sum = temp_sum;
+    udp->check = temp_sum;
 #endif
 
     do_sleep ((struct timeval *) &pkt_index->ts, &last, &didsleep,
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Sipp-users mailing list
Sipp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sipp-users

Reply via email to