📄 zig_8h.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>zig.h File Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center><hr><h1>zig.h File Reference</h1>Provides <a class="el" href="zig_8h.html#a20">zig_init()</a>, <a class="el" href="zig_8h.html#a21">zig_shutdown()</a> and some useful enums. <a href="#_details">More...</a><p><code>#include <assert.h></code><br><code>#include "console.h"</code><br><code>#include "zigdefs.h"</code><br><p><a href="zig_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Enumerations</h2></td></tr><tr><td nowrap align=right valign=top>enum </td><td valign=bottom><a class="el" href="zig_8h.html#a22">reliable_send_policy_t</a> { , <a class="el" href="zig_8h.html#a22a1">RSP_CRITICAL</a> = 0, <a class="el" href="zig_8h.html#a22a2">RSP_HIGHEST</a>, <a class="el" href="zig_8h.html#a22a3">RSP_DEFAULT</a> = RSP_HIGHEST }</td></tr><tr><td> </td><td><font size=-1><em>values for "send policy" parameter of <a class="el" href="classzigclient__c.html">zigclient_c</a> and <a class="el" href="classzigserver__c.html">zigserver_c</a> send_message() and set_default_message_send_policy()</em> <a href="#a22">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>enum </td><td valign=bottom>{ <a class="el" href="zig_8h.html#a23a4">ZIGTIMING_BUSYLOOP</a>, <a class="el" href="zig_8h.html#a23a5">ZIGTIMING_YIELD</a>, <a class="el" href="zig_8h.html#a23a6">ZIGTIMING_SLEEP</a>, <a class="el" href="zig_8h.html#a23a7">ZIGTIMING_SMART</a> }</td></tr><tr><td> </td><td><font size=-1><em>zigclient & zigserver timing policies (argument to method set_timing_policy() in <a class="el" href="classzigclient__c.html">zigclient_c</a> and in <a class="el" href="classzigserver__c.html">zigserver_c</a>). This is the technique used to make threads wait on the main loops of client and server. These have no meaning if client or server are started in non-blocking mode with method run_nonblocking().</em> <a href="#a23">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>enum </td><td valign=bottom>{ <a class="el" href="zig_8h.html#a24a8">ZIG_SERVER_THREADING_1_1</a> = 0, <a class="el" href="zig_8h.html#a24a9">ZIG_SERVER_THREADING_1_N</a>, <a class="el" href="zig_8h.html#a24a10">ZIG_SERVER_THREADING_0</a> }</td></tr><tr><td> </td><td><font size=-1><em>zigserver strategies for using threads to process client's incoming network messages (argument to method set_threading() )</em> <a href="#a24">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>enum </td><td valign=bottom>{ <a class="el" href="zig_8h.html#a25a12">ZIGTHREADSPRIO_SYSTEM_DEFAULT</a>, <a class="el" href="zig_8h.html#a25a13">ZIGTHREADSPRIO_NET_HIGH</a>, <a class="el" href="zig_8h.html#a25a14">ZIGTHREADSPRIO_ALL_HIGH</a> }</td></tr><tr><td> </td><td><font size=-1><em>thread priorities to use on an object's (zigclient/zigserver/...) internal threads</em> <a href="#a25">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>enum </td><td valign=bottom>{ <a class="el" href="zig_8h.html#a26a15">CHFAIL_REQUEST_TIMED_OUT</a> = 1, <a class="el" href="zig_8h.html#a26a16">CHFAIL_CHANNEL_CONNECT_TIMED_OUT</a>, <a class="el" href="zig_8h.html#a26a17">CHFAIL_NO_LISTENERS</a> }</td></tr><tr><td> </td><td><font size=-1><em>failure codes for channel_open_failed()</em> <a href="#a26">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>enum </td><td valign=bottom>{ <a class="el" href="zig_8h.html#a27a18">EX_NULL</a> = 1, <a class="el" href="zig_8h.html#a27a19">EX_EOB</a> }</td></tr><tr><td> </td><td><font size=-1><em>ziglib integer exceptions</em> <a href="#a27">More...</a><em></em></font><br><br></td></tr><tr><td colspan=2><br><h2>Functions</h2></td></tr><tr><td nowrap align=right valign=top><a name="a20" doxytag="zig.h::zig_init"></a>bool </td><td valign=bottom><a class="el" href="zig_8h.html#a20">zig_init</a> (<a class="el" href="classconsole__c.html">console_c</a> *con=0)</td></tr><tr><td> </td><td><font size=-1><em>initialization of the library, call this before using other stuff. this function just initializes the HawkNL library. optional argument: a console to receive debug/error messages during init</em></font><br><br></td></tr><tr><td nowrap align=right valign=top><a name="a21" doxytag="zig.h::zig_shutdown"></a>void </td><td valign=bottom><a class="el" href="zig_8h.html#a21">zig_shutdown</a> (<a class="el" href="classconsole__c.html">console_c</a> *con=0)</td></tr><tr><td> </td><td><font size=-1><em>shutdown of the library, call this when exiting your app. this function just shuts down the HawkNL library. optional argument: a console to receive debug/error messages during shutdown</em></font><br><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Provides <a class="el" href="zig_8h.html#a20">zig_init()</a>, <a class="el" href="zig_8h.html#a21">zig_shutdown()</a> and some useful enums.<p><p><hr><h2>Enumeration Type Documentation</h2><a name="a23" doxytag="zig.h::@0"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> anonymous enum </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>zigclient & zigserver timing policies (argument to method set_timing_policy() in <a class="el" href="classzigclient__c.html">zigclient_c</a> and in <a class="el" href="classzigserver__c.html">zigserver_c</a>). This is the technique used to make threads wait on the main loops of client and server. These have no meaning if client or server are started in non-blocking mode with method run_nonblocking().<p><dl compact><dt><b>Enumeration values: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em><a name="a23a4" doxytag="ZIGTIMING_BUSYLOOP"></a><em>ZIGTIMING_BUSYLOOP</em></em> </td><td>VERY AGRESSIVE (=SELFISH): use a busy loop to wait.</td></tr><tr><td valign=top><em><a name="a23a5" doxytag="ZIGTIMING_YIELD"></a><em>ZIGTIMING_YIELD</em></em> </td><td>AGGRESSIVE: use "yield timeslice" to wait.</td></tr><tr><td valign=top><em><a name="a23a6" doxytag="ZIGTIMING_SLEEP"></a><em>ZIGTIMING_SLEEP</em></em> </td><td>CONSERVATIVE: use "sleep(1ms)" to wait (tipically this will cause sleep of 20-40 ms tho).</td></tr><tr><td valign=top><em><a name="a23a7" doxytag="ZIGTIMING_SMART"></a><em>ZIGTIMING_SMART</em></em> </td><td>attempts to measure sleep accuracy, and sleep if there is enough time left to wait,and if not, uses a more aggressive scheme. FIXME: NEEDS DECENT IMPLEMENTATION</td></tr></table></dl> </td> </tr></table><a name="a24" doxytag="zig.h::@1"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> anonymous enum </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>zigserver strategies for using threads to process client's incoming network messages (argument to method set_threading() )<p><dl compact><dt><b>Enumeration values: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em><a name="a24a8" doxytag="ZIG_SERVER_THREADING_1_1"></a><em>ZIG_SERVER_THREADING_1_1</em></em> </td><td>allocate one thread per client (the default behavior of ZIG 1.1.0 and earlier versions)</td></tr><tr><td valign=top><em><a name="a24a9" doxytag="ZIG_SERVER_THREADING_1_N"></a><em>ZIG_SERVER_THREADING_1_N</em></em> </td><td>allocate one thread to process ALL clients.</td></tr><tr><td valign=top><em><a name="a24a10" doxytag="ZIG_SERVER_THREADING_0"></a><em>ZIG_SERVER_THREADING_0</em></em> </td><td>THIS VALUE IS USED INTERNALLY BY ZIG! DO NOT USE! (this is used for the new "<a class="el" href="classzigserver__c.html#a13">zigserver_c::run_nonblocking()</a>" method that is implemented in ZIG v1.2.1. you don't need to pass this value to run_nonblocking. it is passed implicitly).</td></tr></table></dl> </td> </tr></table><a name="a25" doxytag="zig.h::@2"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> anonymous enum </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>thread priorities to use on an object's (zigclient/zigserver/...) internal threads<p><dl compact><dt><b>Enumeration values: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em><a name="a25a12" doxytag="ZIGTHREADSPRIO_SYSTEM_DEFAULT"></a><em>ZIGTHREADSPRIO_SYSTEM_DEFAULT</em></em> </td><td>don't touch the thread priorities, use the system default</td></tr><tr><td valign=top><em><a name="a25a13" doxytag="ZIGTHREADSPRIO_NET_HIGH"></a><em>ZIGTHREADSPRIO_NET_HIGH</em></em> </td><td>set network thread priorities to a high value, but the tight polling loops' threads (which you use ZIGTIMING_* to control) will remain with the default thread priority)</td></tr><tr><td valign=top><em><a name="a25a14" doxytag="ZIGTHREADSPRIO_ALL_HIGH"></a><em>ZIGTHREADSPRIO_ALL_HIGH</em></em> </td><td>set all thread priorities to a high value (generally "system max value"-1 or "system max value"-2, "realtime" priorities are never used)</td></tr></table></dl> </td> </tr></table><a name="a26" doxytag="zig.h::@3"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> anonymous enum </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>failure codes for channel_open_failed()<p><dl compact><dt><b>Enumeration values: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em><a name="a26a15" doxytag="CHFAIL_REQUEST_TIMED_OUT"></a><em>CHFAIL_REQUEST_TIMED_OUT</em></em> </td><td>request to open channel timed out</td></tr><tr><td valign=top><em><a name="a26a16" doxytag="CHFAIL_CHANNEL_CONNECT_TIMED_OUT"></a><em>CHFAIL_CHANNEL_CONNECT_TIMED_OUT</em></em> </td><td>almost the same as above, but the problem here is that the TCP connection timed out, even after the other side was instructed (via the estabilished UDP connection) to do it.</td></tr><tr><td valign=top><em><a name="a26a17" doxytag="CHFAIL_NO_LISTENERS"></a><em>CHFAIL_NO_LISTENERS</em></em> </td><td>both client and server are NOT configured for listening TCP connections</td></tr></table></dl> </td> </tr></table><a name="a27" doxytag="zig.h::@4"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> anonymous enum </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>ziglib integer exceptions<p><dl compact><dt><b>Enumeration values: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em><a name="a27a18" doxytag="EX_NULL"></a><em>EX_NULL</em></em> </td><td>something is null, and shouldn't</td></tr><tr><td valign=top><em><a name="a27a19" doxytag="EX_EOB"></a><em>EX_EOB</em></em> </td><td>end-of-buffer when reading data</td></tr></table></dl> </td> </tr></table><a name="a22" doxytag="zig.h::reliable_send_policy_t"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> enum reliable_send_policy_t </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>values for "send policy" parameter of <a class="el" href="classzigclient__c.html">zigclient_c</a> and <a class="el" href="classzigserver__c.html">zigserver_c</a> send_message() and set_default_message_send_policy()<p><dl compact><dt><b>Enumeration values: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em><a name="a22a1" doxytag="RSP_CRITICAL"></a><em>RSP_CRITICAL</em></em> </td><td>when the message is critical for the parsability of the rest of the UDP packet. a critical message: if it's not possible to put a pending critical message in an outgoing UDP packet, then the connection is dropped, and a status of ZIGSERVER_DISCONNECTED_LIMIT_CRITICALS (for the server), or ZIGCLIENT_DISCONNECTED_LIMIT_CRITICALS (for the client) is returned as the "zig_reason" disconnection reason code in the <a class="el" href="classzigclient__c.html#a40">zigclient_c::disconnected()</a> and <a class="el" href="classzigserver__c.html#a24">zigserver_c::client_disconnected()</a> callbacks. WHEN TO USE: one use of RSP_CRITICAL is for reliable messages that MUST NOT arrive later than the next outbound packet's block of unreliable data.</td></tr><tr><td valign=top><em><a name="a22a2" doxytag="RSP_HIGHEST"></a><em>RSP_HIGHEST</em></em> </td><td>message is sent in every outbound packet, if possible.</td></tr><tr><td valign=top><em><a name="a22a3" doxytag="RSP_DEFAULT"></a><em>RSP_DEFAULT</em></em> </td><td>the "default default" value for the "send policy", library-wise. CURRENTLY (v1.3.0), it being set to RSP_HIGHEST, meaning that pending reliable messages might not get (re-)sent in the next outbound packet. If you don't like this default, then please use zigclient_c::set_default_message_send_policy() and zigserver_c::set_default_message_send_policy() to choose the "default send policy" you prefer.</td></tr></table></dl> </td> </tr></table><hr><address style="align: right;"><small>Generated on Mon Jan 24 21:14:23 2005 for ZIG by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -