Newer
Older
UbixOS / doc / xml / netbuf_8c.xml
<?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="netbuf_8c" kind="file" language="C++">
    <compoundname>netbuf.c</compoundname>
    <includes refid="opt_8h" local="yes">net/opt.h</includes>
    <incdepgraph>
      <node id="17">
        <label>stdarg.h</label>
        <link refid="stdarg_8h"/>
      </node>
      <node id="18">
        <label>ubixos/kpanic.h</label>
        <link refid="kpanic_8h"/>
      </node>
      <node id="15">
        <label>sys/io.h</label>
        <link refid="io_8h"/>
      </node>
      <node id="8">
        <label>sys/select.h</label>
        <link refid="select_8h"/>
        <childnode refid="9" relation="include">
        </childnode>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="12" relation="include">
        </childnode>
      </node>
      <node id="13">
        <label>net/arch/cc.h</label>
        <link refid="cc_8h"/>
        <childnode refid="14" relation="include">
        </childnode>
      </node>
      <node id="12">
        <label>sys/_sigset.h</label>
        <link refid="__sigset_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/net/api/netbuf.c</label>
        <link refid="netbuf_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="3">
        <label>net/lwipopts.h</label>
        <link refid="lwipopts_8h"/>
      </node>
      <node id="6">
        <label>sys/types.h</label>
        <link refid="include_2sys_2types_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="8" relation="include">
        </childnode>
      </node>
      <node id="5">
        <label>net/arch.h</label>
        <link refid="arch_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
        <childnode refid="18" relation="include">
        </childnode>
      </node>
      <node id="2">
        <label>net/opt.h</label>
        <link refid="opt_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="16">
        <label>lib/kprintf.h</label>
        <link refid="kprintf_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
      </node>
      <node id="4">
        <label>net/debug.h</label>
        <link refid="debug_8h"/>
        <childnode refid="5" relation="include">
        </childnode>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="9">
        <label>sys/cdefs.h</label>
        <link refid="cdefs_8h"/>
      </node>
      <node id="14">
        <label>ubixos/time.h</label>
        <link refid="time_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="15" relation="include">
        </childnode>
      </node>
      <node id="7">
        <label>sys/_types.h</label>
        <link refid="__types_8h"/>
      </node>
      <node id="10">
        <label>sys/_timespec.h</label>
        <link refid="__timespec_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="11">
        <label>sys/_timeval.h</label>
        <link refid="__timeval_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
<para>Network buffer management </para>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="13"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="14"><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="15"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="17"><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="18"><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="19"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="20"><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="21"><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="22"><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="23"><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="24"><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="25"><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="26"><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="27"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="28"><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="29"><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="30"><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="31"><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="32"><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="33"><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="34"><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="35"><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="36"><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="37"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="38"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="39"><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="40"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="41"><highlight class="comment"><sp/>*<sp/>Author:<sp/>Adam<sp/>Dunkels<sp/>&lt;adam@sics.se&gt;</highlight></codeline>
<codeline lineno="42"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="43"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="44"><highlight class="normal"></highlight></codeline>
<codeline lineno="45"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="opt_8h" kindref="compound">net/opt.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="46"><highlight class="normal"></highlight></codeline>
<codeline lineno="47"><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="48"><highlight class="normal"></highlight></codeline>
<codeline lineno="49"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="netbuf_8h" kindref="compound">net/netbuf.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="50"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="memp_8h" kindref="compound">net/memp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="51"><highlight class="normal"></highlight></codeline>
<codeline lineno="52"><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="53"><highlight class="normal"></highlight></codeline>
<codeline lineno="62"><highlight class="keyword">struct</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="63"><highlight class="normal">netbuf<sp/>*netbuf_new(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="64"><highlight class="normal">{</highlight></codeline>
<codeline lineno="65"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">netbuf<sp/>*<ref refid="structbuf" kindref="compound">buf</ref>;</highlight></codeline>
<codeline lineno="66"><highlight class="normal"></highlight></codeline>
<codeline lineno="67"><highlight class="normal"><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="68"><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="69"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="string_8h_1ace4b911463887af5e748326323e99a23" kindref="member">memset</ref>(<ref refid="structbuf" kindref="compound">buf</ref>,<sp/>0,<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netbuf));</highlight></codeline>
<codeline lineno="70"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="71"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structbuf" kindref="compound">buf</ref>;</highlight></codeline>
<codeline lineno="72"><highlight class="normal">}</highlight></codeline>
<codeline lineno="73"><highlight class="normal"></highlight></codeline>
<codeline lineno="80"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="81"><highlight class="normal">netbuf_delete(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netbuf<sp/>*<ref refid="structbuf" kindref="compound">buf</ref>)</highlight></codeline>
<codeline lineno="82"><highlight class="normal">{</highlight></codeline>
<codeline lineno="83"><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="84"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;p);</highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;p<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="87"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="88"><highlight class="normal"><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="89"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="90"><highlight class="normal">}</highlight></codeline>
<codeline lineno="91"><highlight class="normal"></highlight></codeline>
<codeline lineno="101"><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*</highlight></codeline>
<codeline lineno="102"><highlight class="normal">netbuf_alloc(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netbuf<sp/>*<ref refid="structbuf" kindref="compound">buf</ref>,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>size)</highlight></codeline>
<codeline lineno="103"><highlight class="normal">{</highlight></codeline>
<codeline lineno="104"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netbuf_alloc:<sp/>invalid<sp/>buf&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>),<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="105"><highlight class="normal"></highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Deallocate<sp/>any<sp/>previously<sp/>allocated<sp/>memory.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="107"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;p);</highlight></codeline>
<codeline lineno="109"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="110"><highlight class="normal"><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;p<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa2ded3594a3977f8bf9cf09552be327b5" kindref="member">PBUF_TRANSPORT</ref>,<sp/>size,<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>);</highlight></codeline>
<codeline lineno="111"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;p<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="112"><highlight class="normal"><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="113"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="114"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;check<sp/>that<sp/>first<sp/>pbuf<sp/>can<sp/>hold<sp/>size&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="115"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;p-&gt;len<sp/>&gt;=<sp/>size));</highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;p;</highlight></codeline>
<codeline lineno="117"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;p-&gt;payload;</highlight></codeline>
<codeline lineno="118"><highlight class="normal">}</highlight></codeline>
<codeline lineno="119"><highlight class="normal"></highlight></codeline>
<codeline lineno="126"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="127"><highlight class="normal">netbuf_free(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netbuf<sp/>*<ref refid="structbuf" kindref="compound">buf</ref>)</highlight></codeline>
<codeline lineno="128"><highlight class="normal">{</highlight></codeline>
<codeline lineno="129"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netbuf_free:<sp/>invalid<sp/>buf&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>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;);</highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;p<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__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;p);</highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="133"><highlight class="normal"><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;p<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="134"><highlight class="normal">}</highlight></codeline>
<codeline lineno="135"><highlight class="normal"></highlight></codeline>
<codeline lineno="146"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="147"><highlight class="normal">netbuf_ref(</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/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*dataptr,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>size)</highlight></codeline>
<codeline lineno="148"><highlight class="normal">{</highlight></codeline>
<codeline lineno="149"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netbuf_ref:<sp/>invalid<sp/>buf&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>),<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="150"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="151"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;p);</highlight></codeline>
<codeline lineno="152"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="153"><highlight class="normal"><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;p<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa2ded3594a3977f8bf9cf09552be327b5" kindref="member">PBUF_TRANSPORT</ref>,<sp/>0,<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac9b6ba960fdea6f2e8f35c8313b77e4e" kindref="member">PBUF_REF</ref>);</highlight></codeline>
<codeline lineno="154"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;p<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="155"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="156"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="157"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="158"><highlight class="normal"><sp/><sp/>((</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf__rom" kindref="compound">pbuf_rom</ref>*)<ref refid="structbuf" kindref="compound">buf</ref>-&gt;p)-&gt;payload<sp/>=<sp/>dataptr;</highlight></codeline>
<codeline lineno="159"><highlight class="normal"><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;p-&gt;len<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;p-&gt;tot_len<sp/>=<sp/>size;</highlight></codeline>
<codeline lineno="160"><highlight class="normal"><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;p;</highlight></codeline>
<codeline lineno="161"><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="162"><highlight class="normal">}</highlight></codeline>
<codeline lineno="163"><highlight class="normal"></highlight></codeline>
<codeline lineno="171"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="172"><highlight class="normal">netbuf_chain(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netbuf<sp/>*head,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netbuf<sp/>*tail)</highlight></codeline>
<codeline lineno="173"><highlight class="normal">{</highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netbuf_chain:<sp/>invalid<sp/>head&quot;</highlight><highlight class="normal">,<sp/>(head<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;);</highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netbuf_chain:<sp/>invalid<sp/>tail&quot;</highlight><highlight class="normal">,<sp/>(tail<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;);</highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1ga82429084fe29015509c9b4a072707cd4" kindref="member">pbuf_cat</ref>(head-&gt;p,<sp/>tail-&gt;p);</highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/>head-&gt;ptr<sp/>=<sp/>head-&gt;p;</highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_NETBUF,<sp/>tail);</highlight></codeline>
<codeline lineno="179"><highlight class="normal">}</highlight></codeline>
<codeline lineno="180"><highlight class="normal"></highlight></codeline>
<codeline lineno="191"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="192"><highlight class="normal">netbuf_data(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netbuf<sp/>*<ref refid="structbuf" kindref="compound">buf</ref>,<sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>**dataptr,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>*len)</highlight></codeline>
<codeline lineno="193"><highlight class="normal">{</highlight></codeline>
<codeline lineno="194"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netbuf_data:<sp/>invalid<sp/>buf&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>),<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="195"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netbuf_data:<sp/>invalid<sp/>dataptr&quot;</highlight><highlight class="normal">,<sp/>(dataptr<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="196"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netbuf_data:<sp/>invalid<sp/>len&quot;</highlight><highlight class="normal">,<sp/>(len<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="197"><highlight class="normal"></highlight></codeline>
<codeline lineno="198"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="199"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadca05c91366f1b5203a5db9a241b415cd63" kindref="member">ERR_BUF</ref>;</highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/>*dataptr<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr-&gt;payload;</highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/>*len<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr-&gt;len;</highlight></codeline>
<codeline lineno="203"><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="204"><highlight class="normal">}</highlight></codeline>
<codeline lineno="205"><highlight class="normal"></highlight></codeline>
<codeline lineno="217"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga9cd1d7891fe315de1201e2c6e45f4f57" kindref="member">s8_t</ref></highlight></codeline>
<codeline lineno="218"><highlight class="normal">netbuf_next(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netbuf<sp/>*<ref refid="structbuf" kindref="compound">buf</ref>)</highlight></codeline>
<codeline lineno="219"><highlight class="normal">{</highlight></codeline>
<codeline lineno="220"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netbuf_next:<sp/>invalid<sp/>buf&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>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;);</highlight></codeline>
<codeline lineno="221"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr-&gt;next<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="222"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="223"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="224"><highlight class="normal"><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr-&gt;next;</highlight></codeline>
<codeline lineno="225"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr-&gt;next<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="226"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="227"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="228"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="229"><highlight class="normal">}</highlight></codeline>
<codeline lineno="230"><highlight class="normal"></highlight></codeline>
<codeline lineno="239"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="240"><highlight class="normal">netbuf_first(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>netbuf<sp/>*<ref refid="structbuf" kindref="compound">buf</ref>)</highlight></codeline>
<codeline lineno="241"><highlight class="normal">{</highlight></codeline>
<codeline lineno="242"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;netbuf_first:<sp/>invalid<sp/>buf&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>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;);</highlight></codeline>
<codeline lineno="243"><highlight class="normal"><sp/><sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;ptr<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>-&gt;p;</highlight></codeline>
<codeline lineno="244"><highlight class="normal">}</highlight></codeline>
<codeline lineno="245"><highlight class="normal"></highlight></codeline>
<codeline lineno="246"><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/netbuf.c"/>
  </compounddef>
</doxygen>