⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 udp_8c.html

📁 Freescale mcu OpenTCP-1.0.4.doc.html.zip 文档
💻 HTML
📖 第 1 页 / 共 2 页
字号:
      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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>&nbsp;</td><td>handle to socket to be closed </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd> <ul><li> -1 - Error <li> &gt;=0 - handle to closed socket</ul></dl>Closes a given socket in order to disable further communication over it. <p>Definition at line <a class="el" href="udp_8c-source.html#l00340">340</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#l00516">ucb::state</a>, and <a class="el" href="tcp__ip_8h-source.html#l00258">UDP_STATE_CLOSED</a>.    </td>  </tr></table><a name="a7" doxytag="udp.c::udp_send"></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"> INT16 udp_send </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">INT8&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>sochandle</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT32&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>remip</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT16&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>remport</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT8 *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>buf</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT16&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>blen</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT16&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>dlen</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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>&nbsp;</td><td>handle to UDP socket to use </td></tr><tr><td valign=top><em>remip</em>&nbsp;</td><td>remote IP address to which data should be sent </td></tr><tr><td valign=top><em>remport</em>&nbsp;</td><td>remote port number to which data should be sent </td></tr><tr><td valign=top><em>buf</em>&nbsp;</td><td>pointer to data buffer (start of user data) </td></tr><tr><td valign=top><em>blen</em>&nbsp;</td><td>buffer length in bytes (without space reserved at the  beginning of buffer for headers) </td></tr><tr><td valign=top><em>dlen</em>&nbsp;</td><td>length of user data to be sent (in bytes) </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd> <ul><li> -1 - Error (general error, e.g. parameters) <li> -2 - ARP or lower layer not ready, try again later <li> -3 - Socket closed or invalid local port <li> &gt;0 - OK (number represents number of bytes actually sent)</ul></dl><dl compact><dt><b>Warning: </b></dt><dd> <ul><li> <em>buf</em> parameter is a pointer to data to be sent in  user buffer. But note that there <b>MUST</b> be sufficient free buffer space before that data for UDP header (of <a class="el" href="tcp__ip_8h.html#a8">UDP_HLEN</a> size).</ul></dl>Use this function to send data over an already opened UDP socket. <p>Definition at line <a class="el" href="udp_8c-source.html#l00395">395</a> of file <a class="el" href="udp_8c-source.html">udp.c</a>.<p>References <a class="el" href="ip_8c-source.html#l00539">ip_checksum()</a>, <a class="el" href="ip_8c-source.html#l00582">ip_checksum_buf()</a>, <a class="el" href="ip_8h-source.html#l00073">IP_UDP</a>, <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="ip_8c-source.html#l00300">process_ip_out()</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#l00144">UDP_HLEN</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#l00266">UDP_STATE_OPENED</a>.<p>Referenced by <a class="el" href="bootp_8c-source.html#l00183">bootpc_run()</a>, <a class="el" href="dhcpc_8c-source.html#l00389">dhcpc_send_message()</a>, and <a class="el" href="dns_8c-source.html#l00445">get_host_by_name()</a>.    </td>  </tr></table><a name="a8" doxytag="udp.c::process_udp_in"></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"> INT16 process_udp_in </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">struct <a class="el" href="structip__frame.html">ip_frame</a> *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>frame</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT16&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>len</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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>15.07.2002 </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>frame</em>&nbsp;</td><td>pointer to received IP frame structure </td></tr><tr><td valign=top><em>len</em>&nbsp;</td><td>length of data in bytes </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd> <ul><li> -1 - Error (packet not UDP, header errror or no socket for it) <li> &gt;0 - Packet OK</ul></dl>Invoke this function to process received UDP frames. See <a class="el" href="main__demo_8c.html">main_demo.c</a> for an example on how to accomplish this. <p>Definition at line <a class="el" href="udp_8c-source.html#l00550">550</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#l00494">udp_frame::buf_index</a>, <a class="el" href="ip_8h-source.html#l00126">ip_frame::buf_index</a>, <a class="el" href="tcp__ip_8h-source.html#l00493">udp_frame::checksum</a>, <a class="el" href="ip_8h-source.html#l00124">ip_frame::dip</a>, <a class="el" href="tcp__ip_8h-source.html#l00491">udp_frame::dport</a>, <a class="el" href="ip_8c-source.html#l00539">ip_checksum()</a>, <a class="el" href="ip_8h-source.html#l00073">IP_UDP</a>, <a class="el" href="tcp__ip_8h-source.html#l00525">ucb::locport</a>, <a class="el" href="system_8h-source.html#l00270">NETWORK_RECEIVE_INITIALIZE</a>, <a class="el" href="tcp__ip_8h-source.html#l00539">ucb::opts</a>, <a class="el" href="ip_8h-source.html#l00121">ip_frame::protocol</a>, <a class="el" href="system_8h-source.html#l00210">RECEIVE_NETWORK_B</a>, <a class="el" href="ip_8h-source.html#l00123">ip_frame::sip</a>, <a class="el" href="tcp__ip_8h-source.html#l00490">udp_frame::sport</a>, <a class="el" href="tcp__ip_8h-source.html#l00516">ucb::state</a>, <a class="el" href="tcp__ip_8h-source.html#l00492">udp_frame::tlen</a>, <a class="el" href="tcp__ip_8h-source.html#l00276">UDP_EVENT_DATA</a>, <a class="el" href="tcp__ip_8h-source.html#l00144">UDP_HLEN</a>, <a class="el" href="tcp__ip_8h-source.html#l00140">UDP_OPT_CHECK_CS</a>, and <a class="el" href="tcp__ip_8h-source.html#l00266">UDP_STATE_OPENED</a>.    </td>  </tr></table><a name="a9" doxytag="udp.c::udp_getfreeport"></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"> UINT16 udp_getfreeport </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">void&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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>19.10.2002 </dl><dl compact><dt><b>Returns: </b></dt><dd> <ul><li> 0 - no free ports! <li> &gt;0 - free local TCP port number</ul></dl>Function attempts to find new local port number that can be used to  establish a connection. <p>Definition at line <a class="el" href="udp_8c-source.html#l00684">684</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#l00516">ucb::state</a>, <a class="el" href="tcp__ip_8h-source.html#l00109">UDP_PORTS_END</a>, and <a class="el" href="tcp__ip_8h-source.html#l00258">UDP_STATE_CLOSED</a>.<p>Referenced by <a class="el" href="udp_8c-source.html#l00291">udp_open()</a>.    </td>  </tr></table><hr><h2>Variable Documentation</h2><a name="a0" doxytag="udp.c::udp_socket"></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"> struct <a class="el" href="structucb.html">ucb</a> udp_socket[NO_OF_UDPSOCKETS]      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>UDP table is an array of ucb structures holding all of the  necessary information about the state, listener, port numbers and other info about the UDP sockets opened. Number of UDP sockets that can be opened at any given time is defined by the NO_OF_UDPSOCKETS and may be changed in order to change the amount of used RAM memory. See ucb definition for more information about the structure itself. <p>Definition at line <a class="el" href="udp_8c-source.html#l00094">94</a> of file <a class="el" href="udp_8c-source.html">udp.c</a>.    </td>  </tr></table><a name="a1" doxytag="udp.c::received_udp_packet"></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"> struct <a class="el" href="structudp__frame.html">udp_frame</a> received_udp_packet      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Various fields from the received UDP packet are stored in this variable. See <a class="el" href="structudp__frame.html">udp_frame</a> definition for struct information. <p>Definition at line <a class="el" href="udp_8c-source.html#l00101">101</a> of file <a class="el" href="udp_8c-source.html">udp.c</a>.    </td>  </tr></table><hr><address style="align: right;"><small>Generated on Sun Aug 3 20:33:00 2003 for OpenTCP 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 + -