📄 ip_8c.html
字号:
</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>frame</em> </td><td>pointer to IP frame to be checked </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd> <ul><li> 0 - checksum corrupted <li> 1 - checksum OK</ul></dl>Checksum of an IP packet is calculated and compared with the received checksum. Error is signaled if there is discrepancy between them. <p>Definition at line <a class="el" href="ip_8c-source.html#l00474">474</a> of file <a class="el" href="ip_8c-source.html">ip.c</a>.<p>References <a class="el" href="ip_8h-source.html#l00122">ip_frame::checksum</a>, <a class="el" href="ip_8h-source.html#l00124">ip_frame::dip</a>, <a class="el" href="ip_8h-source.html#l00119">ip_frame::frags</a>, <a class="el" href="ip_8h-source.html#l00118">ip_frame::id</a>, <a class="el" href="ip_8c-source.html#l00539">ip_checksum()</a>, <a class="el" href="ip_8h-source.html#l00125">ip_frame::opt</a>, <a class="el" href="ip_8h-source.html#l00121">ip_frame::protocol</a>, <a class="el" href="ip_8h-source.html#l00123">ip_frame::sip</a>, <a class="el" href="ip_8h-source.html#l00117">ip_frame::tlen</a>, <a class="el" href="ip_8h-source.html#l00116">ip_frame::tos</a>, <a class="el" href="ip_8h-source.html#l00120">ip_frame::ttl</a>, and <a class="el" href="ip_8h-source.html#l00115">ip_frame::vihl</a>.<p>Referenced by <a class="el" href="ip_8c-source.html#l00115">process_ip_in()</a>. </td> </tr></table><a name="a7" doxytag="ip.c::ip_checksum"></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 ip_checksum </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">UINT16 </td> <td class="mdname" nowrap> <em>cs</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>UINT8 </td> <td class="mdname" nowrap> <em>count</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>24.02.2002 </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>cs</em> </td><td>last checksum value </td></tr><tr><td valign=top><em>dat</em> </td><td>byte to be added to checksum </td></tr><tr><td valign=top><em>count</em> </td><td>byte indicating whether dat is MSB or LSB byte </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd>new checksum value</dl>Based on count value, dat byte is added to checksum either as a MSB or a LSB byte and the new checksum value is then returned. <p>Definition at line <a class="el" href="ip_8c-source.html#l00539">539</a> of file <a class="el" href="ip_8c-source.html">ip.c</a>.<p>Referenced by <a class="el" href="ip_8c-source.html#l00474">ip_check_cs()</a>, <a class="el" href="ip_8c-source.html#l00582">ip_checksum_buf()</a>, <a class="el" href="ip_8c-source.html#l00417">ip_construct_cs()</a>, <a class="el" href="icmp_8c-source.html#l00097">process_icmp_in()</a>, <a class="el" href="tcp_8c-source.html#l02119">process_tcp_out()</a>, <a class="el" href="udp_8c-source.html#l00550">process_udp_in()</a>, <a class="el" href="tcp_8c-source.html#l02567">tcp_check_cs()</a>, and <a class="el" href="udp_8c-source.html#l00395">udp_send()</a>. </td> </tr></table><a name="a8" doxytag="ip.c::ip_checksum_buf"></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"> UINT32 ip_checksum_buf </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">UINT16 </td> <td class="mdname" nowrap> <em>cs</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT8 * </td> <td class="mdname" nowrap> <em>buf</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>03.08.2003 </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>cs</em> </td><td>last checksum value </td></tr><tr><td valign=top><em>buf</em> </td><td>buffer who's checksum we're calculating </td></tr><tr><td valign=top><em>len</em> </td><td>length of data in buffer </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd>new checksum value</dl>Calculates checksum of the data in buffer and returns new checksum value. <p>Definition at line <a class="el" href="ip_8c-source.html#l00582">582</a> of file <a class="el" href="ip_8c-source.html">ip.c</a>.<p>References <a class="el" href="ip_8c-source.html#l00539">ip_checksum()</a>.<p>Referenced by <a class="el" href="icmp_8c-source.html#l00097">process_icmp_in()</a>, <a class="el" href="tcp_8c-source.html#l02119">process_tcp_out()</a>, <a class="el" href="tcp_8c-source.html#l02567">tcp_check_cs()</a>, and <a class="el" href="udp_8c-source.html#l00395">udp_send()</a>. </td> </tr></table><hr><h2>Variable Documentation</h2><a name="a0" doxytag="ip.c::received_ip_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="structip__frame.html">ip_frame</a> received_ip_packet </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Various fields from the IP packet are stored in this structure. These values are later used from other upper layer protocols (ICMP, UDP, TCP and possibly others) to extract needed information about the received packet. See <a class="el" href="structip__frame.html">ip_frame</a> definition for struct information. <p>Definition at line <a class="el" href="ip_8c-source.html#l00085">85</a> of file <a class="el" href="ip_8c-source.html">ip.c</a>. </td> </tr></table><a name="a1" doxytag="ip.c::send_ip_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="structip__frame.html">ip_frame</a> send_ip_packet </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Various fields from the IP packet are stored in this structure. These values are filled based on the information supplied by the upper layer protocols (ICMP, UDP, TCP and possibly others) and used to form a correct IP packet (correct filed values, checksum,..). See <a class="el" href="structip__frame.html">ip_frame</a> definition for struct information. <p>Definition at line <a class="el" href="ip_8c-source.html#l00095">95</a> of file <a class="el" href="ip_8c-source.html">ip.c</a>. </td> </tr></table><a name="a2" doxytag="ip.c::ip_id"></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 ip_id </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>ID field in the next IP packet that will be sent <p>Definition at line <a class="el" href="ip_8c-source.html#l00097">97</a> of file <a class="el" href="ip_8c-source.html">ip.c</a>.<p>Referenced by <a class="el" href="ip_8c-source.html#l00300">process_ip_out()</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 + -