<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.16">
  <compounddef id="dhcp_8c" kind="file" language="C++">
    <compoundname>dhcp.c</compoundname>
    <includes refid="opt_8h" local="yes">net/opt.h</includes>
    <incdepgraph>
      <node id="17">
        <label>stdarg.h</label>
        <link refid="stdarg_8h"/>
      </node>
      <node id="18">
        <label>ubixos/kpanic.h</label>
        <link refid="kpanic_8h"/>
      </node>
      <node id="15">
        <label>sys/io.h</label>
        <link refid="io_8h"/>
      </node>
      <node id="8">
        <label>sys/select.h</label>
        <link refid="select_8h"/>
        <childnode refid="9" relation="include">
        </childnode>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="12" relation="include">
        </childnode>
      </node>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/net/core/ipv4/dhcp.c</label>
        <link refid="dhcp_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="13">
        <label>net/arch/cc.h</label>
        <link refid="cc_8h"/>
        <childnode refid="14" relation="include">
        </childnode>
      </node>
      <node id="12">
        <label>sys/_sigset.h</label>
        <link refid="__sigset_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="3">
        <label>net/lwipopts.h</label>
        <link refid="lwipopts_8h"/>
      </node>
      <node id="6">
        <label>sys/types.h</label>
        <link refid="include_2sys_2types_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="8" relation="include">
        </childnode>
      </node>
      <node id="5">
        <label>net/arch.h</label>
        <link refid="arch_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
        <childnode refid="18" relation="include">
        </childnode>
      </node>
      <node id="2">
        <label>net/opt.h</label>
        <link refid="opt_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="16">
        <label>lib/kprintf.h</label>
        <link refid="kprintf_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
      </node>
      <node id="4">
        <label>net/debug.h</label>
        <link refid="debug_8h"/>
        <childnode refid="5" relation="include">
        </childnode>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="9">
        <label>sys/cdefs.h</label>
        <link refid="cdefs_8h"/>
      </node>
      <node id="14">
        <label>ubixos/time.h</label>
        <link refid="time_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="15" relation="include">
        </childnode>
      </node>
      <node id="7">
        <label>sys/_types.h</label>
        <link refid="__types_8h"/>
      </node>
      <node id="10">
        <label>sys/_timespec.h</label>
        <link refid="__timespec_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="11">
        <label>sys/_timeval.h</label>
        <link refid="__timeval_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
<para>Dynamic Host Configuration Protocol client </para>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="27"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="28"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2001-2004<sp/>Leon<sp/>Woestenberg<sp/>&lt;leon.woestenberg@gmx.net&gt;</highlight></codeline>
<codeline lineno="29"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2001-2004<sp/>Axon<sp/>Digital<sp/>Design<sp/>B.V.,<sp/>The<sp/>Netherlands.</highlight></codeline>
<codeline lineno="30"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="31"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="32"><highlight class="comment"><sp/>*<sp/>Redistribution<sp/>and<sp/>use<sp/>in<sp/>source<sp/>and<sp/>binary<sp/>forms,<sp/>with<sp/>or<sp/>without<sp/>modification,</highlight></codeline>
<codeline lineno="33"><highlight class="comment"><sp/>*<sp/>are<sp/>permitted<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions<sp/>are<sp/>met:</highlight></codeline>
<codeline lineno="34"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="35"><highlight class="comment"><sp/>*<sp/>1.<sp/>Redistributions<sp/>of<sp/>source<sp/>code<sp/>must<sp/>retain<sp/>the<sp/>above<sp/>copyright<sp/>notice,</highlight></codeline>
<codeline lineno="36"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer.</highlight></codeline>
<codeline lineno="37"><highlight class="comment"><sp/>*<sp/>2.<sp/>Redistributions<sp/>in<sp/>binary<sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright<sp/>notice,</highlight></codeline>
<codeline lineno="38"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer<sp/>in<sp/>the<sp/>documentation</highlight></codeline>
<codeline lineno="39"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>and/or<sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.</highlight></codeline>
<codeline lineno="40"><highlight class="comment"><sp/>*<sp/>3.<sp/>The<sp/>name<sp/>of<sp/>the<sp/>author<sp/>may<sp/>not<sp/>be<sp/>used<sp/>to<sp/>endorse<sp/>or<sp/>promote<sp/>products</highlight></codeline>
<codeline lineno="41"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>derived<sp/>from<sp/>this<sp/>software<sp/>without<sp/>specific<sp/>prior<sp/>written<sp/>permission.</highlight></codeline>
<codeline lineno="42"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="43"><highlight class="comment"><sp/>*<sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>THE<sp/>AUTHOR<sp/>``AS<sp/>IS&apos;&apos;<sp/>AND<sp/>ANY<sp/>EXPRESS<sp/>OR<sp/>IMPLIED</highlight></codeline>
<codeline lineno="44"><highlight class="comment"><sp/>*<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF</highlight></codeline>
<codeline lineno="45"><highlight class="comment"><sp/>*<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/>ARE<sp/>DISCLAIMED.<sp/>IN<sp/>NO<sp/>EVENT</highlight></codeline>
<codeline lineno="46"><highlight class="comment"><sp/>*<sp/>SHALL<sp/>THE<sp/>AUTHOR<sp/>BE<sp/>LIABLE<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,</highlight></codeline>
<codeline lineno="47"><highlight class="comment"><sp/>*<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL<sp/>DAMAGES<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT</highlight></codeline>
<codeline lineno="48"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUBSTITUTE<sp/>GOODS<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS</highlight></codeline>
<codeline lineno="49"><highlight class="comment"><sp/>*<sp/>INTERRUPTION)<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN</highlight></codeline>
<codeline lineno="50"><highlight class="comment"><sp/>*<sp/>CONTRACT,<sp/>STRICT<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING</highlight></codeline>
<codeline lineno="51"><highlight class="comment"><sp/>*<sp/>IN<sp/>ANY<sp/>WAY<sp/>OUT<sp/>OF<sp/>THE<sp/>USE<sp/>OF<sp/>THIS<sp/>SOFTWARE,<sp/>EVEN<sp/>IF<sp/>ADVISED<sp/>OF<sp/>THE<sp/>POSSIBILITY</highlight></codeline>
<codeline lineno="52"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="53"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="54"><highlight class="comment"><sp/>*<sp/>This<sp/>file<sp/>is<sp/>part<sp/>of<sp/>the<sp/>lwIP<sp/>TCP/IP<sp/>stack.</highlight></codeline>
<codeline lineno="55"><highlight class="comment"><sp/>*<sp/>The<sp/>Swedish<sp/>Institute<sp/>of<sp/>Computer<sp/>Science<sp/>and<sp/>Adam<sp/>Dunkels</highlight></codeline>
<codeline lineno="56"><highlight class="comment"><sp/>*<sp/>are<sp/>specifically<sp/>granted<sp/>permission<sp/>to<sp/>redistribute<sp/>this</highlight></codeline>
<codeline lineno="57"><highlight class="comment"><sp/>*<sp/>source<sp/>code.</highlight></codeline>
<codeline lineno="58"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="59"><highlight class="comment"><sp/>*<sp/>Author:<sp/>Leon<sp/>Woestenberg<sp/>&lt;leon.woestenberg@gmx.net&gt;</highlight></codeline>
<codeline lineno="60"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="61"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal"></highlight></codeline>
<codeline lineno="63"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="opt_8h" kindref="compound">net/opt.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="64"><highlight class="normal"></highlight></codeline>
<codeline lineno="65"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_DHCP<sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>build<sp/>if<sp/>not<sp/>configured<sp/>for<sp/>use<sp/>in<sp/>lwipopts.h<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="66"><highlight class="normal"></highlight></codeline>
<codeline lineno="67"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="stats_8h" kindref="compound">net/stats.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="mem_8h" kindref="compound">net/mem.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="udp_8h" kindref="compound">net/udp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="70"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="ip__addr_8h" kindref="compound">net/ip_addr.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="71"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="netif_8h" kindref="compound">net/netif.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="72"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="def_8h" kindref="compound">net/def.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="73"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="dhcp_8h" kindref="compound">net/dhcp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="74"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="autoip_8h" kindref="compound">net/autoip.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="75"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="dns_8h" kindref="compound">net/dns.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="76"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="etharp_8h" kindref="compound">net/etharp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="77"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="prot_2dhcp_8h" kindref="compound">net/prot/dhcp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="78"><highlight class="normal"></highlight></codeline>
<codeline lineno="79"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="string_8h" kindref="compound">string.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="80"><highlight class="normal"></highlight></codeline>
<codeline lineno="84"><highlight class="preprocessor">#ifndef<sp/>DHCP_CREATE_RAND_XID</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="85"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DHCP_CREATE_RAND_XID<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="86"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="87"><highlight class="normal"></highlight></codeline>
<codeline lineno="93"><highlight class="preprocessor">#ifdef<sp/>DHCP_GLOBAL_XID_HEADER</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="94"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>DHCP_GLOBAL_XID_HEADER<sp/></highlight><highlight class="comment">/*<sp/>include<sp/>optional<sp/>starting<sp/>XID<sp/>generation<sp/>prototypes<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="95"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="96"><highlight class="normal"></highlight></codeline>
<codeline lineno="99"><highlight class="preprocessor">#define<sp/>DHCP_MAX_MSG_LEN(netif)<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(netif-&gt;mtu)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="100"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DHCP_MAX_MSG_LEN_MIN_REQUIRED<sp/><sp/>576</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="101"><highlight class="normal"></highlight></codeline>
<codeline lineno="102"><highlight class="preprocessor">#define<sp/>DHCP_MIN_REPLY_LEN<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>44</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="103"><highlight class="normal"></highlight></codeline>
<codeline lineno="104"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>REBOOT_TRIES<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>2</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="105"><highlight class="normal"></highlight></codeline>
<codeline lineno="106"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DNS<sp/>&amp;&amp;<sp/>LWIP_DHCP_MAX_DNS_SERVERS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="107"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_MAX_SERVERS<sp/>&gt;<sp/>LWIP_DHCP_MAX_DNS_SERVERS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="108"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS<sp/>LWIP_DHCP_MAX_DNS_SERVERS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="109"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="110"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS<sp/>DNS_MAX_SERVERS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="111"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="112"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="113"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS<sp/>0</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="114"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight></codeline>
<codeline lineno="121"><highlight class="keyword">enum</highlight><highlight class="normal"><sp/>dhcp_option_idx<sp/>{</highlight></codeline>
<codeline lineno="122"><highlight class="normal"><sp/><sp/>DHCP_OPTION_IDX_OVERLOAD<sp/>=<sp/>0,</highlight></codeline>
<codeline lineno="123"><highlight class="normal"><sp/><sp/>DHCP_OPTION_IDX_MSG_TYPE,</highlight></codeline>
<codeline lineno="124"><highlight class="normal"><sp/><sp/>DHCP_OPTION_IDX_SERVER_ID,</highlight></codeline>
<codeline lineno="125"><highlight class="normal"><sp/><sp/>DHCP_OPTION_IDX_LEASE_TIME,</highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/>DHCP_OPTION_IDX_T1,</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/>DHCP_OPTION_IDX_T2,</highlight></codeline>
<codeline lineno="128"><highlight class="normal"><sp/><sp/>DHCP_OPTION_IDX_SUBNET_MASK,</highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/>DHCP_OPTION_IDX_ROUTER,</highlight></codeline>
<codeline lineno="130"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/>DHCP_OPTION_IDX_DNS_SERVER,</highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/>DHCP_OPTION_IDX_DNS_SERVER_LAST<sp/>=<sp/>DHCP_OPTION_IDX_DNS_SERVER<sp/>+<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS<sp/>-<sp/>1,</highlight></codeline>
<codeline lineno="133"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="134"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_GET_NTP_SRV</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="135"><highlight class="normal"><sp/><sp/>DHCP_OPTION_IDX_NTP_SERVER,</highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/>DHCP_OPTION_IDX_NTP_SERVER_LAST<sp/>=<sp/>DHCP_OPTION_IDX_NTP_SERVER<sp/>+<sp/><ref refid="lwipopts_8h_1a9d014e3f7dc9e1e7c7decd8652ba65e2" kindref="member">LWIP_DHCP_MAX_NTP_SERVERS</ref><sp/>-<sp/>1,</highlight></codeline>
<codeline lineno="137"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_GET_NTP_SRV<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/>DHCP_OPTION_IDX_MAX</highlight></codeline>
<codeline lineno="139"><highlight class="normal">};</highlight></codeline>
<codeline lineno="140"><highlight class="normal"></highlight></codeline>
<codeline lineno="143"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>dhcp_rx_options_val[DHCP_OPTION_IDX_MAX];</highlight></codeline>
<codeline lineno="147"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/><sp/>dhcp_rx_options_given[DHCP_OPTION_IDX_MAX];</highlight></codeline>
<codeline lineno="148"><highlight class="normal"></highlight></codeline>
<codeline lineno="149"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>dhcp_discover_request_options[]<sp/>=<sp/>{</highlight></codeline>
<codeline lineno="150"><highlight class="normal"><sp/><sp/><ref refid="prot_2dhcp_8h_1acff5b8c45e6d63afd973aa8a0e72a901" kindref="member">DHCP_OPTION_SUBNET_MASK</ref>,</highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/><ref refid="prot_2dhcp_8h_1a72cfc4e231017d1d116bb1d69d18ae8c" kindref="member">DHCP_OPTION_ROUTER</ref>,</highlight></codeline>
<codeline lineno="152"><highlight class="normal"><sp/><sp/><ref refid="prot_2dhcp_8h_1ac6c1fce157c3297412cfb28d0822a93b" kindref="member">DHCP_OPTION_BROADCAST</ref></highlight></codeline>
<codeline lineno="153"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/>,<sp/><ref refid="prot_2dhcp_8h_1a8f05c5c6084fbac0be7b24101189232b" kindref="member">DHCP_OPTION_DNS_SERVER</ref></highlight></codeline>
<codeline lineno="155"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="156"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_GET_NTP_SRV</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/>,<sp/><ref refid="prot_2dhcp_8h_1ae5a724660dd11c27d8ed477f0ee136e3" kindref="member">DHCP_OPTION_NTP</ref></highlight></codeline>
<codeline lineno="158"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_GET_NTP_SRV<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/>};</highlight></codeline>
<codeline lineno="160"><highlight class="normal"></highlight></codeline>
<codeline lineno="161"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>DHCP_GLOBAL_XID</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="162"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>xid;</highlight></codeline>
<codeline lineno="163"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>xid_initialised;</highlight></codeline>
<codeline lineno="164"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DHCP_GLOBAL_XID<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="165"><highlight class="normal"></highlight></codeline>
<codeline lineno="166"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>dhcp_option_given(dhcp,<sp/>idx)<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(dhcp_rx_options_given[idx]<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="167"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>dhcp_got_option(dhcp,<sp/>idx)<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(dhcp_rx_options_given[idx]<sp/>=<sp/>1)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="168"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>dhcp_clear_option(dhcp,<sp/>idx)<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(dhcp_rx_options_given[idx]<sp/>=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="169"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>dhcp_clear_all_options(dhcp)<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(memset(dhcp_rx_options_given,<sp/>0,<sp/>sizeof(dhcp_rx_options_given)))</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="170"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>dhcp_get_option_value(dhcp,<sp/>idx)<sp/><sp/><sp/><sp/><sp/><sp/>(dhcp_rx_options_val[idx])</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="171"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>dhcp_set_option_value(dhcp,<sp/>idx,<sp/>val)<sp/>(dhcp_rx_options_val[idx]<sp/>=<sp/>(val))</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="172"><highlight class="normal"></highlight></codeline>
<codeline lineno="173"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">udp_pcb<sp/>*dhcp_pcb;</highlight></codeline>
<codeline lineno="174"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>dhcp_pcb_refcount;</highlight></codeline>
<codeline lineno="175"><highlight class="normal"></highlight></codeline>
<codeline lineno="176"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>DHCP<sp/>client<sp/>state<sp/>machine<sp/>functions<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="177"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>dhcp_discover(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="178"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>dhcp_select(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="179"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_bind(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="180"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DHCP_DOES_ARP_CHECK</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="181"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>dhcp_decline(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="182"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DHCP_DOES_ARP_CHECK<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="183"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>dhcp_rebind(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="184"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>dhcp_reboot(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="185"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_set_state(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>new_state);</highlight></codeline>
<codeline lineno="186"><highlight class="normal"></highlight></codeline>
<codeline lineno="187"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>receive,<sp/>unfold,<sp/>parse<sp/>and<sp/>free<sp/>incoming<sp/>messages<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="188"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_recv(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*arg,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>udp_pcb<sp/>*pcb,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*addr,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>port);</highlight></codeline>
<codeline lineno="189"><highlight class="normal"></highlight></codeline>
<codeline lineno="190"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>set<sp/>the<sp/>DHCP<sp/>timers<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="191"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_timeout(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="192"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_t1_timeout(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="193"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_t2_timeout(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="194"><highlight class="normal"></highlight></codeline>
<codeline lineno="195"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>build<sp/>outgoing<sp/>messages<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="196"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>create<sp/>a<sp/>DHCP<sp/>message,<sp/>fill<sp/>in<sp/>common<sp/>headers<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="197"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>dhcp_create_msg(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>message_type);</highlight></codeline>
<codeline lineno="198"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>free<sp/>a<sp/>DHCP<sp/>request<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="199"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_delete_msg(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp);</highlight></codeline>
<codeline lineno="200"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>add<sp/>a<sp/>DHCP<sp/>option<sp/>(type,<sp/>then<sp/>length<sp/>in<sp/>bytes)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="201"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_option(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>option_type,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>option_len);</highlight></codeline>
<codeline lineno="202"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>add<sp/>option<sp/>values<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="203"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_option_byte(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>value);</highlight></codeline>
<codeline lineno="204"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_option_short(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>value);</highlight></codeline>
<codeline lineno="205"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_option_long(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>value);</highlight></codeline>
<codeline lineno="206"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_HOSTNAME</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="207"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_option_hostname(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="208"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_HOSTNAME<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="209"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>always<sp/>add<sp/>the<sp/>DHCP<sp/>options<sp/>trailer<sp/>to<sp/>end<sp/>and<sp/>pad<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="210"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_option_trailer(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp);</highlight></codeline>
<codeline lineno="211"><highlight class="normal"></highlight></codeline>
<codeline lineno="213"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="214"><highlight class="normal">dhcp_inc_pcb_refcount(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="215"><highlight class="normal">{</highlight></codeline>
<codeline lineno="216"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_pcb_refcount<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="217"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_inc_pcb_refcount():<sp/>memory<sp/>leak&quot;</highlight><highlight class="normal">,<sp/>dhcp_pcb<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="218"><highlight class="normal"></highlight></codeline>
<codeline lineno="219"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>allocate<sp/>UDP<sp/>PCB<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="220"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_pcb<sp/>=<sp/>udp_new();</highlight></codeline>
<codeline lineno="221"><highlight class="normal"></highlight></codeline>
<codeline lineno="222"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_pcb<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="223"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="225"><highlight class="normal"></highlight></codeline>
<codeline lineno="226"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ip_8h_1a13f48cf825c7f074dc05bea54e9d6a93" kindref="member">ip_set_option</ref>(dhcp_pcb,<sp/><ref refid="ip_8h_1ac8c7ccdad2d7d3a264bd8cfc57140ca8" kindref="member">SOF_BROADCAST</ref>);</highlight></codeline>
<codeline lineno="227"><highlight class="normal"></highlight></codeline>
<codeline lineno="228"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>up<sp/>local<sp/>and<sp/>remote<sp/>port<sp/>for<sp/>the<sp/>pcb<sp/>-&gt;<sp/>listen<sp/>on<sp/>all<sp/>interfaces<sp/>on<sp/>all<sp/>src/dest<sp/>IPs<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_bind(dhcp_pcb,<sp/>IP4_ADDR_ANY,<sp/><ref refid="prot_2dhcp_8h_1a23dd788b1cd28a0d834c3afefceaa1c1" kindref="member">DHCP_CLIENT_PORT</ref>);</highlight></codeline>
<codeline lineno="230"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_connect(dhcp_pcb,<sp/>IP4_ADDR_ANY,<sp/><ref refid="prot_2dhcp_8h_1a478f5be6fb4bfb09b235bb50cf806cc9" kindref="member">DHCP_SERVER_PORT</ref>);</highlight></codeline>
<codeline lineno="231"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_recv(dhcp_pcb,<sp/>dhcp_recv,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="232"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="233"><highlight class="normal"></highlight></codeline>
<codeline lineno="234"><highlight class="normal"><sp/><sp/>dhcp_pcb_refcount++;</highlight></codeline>
<codeline lineno="235"><highlight class="normal"></highlight></codeline>
<codeline lineno="236"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="237"><highlight class="normal">}</highlight></codeline>
<codeline lineno="238"><highlight class="normal"></highlight></codeline>
<codeline lineno="240"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="241"><highlight class="normal">dhcp_dec_pcb_refcount(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="242"><highlight class="normal">{</highlight></codeline>
<codeline lineno="243"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_pcb_refcount():<sp/>refcount<sp/>error&quot;</highlight><highlight class="normal">,<sp/>(dhcp_pcb_refcount<sp/>&gt;<sp/>0));</highlight></codeline>
<codeline lineno="244"><highlight class="normal"><sp/><sp/>dhcp_pcb_refcount--;</highlight></codeline>
<codeline lineno="245"><highlight class="normal"></highlight></codeline>
<codeline lineno="246"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_pcb_refcount<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="247"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_remove(dhcp_pcb);</highlight></codeline>
<codeline lineno="248"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_pcb<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="249"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="250"><highlight class="normal">}</highlight></codeline>
<codeline lineno="251"><highlight class="normal"></highlight></codeline>
<codeline lineno="264"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="265"><highlight class="normal">dhcp_handle_nak(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="266"><highlight class="normal">{</highlight></codeline>
<codeline lineno="267"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="268"><highlight class="normal"></highlight></codeline>
<codeline lineno="269"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_handle_nak(netif=%p)<sp/>%c%c%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="270"><highlight class="normal"><sp/><sp/><sp/><sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)<ref refid="structnetif" kindref="compound">netif</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[0],<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[1],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ab7ef01e505dd2feb781fe86756b1c973" kindref="member">num</ref>));</highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Change<sp/>to<sp/>a<sp/>defined<sp/>state<sp/>-<sp/>set<sp/>this<sp/>before<sp/>assigning<sp/>the<sp/>address</highlight></codeline>
<codeline lineno="272"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>to<sp/>ensure<sp/>the<sp/>callback<sp/>can<sp/>use<sp/>dhcp_supplied_address()<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/>dhcp_set_state(dhcp,<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba2dcc3cf888f75285cdc86c3574e1af44" kindref="member">DHCP_STATE_BACKING_OFF</ref>);</highlight></codeline>
<codeline lineno="274"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>remove<sp/>IP<sp/>address<sp/>from<sp/>interface<sp/>(must<sp/>no<sp/>longer<sp/>be<sp/>used,<sp/>as<sp/>per<sp/>RFC2131)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/>netif_set_addr(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>IP4_ADDR_ANY4,<sp/>IP4_ADDR_ANY4,<sp/>IP4_ADDR_ANY4);</highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>can<sp/>immediately<sp/>restart<sp/>discovery<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/>dhcp_discover(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="278"><highlight class="normal">}</highlight></codeline>
<codeline lineno="279"><highlight class="normal"></highlight></codeline>
<codeline lineno="280"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DHCP_DOES_ARP_CHECK</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="281"><highlight class="normal"></highlight></codeline>
<codeline lineno="290"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="291"><highlight class="normal">dhcp_check(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="292"><highlight class="normal">{</highlight></codeline>
<codeline lineno="293"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>result;</highlight></codeline>
<codeline lineno="295"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>msecs;</highlight></codeline>
<codeline lineno="296"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_check(netif=%p)<sp/>%c%c\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>(<ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref>)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[0],</highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref>)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[1]));</highlight></codeline>
<codeline lineno="298"><highlight class="normal"><sp/><sp/>dhcp_set_state(dhcp,<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba56d0710d1876bafdbf9a1c333d6d9ab9" kindref="member">DHCP_STATE_CHECKING</ref>);</highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>create<sp/>an<sp/>ARP<sp/>query<sp/>for<sp/>the<sp/>offered<sp/>IP<sp/>address,<sp/>expecting<sp/>that<sp/>no<sp/>host</highlight></codeline>
<codeline lineno="300"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>responds,<sp/>as<sp/>the<sp/>IP<sp/>address<sp/>should<sp/>not<sp/>be<sp/>in<sp/>use.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/>result<sp/>=<sp/>etharp_query(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;dhcp-&gt;offered_ip_addr,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="302"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(result<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="303"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga77c491e468bf7d9a1bc48430c1866a96" kindref="member">LWIP_DBG_LEVEL_WARNING</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_check:<sp/>could<sp/>not<sp/>perform<sp/>ARP<sp/>query\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="304"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="305"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;tries<sp/>&lt;<sp/>255)<sp/>{</highlight></codeline>
<codeline lineno="306"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;tries++;</highlight></codeline>
<codeline lineno="307"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/>msecs<sp/>=<sp/>500;</highlight></codeline>
<codeline lineno="309"><highlight class="normal"><sp/><sp/>dhcp-&gt;request_timeout<sp/>=<sp/>(msecs<sp/>+<sp/>DHCP_FINE_TIMER_MSECS<sp/>-<sp/>1)<sp/>/<sp/>DHCP_FINE_TIMER_MSECS;</highlight></codeline>
<codeline lineno="310"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_check():<sp/>set<sp/>request<sp/>timeout<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>msecs\n&quot;</highlight><highlight class="normal">,<sp/>msecs));</highlight></codeline>
<codeline lineno="311"><highlight class="normal">}</highlight></codeline>
<codeline lineno="312"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DHCP_DOES_ARP_CHECK<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="313"><highlight class="normal"></highlight></codeline>
<codeline lineno="319"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="320"><highlight class="normal">dhcp_handle_offer(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="321"><highlight class="normal">{</highlight></codeline>
<codeline lineno="322"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="323"><highlight class="normal"></highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_handle_offer(netif=%p)<sp/>%c%c%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="325"><highlight class="normal"><sp/><sp/><sp/><sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)<ref refid="structnetif" kindref="compound">netif</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[0],<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[1],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ab7ef01e505dd2feb781fe86756b1c973" kindref="member">num</ref>));</highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>obtain<sp/>the<sp/>server<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_option_given(dhcp,<sp/>DHCP_OPTION_IDX_SERVER_ID))<sp/>{</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/>ip_addr_set_ip4_u32(&amp;dhcp-&gt;server_ip_addr,<sp/><ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(dhcp_get_option_value(dhcp,<sp/>DHCP_OPTION_IDX_SERVER_ID)));</highlight></codeline>
<codeline lineno="329"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_handle_offer():<sp/>server<sp/>0x%08&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="330"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_get_u32(ip_2_ip4(&amp;dhcp-&gt;server_ip_addr))));</highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>offered<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_copy(dhcp-&gt;offered_ip_addr,<sp/>dhcp-&gt;msg_in-&gt;yiaddr);</highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_handle_offer():<sp/>offer<sp/>for<sp/>0x%08&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_get_u32(&amp;dhcp-&gt;offered_ip_addr)));</highlight></codeline>
<codeline lineno="335"><highlight class="normal"></highlight></codeline>
<codeline lineno="336"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_select(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="338"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,</highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_handle_offer(netif=%p)<sp/>did<sp/>not<sp/>get<sp/>server<sp/>ID!\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="340"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="341"><highlight class="normal">}</highlight></codeline>
<codeline lineno="342"><highlight class="normal"></highlight></codeline>
<codeline lineno="351"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="352"><highlight class="normal">dhcp_select(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="353"><highlight class="normal">{</highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="355"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>result;</highlight></codeline>
<codeline lineno="356"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>msecs;</highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="358"><highlight class="normal"></highlight></codeline>
<codeline lineno="359"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_select(netif=%p)<sp/>%c%c%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)<ref refid="structnetif" kindref="compound">netif</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[0],<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[1],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ab7ef01e505dd2feb781fe86756b1c973" kindref="member">num</ref>));</highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/>dhcp_set_state(dhcp,<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaba0a132e9bb9e5468d04013266e8c997" kindref="member">DHCP_STATE_REQUESTING</ref>);</highlight></codeline>
<codeline lineno="361"><highlight class="normal"></highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>create<sp/>and<sp/>initialize<sp/>the<sp/>DHCP<sp/>message<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="363"><highlight class="normal"><sp/><sp/>result<sp/>=<sp/>dhcp_create_msg(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>dhcp,<sp/><ref refid="prot_2dhcp_8h_1a98a346c53c91848070fd980a98fa77d1" kindref="member">DHCP_REQUEST</ref>);</highlight></codeline>
<codeline lineno="364"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(result<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="365"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1aabc084bbce4768f1a2ec17caa0aac858" kindref="member">DHCP_OPTION_MAX_MSG_SIZE</ref>,<sp/><ref refid="prot_2dhcp_8h_1a73960c1209385e0b3f8d9c0e4f6f438f" kindref="member">DHCP_OPTION_MAX_MSG_SIZE_LEN</ref>);</highlight></codeline>
<codeline lineno="366"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_short(dhcp,<sp/>DHCP_MAX_MSG_LEN(<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="367"><highlight class="normal"></highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>MUST<sp/>request<sp/>the<sp/>offered<sp/>IP<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="369"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1a1cbad840414a6617ebdb17b1b9073597" kindref="member">DHCP_OPTION_REQUESTED_IP</ref>,<sp/>4);</highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_long(dhcp,<sp/><ref refid="def_8h_1a56098407d66feb75806f655bafbee81d" kindref="member">lwip_ntohl</ref>(ip4_addr_get_u32(&amp;dhcp-&gt;offered_ip_addr)));</highlight></codeline>
<codeline lineno="371"><highlight class="normal"></highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1a3bdf84c273501fb73ad217dcab87bb4a" kindref="member">DHCP_OPTION_SERVER_ID</ref>,<sp/>4);</highlight></codeline>
<codeline lineno="373"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_long(dhcp,<sp/><ref refid="def_8h_1a56098407d66feb75806f655bafbee81d" kindref="member">lwip_ntohl</ref>(ip4_addr_get_u32(ip_2_ip4(&amp;dhcp-&gt;server_ip_addr))));</highlight></codeline>
<codeline lineno="374"><highlight class="normal"></highlight></codeline>
<codeline lineno="375"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1a8b484e555c18f2d20df9a2267f35bced" kindref="member">DHCP_OPTION_PARAMETER_REQUEST_LIST</ref>,<sp/><ref refid="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(dhcp_discover_request_options));</highlight></codeline>
<codeline lineno="376"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(dhcp_discover_request_options);<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="377"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_option_byte(dhcp,<sp/>dhcp_discover_request_options[i]);</highlight></codeline>
<codeline lineno="378"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="379"><highlight class="normal"></highlight></codeline>
<codeline lineno="380"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_HOSTNAME</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="381"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_hostname(dhcp,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="382"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_HOSTNAME<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="383"><highlight class="normal"></highlight></codeline>
<codeline lineno="384"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_trailer(dhcp);</highlight></codeline>
<codeline lineno="385"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>shrink<sp/>the<sp/>pbuf<sp/>to<sp/>the<sp/>actual<sp/>content<sp/>length<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="386"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga50abfe830a33a1a47a562febee66015d" kindref="member">pbuf_realloc</ref>(dhcp-&gt;p_out,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref>)<sp/>-<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref><sp/>+<sp/>dhcp-&gt;options_out_len);</highlight></codeline>
<codeline lineno="387"><highlight class="normal"></highlight></codeline>
<codeline lineno="388"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>broadcast<sp/>to<sp/>any<sp/>DHCP<sp/>server<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="389"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_sendto_if_src(dhcp_pcb,<sp/>dhcp-&gt;p_out,<sp/>IP_ADDR_BROADCAST,<sp/><ref refid="prot_2dhcp_8h_1a478f5be6fb4bfb09b235bb50cf806cc9" kindref="member">DHCP_SERVER_PORT</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>,<sp/>IP4_ADDR_ANY);</highlight></codeline>
<codeline lineno="390"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_delete_msg(dhcp);</highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_select:<sp/>REQUESTING\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="392"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="393"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga77c491e468bf7d9a1bc48430c1866a96" kindref="member">LWIP_DBG_LEVEL_WARNING</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_select:<sp/>could<sp/>not<sp/>allocate<sp/>DHCP<sp/>request\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="395"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;tries<sp/>&lt;<sp/>255)<sp/>{</highlight></codeline>
<codeline lineno="396"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;tries++;</highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="398"><highlight class="normal"><sp/><sp/>msecs<sp/>=<sp/>(dhcp-&gt;tries<sp/>&lt;<sp/>6<sp/>?<sp/>1<sp/>&lt;&lt;<sp/>dhcp-&gt;tries<sp/>:<sp/>60)<sp/>*<sp/>1000;</highlight></codeline>
<codeline lineno="399"><highlight class="normal"><sp/><sp/>dhcp-&gt;request_timeout<sp/>=<sp/>(msecs<sp/>+<sp/>DHCP_FINE_TIMER_MSECS<sp/>-<sp/>1)<sp/>/<sp/>DHCP_FINE_TIMER_MSECS;</highlight></codeline>
<codeline lineno="400"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_select():<sp/>set<sp/>request<sp/>timeout<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>msecs\n&quot;</highlight><highlight class="normal">,<sp/>msecs));</highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>result;</highlight></codeline>
<codeline lineno="402"><highlight class="normal">}</highlight></codeline>
<codeline lineno="403"><highlight class="normal"></highlight></codeline>
<codeline lineno="408"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="409"><highlight class="normal">dhcp_coarse_tmr(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="410"><highlight class="normal">{</highlight></codeline>
<codeline lineno="411"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="netif_8h_1a1c8141eaa98f6dc6dfddbb23a706656c" kindref="member">netif_list</ref>;</highlight></codeline>
<codeline lineno="412"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_coarse_tmr()\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="413"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>iterate<sp/>through<sp/>all<sp/>network<sp/>interfaces<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="414"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="415"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>only<sp/>act<sp/>on<sp/>DHCP<sp/>configured<sp/>interfaces<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="416"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="417"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((dhcp<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(dhcp-&gt;state<sp/>!=<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba041a5104e13c4ccfe4982ca3aac677b1" kindref="member">DHCP_STATE_OFF</ref>))<sp/>{</highlight></codeline>
<codeline lineno="418"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>compare<sp/>lease<sp/>time<sp/>to<sp/>expire<sp/>timeout<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="419"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;t0_timeout<sp/>&amp;&amp;<sp/>(++dhcp-&gt;lease_used<sp/>==<sp/>dhcp-&gt;t0_timeout))<sp/>{</highlight></codeline>
<codeline lineno="420"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_coarse_tmr():<sp/>t0<sp/>timeout\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="421"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>clients&apos;<sp/>lease<sp/>time<sp/>has<sp/>expired<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="422"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_release(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="423"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_discover(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="424"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>timer<sp/>is<sp/>active<sp/>(non<sp/>zero),<sp/>and<sp/>triggers<sp/>(zeroes)<sp/>now?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="425"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;t2_rebind_time<sp/>&amp;&amp;<sp/>(dhcp-&gt;t2_rebind_time--<sp/>==<sp/>1))<sp/>{</highlight></codeline>
<codeline lineno="426"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_coarse_tmr():<sp/>t2<sp/>timeout\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="427"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>clients&apos;<sp/>rebind<sp/>timeout<sp/>triggered<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_t2_timeout(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="429"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>timer<sp/>is<sp/>active<sp/>(non<sp/>zero),<sp/>and<sp/>triggers<sp/>(zeroes)<sp/>now<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="430"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;t1_renew_time<sp/>&amp;&amp;<sp/>(dhcp-&gt;t1_renew_time--<sp/>==<sp/>1))<sp/>{</highlight></codeline>
<codeline lineno="431"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_coarse_tmr():<sp/>t1<sp/>timeout\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>clients&apos;<sp/>renewal<sp/>timeout<sp/>triggered<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="433"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_t1_timeout(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="435"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>proceed<sp/>to<sp/>next<sp/>netif<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ae77736b64df442242795220d76be6b86" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="438"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="439"><highlight class="normal">}</highlight></codeline>
<codeline lineno="440"><highlight class="normal"></highlight></codeline>
<codeline lineno="448"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="449"><highlight class="normal">dhcp_fine_tmr(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="450"><highlight class="normal">{</highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="netif_8h_1a1c8141eaa98f6dc6dfddbb23a706656c" kindref="member">netif_list</ref>;</highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>loop<sp/>through<sp/>netif&apos;s<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="453"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="454"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="455"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>only<sp/>act<sp/>on<sp/>DHCP<sp/>configured<sp/>interfaces<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="456"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="457"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>timer<sp/>is<sp/>active<sp/>(non<sp/>zero),<sp/>and<sp/>is<sp/>about<sp/>to<sp/>trigger<sp/>now<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="458"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;request_timeout<sp/>&gt;<sp/>1)<sp/>{</highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp-&gt;request_timeout--;</highlight></codeline>
<codeline lineno="460"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="461"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;request_timeout<sp/>==<sp/>1)<sp/>{</highlight></codeline>
<codeline lineno="462"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp-&gt;request_timeout--;</highlight></codeline>
<codeline lineno="463"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>{<sp/>netif-&gt;dhcp-&gt;request_timeout<sp/>==<sp/>0<sp/>}<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="464"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_fine_tmr():<sp/>request<sp/>timeout\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="465"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>client&apos;s<sp/>request<sp/>timeout<sp/>triggered<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="466"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_timeout(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="467"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="468"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="469"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>proceed<sp/>to<sp/>next<sp/>network<sp/>interface<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="470"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ae77736b64df442242795220d76be6b86" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="471"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="472"><highlight class="normal">}</highlight></codeline>
<codeline lineno="473"><highlight class="normal"></highlight></codeline>
<codeline lineno="482"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="483"><highlight class="normal">dhcp_timeout(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="484"><highlight class="normal">{</highlight></codeline>
<codeline lineno="485"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="486"><highlight class="normal"></highlight></codeline>
<codeline lineno="487"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_timeout()\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="488"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>back-off<sp/>period<sp/>has<sp/>passed,<sp/>or<sp/>server<sp/>selection<sp/>timed<sp/>out<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="489"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba2dcc3cf888f75285cdc86c3574e1af44" kindref="member">DHCP_STATE_BACKING_OFF</ref>)<sp/>||<sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba8a0dca73b4731e6e475dbedc75082bc5" kindref="member">DHCP_STATE_SELECTING</ref>))<sp/>{</highlight></codeline>
<codeline lineno="490"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_timeout():<sp/>restarting<sp/>discovery\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="491"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_discover(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="492"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>receiving<sp/>the<sp/>requested<sp/>lease<sp/>timed<sp/>out<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="493"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaba0a132e9bb9e5468d04013266e8c997" kindref="member">DHCP_STATE_REQUESTING</ref>)<sp/>{</highlight></codeline>
<codeline lineno="494"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_timeout():<sp/>REQUESTING,<sp/>DHCP<sp/>request<sp/>timed<sp/>out\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="495"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;tries<sp/>&lt;=<sp/>5)<sp/>{</highlight></codeline>
<codeline lineno="496"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_select(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="497"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="498"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_timeout():<sp/>REQUESTING,<sp/>releasing,<sp/>restarting\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="499"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_release(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="500"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_discover(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="501"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="502"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DHCP_DOES_ARP_CHECK</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="503"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>received<sp/>no<sp/>ARP<sp/>reply<sp/>for<sp/>the<sp/>offered<sp/>address<sp/>(which<sp/>is<sp/>good)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="504"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba56d0710d1876bafdbf9a1c333d6d9ab9" kindref="member">DHCP_STATE_CHECKING</ref>)<sp/>{</highlight></codeline>
<codeline lineno="505"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_timeout():<sp/>CHECKING,<sp/>ARP<sp/>request<sp/>timed<sp/>out\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="506"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;tries<sp/>&lt;=<sp/>1)<sp/>{</highlight></codeline>
<codeline lineno="507"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_check(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="508"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>ARP<sp/>replies<sp/>on<sp/>the<sp/>offered<sp/>address,</highlight></codeline>
<codeline lineno="509"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>looks<sp/>like<sp/>the<sp/>IP<sp/>address<sp/>is<sp/>indeed<sp/>free<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="510"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="511"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>bind<sp/>the<sp/>interface<sp/>to<sp/>the<sp/>offered<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="512"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_bind(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="513"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="514"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DHCP_DOES_ARP_CHECK<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="515"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba59b94c72eaa1d506d9014de5c9ff5608" kindref="member">DHCP_STATE_REBOOTING</ref>)<sp/>{</highlight></codeline>
<codeline lineno="516"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;tries<sp/>&lt;<sp/>REBOOT_TRIES)<sp/>{</highlight></codeline>
<codeline lineno="517"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_reboot(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="518"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="519"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_discover(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="520"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="521"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="522"><highlight class="normal">}</highlight></codeline>
<codeline lineno="523"><highlight class="normal"></highlight></codeline>
<codeline lineno="529"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="530"><highlight class="normal">dhcp_t1_timeout(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="531"><highlight class="normal">{</highlight></codeline>
<codeline lineno="532"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="533"><highlight class="normal"></highlight></codeline>
<codeline lineno="534"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_t1_timeout()\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="535"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaba0a132e9bb9e5468d04013266e8c997" kindref="member">DHCP_STATE_REQUESTING</ref>)<sp/>||<sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba1200a3d268f2eadee62987a8d7d122e8" kindref="member">DHCP_STATE_BOUND</ref>)<sp/>||</highlight></codeline>
<codeline lineno="536"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbacd567c9a791f5112e7b5a46be86548cd" kindref="member">DHCP_STATE_RENEWING</ref>))<sp/>{</highlight></codeline>
<codeline lineno="537"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>just<sp/>retry<sp/>to<sp/>renew<sp/>-<sp/>note<sp/>that<sp/>the<sp/>rebind<sp/>timer<sp/>(t2)<sp/>will</highlight></codeline>
<codeline lineno="538"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>eventually<sp/>time-out<sp/>if<sp/>renew<sp/>tries<sp/>fail.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="539"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,</highlight></codeline>
<codeline lineno="540"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_t1_timeout():<sp/>must<sp/>renew\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="541"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>slightly<sp/>different<sp/>to<sp/>RFC2131:<sp/>DHCPREQUEST<sp/>will<sp/>be<sp/>sent<sp/>from<sp/>state</highlight></codeline>
<codeline lineno="542"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>DHCP_STATE_RENEWING,<sp/>not<sp/>DHCP_STATE_BOUND<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="543"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_renew(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="544"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Calculate<sp/>next<sp/>timeout<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="545"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(((dhcp-&gt;t2_timeout<sp/>-<sp/>dhcp-&gt;lease_used)<sp/>/<sp/>2)<sp/>&gt;=<sp/>((60<sp/>+<sp/>DHCP_COARSE_TIMER_SECS<sp/>/<sp/>2)<sp/>/<sp/>DHCP_COARSE_TIMER_SECS))</highlight></codeline>
<codeline lineno="546"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="547"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp-&gt;t1_renew_time<sp/>=<sp/>((dhcp-&gt;t2_timeout<sp/>-<sp/>dhcp-&gt;lease_used)<sp/>/<sp/>2);</highlight></codeline>
<codeline lineno="548"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="549"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="550"><highlight class="normal">}</highlight></codeline>
<codeline lineno="551"><highlight class="normal"></highlight></codeline>
<codeline lineno="557"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="558"><highlight class="normal">dhcp_t2_timeout(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="559"><highlight class="normal">{</highlight></codeline>
<codeline lineno="560"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="561"><highlight class="normal"></highlight></codeline>
<codeline lineno="562"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_t2_timeout()\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="563"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaba0a132e9bb9e5468d04013266e8c997" kindref="member">DHCP_STATE_REQUESTING</ref>)<sp/>||<sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba1200a3d268f2eadee62987a8d7d122e8" kindref="member">DHCP_STATE_BOUND</ref>)<sp/>||</highlight></codeline>
<codeline lineno="564"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbacd567c9a791f5112e7b5a46be86548cd" kindref="member">DHCP_STATE_RENEWING</ref>)<sp/>||<sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaf55c3505a4745661f94134f8ccaa6c27" kindref="member">DHCP_STATE_REBINDING</ref>))<sp/>{</highlight></codeline>
<codeline lineno="565"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>just<sp/>retry<sp/>to<sp/>rebind<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="566"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,</highlight></codeline>
<codeline lineno="567"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_t2_timeout():<sp/>must<sp/>rebind\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="568"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>slightly<sp/>different<sp/>to<sp/>RFC2131:<sp/>DHCPREQUEST<sp/>will<sp/>be<sp/>sent<sp/>from<sp/>state</highlight></codeline>
<codeline lineno="569"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>DHCP_STATE_REBINDING,<sp/>not<sp/>DHCP_STATE_BOUND<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="570"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_rebind(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="571"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Calculate<sp/>next<sp/>timeout<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="572"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(((dhcp-&gt;t0_timeout<sp/>-<sp/>dhcp-&gt;lease_used)<sp/>/<sp/>2)<sp/>&gt;=<sp/>((60<sp/>+<sp/>DHCP_COARSE_TIMER_SECS<sp/>/<sp/>2)<sp/>/<sp/>DHCP_COARSE_TIMER_SECS))</highlight></codeline>
<codeline lineno="573"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="574"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp-&gt;t2_rebind_time<sp/>=<sp/>((dhcp-&gt;t0_timeout<sp/>-<sp/>dhcp-&gt;lease_used)<sp/>/<sp/>2);</highlight></codeline>
<codeline lineno="575"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="576"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="577"><highlight class="normal">}</highlight></codeline>
<codeline lineno="578"><highlight class="normal"></highlight></codeline>
<codeline lineno="584"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="585"><highlight class="normal">dhcp_handle_ack(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="586"><highlight class="normal">{</highlight></codeline>
<codeline lineno="587"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="588"><highlight class="normal"></highlight></codeline>
<codeline lineno="589"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS<sp/>||<sp/>LWIP_DHCP_GET_NTP_SRV</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="590"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>n;</highlight></codeline>
<codeline lineno="591"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS<sp/>||<sp/>LWIP_DHCP_GET_NTP_SRV<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="592"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_GET_NTP_SRV</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="593"><highlight class="normal"><sp/><sp/>ip4_addr_t<sp/>ntp_server_addrs[<ref refid="lwipopts_8h_1a9d014e3f7dc9e1e7c7decd8652ba65e2" kindref="member">LWIP_DHCP_MAX_NTP_SERVERS</ref>];</highlight></codeline>
<codeline lineno="594"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="595"><highlight class="normal"></highlight></codeline>
<codeline lineno="596"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>clear<sp/>options<sp/>we<sp/>might<sp/>not<sp/>get<sp/>from<sp/>the<sp/>ACK<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="597"><highlight class="normal"><sp/><sp/>ip4_addr_set_zero(&amp;dhcp-&gt;offered_sn_mask);</highlight></codeline>
<codeline lineno="598"><highlight class="normal"><sp/><sp/>ip4_addr_set_zero(&amp;dhcp-&gt;offered_gw_addr);</highlight></codeline>
<codeline lineno="599"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_BOOTP_FILE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="600"><highlight class="normal"><sp/><sp/>ip4_addr_set_zero(&amp;dhcp-&gt;offered_si_addr);</highlight></codeline>
<codeline lineno="601"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_BOOTP_FILE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="602"><highlight class="normal"></highlight></codeline>
<codeline lineno="603"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>lease<sp/>time<sp/>given?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="604"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_option_given(dhcp,<sp/>DHCP_OPTION_IDX_LEASE_TIME))<sp/>{</highlight></codeline>
<codeline lineno="605"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>offered<sp/>lease<sp/>time<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="606"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;offered_t0_lease<sp/>=<sp/>dhcp_get_option_value(dhcp,<sp/>DHCP_OPTION_IDX_LEASE_TIME);</highlight></codeline>
<codeline lineno="607"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="608"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>renewal<sp/>period<sp/>given?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="609"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_option_given(dhcp,<sp/>DHCP_OPTION_IDX_T1))<sp/>{</highlight></codeline>
<codeline lineno="610"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>given<sp/>renewal<sp/>period<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="611"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;offered_t1_renew<sp/>=<sp/>dhcp_get_option_value(dhcp,<sp/>DHCP_OPTION_IDX_T1);</highlight></codeline>
<codeline lineno="612"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="613"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>calculate<sp/>safe<sp/>periods<sp/>for<sp/>renewal<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="614"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;offered_t1_renew<sp/>=<sp/>dhcp-&gt;offered_t0_lease<sp/>/<sp/>2;</highlight></codeline>
<codeline lineno="615"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="616"><highlight class="normal"></highlight></codeline>
<codeline lineno="617"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>renewal<sp/>period<sp/>given?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="618"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_option_given(dhcp,<sp/>DHCP_OPTION_IDX_T2))<sp/>{</highlight></codeline>
<codeline lineno="619"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>given<sp/>rebind<sp/>period<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="620"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;offered_t2_rebind<sp/>=<sp/>dhcp_get_option_value(dhcp,<sp/>DHCP_OPTION_IDX_T2);</highlight></codeline>
<codeline lineno="621"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="622"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>calculate<sp/>safe<sp/>periods<sp/>for<sp/>rebinding<sp/>(offered_t0_lease<sp/>*<sp/>0.875<sp/>-&gt;<sp/>87.5%)*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="623"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;offered_t2_rebind<sp/>=<sp/>(dhcp-&gt;offered_t0_lease<sp/>*<sp/>7U)<sp/>/<sp/>8U;</highlight></codeline>
<codeline lineno="624"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="625"><highlight class="normal"></highlight></codeline>
<codeline lineno="626"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>(y)our<sp/>internet<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="627"><highlight class="normal"><sp/><sp/>ip4_addr_copy(dhcp-&gt;offered_ip_addr,<sp/>dhcp-&gt;msg_in-&gt;yiaddr);</highlight></codeline>
<codeline lineno="628"><highlight class="normal"></highlight></codeline>
<codeline lineno="629"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_BOOTP_FILE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="630"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>boot<sp/>server<sp/>address,</highlight></codeline>
<codeline lineno="631"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>boot<sp/>file<sp/>name<sp/>copied<sp/>in<sp/>dhcp_parse_reply<sp/>if<sp/>not<sp/>overloaded<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="632"><highlight class="normal"><sp/><sp/>ip4_addr_copy(dhcp-&gt;offered_si_addr,<sp/>dhcp-&gt;msg_in-&gt;siaddr);</highlight></codeline>
<codeline lineno="633"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_BOOTP_FILE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="634"><highlight class="normal"></highlight></codeline>
<codeline lineno="635"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>subnet<sp/>mask<sp/>given?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="636"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_option_given(dhcp,<sp/>DHCP_OPTION_IDX_SUBNET_MASK))<sp/>{</highlight></codeline>
<codeline lineno="637"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>given<sp/>subnet<sp/>mask<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="638"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_set_u32(&amp;dhcp-&gt;offered_sn_mask,<sp/><ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(dhcp_get_option_value(dhcp,<sp/>DHCP_OPTION_IDX_SUBNET_MASK)));</highlight></codeline>
<codeline lineno="639"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;subnet_mask_given<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="640"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="641"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;subnet_mask_given<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="642"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="643"><highlight class="normal"></highlight></codeline>
<codeline lineno="644"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>gateway<sp/>router<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="645"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_option_given(dhcp,<sp/>DHCP_OPTION_IDX_ROUTER))<sp/>{</highlight></codeline>
<codeline lineno="646"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_set_u32(&amp;dhcp-&gt;offered_gw_addr,<sp/><ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(dhcp_get_option_value(dhcp,<sp/>DHCP_OPTION_IDX_ROUTER)));</highlight></codeline>
<codeline lineno="647"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="648"><highlight class="normal"></highlight></codeline>
<codeline lineno="649"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_GET_NTP_SRV</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="650"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>NTP<sp/>servers<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="651"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(n<sp/>=<sp/>0;<sp/>(n<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a9d014e3f7dc9e1e7c7decd8652ba65e2" kindref="member">LWIP_DHCP_MAX_NTP_SERVERS</ref>)<sp/>&amp;&amp;<sp/>dhcp_option_given(dhcp,<sp/>DHCP_OPTION_IDX_NTP_SERVER<sp/>+<sp/>n);<sp/>n++)<sp/>{</highlight></codeline>
<codeline lineno="652"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_set_u32(&amp;ntp_server_addrs[n],<sp/><ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(dhcp_get_option_value(dhcp,<sp/>DHCP_OPTION_IDX_NTP_SERVER<sp/>+<sp/>n)));</highlight></codeline>
<codeline lineno="653"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="654"><highlight class="normal"><sp/><sp/>dhcp_set_ntp_servers(n,<sp/>ntp_server_addrs);</highlight></codeline>
<codeline lineno="655"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_GET_NTP_SRV<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="656"><highlight class="normal"></highlight></codeline>
<codeline lineno="657"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="658"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>DNS<sp/>servers<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="659"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(n<sp/>=<sp/>0;<sp/>(n<sp/>&lt;<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS)<sp/>&amp;&amp;<sp/>dhcp_option_given(dhcp,<sp/>DHCP_OPTION_IDX_DNS_SERVER<sp/>+<sp/>n);<sp/>n++)<sp/>{</highlight></codeline>
<codeline lineno="660"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>dns_addr;</highlight></codeline>
<codeline lineno="661"><highlight class="normal"><sp/><sp/><sp/><sp/>ip_addr_set_ip4_u32(&amp;dns_addr,<sp/><ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(dhcp_get_option_value(dhcp,<sp/>DHCP_OPTION_IDX_DNS_SERVER<sp/>+<sp/>n)));</highlight></codeline>
<codeline lineno="662"><highlight class="normal"><sp/><sp/><sp/><sp/>dns_setserver(n,<sp/>&amp;dns_addr);</highlight></codeline>
<codeline lineno="663"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="664"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="665"><highlight class="normal">}</highlight></codeline>
<codeline lineno="666"><highlight class="normal"></highlight></codeline>
<codeline lineno="675"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="676"><highlight class="normal">dhcp_set_struct(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp)</highlight></codeline>
<codeline lineno="677"><highlight class="normal">{</highlight></codeline>
<codeline lineno="678"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;netif<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="679"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>dhcp<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="680"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;netif<sp/>already<sp/>has<sp/>a<sp/>struct<sp/>dhcp<sp/>set&quot;</highlight><highlight class="normal">,<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>)<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="681"><highlight class="normal"></highlight></codeline>
<codeline lineno="682"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>clear<sp/>data<sp/>structure<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="683"><highlight class="normal"><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(dhcp,<sp/>0,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp));</highlight></codeline>
<codeline lineno="684"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>dhcp_set_state(&amp;dhcp,<sp/>DHCP_STATE_OFF);<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="685"><highlight class="normal"><sp/><sp/>netif_set_client_data(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>LWIP_NETIF_CLIENT_DATA_INDEX_DHCP,<sp/>dhcp);</highlight></codeline>
<codeline lineno="686"><highlight class="normal">}</highlight></codeline>
<codeline lineno="687"><highlight class="normal"></highlight></codeline>
<codeline lineno="697"><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dhcp_cleanup(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="698"><highlight class="normal">{</highlight></codeline>
<codeline lineno="699"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;netif<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="700"><highlight class="normal"></highlight></codeline>
<codeline lineno="701"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>)<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="702"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="mem_8h_1a2fd7aa1adf6e394d3be7c7734e7df41a" kindref="member">mem_free</ref>(netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="703"><highlight class="normal"><sp/><sp/><sp/><sp/>netif_set_client_data(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>LWIP_NETIF_CLIENT_DATA_INDEX_DHCP,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="704"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="705"><highlight class="normal">}</highlight></codeline>
<codeline lineno="706"><highlight class="normal"></highlight></codeline>
<codeline lineno="720"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="721"><highlight class="normal">dhcp_start(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="722"><highlight class="normal">{</highlight></codeline>
<codeline lineno="723"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp;</highlight></codeline>
<codeline lineno="724"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>result;</highlight></codeline>
<codeline lineno="725"><highlight class="normal"></highlight></codeline>
<codeline lineno="726"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netif<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="727"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netif<sp/>is<sp/>not<sp/>up,<sp/>old<sp/>style<sp/>port?&quot;</highlight><highlight class="normal">,<sp/><ref refid="group__netif_1ga94a4c24c988afc0a577387730f303b19" kindref="member">netif_is_up</ref>(<ref refid="structnetif" kindref="compound">netif</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="728"><highlight class="normal"><sp/><sp/>dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="729"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_start(netif=%p)<sp/>%c%c%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)<ref refid="structnetif" kindref="compound">netif</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[0],<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[1],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ab7ef01e505dd2feb781fe86756b1c973" kindref="member">num</ref>));</highlight></codeline>
<codeline lineno="730"><highlight class="normal"></highlight></codeline>
<codeline lineno="731"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>check<sp/>MTU<sp/>of<sp/>the<sp/>netif<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="732"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aca7d56b4e0f822b0ced2885f222b8d48" kindref="member">mtu</ref><sp/>&lt;<sp/>DHCP_MAX_MSG_LEN_MIN_REQUIRED)<sp/>{</highlight></codeline>
<codeline lineno="733"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_start():<sp/>Cannot<sp/>use<sp/>this<sp/>netif<sp/>with<sp/>DHCP:<sp/>MTU<sp/>is<sp/>too<sp/>small\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="734"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="735"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="736"><highlight class="normal"></highlight></codeline>
<codeline lineno="737"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>DHCP<sp/>client<sp/>attached<sp/>yet?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="738"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="739"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_start():<sp/>mallocing<sp/>new<sp/>DHCP<sp/>client\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="740"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*)<ref refid="mem_8h_1a932aa40d85b14cb7331625e012d12335" kindref="member">mem_malloc</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp));</highlight></codeline>
<codeline lineno="741"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="742"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_start():<sp/>could<sp/>not<sp/>allocate<sp/>dhcp\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="743"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="744"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="745"><highlight class="normal"></highlight></codeline>
<codeline lineno="746"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>store<sp/>this<sp/>dhcp<sp/>client<sp/>in<sp/>the<sp/>netif<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="747"><highlight class="normal"><sp/><sp/><sp/><sp/>netif_set_client_data(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>LWIP_NETIF_CLIENT_DATA_INDEX_DHCP,<sp/>dhcp);</highlight></codeline>
<codeline lineno="748"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_start():<sp/>allocated<sp/>dhcp&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="749"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>already<sp/>has<sp/>DHCP<sp/>client<sp/>attached<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="750"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="751"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_start():<sp/>restarting<sp/>DHCP<sp/>configuration\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="752"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf<sp/>p_out<sp/>wasn&apos;t<sp/>freed&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;p_out<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="753"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;reply<sp/>wasn&apos;t<sp/>freed&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;msg_in<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>);</highlight></codeline>
<codeline lineno="754"><highlight class="normal"></highlight></codeline>
<codeline lineno="755"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;pcb_allocated<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="756"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_dec_pcb_refcount();<sp/></highlight><highlight class="comment">/*<sp/>free<sp/>DHCP<sp/>PCB<sp/>if<sp/>not<sp/>needed<sp/>any<sp/>more<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="757"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="758"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>dhcp<sp/>is<sp/>cleared<sp/>below,<sp/>no<sp/>need<sp/>to<sp/>reset<sp/>flag*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="759"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="760"><highlight class="normal"></highlight></codeline>
<codeline lineno="761"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>clear<sp/>data<sp/>structure<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="762"><highlight class="normal"><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(dhcp,<sp/>0,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp));</highlight></codeline>
<codeline lineno="763"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>dhcp_set_state(&amp;dhcp,<sp/>DHCP_STATE_OFF);<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="764"><highlight class="normal"></highlight></codeline>
<codeline lineno="765"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_start():<sp/>starting<sp/>DHCP<sp/>configuration\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="766"><highlight class="normal"></highlight></codeline>
<codeline lineno="767"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_inc_pcb_refcount()<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{<sp/></highlight><highlight class="comment">/*<sp/>ensure<sp/>DHCP<sp/>PCB<sp/>is<sp/>allocated<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="768"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="769"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="770"><highlight class="normal"><sp/><sp/>dhcp-&gt;pcb_allocated<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="771"><highlight class="normal"></highlight></codeline>
<codeline lineno="772"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_CHECK_LINK_UP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="773"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="netif_8h_1a780be4c3fa9f7f2534f7865666c3a1b8" kindref="member">netif_is_link_up</ref>(<ref refid="structnetif" kindref="compound">netif</ref>))<sp/>{</highlight></codeline>
<codeline lineno="774"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>state<sp/>INIT<sp/>and<sp/>wait<sp/>for<sp/>dhcp_network_changed()<sp/>to<sp/>call<sp/>dhcp_discover()<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="775"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_set_state(dhcp,<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba04ab7401642e6e7d7dff940bf1c6ebc0" kindref="member">DHCP_STATE_INIT</ref>);</highlight></codeline>
<codeline lineno="776"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="777"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="778"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_CHECK_LINK_UP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="779"><highlight class="normal"></highlight></codeline>
<codeline lineno="780"><highlight class="normal"></highlight></codeline>
<codeline lineno="781"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>(re)start<sp/>the<sp/>DHCP<sp/>negotiation<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="782"><highlight class="normal"><sp/><sp/>result<sp/>=<sp/>dhcp_discover(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="783"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(result<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="784"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>free<sp/>resources<sp/>allocated<sp/>above<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="785"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_stop(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="786"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="787"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="788"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>result;</highlight></codeline>
<codeline lineno="789"><highlight class="normal">}</highlight></codeline>
<codeline lineno="790"><highlight class="normal"></highlight></codeline>
<codeline lineno="801"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="802"><highlight class="normal">dhcp_inform(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="803"><highlight class="normal">{</highlight></codeline>
<codeline lineno="804"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>dhcp;</highlight></codeline>
<codeline lineno="805"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>result<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="806"><highlight class="normal"></highlight></codeline>
<codeline lineno="807"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netif<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;);</highlight></codeline>
<codeline lineno="808"><highlight class="normal"></highlight></codeline>
<codeline lineno="809"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_inc_pcb_refcount()<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{<sp/></highlight><highlight class="comment">/*<sp/>ensure<sp/>DHCP<sp/>PCB<sp/>is<sp/>allocated<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="810"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="811"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="812"><highlight class="normal"></highlight></codeline>
<codeline lineno="813"><highlight class="normal"><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(&amp;dhcp,<sp/>0,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp));</highlight></codeline>
<codeline lineno="814"><highlight class="normal"><sp/><sp/>dhcp_set_state(&amp;dhcp,<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaf9a6f1bd1a701f3047c542bde1d42ce8" kindref="member">DHCP_STATE_INFORMING</ref>);</highlight></codeline>
<codeline lineno="815"><highlight class="normal"></highlight></codeline>
<codeline lineno="816"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>create<sp/>and<sp/>initialize<sp/>the<sp/>DHCP<sp/>message<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="817"><highlight class="normal"><sp/><sp/>result<sp/>=<sp/>dhcp_create_msg(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;dhcp,<sp/><ref refid="prot_2dhcp_8h_1aaea6a969c0da81c2611885514bbe433f" kindref="member">DHCP_INFORM</ref>);</highlight></codeline>
<codeline lineno="818"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(result<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="819"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(&amp;dhcp,<sp/><ref refid="prot_2dhcp_8h_1aabc084bbce4768f1a2ec17caa0aac858" kindref="member">DHCP_OPTION_MAX_MSG_SIZE</ref>,<sp/><ref refid="prot_2dhcp_8h_1a73960c1209385e0b3f8d9c0e4f6f438f" kindref="member">DHCP_OPTION_MAX_MSG_SIZE_LEN</ref>);</highlight></codeline>
<codeline lineno="820"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_short(&amp;dhcp,<sp/>DHCP_MAX_MSG_LEN(<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="821"><highlight class="normal"></highlight></codeline>
<codeline lineno="822"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_trailer(&amp;dhcp);</highlight></codeline>
<codeline lineno="823"><highlight class="normal"></highlight></codeline>
<codeline lineno="824"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga50abfe830a33a1a47a562febee66015d" kindref="member">pbuf_realloc</ref>(dhcp.p_out,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref>)<sp/>-<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref><sp/>+<sp/>dhcp.options_out_len);</highlight></codeline>
<codeline lineno="825"><highlight class="normal"></highlight></codeline>
<codeline lineno="826"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_inform:<sp/>INFORMING\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="827"><highlight class="normal"></highlight></codeline>
<codeline lineno="828"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_sendto_if(dhcp_pcb,<sp/>dhcp.p_out,<sp/>IP_ADDR_BROADCAST,<sp/><ref refid="prot_2dhcp_8h_1a478f5be6fb4bfb09b235bb50cf806cc9" kindref="member">DHCP_SERVER_PORT</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="829"><highlight class="normal"></highlight></codeline>
<codeline lineno="830"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_delete_msg(&amp;dhcp);</highlight></codeline>
<codeline lineno="831"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="832"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_inform:<sp/>could<sp/>not<sp/>allocate<sp/>DHCP<sp/>request\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="833"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="834"><highlight class="normal"></highlight></codeline>
<codeline lineno="835"><highlight class="normal"><sp/><sp/>dhcp_dec_pcb_refcount();<sp/></highlight><highlight class="comment">/*<sp/>delete<sp/>DHCP<sp/>PCB<sp/>if<sp/>not<sp/>needed<sp/>any<sp/>more<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="836"><highlight class="normal">}</highlight></codeline>
<codeline lineno="837"><highlight class="normal"></highlight></codeline>
<codeline lineno="843"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="844"><highlight class="normal">dhcp_network_changed(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="845"><highlight class="normal">{</highlight></codeline>
<codeline lineno="846"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="847"><highlight class="normal"></highlight></codeline>
<codeline lineno="848"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!dhcp)</highlight></codeline>
<codeline lineno="849"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="850"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(dhcp-&gt;state)<sp/>{</highlight></codeline>
<codeline lineno="851"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaf55c3505a4745661f94134f8ccaa6c27" kindref="member">DHCP_STATE_REBINDING</ref>:</highlight></codeline>
<codeline lineno="852"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbacd567c9a791f5112e7b5a46be86548cd" kindref="member">DHCP_STATE_RENEWING</ref>:</highlight></codeline>
<codeline lineno="853"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba1200a3d268f2eadee62987a8d7d122e8" kindref="member">DHCP_STATE_BOUND</ref>:</highlight></codeline>
<codeline lineno="854"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba59b94c72eaa1d506d9014de5c9ff5608" kindref="member">DHCP_STATE_REBOOTING</ref>:</highlight></codeline>
<codeline lineno="855"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;tries<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="856"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_reboot(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="857"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="858"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba041a5104e13c4ccfe4982ca3aac677b1" kindref="member">DHCP_STATE_OFF</ref>:</highlight></codeline>
<codeline lineno="859"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>stay<sp/>off<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="860"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="861"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="862"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>INIT/REQUESTING/CHECKING/BACKING_OFF<sp/>restart<sp/>with<sp/>new<sp/>&apos;rid&apos;<sp/>because<sp/>the</highlight></codeline>
<codeline lineno="863"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>state<sp/>changes,<sp/>SELECTING:<sp/>continue<sp/>with<sp/>current<sp/>&apos;rid&apos;<sp/>as<sp/>we<sp/>stay<sp/>in<sp/>the</highlight></codeline>
<codeline lineno="864"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>same<sp/>state<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="865"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_AUTOIP_COOP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="866"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;autoip_coop_state<sp/>==<sp/>DHCP_AUTOIP_COOP_STATE_ON)<sp/>{</highlight></codeline>
<codeline lineno="867"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>autoip_stop(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="868"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp-&gt;autoip_coop_state<sp/>=<sp/>DHCP_AUTOIP_COOP_STATE_OFF;</highlight></codeline>
<codeline lineno="869"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="870"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_AUTOIP_COOP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="871"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>ensure<sp/>we<sp/>start<sp/>with<sp/>short<sp/>timeouts,<sp/>even<sp/>if<sp/>already<sp/>discovering<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="872"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;tries<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="873"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_discover(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="874"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="875"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="876"><highlight class="normal">}</highlight></codeline>
<codeline lineno="877"><highlight class="normal"></highlight></codeline>
<codeline lineno="878"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DHCP_DOES_ARP_CHECK</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="879"><highlight class="normal"></highlight></codeline>
<codeline lineno="886"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="887"><highlight class="normal">dhcp_arp_reply(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*addr)</highlight></codeline>
<codeline lineno="888"><highlight class="normal">{</highlight></codeline>
<codeline lineno="889"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp;</highlight></codeline>
<codeline lineno="890"><highlight class="normal"></highlight></codeline>
<codeline lineno="891"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netif<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;);</highlight></codeline>
<codeline lineno="892"><highlight class="normal"><sp/><sp/>dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="893"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_arp_reply()\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="894"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>is<sp/>a<sp/>DHCP<sp/>client<sp/>doing<sp/>an<sp/>ARP<sp/>check?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="895"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((dhcp<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba56d0710d1876bafdbf9a1c333d6d9ab9" kindref="member">DHCP_STATE_CHECKING</ref>))<sp/>{</highlight></codeline>
<codeline lineno="896"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_arp_reply():<sp/>CHECKING,<sp/>arp<sp/>reply<sp/>for<sp/>0x%08&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="897"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_get_u32(addr)));</highlight></codeline>
<codeline lineno="898"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>did<sp/>a<sp/>host<sp/>respond<sp/>with<sp/>the<sp/>address<sp/>we</highlight></codeline>
<codeline lineno="899"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>were<sp/>offered<sp/>by<sp/>the<sp/>DHCP<sp/>server?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="900"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_cmp(addr,<sp/>&amp;dhcp-&gt;offered_ip_addr))<sp/>{</highlight></codeline>
<codeline lineno="901"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>we<sp/>will<sp/>not<sp/>accept<sp/>the<sp/>offered<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="902"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga77c491e468bf7d9a1bc48430c1866a96" kindref="member">LWIP_DBG_LEVEL_WARNING</ref>,</highlight></codeline>
<codeline lineno="903"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_arp_reply():<sp/>arp<sp/>reply<sp/>matched<sp/>with<sp/>offered<sp/>address,<sp/>declining\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="904"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_decline(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="905"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="906"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="907"><highlight class="normal">}</highlight></codeline>
<codeline lineno="908"><highlight class="normal"></highlight></codeline>
<codeline lineno="918"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="919"><highlight class="normal">dhcp_decline(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="920"><highlight class="normal">{</highlight></codeline>
<codeline lineno="921"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="922"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>result<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="923"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>msecs;</highlight></codeline>
<codeline lineno="924"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_decline()\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="925"><highlight class="normal"><sp/><sp/>dhcp_set_state(dhcp,<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba2dcc3cf888f75285cdc86c3574e1af44" kindref="member">DHCP_STATE_BACKING_OFF</ref>);</highlight></codeline>
<codeline lineno="926"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>create<sp/>and<sp/>initialize<sp/>the<sp/>DHCP<sp/>message<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="927"><highlight class="normal"><sp/><sp/>result<sp/>=<sp/>dhcp_create_msg(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>dhcp,<sp/><ref refid="prot_2dhcp_8h_1ae7469660afdf7997c020f7fbf5164548" kindref="member">DHCP_DECLINE</ref>);</highlight></codeline>
<codeline lineno="928"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(result<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="929"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1a1cbad840414a6617ebdb17b1b9073597" kindref="member">DHCP_OPTION_REQUESTED_IP</ref>,<sp/>4);</highlight></codeline>
<codeline lineno="930"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_long(dhcp,<sp/><ref refid="def_8h_1a56098407d66feb75806f655bafbee81d" kindref="member">lwip_ntohl</ref>(ip4_addr_get_u32(&amp;dhcp-&gt;offered_ip_addr)));</highlight></codeline>
<codeline lineno="931"><highlight class="normal"></highlight></codeline>
<codeline lineno="932"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_trailer(dhcp);</highlight></codeline>
<codeline lineno="933"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>resize<sp/>pbuf<sp/>to<sp/>reflect<sp/>true<sp/>size<sp/>of<sp/>options<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="934"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga50abfe830a33a1a47a562febee66015d" kindref="member">pbuf_realloc</ref>(dhcp-&gt;p_out,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref>)<sp/>-<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref><sp/>+<sp/>dhcp-&gt;options_out_len);</highlight></codeline>
<codeline lineno="935"><highlight class="normal"></highlight></codeline>
<codeline lineno="936"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>per<sp/>section<sp/>4.4.4,<sp/>broadcast<sp/>DECLINE<sp/>messages<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="937"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_sendto_if_src(dhcp_pcb,<sp/>dhcp-&gt;p_out,<sp/>IP_ADDR_BROADCAST,<sp/><ref refid="prot_2dhcp_8h_1a478f5be6fb4bfb09b235bb50cf806cc9" kindref="member">DHCP_SERVER_PORT</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>,<sp/>IP4_ADDR_ANY);</highlight></codeline>
<codeline lineno="938"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_delete_msg(dhcp);</highlight></codeline>
<codeline lineno="939"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_decline:<sp/>BACKING<sp/>OFF\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="940"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="941"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,</highlight></codeline>
<codeline lineno="942"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_decline:<sp/>could<sp/>not<sp/>allocate<sp/>DHCP<sp/>request\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="943"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="944"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;tries<sp/>&lt;<sp/>255)<sp/>{</highlight></codeline>
<codeline lineno="945"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;tries++;</highlight></codeline>
<codeline lineno="946"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="947"><highlight class="normal"><sp/><sp/>msecs<sp/>=<sp/>10*1000;</highlight></codeline>
<codeline lineno="948"><highlight class="normal"><sp/><sp/>dhcp-&gt;request_timeout<sp/>=<sp/>(msecs<sp/>+<sp/>DHCP_FINE_TIMER_MSECS<sp/>-<sp/>1)<sp/>/<sp/>DHCP_FINE_TIMER_MSECS;</highlight></codeline>
<codeline lineno="949"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_decline():<sp/>set<sp/>request<sp/>timeout<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>msecs\n&quot;</highlight><highlight class="normal">,<sp/>msecs));</highlight></codeline>
<codeline lineno="950"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>result;</highlight></codeline>
<codeline lineno="951"><highlight class="normal">}</highlight></codeline>
<codeline lineno="952"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DHCP_DOES_ARP_CHECK<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="953"><highlight class="normal"></highlight></codeline>
<codeline lineno="954"><highlight class="normal"></highlight></codeline>
<codeline lineno="960"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="961"><highlight class="normal">dhcp_discover(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="962"><highlight class="normal">{</highlight></codeline>
<codeline lineno="963"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="964"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>result<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="965"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>msecs;</highlight></codeline>
<codeline lineno="966"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="967"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_discover()\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="968"><highlight class="normal"><sp/><sp/>ip4_addr_set_any(&amp;dhcp-&gt;offered_ip_addr);</highlight></codeline>
<codeline lineno="969"><highlight class="normal"><sp/><sp/>dhcp_set_state(dhcp,<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba8a0dca73b4731e6e475dbedc75082bc5" kindref="member">DHCP_STATE_SELECTING</ref>);</highlight></codeline>
<codeline lineno="970"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>create<sp/>and<sp/>initialize<sp/>the<sp/>DHCP<sp/>message<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="971"><highlight class="normal"><sp/><sp/>result<sp/>=<sp/>dhcp_create_msg(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>dhcp,<sp/><ref refid="prot_2dhcp_8h_1a368aca81d0a71853aa3939f546cc25ae" kindref="member">DHCP_DISCOVER</ref>);</highlight></codeline>
<codeline lineno="972"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(result<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="973"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_discover:<sp/>making<sp/>request\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="974"><highlight class="normal"></highlight></codeline>
<codeline lineno="975"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1aabc084bbce4768f1a2ec17caa0aac858" kindref="member">DHCP_OPTION_MAX_MSG_SIZE</ref>,<sp/><ref refid="prot_2dhcp_8h_1a73960c1209385e0b3f8d9c0e4f6f438f" kindref="member">DHCP_OPTION_MAX_MSG_SIZE_LEN</ref>);</highlight></codeline>
<codeline lineno="976"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_short(dhcp,<sp/>DHCP_MAX_MSG_LEN(<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="977"><highlight class="normal"></highlight></codeline>
<codeline lineno="978"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1a8b484e555c18f2d20df9a2267f35bced" kindref="member">DHCP_OPTION_PARAMETER_REQUEST_LIST</ref>,<sp/><ref refid="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(dhcp_discover_request_options));</highlight></codeline>
<codeline lineno="979"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(dhcp_discover_request_options);<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="980"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_option_byte(dhcp,<sp/>dhcp_discover_request_options[i]);</highlight></codeline>
<codeline lineno="981"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="982"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_trailer(dhcp);</highlight></codeline>
<codeline lineno="983"><highlight class="normal"></highlight></codeline>
<codeline lineno="984"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_discover:<sp/>realloc()ing\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="985"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga50abfe830a33a1a47a562febee66015d" kindref="member">pbuf_realloc</ref>(dhcp-&gt;p_out,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref>)<sp/>-<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref><sp/>+<sp/>dhcp-&gt;options_out_len);</highlight></codeline>
<codeline lineno="986"><highlight class="normal"></highlight></codeline>
<codeline lineno="987"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_discover:<sp/>sendto(DISCOVER,<sp/>IP_ADDR_BROADCAST,<sp/>DHCP_SERVER_PORT)\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="988"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_sendto_if_src(dhcp_pcb,<sp/>dhcp-&gt;p_out,<sp/>IP_ADDR_BROADCAST,<sp/><ref refid="prot_2dhcp_8h_1a478f5be6fb4bfb09b235bb50cf806cc9" kindref="member">DHCP_SERVER_PORT</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>,<sp/>IP4_ADDR_ANY);</highlight></codeline>
<codeline lineno="989"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_discover:<sp/>deleting()ing\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="990"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_delete_msg(dhcp);</highlight></codeline>
<codeline lineno="991"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_discover:<sp/>SELECTING\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="992"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="993"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_discover:<sp/>could<sp/>not<sp/>allocate<sp/>DHCP<sp/>request\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="994"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="995"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;tries<sp/>&lt;<sp/>255)<sp/>{</highlight></codeline>
<codeline lineno="996"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;tries++;</highlight></codeline>
<codeline lineno="997"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="998"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_AUTOIP_COOP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="999"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;tries<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a4ff3f941b4c71a04b0c30fbee5b198c2" kindref="member">LWIP_DHCP_AUTOIP_COOP_TRIES</ref><sp/>&amp;&amp;<sp/>dhcp-&gt;autoip_coop_state<sp/>==<sp/>DHCP_AUTOIP_COOP_STATE_OFF)<sp/>{</highlight></codeline>
<codeline lineno="1000"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;autoip_coop_state<sp/>=<sp/>DHCP_AUTOIP_COOP_STATE_ON;</highlight></codeline>
<codeline lineno="1001"><highlight class="normal"><sp/><sp/><sp/><sp/>autoip_start(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1002"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1003"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_AUTOIP_COOP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1004"><highlight class="normal"><sp/><sp/>msecs<sp/>=<sp/>(dhcp-&gt;tries<sp/>&lt;<sp/>6<sp/>?<sp/>1<sp/>&lt;&lt;<sp/>dhcp-&gt;tries<sp/>:<sp/>60)<sp/>*<sp/>1000;</highlight></codeline>
<codeline lineno="1005"><highlight class="normal"><sp/><sp/>dhcp-&gt;request_timeout<sp/>=<sp/>(msecs<sp/>+<sp/>DHCP_FINE_TIMER_MSECS<sp/>-<sp/>1)<sp/>/<sp/>DHCP_FINE_TIMER_MSECS;</highlight></codeline>
<codeline lineno="1006"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_discover():<sp/>set<sp/>request<sp/>timeout<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>msecs\n&quot;</highlight><highlight class="normal">,<sp/>msecs));</highlight></codeline>
<codeline lineno="1007"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>result;</highlight></codeline>
<codeline lineno="1008"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1009"><highlight class="normal"></highlight></codeline>
<codeline lineno="1010"><highlight class="normal"></highlight></codeline>
<codeline lineno="1016"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1017"><highlight class="normal">dhcp_bind(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="1018"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1019"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>timeout;</highlight></codeline>
<codeline lineno="1020"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp;</highlight></codeline>
<codeline lineno="1021"><highlight class="normal"><sp/><sp/>ip4_addr_t<sp/>sn_mask,<sp/>gw_addr;</highlight></codeline>
<codeline lineno="1022"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_bind:<sp/>netif<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;);</highlight></codeline>
<codeline lineno="1023"><highlight class="normal"><sp/><sp/>dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1024"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_bind:<sp/>dhcp<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>(dhcp<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;);</highlight></codeline>
<codeline lineno="1025"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_bind(netif=%p)<sp/>%c%c%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)<ref refid="structnetif" kindref="compound">netif</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[0],<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a32fca6ffd28bb9af3f891a378827a67e" kindref="member">name</ref>[1],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ab7ef01e505dd2feb781fe86756b1c973" kindref="member">num</ref>));</highlight></codeline>
<codeline lineno="1026"><highlight class="normal"></highlight></codeline>
<codeline lineno="1027"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>reset<sp/>time<sp/>used<sp/>of<sp/>lease<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1028"><highlight class="normal"><sp/><sp/>dhcp-&gt;lease_used<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1029"><highlight class="normal"></highlight></codeline>
<codeline lineno="1030"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;offered_t0_lease<sp/>!=<sp/>0xffffffffUL)<sp/>{</highlight></codeline>
<codeline lineno="1031"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>renewal<sp/>period<sp/>timer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1032"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_bind():<sp/>t0<sp/>renewal<sp/>timer<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gad8b0a364e95b07cb0c47709fdc6037d6" kindref="member">U32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>secs\n&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;offered_t0_lease));</highlight></codeline>
<codeline lineno="1033"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>timeout<sp/>=<sp/>(dhcp-&gt;offered_t0_lease<sp/>+<sp/>DHCP_COARSE_TIMER_SECS<sp/>/<sp/>2)<sp/>/<sp/>DHCP_COARSE_TIMER_SECS;</highlight></codeline>
<codeline lineno="1034"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(timeout<sp/>&gt;<sp/>0xffff)<sp/>{</highlight></codeline>
<codeline lineno="1035"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>timeout<sp/>=<sp/>0xffff;</highlight></codeline>
<codeline lineno="1036"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1037"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>dhcp-&gt;t0_timeout<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)timeout;</highlight></codeline>
<codeline lineno="1038"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;t0_timeout<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1039"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp-&gt;t0_timeout<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1040"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1041"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_bind():<sp/>set<sp/>request<sp/>timeout<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gad8b0a364e95b07cb0c47709fdc6037d6" kindref="member">U32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>msecs\n&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;offered_t0_lease*1000));</highlight></codeline>
<codeline lineno="1042"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1043"><highlight class="normal"></highlight></codeline>
<codeline lineno="1044"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>temporary<sp/>DHCP<sp/>lease?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1045"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;offered_t1_renew<sp/>!=<sp/>0xffffffffUL)<sp/>{</highlight></codeline>
<codeline lineno="1046"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>renewal<sp/>period<sp/>timer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1047"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_bind():<sp/>t1<sp/>renewal<sp/>timer<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gad8b0a364e95b07cb0c47709fdc6037d6" kindref="member">U32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>secs\n&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;offered_t1_renew));</highlight></codeline>
<codeline lineno="1048"><highlight class="normal"><sp/><sp/><sp/><sp/>timeout<sp/>=<sp/>(dhcp-&gt;offered_t1_renew<sp/>+<sp/>DHCP_COARSE_TIMER_SECS<sp/>/<sp/>2)<sp/>/<sp/>DHCP_COARSE_TIMER_SECS;</highlight></codeline>
<codeline lineno="1049"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(timeout<sp/>&gt;<sp/>0xffff)<sp/>{</highlight></codeline>
<codeline lineno="1050"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>timeout<sp/>=<sp/>0xffff;</highlight></codeline>
<codeline lineno="1051"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1052"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;t1_timeout<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)timeout;</highlight></codeline>
<codeline lineno="1053"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;t1_timeout<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1054"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp-&gt;t1_timeout<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1055"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1056"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_bind():<sp/>set<sp/>request<sp/>timeout<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gad8b0a364e95b07cb0c47709fdc6037d6" kindref="member">U32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>msecs\n&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;offered_t1_renew*1000));</highlight></codeline>
<codeline lineno="1057"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;t1_renew_time<sp/>=<sp/>dhcp-&gt;t1_timeout;</highlight></codeline>
<codeline lineno="1058"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1059"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>renewal<sp/>period<sp/>timer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1060"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;offered_t2_rebind<sp/>!=<sp/>0xffffffffUL)<sp/>{</highlight></codeline>
<codeline lineno="1061"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_bind():<sp/>t2<sp/>rebind<sp/>timer<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gad8b0a364e95b07cb0c47709fdc6037d6" kindref="member">U32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>secs\n&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;offered_t2_rebind));</highlight></codeline>
<codeline lineno="1062"><highlight class="normal"><sp/><sp/><sp/><sp/>timeout<sp/>=<sp/>(dhcp-&gt;offered_t2_rebind<sp/>+<sp/>DHCP_COARSE_TIMER_SECS<sp/>/<sp/>2)<sp/>/<sp/>DHCP_COARSE_TIMER_SECS;</highlight></codeline>
<codeline lineno="1063"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(timeout<sp/>&gt;<sp/>0xffff)<sp/>{</highlight></codeline>
<codeline lineno="1064"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>timeout<sp/>=<sp/>0xffff;</highlight></codeline>
<codeline lineno="1065"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1066"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;t2_timeout<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)timeout;</highlight></codeline>
<codeline lineno="1067"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;t2_timeout<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1068"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp-&gt;t2_timeout<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1069"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1070"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_bind():<sp/>set<sp/>request<sp/>timeout<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gad8b0a364e95b07cb0c47709fdc6037d6" kindref="member">U32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>msecs\n&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;offered_t2_rebind*1000));</highlight></codeline>
<codeline lineno="1071"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;t2_rebind_time<sp/>=<sp/>dhcp-&gt;t2_timeout;</highlight></codeline>
<codeline lineno="1072"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1073"><highlight class="normal"></highlight></codeline>
<codeline lineno="1074"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>we<sp/>have<sp/>sub<sp/>1<sp/>minute<sp/>lease,<sp/>t2<sp/>and<sp/>t1<sp/>will<sp/>kick<sp/>in<sp/>at<sp/>the<sp/>same<sp/>time.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1075"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((dhcp-&gt;t1_timeout<sp/>&gt;=<sp/>dhcp-&gt;t2_timeout)<sp/>&amp;&amp;<sp/>(dhcp-&gt;t2_timeout<sp/>&gt;<sp/>0))<sp/>{</highlight></codeline>
<codeline lineno="1076"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;t1_timeout<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1077"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1078"><highlight class="normal"></highlight></codeline>
<codeline lineno="1079"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;subnet_mask_given)<sp/>{</highlight></codeline>
<codeline lineno="1080"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>offered<sp/>network<sp/>mask<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1081"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_copy(sn_mask,<sp/>dhcp-&gt;offered_sn_mask);</highlight></codeline>
<codeline lineno="1082"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1083"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>subnet<sp/>mask<sp/>not<sp/>given,<sp/>choose<sp/>a<sp/>safe<sp/>subnet<sp/>mask<sp/>given<sp/>the<sp/>network<sp/>class<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1084"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>first_octet<sp/>=<sp/>ip4_addr1(&amp;dhcp-&gt;offered_ip_addr);</highlight></codeline>
<codeline lineno="1085"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(first_octet<sp/>&lt;=<sp/>127)<sp/>{</highlight></codeline>
<codeline lineno="1086"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_set_u32(&amp;sn_mask,<sp/><ref refid="def_8h_1afea9c21aa1f56180cdf6fb42ef14a294" kindref="member">PP_HTONL</ref>(0xff000000UL));</highlight></codeline>
<codeline lineno="1087"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(first_octet<sp/>&gt;=<sp/>192)<sp/>{</highlight></codeline>
<codeline lineno="1088"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_set_u32(&amp;sn_mask,<sp/><ref refid="def_8h_1afea9c21aa1f56180cdf6fb42ef14a294" kindref="member">PP_HTONL</ref>(0xffffff00UL));</highlight></codeline>
<codeline lineno="1089"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1090"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_set_u32(&amp;sn_mask,<sp/><ref refid="def_8h_1afea9c21aa1f56180cdf6fb42ef14a294" kindref="member">PP_HTONL</ref>(0xffff0000UL));</highlight></codeline>
<codeline lineno="1091"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1092"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1093"><highlight class="normal"></highlight></codeline>
<codeline lineno="1094"><highlight class="normal"><sp/><sp/>ip4_addr_copy(gw_addr,<sp/>dhcp-&gt;offered_gw_addr);</highlight></codeline>
<codeline lineno="1095"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>gateway<sp/>address<sp/>not<sp/>given?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1096"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_isany_val(gw_addr))<sp/>{</highlight></codeline>
<codeline lineno="1097"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>network<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1098"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_get_network(&amp;gw_addr,<sp/>&amp;dhcp-&gt;offered_ip_addr,<sp/>&amp;sn_mask);</highlight></codeline>
<codeline lineno="1099"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>use<sp/>first<sp/>host<sp/>address<sp/>on<sp/>network<sp/>as<sp/>gateway<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1100"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_set_u32(&amp;gw_addr,<sp/>ip4_addr_get_u32(&amp;gw_addr)<sp/>|<sp/><ref refid="def_8h_1afea9c21aa1f56180cdf6fb42ef14a294" kindref="member">PP_HTONL</ref>(0x00000001UL));</highlight></codeline>
<codeline lineno="1101"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1102"><highlight class="normal"></highlight></codeline>
<codeline lineno="1103"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_AUTOIP_COOP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1104"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;autoip_coop_state<sp/>==<sp/>DHCP_AUTOIP_COOP_STATE_ON)<sp/>{</highlight></codeline>
<codeline lineno="1105"><highlight class="normal"><sp/><sp/><sp/><sp/>autoip_stop(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1106"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;autoip_coop_state<sp/>=<sp/>DHCP_AUTOIP_COOP_STATE_OFF;</highlight></codeline>
<codeline lineno="1107"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1108"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_AUTOIP_COOP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1109"><highlight class="normal"></highlight></codeline>
<codeline lineno="1110"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_bind():<sp/>IP:<sp/>0x%08&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>SN:<sp/>0x%08&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>GW:<sp/>0x%08&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1111"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_get_u32(&amp;dhcp-&gt;offered_ip_addr),<sp/>ip4_addr_get_u32(&amp;sn_mask),<sp/>ip4_addr_get_u32(&amp;gw_addr)));</highlight></codeline>
<codeline lineno="1112"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>netif<sp/>is<sp/>now<sp/>bound<sp/>to<sp/>DHCP<sp/>leased<sp/>address<sp/>-<sp/>set<sp/>this<sp/>before<sp/>assigning<sp/>the<sp/>address</highlight></codeline>
<codeline lineno="1113"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>to<sp/>ensure<sp/>the<sp/>callback<sp/>can<sp/>use<sp/>dhcp_supplied_address()<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1114"><highlight class="normal"><sp/><sp/>dhcp_set_state(dhcp,<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba1200a3d268f2eadee62987a8d7d122e8" kindref="member">DHCP_STATE_BOUND</ref>);</highlight></codeline>
<codeline lineno="1115"><highlight class="normal"></highlight></codeline>
<codeline lineno="1116"><highlight class="normal"><sp/><sp/>netif_set_addr(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;dhcp-&gt;offered_ip_addr,<sp/>&amp;sn_mask,<sp/>&amp;gw_addr);</highlight></codeline>
<codeline lineno="1117"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>interface<sp/>is<sp/>used<sp/>by<sp/>routing<sp/>now<sp/>that<sp/>an<sp/>address<sp/>is<sp/>set<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1118"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1119"><highlight class="normal"></highlight></codeline>
<codeline lineno="1126"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1127"><highlight class="normal">dhcp_renew(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="1128"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1129"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1130"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>result;</highlight></codeline>
<codeline lineno="1131"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>msecs;</highlight></codeline>
<codeline lineno="1132"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1133"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_renew()\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1134"><highlight class="normal"><sp/><sp/>dhcp_set_state(dhcp,<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbacd567c9a791f5112e7b5a46be86548cd" kindref="member">DHCP_STATE_RENEWING</ref>);</highlight></codeline>
<codeline lineno="1135"><highlight class="normal"></highlight></codeline>
<codeline lineno="1136"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>create<sp/>and<sp/>initialize<sp/>the<sp/>DHCP<sp/>message<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1137"><highlight class="normal"><sp/><sp/>result<sp/>=<sp/>dhcp_create_msg(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>dhcp,<sp/><ref refid="prot_2dhcp_8h_1a98a346c53c91848070fd980a98fa77d1" kindref="member">DHCP_REQUEST</ref>);</highlight></codeline>
<codeline lineno="1138"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(result<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1139"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1aabc084bbce4768f1a2ec17caa0aac858" kindref="member">DHCP_OPTION_MAX_MSG_SIZE</ref>,<sp/><ref refid="prot_2dhcp_8h_1a73960c1209385e0b3f8d9c0e4f6f438f" kindref="member">DHCP_OPTION_MAX_MSG_SIZE_LEN</ref>);</highlight></codeline>
<codeline lineno="1140"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_short(dhcp,<sp/>DHCP_MAX_MSG_LEN(<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="1141"><highlight class="normal"></highlight></codeline>
<codeline lineno="1142"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1a8b484e555c18f2d20df9a2267f35bced" kindref="member">DHCP_OPTION_PARAMETER_REQUEST_LIST</ref>,<sp/><ref refid="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(dhcp_discover_request_options));</highlight></codeline>
<codeline lineno="1143"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(dhcp_discover_request_options);<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_option_byte(dhcp,<sp/>dhcp_discover_request_options[i]);</highlight></codeline>
<codeline lineno="1145"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1146"><highlight class="normal"></highlight></codeline>
<codeline lineno="1147"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_HOSTNAME</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1148"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_hostname(dhcp,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1149"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_HOSTNAME<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1150"><highlight class="normal"></highlight></codeline>
<codeline lineno="1151"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>append<sp/>DHCP<sp/>message<sp/>trailer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1152"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_trailer(dhcp);</highlight></codeline>
<codeline lineno="1153"><highlight class="normal"></highlight></codeline>
<codeline lineno="1154"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga50abfe830a33a1a47a562febee66015d" kindref="member">pbuf_realloc</ref>(dhcp-&gt;p_out,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref>)<sp/>-<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref><sp/>+<sp/>dhcp-&gt;options_out_len);</highlight></codeline>
<codeline lineno="1155"><highlight class="normal"></highlight></codeline>
<codeline lineno="1156"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_sendto_if(dhcp_pcb,<sp/>dhcp-&gt;p_out,<sp/>&amp;dhcp-&gt;server_ip_addr,<sp/><ref refid="prot_2dhcp_8h_1a478f5be6fb4bfb09b235bb50cf806cc9" kindref="member">DHCP_SERVER_PORT</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1157"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_delete_msg(dhcp);</highlight></codeline>
<codeline lineno="1158"><highlight class="normal"></highlight></codeline>
<codeline lineno="1159"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_renew:<sp/>RENEWING\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1160"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1161"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_renew:<sp/>could<sp/>not<sp/>allocate<sp/>DHCP<sp/>request\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1162"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1163"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;tries<sp/>&lt;<sp/>255)<sp/>{</highlight></codeline>
<codeline lineno="1164"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;tries++;</highlight></codeline>
<codeline lineno="1165"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1166"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>back-off<sp/>on<sp/>retries,<sp/>but<sp/>to<sp/>a<sp/>maximum<sp/>of<sp/>20<sp/>seconds<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1167"><highlight class="normal"><sp/><sp/>msecs<sp/>=<sp/>dhcp-&gt;tries<sp/>&lt;<sp/>10<sp/>?<sp/>dhcp-&gt;tries<sp/>*<sp/>2000<sp/>:<sp/>20<sp/>*<sp/>1000;</highlight></codeline>
<codeline lineno="1168"><highlight class="normal"><sp/><sp/>dhcp-&gt;request_timeout<sp/>=<sp/>(msecs<sp/>+<sp/>DHCP_FINE_TIMER_MSECS<sp/>-<sp/>1)<sp/>/<sp/>DHCP_FINE_TIMER_MSECS;</highlight></codeline>
<codeline lineno="1169"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_renew():<sp/>set<sp/>request<sp/>timeout<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>msecs\n&quot;</highlight><highlight class="normal">,<sp/>msecs));</highlight></codeline>
<codeline lineno="1170"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>result;</highlight></codeline>
<codeline lineno="1171"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1172"><highlight class="normal"></highlight></codeline>
<codeline lineno="1178"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1179"><highlight class="normal">dhcp_rebind(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="1180"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1181"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1182"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>result;</highlight></codeline>
<codeline lineno="1183"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>msecs;</highlight></codeline>
<codeline lineno="1184"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1185"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_rebind()\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1186"><highlight class="normal"><sp/><sp/>dhcp_set_state(dhcp,<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaf55c3505a4745661f94134f8ccaa6c27" kindref="member">DHCP_STATE_REBINDING</ref>);</highlight></codeline>
<codeline lineno="1187"><highlight class="normal"></highlight></codeline>
<codeline lineno="1188"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>create<sp/>and<sp/>initialize<sp/>the<sp/>DHCP<sp/>message<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1189"><highlight class="normal"><sp/><sp/>result<sp/>=<sp/>dhcp_create_msg(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>dhcp,<sp/><ref refid="prot_2dhcp_8h_1a98a346c53c91848070fd980a98fa77d1" kindref="member">DHCP_REQUEST</ref>);</highlight></codeline>
<codeline lineno="1190"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(result<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1191"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1aabc084bbce4768f1a2ec17caa0aac858" kindref="member">DHCP_OPTION_MAX_MSG_SIZE</ref>,<sp/><ref refid="prot_2dhcp_8h_1a73960c1209385e0b3f8d9c0e4f6f438f" kindref="member">DHCP_OPTION_MAX_MSG_SIZE_LEN</ref>);</highlight></codeline>
<codeline lineno="1192"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_short(dhcp,<sp/>DHCP_MAX_MSG_LEN(<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="1193"><highlight class="normal"></highlight></codeline>
<codeline lineno="1194"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1a8b484e555c18f2d20df9a2267f35bced" kindref="member">DHCP_OPTION_PARAMETER_REQUEST_LIST</ref>,<sp/><ref refid="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(dhcp_discover_request_options));</highlight></codeline>
<codeline lineno="1195"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(dhcp_discover_request_options);<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1196"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_option_byte(dhcp,<sp/>dhcp_discover_request_options[i]);</highlight></codeline>
<codeline lineno="1197"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1198"><highlight class="normal"></highlight></codeline>
<codeline lineno="1199"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_HOSTNAME</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1200"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_hostname(dhcp,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1201"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_HOSTNAME<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1202"><highlight class="normal"></highlight></codeline>
<codeline lineno="1203"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_trailer(dhcp);</highlight></codeline>
<codeline lineno="1204"><highlight class="normal"></highlight></codeline>
<codeline lineno="1205"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga50abfe830a33a1a47a562febee66015d" kindref="member">pbuf_realloc</ref>(dhcp-&gt;p_out,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref>)<sp/>-<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref><sp/>+<sp/>dhcp-&gt;options_out_len);</highlight></codeline>
<codeline lineno="1206"><highlight class="normal"></highlight></codeline>
<codeline lineno="1207"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>broadcast<sp/>to<sp/>server<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1208"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_sendto_if(dhcp_pcb,<sp/>dhcp-&gt;p_out,<sp/>IP_ADDR_BROADCAST,<sp/><ref refid="prot_2dhcp_8h_1a478f5be6fb4bfb09b235bb50cf806cc9" kindref="member">DHCP_SERVER_PORT</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1209"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_delete_msg(dhcp);</highlight></codeline>
<codeline lineno="1210"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_rebind:<sp/>REBINDING\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1211"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1212"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_rebind:<sp/>could<sp/>not<sp/>allocate<sp/>DHCP<sp/>request\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1213"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1214"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;tries<sp/>&lt;<sp/>255)<sp/>{</highlight></codeline>
<codeline lineno="1215"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;tries++;</highlight></codeline>
<codeline lineno="1216"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1217"><highlight class="normal"><sp/><sp/>msecs<sp/>=<sp/>dhcp-&gt;tries<sp/>&lt;<sp/>10<sp/>?<sp/>dhcp-&gt;tries<sp/>*<sp/>1000<sp/>:<sp/>10<sp/>*<sp/>1000;</highlight></codeline>
<codeline lineno="1218"><highlight class="normal"><sp/><sp/>dhcp-&gt;request_timeout<sp/>=<sp/>(msecs<sp/>+<sp/>DHCP_FINE_TIMER_MSECS<sp/>-<sp/>1)<sp/>/<sp/>DHCP_FINE_TIMER_MSECS;</highlight></codeline>
<codeline lineno="1219"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_rebind():<sp/>set<sp/>request<sp/>timeout<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>msecs\n&quot;</highlight><highlight class="normal">,<sp/>msecs));</highlight></codeline>
<codeline lineno="1220"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>result;</highlight></codeline>
<codeline lineno="1221"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1222"><highlight class="normal"></highlight></codeline>
<codeline lineno="1228"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1229"><highlight class="normal">dhcp_reboot(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="1230"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1231"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1232"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>result;</highlight></codeline>
<codeline lineno="1233"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>msecs;</highlight></codeline>
<codeline lineno="1234"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1235"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_reboot()\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1236"><highlight class="normal"><sp/><sp/>dhcp_set_state(dhcp,<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba59b94c72eaa1d506d9014de5c9ff5608" kindref="member">DHCP_STATE_REBOOTING</ref>);</highlight></codeline>
<codeline lineno="1237"><highlight class="normal"></highlight></codeline>
<codeline lineno="1238"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>create<sp/>and<sp/>initialize<sp/>the<sp/>DHCP<sp/>message<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1239"><highlight class="normal"><sp/><sp/>result<sp/>=<sp/>dhcp_create_msg(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>dhcp,<sp/><ref refid="prot_2dhcp_8h_1a98a346c53c91848070fd980a98fa77d1" kindref="member">DHCP_REQUEST</ref>);</highlight></codeline>
<codeline lineno="1240"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(result<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1241"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1aabc084bbce4768f1a2ec17caa0aac858" kindref="member">DHCP_OPTION_MAX_MSG_SIZE</ref>,<sp/><ref refid="prot_2dhcp_8h_1a73960c1209385e0b3f8d9c0e4f6f438f" kindref="member">DHCP_OPTION_MAX_MSG_SIZE_LEN</ref>);</highlight></codeline>
<codeline lineno="1242"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_short(dhcp,<sp/>DHCP_MAX_MSG_LEN_MIN_REQUIRED);</highlight></codeline>
<codeline lineno="1243"><highlight class="normal"></highlight></codeline>
<codeline lineno="1244"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1a1cbad840414a6617ebdb17b1b9073597" kindref="member">DHCP_OPTION_REQUESTED_IP</ref>,<sp/>4);</highlight></codeline>
<codeline lineno="1245"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_long(dhcp,<sp/><ref refid="def_8h_1a56098407d66feb75806f655bafbee81d" kindref="member">lwip_ntohl</ref>(ip4_addr_get_u32(&amp;dhcp-&gt;offered_ip_addr)));</highlight></codeline>
<codeline lineno="1246"><highlight class="normal"></highlight></codeline>
<codeline lineno="1247"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1a8b484e555c18f2d20df9a2267f35bced" kindref="member">DHCP_OPTION_PARAMETER_REQUEST_LIST</ref>,<sp/><ref refid="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(dhcp_discover_request_options));</highlight></codeline>
<codeline lineno="1248"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(dhcp_discover_request_options);<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1249"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_option_byte(dhcp,<sp/>dhcp_discover_request_options[i]);</highlight></codeline>
<codeline lineno="1250"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1251"><highlight class="normal"></highlight></codeline>
<codeline lineno="1252"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_trailer(dhcp);</highlight></codeline>
<codeline lineno="1253"><highlight class="normal"></highlight></codeline>
<codeline lineno="1254"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga50abfe830a33a1a47a562febee66015d" kindref="member">pbuf_realloc</ref>(dhcp-&gt;p_out,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref>)<sp/>-<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref><sp/>+<sp/>dhcp-&gt;options_out_len);</highlight></codeline>
<codeline lineno="1255"><highlight class="normal"></highlight></codeline>
<codeline lineno="1256"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>broadcast<sp/>to<sp/>server<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1257"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_sendto_if(dhcp_pcb,<sp/>dhcp-&gt;p_out,<sp/>IP_ADDR_BROADCAST,<sp/><ref refid="prot_2dhcp_8h_1a478f5be6fb4bfb09b235bb50cf806cc9" kindref="member">DHCP_SERVER_PORT</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1258"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_delete_msg(dhcp);</highlight></codeline>
<codeline lineno="1259"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_reboot:<sp/>REBOOTING\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1260"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1261"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_reboot:<sp/>could<sp/>not<sp/>allocate<sp/>DHCP<sp/>request\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1262"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1263"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;tries<sp/>&lt;<sp/>255)<sp/>{</highlight></codeline>
<codeline lineno="1264"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;tries++;</highlight></codeline>
<codeline lineno="1265"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1266"><highlight class="normal"><sp/><sp/>msecs<sp/>=<sp/>dhcp-&gt;tries<sp/>&lt;<sp/>10<sp/>?<sp/>dhcp-&gt;tries<sp/>*<sp/>1000<sp/>:<sp/>10<sp/>*<sp/>1000;</highlight></codeline>
<codeline lineno="1267"><highlight class="normal"><sp/><sp/>dhcp-&gt;request_timeout<sp/>=<sp/>(msecs<sp/>+<sp/>DHCP_FINE_TIMER_MSECS<sp/>-<sp/>1)<sp/>/<sp/>DHCP_FINE_TIMER_MSECS;</highlight></codeline>
<codeline lineno="1268"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_reboot():<sp/>set<sp/>request<sp/>timeout<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>msecs\n&quot;</highlight><highlight class="normal">,<sp/>msecs));</highlight></codeline>
<codeline lineno="1269"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>result;</highlight></codeline>
<codeline lineno="1270"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1271"><highlight class="normal"></highlight></codeline>
<codeline lineno="1272"><highlight class="normal"></highlight></codeline>
<codeline lineno="1279"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1280"><highlight class="normal">dhcp_release(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="1281"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1282"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1283"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>result;</highlight></codeline>
<codeline lineno="1284"><highlight class="normal"><sp/><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>server_ip_addr;</highlight></codeline>
<codeline lineno="1285"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>is_dhcp_supplied_address;</highlight></codeline>
<codeline lineno="1286"><highlight class="normal"></highlight></codeline>
<codeline lineno="1287"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_release()\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1288"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1289"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;</highlight></codeline>
<codeline lineno="1290"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1291"><highlight class="normal"><sp/><sp/><ref refid="ip__addr_8h_1a77a933975db287f6aa5c2e70249ba18f" kindref="member">ip_addr_copy</ref>(server_ip_addr,<sp/>dhcp-&gt;server_ip_addr);</highlight></codeline>
<codeline lineno="1292"><highlight class="normal"></highlight></codeline>
<codeline lineno="1293"><highlight class="normal"><sp/><sp/>is_dhcp_supplied_address<sp/>=<sp/>dhcp_supplied_address(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1294"><highlight class="normal"></highlight></codeline>
<codeline lineno="1295"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>idle<sp/>DHCP<sp/>client<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1296"><highlight class="normal"><sp/><sp/>dhcp_set_state(dhcp,<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba041a5104e13c4ccfe4982ca3aac677b1" kindref="member">DHCP_STATE_OFF</ref>);</highlight></codeline>
<codeline lineno="1297"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>clean<sp/>old<sp/>DHCP<sp/>offer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1298"><highlight class="normal"><sp/><sp/>ip_addr_set_zero_ip4(&amp;dhcp-&gt;server_ip_addr);</highlight></codeline>
<codeline lineno="1299"><highlight class="normal"><sp/><sp/>ip4_addr_set_zero(&amp;dhcp-&gt;offered_ip_addr);</highlight></codeline>
<codeline lineno="1300"><highlight class="normal"><sp/><sp/>ip4_addr_set_zero(&amp;dhcp-&gt;offered_sn_mask);</highlight></codeline>
<codeline lineno="1301"><highlight class="normal"><sp/><sp/>ip4_addr_set_zero(&amp;dhcp-&gt;offered_gw_addr);</highlight></codeline>
<codeline lineno="1302"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_BOOTP_FILE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1303"><highlight class="normal"><sp/><sp/>ip4_addr_set_zero(&amp;dhcp-&gt;offered_si_addr);</highlight></codeline>
<codeline lineno="1304"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_BOOTP_FILE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1305"><highlight class="normal"><sp/><sp/>dhcp-&gt;offered_t0_lease<sp/>=<sp/>dhcp-&gt;offered_t1_renew<sp/>=<sp/>dhcp-&gt;offered_t2_rebind<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1306"><highlight class="normal"><sp/><sp/>dhcp-&gt;t1_renew_time<sp/>=<sp/>dhcp-&gt;t2_rebind_time<sp/>=<sp/>dhcp-&gt;lease_used<sp/>=<sp/>dhcp-&gt;t0_timeout<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1307"><highlight class="normal"></highlight></codeline>
<codeline lineno="1308"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!is_dhcp_supplied_address)<sp/>{</highlight></codeline>
<codeline lineno="1309"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>issue<sp/>release<sp/>message<sp/>when<sp/>address<sp/>is<sp/>not<sp/>dhcp-assigned<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1310"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="1311"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1312"><highlight class="normal"></highlight></codeline>
<codeline lineno="1313"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>create<sp/>and<sp/>initialize<sp/>the<sp/>DHCP<sp/>message<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1314"><highlight class="normal"><sp/><sp/>result<sp/>=<sp/>dhcp_create_msg(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>dhcp,<sp/><ref refid="prot_2dhcp_8h_1ae629d2dc5df40f03ea87cc94a5e3f3eb" kindref="member">DHCP_RELEASE</ref>);</highlight></codeline>
<codeline lineno="1315"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(result<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1316"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1a3bdf84c273501fb73ad217dcab87bb4a" kindref="member">DHCP_OPTION_SERVER_ID</ref>,<sp/>4);</highlight></codeline>
<codeline lineno="1317"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_long(dhcp,<sp/><ref refid="def_8h_1a56098407d66feb75806f655bafbee81d" kindref="member">lwip_ntohl</ref>(ip4_addr_get_u32(ip_2_ip4(&amp;server_ip_addr))));</highlight></codeline>
<codeline lineno="1318"><highlight class="normal"></highlight></codeline>
<codeline lineno="1319"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_option_trailer(dhcp);</highlight></codeline>
<codeline lineno="1320"><highlight class="normal"></highlight></codeline>
<codeline lineno="1321"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1ga50abfe830a33a1a47a562febee66015d" kindref="member">pbuf_realloc</ref>(dhcp-&gt;p_out,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref>)<sp/>-<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref><sp/>+<sp/>dhcp-&gt;options_out_len);</highlight></codeline>
<codeline lineno="1322"><highlight class="normal"></highlight></codeline>
<codeline lineno="1323"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_sendto_if(dhcp_pcb,<sp/>dhcp-&gt;p_out,<sp/>&amp;server_ip_addr,<sp/><ref refid="prot_2dhcp_8h_1a478f5be6fb4bfb09b235bb50cf806cc9" kindref="member">DHCP_SERVER_PORT</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1324"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_delete_msg(dhcp);</highlight></codeline>
<codeline lineno="1325"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga511ee3deb3240635f5ec6a1709c6d741" kindref="member">LWIP_DBG_STATE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_release:<sp/>RELEASED,<sp/>DHCP_STATE_OFF\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1326"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1327"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>sending<sp/>release<sp/>failed,<sp/>but<sp/>that&apos;s<sp/>not<sp/>a<sp/>problem<sp/>since<sp/>the<sp/>correct<sp/>behaviour<sp/>of<sp/>dhcp<sp/>does<sp/>not<sp/>rely<sp/>on<sp/>release<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1328"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_release:<sp/>could<sp/>not<sp/>allocate<sp/>DHCP<sp/>request\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1329"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1330"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>remove<sp/>IP<sp/>address<sp/>from<sp/>interface<sp/>(prevents<sp/>routing<sp/>from<sp/>selecting<sp/>this<sp/>interface)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1331"><highlight class="normal"><sp/><sp/>netif_set_addr(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>IP4_ADDR_ANY4,<sp/>IP4_ADDR_ANY4,<sp/>IP4_ADDR_ANY4);</highlight></codeline>
<codeline lineno="1332"><highlight class="normal"></highlight></codeline>
<codeline lineno="1333"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>result;</highlight></codeline>
<codeline lineno="1334"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1335"><highlight class="normal"></highlight></codeline>
<codeline lineno="1342"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1343"><highlight class="normal">dhcp_stop(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="1344"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1345"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp;</highlight></codeline>
<codeline lineno="1346"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_stop:<sp/>netif<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;);</highlight></codeline>
<codeline lineno="1347"><highlight class="normal"><sp/><sp/>dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1348"><highlight class="normal"></highlight></codeline>
<codeline lineno="1349"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_stop()\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1350"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>netif<sp/>is<sp/>DHCP<sp/>configured?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1351"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1352"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_AUTOIP_COOP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1353"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;autoip_coop_state<sp/>==<sp/>DHCP_AUTOIP_COOP_STATE_ON)<sp/>{</highlight></codeline>
<codeline lineno="1354"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>autoip_stop(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1355"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp-&gt;autoip_coop_state<sp/>=<sp/>DHCP_AUTOIP_COOP_STATE_OFF;</highlight></codeline>
<codeline lineno="1356"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1357"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_AUTOIP_COOP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1358"><highlight class="normal"></highlight></codeline>
<codeline lineno="1359"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;reply<sp/>wasn&apos;t<sp/>freed&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;msg_in<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1360"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_set_state(dhcp,<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba041a5104e13c4ccfe4982ca3aac677b1" kindref="member">DHCP_STATE_OFF</ref>);</highlight></codeline>
<codeline lineno="1361"><highlight class="normal"></highlight></codeline>
<codeline lineno="1362"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;pcb_allocated<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1363"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_dec_pcb_refcount();<sp/></highlight><highlight class="comment">/*<sp/>free<sp/>DHCP<sp/>PCB<sp/>if<sp/>not<sp/>needed<sp/>any<sp/>more<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1364"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp-&gt;pcb_allocated<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1365"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1366"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1367"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1368"><highlight class="normal"></highlight></codeline>
<codeline lineno="1369"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="1370"><highlight class="comment"><sp/>*<sp/>Set<sp/>the<sp/>DHCP<sp/>state<sp/>of<sp/>a<sp/>DHCP<sp/>client.</highlight></codeline>
<codeline lineno="1371"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="1372"><highlight class="comment"><sp/>*<sp/>If<sp/>the<sp/>state<sp/>changed,<sp/>reset<sp/>the<sp/>number<sp/>of<sp/>tries.</highlight></codeline>
<codeline lineno="1373"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1374"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1375"><highlight class="normal">dhcp_set_state(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>new_state)</highlight></codeline>
<codeline lineno="1376"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1377"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(new_state<sp/>!=<sp/>dhcp-&gt;state)<sp/>{</highlight></codeline>
<codeline lineno="1378"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;state<sp/>=<sp/>new_state;</highlight></codeline>
<codeline lineno="1379"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;tries<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1380"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;request_timeout<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1381"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1382"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1383"><highlight class="normal"></highlight></codeline>
<codeline lineno="1384"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="1385"><highlight class="comment"><sp/>*<sp/>Concatenate<sp/>an<sp/>option<sp/>type<sp/>and<sp/>length<sp/>field<sp/>to<sp/>the<sp/>outgoing</highlight></codeline>
<codeline lineno="1386"><highlight class="comment"><sp/>*<sp/>DHCP<sp/>message.</highlight></codeline>
<codeline lineno="1387"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="1388"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1389"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1390"><highlight class="normal">dhcp_option(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>option_type,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>option_len)</highlight></codeline>
<codeline lineno="1391"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1392"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_option:<sp/>dhcp-&gt;options_out_len<sp/>+<sp/>2<sp/>+<sp/>option_len<sp/>&lt;=<sp/>DHCP_OPTIONS_LEN&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;options_out_len<sp/>+<sp/>2U<sp/>+<sp/>option_len<sp/>&lt;=<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref>);</highlight></codeline>
<codeline lineno="1393"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;options[dhcp-&gt;options_out_len++]<sp/>=<sp/>option_type;</highlight></codeline>
<codeline lineno="1394"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;options[dhcp-&gt;options_out_len++]<sp/>=<sp/>option_len;</highlight></codeline>
<codeline lineno="1395"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1396"><highlight class="normal"></highlight><highlight class="comment">/*</highlight></codeline>
<codeline lineno="1397"><highlight class="comment"><sp/>*<sp/>Concatenate<sp/>a<sp/>single<sp/>byte<sp/>to<sp/>the<sp/>outgoing<sp/>DHCP<sp/>message.</highlight></codeline>
<codeline lineno="1398"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="1399"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1400"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1401"><highlight class="normal">dhcp_option_byte(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>value)</highlight></codeline>
<codeline lineno="1402"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1403"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_option_byte:<sp/>dhcp-&gt;options_out_len<sp/>&lt;<sp/>DHCP_OPTIONS_LEN&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;options_out_len<sp/>&lt;<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref>);</highlight></codeline>
<codeline lineno="1404"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;options[dhcp-&gt;options_out_len++]<sp/>=<sp/>value;</highlight></codeline>
<codeline lineno="1405"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1406"><highlight class="normal"></highlight></codeline>
<codeline lineno="1407"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1408"><highlight class="normal">dhcp_option_short(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>value)</highlight></codeline>
<codeline lineno="1409"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1410"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_option_short:<sp/>dhcp-&gt;options_out_len<sp/>+<sp/>2<sp/>&lt;=<sp/>DHCP_OPTIONS_LEN&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;options_out_len<sp/>+<sp/>2U<sp/>&lt;=<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref>);</highlight></codeline>
<codeline lineno="1411"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;options[dhcp-&gt;options_out_len++]<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)((value<sp/>&amp;<sp/>0xff00U)<sp/>&gt;&gt;<sp/>8);</highlight></codeline>
<codeline lineno="1412"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;options[dhcp-&gt;options_out_len++]<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)<sp/>(value<sp/>&amp;<sp/>0x00ffU);</highlight></codeline>
<codeline lineno="1413"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1414"><highlight class="normal"></highlight></codeline>
<codeline lineno="1415"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1416"><highlight class="normal">dhcp_option_long(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>value)</highlight></codeline>
<codeline lineno="1417"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1418"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_option_long:<sp/>dhcp-&gt;options_out_len<sp/>+<sp/>4<sp/>&lt;=<sp/>DHCP_OPTIONS_LEN&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;options_out_len<sp/>+<sp/>4U<sp/>&lt;=<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref>);</highlight></codeline>
<codeline lineno="1419"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;options[dhcp-&gt;options_out_len++]<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)((value<sp/>&amp;<sp/>0xff000000UL)<sp/>&gt;&gt;<sp/>24);</highlight></codeline>
<codeline lineno="1420"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;options[dhcp-&gt;options_out_len++]<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)((value<sp/>&amp;<sp/>0x00ff0000UL)<sp/>&gt;&gt;<sp/>16);</highlight></codeline>
<codeline lineno="1421"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;options[dhcp-&gt;options_out_len++]<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)((value<sp/>&amp;<sp/>0x0000ff00UL)<sp/>&gt;&gt;<sp/>8);</highlight></codeline>
<codeline lineno="1422"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;options[dhcp-&gt;options_out_len++]<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)((value<sp/>&amp;<sp/>0x000000ffUL));</highlight></codeline>
<codeline lineno="1423"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1424"><highlight class="normal"></highlight></codeline>
<codeline lineno="1425"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETIF_HOSTNAME</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1426"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1427"><highlight class="normal">dhcp_option_hostname(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="1428"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1429"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;hostname<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1430"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>namelen<sp/>=<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;hostname);</highlight></codeline>
<codeline lineno="1431"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(namelen<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1432"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>len;</highlight></codeline>
<codeline lineno="1433"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*p<sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;hostname;</highlight></codeline>
<codeline lineno="1434"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Shrink<sp/>len<sp/>to<sp/>available<sp/>bytes<sp/>(need<sp/>2<sp/>bytes<sp/>for<sp/>OPTION_HOSTNAME</highlight></codeline>
<codeline lineno="1435"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>and<sp/>1<sp/>byte<sp/>for<sp/>trailer)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1436"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>available<sp/>=<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref><sp/>-<sp/>dhcp-&gt;options_out_len<sp/>-<sp/>3;</highlight></codeline>
<codeline lineno="1437"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;DHCP:<sp/>hostname<sp/>is<sp/>too<sp/>long!&quot;</highlight><highlight class="normal">,<sp/>namelen<sp/>&lt;=<sp/>available);</highlight></codeline>
<codeline lineno="1438"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>len<sp/>=<sp/><ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>(namelen,<sp/>available);</highlight></codeline>
<codeline lineno="1439"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;DHCP:<sp/>hostname<sp/>is<sp/>too<sp/>long!&quot;</highlight><highlight class="normal">,<sp/>len<sp/>&lt;=<sp/>0xFF);</highlight></codeline>
<codeline lineno="1440"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1a8336c0e435dd07302c1b433d2c9197be" kindref="member">DHCP_OPTION_HOSTNAME</ref>,<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)len);</highlight></codeline>
<codeline lineno="1441"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(len--)<sp/>{</highlight></codeline>
<codeline lineno="1442"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_option_byte(dhcp,<sp/>*p++);</highlight></codeline>
<codeline lineno="1443"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1444"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1445"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1446"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1447"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETIF_HOSTNAME<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1448"><highlight class="normal"></highlight></codeline>
<codeline lineno="1459"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1460"><highlight class="normal">dhcp_parse_reply(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p)</highlight></codeline>
<codeline lineno="1461"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1462"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*options;</highlight></codeline>
<codeline lineno="1463"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset;</highlight></codeline>
<codeline lineno="1464"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset_max;</highlight></codeline>
<codeline lineno="1465"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>options_idx;</highlight></codeline>
<codeline lineno="1466"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>options_idx_max;</highlight></codeline>
<codeline lineno="1467"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*q;</highlight></codeline>
<codeline lineno="1468"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>parse_file_as_options<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1469"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>parse_sname_as_options<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1470"><highlight class="normal"></highlight></codeline>
<codeline lineno="1471"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>clear<sp/>received<sp/>options<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1472"><highlight class="normal"><sp/><sp/>dhcp_clear_all_options(dhcp);</highlight></codeline>
<codeline lineno="1473"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>check<sp/>that<sp/>beginning<sp/>of<sp/>dhcp_msg<sp/>(up<sp/>to<sp/>and<sp/>including<sp/>chaddr)<sp/>is<sp/>in<sp/>first<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1474"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;<sp/><ref refid="prot_2dhcp_8h_1a370421b9ce80052774e0dd8a6437a025" kindref="member">DHCP_SNAME_OFS</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1475"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca05c91366f1b5203a5db9a241b415cd63" kindref="member">ERR_BUF</ref>;</highlight></codeline>
<codeline lineno="1476"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1477"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_in<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="1478"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/><ref refid="lwipopts_8h_1a3c2983cbd228011dd3e18cb417e7e423" kindref="member">LWIP_DHCP_BOOTP_FILE</ref></highlight></codeline>
<codeline lineno="1479"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>clear<sp/>boot<sp/>file<sp/>name<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1480"><highlight class="normal"><sp/><sp/>dhcp-&gt;boot_file_name[0]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1481"><highlight class="normal">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_BOOTP_FILE<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1482"><highlight class="normal"></highlight></codeline>
<codeline lineno="1483"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>parse<sp/>options<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1484"><highlight class="normal"></highlight></codeline>
<codeline lineno="1485"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>start<sp/>with<sp/>options<sp/>field<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1486"><highlight class="normal"><sp/><sp/>options_idx<sp/>=<sp/><ref refid="prot_2dhcp_8h_1af5e2f617c0b6005fb50db9851797be1b" kindref="member">DHCP_OPTIONS_OFS</ref>;</highlight></codeline>
<codeline lineno="1487"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>parse<sp/>options<sp/>to<sp/>the<sp/>end<sp/>of<sp/>the<sp/>received<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1488"><highlight class="normal"><sp/><sp/>options_idx_max<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>;</highlight></codeline>
<codeline lineno="1489"><highlight class="normal">again:</highlight></codeline>
<codeline lineno="1490"><highlight class="normal"><sp/><sp/>q<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="1491"><highlight class="normal"><sp/><sp/>while<sp/>((q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(options_idx<sp/>&gt;=<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1492"><highlight class="normal"><sp/><sp/><sp/><sp/>options_idx<sp/>-=<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="1493"><highlight class="normal"><sp/><sp/><sp/><sp/>options_idx_max<sp/>-=<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="1494"><highlight class="normal"><sp/><sp/><sp/><sp/>q<sp/>=<sp/>q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="1495"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1496"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(q<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1497"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca05c91366f1b5203a5db9a241b415cd63" kindref="member">ERR_BUF</ref>;</highlight></codeline>
<codeline lineno="1498"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1499"><highlight class="normal"><sp/><sp/>offset<sp/>=<sp/>options_idx;</highlight></codeline>
<codeline lineno="1500"><highlight class="normal"><sp/><sp/>offset_max<sp/>=<sp/>options_idx_max;</highlight></codeline>
<codeline lineno="1501"><highlight class="normal"><sp/><sp/>options<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)q-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="1502"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>at<sp/>least<sp/>1<sp/>byte<sp/>to<sp/>read<sp/>and<sp/>no<sp/>end<sp/>marker,<sp/>then<sp/>at<sp/>least<sp/>3<sp/>bytes<sp/>to<sp/>read?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1503"><highlight class="normal"><sp/><sp/>while<sp/>((q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(offset<sp/>&lt;<sp/>offset_max)<sp/>&amp;&amp;<sp/>(options[offset]<sp/>!=<sp/><ref refid="prot_2dhcp_8h_1aea2eb67064efec2c65fff4497f659e7d" kindref="member">DHCP_OPTION_END</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1504"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>op<sp/>=<sp/>options[offset];</highlight></codeline>
<codeline lineno="1505"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>len;</highlight></codeline>
<codeline lineno="1506"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>decode_len<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1507"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>decode_idx<sp/>=<sp/>-1;</highlight></codeline>
<codeline lineno="1508"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>val_offset<sp/>=<sp/>offset<sp/>+<sp/>2;</highlight></codeline>
<codeline lineno="1509"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>len<sp/>byte<sp/>might<sp/>be<sp/>in<sp/>the<sp/>next<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1510"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((offset<sp/>+<sp/>1)<sp/>&lt;<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1511"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>len<sp/>=<sp/>options[offset<sp/>+<sp/>1];</highlight></codeline>
<codeline lineno="1512"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1513"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>len<sp/>=<sp/>(q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>?<sp/>((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>)[0]<sp/>:<sp/>0);</highlight></codeline>
<codeline lineno="1514"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1515"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>LWIP_DEBUGF(DHCP_DEBUG,<sp/>(&quot;msg_offset=%&quot;U16_F&quot;,<sp/>q-&gt;len=%&quot;U16_F,<sp/>msg_offset,<sp/>q-&gt;len));<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1516"><highlight class="normal"><sp/><sp/><sp/><sp/>decode_len<sp/>=<sp/>len;</highlight></codeline>
<codeline lineno="1517"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal">(op)<sp/>{</highlight></codeline>
<codeline lineno="1518"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>case(DHCP_OPTION_END):<sp/>handled<sp/>above<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1519"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal">(<ref refid="prot_2dhcp_8h_1afcfde7a8c1ec0e3055d9a01ef2fa6aa9" kindref="member">DHCP_OPTION_PAD</ref>):</highlight></codeline>
<codeline lineno="1520"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>special<sp/>option:<sp/>no<sp/>len<sp/>encoded<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1521"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_len<sp/>=<sp/>len<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1522"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>will<sp/>be<sp/>increased<sp/>below<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1523"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>offset--;</highlight></codeline>
<codeline lineno="1524"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1525"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal">(<ref refid="prot_2dhcp_8h_1acff5b8c45e6d63afd973aa8a0e72a901" kindref="member">DHCP_OPTION_SUBNET_MASK</ref>):</highlight></codeline>
<codeline lineno="1526"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;len<sp/>==<sp/>4&quot;</highlight><highlight class="normal">,<sp/>len<sp/>==<sp/>4,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1527"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_idx<sp/>=<sp/>DHCP_OPTION_IDX_SUBNET_MASK;</highlight></codeline>
<codeline lineno="1528"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1529"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal">(<ref refid="prot_2dhcp_8h_1a72cfc4e231017d1d116bb1d69d18ae8c" kindref="member">DHCP_OPTION_ROUTER</ref>):</highlight></codeline>
<codeline lineno="1530"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_len<sp/>=<sp/>4;<sp/></highlight><highlight class="comment">/*<sp/>only<sp/>copy<sp/>the<sp/>first<sp/>given<sp/>router<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1531"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;len<sp/>&gt;=<sp/>decode_len&quot;</highlight><highlight class="normal">,<sp/>len<sp/>&gt;=<sp/>decode_len,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1532"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_idx<sp/>=<sp/>DHCP_OPTION_IDX_ROUTER;</highlight></codeline>
<codeline lineno="1533"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1534"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1535"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal">(<ref refid="prot_2dhcp_8h_1a8f05c5c6084fbac0be7b24101189232b" kindref="member">DHCP_OPTION_DNS_SERVER</ref>):</highlight></codeline>
<codeline lineno="1536"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>special<sp/>case:<sp/>there<sp/>might<sp/>be<sp/>more<sp/>than<sp/>one<sp/>server<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1537"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;len<sp/>%%<sp/>4<sp/>==<sp/>0&quot;</highlight><highlight class="normal">,<sp/>len<sp/>%<sp/>4<sp/>==<sp/>0,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1538"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>limit<sp/>number<sp/>of<sp/>DNS<sp/>servers<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1539"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_len<sp/>=<sp/><ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>(len,<sp/>4<sp/>*<sp/><ref refid="lwipopts_8h_1a9f9881c887a8aceb9765820c2dbdf292" kindref="member">DNS_MAX_SERVERS</ref>);</highlight></codeline>
<codeline lineno="1540"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;len<sp/>&gt;=<sp/>decode_len&quot;</highlight><highlight class="normal">,<sp/>len<sp/>&gt;=<sp/>decode_len,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1541"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_idx<sp/>=<sp/>DHCP_OPTION_IDX_DNS_SERVER;</highlight></codeline>
<codeline lineno="1542"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1543"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_PROVIDE_DNS_SERVERS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1544"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal">(<ref refid="prot_2dhcp_8h_1a458994de9415a8a622d1a560bfd9ace4" kindref="member">DHCP_OPTION_LEASE_TIME</ref>):</highlight></codeline>
<codeline lineno="1545"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;len<sp/>==<sp/>4&quot;</highlight><highlight class="normal">,<sp/>len<sp/>==<sp/>4,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1546"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_idx<sp/>=<sp/>DHCP_OPTION_IDX_LEASE_TIME;</highlight></codeline>
<codeline lineno="1547"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1548"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_GET_NTP_SRV</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1549"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal">(<ref refid="prot_2dhcp_8h_1ae5a724660dd11c27d8ed477f0ee136e3" kindref="member">DHCP_OPTION_NTP</ref>):</highlight></codeline>
<codeline lineno="1550"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>special<sp/>case:<sp/>there<sp/>might<sp/>be<sp/>more<sp/>than<sp/>one<sp/>server<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1551"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;len<sp/>%%<sp/>4<sp/>==<sp/>0&quot;</highlight><highlight class="normal">,<sp/>len<sp/>%<sp/>4<sp/>==<sp/>0,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1552"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>limit<sp/>number<sp/>of<sp/>NTP<sp/>servers<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1553"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_len<sp/>=<sp/><ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>(len,<sp/>4<sp/>*<sp/><ref refid="lwipopts_8h_1a9d014e3f7dc9e1e7c7decd8652ba65e2" kindref="member">LWIP_DHCP_MAX_NTP_SERVERS</ref>);</highlight></codeline>
<codeline lineno="1554"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;len<sp/>&gt;=<sp/>decode_len&quot;</highlight><highlight class="normal">,<sp/>len<sp/>&gt;=<sp/>decode_len,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1555"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_idx<sp/>=<sp/>DHCP_OPTION_IDX_NTP_SERVER;</highlight></codeline>
<codeline lineno="1556"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1557"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_GET_NTP_SRV*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1558"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal">(<ref refid="prot_2dhcp_8h_1afa25c2c462288d2ab8cec19d22af661f" kindref="member">DHCP_OPTION_OVERLOAD</ref>):</highlight></codeline>
<codeline lineno="1559"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;len<sp/>==<sp/>1&quot;</highlight><highlight class="normal">,<sp/>len<sp/>==<sp/>1,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1560"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>decode<sp/>overload<sp/>only<sp/>in<sp/>options,<sp/>not<sp/>in<sp/>file/sname:<sp/>invalid<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1561"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;overload<sp/>in<sp/>file/sname&quot;</highlight><highlight class="normal">,<sp/>options_idx<sp/>==<sp/><ref refid="prot_2dhcp_8h_1af5e2f617c0b6005fb50db9851797be1b" kindref="member">DHCP_OPTIONS_OFS</ref>,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1562"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_idx<sp/>=<sp/>DHCP_OPTION_IDX_OVERLOAD;</highlight></codeline>
<codeline lineno="1563"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1564"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal">(<ref refid="prot_2dhcp_8h_1ab023a7a8b3307a68a2eff10a217e48a8" kindref="member">DHCP_OPTION_MESSAGE_TYPE</ref>):</highlight></codeline>
<codeline lineno="1565"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;len<sp/>==<sp/>1&quot;</highlight><highlight class="normal">,<sp/>len<sp/>==<sp/>1,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1566"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_idx<sp/>=<sp/>DHCP_OPTION_IDX_MSG_TYPE;</highlight></codeline>
<codeline lineno="1567"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1568"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal">(<ref refid="prot_2dhcp_8h_1a3bdf84c273501fb73ad217dcab87bb4a" kindref="member">DHCP_OPTION_SERVER_ID</ref>):</highlight></codeline>
<codeline lineno="1569"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;len<sp/>==<sp/>4&quot;</highlight><highlight class="normal">,<sp/>len<sp/>==<sp/>4,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1570"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_idx<sp/>=<sp/>DHCP_OPTION_IDX_SERVER_ID;</highlight></codeline>
<codeline lineno="1571"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1572"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal">(<ref refid="prot_2dhcp_8h_1ac32aa14a7fed99bcff08d10ca2dafc4d" kindref="member">DHCP_OPTION_T1</ref>):</highlight></codeline>
<codeline lineno="1573"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;len<sp/>==<sp/>4&quot;</highlight><highlight class="normal">,<sp/>len<sp/>==<sp/>4,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1574"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_idx<sp/>=<sp/>DHCP_OPTION_IDX_T1;</highlight></codeline>
<codeline lineno="1575"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1576"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal">(<ref refid="prot_2dhcp_8h_1ab9a44c5141f2c790f94ec2dd8a1a4f7e" kindref="member">DHCP_OPTION_T2</ref>):</highlight></codeline>
<codeline lineno="1577"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;len<sp/>==<sp/>4&quot;</highlight><highlight class="normal">,<sp/>len<sp/>==<sp/>4,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1578"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_idx<sp/>=<sp/>DHCP_OPTION_IDX_T2;</highlight></codeline>
<codeline lineno="1579"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1580"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="1581"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_len<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1582"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;skipping<sp/>option<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>in<sp/>options\n&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)op));</highlight></codeline>
<codeline lineno="1583"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1584"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1585"><highlight class="normal"><sp/><sp/><sp/><sp/>offset<sp/>+=<sp/>len<sp/>+<sp/>2;</highlight></codeline>
<codeline lineno="1586"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(decode_len<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1587"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>value<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1588"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>copy_len;</highlight></codeline>
<codeline lineno="1589"><highlight class="normal">decode_next:</highlight></codeline>
<codeline lineno="1590"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;check<sp/>decode_idx&quot;</highlight><highlight class="normal">,<sp/>decode_idx<sp/>&gt;=<sp/>0<sp/>&amp;&amp;<sp/>decode_idx<sp/>&lt;<sp/>DHCP_OPTION_IDX_MAX);</highlight></codeline>
<codeline lineno="1591"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!dhcp_option_given(dhcp,<sp/>decode_idx))<sp/>{</highlight></codeline>
<codeline lineno="1592"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>copy_len<sp/>=<sp/><ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>(decode_len,<sp/>4);</highlight></codeline>
<codeline lineno="1593"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="group__pbuf_1gac2f1f58fd36042e82af46f5015720899" kindref="member">pbuf_copy_partial</ref>(q,<sp/>&amp;value,<sp/>copy_len,<sp/>val_offset)<sp/>!=<sp/>copy_len)<sp/>{</highlight></codeline>
<codeline lineno="1594"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca05c91366f1b5203a5db9a241b415cd63" kindref="member">ERR_BUF</ref>;</highlight></codeline>
<codeline lineno="1595"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1596"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(decode_len<sp/>&gt;<sp/>4)<sp/>{</highlight></codeline>
<codeline lineno="1597"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>decode<sp/>more<sp/>than<sp/>one<sp/>u32_t<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1598"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;decode_len<sp/>%%<sp/>4<sp/>==<sp/>0&quot;</highlight><highlight class="normal">,<sp/>decode_len<sp/>%<sp/>4<sp/>==<sp/>0,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1599"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_got_option(dhcp,<sp/>decode_idx);</highlight></codeline>
<codeline lineno="1600"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_set_option_value(dhcp,<sp/>decode_idx,<sp/><ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(value));</highlight></codeline>
<codeline lineno="1601"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_len<sp/>-=<sp/>4;</highlight></codeline>
<codeline lineno="1602"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>val_offset<sp/>+=<sp/>4;</highlight></codeline>
<codeline lineno="1603"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>decode_idx++;</highlight></codeline>
<codeline lineno="1604"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>decode_next;</highlight></codeline>
<codeline lineno="1605"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(decode_len<sp/>==<sp/>4)<sp/>{</highlight></codeline>
<codeline lineno="1606"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>value<sp/>=<sp/><ref refid="def_8h_1a56098407d66feb75806f655bafbee81d" kindref="member">lwip_ntohl</ref>(value);</highlight></codeline>
<codeline lineno="1607"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1608"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>decode_len&quot;</highlight><highlight class="normal">,<sp/>decode_len<sp/>==<sp/>1,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1609"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>value<sp/>=<sp/>((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)&amp;value)[0];</highlight></codeline>
<codeline lineno="1610"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1611"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_got_option(dhcp,<sp/>decode_idx);</highlight></codeline>
<codeline lineno="1612"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_set_option_value(dhcp,<sp/>decode_idx,<sp/>value);</highlight></codeline>
<codeline lineno="1613"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1614"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1615"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(offset<sp/>&gt;=<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1616"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>offset<sp/>-=<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="1617"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>offset_max<sp/>-=<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="1618"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((offset<sp/>&lt;<sp/>offset_max)<sp/>&amp;&amp;<sp/>offset_max)<sp/>{</highlight></codeline>
<codeline lineno="1619"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>q<sp/>=<sp/>q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="1620"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;next<sp/>pbuf<sp/>was<sp/>null&quot;</highlight><highlight class="normal">,<sp/>q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>,<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1621"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>options<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)q-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="1622"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1623"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We&apos;ve<sp/>run<sp/>out<sp/>of<sp/>bytes,<sp/>probably<sp/>no<sp/>end<sp/>marker.<sp/>Don&apos;t<sp/>proceed.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1624"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1625"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1626"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1627"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1628"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>is<sp/>this<sp/>an<sp/>overloaded<sp/>message?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1629"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_option_given(dhcp,<sp/>DHCP_OPTION_IDX_OVERLOAD))<sp/>{</highlight></codeline>
<codeline lineno="1630"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>overload<sp/>=<sp/>dhcp_get_option_value(dhcp,<sp/>DHCP_OPTION_IDX_OVERLOAD);</highlight></codeline>
<codeline lineno="1631"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_clear_option(dhcp,<sp/>DHCP_OPTION_IDX_OVERLOAD);</highlight></codeline>
<codeline lineno="1632"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(overload<sp/>==<sp/><ref refid="prot_2dhcp_8h_1a04a7b3f1d9138c82c51f2752d440c13e" kindref="member">DHCP_OVERLOAD_FILE</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1633"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>parse_file_as_options<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1634"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;overloaded<sp/>file<sp/>field\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1635"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(overload<sp/>==<sp/><ref refid="prot_2dhcp_8h_1a76d647c8774a4169ac92e01400bbb6ea" kindref="member">DHCP_OVERLOAD_SNAME</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1636"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>parse_sname_as_options<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1637"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;overloaded<sp/>sname<sp/>field\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1638"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(overload<sp/>==<sp/><ref refid="prot_2dhcp_8h_1a07ea61064695eda45483c4c0a192614c" kindref="member">DHCP_OVERLOAD_SNAME_FILE</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1639"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>parse_sname_as_options<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1640"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>parse_file_as_options<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1641"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;overloaded<sp/>sname<sp/>and<sp/>file<sp/>field\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1642"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1643"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>overload<sp/>option:<sp/>%d\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal">)overload));</highlight></codeline>
<codeline lineno="1644"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1645"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DHCP_BOOTP_FILE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1646"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!parse_file_as_options)<sp/>{</highlight></codeline>
<codeline lineno="1647"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>only<sp/>do<sp/>this<sp/>for<sp/>ACK<sp/>messages<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1648"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_option_given(dhcp,<sp/>DHCP_OPTION_IDX_MSG_TYPE)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1649"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(dhcp_get_option_value(dhcp,<sp/>DHCP_OPTION_IDX_MSG_TYPE)<sp/>==<sp/><ref refid="prot_2dhcp_8h_1a3cca70105d2c42c3381829f456446e0e" kindref="member">DHCP_ACK</ref>))</highlight></codeline>
<codeline lineno="1650"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>bootp<sp/>file<sp/>name,<sp/>don&apos;t<sp/>care<sp/>for<sp/>sname<sp/>(server<sp/>hostname)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1651"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="group__pbuf_1gac2f1f58fd36042e82af46f5015720899" kindref="member">pbuf_copy_partial</ref>(p,<sp/>dhcp-&gt;boot_file_name,<sp/><ref refid="prot_2dhcp_8h_1a4ffd004c5d53666e9315d9571af6d41b" kindref="member">DHCP_FILE_LEN</ref>-1,<sp/><ref refid="prot_2dhcp_8h_1a87e51df90840a08fe0a3602d126ebfe3" kindref="member">DHCP_FILE_OFS</ref>)<sp/>!=<sp/>(<ref refid="prot_2dhcp_8h_1a4ffd004c5d53666e9315d9571af6d41b" kindref="member">DHCP_FILE_LEN</ref>-1))<sp/>{</highlight></codeline>
<codeline lineno="1652"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca05c91366f1b5203a5db9a241b415cd63" kindref="member">ERR_BUF</ref>;</highlight></codeline>
<codeline lineno="1653"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1654"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>make<sp/>sure<sp/>the<sp/>string<sp/>is<sp/>really<sp/>NULL-terminated<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1655"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp-&gt;boot_file_name[<ref refid="prot_2dhcp_8h_1a4ffd004c5d53666e9315d9571af6d41b" kindref="member">DHCP_FILE_LEN</ref>-1]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1656"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1657"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DHCP_BOOTP_FILE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1658"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1659"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(parse_file_as_options)<sp/>{</highlight></codeline>
<codeline lineno="1660"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>both<sp/>are<sp/>overloaded,<sp/>parse<sp/>file<sp/>first<sp/>and<sp/>then<sp/>sname<sp/>(RFC<sp/>2131<sp/>ch.<sp/>4.1)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1661"><highlight class="normal"><sp/><sp/><sp/><sp/>parse_file_as_options<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1662"><highlight class="normal"><sp/><sp/><sp/><sp/>options_idx<sp/>=<sp/><ref refid="prot_2dhcp_8h_1a87e51df90840a08fe0a3602d126ebfe3" kindref="member">DHCP_FILE_OFS</ref>;</highlight></codeline>
<codeline lineno="1663"><highlight class="normal"><sp/><sp/><sp/><sp/>options_idx_max<sp/>=<sp/><ref refid="prot_2dhcp_8h_1a87e51df90840a08fe0a3602d126ebfe3" kindref="member">DHCP_FILE_OFS</ref><sp/>+<sp/><ref refid="prot_2dhcp_8h_1a4ffd004c5d53666e9315d9571af6d41b" kindref="member">DHCP_FILE_LEN</ref>;</highlight></codeline>
<codeline lineno="1664"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>again;</highlight></codeline>
<codeline lineno="1665"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(parse_sname_as_options)<sp/>{</highlight></codeline>
<codeline lineno="1666"><highlight class="normal"><sp/><sp/><sp/><sp/>parse_sname_as_options<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1667"><highlight class="normal"><sp/><sp/><sp/><sp/>options_idx<sp/>=<sp/><ref refid="prot_2dhcp_8h_1a370421b9ce80052774e0dd8a6437a025" kindref="member">DHCP_SNAME_OFS</ref>;</highlight></codeline>
<codeline lineno="1668"><highlight class="normal"><sp/><sp/><sp/><sp/>options_idx_max<sp/>=<sp/><ref refid="prot_2dhcp_8h_1a370421b9ce80052774e0dd8a6437a025" kindref="member">DHCP_SNAME_OFS</ref><sp/>+<sp/><ref refid="prot_2dhcp_8h_1a4227e9baee8b09567d1d9dda9d8a8cf3" kindref="member">DHCP_SNAME_LEN</ref>;</highlight></codeline>
<codeline lineno="1669"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>again;</highlight></codeline>
<codeline lineno="1670"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1671"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="1672"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1673"><highlight class="normal"></highlight></codeline>
<codeline lineno="1677"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1678"><highlight class="normal">dhcp_recv(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*arg,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>udp_pcb<sp/>*pcb,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*addr,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>port)</highlight></codeline>
<codeline lineno="1679"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1680"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="ip_8h_1ae214afa9d3f1b26fc8d538436b8fa3c4" kindref="member">ip_current_input_netif</ref>();</highlight></codeline>
<codeline lineno="1681"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp<sp/>*dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1682"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref><sp/>*reply_msg<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="1683"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>msg_type;</highlight></codeline>
<codeline lineno="1684"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1685"><highlight class="normal"></highlight></codeline>
<codeline lineno="1686"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(arg);</highlight></codeline>
<codeline lineno="1687"><highlight class="normal"></highlight></codeline>
<codeline lineno="1688"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Caught<sp/>DHCP<sp/>message<sp/>from<sp/>netif<sp/>that<sp/>does<sp/>not<sp/>have<sp/>DHCP<sp/>enabled?<sp/>-&gt;<sp/>not<sp/>interested<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1689"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((dhcp<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/>(dhcp-&gt;pcb_allocated<sp/>==<sp/>0))<sp/>{</highlight></codeline>
<codeline lineno="1690"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>free_pbuf_and_return;</highlight></codeline>
<codeline lineno="1691"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1692"><highlight class="normal"></highlight></codeline>
<codeline lineno="1693"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>server<sp/>address<sp/>type&quot;</highlight><highlight class="normal">,<sp/><ref refid="ip__addr_8h_1abee5dab2191bb0f3355d7f30d1496f24" kindref="member">IP_IS_V4</ref>(addr));</highlight></codeline>
<codeline lineno="1694"><highlight class="normal"></highlight></codeline>
<codeline lineno="1695"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_recv(pbuf<sp/>=<sp/>%p)<sp/>from<sp/>DHCP<sp/>server<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;.%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>port<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)p,</highlight></codeline>
<codeline lineno="1696"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr1_16(ip_2_ip4(addr)),<sp/>ip4_addr2_16(ip_2_ip4(addr)),<sp/>ip4_addr3_16(ip_2_ip4(addr)),<sp/>ip4_addr4_16(ip_2_ip4(addr)),<sp/>port));</highlight></codeline>
<codeline lineno="1697"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf-&gt;len<sp/>=<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>p-&gt;len));</highlight></codeline>
<codeline lineno="1698"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf-&gt;tot_len<sp/>=<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>p-&gt;tot_len));</highlight></codeline>
<codeline lineno="1699"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>prevent<sp/>warnings<sp/>about<sp/>unused<sp/>arguments<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1700"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(pcb);</highlight></codeline>
<codeline lineno="1701"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(addr);</highlight></codeline>
<codeline lineno="1702"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(port);</highlight></codeline>
<codeline lineno="1703"><highlight class="normal"></highlight></codeline>
<codeline lineno="1704"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;reply<sp/>wasn&apos;t<sp/>freed&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;msg_in<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1705"><highlight class="normal"></highlight></codeline>
<codeline lineno="1706"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;len<sp/>&lt;<sp/>DHCP_MIN_REPLY_LEN)<sp/>{</highlight></codeline>
<codeline lineno="1707"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga77c491e468bf7d9a1bc48430c1866a96" kindref="member">LWIP_DBG_LEVEL_WARNING</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;DHCP<sp/>reply<sp/>message<sp/>or<sp/>pbuf<sp/>too<sp/>short\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1708"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>free_pbuf_and_return;</highlight></codeline>
<codeline lineno="1709"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1710"><highlight class="normal"></highlight></codeline>
<codeline lineno="1711"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(reply_msg-&gt;op<sp/>!=<sp/><ref refid="prot_2dhcp_8h_1a17ef000d25276ab6ca9d773af0d97d21" kindref="member">DHCP_BOOTREPLY</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1712"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga77c491e468bf7d9a1bc48430c1866a96" kindref="member">LWIP_DBG_LEVEL_WARNING</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;not<sp/>a<sp/>DHCP<sp/>reply<sp/>message,<sp/>but<sp/>type<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)reply_msg-&gt;op));</highlight></codeline>
<codeline lineno="1713"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>free_pbuf_and_return;</highlight></codeline>
<codeline lineno="1714"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1715"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>iterate<sp/>through<sp/>hardware<sp/>address<sp/>and<sp/>match<sp/>against<sp/>DHCP<sp/>message<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1716"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref><sp/>&amp;&amp;<sp/>i<sp/>&lt;<sp/><ref refid="netif_8h_1ab887a8ec553de1be1d04cf2961c63c41" kindref="member">NETIF_MAX_HWADDR_LEN</ref><sp/>&amp;&amp;<sp/>i<sp/>&lt;<sp/><ref refid="prot_2dhcp_8h_1a15b8e74ffbf5eb908da440c307401c04" kindref="member">DHCP_CHADDR_LEN</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1717"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>[i]<sp/>!=<sp/>reply_msg-&gt;chaddr[i])<sp/>{</highlight></codeline>
<codeline lineno="1718"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga77c491e468bf7d9a1bc48430c1866a96" kindref="member">LWIP_DBG_LEVEL_WARNING</ref>,</highlight></codeline>
<codeline lineno="1719"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;netif-&gt;hwaddr[%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;]==%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>!=<sp/>reply_msg-&gt;chaddr[%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;]==%02&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1ga1418f92673e54a36b6e376109e526382" kindref="member">X16_F</ref></highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1720"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)i,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>[i],<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)i,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)reply_msg-&gt;chaddr[i]));</highlight></codeline>
<codeline lineno="1721"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>free_pbuf_and_return;</highlight></codeline>
<codeline lineno="1722"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1723"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1724"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>match<sp/>transaction<sp/>ID<sp/>against<sp/>what<sp/>we<sp/>expected<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1725"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="def_8h_1a56098407d66feb75806f655bafbee81d" kindref="member">lwip_ntohl</ref>(reply_msg-&gt;xid)<sp/>!=<sp/>dhcp-&gt;xid)<sp/>{</highlight></codeline>
<codeline lineno="1726"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga77c491e468bf7d9a1bc48430c1866a96" kindref="member">LWIP_DBG_LEVEL_WARNING</ref>,</highlight></codeline>
<codeline lineno="1727"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;transaction<sp/>id<sp/>mismatch<sp/>reply_msg-&gt;xid(%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;)!=dhcp-&gt;xid(%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;)\n&quot;</highlight><highlight class="normal">,<ref refid="def_8h_1a56098407d66feb75806f655bafbee81d" kindref="member">lwip_ntohl</ref>(reply_msg-&gt;xid),dhcp-&gt;xid));</highlight></codeline>
<codeline lineno="1728"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>free_pbuf_and_return;</highlight></codeline>
<codeline lineno="1729"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1730"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>option<sp/>fields<sp/>could<sp/>be<sp/>unfold?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1731"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp_parse_reply(dhcp,<sp/>p)<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1732"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,</highlight></codeline>
<codeline lineno="1733"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;problem<sp/>unfolding<sp/>DHCP<sp/>message<sp/>-<sp/>too<sp/>short<sp/>on<sp/>memory?\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1734"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>free_pbuf_and_return;</highlight></codeline>
<codeline lineno="1735"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1736"><highlight class="normal"></highlight></codeline>
<codeline lineno="1737"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;searching<sp/>DHCP_OPTION_MESSAGE_TYPE\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1738"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>obtain<sp/>pointer<sp/>to<sp/>DHCP<sp/>message<sp/>type<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1739"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!dhcp_option_given(dhcp,<sp/>DHCP_OPTION_IDX_MSG_TYPE))<sp/>{</highlight></codeline>
<codeline lineno="1740"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga77c491e468bf7d9a1bc48430c1866a96" kindref="member">LWIP_DBG_LEVEL_WARNING</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;DHCP_OPTION_MESSAGE_TYPE<sp/>option<sp/>not<sp/>found\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1741"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>free_pbuf_and_return;</highlight></codeline>
<codeline lineno="1742"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1743"><highlight class="normal"></highlight></codeline>
<codeline lineno="1744"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>read<sp/>DHCP<sp/>message<sp/>type<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1745"><highlight class="normal"><sp/><sp/>msg_type<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)dhcp_get_option_value(dhcp,<sp/>DHCP_OPTION_IDX_MSG_TYPE);</highlight></codeline>
<codeline lineno="1746"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>message<sp/>type<sp/>is<sp/>DHCP<sp/>ACK?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1747"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(msg_type<sp/>==<sp/><ref refid="prot_2dhcp_8h_1a3cca70105d2c42c3381829f456446e0e" kindref="member">DHCP_ACK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1748"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;DHCP_ACK<sp/>received\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1749"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>in<sp/>requesting<sp/>state?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1750"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaba0a132e9bb9e5468d04013266e8c997" kindref="member">DHCP_STATE_REQUESTING</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1751"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_handle_ack(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1752"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DHCP_DOES_ARP_CHECK</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1753"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="group__netif__flags_1ga92448dc510bc8d700c09e5c971ef0676" kindref="member">NETIF_FLAG_ETHARP</ref>)<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1754"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>check<sp/>if<sp/>the<sp/>acknowledged<sp/>lease<sp/>address<sp/>is<sp/>already<sp/>in<sp/>use<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1755"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_check(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1756"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1757"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>bind<sp/>interface<sp/>to<sp/>the<sp/>acknowledged<sp/>lease<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1758"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_bind(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1759"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1760"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1761"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>bind<sp/>interface<sp/>to<sp/>the<sp/>acknowledged<sp/>lease<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1762"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_bind(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1763"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1764"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1765"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>already<sp/>bound<sp/>to<sp/>the<sp/>given<sp/>lease<sp/>address?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1766"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba59b94c72eaa1d506d9014de5c9ff5608" kindref="member">DHCP_STATE_REBOOTING</ref>)<sp/>||<sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaf55c3505a4745661f94134f8ccaa6c27" kindref="member">DHCP_STATE_REBINDING</ref>)<sp/>||</highlight></codeline>
<codeline lineno="1767"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbacd567c9a791f5112e7b5a46be86548cd" kindref="member">DHCP_STATE_RENEWING</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1768"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_handle_ack(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1769"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dhcp_bind(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1770"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1771"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1772"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>received<sp/>a<sp/>DHCP_NAK<sp/>in<sp/>appropriate<sp/>state?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1773"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((msg_type<sp/>==<sp/><ref refid="prot_2dhcp_8h_1a12682fd5edb10129309f2046504d4221" kindref="member">DHCP_NAK</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1774"><highlight class="normal"><sp/><sp/><sp/><sp/>((dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba59b94c72eaa1d506d9014de5c9ff5608" kindref="member">DHCP_STATE_REBOOTING</ref>)<sp/>||<sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaba0a132e9bb9e5468d04013266e8c997" kindref="member">DHCP_STATE_REQUESTING</ref>)<sp/>||</highlight></codeline>
<codeline lineno="1775"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaf55c3505a4745661f94134f8ccaa6c27" kindref="member">DHCP_STATE_REBINDING</ref>)<sp/>||<sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbacd567c9a791f5112e7b5a46be86548cd" kindref="member">DHCP_STATE_RENEWING</ref><sp/><sp/>)))<sp/>{</highlight></codeline>
<codeline lineno="1776"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;DHCP_NAK<sp/>received\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1777"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_handle_nak(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1778"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1779"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>received<sp/>a<sp/>DHCP_OFFER<sp/>in<sp/>DHCP_STATE_SELECTING<sp/>state?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1780"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((msg_type<sp/>==<sp/><ref refid="prot_2dhcp_8h_1a4649df4abbae20e28fe422d09decd450" kindref="member">DHCP_OFFER</ref>)<sp/>&amp;&amp;<sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba8a0dca73b4731e6e475dbedc75082bc5" kindref="member">DHCP_STATE_SELECTING</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1781"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;DHCP_OFFER<sp/>received<sp/>in<sp/>DHCP_STATE_SELECTING<sp/>state\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1782"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;request_timeout<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1783"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>offered<sp/>lease<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1784"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp_handle_offer(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1785"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1786"><highlight class="normal"></highlight></codeline>
<codeline lineno="1787"><highlight class="normal">free_pbuf_and_return:</highlight></codeline>
<codeline lineno="1788"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1789"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;msg_in<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1790"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1791"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1792"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1793"><highlight class="normal"></highlight></codeline>
<codeline lineno="1801"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1802"><highlight class="normal">dhcp_create_msg(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>message_type)</highlight></codeline>
<codeline lineno="1803"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1804"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1805"><highlight class="normal"></highlight><highlight class="preprocessor">#ifndef<sp/>DHCP_GLOBAL_XID</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1806"><highlight class="normal"></highlight></codeline>
<codeline lineno="1810"><highlight class="preprocessor">#if<sp/>DHCP_CREATE_RAND_XID<sp/>&amp;&amp;<sp/>defined(LWIP_RAND)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1811"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>xid;</highlight></codeline>
<codeline lineno="1812"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>DHCP_CREATE_RAND_XID<sp/>&amp;&amp;<sp/>defined(LWIP_RAND)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1813"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>xid<sp/>=<sp/>0xABCD0000;</highlight></codeline>
<codeline lineno="1814"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DHCP_CREATE_RAND_XID<sp/>&amp;&amp;<sp/>defined(LWIP_RAND)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1815"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1816"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!xid_initialised)<sp/>{</highlight></codeline>
<codeline lineno="1817"><highlight class="normal"><sp/><sp/><sp/><sp/>xid<sp/>=<sp/>DHCP_GLOBAL_XID;</highlight></codeline>
<codeline lineno="1818"><highlight class="normal"><sp/><sp/><sp/><sp/>xid_initialised<sp/>=<sp/>!xid_initialised;</highlight></codeline>
<codeline lineno="1819"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1820"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1821"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_create_msg:<sp/>netif<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="1822"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_create_msg:<sp/>dhcp<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>(dhcp<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="1823"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_create_msg:<sp/>dhcp-&gt;p_out<sp/>==<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;p_out<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1824"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_create_msg:<sp/>dhcp-&gt;msg_out<sp/>==<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;msg_out<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1825"><highlight class="normal"><sp/><sp/>dhcp-&gt;p_out<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa2ded3594a3977f8bf9cf09552be327b5" kindref="member">PBUF_TRANSPORT</ref>,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref>),<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>);</highlight></codeline>
<codeline lineno="1826"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;p_out<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1827"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,</highlight></codeline>
<codeline lineno="1828"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;dhcp_create_msg():<sp/>could<sp/>not<sp/>allocate<sp/>pbuf\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1829"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="1830"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1831"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_create_msg:<sp/>check<sp/>that<sp/>first<sp/>pbuf<sp/>can<sp/>hold<sp/>struct<sp/>dhcp_msg&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1832"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(dhcp-&gt;p_out-&gt;len<sp/>&gt;=<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref>)));</highlight></codeline>
<codeline lineno="1833"><highlight class="normal"></highlight></codeline>
<codeline lineno="1834"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>DHCP_REQUEST<sp/>should<sp/>reuse<sp/>&apos;xid&apos;<sp/>from<sp/>DHCPOFFER<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1835"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((message_type<sp/>!=<sp/><ref refid="prot_2dhcp_8h_1a98a346c53c91848070fd980a98fa77d1" kindref="member">DHCP_REQUEST</ref>)<sp/>||<sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba59b94c72eaa1d506d9014de5c9ff5608" kindref="member">DHCP_STATE_REBOOTING</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1836"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>reuse<sp/>transaction<sp/>identifier<sp/>in<sp/>retransmissions<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1837"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;tries<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1838"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DHCP_CREATE_RAND_XID<sp/>&amp;&amp;<sp/>defined(LWIP_RAND)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1839"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>xid<sp/>=<sp/>LWIP_RAND();</highlight></codeline>
<codeline lineno="1840"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>DHCP_CREATE_RAND_XID<sp/>&amp;&amp;<sp/>defined(LWIP_RAND)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1841"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>xid++;</highlight></codeline>
<codeline lineno="1842"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DHCP_CREATE_RAND_XID<sp/>&amp;&amp;<sp/>defined(LWIP_RAND)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1843"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1844"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;xid<sp/>=<sp/>xid;</highlight></codeline>
<codeline lineno="1845"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1846"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a97927ceecabcdb5f41735bf372a05cee" kindref="member">DHCP_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,</highlight></codeline>
<codeline lineno="1847"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;transaction<sp/>id<sp/>xid(%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac219830a93d05c5f18f64ce87a34be14" kindref="member">X32_F</ref></highlight><highlight class="stringliteral">&quot;)\n&quot;</highlight><highlight class="normal">,<sp/>xid));</highlight></codeline>
<codeline lineno="1848"><highlight class="normal"></highlight></codeline>
<codeline lineno="1849"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structdhcp__msg" kindref="compound">dhcp_msg</ref><sp/>*)dhcp-&gt;p_out-&gt;payload;</highlight></codeline>
<codeline lineno="1850"><highlight class="normal"></highlight></codeline>
<codeline lineno="1851"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;op<sp/>=<sp/><ref refid="prot_2dhcp_8h_1a752b1eb7aba89801f20202b074f03b67" kindref="member">DHCP_BOOTREQUEST</ref>;</highlight></codeline>
<codeline lineno="1852"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo:<sp/>make<sp/>link<sp/>layer<sp/>independent<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1853"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;htype<sp/>=<sp/><ref refid="prot_2dhcp_8h_1aa9bbddbdf30ee61e9bc529d1981f943a" kindref="member">DHCP_HTYPE_ETH</ref>;</highlight></codeline>
<codeline lineno="1854"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;hlen<sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref>;</highlight></codeline>
<codeline lineno="1855"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;hops<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1856"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;xid<sp/>=<sp/><ref refid="def_8c_1a14f94347a5b9b9e3602705b75b7ae524" kindref="member">lwip_htonl</ref>(dhcp-&gt;xid);</highlight></codeline>
<codeline lineno="1857"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;secs<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1858"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>we<sp/>don&apos;t<sp/>need<sp/>the<sp/>broadcast<sp/>flag<sp/>since<sp/>we<sp/>can<sp/>receive<sp/>unicast<sp/>traffic</highlight></codeline>
<codeline lineno="1859"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>before<sp/>being<sp/>fully<sp/>configured!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1860"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;flags<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1861"><highlight class="normal"><sp/><sp/>ip4_addr_set_zero(&amp;dhcp-&gt;msg_out-&gt;ciaddr);</highlight></codeline>
<codeline lineno="1862"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>ciaddr<sp/>to<sp/>netif-&gt;ip_addr<sp/>based<sp/>on<sp/>message_type<sp/>and<sp/>state<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1863"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((message_type<sp/>==<sp/><ref refid="prot_2dhcp_8h_1aaea6a969c0da81c2611885514bbe433f" kindref="member">DHCP_INFORM</ref>)<sp/>||<sp/>(message_type<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ae7469660afdf7997c020f7fbf5164548" kindref="member">DHCP_DECLINE</ref>)<sp/>||<sp/>(message_type<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ae629d2dc5df40f03ea87cc94a5e3f3eb" kindref="member">DHCP_RELEASE</ref>)<sp/>||</highlight></codeline>
<codeline lineno="1864"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>((message_type<sp/>==<sp/><ref refid="prot_2dhcp_8h_1a98a346c53c91848070fd980a98fa77d1" kindref="member">DHCP_REQUEST</ref>)<sp/>&amp;&amp;<sp/></highlight><highlight class="comment">/*<sp/>DHCP_STATE_BOUND<sp/>not<sp/>used<sp/>for<sp/>sending!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1865"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>((dhcp-&gt;state==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbacd567c9a791f5112e7b5a46be86548cd" kindref="member">DHCP_STATE_RENEWING</ref>)<sp/>||<sp/>dhcp-&gt;state==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaf55c3505a4745661f94134f8ccaa6c27" kindref="member">DHCP_STATE_REBINDING</ref>)))<sp/>{</highlight></codeline>
<codeline lineno="1866"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_copy(dhcp-&gt;msg_out-&gt;ciaddr,<sp/>*netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="1867"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1868"><highlight class="normal"><sp/><sp/>ip4_addr_set_zero(&amp;dhcp-&gt;msg_out-&gt;yiaddr);</highlight></codeline>
<codeline lineno="1869"><highlight class="normal"><sp/><sp/>ip4_addr_set_zero(&amp;dhcp-&gt;msg_out-&gt;siaddr);</highlight></codeline>
<codeline lineno="1870"><highlight class="normal"><sp/><sp/>ip4_addr_set_zero(&amp;dhcp-&gt;msg_out-&gt;giaddr);</highlight></codeline>
<codeline lineno="1871"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="prot_2dhcp_8h_1a15b8e74ffbf5eb908da440c307401c04" kindref="member">DHCP_CHADDR_LEN</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1872"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>netif<sp/>hardware<sp/>address,<sp/>pad<sp/>with<sp/>zeroes<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1873"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;msg_out-&gt;chaddr[i]<sp/>=<sp/>(i<sp/>&lt;<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1afe1181561cb16241f3cb5ed01e567d42" kindref="member">hwaddr_len</ref><sp/>&amp;&amp;<sp/>i<sp/>&lt;<sp/><ref refid="netif_8h_1ab887a8ec553de1be1d04cf2961c63c41" kindref="member">NETIF_MAX_HWADDR_LEN</ref>)<sp/>?<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1aee967965d999fc1a4c40a66709304e69" kindref="member">hwaddr</ref>[i]<sp/>:<sp/>0</highlight><highlight class="comment">/*<sp/>pad<sp/>byte*/</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1874"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1875"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="prot_2dhcp_8h_1a4227e9baee8b09567d1d9dda9d8a8cf3" kindref="member">DHCP_SNAME_LEN</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1876"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;msg_out-&gt;sname[i]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1877"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1878"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="prot_2dhcp_8h_1a4ffd004c5d53666e9315d9571af6d41b" kindref="member">DHCP_FILE_LEN</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1879"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;msg_out-&gt;file[i]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1880"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1881"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;cookie<sp/>=<sp/><ref refid="def_8h_1afea9c21aa1f56180cdf6fb42ef14a294" kindref="member">PP_HTONL</ref>(<ref refid="prot_2dhcp_8h_1ac38bb410b5a906ccc81317bf2197d0d5" kindref="member">DHCP_MAGIC_COOKIE</ref>);</highlight></codeline>
<codeline lineno="1882"><highlight class="normal"><sp/><sp/>dhcp-&gt;options_out_len<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1883"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>fill<sp/>options<sp/>field<sp/>with<sp/>an<sp/>incrementing<sp/>array<sp/>(for<sp/>debugging<sp/>purposes)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1884"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1885"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;msg_out-&gt;options[i]<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)i;<sp/></highlight><highlight class="comment">/*<sp/>for<sp/>debugging<sp/>only,<sp/>no<sp/>matter<sp/>if<sp/>truncated<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1886"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1887"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Add<sp/>option<sp/>MESSAGE_TYPE<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1888"><highlight class="normal"><sp/><sp/>dhcp_option(dhcp,<sp/><ref refid="prot_2dhcp_8h_1ab023a7a8b3307a68a2eff10a217e48a8" kindref="member">DHCP_OPTION_MESSAGE_TYPE</ref>,<sp/><ref refid="prot_2dhcp_8h_1a9cf37917cca6ff44e6e409e1fc30ce6b" kindref="member">DHCP_OPTION_MESSAGE_TYPE_LEN</ref>);</highlight></codeline>
<codeline lineno="1889"><highlight class="normal"><sp/><sp/>dhcp_option_byte(dhcp,<sp/>message_type);</highlight></codeline>
<codeline lineno="1890"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="1891"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1892"><highlight class="normal"></highlight></codeline>
<codeline lineno="1898"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1899"><highlight class="normal">dhcp_delete_msg(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp)</highlight></codeline>
<codeline lineno="1900"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1901"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_delete_msg:<sp/>dhcp<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>(dhcp<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;);</highlight></codeline>
<codeline lineno="1902"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_delete_msg:<sp/>dhcp-&gt;p_out<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;p_out<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1903"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_delete_msg:<sp/>dhcp-&gt;msg_out<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;msg_out<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1904"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dhcp-&gt;p_out<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1905"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(dhcp-&gt;p_out);</highlight></codeline>
<codeline lineno="1906"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1907"><highlight class="normal"><sp/><sp/>dhcp-&gt;p_out<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1908"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1909"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1910"><highlight class="normal"></highlight></codeline>
<codeline lineno="1919"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1920"><highlight class="normal">dhcp_option_trailer(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dhcp<sp/>*dhcp)</highlight></codeline>
<codeline lineno="1921"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1922"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_option_trailer:<sp/>dhcp<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>(dhcp<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;);</highlight></codeline>
<codeline lineno="1923"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_option_trailer:<sp/>dhcp-&gt;msg_out<sp/>!=<sp/>NULL\n&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;msg_out<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1924"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dhcp_option_trailer:<sp/>dhcp-&gt;options_out_len<sp/>&lt;<sp/>DHCP_OPTIONS_LEN\n&quot;</highlight><highlight class="normal">,<sp/>dhcp-&gt;options_out_len<sp/>&lt;<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref>);</highlight></codeline>
<codeline lineno="1925"><highlight class="normal"><sp/><sp/>dhcp-&gt;msg_out-&gt;options[dhcp-&gt;options_out_len++]<sp/>=<sp/><ref refid="prot_2dhcp_8h_1aea2eb67064efec2c65fff4497f659e7d" kindref="member">DHCP_OPTION_END</ref>;</highlight></codeline>
<codeline lineno="1926"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>packet<sp/>is<sp/>too<sp/>small,<sp/>or<sp/>not<sp/>4<sp/>byte<sp/>aligned?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1927"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(((dhcp-&gt;options_out_len<sp/>&lt;<sp/><ref refid="prot_2dhcp_8h_1a639e682d86ae2abca54841cf2d5c7b57" kindref="member">DHCP_MIN_OPTIONS_LEN</ref>)<sp/>||<sp/>(dhcp-&gt;options_out_len<sp/>&amp;<sp/>3))<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1928"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(dhcp-&gt;options_out_len<sp/>&lt;<sp/><ref refid="prot_2dhcp_8h_1ae99d4be0d03f6f9c8f02f63abde91a06" kindref="member">DHCP_OPTIONS_LEN</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1929"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>add<sp/>a<sp/>fill/padding<sp/>byte<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1930"><highlight class="normal"><sp/><sp/><sp/><sp/>dhcp-&gt;msg_out-&gt;options[dhcp-&gt;options_out_len++]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1931"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1932"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1933"><highlight class="normal"></highlight></codeline>
<codeline lineno="1940"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></highlight></codeline>
<codeline lineno="1941"><highlight class="normal">dhcp_supplied_address(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="1942"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1943"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>)<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1944"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dhcp*<sp/>dhcp<sp/>=<sp/>netif_dhcp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="1945"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bba1200a3d268f2eadee62987a8d7d122e8" kindref="member">DHCP_STATE_BOUND</ref>)<sp/>||<sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbacd567c9a791f5112e7b5a46be86548cd" kindref="member">DHCP_STATE_RENEWING</ref>)<sp/>||</highlight></codeline>
<codeline lineno="1946"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(dhcp-&gt;state<sp/>==<sp/><ref refid="prot_2dhcp_8h_1ad85c86fcabb42bf16849247f12d810bbaf55c3505a4745661f94134f8ccaa6c27" kindref="member">DHCP_STATE_REBINDING</ref>);</highlight></codeline>
<codeline lineno="1947"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1948"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="1949"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1950"><highlight class="normal"></highlight></codeline>
<codeline lineno="1951"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_DHCP<sp/>*/</highlight><highlight class="preprocessor"></highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/net/core/ipv4/dhcp.c"/>
  </compounddef>
</doxygen>
