Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/enet-1.1/docs/html/group__host.html @ 13

Last change on this file since 13 was 13, checked in by landauf, 17 years ago

added enet

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