📄 scenario.cpp
字号:
break; default: return(0); } } // end for } return(1);}int createIntegerTable(char * P_listeStr, unsigned int ** listeInteger, int * sizeOfList){ int nb=0; char * ptr = P_listeStr; char * ptr_prev = P_listeStr; unsigned int current_int; int sizeOf; bool isANumber; if(isWellFormed(P_listeStr, sizeOfList) == 1) { (*listeInteger) = new unsigned int[(*sizeOfList)]; while((*ptr) != ('\0')) { if((*ptr) == ',') { sscanf(ptr_prev, "%u", ¤t_int); if (nb<(*sizeOfList)) (*listeInteger)[nb] = current_int; nb++; ptr_prev = ptr+1; } ptr++; } // Read the last sscanf(ptr_prev, "%u", ¤t_int); if (nb<(*sizeOfList)) (*listeInteger)[nb] = current_int; nb++; return(1); } return(0);}// TIP: to integrate an existing XML scenario, use the following sed line:// cat ../3pcc-controller-B.xml | sed -e 's/\"/\\\"/g' -e 's/\(.*\)/\"\1\\n\"/'char * default_scenario [] = { /************* Default_scenario[0] ***************/(char *)"<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n""<!DOCTYPE scenario SYSTEM \"sipp.dtd\">\n""\n""<!-- This program is free software; you can redistribute it and/or -->\n""<!-- modify it under the terms of the GNU General Public License as -->\n""<!-- published by the Free Software Foundation; either version 2 of the -->\n""<!-- License, or (at your option) any later version. -->\n""<!-- -->\n""<!-- This program is distributed in the hope that it will be useful, -->\n""<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->\n""<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->\n""<!-- GNU General Public License for more details. -->\n""<!-- -->\n""<!-- You should have received a copy of the GNU General Public License -->\n""<!-- along with this program; if not, write to the -->\n""<!-- Free Software Foundation, Inc., -->\n""<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->\n""<!-- -->\n""<!-- Sipp default 'uac' scenario. -->\n""<!-- -->\n""\n""<scenario name=\"Basic Sipstone UAC\">\n"" <!-- In client mode (sipp placing calls), the Call-ID MUST be -->\n"" <!-- generated by sipp. To do so, use [call_id] token. -->\n"" <send retrans=\"500\">\n"" <![CDATA[\n""\n"" INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0\n"" Via: SIP/2.0/[transport] [local_ip]:[local_port]\n"" From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]\n"" To: sut <sip:[service]@[remote_ip]:[remote_port]>\n"" Call-ID: [call_id]\n"" CSeq: 1 INVITE\n"" Contact: sip:sipp@[local_ip]:[local_port]\n"" Max-Forwards: 70\n"" Subject: Performance Test\n"" Content-Type: application/sdp\n"" Content-Length: [len]\n""\n"" v=0\n"" o=user1 53655765 2353687637 IN IP4 127.0.0.1\n"" s=-\n"" t=0 0\n"" c=IN IP4 [media_ip]\n"" m=audio [media_port] RTP/AVP 0\n"" a=rtpmap:0 PCMU/8000\n""\n"" ]]>\n"" </send>\n""\n"" <recv response=\"100\"\n"" optional=\"true\">\n"" </recv>\n""\n"" <recv response=\"180\" optional=\"true\">\n"" </recv>\n""\n"" <!-- By adding rrs=\"true\" (Record Route Sets), the route sets -->\n"" <!-- are saved and used for following messages sent. Useful to test -->\n"" <!-- against stateful SIP proxies/B2BUAs. -->\n"" <recv response=\"200\" rtd=\"true\">\n"" </recv>\n""\n"" <!-- Packet lost can be simulated in any send/recv message by -->\n"" <!-- by adding the 'lost = \"10\"'. Value can be [1-100] percent. -->\n"" <send>\n"" <![CDATA[\n""\n"" ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0\n"" Via: SIP/2.0/[transport] [local_ip]:[local_port]\n"" From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]\n"" To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]\n"" Call-ID: [call_id]\n"" CSeq: 1 ACK\n"" Contact: sip:sipp@[local_ip]:[local_port]\n"" Max-Forwards: 70\n"" Subject: Performance Test\n"" Content-Length: 0\n""\n"" ]]>\n"" </send>\n""\n"" <!-- This delay can be customized by the -d command-line option -->\n"" <!-- or by adding a 'milliseconds = \"value\"' option here. -->\n"" <pause/>\n""\n"" <!-- The 'crlf' option inserts a blank line in the statistics report. -->\n"" <send retrans=\"500\">\n"" <![CDATA[\n""\n"" BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0\n"" Via: SIP/2.0/[transport] [local_ip]:[local_port]\n"" From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]\n"" To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]\n"" Call-ID: [call_id]\n"" CSeq: 2 BYE\n"" Contact: sip:sipp@[local_ip]:[local_port]\n"" Max-Forwards: 70\n"" Subject: Performance Test\n"" Content-Length: 0\n""\n"" ]]>\n"" </send>\n""\n"" <recv response=\"200\" crlf=\"true\">\n"" </recv>\n""\n"" <!-- definition of the response time repartition table (unit is ms) -->\n"" <ResponseTimeRepartition value=\"10, 20, 30, 40, 50, 100, 150, 200\"/>\n""\n"" <!-- definition of the call length repartition table (unit is ms) -->\n"" <CallLengthRepartition value=\"10, 50, 100, 500, 1000, 5000, 10000\"/>\n""\n""</scenario>\n""\n", /************* Default_scenario[1] ***************/(char *)"<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n""<!DOCTYPE scenario SYSTEM \"sipp.dtd\">\n""\n""<!-- This program is free software; you can redistribute it and/or -->\n""<!-- modify it under the terms of the GNU General Public License as -->\n""<!-- published by the Free Software Foundation; either version 2 of the -->\n""<!-- License, or (at your option) any later version. -->\n""<!-- -->\n""<!-- This program is distributed in the hope that it will be useful, -->\n""<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->\n""<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->\n""<!-- GNU General Public License for more details. -->\n""<!-- -->\n""<!-- You should have received a copy of the GNU General Public License -->\n""<!-- along with this program; if not, write to the -->\n""<!-- Free Software Foundation, Inc., -->\n""<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->\n""<!-- -->\n""<!-- Sipp default 'uas' scenario. -->\n""<!-- -->\n""\n""<scenario name=\"Basic UAS responder\">\n"" <!-- By adding rrs=\"true\" (Record Route Sets), the route sets -->\n"" <!-- are saved and used for following messages sent. Useful to test -->\n"" <!-- against stateful SIP proxies/B2BUAs. -->\n"" <recv request=\"INVITE\" crlf=\"true\">\n"" </recv>\n""\n"" <!-- The '[last_*]' keyword is replaced automatically by the -->\n"" <!-- specified header if it was present in the last message received -->\n"" <!-- (except if it was a retransmission). If the header was not -->\n"" <!-- present or if no message has been received, the '[last_*]' -->\n"" <!-- keyword is discarded, and all bytes until the end of the line -->\n"" <!-- are also discarded. -->\n"" <!-- -->\n"" <!-- If the specified header was present several times in the -->\n"" <!-- message, all occurences are concatenated (CRLF seperated) -->\n"" <!-- to be used in place of the '[last_*]' keyword. -->\n""\n"" <send>\n"" <![CDATA[\n""\n"" SIP/2.0 180 Ringing\n"" [last_Via:]\n"" [last_From:]\n"" [last_To:];tag=[call_number]\n"" [last_Call-ID:]\n"" [last_CSeq:]\n"" Contact: <sip:[local_ip]:[local_port];transport=[transport]>\n"" Content-Length: 0\n""\n"" ]]>\n"" </send>\n""\n"" <send retrans=\"500\">\n"" <![CDATA[\n""\n"" SIP/2.0 200 OK\n"" [last_Via:]\n"" [last_From:]\n"" [last_To:];tag=[call_number]\n"" [last_Call-ID:]\n"" [last_CSeq:]\n"" Contact: <sip:[local_ip]:[local_port];transport=[transport]>\n"" Content-Type: application/sdp\n"" Content-Length: [len]\n""\n"" v=0\n"" o=user1 53655765 2353687637 IN IP4 127.0.0.1\n"" s=-\n"" t=0 0\n"" c=IN IP4 [media_ip]\n"" m=audio [media_port] RTP/AVP 0\n"" a=rtpmap:0 PCMU/8000\n""\n"" ]]>\n"" </send>\n""\n"" <recv request=\"ACK\"\n"" optional=\"true\"\n"" rtd=\"true\"\n"" crlf=\"true\">\n"" </recv>\n""\n"" <recv request=\"BYE\">\n"" </recv>\n""\n"" <send>\n"" <![CDATA[\n""\n"" SIP/2.0 200 OK\n"" [last_Via:]\n"" [last_From:]\n"" [last_To:];tag=[call_number]\n"" [last_Call-ID:]\n"" [last_CSeq:]\n"" Contact: <sip:[local_ip]:[local_port];transport=[transport]>\n"" Content-Length: 0\n""\n"" ]]>\n"" </send>\n""\n"" <!-- Keep the call open for a while in case the 200 is lost to be -->\n"" <!-- able to retransmit it if we receive the BYE again. -->\n"" <pause milliseconds=\"4000\"/>\n""\n""\n"" <!-- definition of the response time repartition table (unit is ms) -->\n"" <ResponseTimeRepartition value=\"10, 20, 30, 40, 50, 100, 150, 200\"/>\n""\n"" <!-- definition of the call length repartition table (unit is ms) -->\n"" <CallLengthRepartition value=\"10, 50, 100, 500, 1000, 5000, 10000\"/>\n""\n""</scenario>\n""\n",/************* Default_scenario[2] ***************/(char *)"<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n""<!DOCTYPE scenario SYSTEM \"sipp.dtd\">\n""\n""<!-- This program is free software; you can redistribute it and/or -->\n""<!-- modify it under the terms of the GNU General Public License as -->\n""<!-- published by the Free Software Foundation; either version 2 of the -->\n""<!-- License, or (at your option) any later version. -->\n""<!-- -->\n""<!-- This program is distributed in the hope that it will be useful, -->\n""<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->\n""<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->\n""<!-- GNU General Public License for more details. -->\n""<!-- -->\n""<!-- You should have received a copy of the GNU General Public License -->\n""<!-- along with this program; if not, write to the -->\n""<!-- Free Software Foundation, Inc., -->\n""<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->\n""<!-- -->\n""<!-- Sipp default 'regexp client' scenario. -->\n""<!-- -->\n""\n""<scenario name=\"Client with regexp scenario\">\n"" <send retrans=\"500\">\n"" <![CDATA[\n""\n"" INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0\n"" Via: SIP/2.0/[transport] [local_ip]:[local_port]\n"" From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]\n"" To: sut <sip:[service]@[remote_ip]:[remote_port]>\n"" Call-ID: [call_id]\n"" CSeq: 1 INVITE\n"" Contact: sip:sipp@[local_ip]:[local_port]\n"" Max-Forwards: 70\n"" Subject: Performance Test\n"" Content-Type: application/sdp\n"" Content-Length: [len]\n""\n"" v=0\n"" o=user1 53655765 2353687637 IN IP4 127.0.0.1\n"" s=-\n"" t=0 0\n"" c=IN IP4 [media_ip]\n"" m=audio [media_port] RTP/AVP 0\n"" a=rtpmap:0 PCMU/8000\n""\n"" ]]>\n"" </send>\n""\n"" <recv response=\"100\"\n"" optional=\"true\">\n"" </recv>\n""\n"" <recv response=\"180\" optional=\"true\">\n"" </recv>\n""\n"" <recv response=\"200\" start_rtd=\"true\">\n"" <!-- Definition of regexp in the action tag. The regexp must follow -->\n"" <!-- the Posix Extended standard (POSIX 1003.2), see: -->\n"" <!-- -->\n"" <!-- http://www.opengroup.org/onlinepubs/007908799/xbd/re.html -->\n"" <!-- -->\n"" <!-- regexp : Contain the regexp to use for matching the -->\n"" <!-- received message -->\n"" <!-- MANDATORY -->\n"" <!-- search_in : msg (try to match against the entire message) -->\n"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -