1 // Copyright (C) 2001,2002,2006 Federico Montesino Pouzols <fedemp@altern.org>
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 //
17 // As a special exception, you may use this file as part of a free software
18 // library without restriction. Specifically, if other files instantiate
19 // templates or use macros or inline functions from this file, or you compile
20 // this file and link it with other files to produce an executable, this
21 // file does not by itself cause the resulting executable to be covered by
22 // the GNU General Public License. This exception does not however
23 // invalidate any other reasons why the executable file might be covered by
24 // the GNU General Public License.
25 //
26 // This exception applies only to the code released under the name GNU
27 // ccRTP. If you copy code from other releases into a copy of GNU
28 // ccRTP, as the General Public License permits, the exception does
29 // not apply to the code that you add in this way. To avoid misleading
30 // anyone as to the status of such modified files, you must delete
31 // this exception notice from them.
32 //
33 // If you write modifications of your own for GNU ccRTP, it is your choice
34 // whether to permit this exception to apply to your modifications.
35 // If you do not wish that, delete this exception notice.
36 //
37
43 #ifndef CCXX_RTP_POOL_H
44 #define CCXX_RTP_POOL_H
45
46 #include <list>
48
49 #ifdef CCXX_NAMESPACES
50 namespace ost {
51 using std::list;
52 #endif
53
55
57 {
58 public:
60 { return s.getSchedulingTimeout(); }
61
63 { return s.getRTCPCheckInterval(); }
64
65 size_t
67 { return s.takeInDataPacket(); }
68
69 size_t
71 { return s.dispatchDataPacket(); }
72
73 void
75 { s.controlReceptionService(); }
76
77 void
79 { s.controlTransmissionService(); }
80
82 { return s.getDataRecvSocket(); }
83
85 { return s.getControlRecvSocket(); }
86 };
87
96 private:
99
100 public:
102 void clear();
103 bool isCleared();
105 };
106
107
109 : elem(e), cleared(false) {
110 }
111
116 }
117
120 }
121
124 }
125
132 {
133 protected:
135 public:
137
139 {
141 }
142 };
143
158 {
159 public:
161
163 { }
164
165 bool
167
168 bool
170
171 size_t
172 getPoolLength() const;
173
174 virtual void startRunning() = 0;
175
177 { return poolActive; }
178
179 protected:
181 { poolActive = true; }
182
184 { return poolTimeout; }
185
187 { poolTimeout.tv_sec = sec; poolTimeout.tv_usec = usec; }
188
190 { poolTimeout = to; }
191
194
196
197 #ifndef WIN32
200 #endif
201
202 private:
205 };
206
207
211 {
212 public:
219 { }
220
222 { }
223
226
227 protected:
233 };
234
235 #ifdef CCXX_NAMESPACES
236 }
237 #endif
238
239 #endif //CCXX_RTP_POOL_H
240
std::list< SessionListElement * >::iterator PoolIterator
std::list< SessionListElement * > sessionList
size_t dispatchDataPacket(RTPSessionBase &s)
void controlTransmissionService(RTPSessionBase &s)
void setPoolTimeout(struct timeval to)
uint32 microtimeout_t
Time interval expressed in microseconds.
Generic RTP protocol stack for exchange of realtime data.
SOCKET getControlRecvSocket(RTPSessionBase &s) const
SOCKET getDataRecvSocket(RTPSessionBase &s) const
int start(Semaphore *start=0)
When a new thread is created, it does not begin immediate execution.
size_t takeInDataPacket(RTPSessionBase &s)
std equality for SessionListElement objects.
SessionListElement(RTPSessionBase *e)
SingleRTPSessionPool(int pri=0)
virtual ~RTPSessionPool()
timeval getRTCPCheckInterval(RTPSessionBase &s)
Class for tracking session status.
bool operator()(SessionListElement *e)
The ThreadLock class impliments a thread rwlock for optimal reader performance on systems which have ...
microtimeout_t getSchedulingTimeout(RTPSessionBase &s)
void controlReceptionService(RTPSessionBase &s)
PredEquals(RTPSessionBase *e)
Every thread of execution in an application is created by instantiating an object of a class derived ...
This class is a base class for classes that define a group of RTP sessions that will be served by one...
virtual void run(void)=0
All threads execute by deriving the Run method of Thread.
TRTPSessionBase RTPSessionBase
Generic and audio/video profile specific RTP interface of ccRTP.
void setPoolTimeout(int sec, int usec)