<?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="dns_8c" kind="file" language="C++">
    <compoundname>dns.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="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="1">
        <label>C:/Dev/git/UbixOS/sys/net/core/dns.c</label>
        <link refid="dns_8c"/>
        <childnode refid="2" 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>DNS - host name to IP address resolver. </para>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="37"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="38"><highlight class="comment"><sp/>*<sp/>Port<sp/>to<sp/>lwIP<sp/>from<sp/>uIP</highlight></codeline>
<codeline lineno="39"><highlight class="comment"><sp/>*<sp/>by<sp/>Jim<sp/>Pettinato<sp/>April<sp/>2007</highlight></codeline>
<codeline lineno="40"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="41"><highlight class="comment"><sp/>*<sp/>security<sp/>fixes<sp/>and<sp/>more<sp/>by<sp/>Simon<sp/>Goldschmidt</highlight></codeline>
<codeline lineno="42"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="43"><highlight class="comment"><sp/>*<sp/>uIP<sp/>version<sp/>Copyright<sp/>(c)<sp/>2002-2003,<sp/>Adam<sp/>Dunkels.</highlight></codeline>
<codeline lineno="44"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="45"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="46"><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</highlight></codeline>
<codeline lineno="47"><highlight class="comment"><sp/>*<sp/>modification,<sp/>are<sp/>permitted<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions</highlight></codeline>
<codeline lineno="48"><highlight class="comment"><sp/>*<sp/>are<sp/>met:</highlight></codeline>
<codeline lineno="49"><highlight class="comment"><sp/>*<sp/>1.<sp/>Redistributions<sp/>of<sp/>source<sp/>code<sp/>must<sp/>retain<sp/>the<sp/>above<sp/>copyright</highlight></codeline>
<codeline lineno="50"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>notice,<sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer.</highlight></codeline>
<codeline lineno="51"><highlight class="comment"><sp/>*<sp/>2.<sp/>Redistributions<sp/>in<sp/>binary<sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright</highlight></codeline>
<codeline lineno="52"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>notice,<sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer<sp/>in<sp/>the</highlight></codeline>
<codeline lineno="53"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>documentation<sp/>and/or<sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.</highlight></codeline>
<codeline lineno="54"><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</highlight></codeline>
<codeline lineno="55"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>products<sp/>derived<sp/>from<sp/>this<sp/>software<sp/>without<sp/>specific<sp/>prior</highlight></codeline>
<codeline lineno="56"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>written<sp/>permission.</highlight></codeline>
<codeline lineno="57"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="58"><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</highlight></codeline>
<codeline lineno="59"><highlight class="comment"><sp/>*<sp/>OR<sp/>IMPLIED<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/>IMPLIED</highlight></codeline>
<codeline lineno="60"><highlight class="comment"><sp/>*<sp/>WARRANTIES<sp/>OF<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE</highlight></codeline>
<codeline lineno="61"><highlight class="comment"><sp/>*<sp/>ARE<sp/>DISCLAIMED.<sp/><sp/>IN<sp/>NO<sp/>EVENT<sp/>SHALL<sp/>THE<sp/>AUTHOR<sp/>BE<sp/>LIABLE<sp/>FOR<sp/>ANY</highlight></codeline>
<codeline lineno="62"><highlight class="comment"><sp/>*<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL</highlight></codeline>
<codeline lineno="63"><highlight class="comment"><sp/>*<sp/>DAMAGES<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT<sp/>OF<sp/>SUBSTITUTE</highlight></codeline>
<codeline lineno="64"><highlight class="comment"><sp/>*<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="65"><highlight class="comment"><sp/>*<sp/>INTERRUPTION)<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,</highlight></codeline>
<codeline lineno="66"><highlight class="comment"><sp/>*<sp/>WHETHER<sp/>IN<sp/>CONTRACT,<sp/>STRICT<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING</highlight></codeline>
<codeline lineno="67"><highlight class="comment"><sp/>*<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING<sp/>IN<sp/>ANY<sp/>WAY<sp/>OUT<sp/>OF<sp/>THE<sp/>USE<sp/>OF<sp/>THIS</highlight></codeline>
<codeline lineno="68"><highlight class="comment"><sp/>*<sp/>SOFTWARE,<sp/>EVEN<sp/>IF<sp/>ADVISED<sp/>OF<sp/>THE<sp/>POSSIBILITY<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="69"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="70"><highlight class="normal"></highlight></codeline>
<codeline lineno="71"><highlight class="normal"></highlight><highlight class="comment">/*-----------------------------------------------------------------------------</highlight></codeline>
<codeline lineno="72"><highlight class="comment"><sp/>*<sp/>RFC<sp/>1035<sp/>-<sp/>Domain<sp/>names<sp/>-<sp/>implementation<sp/>and<sp/>specification</highlight></codeline>
<codeline lineno="73"><highlight class="comment"><sp/>*<sp/>RFC<sp/>2181<sp/>-<sp/>Clarifications<sp/>to<sp/>the<sp/>DNS<sp/>Specification</highlight></codeline>
<codeline lineno="74"><highlight class="comment"><sp/>*----------------------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="75"><highlight class="normal"></highlight></codeline>
<codeline lineno="81"><highlight class="comment">/*-----------------------------------------------------------------------------</highlight></codeline>
<codeline lineno="82"><highlight class="comment"><sp/>*<sp/>Includes</highlight></codeline>
<codeline lineno="83"><highlight class="comment"><sp/>*----------------------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="84"><highlight class="normal"></highlight></codeline>
<codeline lineno="85"><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="86"><highlight class="normal"></highlight></codeline>
<codeline lineno="87"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DNS<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="88"><highlight class="normal"></highlight></codeline>
<codeline lineno="89"><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="90"><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="91"><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="92"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="memp_8h" kindref="compound">net/memp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="93"><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="94"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="prot_2dns_8h" kindref="compound">net/prot/dns.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="95"><highlight class="normal"></highlight></codeline>
<codeline lineno="96"><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="97"><highlight class="normal"></highlight></codeline>
<codeline lineno="99"><highlight class="preprocessor">#ifndef<sp/>DNS_RAND_TXID</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="100"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_RAND_XID)<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="101"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DNS_RAND_TXID<sp/>LWIP_RAND</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="102"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="103"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>dns_txid;</highlight></codeline>
<codeline lineno="104"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DNS_RAND_TXID()<sp/>(++dns_txid)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="105"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="106"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="107"><highlight class="normal"></highlight></codeline>
<codeline lineno="109"><highlight class="preprocessor">#ifndef<sp/>DNS_PORT_ALLOWED</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="110"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DNS_PORT_ALLOWED(port)<sp/>((port)<sp/>&gt;=<sp/>1024)</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></codeline>
<codeline lineno="114"><highlight class="preprocessor">#ifndef<sp/>DNS_MAX_RETRIES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DNS_MAX_RETRIES<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="116"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="117"><highlight class="normal"></highlight></codeline>
<codeline lineno="119"><highlight class="preprocessor">#ifndef<sp/>DNS_MAX_TTL</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="120"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DNS_MAX_TTL<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>604800</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="121"><highlight class="normal"></highlight><highlight class="preprocessor">#elif<sp/>DNS_MAX_TTL<sp/>&gt;<sp/>0x7FFFFFFF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="normal"></highlight><highlight class="preprocessor">#error<sp/>DNS_MAX_TTL<sp/>must<sp/>be<sp/>a<sp/>positive<sp/>32-bit<sp/>value</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="123"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="124"><highlight class="normal"></highlight></codeline>
<codeline lineno="125"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_TABLE_SIZE<sp/>&gt;<sp/>255</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="126"><highlight class="normal"></highlight><highlight class="preprocessor">#error<sp/>DNS_TABLE_SIZE<sp/>must<sp/>fit<sp/>into<sp/>an<sp/>u8_t</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="127"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="128"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_MAX_SERVERS<sp/>&gt;<sp/>255</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="129"><highlight class="normal"></highlight><highlight class="preprocessor">#error<sp/>DNS_MAX_SERVERS<sp/>must<sp/>fit<sp/>into<sp/>an<sp/>u8_t</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="130"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="131"><highlight class="normal"></highlight></codeline>
<codeline lineno="132"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>The<sp/>number<sp/>of<sp/>parallel<sp/>requests<sp/>(i.e.<sp/>calls<sp/>to<sp/>dns_gethostbyname</highlight></codeline>
<codeline lineno="133"><highlight class="comment"><sp/>*<sp/>that<sp/>cannot<sp/>be<sp/>answered<sp/>from<sp/>the<sp/>DNS<sp/>table.</highlight></codeline>
<codeline lineno="134"><highlight class="comment"><sp/>*<sp/>This<sp/>is<sp/>set<sp/>to<sp/>the<sp/>table<sp/>size<sp/>by<sp/>default.</highlight></codeline>
<codeline lineno="135"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="136"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING)<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="137"><highlight class="normal"></highlight><highlight class="preprocessor">#ifndef<sp/>DNS_MAX_REQUESTS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="138"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DNS_MAX_REQUESTS<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>DNS_TABLE_SIZE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="139"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="140"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_MAX_REQUESTS<sp/>&gt;<sp/>255</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="141"><highlight class="normal"></highlight><highlight class="preprocessor">#error<sp/>DNS_MAX_REQUESTS<sp/>must<sp/>fit<sp/>into<sp/>an<sp/>u8_t</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="142"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="143"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="144"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="145"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>In<sp/>this<sp/>configuration,<sp/>both<sp/>arrays<sp/>have<sp/>to<sp/>have<sp/>the<sp/>same<sp/>size<sp/>and<sp/>are<sp/>used</highlight></codeline>
<codeline lineno="146"><highlight class="comment"><sp/>*<sp/>like<sp/>one<sp/>entry<sp/>(used/free)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="147"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DNS_MAX_REQUESTS<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>DNS_TABLE_SIZE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="148"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="149"><highlight class="normal"></highlight></codeline>
<codeline lineno="150"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>The<sp/>number<sp/>of<sp/>UDP<sp/>source<sp/>ports<sp/>used<sp/>in<sp/>parallel<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="151"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_RAND_SRC_PORT)<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="152"><highlight class="normal"></highlight><highlight class="preprocessor">#ifndef<sp/>DNS_MAX_SOURCE_PORTS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="153"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DNS_MAX_SOURCE_PORTS<sp/><sp/><sp/><sp/><sp/><sp/>DNS_MAX_REQUESTS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="154"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="155"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_MAX_SOURCE_PORTS<sp/>&gt;<sp/>255</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="156"><highlight class="normal"></highlight><highlight class="preprocessor">#error<sp/>DNS_MAX_SOURCE_PORTS<sp/>must<sp/>fit<sp/>into<sp/>an<sp/>u8_t</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="157"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="158"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="159"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="160"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>DNS_MAX_SOURCE_PORTS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="161"><highlight class="normal"></highlight><highlight class="preprocessor">#undef<sp/>DNS_MAX_SOURCE_PORTS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="162"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="163"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DNS_MAX_SOURCE_PORTS<sp/><sp/><sp/><sp/><sp/><sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="164"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="165"><highlight class="normal"></highlight></codeline>
<codeline lineno="166"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="167"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DNS_ADDRTYPE_IS_IPV6(t)<sp/>(((t)<sp/>==<sp/>LWIP_DNS_ADDRTYPE_IPV6_IPV4)<sp/>||<sp/>((t)<sp/>==<sp/>LWIP_DNS_ADDRTYPE_IPV6))</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="168"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DNS_ADDRTYPE_MATCH_IP(t,<sp/>ip)<sp/>(IP_IS_V6_VAL(ip)<sp/>?<sp/>LWIP_DNS_ADDRTYPE_IS_IPV6(t)<sp/>:<sp/>(!LWIP_DNS_ADDRTYPE_IS_IPV6(t)))</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="169"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DNS_ADDRTYPE_ARG(x)<sp/>,<sp/>x</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="170"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DNS_ADDRTYPE_ARG_OR_ZERO(x)<sp/>x</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="171"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DNS_SET_ADDRTYPE(x,<sp/>y)<sp/>do<sp/>{<sp/>x<sp/>=<sp/>y;<sp/>}<sp/>while(0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="172"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="173"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="174"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DNS_ADDRTYPE_IS_IPV6(t)<sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="175"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="176"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DNS_ADDRTYPE_IS_IPV6(t)<sp/>0</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="177"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="178"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DNS_ADDRTYPE_MATCH_IP(t,<sp/>ip)<sp/>1</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="179"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DNS_ADDRTYPE_ARG(x)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="180"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DNS_ADDRTYPE_ARG_OR_ZERO(x)<sp/>0</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="181"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DNS_SET_ADDRTYPE(x,<sp/>y)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="182"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="183"><highlight class="normal"></highlight></codeline>
<codeline lineno="184"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DNS_SUPPORT_MDNS_QUERIES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="185"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DNS_ISMDNS_ARG(x)<sp/>,<sp/>x</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="186"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="187"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>LWIP_DNS_ISMDNS_ARG(x)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="188"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="189"><highlight class="normal"></highlight></codeline>
<codeline lineno="192"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_query<sp/>{</highlight></codeline>
<codeline lineno="193"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>DNS<sp/>query<sp/>record<sp/>starts<sp/>with<sp/>either<sp/>a<sp/>domain<sp/>name<sp/>or<sp/>a<sp/>pointer</highlight></codeline>
<codeline lineno="194"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>to<sp/>a<sp/>name<sp/>already<sp/>present<sp/>somewhere<sp/>in<sp/>the<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="195"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>type;</highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>cls;</highlight></codeline>
<codeline lineno="197"><highlight class="normal">};</highlight></codeline>
<codeline lineno="198"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>SIZEOF_DNS_QUERY<sp/>4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="199"><highlight class="normal"></highlight></codeline>
<codeline lineno="202"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_answer<sp/>{</highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>DNS<sp/>answer<sp/>record<sp/>starts<sp/>with<sp/>either<sp/>a<sp/>domain<sp/>name<sp/>or<sp/>a<sp/>pointer</highlight></codeline>
<codeline lineno="204"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>to<sp/>a<sp/>name<sp/>already<sp/>present<sp/>somewhere<sp/>in<sp/>the<sp/>packet.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>type;</highlight></codeline>
<codeline lineno="206"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>cls;</highlight></codeline>
<codeline lineno="207"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>ttl;</highlight></codeline>
<codeline lineno="208"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>len;</highlight></codeline>
<codeline lineno="209"><highlight class="normal">};</highlight></codeline>
<codeline lineno="210"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>SIZEOF_DNS_ANSWER<sp/>10</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="211"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>maximum<sp/>allowed<sp/>size<sp/>for<sp/>the<sp/>struct<sp/>due<sp/>to<sp/>non-packed<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="212"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>SIZEOF_DNS_ANSWER_ASSERT<sp/>12</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="213"><highlight class="normal"></highlight></codeline>
<codeline lineno="214"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>DNS<sp/>table<sp/>entry<sp/>states<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="215"><highlight class="normal"></highlight><highlight class="keyword">typedef</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">enum</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="216"><highlight class="normal"><sp/><sp/>DNS_STATE_UNUSED<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0,</highlight></codeline>
<codeline lineno="217"><highlight class="normal"><sp/><sp/>DNS_STATE_NEW<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>1,</highlight></codeline>
<codeline lineno="218"><highlight class="normal"><sp/><sp/>DNS_STATE_ASKING<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>2,</highlight></codeline>
<codeline lineno="219"><highlight class="normal"><sp/><sp/>DNS_STATE_DONE<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>3</highlight></codeline>
<codeline lineno="220"><highlight class="normal">}<sp/>dns_state_enum_t;</highlight></codeline>
<codeline lineno="221"><highlight class="normal"></highlight></codeline>
<codeline lineno="223"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_table_entry<sp/>{</highlight></codeline>
<codeline lineno="224"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>ttl;</highlight></codeline>
<codeline lineno="225"><highlight class="normal"><sp/><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>ipaddr;</highlight></codeline>
<codeline lineno="226"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>txid;</highlight></codeline>
<codeline lineno="227"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/><sp/>state;</highlight></codeline>
<codeline lineno="228"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/><sp/>server_idx;</highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/><sp/>tmr;</highlight></codeline>
<codeline lineno="230"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/><sp/>retries;</highlight></codeline>
<codeline lineno="231"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/><sp/>seqno;</highlight></codeline>
<codeline lineno="232"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_RAND_SRC_PORT)<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="233"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>pcb_idx;</highlight></codeline>
<codeline lineno="234"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="235"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>[<ref refid="lwipopts_8h_1a3b01c79902063c170ef57deb72f56124" kindref="member">DNS_MAX_NAME_LENGTH</ref>];</highlight></codeline>
<codeline lineno="236"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="237"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>reqaddrtype;</highlight></codeline>
<codeline lineno="238"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="239"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DNS_SUPPORT_MDNS_QUERIES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="240"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>is_mdns;</highlight></codeline>
<codeline lineno="241"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="242"><highlight class="normal">};</highlight></codeline>
<codeline lineno="243"><highlight class="normal"></highlight></codeline>
<codeline lineno="246"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_req_entry<sp/>{</highlight></codeline>
<codeline lineno="247"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>pointer<sp/>to<sp/>callback<sp/>on<sp/>DNS<sp/>query<sp/>done<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="248"><highlight class="normal"><sp/><sp/>dns_found_callback<sp/>found;</highlight></codeline>
<codeline lineno="249"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>argument<sp/>passed<sp/>to<sp/>the<sp/>callback<sp/>function<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="250"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*arg;</highlight></codeline>
<codeline lineno="251"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING)<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="252"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>dns_table_idx;</highlight></codeline>
<codeline lineno="253"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="254"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="255"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>reqaddrtype;</highlight></codeline>
<codeline lineno="256"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="257"><highlight class="normal">};</highlight></codeline>
<codeline lineno="258"><highlight class="normal"></highlight></codeline>
<codeline lineno="259"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_LOCAL_HOSTLIST</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="260"><highlight class="normal"></highlight></codeline>
<codeline lineno="261"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_LOCAL_HOSTLIST_IS_DYNAMIC</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="262"><highlight class="normal"></highlight></codeline>
<codeline lineno="264"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">local_hostlist_entry<sp/>*local_hostlist_dynamic;</highlight></codeline>
<codeline lineno="265"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST_IS_DYNAMIC<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="266"><highlight class="normal"></highlight></codeline>
<codeline lineno="269"><highlight class="preprocessor">#ifndef<sp/>DNS_LOCAL_HOSTLIST_STORAGE_PRE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="270"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DNS_LOCAL_HOSTLIST_STORAGE_PRE<sp/>static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="271"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST_STORAGE_PRE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="272"><highlight class="normal"></highlight></codeline>
<codeline lineno="274"><highlight class="preprocessor">#ifndef<sp/>DNS_LOCAL_HOSTLIST_STORAGE_POST</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="275"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>DNS_LOCAL_HOSTLIST_STORAGE_POST</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="276"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST_STORAGE_POST<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="277"><highlight class="normal">DNS_LOCAL_HOSTLIST_STORAGE_PRE<sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">local_hostlist_entry<sp/>local_hostlist_static[]</highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/>DNS_LOCAL_HOSTLIST_STORAGE_POST<sp/>=<sp/>DNS_LOCAL_HOSTLIST_INIT;</highlight></codeline>
<codeline lineno="279"><highlight class="normal"></highlight></codeline>
<codeline lineno="280"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST_IS_DYNAMIC<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="281"><highlight class="normal"></highlight></codeline>
<codeline lineno="282"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dns_init_local(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="283"><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/>dns_lookup_local(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*hostname,<sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*addr<sp/>LWIP_DNS_ADDRTYPE_ARG(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>dns_addrtype));</highlight></codeline>
<codeline lineno="284"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="285"><highlight class="normal"></highlight></codeline>
<codeline lineno="286"><highlight class="normal"></highlight></codeline>
<codeline lineno="287"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>forward<sp/>declarations<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="288"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dns_recv(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*s,<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="289"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dns_check_entries(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="290"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>dns_call_found(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>idx,<sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref>*<sp/>addr);</highlight></codeline>
<codeline lineno="291"><highlight class="normal"></highlight></codeline>
<codeline lineno="292"><highlight class="normal"></highlight><highlight class="comment">/*-----------------------------------------------------------------------------</highlight></codeline>
<codeline lineno="293"><highlight class="comment"><sp/>*<sp/>Globals</highlight></codeline>
<codeline lineno="294"><highlight class="comment"><sp/>*----------------------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="295"><highlight class="normal"></highlight></codeline>
<codeline lineno="296"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>DNS<sp/>variables<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="297"><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/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*dns_pcbs[DNS_MAX_SOURCE_PORTS];</highlight></codeline>
<codeline lineno="298"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_RAND_SRC_PORT)<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="299"><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/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_last_pcb_idx;</highlight></codeline>
<codeline lineno="300"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="301"><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/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_seqno;</highlight></codeline>
<codeline lineno="302"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_table_entry<sp/>dns_table[<ref refid="lwipopts_8h_1a2384e76c1acdf969d883f3de08d340f7" kindref="member">DNS_TABLE_SIZE</ref>];</highlight></codeline>
<codeline lineno="303"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_req_entry<sp/><sp/><sp/>dns_requests[DNS_MAX_REQUESTS];</highlight></codeline>
<codeline lineno="304"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_servers[<ref refid="lwipopts_8h_1a9f9881c887a8aceb9765820c2dbdf292" kindref="member">DNS_MAX_SERVERS</ref>];</highlight></codeline>
<codeline lineno="305"><highlight class="normal"></highlight></codeline>
<codeline lineno="306"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="307"><highlight class="normal"></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>dns_mquery_v4group<sp/>=<sp/><ref refid="prot_2dns_8h_1a861fa0ab623ace9086f5c7247a9f04c8" kindref="member">DNS_MQUERY_IPV4_GROUP_INIT</ref>;</highlight></codeline>
<codeline lineno="308"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="309"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="310"><highlight class="normal"></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>dns_mquery_v6group<sp/>=<sp/><ref refid="prot_2dns_8h_1ae8c419a73ada8ec6b470b3679ae87b8e" kindref="member">DNS_MQUERY_IPV6_GROUP_INIT</ref>;</highlight></codeline>
<codeline lineno="311"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="312"><highlight class="normal"></highlight></codeline>
<codeline lineno="317"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="318"><highlight class="normal">dns_init(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="319"><highlight class="normal">{</highlight></codeline>
<codeline lineno="320"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>DNS_SERVER_ADDRESS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>initialize<sp/>default<sp/>DNS<sp/>server<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="322"><highlight class="normal"><sp/><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>dnsserver;</highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/>DNS_SERVER_ADDRESS(&amp;dnsserver);</highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/>dns_setserver(0,<sp/>&amp;dnsserver);</highlight></codeline>
<codeline lineno="325"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DNS_SERVER_ADDRESS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="326"><highlight class="normal"></highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;sanity<sp/>check<sp/>SIZEOF_DNS_QUERY&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dns_query)<sp/>==<sp/>SIZEOF_DNS_QUERY);</highlight></codeline>
<codeline lineno="329"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;sanity<sp/>check<sp/>SIZEOF_DNS_ANSWER&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="330"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dns_answer)<sp/>&lt;=<sp/>SIZEOF_DNS_ANSWER_ASSERT);</highlight></codeline>
<codeline lineno="331"><highlight class="normal"></highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_init:<sp/>initializing\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="333"><highlight class="normal"></highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>dns<sp/>client<sp/>not<sp/>yet<sp/>initialized...<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="335"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_RAND_SRC_PORT)<sp/>==<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="336"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_pcbs[0]<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/><sp/><sp/>dns_pcbs[0]<sp/>=<sp/>udp_new_ip_type(<ref refid="group__ipaddr_1ggaf2142f0dfdcc938e2db16aa745ed585cac6b2c99cf920e08efcb55dc40e42944e" kindref="member">IPADDR_TYPE_ANY</ref>);</highlight></codeline>
<codeline lineno="338"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dns_pcbs[0]<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>dns_pcbs[0]<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="339"><highlight class="normal"></highlight></codeline>
<codeline lineno="340"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>initialize<sp/>DNS<sp/>table<sp/>not<sp/>needed<sp/>(initialized<sp/>to<sp/>zero<sp/>since<sp/>it<sp/>is<sp/>a</highlight></codeline>
<codeline lineno="341"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>global<sp/>variable)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="342"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;For<sp/>implicit<sp/>initialization<sp/>to<sp/>work,<sp/>DNS_STATE_UNUSED<sp/>needs<sp/>to<sp/>be<sp/>0&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="343"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>DNS_STATE_UNUSED<sp/>==<sp/>0);</highlight></codeline>
<codeline lineno="344"><highlight class="normal"></highlight></codeline>
<codeline lineno="345"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>initialize<sp/>DNS<sp/>client<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="346"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_bind(dns_pcbs[0],<sp/><ref refid="ip__addr_8h_1abe43b154533b73585c4e58f568370ede" kindref="member">IP_ANY_TYPE</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="347"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_recv(dns_pcbs[0],<sp/>dns_recv,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="348"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="349"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="350"><highlight class="normal"></highlight></codeline>
<codeline lineno="351"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_LOCAL_HOSTLIST</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="352"><highlight class="normal"><sp/><sp/>dns_init_local();</highlight></codeline>
<codeline lineno="353"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="354"><highlight class="normal">}</highlight></codeline>
<codeline lineno="355"><highlight class="normal"></highlight></codeline>
<codeline lineno="363"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="364"><highlight class="normal">dns_setserver(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>numdns,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*dnsserver)</highlight></codeline>
<codeline lineno="365"><highlight class="normal">{</highlight></codeline>
<codeline lineno="366"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(numdns<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a9f9881c887a8aceb9765820c2dbdf292" kindref="member">DNS_MAX_SERVERS</ref>)<sp/>{</highlight></codeline>
<codeline lineno="367"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dnsserver<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dns_servers[numdns]<sp/>=<sp/>(*dnsserver);</highlight></codeline>
<codeline lineno="369"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dns_servers[numdns]<sp/>=<sp/>*IP_ADDR_ANY;</highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="373"><highlight class="normal">}</highlight></codeline>
<codeline lineno="374"><highlight class="normal"></highlight></codeline>
<codeline lineno="383"><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref>*</highlight></codeline>
<codeline lineno="384"><highlight class="normal">dns_getserver(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>numdns)</highlight></codeline>
<codeline lineno="385"><highlight class="normal">{</highlight></codeline>
<codeline lineno="386"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(numdns<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a9f9881c887a8aceb9765820c2dbdf292" kindref="member">DNS_MAX_SERVERS</ref>)<sp/>{</highlight></codeline>
<codeline lineno="387"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>&amp;dns_servers[numdns];</highlight></codeline>
<codeline lineno="388"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="389"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>IP_ADDR_ANY;</highlight></codeline>
<codeline lineno="390"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="391"><highlight class="normal">}</highlight></codeline>
<codeline lineno="392"><highlight class="normal"></highlight></codeline>
<codeline lineno="397"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="398"><highlight class="normal">dns_tmr(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="399"><highlight class="normal">{</highlight></codeline>
<codeline lineno="400"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_tmr:<sp/>dns_check_entries\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/>dns_check_entries();</highlight></codeline>
<codeline lineno="402"><highlight class="normal">}</highlight></codeline>
<codeline lineno="403"><highlight class="normal"></highlight></codeline>
<codeline lineno="404"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_LOCAL_HOSTLIST</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="405"><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="406"><highlight class="normal">dns_init_local(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="407"><highlight class="normal">{</highlight></codeline>
<codeline lineno="408"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_LOCAL_HOSTLIST_IS_DYNAMIC<sp/>&amp;&amp;<sp/>defined(DNS_LOCAL_HOSTLIST_INIT)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="409"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="410"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">local_hostlist_entry<sp/>*entry;</highlight></codeline>
<codeline lineno="411"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Dynamic:<sp/>copy<sp/>entries<sp/>from<sp/>DNS_LOCAL_HOSTLIST_INIT<sp/>to<sp/>list<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="412"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">local_hostlist_entry<sp/>local_hostlist_init[]<sp/>=<sp/>DNS_LOCAL_HOSTLIST_INIT;</highlight></codeline>
<codeline lineno="413"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>namelen;</highlight></codeline>
<codeline lineno="414"><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="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(local_hostlist_init);<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="415"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">local_hostlist_entry<sp/>*init_entry<sp/>=<sp/>&amp;local_hostlist_init[i];</highlight></codeline>
<codeline lineno="416"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>host<sp/>name<sp/>(NULL)&quot;</highlight><highlight class="normal">,<sp/>init_entry-&gt;name<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="417"><highlight class="normal"><sp/><sp/><sp/><sp/>namelen<sp/>=<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(init_entry-&gt;name);</highlight></codeline>
<codeline lineno="418"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;namelen<sp/>&lt;=<sp/>DNS_LOCAL_HOSTLIST_MAX_NAMELEN&quot;</highlight><highlight class="normal">,<sp/>namelen<sp/>&lt;=<sp/>DNS_LOCAL_HOSTLIST_MAX_NAMELEN);</highlight></codeline>
<codeline lineno="419"><highlight class="normal"><sp/><sp/><sp/><sp/>entry<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">local_hostlist_entry<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_LOCALHOSTLIST);</highlight></codeline>
<codeline lineno="420"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;mem-error<sp/>in<sp/>dns_init_local&quot;</highlight><highlight class="normal">,<sp/>entry<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="421"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(entry<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="422"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*<sp/>entry_name<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)entry<sp/>+<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>local_hostlist_entry);</highlight></codeline>
<codeline lineno="423"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(entry_name,<sp/>init_entry-&gt;name,<sp/>namelen);</highlight></codeline>
<codeline lineno="424"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry_name[namelen]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="425"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;name<sp/>=<sp/>entry_name;</highlight></codeline>
<codeline lineno="426"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;addr<sp/>=<sp/>init_entry-&gt;addr;</highlight></codeline>
<codeline lineno="427"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;next<sp/>=<sp/>local_hostlist_dynamic;</highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>local_hostlist_dynamic<sp/>=<sp/>entry;</highlight></codeline>
<codeline lineno="429"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="430"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="431"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST_IS_DYNAMIC<sp/>&amp;&amp;<sp/>defined(DNS_LOCAL_HOSTLIST_INIT)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="432"><highlight class="normal">}</highlight></codeline>
<codeline lineno="433"><highlight class="normal"></highlight></codeline>
<codeline lineno="442"><highlight class="keywordtype">size_t</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="443"><highlight class="normal">dns_local_iterate(dns_found_callback<sp/>iterator_fn,<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*iterator_arg)</highlight></codeline>
<codeline lineno="444"><highlight class="normal">{</highlight></codeline>
<codeline lineno="445"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="446"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_LOCAL_HOSTLIST_IS_DYNAMIC</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="447"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">local_hostlist_entry<sp/>*entry<sp/>=<sp/>local_hostlist_dynamic;</highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/>i<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(entry<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="450"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iterator_fn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>iterator_fn(entry-&gt;name,<sp/>&amp;entry-&gt;addr,<sp/>iterator_arg);</highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="453"><highlight class="normal"><sp/><sp/><sp/><sp/>i++;</highlight></codeline>
<codeline lineno="454"><highlight class="normal"><sp/><sp/><sp/><sp/>entry<sp/>=<sp/>entry-&gt;next;</highlight></codeline>
<codeline lineno="455"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="456"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST_IS_DYNAMIC<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="457"><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="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(local_hostlist_static);<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="458"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(iterator_fn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>iterator_fn(local_hostlist_static[i].<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/>&amp;local_hostlist_static[i].addr,<sp/>iterator_arg);</highlight></codeline>
<codeline lineno="460"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="461"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="462"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST_IS_DYNAMIC<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="463"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="464"><highlight class="normal">}</highlight></codeline>
<codeline lineno="465"><highlight class="normal"></highlight></codeline>
<codeline lineno="479"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="480"><highlight class="normal">dns_local_lookup(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*hostname,<sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*addr,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>dns_addrtype)</highlight></codeline>
<codeline lineno="481"><highlight class="normal">{</highlight></codeline>
<codeline lineno="482"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(dns_addrtype);</highlight></codeline>
<codeline lineno="483"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>dns_lookup_local(hostname,<sp/>addr<sp/>LWIP_DNS_ADDRTYPE_ARG(dns_addrtype));</highlight></codeline>
<codeline lineno="484"><highlight class="normal">}</highlight></codeline>
<codeline lineno="485"><highlight class="normal"></highlight></codeline>
<codeline lineno="486"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Internal<sp/>implementation<sp/>for<sp/>dns_local_lookup<sp/>and<sp/>dns_lookup<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="487"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="488"><highlight class="normal">dns_lookup_local(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*hostname,<sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*addr<sp/>LWIP_DNS_ADDRTYPE_ARG(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>dns_addrtype))</highlight></codeline>
<codeline lineno="489"><highlight class="normal">{</highlight></codeline>
<codeline lineno="490"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_LOCAL_HOSTLIST_IS_DYNAMIC</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="491"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">local_hostlist_entry<sp/>*entry<sp/>=<sp/>local_hostlist_dynamic;</highlight></codeline>
<codeline lineno="492"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(entry<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="493"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="group__sys__nonstandard_1ga263cbafcb697eff964139a9998a6668a" kindref="member">lwip_stricmp</ref>(entry-&gt;name,<sp/>hostname)<sp/>==<sp/>0)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="494"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>LWIP_DNS_ADDRTYPE_MATCH_IP(dns_addrtype,<sp/>entry-&gt;addr))<sp/>{</highlight></codeline>
<codeline lineno="495"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(addr)<sp/>{</highlight></codeline>
<codeline lineno="496"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a77a933975db287f6aa5c2e70249ba18f" kindref="member">ip_addr_copy</ref>(*addr,<sp/>entry-&gt;addr);</highlight></codeline>
<codeline lineno="497"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="498"><highlight class="normal"><sp/><sp/><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="499"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="500"><highlight class="normal"><sp/><sp/><sp/><sp/>entry<sp/>=<sp/>entry-&gt;next;</highlight></codeline>
<codeline lineno="501"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="502"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST_IS_DYNAMIC<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="503"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="504"><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="def_8h_1a4abb61f4c9339d8a0a0c63b4fbfe6a37" kindref="member">LWIP_ARRAYSIZE</ref>(local_hostlist_static);<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="505"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="group__sys__nonstandard_1ga263cbafcb697eff964139a9998a6668a" kindref="member">lwip_stricmp</ref>(local_hostlist_static[i].<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/>hostname)<sp/>==<sp/>0)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="506"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>LWIP_DNS_ADDRTYPE_MATCH_IP(dns_addrtype,<sp/>local_hostlist_static[i].addr))<sp/>{</highlight></codeline>
<codeline lineno="507"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(addr)<sp/>{</highlight></codeline>
<codeline lineno="508"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a77a933975db287f6aa5c2e70249ba18f" kindref="member">ip_addr_copy</ref>(*addr,<sp/>local_hostlist_static[i].addr);</highlight></codeline>
<codeline lineno="509"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="510"><highlight class="normal"><sp/><sp/><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="511"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="512"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="513"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST_IS_DYNAMIC<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="514"><highlight class="normal"><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="515"><highlight class="normal">}</highlight></codeline>
<codeline lineno="516"><highlight class="normal"></highlight></codeline>
<codeline lineno="517"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_LOCAL_HOSTLIST_IS_DYNAMIC</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="518"><highlight class="normal"></highlight></codeline>
<codeline lineno="528"><highlight class="keywordtype">int</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="529"><highlight class="normal">dns_local_removehost(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*hostname,<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)</highlight></codeline>
<codeline lineno="530"><highlight class="normal">{</highlight></codeline>
<codeline lineno="531"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>removed<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="532"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">local_hostlist_entry<sp/>*entry<sp/>=<sp/>local_hostlist_dynamic;</highlight></codeline>
<codeline lineno="533"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">local_hostlist_entry<sp/>*last_entry<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="534"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(entry<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="535"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(((hostname<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/>!<ref refid="group__sys__nonstandard_1ga263cbafcb697eff964139a9998a6668a" kindref="member">lwip_stricmp</ref>(entry-&gt;name,<sp/>hostname))<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="536"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>((addr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/><ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(&amp;entry-&gt;addr,<sp/>addr)))<sp/>{</highlight></codeline>
<codeline lineno="537"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">local_hostlist_entry<sp/>*free_entry;</highlight></codeline>
<codeline lineno="538"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(last_entry<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="539"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>last_entry-&gt;next<sp/>=<sp/>entry-&gt;next;</highlight></codeline>
<codeline lineno="540"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="541"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>local_hostlist_dynamic<sp/>=<sp/>entry-&gt;next;</highlight></codeline>
<codeline lineno="542"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="543"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>free_entry<sp/>=<sp/>entry;</highlight></codeline>
<codeline lineno="544"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry<sp/>=<sp/>entry-&gt;next;</highlight></codeline>
<codeline lineno="545"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_LOCALHOSTLIST,<sp/>free_entry);</highlight></codeline>
<codeline lineno="546"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>removed++;</highlight></codeline>
<codeline lineno="547"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="548"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>last_entry<sp/>=<sp/>entry;</highlight></codeline>
<codeline lineno="549"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry<sp/>=<sp/>entry-&gt;next;</highlight></codeline>
<codeline lineno="550"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="551"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="552"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>removed;</highlight></codeline>
<codeline lineno="553"><highlight class="normal">}</highlight></codeline>
<codeline lineno="554"><highlight class="normal"></highlight></codeline>
<codeline lineno="564"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="565"><highlight class="normal">dns_local_addhost(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*hostname,<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)</highlight></codeline>
<codeline lineno="566"><highlight class="normal">{</highlight></codeline>
<codeline lineno="567"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">local_hostlist_entry<sp/>*entry;</highlight></codeline>
<codeline lineno="568"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>namelen;</highlight></codeline>
<codeline lineno="569"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*<sp/>entry_name;</highlight></codeline>
<codeline lineno="570"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>host<sp/>name<sp/>(NULL)&quot;</highlight><highlight class="normal">,<sp/>hostname<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="571"><highlight class="normal"><sp/><sp/>namelen<sp/>=<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(hostname);</highlight></codeline>
<codeline lineno="572"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;namelen<sp/>&lt;=<sp/>DNS_LOCAL_HOSTLIST_MAX_NAMELEN&quot;</highlight><highlight class="normal">,<sp/>namelen<sp/>&lt;=<sp/>DNS_LOCAL_HOSTLIST_MAX_NAMELEN);</highlight></codeline>
<codeline lineno="573"><highlight class="normal"><sp/><sp/>entry<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">local_hostlist_entry<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_LOCALHOSTLIST);</highlight></codeline>
<codeline lineno="574"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(entry<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="575"><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="576"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="577"><highlight class="normal"><sp/><sp/>entry_name<sp/>=<sp/>(</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)entry<sp/>+<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>local_hostlist_entry);</highlight></codeline>
<codeline lineno="578"><highlight class="normal"><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(entry_name,<sp/>hostname,<sp/>namelen);</highlight></codeline>
<codeline lineno="579"><highlight class="normal"><sp/><sp/>entry_name[namelen]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="580"><highlight class="normal"><sp/><sp/>entry-&gt;name<sp/>=<sp/>entry_name;</highlight></codeline>
<codeline lineno="581"><highlight class="normal"><sp/><sp/><ref refid="ip__addr_8h_1a77a933975db287f6aa5c2e70249ba18f" kindref="member">ip_addr_copy</ref>(entry-&gt;addr,<sp/>*addr);</highlight></codeline>
<codeline lineno="582"><highlight class="normal"><sp/><sp/>entry-&gt;next<sp/>=<sp/>local_hostlist_dynamic;</highlight></codeline>
<codeline lineno="583"><highlight class="normal"><sp/><sp/>local_hostlist_dynamic<sp/>=<sp/>entry;</highlight></codeline>
<codeline lineno="584"><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="585"><highlight class="normal">}</highlight></codeline>
<codeline lineno="586"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST_IS_DYNAMIC*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="587"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="588"><highlight class="normal"></highlight></codeline>
<codeline lineno="604"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="605"><highlight class="normal">dns_lookup(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*addr<sp/>LWIP_DNS_ADDRTYPE_ARG(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>dns_addrtype))</highlight></codeline>
<codeline lineno="606"><highlight class="normal">{</highlight></codeline>
<codeline lineno="607"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="608"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_LOCAL_HOSTLIST<sp/>||<sp/>defined(DNS_LOOKUP_LOCAL_EXTERN)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="609"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST<sp/>||<sp/>defined(DNS_LOOKUP_LOCAL_EXTERN)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="610"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>DNS_LOCAL_HOSTLIST</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="611"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_lookup_local(<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/>addr<sp/>LWIP_DNS_ADDRTYPE_ARG(dns_addrtype))<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="612"><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="613"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="614"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOCAL_HOSTLIST<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="615"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>DNS_LOOKUP_LOCAL_EXTERN</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="616"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(DNS_LOOKUP_LOCAL_EXTERN(<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/>addr,<sp/>LWIP_DNS_ADDRTYPE_ARG_OR_ZERO(dns_addrtype))<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="617"><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="618"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="619"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>DNS_LOOKUP_LOCAL_EXTERN<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="620"><highlight class="normal"></highlight></codeline>
<codeline lineno="621"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Walk<sp/>through<sp/>name<sp/>list,<sp/>return<sp/>entry<sp/>if<sp/>found.<sp/>If<sp/>not,<sp/>return<sp/>NULL.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="622"><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="lwipopts_8h_1a2384e76c1acdf969d883f3de08d340f7" kindref="member">DNS_TABLE_SIZE</ref>;<sp/>++i)<sp/>{</highlight></codeline>
<codeline lineno="623"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((dns_table[i].state<sp/>==<sp/>DNS_STATE_DONE)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="624"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__sys__nonstandard_1ga997dcc49451121d4ed755b33bc7bd26a" kindref="member">lwip_strnicmp</ref>(<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/>dns_table[i].<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(dns_table[i].<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>))<sp/>==<sp/>0)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="625"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>LWIP_DNS_ADDRTYPE_MATCH_IP(dns_addrtype,<sp/>dns_table[i].ipaddr))<sp/>{</highlight></codeline>
<codeline lineno="626"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_lookup:<sp/>\&quot;%s\&quot;:<sp/>found<sp/>=<sp/>&quot;</highlight><highlight class="normal">,<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>));</highlight></codeline>
<codeline lineno="627"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1af7d84bce2fb861a97f3047ecd69ab018" kindref="member">ip_addr_debug_print</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>&amp;(dns_table[i].ipaddr));</highlight></codeline>
<codeline lineno="628"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="629"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(addr)<sp/>{</highlight></codeline>
<codeline lineno="630"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a77a933975db287f6aa5c2e70249ba18f" kindref="member">ip_addr_copy</ref>(*addr,<sp/>dns_table[i].ipaddr);</highlight></codeline>
<codeline lineno="631"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="632"><highlight class="normal"><sp/><sp/><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="633"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="634"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="635"><highlight class="normal"></highlight></codeline>
<codeline lineno="636"><highlight class="normal"><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="637"><highlight class="normal">}</highlight></codeline>
<codeline lineno="638"><highlight class="normal"></highlight></codeline>
<codeline lineno="650"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></highlight></codeline>
<codeline lineno="651"><highlight class="normal">dns_compare_name(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*query,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>p,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>start_offset)</highlight></codeline>
<codeline lineno="652"><highlight class="normal">{</highlight></codeline>
<codeline lineno="653"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>n;</highlight></codeline>
<codeline lineno="654"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>response_offset<sp/>=<sp/>start_offset;</highlight></codeline>
<codeline lineno="655"><highlight class="normal"></highlight></codeline>
<codeline lineno="656"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">do</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="657"><highlight class="normal"><sp/><sp/><sp/><sp/>n<sp/>=<sp/><ref refid="group__pbuf_1ga839f342803b0cf89049744124c5a98ad" kindref="member">pbuf_try_get_at</ref>(p,<sp/>response_offset++);</highlight></codeline>
<codeline lineno="658"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(n<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="659"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0xFFFF;</highlight></codeline>
<codeline lineno="660"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="662"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((n<sp/>&amp;<sp/>0xc0)<sp/>==<sp/>0xc0)<sp/>{</highlight></codeline>
<codeline lineno="663"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Compressed<sp/>name:<sp/>cannot<sp/>be<sp/>equal<sp/>since<sp/>we<sp/>don&apos;t<sp/>send<sp/>them<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="664"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0xFFFF;</highlight></codeline>
<codeline lineno="665"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="666"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Not<sp/>compressed<sp/>name<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="667"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(n<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="668"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>c<sp/>=<sp/><ref refid="group__pbuf_1ga839f342803b0cf89049744124c5a98ad" kindref="member">pbuf_try_get_at</ref>(p,<sp/>response_offset);</highlight></codeline>
<codeline lineno="669"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(c<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="670"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0xFFFF;</highlight></codeline>
<codeline lineno="671"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="672"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((*query)<sp/>!=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)c)<sp/>{</highlight></codeline>
<codeline lineno="673"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0xFFFF;</highlight></codeline>
<codeline lineno="674"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="675"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>++response_offset;</highlight></codeline>
<codeline lineno="676"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>++query;</highlight></codeline>
<codeline lineno="677"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>--n;</highlight></codeline>
<codeline lineno="678"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="679"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>++query;</highlight></codeline>
<codeline lineno="680"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="681"><highlight class="normal"><sp/><sp/><sp/><sp/>n<sp/>=<sp/><ref refid="group__pbuf_1ga839f342803b0cf89049744124c5a98ad" kindref="member">pbuf_try_get_at</ref>(p,<sp/>response_offset);</highlight></codeline>
<codeline lineno="682"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(n<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="683"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0xFFFF;</highlight></codeline>
<codeline lineno="684"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="685"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(n<sp/>!=<sp/>0);</highlight></codeline>
<codeline lineno="686"><highlight class="normal"></highlight></codeline>
<codeline lineno="687"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>response_offset<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="688"><highlight class="normal">}</highlight></codeline>
<codeline lineno="689"><highlight class="normal"></highlight></codeline>
<codeline lineno="697"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></highlight></codeline>
<codeline lineno="698"><highlight class="normal">dns_skip_name(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>p,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>query_idx)</highlight></codeline>
<codeline lineno="699"><highlight class="normal">{</highlight></codeline>
<codeline lineno="700"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>n;</highlight></codeline>
<codeline lineno="701"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset<sp/>=<sp/>query_idx;</highlight></codeline>
<codeline lineno="702"><highlight class="normal"></highlight></codeline>
<codeline lineno="703"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">do</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="704"><highlight class="normal"><sp/><sp/><sp/><sp/>n<sp/>=<sp/><ref refid="group__pbuf_1ga839f342803b0cf89049744124c5a98ad" kindref="member">pbuf_try_get_at</ref>(p,<sp/>offset++);</highlight></codeline>
<codeline lineno="705"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(n<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="706"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0xFFFF;</highlight></codeline>
<codeline lineno="707"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="709"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((n<sp/>&amp;<sp/>0xc0)<sp/>==<sp/>0xc0)<sp/>{</highlight></codeline>
<codeline lineno="710"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Compressed<sp/>name:<sp/>since<sp/>we<sp/>only<sp/>want<sp/>to<sp/>skip<sp/>it<sp/>(not<sp/>check<sp/>it),<sp/>stop<sp/>here<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="711"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="712"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="713"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Not<sp/>compressed<sp/>name<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="714"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(offset<sp/>+<sp/>n<sp/>&gt;=<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>)<sp/>{</highlight></codeline>
<codeline lineno="715"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0xFFFF;</highlight></codeline>
<codeline lineno="716"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="717"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>offset<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(offset<sp/>+<sp/>n);</highlight></codeline>
<codeline lineno="718"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="719"><highlight class="normal"><sp/><sp/><sp/><sp/>n<sp/>=<sp/><ref refid="group__pbuf_1ga839f342803b0cf89049744124c5a98ad" kindref="member">pbuf_try_get_at</ref>(p,<sp/>offset);</highlight></codeline>
<codeline lineno="720"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(n<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="721"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0xFFFF;</highlight></codeline>
<codeline lineno="722"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="723"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(n<sp/>!=<sp/>0);</highlight></codeline>
<codeline lineno="724"><highlight class="normal"></highlight></codeline>
<codeline lineno="725"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>offset<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="726"><highlight class="normal">}</highlight></codeline>
<codeline lineno="727"><highlight class="normal"></highlight></codeline>
<codeline lineno="734"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="735"><highlight class="normal">dns_send(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>idx)</highlight></codeline>
<codeline lineno="736"><highlight class="normal">{</highlight></codeline>
<codeline lineno="737"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="738"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structdns__hdr" kindref="compound">dns_hdr</ref><sp/>hdr;</highlight></codeline>
<codeline lineno="739"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_query<sp/>qry;</highlight></codeline>
<codeline lineno="740"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p;</highlight></codeline>
<codeline lineno="741"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>query_idx,<sp/>copy_len;</highlight></codeline>
<codeline lineno="742"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*hostname,<sp/>*hostname_part;</highlight></codeline>
<codeline lineno="743"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>n;</highlight></codeline>
<codeline lineno="744"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>pcb_idx;</highlight></codeline>
<codeline lineno="745"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_table_entry*<sp/>entry<sp/>=<sp/>&amp;dns_table[idx];</highlight></codeline>
<codeline lineno="746"><highlight class="normal"></highlight></codeline>
<codeline lineno="747"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_send:<sp/>dns_servers[%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;]<sp/>\&quot;%s\&quot;:<sp/>request\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="748"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(entry-&gt;server_idx),<sp/>entry-&gt;name));</highlight></codeline>
<codeline lineno="749"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dns<sp/>server<sp/>out<sp/>of<sp/>array&quot;</highlight><highlight class="normal">,<sp/>entry-&gt;server_idx<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a9f9881c887a8aceb9765820c2dbdf292" kindref="member">DNS_MAX_SERVERS</ref>);</highlight></codeline>
<codeline lineno="750"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ip__addr_8h_1acd8f5aa151cff966fd28368b85f38c05" kindref="member">ip_addr_isany_val</ref>(dns_servers[entry-&gt;server_idx])</highlight></codeline>
<codeline lineno="751"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/><ref refid="lwipopts_8h_1afcbde5706a70ace562bd1f7d2d6f77cb" kindref="member">LWIP_DNS_SUPPORT_MDNS_QUERIES</ref></highlight></codeline>
<codeline lineno="752"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>&amp;&amp;<sp/>!entry-&gt;is_mdns</highlight></codeline>
<codeline lineno="753"><highlight class="normal">#endif</highlight></codeline>
<codeline lineno="754"><highlight class="normal"><sp/><sp/><sp/><sp/>)<sp/>{</highlight></codeline>
<codeline lineno="755"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>DNS<sp/>server<sp/>not<sp/>valid<sp/>anymore,<sp/>e.g.<sp/>PPP<sp/>netif<sp/>has<sp/>been<sp/>shut<sp/>down<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="756"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>call<sp/>specified<sp/>callback<sp/>function<sp/>if<sp/>provided<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="757"><highlight class="normal"><sp/><sp/><sp/><sp/>dns_call_found(idx,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="758"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>flush<sp/>this<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="759"><highlight class="normal"><sp/><sp/><sp/><sp/>entry-&gt;state<sp/>=<sp/>DNS_STATE_UNUSED;</highlight></codeline>
<codeline lineno="760"><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="761"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="762"><highlight class="normal"></highlight></codeline>
<codeline lineno="763"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>here,<sp/>we<sp/>have<sp/>either<sp/>a<sp/>new<sp/>query<sp/>or<sp/>a<sp/>retry<sp/>on<sp/>a<sp/>previous<sp/>query<sp/>to<sp/>process<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="764"><highlight class="normal"><sp/><sp/>p<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa2ded3594a3977f8bf9cf09552be327b5" kindref="member">PBUF_TRANSPORT</ref>,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(<ref refid="prot_2dns_8h_1a1ffff846513e2493ba915d8874c26476" kindref="member">SIZEOF_DNS_HDR</ref><sp/>+<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(entry-&gt;name)<sp/>+<sp/>2<sp/>+</highlight></codeline>
<codeline lineno="765"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>SIZEOF_DNS_QUERY),<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>);</highlight></codeline>
<codeline lineno="766"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="767"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref>*<sp/>dst;</highlight></codeline>
<codeline lineno="768"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>dst_port;</highlight></codeline>
<codeline lineno="769"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>fill<sp/>dns<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="770"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(&amp;hdr,<sp/>0,<sp/><ref refid="prot_2dns_8h_1a1ffff846513e2493ba915d8874c26476" kindref="member">SIZEOF_DNS_HDR</ref>);</highlight></codeline>
<codeline lineno="771"><highlight class="normal"><sp/><sp/><sp/><sp/>hdr.id<sp/>=<sp/><ref refid="def_8c_1ad637280639de4066392e6b5614fa3e56" kindref="member">lwip_htons</ref>(entry-&gt;txid);</highlight></codeline>
<codeline lineno="772"><highlight class="normal"><sp/><sp/><sp/><sp/>hdr.flags1<sp/>=<sp/><ref refid="prot_2dns_8h_1a72d99b1623afa14bd58c667b748c2ddc" kindref="member">DNS_FLAG1_RD</ref>;</highlight></codeline>
<codeline lineno="773"><highlight class="normal"><sp/><sp/><sp/><sp/>hdr.numquestions<sp/>=<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(1);</highlight></codeline>
<codeline lineno="774"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gad1e31e370271335b197272af2724ca85" kindref="member">pbuf_take</ref>(p,<sp/>&amp;hdr,<sp/><ref refid="prot_2dns_8h_1a1ffff846513e2493ba915d8874c26476" kindref="member">SIZEOF_DNS_HDR</ref>);</highlight></codeline>
<codeline lineno="775"><highlight class="normal"><sp/><sp/><sp/><sp/>hostname<sp/>=<sp/>entry-&gt;name;</highlight></codeline>
<codeline lineno="776"><highlight class="normal"><sp/><sp/><sp/><sp/>--hostname;</highlight></codeline>
<codeline lineno="777"><highlight class="normal"></highlight></codeline>
<codeline lineno="778"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>convert<sp/>hostname<sp/>into<sp/>suitable<sp/>query<sp/>format.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="779"><highlight class="normal"><sp/><sp/><sp/><sp/>query_idx<sp/>=<sp/><ref refid="prot_2dns_8h_1a1ffff846513e2493ba915d8874c26476" kindref="member">SIZEOF_DNS_HDR</ref>;</highlight></codeline>
<codeline lineno="780"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">do</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="781"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>++hostname;</highlight></codeline>
<codeline lineno="782"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>hostname_part<sp/>=<sp/>hostname;</highlight></codeline>
<codeline lineno="783"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(n<sp/>=<sp/>0;<sp/>*hostname<sp/>!=<sp/></highlight><highlight class="charliteral">&apos;.&apos;</highlight><highlight class="normal"><sp/>&amp;&amp;<sp/>*hostname<sp/>!=<sp/>0;<sp/>++hostname)<sp/>{</highlight></codeline>
<codeline lineno="784"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>++n;</highlight></codeline>
<codeline lineno="785"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="786"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>copy_len<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(hostname<sp/>-<sp/>hostname_part);</highlight></codeline>
<codeline lineno="787"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gaf76863707dc02993eae116574b1ea03f" kindref="member">pbuf_put_at</ref>(p,<sp/>query_idx,<sp/>n);</highlight></codeline>
<codeline lineno="788"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gae1cf2bf7454ff87ff377b0b2262f9b44" kindref="member">pbuf_take_at</ref>(p,<sp/>hostname_part,<sp/>copy_len,<sp/>query_idx<sp/>+<sp/>1);</highlight></codeline>
<codeline lineno="789"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>query_idx<sp/>+=<sp/>n<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="790"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(*hostname<sp/>!=<sp/>0);</highlight></codeline>
<codeline lineno="791"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gaf76863707dc02993eae116574b1ea03f" kindref="member">pbuf_put_at</ref>(p,<sp/>query_idx,<sp/>0);</highlight></codeline>
<codeline lineno="792"><highlight class="normal"><sp/><sp/><sp/><sp/>query_idx++;</highlight></codeline>
<codeline lineno="793"><highlight class="normal"></highlight></codeline>
<codeline lineno="794"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>fill<sp/>dns<sp/>query<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="795"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(LWIP_DNS_ADDRTYPE_IS_IPV6(entry-&gt;reqaddrtype))<sp/>{</highlight></codeline>
<codeline lineno="796"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>qry.type<sp/>=<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2dns_8h_1ae533fbb9f59f4de915ed3ecb9ff24953" kindref="member">DNS_RRTYPE_AAAA</ref>);</highlight></codeline>
<codeline lineno="797"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="798"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>qry.type<sp/>=<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2dns_8h_1a830e99420463950d3c4d661487f20d0d" kindref="member">DNS_RRTYPE_A</ref>);</highlight></codeline>
<codeline lineno="799"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="800"><highlight class="normal"><sp/><sp/><sp/><sp/>qry.cls<sp/>=<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2dns_8h_1a08bc1c1897d2921b6f102365be55da2a" kindref="member">DNS_RRCLASS_IN</ref>);</highlight></codeline>
<codeline lineno="801"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gae1cf2bf7454ff87ff377b0b2262f9b44" kindref="member">pbuf_take_at</ref>(p,<sp/>&amp;qry,<sp/>SIZEOF_DNS_QUERY,<sp/>query_idx);</highlight></codeline>
<codeline lineno="802"><highlight class="normal"></highlight></codeline>
<codeline lineno="803"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_RAND_SRC_PORT)<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="804"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb_idx<sp/>=<sp/>entry-&gt;pcb_idx;</highlight></codeline>
<codeline lineno="805"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="806"><highlight class="normal"><sp/><sp/><sp/><sp/>pcb_idx<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="807"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="808"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>dns<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="809"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;sending<sp/>DNS<sp/>request<sp/>ID<sp/>%d<sp/>for<sp/>name<sp/>\&quot;%s\&quot;<sp/>to<sp/>server<sp/>%d\r\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="810"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;txid,<sp/>entry-&gt;name,<sp/>entry-&gt;server_idx));</highlight></codeline>
<codeline lineno="811"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DNS_SUPPORT_MDNS_QUERIES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="812"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(entry-&gt;is_mdns)<sp/>{</highlight></codeline>
<codeline lineno="813"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dst_port<sp/>=<sp/><ref refid="prot_2dns_8h_1a62d67af5ac6c6b3f98a6566a42564276" kindref="member">DNS_MQUERY_PORT</ref>;</highlight></codeline>
<codeline lineno="814"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="815"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(LWIP_DNS_ADDRTYPE_IS_IPV6(entry-&gt;reqaddrtype))</highlight></codeline>
<codeline lineno="816"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="817"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dst<sp/>=<sp/>&amp;dns_mquery_v6group;</highlight></codeline>
<codeline lineno="818"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="819"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="820"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="821"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="822"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="823"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="824"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="825"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dst<sp/>=<sp/>&amp;dns_mquery_v4group;</highlight></codeline>
<codeline lineno="826"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="827"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="828"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="829"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DNS_SUPPORT_MDNS_QUERIES<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="830"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="831"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dst_port<sp/>=<sp/><ref refid="prot_2dns_8h_1a9266b48706648ecf0625a3e651095317" kindref="member">DNS_SERVER_PORT</ref>;</highlight></codeline>
<codeline lineno="832"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dst<sp/>=<sp/>&amp;dns_servers[entry-&gt;server_idx];</highlight></codeline>
<codeline lineno="833"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="834"><highlight class="normal"><sp/><sp/><sp/><sp/>err<sp/>=<sp/>udp_sendto(dns_pcbs[pcb_idx],<sp/>p,<sp/>dst,<sp/>dst_port);</highlight></codeline>
<codeline lineno="835"><highlight class="normal"></highlight></codeline>
<codeline lineno="836"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>free<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="837"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="838"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="839"><highlight class="normal"><sp/><sp/><sp/><sp/>err<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="840"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="841"><highlight class="normal"></highlight></codeline>
<codeline lineno="842"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="843"><highlight class="normal">}</highlight></codeline>
<codeline lineno="844"><highlight class="normal"></highlight></codeline>
<codeline lineno="845"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_RAND_SRC_PORT)<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="846"><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*</highlight></codeline>
<codeline lineno="847"><highlight class="normal">dns_alloc_random_port(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="848"><highlight class="normal">{</highlight></codeline>
<codeline lineno="849"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="850"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">udp_pcb*<sp/>ret;</highlight></codeline>
<codeline lineno="851"><highlight class="normal"></highlight></codeline>
<codeline lineno="852"><highlight class="normal"><sp/><sp/>ret<sp/>=<sp/>udp_new_ip_type(<ref refid="group__ipaddr_1ggaf2142f0dfdcc938e2db16aa745ed585cac6b2c99cf920e08efcb55dc40e42944e" kindref="member">IPADDR_TYPE_ANY</ref>);</highlight></codeline>
<codeline lineno="853"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="854"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>out<sp/>of<sp/>memory,<sp/>have<sp/>to<sp/>reuse<sp/>an<sp/>existing<sp/>pcb<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="855"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="856"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="857"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">do</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="858"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>port<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)DNS_RAND_TXID();</highlight></codeline>
<codeline lineno="859"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!DNS_PORT_ALLOWED(port))<sp/>{</highlight></codeline>
<codeline lineno="860"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>port<sp/>is<sp/>not<sp/>allowed,<sp/>try<sp/>again<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="861"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>err<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca4ebdc2aa1dbd75f927845733a3fb1f8b" kindref="member">ERR_USE</ref>;</highlight></codeline>
<codeline lineno="862"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">continue</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="863"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="864"><highlight class="normal"><sp/><sp/><sp/><sp/>err<sp/>=<sp/>udp_bind(ret,<sp/><ref refid="ip__addr_8h_1abe43b154533b73585c4e58f568370ede" kindref="member">IP_ANY_TYPE</ref>,<sp/>port);</highlight></codeline>
<codeline lineno="865"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca4ebdc2aa1dbd75f927845733a3fb1f8b" kindref="member">ERR_USE</ref>);</highlight></codeline>
<codeline lineno="866"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="867"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_remove(ret);</highlight></codeline>
<codeline lineno="868"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="869"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="870"><highlight class="normal"><sp/><sp/>udp_recv(ret,<sp/>dns_recv,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="871"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ret;</highlight></codeline>
<codeline lineno="872"><highlight class="normal">}</highlight></codeline>
<codeline lineno="873"><highlight class="normal"></highlight></codeline>
<codeline lineno="880"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></highlight></codeline>
<codeline lineno="881"><highlight class="normal">dns_alloc_pcb(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="882"><highlight class="normal">{</highlight></codeline>
<codeline lineno="883"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="884"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>idx;</highlight></codeline>
<codeline lineno="885"><highlight class="normal"></highlight></codeline>
<codeline lineno="886"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>DNS_MAX_SOURCE_PORTS;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="887"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_pcbs[i]<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="888"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="889"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="890"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="891"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>&lt;<sp/>DNS_MAX_SOURCE_PORTS)<sp/>{</highlight></codeline>
<codeline lineno="892"><highlight class="normal"><sp/><sp/><sp/><sp/>dns_pcbs[i]<sp/>=<sp/>dns_alloc_random_port();</highlight></codeline>
<codeline lineno="893"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_pcbs[i]<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="894"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>succeeded<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="895"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dns_last_pcb_idx<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="896"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="897"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="898"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="899"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>we<sp/>come<sp/>here,<sp/>creating<sp/>a<sp/>new<sp/>UDP<sp/>pcb<sp/>failed,<sp/>so<sp/>we<sp/>have<sp/>to<sp/>use</highlight></codeline>
<codeline lineno="900"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>an<sp/>already<sp/>existing<sp/>one<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="901"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0,<sp/>idx<sp/>=<sp/>dns_last_pcb_idx<sp/>+<sp/>1;<sp/>i<sp/>&lt;<sp/>DNS_MAX_SOURCE_PORTS;<sp/>i++,<sp/>idx++)<sp/>{</highlight></codeline>
<codeline lineno="902"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(idx<sp/>&gt;=<sp/>DNS_MAX_SOURCE_PORTS)<sp/>{</highlight></codeline>
<codeline lineno="903"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>idx<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="904"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="905"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_pcbs[idx]<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="906"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dns_last_pcb_idx<sp/>=<sp/>idx;</highlight></codeline>
<codeline lineno="907"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>idx;</highlight></codeline>
<codeline lineno="908"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="909"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="910"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>DNS_MAX_SOURCE_PORTS;</highlight></codeline>
<codeline lineno="911"><highlight class="normal">}</highlight></codeline>
<codeline lineno="912"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_RAND_SRC_PORT)<sp/>!=<sp/>0)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="913"><highlight class="normal"></highlight></codeline>
<codeline lineno="922"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="923"><highlight class="normal">dns_call_found(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>idx,<sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref>*<sp/>addr)</highlight></codeline>
<codeline lineno="924"><highlight class="normal">{</highlight></codeline>
<codeline lineno="925"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>(LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING<sp/>|<sp/>LWIP_DNS_SECURE_RAND_SRC_PORT))<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="926"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="927"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="928"><highlight class="normal"></highlight></codeline>
<codeline lineno="929"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="930"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(addr<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="931"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>check<sp/>that<sp/>address<sp/>type<sp/>matches<sp/>the<sp/>request<sp/>and<sp/>adapt<sp/>the<sp/>table<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="932"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ip__addr_8h_1a1578e34703e86711a7fb7dcc3857004d" kindref="member">IP_IS_V6_VAL</ref>(*addr))<sp/>{</highlight></codeline>
<codeline lineno="933"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>response&quot;</highlight><highlight class="normal">,<sp/>LWIP_DNS_ADDRTYPE_IS_IPV6(dns_table[idx].reqaddrtype));</highlight></codeline>
<codeline lineno="934"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dns_table[idx].reqaddrtype<sp/>=<sp/>LWIP_DNS_ADDRTYPE_IPV6;</highlight></codeline>
<codeline lineno="935"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="936"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;invalid<sp/>response&quot;</highlight><highlight class="normal">,<sp/>!LWIP_DNS_ADDRTYPE_IS_IPV6(dns_table[idx].reqaddrtype));</highlight></codeline>
<codeline lineno="937"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dns_table[idx].reqaddrtype<sp/>=<sp/>LWIP_DNS_ADDRTYPE_IPV4;</highlight></codeline>
<codeline lineno="938"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="939"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="940"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="941"><highlight class="normal"></highlight></codeline>
<codeline lineno="942"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING)<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="943"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>DNS_MAX_REQUESTS;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="944"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_requests[i].found<sp/>&amp;&amp;<sp/>(dns_requests[i].dns_table_idx<sp/>==<sp/>idx))<sp/>{</highlight></codeline>
<codeline lineno="945"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(*dns_requests[i].found)(dns_table[idx].<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/>addr,<sp/>dns_requests[i].arg);</highlight></codeline>
<codeline lineno="946"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>flush<sp/>this<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="947"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dns_requests[i].found<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="948"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="949"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="950"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="951"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_requests[idx].found)<sp/>{</highlight></codeline>
<codeline lineno="952"><highlight class="normal"><sp/><sp/><sp/><sp/>(*dns_requests[idx].found)(dns_table[idx].<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/>addr,<sp/>dns_requests[idx].arg);</highlight></codeline>
<codeline lineno="953"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="954"><highlight class="normal"><sp/><sp/>dns_requests[idx].found<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="955"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="956"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_RAND_SRC_PORT)<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="957"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>close<sp/>the<sp/>pcb<sp/>used<sp/>unless<sp/>other<sp/>request<sp/>are<sp/>using<sp/>it<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="958"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>DNS_MAX_REQUESTS;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="959"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>==<sp/>idx)<sp/>{</highlight></codeline>
<codeline lineno="960"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">continue</highlight><highlight class="normal">;<sp/></highlight><highlight class="comment">/*<sp/>only<sp/>check<sp/>other<sp/>requests<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="961"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="962"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_table[i].state<sp/>==<sp/>DNS_STATE_ASKING)<sp/>{</highlight></codeline>
<codeline lineno="963"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_table[i].pcb_idx<sp/>==<sp/>dns_table[idx].pcb_idx)<sp/>{</highlight></codeline>
<codeline lineno="964"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>another<sp/>request<sp/>is<sp/>still<sp/>using<sp/>the<sp/>same<sp/>pcb<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="965"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_table[idx].pcb_idx<sp/>=<sp/>DNS_MAX_SOURCE_PORTS;</highlight></codeline>
<codeline lineno="966"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="967"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="968"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="969"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="970"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_table[idx].pcb_idx<sp/>&lt;<sp/>DNS_MAX_SOURCE_PORTS)<sp/>{</highlight></codeline>
<codeline lineno="971"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>we<sp/>come<sp/>here,<sp/>the<sp/>pcb<sp/>is<sp/>not<sp/>used<sp/>any<sp/>more<sp/>and<sp/>can<sp/>be<sp/>removed<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="972"><highlight class="normal"><sp/><sp/><sp/><sp/>udp_remove(dns_pcbs[dns_table[idx].pcb_idx]);</highlight></codeline>
<codeline lineno="973"><highlight class="normal"><sp/><sp/><sp/><sp/>dns_pcbs[dns_table[idx].pcb_idx]<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="974"><highlight class="normal"><sp/><sp/><sp/><sp/>dns_table[idx].pcb_idx<sp/>=<sp/>DNS_MAX_SOURCE_PORTS;</highlight></codeline>
<codeline lineno="975"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="976"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="977"><highlight class="normal">}</highlight></codeline>
<codeline lineno="978"><highlight class="normal"></highlight></codeline>
<codeline lineno="979"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Create<sp/>a<sp/>query<sp/>transmission<sp/>ID<sp/>that<sp/>is<sp/>unique<sp/>for<sp/>all<sp/>outstanding<sp/>queries<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="980"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></highlight></codeline>
<codeline lineno="981"><highlight class="normal">dns_create_txid(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="982"><highlight class="normal">{</highlight></codeline>
<codeline lineno="983"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>txid;</highlight></codeline>
<codeline lineno="984"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="985"><highlight class="normal"></highlight></codeline>
<codeline lineno="986"><highlight class="normal">again:</highlight></codeline>
<codeline lineno="987"><highlight class="normal"><sp/><sp/>txid<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)DNS_RAND_TXID();</highlight></codeline>
<codeline lineno="988"><highlight class="normal"></highlight></codeline>
<codeline lineno="989"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>check<sp/>whether<sp/>the<sp/>ID<sp/>is<sp/>unique<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="990"><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="lwipopts_8h_1a2384e76c1acdf969d883f3de08d340f7" kindref="member">DNS_TABLE_SIZE</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="991"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((dns_table[i].state<sp/>==<sp/>DNS_STATE_ASKING)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="992"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(dns_table[i].txid<sp/>==<sp/>txid))<sp/>{</highlight></codeline>
<codeline lineno="993"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>ID<sp/>already<sp/>used<sp/>by<sp/>another<sp/>pending<sp/>query<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="994"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>again;</highlight></codeline>
<codeline lineno="995"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="996"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="997"><highlight class="normal"></highlight></codeline>
<codeline lineno="998"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>txid;</highlight></codeline>
<codeline lineno="999"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1000"><highlight class="normal"></highlight></codeline>
<codeline lineno="1010"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1011"><highlight class="normal">dns_check_entry(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i)</highlight></codeline>
<codeline lineno="1012"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1013"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="1014"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_table_entry<sp/>*entry<sp/>=<sp/>&amp;dns_table[i];</highlight></codeline>
<codeline lineno="1015"><highlight class="normal"></highlight></codeline>
<codeline lineno="1016"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;array<sp/>index<sp/>out<sp/>of<sp/>bounds&quot;</highlight><highlight class="normal">,<sp/>i<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a2384e76c1acdf969d883f3de08d340f7" kindref="member">DNS_TABLE_SIZE</ref>);</highlight></codeline>
<codeline lineno="1017"><highlight class="normal"></highlight></codeline>
<codeline lineno="1018"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(entry-&gt;state)<sp/>{</highlight></codeline>
<codeline lineno="1019"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>DNS_STATE_NEW:</highlight></codeline>
<codeline lineno="1020"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>initialize<sp/>new<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1021"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;txid<sp/>=<sp/>dns_create_txid();</highlight></codeline>
<codeline lineno="1022"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;state<sp/>=<sp/>DNS_STATE_ASKING;</highlight></codeline>
<codeline lineno="1023"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;server_idx<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1024"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;tmr<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1025"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;retries<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1026"><highlight class="normal"></highlight></codeline>
<codeline lineno="1027"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>DNS<sp/>packet<sp/>for<sp/>this<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1028"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>err<sp/>=<sp/>dns_send(i);</highlight></codeline>
<codeline lineno="1029"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1030"><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_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga77c491e468bf7d9a1bc48430c1866a96" kindref="member">LWIP_DBG_LEVEL_WARNING</ref>,</highlight></codeline>
<codeline lineno="1031"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;dns_send<sp/>returned<sp/>error:<sp/>%s\n&quot;</highlight><highlight class="normal">,<sp/><ref refid="err_8h_1ab58c2561ad3b133e625183721b25ba27" kindref="member">lwip_strerr</ref>(err)));</highlight></codeline>
<codeline lineno="1032"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1033"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1034"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>DNS_STATE_ASKING:</highlight></codeline>
<codeline lineno="1035"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(--entry-&gt;tmr<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1036"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(++entry-&gt;retries<sp/>==<sp/>DNS_MAX_RETRIES)<sp/>{</highlight></codeline>
<codeline lineno="1037"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((entry-&gt;server_idx<sp/>+<sp/>1<sp/>&lt;<sp/><ref refid="lwipopts_8h_1a9f9881c887a8aceb9765820c2dbdf292" kindref="member">DNS_MAX_SERVERS</ref>)<sp/>&amp;&amp;<sp/>!<ref refid="ip__addr_8h_1acd8f5aa151cff966fd28368b85f38c05" kindref="member">ip_addr_isany_val</ref>(dns_servers[entry-&gt;server_idx<sp/>+<sp/>1])</highlight></codeline>
<codeline lineno="1038"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/><ref refid="lwipopts_8h_1afcbde5706a70ace562bd1f7d2d6f77cb" kindref="member">LWIP_DNS_SUPPORT_MDNS_QUERIES</ref></highlight></codeline>
<codeline lineno="1039"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>&amp;&amp;<sp/>!entry-&gt;is_mdns</highlight></codeline>
<codeline lineno="1040"><highlight class="normal">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DNS_SUPPORT_MDNS_QUERIES<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1041"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>)<sp/>{</highlight></codeline>
<codeline lineno="1042"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>change<sp/>of<sp/>server<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1043"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;server_idx++;</highlight></codeline>
<codeline lineno="1044"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;tmr<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1045"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;retries<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1046"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1047"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_check_entry:<sp/>\&quot;%s\&quot;:<sp/>timeout\n&quot;</highlight><highlight class="normal">,<sp/>entry-&gt;name));</highlight></codeline>
<codeline lineno="1048"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>call<sp/>specified<sp/>callback<sp/>function<sp/>if<sp/>provided<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1049"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_call_found(i,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1050"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>flush<sp/>this<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1051"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;state<sp/>=<sp/>DNS_STATE_UNUSED;</highlight></codeline>
<codeline lineno="1052"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1053"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1054"><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="1055"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>wait<sp/>longer<sp/>for<sp/>the<sp/>next<sp/>retry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1056"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;tmr<sp/>=<sp/>entry-&gt;retries;</highlight></codeline>
<codeline lineno="1057"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1058"><highlight class="normal"></highlight></codeline>
<codeline lineno="1059"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>send<sp/>DNS<sp/>packet<sp/>for<sp/>this<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1060"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>err<sp/>=<sp/>dns_send(i);</highlight></codeline>
<codeline lineno="1061"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1062"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga77c491e468bf7d9a1bc48430c1866a96" kindref="member">LWIP_DBG_LEVEL_WARNING</ref>,</highlight></codeline>
<codeline lineno="1063"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;dns_send<sp/>returned<sp/>error:<sp/>%s\n&quot;</highlight><highlight class="normal">,<sp/><ref refid="err_8h_1ab58c2561ad3b133e625183721b25ba27" kindref="member">lwip_strerr</ref>(err)));</highlight></codeline>
<codeline lineno="1064"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1065"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1066"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1067"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>DNS_STATE_DONE:</highlight></codeline>
<codeline lineno="1068"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>the<sp/>time<sp/>to<sp/>live<sp/>is<sp/>nul<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1069"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((entry-&gt;ttl<sp/>==<sp/>0)<sp/>||<sp/>(--entry-&gt;ttl<sp/>==<sp/>0))<sp/>{</highlight></codeline>
<codeline lineno="1070"><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_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_check_entry:<sp/>\&quot;%s\&quot;:<sp/>flush\n&quot;</highlight><highlight class="normal">,<sp/>entry-&gt;name));</highlight></codeline>
<codeline lineno="1071"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>flush<sp/>this<sp/>entry,<sp/>there<sp/>cannot<sp/>be<sp/>any<sp/>related<sp/>pending<sp/>entries<sp/>in<sp/>this<sp/>state<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1072"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;state<sp/>=<sp/>DNS_STATE_UNUSED;</highlight></codeline>
<codeline lineno="1073"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1074"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1075"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/>DNS_STATE_UNUSED:</highlight></codeline>
<codeline lineno="1076"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>nothing<sp/>to<sp/>do<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1077"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1078"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="1079"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;unknown<sp/>dns_table<sp/>entry<sp/>state:&quot;</highlight><highlight class="normal">,<sp/>0);</highlight></codeline>
<codeline lineno="1080"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1081"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1082"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1083"><highlight class="normal"></highlight></codeline>
<codeline lineno="1087"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1088"><highlight class="normal">dns_check_entries(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="1089"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1090"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1091"><highlight class="normal"></highlight></codeline>
<codeline lineno="1092"><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="lwipopts_8h_1a2384e76c1acdf969d883f3de08d340f7" kindref="member">DNS_TABLE_SIZE</ref>;<sp/>++i)<sp/>{</highlight></codeline>
<codeline lineno="1093"><highlight class="normal"><sp/><sp/><sp/><sp/>dns_check_entry(i);</highlight></codeline>
<codeline lineno="1094"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1095"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1096"><highlight class="normal"></highlight></codeline>
<codeline lineno="1100"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1101"><highlight class="normal">dns_correct_response(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>idx,<sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>ttl)</highlight></codeline>
<codeline lineno="1102"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1103"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_table_entry<sp/>*entry<sp/>=<sp/>&amp;dns_table[idx];</highlight></codeline>
<codeline lineno="1104"><highlight class="normal"></highlight></codeline>
<codeline lineno="1105"><highlight class="normal"><sp/><sp/>entry-&gt;state<sp/>=<sp/>DNS_STATE_DONE;</highlight></codeline>
<codeline lineno="1106"><highlight class="normal"></highlight></codeline>
<codeline lineno="1107"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_recv:<sp/>\&quot;%s\&quot;:<sp/>response<sp/>=<sp/>&quot;</highlight><highlight class="normal">,<sp/>entry-&gt;name));</highlight></codeline>
<codeline lineno="1108"><highlight class="normal"><sp/><sp/><ref refid="ip__addr_8h_1af7d84bce2fb861a97f3047ecd69ab018" kindref="member">ip_addr_debug_print</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(&amp;(entry-&gt;ipaddr)));</highlight></codeline>
<codeline lineno="1109"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1110"><highlight class="normal"></highlight></codeline>
<codeline lineno="1111"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>read<sp/>the<sp/>answer<sp/>resource<sp/>record&apos;s<sp/>TTL,<sp/>and<sp/>maximize<sp/>it<sp/>if<sp/>needed<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1112"><highlight class="normal"><sp/><sp/>entry-&gt;ttl<sp/>=<sp/>ttl;</highlight></codeline>
<codeline lineno="1113"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(entry-&gt;ttl<sp/>&gt;<sp/>DNS_MAX_TTL)<sp/>{</highlight></codeline>
<codeline lineno="1114"><highlight class="normal"><sp/><sp/><sp/><sp/>entry-&gt;ttl<sp/>=<sp/>DNS_MAX_TTL;</highlight></codeline>
<codeline lineno="1115"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1116"><highlight class="normal"><sp/><sp/>dns_call_found(idx,<sp/>&amp;entry-&gt;ipaddr);</highlight></codeline>
<codeline lineno="1117"><highlight class="normal"></highlight></codeline>
<codeline lineno="1118"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(entry-&gt;ttl<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1119"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>RFC<sp/>883,<sp/>page<sp/>29:<sp/>&quot;Zero<sp/>values<sp/>are</highlight></codeline>
<codeline lineno="1120"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>interpreted<sp/>to<sp/>mean<sp/>that<sp/>the<sp/>RR<sp/>can<sp/>only<sp/>be<sp/>used<sp/>for<sp/>the</highlight></codeline>
<codeline lineno="1121"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>transaction<sp/>in<sp/>progress,<sp/>and<sp/>should<sp/>not<sp/>be<sp/>cached.&quot;</highlight></codeline>
<codeline lineno="1122"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>-&gt;<sp/>flush<sp/>this<sp/>entry<sp/>now<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1123"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>entry<sp/>reused<sp/>during<sp/>callback?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1124"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(entry-&gt;state<sp/>==<sp/>DNS_STATE_DONE)<sp/>{</highlight></codeline>
<codeline lineno="1125"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry-&gt;state<sp/>=<sp/>DNS_STATE_UNUSED;</highlight></codeline>
<codeline lineno="1126"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1127"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1128"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1132"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1133"><highlight class="normal">dns_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="1134"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1135"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1136"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>txid;</highlight></codeline>
<codeline lineno="1137"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>res_idx;</highlight></codeline>
<codeline lineno="1138"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structdns__hdr" kindref="compound">dns_hdr</ref><sp/>hdr;</highlight></codeline>
<codeline lineno="1139"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_answer<sp/>ans;</highlight></codeline>
<codeline lineno="1140"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_query<sp/>qry;</highlight></codeline>
<codeline lineno="1141"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>nquestions,<sp/>nanswers;</highlight></codeline>
<codeline lineno="1142"><highlight class="normal"></highlight></codeline>
<codeline lineno="1143"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(arg);</highlight></codeline>
<codeline lineno="1144"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(pcb);</highlight></codeline>
<codeline lineno="1145"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(port);</highlight></codeline>
<codeline lineno="1146"><highlight class="normal"></highlight></codeline>
<codeline lineno="1147"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>is<sp/>the<sp/>dns<sp/>message<sp/>big<sp/>enough<sp/>?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1148"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>&lt;<sp/>(<ref refid="prot_2dns_8h_1a1ffff846513e2493ba915d8874c26476" kindref="member">SIZEOF_DNS_HDR</ref><sp/>+<sp/>SIZEOF_DNS_QUERY))<sp/>{</highlight></codeline>
<codeline lineno="1149"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_recv:<sp/>pbuf<sp/>too<sp/>small\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1150"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>free<sp/>pbuf<sp/>and<sp/>return<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1151"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>memerr;</highlight></codeline>
<codeline lineno="1152"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1153"><highlight class="normal"></highlight></codeline>
<codeline lineno="1154"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>dns<sp/>payload<sp/>inside<sp/>static<sp/>buffer<sp/>for<sp/>processing<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1155"><highlight class="normal"><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/>&amp;hdr,<sp/><ref refid="prot_2dns_8h_1a1ffff846513e2493ba915d8874c26476" kindref="member">SIZEOF_DNS_HDR</ref>,<sp/>0)<sp/>==<sp/><ref refid="prot_2dns_8h_1a1ffff846513e2493ba915d8874c26476" kindref="member">SIZEOF_DNS_HDR</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1156"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Match<sp/>the<sp/>ID<sp/>in<sp/>the<sp/>DNS<sp/>header<sp/>with<sp/>the<sp/>name<sp/>table.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1157"><highlight class="normal"><sp/><sp/><sp/><sp/>txid<sp/>=<sp/><ref refid="def_8c_1ad637280639de4066392e6b5614fa3e56" kindref="member">lwip_htons</ref>(hdr.id);</highlight></codeline>
<codeline lineno="1158"><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="lwipopts_8h_1a2384e76c1acdf969d883f3de08d340f7" kindref="member">DNS_TABLE_SIZE</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1159"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_table_entry<sp/>*entry<sp/>=<sp/>&amp;dns_table[i];</highlight></codeline>
<codeline lineno="1160"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((entry-&gt;state<sp/>==<sp/>DNS_STATE_ASKING)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1161"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(entry-&gt;txid<sp/>==<sp/>txid))<sp/>{</highlight></codeline>
<codeline lineno="1162"><highlight class="normal"></highlight></codeline>
<codeline lineno="1163"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>only<sp/>care<sp/>about<sp/>the<sp/>question(s)<sp/>and<sp/>the<sp/>answers.<sp/>The<sp/>authrr</highlight></codeline>
<codeline lineno="1164"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>and<sp/>the<sp/>extrarr<sp/>are<sp/>simply<sp/>discarded.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1165"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nquestions<sp/>=<sp/><ref refid="def_8c_1ad637280639de4066392e6b5614fa3e56" kindref="member">lwip_htons</ref>(hdr.numquestions);</highlight></codeline>
<codeline lineno="1166"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>nanswers<sp/><sp/><sp/>=<sp/><ref refid="def_8c_1ad637280639de4066392e6b5614fa3e56" kindref="member">lwip_htons</ref>(hdr.numanswers);</highlight></codeline>
<codeline lineno="1167"><highlight class="normal"></highlight></codeline>
<codeline lineno="1168"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>for<sp/>correct<sp/>response.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1169"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((hdr.flags1<sp/>&amp;<sp/><ref refid="prot_2dns_8h_1a96eb4534b574ece96ed36806039f73d3" kindref="member">DNS_FLAG1_RESPONSE</ref>)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1170"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_recv:<sp/>\&quot;%s\&quot;:<sp/>not<sp/>a<sp/>response\n&quot;</highlight><highlight class="normal">,<sp/>entry-&gt;name));</highlight></codeline>
<codeline lineno="1171"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>memerr;<sp/></highlight><highlight class="comment">/*<sp/>ignore<sp/>this<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1172"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1173"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(nquestions<sp/>!=<sp/>1)<sp/>{</highlight></codeline>
<codeline lineno="1174"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_recv:<sp/>\&quot;%s\&quot;:<sp/>response<sp/>not<sp/>match<sp/>to<sp/>query\n&quot;</highlight><highlight class="normal">,<sp/>entry-&gt;name));</highlight></codeline>
<codeline lineno="1175"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>memerr;<sp/></highlight><highlight class="comment">/*<sp/>ignore<sp/>this<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1176"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1177"><highlight class="normal"></highlight></codeline>
<codeline lineno="1178"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DNS_SUPPORT_MDNS_QUERIES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1179"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!entry-&gt;is_mdns)</highlight></codeline>
<codeline lineno="1180"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DNS_SUPPORT_MDNS_QUERIES<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1181"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="1182"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>whether<sp/>response<sp/>comes<sp/>from<sp/>the<sp/>same<sp/>network<sp/>address<sp/>to<sp/>which<sp/>the</highlight></codeline>
<codeline lineno="1183"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>question<sp/>was<sp/>sent.<sp/>(RFC<sp/>5452)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1184"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(addr,<sp/>&amp;dns_servers[entry-&gt;server_idx]))<sp/>{</highlight></codeline>
<codeline lineno="1185"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>memerr;<sp/></highlight><highlight class="comment">/*<sp/>ignore<sp/>this<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1186"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1187"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1188"><highlight class="normal"></highlight></codeline>
<codeline lineno="1189"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>if<sp/>the<sp/>name<sp/>in<sp/>the<sp/>&quot;question&quot;<sp/>part<sp/>match<sp/>with<sp/>the<sp/>name<sp/>in<sp/>the<sp/>entry<sp/>and</highlight></codeline>
<codeline lineno="1190"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>skip<sp/>it<sp/>if<sp/>equal.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1191"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>res_idx<sp/>=<sp/>dns_compare_name(entry-&gt;name,<sp/>p,<sp/><ref refid="prot_2dns_8h_1a1ffff846513e2493ba915d8874c26476" kindref="member">SIZEOF_DNS_HDR</ref>);</highlight></codeline>
<codeline lineno="1192"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(res_idx<sp/>==<sp/>0xFFFF)<sp/>{</highlight></codeline>
<codeline lineno="1193"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_recv:<sp/>\&quot;%s\&quot;:<sp/>response<sp/>not<sp/>match<sp/>to<sp/>query\n&quot;</highlight><highlight class="normal">,<sp/>entry-&gt;name));</highlight></codeline>
<codeline lineno="1194"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>memerr;<sp/></highlight><highlight class="comment">/*<sp/>ignore<sp/>this<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1195"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1196"><highlight class="normal"></highlight></codeline>
<codeline lineno="1197"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>check<sp/>if<sp/>&quot;question&quot;<sp/>part<sp/>matches<sp/>the<sp/>request<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1198"><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>(p,<sp/>&amp;qry,<sp/>SIZEOF_DNS_QUERY,<sp/>res_idx)<sp/>!=<sp/>SIZEOF_DNS_QUERY)<sp/>{</highlight></codeline>
<codeline lineno="1199"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>memerr;<sp/></highlight><highlight class="comment">/*<sp/>ignore<sp/>this<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1200"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1201"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((qry.cls<sp/>!=<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2dns_8h_1a08bc1c1897d2921b6f102365be55da2a" kindref="member">DNS_RRCLASS_IN</ref>))<sp/>||</highlight></codeline>
<codeline lineno="1202"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(LWIP_DNS_ADDRTYPE_IS_IPV6(entry-&gt;reqaddrtype)<sp/>&amp;&amp;<sp/>(qry.type<sp/>!=<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2dns_8h_1ae533fbb9f59f4de915ed3ecb9ff24953" kindref="member">DNS_RRTYPE_AAAA</ref>)))<sp/>||</highlight></codeline>
<codeline lineno="1203"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(!LWIP_DNS_ADDRTYPE_IS_IPV6(entry-&gt;reqaddrtype)<sp/>&amp;&amp;<sp/>(qry.type<sp/>!=<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2dns_8h_1a830e99420463950d3c4d661487f20d0d" kindref="member">DNS_RRTYPE_A</ref>))))<sp/>{</highlight></codeline>
<codeline lineno="1204"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_recv:<sp/>\&quot;%s\&quot;:<sp/>response<sp/>not<sp/>match<sp/>to<sp/>query\n&quot;</highlight><highlight class="normal">,<sp/>entry-&gt;name));</highlight></codeline>
<codeline lineno="1205"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>memerr;<sp/></highlight><highlight class="comment">/*<sp/>ignore<sp/>this<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1206"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1207"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>skip<sp/>the<sp/>rest<sp/>of<sp/>the<sp/>&quot;question&quot;<sp/>part<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1208"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>res_idx<sp/>+=<sp/>SIZEOF_DNS_QUERY;</highlight></codeline>
<codeline lineno="1209"><highlight class="normal"></highlight></codeline>
<codeline lineno="1210"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>for<sp/>error.<sp/>If<sp/>so,<sp/>call<sp/>callback<sp/>to<sp/>inform.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1211"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(hdr.flags2<sp/>&amp;<sp/><ref refid="prot_2dns_8h_1a9f6c329c04baba17fe0f5b2a6597d713" kindref="member">DNS_FLAG2_ERR_MASK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1212"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_recv:<sp/>\&quot;%s\&quot;:<sp/>error<sp/>in<sp/>flags\n&quot;</highlight><highlight class="normal">,<sp/>entry-&gt;name));</highlight></codeline>
<codeline lineno="1213"><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="1214"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>((nanswers<sp/>&gt;<sp/>0)<sp/>&amp;&amp;<sp/>(res_idx<sp/>&lt;<sp/>p-&gt;tot_len))<sp/>{</highlight></codeline>
<codeline lineno="1215"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>skip<sp/>answer<sp/>resource<sp/>record&apos;s<sp/>host<sp/>name<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1216"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>res_idx<sp/>=<sp/>dns_skip_name(p,<sp/>res_idx);</highlight></codeline>
<codeline lineno="1217"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(res_idx<sp/>==<sp/>0xFFFF)<sp/>{</highlight></codeline>
<codeline lineno="1218"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>memerr;<sp/></highlight><highlight class="comment">/*<sp/>ignore<sp/>this<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1219"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1220"><highlight class="normal"></highlight></codeline>
<codeline lineno="1221"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>for<sp/>IP<sp/>address<sp/>type<sp/>and<sp/>Internet<sp/>class.<sp/>Others<sp/>are<sp/>discarded.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1222"><highlight class="normal"><sp/><sp/><sp/><sp/><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>(p,<sp/>&amp;ans,<sp/>SIZEOF_DNS_ANSWER,<sp/>res_idx)<sp/>!=<sp/>SIZEOF_DNS_ANSWER)<sp/>{</highlight></codeline>
<codeline lineno="1223"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>memerr;<sp/></highlight><highlight class="comment">/*<sp/>ignore<sp/>this<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1224"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1225"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>res_idx<sp/>+=<sp/>SIZEOF_DNS_ANSWER;</highlight></codeline>
<codeline lineno="1226"><highlight class="normal"></highlight></codeline>
<codeline lineno="1227"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ans.cls<sp/>==<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2dns_8h_1a08bc1c1897d2921b6f102365be55da2a" kindref="member">DNS_RRCLASS_IN</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1228"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1229"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ans.type<sp/>==<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2dns_8h_1a830e99420463950d3c4d661487f20d0d" kindref="member">DNS_RRTYPE_A</ref>))<sp/>&amp;&amp;<sp/>(ans.len<sp/>==<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(ip4_addr_t))))<sp/>{</highlight></codeline>
<codeline lineno="1230"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1231"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!LWIP_DNS_ADDRTYPE_IS_IPV6(entry-&gt;reqaddrtype))</highlight></codeline>
<codeline lineno="1232"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1233"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="1234"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_t<sp/>ip4addr;</highlight></codeline>
<codeline lineno="1235"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>read<sp/>the<sp/>IP<sp/>address<sp/>after<sp/>answer<sp/>resource<sp/>record&apos;s<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1236"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><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>(p,<sp/>&amp;ip4addr,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(ip4_addr_t),<sp/>res_idx)<sp/>!=<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(ip4_addr_t))<sp/>{</highlight></codeline>
<codeline lineno="1237"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>memerr;<sp/></highlight><highlight class="comment">/*<sp/>ignore<sp/>this<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1238"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1239"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip_addr_copy_from_ip4(dns_table[i].ipaddr,<sp/>ip4addr);</highlight></codeline>
<codeline lineno="1240"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1241"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>handle<sp/>correct<sp/>response<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1242"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_correct_response(i,<sp/><ref refid="def_8h_1a56098407d66feb75806f655bafbee81d" kindref="member">lwip_ntohl</ref>(ans.ttl));</highlight></codeline>
<codeline lineno="1243"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1244"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1245"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1246"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1247"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1248"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ans.type<sp/>==<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2dns_8h_1ae533fbb9f59f4de915ed3ecb9ff24953" kindref="member">DNS_RRTYPE_AAAA</ref>))<sp/>&amp;&amp;<sp/>(ans.len<sp/>==<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(</highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(ip6_addr_t))))<sp/>{</highlight></codeline>
<codeline lineno="1249"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1250"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(LWIP_DNS_ADDRTYPE_IS_IPV6(entry-&gt;reqaddrtype))</highlight></codeline>
<codeline lineno="1251"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1252"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="1253"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip6_addr_t<sp/>ip6addr;</highlight></codeline>
<codeline lineno="1254"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>read<sp/>the<sp/>IP<sp/>address<sp/>after<sp/>answer<sp/>resource<sp/>record&apos;s<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1255"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><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>(p,<sp/>&amp;ip6addr,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(ip6_addr_t),<sp/>res_idx)<sp/>!=<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(ip6_addr_t))<sp/>{</highlight></codeline>
<codeline lineno="1256"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>memerr;<sp/></highlight><highlight class="comment">/*<sp/>ignore<sp/>this<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1257"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1258"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1abe6f7908ce8a91dc587e2ebc2172e651" kindref="member">ip_addr_copy_from_ip6</ref>(dns_table[i].ipaddr,<sp/>ip6addr);</highlight></codeline>
<codeline lineno="1259"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1260"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>handle<sp/>correct<sp/>response<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1261"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_correct_response(i,<sp/><ref refid="def_8h_1a56098407d66feb75806f655bafbee81d" kindref="member">lwip_ntohl</ref>(ans.ttl));</highlight></codeline>
<codeline lineno="1262"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1263"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1264"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1265"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1266"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1267"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>skip<sp/>this<sp/>answer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1268"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((</highlight><highlight class="keywordtype">int</highlight><highlight class="normal">)(res_idx<sp/>+<sp/><ref refid="def_8c_1ad637280639de4066392e6b5614fa3e56" kindref="member">lwip_htons</ref>(ans.len))<sp/>&gt;<sp/>0xFFFF)<sp/>{</highlight></codeline>
<codeline lineno="1269"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">goto</highlight><highlight class="normal"><sp/>memerr;<sp/></highlight><highlight class="comment">/*<sp/>ignore<sp/>this<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1270"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1271"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>res_idx<sp/>+=<sp/><ref refid="def_8c_1ad637280639de4066392e6b5614fa3e56" kindref="member">lwip_htons</ref>(ans.len);</highlight></codeline>
<codeline lineno="1272"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>--nanswers;</highlight></codeline>
<codeline lineno="1273"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1274"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1275"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((entry-&gt;reqaddrtype<sp/>==<sp/>LWIP_DNS_ADDRTYPE_IPV4_IPV6)<sp/>||</highlight></codeline>
<codeline lineno="1276"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(entry-&gt;reqaddrtype<sp/>==<sp/>LWIP_DNS_ADDRTYPE_IPV6_IPV4))<sp/>{</highlight></codeline>
<codeline lineno="1277"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(entry-&gt;reqaddrtype<sp/>==<sp/>LWIP_DNS_ADDRTYPE_IPV4_IPV6)<sp/>{</highlight></codeline>
<codeline lineno="1278"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>IPv4<sp/>failed,<sp/>try<sp/>IPv6<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1279"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_table[i].reqaddrtype<sp/>=<sp/>LWIP_DNS_ADDRTYPE_IPV6;</highlight></codeline>
<codeline lineno="1280"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1281"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>IPv6<sp/>failed,<sp/>try<sp/>IPv4<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1282"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_table[i].reqaddrtype<sp/>=<sp/>LWIP_DNS_ADDRTYPE_IPV4;</highlight></codeline>
<codeline lineno="1283"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1284"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1285"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_table[i].state<sp/>=<sp/>DNS_STATE_NEW;</highlight></codeline>
<codeline lineno="1286"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_check_entry(i);</highlight></codeline>
<codeline lineno="1287"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1288"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1289"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1290"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_recv:<sp/>\&quot;%s\&quot;:<sp/>error<sp/>in<sp/>response\n&quot;</highlight><highlight class="normal">,<sp/>entry-&gt;name));</highlight></codeline>
<codeline lineno="1291"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1292"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>call<sp/>callback<sp/>to<sp/>indicate<sp/>error,<sp/>clean<sp/>up<sp/>memory<sp/>and<sp/>return<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1293"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1294"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_call_found(i,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1295"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_table[i].state<sp/>=<sp/>DNS_STATE_UNUSED;</highlight></codeline>
<codeline lineno="1296"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1297"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1298"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1299"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1300"><highlight class="normal"></highlight></codeline>
<codeline lineno="1301"><highlight class="normal">memerr:</highlight></codeline>
<codeline lineno="1302"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>deallocate<sp/>memory<sp/>and<sp/>return<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1303"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1304"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1305"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1306"><highlight class="normal"></highlight></codeline>
<codeline lineno="1316"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1317"><highlight class="normal">dns_enqueue(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>hostnamelen,<sp/>dns_found_callback<sp/>found,</highlight></codeline>
<codeline lineno="1318"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*callback_arg<sp/>LWIP_DNS_ADDRTYPE_ARG(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>dns_addrtype)<sp/>LWIP_DNS_ISMDNS_ARG(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>is_mdns))</highlight></codeline>
<codeline lineno="1319"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1320"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1321"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>lseq,<sp/>lseqi;</highlight></codeline>
<codeline lineno="1322"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_table_entry<sp/>*entry<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1323"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>namelen;</highlight></codeline>
<codeline lineno="1324"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">dns_req_entry*<sp/>req;</highlight></codeline>
<codeline lineno="1325"><highlight class="normal"></highlight></codeline>
<codeline lineno="1326"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING)<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1327"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>r;</highlight></codeline>
<codeline lineno="1328"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>check<sp/>for<sp/>duplicate<sp/>entries<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1329"><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="lwipopts_8h_1a2384e76c1acdf969d883f3de08d340f7" kindref="member">DNS_TABLE_SIZE</ref>;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1330"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((dns_table[i].state<sp/>==<sp/>DNS_STATE_ASKING)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="1331"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="group__sys__nonstandard_1ga997dcc49451121d4ed755b33bc7bd26a" kindref="member">lwip_strnicmp</ref>(<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/>dns_table[i].<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(dns_table[i].<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>))<sp/>==<sp/>0))<sp/>{</highlight></codeline>
<codeline lineno="1332"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1333"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_table[i].reqaddrtype<sp/>!=<sp/>dns_addrtype)<sp/>{</highlight></codeline>
<codeline lineno="1334"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>requested<sp/>address<sp/>types<sp/>don&apos;t<sp/>match</highlight></codeline>
<codeline lineno="1335"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>this<sp/>can<sp/>lead<sp/>to<sp/>2<sp/>concurrent<sp/>requests,<sp/>but<sp/>mixing<sp/>the<sp/>address<sp/>types</highlight></codeline>
<codeline lineno="1336"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>for<sp/>the<sp/>same<sp/>host<sp/>should<sp/>not<sp/>be<sp/>that<sp/>common<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1337"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">continue</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1338"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1339"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1340"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>is<sp/>a<sp/>duplicate<sp/>entry,<sp/>find<sp/>a<sp/>free<sp/>request<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1341"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(r<sp/>=<sp/>0;<sp/>r<sp/>&lt;<sp/>DNS_MAX_REQUESTS;<sp/>r++)<sp/>{</highlight></codeline>
<codeline lineno="1342"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_requests[r].found<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1343"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_requests[r].found<sp/>=<sp/>found;</highlight></codeline>
<codeline lineno="1344"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_requests[r].arg<sp/>=<sp/>callback_arg;</highlight></codeline>
<codeline lineno="1345"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dns_requests[r].dns_table_idx<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="1346"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>LWIP_DNS_SET_ADDRTYPE(dns_requests[r].reqaddrtype,<sp/>dns_addrtype);</highlight></codeline>
<codeline lineno="1347"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_enqueue:<sp/>\&quot;%s\&quot;:<sp/>duplicate<sp/>request\n&quot;</highlight><highlight class="normal">,<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>));</highlight></codeline>
<codeline lineno="1348"><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_1ggae2e66c7d13afc90ffecd6151680fbadca13e1dd0edca8a27b6abdf1524bde7929" kindref="member">ERR_INPROGRESS</ref>;</highlight></codeline>
<codeline lineno="1349"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1350"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1351"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1352"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1353"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>duplicate<sp/>entries<sp/>found<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1354"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1355"><highlight class="normal"></highlight></codeline>
<codeline lineno="1356"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>search<sp/>an<sp/>unused<sp/>entry,<sp/>or<sp/>the<sp/>oldest<sp/>one<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1357"><highlight class="normal"><sp/><sp/>lseq<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1358"><highlight class="normal"><sp/><sp/>lseqi<sp/>=<sp/><ref refid="lwipopts_8h_1a2384e76c1acdf969d883f3de08d340f7" kindref="member">DNS_TABLE_SIZE</ref>;</highlight></codeline>
<codeline lineno="1359"><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="lwipopts_8h_1a2384e76c1acdf969d883f3de08d340f7" kindref="member">DNS_TABLE_SIZE</ref>;<sp/>++i)<sp/>{</highlight></codeline>
<codeline lineno="1360"><highlight class="normal"><sp/><sp/><sp/><sp/>entry<sp/>=<sp/>&amp;dns_table[i];</highlight></codeline>
<codeline lineno="1361"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>is<sp/>it<sp/>an<sp/>unused<sp/>entry<sp/>?<sp/>*/</highlight><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/>(entry-&gt;state<sp/>==<sp/>DNS_STATE_UNUSED)<sp/>{</highlight></codeline>
<codeline lineno="1363"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1364"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1365"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>check<sp/>if<sp/>this<sp/>is<sp/>the<sp/>oldest<sp/>completed<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1366"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(entry-&gt;state<sp/>==<sp/>DNS_STATE_DONE)<sp/>{</highlight></codeline>
<codeline lineno="1367"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>age<sp/>=<sp/>dns_seqno<sp/>-<sp/>entry-&gt;seqno;</highlight></codeline>
<codeline lineno="1368"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(age<sp/>&gt;<sp/>lseq)<sp/>{</highlight></codeline>
<codeline lineno="1369"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lseq<sp/>=<sp/>age;</highlight></codeline>
<codeline lineno="1370"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>lseqi<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="1371"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1372"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1373"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1374"><highlight class="normal"></highlight></codeline>
<codeline lineno="1375"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>we<sp/>don&apos;t<sp/>have<sp/>found<sp/>an<sp/>unused<sp/>entry,<sp/>use<sp/>the<sp/>oldest<sp/>completed<sp/>one<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1376"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(i<sp/>==<sp/><ref refid="lwipopts_8h_1a2384e76c1acdf969d883f3de08d340f7" kindref="member">DNS_TABLE_SIZE</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1377"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((lseqi<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a2384e76c1acdf969d883f3de08d340f7" kindref="member">DNS_TABLE_SIZE</ref>)<sp/>||<sp/>(dns_table[lseqi].state<sp/>!=<sp/>DNS_STATE_DONE))<sp/>{</highlight></codeline>
<codeline lineno="1378"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>entry<sp/>can<sp/>be<sp/>used<sp/>now,<sp/>table<sp/>is<sp/>full<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1379"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_enqueue:<sp/>\&quot;%s\&quot;:<sp/>DNS<sp/>entries<sp/>table<sp/>is<sp/>full\n&quot;</highlight><highlight class="normal">,<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>));</highlight></codeline>
<codeline lineno="1380"><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="1381"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1382"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>use<sp/>the<sp/>oldest<sp/>completed<sp/>one<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1383"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>lseqi;</highlight></codeline>
<codeline lineno="1384"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>entry<sp/>=<sp/>&amp;dns_table[i];</highlight></codeline>
<codeline lineno="1385"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1386"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1387"><highlight class="normal"></highlight></codeline>
<codeline lineno="1388"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_NO_MULTIPLE_OUTSTANDING)<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1389"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>find<sp/>a<sp/>free<sp/>request<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1390"><highlight class="normal"><sp/><sp/>req<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1391"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(r<sp/>=<sp/>0;<sp/>r<sp/>&lt;<sp/>DNS_MAX_REQUESTS;<sp/>r++)<sp/>{</highlight></codeline>
<codeline lineno="1392"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_requests[r].found<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1393"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>req<sp/>=<sp/>&amp;dns_requests[r];</highlight></codeline>
<codeline lineno="1394"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="1395"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1396"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1397"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(req<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1398"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>request<sp/>entry<sp/>can<sp/>be<sp/>used<sp/>now,<sp/>table<sp/>is<sp/>full<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1399"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_enqueue:<sp/>\&quot;%s\&quot;:<sp/>DNS<sp/>request<sp/>entries<sp/>table<sp/>is<sp/>full\n&quot;</highlight><highlight class="normal">,<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>));</highlight></codeline>
<codeline lineno="1400"><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="1401"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1402"><highlight class="normal"><sp/><sp/>req-&gt;dns_table_idx<sp/>=<sp/>i;</highlight></codeline>
<codeline lineno="1403"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1404"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>in<sp/>this<sp/>configuration,<sp/>the<sp/>entry<sp/>index<sp/>is<sp/>the<sp/>same<sp/>as<sp/>the<sp/>request<sp/>index<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1405"><highlight class="normal"><sp/><sp/>req<sp/>=<sp/>&amp;dns_requests[i];</highlight></codeline>
<codeline lineno="1406"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1407"><highlight class="normal"></highlight></codeline>
<codeline lineno="1408"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>use<sp/>this<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1409"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_enqueue:<sp/>\&quot;%s\&quot;:<sp/>use<sp/>DNS<sp/>entry<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="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(i)));</highlight></codeline>
<codeline lineno="1410"><highlight class="normal"></highlight></codeline>
<codeline lineno="1411"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>fill<sp/>the<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1412"><highlight class="normal"><sp/><sp/>entry-&gt;state<sp/>=<sp/>DNS_STATE_NEW;</highlight></codeline>
<codeline lineno="1413"><highlight class="normal"><sp/><sp/>entry-&gt;seqno<sp/>=<sp/>dns_seqno;</highlight></codeline>
<codeline lineno="1414"><highlight class="normal"><sp/><sp/>LWIP_DNS_SET_ADDRTYPE(entry-&gt;reqaddrtype,<sp/>dns_addrtype);</highlight></codeline>
<codeline lineno="1415"><highlight class="normal"><sp/><sp/>LWIP_DNS_SET_ADDRTYPE(req-&gt;reqaddrtype,<sp/>dns_addrtype);</highlight></codeline>
<codeline lineno="1416"><highlight class="normal"><sp/><sp/>req-&gt;found<sp/>=<sp/>found;</highlight></codeline>
<codeline lineno="1417"><highlight class="normal"><sp/><sp/>req-&gt;arg<sp/><sp/><sp/>=<sp/>callback_arg;</highlight></codeline>
<codeline lineno="1418"><highlight class="normal"><sp/><sp/>namelen<sp/>=<sp/><ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>(hostnamelen,<sp/><ref refid="lwipopts_8h_1a3b01c79902063c170ef57deb72f56124" kindref="member">DNS_MAX_NAME_LENGTH</ref>-1);</highlight></codeline>
<codeline lineno="1419"><highlight class="normal"><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(entry-&gt;name,<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/>namelen);</highlight></codeline>
<codeline lineno="1420"><highlight class="normal"><sp/><sp/>entry-&gt;name[namelen]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1421"><highlight class="normal"></highlight></codeline>
<codeline lineno="1422"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_RAND_SRC_PORT)<sp/>!=<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1423"><highlight class="normal"><sp/><sp/>entry-&gt;pcb_idx<sp/>=<sp/>dns_alloc_pcb();</highlight></codeline>
<codeline lineno="1424"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(entry-&gt;pcb_idx<sp/>&gt;=<sp/>DNS_MAX_SOURCE_PORTS)<sp/>{</highlight></codeline>
<codeline lineno="1425"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>failed<sp/>to<sp/>get<sp/>a<sp/>UDP<sp/>pcb<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1426"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_enqueue:<sp/>\&quot;%s\&quot;:<sp/>failed<sp/>to<sp/>allocate<sp/>a<sp/>pcb\n&quot;</highlight><highlight class="normal">,<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>));</highlight></codeline>
<codeline lineno="1427"><highlight class="normal"><sp/><sp/><sp/><sp/>entry-&gt;state<sp/>=<sp/>DNS_STATE_UNUSED;</highlight></codeline>
<codeline lineno="1428"><highlight class="normal"><sp/><sp/><sp/><sp/>req-&gt;found<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1429"><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="1430"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1431"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_enqueue:<sp/>\&quot;%s\&quot;:<sp/>use<sp/>DNS<sp/>pcb<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="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(entry-&gt;pcb_idx)));</highlight></codeline>
<codeline lineno="1432"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1433"><highlight class="normal"></highlight></codeline>
<codeline lineno="1434"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DNS_SUPPORT_MDNS_QUERIES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1435"><highlight class="normal"><sp/><sp/>entry-&gt;is_mdns<sp/>=<sp/>is_mdns;</highlight></codeline>
<codeline lineno="1436"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1437"><highlight class="normal"></highlight></codeline>
<codeline lineno="1438"><highlight class="normal"><sp/><sp/>dns_seqno++;</highlight></codeline>
<codeline lineno="1439"><highlight class="normal"></highlight></codeline>
<codeline lineno="1440"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>force<sp/>to<sp/>send<sp/>query<sp/>without<sp/>waiting<sp/>timer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1441"><highlight class="normal"><sp/><sp/>dns_check_entry(i);</highlight></codeline>
<codeline lineno="1442"><highlight class="normal"></highlight></codeline>
<codeline lineno="1443"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>dns<sp/>query<sp/>is<sp/>enqueued<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1444"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca13e1dd0edca8a27b6abdf1524bde7929" kindref="member">ERR_INPROGRESS</ref>;</highlight></codeline>
<codeline lineno="1445"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1446"><highlight class="normal"></highlight></codeline>
<codeline lineno="1467"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1468"><highlight class="normal">dns_gethostbyname(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*hostname,<sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*addr,<sp/>dns_found_callback<sp/>found,</highlight></codeline>
<codeline lineno="1469"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*callback_arg)</highlight></codeline>
<codeline lineno="1470"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1471"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>dns_gethostbyname_addrtype(hostname,<sp/>addr,<sp/>found,<sp/>callback_arg,<sp/>LWIP_DNS_ADDRTYPE_DEFAULT);</highlight></codeline>
<codeline lineno="1472"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1473"><highlight class="normal"></highlight></codeline>
<codeline lineno="1488"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1489"><highlight class="normal">dns_gethostbyname_addrtype(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*hostname,<sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*addr,<sp/>dns_found_callback<sp/>found,</highlight></codeline>
<codeline lineno="1490"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*callback_arg,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>dns_addrtype)</highlight></codeline>
<codeline lineno="1491"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1492"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>hostnamelen;</highlight></codeline>
<codeline lineno="1493"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DNS_SUPPORT_MDNS_QUERIES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1494"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>is_mdns;</highlight></codeline>
<codeline lineno="1495"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1496"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>not<sp/>initialized<sp/>or<sp/>no<sp/>valid<sp/>server<sp/>yet,<sp/>or<sp/>invalid<sp/>addr<sp/>pointer</highlight></codeline>
<codeline lineno="1497"><highlight class="comment"><sp/><sp/><sp/>*<sp/>or<sp/>invalid<sp/>hostname<sp/>or<sp/>invalid<sp/>hostname<sp/>length<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1498"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((addr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||</highlight></codeline>
<codeline lineno="1499"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(!hostname)<sp/>||<sp/>(!hostname[0]))<sp/>{</highlight></codeline>
<codeline lineno="1500"><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="1501"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1502"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>((LWIP_DNS_SECURE<sp/>&amp;<sp/>LWIP_DNS_SECURE_RAND_SRC_PORT)<sp/>==<sp/>0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1503"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_pcbs[0]<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1504"><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="1505"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1506"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1507"><highlight class="normal"><sp/><sp/>hostnamelen<sp/>=<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(hostname);</highlight></codeline>
<codeline lineno="1508"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(hostnamelen<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a3b01c79902063c170ef57deb72f56124" kindref="member">DNS_MAX_NAME_LENGTH</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1509"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1aba55da2352c99d813767913e5e36be1f" kindref="member">DNS_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;dns_gethostbyname:<sp/>name<sp/>too<sp/>long<sp/>to<sp/>resolve&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1510"><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="1511"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1512"><highlight class="normal"></highlight></codeline>
<codeline lineno="1513"><highlight class="normal"></highlight></codeline>
<codeline lineno="1514"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_HAVE_LOOPIF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1515"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="string_8h_1a6f3dcb20ff11ff9db5904c3cfb61a38c" kindref="member">strcmp</ref>(hostname,<sp/></highlight><highlight class="stringliteral">&quot;localhost&quot;</highlight><highlight class="normal">)<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1516"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a8f9d56ac85cd87338a1823e4a58ba1da" kindref="member">ip_addr_set_loopback</ref>(LWIP_DNS_ADDRTYPE_IS_IPV6(dns_addrtype),<sp/>addr);</highlight></codeline>
<codeline lineno="1517"><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="1518"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1519"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_HAVE_LOOPIF<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1520"><highlight class="normal"></highlight></codeline>
<codeline lineno="1521"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>host<sp/>name<sp/>already<sp/>in<sp/>octet<sp/>notation?<sp/>set<sp/>ip<sp/>addr<sp/>and<sp/>return<sp/>ERR_OK<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1522"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ip__addr_8h_1a9b9fae6ad88a288c3c6da050644e2a48" kindref="member">ipaddr_aton</ref>(hostname,<sp/>addr))<sp/>{</highlight></codeline>
<codeline lineno="1523"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1524"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="ip__addr_8h_1a9bac7e938757f1d24df2404e8b57cb7d" kindref="member">IP_IS_V6</ref>(addr)<sp/>&amp;&amp;<sp/>(dns_addrtype<sp/>!=<sp/>LWIP_DNS_ADDRTYPE_IPV4))<sp/>||</highlight></codeline>
<codeline lineno="1525"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="ip__addr_8h_1abee5dab2191bb0f3355d7f30d1496f24" kindref="member">IP_IS_V4</ref>(addr)<sp/>&amp;&amp;<sp/>(dns_addrtype<sp/>!=<sp/>LWIP_DNS_ADDRTYPE_IPV6)))</highlight></codeline>
<codeline lineno="1526"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1527"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="1528"><highlight class="normal"><sp/><sp/><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="1529"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1530"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1531"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>already<sp/>have<sp/>this<sp/>address<sp/>cached?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1532"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_lookup(hostname,<sp/>addr<sp/>LWIP_DNS_ADDRTYPE_ARG(dns_addrtype))<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1533"><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="1534"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1535"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1536"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((dns_addrtype<sp/>==<sp/>LWIP_DNS_ADDRTYPE_IPV4_IPV6)<sp/>||<sp/>(dns_addrtype<sp/>==<sp/>LWIP_DNS_ADDRTYPE_IPV6_IPV4))<sp/>{</highlight></codeline>
<codeline lineno="1537"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>fallback<sp/>to<sp/>2nd<sp/>IP<sp/>type<sp/>and<sp/>try<sp/>again<sp/>to<sp/>lookup<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1538"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>fallback;</highlight></codeline>
<codeline lineno="1539"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_addrtype<sp/>==<sp/>LWIP_DNS_ADDRTYPE_IPV4_IPV6)<sp/>{</highlight></codeline>
<codeline lineno="1540"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>fallback<sp/>=<sp/>LWIP_DNS_ADDRTYPE_IPV6;</highlight></codeline>
<codeline lineno="1541"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1542"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>fallback<sp/>=<sp/>LWIP_DNS_ADDRTYPE_IPV4;</highlight></codeline>
<codeline lineno="1543"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1544"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dns_lookup(hostname,<sp/>addr<sp/>LWIP_DNS_ADDRTYPE_ARG(fallback))<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1545"><highlight class="normal"><sp/><sp/><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="1546"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1547"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1548"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1549"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(dns_addrtype);</highlight></codeline>
<codeline lineno="1550"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1551"><highlight class="normal"></highlight></codeline>
<codeline lineno="1552"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DNS_SUPPORT_MDNS_QUERIES</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1553"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="string_8h_1adcec9a82a6a276e8edb0fd4fc26fe8f2" kindref="member">strstr</ref>(hostname,<sp/></highlight><highlight class="stringliteral">&quot;.local&quot;</highlight><highlight class="normal">)<sp/>==<sp/>&amp;hostname[hostnamelen]<sp/>-<sp/>6)<sp/>{</highlight></codeline>
<codeline lineno="1554"><highlight class="normal"><sp/><sp/><sp/><sp/>is_mdns<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="1555"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1556"><highlight class="normal"><sp/><sp/><sp/><sp/>is_mdns<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1557"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1558"><highlight class="normal"></highlight></codeline>
<codeline lineno="1559"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!is_mdns)</highlight></codeline>
<codeline lineno="1560"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DNS_SUPPORT_MDNS_QUERIES<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1561"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="1562"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>prevent<sp/>calling<sp/>found<sp/>callback<sp/>if<sp/>no<sp/>server<sp/>is<sp/>set,<sp/>return<sp/>error<sp/>instead<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1563"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="ip__addr_8h_1acd8f5aa151cff966fd28368b85f38c05" kindref="member">ip_addr_isany_val</ref>(dns_servers[0]))<sp/>{</highlight></codeline>
<codeline lineno="1564"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><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="1565"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1566"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1567"><highlight class="normal"></highlight></codeline>
<codeline lineno="1568"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>queue<sp/>query<sp/>with<sp/>specified<sp/>callback<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1569"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>dns_enqueue(hostname,<sp/>hostnamelen,<sp/>found,<sp/>callback_arg<sp/>LWIP_DNS_ADDRTYPE_ARG(dns_addrtype)</highlight></codeline>
<codeline lineno="1570"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>LWIP_DNS_ISMDNS_ARG(is_mdns));</highlight></codeline>
<codeline lineno="1571"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1572"><highlight class="normal"></highlight></codeline>
<codeline lineno="1573"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DNS<sp/>*/</highlight><highlight class="preprocessor"></highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/net/core/dns.c"/>
  </compounddef>
</doxygen>
