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