<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>oRTP: include/ortp/sessionset.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">oRTP  <span id="projectnumber">0.20.0</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.7.5 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> | <a href="#define-members">Defines</a> | <a href="#typedef-members">Typedefs</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">include/ortp/sessionset.h File Reference</div> </div> </div> <div class="contents"> <p>Sending and receiving multiple streams together with only one thread. <a href="#details">More...</a></p> <div class="textblock"><code>#include <<a class="el" href="rtpsession_8h_source.html">ortp/rtpsession.h</a>></code><br/> <code>#include <sys/time.h></code><br/> <code>#include <sys/types.h></code><br/> <code>#include <unistd.h></code><br/> </div><div class="textblock"><div class="dynheader"> Include dependency graph for sessionset.h:</div> <div class="dyncontent"> <div class="center"><img src="sessionset_8h__incl.png" border="0" usemap="#include_2ortp_2sessionset_8h" alt=""/></div> <map name="include_2ortp_2sessionset_8h" id="include_2ortp_2sessionset_8h"> <area shape="rect" id="node3" href="rtpsession_8h.html" title="The RtpSession api." alt="" coords="765,80,883,107"/><area shape="rect" id="node5" href="port_8h_source.html" title="ortp/port.h" alt="" coords="649,304,729,331"/><area shape="rect" id="node33" href="rtp_8h_source.html" title="ortp/rtp.h" alt="" coords="441,155,515,181"/><area shape="rect" id="node36" href="str__utils_8h_source.html" title="ortp/str_utils.h" alt="" coords="529,229,633,256"/><area shape="rect" id="node39" href="payloadtype_8h.html" title="Using and creating standart and custom RTP profiles." alt="" coords="658,229,787,256"/><area shape="rect" id="node43" href="rtcp_8h_source.html" title="ortp/rtcp.h" alt="" coords="834,229,915,256"/><area shape="rect" id="node47" href="rtpsignaltable_8h_source.html" title="ortp/rtpsignaltable.h" alt="" coords="756,155,891,181"/><area shape="rect" id="node49" href="event_8h_source.html" title="ortp/event.h" alt="" coords="540,155,631,181"/></map> </div> </div><div class="textblock"><div class="dynheader"> This graph shows which files directly or indirectly include this file:</div> <div class="dyncontent"> <div class="center"><img src="sessionset_8h__dep__incl.png" border="0" usemap="#include_2ortp_2sessionset_8hdep" alt=""/></div> <map name="include_2ortp_2sessionset_8hdep" id="include_2ortp_2sessionset_8hdep"> <area shape="rect" id="node3" href="scheduler_8h_source.html" title="src/scheduler.h" alt="" coords="5,155,115,181"/><area shape="rect" id="node5" href="ortp_8h.html" title="General purpose library functions." alt="" coords="139,155,265,181"/><area shape="rect" id="node7" href="rtpsession_8h.html" title="The RtpSession api." alt="" coords="290,80,453,107"/><area shape="rect" id="node9" href="rtpsession__priv_8h_source.html" title="src/rtpsession_priv.h" alt="" coords="663,155,805,181"/><area shape="rect" id="node13" href="ortp__srtp_8h_source.html" title="include/ortp/ortp_srtp.h" alt="" coords="831,155,984,181"/><area shape="rect" id="node16" href="telephonyevents_8h.html" title="Receiving and sending telephone events (RFC2833)" alt="" coords="290,155,488,181"/><area shape="rect" id="node18" href="zrtp_8h_source.html" title="include/ortp/zrtp.h" alt="" coords="513,155,639,181"/></map> </div> </div> <p><a href="sessionset_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Data Structures</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct__SessionSet.html">_SessionSet</a></td></tr> <tr><td colspan="2"><h2><a name="define-members"></a> Defines</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a752729ed862257cade2d7339536fefcc"></a><!-- doxytag: member="sessionset.h::ORTP_FD_SET" ref="a752729ed862257cade2d7339536fefcc" args="(d, s)" --> #define </td><td class="memItemRight" valign="bottom"><b>ORTP_FD_SET</b>(d, s)   FD_SET(d, s)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2ff84cd0b62e99851c4cae2ee96b14cd"></a><!-- doxytag: member="sessionset.h::ORTP_FD_CLR" ref="a2ff84cd0b62e99851c4cae2ee96b14cd" args="(d, s)" --> #define </td><td class="memItemRight" valign="bottom"><b>ORTP_FD_CLR</b>(d, s)   FD_CLR(d, s)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adfeeaaadca7d1ef3407a6a54a34de49c"></a><!-- doxytag: member="sessionset.h::ORTP_FD_ISSET" ref="adfeeaaadca7d1ef3407a6a54a34de49c" args="(d, s)" --> #define </td><td class="memItemRight" valign="bottom"><b>ORTP_FD_ISSET</b>(d, s)   FD_ISSET(d, s)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adfb984b3e67b0e3377a59edec3c5223c"></a><!-- doxytag: member="sessionset.h::ORTP_FD_ZERO" ref="adfb984b3e67b0e3377a59edec3c5223c" args="(s)" --> #define </td><td class="memItemRight" valign="bottom"><b>ORTP_FD_ZERO</b>(s)   FD_ZERO(s)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a36cfdc2ea6ff577831cb1e779f65350e"></a><!-- doxytag: member="sessionset.h::session_set_init" ref="a36cfdc2ea6ff577831cb1e779f65350e" args="(ss)" --> #define </td><td class="memItemRight" valign="bottom"><b>session_set_init</b>(ss)   ORTP_FD_ZERO(&(ss)->rtpset)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="sessionset_8h.html#a6c2e5af222e014af8cd572cae29da5c5">session_set_set</a>(ss, rtpsession)   ORTP_FD_SET((rtpsession)->mask_pos,&(ss)->rtpset)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="sessionset_8h.html#a9d100df1b61766039dd0d1625794d8f5">session_set_is_set</a>(ss, rtpsession)   ORTP_FD_ISSET((rtpsession)->mask_pos,&(ss)->rtpset)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="sessionset_8h.html#a74b2d46bb4c18f418ca99dd5ec443502">session_set_clr</a>(ss, rtpsession)   ORTP_FD_CLR((rtpsession)->mask_pos,&(ss)->rtpset)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5023d9a63527201ca71e001a581a0f5a"></a><!-- doxytag: member="sessionset.h::session_set_copy" ref="a5023d9a63527201ca71e001a581a0f5a" args="(dest, src)" --> #define </td><td class="memItemRight" valign="bottom"><b>session_set_copy</b>(dest, src)   memcpy(&(dest)->rtpset,&(src)->rtpset,sizeof(ortp_fd_set))</td></tr> <tr><td colspan="2"><h2><a name="typedef-members"></a> Typedefs</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a061b125afed726878a4769e93a1e1abb"></a><!-- doxytag: member="sessionset.h::ortp_fd_set" ref="a061b125afed726878a4769e93a1e1abb" args="" --> typedef fd_set </td><td class="memItemRight" valign="bottom"><b>ortp_fd_set</b></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af9d4ac068a63463e080b8289dc01ab29"></a><!-- doxytag: member="sessionset.h::SessionSet" ref="af9d4ac068a63463e080b8289dc01ab29" args="" --> typedef struct <a class="el" href="struct__SessionSet.html">_SessionSet</a> </td><td class="memItemRight" valign="bottom"><b>SessionSet</b></td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct__SessionSet.html">SessionSet</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="sessionset_8h.html#a2e827fa3e1534317404d28aa3df73775">session_set_new</a> (void)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="sessionset_8h.html#a7b977891b1a456e636c16ec964840687">session_set_destroy</a> (<a class="el" href="struct__SessionSet.html">SessionSet</a> *set)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="sessionset_8h.html#af199d48aa2a51ff81a772aef2c477e2e">session_set_select</a> (<a class="el" href="struct__SessionSet.html">SessionSet</a> *recvs, <a class="el" href="struct__SessionSet.html">SessionSet</a> *sends, <a class="el" href="struct__SessionSet.html">SessionSet</a> *errors)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae7e8d7afdbd8814e4f29c5a718f40c2e"></a><!-- doxytag: member="sessionset.h::session_set_timedselect" ref="ae7e8d7afdbd8814e4f29c5a718f40c2e" args="(SessionSet *recvs, SessionSet *sends, SessionSet *errors, struct timeval *timeout)" --> int </td><td class="memItemRight" valign="bottom"><b>session_set_timedselect</b> (<a class="el" href="struct__SessionSet.html">SessionSet</a> *recvs, <a class="el" href="struct__SessionSet.html">SessionSet</a> *sends, <a class="el" href="struct__SessionSet.html">SessionSet</a> *errors, struct timeval *timeout)</td></tr> </table> <hr/><a name="details" id="details"></a><h2>Detailed Description</h2> <div class="textblock"><p>Sending and receiving multiple streams together with only one thread. </p> </div><hr/><h2>Define Documentation</h2> <a class="anchor" id="a74b2d46bb4c18f418ca99dd5ec443502"></a><!-- doxytag: member="sessionset.h::session_set_clr" ref="a74b2d46bb4c18f418ca99dd5ec443502" args="(ss, rtpsession)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define session_set_clr</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">ss, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">rtpsession </td> </tr> <tr> <td></td> <td>)</td> <td></td><td>   ORTP_FD_CLR((rtpsession)->mask_pos,&(ss)->rtpset)</td> </tr> </table> </div> <div class="memdoc"> <p>Removes the session from the set. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">ss</td><td>a set of sessions. </td></tr> <tr><td class="paramname">rtpsession</td><td>a rtp session. </td></tr> </table> </dd> </dl> <p>Referenced by <a class="el" href="rtpsession_8h.html#a7df1261d3eeaf10d283ba4ac34e2388d">rtp_session_recvm_with_ts()</a>.</p> </div> </div> <a class="anchor" id="a9d100df1b61766039dd0d1625794d8f5"></a><!-- doxytag: member="sessionset.h::session_set_is_set" ref="a9d100df1b61766039dd0d1625794d8f5" args="(ss, rtpsession)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define session_set_is_set</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">ss, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">rtpsession </td> </tr> <tr> <td></td> <td>)</td> <td></td><td>   ORTP_FD_ISSET((rtpsession)->mask_pos,&(ss)->rtpset)</td> </tr> </table> </div> <div class="memdoc"> <p>This macro tests if the session is part of the set. 1 is returned if true, 0 else. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">ss</td><td>a set (#SessionSet object) </td></tr> <tr><td class="paramname">rtpsession</td><td>a rtp session </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a6c2e5af222e014af8cd572cae29da5c5"></a><!-- doxytag: member="sessionset.h::session_set_set" ref="a6c2e5af222e014af8cd572cae29da5c5" args="(ss, rtpsession)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define session_set_set</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname">ss, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"> </td> <td class="paramname">rtpsession </td> </tr> <tr> <td></td> <td>)</td> <td></td><td>   ORTP_FD_SET((rtpsession)->mask_pos,&(ss)->rtpset)</td> </tr> </table> </div> <div class="memdoc"> <p>This macro adds the rtp session to the set. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">ss</td><td>a set (SessionSet object) </td></tr> <tr><td class="paramname">rtpsession</td><td>a RtpSession </td></tr> </table> </dd> </dl> <p>Referenced by <a class="el" href="rtpsession_8h.html#a7df1261d3eeaf10d283ba4ac34e2388d">rtp_session_recvm_with_ts()</a>.</p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a7b977891b1a456e636c16ec964840687"></a><!-- doxytag: member="sessionset.h::session_set_destroy" ref="a7b977891b1a456e636c16ec964840687" args="(SessionSet *set)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void session_set_destroy </td> <td>(</td> <td class="paramtype"><a class="el" href="struct__SessionSet.html">SessionSet</a> * </td> <td class="paramname"><em>set</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Frees a SessionSet.</p> <p>Destroys a session set. </p> </div> </div> <a class="anchor" id="a2e827fa3e1534317404d28aa3df73775"></a><!-- doxytag: member="sessionset.h::session_set_new" ref="a2e827fa3e1534317404d28aa3df73775" args="(void)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="struct__SessionSet.html">SessionSet</a>* session_set_new </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Allocates and initialize a new empty session set.</p> <dl class="return"><dt><b>Returns:</b></dt><dd>the empty session set. </dd></dl> </div> </div> <a class="anchor" id="af199d48aa2a51ff81a772aef2c477e2e"></a><!-- doxytag: member="sessionset.h::session_set_select" ref="af199d48aa2a51ff81a772aef2c477e2e" args="(SessionSet *recvs, SessionSet *sends, SessionSet *errors)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int session_set_select </td> <td>(</td> <td class="paramtype"><a class="el" href="struct__SessionSet.html">SessionSet</a> * </td> <td class="paramname"><em>recvs</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="struct__SessionSet.html">SessionSet</a> * </td> <td class="paramname"><em>sends</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="struct__SessionSet.html">SessionSet</a> * </td> <td class="paramname"><em>errors</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>This function performs similarly as libc select() function, but performs on #RtpSession instead of file descriptors. <a class="el" href="sessionset_8h.html#af199d48aa2a51ff81a772aef2c477e2e">session_set_select()</a> suspends the calling process until some events arrive on one of the three sets passed in argument. Two of the sets can be NULL. The first set is interpreted as a set of RtpSession waiting for receive events: a new buffer (perhaps empty) is availlable on one or more sessions of the set, or the last receive operation with <a class="el" href="rtpsession_8h.html#a2e325c908712601c051a7eedc59ca935">rtp_session_recv_with_ts()</a> would have finished if it were in blocking mode. The second set is interpreted as a set of RtpSession waiting for send events, i.e. the last <a class="el" href="rtpsession_8h.html#a3ed3f377bf06840f0e32c9b9a76bad10">rtp_session_send_with_ts()</a> call on a session would have finished if it were in blocking mode.</p> <p>When some events arrived on some of sets, then the function returns and sets are changed to indicate the sessions where events happened. Sessions can be added to sets using <a class="el" href="sessionset_8h.html#a6c2e5af222e014af8cd572cae29da5c5">session_set_set()</a>, a session has to be tested to be part of a set using <a class="el" href="sessionset_8h.html#a9d100df1b61766039dd0d1625794d8f5">session_set_is_set()</a>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">recvs</td><td>a set of rtp sessions to be watched for read events </td></tr> <tr><td class="paramname">sends</td><td>a set of rtp sessions to be watched for write events </td></tr> <tr><td class="paramname">errors</td><td>a set of rtp sessions to be watched for errors </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>: the number of sessions on which the selected events happened. </dd></dl> </div> </div> </div> <hr class="footer"/><address class="footer"><small> Generated on Sat Feb 25 2012 10:01:30 for oRTP by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.7.5 </small></address> </body> </html>