<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>ccRTP: rtp.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.9 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <h1>rtp.h</h1><a href="rtp_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Copyright (C) 1999-2005 Open Source Telecom Corporation.</span> <a name="l00002"></a>00002 <span class="comment">//</span> <a name="l00003"></a>00003 <span class="comment">// This program is free software; you can redistribute it and/or modify</span> <a name="l00004"></a>00004 <span class="comment">// it under the terms of the GNU General Public License as published by</span> <a name="l00005"></a>00005 <span class="comment">// the Free Software Foundation; either version 2 of the License, or</span> <a name="l00006"></a>00006 <span class="comment">// (at your option) any later version.</span> <a name="l00007"></a>00007 <span class="comment">//</span> <a name="l00008"></a>00008 <span class="comment">// This program is distributed in the hope that it will be useful,</span> <a name="l00009"></a>00009 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00010"></a>00010 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> <a name="l00011"></a>00011 <span class="comment">// GNU General Public License for more details.</span> <a name="l00012"></a>00012 <span class="comment">//</span> <a name="l00013"></a>00013 <span class="comment">// You should have received a copy of the GNU General Public License</span> <a name="l00014"></a>00014 <span class="comment">// along with this program; if not, write to the Free Software</span> <a name="l00015"></a>00015 <span class="comment">// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</span> <a name="l00016"></a>00016 <span class="comment">//</span> <a name="l00017"></a>00017 <span class="comment">// As a special exception, you may use this file as part of a free software</span> <a name="l00018"></a>00018 <span class="comment">// library without restriction. Specifically, if other files instantiate</span> <a name="l00019"></a>00019 <span class="comment">// templates or use macros or inline functions from this file, or you compile</span> <a name="l00020"></a>00020 <span class="comment">// this file and link it with other files to produce an executable, this</span> <a name="l00021"></a>00021 <span class="comment">// file does not by itself cause the resulting executable to be covered by</span> <a name="l00022"></a>00022 <span class="comment">// the GNU General Public License. This exception does not however</span> <a name="l00023"></a>00023 <span class="comment">// invalidate any other reasons why the executable file might be covered by</span> <a name="l00024"></a>00024 <span class="comment">// the GNU General Public License.</span> <a name="l00025"></a>00025 <span class="comment">//</span> <a name="l00026"></a>00026 <span class="comment">// This exception applies only to the code released under the name GNU</span> <a name="l00027"></a>00027 <span class="comment">// ccRTP. If you copy code from other releases into a copy of GNU</span> <a name="l00028"></a>00028 <span class="comment">// ccRTP, as the General Public License permits, the exception does</span> <a name="l00029"></a>00029 <span class="comment">// not apply to the code that you add in this way. To avoid misleading</span> <a name="l00030"></a>00030 <span class="comment">// anyone as to the status of such modified files, you must delete</span> <a name="l00031"></a>00031 <span class="comment">// this exception notice from them.</span> <a name="l00032"></a>00032 <span class="comment">//</span> <a name="l00033"></a>00033 <span class="comment">// If you write modifications of your own for GNU ccRTP, it is your choice</span> <a name="l00034"></a>00034 <span class="comment">// whether to permit this exception to apply to your modifications.</span> <a name="l00035"></a>00035 <span class="comment">// If you do not wish that, delete this exception notice.</span> <a name="l00036"></a>00036 <span class="comment">//</span> <a name="l00037"></a>00037 <a name="l00049"></a>00049 <span class="preprocessor">#ifndef CCXX_RTP_RTP_H_</span> <a name="l00050"></a>00050 <span class="preprocessor"></span><span class="preprocessor">#define CCXX_RTP_RTP_H_</span> <a name="l00051"></a>00051 <span class="preprocessor"></span> <a name="l00052"></a>00052 <span class="preprocessor">#include <<a class="code" href="cqueue_8h.html" title="Generic RTCP control queues.">ccrtp/cqueue.h</a>></span> <a name="l00053"></a>00053 <span class="preprocessor">#include <<a class="code" href="channel_8h.html" title="Definition of socket classes for different underlying transport and/or network protocols...">ccrtp/channel.h</a>></span> <a name="l00054"></a>00054 <a name="l00055"></a>00055 <span class="preprocessor">#ifdef CCXX_NAMESPACES</span> <a name="l00056"></a>00056 <span class="preprocessor"></span><span class="keyword">namespace </span>ost { <a name="l00057"></a>00057 <span class="preprocessor">#endif</span> <a name="l00058"></a>00058 <span class="preprocessor"></span> <a name="l00085"></a>00085 <span class="keyword">template</span> <<span class="keyword">class </span>RTPDataChannel = <a class="code" href="class_dual_r_t_p_channel.html">DualRTPUDPIPv4Channel</a>, <a name="l00086"></a>00086 <span class="keyword">class </span>RTCPChannel = <a class="code" href="class_dual_r_t_p_channel.html">DualRTPUDPIPv4Channel</a>, <a name="l00087"></a>00087 <span class="keyword">class </span><a class="code" href="class_service_queue.html">ServiceQueue</a> = <a class="code" href="class_a_v_p_queue.html" title="This class, an RTP/RTCP queue, adds audio/video profile (AVP) specific methods to...">AVPQueue</a>> <a name="l00088"></a><a class="code" href="class_t_r_t_p_session_base.html">00088</a> <span class="keyword">class </span>__EXPORT <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase</a> : <span class="keyword">public</span> <a class="code" href="class_service_queue.html">ServiceQueue</a> <a name="l00089"></a>00089 { <a name="l00090"></a>00090 <span class="keyword">public</span>: <a name="l00100"></a><a class="code" href="class_t_r_t_p_session_base.html#d2250f245e86ea6087b6cb9148deecef">00100</a> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase</a>(<span class="keyword">const</span> InetHostAddress& ia, tpport_t dataPort, <a name="l00101"></a>00101 tpport_t controlPort, uint32 membersSize, <a name="l00102"></a>00102 <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app) : <a name="l00103"></a>00103 <a class="code" href="class_service_queue.html">ServiceQueue</a>(membersSize,app) <a name="l00104"></a>00104 { build(ia,dataPort,controlPort); } <a name="l00105"></a>00105 <a name="l00117"></a><a class="code" href="class_t_r_t_p_session_base.html#91eb5b5f9e663402444e52a174db2f6d">00117</a> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase</a>(uint32 ssrc, <a name="l00118"></a>00118 <span class="keyword">const</span> InetHostAddress& ia, <a name="l00119"></a>00119 tpport_t dataPort, tpport_t controlPort, <a name="l00120"></a>00120 uint32 membersSize, <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app): <a name="l00121"></a>00121 <a class="code" href="class_service_queue.html">ServiceQueue</a>(ssrc,membersSize,app) <a name="l00122"></a>00122 { build(ia,dataPort,controlPort); } <a name="l00123"></a>00123 <a name="l00136"></a><a class="code" href="class_t_r_t_p_session_base.html#53d4fa53acdf6674e8067a1eec88d5f2">00136</a> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase</a>(<span class="keyword">const</span> InetMcastAddress& ia, tpport_t dataPort, <a name="l00137"></a>00137 tpport_t controlPort, uint32 membersSize, <a name="l00138"></a>00138 <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app, uint32 iface) : <a name="l00139"></a>00139 <a class="code" href="class_service_queue.html">ServiceQueue</a>(membersSize,app) <a name="l00140"></a>00140 { build(ia,dataPort,controlPort,iface); } <a name="l00141"></a>00141 <a name="l00156"></a><a class="code" href="class_t_r_t_p_session_base.html#2cca47125e02fe63530c44bfb9562480">00156</a> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase</a>(uint32 ssrc, <a name="l00157"></a>00157 <span class="keyword">const</span> InetMcastAddress& ia, tpport_t dataPort, <a name="l00158"></a>00158 tpport_t controlPort, uint32 membersSize, <a name="l00159"></a>00159 <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app, uint32 iface) : <a name="l00160"></a>00160 <a class="code" href="class_service_queue.html">ServiceQueue</a>(ssrc,membersSize,app) <a name="l00161"></a>00161 { build(ia,dataPort,controlPort,iface); } <a name="l00162"></a>00162 <a name="l00163"></a><a class="code" href="class_t_r_t_p_session_base.html#152fd688288d6cc9b531706d94070190">00163</a> <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> dispatchBYE(<span class="keyword">const</span> std::string &str) <a name="l00164"></a>00164 { <a name="l00165"></a>00165 <span class="keywordflow">return</span> <a class="code" href="class_queue_r_t_c_p_manager.html#982ad2a7a514a6dc4689944d8ce254ef" title="This method is used to send an RTCP BYE packet.">QueueRTCPManager::dispatchBYE</a>(str); <a name="l00166"></a>00166 } <a name="l00167"></a>00167 <a name="l00174"></a>00174 <span class="keyword">inline</span> Socket::Error <a name="l00175"></a><a class="code" href="class_t_r_t_p_session_base.html#15e7e7c36bdaca7d95604465e1f060d5">00175</a> setMcastTTL(uint8 ttl) <a name="l00176"></a>00176 { <a name="l00177"></a>00177 Socket::Error error = dso->setMulticast(<span class="keyword">true</span>); <a name="l00178"></a>00178 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00179"></a>00179 error = dso->setTimeToLive(ttl); <a name="l00180"></a>00180 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00181"></a>00181 error = cso->setMulticast(<span class="keyword">true</span>); <a name="l00182"></a>00182 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00183"></a>00183 <span class="keywordflow">return</span> cso->setTimeToLive(ttl); <a name="l00184"></a>00184 } <a name="l00185"></a>00185 <a name="l00186"></a>00186 <span class="keyword">inline</span> <span class="keyword">virtual</span> <a name="l00187"></a><a class="code" href="class_t_r_t_p_session_base.html#c40f9deaa218ab7962445e449a557a86">00187</a> ~<a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase</a>() <a name="l00188"></a>00188 { <a name="l00189"></a>00189 endSocket(); <a name="l00190"></a>00190 } <a name="l00191"></a>00191 <a name="l00192"></a><a class="code" href="class_t_r_t_p_session_base.html#6bb8f202a3c152f85f396cbfc87a14a9">00192</a> <span class="keyword">inline</span> RTPDataChannel *getDSO(<span class="keywordtype">void</span>) <a name="l00193"></a>00193 {<span class="keywordflow">return</span> dso;} <a name="l00194"></a>00194 <a name="l00195"></a>00195 <span class="keyword">protected</span>: <a name="l00199"></a>00199 <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a name="l00200"></a><a class="code" href="class_t_r_t_p_session_base.html#822633ad78b1ffe20bae3b857f82358f">00200</a> isPendingData(<a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> timeout) <a name="l00201"></a>00201 { <span class="keywordflow">return</span> dso->isPendingRecv(timeout); } <a name="l00202"></a>00202 <a name="l00203"></a>00203 InetHostAddress <a name="l00204"></a><a class="code" href="class_t_r_t_p_session_base.html#28f2bbcc10d8f97c1e03a81091986c0c">00204</a> getDataSender(tpport_t *port = NULL)<span class="keyword"> const</span> <a name="l00205"></a>00205 <span class="keyword"> </span>{ <span class="keywordflow">return</span> dso->getSender(port); } <a name="l00206"></a>00206 <a name="l00207"></a>00207 <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a name="l00208"></a><a class="code" href="class_t_r_t_p_session_base.html#a7d60681611db82a04ff825824335e43">00208</a> getNextDataPacketSize()<span class="keyword"> const</span> <a name="l00209"></a>00209 <span class="keyword"> </span>{ <span class="keywordflow">return</span> dso->getNextPacketSize(); } <a name="l00210"></a>00210 <a name="l00220"></a>00220 <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a name="l00221"></a><a class="code" href="class_t_r_t_p_session_base.html#937bca66a76a882c9f8993b798cc69ce">00221</a> recvData(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* buffer, <span class="keywordtype">size_t</span> len, <a name="l00222"></a>00222 InetHostAddress& na, tpport_t& tp) <a name="l00223"></a>00223 { na = dso->getSender(tp); <span class="keywordflow">return</span> dso->recv(buffer, len); } <a name="l00224"></a>00224 <a name="l00225"></a>00225 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a name="l00226"></a><a class="code" href="class_t_r_t_p_session_base.html#f0c1d1037e9f9e3f1237899329288610">00226</a> setDataPeer(<span class="keyword">const</span> InetAddress &host, tpport_t port) <a name="l00227"></a>00227 { dso->setPeer(host,port); } <a name="l00228"></a>00228 <a name="l00229"></a>00229 <a name="l00234"></a>00234 <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a name="l00235"></a><a class="code" href="class_t_r_t_p_session_base.html#9c3b4d22b15ca18f80740de0ae32ad35">00235</a> sendData(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> buffer, <span class="keywordtype">size_t</span> len) <a name="l00236"></a>00236 { <span class="keywordflow">return</span> dso->send(buffer, len); } <a name="l00237"></a>00237 <a name="l00238"></a><a class="code" href="class_t_r_t_p_session_base.html#90d5d69199f4aa0433eaa29af736af4a">00238</a> <span class="keyword">inline</span> SOCKET getDataRecvSocket()<span class="keyword"> const</span> <a name="l00239"></a>00239 <span class="keyword"> </span>{ <span class="keywordflow">return</span> dso->getRecvSocket(); } <a name="l00240"></a>00240 <a name="l00245"></a>00245 <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a name="l00246"></a><a class="code" href="class_t_r_t_p_session_base.html#8e90cb1ed14bd56e5c4d23faa4a44e74">00246</a> isPendingControl(<a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> timeout) <a name="l00247"></a>00247 { <span class="keywordflow">return</span> cso->isPendingRecv(timeout); } <a name="l00248"></a>00248 <a name="l00249"></a>00249 InetHostAddress <a name="l00250"></a><a class="code" href="class_t_r_t_p_session_base.html#157d38d00876422f9dcec56ab340d2a1">00250</a> getControlSender(tpport_t *port = NULL)<span class="keyword"> const</span> <a name="l00251"></a>00251 <span class="keyword"> </span>{ <span class="keywordflow">return</span> cso->getSender(port); } <a name="l00252"></a>00252 <a name="l00262"></a>00262 <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a name="l00263"></a><a class="code" href="class_t_r_t_p_session_base.html#db9c0e83b38e24fa9e20f9eedd40ecff">00263</a> recvControl(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *buffer, <span class="keywordtype">size_t</span> len, <a name="l00264"></a>00264 InetHostAddress& na, tpport_t& tp) <a name="l00265"></a>00265 { na = cso->getSender(tp); <span class="keywordflow">return</span> cso->recv(buffer,len); } <a name="l00266"></a>00266 <a name="l00267"></a>00267 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a name="l00268"></a><a class="code" href="class_t_r_t_p_session_base.html#10b12fc2d2e07b87453946b23adba6b4">00268</a> setControlPeer(<span class="keyword">const</span> InetAddress &host, tpport_t port) <a name="l00269"></a>00269 { cso->setPeer(host,port); } <a name="l00270"></a>00270 <a name="l00276"></a>00276 <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a name="l00277"></a><a class="code" href="class_t_r_t_p_session_base.html#6ad9b5d0969e3f0b3b2f477d791f7e53">00277</a> sendControl(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> buffer, <span class="keywordtype">size_t</span> len) <a name="l00278"></a>00278 { <span class="keywordflow">return</span> cso->send(buffer,len); } <a name="l00279"></a>00279 <a name="l00280"></a><a class="code" href="class_t_r_t_p_session_base.html#69645a431c11b197109e511031e803ec">00280</a> <span class="keyword">inline</span> SOCKET getControlRecvSocket()<span class="keyword"> const</span> <a name="l00281"></a>00281 <span class="keyword"> </span>{ <span class="keywordflow">return</span> cso->getRecvSocket(); } <a name="l00282"></a>00282 <a name="l00289"></a>00289 <span class="keyword">inline</span> Socket::Error <a name="l00290"></a><a class="code" href="class_t_r_t_p_session_base.html#8fcfef7a2b4cdee3cdba40916df20d3a">00290</a> joinGroup(<span class="keyword">const</span> InetMcastAddress& ia, uint32 iface) <a name="l00291"></a>00291 { <a name="l00292"></a>00292 Socket::Error error = dso->setMulticast(<span class="keyword">true</span>); <a name="l00293"></a>00293 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00294"></a>00294 error = dso->join(ia,iface); <a name="l00295"></a>00295 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00296"></a>00296 error = cso->setMulticast(<span class="keyword">true</span>); <a name="l00297"></a>00297 <span class="keywordflow">if</span> ( error ) { <a name="l00298"></a>00298 dso->drop(ia); <a name="l00299"></a>00299 <span class="keywordflow">return</span> error; <a name="l00300"></a>00300 } <a name="l00301"></a>00301 error = cso->join(ia,iface); <a name="l00302"></a>00302 <span class="keywordflow">if</span> ( error ) { <a name="l00303"></a>00303 dso->drop(ia); <a name="l00304"></a>00304 <span class="keywordflow">return</span> error; <a name="l00305"></a>00305 } <a name="l00306"></a>00306 <span class="keywordflow">return</span> Socket::errSuccess; <a name="l00307"></a>00307 } <a name="l00308"></a>00308 <a name="l00315"></a>00315 <span class="keyword">inline</span> Socket::Error <a name="l00316"></a><a class="code" href="class_t_r_t_p_session_base.html#d608f159f375ee47633116a4bbf656cb">00316</a> leaveGroup(<span class="keyword">const</span> InetMcastAddress& ia) <a name="l00317"></a>00317 { <a name="l00318"></a>00318 Socket::Error error = dso->setMulticast(<span class="keyword">false</span>); <a name="l00319"></a>00319 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00320"></a>00320 error = dso->leaveGroup(ia); <a name="l00321"></a>00321 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00322"></a>00322 error = cso->setMulticast(<span class="keyword">false</span>); <a name="l00323"></a>00323 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00324"></a>00324 <span class="keywordflow">return</span> cso->leaveGroup(ia); <a name="l00325"></a>00325 } <a name="l00326"></a>00326 <a name="l00327"></a>00327 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a name="l00328"></a><a class="code" href="class_t_r_t_p_session_base.html#348fa0230d6fd2df84b243079df70137">00328</a> endSocket() <a name="l00329"></a>00329 { <a name="l00330"></a>00330 <span class="keywordflow">if</span> (dso) { <a name="l00331"></a>00331 dso->endSocket(); <a name="l00332"></a>00332 <span class="keyword">delete</span> dso; <a name="l00333"></a>00333 } <a name="l00334"></a>00334 dso = NULL; <a name="l00335"></a>00335 <span class="keywordflow">if</span> (cso) { <a name="l00336"></a>00336 cso->endSocket(); <a name="l00337"></a>00337 <span class="keyword">delete</span> cso; <a name="l00338"></a>00338 } <a name="l00339"></a>00339 cso = NULL; <a name="l00340"></a>00340 } <a name="l00341"></a>00341 <a name="l00342"></a>00342 <span class="keyword">private</span>: <a name="l00343"></a>00343 <span class="keywordtype">void</span> <a name="l00344"></a>00344 build(<span class="keyword">const</span> InetHostAddress& ia, tpport_t dataPort, <a name="l00345"></a>00345 tpport_t controlPort) <a name="l00346"></a>00346 { <a name="l00347"></a>00347 <span class="keywordflow">if</span> ( 0 == controlPort ) { <a name="l00348"></a>00348 dataBasePort = even_port(dataPort); <a name="l00349"></a>00349 controlBasePort = dataBasePort + 1; <a name="l00350"></a>00350 } <span class="keywordflow">else</span> { <a name="l00351"></a>00351 dataBasePort = dataPort; <a name="l00352"></a>00352 controlBasePort = controlPort; <a name="l00353"></a>00353 } <a name="l00354"></a>00354 dso = <span class="keyword">new</span> RTPDataChannel(ia,dataBasePort); <a name="l00355"></a>00355 cso = <span class="keyword">new</span> RTCPChannel(ia,controlBasePort); <a name="l00356"></a>00356 } <a name="l00357"></a>00357 <a name="l00358"></a>00358 <span class="keywordtype">void</span> <a name="l00359"></a>00359 build(<span class="keyword">const</span> InetMcastAddress& ia, tpport_t dataPort, <a name="l00360"></a>00360 tpport_t controlPort, uint32 iface) <a name="l00361"></a>00361 { <a name="l00362"></a>00362 <span class="keywordflow">if</span> ( 0 == controlPort ) { <a name="l00363"></a>00363 dataBasePort = even_port(dataPort); <a name="l00364"></a>00364 controlBasePort = dataBasePort + 1; <a name="l00365"></a>00365 } <span class="keywordflow">else</span> { <a name="l00366"></a>00366 dataBasePort = dataPort; <a name="l00367"></a>00367 controlBasePort = controlPort; <a name="l00368"></a>00368 } <a name="l00369"></a>00369 dso = <span class="keyword">new</span> RTPDataChannel(InetHostAddress(<span class="stringliteral">"0.0.0.0"</span>),dataBasePort); <a name="l00370"></a>00370 cso = <span class="keyword">new</span> RTCPChannel(InetHostAddress(<span class="stringliteral">"0.0.0.0"</span>),controlBasePort); <a name="l00371"></a>00371 joinGroup(ia,iface); <a name="l00372"></a>00372 } <a name="l00373"></a>00373 <a name="l00381"></a>00381 <span class="keyword">inline</span> tpport_t <a name="l00382"></a>00382 odd_port(tpport_t port) <a name="l00383"></a>00383 { <span class="keywordflow">return</span> (port & 0x01)? (port) : (port - 1); } <a name="l00384"></a>00384 <a name="l00392"></a>00392 <span class="keyword">inline</span> tpport_t <a name="l00393"></a>00393 even_port(tpport_t port) <a name="l00394"></a>00394 { <span class="keywordflow">return</span> (port & 0x01)? (port - 1) : (port); } <a name="l00395"></a>00395 <a name="l00396"></a>00396 tpport_t dataBasePort; <a name="l00397"></a>00397 tpport_t controlBasePort; <a name="l00398"></a>00398 <a name="l00399"></a>00399 <span class="keyword">protected</span>: <a name="l00400"></a><a class="code" href="class_t_r_t_p_session_base.html#66bfbf8dca46244bbb23c1467bed1980">00400</a> RTPDataChannel* dso; <a name="l00401"></a><a class="code" href="class_t_r_t_p_session_base.html#fa312af83ce90224d8a1e91c14dc39da">00401</a> RTCPChannel* cso; <a name="l00402"></a><a class="code" href="class_t_r_t_p_session_base.html#21eaf0a2e6407d0731d63c302df23722">00402</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_r_t_p_session_base_handler.html">RTPSessionBaseHandler</a>; <a name="l00403"></a>00403 }; <a name="l00404"></a>00404 <a name="l00415"></a>00415 <span class="keyword">template</span> <a name="l00416"></a>00416 <<span class="keyword">class </span>RTPDataChannel = <a class="code" href="class_dual_r_t_p_channel.html">DualRTPUDPIPv4Channel</a>, <a name="l00417"></a>00417 <span class="keyword">class </span>RTCPChannel = <a class="code" href="class_dual_r_t_p_channel.html">DualRTPUDPIPv4Channel</a>, <a name="l00418"></a>00418 <span class="keyword">class </span><a class="code" href="class_service_queue.html">ServiceQueue</a> = <a class="code" href="class_a_v_p_queue.html" title="This class, an RTP/RTCP queue, adds audio/video profile (AVP) specific methods to...">AVPQueue</a>> <a name="l00419"></a><a class="code" href="class_single_thread_r_t_p_session.html">00419</a> <span class="keyword">class </span>__EXPORT <a class="code" href="class_single_thread_r_t_p_session.html" title="This template class adds the threading aspect to the RTPSessionBase template in one...">SingleThreadRTPSession</a> : <a name="l00420"></a>00420 <span class="keyword">protected</span> Thread, <a name="l00421"></a>00421 <span class="keyword">public</span> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase</a><RTPDataChannel,RTCPChannel,ServiceQueue> <a name="l00422"></a>00422 { <a name="l00423"></a>00423 <span class="keyword">public</span>: <a name="l00424"></a><a class="code" href="class_single_thread_r_t_p_session.html#e2218d8a041c3b4ccedb6c8b81c40db5">00424</a> <a class="code" href="class_single_thread_r_t_p_session.html" title="This template class adds the threading aspect to the RTPSessionBase template in one...">SingleThreadRTPSession</a>(<span class="keyword">const</span> InetHostAddress& ia, <a name="l00425"></a>00425 tpport_t dataPort = <a class="code" href="base_8h.html#d4ff4b9421fd67733fa3ee452c8ee268" title="registered default RTP data transport port">DefaultRTPDataPort</a>, <a name="l00426"></a>00426 tpport_t controlPort = 0, <a name="l00427"></a>00427 <span class="keywordtype">int</span> pri = 0, <a name="l00428"></a>00428 uint32 memberssize = <a name="l00429"></a>00429 <a class="code" href="class_membership_bookkeeping.html#53ba5e9495dfdb9ec16c551206796d99">MembershipBookkeeping::defaultMembersHashSize</a>, <a name="l00430"></a>00430 <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app = <a class="code" href="group__sources.html#g206420a8423d0c261e9bfc5a388a9534" title="Get the RTPApplication object for the &quot;default&quot; application (the only one...">defaultApplication</a>() <a name="l00431"></a>00431 #<span class="keywordflow">if</span> defined(_MSC_VER) && _MSC_VER >= 1300 <a name="l00432"></a>00432 ); <a name="l00433"></a>00433 <span class="preprocessor">#else</span> <a name="l00434"></a>00434 <span class="preprocessor"></span> ): <a name="l00435"></a>00435 Thread(pri), <a name="l00436"></a>00436 <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue></a> <a name="l00437"></a>00437 (ia,dataPort,controlPort,memberssize,app) <a name="l00438"></a>00438 { } <a name="l00439"></a>00439 <span class="preprocessor">#endif</span> <a name="l00440"></a>00440 <span class="preprocessor"></span> <a name="l00441"></a><a class="code" href="class_single_thread_r_t_p_session.html#bb27b8b9d9194302519faa92dca06397">00441</a> <a class="code" href="class_single_thread_r_t_p_session.html" title="This template class adds the threading aspect to the RTPSessionBase template in one...">SingleThreadRTPSession</a>(uint32 ssrc, <span class="keyword">const</span> InetHostAddress& ia, <a name="l00442"></a>00442 tpport_t dataPort = <a class="code" href="base_8h.html#d4ff4b9421fd67733fa3ee452c8ee268" title="registered default RTP data transport port">DefaultRTPDataPort</a>, <a name="l00443"></a>00443 tpport_t controlPort = 0, <a name="l00444"></a>00444 <span class="keywordtype">int</span> pri = 0, <a name="l00445"></a>00445 uint32 memberssize = <a name="l00446"></a>00446 <a class="code" href="class_membership_bookkeeping.html#53ba5e9495dfdb9ec16c551206796d99">MembershipBookkeeping::defaultMembersHashSize</a>, <a name="l00447"></a>00447 <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app = <a class="code" href="group__sources.html#g206420a8423d0c261e9bfc5a388a9534" title="Get the RTPApplication object for the &quot;default&quot; application (the only one...">defaultApplication</a>() <a name="l00448"></a>00448 #<span class="keywordflow">if</span> defined(_MSC_VER) && _MSC_VER >= 1300 <a name="l00449"></a>00449 ); <a name="l00450"></a>00450 <span class="preprocessor">#else</span> <a name="l00451"></a>00451 <span class="preprocessor"></span> ): <a name="l00452"></a>00452 Thread(pri), <a name="l00453"></a>00453 <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue></a> <a name="l00454"></a>00454 (ssrc, ia,dataPort,controlPort,memberssize,app) <a name="l00455"></a>00455 { } <a name="l00456"></a>00456 <span class="preprocessor">#endif</span> <a name="l00457"></a>00457 <span class="preprocessor"></span> <a name="l00458"></a><a class="code" href="class_single_thread_r_t_p_session.html#e2e65da7bf1845b9b8973c8a6843d9c6">00458</a> <a class="code" href="class_single_thread_r_t_p_session.html" title="This template class adds the threading aspect to the RTPSessionBase template in one...">SingleThreadRTPSession</a>(<span class="keyword">const</span> InetMcastAddress& ia, <a name="l00459"></a>00459 tpport_t dataPort = <a class="code" href="base_8h.html#d4ff4b9421fd67733fa3ee452c8ee268" title="registered default RTP data transport port">DefaultRTPDataPort</a>, <a name="l00460"></a>00460 tpport_t controlPort = 0, <a name="l00461"></a>00461 <span class="keywordtype">int</span> pri = 0, <a name="l00462"></a>00462 uint32 memberssize = <a name="l00463"></a>00463 <a class="code" href="class_membership_bookkeeping.html#53ba5e9495dfdb9ec16c551206796d99">MembershipBookkeeping::defaultMembersHashSize</a>, <a name="l00464"></a>00464 <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app = <a class="code" href="group__sources.html#g206420a8423d0c261e9bfc5a388a9534" title="Get the RTPApplication object for the &quot;default&quot; application (the only one...">defaultApplication</a>(), <a name="l00465"></a>00465 uint32 iface = 0 <a name="l00466"></a>00466 #<span class="keywordflow">if</span> defined(_MSC_VER) && _MSC_VER >= 1300 <a name="l00467"></a>00467 ); <a name="l00468"></a>00468 <span class="preprocessor">#else</span> <a name="l00469"></a>00469 <span class="preprocessor"></span> ): <a name="l00470"></a>00470 Thread(pri), <a name="l00471"></a>00471 <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue></a> <a name="l00472"></a>00472 (ia,dataPort,controlPort,memberssize,app,iface) <a name="l00473"></a>00473 { } <a name="l00474"></a>00474 <span class="preprocessor">#endif</span> <a name="l00475"></a>00475 <span class="preprocessor"></span> <a name="l00476"></a><a class="code" href="class_single_thread_r_t_p_session.html#6e2c6db8fae414598408b5f5d6b44e24">00476</a> <a class="code" href="class_single_thread_r_t_p_session.html" title="This template class adds the threading aspect to the RTPSessionBase template in one...">SingleThreadRTPSession</a>(uint32 ssrc, <span class="keyword">const</span> InetMcastAddress& ia, <a name="l00477"></a>00477 tpport_t dataPort = <a class="code" href="base_8h.html#d4ff4b9421fd67733fa3ee452c8ee268" title="registered default RTP data transport port">DefaultRTPDataPort</a>, <a name="l00478"></a>00478 tpport_t controlPort = 0, <a name="l00479"></a>00479 <span class="keywordtype">int</span> pri = 0, <a name="l00480"></a>00480 uint32 memberssize = <a name="l00481"></a>00481 <a class="code" href="class_membership_bookkeeping.html#53ba5e9495dfdb9ec16c551206796d99">MembershipBookkeeping::defaultMembersHashSize</a>, <a name="l00482"></a>00482 <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app = <a class="code" href="group__sources.html#g206420a8423d0c261e9bfc5a388a9534" title="Get the RTPApplication object for the &quot;default&quot; application (the only one...">defaultApplication</a>(), <a name="l00483"></a>00483 uint32 iface = 0 <a name="l00484"></a>00484 #<span class="keywordflow">if</span> defined(_MSC_VER) && _MSC_VER >= 1300 <a name="l00485"></a>00485 ); <a name="l00486"></a>00486 <span class="preprocessor">#else</span> <a name="l00487"></a>00487 <span class="preprocessor"></span> ): <a name="l00488"></a>00488 Thread(pri), <a name="l00489"></a>00489 <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue></a> <a name="l00490"></a>00490 (ssrc,ia,dataPort,controlPort,memberssize,app,iface) <a name="l00491"></a>00491 { } <a name="l00492"></a>00492 <span class="preprocessor">#endif</span> <a name="l00493"></a>00493 <span class="preprocessor"></span> <a name="l00494"></a>00494 <a name="l00495"></a><a class="code" href="class_single_thread_r_t_p_session.html#9f6514918a6e7709fc7ee893c9689724">00495</a> ~<a class="code" href="class_single_thread_r_t_p_session.html" title="This template class adds the threading aspect to the RTPSessionBase template in one...">SingleThreadRTPSession</a>() <a name="l00496"></a>00496 { <a name="l00497"></a>00497 <span class="keywordflow">if</span> (isRunning()) { <a name="l00498"></a>00498 disableStack(); Thread::join(); <a name="l00499"></a>00499 } <a name="l00500"></a>00500 } <a name="l00501"></a>00501 <a name="l00502"></a>00502 <span class="preprocessor">#if defined(_MSC_VER) && _MSC_VER >= 1300</span> <a name="l00503"></a>00503 <span class="preprocessor"></span><span class="keyword">virtual</span> <span class="keywordtype">void</span> startRunning(); <a name="l00504"></a>00504 <span class="preprocessor">#else</span> <a name="l00505"></a>00505 <span class="preprocessor"></span> <a name="l00508"></a>00508 <span class="keywordtype">void</span> <a name="l00509"></a><a class="code" href="class_single_thread_r_t_p_session.html#e861fb5d15be69ea35da87ee41ad6b0b">00509</a> startRunning() <a name="l00510"></a>00510 { enableStack(); Thread::start(); } <a name="l00511"></a>00511 <span class="preprocessor">#endif</span> <a name="l00512"></a>00512 <span class="preprocessor"></span> <a name="l00513"></a>00513 <a name="l00514"></a>00514 <span class="keyword">protected</span>: <a name="l00515"></a><a class="code" href="class_single_thread_r_t_p_session.html#d2e2bac70941014c79ad4764e0575e7a">00515</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> disableStack(<span class="keywordtype">void</span>) <a name="l00516"></a>00516 {<a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::disableStack</a>();} <a name="l00517"></a>00517 <a name="l00518"></a><a class="code" href="class_single_thread_r_t_p_session.html#228521a4e594fe030317e6af931a0a58">00518</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> enableStack(<span class="keywordtype">void</span>) <a name="l00519"></a>00519 {<a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::enableStack</a>();} <a name="l00520"></a>00520 <a name="l00521"></a><a class="code" href="class_single_thread_r_t_p_session.html#0c7a903321dcb0a922386eb6c863f875">00521</a> <span class="keyword">inline</span> <a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> getSchedulingTimeout(<span class="keywordtype">void</span>) <a name="l00522"></a>00522 {<span class="keywordflow">return</span> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::getSchedulingTimeout</a>();} <a name="l00523"></a>00523 <a name="l00524"></a><a class="code" href="class_single_thread_r_t_p_session.html#7d0650ca9e4a157f915492fcededdacd">00524</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> controlReceptionService(<span class="keywordtype">void</span>) <a name="l00525"></a>00525 {<a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::controlReceptionService</a>();} <a name="l00526"></a>00526 <a name="l00527"></a><a class="code" href="class_single_thread_r_t_p_session.html#01537c355c7cf5bb79662c489d64f42c">00527</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> controlTransmissionService(<span class="keywordtype">void</span>) <a name="l00528"></a>00528 {<a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::controlTransmissionService</a>();} <a name="l00529"></a>00529 <a name="l00530"></a><a class="code" href="class_single_thread_r_t_p_session.html#93b40556952647455aab43e2326081ae">00530</a> <span class="keyword">inline</span> timeval getRTCPCheckInterval(<span class="keywordtype">void</span>) <a name="l00531"></a>00531 {<span class="keywordflow">return</span> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::getRTCPCheckInterval</a>();} <a name="l00532"></a>00532 <a name="l00533"></a><a class="code" href="class_single_thread_r_t_p_session.html#068afbd1e22ce3b2f66a60cdaf1d42d8">00533</a> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> dispatchDataPacket(<span class="keywordtype">void</span>) <a name="l00534"></a>00534 {<span class="keywordflow">return</span> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::dispatchDataPacket</a>();} <a name="l00535"></a>00535 <a name="l00536"></a>00536 <span class="preprocessor">#if defined(_MSC_VER) && _MSC_VER >= 1300</span> <a name="l00537"></a>00537 <span class="preprocessor"></span><span class="keyword">virtual</span> <span class="keywordtype">void</span> run(<span class="keywordtype">void</span>); <a name="l00538"></a>00538 <a name="l00539"></a>00539 <span class="keyword">virtual</span> <span class="keywordtype">void</span> timerTick(<span class="keywordtype">void</span>); <a name="l00540"></a>00540 <a name="l00541"></a>00541 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> isPendingData(<a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> timeout); <a name="l00542"></a>00542 <span class="preprocessor">#else</span> <a name="l00543"></a>00543 <span class="preprocessor"></span> <a name="l00544"></a><a class="code" href="class_single_thread_r_t_p_session.html#076859be1d6e52124dd197f5c68d2fa1">00544</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> timerTick(<span class="keywordtype">void</span>) <a name="l00545"></a>00545 {<span class="keywordflow">return</span>;} <a name="l00546"></a>00546 <a name="l00547"></a><a class="code" href="class_single_thread_r_t_p_session.html#36409dbb9e2244ea7be2f2af4d6d4fa8">00547</a> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> isPendingData(<a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> timeout) <a name="l00548"></a>00548 {<span class="keywordflow">return</span> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::isPendingData</a>(timeout);} <a name="l00549"></a>00549 <a name="l00554"></a><a class="code" href="class_single_thread_r_t_p_session.html#4211a0f45cc8019a7fd403efe1186265">00554</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> run(<span class="keywordtype">void</span>) <a name="l00555"></a>00555 { <a name="l00556"></a>00556 <a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> timeout = 0; <a name="l00557"></a>00557 <span class="keywordflow">while</span> ( ServiceQueue::isActive() ) { <a name="l00558"></a>00558 <span class="keywordflow">if</span> ( timeout < 1000 ){ <span class="comment">// !(timeout/1000)</span> <a name="l00559"></a>00559 timeout = getSchedulingTimeout(); <a name="l00560"></a>00560 } <a name="l00561"></a>00561 setCancel(cancelDeferred); <a name="l00562"></a>00562 controlReceptionService(); <a name="l00563"></a>00563 controlTransmissionService(); <a name="l00564"></a>00564 setCancel(cancelImmediate); <a name="l00565"></a>00565 <a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> maxWait = <a name="l00566"></a>00566 <a class="code" href="base_8h.html#004964b34cd778d02d1c156ac6e96f3b" title="Convert a time interval, expressed as a timeval value into a microseconds counter...">timeval2microtimeout</a>(getRTCPCheckInterval()); <a name="l00567"></a>00567 <span class="comment">// make sure the scheduling timeout is</span> <a name="l00568"></a>00568 <span class="comment">// <= the check interval for RTCP</span> <a name="l00569"></a>00569 <span class="comment">// packets</span> <a name="l00570"></a>00570 timeout = (timeout > maxWait)? maxWait : timeout; <a name="l00571"></a>00571 <span class="keywordflow">if</span> ( timeout < 1000 ) { <span class="comment">// !(timeout/1000)</span> <a name="l00572"></a>00572 setCancel(cancelDeferred); <a name="l00573"></a>00573 dispatchDataPacket(); <a name="l00574"></a>00574 setCancel(cancelImmediate); <a name="l00575"></a>00575 timerTick(); <a name="l00576"></a>00576 } <span class="keywordflow">else</span> { <a name="l00577"></a>00577 <span class="keywordflow">if</span> ( isPendingData(timeout/1000) ) { <a name="l00578"></a>00578 setCancel(cancelDeferred); <a name="l00579"></a>00579 <span class="keywordflow">if</span> (ServiceQueue::isActive()) { <span class="comment">// take in only if active</span> <a name="l00580"></a>00580 takeInDataPacket(); <a name="l00581"></a>00581 } <a name="l00582"></a>00582 setCancel(cancelImmediate); <a name="l00583"></a>00583 } <a name="l00584"></a>00584 timeout = 0; <a name="l00585"></a>00585 } <a name="l00586"></a>00586 } <a name="l00587"></a>00587 dispatchBYE(<span class="stringliteral">"GNU ccRTP stack finishing."</span>); <a name="l00588"></a>00588 <span class="comment">// Thread::exit();</span> <a name="l00589"></a>00589 } <a name="l00590"></a>00590 <a name="l00591"></a>00591 <span class="preprocessor">#endif</span> <a name="l00592"></a>00592 <span class="preprocessor"></span> <a name="l00593"></a><a class="code" href="class_single_thread_r_t_p_session.html#73bf4e6641c4c70c46da6a2e7887b63d">00593</a> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> takeInDataPacket(<span class="keywordtype">void</span>) <a name="l00594"></a>00594 {<span class="keywordflow">return</span> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::takeInDataPacket</a>();} <a name="l00595"></a>00595 <a name="l00596"></a><a class="code" href="class_single_thread_r_t_p_session.html#e81464103a9f3cad8a30a00c31a9661f">00596</a> <span class="keyword">inline</span> <span class="keywordtype">size_t</span> dispatchBYE(<span class="keyword">const</span> std::string &str) <a name="l00597"></a>00597 {<span class="keywordflow">return</span> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::dispatchBYE</a>(str);} <a name="l00598"></a>00598 }; <a name="l00599"></a>00599 <a name="l00608"></a><a class="code" href="group__sessions.html#g24e16f350c9ae0c1e2a3f5d6a6dad9f9">00608</a> <span class="keyword">typedef</span> <a class="code" href="class_single_thread_r_t_p_session.html" title="This template class adds the threading aspect to the RTPSessionBase template in one...">SingleThreadRTPSession<></a> <a class="code" href="class_single_thread_r_t_p_session.html" title="This template class adds the threading aspect to the RTPSessionBase template in one...">RTPSession</a>; <a name="l00609"></a>00609 <a name="l00615"></a><a class="code" href="group__sessions.html#gdf1c6653b0c0963a3d3ac98730a29685">00615</a> <span class="keyword">typedef</span> <a class="code" href="class_single_thread_r_t_p_session.html" title="This template class adds the threading aspect to the RTPSessionBase template in one...">RTPSession</a> <a class="code" href="class_single_thread_r_t_p_session.html" title="This template class adds the threading aspect to the RTPSessionBase template in one...">RTPSocket</a>; <a name="l00616"></a>00616 <a name="l00625"></a>00625 <span class="keyword">typedef</span> <a class="code" href="class_single_thread_r_t_p_session.html" title="This template class adds the threading aspect to the RTPSessionBase template in one...">SingleThreadRTPSession</a><<a class="code" href="class_r_t_p_base_u_d_p_i_pv4_socket.html" title="A UDP/IPv4 socket class targetted at RTP stacks.">SymmetricRTPChannel</a>, <a name="l00626"></a><a class="code" href="group__sessions.html#g8c9dd5e82e1ea0da011c893a6a6cece7">00626</a> <a class="code" href="class_r_t_p_base_u_d_p_i_pv4_socket.html" title="A UDP/IPv4 socket class targetted at RTP stacks.">SymmetricRTPChannel</a>> <a class="code" href="class_single_thread_r_t_p_session.html" title="This template class adds the threading aspect to the RTPSessionBase template in one...">SymmetricRTPSession</a>; <a name="l00627"></a>00627 <a name="l00628"></a>00628 <span class="preprocessor">#ifdef CCXX_IPV6</span> <a name="l00629"></a>00629 <span class="preprocessor"></span> <a name="l00651"></a>00651 <span class="keyword">template</span> <<span class="keyword">class </span>RTPDataChannel = DualRTPUDPIPv6Channel, <a name="l00652"></a>00652 <span class="keyword">class </span>RTCPChannel = DualRTPUDPIPv6Channel, <a name="l00653"></a>00653 <span class="keyword">class </span><a class="code" href="class_service_queue.html">ServiceQueue</a> = <a class="code" href="class_a_v_p_queue.html" title="This class, an RTP/RTCP queue, adds audio/video profile (AVP) specific methods to...">AVPQueue</a>> <a name="l00654"></a>00654 <span class="keyword">class </span>__EXPORT TRTPSessionBaseIPV6 : <span class="keyword">public</span> <a class="code" href="class_service_queue.html">ServiceQueue</a> <a name="l00655"></a>00655 { <a name="l00656"></a>00656 <span class="keyword">public</span>: <a name="l00666"></a>00666 TRTPSessionBaseIPV6(<span class="keyword">const</span> IPV6Host& ia, tpport_t dataPort, <a name="l00667"></a>00667 tpport_t controlPort, uint32 membersSize, <a name="l00668"></a>00668 <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app) : <a name="l00669"></a>00669 <a class="code" href="class_service_queue.html">ServiceQueue</a>(membersSize,app) <a name="l00670"></a>00670 { build(ia,dataPort,controlPort); } <a name="l00671"></a>00671 <a name="l00683"></a>00683 TRTPSessionBaseIPV6(uint32 ssrc, <a name="l00684"></a>00684 <span class="keyword">const</span> IPV6Host& ia, <a name="l00685"></a>00685 tpport_t dataPort, tpport_t controlPort, <a name="l00686"></a>00686 uint32 membersSize, <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app): <a name="l00687"></a>00687 <a class="code" href="class_service_queue.html">ServiceQueue</a>(ssrc,membersSize,app) <a name="l00688"></a>00688 { build(ia,dataPort,controlPort); } <a name="l00689"></a>00689 <a name="l00702"></a>00702 TRTPSessionBaseIPV6(<span class="keyword">const</span> IPV6Multicast& ia, tpport_t dataPort, <a name="l00703"></a>00703 tpport_t controlPort, uint32 membersSize, <a name="l00704"></a>00704 <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app, uint32 iface) : <a name="l00705"></a>00705 <a class="code" href="class_service_queue.html">ServiceQueue</a>(membersSize,app) <a name="l00706"></a>00706 { build(ia,dataPort,controlPort,iface); } <a name="l00707"></a>00707 <a name="l00722"></a>00722 TRTPSessionBaseIPV6(uint32 ssrc, <a name="l00723"></a>00723 <span class="keyword">const</span> IPV6Multicast& ia, tpport_t dataPort, <a name="l00724"></a>00724 tpport_t controlPort, uint32 membersSize, <a name="l00725"></a>00725 <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app, uint32 iface) : <a name="l00726"></a>00726 <a class="code" href="class_service_queue.html">ServiceQueue</a>(ssrc,membersSize,app) <a name="l00727"></a>00727 { build(ia,dataPort,controlPort,iface); } <a name="l00728"></a>00728 <a name="l00729"></a>00729 <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> dispatchBYE(<span class="keyword">const</span> std::string &str) <a name="l00730"></a>00730 { <a name="l00731"></a>00731 <span class="keywordflow">return</span> <a class="code" href="class_queue_r_t_c_p_manager.html#982ad2a7a514a6dc4689944d8ce254ef" title="This method is used to send an RTCP BYE packet.">QueueRTCPManager::dispatchBYE</a>(str); <a name="l00732"></a>00732 } <a name="l00733"></a>00733 <a name="l00734"></a>00734 <span class="keyword">inline</span> <span class="keyword">virtual</span> <a name="l00735"></a>00735 ~TRTPSessionBaseIPV6() <a name="l00736"></a>00736 { <a name="l00737"></a>00737 endSocket(); <a name="l00738"></a>00738 } <a name="l00739"></a>00739 <a name="l00740"></a>00740 <span class="keyword">inline</span> RTPDataChannel *getDSO(<span class="keywordtype">void</span>) <a name="l00741"></a>00741 {<span class="keywordflow">return</span> dso;} <a name="l00742"></a>00742 <a name="l00743"></a>00743 <span class="keyword">protected</span>: <a name="l00747"></a>00747 <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a name="l00748"></a>00748 isPendingData(<a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> timeout) <a name="l00749"></a>00749 { <span class="keywordflow">return</span> dso->isPendingRecv(timeout); } <a name="l00750"></a>00750 <a name="l00751"></a>00751 <span class="keyword">inline</span> IPV6Host <a name="l00752"></a>00752 getDataSender(tpport_t *port = NULL)<span class="keyword"> const</span> <a name="l00753"></a>00753 <span class="keyword"> </span>{ <span class="keywordflow">return</span> dso->getSender(port); } <a name="l00754"></a>00754 <a name="l00755"></a>00755 <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a name="l00756"></a>00756 getNextDataPacketSize()<span class="keyword"> const</span> <a name="l00757"></a>00757 <span class="keyword"> </span>{ <span class="keywordflow">return</span> dso->getNextPacketSize(); } <a name="l00758"></a>00758 <a name="l00768"></a>00768 <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a name="l00769"></a>00769 recvData(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* buffer, <span class="keywordtype">size_t</span> len, <a name="l00770"></a>00770 IPV6Host& na, tpport_t& tp) <a name="l00771"></a>00771 { na = dso->getSender(tp); <span class="keywordflow">return</span> dso->recv(buffer, len); } <a name="l00772"></a>00772 <a name="l00773"></a>00773 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a name="l00774"></a>00774 setDataPeerIPV6(<span class="keyword">const</span> IPV6Host &host, tpport_t port) <a name="l00775"></a>00775 { dso->setPeer(host,port); } <a name="l00776"></a>00776 <a name="l00781"></a>00781 <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a name="l00782"></a>00782 sendDataIPV6(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> buffer, <span class="keywordtype">size_t</span> len) <a name="l00783"></a>00783 { <span class="keywordflow">return</span> dso->send(buffer, len); } <a name="l00784"></a>00784 <a name="l00785"></a>00785 <span class="keyword">inline</span> SOCKET getDataRecvSocket()<span class="keyword"> const</span> <a name="l00786"></a>00786 <span class="keyword"> </span>{ <span class="keywordflow">return</span> dso->getRecvSocket(); } <a name="l00787"></a>00787 <a name="l00792"></a>00792 <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a name="l00793"></a>00793 isPendingControl(<a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> timeout) <a name="l00794"></a>00794 { <span class="keywordflow">return</span> cso->isPendingRecv(timeout); } <a name="l00795"></a>00795 <a name="l00796"></a>00796 <span class="keyword">inline</span> IPV6Host <a name="l00797"></a>00797 getControlSender(tpport_t *port = NULL)<span class="keyword"> const</span> <a name="l00798"></a>00798 <span class="keyword"> </span>{ <span class="keywordflow">return</span> cso->getSender(port); } <a name="l00799"></a>00799 <a name="l00809"></a>00809 <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a name="l00810"></a>00810 recvControl(<span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *buffer, <span class="keywordtype">size_t</span> len, <a name="l00811"></a>00811 IPV6Host& na, tpport_t& tp) <a name="l00812"></a>00812 { na = cso->getSender(tp); <span class="keywordflow">return</span> cso->recv(buffer,len); } <a name="l00813"></a>00813 <a name="l00814"></a>00814 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a name="l00815"></a>00815 setControlPeerIPV6(<span class="keyword">const</span> IPV6Host &host, tpport_t port) <a name="l00816"></a>00816 { cso->setPeer(host,port); } <a name="l00817"></a>00817 <a name="l00823"></a>00823 <span class="keyword">inline</span> <span class="keywordtype">size_t</span> <a name="l00824"></a>00824 sendControl(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* <span class="keyword">const</span> buffer, <span class="keywordtype">size_t</span> len) <a name="l00825"></a>00825 { <span class="keywordflow">return</span> cso->send(buffer,len); } <a name="l00826"></a>00826 <a name="l00827"></a>00827 <span class="keyword">inline</span> SOCKET getControlRecvSocket()<span class="keyword"> const</span> <a name="l00828"></a>00828 <span class="keyword"> </span>{ <span class="keywordflow">return</span> cso->getRecvSocket(); } <a name="l00829"></a>00829 <a name="l00830"></a>00830 <span class="keyword">inline</span> <span class="keywordtype">void</span> <a name="l00831"></a>00831 endSocket() <a name="l00832"></a>00832 { <a name="l00833"></a>00833 dso->endSocket(); <a name="l00834"></a>00834 cso->endSocket(); <a name="l00835"></a>00835 <span class="keywordflow">if</span> (dso) <span class="keyword">delete</span> dso; <a name="l00836"></a>00836 dso = NULL; <a name="l00837"></a>00837 <span class="keywordflow">if</span> (cso) <span class="keyword">delete</span> cso; <a name="l00838"></a>00838 cso = NULL; <a name="l00839"></a>00839 } <a name="l00840"></a>00840 <a name="l00841"></a>00841 <span class="keyword">private</span>: <a name="l00842"></a>00842 <span class="keywordtype">void</span> <a name="l00843"></a>00843 build(<span class="keyword">const</span> IPV6Host& ia, tpport_t dataPort, <a name="l00844"></a>00844 tpport_t controlPort) <a name="l00845"></a>00845 { <a name="l00846"></a>00846 <span class="keywordflow">if</span> ( 0 == controlPort ) { <a name="l00847"></a>00847 dataBasePort = even_port(dataPort); <a name="l00848"></a>00848 controlBasePort = dataBasePort + 1; <a name="l00849"></a>00849 } <span class="keywordflow">else</span> { <a name="l00850"></a>00850 dataBasePort = dataPort; <a name="l00851"></a>00851 controlBasePort = controlPort; <a name="l00852"></a>00852 } <a name="l00853"></a>00853 dso = <span class="keyword">new</span> RTPDataChannel(ia,dataBasePort); <a name="l00854"></a>00854 cso = <span class="keyword">new</span> RTCPChannel(ia,controlBasePort); <a name="l00855"></a>00855 } <a name="l00856"></a>00856 <a name="l00857"></a>00857 <span class="keywordtype">void</span> <a name="l00858"></a>00858 build(<span class="keyword">const</span> IPV6Multicast& ia, tpport_t dataPort, <a name="l00859"></a>00859 tpport_t controlPort, uint32 iface) <a name="l00860"></a>00860 { <a name="l00861"></a>00861 <span class="keywordflow">if</span> ( 0 == controlPort ) { <a name="l00862"></a>00862 dataBasePort = even_port(dataPort); <a name="l00863"></a>00863 controlBasePort = dataBasePort + 1; <a name="l00864"></a>00864 } <span class="keywordflow">else</span> { <a name="l00865"></a>00865 dataBasePort = dataPort; <a name="l00866"></a>00866 controlBasePort = controlPort; <a name="l00867"></a>00867 } <a name="l00868"></a>00868 dso = <span class="keyword">new</span> RTPDataChannel(IPV6Host(<span class="stringliteral">"0.0.0.0"</span>),dataBasePort); <a name="l00869"></a>00869 cso = <span class="keyword">new</span> RTCPChannel(IPV6Host(<span class="stringliteral">"0.0.0.0"</span>),controlBasePort); <a name="l00870"></a>00870 joinGroup(ia,iface); <a name="l00871"></a>00871 } <a name="l00872"></a>00872 <a name="l00879"></a>00879 <span class="keyword">inline</span> Socket::Error <a name="l00880"></a>00880 joinGroup(<span class="keyword">const</span> IPV6Multicast& ia, uint32 iface) <a name="l00881"></a>00881 { <a name="l00882"></a>00882 Socket::Error error = dso->setMulticast(<span class="keyword">true</span>); <a name="l00883"></a>00883 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00884"></a>00884 error = dso->join(ia,iface); <a name="l00885"></a>00885 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00886"></a>00886 error = cso->setMulticast(<span class="keyword">true</span>); <a name="l00887"></a>00887 <span class="keywordflow">if</span> ( error ) { <a name="l00888"></a>00888 dso->drop(ia); <a name="l00889"></a>00889 <span class="keywordflow">return</span> error; <a name="l00890"></a>00890 } <a name="l00891"></a>00891 error = cso->join(ia,iface); <a name="l00892"></a>00892 <span class="keywordflow">if</span> ( error ) { <a name="l00893"></a>00893 dso->drop(ia); <a name="l00894"></a>00894 <span class="keywordflow">return</span> error; <a name="l00895"></a>00895 } <a name="l00896"></a>00896 <span class="keywordflow">return</span> Socket::errSuccess; <a name="l00897"></a>00897 } <a name="l00898"></a>00898 <a name="l00905"></a>00905 <span class="keyword">inline</span> Socket::Error <a name="l00906"></a>00906 leaveGroup(<span class="keyword">const</span> IPV6Multicast& ia) <a name="l00907"></a>00907 { <a name="l00908"></a>00908 Socket::Error error = dso->setMulticast(<span class="keyword">false</span>); <a name="l00909"></a>00909 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00910"></a>00910 error = dso->leaveGroup(ia); <a name="l00911"></a>00911 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00912"></a>00912 error = cso->setMulticast(<span class="keyword">false</span>); <a name="l00913"></a>00913 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00914"></a>00914 <span class="keywordflow">return</span> cso->leaveGroup(ia); <a name="l00915"></a>00915 } <a name="l00916"></a>00916 <a name="l00923"></a>00923 <span class="keyword">inline</span> Socket::Error <a name="l00924"></a>00924 setMcastTTL(uint8 ttl) <a name="l00925"></a>00925 { <a name="l00926"></a>00926 Socket::Error error = dso->setMulticast(<span class="keyword">true</span>); <a name="l00927"></a>00927 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00928"></a>00928 error = dso->setTimeToLive(ttl); <a name="l00929"></a>00929 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00930"></a>00930 error = cso->setMulticast(<span class="keyword">true</span>); <a name="l00931"></a>00931 <span class="keywordflow">if</span> ( error ) <span class="keywordflow">return</span> error; <a name="l00932"></a>00932 <span class="keywordflow">return</span> cso->setTimeToLive(ttl); <a name="l00933"></a>00933 } <a name="l00934"></a>00934 <a name="l00942"></a>00942 <span class="keyword">inline</span> tpport_t <a name="l00943"></a>00943 odd_port(tpport_t port) <a name="l00944"></a>00944 { <span class="keywordflow">return</span> (port & 0x01)? (port) : (port - 1); } <a name="l00945"></a>00945 <a name="l00953"></a>00953 <span class="keyword">inline</span> tpport_t <a name="l00954"></a>00954 even_port(tpport_t port) <a name="l00955"></a>00955 { <span class="keywordflow">return</span> (port & 0x01)? (port - 1) : (port); } <a name="l00956"></a>00956 <a name="l00957"></a>00957 tpport_t dataBasePort; <a name="l00958"></a>00958 tpport_t controlBasePort; <a name="l00959"></a>00959 <a name="l00960"></a>00960 <span class="keyword">protected</span>: <a name="l00961"></a>00961 RTPDataChannel* dso; <a name="l00962"></a>00962 RTCPChannel* cso; <a name="l00963"></a>00963 <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_r_t_p_session_base_handler.html">RTPSessionBaseHandler</a>; <a name="l00964"></a>00964 }; <a name="l00965"></a>00965 <a name="l00976"></a>00976 <span class="keyword">template</span> <a name="l00977"></a>00977 <<span class="keyword">class </span>RTPDataChannel = DualRTPUDPIPv6Channel, <a name="l00978"></a>00978 <span class="keyword">class </span>RTCPChannel = DualRTPUDPIPv6Channel, <a name="l00979"></a>00979 <span class="keyword">class </span><a class="code" href="class_service_queue.html">ServiceQueue</a> = <a class="code" href="class_a_v_p_queue.html" title="This class, an RTP/RTCP queue, adds audio/video profile (AVP) specific methods to...">AVPQueue</a>> <a name="l00980"></a>00980 <span class="keyword">class </span>__EXPORT SingleThreadRTPSessionIPV6 : <a name="l00981"></a>00981 <span class="keyword">protected</span> Thread, <a name="l00982"></a>00982 <span class="keyword">public</span> TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue> <a name="l00983"></a>00983 { <a name="l00984"></a>00984 <span class="keyword">public</span>: <a name="l00985"></a>00985 SingleThreadRTPSessionIPV6(<span class="keyword">const</span> IPV6Host& ia, <a name="l00986"></a>00986 tpport_t dataPort = <a class="code" href="base_8h.html#d4ff4b9421fd67733fa3ee452c8ee268" title="registered default RTP data transport port">DefaultRTPDataPort</a>, <a name="l00987"></a>00987 tpport_t controlPort = 0, <a name="l00988"></a>00988 <span class="keywordtype">int</span> pri = 0, <a name="l00989"></a>00989 uint32 memberssize = <a name="l00990"></a>00990 <a class="code" href="class_membership_bookkeeping.html#53ba5e9495dfdb9ec16c551206796d99">MembershipBookkeeping::defaultMembersHashSize</a>, <a name="l00991"></a>00991 <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app = <a class="code" href="group__sources.html#g206420a8423d0c261e9bfc5a388a9534" title="Get the RTPApplication object for the &quot;default&quot; application (the only one...">defaultApplication</a>() <a name="l00992"></a>00992 #<span class="keywordflow">if</span> defined(_MSC_VER) && _MSC_VER >= 1300 <a name="l00993"></a>00993 ); <a name="l00994"></a>00994 <span class="preprocessor">#else</span> <a name="l00995"></a>00995 <span class="preprocessor"></span> ): <a name="l00996"></a>00996 Thread(pri), <a name="l00997"></a>00997 TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue> <a name="l00998"></a>00998 (ia,dataPort,controlPort,memberssize,app) <a name="l00999"></a>00999 { } <a name="l01000"></a>01000 <span class="preprocessor">#endif</span> <a name="l01001"></a>01001 <span class="preprocessor"></span> <a name="l01002"></a>01002 SingleThreadRTPSessionIPV6(<span class="keyword">const</span> IPV6Multicast& ia, <a name="l01003"></a>01003 tpport_t dataPort = <a class="code" href="base_8h.html#d4ff4b9421fd67733fa3ee452c8ee268" title="registered default RTP data transport port">DefaultRTPDataPort</a>, <a name="l01004"></a>01004 tpport_t controlPort = 0, <a name="l01005"></a>01005 <span class="keywordtype">int</span> pri = 0, <a name="l01006"></a>01006 uint32 memberssize = <a name="l01007"></a>01007 <a class="code" href="class_membership_bookkeeping.html#53ba5e9495dfdb9ec16c551206796d99">MembershipBookkeeping::defaultMembersHashSize</a>, <a name="l01008"></a>01008 <a class="code" href="class_r_t_p_application.html" title="An RTP application, holding identifying RTCP SDES item values.">RTPApplication</a>& app = <a class="code" href="group__sources.html#g206420a8423d0c261e9bfc5a388a9534" title="Get the RTPApplication object for the &quot;default&quot; application (the only one...">defaultApplication</a>(), <a name="l01009"></a>01009 uint32 iface = 0 <a name="l01010"></a>01010 #<span class="keywordflow">if</span> defined(_MSC_VER) && _MSC_VER >= 1300 <a name="l01011"></a>01011 ); <a name="l01012"></a>01012 <span class="preprocessor">#else</span> <a name="l01013"></a>01013 <span class="preprocessor"></span> ): <a name="l01014"></a>01014 Thread(pri), <a name="l01015"></a>01015 TRTPSessionBaseIPV6<RTPDataChannel,RTCPChannel,ServiceQueue> <a name="l01016"></a>01016 (ia,dataPort,controlPort,memberssize,app,iface) <a name="l01017"></a>01017 { } <a name="l01018"></a>01018 <span class="preprocessor">#endif</span> <a name="l01019"></a>01019 <span class="preprocessor"></span> <a name="l01020"></a>01020 ~SingleThreadRTPSessionIPV6() <a name="l01021"></a>01021 { <a name="l01022"></a>01022 <span class="keywordflow">if</span> (isRunning()) { <a name="l01023"></a>01023 disableStack(); Thread::join(); <a name="l01024"></a>01024 } <a name="l01025"></a>01025 } <a name="l01026"></a>01026 <a name="l01027"></a>01027 <span class="preprocessor">#if defined(_MSC_VER) && _MSC_VER >= 1300</span> <a name="l01028"></a>01028 <span class="preprocessor"></span><span class="keyword">virtual</span> <span class="keywordtype">void</span> startRunning(); <a name="l01029"></a>01029 <span class="preprocessor">#else</span> <a name="l01030"></a>01030 <span class="preprocessor"></span> <a name="l01033"></a>01033 <span class="keywordtype">void</span> <a name="l01034"></a>01034 startRunning() <a name="l01035"></a>01035 { enableStack(); Thread::start(); } <a name="l01036"></a>01036 <span class="preprocessor">#endif</span> <a name="l01037"></a>01037 <span class="preprocessor"></span> <a name="l01038"></a>01038 <a name="l01039"></a>01039 <span class="keyword">protected</span>: <a name="l01040"></a>01040 <span class="keyword">inline</span> <span class="keywordtype">void</span> enableStack(<span class="keywordtype">void</span>) <a name="l01041"></a>01041 {<a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::enableStack</a>();} <a name="l01042"></a>01042 <a name="l01043"></a>01043 <span class="keyword">inline</span> <span class="keywordtype">void</span> disableStack(<span class="keywordtype">void</span>) <a name="l01044"></a>01044 {<a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::disableStack</a>();} <a name="l01045"></a>01045 <a name="l01046"></a>01046 <span class="keyword">inline</span> <a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> getSchedulingTimeout(<span class="keywordtype">void</span>) <a name="l01047"></a>01047 {<span class="keywordflow">return</span> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::getSchedulingTimeout</a>();} <a name="l01048"></a>01048 <a name="l01049"></a>01049 <span class="keyword">inline</span> <span class="keywordtype">void</span> controlReceptionService(<span class="keywordtype">void</span>) <a name="l01050"></a>01050 {<a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::controlReceptionService</a>();} <a name="l01051"></a>01051 <a name="l01052"></a>01052 <span class="keyword">inline</span> <span class="keywordtype">void</span> controlTransmissionService(<span class="keywordtype">void</span>) <a name="l01053"></a>01053 {<a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::controlTransmissionService</a>();} <a name="l01054"></a>01054 <a name="l01055"></a>01055 <span class="keyword">inline</span> timeval getRTCPCheckInterval(<span class="keywordtype">void</span>) <a name="l01056"></a>01056 {<span class="keywordflow">return</span> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::getRTCPCheckInterval</a>();} <a name="l01057"></a>01057 <a name="l01058"></a>01058 <span class="keyword">inline</span> <span class="keywordtype">size_t</span> dispatchDataPacket(<span class="keywordtype">void</span>) <a name="l01059"></a>01059 {<span class="keywordflow">return</span> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::dispatchDataPacket</a>();} <a name="l01060"></a>01060 <a name="l01061"></a>01061 <span class="preprocessor">#if defined(_MSC_VER) && _MSC_VER >= 1300</span> <a name="l01062"></a>01062 <span class="preprocessor"></span><span class="keyword">virtual</span> <span class="keywordtype">void</span> run(<span class="keywordtype">void</span>); <a name="l01063"></a>01063 <a name="l01064"></a>01064 <span class="keyword">virtual</span> <span class="keywordtype">void</span> timerTick(<span class="keywordtype">void</span>); <a name="l01065"></a>01065 <a name="l01066"></a>01066 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> isPendingData(<a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> timeout); <a name="l01067"></a>01067 <span class="preprocessor">#else</span> <a name="l01068"></a>01068 <span class="preprocessor"></span> <a name="l01069"></a>01069 <span class="keyword">virtual</span> <span class="keywordtype">void</span> timerTick(<span class="keywordtype">void</span>) <a name="l01070"></a>01070 {<span class="keywordflow">return</span>;} <a name="l01071"></a>01071 <a name="l01072"></a>01072 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> isPendingData(<a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> timeout) <a name="l01073"></a>01073 {<span class="keywordflow">return</span> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::isPendingData</a>(timeout);} <a name="l01074"></a>01074 <a name="l01079"></a>01079 <span class="keyword">virtual</span> <span class="keywordtype">void</span> run(<span class="keywordtype">void</span>) <a name="l01080"></a>01080 { <a name="l01081"></a>01081 <a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> timeout = 0; <a name="l01082"></a>01082 <span class="keywordflow">while</span> ( ServiceQueue::isActive() ) { <a name="l01083"></a>01083 <span class="keywordflow">if</span> ( timeout < 1000 ){ <span class="comment">// !(timeout/1000)</span> <a name="l01084"></a>01084 timeout = getSchedulingTimeout(); <a name="l01085"></a>01085 } <a name="l01086"></a>01086 setCancel(cancelDeferred); <a name="l01087"></a>01087 controlReceptionService(); <a name="l01088"></a>01088 controlTransmissionService(); <a name="l01089"></a>01089 setCancel(cancelImmediate); <a name="l01090"></a>01090 <a class="code" href="base_8h.html#c16d853255145e6a903914eb376a84bb" title="Time interval expressed in microseconds.">microtimeout_t</a> maxWait = <a name="l01091"></a>01091 <a class="code" href="base_8h.html#004964b34cd778d02d1c156ac6e96f3b" title="Convert a time interval, expressed as a timeval value into a microseconds counter...">timeval2microtimeout</a>(getRTCPCheckInterval()); <a name="l01092"></a>01092 <span class="comment">// make sure the scheduling timeout is</span> <a name="l01093"></a>01093 <span class="comment">// <= the check interval for RTCP</span> <a name="l01094"></a>01094 <span class="comment">// packets</span> <a name="l01095"></a>01095 timeout = (timeout > maxWait)? maxWait : timeout; <a name="l01096"></a>01096 <span class="keywordflow">if</span> ( timeout < 1000 ) { <span class="comment">// !(timeout/1000)</span> <a name="l01097"></a>01097 setCancel(cancelDeferred); <a name="l01098"></a>01098 dispatchDataPacket(); <a name="l01099"></a>01099 setCancel(cancelImmediate); <a name="l01100"></a>01100 timerTick(); <a name="l01101"></a>01101 } <span class="keywordflow">else</span> { <a name="l01102"></a>01102 <span class="keywordflow">if</span> ( isPendingData(timeout/1000) ) { <a name="l01103"></a>01103 setCancel(cancelDeferred); <a name="l01104"></a>01104 takeInDataPacket(); <a name="l01105"></a>01105 setCancel(cancelImmediate); <a name="l01106"></a>01106 } <a name="l01107"></a>01107 timeout = 0; <a name="l01108"></a>01108 } <a name="l01109"></a>01109 } <a name="l01110"></a>01110 dispatchBYE(<span class="stringliteral">"GNU ccRTP stack finishing."</span>); <a name="l01111"></a>01111 Thread::exit(); <a name="l01112"></a>01112 } <a name="l01113"></a>01113 <a name="l01114"></a>01114 <span class="preprocessor">#endif</span> <a name="l01115"></a>01115 <span class="preprocessor"></span> <a name="l01116"></a>01116 <span class="keyword">inline</span> <span class="keywordtype">size_t</span> takeInDataPacket(<span class="keywordtype">void</span>) <a name="l01117"></a>01117 {<span class="keywordflow">return</span> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::takeInDataPacket</a>();} <a name="l01118"></a>01118 <a name="l01119"></a>01119 <span class="keyword">inline</span> <span class="keywordtype">size_t</span> dispatchBYE(<span class="keyword">const</span> std::string &str) <a name="l01120"></a>01120 {<span class="keywordflow">return</span> <a class="code" href="class_t_r_t_p_session_base.html">TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>::dispatchBYE</a>(str);} <a name="l01121"></a>01121 }; <a name="l01122"></a>01122 <a name="l01131"></a>01131 <span class="keyword">typedef</span> SingleThreadRTPSessionIPV6<> RTPSessionIPV6; <a name="l01132"></a>01132 <a name="l01138"></a>01138 <span class="keyword">typedef</span> RTPSessionIPV6 RTPSocketIPV6; <a name="l01139"></a>01139 <a name="l01148"></a>01148 <span class="keyword">typedef</span> SingleThreadRTPSessionIPV6<SymmetricRTPChannelIPV6, <a name="l01149"></a>01149 SymmetricRTPChannelIPV6> SymmetricRTPSessionIPV6; <a name="l01150"></a>01150 <a name="l01151"></a>01151 <a name="l01152"></a>01152 <span class="preprocessor">#endif</span> <a name="l01153"></a>01153 <span class="preprocessor"></span> <span class="comment">// sessions</span> <a name="l01155"></a>01155 <a name="l01156"></a>01156 <span class="preprocessor">#ifdef CCXX_NAMESPACES</span> <a name="l01157"></a>01157 <span class="preprocessor"></span>} <a name="l01158"></a>01158 <span class="preprocessor">#endif</span> <a name="l01159"></a>01159 <span class="preprocessor"></span> <a name="l01160"></a>01160 <span class="preprocessor">#endif //CCXX_RTP_RTP_H_</span> <a name="l01161"></a>01161 <span class="preprocessor"></span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Fri Jul 24 21:42:25 2009 for ccRTP by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> </body> </html>