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

📄 dhcpc_8c.html

📁 Freescale mcu OpenTCP-1.0.4.doc.html.zip 文档
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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>dhcpc.c 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> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; <a class="qindex" href="annotated.html">Data Structures</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Data Fields</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindex" href="examples.html">Examples</a> &nbsp; </center><hr><h1>/opentcp/dhcp/dhcpc.c File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2> <dl compact><dt><b>Author: </b></dt><dd> <ul><li> Vladan Jovanovic (<a href="mailto:vladan.jovanovic@violasystems.com">vladan.jovanovic@violasystems.com</a>) </ul></dl><dl compact><dt><b>Version: </b></dt><dd>1.03 </dl><dl compact><dt><b>Date: </b></dt><dd>23.5.2003 </dl><dl compact><dt><b><a class="el" href="bug.html#_bug000009">Bug: </a></b></dt><dd></dl> <dl compact><dt><b>Warning: </b></dt><dd> </dl><dl compact><dt><b><a class="el" href="todo.html#_todo000009">Todo: </a></b></dt><dd><ul><li> We SHOULD first test (with PING or ARP) assigned IP address to see if it's in use already.</dl></ul>OpenTCP DHCP client protocol implementation. Features a complete DHCP state machine. Function declarations can be found in  <a class="el" href="dhcpc_8h.html">inet/dhcp/dhcpc.h</a><p><p>Definition in file <a class="el" href="dhcpc_8c-source.html">dhcpc.c</a>.<p><a href="dhcpc_8c-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>Functions</h2></td></tr><tr><td nowrap align=right valign=top>INT32&nbsp;</td><td valign=bottom><a class="el" href="dhcpc_8c.html#a8">dhcpc_eventlistener</a> (INT8 cbhandle, UINT8 event, UINT32 ipaddr, UINT16 port, UINT16 buffindex, UINT16 datalen)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>DHCP event listener, parses all DHCP replies.</em> <a href="#a8"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>INT8&nbsp;</td><td valign=bottom><a class="el" href="dhcpc_8c.html#a9">dhcpc_send_message</a> (UINT8 msg_type)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Sends DHCP messages.</em> <a href="#a9"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>INT8&nbsp;</td><td valign=bottom><a class="el" href="dhcpc_8c.html#a10">dhcpc_init</a> (void)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Initializes DHCP client.</em> <a href="#a10"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="dhcpc_8c.html#a11">dhcpc_run</a> (void)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>DHCP client main state machine.</em> <a href="#a11"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>UINT32&nbsp;</td><td valign=bottom><a class="el" href="dhcpc_8c.html#a12">dhcpc_read_n_bytes</a> (UINT8 n)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Processes received parameter from DHCP server.</em> <a href="#a12"></a><em></em></font><br><br></td></tr><tr><td colspan=2><br><h2>Variables</h2></td></tr><tr><td nowrap align=right valign=top>UINT8&nbsp;</td><td valign=bottom><a class="el" href="dhcpc_8c.html#a0">dhcpc_state</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Holds DHCP clients' state information.</em> <a href="#a0"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>UINT8&nbsp;</td><td valign=bottom><a class="el" href="dhcpc_8c.html#a1">dhcpc_timer_handle</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>DHCP client's timer handle.</em> <a href="#a1"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>INT8&nbsp;</td><td valign=bottom><a class="el" href="dhcpc_8c.html#a2">dhcpc_soc_handle</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>DHCP client's UDP socket handle.</em> <a href="#a2"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>UINT8&nbsp;</td><td valign=bottom><a class="el" href="dhcpc_8c.html#a3">dhcpc_initialized</a> = 0</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Holds information if DHCP client is initialized.</em> <a href="#a3"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>UINT32&nbsp;</td><td valign=bottom><a class="el" href="dhcpc_8c.html#a4">dhcpc_t1</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>DHCP renew timer.</em> <a href="#a4"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>UINT32&nbsp;</td><td valign=bottom><a class="el" href="dhcpc_8c.html#a5">dhcpc_t2</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>DHCP rebind timer.</em> <a href="#a5"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>UINT32&nbsp;</td><td valign=bottom><a class="el" href="dhcpc_8c.html#a6">dhcpc_server_identifier</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>DHCP server identifier as received from DHCP server.</em> <a href="#a6"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>UINT32&nbsp;</td><td valign=bottom><a class="el" href="dhcpc_8c.html#a7">dhcpc_requested_ip</a></td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Holds offered IP address or IP address that we're requesting.</em> <a href="#a7"></a><em></em></font><br><br></td></tr></table><hr><h2>Function Documentation</h2><a name="a8" doxytag="dhcpc.c::dhcpc_eventlistener"></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"> INT32 dhcpc_eventlistener </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">INT8&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>cbhandle</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT8&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>event</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT32&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>ipaddr</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT16&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>port</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT16&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>buffindex</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT16&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>datalen</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> Vladan Jovanovic (<a href="mailto:vladan.jovanovic@violasystems.com">vladan.jovanovic@violasystems.com</a>) </ul></dl><dl compact><dt><b>Date: </b></dt><dd>23.05.2003</dl>This is internal function invoked by OpenTCP UDP module when DHCP reply on a given UDP port is received. This function parses the response, checks for correctnes and performs certain actions based on the current state of DHCP client. <p>Definition at line <a class="el" href="dhcpc_8c-source.html#l00568">568</a> of file <a class="el" href="dhcpc_8c-source.html">dhcpc.c</a>.<p>References <a class="el" href="dhcpc_8c-source.html#l00549">dhcpc_read_n_bytes()</a>, <a class="el" href="dhcpc_8c-source.html#l00140">dhcpc_requested_ip</a>, <a class="el" href="dhcpc_8c-source.html#l00389">dhcpc_send_message()</a>, <a class="el" href="dhcpc_8c-source.html#l00131">dhcpc_server_identifier</a>, <a class="el" href="dhcpc_8c-source.html#l00100">dhcpc_soc_handle</a>, <a class="el" href="dhcpc_8c-source.html#l00087">dhcpc_state</a>, <a class="el" href="dhcpc_8c-source.html#l00115">dhcpc_t1</a>, <a class="el" href="dhcpc_8c-source.html#l00124">dhcpc_t2</a>, <a class="el" href="system_8h-source.html#l00210">RECEIVE_NETWORK_B</a>, and <a class="el" href="tcp__ip_8h-source.html#l00276">UDP_EVENT_DATA</a>.<p>Referenced by <a class="el" href="dhcpc_8c-source.html#l00158">dhcpc_init()</a>.    </td>  </tr></table><a name="a9" doxytag="dhcpc.c::dhcpc_send_message"></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 dhcpc_send_message </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">UINT8&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp; <em>msg_type</em>          </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> Vladan Jovanovic (<a href="mailto:vladan.jovanovic@violasystems.com">vladan.jovanovic@violasystems.com</a>) </ul></dl><dl compact><dt><b>Date: </b></dt><dd>23.05.2003 </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>msg_type</em>&nbsp;</td><td>Type of DHCP message to be sent. This implementation can send only DHCP_DISCOVER, DHCP_REQUEST and DCHP_DECLINE messages. </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd>Returns result of <a class="el" href="group__udp__app__api.html#a4">udp_send()</a> function.</dl>This is internal function invoked to send appropriate DHCP message. <p>Definition at line <a class="el" href="dhcpc_8c-source.html#l00389">389</a> of file <a class="el" href="dhcpc_8c-source.html">dhcpc.c</a>.<p>References <a class="el" href="dhcpc_8c-source.html#l00140">dhcpc_requested_ip</a>, <a class="el" href="dhcpc_8c-source.html#l00131">dhcpc_server_identifier</a>, <a class="el" href="dhcpc_8c-source.html#l00100">dhcpc_soc_handle</a>, <a class="el" href="dhcpc_8c-source.html#l00087">dhcpc_state</a>, <a class="el" href="system_8h-source.html#l00091">NETWORK_TX_BUFFER_SIZE</a>, <a class="el" href="tcp__ip_8h-source.html#l00471">UDP_APP_OFFSET</a>, and <a class="el" href="udp_8c-source.html#l00395">udp_send()</a>.<p>Referenced by <a class="el" href="dhcpc_8c-source.html#l00568">dhcpc_eventlistener()</a>, and <a class="el" href="dhcpc_8c-source.html#l00201">dhcpc_run()</a>.    </td>  </tr></table><a name="a10" doxytag="dhcpc.c::dhcpc_init"></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 dhcpc_init </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> Vladan Jovanovic (<a href="mailto:vladan.jovanovic@violasystems.com">vladan.jovanovic@violasystems.com</a>) </ul></dl><dl compact><dt><b>Date: </b></dt><dd>23.05.2003</dl>This function should be called once when system starts to initialize and start DHCP client. Before this function is invoked, localmachine.localip MUST be se to either zero (in which case DHCP client will request any IP address) or a previously assigned IP address (which doesn't mean DHCP server will allow us to continue using this address) in which case DHCP client will first try to obtain that existing IP address. <p>Definition at line <a class="el" href="dhcpc_8c-source.html#l00158">158</a> of file <a class="el" href="dhcpc_8c-source.html">dhcpc.c</a>.<p>References <a class="el" href="dhcpc_8c-source.html#l00568">dhcpc_eventlistener()</a>, <a class="el" href="dhcpc_8c-source.html#l00106">dhcpc_initialized</a>, <a class="el" href="dhcpc_8c-source.html#l00100">dhcpc_soc_handle</a>, <a class="el" href="dhcpc_8c-source.html#l00087">dhcpc_state</a>, <a class="el" href="dhcpc_8c-source.html#l00094">dhcpc_timer_handle</a>, <a class="el" href="timers_8c-source.html#l00131">get_timer()</a>, <a class="el" href="timers_8c-source.html#l00194">init_timer()</a>, <a class="el" href="timers_8h-source.html#l00086">TIMERTIC</a>, <a class="el" href="udp_8c-source.html#l00175">udp_getsocket()</a>, <a class="el" href="udp_8c-source.html#l00291">udp_open()</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#l00132">UDP_OPT_SEND_CS</a>.    </td>  </tr></table><a name="a11" doxytag="dhcpc.c::dhcpc_run"></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"> void dhcpc_run </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> Vladan Jovanovic (<a href="mailto:vladan.jovanovic@violasystems.com">vladan.jovanovic@violasystems.com</a>) </ul></dl><dl compact><dt><b>Date: </b></dt><dd>23.05.2003</dl>Call this function periodically from main loop to ensure proper operation. This function holds the main state machine of DHCP client that ensures proper operation. <p>Definition at line <a class="el" href="dhcpc_8c-source.html#l00201">201</a> of file <a class="el" href="dhcpc_8c-source.html">dhcpc.c</a>.<p>References <a class="el" href="timers_8c-source.html#l00233">check_timer()</a>, <a class="el" href="dhcpc_8c-source.html#l00106">dhcpc_initialized</a>, <a class="el" href="dhcpc_8c-source.html#l00140">dhcpc_requested_ip</a>, <a class="el" href="dhcpc_8c-source.html#l00389">dhcpc_send_message()</a>, <a class="el" href="dhcpc_8c-source.html#l00087">dhcpc_state</a>, <a class="el" href="dhcpc_8c-source.html#l00115">dhcpc_t1</a>, <a class="el" href="dhcpc_8c-source.html#l00124">dhcpc_t2</a>, <a class="el" href="dhcpc_8c-source.html#l00094">dhcpc_timer_handle</a>, <a class="el" href="timers_8c-source.html#l00194">init_timer()</a>, and <a class="el" href="timers_8h-source.html#l00086">TIMERTIC</a>.    </td>  </tr></table><a name="a12" doxytag="dhcpc.c::dhcpc_read_n_bytes"></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 dhcpc_read_n_bytes </td>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -