From: <cha...@us...> - 2008-03-28 13:46:50
|
Revision: 430 http://sipp.svn.sourceforge.net/sipp/?rev=430&view=rev Author: charlespwright Date: 2008-03-28 06:46:49 -0700 (Fri, 28 Mar 2008) Log Message: ----------- Enh: Allow more than one sending message per action. Modified Paths: -------------- sipp/trunk/actions.cpp sipp/trunk/actions.hpp Modified: sipp/trunk/actions.cpp =================================================================== --- sipp/trunk/actions.cpp 2008-03-28 13:44:06 UTC (rev 429) +++ sipp/trunk/actions.cpp 2008-03-28 13:46:49 UTC (rev 430) @@ -112,9 +112,9 @@ } else if (M_action == E_AT_EXEC_INTCMD) { printf("Type[%d] - intcmd[%-32.32s]", M_action, strIntCmd(M_IntCmd)); } else if (M_action == E_AT_LOG_TO_FILE) { - printf("Type[%d] - message[%-32.32s]", M_action, M_message); + printf("Type[%d] - message[%-32.32s]", M_action, M_message[0]); } else if (M_action == E_AT_LOG_WARNING) { - printf("Type[%d] - warning[%-32.32s]", M_action, M_message); + printf("Type[%d] - warning[%-32.32s]", M_action, M_message[0]); } else if (M_action == E_AT_ASSIGN_FROM_SAMPLE) { char tmp[40]; M_distribution->textDescr(tmp, sizeof(tmp)); @@ -126,7 +126,7 @@ } else if (M_action == E_AT_ASSIGN_FROM_GETTIMEOFDAY) { printf("Type[%d] - assign gettimeofday[%d, %d]", M_action, display_scenario->allocVars->getName(M_varId)); } else if (M_action == E_AT_ASSIGN_FROM_STRING) { - printf("Type[%d] - string assign varId[%d] [%-32.32s]", M_action, display_scenario->allocVars->getName(M_varId), M_message); + printf("Type[%d] - string assign varId[%d] [%-32.32s]", M_action, display_scenario->allocVars->getName(M_varId), M_message[0]); } else if (M_action == E_AT_JUMP) { printf("Type[%d] - jump varInId[%d] %lf", M_action, display_scenario->allocVars->getName(M_varInId), M_doubleValue); } else if (M_action == E_AT_PAUSE_RESTORE) { @@ -165,7 +165,7 @@ int CAction::getVarId() { return(M_varId); } int CAction::getVarInId() { return(M_varInId); } char* CAction::getLookingChar() { return(M_lookingChar); } -SendingMessage *CAction::getMessage() { return(M_message); } +SendingMessage *CAction::getMessage(int n) { return(M_message[n]); } SendingMessage *CAction::getCmdLine() { return(M_cmdLine); } CSample* CAction::getDistribution() { return(M_distribution); } double CAction::getDoubleValue() { return(M_doubleValue); } @@ -250,18 +250,20 @@ } } -void CAction::setMessage (char* P_value) +void CAction::setMessage (char* P_value, int n) { - if(M_message != NULL) + if(M_message[n] != NULL) { - delete [] M_message; - M_message = NULL; + delete M_message[n]; + M_message[n] = NULL; } + free(M_message_str[n]); + M_message_str[n] = NULL; if(P_value != NULL) { - M_message_str = strdup(P_value); - M_message = new SendingMessage(M_scenario, P_value, true /* skip sanity */); + M_message_str[n] = strdup(P_value); + M_message[n] = new SendingMessage(M_scenario, P_value, true /* skip sanity */); } } @@ -427,7 +429,9 @@ setCaseIndep ( P_action.getCaseIndep() ); setOccurence ( P_action.getOccurence() ); setHeadersOnly ( P_action.getHeadersOnly() ); - setMessage ( P_action.M_message_str ); + for (L_i = 0; L_i < MAX_ACTION_MESSAGE; L_i++) { + setMessage(P_action.M_message_str[L_i], L_i); + } setRegExp ( P_action.M_regularExpression); setCmdLine ( P_action.M_cmdLine_str ); setIntCmd ( P_action.M_IntCmd ); @@ -452,7 +456,10 @@ M_caseIndep = false; M_occurence = 1; M_headersOnly = true; - M_message = NULL; + for (int i = 0; i < MAX_ACTION_MESSAGE; i++) { + M_message[i] = NULL; + M_message_str[i] = NULL; + } M_cmdLine = NULL; M_IntCmd = E_INTCMD_INVALID; M_doubleValue = 0; @@ -461,8 +468,6 @@ #ifdef PCAPPLAY M_pcapArgs = NULL; #endif - M_message = NULL; - M_message_str = NULL; M_cmdLine_str = NULL; M_scenario = scenario; M_regExpSet = false; @@ -476,16 +481,15 @@ delete [] M_lookingChar; M_lookingChar = NULL; } - if(M_message != NULL) - { - delete M_message; - M_message = NULL; + for (int i = 0; i < MAX_ACTION_MESSAGE; i++) { + if(M_message[i] != NULL) + { + delete M_message[i]; + M_message[i] = NULL; + } + free(M_message_str[i]); + M_message_str[i] = NULL; } - if(M_message_str != NULL) - { - free(M_message_str); - M_message_str = NULL; - } if(M_cmdLine != NULL) { delete M_cmdLine; Modified: sipp/trunk/actions.hpp =================================================================== --- sipp/trunk/actions.hpp 2008-03-28 13:44:06 UTC (rev 429) +++ sipp/trunk/actions.hpp 2008-03-28 13:46:49 UTC (rev 430) @@ -31,6 +31,8 @@ #include "prepare_pcap.h" #endif +#define MAX_ACTION_MESSAGE 2 + class CAction { public: @@ -111,7 +113,7 @@ int getOccurence(); char* getLookingChar(); char* getRegularExpression(); - SendingMessage *getMessage(); /* log specific function */ + SendingMessage *getMessage(int n = 0); /* log specific function */ SendingMessage *getCmdLine(); /* exec specific function */ T_IntCmdType getIntCmd(); /* exec specific function */ #ifdef PCAPPLAY @@ -132,7 +134,7 @@ void setScenario (scenario * P_scenario); void setRegExp (char* P_value); /* ereg specific function. */ int executeRegExp (char* P_string, VariableTable *P_callVarTable); - void setMessage (char* P_value); /* log specific function */ + void setMessage (char* P_value, int n = 0); /* log specific function */ void setCmdLine (char* P_value); /* exec specific function */ void setIntCmd (T_IntCmdType P_type ); /* exec specific function */ void setDistribution (CSample * P_value); /* sample specific function */ @@ -171,8 +173,8 @@ char* M_lookingChar; /* log specific member */ - SendingMessage *M_message; - char * M_message_str; + SendingMessage *M_message[MAX_ACTION_MESSAGE]; + char * M_message_str[MAX_ACTION_MESSAGE]; /* exec specific member */ SendingMessage *M_cmdLine; char* M_cmdLine_str; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |