<?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="api__lib_8c" kind="file" language="C++">
    <compoundname>api_lib.c</compoundname>
    <includes refid="opt_8h" local="no">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="1">
        <label>C:/Dev/git/UbixOS/sys/net/api/api_lib.c</label>
        <link refid="api__lib_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
      </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="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>Sequential API External module </para>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="24"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="25"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2001-2004<sp/>Swedish<sp/>Institute<sp/>of<sp/>Computer<sp/>Science.</highlight></codeline>
<codeline lineno="26"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="27"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="28"><highlight class="comment"><sp/>*<sp/>Redistribution<sp/>and<sp/>use<sp/>in<sp/>source<sp/>and<sp/>binary<sp/>forms,<sp/>with<sp/>or<sp/>without<sp/>modification,</highlight></codeline>
<codeline lineno="29"><highlight class="comment"><sp/>*<sp/>are<sp/>permitted<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions<sp/>are<sp/>met:</highlight></codeline>
<codeline lineno="30"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="31"><highlight class="comment"><sp/>*<sp/>1.<sp/>Redistributions<sp/>of<sp/>source<sp/>code<sp/>must<sp/>retain<sp/>the<sp/>above<sp/>copyright<sp/>notice,</highlight></codeline>
<codeline lineno="32"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer.</highlight></codeline>
<codeline lineno="33"><highlight class="comment"><sp/>*<sp/>2.<sp/>Redistributions<sp/>in<sp/>binary<sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright<sp/>notice,</highlight></codeline>
<codeline lineno="34"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer<sp/>in<sp/>the<sp/>documentation</highlight></codeline>
<codeline lineno="35"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>and/or<sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.</highlight></codeline>
<codeline lineno="36"><highlight class="comment"><sp/>*<sp/>3.<sp/>The<sp/>name<sp/>of<sp/>the<sp/>author<sp/>may<sp/>not<sp/>be<sp/>used<sp/>to<sp/>endorse<sp/>or<sp/>promote<sp/>products</highlight></codeline>
<codeline lineno="37"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>derived<sp/>from<sp/>this<sp/>software<sp/>without<sp/>specific<sp/>prior<sp/>written<sp/>permission.</highlight></codeline>
<codeline lineno="38"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="39"><highlight class="comment"><sp/>*<sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>THE<sp/>AUTHOR<sp/>``AS<sp/>IS&apos;&apos;<sp/>AND<sp/>ANY<sp/>EXPRESS<sp/>OR<sp/>IMPLIED</highlight></codeline>
<codeline lineno="40"><highlight class="comment"><sp/>*<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF</highlight></codeline>
<codeline lineno="41"><highlight class="comment"><sp/>*<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE<sp/>ARE<sp/>DISCLAIMED.<sp/>IN<sp/>NO<sp/>EVENT</highlight></codeline>
<codeline lineno="42"><highlight class="comment"><sp/>*<sp/>SHALL<sp/>THE<sp/>AUTHOR<sp/>BE<sp/>LIABLE<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,</highlight></codeline>
<codeline lineno="43"><highlight class="comment"><sp/>*<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL<sp/>DAMAGES<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT</highlight></codeline>
<codeline lineno="44"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUBSTITUTE<sp/>GOODS<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS</highlight></codeline>
<codeline lineno="45"><highlight class="comment"><sp/>*<sp/>INTERRUPTION)<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN</highlight></codeline>
<codeline lineno="46"><highlight class="comment"><sp/>*<sp/>CONTRACT,<sp/>STRICT<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING</highlight></codeline>
<codeline lineno="47"><highlight class="comment"><sp/>*<sp/>IN<sp/>ANY<sp/>WAY<sp/>OUT<sp/>OF<sp/>THE<sp/>USE<sp/>OF<sp/>THIS<sp/>SOFTWARE,<sp/>EVEN<sp/>IF<sp/>ADVISED<sp/>OF<sp/>THE<sp/>POSSIBILITY</highlight></codeline>
<codeline lineno="48"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="49"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="50"><highlight class="comment"><sp/>*<sp/>This<sp/>file<sp/>is<sp/>part<sp/>of<sp/>the<sp/>lwIP<sp/>TCP/IP<sp/>stack.</highlight></codeline>
<codeline lineno="51"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="52"><highlight class="comment"><sp/>*<sp/>Author:<sp/>Adam<sp/>Dunkels<sp/>&lt;adam@sics.se&gt;</highlight></codeline>
<codeline lineno="53"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="54"><highlight class="normal"></highlight></codeline>
<codeline lineno="55"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>This<sp/>is<sp/>the<sp/>part<sp/>of<sp/>the<sp/>API<sp/>that<sp/>is<sp/>linked<sp/>with</highlight></codeline>
<codeline lineno="56"><highlight class="comment"><sp/><sp/><sp/>the<sp/>application<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="57"><highlight class="normal"></highlight></codeline>
<codeline lineno="58"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="opt_8h" kindref="compound">net/opt.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="59"><highlight class="normal"></highlight></codeline>
<codeline lineno="60"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETCONN<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="61"><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="api_8h" kindref="compound">net/api.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="63"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="memp_8h" kindref="compound">net/memp.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="64"><highlight class="normal"></highlight></codeline>
<codeline lineno="65"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="ip_8h" kindref="compound">net/ip.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="66"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="raw_8h" kindref="compound">net/raw.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="67"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="udp_8h" kindref="compound">net/udp.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="api__msg_8h" kindref="compound">net/priv/api_msg.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="tcp__priv_8h" kindref="compound">net/priv/tcp_priv.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="70"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;<ref refid="tcpip__priv_8h" kindref="compound">net/priv/tcpip_priv.h</ref>&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="71"><highlight class="normal"></highlight></codeline>
<codeline lineno="72"><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="73"><highlight class="normal"></highlight></codeline>
<codeline lineno="74"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>API_MSG_VAR_REF(name)<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>API_VAR_REF(name)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="75"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>API_MSG_VAR_DECLARE(name)<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>API_VAR_DECLARE(struct<sp/>api_msg,<sp/>name)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="76"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>API_MSG_VAR_ALLOC(name)<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>API_VAR_ALLOC(struct<sp/>api_msg,<sp/>MEMP_API_MSG,<sp/>name,<sp/>ERR_MEM)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="77"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>API_MSG_VAR_ALLOC_RETURN_NULL(name)<sp/>API_VAR_ALLOC(struct<sp/>api_msg,<sp/>MEMP_API_MSG,<sp/>name,<sp/>NULL)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="78"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>API_MSG_VAR_FREE(name)<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>API_VAR_FREE(MEMP_API_MSG,<sp/>name)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="79"><highlight class="normal"></highlight></codeline>
<codeline lineno="80"><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/>netconn_close_shutdown(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>how);</highlight></codeline>
<codeline lineno="81"><highlight class="normal"></highlight></codeline>
<codeline lineno="91"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="92"><highlight class="normal">netconn_apimsg(<ref refid="tcpip_8h_1a35203296bb838f3b493839ffc6e7285d" kindref="member">tcpip_callback_fn</ref><sp/>fn,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>api_msg<sp/>*apimsg)</highlight></codeline>
<codeline lineno="93"><highlight class="normal">{</highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="95"><highlight class="normal"></highlight></codeline>
<codeline lineno="96"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_DEBUG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="97"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>catch<sp/>functions<sp/>that<sp/>don&apos;t<sp/>set<sp/>err<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/>apimsg-&gt;err<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;</highlight></codeline>
<codeline lineno="99"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DEBUG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="100"><highlight class="normal"></highlight></codeline>
<codeline lineno="101"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETCONN_SEM_PER_THREAD</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/>apimsg-&gt;op_completed_sem<sp/>=<sp/>LWIP_NETCONN_THREAD_SEM_GET();</highlight></codeline>
<codeline lineno="103"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETCONN_SEM_PER_THREAD<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="104"><highlight class="normal"></highlight></codeline>
<codeline lineno="105"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/><ref refid="tcpip__priv_8h_1a12bdf37eddcd72c4178e3ea7d370395d" kindref="member">tcpip_send_msg_wait_sem</ref>(fn,<sp/>apimsg,<sp/>LWIP_API_MSG_SEM(apimsg));</highlight></codeline>
<codeline lineno="106"><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="107"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>apimsg-&gt;err;</highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="109"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="110"><highlight class="normal">}</highlight></codeline>
<codeline lineno="111"><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">netconn*</highlight></codeline>
<codeline lineno="123"><highlight class="normal">netconn_new_with_proto_and_callback(</highlight><highlight class="keyword">enum</highlight><highlight class="normal"><sp/>netconn_type<sp/>t,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>proto,<sp/>netconn_callback<sp/>callback)</highlight></codeline>
<codeline lineno="124"><highlight class="normal">{</highlight></codeline>
<codeline lineno="125"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">netconn<sp/>*conn;</highlight></codeline>
<codeline lineno="126"><highlight class="normal"><sp/><sp/>API_MSG_VAR_DECLARE(msg);</highlight></codeline>
<codeline lineno="127"><highlight class="normal"><sp/><sp/>API_MSG_VAR_ALLOC_RETURN_NULL(msg);</highlight></codeline>
<codeline lineno="128"><highlight class="normal"></highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/>conn<sp/>=<sp/>netconn_alloc(t,<sp/>callback);</highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="131"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="132"><highlight class="normal"></highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/><sp/><sp/>API_MSG_VAR_REF(msg).msg.n.proto<sp/>=<sp/>proto;</highlight></codeline>
<codeline lineno="134"><highlight class="normal"><sp/><sp/><sp/><sp/>API_MSG_VAR_REF(msg).conn<sp/>=<sp/>conn;</highlight></codeline>
<codeline lineno="135"><highlight class="normal"><sp/><sp/><sp/><sp/>err<sp/>=<sp/>netconn_apimsg(lwip_netconn_do_newconn,<sp/>&amp;API_MSG_VAR_REF(msg));</highlight></codeline>
<codeline lineno="136"><highlight class="normal"><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="137"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;freeing<sp/>conn<sp/>without<sp/>freeing<sp/>pcb&quot;</highlight><highlight class="normal">,<sp/>conn-&gt;pcb.tcp<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;conn<sp/>has<sp/>no<sp/>recvmbox&quot;</highlight><highlight class="normal">,<sp/><ref refid="group__sys__mbox_1gadf4b8fccb41fe2d76e88bef546e8e8bb" kindref="member">sys_mbox_valid</ref>(&amp;conn-&gt;recvmbox));</highlight></codeline>
<codeline lineno="139"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;conn-&gt;acceptmbox<sp/>shouldn&apos;t<sp/>exist&quot;</highlight><highlight class="normal">,<sp/>!<ref refid="group__sys__mbox_1gadf4b8fccb41fe2d76e88bef546e8e8bb" kindref="member">sys_mbox_valid</ref>(&amp;conn-&gt;acceptmbox));</highlight></codeline>
<codeline lineno="141"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="142"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!LWIP_NETCONN_SEM_PER_THREAD</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;conn<sp/>has<sp/>no<sp/>op_completed&quot;</highlight><highlight class="normal">,<sp/><ref refid="group__sys__sem_1gac7ff314270976b80559d043f6098817b" kindref="member">sys_sem_valid</ref>(&amp;conn-&gt;op_completed));</highlight></codeline>
<codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1ga4d02e29e5dfa092559efc04dee985822" kindref="member">sys_sem_free</ref>(&amp;conn-&gt;op_completed);</highlight></codeline>
<codeline lineno="145"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>!LWIP_NETCONN_SEM_PER_THREAD<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__sys__mbox_1gad4a51a28337f89d4b4806e6deb99798d" kindref="member">sys_mbox_free</ref>(&amp;conn-&gt;recvmbox);</highlight></codeline>
<codeline lineno="147"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_NETCONN,<sp/>conn);</highlight></codeline>
<codeline lineno="148"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="149"><highlight class="normal"><sp/><sp/><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="150"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="152"><highlight class="normal"><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="153"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>conn;</highlight></codeline>
<codeline lineno="154"><highlight class="normal">}</highlight></codeline>
<codeline lineno="155"><highlight class="normal"></highlight></codeline>
<codeline lineno="165"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="166"><highlight class="normal">netconn_delete(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn)</highlight></codeline>
<codeline lineno="167"><highlight class="normal">{</highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="169"><highlight class="normal"><sp/><sp/>API_MSG_VAR_DECLARE(msg);</highlight></codeline>
<codeline lineno="170"><highlight class="normal"></highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>No<sp/>ASSERT<sp/>here<sp/>because<sp/>possible<sp/>to<sp/>get<sp/>a<sp/>(conn<sp/>==<sp/>NULL)<sp/>if<sp/>we<sp/>got<sp/>an<sp/>accept<sp/>error<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="172"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(conn<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="173"><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="174"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="175"><highlight class="normal"></highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/>API_MSG_VAR_ALLOC(msg);</highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).conn<sp/>=<sp/>conn;</highlight></codeline>
<codeline lineno="178"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_SO_SNDTIMEO<sp/>||<sp/>LWIP_SO_LINGER</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="179"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>get<sp/>the<sp/>time<sp/>we<sp/>started,<sp/>which<sp/>is<sp/>later<sp/>compared<sp/>to</highlight></codeline>
<codeline lineno="180"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>sys_now()<sp/>+<sp/>conn-&gt;send_timeout<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.sd.time_started<sp/>=<sp/><ref refid="group__sys__time_1ga11316ac1e77418c6fa4ab8869e3fa199" kindref="member">sys_now</ref>();</highlight></codeline>
<codeline lineno="182"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_SO_SNDTIMEO<sp/>||<sp/>LWIP_SO_LINGER<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="183"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="184"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.sd.polls_left<sp/>=</highlight></codeline>
<codeline lineno="185"><highlight class="normal"><sp/><sp/><sp/><sp/>((<ref refid="lwipopts_8h_1a3e7498d5d2921f0df3792de72f384d36" kindref="member">LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT</ref><sp/>+<sp/>TCP_SLOW_INTERVAL<sp/>-<sp/>1)<sp/>/<sp/>TCP_SLOW_INTERVAL)<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="186"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="187"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_SO_SNDTIMEO<sp/>||<sp/>LWIP_SO_LINGER<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="188"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>netconn_apimsg(lwip_netconn_do_delconn,<sp/>&amp;API_MSG_VAR_REF(msg));</highlight></codeline>
<codeline lineno="189"><highlight class="normal"><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="190"><highlight class="normal"></highlight></codeline>
<codeline lineno="191"><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="192"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="193"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="194"><highlight class="normal"></highlight></codeline>
<codeline lineno="195"><highlight class="normal"><sp/><sp/>netconn_free(conn);</highlight></codeline>
<codeline lineno="196"><highlight class="normal"></highlight></codeline>
<codeline lineno="197"><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="198"><highlight class="normal">}</highlight></codeline>
<codeline lineno="199"><highlight class="normal"></highlight></codeline>
<codeline lineno="211"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="212"><highlight class="normal">netconn_getaddr(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<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,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>local)</highlight></codeline>
<codeline lineno="213"><highlight class="normal">{</highlight></codeline>
<codeline lineno="214"><highlight class="normal"><sp/><sp/>API_MSG_VAR_DECLARE(msg);</highlight></codeline>
<codeline lineno="215"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="216"><highlight class="normal"></highlight></codeline>
<codeline lineno="217"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_getaddr:<sp/>invalid<sp/>conn&quot;</highlight><highlight class="normal">,<sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="218"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_getaddr:<sp/>invalid<sp/>addr&quot;</highlight><highlight class="normal">,<sp/>(addr<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="219"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_getaddr:<sp/>invalid<sp/>port&quot;</highlight><highlight class="normal">,<sp/>(port<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="220"><highlight class="normal"></highlight></codeline>
<codeline lineno="221"><highlight class="normal"><sp/><sp/>API_MSG_VAR_ALLOC(msg);</highlight></codeline>
<codeline lineno="222"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).conn<sp/>=<sp/>conn;</highlight></codeline>
<codeline lineno="223"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.ad.local<sp/>=<sp/>local;</highlight></codeline>
<codeline lineno="224"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_MPU_COMPATIBLE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="225"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>netconn_apimsg(lwip_netconn_do_getaddr,<sp/>&amp;API_MSG_VAR_REF(msg));</highlight></codeline>
<codeline lineno="226"><highlight class="normal"><sp/><sp/>*addr<sp/>=<sp/>msg-&gt;msg.ad.ipaddr;</highlight></codeline>
<codeline lineno="227"><highlight class="normal"><sp/><sp/>*port<sp/>=<sp/>msg-&gt;msg.ad.port;</highlight></codeline>
<codeline lineno="228"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_MPU_COMPATIBLE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/>msg.msg.ad.ipaddr<sp/>=<sp/>addr;</highlight></codeline>
<codeline lineno="230"><highlight class="normal"><sp/><sp/>msg.msg.ad.port<sp/>=<sp/>port;</highlight></codeline>
<codeline lineno="231"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>netconn_apimsg(lwip_netconn_do_getaddr,<sp/>&amp;msg);</highlight></codeline>
<codeline lineno="232"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_MPU_COMPATIBLE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="233"><highlight class="normal"><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="234"><highlight class="normal"></highlight></codeline>
<codeline lineno="235"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="236"><highlight class="normal">}</highlight></codeline>
<codeline lineno="237"><highlight class="normal"></highlight></codeline>
<codeline lineno="249"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="250"><highlight class="normal">netconn_bind(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<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="251"><highlight class="normal">{</highlight></codeline>
<codeline lineno="252"><highlight class="normal"><sp/><sp/>API_MSG_VAR_DECLARE(msg);</highlight></codeline>
<codeline lineno="253"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="254"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="255"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_bind:<sp/>invalid<sp/>conn&quot;</highlight><highlight class="normal">,<sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="256"><highlight class="normal"></highlight></codeline>
<codeline lineno="257"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="258"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Don&apos;t<sp/>propagate<sp/>NULL<sp/>pointer<sp/>(IP_ADDR_ANY<sp/>alias)<sp/>to<sp/>subsequent<sp/>functions<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="259"><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="260"><highlight class="normal"><sp/><sp/><sp/><sp/>addr<sp/>=<sp/>IP4_ADDR_ANY;</highlight></codeline>
<codeline lineno="261"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="262"><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="263"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="264"><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="265"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>&quot;Socket<sp/>API<sp/>like&quot;<sp/>dual-stack<sp/>support:<sp/>If<sp/>IP<sp/>to<sp/>bind<sp/>to<sp/>is<sp/>IP6_ADDR_ANY,</highlight></codeline>
<codeline lineno="266"><highlight class="comment"><sp/><sp/><sp/>*<sp/>and<sp/>NETCONN_FLAG_IPV6_V6ONLY<sp/>is<sp/>0,<sp/>use<sp/>IP_ANY_TYPE<sp/>to<sp/>bind</highlight></codeline>
<codeline lineno="267"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="268"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((netconn_get_ipv6only(conn)<sp/>==<sp/>0)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="269"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a008c9c92d770cc030ea054e6b259835a" kindref="member">ip_addr_cmp</ref>(addr,<sp/>IP6_ADDR_ANY))<sp/>{</highlight></codeline>
<codeline lineno="270"><highlight class="normal"><sp/><sp/><sp/><sp/>addr<sp/>=<sp/><ref refid="ip__addr_8h_1abe43b154533b73585c4e58f568370ede" kindref="member">IP_ANY_TYPE</ref>;</highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="272"><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="273"><highlight class="normal"></highlight></codeline>
<codeline lineno="274"><highlight class="normal"><sp/><sp/>API_MSG_VAR_ALLOC(msg);</highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).conn<sp/>=<sp/>conn;</highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.bc.ipaddr<sp/>=<sp/>API_MSG_VAR_REF(addr);</highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.bc.port<sp/>=<sp/>port;</highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>netconn_apimsg(lwip_netconn_do_bind,<sp/>&amp;API_MSG_VAR_REF(msg));</highlight></codeline>
<codeline lineno="279"><highlight class="normal"><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="280"><highlight class="normal"></highlight></codeline>
<codeline lineno="281"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="282"><highlight class="normal">}</highlight></codeline>
<codeline lineno="283"><highlight class="normal"></highlight></codeline>
<codeline lineno="293"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="294"><highlight class="normal">netconn_connect(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<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="295"><highlight class="normal">{</highlight></codeline>
<codeline lineno="296"><highlight class="normal"><sp/><sp/>API_MSG_VAR_DECLARE(msg);</highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="298"><highlight class="normal"></highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_connect:<sp/>invalid<sp/>conn&quot;</highlight><highlight class="normal">,<sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="300"><highlight class="normal"></highlight></codeline>
<codeline lineno="301"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="302"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Don&apos;t<sp/>propagate<sp/>NULL<sp/>pointer<sp/>(IP_ADDR_ANY<sp/>alias)<sp/>to<sp/>subsequent<sp/>functions<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="303"><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="304"><highlight class="normal"><sp/><sp/><sp/><sp/>addr<sp/>=<sp/>IP4_ADDR_ANY;</highlight></codeline>
<codeline lineno="305"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="306"><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="307"><highlight class="normal"></highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/>API_MSG_VAR_ALLOC(msg);</highlight></codeline>
<codeline lineno="309"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).conn<sp/>=<sp/>conn;</highlight></codeline>
<codeline lineno="310"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.bc.ipaddr<sp/>=<sp/>API_MSG_VAR_REF(addr);</highlight></codeline>
<codeline lineno="311"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.bc.port<sp/>=<sp/>port;</highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>netconn_apimsg(lwip_netconn_do_connect,<sp/>&amp;API_MSG_VAR_REF(msg));</highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="314"><highlight class="normal"></highlight></codeline>
<codeline lineno="315"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="316"><highlight class="normal">}</highlight></codeline>
<codeline lineno="317"><highlight class="normal"></highlight></codeline>
<codeline lineno="325"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="326"><highlight class="normal">netconn_disconnect(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn)</highlight></codeline>
<codeline lineno="327"><highlight class="normal">{</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/>API_MSG_VAR_DECLARE(msg);</highlight></codeline>
<codeline lineno="329"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="330"><highlight class="normal"></highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_disconnect:<sp/>invalid<sp/>conn&quot;</highlight><highlight class="normal">,<sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="332"><highlight class="normal"></highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/>API_MSG_VAR_ALLOC(msg);</highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).conn<sp/>=<sp/>conn;</highlight></codeline>
<codeline lineno="335"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>netconn_apimsg(lwip_netconn_do_disconnect,<sp/>&amp;API_MSG_VAR_REF(msg));</highlight></codeline>
<codeline lineno="336"><highlight class="normal"><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="337"><highlight class="normal"></highlight></codeline>
<codeline lineno="338"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="339"><highlight class="normal">}</highlight></codeline>
<codeline lineno="340"><highlight class="normal"></highlight></codeline>
<codeline lineno="350"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="351"><highlight class="normal">netconn_listen_with_backlog(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>backlog)</highlight></codeline>
<codeline lineno="352"><highlight class="normal">{</highlight></codeline>
<codeline lineno="353"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/>API_MSG_VAR_DECLARE(msg);</highlight></codeline>
<codeline lineno="355"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="356"><highlight class="normal"></highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>does<sp/>no<sp/>harm.<sp/>If<sp/>TCP_LISTEN_BACKLOG<sp/>is<sp/>off,<sp/>backlog<sp/>is<sp/>unused.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="358"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(backlog);</highlight></codeline>
<codeline lineno="359"><highlight class="normal"></highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_listen:<sp/>invalid<sp/>conn&quot;</highlight><highlight class="normal">,<sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="361"><highlight class="normal"></highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/>API_MSG_VAR_ALLOC(msg);</highlight></codeline>
<codeline lineno="363"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).conn<sp/>=<sp/>conn;</highlight></codeline>
<codeline lineno="364"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_LISTEN_BACKLOG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="365"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.lb.backlog<sp/>=<sp/>backlog;</highlight></codeline>
<codeline lineno="366"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_LISTEN_BACKLOG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="367"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>netconn_apimsg(lwip_netconn_do_listen,<sp/>&amp;API_MSG_VAR_REF(msg));</highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="369"><highlight class="normal"></highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="371"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(conn);</highlight></codeline>
<codeline lineno="373"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(backlog);</highlight></codeline>
<codeline lineno="374"><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="375"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="376"><highlight class="normal">}</highlight></codeline>
<codeline lineno="377"><highlight class="normal"></highlight></codeline>
<codeline lineno="387"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="388"><highlight class="normal">netconn_accept(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>**new_conn)</highlight></codeline>
<codeline lineno="389"><highlight class="normal">{</highlight></codeline>
<codeline lineno="390"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*accept_ptr;</highlight></codeline>
<codeline lineno="392"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">netconn<sp/>*newconn;</highlight></codeline>
<codeline lineno="393"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_LISTEN_BACKLOG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/>API_MSG_VAR_DECLARE(msg);</highlight></codeline>
<codeline lineno="395"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_LISTEN_BACKLOG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="396"><highlight class="normal"></highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_accept:<sp/>invalid<sp/>pointer&quot;</highlight><highlight class="normal">,<sp/><sp/><sp/><sp/>(new_conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<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"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="398"><highlight class="normal"><sp/><sp/>*new_conn<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="399"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_accept:<sp/>invalid<sp/>conn&quot;</highlight><highlight class="normal">,<sp/><sp/><sp/><sp/><sp/><sp/><sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<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="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="400"><highlight class="normal"></highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="group__infrastructure__errors_1gac36f9cda08ffce1f67529a432a046248" kindref="member">ERR_IS_FATAL</ref>(conn-&gt;last_err))<sp/>{</highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>recv<sp/>on<sp/>fatal<sp/>errors:<sp/>this<sp/>might<sp/>block<sp/>the<sp/>application<sp/>task</highlight></codeline>
<codeline lineno="403"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>waiting<sp/>on<sp/>acceptmbox<sp/>forever!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="404"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>conn-&gt;last_err;</highlight></codeline>
<codeline lineno="405"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="406"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="group__sys__mbox_1gadf4b8fccb41fe2d76e88bef546e8e8bb" kindref="member">sys_mbox_valid</ref>(&amp;conn-&gt;acceptmbox))<sp/>{</highlight></codeline>
<codeline lineno="407"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa5176d9fecf8ec43d3bc49f4e6c3f7f5" kindref="member">ERR_CLSD</ref>;</highlight></codeline>
<codeline lineno="408"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="409"><highlight class="normal"></highlight></codeline>
<codeline lineno="410"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_LISTEN_BACKLOG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="411"><highlight class="normal"><sp/><sp/>API_MSG_VAR_ALLOC(msg);</highlight></codeline>
<codeline lineno="412"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_LISTEN_BACKLOG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="413"><highlight class="normal"></highlight></codeline>
<codeline lineno="414"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_SO_RCVTIMEO</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="415"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="group__sys__mbox_1gacc53b5c30f131abc40f0885d39d32f87" kindref="member">sys_arch_mbox_fetch</ref>(&amp;conn-&gt;acceptmbox,<sp/>&amp;accept_ptr,<sp/>conn-&gt;recv_timeout)<sp/>==<sp/><ref refid="sys_8h_1ac1495030a8ab5e1f3c89e42ced527c5b" kindref="member">SYS_ARCH_TIMEOUT</ref>)<sp/>{</highlight></codeline>
<codeline lineno="416"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_LISTEN_BACKLOG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="417"><highlight class="normal"><sp/><sp/><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="418"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_LISTEN_BACKLOG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="419"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcac568baeb6407ef5e2630084ccbc34be8" kindref="member">ERR_TIMEOUT</ref>;</highlight></codeline>
<codeline lineno="420"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="421"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="422"><highlight class="normal"><sp/><sp/><ref refid="group__sys__mbox_1gacc53b5c30f131abc40f0885d39d32f87" kindref="member">sys_arch_mbox_fetch</ref>(&amp;conn-&gt;acceptmbox,<sp/>&amp;accept_ptr,<sp/>0);</highlight></codeline>
<codeline lineno="423"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_SO_RCVTIMEO*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="424"><highlight class="normal"><sp/><sp/>newconn<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">netconn<sp/>*)accept_ptr;</highlight></codeline>
<codeline lineno="425"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Register<sp/>event<sp/>with<sp/>callback<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="426"><highlight class="normal"><sp/><sp/>API_EVENT(conn,<sp/>NETCONN_EVT_RCVMINUS,<sp/>0);</highlight></codeline>
<codeline lineno="427"><highlight class="normal"></highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(accept_ptr<sp/>==<sp/>&amp;netconn_aborted)<sp/>{</highlight></codeline>
<codeline lineno="429"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>a<sp/>connection<sp/>has<sp/>been<sp/>aborted:<sp/>out<sp/>of<sp/>pcbs<sp/>or<sp/>out<sp/>of<sp/>netconns<sp/>during<sp/>accept<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="430"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo:<sp/>set<sp/>netconn<sp/>error,<sp/>but<sp/>this<sp/>would<sp/>be<sp/>fatal<sp/>and<sp/>thus<sp/>block<sp/>further<sp/>accepts<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="431"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_LISTEN_BACKLOG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="433"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_LISTEN_BACKLOG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaf316b2c5eee4079820f7100849115142" kindref="member">ERR_ABRT</ref>;</highlight></codeline>
<codeline lineno="435"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(newconn<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>connection<sp/>has<sp/>been<sp/>aborted<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="438"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>in<sp/>this<sp/>special<sp/>case,<sp/>we<sp/>set<sp/>the<sp/>netconn<sp/>error<sp/>from<sp/>application<sp/>thread,<sp/>as</highlight></codeline>
<codeline lineno="439"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>on<sp/>a<sp/>ready-to-accept<sp/>listening<sp/>netconn,<sp/>there<sp/>should<sp/>not<sp/>be<sp/>anything<sp/>running</highlight></codeline>
<codeline lineno="440"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>in<sp/>tcpip_thread<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="441"><highlight class="normal"><sp/><sp/><sp/><sp/>NETCONN_SET_SAFE_ERR(conn,<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa5176d9fecf8ec43d3bc49f4e6c3f7f5" kindref="member">ERR_CLSD</ref>);</highlight></codeline>
<codeline lineno="442"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_LISTEN_BACKLOG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="443"><highlight class="normal"><sp/><sp/><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="444"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_LISTEN_BACKLOG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="445"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa5176d9fecf8ec43d3bc49f4e6c3f7f5" kindref="member">ERR_CLSD</ref>;</highlight></codeline>
<codeline lineno="446"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="447"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>TCP_LISTEN_BACKLOG</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Let<sp/>the<sp/>stack<sp/>know<sp/>that<sp/>we<sp/>have<sp/>accepted<sp/>the<sp/>connection.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).conn<sp/>=<sp/>newconn;</highlight></codeline>
<codeline lineno="450"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>care<sp/>for<sp/>the<sp/>return<sp/>value<sp/>of<sp/>lwip_netconn_do_recv<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/>netconn_apimsg(lwip_netconn_do_accepted,<sp/>&amp;API_MSG_VAR_REF(msg));</highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="453"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>TCP_LISTEN_BACKLOG<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="454"><highlight class="normal"></highlight></codeline>
<codeline lineno="455"><highlight class="normal"><sp/><sp/>*new_conn<sp/>=<sp/>newconn;</highlight></codeline>
<codeline lineno="456"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>set<sp/>conn-&gt;last_err:<sp/>it&apos;s<sp/>only<sp/>ERR_OK,<sp/>anyway<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="457"><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="458"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(conn);</highlight></codeline>
<codeline lineno="460"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(new_conn);</highlight></codeline>
<codeline lineno="461"><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="462"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="463"><highlight class="normal">}</highlight></codeline>
<codeline lineno="464"><highlight class="normal"></highlight></codeline>
<codeline lineno="475"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="476"><highlight class="normal">netconn_recv_data(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>**new_buf)</highlight></codeline>
<codeline lineno="477"><highlight class="normal">{</highlight></codeline>
<codeline lineno="478"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*<ref refid="structbuf" kindref="compound">buf</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="479"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>len;</highlight></codeline>
<codeline lineno="480"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="481"><highlight class="normal"><sp/><sp/>API_MSG_VAR_DECLARE(msg);</highlight></codeline>
<codeline lineno="482"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_MPU_COMPATIBLE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="483"><highlight class="normal"><sp/><sp/>msg<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="484"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="485"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="486"><highlight class="normal"></highlight></codeline>
<codeline lineno="487"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_recv:<sp/>invalid<sp/>pointer&quot;</highlight><highlight class="normal">,<sp/>(new_buf<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="488"><highlight class="normal"><sp/><sp/>*new_buf<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="489"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_recv:<sp/>invalid<sp/>conn&quot;</highlight><highlight class="normal">,<sp/><sp/><sp/><sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<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="490"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="491"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="492"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(NETCONNTYPE_GROUP(conn-&gt;type)<sp/>==<sp/>NETCONN_TCP)</highlight></codeline>
<codeline lineno="493"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="494"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="495"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!<ref refid="group__sys__mbox_1gadf4b8fccb41fe2d76e88bef546e8e8bb" kindref="member">sys_mbox_valid</ref>(&amp;conn-&gt;recvmbox))<sp/>{</highlight></codeline>
<codeline lineno="496"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>happens<sp/>when<sp/>calling<sp/>this<sp/>function<sp/>after<sp/>receiving<sp/>FIN<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="497"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__sys__mbox_1gadf4b8fccb41fe2d76e88bef546e8e8bb" kindref="member">sys_mbox_valid</ref>(&amp;conn-&gt;acceptmbox)<sp/>?<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab0036c51817b5200bfe8157cc4115b27" kindref="member">ERR_CONN</ref><sp/>:<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa5176d9fecf8ec43d3bc49f4e6c3f7f5" kindref="member">ERR_CLSD</ref>;</highlight></codeline>
<codeline lineno="498"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="499"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="500"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="501"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_recv:<sp/>invalid<sp/>recvmbox&quot;</highlight><highlight class="normal">,<sp/><ref refid="group__sys__mbox_1gadf4b8fccb41fe2d76e88bef546e8e8bb" kindref="member">sys_mbox_valid</ref>(&amp;conn-&gt;recvmbox),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab0036c51817b5200bfe8157cc4115b27" kindref="member">ERR_CONN</ref>;);</highlight></codeline>
<codeline lineno="502"><highlight class="normal"></highlight></codeline>
<codeline lineno="503"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="group__infrastructure__errors_1gac36f9cda08ffce1f67529a432a046248" kindref="member">ERR_IS_FATAL</ref>(conn-&gt;last_err))<sp/>{</highlight></codeline>
<codeline lineno="504"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>recv<sp/>on<sp/>fatal<sp/>errors:<sp/>this<sp/>might<sp/>block<sp/>the<sp/>application<sp/>task</highlight></codeline>
<codeline lineno="505"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>waiting<sp/>on<sp/>recvmbox<sp/>forever!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="506"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo:<sp/>this<sp/>does<sp/>not<sp/>allow<sp/>us<sp/>to<sp/>fetch<sp/>data<sp/>that<sp/>has<sp/>been<sp/>put<sp/>into<sp/>recvmbox</highlight></codeline>
<codeline lineno="507"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>before<sp/>the<sp/>fatal<sp/>error<sp/>occurred<sp/>-<sp/>is<sp/>that<sp/>a<sp/>problem?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="508"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>conn-&gt;last_err;</highlight></codeline>
<codeline lineno="509"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="510"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="511"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="512"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(NETCONNTYPE_GROUP(conn-&gt;type)<sp/>==<sp/>NETCONN_TCP)</highlight></codeline>
<codeline lineno="513"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="514"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="515"><highlight class="normal"><sp/><sp/><sp/><sp/>API_MSG_VAR_ALLOC(msg);</highlight></codeline>
<codeline lineno="516"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="517"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="518"><highlight class="normal"></highlight></codeline>
<codeline lineno="519"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_SO_RCVTIMEO</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="520"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="group__sys__mbox_1gacc53b5c30f131abc40f0885d39d32f87" kindref="member">sys_arch_mbox_fetch</ref>(&amp;conn-&gt;recvmbox,<sp/>&amp;<ref refid="structbuf" kindref="compound">buf</ref>,<sp/>conn-&gt;recv_timeout)<sp/>==<sp/><ref refid="sys_8h_1ac1495030a8ab5e1f3c89e42ced527c5b" kindref="member">SYS_ARCH_TIMEOUT</ref>)<sp/>{</highlight></codeline>
<codeline lineno="521"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="522"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="523"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(NETCONNTYPE_GROUP(conn-&gt;type)<sp/>==<sp/>NETCONN_TCP)</highlight></codeline>
<codeline lineno="524"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="525"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="526"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="527"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="528"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="529"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcac568baeb6407ef5e2630084ccbc34be8" kindref="member">ERR_TIMEOUT</ref>;</highlight></codeline>
<codeline lineno="530"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="531"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="532"><highlight class="normal"><sp/><sp/><ref refid="group__sys__mbox_1gacc53b5c30f131abc40f0885d39d32f87" kindref="member">sys_arch_mbox_fetch</ref>(&amp;conn-&gt;recvmbox,<sp/>&amp;<ref refid="structbuf" kindref="compound">buf</ref>,<sp/>0);</highlight></codeline>
<codeline lineno="533"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_SO_RCVTIMEO*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="534"><highlight class="normal"></highlight></codeline>
<codeline lineno="535"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="536"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="537"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(NETCONNTYPE_GROUP(conn-&gt;type)<sp/>==<sp/>NETCONN_TCP)</highlight></codeline>
<codeline lineno="538"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="539"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="540"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Let<sp/>the<sp/>stack<sp/>know<sp/>that<sp/>we<sp/>have<sp/>taken<sp/>the<sp/>data.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="541"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo:<sp/>Speedup:<sp/>Don&apos;t<sp/>block<sp/>and<sp/>wait<sp/>for<sp/>the<sp/>answer<sp/>here</highlight></codeline>
<codeline lineno="542"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(to<sp/>prevent<sp/>multiple<sp/>thread-switches).<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="543"><highlight class="normal"><sp/><sp/><sp/><sp/>API_MSG_VAR_REF(msg).conn<sp/>=<sp/>conn;</highlight></codeline>
<codeline lineno="544"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structbuf" kindref="compound">buf</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="545"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>API_MSG_VAR_REF(msg).msg.r.len<sp/>=<sp/>((</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*)<ref refid="structbuf" kindref="compound">buf</ref>)-&gt;tot_len;</highlight></codeline>
<codeline lineno="546"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="547"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>API_MSG_VAR_REF(msg).msg.r.len<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="548"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="549"><highlight class="normal"></highlight></codeline>
<codeline lineno="550"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>care<sp/>for<sp/>the<sp/>return<sp/>value<sp/>of<sp/>lwip_netconn_do_recv<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="551"><highlight class="normal"><sp/><sp/><sp/><sp/>netconn_apimsg(lwip_netconn_do_recv,<sp/>&amp;API_MSG_VAR_REF(msg));</highlight></codeline>
<codeline lineno="552"><highlight class="normal"><sp/><sp/><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="553"><highlight class="normal"></highlight></codeline>
<codeline lineno="554"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>we<sp/>are<sp/>closed,<sp/>we<sp/>indicate<sp/>that<sp/>we<sp/>no<sp/>longer<sp/>wish<sp/>to<sp/>use<sp/>the<sp/>socket<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="555"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structbuf" kindref="compound">buf</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="556"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>API_EVENT(conn,<sp/>NETCONN_EVT_RCVMINUS,<sp/>0);</highlight></codeline>
<codeline lineno="557"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(conn-&gt;pcb.ip<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="558"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>race<sp/>condition:<sp/>RST<sp/>during<sp/>recv<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="559"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>conn-&gt;last_err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref><sp/>?<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca759030525f1768a23dc086a5fd45b4e5" kindref="member">ERR_RST</ref><sp/>:<sp/>conn-&gt;last_err;</highlight></codeline>
<codeline lineno="560"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="561"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>RX<sp/>side<sp/>is<sp/>closed,<sp/>so<sp/>deallocate<sp/>the<sp/>recvmbox<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="562"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>netconn_close_shutdown(conn,<sp/>NETCONN_SHUT_RD);</highlight></codeline>
<codeline lineno="563"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Don&apos;<sp/>store<sp/>ERR_CLSD<sp/>as<sp/>conn-&gt;err<sp/>since<sp/>we<sp/>are<sp/>only<sp/>half-closed<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="564"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa5176d9fecf8ec43d3bc49f4e6c3f7f5" kindref="member">ERR_CLSD</ref>;</highlight></codeline>
<codeline lineno="565"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="566"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>=<sp/>((</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*)<ref refid="structbuf" kindref="compound">buf</ref>)-&gt;tot_len;</highlight></codeline>
<codeline lineno="567"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="568"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="569"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP<sp/>&amp;&amp;<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="570"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="571"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>&amp;&amp;<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="572"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="573"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="574"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;buf<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/><ref refid="structbuf" kindref="compound">buf</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="575"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>=<sp/>netbuf_len((</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netbuf*)<ref refid="structbuf" kindref="compound">buf</ref>);</highlight></codeline>
<codeline lineno="576"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="577"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="578"><highlight class="normal"></highlight></codeline>
<codeline lineno="579"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_SO_RCVBUF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="580"><highlight class="normal"><sp/><sp/><ref refid="sys_8h_1aa9a585faa63acdd5d59ac5e7759a07c5" kindref="member">SYS_ARCH_DEC</ref>(conn-&gt;recv_avail,<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>);</highlight></codeline>
<codeline lineno="581"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_SO_RCVBUF<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="582"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Register<sp/>event<sp/>with<sp/>callback<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="583"><highlight class="normal"><sp/><sp/>API_EVENT(conn,<sp/>NETCONN_EVT_RCVMINUS,<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>);</highlight></codeline>
<codeline lineno="584"><highlight class="normal"></highlight></codeline>
<codeline lineno="585"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a671009550216f7dc03e67ba5751e3160" kindref="member">API_LIB_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;netconn_recv_data:<sp/>received<sp/>%p,<sp/>len=%&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="structbuf" kindref="compound">buf</ref>,<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>));</highlight></codeline>
<codeline lineno="586"><highlight class="normal"></highlight></codeline>
<codeline lineno="587"><highlight class="normal"><sp/><sp/>*new_buf<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>;</highlight></codeline>
<codeline lineno="588"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>set<sp/>conn-&gt;last_err:<sp/>it&apos;s<sp/>only<sp/>ERR_OK,<sp/>anyway<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="589"><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="590"><highlight class="normal">}</highlight></codeline>
<codeline lineno="591"><highlight class="normal"></highlight></codeline>
<codeline lineno="602"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="603"><highlight class="normal">netconn_recv_tcp_pbuf(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>**new_buf)</highlight></codeline>
<codeline lineno="604"><highlight class="normal">{</highlight></codeline>
<codeline lineno="605"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_recv:<sp/>invalid<sp/>conn&quot;</highlight><highlight class="normal">,<sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="606"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>NETCONNTYPE_GROUP(netconn_type(conn))<sp/>==<sp/>NETCONN_TCP,<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="607"><highlight class="normal"></highlight></codeline>
<codeline lineno="608"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>netconn_recv_data(conn,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>**)new_buf);</highlight></codeline>
<codeline lineno="609"><highlight class="normal">}</highlight></codeline>
<codeline lineno="610"><highlight class="normal"></highlight></codeline>
<codeline lineno="620"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="621"><highlight class="normal">netconn_recv(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netbuf<sp/>**new_buf)</highlight></codeline>
<codeline lineno="622"><highlight class="normal">{</highlight></codeline>
<codeline lineno="623"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="624"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">netbuf<sp/>*<ref refid="structbuf" kindref="compound">buf</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="625"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="626"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="627"><highlight class="normal"></highlight></codeline>
<codeline lineno="628"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_recv:<sp/>invalid<sp/>pointer&quot;</highlight><highlight class="normal">,<sp/>(new_buf<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="629"><highlight class="normal"><sp/><sp/>*new_buf<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="630"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_recv:<sp/>invalid<sp/>conn&quot;</highlight><highlight class="normal">,<sp/><sp/><sp/><sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<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="631"><highlight class="normal"></highlight></codeline>
<codeline lineno="632"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="633"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="634"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(NETCONNTYPE_GROUP(conn-&gt;type)<sp/>==<sp/>NETCONN_TCP)</highlight></codeline>
<codeline lineno="635"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="636"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="637"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="638"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>is<sp/>not<sp/>a<sp/>listening<sp/>netconn,<sp/>since<sp/>recvmbox<sp/>is<sp/>set<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="639"><highlight class="normal"></highlight></codeline>
<codeline lineno="640"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref><sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">netbuf<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_NETBUF);</highlight></codeline>
<codeline lineno="641"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structbuf" kindref="compound">buf</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="642"><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="643"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="644"><highlight class="normal"></highlight></codeline>
<codeline lineno="645"><highlight class="normal"><sp/><sp/><sp/><sp/>err<sp/>=<sp/>netconn_recv_data(conn,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>**)&amp;p);</highlight></codeline>
<codeline lineno="646"><highlight class="normal"><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="647"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_NETBUF,<sp/><ref refid="structbuf" kindref="compound">buf</ref>);</highlight></codeline>
<codeline lineno="648"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="649"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="650"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;p<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="651"><highlight class="normal"></highlight></codeline>
<codeline lineno="652"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;p<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="653"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="654"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;port<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="655"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1aae7edb585c062ae03bfbd3af7bf671bc" kindref="member">ip_addr_set_zero</ref>(&amp;<ref refid="structbuf" kindref="compound">buf</ref>-&gt;addr);</highlight></codeline>
<codeline lineno="656"><highlight class="normal"><sp/><sp/><sp/><sp/>*new_buf<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>;</highlight></codeline>
<codeline lineno="657"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>set<sp/>conn-&gt;last_err:<sp/>it&apos;s<sp/>only<sp/>ERR_OK,<sp/>anyway<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="658"><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="659"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="660"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="661"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP<sp/>&amp;&amp;<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="662"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="663"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>&amp;&amp;<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="664"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="665"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="666"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>netconn_recv_data(conn,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>**)new_buf);</highlight></codeline>
<codeline lineno="667"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>(LWIP_UDP<sp/>||<sp/>LWIP_RAW)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="668"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="669"><highlight class="normal">}</highlight></codeline>
<codeline lineno="670"><highlight class="normal"></highlight></codeline>
<codeline lineno="682"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="683"><highlight class="normal">netconn_sendto(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netbuf<sp/>*<ref refid="structbuf" kindref="compound">buf</ref>,<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="684"><highlight class="normal">{</highlight></codeline>
<codeline lineno="685"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structbuf" kindref="compound">buf</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="686"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="ip__addr_8h_1a40db7feae2b92f7a7a01d65a85b06e18" kindref="member">ip_addr_set</ref>(&amp;<ref refid="structbuf" kindref="compound">buf</ref>-&gt;addr,<sp/>addr);</highlight></codeline>
<codeline lineno="687"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;port<sp/>=<sp/>port;</highlight></codeline>
<codeline lineno="688"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>netconn_send(conn,<sp/><ref refid="structbuf" kindref="compound">buf</ref>);</highlight></codeline>
<codeline lineno="689"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="690"><highlight class="normal"><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="691"><highlight class="normal">}</highlight></codeline>
<codeline lineno="692"><highlight class="normal"></highlight></codeline>
<codeline lineno="701"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="702"><highlight class="normal">netconn_send(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netbuf<sp/>*<ref refid="structbuf" kindref="compound">buf</ref>)</highlight></codeline>
<codeline lineno="703"><highlight class="normal">{</highlight></codeline>
<codeline lineno="704"><highlight class="normal"><sp/><sp/>API_MSG_VAR_DECLARE(msg);</highlight></codeline>
<codeline lineno="705"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="706"><highlight class="normal"></highlight></codeline>
<codeline lineno="707"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_send:<sp/>invalid<sp/>conn&quot;</highlight><highlight class="normal">,<sp/><sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="708"><highlight class="normal"></highlight></codeline>
<codeline lineno="709"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a671009550216f7dc03e67ba5751e3160" kindref="member">API_LIB_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;netconn_send:<sp/>sending<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;<sp/>bytes\n&quot;</highlight><highlight class="normal">,<sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;p-&gt;tot_len));</highlight></codeline>
<codeline lineno="710"><highlight class="normal"></highlight></codeline>
<codeline lineno="711"><highlight class="normal"><sp/><sp/>API_MSG_VAR_ALLOC(msg);</highlight></codeline>
<codeline lineno="712"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).conn<sp/>=<sp/>conn;</highlight></codeline>
<codeline lineno="713"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.b<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>;</highlight></codeline>
<codeline lineno="714"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>netconn_apimsg(lwip_netconn_do_send,<sp/>&amp;API_MSG_VAR_REF(msg));</highlight></codeline>
<codeline lineno="715"><highlight class="normal"><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="716"><highlight class="normal"></highlight></codeline>
<codeline lineno="717"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="718"><highlight class="normal">}</highlight></codeline>
<codeline lineno="719"><highlight class="normal"></highlight></codeline>
<codeline lineno="734"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="735"><highlight class="normal">netconn_write_partly(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*dataptr,<sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>size,</highlight></codeline>
<codeline lineno="736"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>apiflags,<sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>*bytes_written)</highlight></codeline>
<codeline lineno="737"><highlight class="normal">{</highlight></codeline>
<codeline lineno="738"><highlight class="normal"><sp/><sp/>API_MSG_VAR_DECLARE(msg);</highlight></codeline>
<codeline lineno="739"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="740"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>dontblock;</highlight></codeline>
<codeline lineno="741"><highlight class="normal"></highlight></codeline>
<codeline lineno="742"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_write:<sp/>invalid<sp/>conn&quot;</highlight><highlight class="normal">,<sp/><sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="743"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_write:<sp/>invalid<sp/>conn-&gt;type&quot;</highlight><highlight class="normal">,<sp/><sp/>(NETCONNTYPE_GROUP(conn-&gt;type)==<sp/>NETCONN_TCP),<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="744"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(size<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="745"><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="746"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="747"><highlight class="normal"><sp/><sp/>dontblock<sp/>=<sp/>netconn_is_nonblocking(conn)<sp/>||<sp/>(apiflags<sp/>&amp;<sp/>NETCONN_DONTBLOCK);</highlight></codeline>
<codeline lineno="748"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_SO_SNDTIMEO</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="749"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(conn-&gt;send_timeout<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="750"><highlight class="normal"><sp/><sp/><sp/><sp/>dontblock<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="751"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="752"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_SO_SNDTIMEO<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="753"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dontblock<sp/>&amp;&amp;<sp/>!bytes_written)<sp/>{</highlight></codeline>
<codeline lineno="754"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>implies<sp/>netconn_write()<sp/>cannot<sp/>be<sp/>used<sp/>for<sp/>non-blocking<sp/>send,<sp/>since</highlight></codeline>
<codeline lineno="755"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>it<sp/>has<sp/>no<sp/>way<sp/>to<sp/>return<sp/>the<sp/>number<sp/>of<sp/>bytes<sp/>written.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="756"><highlight class="normal"><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="757"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="758"><highlight class="normal"></highlight></codeline>
<codeline lineno="759"><highlight class="normal"><sp/><sp/>API_MSG_VAR_ALLOC(msg);</highlight></codeline>
<codeline lineno="760"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>non-blocking<sp/>write<sp/>sends<sp/>as<sp/>much<sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="761"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).conn<sp/>=<sp/>conn;</highlight></codeline>
<codeline lineno="762"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.w.dataptr<sp/>=<sp/>dataptr;</highlight></codeline>
<codeline lineno="763"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.w.apiflags<sp/>=<sp/>apiflags;</highlight></codeline>
<codeline lineno="764"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.w.len<sp/>=<sp/>size;</highlight></codeline>
<codeline lineno="765"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_SO_SNDTIMEO</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="766"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(conn-&gt;send_timeout<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="767"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>get<sp/>the<sp/>time<sp/>we<sp/>started,<sp/>which<sp/>is<sp/>later<sp/>compared<sp/>to</highlight></codeline>
<codeline lineno="768"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>sys_now()<sp/>+<sp/>conn-&gt;send_timeout<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="769"><highlight class="normal"><sp/><sp/><sp/><sp/>API_MSG_VAR_REF(msg).msg.w.time_started<sp/>=<sp/><ref refid="group__sys__time_1ga11316ac1e77418c6fa4ab8869e3fa199" kindref="member">sys_now</ref>();</highlight></codeline>
<codeline lineno="770"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="771"><highlight class="normal"><sp/><sp/><sp/><sp/>API_MSG_VAR_REF(msg).msg.w.time_started<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="772"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="773"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_SO_SNDTIMEO<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="774"><highlight class="normal"></highlight></codeline>
<codeline lineno="775"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>For<sp/>locking<sp/>the<sp/>core:<sp/>this<sp/>_can_<sp/>be<sp/>delayed<sp/>on<sp/>low<sp/>memory/low<sp/>send<sp/>buffer,</highlight></codeline>
<codeline lineno="776"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>but<sp/>if<sp/>it<sp/>is,<sp/>this<sp/>is<sp/>done<sp/>inside<sp/>api_msg.c:do_write(),<sp/>so<sp/>we<sp/>can<sp/>use<sp/>the</highlight></codeline>
<codeline lineno="777"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>non-blocking<sp/>version<sp/>here.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="778"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>netconn_apimsg(lwip_netconn_do_write,<sp/>&amp;API_MSG_VAR_REF(msg));</highlight></codeline>
<codeline lineno="779"><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/>&amp;&amp;<sp/>(bytes_written<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="780"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(dontblock)<sp/>{</highlight></codeline>
<codeline lineno="781"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>nonblocking<sp/>write:<sp/>maybe<sp/>the<sp/>data<sp/>has<sp/>been<sp/>sent<sp/>partly<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="782"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>*bytes_written<sp/>=<sp/>API_MSG_VAR_REF(msg).msg.w.len;</highlight></codeline>
<codeline lineno="783"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="784"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>blocking<sp/>call<sp/>succeeded:<sp/>all<sp/>data<sp/>has<sp/>been<sp/>sent<sp/>if<sp/>it<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="785"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>*bytes_written<sp/>=<sp/>size;</highlight></codeline>
<codeline lineno="786"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="787"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="788"><highlight class="normal"><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="789"><highlight class="normal"></highlight></codeline>
<codeline lineno="790"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="791"><highlight class="normal">}</highlight></codeline>
<codeline lineno="792"><highlight class="normal"></highlight></codeline>
<codeline lineno="801"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="802"><highlight class="normal">netconn_close_shutdown(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>how)</highlight></codeline>
<codeline lineno="803"><highlight class="normal">{</highlight></codeline>
<codeline lineno="804"><highlight class="normal"><sp/><sp/>API_MSG_VAR_DECLARE(msg);</highlight></codeline>
<codeline lineno="805"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="806"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(how);</highlight></codeline>
<codeline lineno="807"><highlight class="normal"></highlight></codeline>
<codeline lineno="808"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_close:<sp/>invalid<sp/>conn&quot;</highlight><highlight class="normal">,<sp/><sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="809"><highlight class="normal"></highlight></codeline>
<codeline lineno="810"><highlight class="normal"><sp/><sp/>API_MSG_VAR_ALLOC(msg);</highlight></codeline>
<codeline lineno="811"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).conn<sp/>=<sp/>conn;</highlight></codeline>
<codeline lineno="812"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="813"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>shutting<sp/>down<sp/>both<sp/>ends<sp/>is<sp/>the<sp/>same<sp/>as<sp/>closing<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="814"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.sd.shut<sp/>=<sp/>how;</highlight></codeline>
<codeline lineno="815"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_SO_SNDTIMEO<sp/>||<sp/>LWIP_SO_LINGER</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="816"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>get<sp/>the<sp/>time<sp/>we<sp/>started,<sp/>which<sp/>is<sp/>later<sp/>compared<sp/>to</highlight></codeline>
<codeline lineno="817"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>sys_now()<sp/>+<sp/>conn-&gt;send_timeout<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="818"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.sd.time_started<sp/>=<sp/><ref refid="group__sys__time_1ga11316ac1e77418c6fa4ab8869e3fa199" kindref="member">sys_now</ref>();</highlight></codeline>
<codeline lineno="819"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_SO_SNDTIMEO<sp/>||<sp/>LWIP_SO_LINGER<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="820"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.sd.polls_left<sp/>=</highlight></codeline>
<codeline lineno="821"><highlight class="normal"><sp/><sp/><sp/><sp/>((<ref refid="lwipopts_8h_1a3e7498d5d2921f0df3792de72f384d36" kindref="member">LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT</ref><sp/>+<sp/>TCP_SLOW_INTERVAL<sp/>-<sp/>1)<sp/>/<sp/>TCP_SLOW_INTERVAL)<sp/>+<sp/>1;</highlight></codeline>
<codeline lineno="822"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_SO_SNDTIMEO<sp/>||<sp/>LWIP_SO_LINGER<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="823"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="824"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>netconn_apimsg(lwip_netconn_do_close,<sp/>&amp;API_MSG_VAR_REF(msg));</highlight></codeline>
<codeline lineno="825"><highlight class="normal"><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="826"><highlight class="normal"></highlight></codeline>
<codeline lineno="827"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="828"><highlight class="normal">}</highlight></codeline>
<codeline lineno="829"><highlight class="normal"></highlight></codeline>
<codeline lineno="837"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="838"><highlight class="normal">netconn_close(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn)</highlight></codeline>
<codeline lineno="839"><highlight class="normal">{</highlight></codeline>
<codeline lineno="840"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>shutting<sp/>down<sp/>both<sp/>ends<sp/>is<sp/>the<sp/>same<sp/>as<sp/>closing<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="841"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>netconn_close_shutdown(conn,<sp/>NETCONN_SHUT_RDWR);</highlight></codeline>
<codeline lineno="842"><highlight class="normal">}</highlight></codeline>
<codeline lineno="843"><highlight class="normal"></highlight></codeline>
<codeline lineno="853"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="854"><highlight class="normal">netconn_shutdown(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>shut_rx,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>shut_tx)</highlight></codeline>
<codeline lineno="855"><highlight class="normal">{</highlight></codeline>
<codeline lineno="856"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>netconn_close_shutdown(conn,<sp/>(shut_rx<sp/>?<sp/>NETCONN_SHUT_RD<sp/>:<sp/>0)<sp/>|<sp/>(shut_tx<sp/>?<sp/>NETCONN_SHUT_WR<sp/>:<sp/>0));</highlight></codeline>
<codeline lineno="857"><highlight class="normal">}</highlight></codeline>
<codeline lineno="858"><highlight class="normal"></highlight></codeline>
<codeline lineno="859"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IGMP<sp/>||<sp/>(LWIP_IPV6<sp/>&amp;&amp;<sp/>LWIP_IPV6_MLD)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="860"><highlight class="normal"></highlight></codeline>
<codeline lineno="871"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="872"><highlight class="normal">netconn_join_leave_group(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netconn<sp/>*conn,</highlight></codeline>
<codeline lineno="873"><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/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*multiaddr,</highlight></codeline>
<codeline lineno="874"><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/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="ip__addr_8h_1a88b43639738c4de2d3cd22e3a1fd7696" kindref="member">ip_addr_t</ref><sp/>*netif_addr,</highlight></codeline>
<codeline lineno="875"><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/></highlight><highlight class="keyword">enum</highlight><highlight class="normal"><sp/>netconn_igmp<sp/>join_or_leave)</highlight></codeline>
<codeline lineno="876"><highlight class="normal">{</highlight></codeline>
<codeline lineno="877"><highlight class="normal"><sp/><sp/>API_MSG_VAR_DECLARE(msg);</highlight></codeline>
<codeline lineno="878"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="879"><highlight class="normal"></highlight></codeline>
<codeline lineno="880"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_join_leave_group:<sp/>invalid<sp/>conn&quot;</highlight><highlight class="normal">,<sp/><sp/>(conn<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="881"><highlight class="normal"></highlight></codeline>
<codeline lineno="882"><highlight class="normal"><sp/><sp/>API_MSG_VAR_ALLOC(msg);</highlight></codeline>
<codeline lineno="883"><highlight class="normal"></highlight></codeline>
<codeline lineno="884"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="885"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Don&apos;t<sp/>propagate<sp/>NULL<sp/>pointer<sp/>(IP_ADDR_ANY<sp/>alias)<sp/>to<sp/>subsequent<sp/>functions<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="886"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(multiaddr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="887"><highlight class="normal"><sp/><sp/><sp/><sp/>multiaddr<sp/>=<sp/>IP4_ADDR_ANY;</highlight></codeline>
<codeline lineno="888"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="889"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(netif_addr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="890"><highlight class="normal"><sp/><sp/><sp/><sp/>netif_addr<sp/>=<sp/>IP4_ADDR_ANY;</highlight></codeline>
<codeline lineno="891"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="892"><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="893"><highlight class="normal"></highlight></codeline>
<codeline lineno="894"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).conn<sp/>=<sp/>conn;</highlight></codeline>
<codeline lineno="895"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.jl.multiaddr<sp/>=<sp/>API_MSG_VAR_REF(multiaddr);</highlight></codeline>
<codeline lineno="896"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.jl.netif_addr<sp/>=<sp/>API_MSG_VAR_REF(netif_addr);</highlight></codeline>
<codeline lineno="897"><highlight class="normal"><sp/><sp/>API_MSG_VAR_REF(msg).msg.jl.join_or_leave<sp/>=<sp/>join_or_leave;</highlight></codeline>
<codeline lineno="898"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>netconn_apimsg(lwip_netconn_do_join_leave_group,<sp/>&amp;API_MSG_VAR_REF(msg));</highlight></codeline>
<codeline lineno="899"><highlight class="normal"><sp/><sp/>API_MSG_VAR_FREE(msg);</highlight></codeline>
<codeline lineno="900"><highlight class="normal"></highlight></codeline>
<codeline lineno="901"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="902"><highlight class="normal">}</highlight></codeline>
<codeline lineno="903"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IGMP<sp/>||<sp/>(LWIP_IPV6<sp/>&amp;&amp;<sp/>LWIP_IPV6_MLD)<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="904"><highlight class="normal"></highlight></codeline>
<codeline lineno="905"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_DNS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="906"><highlight class="normal"></highlight></codeline>
<codeline lineno="918"><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IPV6</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="919"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="920"><highlight class="normal">netconn_gethostbyname_addrtype(</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/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>dns_addrtype)</highlight></codeline>
<codeline lineno="921"><highlight class="normal"></highlight><highlight class="preprocessor">#else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="922"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="923"><highlight class="normal">netconn_gethostbyname(</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)</highlight></codeline>
<codeline lineno="924"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="925"><highlight class="normal">{</highlight></codeline>
<codeline lineno="926"><highlight class="normal"><sp/><sp/><ref refid="tcpip__priv_8h_1ab5d4a4fa91c4c144bedabf593a68b4dd" kindref="member">API_VAR_DECLARE</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dns_api_msg,<sp/>msg);</highlight></codeline>
<codeline lineno="927"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!LWIP_MPU_COMPATIBLE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="928"><highlight class="normal"><sp/><sp/><ref refid="structsys__sem" kindref="compound">sys_sem_t</ref><sp/>sem;</highlight></codeline>
<codeline lineno="929"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_MPU_COMPATIBLE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="930"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="931"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>cberr;</highlight></codeline>
<codeline lineno="932"><highlight class="normal"></highlight></codeline>
<codeline lineno="933"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_gethostbyname:<sp/>invalid<sp/>name&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="934"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netconn_gethostbyname:<sp/>invalid<sp/>addr&quot;</highlight><highlight class="normal">,<sp/>(addr<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;);</highlight></codeline>
<codeline lineno="935"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_MPU_COMPATIBLE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="936"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>)<sp/>&gt;=<sp/><ref refid="lwipopts_8h_1a3b01c79902063c170ef57deb72f56124" kindref="member">DNS_MAX_NAME_LENGTH</ref>)<sp/>{</highlight></codeline>
<codeline lineno="937"><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="938"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="939"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="940"><highlight class="normal"></highlight></codeline>
<codeline lineno="941"><highlight class="normal"><sp/><sp/><ref refid="tcpip__priv_8h_1a8ff9b936b16d91844c0e32424e97f493" kindref="member">API_VAR_ALLOC</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>dns_api_msg,<sp/>MEMP_DNS_API_MSG,<sp/>msg,<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>);</highlight></codeline>
<codeline lineno="942"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_MPU_COMPATIBLE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="943"><highlight class="normal"><sp/><sp/><ref refid="string_8h_1a3a2a3fddad0b7aa0ddb8fcd7509b9e27" kindref="member">strncpy</ref>(<ref refid="tcpip__priv_8h_1a3518256af0d1a422755a899b13c2b563" kindref="member">API_VAR_REF</ref>(msg).<ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>,<sp/><ref refid="lwipopts_8h_1a3b01c79902063c170ef57deb72f56124" kindref="member">DNS_MAX_NAME_LENGTH</ref>-1);</highlight></codeline>
<codeline lineno="944"><highlight class="normal"><sp/><sp/><ref refid="tcpip__priv_8h_1a3518256af0d1a422755a899b13c2b563" kindref="member">API_VAR_REF</ref>(msg).name[<ref refid="lwipopts_8h_1a3b01c79902063c170ef57deb72f56124" kindref="member">DNS_MAX_NAME_LENGTH</ref>-1]<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="945"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_MPU_COMPATIBLE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="946"><highlight class="normal"><sp/><sp/>msg.err<sp/>=<sp/>&amp;err;</highlight></codeline>
<codeline lineno="947"><highlight class="normal"><sp/><sp/>msg.sem<sp/>=<sp/>&amp;sem;</highlight></codeline>
<codeline lineno="948"><highlight class="normal"><sp/><sp/><ref refid="tcpip__priv_8h_1a3518256af0d1a422755a899b13c2b563" kindref="member">API_VAR_REF</ref>(msg).addr<sp/>=<sp/><ref refid="tcpip__priv_8h_1a3518256af0d1a422755a899b13c2b563" kindref="member">API_VAR_REF</ref>(addr);</highlight></codeline>
<codeline lineno="949"><highlight class="normal"><sp/><sp/><ref refid="tcpip__priv_8h_1a3518256af0d1a422755a899b13c2b563" kindref="member">API_VAR_REF</ref>(msg).name<sp/>=<sp/><ref refid="pci_8c_1a8f8f80d37794cde9472343e4487ba3eb" kindref="member">name</ref>;</highlight></codeline>
<codeline lineno="950"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_MPU_COMPATIBLE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="951"><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="952"><highlight class="normal"><sp/><sp/><ref refid="tcpip__priv_8h_1a3518256af0d1a422755a899b13c2b563" kindref="member">API_VAR_REF</ref>(msg).dns_addrtype<sp/>=<sp/>dns_addrtype;</highlight></codeline>
<codeline lineno="953"><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="954"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETCONN_SEM_PER_THREAD</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="955"><highlight class="normal"><sp/><sp/><ref refid="tcpip__priv_8h_1a3518256af0d1a422755a899b13c2b563" kindref="member">API_VAR_REF</ref>(msg).sem<sp/>=<sp/>LWIP_NETCONN_THREAD_SEM_GET();</highlight></codeline>
<codeline lineno="956"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETCONN_SEM_PER_THREAD*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="957"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/><ref refid="group__sys__sem_1gadb68acad14b34550b9891bc11bbf4e63" kindref="member">sys_sem_new</ref>(<ref refid="tcpip__priv_8h_1a1f3c3ae0938b5510978cbd31560a5797" kindref="member">API_EXPR_REF</ref>(<ref refid="tcpip__priv_8h_1a3518256af0d1a422755a899b13c2b563" kindref="member">API_VAR_REF</ref>(msg).sem),<sp/>0);</highlight></codeline>
<codeline lineno="958"><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="959"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="tcpip__priv_8h_1a30caebb5334f52d49ac938a507094094" kindref="member">API_VAR_FREE</ref>(MEMP_DNS_API_MSG,<sp/>msg);</highlight></codeline>
<codeline lineno="960"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="961"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="962"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETCONN_SEM_PER_THREAD<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="963"><highlight class="normal"></highlight></codeline>
<codeline lineno="964"><highlight class="normal"><sp/><sp/>cberr<sp/>=<sp/><ref refid="tcpip_8h_1a7eb868a1215472ec38f3f2a04d442b9f" kindref="member">tcpip_callback</ref>(lwip_netconn_do_gethostbyname,<sp/>&amp;<ref refid="tcpip__priv_8h_1a3518256af0d1a422755a899b13c2b563" kindref="member">API_VAR_REF</ref>(msg));</highlight></codeline>
<codeline lineno="965"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(cberr<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="966"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!LWIP_NETCONN_SEM_PER_THREAD</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="967"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__sys__sem_1ga4d02e29e5dfa092559efc04dee985822" kindref="member">sys_sem_free</ref>(<ref refid="tcpip__priv_8h_1a1f3c3ae0938b5510978cbd31560a5797" kindref="member">API_EXPR_REF</ref>(<ref refid="tcpip__priv_8h_1a3518256af0d1a422755a899b13c2b563" kindref="member">API_VAR_REF</ref>(msg).sem));</highlight></codeline>
<codeline lineno="968"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>!LWIP_NETCONN_SEM_PER_THREAD<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="969"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="tcpip__priv_8h_1a30caebb5334f52d49ac938a507094094" kindref="member">API_VAR_FREE</ref>(MEMP_DNS_API_MSG,<sp/>msg);</highlight></codeline>
<codeline lineno="970"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>cberr;</highlight></codeline>
<codeline lineno="971"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="972"><highlight class="normal"><sp/><sp/><ref refid="sys_8h_1a84e7e4bc00255aee84e6e7289a985703" kindref="member">sys_sem_wait</ref>(<ref refid="tcpip__priv_8h_1a91e803b3c3f0ab89b20d7a85e3e92624" kindref="member">API_EXPR_REF_SEM</ref>(<ref refid="tcpip__priv_8h_1a3518256af0d1a422755a899b13c2b563" kindref="member">API_VAR_REF</ref>(msg).sem));</highlight></codeline>
<codeline lineno="973"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!LWIP_NETCONN_SEM_PER_THREAD</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="974"><highlight class="normal"><sp/><sp/><ref refid="group__sys__sem_1ga4d02e29e5dfa092559efc04dee985822" kindref="member">sys_sem_free</ref>(<ref refid="tcpip__priv_8h_1a1f3c3ae0938b5510978cbd31560a5797" kindref="member">API_EXPR_REF</ref>(<ref refid="tcpip__priv_8h_1a3518256af0d1a422755a899b13c2b563" kindref="member">API_VAR_REF</ref>(msg).sem));</highlight></codeline>
<codeline lineno="975"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>!LWIP_NETCONN_SEM_PER_THREAD<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="976"><highlight class="normal"></highlight></codeline>
<codeline lineno="977"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_MPU_COMPATIBLE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="978"><highlight class="normal"><sp/><sp/>*addr<sp/>=<sp/>msg-&gt;addr;</highlight></codeline>
<codeline lineno="979"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/>msg-&gt;err;</highlight></codeline>
<codeline lineno="980"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_MPU_COMPATIBLE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="981"><highlight class="normal"></highlight></codeline>
<codeline lineno="982"><highlight class="normal"><sp/><sp/><ref refid="tcpip__priv_8h_1a30caebb5334f52d49ac938a507094094" kindref="member">API_VAR_FREE</ref>(MEMP_DNS_API_MSG,<sp/>msg);</highlight></codeline>
<codeline lineno="983"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="984"><highlight class="normal">}</highlight></codeline>
<codeline lineno="985"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_DNS*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="986"><highlight class="normal"></highlight></codeline>
<codeline lineno="987"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_NETCONN_SEM_PER_THREAD</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="988"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="989"><highlight class="normal">netconn_thread_init(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="990"><highlight class="normal">{</highlight></codeline>
<codeline lineno="991"><highlight class="normal"><sp/><sp/><ref refid="structsys__sem" kindref="compound">sys_sem_t</ref><sp/>*sem<sp/>=<sp/>LWIP_NETCONN_THREAD_SEM_GET();</highlight></codeline>
<codeline lineno="992"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((sem<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/>!<ref refid="group__sys__sem_1gac7ff314270976b80559d043f6098817b" kindref="member">sys_sem_valid</ref>(sem))<sp/>{</highlight></codeline>
<codeline lineno="993"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>call<sp/>alloc<sp/>only<sp/>once<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="994"><highlight class="normal"><sp/><sp/><sp/><sp/>LWIP_NETCONN_THREAD_SEM_ALLOC();</highlight></codeline>
<codeline lineno="995"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;LWIP_NETCONN_THREAD_SEM_ALLOC()<sp/>failed&quot;</highlight><highlight class="normal">,<sp/><ref refid="group__sys__sem_1gac7ff314270976b80559d043f6098817b" kindref="member">sys_sem_valid</ref>(LWIP_NETCONN_THREAD_SEM_GET()));</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"></highlight></codeline>
<codeline lineno="999"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1000"><highlight class="normal">netconn_thread_cleanup(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="1001"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1002"><highlight class="normal"><sp/><sp/><ref refid="structsys__sem" kindref="compound">sys_sem_t</ref><sp/>*sem<sp/>=<sp/>LWIP_NETCONN_THREAD_SEM_GET();</highlight></codeline>
<codeline lineno="1003"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((sem<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/><ref refid="group__sys__sem_1gac7ff314270976b80559d043f6098817b" kindref="member">sys_sem_valid</ref>(sem))<sp/>{</highlight></codeline>
<codeline lineno="1004"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>call<sp/>free<sp/>only<sp/>once<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1005"><highlight class="normal"><sp/><sp/><sp/><sp/>LWIP_NETCONN_THREAD_SEM_FREE();</highlight></codeline>
<codeline lineno="1006"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1007"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1008"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETCONN_SEM_PER_THREAD<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1009"><highlight class="normal"></highlight></codeline>
<codeline lineno="1010"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_NETCONN<sp/>*/</highlight><highlight class="preprocessor"></highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/net/api/api_lib.c"/>
  </compounddef>
</doxygen>
