📄 ip_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>ip.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="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>/opentcp/include/inet/ip.h File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2> <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>Version: </b></dt><dd>1.0 </dl><dl compact><dt><b>Date: </b></dt><dd>11.6.2002</dl>OpenTCP IP function declarations, constants, etc.<p><p>Definition in file <a class="el" href="ip_8h-source.html">ip.h</a>.<p><a href="ip_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>Data Structures</h2></td></tr><tr><td nowrap align=right valign=top>struct </td><td valign=bottom><a class="el" href="structip__frame.html">ip_frame</a></td></tr><tr><td> </td><td><font size=-1><em>IP datagram header fields.</em> <a href="structip__frame.html#_details">More...</a><em></em></font><br><br></td></tr><tr><td colspan=2><br><h2>Defines</h2></td></tr><tr><td nowrap align=right valign=top>#define </td><td valign=bottom><a class="el" href="ip_8h.html#a0">PHY_ADR_LEN</a> ETH_ADDRESS_LEN</td></tr><tr><td nowrap align=right valign=top>#define </td><td valign=bottom><a class="el" href="ip_8h.html#a1">IP_ICMP</a> 0x01</td></tr><tr><td nowrap align=right valign=top>#define </td><td valign=bottom><a class="el" href="ip_8h.html#a2">IP_UDP</a> 17</td></tr><tr><td nowrap align=right valign=top>#define </td><td valign=bottom><a class="el" href="ip_8h.html#a3">IP_TCP</a> 6</td></tr><tr><td colspan=2><br><h2>Functions</h2></td></tr><tr><td nowrap align=right valign=top>INT16 </td><td valign=bottom><a class="el" href="group__periodic__functions.html#a3">process_ip_in</a> (struct <a class="el" href="structethernet__frame.html">ethernet_frame</a> *)</td></tr><tr><td> </td><td><font size=-1><em>Process received IP frame.</em> <a href="group__periodic__functions.html#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="ip_8h.html#a19">process_ip_out</a> (UINT32, UINT8, UINT8, UINT8, UINT8 *, UINT16)</td></tr><tr><td> </td><td><font size=-1><em>Try to send out IP frame.</em> <a href="#a19"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>UINT8 </td><td valign=bottom><a class="el" href="ip_8h.html#a20">ip_check_cs</a> (struct <a class="el" href="structip__frame.html">ip_frame</a> *)</td></tr><tr><td> </td><td><font size=-1><em>Check IP frame's checksum.</em> <a href="#a20"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>UINT16 </td><td valign=bottom><a class="el" href="ip_8h.html#a21">ip_checksum</a> (UINT16, UINT8, UINT8)</td></tr><tr><td> </td><td><font size=-1><em>Used for constructuing IP checksum.</em> <a href="#a21"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>UINT32 </td><td valign=bottom><a class="el" href="ip_8h.html#a22">ip_checksum_buf</a> (UINT16 cs, UINT8 *buf, UINT16 len)</td></tr><tr><td> </td><td><font size=-1><em>Used for constructuing IP checksum of a data buffer.</em> <a href="#a22"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>UINT32 </td><td valign=bottom><a class="el" href="ip_8h.html#a23">ip_construct_cs</a> (struct <a class="el" href="structip__frame.html">ip_frame</a> *)</td></tr><tr><td> </td><td><font size=-1><em>Construct checksum of the IP header.</em> <a href="#a23"></a><em></em></font><br><br></td></tr></table><hr><h2>Define Documentation</h2><a name="a0" doxytag="ip.h::PHY_ADR_LEN"></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"> #define PHY_ADR_LEN ETH_ADDRESS_LEN </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Lower-layer physical address length <p>Definition at line <a class="el" href="ip_8h-source.html#l00070">70</a> of file <a class="el" href="ip_8h-source.html">ip.h</a>.<p>Referenced by <a class="el" href="ip_8c-source.html#l00115">process_ip_in()</a>. </td> </tr></table><a name="a1" doxytag="ip.h::IP_ICMP"></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"> #define IP_ICMP 0x01 </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>ICMP over IP <p>Definition at line <a class="el" href="ip_8h-source.html#l00072">72</a> of file <a class="el" href="ip_8h-source.html">ip.h</a>.<p>Referenced by <a class="el" href="icmp_8c-source.html#l00097">process_icmp_in()</a>, <a class="el" href="ip_8c-source.html#l00115">process_ip_in()</a>, and <a class="el" href="ip_8c-source.html#l00300">process_ip_out()</a>. </td> </tr></table><a name="a2" doxytag="ip.h::IP_UDP"></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"> #define IP_UDP 17 </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>UDP over IP <p>Definition at line <a class="el" href="ip_8h-source.html#l00073">73</a> of file <a class="el" href="ip_8h-source.html">ip.h</a>.<p>Referenced by <a class="el" href="ip_8c-source.html#l00300">process_ip_out()</a>, <a class="el" href="udp_8c-source.html#l00550">process_udp_in()</a>, and <a class="el" href="udp_8c-source.html#l00395">udp_send()</a>. </td> </tr></table><a name="a3" doxytag="ip.h::IP_TCP"></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"> #define IP_TCP 6 </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>TCP over IP <p>Definition at line <a class="el" href="ip_8h-source.html#l00074">74</a> of file <a class="el" href="ip_8h-source.html">ip.h</a>.<p>Referenced by <a class="el" href="ip_8c-source.html#l00300">process_ip_out()</a>, <a class="el" href="tcp_8c-source.html#l01250">process_tcp_in()</a>, and <a class="el" href="tcp_8c-source.html#l02119">process_tcp_out()</a>. </td> </tr></table><hr><h2>Function Documentation</h2><a name="a19" doxytag="ip.h::process_ip_out"></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_ip_out </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">UINT32 </td> <td class="mdname" nowrap> <em>ipadr</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT8 </td> <td class="mdname" nowrap> <em>pcol</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT8 </td> <td class="mdname" nowrap> <em>tos</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT8 </td> <td class="mdname" nowrap> <em>ttl</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT8 * </td> <td class="mdname" nowrap> <em>dat</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT16 </td> <td class="mdname" nowrap> <em>len</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 </ul></dl><dl compact><dt><b>Date: </b></dt><dd>11.06.2002 </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>ipadr</em> </td><td>remote IP address </td></tr><tr><td valign=top><em>pcol</em> </td><td>protocol over IP used. Can be one of the following: <ul><li> <a class="el" href="ip_8h.html#a1">IP_ICMP</a> <li> <a class="el" href="ip_8h.html#a2">IP_UDP</a> <li> <a class="el" href="ip_8h.html#a3">IP_TCP</a> </ul></td></tr><tr><td valign=top><em>tos</em> </td><td>type of service required </td></tr><tr><td valign=top><em>ttl</em> </td><td>time to live header field of IP packet </td></tr><tr><td valign=top><em>dat</em> </td><td>pointer to data buffer </td></tr><tr><td valign=top><em>len</em> </td><td>length of data to be sent in IP datagram </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd> <ul><li> -1 - general error <li> -2 - ARP cache not ready <li> >0 - number of data bytes sent (packet OK)</ul></dl>Invoke this function to perform all of the necessary preparation in order to send out an IP packet. These include: <ul><li> Consulting ARP cache for HW address to send the packet to <li> Filling send_ip_packet variable with correct values <li> Calculating checksum for the IP packet <li> Adding datalink header information <li> Sending IP header and data <li> Instructing NIC to send the data </ul>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -