reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
EventStackThread.hxx
Go to the documentation of this file.
1#ifndef RESIP_EventStackThread__hxx
2#define RESIP_EventStackThread__hxx
3
4#include <vector>
5
6#include "rutil/ThreadIf.hxx"
7#include "rutil/FdPoll.hxx"
9
10namespace resip
11{
12
13class SipStackOptions;
14class SipStack;
15class SelectInterruptor;
16class EventThreadInterruptor;
17class FdPollGrp;
18
41{
42 public:
45 virtual ~EventStackThread();
46
47 /*
48 * If you use the 1st constructor form, use this after creating
49 * the stack to add it into the list to which the thread is providing
50 * cycles. Even with only one active stack, this approach can
51 * be used to solve the cyclic initialization problem.
52 */
53 void addStack(SipStack& stack);
54
55 virtual void thread();
56 virtual void shutdown();
57
58 protected:
59 /*
60 * Return time (in milliseconds) until your next timer, or
61 * ~30sec for infinity.
62 */
63 virtual unsigned int getTimeTillNextProcessMS() const;
64
65 /*
66 * Called after all socket IO and sip stack timers. Process
67 * any application timers here.
68 */
69 virtual void afterProcess();
70
71 private:
72 typedef std::vector<SipStack*> StackList;
73 StackList mStacks;
75 FdPollGrp& mPollGrp;
76};
77
78
79
81{
82 public:
85 protected:
86 FdPollGrp& mPollGrp; // used just to remove ourselves
88};
89
110{
111 public:
112 EventStackSimpleMgr(const char *implName);
114 /*
115 * Configure {options} with our pollGrp and asyncHandler.
116 * Use this prior to creating your SipStack instance.
117 */
118 void setOptions(SipStackOptions& options);
119
120 /*
121 * Convenience function to create SipStack instance. Will add
122 * appropriate options, cerate the stack and add the stack to
123 * the thread.
124 */
126
127
128 /*
129 * Thread accessor.
130 * Use this to invoke addStack(), run(), shutdown(), join(), etc.
131 */
133
134 /*
135 * Call to release all owned resources early. Stack must be
136 * stopped and thread joined prior to releasing.
137 */
138 void release();
139
140 protected:
145};
146
147} // namespace
148
149#endif
150
151
152/* ====================================================================
153 * The Vovida Software License, Version 1.0
154 *
155 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
156 *
157 * Redistribution and use in source and binary forms, with or without
158 * modification, are permitted provided that the following conditions
159 * are met:
160 *
161 * 1. Redistributions of source code must retain the above copyright
162 * notice, this list of conditions and the following disclaimer.
163 *
164 * 2. Redistributions in binary form must reproduce the above copyright
165 * notice, this list of conditions and the following disclaimer in
166 * the documentation and/or other materials provided with the
167 * distribution.
168 *
169 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
170 * and "Vovida Open Communication Application Library (VOCAL)" must
171 * not be used to endorse or promote products derived from this
172 * software without prior written permission. For written
173 * permission, please contact vocal@vovida.org.
174 *
175 * 4. Products derived from this software may not be called "VOCAL", nor
176 * may "VOCAL" appear in their name, without prior written
177 * permission of Vovida Networks, Inc.
178 *
179 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
180 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
181 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
182 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
183 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
184 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
185 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
186 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
187 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
188 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
189 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
190 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
191 * DAMAGE.
192 *
193 * ====================================================================
194 *
195 * This software consists of voluntary contributions made by Vovida
196 * Networks, Inc. and many individuals on behalf of Vovida Networks,
197 * Inc. For more information on Vovida Networks, Inc., please see
198 * <http://www.vovida.org/>.
199 *
200 * vi: set shiftwidth=3 expandtab:
201 */
#define resip_assert(x)
This file needs to work for both C and C++ code.
EventStackThread & getThread()
EventThreadInterruptor * mIntr
SipStack & createStack(SipStackOptions &options)
void setOptions(SipStackOptions &options)
This class creates a thread in which to run one or more SipStacks.
virtual unsigned int getTimeTillNextProcessMS() const
void addStack(SipStack &stack)
Used to 'artificially' interrupt a select call.
This class holds constructor-time initialization arguments for SipStack.
Definition SipStack.hxx:112
This is the primary point of interaction between the app-layer and the stack.
Definition SipStack.hxx:160
A wrapper class to create and spawn a thread.
Definition ThreadIf.hxx:54
dcm! – add UnusedChecking(_enum) below;
struct FdPollItemFake * FdPollItemHandle
This is opaque type used to identify a particular Item.
Definition FdPoll.hxx:42