/[resiprocate]/main/resip/stack/test/testRSP-2.cxx
ViewVC logotype

Contents of /main/resip/stack/test/testRSP-2.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7081 - (show annotations) (download)
Tue Apr 17 14:46:38 2007 UTC (12 years, 7 months ago) by bcampen
File MIME type: text/plain
File size: 3980 byte(s)
Reverting rev 7077 until it can get some review.
1 #include "resip/stack/SipStack.hxx"
2 #include "resip/stack/SipMessage.hxx"
3 #include "rutil/Logger.hxx"
4 #include "rutil/Subsystem.hxx"
5 #include "resip/stack/Helper.hxx"
6
7 #ifndef WIN32
8 #include <pthread.h>
9 #endif
10
11 class TestSS : public resip::Subsystem
12 {
13 public:
14 static const TestSS RSP2;
15 private:
16 TestSS(const resip::Data& rhs) : resip::Subsystem(resip::Data("TestSS")+rhs){};
17 TestSS& operator=(const resip::Data& rhs);
18 }
19
20 const TestSS::RSP2("RSP2");
21
22 using namespace std;
23 using namespace resip;
24
25 bool g_stop_poller = false;
26
27 void *poller(void *arg)
28 {
29 int i = 0;
30 SipStack *stack1 = (SipStack*)arg;
31 while (!g_stop_poller)
32 {
33 FdSet fdset;
34 stack1->buildFdSet(fdset);
35 fdset.selectMilliSeconds(100);
36 stack1->process(fdset);
37 SipMessage *msg = stack1->receive();
38 if (msg)
39 {
40 cerr << "Got a message" << endl;
41 SipMessage *resp = Helper::makeResponse(*msg,604);
42 stack1->send(*resp);
43 delete resp;
44 delete msg;
45 }
46 else
47 {
48 ++i;
49 if (!(i%10))
50 cerr << "Nothing there " << i/10 << '\r';
51 }
52 }
53 return NULL;
54 }
55
56 #define RESIPROCATE_SUBSYSTEM TestSS::RSP2
57
58 int main(int argc, char* argv[])
59 {
60 resip::Log::initialize(Log::Cout, Log::Stack, *argv);
61 SipStack stack1;
62 //pthread_t tid;
63 stack1.addTransport(UDP, 5060, V4, StunDisabled, Data::Empty, Data::Empty, Data::Empty, SecurityTypes::TLSv1);
64 stack1.addTransport(TCP, 5060, V4, StunDisabled, Data::Empty, Data::Empty, Data::Empty, SecurityTypes::TLSv1);
65 //pthread_create(&tid, NULL, poller, &stack1);
66 //pthread_join(tid, &retval);
67 poller((void*)&stack1);
68 }
69
70 /* ====================================================================
71 * The Vovida Software License, Version 1.0
72 *
73 * Copyright (c) 2000-2005 Vovida Networks, Inc. All rights reserved.
74 *
75 * Redistribution and use in source and binary forms, with or without
76 * modification, are permitted provided that the following conditions
77 * are met:
78 *
79 * 1. Redistributions of source code must retain the above copyright
80 * notice, this list of conditions and the following disclaimer.
81 *
82 * 2. Redistributions in binary form must reproduce the above copyright
83 * notice, this list of conditions and the following disclaimer in
84 * the documentation and/or other materials provided with the
85 * distribution.
86 *
87 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
88 * and "Vovida Open Communication Application Library (VOCAL)" must
89 * not be used to endorse or promote products derived from this
90 * software without prior written permission. For written
91 * permission, please contact vocal@vovida.org.
92 *
93 * 4. Products derived from this software may not be called "VOCAL", nor
94 * may "VOCAL" appear in their name, without prior written
95 * permission of Vovida Networks, Inc.
96 *
97 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
98 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
99 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
100 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
101 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
102 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
103 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
104 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
105 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
106 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
107 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
108 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
109 * DAMAGE.
110 *
111 * ====================================================================
112 *
113 * This software consists of voluntary contributions made by Vovida
114 * Networks, Inc. and many individuals on behalf of Vovida Networks,
115 * Inc. For more information on Vovida Networks, Inc., please see
116 * <http://www.vovida.org/>.
117 *
118 */

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