📄 group__udp__app__api.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>UDP API functions</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="main.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindex" href="examples.html">Examples</a> </center><hr><h1>UDP API functions</h1><hr><a name="_details"></a><h2>Detailed Description</h2>These are the functions that applications need to use in order to send/receive data using UDP as well as to work with UDP sockets so as to achieve such a communication. <table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Functions</h2></td></tr><tr><td nowrap align=right valign=top>INT8 </td><td valign=bottom><a class="el" href="group__udp__app__api.html#a0">udp_getsocket</a> (UINT8, INT32(*)(INT8, UINT8, UINT32, UINT16, UINT16, UINT16), UINT8)</td></tr><tr><td> </td><td><font size=-1><em>Allocate a free socket in UDP socket pool.</em> <a href="#a0"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>INT8 </td><td valign=bottom><a class="el" href="group__udp__app__api.html#a1">udp_releasesocket</a> (INT8)</td></tr><tr><td> </td><td><font size=-1><em>Release a given socket.</em> <a href="#a1"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>INT8 </td><td valign=bottom><a class="el" href="group__udp__app__api.html#a2">udp_open</a> (INT8, UINT16)</td></tr><tr><td> </td><td><font size=-1><em>Open a given UDP socket for communication.</em> <a href="#a2"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>INT8 </td><td valign=bottom><a class="el" href="group__udp__app__api.html#a3">udp_close</a> (INT8)</td></tr><tr><td> </td><td><font size=-1><em>Close given socket for communication.</em> <a href="#a3"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>INT16 </td><td valign=bottom><a class="el" href="group__udp__app__api.html#a4">udp_send</a> (INT8, UINT32, UINT16, UINT8 *, UINT16, UINT16)</td></tr><tr><td> </td><td><font size=-1><em>Send data to remote host using given UDP socket.</em> <a href="#a4"></a><em></em></font><br><br></td></tr></table><hr><h2>Function Documentation</h2><a name="a0" doxytag="tcp_ip.h::udp_getsocket"></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"> INT8 udp_getsocket </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">UINT8 </td> <td class="mdname" nowrap> <em>tos</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>INT32(* </td> <td class="mdname" nowrap> <em>listener</em>)(INT8, UINT8, UINT32, UINT16, UINT16, UINT16), </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT8 </td> <td class="mdname" nowrap> <em>opts</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p><dl compact><dt><b>Author: </b></dt><dd> <ul><li> Jari Lahti (<a href="mailto:jari.lahti@violasystems.com">jari.lahti@violasystems.com</a>) </ul></dl><dl compact><dt><b>Date: </b></dt><dd>26.07.2002 </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>tos</em> </td><td>type of service for socket. For now nothing implemented so 0. </td></tr><tr><td valign=top><em>listener</em> </td><td>pointer to callback function that will be invoked by the TCP/IP stack to inform socket application of UDP_DATA_ARRIVAL event (for now only this, in future maybe others!) </td></tr><tr><td valign=top><em>opts</em> </td><td>Options for checksum generation & inspection. Can be one of the following: <ul><li> <a class="el" href="tcp__ip_8h.html#a4">UDP_OPT_NONE</a> <li> <a class="el" href="tcp__ip_8h.html#a5">UDP_OPT_SEND_CS</a> <li> <a class="el" href="tcp__ip_8h.html#a6">UDP_OPT_CHECK_CS</a> <li> <a class="el" href="tcp__ip_8h.html#a5">UDP_OPT_SEND_CS</a> | <a class="el" href="tcp__ip_8h.html#a6">UDP_OPT_CHECK_CS</a> </ul></td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd> <ul><li> -1 - Error <li> >=0 - Handle to reserved socket</ul></dl>Invoke this function to try to obtain a free socket from UDP socket pool. Function returns a handle to the free socket that is later used for accessing the allocated socket. <dl compact><dt><b>Examples: </b></dt><dd><a class="el" href="udp__demo_8c-example.html#a0">udp_demo.c</a>.</dl><p>Definition at line <a class="el" href="udp_8c-source.html#l00175">175</a> of file <a class="el" href="udp_8c-source.html">udp.c</a>.<p>References <a class="el" href="tcp__ip_8h-source.html#l00525">ucb::locport</a>, <a class="el" href="tcp__ip_8h-source.html#l00539">ucb::opts</a>, <a class="el" href="tcp__ip_8h-source.html#l00516">ucb::state</a>, <a class="el" href="tcp__ip_8h-source.html#l00523">ucb::tos</a>, <a class="el" href="tcp__ip_8h-source.html#l00140">UDP_OPT_CHECK_CS</a>, <a class="el" href="tcp__ip_8h-source.html#l00132">UDP_OPT_SEND_CS</a>, <a class="el" href="tcp__ip_8h-source.html#l00258">UDP_STATE_CLOSED</a>, and <a class="el" href="tcp__ip_8h-source.html#l00249">UDP_STATE_FREE</a>.<p>Referenced by <a class="el" href="bootp_8c-source.html#l00108">bootpc_init()</a>, <a class="el" href="dhcpc_8c-source.html#l00158">dhcpc_init()</a>, <a class="el" href="dns_8c-source.html#l00108">dns_init()</a>, and <a class="el" href="tftps_8c-source.html#l00136">tftps_init()</a>. </td> </tr></table><a name="a1" doxytag="tcp_ip.h::udp_releasesocket"></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"> INT8 udp_releasesocket </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">INT8 </td> <td class="mdname1" valign="top" nowrap> <em>sochandle</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p><dl compact><dt><b>Author: </b></dt><dd> <ul><li> Jari Lahti (<a href="mailto:jari.lahti@violasystems.com">jari.lahti@violasystems.com</a>) </ul></dl><dl compact><dt><b>Date: </b></dt><dd>26.07.2002 </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>sochandle</em> </td><td>handle of UDP socket to be released </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd> <ul><li> -1 - error <li> >=0 - OK (returns handle to release socket)</ul></dl>This function releases UDP socket. This means that the socket entry is marked as free and all of the ucb fields are initialized to default values. <p>Definition at line <a class="el" href="udp_8c-source.html#l00244">244</a> of file <a class="el" href="udp_8c-source.html">udp.c</a>.<p>References <a class="el" href="tcp__ip_8h-source.html#l00525">ucb::locport</a>, <a class="el" href="tcp__ip_8h-source.html#l00539">ucb::opts</a>, <a class="el" href="tcp__ip_8h-source.html#l00516">ucb::state</a>, <a class="el" href="tcp__ip_8h-source.html#l00523">ucb::tos</a>, <a class="el" href="tcp__ip_8h-source.html#l00140">UDP_OPT_CHECK_CS</a>, <a class="el" href="tcp__ip_8h-source.html#l00132">UDP_OPT_SEND_CS</a>, and <a class="el" href="tcp__ip_8h-source.html#l00249">UDP_STATE_FREE</a>. </td> </tr></table><a name="a2" doxytag="tcp_ip.h::udp_open"></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"> INT8 udp_open </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">INT8 </td> <td class="mdname" nowrap> <em>sochandle</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT16 </td> <td class="mdname" nowrap> <em>locport</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -