/[resiprocate]/main/resip/stack/test/lg.cxx
ViewVC logotype

Contents of /main/resip/stack/test/lg.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5948 - (show annotations) (download)
Fri Feb 17 15:30:16 2006 UTC (13 years, 9 months ago) by dworley
File MIME type: text/plain
File size: 4596 byte(s)
Setting more svn: properties, and adding EOLs to the ends of files
that need it.

1 #include "rutil/Logger.hxx"
2
3 #include "resip/stack/Uri.hxx"
4
5 #include "Register.hxx"
6 #include "Registrar.hxx"
7 #include "InviteServer.hxx"
8 #include "InviteClient.hxx"
9 #include "Transceiver.hxx"
10
11
12 using namespace resip;
13 using namespace std;
14 using namespace Loadgen;
15
16
17 #define RESIPROCATE_SUBSYSTEM Subsystem::SIP
18
19 void usage()
20 {
21 cout << "Usage: lg port {REG_RECEIVE, INV_RECEIVE}" << endl
22 << " lg port {REG_SEND, INV_SEND} targetHost:port startingExt endingExt [registers]" << endl;
23 exit(-1);
24 }
25
26 int
27 main(int argc, char* argv[])
28 {
29 Log::initialize(Log::Cout, Log::Info, argv[0]);
30
31 if (!(argc == 3 || argc == 6 || argc == 7))
32 {
33 usage();
34 }
35
36 int port = atoi(argv[1]);
37 if (port == 0)
38 {
39 usage();
40 }
41
42 if (Data(argv[2]) == "REG_SEND" || Data(argv[2]) == "INV_SEND")
43 {
44 Uri target;
45
46 ParseBuffer host(argv[3], strlen(argv[3]));
47 const char* start = host.position();
48 host.skipToChar(Symbols::COLON[0]);
49 if (host.position() == host.end())
50 {
51 usage();
52 }
53
54 target.host() = host.data(start);
55 host.skipChar();
56 target.port() = host.integer();
57 target.param(p_transport) = "udp";
58
59 InfoLog(<< target);
60
61 Transceiver stack(port);
62
63 int startExt = atoi(argv[4]);
64 int endExt = atoi(argv[5]);
65 if (startExt == 0 || endExt == 0 || startExt > endExt)
66 {
67 usage();
68 }
69 int numTimes = 0;
70 if (argc == 7)
71 {
72 numTimes = atoi(argv[6]);
73 if (numTimes == 0)
74 {
75 usage();
76 }
77 }
78 if (Data(argv[2]) == "REG_SEND")
79 {
80 Register reg(stack, target,
81 startExt, endExt, numTimes);
82 reg.go();
83 }
84 else
85 {
86 InviteClient inv(stack, target,
87 startExt, endExt, numTimes);
88 inv.go();
89 }
90 }
91 else if (Data(argv[2]) == "REG_RECEIVE")
92 {
93 Transceiver stack(port);
94 Registrar reg(stack);
95 reg.go();
96 }
97 else if (Data(argv[2]) == "INV_RECEIVE")
98 {
99 Transceiver stack(port);
100 InviteServer inv(stack);
101 inv.go();
102 }
103 else
104 {
105 usage();
106 }
107 return 0;
108 }
109 /* ====================================================================
110 * The Vovida Software License, Version 1.0
111 *
112 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
113 *
114 * Redistribution and use in source and binary forms, with or without
115 * modification, are permitted provided that the following conditions
116 * are met:
117 *
118 * 1. Redistributions of source code must retain the above copyright
119 * notice, this list of conditions and the following disclaimer.
120 *
121 * 2. Redistributions in binary form must reproduce the above copyright
122 * notice, this list of conditions and the following disclaimer in
123 * the documentation and/or other materials provided with the
124 * distribution.
125 *
126 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
127 * and "Vovida Open Communication Application Library (VOCAL)" must
128 * not be used to endorse or promote products derived from this
129 * software without prior written permission. For written
130 * permission, please contact vocal@vovida.org.
131 *
132 * 4. Products derived from this software may not be called "VOCAL", nor
133 * may "VOCAL" appear in their name, without prior written
134 * permission of Vovida Networks, Inc.
135 *
136 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
137 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
138 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
139 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
140 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
141 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
142 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
143 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
144 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
145 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
146 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
147 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
148 * DAMAGE.
149 *
150 * ====================================================================
151 *
152 * This software consists of voluntary contributions made by Vovida
153 * Networks, Inc. and many individuals on behalf of Vovida Networks,
154 * Inc. For more information on Vovida Networks, Inc., please see
155 * <http://www.vovida.org/>.
156 *
157 */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27