From: <cha...@us...> - 2008-07-18 11:09:25
|
Revision: 510 http://sipp.svn.sourceforge.net/sipp/?rev=510&view=rev Author: charlespwright Date: 2008-07-18 11:09:18 +0000 (Fri, 18 Jul 2008) Log Message: ----------- Fix: Valgrind detected bug fixes. Provided by Roland Meub. Modified Paths: -------------- sipp/trunk/call.cpp sipp/trunk/scenario.cpp sipp/trunk/stat.cpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-07-15 13:02:46 UTC (rev 509) +++ sipp/trunk/call.cpp 2008-07-18 11:09:18 UTC (rev 510) @@ -617,7 +617,9 @@ if (use_tdmmap) { tdm_map[tdm_map_number] = false; } - + + free(start_time_rtd); + free(rtd_done); free(debugBuffer); } Modified: sipp/trunk/scenario.cpp =================================================================== --- sipp/trunk/scenario.cpp 2008-07-15 13:02:46 UTC (rev 509) +++ sipp/trunk/scenario.cpp 2008-07-18 11:09:18 UTC (rev 510) @@ -685,9 +685,11 @@ if(!strcmp(elem, "CallLengthRepartition")) { ptr = xp_get_string("value", "CallLengthRepartition"); stats->setRepartitionCallLength(ptr); + free(ptr); } else if(!strcmp(elem, "ResponseTimeRepartition")) { ptr = xp_get_string("value", "ResponseTimeRepartition"); stats->setRepartitionResponseTime(ptr); + free(ptr); } else if(!strcmp(elem, "Global")) { ptr = xp_get_string("variables", "Global"); @@ -699,6 +701,7 @@ globalVariables->find(currentTabVarName[i], true); } freeStringTable(currentTabVarName, currentNbVarNames); + free(ptr); } else if(!strcmp(elem, "User")) { ptr = xp_get_string("variables", "User"); @@ -710,6 +713,7 @@ userVariables->find(currentTabVarName[i], true); } freeStringTable(currentTabVarName, currentNbVarNames); + free(ptr); } else if(!strcmp(elem, "Reference")) { ptr = xp_get_string("variables", "Reference"); @@ -724,6 +728,7 @@ } } freeStringTable(currentTabVarName, currentNbVarNames); + free(ptr); } else if(!strcmp(elem, "DefaultMessage")) { char *id = xp_get_string("id", "DefaultMessage"); if(!(ptr = xp_get_cdata())) { @@ -739,6 +744,7 @@ ERROR("The label name '%s' is used twice.", ptr); } labelMap[ptr] = messages.size(); + free(ptr); } else if (!strcmp(elem, "init")) { /* We have an init section, which must be full of nops or labels. */ int nop_cursor = 0; @@ -1370,6 +1376,7 @@ tmpAction->setCaseIndep(xp_get_bool("case_indep", "ereg", false)); tmpAction->setHeadersOnly(xp_get_bool("start_line", "ereg", false)); + free(ptr); if ( 0 != ( ptr = xp_get_value((char *)"search_in") ) ) { tmpAction->setOccurence(1); @@ -1511,6 +1518,7 @@ } else { ERROR("Invalid 'compare' parameter: %s", ptr); } + free(ptr); } else if(!strcmp(actionElem, "verifyauth")) { #ifdef _USE_OPENSSL tmpAction->setVarId(xp_get_var("assign_to", "verifyauth")); Modified: sipp/trunk/stat.cpp =================================================================== --- sipp/trunk/stat.cpp 2008-07-15 13:02:46 UTC (rev 509) +++ sipp/trunk/stat.cpp 2008-07-18 11:09:18 UTC (rev 510) @@ -149,6 +149,7 @@ delete [] M_ResponseTimeRepartition[i]; } } + free(M_ResponseTimeRepartition); if (M_CallLengthRepartition != NULL) delete [] M_CallLengthRepartition; @@ -174,6 +175,10 @@ if(M_dumpRespTime != NULL) delete [] M_dumpRespTime ; + free(M_rtdInfo); + for (int_str_map::iterator i = M_revRtdMap.begin(); i != M_revRtdMap.end(); ++i) { + free(i->second); + } M_SizeOfResponseTimeRepartition = 0; M_SizeOfCallLengthRepartition = 0; @@ -1064,7 +1069,8 @@ M_counterDumpRespTime = 0 ; M_dumpRespTime = NULL; M_fileNameRtt = NULL; - + M_rtdInfo = NULL; + init(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-07-22 19:06:12
|
Revision: 515 http://sipp.svn.sourceforge.net/sipp/?rev=515&view=rev Author: charlespwright Date: 2008-07-22 19:06:05 +0000 (Tue, 22 Jul 2008) Log Message: ----------- Enh: [file name=x] keyword allows inserting a file into a message. Modified Paths: -------------- sipp/trunk/call.cpp sipp/trunk/message.cpp sipp/trunk/message.hpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-07-22 18:20:22 UTC (rev 514) +++ sipp/trunk/call.cpp 2008-07-22 19:06:05 UTC (rev 515) @@ -2247,6 +2247,23 @@ *dest = '\0'; break; } + case E_Message_File: { + char buffer[MAX_HEADER_LEN]; + createSendingMessage(comp->comp_param.filename, -2, buffer, sizeof(buffer)); + FILE *f = fopen(buffer, "r"); + if (!f) { + ERROR("Could not open '%s': %s\n", buffer, strerror(errno)); + } + int ret; + while ((ret = fread(dest, 1, left, f)) > 0) { + left -= ret; + } + if (ret < 0) { + ERROR("Error reading '%s': %s\n", buffer, strerror(errno)); + } + fclose(f); + break; + } case E_Message_Injection: { char *orig_dest = dest; getFieldFromInputFile(comp->comp_param.field_param.filename, comp->comp_param.field_param.field, comp->comp_param.field_param.line, dest); Modified: sipp/trunk/message.cpp =================================================================== --- sipp/trunk/message.cpp 2008-07-22 18:20:22 UTC (rev 514) +++ sipp/trunk/message.cpp 2008-07-22 19:06:05 UTC (rev 515) @@ -246,6 +246,17 @@ /* Turn this into a new message component. */ newcomp->comp_param.field_param.line = new SendingMessage(msg_scenario, line, true); } + } else if(!strncmp(keyword, "file", strlen("file"))) { + newcomp->type = E_Message_File; + + /* Parse out the interesting things like file and number. */ + char fileName[KEYWORD_SIZE]; + getKeywordParam(keyword, "name=", fileName); + if (fileName[0] == '\0') { + ERROR("No name specified for 'file' keyword!\n"); + } + /* Turn this into a new message component. */ + newcomp->comp_param.filename = new SendingMessage(msg_scenario, fileName, true); } else if(*keyword == '$') { newcomp->type = E_Message_Variable; if (!msg_scenario) { Modified: sipp/trunk/message.hpp =================================================================== --- sipp/trunk/message.hpp 2008-07-22 18:20:22 UTC (rev 514) +++ sipp/trunk/message.hpp 2008-07-22 19:06:05 UTC (rev 515) @@ -82,6 +82,7 @@ E_Message_UserID, E_Message_Timestamp, E_Message_SippVersion, + E_Message_File, } MessageCompType; class SendingMessage { @@ -140,6 +141,7 @@ int field; SendingMessage *line; } field_param; + SendingMessage *filename; } comp_param; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-07-25 14:32:47
|
Revision: 519 http://sipp.svn.sourceforge.net/sipp/?rev=519&view=rev Author: charlespwright Date: 2008-07-25 14:32:45 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Enh: -sleep option pauses startup for a while after backgrounding SIPp. Modified Paths: -------------- sipp/trunk/sipp.cpp sipp/trunk/sipp.hpp Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-07-25 14:31:06 UTC (rev 518) +++ sipp/trunk/sipp.cpp 2008-07-25 14:32:45 UTC (rev 519) @@ -37,6 +37,8 @@ #include "sipp.hpp" #include "assert.h" +void sipp_usleep(unsigned long usec); + #ifdef _USE_OPENSSL SSL_CTX *sip_trp_ssl_ctx = NULL; /* For SSL cserver context */ SSL_CTX *sip_trp_ssl_ctx_client = NULL; /* For SSL cserver context */ @@ -221,6 +223,7 @@ {"no_rate_quit", "If -rate_increase is set, do not quit after the rate reaches -rate_max.", SIPP_OPTION_UNSETFLAG, &rate_quit, 1}, {"recv_timeout", "Global receive timeout. Default unit is milliseconds. If the expected message is not received, the call times out and is aborted.", SIPP_OPTION_TIME_MS_LONG, &defl_recv_timeout, 1}, {"send_timeout", "Global send timeout. Default unit is milliseconds. If a message is not sent (due to congestion), the call times out and is aborted.", SIPP_OPTION_TIME_MS_LONG, &defl_send_timeout, 1}, + {"sleep", "How long to sleep for at startup. Default unit is seconds.", SIPP_OPTION_TIME_SEC, &sleeptime, 1}, {"reconnect_close", "Should calls be closed on reconnect?", SIPP_OPTION_BOOL, &reset_close, 1}, {"reconnect_sleep", "How long (in milliseconds) to sleep between the close and reconnect?", SIPP_OPTION_TIME_MS, &reset_sleep, 1}, {"ringbuffer_files", "How many error/message files should be kept after rotation?", SIPP_OPTION_INT, &ringbuffer_files, 1}, @@ -3017,6 +3020,7 @@ if (!multisocket) { switch(transport) { case T_UDP: + WARNING("Connecting main socket: %p\n", main_socket); new_ptr->associate_socket(main_socket); main_socket->ss_count++; break; @@ -3806,7 +3810,8 @@ } if((fd = socket(use_ipv6 ? AF_INET6 : AF_INET, socket_type, 0))== -1) { - ERROR("Unable to get a %s socket", TRANSPORT_TO_STRING(transport)); + assert(0); + ERROR("Unable to get a %s socket (3)", TRANSPORT_TO_STRING(transport)); } return fd; @@ -4699,7 +4704,7 @@ FD_SETSIZE; #endif } - + rlimit.rlim_cur = rlimit.rlim_max; if (setrlimit (RLIMIT_NOFILE, &rlimit) < 0) { ERROR("Unable to increase the open file limit to FD_SETSIZE = %d", @@ -4766,6 +4771,7 @@ } } + sipp_usleep(sleeptime * 1000); /* Create the statistics reporting task. */ stattask::initialize(); Modified: sipp/trunk/sipp.hpp =================================================================== --- sipp/trunk/sipp.hpp 2008-07-25 14:31:06 UTC (rev 518) +++ sipp/trunk/sipp.hpp 2008-07-25 14:32:45 UTC (rev 519) @@ -187,6 +187,7 @@ extern bool rate_quit _DEFVAL(true); extern int users _DEFVAL(-1); extern int rate_period_ms _DEFVAL(DEFAULT_RATE_PERIOD_MS); +extern int sleeptime _DEFVAL(0); extern unsigned long defl_recv_timeout _DEFVAL(0); extern unsigned long defl_send_timeout _DEFVAL(0); extern unsigned long global_timeout _DEFVAL(0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-07-25 16:07:56
|
Revision: 520 http://sipp.svn.sourceforge.net/sipp/?rev=520&view=rev Author: charlespwright Date: 2008-07-25 16:01:23 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Fix: Do not create multiple RSA sockets when using -t u1. Modified Paths: -------------- sipp/trunk/call.cpp sipp/trunk/sipp.cpp sipp/trunk/sipp.hpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-07-25 14:32:45 UTC (rev 519) +++ sipp/trunk/call.cpp 2008-07-25 16:01:23 UTC (rev 520) @@ -846,28 +846,40 @@ if ((use_remote_sending_addr) && (sendMode == MODE_SERVER)) { if (!call_remote_socket) { - struct sockaddr_storage *L_dest = &remote_sending_sockaddr; + if (multisocket || !main_remote_socket) { + struct sockaddr_storage *L_dest = &remote_sending_sockaddr; - if((call_remote_socket= new_sipp_socket(use_ipv6, transport)) == NULL) { - ERROR_NO("Unable to get a socket for rsa option"); - } + if((call_remote_socket= new_sipp_socket(use_ipv6, transport)) == NULL) { + ERROR_NO("Unable to get a socket for rsa option"); + } - sipp_customize_socket(call_remote_socket); + sipp_customize_socket(call_remote_socket); - if(transport != T_UDP) { - if (sipp_connect_socket(call_remote_socket, L_dest)) { - if(errno == EINVAL){ - /* This occurs sometime on HPUX but is not a true INVAL */ - ERROR("Unable to connect a %s socket for rsa option, remote peer error", TRANSPORT_TO_STRING(transport)); - } else { - ERROR_NO("Unable to connect a socket for rsa option"); + if(transport != T_UDP) { + if (sipp_connect_socket(call_remote_socket, L_dest)) { + if(errno == EINVAL){ + /* This occurs sometime on HPUX but is not a true INVAL */ + ERROR("Unable to connect a %s socket for rsa option, remote peer error", TRANSPORT_TO_STRING(transport)); + } else { + ERROR_NO("Unable to connect a socket for rsa option"); + } } } + if (!multisocket) { + main_remote_socket = call_remote_socket; + } + } else { + assert(!multisocket); + assert(main_remote_socket); + call_remote_socket = associate_socket(main_remote_socket); + main_remote_socket->ss_count++; } } sock=call_remote_socket ; } + assert(sock); + rc = write_socket(sock, msg, strlen(msg), WS_BUFFER, &call_peer); if(rc == -1 && errno == EWOULDBLOCK) { return -1; Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-07-25 14:32:45 UTC (rev 519) +++ sipp/trunk/sipp.cpp 2008-07-25 16:01:23 UTC (rev 520) @@ -3020,7 +3020,6 @@ if (!multisocket) { switch(transport) { case T_UDP: - WARNING("Connecting main socket: %p\n", main_socket); new_ptr->associate_socket(main_socket); main_socket->ss_count++; break; @@ -3810,7 +3809,6 @@ } if((fd = socket(use_ipv6 ? AF_INET6 : AF_INET, socket_type, 0))== -1) { - assert(0); ERROR("Unable to get a %s socket (3)", TRANSPORT_TO_STRING(transport)); } Modified: sipp/trunk/sipp.hpp =================================================================== --- sipp/trunk/sipp.hpp 2008-07-25 14:32:45 UTC (rev 519) +++ sipp/trunk/sipp.hpp 2008-07-25 16:01:23 UTC (rev 520) @@ -381,8 +381,9 @@ /*********************** Global Sockets **********************/ -extern struct sipp_socket *main_socket _DEFVAL(0); -extern struct sipp_socket *tcp_multiplex _DEFVAL(0); +extern struct sipp_socket *main_socket _DEFVAL(NULL); +extern struct sipp_socket *main_remote_socket _DEFVAL(NULL); +extern struct sipp_socket *tcp_multiplex _DEFVAL(NULL); extern int media_socket _DEFVAL(0); extern int media_socket_video _DEFVAL(0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-08-15 18:13:05
|
Revision: 523 http://sipp.svn.sourceforge.net/sipp/?rev=523&view=rev Author: charlespwright Date: 2008-08-15 18:13:02 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Fix: If a call was created without a source (e.g., via 3pcc), allow the source to be set on the first incoming SIP message. Modified Paths: -------------- sipp/trunk/call.cpp sipp/trunk/call.hpp sipp/trunk/deadcall.cpp sipp/trunk/deadcall.hpp sipp/trunk/listener.hpp sipp/trunk/sipp.cpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-07-28 01:27:05 UTC (rev 522) +++ sipp/trunk/call.cpp 2008-08-15 18:13:02 UTC (rev 523) @@ -2819,7 +2819,7 @@ queued_msg = strdup(msg); } -bool call::process_incoming(char * msg) +bool call::process_incoming(char * msg, struct sockaddr_storage *src) { int reply_code; static char request[65]; @@ -2839,6 +2839,11 @@ /* Ignore the messages received during a pause if -pause_msg_ign is set */ if(call_scenario->messages[msg_index] -> M_type == MSG_TYPE_PAUSE && pause_msg_ign) return(true); + /* Get our destination if we have none. */ + if (call_peer.ss_family == AF_UNSPEC && src) { + memcpy(&call_peer, src, SOCK_ADDR_SIZE(src)); + } + /* Authorize nop as a first command, even in server mode */ if((msg_index == 0) && (call_scenario->messages[msg_index] -> M_type == MSG_TYPE_NOP)) { queue_up (msg); Modified: sipp/trunk/call.hpp =================================================================== --- sipp/trunk/call.hpp 2008-07-28 01:27:05 UTC (rev 522) +++ sipp/trunk/call.hpp 2008-08-15 18:13:02 UTC (rev 523) @@ -74,7 +74,7 @@ virtual ~call(); - virtual bool process_incoming(char * msg); + virtual bool process_incoming(char * msg, struct sockaddr_storage *src = NULL); virtual bool process_twinSippCom(char * msg); virtual bool run(); Modified: sipp/trunk/deadcall.cpp =================================================================== --- sipp/trunk/deadcall.cpp 2008-07-28 01:27:05 UTC (rev 522) +++ sipp/trunk/deadcall.cpp 2008-08-15 18:13:02 UTC (rev 523) @@ -62,7 +62,7 @@ free(reason); } -bool deadcall::process_incoming(char * msg) { +bool deadcall::process_incoming(char * msg, struct sockaddr_storage *src) { char buffer[MAX_HEADER_LEN]; CStat::globalStat(CStat::E_DEAD_CALL_MSGS); Modified: sipp/trunk/deadcall.hpp =================================================================== --- sipp/trunk/deadcall.hpp 2008-07-28 01:27:05 UTC (rev 522) +++ sipp/trunk/deadcall.hpp 2008-08-15 18:13:02 UTC (rev 523) @@ -5,7 +5,7 @@ deadcall(char *id, char * reason); ~deadcall(); - virtual bool process_incoming(char * msg); + virtual bool process_incoming(char * msg, struct sockaddr_storage *); virtual bool process_twinSippCom(char * msg); virtual bool run(); Modified: sipp/trunk/listener.hpp =================================================================== --- sipp/trunk/listener.hpp 2008-07-28 01:27:05 UTC (rev 522) +++ sipp/trunk/listener.hpp 2008-08-15 18:13:02 UTC (rev 523) @@ -34,7 +34,7 @@ listener(char *id, bool listening); virtual ~listener(); char *getId(); - virtual bool process_incoming(char * msg) = 0; + virtual bool process_incoming(char * msg, struct sockaddr_storage *src) = 0; virtual bool process_twinSippCom(char * msg) = 0; protected: Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-07-28 01:27:05 UTC (rev 522) +++ sipp/trunk/sipp.cpp 2008-08-15 18:13:02 UTC (rev 523) @@ -3067,7 +3067,7 @@ ERROR("Out of memory allocating a call!"); } CStat::globalStat(CStat::E_AUTO_ANSWERED); - call_ptr->process_incoming(msg); + call_ptr->process_incoming(msg, src); } else { /* We received a response not relating to any known call */ /* Do nothing, even if in auto answer mode */ @@ -3091,7 +3091,7 @@ } else { - listener_ptr -> process_incoming(msg); + listener_ptr -> process_incoming(msg, src); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-08-22 01:49:43
|
Revision: 525 http://sipp.svn.sourceforge.net/sipp/?rev=525&view=rev Author: charlespwright Date: 2008-08-22 01:49:41 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Enh: Allow regular expression matches on the body of the message. Modified Paths: -------------- sipp/trunk/actions.hpp sipp/trunk/call.cpp sipp/trunk/scenario.cpp Modified: sipp/trunk/actions.hpp =================================================================== --- sipp/trunk/actions.hpp 2008-08-21 16:10:41 UTC (rev 524) +++ sipp/trunk/actions.hpp 2008-08-22 01:49:41 UTC (rev 525) @@ -77,6 +77,7 @@ { E_LP_MSG = 0, E_LP_HDR, + E_LP_BODY, E_LP_NB_LOOKING_PLACE }; Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-08-21 16:10:41 UTC (rev 524) +++ sipp/trunk/call.cpp 2008-08-22 01:49:41 UTC (rev 525) @@ -3340,8 +3340,21 @@ return(call::E_AR_HDR_NOT_FOUND); } haystack = msgPart; + } else if(currentAction->getLookingPlace() == CAction::E_LP_BODY) { + haystack = strstr(msg, "\r\n\r\n"); + if (!haystack) { + if (currentAction->getCheckIt() == true) { + WARNING("Failed regexp match: body not found in message %s\n", msg); + return(call::E_AR_HDR_NOT_FOUND); + } + msgPart[0] = '\0'; + haystack = msgPart; + } + haystack += strlen("\r\n\r\n"); + } else if(currentAction->getLookingPlace() == CAction::E_LP_MSG) { + haystack = msg; } else { - haystack = msg; + ERROR("Invalid looking place: %d\n", currentAction->getLookingPlace()); } currentAction->executeRegExp(haystack, M_callVariableTable); Modified: sipp/trunk/scenario.cpp =================================================================== --- sipp/trunk/scenario.cpp 2008-08-21 16:10:41 UTC (rev 524) +++ sipp/trunk/scenario.cpp 2008-08-22 01:49:41 UTC (rev 525) @@ -1383,6 +1383,9 @@ if ( 0 == strcmp(ptr, (char *)"msg") ) { tmpAction->setLookingPlace(CAction::E_LP_MSG); tmpAction->setLookingChar (NULL); + } else if ( 0 == strcmp(ptr, (char *)"body") ) { + tmpAction->setLookingPlace(CAction::E_LP_BODY); + tmpAction->setLookingChar (NULL); } else if (!strcmp(ptr, (char *)"hdr")) { ptr = xp_get_value((char *)"header"); if (!ptr || !strlen(ptr)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-08-22 19:08:10
|
Revision: 527 http://sipp.svn.sourceforge.net/sipp/?rev=527&view=rev Author: charlespwright Date: 2008-08-22 19:08:05 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Fix: Factor out optional message checking into function and check nops. Modified Paths: -------------- sipp/trunk/scenario.cpp sipp/trunk/scenario.hpp Modified: sipp/trunk/scenario.cpp =================================================================== --- sipp/trunk/scenario.cpp 2008-08-22 03:32:16 UTC (rev 526) +++ sipp/trunk/scenario.cpp 2008-08-22 19:08:05 UTC (rev 527) @@ -634,16 +634,23 @@ /********************** Scenario File analyser **********************/ +void scenario::checkOptionalRecv(char *elem, unsigned int scenario_file_cursor) { + if (last_recv_optional) { + ERROR("<recv> before <%s> sequence without a mandatory message. Please remove one 'optional=true' (element %d).", elem, scenario_file_cursor); + } + last_recv_optional = false; +} + scenario::scenario(char * filename, int deflt) { char * elem; char *method_list = NULL; unsigned int scenario_file_cursor = 0; int L_content_length = 0 ; - unsigned int recv_count = 0; - unsigned int recv_opt_count = 0; char * peer; + last_recv_optional = false; + if(filename) { if(!xp_set_xml_buffer_from_file(filename)) { ERROR("Unable to load or parse '%s' xml scenario file", filename); @@ -776,15 +783,7 @@ messages.push_back(curmsg); if(!strcmp(elem, "send")) { - if (recv_count) { - if (recv_count != recv_opt_count) { - recv_count = 0; - recv_opt_count = 0; - } else { - ERROR("<recv> before <send> sequence without a mandatory message. Please remove one 'optional=true' (element %d).", scenario_file_cursor); - } - } - + checkOptionalRecv(elem, scenario_file_cursor); curmsg->M_type = MSG_TYPE_SEND; /* Sent messages descriptions */ if(!(ptr = xp_get_cdata())) { @@ -857,7 +856,6 @@ curmsg -> retrans_delay = xp_get_long("retrans", "retransmission timer", 0); curmsg -> timeout = xp_get_long("timeout", "message send timeout", 0); } else if(!strcmp(elem, (char *)"recv")) { - recv_count++; curmsg->M_type = MSG_TYPE_RECV; /* Received messages descriptions */ if((ptr = xp_get_value((char *)"response"))) { @@ -878,9 +876,7 @@ } curmsg->optional = xp_get_optional("optional", "recv"); - if (curmsg->optional) { - ++recv_opt_count; - } + last_recv_optional = curmsg->optional; curmsg->advance_state = xp_get_bool("advance_state", "recv", true); if (!curmsg->advance_state && curmsg->optional == OPTIONAL_FALSE) { ERROR("advance_state is allowed only for optional messages (index = %d)\n", messages.size() - 1); @@ -912,14 +908,7 @@ #endif } } else if(!strcmp(elem, "pause") || !strcmp(elem, "timewait")) { - if (recv_count) { - if (recv_count != recv_opt_count) { - recv_count = 0; - recv_opt_count = 0; - } else { - ERROR("<recv> before <send> sequence without a mandatory message. Please remove one 'optional=true' (element %d).", scenario_file_cursor); - } - } + checkOptionalRecv(elem, scenario_file_cursor); curmsg->M_type = MSG_TYPE_PAUSE; if (!strcmp(elem, "timewait")) { curmsg->timewait = true; @@ -951,17 +940,15 @@ } } else if(!strcmp(elem, "nop")) { + checkOptionalRecv(elem, scenario_file_cursor); /* Does nothing at SIP level. This message type can be used to handle * actions, increment counters, or for RTDs. */ curmsg->M_type = MSG_TYPE_NOP; } else if(!strcmp(elem, "recvCmd")) { - recv_count++; curmsg->M_type = MSG_TYPE_RECVCMD; curmsg->optional = xp_get_optional("optional", "recv"); - if (curmsg->optional) { - ++recv_opt_count; - } + last_recv_optional = curmsg->optional; /* 3pcc extended mode */ if((ptr = xp_get_value((char *)"src"))) { @@ -970,14 +957,7 @@ ERROR("You must specify a 'src' for recvCmd when using extended 3pcc mode!"); } } else if(!strcmp(elem, "sendCmd")) { - if (recv_count) { - if (recv_count != recv_opt_count) { - recv_count = 0; - recv_opt_count = 0; - } else { - ERROR("<recv> before <send> sequence without a mandatory message. Please remove one 'optional=true' (element %d).", scenario_file_cursor); - } - } + checkOptionalRecv(elem, scenario_file_cursor); curmsg->M_type = MSG_TYPE_SENDCMD; /* Sent messages descriptions */ Modified: sipp/trunk/scenario.hpp =================================================================== --- sipp/trunk/scenario.hpp 2008-08-22 03:32:16 UTC (rev 526) +++ sipp/trunk/scenario.hpp 2008-08-22 19:08:05 UTC (rev 527) @@ -207,6 +207,7 @@ void parseAction(CActions *actions); void handle_arithmetic(CAction *tmpAction, char *what); void handle_rhs(CAction *tmpAction, char *what); + void checkOptionalRecv(char *elem, unsigned int scenario_file_cursor); void apply_labels(msgvec v, str_int_map labels); void validate_variable_usage(); @@ -216,8 +217,8 @@ int xp_get_var(const char *name, const char *what); int xp_get_var(const char *name, const char *what, int defval); - bool hidedefault; + bool last_recv_optional; }; /* There are external variable containing the current scenario */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-08-28 16:01:02
|
Revision: 529 http://sipp.svn.sourceforge.net/sipp/?rev=529&view=rev Author: charlespwright Date: 2008-08-28 16:00:58 +0000 (Thu, 28 Aug 2008) Log Message: ----------- Fix: Resolve some signedness issues. Modified Paths: -------------- sipp/trunk/call.hpp sipp/trunk/sipp.cpp Modified: sipp/trunk/call.hpp =================================================================== --- sipp/trunk/call.hpp 2008-08-27 01:40:51 UTC (rev 528) +++ sipp/trunk/call.hpp 2008-08-28 16:00:58 UTC (rev 529) @@ -140,8 +140,8 @@ * a cause relationship, so the next time this cookie will be recvd, * we will retransmit the same message we sent this time */ unsigned long recv_retrans_hash; - unsigned int recv_retrans_recv_index; - unsigned int recv_retrans_send_index; + int recv_retrans_recv_index; + int recv_retrans_send_index; unsigned int recv_timeout; /* holds the route set */ Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-08-27 01:40:51 UTC (rev 528) +++ sipp/trunk/sipp.cpp 2008-08-28 16:00:58 UTC (rev 529) @@ -3863,7 +3863,6 @@ int test_socket = next_socket; next_socket = (next_socket + 1) % pollnfds; - assert(sockets[test_socket]->ss_call_socket >= 0); if (sockets[test_socket]->ss_call_socket) { sock = sockets[test_socket]; sock->ss_count++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-08-28 21:45:08
|
Revision: 530 http://sipp.svn.sourceforge.net/sipp/?rev=530&view=rev Author: charlespwright Date: 2008-08-28 21:45:03 +0000 (Thu, 28 Aug 2008) Log Message: ----------- Allow regular expressions to be matched against variables with search_in='var'. Modified Paths: -------------- sipp/trunk/actions.hpp sipp/trunk/call.cpp sipp/trunk/scenario.cpp Modified: sipp/trunk/actions.hpp =================================================================== --- sipp/trunk/actions.hpp 2008-08-28 16:00:58 UTC (rev 529) +++ sipp/trunk/actions.hpp 2008-08-28 21:45:03 UTC (rev 530) @@ -78,6 +78,7 @@ E_LP_MSG = 0, E_LP_HDR, E_LP_BODY, + E_LP_VAR, E_LP_NB_LOOKING_PLACE }; Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-08-28 16:00:58 UTC (rev 529) +++ sipp/trunk/call.cpp 2008-08-28 21:45:03 UTC (rev 530) @@ -3354,6 +3354,15 @@ haystack += strlen("\r\n\r\n"); } else if(currentAction->getLookingPlace() == CAction::E_LP_MSG) { haystack = msg; + } else if(currentAction->getLookingPlace() == CAction::E_LP_VAR) { + /* Get the input variable. */ + haystack = M_callVariableTable->getVar(currentAction->getVarInId())->getString(); + if (!haystack) { + if (currentAction->getCheckIt() == true) { + WARNING("Failed regexp match: variable $%d not set\n", currentAction->getVarInId()); + return(call::E_AR_HDR_NOT_FOUND); + } + } } else { ERROR("Invalid looking place: %d\n", currentAction->getLookingPlace()); } Modified: sipp/trunk/scenario.cpp =================================================================== --- sipp/trunk/scenario.cpp 2008-08-28 16:00:58 UTC (rev 529) +++ sipp/trunk/scenario.cpp 2008-08-28 21:45:03 UTC (rev 530) @@ -1367,6 +1367,9 @@ } else if ( 0 == strcmp(ptr, (char *)"body") ) { tmpAction->setLookingPlace(CAction::E_LP_BODY); tmpAction->setLookingChar (NULL); + } else if (!strcmp(ptr, (char *)"var")) { + tmpAction->setVarInId(xp_get_var("variable", "ereg")); + tmpAction->setLookingPlace(CAction::E_LP_VAR); } else if (!strcmp(ptr, (char *)"hdr")) { ptr = xp_get_value((char *)"header"); if (!ptr || !strlen(ptr)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-08-28 21:48:18
|
Revision: 531 http://sipp.svn.sourceforge.net/sipp/?rev=531&view=rev Author: charlespwright Date: 2008-08-28 21:48:16 +0000 (Thu, 28 Aug 2008) Log Message: ----------- Enh: Allow setdest to reconnect a TCP socket. Modified Paths: -------------- sipp/trunk/call.cpp sipp/trunk/call.hpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-08-28 21:45:03 UTC (rev 530) +++ sipp/trunk/call.cpp 2008-08-28 21:48:16 UTC (rev 531) @@ -1291,6 +1291,14 @@ new deadcall(id, reason_str); } break; + case E_AR_CONNECT_FAILED: + computeStat(CStat::E_CALL_FAILED); + computeStat(CStat::E_FAILED_TCP_CONNECT); + if (deadcall_wait && !initCall) { + sprintf(reason_str, "connection failed %d", msg_index); + new deadcall(id, reason_str); + } + break; case call::E_AR_NO_ERROR: case call::E_AR_STOP_CALL: /* Do nothing. */ @@ -2511,7 +2519,10 @@ call::last_action_result = actionResult; if (actionResult == E_AR_STOP_CALL) { return rejectCall(); - } + } else if (actionResult == E_AR_CONNECT_FAILED) { + terminate(CStat::E_FAILED_TCP_CONNECT); + return false; + } } } else { TRACE_MSG("Unexpected control message received (no such message found):\n%s\n", msg); @@ -3137,6 +3148,9 @@ call::last_action_result = actionResult; if (actionResult == E_AR_STOP_CALL) { return rejectCall(); + } else if (actionResult == E_AR_CONNECT_FAILED) { + terminate(CStat::E_FAILED_TCP_CONNECT); + return false; } } } @@ -3442,24 +3456,37 @@ char *endptr; int port = (int)strtod(str_port, &endptr); if (*endptr) { - ERROR("Invalid line number for replace: %s", str_port); + ERROR("Invalid port for setdest: %s", str_port); } int protocol; - if (!strcmp(str_protocol, "udp")) { + if (!strcmp(str_protocol, "udp") || !strcmp(str_protocol, "UDP")) { protocol = T_UDP; - } else if (!strcmp(str_protocol, "tcp")) { + } else if (!strcmp(str_protocol, "tcp") || !strcmp(str_protocol, "TCP")) { protocol = T_TCP; - } else if (!strcmp(str_protocol, "tls")) { + } else if (!strcmp(str_protocol, "tls") || !strcmp(str_protocol, "TLS")) { protocol = T_TLS; } else { ERROR("Unknown transport for setdest: '%s'", str_protocol); } - if (protocol != T_UDP) { - ERROR("The only supported protocol for changing destination is currently UDP."); + if (protocol != call_socket->ss_transport) { + ERROR("Can not switch protocols during setdest."); } + if (protocol == T_UDP) { + /* Nothing to do. */ + } else if (protocol == T_TLS) { + ERROR("Changing destinations is not supported for TLS."); + } else if (protocol == T_TCP) { + if (!multisocket) { + ERROR("Changing destinations for TCP requires multisocket mode."); + } + if (call_socket->ss_count > 1) { + ERROR("Can not change destinations for a TCP socket that has more than one user."); + } + } + struct addrinfo hints; struct addrinfo * local_addr; memset((char*)&hints, 0, sizeof(hints)); @@ -3479,10 +3506,42 @@ } else { (_RCAST(struct sockaddr_in6 *,&call_peer))->sin6_port = htons(port); } + memcpy(&call_socket->ss_dest, &call_peer, SOCK_ADDR_SIZE(_RCAST(struct sockaddr_storage *,&call_peer))); free(str_host); free(str_port); free(str_protocol); + + if (protocol == T_TCP) { + close(call_socket->ss_fd); + call_socket->ss_fd = -1; + if (sipp_reconnect_socket(call_socket)) { + if (reconnect_allowed()) { + if(errno == EINVAL){ + /* This occurs sometime on HPUX but is not a true INVAL */ + WARNING("Unable to connect a TCP socket, remote peer error"); + } else { + WARNING("Unable to connect a TCP socket"); + } + /* This connection failed. We must be in multisocket mode, because + * otherwise we would already have a call_socket. This call can not + * succeed, but does not affect any of our other calls. We do decrement + * the reconnection counter however. */ + if (reset_number != -1) { + reset_number--; + } + + return E_AR_CONNECT_FAILED; + } else { + if(errno == EINVAL){ + /* This occurs sometime on HPUX but is not a true INVAL */ + ERROR("Unable to connect a TCP socket, remote peer error"); + } else { + ERROR_NO("Unable to connect a TCP socket"); + } + } + } + } #ifdef _USE_OPENSSL } else if (currentAction->getActionType() == CAction::E_AT_VERIFY_AUTH) { bool result; Modified: sipp/trunk/call.hpp =================================================================== --- sipp/trunk/call.hpp 2008-08-28 21:45:03 UTC (rev 530) +++ sipp/trunk/call.hpp 2008-08-28 21:48:16 UTC (rev 531) @@ -205,6 +205,7 @@ E_AR_NO_ERROR = 0, E_AR_REGEXP_DOESNT_MATCH, E_AR_STOP_CALL, + E_AR_CONNECT_FAILED, E_AR_HDR_NOT_FOUND }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-08-28 22:06:13
|
Revision: 532 http://sipp.svn.sourceforge.net/sipp/?rev=532&view=rev Author: charlespwright Date: 2008-08-28 22:06:11 +0000 (Thu, 28 Aug 2008) Log Message: ----------- Enh: Allow setdest and max_allowed_socket to both take effect (you can't reuse a socket once setdest has been called on it). Modified Paths: -------------- sipp/trunk/call.cpp sipp/trunk/sipp.cpp sipp/trunk/sipp.hpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-08-28 21:48:16 UTC (rev 531) +++ sipp/trunk/call.cpp 2008-08-28 22:06:11 UTC (rev 532) @@ -3515,6 +3515,7 @@ if (protocol == T_TCP) { close(call_socket->ss_fd); call_socket->ss_fd = -1; + call_socket->ss_changed_dest = true; if (sipp_reconnect_socket(call_socket)) { if (reconnect_allowed()) { if(errno == EINVAL){ Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-08-28 21:48:16 UTC (rev 531) +++ sipp/trunk/sipp.cpp 2008-08-28 22:06:11 UTC (rev 532) @@ -3755,6 +3755,7 @@ ret->ss_fd = fd; ret->ss_comp_state = NULL; ret->ss_count = 1; + ret->ss_changed_dest = false; /* Initialize all sockets with our destination address. */ memcpy(&ret->ss_remote_sockaddr, &remote_sockaddr, sizeof(ret->ss_remote_sockaddr)); @@ -3864,6 +3865,17 @@ next_socket = (next_socket + 1) % pollnfds; if (sockets[test_socket]->ss_call_socket) { + /* Here we need to check that the address is the default. */ + if (sockets[test_socket]->ss_ipv6 != use_ipv6) { + continue; + } + if (sockets[test_socket]->ss_transport != transport) { + continue; + } + if (sockets[test_socket]->ss_changed_dest) { + continue; + } + sock = sockets[test_socket]; sock->ss_count++; *existing = true; Modified: sipp/trunk/sipp.hpp =================================================================== --- sipp/trunk/sipp.hpp 2008-08-28 21:48:16 UTC (rev 531) +++ sipp/trunk/sipp.hpp 2008-08-28 22:06:11 UTC (rev 532) @@ -522,6 +522,7 @@ bool ss_ipv6; bool ss_control; /* Is this a control socket? */ bool ss_call_socket; /* Is this a call socket? */ + bool ss_changed_dest; /* Has the destination changed from default. */ int ss_fd; /* The underlying file descriptor for this socket. */ void *ss_comp_state; /* The compression state. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-09-22 15:46:32
|
Revision: 536 http://sipp.svn.sourceforge.net/sipp/?rev=536&view=rev Author: charlespwright Date: 2008-09-22 15:43:59 +0000 (Mon, 22 Sep 2008) Log Message: ----------- Enh: Allow sending of NUL characters inside of literals (Provided by Andy Aicken). Modified Paths: -------------- sipp/trunk/call.cpp sipp/trunk/call.hpp sipp/trunk/message.cpp sipp/trunk/message.hpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-09-22 15:12:06 UTC (rev 535) +++ sipp/trunk/call.cpp 2008-09-22 15:43:59 UTC (rev 536) @@ -34,6 +34,7 @@ * Marc Van Diest from Belgacom * Michael Dwyer from Cibation * Roland Meub + * Andy Aicken */ #include <iterator> @@ -364,6 +365,7 @@ msg_index = 0; last_send_index = 0; last_send_msg = NULL; + last_send_len = 0; last_recv_hash = 0; last_recv_index = -1; @@ -818,7 +820,7 @@ return (((double)rand() / (double)RAND_MAX) < (percent / 100.0)); } -int call::send_raw(char * msg, int index) +int call::send_raw(char * msg, int index, int len) { struct sipp_socket *sock; int rc; @@ -878,9 +880,14 @@ sock=call_remote_socket ; } + // If the length hasn't been explicitly specified, treat the message as a string + if (len==0) { + len = strlen(msg); + } + assert(sock); - rc = write_socket(sock, msg, strlen(msg), WS_BUFFER, &call_peer); + rc = write_socket(sock, msg, len, WS_BUFFER, &call_peer); if(rc == -1 && errno == EWOULDBLOCK) { return -1; } @@ -896,10 +903,10 @@ /* This method is used to send messages that are not */ /* part of the XML scenario */ -void call::sendBuffer(char * msg) +void call::sendBuffer(char * msg, int len) { /* call send_raw but with a special scenario index */ - if (send_raw(msg, -1) < 0) { + if (send_raw(msg, -1, len) < 0) { if (sendbuffer_warn) { ERROR_NO("Error sending raw message"); } else { @@ -1182,10 +1189,8 @@ } -char * call::send_scene(int index, int *send_status) +char * call::send_scene(int index, int *send_status, int *len) { - static char msg_buffer[SIPP_MAX_MSG_SIZE]; - #define MAX_MSG_NAME_SIZE 30 static char msg_name[MAX_MSG_NAME_SIZE]; char *L_ptr1 ; @@ -1209,12 +1214,11 @@ assert(call_scenario->messages[index]->send_scheme); char * dest; - dest = createSendingMessage(call_scenario->messages[index] -> send_scheme, index); - strcpy(msg_buffer, dest); + dest = createSendingMessage(call_scenario->messages[index] -> send_scheme, index, len); if (dest) { L_ptr1=msg_name ; - L_ptr2=msg_buffer ; + L_ptr2=dest ; while ((*L_ptr2 != ' ') && (*L_ptr2 != '\n') && (*L_ptr2 != '\t')) { *L_ptr1 = *L_ptr2; L_ptr1 ++; @@ -1228,9 +1232,9 @@ ack_is_pending = false ; } - *send_status = send_raw(msg_buffer, index); + *send_status = send_raw(dest, index, *len); - return msg_buffer; + return dest; } void call::do_bookkeeping(message *curmsg) { @@ -1414,6 +1418,7 @@ else if(curmsg -> send_scheme) { char * msg_snd; + int msgLen; int send_status; /* Do not send a new message until the previous one which had @@ -1441,7 +1446,7 @@ incr_cseq = 1; } - msg_snd = send_scene(msg_index, &send_status); + msg_snd = send_scene(msg_index, &send_status, &msgLen); if(send_status == -1 && errno == EWOULDBLOCK) { if (incr_cseq) --cseq; /* Have we set the timeout yet? */ @@ -1476,8 +1481,10 @@ send_timeout = 0; last_send_index = curmsg->index; - last_send_msg = (char *) realloc(last_send_msg, strlen(msg_snd) + 1); - strcpy(last_send_msg, msg_snd); + last_send_len = msgLen; + last_send_msg = (char *) realloc(last_send_msg, msgLen+1); + memcpy(last_send_msg, msg_snd, msgLen); + last_send_msg[msgLen] = '\0'; if (curmsg->start_txn) { transactions[curmsg->start_txn - 1].txnID = (char *)realloc(transactions[curmsg->start_txn - 1].txnID, MAX_HEADER_LEN); @@ -1677,7 +1684,7 @@ nb_last_delay = DEFAULT_T2_TIMER_VALUE; } } - if(send_raw(last_send_msg, last_send_index) < -1) { + if(send_raw(last_send_msg, last_send_index, last_send_len) < -1) { return false; } call_scenario->messages[last_send_index] -> nb_sent_retrans++; @@ -2032,12 +2039,12 @@ } -char* call::createSendingMessage(SendingMessage *src, int P_index) { +char* call::createSendingMessage(SendingMessage *src, int P_index, int *msgLen) { static char msg_buffer[SIPP_MAX_MSG_SIZE+2]; - return createSendingMessage(src, P_index, msg_buffer, sizeof(msg_buffer)); + return createSendingMessage(src, P_index, msg_buffer, sizeof(msg_buffer), msgLen); } -char* call::createSendingMessage(SendingMessage *src, int P_index, char *msg_buffer, int buf_len) +char* call::createSendingMessage(SendingMessage *src, int P_index, char *msg_buffer, int buf_len, int *msgLen) { char * length_marker = NULL; char * auth_marker = NULL; @@ -2060,7 +2067,9 @@ dest += snprintf(dest, left, "%s", ptr); supresscrlf = false; } else { - dest += snprintf(dest, left, "%s", comp->literal); + memcpy(dest, comp->literal, comp->literalLen); + dest += comp->literalLen; + *dest = '\0'; } break; case E_Message_Remote_IP: @@ -2457,6 +2466,10 @@ SendingMessage::freeMessageComponent(auth_comp); } + if (msgLen != NULL) { + *msgLen = dest - msg_buffer; + } + return msg_buffer; } @@ -2888,7 +2901,7 @@ call_scenario->messages[recv_retrans_recv_index] -> nb_recv_retrans++; - send_scene(recv_retrans_send_index, &status); + send_scene(recv_retrans_send_index, &status, NULL); if(status >= 0) { call_scenario->messages[recv_retrans_send_index] -> nb_sent_retrans++; Modified: sipp/trunk/call.hpp =================================================================== --- sipp/trunk/call.hpp 2008-09-22 15:12:06 UTC (rev 535) +++ sipp/trunk/call.hpp 2008-09-22 15:43:59 UTC (rev 536) @@ -16,6 +16,7 @@ * Author : Richard GAYRAUD - 04 Nov 2003 * From Hewlett Packard Company. * Charles P. Wright from IBM Research + * Andy Aicken */ #ifndef __CALL__ @@ -124,6 +125,7 @@ * are kept in this index.) */ int last_send_index; char * last_send_msg; + int last_send_len; /* How long until sending this message times out. */ unsigned int send_timeout; @@ -228,9 +230,9 @@ // P_index use for message index in scenario and ctrl of CRLF // P_index = -2 No ctrl of CRLF // P_index = -1 Add crlf to end of message - char* createSendingMessage(SendingMessage *src, int P_index); + char* createSendingMessage(SendingMessage *src, int P_index, int *msgLen=NULL); char* createSendingMessage(char * src, int P_index, bool skip_sanity = false); - char* createSendingMessage(SendingMessage *src, int P_index, char *msg_buffer, int buflen); + char* createSendingMessage(SendingMessage *src, int P_index, char *msg_buffer, int buflen, int *msgLen=NULL); // method for the management of unexpected messages bool checkInternalCmd(char* cmd); // check of specific internal command @@ -241,7 +243,7 @@ int search_index); // 3pcc extended mode:check if // the twin message received // comes from the expected sender - void sendBuffer(char *buf); // send a message out of a scenario + void sendBuffer(char *buf, int len = 0); // send a message out of a scenario // execution T_AutoMode checkAutomaticResponseMode(char * P_recv); @@ -270,8 +272,8 @@ void extract_cseq_method (char* responseCseq, char* msg); void extract_transaction (char* txn, char* msg); - int send_raw(char * msg, int index); - char * send_scene(int index, int *send_status); + int send_raw(char * msg, int index, int len); + char * send_scene(int index, int *send_status, int *msgLen); bool connect_socket_if_needed(); char * compute_cseq(char * src); Modified: sipp/trunk/message.cpp =================================================================== --- sipp/trunk/message.cpp 2008-09-22 15:12:06 UTC (rev 535) +++ sipp/trunk/message.cpp 2008-09-22 15:43:59 UTC (rev 536) @@ -33,6 +33,7 @@ * Ben Evans from Open Cloud * Marc Van Diest from Belgacom * Stefan Esser + * Andy Aicken */ #include "sipp.hpp" @@ -86,6 +87,7 @@ SendingMessage::SendingMessage(scenario *msg_scenario, char *src, bool skip_sanity) { char *osrc = src; char * literal; + int literalLen; char * dest; char * key; char current_line[MAX_HEADER_LEN]; @@ -96,6 +98,7 @@ this->msg_scenario = msg_scenario; dest = literal = (char *)malloc(strlen(src) + num_cr + 1); + literalLen = 0; current_line[0] = '\0'; *dest = 0; @@ -132,7 +135,8 @@ } else { /* We have found a keyword, store the literal that we have been generating. */ *dest = '\0'; - literal = (char *)realloc(literal, strlen(literal) + 1); + literalLen = dest - literal; + literal = (char *)realloc(literal, literalLen); if (!literal) { ERROR("Out of memory!"); } MessageComponent *newcomp = (MessageComponent *)calloc(1, sizeof(MessageComponent)); @@ -140,9 +144,11 @@ newcomp->type = E_Message_Literal; newcomp->literal = literal; + newcomp->literalLen = literalLen; // length without the terminator messageComponents.push_back(newcomp); dest = literal = (char *)malloc(strlen(src) + num_cr + 1); + literalLen = 0; *dest = '\0'; /* Now lets determine which keyword we have. */ @@ -275,6 +281,7 @@ getKeywordParam(keyword, "variable=", varName); newcomp->literal = strdup(filltext); + newcomp->literalLen = strlen(newcomp->literal); if (!msg_scenario) { ERROR("SendingMessage with variable usage outside of scenario!"); } @@ -282,6 +289,7 @@ } else if(!strncmp(keyword, "last_", strlen("last_"))) { newcomp->type = E_Message_Last_Header; newcomp->literal = strdup(keyword + strlen("last_")); + newcomp->literalLen = strlen(newcomp->literal); } else if(!strncmp(keyword, "authentication", strlen("authentication"))) { parseAuthenticationKeyword(msg_scenario, newcomp, keyword); } @@ -308,6 +316,7 @@ if(!strcmp(keyword, msg1)) { newcomp->type = E_Message_Literal; newcomp->literal = strdup(msg2); + newcomp->literalLen = strlen(newcomp->literal); break; } ++i; @@ -323,7 +332,8 @@ } if (literal[0]) { *dest++ = '\0'; - literal = (char *)realloc(literal, strlen(literal) + 1); + literalLen = dest - literal; + literal = (char *)realloc(literal, literalLen); if (!literal) { ERROR("Out of memory!"); } MessageComponent *newcomp = (MessageComponent *)calloc(1, sizeof(MessageComponent)); @@ -331,6 +341,7 @@ newcomp->type = E_Message_Literal; newcomp->literal = literal; + newcomp->literalLen = literalLen-1; messageComponents.push_back(newcomp); } else { free(literal); Modified: sipp/trunk/message.hpp =================================================================== --- sipp/trunk/message.hpp 2008-09-22 15:12:06 UTC (rev 535) +++ sipp/trunk/message.hpp 2008-09-22 15:43:59 UTC (rev 536) @@ -32,6 +32,7 @@ * Jan Andres from Freenet * Ben Evans from Open Cloud * Marc Van Diest from Belgacom + * Andy Aicken */ #ifndef __MESSAGE__ @@ -124,6 +125,7 @@ struct MessageComponent { MessageCompType type; char *literal; + int literalLen; int offset; int varId; union u { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-09-25 02:37:41
|
Revision: 538 http://sipp.svn.sourceforge.net/sipp/?rev=538&view=rev Author: charlespwright Date: 2008-09-25 02:35:53 +0000 (Thu, 25 Sep 2008) Log Message: ----------- Enh: -timeout_error flag will immediately terminate SIPp with a fatal error if the global timeout (-timeout) is reached. Modified Paths: -------------- sipp/trunk/sipp.cpp sipp/trunk/sipp.hpp Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-09-22 15:48:36 UTC (rev 537) +++ sipp/trunk/sipp.cpp 2008-09-25 02:35:53 UTC (rev 538) @@ -272,6 +272,7 @@ , SIPP_OPTION_TRANSPORT, NULL, 1}, {"timeout", "Global timeout. Default unit is seconds. If this option is set, SIPp quits after nb units (-timeout 20s quits after 20 seconds).", SIPP_OPTION_TIME_SEC, &global_timeout, 1}, + {"timeout_error", "SIPp fails if the global timeout is reached is set (-timeout option required).", SIPP_OPTION_SETFLAG, &timeout_error, 1}, {"timer_resol", "Set the timer resolution. Default unit is milliseconds. This option has an impact on timers precision." "Small values allow more precise scheduling but impacts CPU usage." "If the compression is on, the value is set to 50ms. The default value is 10ms.", SIPP_OPTION_TIME_MS, &timer_resolution, 1}, @@ -3239,6 +3240,9 @@ } void timeout_alarm(int param){ + if (timeout_error) { + ERROR("%s timed out after '%.3lf' seconds", scenario_file, ((double)clock_tick / 1000LL)); + } quitting = 1; timeout_exit = true; } Modified: sipp/trunk/sipp.hpp =================================================================== --- sipp/trunk/sipp.hpp 2008-09-22 15:48:36 UTC (rev 537) +++ sipp/trunk/sipp.hpp 2008-09-25 02:35:53 UTC (rev 538) @@ -216,6 +216,7 @@ extern char * stat_delimiter _DEFVAL(";"); extern bool timeout_exit _DEFVAL(false); +extern bool timeout_error _DEFVAL(false); extern unsigned long report_freq_dumpRtt _DEFVAL (DEFAULT_FREQ_DUMP_RTT); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-09-25 12:34:16
|
Revision: 540 http://sipp.svn.sourceforge.net/sipp/?rev=540&view=rev Author: charlespwright Date: 2008-09-25 11:50:51 +0000 (Thu, 25 Sep 2008) Log Message: ----------- Fix: Correct error messages with 3pcc non-extended mode. Modified Paths: -------------- sipp/trunk/scenario.cpp sipp/trunk/sipp.cpp Modified: sipp/trunk/scenario.cpp =================================================================== --- sipp/trunk/scenario.cpp 2008-09-25 11:32:11 UTC (rev 539) +++ sipp/trunk/scenario.cpp 2008-09-25 11:50:51 UTC (rev 540) @@ -977,7 +977,7 @@ strcpy(infos.peer_host, get_peer_addr(peer)); peers[std::string(peer)] = infos; } - } else if (twinSippMode) { + } else if (extendedTwinSippMode) { ERROR("You must specify a 'dest' for sendCmd with extended 3pcc mode!"); } Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-09-25 11:32:11 UTC (rev 539) +++ sipp/trunk/sipp.cpp 2008-09-25 11:50:51 UTC (rev 540) @@ -1233,9 +1233,6 @@ case MODE_3PCC_CONTROLLER_A : fprintf(f,"----------------------- 3PCC Mode - Controller A side -------------------------" SIPP_ENDL); break; - case MODE_3PCC_CONTROLLER_B : - fprintf(f,"----------------------- 3PCC Mode - Controller B side -------------------------" SIPP_ENDL); - break; case MODE_3PCC_NONE: fprintf(f,"------ [+|-|*|/]: Adjust rate ---- [q]: Soft exit ---- [p]: Pause traffic -----" SIPP_ENDL); break; @@ -1248,6 +1245,9 @@ case MODE_3PCC_A_PASSIVE : fprintf(f,"------------------ 3PCC Mode - Controller A side (passive) --------------------" SIPP_ENDL); break; + case MODE_3PCC_CONTROLLER_B : + fprintf(f,"----------------------- 3PCC Mode - Controller B side -------------------------" SIPP_ENDL); + break; case MODE_MASTER_PASSIVE : fprintf(f,"------------------ 3PCC extended mode - Master side (passive) --------------------" SIPP_ENDL); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-09-25 14:27:17
|
Revision: 541 http://sipp.svn.sourceforge.net/sipp/?rev=541&view=rev Author: charlespwright Date: 2008-09-25 14:27:13 +0000 (Thu, 25 Sep 2008) Log Message: ----------- Fix: Correct problems with NUL message handling corrupting authenticated messages. Modified Paths: -------------- sipp/trunk/call.cpp sipp/trunk/message.cpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-09-25 11:50:51 UTC (rev 540) +++ sipp/trunk/call.cpp 2008-09-25 14:27:13 UTC (rev 541) @@ -1195,6 +1195,7 @@ static char msg_name[MAX_MSG_NAME_SIZE]; char *L_ptr1 ; char *L_ptr2 ; + int uselen = 0; assert(send_status); @@ -1213,6 +1214,10 @@ assert(call_scenario->messages[index]->send_scheme); + if (!len) { + len = &uselen; + } + char * dest; dest = createSendingMessage(call_scenario->messages[index] -> send_scheme, index, len); @@ -2382,7 +2387,7 @@ if (body && dest - body > 4 && dest - body < 100004) { char tmp = length_marker[5]; - sprintf(length_marker, "%5u", dest - body - 4 + len_offset); + sprintf(length_marker, "%5u", (unsigned)(dest - body - 4 + len_offset)); length_marker[5] = tmp; } else { // Other cases: Content-Length is 0 @@ -2390,6 +2395,10 @@ } } + if (msgLen) { + *msgLen = dest - msg_buffer; + } + /* * The authentication substitution must be done outside the above * loop because auth-int will use the body (which must have already @@ -2459,6 +2468,9 @@ memmove(auth_marker + authlen, auth_marker + auth_marker_len, strlen(auth_marker + auth_marker_len) + 1); /* Copy our result into the hole. */ memcpy(auth_marker, result, authlen); + if (msgLen) { + *msgLen += (authlen - auth_marker_len); + } #endif } @@ -2466,10 +2478,6 @@ SendingMessage::freeMessageComponent(auth_comp); } - if (msgLen != NULL) { - *msgLen = dest - msg_buffer; - } - return msg_buffer; } Modified: sipp/trunk/message.cpp =================================================================== --- sipp/trunk/message.cpp 2008-09-25 11:50:51 UTC (rev 540) +++ sipp/trunk/message.cpp 2008-09-25 14:27:13 UTC (rev 541) @@ -137,7 +137,7 @@ literalLen = dest - literal; if (literalLen) { *dest = '\0'; - literal = (char *)realloc(literal, literalLen); + literal = (char *)realloc(literal, literalLen + 1); if (!literal) { ERROR("Out of memory!"); } MessageComponent *newcomp = (MessageComponent *)calloc(1, sizeof(MessageComponent)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-09-26 03:02:07
|
Revision: 542 http://sipp.svn.sourceforge.net/sipp/?rev=542&view=rev Author: charlespwright Date: 2008-09-26 03:02:03 +0000 (Fri, 26 Sep 2008) Log Message: ----------- Enh: Add abstraction for the various log files. Modified Paths: -------------- sipp/trunk/screen.cpp sipp/trunk/sipp.cpp sipp/trunk/sipp.hpp Modified: sipp/trunk/screen.cpp =================================================================== --- sipp/trunk/screen.cpp 2008-09-25 14:27:13 UTC (rev 541) +++ sipp/trunk/screen.cpp 2008-09-26 03:02:03 UTC (rev 542) @@ -168,9 +168,9 @@ "Max file size reached - no more logs\n", CStat::formatTime(¤tTime)); fflush(f); - stop_all_traces(); + stop_all_traces(); print_all_responses = 0; - screen_errorf = 0; + error_lfi.fptr = NULL; } @@ -231,33 +231,33 @@ c+= sprintf(c, ".\n"); screen_errors++; - if(screen_inited && !screen_errorf && print_all_responses) { + if(screen_inited && !error_lfi.fptr && print_all_responses) { rotate_errorf(); - if(!screen_errorf) { + if(!error_lfi.fptr) { c += sprintf(c, "%s: Unable to create '%s': %s.\n", screen_exename, screen_logfile, strerror(errno)); screen_exit(EXIT_FATAL_ERROR); } else { - fprintf(screen_errorf, "%s: The following events occured:\n", + fprintf(error_lfi.fptr, "%s: The following events occured:\n", screen_exename); - fflush(screen_errorf); + fflush(error_lfi.fptr); } } - if(screen_errorf) { - count += fprintf(screen_errorf, "%s", screen_last_error); - fflush(screen_errorf); + if(error_lfi.fptr) { + count += fprintf(error_lfi.fptr, "%s", screen_last_error); + fflush(error_lfi.fptr); if (ringbuffer_size && count > ringbuffer_size) { rotate_errorf(); count = 0; } if (max_log_size && count > max_log_size) { print_all_responses = 0; - if (screen_errorf) { - fflush(screen_errorf); - fclose(screen_errorf); - screen_errorf = NULL; - errorf_overwrite = false; + if (error_lfi.fptr) { + fflush(error_lfi.fptr); + fclose(error_lfi.fptr); + error_lfi.fptr = NULL; + error_lfi.overwrite = false; } } } else if (fatal) { Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-09-25 14:27:13 UTC (rev 541) +++ sipp/trunk/sipp.cpp 2008-09-26 03:02:03 UTC (rev 542) @@ -40,6 +40,11 @@ void sipp_usleep(unsigned long usec); +void rotate_messagef(); +void rotate_calldebugf(); +void rotate_shortmessagef(); +void rotate_logfile(); + #ifdef _USE_OPENSSL SSL_CTX *sip_trp_ssl_ctx = NULL; /* For SSL cserver context */ SSL_CTX *sip_trp_ssl_ctx_client = NULL; /* For SSL cserver context */ @@ -1667,6 +1672,15 @@ } } +void log_off(struct logfile_info *lfi) { + if (lfi->fptr) { + fflush(lfi->fptr); + fclose(lfi->fptr); + lfi->fptr = NULL; + lfi->overwrite = false; + } +} + void process_trace(char *what) { bool on = false; char *rest = strchr(what, ' '); @@ -1703,15 +1717,10 @@ print_all_responses = 1; } else { print_all_responses = 0; - if (screen_errorf) { - fflush(screen_errorf); - fclose(screen_errorf); - screen_errorf = NULL; - errorf_overwrite = false; - } + log_off(&error_lfi); } } else if (!strcmp(what, "logs")) { - if (on == !!logfile) { + if (on == !!log_lfi.fptr) { return; } if (on) { @@ -1719,13 +1728,10 @@ rotate_logfile(); } else { useLogf = 0; - fflush(logfile); - fclose(logfile); - logfile = NULL; - logfile_overwrite = false; + log_off(&log_lfi); } } else if (!strcmp(what, "messages")) { - if (on == !!messagef) { + if (on == !!message_lfi.fptr) { return; } if (on) { @@ -1733,13 +1739,10 @@ rotate_logfile(); } else { useMessagef = 0; - fflush(messagef); - fclose(messagef); - messagef = NULL; - messagef_overwrite = false; + log_off(&message_lfi); } } else if (!strcmp(what, "shortmessages")) { - if (on == !!shortmessagef) { + if (on == !!shortmessage_lfi.fptr) { return; } @@ -1748,10 +1751,7 @@ rotate_shortmessagef(); } else { useShortMessagef = 0; - fflush(shortmessagef); - fclose(shortmessagef); - shortmessagef = NULL; - shortmessagef_overwrite = false; + log_off(&shortmessage_lfi); } } else { WARNING("Unknown log file: %s", what); @@ -3716,12 +3716,10 @@ void stop_all_traces() { - if(messagef) messagef = NULL; - if(logfile) logfile = NULL; - // if(timeoutf) timeoutf = NULL; TODO: finish the -trace_timeout option implementation + message_lfi.fptr = NULL; + log_lfi.fptr = NULL; if(dumpInRtt) dumpInRtt = 0; if(dumpInFile) dumpInFile = 0; - } char* remove_pattern(char* P_buffer, char* P_extensionPattern) { @@ -5583,214 +5581,152 @@ } } -#ifdef __cplusplus -extern "C" { -#endif -int TRACE_MSG(char *fmt, ...) { - int ret = 0; - static unsigned long long count = 0; - if(messagef) { - va_list ap; - va_start(ap, fmt); - ret = vfprintf(messagef, fmt, ap); - va_end(ap); - fflush(messagef); +void rotatef(struct logfile_info *lfi) { + char L_rotate_file_name [MAX_PATH]; - count += ret; + sprintf (lfi->file_name, "%s_%d_%s.log", scenario_file, getpid(), lfi->name); - if (max_log_size && count > max_log_size) { - fclose(messagef); - messagef = NULL; + if (ringbuffer_files > 0) { + if (!lfi->ftimes) { + lfi->ftimes = (struct logfile_id *)calloc(ringbuffer_files, sizeof(struct logfile_id)); } - - if (ringbuffer_size && count > ringbuffer_size) { - rotate_messagef(); - count = 0; + /* We need to rotate away an existing file. */ + if (lfi->nfiles == ringbuffer_files) { + if ((lfi->ftimes)[0].n) { + sprintf(L_rotate_file_name, "%s_%d_%s_%lu.%d.log", scenario_file, getpid(), lfi->name, (lfi->ftimes)[0].start, (lfi->ftimes)[0].n); + } else { + sprintf(L_rotate_file_name, "%s_%d_%s_%lu.log", scenario_file, getpid(), lfi->name, (lfi->ftimes)[0].start); + } + unlink(L_rotate_file_name); + lfi->nfiles--; + memmove(lfi->ftimes, &((lfi->ftimes)[1]), sizeof(struct logfile_id) * (lfi->nfiles)); } + if (lfi->starttime) { + (lfi->ftimes)[lfi->nfiles].start = lfi->starttime; + (lfi->ftimes)[lfi->nfiles].n = 0; + /* If we have the same time, then we need to append an identifier. */ + if (lfi->nfiles && ((lfi->ftimes)[lfi->nfiles].start == (lfi->ftimes)[lfi->nfiles - 1].start)) { + (lfi->ftimes)[lfi->nfiles].n = (lfi->ftimes)[lfi->nfiles - 1].n + 1; + } + if ((lfi->ftimes)[lfi->nfiles].n) { + sprintf(L_rotate_file_name, "%s_%d_%s_%lu.%d.log", scenario_file, getpid(), lfi->name, (lfi->ftimes)[lfi->nfiles].start, (lfi->ftimes)[lfi->nfiles].n); + } else { + sprintf(L_rotate_file_name, "%s_%d_%s_%lu.log", scenario_file, getpid(), lfi->name, (lfi->ftimes)[lfi->nfiles].start); + } + lfi->nfiles++; + fflush(lfi->fptr); + fclose(lfi->fptr); + lfi->fptr = NULL; + rename(lfi->file_name, L_rotate_file_name); + } } - return ret; + + time(&lfi->starttime); + if (lfi->overwrite) { + lfi->fptr = fopen(lfi->file_name, "w"); + } else { + lfi->fptr = fopen(lfi->file_name, "a"); + lfi->overwrite = true; + } + if(lfi->check && !lfi->fptr) { + /* We can not use the error functions from this function, as we may be rotating the error log itself! */ + ERROR("Unable to create '%s'", lfi->file_name); + } } -int TRACE_SHORTMSG(char *fmt, ...) { - int ret = 0; - static unsigned long long count = 0; - if(shortmessagef) { - va_list ap; - va_start(ap, fmt); - ret = vfprintf(shortmessagef, fmt, ap); - va_end(ap); - fflush(shortmessagef); +void rotate_calldebugf() { + rotatef(&calldebug_lfi); +} - count += ret; +void rotate_messagef() { + rotatef(&message_lfi); +} - if (max_log_size && count > max_log_size) { - fclose(shortmessagef); - shortmessagef = NULL; - } - if (ringbuffer_size && count > ringbuffer_size) { - rotate_shortmessagef(); - count = 0; - } - } - return ret; +void rotate_shortmessagef() { + rotatef(&shortmessage_lfi); } -int LOG_MSG(char *fmt, ...) { - int ret = 0; - static unsigned long long count = 0; - if(logfile) { - va_list ap; - va_start(ap, fmt); - ret = vfprintf(logfile, fmt, ap); - va_end(ap); - fflush(logfile); - count += ret; +void rotate_logfile() { + rotatef(&log_lfi); +} - if (max_log_size && count > max_log_size) { - fclose(logfile); - logfile = NULL; - } - - if (ringbuffer_size && count > ringbuffer_size) { - rotate_messagef(); - count = 0; - } - } - return ret; +void rotate_errorf() { + rotatef(&error_lfi); + strcpy(screen_logfile, error_lfi.file_name); } -int TRACE_CALLDEBUG(char *fmt, ...) { +#ifdef __cplusplus +extern "C" { +#endif +int _trace (struct logfile_info *lfi, char *fmt, va_list ap) { int ret = 0; - static unsigned long long count = 0; - if(calldebugf) { - va_list ap; - va_start(ap, fmt); - ret = vfprintf(calldebugf, fmt, ap); - va_end(ap); - fflush(calldebugf); + if(lfi->fptr) { + ret = vfprintf(lfi->fptr, fmt, ap); + fflush(lfi->fptr); - count += ret; + lfi->count += ret; - if (max_log_size && count > max_log_size) { - fclose(calldebugf); - calldebugf = NULL; + if (max_log_size && lfi->count > max_log_size) { + fclose(lfi->fptr); + lfi->fptr = NULL; } - if (ringbuffer_size && count > ringbuffer_size) { - rotate_calldebugf(); - count = 0; + if (ringbuffer_size && lfi->count > ringbuffer_size) { + rotatef(lfi); + lfi->count = 0; } } return ret; } -// TODO: finish the -trace_timeout option implementation -/* int TRACE_TIMEOUT(char *fmt, ...) */ -#ifdef __cplusplus -} -#endif +int TRACE_MSG(char *fmt, ...) { + int ret; + va_list ap; -struct logfile_id { - time_t start; - int n; -}; + va_start(ap, fmt); + ret = _trace(&message_lfi, fmt, ap); + va_end(ap); -/* We can not use the error functions from this file, as we may be rotating the error log itself! */ -void rotatef(char *name, FILE **fptr, time_t *starttime, int *nfiles, struct logfile_id **ftimes, bool check, bool *overwrite) { - char L_file_name [MAX_PATH]; - char L_rotate_file_name [MAX_PATH]; + return ret; +} - sprintf (L_file_name, "%s_%d_%s.log", scenario_file, getpid(), name); +int TRACE_SHORTMSG(char *fmt, ...) { + int ret; + va_list ap; - if (ringbuffer_files > 0) { - if (!*ftimes) { - *ftimes = (struct logfile_id *)calloc(ringbuffer_files, sizeof(struct logfile_id)); - } - /* We need to rotate away an existing file. */ - if (*nfiles == ringbuffer_files) { - if ((*ftimes)[0].n) { - sprintf(L_rotate_file_name, "%s_%d_%s_%lu.%d.log", scenario_file, getpid(), name, (*ftimes)[0].start, (*ftimes)[0].n); - } else { - sprintf(L_rotate_file_name, "%s_%d_%s_%lu.log", scenario_file, getpid(), name, (*ftimes)[0].start); - } - unlink(L_rotate_file_name); - (*nfiles)--; - memmove(*ftimes, &((*ftimes)[1]), sizeof(struct logfile_id) * (*nfiles)); - } - if (*starttime) { - (*ftimes)[*nfiles].start = *starttime; - (*ftimes)[*nfiles].n = 0; - /* If we have the same time, then we need to append an identifier. */ - if (*nfiles && ((*ftimes)[*nfiles].start == (*ftimes)[*nfiles - 1].start)) { - (*ftimes)[*nfiles].n = (*ftimes)[*nfiles - 1].n + 1; - } - if ((*ftimes)[*nfiles].n) { - sprintf(L_rotate_file_name, "%s_%d_%s_%lu.%d.log", scenario_file, getpid(), name, (*ftimes)[*nfiles].start, (*ftimes)[*nfiles].n); - } else { - sprintf(L_rotate_file_name, "%s_%d_%s_%lu.log", scenario_file, getpid(), name, (*ftimes)[*nfiles].start); - } - (*nfiles)++; - fflush(*fptr); - fclose(*fptr); - *fptr = NULL; - rename(L_file_name, L_rotate_file_name); - } - } + va_start(ap, fmt); + ret = _trace(&shortmessage_lfi, fmt, ap); + va_end(ap); - time(starttime); - if (*overwrite) { - *fptr = fopen(L_file_name, "w"); - } else { - *fptr = fopen(L_file_name, "a"); - *overwrite = true; - } - if(check && !*fptr) { - ERROR("Unable to create '%s'", L_file_name); - } + return ret; } -int calldebugf_nfiles = 0; -struct logfile_id *calldebugf_times = NULL; +int LOG_MSG(char *fmt, ...) { + int ret; + va_list ap; -void rotate_calldebugf() { - static time_t starttime = 0; - rotatef("calldebug", &calldebugf, &starttime, &calldebugf_nfiles, &calldebugf_times, true, &calldebugf_overwrite); -} + va_start(ap, fmt); + ret = _trace(&log_lfi, fmt, ap); + va_end(ap); - -int messagef_nfiles = 0; -struct logfile_id *messagef_times = NULL; - -void rotate_messagef() { - static time_t starttime = 0; - rotatef("messages", &messagef, &starttime, &messagef_nfiles, &messagef_times, true, &messagef_overwrite); + return ret; } -int shortmessagef_nfiles = 0; -struct logfile_id *shortmessagef_times = NULL; +int TRACE_CALLDEBUG(char *fmt, ...) { + int ret; + va_list ap; -void rotate_shortmessagef() { - static time_t starttime = 0; - rotatef("shortmessages", &shortmessagef, &starttime, &shortmessagef_nfiles, &shortmessagef_times, true, &shortmessagef_overwrite); -} + va_start(ap, fmt); + ret = _trace(&calldebug_lfi, fmt, ap); + va_end(ap); -int logfile_nfiles = 0; -struct logfile_id *logfile_times = NULL; - -void rotate_logfile() { - static time_t starttime = 0; - rotatef("logs", &logfile, &starttime, &logfile_nfiles, &logfile_times, true, &logfile_overwrite); + return ret; } -int errorf_nfiles = 0; -struct logfile_id *errorf_times = NULL; - -void rotate_errorf() { - static time_t starttime = 0; - rotatef("errors", &screen_errorf, &starttime, &errorf_nfiles, &errorf_times, false, &errorf_overwrite); - /* If rotatef is changed, this must be changed as well. */ - sprintf (screen_logfile, "%s_%d_errors.log", scenario_file, getpid()); +#ifdef __cplusplus } +#endif + Modified: sipp/trunk/sipp.hpp =================================================================== --- sipp/trunk/sipp.hpp 2008-09-25 14:27:13 UTC (rev 541) +++ sipp/trunk/sipp.hpp 2008-09-26 03:02:03 UTC (rev 542) @@ -439,10 +439,6 @@ /************************** Trace Files ***********************/ extern FILE * screenf _DEFVAL(0); -extern FILE * logfile _DEFVAL(0); -extern FILE * messagef _DEFVAL(0); -extern FILE * calldebugf _DEFVAL(0); -extern FILE * shortmessagef _DEFVAL(0); extern FILE * countf _DEFVAL(0); // extern FILE * timeoutf _DEFVAL(0); extern bool useMessagef _DEFVAL(0); @@ -450,12 +446,6 @@ extern bool useShortMessagef _DEFVAL(0); extern bool useScreenf _DEFVAL(0); extern bool useLogf _DEFVAL(0); -// should we overwrite the existing files? -extern bool messagef_overwrite _DEFVAL(true); -extern bool calldebugf_overwrite _DEFVAL(true); -extern bool shortmessagef_overwrite _DEFVAL(true); -extern bool errorf_overwrite _DEFVAL(true); -extern bool logfile_overwrite _DEFVAL(true); //extern bool useTimeoutf _DEFVAL(0); extern bool dumpInFile _DEFVAL(0); extern bool dumpInRtt _DEFVAL(0); @@ -469,13 +459,39 @@ extern char screen_last_error[32768]; extern char screen_logfile[MAX_PATH] _DEFVAL(""); -extern FILE * screen_errorf _DEFVAL(NULL); /* Log Rotation Functions. */ -void rotate_messagef(); -void rotate_calldebugf(); -void rotate_shortmessagef(); -void rotate_logfile(); +struct logfile_id { + time_t start; + int n; +}; + +struct logfile_info { + char *name; + bool check; + FILE *fptr; + int nfiles; + struct logfile_id *ftimes; + char file_name[MAX_PATH]; + bool overwrite; + bool fixedname; + time_t starttime; + unsigned int count; +}; + +#ifdef GLOBALS_FULL_DEFINITION +#define LOGFILE(name, s, check) \ + struct logfile_info name = { s, check, NULL, 0, NULL, "", true, false, 0, 0}; +#else +#define LOGFILE(name, s, check) \ + extern struct logfile_info name; +#endif +LOGFILE(calldebug_lfi, "calldebug", true); +LOGFILE(message_lfi, "messages", true); +LOGFILE(shortmessage_lfi, "shortmessages", true); +LOGFILE(log_lfi, "logs", true); +LOGFILE(error_lfi, "errors", false); + void rotate_errorf(); /* Screen/Statistics Printing Functions. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sri...@us...> - 2008-10-06 07:40:47
|
Revision: 546 http://sipp.svn.sourceforge.net/sipp/?rev=546&view=rev Author: srivanuj Date: 2008-10-06 07:40:42 +0000 (Mon, 06 Oct 2008) Log Message: ----------- add the support of dynamic_id, a wrapping, auto incrementing, global variable provided by Francois Draperi Modified Paths: -------------- sipp/trunk/call.cpp sipp/trunk/call.hpp sipp/trunk/message.cpp sipp/trunk/message.hpp sipp/trunk/sipp.cpp sipp/trunk/sipp.hpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-09-29 15:33:30 UTC (rev 545) +++ sipp/trunk/call.cpp 2008-10-06 07:40:42 UTC (rev 546) @@ -65,6 +65,10 @@ /* send_packets pthread wrapper */ void *send_wrapper(void *); #endif +int call::dynamicId = 0; +int call::maxDynamicId = 10000+2000*4; // FIXME both param to be in command line !!!! +int call::startDynamicId = 10000; // FIXME both param to be in command line !!!! +int call::stepDynamicId = 4; // FIXME both param to be in command line !!!! /************** Call map and management routines **************/ static unsigned int next_number = 1; @@ -2173,6 +2177,12 @@ case E_Message_Call_Number: dest += snprintf(dest, left, "%u", number); break; + case E_Message_DynamicId: + dest += snprintf(dest, left, "%u", call::dynamicId); + // increment at each request + dynamicId += stepDynamicId; + if ( this->dynamicId > maxDynamicId ) { call::dynamicId = call::startDynamicId; } ; + break; case E_Message_Call_ID: dest += snprintf(dest, left, "%s", id); break; Modified: sipp/trunk/call.hpp =================================================================== --- sipp/trunk/call.hpp 2008-09-29 15:33:30 UTC (rev 545) +++ sipp/trunk/call.hpp 2008-10-06 07:40:42 UTC (rev 546) @@ -115,6 +115,15 @@ scenario *call_scenario; unsigned int number; + +public: + static int maxDynamicId; // max value for dynamicId; this value is reached ! + static int startDynamicId; // offset for first dynamicId FIXME:in CmdLine + static int stepDynamicId; // step of increment for dynamicId + static int dynamicId; // a counter for general use, incrementing by stepDynamicId starting at startDynamicId wrapping at maxDynamicId GLOBALY +private: + + unsigned int tdm_map_number; int msg_index; Modified: sipp/trunk/message.cpp =================================================================== --- sipp/trunk/message.cpp 2008-09-29 15:33:30 UTC (rev 545) +++ sipp/trunk/message.cpp 2008-10-06 07:40:42 UTC (rev 546) @@ -61,6 +61,7 @@ {"media_port", E_Message_Media_Port }, {"media_ip_type", E_Message_Media_IP_Type }, {"call_number", E_Message_Call_Number }, + {"dynamic_id", E_Message_DynamicId }, // wrapping global counter {"call_id", E_Message_Call_ID }, {"cseq", E_Message_CSEQ }, {"pid", E_Message_PID }, Modified: sipp/trunk/message.hpp =================================================================== --- sipp/trunk/message.hpp 2008-09-29 15:33:30 UTC (rev 545) +++ sipp/trunk/message.hpp 2008-10-06 07:40:42 UTC (rev 546) @@ -59,6 +59,7 @@ E_Message_Media_Port, E_Message_Media_IP_Type, E_Message_Call_Number, + E_Message_DynamicId, // general usage, global, autoincrementing and wrapping counter E_Message_Call_ID, E_Message_CSEQ, E_Message_PID, Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-09-29 15:33:30 UTC (rev 545) +++ sipp/trunk/sipp.cpp 2008-10-06 07:40:42 UTC (rev 546) @@ -20,6 +20,7 @@ * David MANSUTTI * Francois-Xavier Kowalski * Gerard Lyonnaz + * Francois Draperi (for dynamic_id) * From Hewlett Packard Company. * F. Tarek Rogers * Peter Higginson @@ -340,6 +341,9 @@ "Format: -tdmmap {0-3}{99}{5-8}{1-31}", SIPP_OPTION_TDMMAP, NULL, 1}, {"key", "keyword value\nSet the generic parameter named \"keyword\" to \"value\".", SIPP_OPTION_KEY, NULL, 1}, {"set", "variable value\nSet the global variable parameter named \"variable\" to \"value\".", SIPP_OPTION_VAR, NULL, 3}, + {"dynamicStart", "variable value\nSet the start offset of dynamic_id varaiable", SIPP_OPTION_INT, &startDynamicId, 1}, + {"dynamicMax", "variable value\nSet the maximum of dynamic_id variable ", SIPP_OPTION_INT, &maxDynamicId, 1}, + {"dynamicStep", "variable value\nSet the increment of dynamic_id variable", SIPP_OPTION_INT, &stepDynamicId, 1} }; struct sipp_option *find_option(const char *option) { @@ -2620,6 +2624,10 @@ /* Write data to a socket. */ int write_socket(struct sipp_socket *socket, char *buffer, ssize_t len, int flags, struct sockaddr_storage *dest) { int rc; + if ( socket == NULL ) { + //FIX coredump when trying to send data but no master yet ... ( for example after unexpected mesdsage) + return 0; + } if (socket->ss_out) { rc = flush_socket(socket); @@ -4780,7 +4788,14 @@ if(argiFileName) { main_scenario->stats->setFileName(argv[argiFileName]); } + + // setup option form cmd line + call::maxDynamicId = maxDynamicId; + call::startDynamicId = startDynamicId; + call::dynamicId = startDynamicId; + call::stepDynamicId = stepDynamicId; + /* Now Initialize the scenarios. */ main_scenario->runInit(); ooc_scenario->runInit(); Modified: sipp/trunk/sipp.hpp =================================================================== --- sipp/trunk/sipp.hpp 2008-09-29 15:33:30 UTC (rev 545) +++ sipp/trunk/sipp.hpp 2008-10-06 07:40:42 UTC (rev 546) @@ -374,6 +374,14 @@ extern unsigned long watchdog_major_maxtriggers _DEFVAL(10); extern unsigned long watchdog_reset _DEFVAL(600000); + +/********************* dynamic Id ************************* */ +extern int maxDynamicId _DEFVAL(12000); // max value for dynamicId; this value is reached +extern int startDynamicId _DEFVAL(10000); // offset for first dynamicId FIXME:in CmdLine +extern int stepDynamicId _DEFVAL(4); // step of increment for dynamicId + + + #define GET_TIME(clock) \ { \ struct timezone tzp; \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-10-29 12:20:17
|
Revision: 552 http://sipp.svn.sourceforge.net/sipp/?rev=552&view=rev Author: charlespwright Date: 2008-10-29 12:20:06 +0000 (Wed, 29 Oct 2008) Log Message: ----------- Enh: Allow sipp to load dynamic library plugins at startup. Modified Paths: -------------- sipp/trunk/Makefile sipp/trunk/sipp.cpp Added Paths: ----------- sipp/trunk/fortune.cpp Modified: sipp/trunk/Makefile =================================================================== --- sipp/trunk/Makefile 2008-10-13 15:23:10 UTC (rev 551) +++ sipp/trunk/Makefile 2008-10-29 12:20:06 UTC (rev 552) @@ -228,3 +228,7 @@ .c.o: $(CC) $(CFLAGS) $(MFLAGS) $(DEBUG_FLAGS) $(_HPUX_LI_FLAG) $(INCDIR) -c -o $*.o $< + +fortune.so: fortune.cpp + g++ -fPIC $(CPPFLAGS) $(MFLAGS) $(DEBUG_FLAGS) $(_HPUX_LI_FLAG) $(INCDIR) -c -o fortune.o $< + gcc -shared -Wl,-soname,fortune.so -o $@ fortune.o Added: sipp/trunk/fortune.cpp =================================================================== --- sipp/trunk/fortune.cpp (rev 0) +++ sipp/trunk/fortune.cpp 2008-10-29 12:20:06 UTC (rev 552) @@ -0,0 +1,25 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author : Richard GAYRAUD - 04 Nov 2003 + * Olivier JACQUES + * Charles P Wright from IBM Research + */ +#include "sipp.hpp" + + +extern "C" int init(void) { + return 0; +} Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-10-13 15:23:10 UTC (rev 551) +++ sipp/trunk/sipp.cpp 2008-10-29 12:20:06 UTC (rev 552) @@ -36,6 +36,7 @@ #define GLOBALS_FULL_DEFINITION +#include <dlfcn.h> #include "sipp.hpp" #include "assert.h" @@ -127,6 +128,7 @@ #define SIPP_OPTION_RTCHECK 35 #define SIPP_OPTION_LFNAME 36 #define SIPP_OPTION_LFOVERWRITE 37 +#define SIPP_OPTION_PLUGIN 38 /* Put Each option, its help text, and type in this table. */ struct sipp_option options_table[] = { @@ -223,6 +225,7 @@ {"p", "Set the local port number. Default is a random free port chosen by the system.", SIPP_OPTION_INT, &user_port, 1}, {"pause_msg_ign", "Ignore the messages received during a pause defined in the scenario ", SIPP_OPTION_SETFLAG, &pause_msg_ign, 1}, {"periodic_rtd", "Reset response time partition counters each logging interval.", SIPP_OPTION_SETFLAG, &periodic_rtd, 1}, + {"plugin", "Load a plugin.", SIPP_OPTION_PLUGIN, NULL, 1}, {"r", "Set the call rate (in calls per seconds). This value can be" "changed during test by pressing '+','_','*' or '/'. Default is 10.\n" @@ -4645,6 +4648,31 @@ ((struct logfile_info*)option->data)->fixedname = true; ((struct logfile_info*)option->data)->overwrite = get_bool(argv[argi], argv[argi-1]); break; + case SIPP_OPTION_PLUGIN: { + void *handle; + char *error; + int (*init)(); + int ret; + + REQUIRE_ARG(); + CHECK_PASS(); + + handle = dlopen(argv[argi], RTLD_NOW); + if (!handle) { + ERROR("Could not open plugin %s: %s", argv[argi], dlerror()); + } + + init = (int (*)())dlsym(handle, "init"); + if((error = (char *) dlerror())) { + ERROR("Could not locate init function in %s: %s", argv[argi], dlerror()); + } + + ret = init(); + if (ret != 0) { + ERROR("Plugin %s initialization failed.", argv[argi]); + } + } + break; default: ERROR("Internal error: I don't recognize the option type for %s\n", argv[argi]); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-10-29 12:22:46
|
Revision: 553 http://sipp.svn.sourceforge.net/sipp/?rev=553&view=rev Author: charlespwright Date: 2008-10-29 12:22:40 +0000 (Wed, 29 Oct 2008) Log Message: ----------- Enh: Allow plugins to register new keywords. Simple example includes the output of fortune in a message. Modified Paths: -------------- sipp/trunk/call.cpp sipp/trunk/call.hpp sipp/trunk/fortune.cpp sipp/trunk/message.cpp sipp/trunk/message.hpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-10-29 12:20:06 UTC (rev 552) +++ sipp/trunk/call.cpp 2008-10-29 12:22:40 UTC (rev 553) @@ -2343,6 +2343,10 @@ } break; } + case E_Message_Custom: { + dest += comp->comp_param.fxn(this, comp, dest, left); + break; + } case E_Message_Last_Message: if(last_recv_msg && strlen(last_recv_msg)) { dest += sprintf(dest, "%s", last_recv_msg); Modified: sipp/trunk/call.hpp =================================================================== --- sipp/trunk/call.hpp 2008-10-29 12:20:06 UTC (rev 552) +++ sipp/trunk/call.hpp 2008-10-29 12:22:40 UTC (rev 553) @@ -162,6 +162,8 @@ /* cseq value for [cseq] keyword */ unsigned int cseq; + const char *getLastReceived() { return last_recv_msg; }; + #ifdef PCAPPLAY int hasMediaInformation; pthread_t media_thread; Modified: sipp/trunk/fortune.cpp =================================================================== --- sipp/trunk/fortune.cpp 2008-10-29 12:20:06 UTC (rev 552) +++ sipp/trunk/fortune.cpp 2008-10-29 12:22:40 UTC (rev 553) @@ -14,12 +14,72 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Author : Richard GAYRAUD - 04 Nov 2003 - * Olivier JACQUES + * Olivier Jacques + * From Hewlett Packard Company. * Charles P Wright from IBM Research */ #include "sipp.hpp" +/* This is a fun sample of creating your own extensible keyword. */ +int fortune(call *call, MessageComponent *comp, char *buf, int len) { + int pipes[2]; + char localbuf[SIPP_MAX_MSG_SIZE]; + char *p = localbuf; + int ret; + int written = 0; + if (pipe(pipes) == -1) { + ERROR("Could not create pipes!\n"); + } + + switch (fork()) { + case -1: + ERROR("Fork failed: %s\n", strerror(errno)); + case 0: + /* We are the child. */ + close(pipes[0]); + dup2(pipes[1], fileno(stdout)); + dup2(pipes[1], fileno(stderr)); + close(fileno(stdin)); + system("/usr/bin/fortune"); + exit (127); + default: + /* We are the parent*/ + close(pipes[1]); + while ((ret = read(pipes[0], p, sizeof(localbuf) - (p - localbuf))) > 0) { + p += ret; + } + *p = '\0'; + close(pipes[0]); + + if (len > p - localbuf) { + len = p -localbuf; + } + + p = localbuf; + while(len-- > 0) { + if (*p == '\n') { + if (len < 3) { + break; + } + *buf++ = '\r'; + *buf++ = '\n'; + *buf++ = ' '; + written += 3; + p++; + } else { + *buf++ = *p++; + written++; + } + } + break; + } + + return written; +} + +/* On initialization we register our keywords. */ extern "C" int init(void) { + registerKeyword("fortune", fortune); return 0; } Modified: sipp/trunk/message.cpp =================================================================== --- sipp/trunk/message.cpp 2008-10-29 12:20:06 UTC (rev 552) +++ sipp/trunk/message.cpp 2008-10-29 12:22:40 UTC (rev 553) @@ -44,6 +44,9 @@ MessageCompType type; }; +typedef std::map<std::string, customKeyword> kw_map; +kw_map keyword_map; + /* These keywords take no parameters. */ struct KeywordMap SimpleKeywords[] = { {"remote_ip", E_Message_Remote_IP }, @@ -217,6 +220,24 @@ } } + char *spc = NULL; + char ospc; + if ((spc = strchr(keyword, ' '))) { + ospc = *spc; + *spc = '\0'; + } + kw_map::iterator it = keyword_map.find(keyword); + if (spc) { + *spc = ospc; + } + + if (it != keyword_map.end()) { + newcomp->type = E_Message_Custom; + newcomp->comp_param.fxn = it->second; + messageComponents.push_back(newcomp); + continue; + } + bool simple_keyword = false; for (unsigned int i = 0; i < sizeof(SimpleKeywords)/sizeof(SimpleKeywords[0]); i++) { if (!strcmp(keyword, SimpleKeywords[i].keyword)) { @@ -559,3 +580,12 @@ struct MessageComponent *SendingMessage::getComponent(int i) { return messageComponents[i]; } + +/* This is very simplistic and does not yet allow any arguments, but it is a start. */ +int registerKeyword(char *keyword, customKeyword fxn) { + if (keyword_map.find(keyword) != keyword_map.end()) { + ERROR("Can not register keyword '%s', already registered!\n", keyword); + } + keyword_map[keyword] = fxn; + return 0; +} Modified: sipp/trunk/message.hpp =================================================================== --- sipp/trunk/message.hpp 2008-10-29 12:20:06 UTC (rev 552) +++ sipp/trunk/message.hpp 2008-10-29 12:22:40 UTC (rev 553) @@ -85,6 +85,7 @@ E_Message_Timestamp, E_Message_SippVersion, E_Message_File, + E_Message_Custom, } MessageCompType; class SendingMessage { @@ -122,6 +123,12 @@ static void getKeywordParam(char * src, char * param, char * output); }; +/* Custom Keyword Function Type. */ +struct MessageComponent; +class call; +typedef int (*customKeyword)(call *, struct MessageComponent *, char *, int); +/* Custom Keyword Registration Function. */ +int registerKeyword(char *keyword, customKeyword fxn); struct MessageComponent { MessageCompType type; @@ -145,6 +152,7 @@ SendingMessage *line; } field_param; SendingMessage *filename; + customKeyword fxn; } comp_param; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-10-29 12:23:28
|
Revision: 554 http://sipp.svn.sourceforge.net/sipp/?rev=554&view=rev Author: charlespwright Date: 2008-10-29 12:23:19 +0000 (Wed, 29 Oct 2008) Log Message: ----------- Enh: closecon action closes a call's TCP/TLS connection. Modified Paths: -------------- sipp/trunk/actions.hpp sipp/trunk/call.cpp sipp/trunk/scenario.cpp Modified: sipp/trunk/actions.hpp =================================================================== --- sipp/trunk/actions.hpp 2008-10-29 12:22:40 UTC (rev 553) +++ sipp/trunk/actions.hpp 2008-10-29 12:23:19 UTC (rev 554) @@ -66,6 +66,7 @@ E_AT_VAR_TRIM, E_AT_VERIFY_AUTH, E_AT_SET_DEST, + E_AT_CLOSE_CON, #ifdef PCAPPLAY E_AT_PLAY_PCAP_AUDIO, E_AT_PLAY_PCAP_VIDEO, Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-10-29 12:22:40 UTC (rev 553) +++ sipp/trunk/call.cpp 2008-10-29 12:23:19 UTC (rev 554) @@ -3482,6 +3482,12 @@ free(file); free(line); free(value); + } else if (currentAction->getActionType() == CAction::E_AT_CLOSE_CON) { + if (call_socket) { + sipp_socket_invalidate(call_socket); + sipp_close_socket(call_socket); + call_socket = NULL; + } } else if (currentAction->getActionType() == CAction::E_AT_SET_DEST) { /* Change the destination for this call. */ char *str_host = strdup(createSendingMessage(currentAction->getMessage(0), -2)); Modified: sipp/trunk/scenario.cpp =================================================================== --- sipp/trunk/scenario.cpp 2008-10-29 12:22:40 UTC (rev 553) +++ sipp/trunk/scenario.cpp 2008-10-29 12:23:19 UTC (rev 554) @@ -1534,6 +1534,8 @@ tmpAction->setMessage(xp_get_string("port", actionElem), 1); tmpAction->setMessage(xp_get_string("protocol", actionElem), 2); tmpAction->setActionType(CAction::E_AT_SET_DEST); + } else if(!strcmp(actionElem, "closecon")) { + tmpAction->setActionType(CAction::E_AT_CLOSE_CON); } else if(!strcmp(actionElem, "strcmp")) { tmpAction->setVarId(xp_get_var("assign_to", "strcmp")); tmpAction->setVarInId(xp_get_var("variable", "test")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-10-30 17:48:01
|
Revision: 555 http://sipp.svn.sourceforge.net/sipp/?rev=555&view=rev Author: charlespwright Date: 2008-10-30 17:47:55 +0000 (Thu, 30 Oct 2008) Log Message: ----------- Enh: Command to reset cumulative statistics. Modified Paths: -------------- sipp/trunk/sipp.cpp sipp/trunk/stat.cpp sipp/trunk/stat.hpp Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-10-29 12:23:19 UTC (rev 554) +++ sipp/trunk/sipp.cpp 2008-10-30 17:47:55 UTC (rev 555) @@ -1790,6 +1790,14 @@ } } +void process_reset(char *what) { + if (!strcmp(what, "stats")) { + main_scenario->stats->computeStat(CStat::E_RESET_C_COUNTERS); + } else { + WARNING("Unknown reset type: %s", what); + } +} + bool process_command(char *command) { trim(command); @@ -1805,6 +1813,8 @@ process_trace(rest); } else if (!strcmp(command, "dump")) { process_dump(rest); + } else if (!strcmp(command, "reset")) { + process_reset(rest); } else { WARNING("Unrecognized command: \"%s\"", command); } Modified: sipp/trunk/stat.cpp =================================================================== --- sipp/trunk/stat.cpp 2008-10-29 12:23:19 UTC (rev 554) +++ sipp/trunk/stat.cpp 2008-10-30 17:47:55 UTC (rev 555) @@ -89,6 +89,27 @@ #define RESET_COUNTERS(PT)\ memset (PT, 0, CStat::E_NB_COUNTER * sizeof(unsigned long long)) +#define RESET_C_COUNTERS \ +{ \ + int i; \ + for (i=CStat::CPT_G_C_OutOfCallMsgs; \ + i<=CStat::CPT_G_C_AutoAnswered; \ + i++) \ + M_G_counters[i - E_NB_COUNTER - 1] = (unsigned long) 0; \ + for (i=CStat::CPT_C_IncomingCallCreated; \ + i<=CStat::CPT_C_Retransmissions; \ + i++) \ + M_counters[i] = (unsigned long) 0; \ + for (unsigned int j=0;j<M_genericMap.size(); j++) { \ + M_genericCounters[j * GENERIC_TYPES + GENERIC_C] = 0; \ + } \ + for (unsigned int j=0;j<M_rtdMap.size(); j++) { \ + M_rtdInfo[(j * GENERIC_TYPES * RTD_TYPES) + (GENERIC_C * RTD_TYPES) + RTD_COUNT] = 0; \ + M_rtdInfo[(j * GENERIC_TYPES * RTD_TYPES) + (GENERIC_C * RTD_TYPES) + RTD_SUM] = 0; \ + M_rtdInfo[(j * GENERIC_TYPES * RTD_TYPES) + (GENERIC_C * RTD_TYPES) + RTD_SUMSQ] = 0; \ + } \ +} + #define RESET_PD_COUNTERS \ { \ int i; \ @@ -679,6 +700,11 @@ M_counters [CPT_PL_Retransmissions]++; break; + case E_RESET_C_COUNTERS : + RESET_C_COUNTERS; + GET_TIME (&M_startTime); + break; + case E_RESET_PD_COUNTERS : //DEBUG (C_Debug::E_LEVEL_4, "ENTER CASE", "%s", // "CStat::computeStat : RESET_PD_COUNTERS"); Modified: sipp/trunk/stat.hpp =================================================================== --- sipp/trunk/stat.hpp 2008-10-29 12:23:19 UTC (rev 554) +++ sipp/trunk/stat.hpp 2008-10-30 17:47:55 UTC (rev 555) @@ -93,6 +93,7 @@ E_CREATE_INCOMING_CALL, E_CALL_FAILED, E_CALL_SUCCESSFULLY_ENDED, + E_RESET_C_COUNTERS, E_RESET_PD_COUNTERS, E_RESET_PL_COUNTERS, E_ADD_CALL_DURATION, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-12-29 16:56:21
|
Revision: 564 http://sipp.svn.sourceforge.net/sipp/?rev=564&view=rev Author: charlespwright Date: 2008-12-29 16:56:17 +0000 (Mon, 29 Dec 2008) Log Message: ----------- Fix: Get rid of call_sockets variable in favor of just referencing pollnfds. (From M.H. VanLeeuwen) Modified Paths: -------------- sipp/trunk/sipp.cpp sipp/trunk/sipp.hpp Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-12-29 16:38:06 UTC (rev 563) +++ sipp/trunk/sipp.cpp 2008-12-29 16:56:17 UTC (rev 564) @@ -725,7 +725,6 @@ /******************** Recv Poll Processing *********************/ int pollnfds; -unsigned int call_sockets; struct pollfd pollfiles[SIPP_MAXFDS]; struct sipp_socket *sockets[SIPP_MAXFDS]; @@ -2935,10 +2934,6 @@ ERROR("Pollset error: index %d is greater than number of fds %d!", pollidx, pollnfds); } - if (socket->ss_call_socket) { - call_sockets--; - } - socket->ss_invalid = true; socket->ss_pollidx = -1; @@ -3913,7 +3908,7 @@ struct sipp_socket *new_sipp_call_socket(bool use_ipv6, int transport, bool *existing) { struct sipp_socket *sock = NULL; static int next_socket; - if (call_sockets >= max_multi_socket - 1) { // we must take the main socket into account + if (pollnfds >= max_multi_socket) { // we must take the main socket into account /* Find an existing socket that matches transport and ipv6 parameters. */ int first = next_socket; do @@ -3946,7 +3941,6 @@ } else { sock = new_sipp_socket(use_ipv6, transport); sock->ss_call_socket = true; - call_sockets++; *existing = false; } return sock; @@ -4792,7 +4786,7 @@ if (rlimit.rlim_max > #ifndef __CYGWIN - ((L_maxSocketPresent) ? max_multi_socket : FD_SETSIZE) + ((L_maxSocketPresent) ? (unsigned int)max_multi_socket : FD_SETSIZE) #else FD_SETSIZE #endif @@ -4803,7 +4797,7 @@ rlimit.rlim_max = #ifndef __CYGWIN - (L_maxSocketPresent) ? max_multi_socket+min_socket : FD_SETSIZE ; + (L_maxSocketPresent) ? (unsigned int)max_multi_socket+min_socket : FD_SETSIZE ; #else FD_SETSIZE; Modified: sipp/trunk/sipp.hpp =================================================================== --- sipp/trunk/sipp.hpp 2008-12-29 16:38:06 UTC (rev 563) +++ sipp/trunk/sipp.hpp 2008-12-29 16:56:17 UTC (rev 564) @@ -221,7 +221,7 @@ extern unsigned long report_freq_dumpRtt _DEFVAL (DEFAULT_FREQ_DUMP_RTT); -extern unsigned int max_multi_socket _DEFVAL +extern int max_multi_socket _DEFVAL (DEFAULT_MAX_MULTI_SOCKET); extern bool skip_rlimit _DEFVAL(false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2009-01-09 18:33:08
|
Revision: 568 http://sipp.svn.sourceforge.net/sipp/?rev=568&view=rev Author: charlespwright Date: 2009-01-09 18:33:03 +0000 (Fri, 09 Jan 2009) Log Message: ----------- Enh: Allow strcmp and test to compare two variables. Modified Paths: -------------- sipp/trunk/actions.cpp sipp/trunk/actions.hpp sipp/trunk/call.cpp sipp/trunk/scenario.cpp Modified: sipp/trunk/actions.cpp =================================================================== --- sipp/trunk/actions.cpp 2008-12-30 17:09:30 UTC (rev 567) +++ sipp/trunk/actions.cpp 2009-01-09 18:33:03 UTC (rev 568) @@ -66,7 +66,7 @@ bool CAction::compare(VariableTable *variableTable) { double lhs = variableTable->getVar(M_varInId)->getDouble(); - double rhs = M_doubleValue; + double rhs = M_varIn2Id ? variableTable->getVar(M_varIn2Id)->getDouble() : M_doubleValue; switch(M_comp) { case E_C_EQ: @@ -164,6 +164,7 @@ int CAction::getOccurence() { return(M_occurence); } int CAction::getVarId() { return(M_varId); } int CAction::getVarInId() { return(M_varInId); } +int CAction::getVarIn2Id() { return(M_varIn2Id); } char* CAction::getLookingChar() { return(M_lookingChar); } SendingMessage *CAction::getMessage(int n) { return(M_message[n]); } CSample* CAction::getDistribution() { return(M_distribution); } @@ -183,6 +184,8 @@ { M_varId = P_value; } void CAction::setVarInId (int P_value) { M_varInId = P_value; } +void CAction::setVarIn2Id (int P_value) +{ M_varIn2Id = P_value; } void CAction::setCaseIndep (bool P_value) { M_caseIndep = P_value; } void CAction::setOccurence (int P_value) @@ -424,6 +427,7 @@ M_action = E_AT_NO_ACTION; M_varId = 0; M_varInId = 0; + M_varIn2Id = 0; M_nbSubVarId = 0; M_maxNbSubVarId = 0; Modified: sipp/trunk/actions.hpp =================================================================== --- sipp/trunk/actions.hpp 2008-12-30 17:09:30 UTC (rev 567) +++ sipp/trunk/actions.hpp 2009-01-09 18:33:03 UTC (rev 568) @@ -119,6 +119,7 @@ bool getHeadersOnly(); int getVarId(); int getVarInId(); + int getVarIn2Id(); int getOccurence(); char* getLookingChar(); char* getRegularExpression(); @@ -134,6 +135,7 @@ void setCheckIt (bool P_value); void setVarId (int P_value); void setVarInId (int P_value); + void setVarIn2Id (int P_value); void setLookingChar (char* P_value); void setAction (CAction P_action); void setCaseIndep (bool P_action); @@ -173,6 +175,7 @@ bool M_headersOnly; int M_varId; int M_varInId; + int M_varIn2Id; int M_occurence; int M_nbSubVarId; int M_maxNbSubVarId; Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-12-30 17:09:30 UTC (rev 567) +++ sipp/trunk/call.cpp 2009-01-09 18:33:03 UTC (rev 568) @@ -3661,7 +3661,12 @@ M_callVariableTable->getVar(currentAction->getVarId())->setBool(value); } else if (currentAction->getActionType() == CAction::E_AT_VAR_STRCMP) { char *rhs = M_callVariableTable->getVar(currentAction->getVarInId())->getString(); - char *lhs = currentAction->getStringValue(); + char *lhs; + if (currentAction->getVarIn2Id()) { + lhs = M_callVariableTable->getVar(currentAction->getVarIn2Id())->getString(); + } else { + lhs = currentAction->getStringValue(); + } int value = strcmp(rhs, lhs); M_callVariableTable->getVar(currentAction->getVarId())->setDouble((double)value); } else if (currentAction->getActionType() == CAction::E_AT_VAR_TRIM) { Modified: sipp/trunk/scenario.cpp =================================================================== --- sipp/trunk/scenario.cpp 2008-12-30 17:09:30 UTC (rev 567) +++ sipp/trunk/scenario.cpp 2009-01-09 18:33:03 UTC (rev 568) @@ -1487,7 +1487,14 @@ } else if(!strcmp(actionElem, "test")) { tmpAction->setVarId(xp_get_var("assign_to", "test")); tmpAction->setVarInId(xp_get_var("variable", "test")); - tmpAction->setDoubleValue(xp_get_double("value", "test")); + if (xp_get_value("value")) { + tmpAction->setDoubleValue(xp_get_double("value", "test")); + if (xp_get_value("variable2")) { + ERROR("Can not have both a value and a variable2 for test!"); + } + } else { + tmpAction->setVarIn2Id(xp_get_var("variable2", "test")); + } tmpAction->setActionType(CAction::E_AT_VAR_TEST); ptr = xp_get_string("compare", "test"); if (!strcmp(ptr, "equal")) { @@ -1538,8 +1545,15 @@ tmpAction->setActionType(CAction::E_AT_CLOSE_CON); } else if(!strcmp(actionElem, "strcmp")) { tmpAction->setVarId(xp_get_var("assign_to", "strcmp")); - tmpAction->setVarInId(xp_get_var("variable", "test")); - tmpAction->setStringValue(xp_get_string("value", "test")); + tmpAction->setVarInId(xp_get_var("variable", "strcmp")); + if (xp_get_value("value")) { + tmpAction->setStringValue(xp_get_string("value", "strcmp")); + if (xp_get_value("variable2")) { + ERROR("Can not have both a value and a variable2 for strcmp!"); + } + } else { + tmpAction->setVarIn2Id(xp_get_var("variable2", "strcmp")); + } tmpAction->setActionType(CAction::E_AT_VAR_STRCMP); } else if(!strcmp(actionElem, "trim")) { tmpAction->setVarId(xp_get_var("assign_to", "trim")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2009-01-27 03:05:03
|
Revision: 570 http://sipp.svn.sourceforge.net/sipp/?rev=570&view=rev Author: charlespwright Date: 2009-01-27 03:04:52 +0000 (Tue, 27 Jan 2009) Log Message: ----------- Fix: Correct memory corruption reported by Artur Silveira da Cunha. Modified Paths: -------------- sipp/trunk/stat.cpp sipp/trunk/stat.hpp Modified: sipp/trunk/stat.cpp =================================================================== --- sipp/trunk/stat.cpp 2009-01-21 15:10:06 UTC (rev 569) +++ sipp/trunk/stat.cpp 2009-01-27 03:04:52 UTC (rev 570) @@ -1104,23 +1104,28 @@ int sizeOfTab, char * P_repartitionName) { - static char repartitionHeader[MAX_REPARTITION_HEADER_LENGTH]; + static char *repartitionHeader = NULL; char buffer[MAX_CHAR_BUFFER_SIZE]; + int dlen = strlen(stat_delimiter); if(tabRepartition != NULL) { + repartitionHeader = (char *)realloc(repartitionHeader, strlen(P_repartitionName) + dlen + 1); sprintf(repartitionHeader, "%s%s", P_repartitionName, stat_delimiter); for(int i=0; i<(sizeOfTab-1); i++) - { + { sprintf(buffer, "<%d%s", tabRepartition[i].borderMax, stat_delimiter); + repartitionHeader = (char *)realloc(repartitionHeader, strlen(repartitionHeader) + strlen(buffer) + 1); strcat(repartitionHeader, buffer); } sprintf(buffer, ">=%d%s", tabRepartition[sizeOfTab-1].borderMax, stat_delimiter); + repartitionHeader = (char *)realloc(repartitionHeader, strlen(repartitionHeader) + strlen(buffer) + 1); strcat(repartitionHeader, buffer); } else { - repartitionHeader[0] = '\0'; + repartitionHeader = (char *)realloc(repartitionHeader, 2); + strcpy(repartitionHeader, ""); } return(repartitionHeader); @@ -1129,23 +1134,28 @@ char* CStat::sRepartitionInfo(T_dynamicalRepartition * tabRepartition, int sizeOfTab) { - static char repartitionInfo[MAX_REPARTITION_INFO_LENGTH]; + static char *repartitionInfo; char buffer[MAX_CHAR_BUFFER_SIZE]; + int dlen = strlen(stat_delimiter); if(tabRepartition != NULL) { // if a repartition is present, this field match the repartition name + repartitionInfo = (char *)realloc(repartitionInfo, dlen + 1); sprintf(repartitionInfo, stat_delimiter); for(int i=0; i<(sizeOfTab-1); i++) { sprintf(buffer, "%lu%s", tabRepartition[i].nbInThisBorder, stat_delimiter); + repartitionInfo = (char *)realloc(repartitionInfo, strlen(repartitionInfo) + strlen(buffer) + 1); strcat(repartitionInfo, buffer); } sprintf(buffer, "%lu%s", tabRepartition[sizeOfTab-1].nbInThisBorder, stat_delimiter); + repartitionInfo = (char *)realloc(repartitionInfo, strlen(repartitionInfo) + strlen(buffer) + 1); strcat(repartitionInfo, buffer); } else { + repartitionInfo = (char *)realloc(repartitionInfo, 2); repartitionInfo[0] = '\0'; } Modified: sipp/trunk/stat.hpp =================================================================== --- sipp/trunk/stat.hpp 2009-01-21 15:10:06 UTC (rev 569) +++ sipp/trunk/stat.hpp 2009-01-27 03:04:52 UTC (rev 570) @@ -29,8 +29,6 @@ #define DEFAULT_FILE_NAME (char*)"dumpFile" #define DEFAULT_EXTENSION (char*)".csv" -#define MAX_REPARTITION_HEADER_LENGTH 1024 -#define MAX_REPARTITION_INFO_LENGTH 1024 #define MAX_CHAR_BUFFER_SIZE 1024 #include <ctime> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sri...@us...> - 2009-04-15 12:10:13
|
Revision: 579 http://sipp.svn.sourceforge.net/sipp/?rev=579&view=rev Author: srivanuj Date: 2009-04-15 12:10:03 +0000 (Wed, 15 Apr 2009) Log Message: ----------- add the attribute check_it_inverse to the ereg action, provided by Mikael Rudholm Modified Paths: -------------- sipp/trunk/actions.cpp sipp/trunk/actions.hpp sipp/trunk/call.cpp sipp/trunk/call.hpp sipp/trunk/scenario.cpp sipp/trunk/sipp.cpp sipp/trunk/stat.cpp sipp/trunk/stat.hpp Modified: sipp/trunk/actions.cpp =================================================================== --- sipp/trunk/actions.cpp 2009-03-30 08:51:27 UTC (rev 578) +++ sipp/trunk/actions.cpp 2009-04-15 12:10:03 UTC (rev 579) @@ -91,19 +91,21 @@ { if (M_action == E_AT_ASSIGN_FROM_REGEXP) { if(M_lookingPlace == E_LP_MSG) { - printf("Type[%d] - regexp[%s] where[%s] - checkIt[%d] - $%s", + printf("Type[%d] - regexp[%s] where[%s] - checkIt[%d] - checkItInverse[%d] - $%s", M_action, M_regularExpression, "Full Msg", M_checkIt, + M_checkItInverse, display_scenario->allocVars->getName(M_varId)); } else { - printf("Type[%d] - regexp[%s] where[%s-%s] - checkIt[%d] - $%s", + printf("Type[%d] - regexp[%s] where[%s-%s] - checkIt[%d] - checkItInverse[%d] - $%s", M_action, M_regularExpression, "Header", M_lookingChar, - M_checkIt, display_scenario->allocVars->getName(M_varId)); + M_checkIt, + M_checkItInverse, display_scenario->allocVars->getName(M_varId)); } } else if (M_action == E_AT_EXECUTE_CMD) { printf("Type[%d] - command[%-32.32s]", M_action, M_message_str[0]); @@ -159,6 +161,7 @@ CAction::T_Comparator CAction::getComparator () { return(M_comp); } bool CAction::getCheckIt() { return(M_checkIt); } +bool CAction::getCheckItInverse() { return(M_checkItInverse); } bool CAction::getCaseIndep() { return(M_caseIndep); } bool CAction::getHeadersOnly() { return(M_headersOnly); } int CAction::getOccurence() { return(M_occurence); } @@ -180,6 +183,8 @@ { M_lookingPlace = P_value; } void CAction::setCheckIt (bool P_value) { M_checkIt = P_value; } +void CAction::setCheckItInverse (bool P_value) +{ M_checkItInverse = P_value; } void CAction::setVarId (int P_value) { M_varId = P_value; } void CAction::setVarInId (int P_value) @@ -409,6 +414,7 @@ setLookingChar ( P_action.getLookingChar() ); setCheckIt ( P_action.getCheckIt() ); + setCheckItInverse ( P_action.getCheckItInverse() ); setCaseIndep ( P_action.getCaseIndep() ); setOccurence ( P_action.getOccurence() ); setHeadersOnly ( P_action.getHeadersOnly() ); @@ -434,6 +440,7 @@ M_subVarId = NULL; M_checkIt = false; + M_checkItInverse = false; M_lookingPlace = E_LP_MSG; M_lookingChar = NULL; M_caseIndep = false; Modified: sipp/trunk/actions.hpp =================================================================== --- sipp/trunk/actions.hpp 2009-03-30 08:51:27 UTC (rev 578) +++ sipp/trunk/actions.hpp 2009-04-15 12:10:03 UTC (rev 579) @@ -115,6 +115,7 @@ T_LookingPlace getLookingPlace(); T_Comparator getComparator(); bool getCheckIt(); + bool getCheckItInverse(); bool getCaseIndep(); bool getHeadersOnly(); int getVarId(); @@ -133,6 +134,7 @@ void setLookingPlace (T_LookingPlace P_value); void setComparator (T_Comparator P_value); void setCheckIt (bool P_value); + void setCheckItInverse (bool P_value); void setVarId (int P_value); void setVarInId (int P_value); void setVarIn2Id (int P_value); @@ -171,6 +173,7 @@ T_LookingPlace M_lookingPlace; T_Comparator M_comp; bool M_checkIt; + bool M_checkItInverse; bool M_caseIndep; bool M_headersOnly; int M_varId; Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2009-03-30 08:51:27 UTC (rev 578) +++ sipp/trunk/call.cpp 2009-04-15 12:10:03 UTC (rev 579) @@ -1296,6 +1296,14 @@ new deadcall(id, reason_str); } break; + case call::E_AR_REGEXP_SHOULDNT_MATCH: + computeStat(CStat::E_CALL_FAILED); + computeStat(CStat::E_FAILED_REGEXP_SHOULDNT_MATCH); + if (deadcall_wait && !initCall) { + sprintf(reason_str, "regexp matched, but shouldn't at index %d", msg_index); + new deadcall(id, reason_str); + } + break; case call::E_AR_HDR_NOT_FOUND: computeStat(CStat::E_CALL_FAILED); computeStat(CStat::E_FAILED_REGEXP_HDR_NOT_FOUND); @@ -3423,6 +3431,13 @@ WARNING("Failed regexp match: looking in '%s', with regexp '%s'", haystack, currentAction->getRegularExpression()); return(call::E_AR_REGEXP_DOESNT_MATCH); + } else if ( ((M_callVariableTable->getVar(currentAction->getVarId())->isSet())) && + (currentAction->getCheckItInverse() == true) ) + { + // The inverse of the above + WARNING("Regexp matched but should not: looking in '%s', with regexp '%s'", + haystack, currentAction->getRegularExpression()); + return(call::E_AR_REGEXP_SHOULDNT_MATCH); } } else if (currentAction->getActionType() == CAction::E_AT_ASSIGN_FROM_VALUE) { double operand = get_rhs(currentAction); Modified: sipp/trunk/call.hpp =================================================================== --- sipp/trunk/call.hpp 2009-03-30 08:51:27 UTC (rev 578) +++ sipp/trunk/call.hpp 2009-04-15 12:10:03 UTC (rev 579) @@ -216,6 +216,7 @@ { E_AR_NO_ERROR = 0, E_AR_REGEXP_DOESNT_MATCH, + E_AR_REGEXP_SHOULDNT_MATCH, E_AR_STOP_CALL, E_AR_CONNECT_FAILED, E_AR_HDR_NOT_FOUND Modified: sipp/trunk/scenario.cpp =================================================================== --- sipp/trunk/scenario.cpp 2009-03-30 08:51:27 UTC (rev 578) +++ sipp/trunk/scenario.cpp 2009-04-15 12:10:03 UTC (rev 579) @@ -1391,7 +1391,14 @@ tmpAction->setLookingChar(NULL); } // end if-else search_in + if (xp_get_value("check_it")) { tmpAction->setCheckIt(xp_get_bool("check_it", "ereg", false)); + if (xp_get_value("check_it_inverse")) { + ERROR("Can not have both check_it and check_it_inverse for ereg!"); + } + } else { + tmpAction->setCheckItInverse(xp_get_bool("check_it_inverse", "ereg", false)); + } if (!(ptr = xp_get_value((char *) "assign_to"))) { ERROR("assign_to value is missing"); Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2009-03-30 08:51:27 UTC (rev 578) +++ sipp/trunk/sipp.cpp 2009-04-15 12:10:03 UTC (rev 579) @@ -3708,6 +3708,12 @@ " during the call but the counter is increased only by\n" " one).\n" "\n" +" - FailedRegexpShouldntMatch:\n" +" Number of failed calls because of regexp that shouldn't\n" +" match (there might be several regexp that shouldn't match\n" +" during the call but the counter is increased only by\n" +" one).\n" +"\n" " - FailedRegexpHdrNotFound:\n" " Number of failed calls because of regexp with hdr \n" " option but no matching header found.\n" Modified: sipp/trunk/stat.cpp =================================================================== --- sipp/trunk/stat.cpp 2009-03-30 08:51:27 UTC (rev 578) +++ sipp/trunk/stat.cpp 2009-04-15 12:10:03 UTC (rev 579) @@ -670,6 +670,12 @@ M_counters [CPT_PL_FailedCallRegexpDoesntMatch]++; break; + case E_FAILED_REGEXP_SHOULDNT_MATCH : + M_counters [CPT_C_FailedCallRegexpShouldntMatch]++; + M_counters [CPT_PD_FailedCallRegexpShouldntMatch]++; + M_counters [CPT_PL_FailedCallRegexpShouldntMatch]++; + break; + case E_FAILED_REGEXP_HDR_NOT_FOUND : M_counters [CPT_C_FailedCallRegexpHdrNotFound]++; M_counters [CPT_PD_FailedCallRegexpHdrNotFound]++; @@ -1497,6 +1503,8 @@ << "FailedCmdNotSent(C)" << stat_delimiter << "FailedRegexpDoesntMatch(P)" << stat_delimiter << "FailedRegexpDoesntMatch(C)" << stat_delimiter + << "FailedRegexpShouldntMatch(P)" << stat_delimiter + << "FailedRegexpShouldntMatch(C)" << stat_delimiter << "FailedRegexpHdrNotFound(P)" << stat_delimiter << "FailedRegexpHdrNotFound(C)" << stat_delimiter << "FailedOutboundCongestion(P)" << stat_delimiter @@ -1600,6 +1608,8 @@ << M_counters[CPT_C_FailedCallCmdNotSent] << stat_delimiter << M_counters[CPT_PL_FailedCallRegexpDoesntMatch] << stat_delimiter << M_counters[CPT_C_FailedCallRegexpDoesntMatch] << stat_delimiter + << M_counters[CPT_PL_FailedCallRegexpShouldntMatch] << stat_delimiter + << M_counters[CPT_C_FailedCallRegexpShouldntMatch] << stat_delimiter << M_counters[CPT_PL_FailedCallRegexpHdrNotFound] << stat_delimiter << M_counters[CPT_C_FailedCallRegexpHdrNotFound] << stat_delimiter << M_counters[CPT_PL_FailedOutboundCongestion] << stat_delimiter Modified: sipp/trunk/stat.hpp =================================================================== --- sipp/trunk/stat.hpp 2009-03-30 08:51:27 UTC (rev 578) +++ sipp/trunk/stat.hpp 2009-04-15 12:10:03 UTC (rev 579) @@ -104,6 +104,7 @@ E_FAILED_CALL_REJECTED, E_FAILED_CMD_NOT_SENT, E_FAILED_REGEXP_DOESNT_MATCH, + E_FAILED_REGEXP_SHOULDNT_MATCH, E_FAILED_REGEXP_HDR_NOT_FOUND, E_FAILED_OUTBOUND_CONGESTION, E_FAILED_TIMEOUT_ON_RECV, @@ -143,6 +144,7 @@ CPT_C_FailedCallCallRejected, CPT_C_FailedCallCmdNotSent, CPT_C_FailedCallRegexpDoesntMatch, + CPT_C_FailedCallRegexpShouldntMatch, CPT_C_FailedCallRegexpHdrNotFound, CPT_C_FailedOutboundCongestion, CPT_C_FailedTimeoutOnRecv, @@ -182,6 +184,7 @@ CPT_PD_FailedCallCallRejected, CPT_PD_FailedCallCmdNotSent, CPT_PD_FailedCallRegexpDoesntMatch, + CPT_PD_FailedCallRegexpShouldntMatch, CPT_PD_FailedCallRegexpHdrNotFound, CPT_PD_FailedOutboundCongestion, CPT_PD_FailedTimeoutOnRecv, @@ -222,6 +225,7 @@ CPT_PL_FailedCallCallRejected, CPT_PL_FailedCallCmdNotSent, CPT_PL_FailedCallRegexpDoesntMatch, + CPT_PL_FailedCallRegexpShouldntMatch, CPT_PL_FailedCallRegexpHdrNotFound, CPT_PL_FailedOutboundCongestion, CPT_PL_FailedTimeoutOnRecv, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |