r41 - regression_tests/common/ua
erik at minisip.org
erik at minisip.org
Mon Nov 20 14:37:04 CET 2006
Author: erik
Date: 2006-11-20 14:37:03 +0100 (Mon, 20 Nov 2006)
New Revision: 41
Modified:
regression_tests/common/ua/Makefile
regression_tests/common/ua/ua.cxx
Log:
* Updated the "ua" test application to allow the user to select what
transport protocols to start (any combination of UDP, TCP and TLS is
supported now).
Modified: regression_tests/common/ua/Makefile
===================================================================
--- regression_tests/common/ua/Makefile 2006-11-20 09:08:16 UTC (rev 40)
+++ regression_tests/common/ua/Makefile 2006-11-20 13:37:03 UTC (rev 41)
@@ -1,5 +1,5 @@
all: ua
ua: ua.cxx
- g++ -Wall -g -rdynamic -o ua $(CPP_FLAGS) $(LD_FLAGS) ua.cxx -lminisip -lmsip -lpthread -lssl
+ g++ -Wall -g -rdynamic -o ua -I$(CPP_FLAGS) -L$(LD_FLAGS) ua.cxx -lminisip -lmsip -lpthread -lssl
clean:
rm -f ua
Modified: regression_tests/common/ua/ua.cxx
===================================================================
--- regression_tests/common/ua/ua.cxx 2006-11-20 09:08:16 UTC (rev 40)
+++ regression_tests/common/ua/ua.cxx 2006-11-20 13:37:03 UTC (rev 41)
@@ -8,7 +8,7 @@
It makes the SIP stack listen to a port that is specified
via the command line.
-Usage: ./ua -u <uri> -p <port> [-d <dropvector_udp_out>] [-D <dropvector_udp_in>]
+Usage: ./ua -u <uri> -p <port> [-d <dropvector_udp_out>] [-D <dropvector_udp_in>] -t <transportproto>
<uri> is the local users SIP URI
<port> is the local UDP/TCP port numbers that will be opened
@@ -17,6 +17,9 @@
first, second, fourth, fifth, ...)
<dropvector_udp_in> same as previous, except it is applied to incoming
packets
+ <transportproto> can be udp, tcp or tls. "-t" can be given multiple
+ times to support more than one transport type. If no transport type
+ is indicated "udp" will be used.
The application registers a default handler called "MyApp" to
libmsip.
@@ -310,7 +313,12 @@
class MyApp : public SipSMCommandReceiver , public Runnable{
public:
- MyApp(MRef<SipIdentity*> ident):myIdentity(ident){}
+ MyApp(MRef<SipIdentity*> ident, bool udp, bool tcp, bool tls):
+ myIdentity(ident),
+ useUdp(udp),
+ useTcp(tcp),
+ useTls(tls)
+ {}
bool handleCommand(const SipSMCommand& cmd){
if (cmd.getType()==SipSMCommand::COMMAND_STRING){
@@ -348,13 +356,27 @@
sipStack = new SipStack( config );
sipStack->setDebugPrintPackets(true);
sipStack->setDefaultDialogCommandHandler( this );
- sipStack->startUdpServer();
- sipStack->startTcpServer();
+ if (useUdp){
+ cerr << "STARTING UDP"<<endl;
+ sipStack->startUdpServer();
+ }
+ if (useTcp){
+ cerr << "STARTING TCP"<<endl;
+ sipStack->startTcpServer();
+ }
+ if (useTls){ //FIXME: we have not implemented setting certificates for the identity yet
+ cerr << "STARTING TLS"<<endl;
+ sipStack->startTlsServer();
+ }
+
sipStack->run();
}
MRef<SipStack*> sipStack;
MRef<SipIdentity*> myIdentity;
+ bool useUdp;
+ bool useTcp;
+ bool useTls;
};
@@ -373,6 +395,9 @@
string uri;
string portstr;
+ bool startudp=false;
+ bool starttcp=false;
+ bool starttls=false;
for (int i=1; i<argc; i+=2){
if (string("-u")==argv[i])
@@ -383,8 +408,21 @@
setDropFilterOut(argv[i+1]);
if (string("-D")==argv[i])
setDropFilterIn(argv[i+1]);
+ if (string("-t")==argv[i]){
+ if (strCaseCmp(argv[i+1],"udp")==0)
+ startudp=true;
+ if (strCaseCmp(argv[i+1],"tcp")==0)
+ starttcp=true;
+ if (strCaseCmp(argv[i+1],"tls")==0)
+ starttls=true;
+ }
}
+ if (!(startudp||starttcp||starttls))
+ startudp=true;
+
+ cerr << "starttls is "<<starttls<<endl;
+
if (uri=="" || portstr==""){
usage(argv[0]);
}
@@ -393,7 +431,7 @@
MRef<SipIdentity*> myIdentity= new SipIdentity(SipUri(uri));
- MRef<MyApp*> myApp = new MyApp(myIdentity);
+ MRef<MyApp*> myApp = new MyApp(myIdentity, startudp, starttcp, starttls);
port=atoi(portstr.c_str());
More information about the Minisip-devel
mailing list