1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>enet: ENet host functions</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.1 -->
<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="classes.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
</ul></div>
<h1>ENet host functions</h1>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#g929df1baa1662e1eb0ae89af9ee3b339">enet_host_create</a> (const <a class="el" href="struct__ENetAddress.html">ENetAddress</a> *address, size_t peerCount, <a class="el" href="types_8h.html#5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> incomingBandwidth, <a class="el" href="types_8h.html#5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> outgoingBandwidth)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a host for communicating to peers. <a href="#g929df1baa1662e1eb0ae89af9ee3b339"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#gcec1e9a0b528c1f9ce30544d2d5b5b79">enet_host_destroy</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Destroys the host and all resources associated with it. <a href="#gcec1e9a0b528c1f9ce30544d2d5b5b79"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="struct__ENetPeer.html">ENetPeer</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#g04f234142512c08dd86a22b05020bd88">enet_host_connect</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host, const <a class="el" href="struct__ENetAddress.html">ENetAddress</a> *address, size_t channelCount)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initiates a connection to a foreign host. <a href="#g04f234142512c08dd86a22b05020bd88"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#g5190a63f78eb0c15bd96cda44bf423c6">enet_host_broadcast</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host, <a class="el" href="types_8h.html#34ce80c65abc6389fe0121a83d757f07">enet_uint8</a> channelID, <a class="el" href="struct__ENetPacket.html">ENetPacket</a> *packet)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Queues a packet to be sent to all peers associated with the host. <a href="#g5190a63f78eb0c15bd96cda44bf423c6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#g83c5fa02a3ba6ab829856302e54929fe">enet_host_bandwidth_limit</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host, <a class="el" href="types_8h.html#5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> incomingBandwidth, <a class="el" href="types_8h.html#5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> outgoingBandwidth)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Adjusts the bandwidth limits of a host. <a href="#g83c5fa02a3ba6ab829856302e54929fe"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gc76acd47fd07c27e5b85ecb63b192dd1"></a><!-- doxytag: member="host::enet_host_bandwidth_throttle" ref="gc76acd47fd07c27e5b85ecb63b192dd1" args="(ENetHost *host)" -->
void </td><td class="memItemRight" valign="bottom"><b>enet_host_bandwidth_throttle</b> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#gc8f53bcdbd540043f87e7d59048559fa">enet_host_flush</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sends any queued packets on the host specified to its designated peers. <a href="#gc8f53bcdbd540043f87e7d59048559fa"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#g6ba501b3ee576e5578c8e6d1694ebd49">enet_host_service</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host, <a class="el" href="struct__ENetEvent.html">ENetEvent</a> *event, <a class="el" href="types_8h.html#5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> timeout)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Waits for events on the host specified and shuttles packets between the host and its peers. <a href="#g6ba501b3ee576e5578c8e6d1694ebd49"></a><br></td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g83c5fa02a3ba6ab829856302e54929fe"></a><!-- doxytag: member="host.c::enet_host_bandwidth_limit" ref="g83c5fa02a3ba6ab829856302e54929fe" args="(ENetHost *host, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void enet_host_bandwidth_limit </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> </td>
<td class="paramname"> <em>incomingBandwidth</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> </td>
<td class="paramname"> <em>outgoingBandwidth</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host to adjust </td></tr>
<tr><td valign="top"></td><td valign="top"><em>incomingBandwidth</em> </td><td>new incoming bandwidth </td></tr>
<tr><td valign="top"></td><td valign="top"><em>outgoingBandwidth</em> </td><td>new outgoing bandwidth </td></tr>
</table>
</dl>
<dl class="remark" compact><dt><b>Remarks:</b></dt><dd>the incoming and outgoing bandwidth parameters are identical in function to those specified in <a class="el" href="group__host.html#g929df1baa1662e1eb0ae89af9ee3b339">enet_host_create()</a>. </dd></dl>
</div>
</div><p>
<a class="anchor" name="g5190a63f78eb0c15bd96cda44bf423c6"></a><!-- doxytag: member="host.c::enet_host_broadcast" ref="g5190a63f78eb0c15bd96cda44bf423c6" args="(ENetHost *host, enet_uint8 channelID, ENetPacket *packet)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void enet_host_broadcast </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#34ce80c65abc6389fe0121a83d757f07">enet_uint8</a> </td>
<td class="paramname"> <em>channelID</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct__ENetPacket.html">ENetPacket</a> * </td>
<td class="paramname"> <em>packet</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host on which to broadcast the packet </td></tr>
<tr><td valign="top"></td><td valign="top"><em>channelID</em> </td><td>channel on which to broadcast </td></tr>
<tr><td valign="top"></td><td valign="top"><em>packet</em> </td><td>packet to broadcast </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="g04f234142512c08dd86a22b05020bd88"></a><!-- doxytag: member="host.c::enet_host_connect" ref="g04f234142512c08dd86a22b05020bd88" args="(ENetHost *host, const ENetAddress *address, size_t channelCount)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct__ENetPeer.html">ENetPeer</a>* enet_host_connect </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="struct__ENetAddress.html">ENetAddress</a> * </td>
<td class="paramname"> <em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"> <em>channelCount</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host seeking the connection </td></tr>
<tr><td valign="top"></td><td valign="top"><em>address</em> </td><td>destination for the connection </td></tr>
<tr><td valign="top"></td><td valign="top"><em>channelCount</em> </td><td>number of channels to allocate </td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>a peer representing the foreign host on success, NULL on failure </dd></dl>
<dl class="remark" compact><dt><b>Remarks:</b></dt><dd>The peer returned will have not completed the connection until <a class="el" href="group__host.html#g6ba501b3ee576e5578c8e6d1694ebd49">enet_host_service()</a> notifies of an ENET_EVENT_TYPE_CONNECT event for the peer. </dd></dl>
</div>
</div><p>
<a class="anchor" name="g929df1baa1662e1eb0ae89af9ee3b339"></a><!-- doxytag: member="host.c::enet_host_create" ref="g929df1baa1662e1eb0ae89af9ee3b339" args="(const ENetAddress *address, size_t peerCount, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct__ENetHost.html">ENetHost</a>* enet_host_create </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="struct__ENetAddress.html">ENetAddress</a> * </td>
<td class="paramname"> <em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"> <em>peerCount</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> </td>
<td class="paramname"> <em>incomingBandwidth</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> </td>
<td class="paramname"> <em>outgoingBandwidth</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>address</em> </td><td>the address at which other peers may connect to this host. If NULL, then no peers may connect to the host. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>peerCount</em> </td><td>the maximum number of peers that should be allocated for the host. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>incomingBandwidth</em> </td><td>downstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>outgoingBandwidth</em> </td><td>upstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth.</td></tr>
</table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>the host on success and NULL on failure</dd></dl>
<dl class="remark" compact><dt><b>Remarks:</b></dt><dd>ENet will strategically drop packets on specific sides of a connection between hosts to ensure the host's bandwidth is not overwhelmed. The bandwidth parameters also determine the window size of a connection which limits the amount of reliable packets that may be in transit at any given time. </dd></dl>
</div>
</div><p>
<a class="anchor" name="gcec1e9a0b528c1f9ce30544d2d5b5b79"></a><!-- doxytag: member="host.c::enet_host_destroy" ref="gcec1e9a0b528c1f9ce30544d2d5b5b79" args="(ENetHost *host)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void enet_host_destroy </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em> </td>
<td> ) </td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>pointer to the host to destroy </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="gc8f53bcdbd540043f87e7d59048559fa"></a><!-- doxytag: member="protocol.c::enet_host_flush" ref="gc8f53bcdbd540043f87e7d59048559fa" args="(ENetHost *host)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void enet_host_flush </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em> </td>
<td> ) </td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host to flush </td></tr>
</table>
</dl>
<dl class="remark" compact><dt><b>Remarks:</b></dt><dd>this function need only be used in circumstances where one wishes to send queued packets earlier than in a call to <a class="el" href="group__host.html#g6ba501b3ee576e5578c8e6d1694ebd49">enet_host_service()</a>. </dd></dl>
</div>
</div><p>
<a class="anchor" name="g6ba501b3ee576e5578c8e6d1694ebd49"></a><!-- doxytag: member="protocol.c::enet_host_service" ref="g6ba501b3ee576e5578c8e6d1694ebd49" args="(ENetHost *host, ENetEvent *event, enet_uint32 timeout)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int enet_host_service </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct__ENetEvent.html">ENetEvent</a> * </td>
<td class="paramname"> <em>event</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> </td>
<td class="paramname"> <em>timeout</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host to service </td></tr>
<tr><td valign="top"></td><td valign="top"><em>event</em> </td><td>an event structure where event details will be placed if one occurs if event == NULL then no events will be delivered </td></tr>
<tr><td valign="top"></td><td valign="top"><em>timeout</em> </td><td>number of milliseconds that ENet should wait for events </td></tr>
</table>
</dl>
<dl compact><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>></em> </td><td>0 if an event occurred within the specified time limit </td></tr>
<tr><td valign="top"></td><td valign="top"><em>0</em> </td><td>if no event occurred </td></tr>
<tr><td valign="top"></td><td valign="top"><em><</em> </td><td>0 on failure </td></tr>
</table>
</dl>
<dl class="remark" compact><dt><b>Remarks:</b></dt><dd>enet_host_service should be called fairly regularly for adequate performance </dd></dl>
</div>
</div><p>
<hr size="1"><address style="align: right;"><small>Generated on Wed Jun 6 14:33:50 2007 for enet by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
</body>
</html>
|