You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(2) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(12) |
Feb
(9) |
Mar
(8) |
Apr
(5) |
May
(10) |
Jun
(13) |
Jul
(7) |
Aug
(15) |
Sep
(17) |
Oct
(23) |
Nov
(51) |
Dec
(9) |
2007 |
Jan
(27) |
Feb
(11) |
Mar
(14) |
Apr
(21) |
May
(55) |
Jun
(15) |
Jul
(16) |
Aug
(8) |
Sep
(15) |
Oct
(24) |
Nov
(19) |
Dec
(47) |
2008 |
Jan
(33) |
Feb
(1) |
Mar
(14) |
Apr
(10) |
May
(8) |
Jun
(33) |
Jul
(33) |
Aug
(10) |
Sep
(13) |
Oct
(10) |
Nov
(1) |
Dec
(11) |
2009 |
Jan
(3) |
Feb
|
Mar
(8) |
Apr
(5) |
May
(1) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(3) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(20) |
2013 |
Jan
(3) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
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: <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-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 12:24:04
|
Revision: 539 http://sipp.svn.sourceforge.net/sipp/?rev=539&view=rev Author: charlespwright Date: 2008-09-25 11:32:11 +0000 (Thu, 25 Sep 2008) Log Message: ----------- Fix: Do not try to allocate a zero length literal. Modified Paths: -------------- sipp/trunk/message.cpp Modified: sipp/trunk/message.cpp =================================================================== --- sipp/trunk/message.cpp 2008-09-25 02:35:53 UTC (rev 538) +++ sipp/trunk/message.cpp 2008-09-25 11:32:11 UTC (rev 539) @@ -134,25 +134,29 @@ *dest++ = *src++; } else { /* We have found a keyword, store the literal that we have been generating. */ - *dest = '\0'; literalLen = dest - literal; - literal = (char *)realloc(literal, literalLen); - if (!literal) { ERROR("Out of memory!"); } + if (literalLen) { + *dest = '\0'; + literal = (char *)realloc(literal, literalLen); + if (!literal) { ERROR("Out of memory!"); } - MessageComponent *newcomp = (MessageComponent *)calloc(1, sizeof(MessageComponent)); - if (!newcomp) { ERROR("Out of memory!"); } + MessageComponent *newcomp = (MessageComponent *)calloc(1, sizeof(MessageComponent)); + if (!newcomp) { ERROR("Out of memory!"); } - newcomp->type = E_Message_Literal; - newcomp->literal = literal; - newcomp->literalLen = literalLen; // length without the terminator - messageComponents.push_back(newcomp); + newcomp->type = E_Message_Literal; + newcomp->literal = literal; + newcomp->literalLen = literalLen; // length without the terminator + messageComponents.push_back(newcomp); + } else { + free(literal); + } dest = literal = (char *)malloc(strlen(src) + num_cr + 1); literalLen = 0; *dest = '\0'; /* Now lets determine which keyword we have. */ - newcomp = (MessageComponent *)calloc(1, sizeof(MessageComponent)); + MessageComponent *newcomp = (MessageComponent *)calloc(1, sizeof(MessageComponent)); if (!newcomp) { ERROR("Out of memory!"); } char keyword [KEYWORD_SIZE+1]; 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-22 15:49:46
|
Revision: 537 http://sipp.svn.sourceforge.net/sipp/?rev=537&view=rev Author: charlespwright Date: 2008-09-22 15:48:36 +0000 (Mon, 22 Sep 2008) Log Message: ----------- Enh: Add debug_pcap target. Modified Paths: -------------- sipp/trunk/Makefile Modified: sipp/trunk/Makefile =================================================================== --- sipp/trunk/Makefile 2008-09-22 15:43:59 UTC (rev 536) +++ sipp/trunk/Makefile 2008-09-22 15:48:36 UTC (rev 537) @@ -196,6 +196,9 @@ debug_ossl: @DEBUG_FLAGS=-g ; export DEBUG_FLAGS ; $(MAKE) ossl +debug_pcap: + @DEBUG_FLAGS=-g ; export DEBUG_FLAGS ; make pcapplay + debug_pcap_cygwin: @DEBUG_FLAGS=-g ; export DEBUG_FLAGS ; $(MAKE) pcapplay_ossl_cygwin 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-22 15:12:09
|
Revision: 535 http://sipp.svn.sourceforge.net/sipp/?rev=535&view=rev Author: charlespwright Date: 2008-09-22 15:12:06 +0000 (Mon, 22 Sep 2008) Log Message: ----------- Enh: Allow log files to be used in scenario initialization. (From Andy Aicken). Modified Paths: -------------- sipp/trunk/sipp.cpp Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-09-22 14:48:05 UTC (rev 534) +++ sipp/trunk/sipp.cpp 2008-09-22 15:12:06 UTC (rev 535) @@ -30,6 +30,7 @@ * Wolfgang Beck * Charles P Wright from IBM Research * Martin Van Leeuwen + * Andy Aicken */ #define GLOBALS_FULL_DEFINITION @@ -4407,9 +4408,12 @@ REQUIRE_ARG(); CHECK_PASS(); if (!strcmp(argv[argi - 1], "-sf")) { - main_scenario = new scenario(argv[argi], 0); scenario_file = new char [strlen(argv[argi])+1] ; sprintf(scenario_file,"%s", argv[argi]); + if (useLogf == 1) { + rotate_logfile(); + } + main_scenario = new scenario(argv[argi], 0); main_scenario->stats->setFileName(argv[argi], (char*)".csv"); } else if (!strcmp(argv[argi - 1], "-sn")) { int i = find_scenario(argv[argi]); @@ -4677,10 +4681,6 @@ print_count_file(countf, 1); } - if (useLogf == 1) { - rotate_logfile(); - } - if (dumpInRtt == 1) { main_scenario->stats->initRtt((char*)scenario_file, (char*)".csv", report_freq_dumpRtt); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-09-22 14:48:30
|
Revision: 534 http://sipp.svn.sourceforge.net/sipp/?rev=534&view=rev Author: charlespwright Date: 2008-09-22 14:48:05 +0000 (Mon, 22 Sep 2008) Log Message: ----------- Fix: Create the socket before reconnecting it for TCP setdest actions. Modified Paths: -------------- sipp/trunk/call.cpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-09-22 14:46:56 UTC (rev 533) +++ sipp/trunk/call.cpp 2008-09-22 14:48:05 UTC (rev 534) @@ -3470,6 +3470,18 @@ ERROR("Unknown transport for setdest: '%s'", str_protocol); } + if (!call_socket && protocol == T_TCP && transport == T_TCP) { + bool existing; + if ((associate_socket(new_sipp_call_socket(use_ipv6, transport, &existing))) == NULL) { + ERROR_NO("Unable to get a TCP socket"); + } + + if (!existing) { + sipp_customize_socket(call_socket); + } + } + + if (protocol != call_socket->ss_transport) { ERROR("Can not switch protocols during setdest."); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-09-22 14:47:02
|
Revision: 533 http://sipp.svn.sourceforge.net/sipp/?rev=533&view=rev Author: charlespwright Date: 2008-09-22 14:46:56 +0000 (Mon, 22 Sep 2008) Log Message: ----------- Fix: If we are in server mode, we should also allow TCP reconnections. Modified Paths: -------------- sipp/trunk/sipp.cpp Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-08-28 22:06:11 UTC (rev 532) +++ sipp/trunk/sipp.cpp 2008-09-22 14:46:56 UTC (rev 533) @@ -4802,10 +4802,6 @@ opentask::set_rate(rate); } - if (creationMode == MODE_SERVER) { - reset_number = 0; - } - open_connections(); /* Defaults for media sockets */ 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-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 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 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-27 01:40:53
|
Revision: 528 http://sipp.svn.sourceforge.net/sipp/?rev=528&view=rev Author: charlespwright Date: 2008-08-27 01:40:51 +0000 (Wed, 27 Aug 2008) Log Message: ----------- Fix: Correctly handle newline at end of CDATA from Michael Stovenour. Modified Paths: -------------- sipp/trunk/scenario.cpp Modified: sipp/trunk/scenario.cpp =================================================================== --- sipp/trunk/scenario.cpp 2008-08-22 19:08:05 UTC (rev 527) +++ sipp/trunk/scenario.cpp 2008-08-27 01:40:51 UTC (rev 528) @@ -24,6 +24,7 @@ * Wolfgang Beck * Marc Van Diest from Belgacom * Charles P. Wright from IBM Research + * Michael Stovenour */ #include <stdlib.h> @@ -602,7 +603,7 @@ (*ptr == '\t') || (*ptr == '\n'))) { if(*ptr == '\n' && removed_crlf) { - *removed_crlf++; + (*removed_crlf)++; } *ptr-- = 0; } 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-22 03:32:19
|
Revision: 526 http://sipp.svn.sourceforge.net/sipp/?rev=526&view=rev Author: charlespwright Date: 2008-08-22 03:32:16 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Fix: r524 messed up content-length calculations, correct it. Modified Paths: -------------- sipp/trunk/call.cpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-08-22 01:49:41 UTC (rev 525) +++ sipp/trunk/call.cpp 2008-08-22 03:32:16 UTC (rev 526) @@ -2349,10 +2349,11 @@ } /* Need the body for length and auth-int calculation */ char *body; + char *auth_body = NULL; if (length_marker || auth_marker) { body = strstr(msg_buffer, "\r\n\r\n"); if (body) { - body += strlen("\r\n\r\n"); + auth_body += strlen("\r\n\r\n"); } } @@ -2401,8 +2402,8 @@ while(isspace(*tmp) || isdigit(*tmp)) tmp++; sscanf(tmp,"%s", method); - if (!body) { - body = ""; + if (!auth_body) { + auth_body = ""; } /* Determine the type of credentials. */ @@ -2431,7 +2432,7 @@ createSendingMessage(auth_comp->comp_param.auth_param.aka_AMF, -2, my_aka_AMF, sizeof(my_aka_AMF)); createSendingMessage(auth_comp->comp_param.auth_param.aka_OP, -2, my_aka_OP, sizeof(my_aka_OP)); - if (createAuthHeader(my_auth_user, my_auth_pass, method, uri, body, dialog_authentication, + if (createAuthHeader(my_auth_user, my_auth_pass, method, uri, auth_body, dialog_authentication, my_aka_OP, my_aka_AMF, my_aka_K, result + authlen) == 0) { ERROR("%s", result + authlen); } 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-21 16:10:44
|
Revision: 524 http://sipp.svn.sourceforge.net/sipp/?rev=524&view=rev Author: charlespwright Date: 2008-08-21 16:10:41 +0000 (Thu, 21 Aug 2008) Log Message: ----------- Fix: auth-int should not include crlfs in the body hash. Modified Paths: -------------- sipp/trunk/call.cpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-08-15 18:13:02 UTC (rev 523) +++ sipp/trunk/call.cpp 2008-08-21 16:10:41 UTC (rev 524) @@ -2351,6 +2351,9 @@ char *body; if (length_marker || auth_marker) { body = strstr(msg_buffer, "\r\n\r\n"); + if (body) { + body += strlen("\r\n\r\n"); + } } /* Fix up the length. */ 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-07-28 01:27:08
|
Revision: 522 http://sipp.svn.sourceforge.net/sipp/?rev=522&view=rev Author: charlespwright Date: 2008-07-28 01:27:05 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Don't get try to output count files if it is not intialized. Modified Paths: -------------- sipp/trunk/sipp.cpp Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-07-25 19:45:05 UTC (rev 521) +++ sipp/trunk/sipp.cpp 2008-07-28 01:27:05 UTC (rev 522) @@ -1060,12 +1060,16 @@ void print_count_file(FILE *f, int header) { char temp_str[256]; + if (!main_scenario || (!header && !main_scenario->stats)) { + return; + } + if (header) { fprintf(f, "CurrentTime%sElapsedTime%s", stat_delimiter, stat_delimiter); } else { struct timeval currentTime, startTime; GET_TIME(¤tTime); - display_scenario->stats->getStartTime(&startTime); + main_scenario->stats->getStartTime(&startTime); unsigned long globalElapsedTime = CStat::computeDiffTimeInMs (¤tTime, &startTime); fprintf(f, "%s%s", CStat::formatTime(¤tTime), stat_delimiter); fprintf(f, "%s%s", CStat::msToHHMMSSmmm(globalElapsedTime), stat_delimiter); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cha...@us...> - 2008-07-25 19:45:08
|
Revision: 521 http://sipp.svn.sourceforge.net/sipp/?rev=521&view=rev Author: charlespwright Date: 2008-07-25 19:45:05 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Fix: We should not associate call_remote_socket. Modified Paths: -------------- sipp/trunk/call.cpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-07-25 16:01:23 UTC (rev 520) +++ sipp/trunk/call.cpp 2008-07-25 19:45:05 UTC (rev 521) @@ -868,10 +868,10 @@ if (!multisocket) { main_remote_socket = call_remote_socket; } - } else { - assert(!multisocket); - assert(main_remote_socket); - call_remote_socket = associate_socket(main_remote_socket); + } + + if (!multisocket) { + call_remote_socket = main_remote_socket; main_remote_socket->ss_count++; } } 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-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 14:31:09
|
Revision: 518 http://sipp.svn.sourceforge.net/sipp/?rev=518&view=rev Author: charlespwright Date: 2008-07-25 14:31:06 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Fix: Handle zero length regexp matches more gracefully. Modified Paths: -------------- sipp/trunk/actions.cpp Modified: sipp/trunk/actions.cpp =================================================================== --- sipp/trunk/actions.cpp 2008-07-25 14:29:17 UTC (rev 517) +++ sipp/trunk/actions.cpp 2008-07-25 14:31:06 UTC (rev 518) @@ -327,19 +327,16 @@ void CAction::setSubString(char** P_target, char* P_source, int P_start, int P_stop) { int sizeOf; - size_t L_size = 0; if(P_source != NULL) { sizeOf = P_stop - P_start; - if(sizeOf > 0) { - L_size = (size_t) sizeOf; - L_size += 1; - (*P_target) = new char[L_size]; + (*P_target) = new char[sizeOf + 1]; + if (sizeOf > 0) { memcpy((*P_target), &(P_source[P_start]), sizeOf); + } - (*P_target)[sizeOf] = '\0'; - } + (*P_target)[sizeOf] = '\0'; } else { *P_target = NULL ; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |