<?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="pbuf_8c" kind="file" language="C++">
    <compoundname>pbuf.c</compoundname>
    <includes refid="opt_8h" local="yes">net/opt.h</includes>
    <includes refid="stats_8h" local="yes">net/stats.h</includes>
    <includes refid="def_8h" local="yes">net/def.h</includes>
    <includes refid="mem_8h" local="yes">net/mem.h</includes>
    <includes refid="memp_8h" local="yes">net/memp.h</includes>
    <includes refid="pbuf_8h" local="yes">net/pbuf.h</includes>
    <includes refid="sys_8h" local="yes">net/sys.h</includes>
    <includes refid="string_8h" local="no">string.h</includes>
    <incdepgraph>
      <node id="42">
        <label>ufs/ufs.h</label>
        <link refid="ufs_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="43" relation="include">
        </childnode>
      </node>
      <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="47">
        <label>ubixos/sem.h</label>
        <link refid="sem_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="48" relation="include">
        </childnode>
        <childnode refid="29" relation="include">
        </childnode>
      </node>
      <node id="46">
        <label>sys/tss.h</label>
        <link refid="tss_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
      </node>
      <node id="15">
        <label>sys/io.h</label>
        <link refid="io_8h"/>
      </node>
      <node id="25">
        <label>net/pbuf.h</label>
        <link refid="pbuf_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="26" relation="include">
        </childnode>
      </node>
      <node id="48">
        <label>ubixos/errno.h</label>
        <link refid="ubixos_2errno_8h"/>
      </node>
      <node id="45">
        <label>ubixos/tty.h</label>
        <link refid="tty_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
      </node>
      <node id="50">
        <label>strings.h</label>
        <link refid="strings_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
      </node>
      <node id="23">
        <label>net/priv/memp_priv.h</label>
        <link refid="memp__priv_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
      </node>
      <node id="35">
        <label>i386/cpu.h</label>
        <link refid="i386_2cpu_8h"/>
        <childnode refid="6" 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="38">
        <label>vfs/inode.h</label>
        <link refid="inode_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="39" relation="include">
        </childnode>
        <childnode refid="40" relation="include">
        </childnode>
        <childnode refid="41" relation="include">
        </childnode>
        <childnode refid="42" relation="include">
        </childnode>
      </node>
      <node id="27">
        <label>net/sys.h</label>
        <link refid="sys_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="28" relation="include">
        </childnode>
        <childnode refid="26" relation="include">
        </childnode>
      </node>
      <node id="29">
        <label>ubixos/ubthread.h</label>
        <link refid="ubthread_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="30" relation="include">
        </childnode>
        <childnode refid="14" 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="20">
        <label>net/mem.h</label>
        <link refid="mem_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="19">
        <label>net/stats.h</label>
        <link refid="stats_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
        <childnode refid="21" relation="include">
        </childnode>
      </node>
      <node id="3">
        <label>net/lwipopts.h</label>
        <link refid="lwipopts_8h"/>
      </node>
      <node id="28">
        <label>net/arch/sys_arch.h</label>
        <link refid="sys__arch_8h"/>
        <childnode refid="29" relation="include">
        </childnode>
        <childnode refid="47" relation="include">
        </childnode>
      </node>
      <node id="44">
        <label>vfs/mount.h</label>
        <link refid="mount_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
      </node>
      <node id="37">
        <label>sys/resource.h</label>
        <link refid="resource_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="34">
        <label>sys/trap.h</label>
        <link refid="trap_8h"/>
        <childnode refid="35" relation="include">
        </childnode>
      </node>
      <node id="49">
        <label>string.h</label>
        <link refid="string_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="50" relation="include">
        </childnode>
      </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="31">
        <label>vfs/file.h</label>
        <link refid="include_2vfs_2file_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="32" relation="include">
        </childnode>
        <childnode refid="33" relation="include">
        </childnode>
        <childnode refid="38" relation="include">
        </childnode>
        <childnode refid="44" relation="include">
        </childnode>
        <childnode refid="42" relation="include">
        </childnode>
      </node>
      <node id="24">
        <label>net/def.h</label>
        <link refid="def_8h"/>
        <childnode refid="5" relation="include">
        </childnode>
        <childnode refid="2" 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="41">
        <label>fs/msdos_fs.h</label>
        <link refid="msdos__fs_8h"/>
      </node>
      <node id="36">
        <label>sys/signal.h</label>
        <link refid="sys_2signal_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
      </node>
      <node id="40">
        <label>fs/pipe_fs.h</label>
        <link refid="pipe__fs_8h"/>
      </node>
      <node id="39">
        <label>ubixos/wait.h</label>
        <link refid="wait_8h"/>
      </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="33">
        <label>sys/thread.h</label>
        <link refid="thread_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="34" relation="include">
        </childnode>
        <childnode refid="36" relation="include">
        </childnode>
        <childnode refid="37" relation="include">
        </childnode>
      </node>
      <node id="22">
        <label>net/priv/memp_std.h</label>
        <link refid="memp__std_8h"/>
      </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="30">
        <label>ubixos/sched.h</label>
        <link refid="sched_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="31" relation="include">
        </childnode>
        <childnode refid="45" relation="include">
        </childnode>
        <childnode refid="46" relation="include">
        </childnode>
        <childnode refid="33" relation="include">
        </childnode>
      </node>
      <node id="7">
        <label>sys/_types.h</label>
        <link refid="__types_8h"/>
      </node>
      <node id="26">
        <label>net/err.h</label>
        <link refid="err_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="5" relation="include">
        </childnode>
      </node>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/net/core/pbuf.c</label>
        <link refid="pbuf_8c"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="19" relation="include">
        </childnode>
        <childnode refid="24" relation="include">
        </childnode>
        <childnode refid="20" relation="include">
        </childnode>
        <childnode refid="21" relation="include">
        </childnode>
        <childnode refid="25" relation="include">
        </childnode>
        <childnode refid="27" relation="include">
        </childnode>
        <childnode refid="49" relation="include">
        </childnode>
      </node>
      <node id="10">
        <label>sys/_timespec.h</label>
        <link refid="__timespec_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="43">
        <label>sys/device.h</label>
        <link refid="include_2sys_2device_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
      </node>
      <node id="32">
        <label>ubixfs/dirCache.h</label>
        <link refid="dirCache_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
      </node>
      <node id="11">
        <label>sys/_timeval.h</label>
        <link refid="__timeval_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="21">
        <label>net/memp.h</label>
        <link refid="memp_8h"/>
        <childnode refid="2" relation="include">
        </childnode>
        <childnode refid="22" relation="include">
        </childnode>
        <childnode refid="23" relation="include">
        </childnode>
        <childnode refid="19" relation="include">
        </childnode>
      </node>
    </incdepgraph>
      <sectiondef kind="define">
      <memberdef kind="define" id="pbuf_8c_1a3dad81a8286ee8e9a7c70a74f9f4bb0f" prot="public" static="no">
        <name>PBUF_POOL_BUFSIZE_ALIGNED</name>
        <initializer><ref refid="group__compiler__abstraction_1gaef204be511fd32f681b55abc08e9ae18" kindref="member">LWIP_MEM_ALIGN_SIZE</ref>(<ref refid="group__lwip__opts__pbuf_1gae61f4491d56e805e79b79eb5d35a00e5" kindref="member">PBUF_POOL_BUFSIZE</ref>)</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="132" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="132" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="pbuf_8c_1aed70c61e971683736c569a1a99b76569" prot="public" static="no">
        <name>PBUF_POOL_IS_EMPTY</name>
        <param></param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="135" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="135" bodyend="-1"/>
      </memberdef>
      <memberdef kind="define" id="pbuf_8c_1a8357a994e45ff94c9494aa55b6c3ecb3" prot="public" static="no">
        <name>SIZEOF_STRUCT_PBUF</name>
        <initializer><ref refid="group__compiler__abstraction_1gaef204be511fd32f681b55abc08e9ae18" kindref="member">LWIP_MEM_ALIGN_SIZE</ref>(sizeof(struct <ref refid="structpbuf" kindref="compound">pbuf</ref>))</initializer>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="129" column="9" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="129" bodyend="-1"/>
      </memberdef>
      </sectiondef>
      <sectiondef kind="func">
      <memberdef kind="function" id="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
        <definition>struct pbuf* pbuf_alloc</definition>
        <argsstring>(pbuf_layer layer, u16_t length, pbuf_type type)</argsstring>
        <name>pbuf_alloc</name>
        <param>
          <type><ref refid="group__pbuf_1gaee1baa59bb2f85ba575b5a8619ac1ebf" kindref="member">pbuf_layer</ref></type>
          <declname>layer</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>length</declname>
        </param>
        <param>
          <type><ref refid="group__pbuf_1gab7e0e32fcc292c0d7107721766ed92fb" kindref="member">pbuf_type</ref></type>
          <declname>type</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Allocates a pbuf of the given type (possibly a chain for PBUF_POOL type).</para>
<para>The actual memory allocated for the pbuf is determined by the layer at which the pbuf is allocated and the requested size (from the size parameter).</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>layer</parametername>
</parameternamelist>
<parameterdescription>
<para>flag to define header size </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>length</parametername>
</parameternamelist>
<parameterdescription>
<para>size of the pbuf&apos;s payload </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>type</parametername>
</parameternamelist>
<parameterdescription>
<para>this parameter decides how and where the pbuf should be allocated as follows:</para>
</parameterdescription>
</parameteritem>
</parameterlist>
<itemizedlist>
<listitem><para>PBUF_RAM: buffer memory for pbuf is allocated as one large chunk. This includes protocol headers as well.</para>
</listitem><listitem><para>PBUF_ROM: no buffer memory is allocated for the pbuf, even for protocol headers. Additional headers must be prepended by allocating another pbuf and chain in to the front of the ROM pbuf. It is assumed that the memory used is really similar to ROM in that it is immutable and will not be changed. Memory which is dynamic should generally not be attached to PBUF_ROM pbufs. Use PBUF_REF instead.</para>
</listitem><listitem><para>PBUF_REF: no buffer memory is allocated for the pbuf, even for protocol headers. It is assumed that the pbuf is only being used in a single thread. If the pbuf gets queued, then pbuf_take should be called to copy the buffer.</para>
</listitem><listitem><para>PBUF_POOL: the pbuf is allocated as a pbuf chain, with pbufs from the pbuf pool that is allocated during <ref refid="pbuf_8h_1a0c9b6a35471ebe1628ffe74bbc67f0b4" kindref="member">pbuf_init()</ref>.</para>
</listitem></itemizedlist>
</para>
<para><simplesect kind="return"><para>the allocated pbuf. If multiple pbufs where allocated, this is the first pbuf of a pbuf chain. </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="248" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="248" bodyend="405"/>
        <references refid="structpbuf_1aa4d1af2cab3d9280d29212095b5b872a" compoundref="pbuf_8h" startline="165">pbuf::flags</references>
        <references refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" compoundref="pbuf_8h" startline="159">pbuf::len</references>
        <references refid="debug_8h_1a94ad086267808462beae2b38f91996ed" compoundref="debug_8h" startline="116">LWIP_ASSERT</references>
        <references refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" compoundref="debug_8h" startline="57">LWIP_DBG_LEVEL_SERIOUS</references>
        <references refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" compoundref="debug_8h" startline="83">LWIP_DBG_TRACE</references>
        <references refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" compoundref="debug_8h" startline="164">LWIP_DEBUGF</references>
        <references refid="group__compiler__abstraction_1gaa8e8724eb1c220cbbb90de9e175ce1dc" compoundref="arch_8h" startline="236">LWIP_MEM_ALIGN</references>
        <references refid="group__compiler__abstraction_1gaef204be511fd32f681b55abc08e9ae18" compoundref="arch_8h" startline="221">LWIP_MEM_ALIGN_SIZE</references>
        <references refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" compoundref="def_8h" startline="55">LWIP_MIN</references>
        <references refid="lwipopts_8h_1a97343214666ee6dcb18c0bd77b441ea7" compoundref="lwipopts_8h" startline="54">MEM_ALIGNMENT</references>
        <references refid="mem_8h_1a932aa40d85b14cb7331625e012d12335" compoundref="mem_8c" startline="603" endline="742">mem_malloc</references>
        <references refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" compoundref="memp_8c" startline="385" endline="404">memp_malloc</references>
        <references refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" compoundref="pbuf_8h" startline="144">pbuf::next</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" compoundref="pbuf_8h" startline="147">pbuf::payload</references>
        <references refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" compoundref="lwipopts_8h" startline="435">PBUF_DEBUG</references>
        <references refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" compoundref="pbuf_8c" startline="715" endline="792">pbuf_free</references>
        <references refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfafcc1e506061ba69dfa142eb6b3da5f13" compoundref="pbuf_8h" startline="80">PBUF_IP</references>
        <references refid="pbuf_8h_1aae0fea237167bb06ea4dc5333df5b0a7" compoundref="pbuf_8h" startline="65">PBUF_IP_HLEN</references>
        <references refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfab4de441e737330558b609a990cd17346" compoundref="pbuf_8h" startline="85">PBUF_LINK</references>
        <references refid="lwipopts_8h_1a6e1ba1875ae5168a17b53d83597bc1de" compoundref="lwipopts_8h" startline="211">PBUF_LINK_ENCAPSULATION_HLEN</references>
        <references refid="lwipopts_8h_1a35998a3d56af9940e6a80bb372597685" compoundref="lwipopts_8h" startline="209">PBUF_LINK_HLEN</references>
        <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbae969347127387b9b59a23ccd24b76d21" compoundref="pbuf_8h" startline="123">PBUF_POOL</references>
        <references refid="pbuf_8c_1a3dad81a8286ee8e9a7c70a74f9f4bb0f" compoundref="pbuf_8c" startline="132">PBUF_POOL_BUFSIZE_ALIGNED</references>
        <references refid="pbuf_8c_1aed70c61e971683736c569a1a99b76569" compoundref="pbuf_8c" startline="135">PBUF_POOL_IS_EMPTY</references>
        <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" compoundref="pbuf_8h" startline="108">PBUF_RAM</references>
        <references refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa21116654fbab6d5a4dfeb87a1bb8f0ba" compoundref="pbuf_8h" startline="94">PBUF_RAW</references>
        <references refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa0ff039585f05f9208bcb66c2d37783e2" compoundref="pbuf_8h" startline="91">PBUF_RAW_TX</references>
        <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac9b6ba960fdea6f2e8f35c8313b77e4e" compoundref="pbuf_8h" startline="116">PBUF_REF</references>
        <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac120b0fe39efe35bb682e4aa3b82e2c9" compoundref="pbuf_8h" startline="112">PBUF_ROM</references>
        <references refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa2ded3594a3977f8bf9cf09552be327b5" compoundref="pbuf_8h" startline="76">PBUF_TRANSPORT</references>
        <references refid="pbuf_8h_1af9da2e1ca60dc0c584938ccc5d662307" compoundref="pbuf_8h" startline="61">PBUF_TRANSPORT_HLEN</references>
        <references refid="structpbuf_1a18e2c02942feb1baa3756fcd585b6731" compoundref="pbuf_8h" startline="172">pbuf::ref</references>
        <references refid="pbuf_8c_1a8357a994e45ff94c9494aa55b6c3ecb3" compoundref="pbuf_8c" startline="129">SIZEOF_STRUCT_PBUF</references>
        <references refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" compoundref="pbuf_8h" startline="156">pbuf::tot_len</references>
        <references refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" compoundref="pbuf_8h" startline="162">pbuf::type</references>
        <references refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" compoundref="arch_8h" startline="148">U16_F</references>
        <referencedby refid="arp_8c_1a9d1287b9a80c370797b2ac5c63f70e2e" compoundref="arp_8c" startline="273" endline="309">arp_query</referencedby>
        <referencedby refid="group__pbuf_1ga54ac7b116c6f53c704cbf74f35a8b35c" compoundref="pbuf_8c" startline="1230" endline="1247">pbuf_coalesce</referencedby>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1ga82429084fe29015509c9b4a072707cd4" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void pbuf_cat</definition>
        <argsstring>(struct pbuf *h, struct pbuf *t)</argsstring>
        <name>pbuf_cat</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>h</declname>
        </param>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>t</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Concatenate two pbufs (each may be a pbuf chain) and take over the caller&apos;s reference of the tail pbuf.</para>
<para><simplesect kind="note"><para>The caller MAY NOT reference the tail pbuf afterwards. Use <ref refid="group__pbuf_1ga831c9a72bda1d3bd4c7b96f5a0e3b891" kindref="member">pbuf_chain()</ref> for that purpose.</para>
</simplesect>
<simplesect kind="see"><para><ref refid="group__pbuf_1ga831c9a72bda1d3bd4c7b96f5a0e3b891" kindref="member">pbuf_chain()</ref> </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="841" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="841" bodyend="863"/>
        <references refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" compoundref="pbuf_8h" startline="159">pbuf::len</references>
        <references refid="debug_8h_1a94ad086267808462beae2b38f91996ed" compoundref="debug_8h" startline="116">LWIP_ASSERT</references>
        <references refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" compoundref="debug_8h" startline="135">LWIP_ERROR</references>
        <references refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" compoundref="pbuf_8h" startline="144">pbuf::next</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" compoundref="pbuf_8h" startline="156">pbuf::tot_len</references>
        <referencedby refid="group__pbuf_1ga831c9a72bda1d3bd4c7b96f5a0e3b891" compoundref="pbuf_8c" startline="883" endline="889">pbuf_chain</referencedby>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1ga831c9a72bda1d3bd4c7b96f5a0e3b891" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void pbuf_chain</definition>
        <argsstring>(struct pbuf *h, struct pbuf *t)</argsstring>
        <name>pbuf_chain</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>h</declname>
        </param>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>t</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Chain two pbufs (or pbuf chains) together.</para>
<para>The caller MUST call pbuf_free(t) once it has stopped using it. Use <ref refid="group__pbuf_1ga82429084fe29015509c9b4a072707cd4" kindref="member">pbuf_cat()</ref> instead if you no longer use t.</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>h</parametername>
</parameternamelist>
<parameterdescription>
<para>head pbuf (chain) </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>t</parametername>
</parameternamelist>
<parameterdescription>
<para>tail pbuf (chain) </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="note"><para>The pbufs MUST belong to the same packet. </para>
</simplesect>
<simplesect kind="note"><para>MAY NOT be called on a packet queue.</para>
</simplesect>
The -&gt;tot_len fields of all pbufs of the head chain are adjusted. The -&gt;next field of the last pbuf of the head chain is adjusted. The -&gt;ref field of the first pbuf of the tail chain is adjusted. </para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="883" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="883" bodyend="889"/>
        <references refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" compoundref="debug_8h" startline="83">LWIP_DBG_TRACE</references>
        <references refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" compoundref="debug_8h" startline="164">LWIP_DEBUGF</references>
        <references refid="group__pbuf_1ga82429084fe29015509c9b4a072707cd4" compoundref="pbuf_8c" startline="841" endline="863">pbuf_cat</references>
        <references refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" compoundref="lwipopts_8h" startline="435">PBUF_DEBUG</references>
        <references refid="group__pbuf_1ga77f6bbd69e45e542014d9c547c7da74e" compoundref="pbuf_8c" startline="821" endline="828">pbuf_ref</references>
      </memberdef>
      <memberdef kind="function" id="pbuf_8c_1a5df7ac5ae59012fe9aeddba375a72190" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
        <definition>u16_t pbuf_clen</definition>
        <argsstring>(const struct pbuf *p)</argsstring>
        <name>pbuf_clen</name>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Count number of pbufs in a chain</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>first pbuf of chain </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>the number of pbufs in a chain </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="801" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="801" bodyend="811"/>
        <references refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" compoundref="pbuf_8h" startline="144">pbuf::next</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1ga54ac7b116c6f53c704cbf74f35a8b35c" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
        <definition>struct pbuf* pbuf_coalesce</definition>
        <argsstring>(struct pbuf *p, pbuf_layer layer)</argsstring>
        <name>pbuf_coalesce</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <param>
          <type><ref refid="group__pbuf_1gaee1baa59bb2f85ba575b5a8619ac1ebf" kindref="member">pbuf_layer</ref></type>
          <declname>layer</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Creates a single pbuf out of a queue of pbufs.</para>
<para><simplesect kind="remark"><para>: Either the source pbuf &apos;p&apos; is freed by this function or the original pbuf &apos;p&apos; is returned, therefore the caller has to check the result!</para>
</simplesect>
<parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>the source pbuf </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>layer</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf_layer of the new pbuf</para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>a new, single pbuf (p-&gt;next is NULL) or the old pbuf if allocation fails </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="1230" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="1230" bodyend="1247"/>
        <references refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" compoundref="err_8h" startline="63">ERR_OK</references>
        <references refid="debug_8h_1a94ad086267808462beae2b38f91996ed" compoundref="debug_8h" startline="116">LWIP_ASSERT</references>
        <references refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" compoundref="arch_8h" startline="315">LWIP_UNUSED_ARG</references>
        <references refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" compoundref="pbuf_8h" startline="144">pbuf::next</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" compoundref="pbuf_8c" startline="248" endline="405">pbuf_alloc</references>
        <references refid="group__pbuf_1gaba88511dee3df4b631fde691f421320d" compoundref="pbuf_8c" startline="949" endline="1001">pbuf_copy</references>
        <references refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" compoundref="pbuf_8c" startline="715" endline="792">pbuf_free</references>
        <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" compoundref="pbuf_8h" startline="108">PBUF_RAM</references>
        <references refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" compoundref="pbuf_8h" startline="156">pbuf::tot_len</references>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1gaba88511dee3df4b631fde691f421320d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></type>
        <definition>err_t pbuf_copy</definition>
        <argsstring>(struct pbuf *p_to, const struct pbuf *p_from)</argsstring>
        <name>pbuf_copy</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p_to</declname>
        </param>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p_from</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Create PBUF_RAM copies of pbufs.</para>
<para>Used to queue packets on behalf of the lwIP stack, such as ARP based queueing.</para>
<para><simplesect kind="note"><para>You MUST explicitly use p = pbuf_take(p);</para>
</simplesect>
<simplesect kind="note"><para>Only one packet is copied, no packet queue!</para>
</simplesect>
<parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p_to</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf destination of the copy </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>p_from</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf source of the copy</para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>ERR_OK if pbuf was copied ERR_ARG if one of the pbufs is NULL or p_to is not big enough to hold p_from </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="949" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="949" bodyend="1001"/>
        <references refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" compoundref="err_8h" startline="96">ERR_ARG</references>
        <references refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" compoundref="err_8h" startline="63">ERR_OK</references>
        <references refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" compoundref="err_8h" startline="75">ERR_VAL</references>
        <references refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" compoundref="pbuf_8h" startline="159">pbuf::len</references>
        <references refid="debug_8h_1a94ad086267808462beae2b38f91996ed" compoundref="debug_8h" startline="116">LWIP_ASSERT</references>
        <references refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" compoundref="debug_8h" startline="83">LWIP_DBG_TRACE</references>
        <references refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" compoundref="debug_8h" startline="164">LWIP_DEBUGF</references>
        <references refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" compoundref="debug_8h" startline="135">LWIP_ERROR</references>
        <references refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" compoundref="lwipopts_8h" startline="43">MEMCPY</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" compoundref="lwipopts_8h" startline="435">PBUF_DEBUG</references>
        <referencedby refid="group__pbuf_1ga54ac7b116c6f53c704cbf74f35a8b35c" compoundref="pbuf_8c" startline="1230" endline="1247">pbuf_coalesce</referencedby>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1gac2f1f58fd36042e82af46f5015720899" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
        <definition>u16_t pbuf_copy_partial</definition>
        <argsstring>(const struct pbuf *buf, void *dataptr, u16_t len, u16_t offset)</argsstring>
        <name>pbuf_copy_partial</name>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>buf</declname>
        </param>
        <param>
          <type>void *</type>
          <declname>dataptr</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>len</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>offset</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Copy (part of) the contents of a packet buffer to an application supplied buffer.</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>buf</parametername>
</parameternamelist>
<parameterdescription>
<para>the pbuf from which to copy data </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>dataptr</parametername>
</parameternamelist>
<parameterdescription>
<para>the application supplied buffer </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>len</parametername>
</parameternamelist>
<parameterdescription>
<para>length of data to copy (dataptr must be big enough). No more than buf-&gt;tot_len will be copied, irrespective of len </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>offset</parametername>
</parameternamelist>
<parameterdescription>
<para>offset into the packet buffer from where to begin copying len bytes </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>the number of bytes copied, or 0 on failure </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="1016" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="1016" bodyend="1052"/>
        <references refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" compoundref="pbuf_8h" startline="159">pbuf::len</references>
        <references refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" compoundref="debug_8h" startline="135">LWIP_ERROR</references>
        <references refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" compoundref="lwipopts_8h" startline="43">MEMCPY</references>
        <references refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" compoundref="pbuf_8h" startline="144">pbuf::next</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" compoundref="pbuf_8h" startline="147">pbuf::payload</references>
      </memberdef>
      <memberdef kind="function" id="pbuf_8c_1abf3d29c4f43986b4cb5eb314d5b9729d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
        <definition>struct pbuf* pbuf_dechain</definition>
        <argsstring>(struct pbuf *p)</argsstring>
        <name>pbuf_dechain</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Dechains the first pbuf from its succeeding pbufs in the chain.</para>
<para>Makes p-&gt;tot_len field equal to p-&gt;len. <parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf to dechain </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>remainder of the pbuf chain, or NULL if it was de-allocated. </para>
</simplesect>
<simplesect kind="note"><para>May not be called on a packet queue. </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="900" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="900" bodyend="928"/>
        <references refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" compoundref="pbuf_8h" startline="159">pbuf::len</references>
        <references refid="debug_8h_1a94ad086267808462beae2b38f91996ed" compoundref="debug_8h" startline="116">LWIP_ASSERT</references>
        <references refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" compoundref="debug_8h" startline="83">LWIP_DBG_TRACE</references>
        <references refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" compoundref="debug_8h" startline="164">LWIP_DEBUGF</references>
        <references refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" compoundref="pbuf_8h" startline="144">pbuf::next</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" compoundref="lwipopts_8h" startline="435">PBUF_DEBUG</references>
        <references refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" compoundref="pbuf_8c" startline="715" endline="792">pbuf_free</references>
        <references refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" compoundref="pbuf_8h" startline="156">pbuf::tot_len</references>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></type>
        <definition>u8_t pbuf_free</definition>
        <argsstring>(struct pbuf *p)</argsstring>
        <name>pbuf_free</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Dereference a pbuf chain or queue and deallocate any no-longer-used pbufs at the head of this chain or queue.</para>
<para>Decrements the pbuf reference count. If it reaches zero, the pbuf is deallocated.</para>
<para>For a pbuf chain, this is repeated for each pbuf in the chain, up to the first pbuf which has a non-zero reference count after decrementing. So, when all reference counts are one, the whole chain is free&apos;d.</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>The pbuf (chain) to be dereferenced.</para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>the number of pbufs that were de-allocated from the head of the chain.</para>
</simplesect>
<simplesect kind="note"><para>MUST NOT be called on a packet queue (Not verified to work yet). </para>
</simplesect>
<simplesect kind="note"><para>the reference counter of a pbuf equals the number of pointers that refer to the pbuf (or into the pbuf).</para>
</simplesect>
</para>
<internal><para>examples:</para>
<para>Assuming existing chains a-&gt;b-&gt;c with the following reference counts, calling pbuf_free(a) results in:</para>
<para>1-&gt;2-&gt;3 becomes ...1-&gt;3 3-&gt;3-&gt;3 becomes 2-&gt;3-&gt;3 1-&gt;1-&gt;2 becomes ......1 2-&gt;1-&gt;1 becomes 1-&gt;1-&gt;1 1-&gt;1-&gt;1 becomes ....... </para>
</internal>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="715" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="715" bodyend="792"/>
        <references refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" compoundref="armv6_2sched_8c" startline="50">_current</references>
        <references refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" compoundref="sched_8h" startline="63">taskStruct::id</references>
        <references refid="debug_8h_1a94ad086267808462beae2b38f91996ed" compoundref="debug_8h" startline="116">LWIP_ASSERT</references>
        <references refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" compoundref="debug_8h" startline="57">LWIP_DBG_LEVEL_SERIOUS</references>
        <references refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" compoundref="debug_8h" startline="83">LWIP_DBG_TRACE</references>
        <references refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" compoundref="debug_8h" startline="164">LWIP_DEBUGF</references>
        <references refid="mem_8h_1a2fd7aa1adf6e394d3be7c7734e7df41a" compoundref="mem_8c" startline="419" endline="465">mem_free</references>
        <references refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" compoundref="memp_8c" startline="469" endline="496">memp_free</references>
        <references refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" compoundref="pbuf_8h" startline="144">pbuf::next</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" compoundref="lwipopts_8h" startline="435">PBUF_DEBUG</references>
        <references refid="pbuf_8h_1af78a7e1815dc0e31884d095b666d997f" compoundref="pbuf_8h" startline="131">PBUF_FLAG_IS_CUSTOM</references>
        <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbae969347127387b9b59a23ccd24b76d21" compoundref="pbuf_8h" startline="123">PBUF_POOL</references>
        <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" compoundref="pbuf_8h" startline="108">PBUF_RAM</references>
        <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac9b6ba960fdea6f2e8f35c8313b77e4e" compoundref="pbuf_8h" startline="116">PBUF_REF</references>
        <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac120b0fe39efe35bb682e4aa3b82e2c9" compoundref="pbuf_8h" startline="112">PBUF_ROM</references>
        <references refid="perf_8h_1aa1d6977095e51331f65dcfb2b076da52" compoundref="perf_8h" startline="20">PERF_START</references>
        <references refid="perf_8h_1a8ac3afe5d720793a229fbf70a78eb82f" compoundref="perf_8h" startline="21">PERF_STOP</references>
        <references refid="structpbuf_1a18e2c02942feb1baa3756fcd585b6731" compoundref="pbuf_8h" startline="172">pbuf::ref</references>
        <references refid="sys_8h_1a945395fa326214fc9736487242710a90" compoundref="sys_8h" startline="361">SYS_ARCH_DECL_PROTECT</references>
        <references refid="sys_8h_1a3d0e48feafd378e9c26c64567ecd8bab" compoundref="sys_8h" startline="362">SYS_ARCH_PROTECT</references>
        <references refid="sys_8h_1a2f48e97047945642ddeb27e65bf4ffe2" compoundref="sys_8h" startline="363">SYS_ARCH_UNPROTECT</references>
        <references refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" compoundref="pbuf_8h" startline="162">pbuf::type</references>
        <references refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" compoundref="arch_8h" startline="148">U16_F</references>
        <referencedby refid="arp_8c_1a57a25dd51cf73f048ad5364ecc2f040b" compoundref="arp_8c" startline="197" endline="257">arp_arp_input</referencedby>
        <referencedby refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" compoundref="pbuf_8c" startline="248" endline="405">pbuf_alloc</referencedby>
        <referencedby refid="group__pbuf_1ga54ac7b116c6f53c704cbf74f35a8b35c" compoundref="pbuf_8c" startline="1230" endline="1247">pbuf_coalesce</referencedby>
        <referencedby refid="pbuf_8c_1abf3d29c4f43986b4cb5eb314d5b9729d" compoundref="pbuf_8c" startline="900" endline="928">pbuf_dechain</referencedby>
        <referencedby refid="group__pbuf_1ga50abfe830a33a1a47a562febee66015d" compoundref="pbuf_8c" startline="493" endline="555">pbuf_realloc</referencedby>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1ga6d803d9945bffb7ad97743f2fa503da6" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></type>
        <definition>u8_t pbuf_get_at</definition>
        <argsstring>(const struct pbuf *p, u16_t offset)</argsstring>
        <name>pbuf_get_at</name>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>offset</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Get one byte from the specified position in a pbuf WARNING: returns zero for offset &gt;= p-&gt;tot_len</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf to parse </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>offset</parametername>
</parameternamelist>
<parameterdescription>
<para>offset into p of the byte to return </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>byte at an offset into p OR ZERO IF &apos;offset&apos; &gt;= p-&gt;tot_len </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="1300" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="1300" bodyend="1307"/>
        <references refid="group__pbuf_1ga839f342803b0cf89049744124c5a98ad" compoundref="pbuf_8c" startline="1318" endline="1328">pbuf_try_get_at</references>
        <referencedby refid="group__pbuf_1ga2170ccbbb13238380dbb203ee1b85974" compoundref="pbuf_8c" startline="1363" endline="1390">pbuf_memcmp</referencedby>
      </memberdef>
      <memberdef kind="function" id="pbuf_8c_1a0f81deff4a0e6e8e0ff161a7b9871449" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></type>
        <definition>u8_t pbuf_header</definition>
        <argsstring>(struct pbuf *p, s16_t header_size_increment)</argsstring>
        <name>pbuf_header</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref></type>
          <declname>header_size_increment</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Adjusts the payload pointer to hide or reveal headers in the payload.</para>
<para>Adjusts the -&gt;payload pointer so that space for a header (dis)appears in the pbuf payload.</para>
<para>The -&gt;payload, -&gt;tot_len and -&gt;len fields are adjusted.</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf to change the header size. </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>header_size_increment</parametername>
</parameternamelist>
<parameterdescription>
<para>Number of bytes to increment header size which increases the size of the pbuf. New space is on the front. (Using a negative value decreases the header size.) If hdr_size_inc is 0, this function does nothing and returns successful.</para>
</parameterdescription>
</parameteritem>
</parameterlist>
PBUF_ROM and PBUF_REF type buffers cannot have their sizes increased, so the call will fail. A check is made that the increase in header size does not move the payload pointer in front of the start of the buffer. <simplesect kind="return"><para>non-zero on failure, zero on success. </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="665" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="665" bodyend="668"/>
      </memberdef>
      <memberdef kind="function" id="pbuf_8c_1ad0e64d6fbc423593461063da97da9ce6" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></type>
        <definition>u8_t pbuf_header_force</definition>
        <argsstring>(struct pbuf *p, s16_t header_size_increment)</argsstring>
        <name>pbuf_header_force</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref></type>
          <declname>header_size_increment</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Same as pbuf_header but does not check if &apos;header_size &gt; 0&apos; is allowed. This is used internally only, to allow PBUF_REF for RX. </para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="675" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="675" bodyend="678"/>
      </memberdef>
      <memberdef kind="function" id="pbuf_8c_1a65b211367b45b45ed385363cf231213e" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></type>
        <definition>static u8_t pbuf_header_impl</definition>
        <argsstring>(struct pbuf *p, s16_t header_size_increment, u8_t force)</argsstring>
        <name>pbuf_header_impl</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref></type>
          <declname>header_size_increment</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></type>
          <declname>force</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Adjusts the payload pointer to hide or reveal headers in the payload. <simplesect kind="see"><para><ref refid="pbuf_8c_1a0f81deff4a0e6e8e0ff161a7b9871449" kindref="member">pbuf_header</ref>.</para>
</simplesect>
<parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf to change the header size. </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>header_size_increment</parametername>
</parameternamelist>
<parameterdescription>
<para>Number of bytes to increment header size. </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>force</parametername>
</parameternamelist>
<parameterdescription>
<para>Allow &apos;header_size_increment &gt; 0&apos; for PBUF_REF/PBUF_ROM types</para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>non-zero on failure, zero on success. </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="569" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="569" bodyend="642"/>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1ga2170ccbbb13238380dbb203ee1b85974" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
        <definition>u16_t pbuf_memcmp</definition>
        <argsstring>(const struct pbuf *p, u16_t offset, const void *s2, u16_t n)</argsstring>
        <name>pbuf_memcmp</name>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>offset</declname>
        </param>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> void *</type>
          <declname>s2</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>n</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Compare pbuf contents at specified offset with memory s2, both of length n</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf to compare </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>offset</parametername>
</parameternamelist>
<parameterdescription>
<para>offset into p at which to start comparing </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>s2</parametername>
</parameternamelist>
<parameterdescription>
<para>buffer to compare </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>n</parametername>
</parameternamelist>
<parameterdescription>
<para>length of buffer to compare </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>zero if equal, nonzero otherwise (0xffff if p is too short, diffoffset+1 otherwise) </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="1363" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="1363" bodyend="1390"/>
        <references refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" compoundref="pbuf_8h" startline="159">pbuf::len</references>
        <references refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" compoundref="pbuf_8h" startline="144">pbuf::next</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="group__pbuf_1ga6d803d9945bffb7ad97743f2fa503da6" compoundref="pbuf_8c" startline="1300" endline="1307">pbuf_get_at</references>
        <references refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" compoundref="pbuf_8h" startline="156">pbuf::tot_len</references>
        <referencedby refid="group__pbuf_1ga18c164a6e4a24d89ea9eb7571a886448" compoundref="pbuf_8c" startline="1405" endline="1418">pbuf_memfind</referencedby>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1ga18c164a6e4a24d89ea9eb7571a886448" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
        <definition>u16_t pbuf_memfind</definition>
        <argsstring>(const struct pbuf *p, const void *mem, u16_t mem_len, u16_t start_offset)</argsstring>
        <name>pbuf_memfind</name>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> void *</type>
          <declname>mem</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>mem_len</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>start_offset</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Find occurrence of mem (with length mem_len) in pbuf p, starting at offset start_offset.</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf to search, maximum length is 0xFFFE since 0xFFFF is used as return value &apos;not found&apos; </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>mem</parametername>
</parameternamelist>
<parameterdescription>
<para>search for the contents of this buffer </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>mem_len</parametername>
</parameternamelist>
<parameterdescription>
<para>length of &apos;mem&apos; </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>start_offset</parametername>
</parameternamelist>
<parameterdescription>
<para>offset into p at which to start searching </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>0xFFFF if substr was not found in p or the index where it was found </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="1405" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="1405" bodyend="1418"/>
        <references refid="group__pbuf_1ga2170ccbbb13238380dbb203ee1b85974" compoundref="pbuf_8c" startline="1363" endline="1390">pbuf_memcmp</references>
        <references refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" compoundref="pbuf_8h" startline="156">pbuf::tot_len</references>
        <referencedby refid="pbuf_8c_1a9ba3f7b705309ceadb147692fd5a1c7d" compoundref="pbuf_8c" startline="1432" endline="1443">pbuf_strstr</referencedby>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1gaf76863707dc02993eae116574b1ea03f" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void pbuf_put_at</definition>
        <argsstring>(struct pbuf *p, u16_t offset, u8_t data)</argsstring>
        <name>pbuf_put_at</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>offset</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></type>
          <declname>data</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Put one byte to the specified position in a pbuf WARNING: silently ignores offset &gt;= p-&gt;tot_len</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf to fill </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>offset</parametername>
</parameternamelist>
<parameterdescription>
<para>offset into p of the byte to write </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>data</parametername>
</parameternamelist>
<parameterdescription>
<para>byte to write at an offset into p </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="1340" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="1340" bodyend="1349"/>
        <references refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" compoundref="pbuf_8h" startline="159">pbuf::len</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" compoundref="pbuf_8h" startline="147">pbuf::payload</references>
        <references refid="group__pbuf_1ga6a961522d81f0327aaf4d4ee6d96c583" compoundref="pbuf_8c" startline="1132" endline="1136">pbuf_skip</references>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1ga50abfe830a33a1a47a562febee66015d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void pbuf_realloc</definition>
        <argsstring>(struct pbuf *p, u16_t new_len)</argsstring>
        <name>pbuf_realloc</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>new_len</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Shrink a pbuf chain to a desired length.</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf to shrink. </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>new_len</parametername>
</parameternamelist>
<parameterdescription>
<para>desired new length of pbuf chain</para>
</parameterdescription>
</parameteritem>
</parameterlist>
Depending on the desired length, the first few pbufs in a chain might be skipped and left unchanged. The new last pbuf in the chain will be resized, and any remaining pbufs will be freed.</para>
<para><simplesect kind="note"><para>If the pbuf is ROM/REF, only the -&gt;tot_len and -&gt;len fields are adjusted. </para>
</simplesect>
<simplesect kind="note"><para>May not be called on a packet queue.</para>
</simplesect>
<simplesect kind="note"><para>Despite its name, pbuf_realloc cannot grow the size of a pbuf (chain). </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="493" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="493" bodyend="555"/>
        <references refid="structpbuf_1aa4d1af2cab3d9280d29212095b5b872a" compoundref="pbuf_8h" startline="165">pbuf::flags</references>
        <references refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" compoundref="pbuf_8h" startline="159">pbuf::len</references>
        <references refid="debug_8h_1a94ad086267808462beae2b38f91996ed" compoundref="debug_8h" startline="116">LWIP_ASSERT</references>
        <references refid="pbuf_8h_1a64174c5169b48dc17674324afd9c63b9" compoundref="pbuf_8h" startline="55">LWIP_SUPPORT_CUSTOM_PBUF</references>
        <references refid="mem_8h_1a5e39a108c44d8a72df0b30a117cb62e4" compoundref="mem_8c" startline="478" endline="592">mem_trim</references>
        <references refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" compoundref="pbuf_8h" startline="144">pbuf::next</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" compoundref="pbuf_8h" startline="147">pbuf::payload</references>
        <references refid="pbuf_8h_1af78a7e1815dc0e31884d095b666d997f" compoundref="pbuf_8h" startline="131">PBUF_FLAG_IS_CUSTOM</references>
        <references refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" compoundref="pbuf_8c" startline="715" endline="792">pbuf_free</references>
        <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbae969347127387b9b59a23ccd24b76d21" compoundref="pbuf_8h" startline="123">PBUF_POOL</references>
        <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" compoundref="pbuf_8h" startline="108">PBUF_RAM</references>
        <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac9b6ba960fdea6f2e8f35c8313b77e4e" compoundref="pbuf_8h" startline="116">PBUF_REF</references>
        <references refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac120b0fe39efe35bb682e4aa3b82e2c9" compoundref="pbuf_8h" startline="112">PBUF_ROM</references>
        <references refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" compoundref="pbuf_8h" startline="156">pbuf::tot_len</references>
        <references refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" compoundref="pbuf_8h" startline="162">pbuf::type</references>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1ga77f6bbd69e45e542014d9c547c7da74e" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>void pbuf_ref</definition>
        <argsstring>(struct pbuf *p)</argsstring>
        <name>pbuf_ref</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Increment the reference count of the pbuf.</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf to increase reference counter of </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="821" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="821" bodyend="828"/>
        <references refid="debug_8h_1a94ad086267808462beae2b38f91996ed" compoundref="debug_8h" startline="116">LWIP_ASSERT</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="structpbuf_1a18e2c02942feb1baa3756fcd585b6731" compoundref="pbuf_8h" startline="172">pbuf::ref</references>
        <references refid="sys_8h_1acc5f7f8cbd020de628d1e9a0443da4c7" compoundref="sys_8h" startline="375">SYS_ARCH_INC</references>
        <referencedby refid="group__pbuf_1ga831c9a72bda1d3bd4c7b96f5a0e3b891" compoundref="pbuf_8c" startline="883" endline="889">pbuf_chain</referencedby>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1ga6a961522d81f0327aaf4d4ee6d96c583" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
        <definition>struct pbuf* pbuf_skip</definition>
        <argsstring>(struct pbuf *in, u16_t in_offset, u16_t *out_offset)</argsstring>
        <name>pbuf_skip</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>in</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>in_offset</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref> *</type>
          <declname>out_offset</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Skip a number of bytes at the start of a pbuf</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>in</parametername>
</parameternamelist>
<parameterdescription>
<para>input pbuf </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>in_offset</parametername>
</parameternamelist>
<parameterdescription>
<para>offset to skip </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>out_offset</parametername>
</parameternamelist>
<parameterdescription>
<para>resulting offset in the returned pbuf </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>the pbuf in the queue where the offset is </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="1132" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="1132" bodyend="1136"/>
        <referencedby refid="group__pbuf_1gaf76863707dc02993eae116574b1ea03f" compoundref="pbuf_8c" startline="1340" endline="1349">pbuf_put_at</referencedby>
        <referencedby refid="group__pbuf_1gae1cf2bf7454ff87ff377b0b2262f9b44" compoundref="pbuf_8c" startline="1194" endline="1214">pbuf_take_at</referencedby>
      </memberdef>
      <memberdef kind="function" id="pbuf_8c_1a9b037eb0b8d330d5a72fc86da48feeab" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
        <definition>static const struct pbuf* pbuf_skip_const</definition>
        <argsstring>(const struct pbuf *in, u16_t in_offset, u16_t *out_offset)</argsstring>
        <name>pbuf_skip_const</name>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>in</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>in_offset</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref> *</type>
          <declname>out_offset</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="1106" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="1106" bodyend="1120"/>
      </memberdef>
      <memberdef kind="function" id="pbuf_8c_1a9ba3f7b705309ceadb147692fd5a1c7d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
        <definition>u16_t pbuf_strstr</definition>
        <argsstring>(const struct pbuf *p, const char *substr)</argsstring>
        <name>pbuf_strstr</name>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> char *</type>
          <declname>substr</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Find occurrence of substr with length substr_len in pbuf p, start at offset start_offset WARNING: in contrast to <ref refid="string_8h_1adcec9a82a6a276e8edb0fd4fc26fe8f2" kindref="member">strstr()</ref>, this one does not stop at the first \0 in the pbuf/source string!</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf to search, maximum length is 0xFFFE since 0xFFFF is used as return value &apos;not found&apos; </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>substr</parametername>
</parameternamelist>
<parameterdescription>
<para>string to search for in p, maximum length is 0xFFFE </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>0xFFFF if substr was not found in p or the index where it was found </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="1432" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="1432" bodyend="1443"/>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="group__pbuf_1ga18c164a6e4a24d89ea9eb7571a886448" compoundref="pbuf_8c" startline="1405" endline="1418">pbuf_memfind</references>
        <references refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" compoundref="strlen_8c" startline="55" endline="101">strlen</references>
        <references refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" compoundref="pbuf_8h" startline="156">pbuf::tot_len</references>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1gad1e31e370271335b197272af2724ca85" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></type>
        <definition>err_t pbuf_take</definition>
        <argsstring>(struct pbuf *buf, const void *dataptr, u16_t len)</argsstring>
        <name>pbuf_take</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>buf</declname>
        </param>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> void *</type>
          <declname>dataptr</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>len</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Copy application supplied data into a pbuf. This function can only be used to copy the equivalent of buf-&gt;tot_len data.</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>buf</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf to fill with data </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>dataptr</parametername>
</parameternamelist>
<parameterdescription>
<para>application supplied data buffer </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>len</parametername>
</parameternamelist>
<parameterdescription>
<para>length of the application supplied data buffer</para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>ERR_OK if successful, ERR_MEM if the pbuf is not big enough </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="1150" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="1150" bodyend="1180"/>
        <references refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" compoundref="err_8h" startline="96">ERR_ARG</references>
        <references refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" compoundref="err_8h" startline="65">ERR_MEM</references>
        <references refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" compoundref="err_8h" startline="63">ERR_OK</references>
        <references refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" compoundref="pbuf_8h" startline="159">pbuf::len</references>
        <references refid="debug_8h_1a94ad086267808462beae2b38f91996ed" compoundref="debug_8h" startline="116">LWIP_ASSERT</references>
        <references refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" compoundref="debug_8h" startline="135">LWIP_ERROR</references>
        <references refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" compoundref="lwipopts_8h" startline="43">MEMCPY</references>
        <references refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" compoundref="pbuf_8h" startline="144">pbuf::next</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" compoundref="pbuf_8h" startline="147">pbuf::payload</references>
        <referencedby refid="group__pbuf_1gae1cf2bf7454ff87ff377b0b2262f9b44" compoundref="pbuf_8c" startline="1194" endline="1214">pbuf_take_at</referencedby>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1gae1cf2bf7454ff87ff377b0b2262f9b44" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></type>
        <definition>err_t pbuf_take_at</definition>
        <argsstring>(struct pbuf *buf, const void *dataptr, u16_t len, u16_t offset)</argsstring>
        <name>pbuf_take_at</name>
        <param>
          <type>struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>buf</declname>
        </param>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> void *</type>
          <declname>dataptr</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>len</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>offset</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Same as <ref refid="group__pbuf_1gad1e31e370271335b197272af2724ca85" kindref="member">pbuf_take()</ref> but puts data at an offset</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>buf</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf to fill with data </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>dataptr</parametername>
</parameternamelist>
<parameterdescription>
<para>application supplied data buffer </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>len</parametername>
</parameternamelist>
<parameterdescription>
<para>length of the application supplied data buffer </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>offset</parametername>
</parameternamelist>
<parameterdescription>
<para>offset in pbuf where to copy dataptr to</para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>ERR_OK if successful, ERR_MEM if the pbuf is not big enough </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="1194" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="1194" bodyend="1214"/>
        <references refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" compoundref="err_8h" startline="65">ERR_MEM</references>
        <references refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" compoundref="err_8h" startline="63">ERR_OK</references>
        <references refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" compoundref="pbuf_8h" startline="159">pbuf::len</references>
        <references refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" compoundref="def_8h" startline="55">LWIP_MIN</references>
        <references refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" compoundref="lwipopts_8h" startline="43">MEMCPY</references>
        <references refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" compoundref="pbuf_8h" startline="144">pbuf::next</references>
        <references refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" compoundref="fat__string_8h" startline="17">NULL</references>
        <references refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" compoundref="pbuf_8h" startline="147">pbuf::payload</references>
        <references refid="group__pbuf_1ga6a961522d81f0327aaf4d4ee6d96c583" compoundref="pbuf_8c" startline="1132" endline="1136">pbuf_skip</references>
        <references refid="group__pbuf_1gad1e31e370271335b197272af2724ca85" compoundref="pbuf_8c" startline="1150" endline="1180">pbuf_take</references>
        <references refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" compoundref="pbuf_8h" startline="156">pbuf::tot_len</references>
      </memberdef>
      <memberdef kind="function" id="group__pbuf_1ga839f342803b0cf89049744124c5a98ad" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>int</type>
        <definition>int pbuf_try_get_at</definition>
        <argsstring>(const struct pbuf *p, u16_t offset)</argsstring>
        <name>pbuf_try_get_at</name>
        <param>
          <type><ref refid="cdefs_8h_1a2c212835823e3c54a8ab6d95c652660e" kindref="member">const</ref> struct <ref refid="structpbuf" kindref="compound">pbuf</ref> *</type>
          <declname>p</declname>
        </param>
        <param>
          <type><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></type>
          <declname>offset</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>Get one byte from the specified position in a pbuf</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>p</parametername>
</parameternamelist>
<parameterdescription>
<para>pbuf to parse </para>
</parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>offset</parametername>
</parameternamelist>
<parameterdescription>
<para>offset into p of the byte to return </para>
</parameterdescription>
</parameteritem>
</parameterlist>
<simplesect kind="return"><para>byte at an offset into p [0..0xFF] OR negative if &apos;offset&apos; &gt;= p-&gt;tot_len </para>
</simplesect>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" line="1318" column="1" bodyfile="C:/Dev/git/UbixOS/sys/net/core/pbuf.c" bodystart="1318" bodyend="1328"/>
        <referencedby refid="group__pbuf_1ga6d803d9945bffb7ad97743f2fa503da6" compoundref="pbuf_8c" startline="1300" endline="1307">pbuf_get_at</referencedby>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
<para>Packet buffer management </para>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="80"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="81"><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="82"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="83"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="84"><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="85"><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="86"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="87"><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="88"><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="89"><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="90"><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="91"><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="92"><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="93"><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="94"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="95"><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="96"><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="97"><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="98"><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="99"><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="100"><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="101"><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="102"><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="103"><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="104"><highlight class="comment"><sp/>*<sp/>OF<sp/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="105"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="106"><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="107"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="108"><highlight class="comment"><sp/>*<sp/>Author:<sp/>Adam<sp/>Dunkels<sp/>&lt;adam@sics.se&gt;</highlight></codeline>
<codeline lineno="109"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="110"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="111"><highlight class="normal"></highlight></codeline>
<codeline lineno="112"><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="113"><highlight class="normal"></highlight></codeline>
<codeline lineno="114"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="stats_8h" kindref="compound">net/stats.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="115"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="def_8h" kindref="compound">net/def.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="116"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="mem_8h" kindref="compound">net/mem.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="117"><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="118"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="pbuf_8h" kindref="compound">net/pbuf.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="119"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="sys_8h" kindref="compound">net/sys.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="120"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP<sp/>&amp;&amp;<sp/>TCP_QUEUE_OOSEQ</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="121"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="tcp__priv_8h" kindref="compound">net/priv/tcp_priv.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="122"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="123"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CHECKSUM_ON_COPY</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="124"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="inet__chksum_8h" kindref="compound">net/inet_chksum.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="125"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="126"><highlight class="normal"></highlight></codeline>
<codeline lineno="127"><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="128"><highlight class="normal"></highlight></codeline>
<codeline lineno="129" refid="pbuf_8c_1a8357a994e45ff94c9494aa55b6c3ecb3" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>SIZEOF_STRUCT_PBUF<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>LWIP_MEM_ALIGN_SIZE(sizeof(struct<sp/>pbuf))</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="130"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Since<sp/>the<sp/>pool<sp/>is<sp/>created<sp/>in<sp/>memp,<sp/>PBUF_POOL_BUFSIZE<sp/>will<sp/>be<sp/>automatically</highlight></codeline>
<codeline lineno="131"><highlight class="comment"><sp/><sp/><sp/>aligned<sp/>there.<sp/>Therefore,<sp/>PBUF_POOL_BUFSIZE_ALIGNED<sp/>can<sp/>be<sp/>used<sp/>here.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="132" refid="pbuf_8c_1a3dad81a8286ee8e9a7c70a74f9f4bb0f" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>PBUF_POOL_BUFSIZE_ALIGNED<sp/>LWIP_MEM_ALIGN_SIZE(PBUF_POOL_BUFSIZE)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="133"><highlight class="normal"></highlight></codeline>
<codeline lineno="134"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!LWIP_TCP<sp/>||<sp/>!TCP_QUEUE_OOSEQ<sp/>||<sp/>!PBUF_POOL_FREE_OOSEQ</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="135" refid="pbuf_8c_1aed70c61e971683736c569a1a99b76569" refkind="member"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>PBUF_POOL_IS_EMPTY()</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="136"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>!LWIP_TCP<sp/>||<sp/>!TCP_QUEUE_OOSEQ<sp/>||<sp/>!PBUF_POOL_FREE_OOSEQ<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="137"><highlight class="normal"></highlight></codeline>
<codeline lineno="138"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!NO_SYS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="139"><highlight class="normal"></highlight><highlight class="preprocessor">#ifndef<sp/>PBUF_POOL_FREE_OOSEQ_QUEUE_CALL</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="140"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="tcpip_8h" kindref="compound">net/tcpip.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="141"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>PBUF_POOL_FREE_OOSEQ_QUEUE_CALL()<sp/><sp/>do<sp/>{<sp/>\</highlight></codeline>
<codeline lineno="142"><highlight class="preprocessor"><sp/><sp/>if<sp/>(tcpip_callback_with_block(pbuf_free_ooseq_callback,<sp/>NULL,<sp/>0)<sp/>!=<sp/>ERR_OK)<sp/>{<sp/>\</highlight></codeline>
<codeline lineno="143"><highlight class="preprocessor"><sp/><sp/><sp/><sp/><sp/><sp/>SYS_ARCH_PROTECT(old_level);<sp/>\</highlight></codeline>
<codeline lineno="144"><highlight class="preprocessor"><sp/><sp/><sp/><sp/><sp/><sp/>pbuf_free_ooseq_pending<sp/>=<sp/>0;<sp/>\</highlight></codeline>
<codeline lineno="145"><highlight class="preprocessor"><sp/><sp/><sp/><sp/><sp/><sp/>SYS_ARCH_UNPROTECT(old_level);<sp/>\</highlight></codeline>
<codeline lineno="146"><highlight class="preprocessor"><sp/><sp/>}<sp/>}<sp/>while(0)</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="147"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>PBUF_POOL_FREE_OOSEQ_QUEUE_CALL<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="148"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>!NO_SYS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="149"><highlight class="normal"></highlight></codeline>
<codeline lineno="150"><highlight class="normal"></highlight><highlight class="keyword">volatile</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>pbuf_free_ooseq_pending;</highlight></codeline>
<codeline lineno="151"><highlight class="normal"></highlight><highlight class="preprocessor">#define<sp/>PBUF_POOL_IS_EMPTY()<sp/>pbuf_pool_is_empty()</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="152"><highlight class="normal"></highlight></codeline>
<codeline lineno="161"><highlight class="preprocessor">#if<sp/>!NO_SYS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="162"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="163"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>!NO_SYS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="164"><highlight class="normal"></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="165"><highlight class="normal">pbuf_free_ooseq(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="166"><highlight class="normal">{</highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">tcp_pcb*<sp/>pcb;</highlight></codeline>
<codeline lineno="168"><highlight class="normal"><sp/><sp/><ref refid="sys_8h_1a24ff55288a4d9fa28100c78b2f4612f6" kindref="member">SYS_ARCH_SET</ref>(pbuf_free_ooseq_pending,<sp/>0);</highlight></codeline>
<codeline lineno="169"><highlight class="normal"></highlight></codeline>
<codeline lineno="170"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(pcb<sp/>=<sp/>tcp_active_pcbs;<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>!=<sp/>pcb;<sp/>pcb<sp/>=<sp/>pcb-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>!=<sp/>pcb-&gt;ooseq)<sp/>{</highlight></codeline>
<codeline lineno="173"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_free_ooseq:<sp/>freeing<sp/>out-of-sequence<sp/>pbufs\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tcp_segs_free(pcb-&gt;ooseq);</highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>pcb-&gt;ooseq<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="176"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="179"><highlight class="normal">}</highlight></codeline>
<codeline lineno="180"><highlight class="normal"></highlight></codeline>
<codeline lineno="181"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>!NO_SYS</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="182"><highlight class="normal"></highlight></codeline>
<codeline lineno="185"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="186"><highlight class="normal">pbuf_free_ooseq_callback(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*arg)</highlight></codeline>
<codeline lineno="187"><highlight class="normal">{</highlight></codeline>
<codeline lineno="188"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(arg);</highlight></codeline>
<codeline lineno="189"><highlight class="normal"><sp/><sp/>pbuf_free_ooseq();</highlight></codeline>
<codeline lineno="190"><highlight class="normal">}</highlight></codeline>
<codeline lineno="191"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>!NO_SYS<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="192"><highlight class="normal"></highlight></codeline>
<codeline lineno="194"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="195"><highlight class="normal">pbuf_pool_is_empty(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="196"><highlight class="normal">{</highlight></codeline>
<codeline lineno="197"><highlight class="normal"></highlight><highlight class="preprocessor">#ifndef<sp/>PBUF_POOL_FREE_OOSEQ_QUEUE_CALL</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="198"><highlight class="normal"><sp/><sp/><ref refid="sys_8h_1a24ff55288a4d9fa28100c78b2f4612f6" kindref="member">SYS_ARCH_SET</ref>(pbuf_free_ooseq_pending,<sp/>1);</highlight></codeline>
<codeline lineno="199"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>PBUF_POOL_FREE_OOSEQ_QUEUE_CALL<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>queued;</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/><ref refid="sys_8h_1a945395fa326214fc9736487242710a90" kindref="member">SYS_ARCH_DECL_PROTECT</ref>(old_level);</highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/><ref refid="sys_8h_1a3d0e48feafd378e9c26c64567ecd8bab" kindref="member">SYS_ARCH_PROTECT</ref>(old_level);</highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/>queued<sp/>=<sp/>pbuf_free_ooseq_pending;</highlight></codeline>
<codeline lineno="204"><highlight class="normal"><sp/><sp/>pbuf_free_ooseq_pending<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/><ref refid="sys_8h_1a2f48e97047945642ddeb27e65bf4ffe2" kindref="member">SYS_ARCH_UNPROTECT</ref>(old_level);</highlight></codeline>
<codeline lineno="206"><highlight class="normal"></highlight></codeline>
<codeline lineno="207"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!queued)<sp/>{</highlight></codeline>
<codeline lineno="208"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>queue<sp/>a<sp/>call<sp/>to<sp/>pbuf_free_ooseq<sp/>if<sp/>not<sp/>already<sp/>queued<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="209"><highlight class="normal"><sp/><sp/><sp/><sp/>PBUF_POOL_FREE_OOSEQ_QUEUE_CALL();</highlight></codeline>
<codeline lineno="210"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="211"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>PBUF_POOL_FREE_OOSEQ_QUEUE_CALL<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="212"><highlight class="normal">}</highlight></codeline>
<codeline lineno="213"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>!LWIP_TCP<sp/>||<sp/>!TCP_QUEUE_OOSEQ<sp/>||<sp/>!PBUF_POOL_FREE_OOSEQ<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="214"><highlight class="normal"></highlight></codeline>
<codeline lineno="247"><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*</highlight></codeline>
<codeline lineno="248" refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1gaee1baa59bb2f85ba575b5a8619ac1ebf" kindref="member">pbuf_layer</ref><sp/>layer,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>length,<sp/><ref refid="group__pbuf_1gab7e0e32fcc292c0d7107721766ed92fb" kindref="member">pbuf_type</ref><sp/><ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref>)</highlight></codeline>
<codeline lineno="249"><highlight class="normal">{</highlight></codeline>
<codeline lineno="250"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/>*q,<sp/>*r;</highlight></codeline>
<codeline lineno="251"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset;</highlight></codeline>
<codeline lineno="252"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga10f9a3d7baef58ccc23228c3bd29c1fb" kindref="member">s32_t</ref><sp/>rem_len;<sp/></highlight><highlight class="comment">/*<sp/>remaining<sp/>length<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="253"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_alloc(length=%&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/>length));</highlight></codeline>
<codeline lineno="254"><highlight class="normal"></highlight></codeline>
<codeline lineno="255"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>determine<sp/>header<sp/>offset<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="256"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(layer)<sp/>{</highlight></codeline>
<codeline lineno="257"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa2ded3594a3977f8bf9cf09552be327b5" kindref="member">PBUF_TRANSPORT</ref>:</highlight></codeline>
<codeline lineno="258"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>add<sp/>room<sp/>for<sp/>transport<sp/>(often<sp/>TCP)<sp/>layer<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="259"><highlight class="normal"><sp/><sp/><sp/><sp/>offset<sp/>=<sp/><ref refid="lwipopts_8h_1a6e1ba1875ae5168a17b53d83597bc1de" kindref="member">PBUF_LINK_ENCAPSULATION_HLEN</ref><sp/>+<sp/><ref refid="lwipopts_8h_1a35998a3d56af9940e6a80bb372597685" kindref="member">PBUF_LINK_HLEN</ref><sp/>+<sp/><ref refid="pbuf_8h_1aae0fea237167bb06ea4dc5333df5b0a7" kindref="member">PBUF_IP_HLEN</ref><sp/>+<sp/><ref refid="pbuf_8h_1af9da2e1ca60dc0c584938ccc5d662307" kindref="member">PBUF_TRANSPORT_HLEN</ref>;</highlight></codeline>
<codeline lineno="260"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="261"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfafcc1e506061ba69dfa142eb6b3da5f13" kindref="member">PBUF_IP</ref>:</highlight></codeline>
<codeline lineno="262"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>add<sp/>room<sp/>for<sp/>IP<sp/>layer<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="263"><highlight class="normal"><sp/><sp/><sp/><sp/>offset<sp/>=<sp/><ref refid="lwipopts_8h_1a6e1ba1875ae5168a17b53d83597bc1de" kindref="member">PBUF_LINK_ENCAPSULATION_HLEN</ref><sp/>+<sp/><ref refid="lwipopts_8h_1a35998a3d56af9940e6a80bb372597685" kindref="member">PBUF_LINK_HLEN</ref><sp/>+<sp/><ref refid="pbuf_8h_1aae0fea237167bb06ea4dc5333df5b0a7" kindref="member">PBUF_IP_HLEN</ref>;</highlight></codeline>
<codeline lineno="264"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="265"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfab4de441e737330558b609a990cd17346" kindref="member">PBUF_LINK</ref>:</highlight></codeline>
<codeline lineno="266"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>add<sp/>room<sp/>for<sp/>link<sp/>layer<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="267"><highlight class="normal"><sp/><sp/><sp/><sp/>offset<sp/>=<sp/><ref refid="lwipopts_8h_1a6e1ba1875ae5168a17b53d83597bc1de" kindref="member">PBUF_LINK_ENCAPSULATION_HLEN</ref><sp/>+<sp/><ref refid="lwipopts_8h_1a35998a3d56af9940e6a80bb372597685" kindref="member">PBUF_LINK_HLEN</ref>;</highlight></codeline>
<codeline lineno="268"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="269"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa0ff039585f05f9208bcb66c2d37783e2" kindref="member">PBUF_RAW_TX</ref>:</highlight></codeline>
<codeline lineno="270"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>add<sp/>room<sp/>for<sp/>encapsulating<sp/>link<sp/>layer<sp/>headers<sp/>(e.g.<sp/>802.11)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/><sp/><sp/>offset<sp/>=<sp/><ref refid="lwipopts_8h_1a6e1ba1875ae5168a17b53d83597bc1de" kindref="member">PBUF_LINK_ENCAPSULATION_HLEN</ref>;</highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa21116654fbab6d5a4dfeb87a1bb8f0ba" kindref="member">PBUF_RAW</ref>:</highlight></codeline>
<codeline lineno="274"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>no<sp/>offset<sp/>(e.g.<sp/>RX<sp/>buffers<sp/>or<sp/>chain<sp/>successors)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/><sp/><sp/>offset<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_alloc:<sp/>bad<sp/>pbuf<sp/>layer&quot;</highlight><highlight class="normal">,<sp/>0);</highlight></codeline>
<codeline lineno="279"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="280"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="281"><highlight class="normal"></highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref>)<sp/>{</highlight></codeline>
<codeline lineno="283"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbae969347127387b9b59a23ccd24b76d21" kindref="member">PBUF_POOL</ref>:</highlight></codeline>
<codeline lineno="284"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>allocate<sp/>head<sp/>of<sp/>pbuf<sp/>chain<sp/>into<sp/>p<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="285"><highlight class="normal"><sp/><sp/><sp/><sp/>p<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_PBUF_POOL);</highlight></codeline>
<codeline lineno="286"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_alloc:<sp/>allocated<sp/>pbuf<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)p));</highlight></codeline>
<codeline lineno="287"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="288"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="pbuf_8c_1aed70c61e971683736c569a1a99b76569" kindref="member">PBUF_POOL_IS_EMPTY</ref>();</highlight></codeline>
<codeline lineno="289"><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="290"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="291"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;type<sp/>=<sp/><ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="292"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;next<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="293"><highlight class="normal"></highlight></codeline>
<codeline lineno="294"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>make<sp/>the<sp/>payload<sp/>pointer<sp/>point<sp/>&apos;offset&apos;<sp/>bytes<sp/>into<sp/>pbuf<sp/>data<sp/>memory<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="295"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;payload<sp/>=<sp/><ref refid="group__compiler__abstraction_1gaa8e8724eb1c220cbbb90de9e175ce1dc" kindref="member">LWIP_MEM_ALIGN</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)p<sp/>+<sp/>(<ref refid="pbuf_8c_1a8357a994e45ff94c9494aa55b6c3ecb3" kindref="member">SIZEOF_STRUCT_PBUF</ref><sp/>+<sp/>offset)));</highlight></codeline>
<codeline lineno="296"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_alloc:<sp/>pbuf<sp/>p-&gt;payload<sp/>properly<sp/>aligned&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>((<ref refid="group__compiler__abstraction_1gaf019cbb71af10dcfda7758b21e655307" kindref="member">mem_ptr_t</ref>)p-&gt;payload<sp/>%<sp/><ref refid="lwipopts_8h_1a97343214666ee6dcb18c0bd77b441ea7" kindref="member">MEM_ALIGNMENT</ref>)<sp/>==<sp/>0);</highlight></codeline>
<codeline lineno="298"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>the<sp/>total<sp/>length<sp/>of<sp/>the<sp/>pbuf<sp/>chain<sp/>is<sp/>the<sp/>requested<sp/>size<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="299"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;tot_len<sp/>=<sp/>length;</highlight></codeline>
<codeline lineno="300"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>the<sp/>length<sp/>of<sp/>the<sp/>first<sp/>pbuf<sp/>in<sp/>the<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;len<sp/>=<sp/><ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>(length,<sp/><ref refid="pbuf_8c_1a3dad81a8286ee8e9a7c70a74f9f4bb0f" kindref="member">PBUF_POOL_BUFSIZE_ALIGNED</ref><sp/>-<sp/><ref refid="group__compiler__abstraction_1gaef204be511fd32f681b55abc08e9ae18" kindref="member">LWIP_MEM_ALIGN_SIZE</ref>(offset));</highlight></codeline>
<codeline lineno="302"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;check<sp/>p-&gt;payload<sp/>+<sp/>p-&gt;len<sp/>does<sp/>not<sp/>overflow<sp/>pbuf&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="303"><highlight class="normal"><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>*)p-&gt;payload<sp/>+<sp/>p-&gt;len<sp/>&lt;=</highlight></codeline>
<codeline lineno="304"><highlight class="normal"><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>*)p<sp/>+<sp/><ref refid="pbuf_8c_1a8357a994e45ff94c9494aa55b6c3ecb3" kindref="member">SIZEOF_STRUCT_PBUF</ref><sp/>+<sp/><ref refid="pbuf_8c_1a3dad81a8286ee8e9a7c70a74f9f4bb0f" kindref="member">PBUF_POOL_BUFSIZE_ALIGNED</ref>));</highlight></codeline>
<codeline lineno="305"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;PBUF_POOL_BUFSIZE<sp/>must<sp/>be<sp/>bigger<sp/>than<sp/>MEM_ALIGNMENT&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="306"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="pbuf_8c_1a3dad81a8286ee8e9a7c70a74f9f4bb0f" kindref="member">PBUF_POOL_BUFSIZE_ALIGNED</ref><sp/>-<sp/><ref refid="group__compiler__abstraction_1gaef204be511fd32f681b55abc08e9ae18" kindref="member">LWIP_MEM_ALIGN_SIZE</ref>(offset))<sp/>&gt;<sp/>0<sp/>);</highlight></codeline>
<codeline lineno="307"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>reference<sp/>count<sp/>(needed<sp/>here<sp/>in<sp/>case<sp/>we<sp/>fail)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;ref<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="309"><highlight class="normal"></highlight></codeline>
<codeline lineno="310"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>now<sp/>allocate<sp/>the<sp/>tail<sp/>of<sp/>the<sp/>pbuf<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="311"><highlight class="normal"></highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>first<sp/>pbuf<sp/>for<sp/>linkage<sp/>in<sp/>next<sp/>iteration<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="313"><highlight class="normal"><sp/><sp/><sp/><sp/>r<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="314"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remaining<sp/>length<sp/>to<sp/>be<sp/>allocated<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="315"><highlight class="normal"><sp/><sp/><sp/><sp/>rem_len<sp/>=<sp/>length<sp/>-<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="316"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>any<sp/>remaining<sp/>pbufs<sp/>to<sp/>be<sp/>allocated?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="317"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(rem_len<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="318"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>q<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_PBUF_POOL);</highlight></codeline>
<codeline lineno="319"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(q<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="320"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="pbuf_8c_1aed70c61e971683736c569a1a99b76569" kindref="member">PBUF_POOL_IS_EMPTY</ref>();</highlight></codeline>
<codeline lineno="321"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>free<sp/>chain<sp/>so<sp/>far<sp/>allocated<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="322"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="323"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>bail<sp/>out<sp/>unsuccessfully<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="324"><highlight class="normal"><sp/><sp/><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="325"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>q-&gt;<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>=<sp/><ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>q-&gt;<ref refid="structpbuf_1aa4d1af2cab3d9280d29212095b5b872a" kindref="member">flags</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="328"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="329"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>make<sp/>previous<sp/>pbuf<sp/>point<sp/>to<sp/>this<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="330"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>r-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>=<sp/>q;</highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>total<sp/>length<sp/>of<sp/>this<sp/>pbuf<sp/>and<sp/>next<sp/>in<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;rem_len<sp/>&lt;<sp/>max_u16_t&quot;</highlight><highlight class="normal">,<sp/>rem_len<sp/>&lt;<sp/>0xffff);</highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>q-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)rem_len;</highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>pbuf<sp/>length<sp/>is<sp/>pool<sp/>size,<sp/>unless<sp/>smaller<sp/>sized<sp/>tail<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="335"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>=<sp/><ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>((<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)rem_len,<sp/><ref refid="pbuf_8c_1a3dad81a8286ee8e9a7c70a74f9f4bb0f" kindref="member">PBUF_POOL_BUFSIZE_ALIGNED</ref>);</highlight></codeline>
<codeline lineno="336"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>q-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>=<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)q<sp/>+<sp/><ref refid="pbuf_8c_1a8357a994e45ff94c9494aa55b6c3ecb3" kindref="member">SIZEOF_STRUCT_PBUF</ref>);</highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_alloc:<sp/>pbuf<sp/>q-&gt;payload<sp/>properly<sp/>aligned&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="338"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>((<ref refid="group__compiler__abstraction_1gaf019cbb71af10dcfda7758b21e655307" kindref="member">mem_ptr_t</ref>)q-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>%<sp/><ref refid="lwipopts_8h_1a97343214666ee6dcb18c0bd77b441ea7" kindref="member">MEM_ALIGNMENT</ref>)<sp/>==<sp/>0);</highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;check<sp/>p-&gt;payload<sp/>+<sp/>p-&gt;len<sp/>does<sp/>not<sp/>overflow<sp/>pbuf&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="340"><highlight class="normal"><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>*)p-&gt;payload<sp/>+<sp/>p-&gt;len<sp/>&lt;=</highlight></codeline>
<codeline lineno="341"><highlight class="normal"><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>*)p<sp/>+<sp/><ref refid="pbuf_8c_1a8357a994e45ff94c9494aa55b6c3ecb3" kindref="member">SIZEOF_STRUCT_PBUF</ref><sp/>+<sp/><ref refid="pbuf_8c_1a3dad81a8286ee8e9a7c70a74f9f4bb0f" kindref="member">PBUF_POOL_BUFSIZE_ALIGNED</ref>));</highlight></codeline>
<codeline lineno="342"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>q-&gt;<ref refid="structpbuf_1a18e2c02942feb1baa3756fcd585b6731" kindref="member">ref</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="343"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>calculate<sp/>remaining<sp/>length<sp/>to<sp/>be<sp/>allocated<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="344"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>rem_len<sp/>-=<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="345"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>this<sp/>pbuf<sp/>for<sp/>linkage<sp/>in<sp/>next<sp/>iteration<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="346"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>r<sp/>=<sp/>q;</highlight></codeline>
<codeline lineno="347"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="348"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>end<sp/>of<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="349"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*r-&gt;next<sp/>=<sp/>NULL;*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="350"><highlight class="normal"></highlight></codeline>
<codeline lineno="351"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="352"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>:</highlight></codeline>
<codeline lineno="353"><highlight class="normal"><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="mem_8h_1a49bff6e5dd4cb95fe6dc0670962bbf54" kindref="member">mem_size_t</ref><sp/>alloc_len<sp/>=<sp/><ref refid="group__compiler__abstraction_1gaef204be511fd32f681b55abc08e9ae18" kindref="member">LWIP_MEM_ALIGN_SIZE</ref>(<ref refid="pbuf_8c_1a8357a994e45ff94c9494aa55b6c3ecb3" kindref="member">SIZEOF_STRUCT_PBUF</ref><sp/>+<sp/>offset)<sp/>+<sp/><ref refid="group__compiler__abstraction_1gaef204be511fd32f681b55abc08e9ae18" kindref="member">LWIP_MEM_ALIGN_SIZE</ref>(length);</highlight></codeline>
<codeline lineno="355"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="356"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>bug<sp/>#50040:<sp/>Check<sp/>for<sp/>integer<sp/>overflow<sp/>when<sp/>calculating<sp/>alloc_len<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(alloc_len<sp/>&lt;<sp/><ref refid="group__compiler__abstraction_1gaef204be511fd32f681b55abc08e9ae18" kindref="member">LWIP_MEM_ALIGN_SIZE</ref>(length))<sp/>{</highlight></codeline>
<codeline lineno="358"><highlight class="normal"><sp/><sp/><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="359"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="361"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>pbuf<sp/>is<sp/>to<sp/>be<sp/>allocated<sp/>in<sp/>RAM,<sp/>allocate<sp/>memory<sp/>for<sp/>it.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>p<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref>*)<ref refid="mem_8h_1a932aa40d85b14cb7331625e012d12335" kindref="member">mem_malloc</ref>(alloc_len);</highlight></codeline>
<codeline lineno="363"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="364"><highlight class="normal"></highlight></codeline>
<codeline lineno="365"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="366"><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="367"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Set<sp/>up<sp/>internal<sp/>structure<sp/>of<sp/>the<sp/>pbuf.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="369"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;payload<sp/>=<sp/><ref refid="group__compiler__abstraction_1gaa8e8724eb1c220cbbb90de9e175ce1dc" kindref="member">LWIP_MEM_ALIGN</ref>((</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)p<sp/>+<sp/><ref refid="pbuf_8c_1a8357a994e45ff94c9494aa55b6c3ecb3" kindref="member">SIZEOF_STRUCT_PBUF</ref><sp/>+<sp/>offset));</highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;len<sp/>=<sp/>p-&gt;tot_len<sp/>=<sp/>length;</highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;next<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="372"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;type<sp/>=<sp/><ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="373"><highlight class="normal"></highlight></codeline>
<codeline lineno="374"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_alloc:<sp/>pbuf-&gt;payload<sp/>properly<sp/>aligned&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="375"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>((<ref refid="group__compiler__abstraction_1gaf019cbb71af10dcfda7758b21e655307" kindref="member">mem_ptr_t</ref>)p-&gt;payload<sp/>%<sp/><ref refid="lwipopts_8h_1a97343214666ee6dcb18c0bd77b441ea7" kindref="member">MEM_ALIGNMENT</ref>)<sp/>==<sp/>0);</highlight></codeline>
<codeline lineno="376"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="377"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>pbuf<sp/>references<sp/>existing<sp/>(non-volatile<sp/>static<sp/>constant)<sp/>ROM<sp/>payload?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="378"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac120b0fe39efe35bb682e4aa3b82e2c9" kindref="member">PBUF_ROM</ref>:</highlight></codeline>
<codeline lineno="379"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>pbuf<sp/>references<sp/>existing<sp/>(externally<sp/>allocated)<sp/>RAM<sp/>payload?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="380"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac9b6ba960fdea6f2e8f35c8313b77e4e" kindref="member">PBUF_REF</ref>:</highlight></codeline>
<codeline lineno="381"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>only<sp/>allocate<sp/>memory<sp/>for<sp/>the<sp/>pbuf<sp/>structure<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="382"><highlight class="normal"><sp/><sp/><sp/><sp/>p<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_PBUF);</highlight></codeline>
<codeline lineno="383"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="384"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,</highlight></codeline>
<codeline lineno="385"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_alloc:<sp/>Could<sp/>not<sp/>allocate<sp/>MEMP_PBUF<sp/>for<sp/>PBUF_%s.\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="386"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac120b0fe39efe35bb682e4aa3b82e2c9" kindref="member">PBUF_ROM</ref>)<sp/>?<sp/></highlight><highlight class="stringliteral">&quot;ROM&quot;</highlight><highlight class="normal"><sp/>:<sp/></highlight><highlight class="stringliteral">&quot;REF&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="387"><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="388"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="389"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>caller<sp/>must<sp/>set<sp/>this<sp/>field<sp/>properly,<sp/>afterwards<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="390"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;payload<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;len<sp/>=<sp/>p-&gt;tot_len<sp/>=<sp/>length;</highlight></codeline>
<codeline lineno="392"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;next<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="393"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;type<sp/>=<sp/><ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="395"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="396"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_alloc:<sp/>erroneous<sp/>type&quot;</highlight><highlight class="normal">,<sp/>0);</highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="398"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="399"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>reference<sp/>count<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="400"><highlight class="normal"><sp/><sp/>p-&gt;<ref refid="structpbuf_1a18e2c02942feb1baa3756fcd585b6731" kindref="member">ref</ref><sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>flags<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/>p-&gt;<ref refid="structpbuf_1aa4d1af2cab3d9280d29212095b5b872a" kindref="member">flags</ref><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="403"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_alloc(length=%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;)<sp/>==<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>length,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)p));</highlight></codeline>
<codeline lineno="404"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>p;</highlight></codeline>
<codeline lineno="405"><highlight class="normal">}</highlight></codeline>
<codeline lineno="406"><highlight class="normal"></highlight></codeline>
<codeline lineno="407"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_SUPPORT_CUSTOM_PBUF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="408"><highlight class="normal"></highlight></codeline>
<codeline lineno="424"><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref>*</highlight></codeline>
<codeline lineno="425"><highlight class="normal">pbuf_alloced_custom(<ref refid="group__pbuf_1gaee1baa59bb2f85ba575b5a8619ac1ebf" kindref="member">pbuf_layer</ref><sp/>l,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>length,<sp/><ref refid="group__pbuf_1gab7e0e32fcc292c0d7107721766ed92fb" kindref="member">pbuf_type</ref><sp/><ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>pbuf_custom<sp/>*p,</highlight></codeline>
<codeline lineno="426"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*payload_mem,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>payload_mem_len)</highlight></codeline>
<codeline lineno="427"><highlight class="normal">{</highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset;</highlight></codeline>
<codeline lineno="429"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_alloced_custom(length=%&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/>length));</highlight></codeline>
<codeline lineno="430"><highlight class="normal"></highlight></codeline>
<codeline lineno="431"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>determine<sp/>header<sp/>offset<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(l)<sp/>{</highlight></codeline>
<codeline lineno="433"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa2ded3594a3977f8bf9cf09552be327b5" kindref="member">PBUF_TRANSPORT</ref>:</highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>add<sp/>room<sp/>for<sp/>transport<sp/>(often<sp/>TCP)<sp/>layer<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="435"><highlight class="normal"><sp/><sp/><sp/><sp/>offset<sp/>=<sp/><ref refid="lwipopts_8h_1a6e1ba1875ae5168a17b53d83597bc1de" kindref="member">PBUF_LINK_ENCAPSULATION_HLEN</ref><sp/>+<sp/><ref refid="lwipopts_8h_1a35998a3d56af9940e6a80bb372597685" kindref="member">PBUF_LINK_HLEN</ref><sp/>+<sp/><ref refid="pbuf_8h_1aae0fea237167bb06ea4dc5333df5b0a7" kindref="member">PBUF_IP_HLEN</ref><sp/>+<sp/><ref refid="pbuf_8h_1af9da2e1ca60dc0c584938ccc5d662307" kindref="member">PBUF_TRANSPORT_HLEN</ref>;</highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfafcc1e506061ba69dfa142eb6b3da5f13" kindref="member">PBUF_IP</ref>:</highlight></codeline>
<codeline lineno="438"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>add<sp/>room<sp/>for<sp/>IP<sp/>layer<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="439"><highlight class="normal"><sp/><sp/><sp/><sp/>offset<sp/>=<sp/><ref refid="lwipopts_8h_1a6e1ba1875ae5168a17b53d83597bc1de" kindref="member">PBUF_LINK_ENCAPSULATION_HLEN</ref><sp/>+<sp/><ref refid="lwipopts_8h_1a35998a3d56af9940e6a80bb372597685" kindref="member">PBUF_LINK_HLEN</ref><sp/>+<sp/><ref refid="pbuf_8h_1aae0fea237167bb06ea4dc5333df5b0a7" kindref="member">PBUF_IP_HLEN</ref>;</highlight></codeline>
<codeline lineno="440"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="441"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfab4de441e737330558b609a990cd17346" kindref="member">PBUF_LINK</ref>:</highlight></codeline>
<codeline lineno="442"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>add<sp/>room<sp/>for<sp/>link<sp/>layer<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="443"><highlight class="normal"><sp/><sp/><sp/><sp/>offset<sp/>=<sp/><ref refid="lwipopts_8h_1a6e1ba1875ae5168a17b53d83597bc1de" kindref="member">PBUF_LINK_ENCAPSULATION_HLEN</ref><sp/>+<sp/><ref refid="lwipopts_8h_1a35998a3d56af9940e6a80bb372597685" kindref="member">PBUF_LINK_HLEN</ref>;</highlight></codeline>
<codeline lineno="444"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="445"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa0ff039585f05f9208bcb66c2d37783e2" kindref="member">PBUF_RAW_TX</ref>:</highlight></codeline>
<codeline lineno="446"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>add<sp/>room<sp/>for<sp/>encapsulating<sp/>link<sp/>layer<sp/>headers<sp/>(e.g.<sp/>802.11)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="447"><highlight class="normal"><sp/><sp/><sp/><sp/>offset<sp/>=<sp/><ref refid="lwipopts_8h_1a6e1ba1875ae5168a17b53d83597bc1de" kindref="member">PBUF_LINK_ENCAPSULATION_HLEN</ref>;</highlight></codeline>
<codeline lineno="448"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="449"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa21116654fbab6d5a4dfeb87a1bb8f0ba" kindref="member">PBUF_RAW</ref>:</highlight></codeline>
<codeline lineno="450"><highlight class="normal"><sp/><sp/><sp/><sp/>offset<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="453"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_alloced_custom:<sp/>bad<sp/>pbuf<sp/>layer&quot;</highlight><highlight class="normal">,<sp/>0);</highlight></codeline>
<codeline lineno="454"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="455"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="456"><highlight class="normal"></highlight></codeline>
<codeline lineno="457"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="group__compiler__abstraction_1gaef204be511fd32f681b55abc08e9ae18" kindref="member">LWIP_MEM_ALIGN_SIZE</ref>(offset)<sp/>+<sp/>length<sp/>&gt;<sp/>payload_mem_len)<sp/>{</highlight></codeline>
<codeline lineno="458"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga77c491e468bf7d9a1bc48430c1866a96" kindref="member">LWIP_DBG_LEVEL_WARNING</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_alloced_custom(length=%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;)<sp/>buffer<sp/>too<sp/>short\n&quot;</highlight><highlight class="normal">,<sp/>length));</highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="460"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="461"><highlight class="normal"></highlight></codeline>
<codeline lineno="462"><highlight class="normal"><sp/><sp/>p-&gt;pbuf.next<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="463"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(payload_mem<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="464"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;pbuf.payload<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)payload_mem<sp/>+<sp/><ref refid="group__compiler__abstraction_1gaef204be511fd32f681b55abc08e9ae18" kindref="member">LWIP_MEM_ALIGN_SIZE</ref>(offset);</highlight></codeline>
<codeline lineno="465"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="466"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;pbuf.payload<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="467"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="468"><highlight class="normal"><sp/><sp/>p-&gt;pbuf.flags<sp/>=<sp/><ref refid="pbuf_8h_1af78a7e1815dc0e31884d095b666d997f" kindref="member">PBUF_FLAG_IS_CUSTOM</ref>;</highlight></codeline>
<codeline lineno="469"><highlight class="normal"><sp/><sp/>p-&gt;pbuf.len<sp/>=<sp/>p-&gt;pbuf.tot_len<sp/>=<sp/>length;</highlight></codeline>
<codeline lineno="470"><highlight class="normal"><sp/><sp/>p-&gt;pbuf.type<sp/>=<sp/><ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="471"><highlight class="normal"><sp/><sp/>p-&gt;pbuf.ref<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="472"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>&amp;p-&gt;pbuf;</highlight></codeline>
<codeline lineno="473"><highlight class="normal">}</highlight></codeline>
<codeline lineno="474"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_SUPPORT_CUSTOM_PBUF<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="475"><highlight class="normal"></highlight></codeline>
<codeline lineno="492"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="493" refid="group__pbuf_1ga50abfe830a33a1a47a562febee66015d" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1ga50abfe830a33a1a47a562febee66015d" kindref="member">pbuf_realloc</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>new_len)</highlight></codeline>
<codeline lineno="494"><highlight class="normal">{</highlight></codeline>
<codeline lineno="495"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*q;</highlight></codeline>
<codeline lineno="496"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>rem_len;<sp/></highlight><highlight class="comment">/*<sp/>remaining<sp/>length<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="497"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga10f9a3d7baef58ccc23228c3bd29c1fb" kindref="member">s32_t</ref><sp/>grow;</highlight></codeline>
<codeline lineno="498"><highlight class="normal"></highlight></codeline>
<codeline lineno="499"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_realloc:<sp/>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="500"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_realloc:<sp/>sane<sp/>p-&gt;type&quot;</highlight><highlight class="normal">,<sp/>p-&gt;<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbae969347127387b9b59a23ccd24b76d21" kindref="member">PBUF_POOL</ref><sp/>||</highlight></codeline>
<codeline lineno="501"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac120b0fe39efe35bb682e4aa3b82e2c9" kindref="member">PBUF_ROM</ref><sp/>||</highlight></codeline>
<codeline lineno="502"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref><sp/>||</highlight></codeline>
<codeline lineno="503"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac9b6ba960fdea6f2e8f35c8313b77e4e" kindref="member">PBUF_REF</ref>);</highlight></codeline>
<codeline lineno="504"><highlight class="normal"></highlight></codeline>
<codeline lineno="505"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>desired<sp/>length<sp/>larger<sp/>than<sp/>current<sp/>length?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="506"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(new_len<sp/>&gt;=<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>)<sp/>{</highlight></codeline>
<codeline lineno="507"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>enlarging<sp/>not<sp/>yet<sp/>supported<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">;</highlight></codeline>
<codeline lineno="509"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="510"><highlight class="normal"></highlight></codeline>
<codeline lineno="511"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>the<sp/>pbuf<sp/>chain<sp/>grows<sp/>by<sp/>(new_len<sp/>-<sp/>p-&gt;tot_len)<sp/>bytes</highlight></codeline>
<codeline lineno="512"><highlight class="comment"><sp/><sp/><sp/>*<sp/>(which<sp/>may<sp/>be<sp/>negative<sp/>in<sp/>case<sp/>of<sp/>shrinking)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="513"><highlight class="normal"><sp/><sp/>grow<sp/>=<sp/>new_len<sp/>-<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>;</highlight></codeline>
<codeline lineno="514"><highlight class="normal"></highlight></codeline>
<codeline lineno="515"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>first,<sp/>step<sp/>over<sp/>any<sp/>pbufs<sp/>that<sp/>should<sp/>remain<sp/>in<sp/>the<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="516"><highlight class="normal"><sp/><sp/>rem_len<sp/>=<sp/>new_len;</highlight></codeline>
<codeline lineno="517"><highlight class="normal"><sp/><sp/>q<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="518"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>should<sp/>this<sp/>pbuf<sp/>be<sp/>kept?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="519"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(rem_len<sp/>&gt;<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>)<sp/>{</highlight></codeline>
<codeline lineno="520"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>decrease<sp/>remaining<sp/>length<sp/>by<sp/>pbuf<sp/>length<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="521"><highlight class="normal"><sp/><sp/><sp/><sp/>rem_len<sp/>-=<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="522"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>decrease<sp/>total<sp/>length<sp/>indicator<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="523"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;grow<sp/>&lt;<sp/>max_u16_t&quot;</highlight><highlight class="normal">,<sp/>grow<sp/>&lt;<sp/>0xffff);</highlight></codeline>
<codeline lineno="524"><highlight class="normal"><sp/><sp/><sp/><sp/>q-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>+=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)grow;</highlight></codeline>
<codeline lineno="525"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>proceed<sp/>to<sp/>next<sp/>pbuf<sp/>in<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="526"><highlight class="normal"><sp/><sp/><sp/><sp/>q<sp/>=<sp/>q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="527"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_realloc:<sp/>q<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="528"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="529"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>we<sp/>have<sp/>now<sp/>reached<sp/>the<sp/>new<sp/>last<sp/>pbuf<sp/>(in<sp/>q)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="530"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>rem_len<sp/>==<sp/>desired<sp/>length<sp/>for<sp/>pbuf<sp/>q<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="531"><highlight class="normal"></highlight></codeline>
<codeline lineno="532"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>shrink<sp/>allocated<sp/>memory<sp/>for<sp/>PBUF_RAM<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="533"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>(other<sp/>types<sp/>merely<sp/>adjust<sp/>their<sp/>length<sp/>fields<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="534"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((q-&gt;<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>)<sp/>&amp;&amp;<sp/>(rem_len<sp/>!=<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>)</highlight></codeline>
<codeline lineno="535"><highlight class="normal">#</highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/><ref refid="pbuf_8h_1a64174c5169b48dc17674324afd9c63b9" kindref="member">LWIP_SUPPORT_CUSTOM_PBUF</ref></highlight></codeline>
<codeline lineno="536"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>&amp;&amp;<sp/>((q-&gt;<ref refid="structpbuf_1aa4d1af2cab3d9280d29212095b5b872a" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="pbuf_8h_1af78a7e1815dc0e31884d095b666d997f" kindref="member">PBUF_FLAG_IS_CUSTOM</ref>)<sp/>==<sp/>0)</highlight></codeline>
<codeline lineno="537"><highlight class="normal">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_SUPPORT_CUSTOM_PBUF<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="538"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>)<sp/>{</highlight></codeline>
<codeline lineno="539"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>reallocate<sp/>and<sp/>adjust<sp/>the<sp/>length<sp/>of<sp/>the<sp/>pbuf<sp/>that<sp/>will<sp/>be<sp/>split<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="540"><highlight class="normal"><sp/><sp/><sp/><sp/>q<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*)<ref refid="mem_8h_1a5e39a108c44d8a72df0b30a117cb62e4" kindref="member">mem_trim</ref>(q,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)q-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>-<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)q)<sp/>+<sp/>rem_len);</highlight></codeline>
<codeline lineno="541"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;mem_trim<sp/>returned<sp/>q<sp/>==<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="542"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="543"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>adjust<sp/>length<sp/>fields<sp/>for<sp/>new<sp/>last<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="544"><highlight class="normal"><sp/><sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>=<sp/>rem_len;</highlight></codeline>
<codeline lineno="545"><highlight class="normal"><sp/><sp/>q-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>=<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="546"><highlight class="normal"></highlight></codeline>
<codeline lineno="547"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>any<sp/>remaining<sp/>pbufs<sp/>in<sp/>chain?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="548"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="549"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>free<sp/>remaining<sp/>pbufs<sp/>in<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="550"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>);</highlight></codeline>
<codeline lineno="551"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="552"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>q<sp/>is<sp/>last<sp/>packet<sp/>in<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="553"><highlight class="normal"><sp/><sp/>q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="554"><highlight class="normal"></highlight></codeline>
<codeline lineno="555"><highlight class="normal">}</highlight></codeline>
<codeline lineno="556"><highlight class="normal"></highlight></codeline>
<codeline lineno="568"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></highlight></codeline>
<codeline lineno="569"><highlight class="normal">pbuf_header_impl(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/><ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref><sp/>header_size_increment,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>force)</highlight></codeline>
<codeline lineno="570"><highlight class="normal">{</highlight></codeline>
<codeline lineno="571"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/><ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="572"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="573"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>increment_magnitude;</highlight></codeline>
<codeline lineno="574"><highlight class="normal"></highlight></codeline>
<codeline lineno="575"><highlight class="normal"><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="576"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((header_size_increment<sp/>==<sp/>0)<sp/>||<sp/>(p<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="577"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="578"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="579"><highlight class="normal"></highlight></codeline>
<codeline lineno="580"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(header_size_increment<sp/>&lt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="581"><highlight class="normal"><sp/><sp/><sp/><sp/>increment_magnitude<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)-header_size_increment;</highlight></codeline>
<codeline lineno="582"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>that<sp/>we<sp/>aren&apos;t<sp/>going<sp/>to<sp/>move<sp/>off<sp/>the<sp/>end<sp/>of<sp/>the<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="583"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;increment_magnitude<sp/>&lt;=<sp/>p-&gt;len&quot;</highlight><highlight class="normal">,<sp/>(increment_magnitude<sp/>&lt;=<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;);</highlight></codeline>
<codeline lineno="584"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="585"><highlight class="normal"><sp/><sp/><sp/><sp/>increment_magnitude<sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)header_size_increment;</highlight></codeline>
<codeline lineno="586"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>0</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="587"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Can&apos;t<sp/>assert<sp/>these<sp/>as<sp/>some<sp/>callers<sp/>speculatively<sp/>call</highlight></codeline>
<codeline lineno="588"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pbuf_header()<sp/>to<sp/>see<sp/>if<sp/>it&apos;s<sp/>OK.<sp/><sp/>Will<sp/>return<sp/>1<sp/>below<sp/>instead.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="589"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>that<sp/>we&apos;ve<sp/>got<sp/>the<sp/>correct<sp/>type<sp/>of<sp/>pbuf<sp/>to<sp/>work<sp/>with<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="590"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;p-&gt;type<sp/>==<sp/>PBUF_RAM<sp/>||<sp/>p-&gt;type<sp/>==<sp/>PBUF_POOL&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="591"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref><sp/>||<sp/>p-&gt;<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbae969347127387b9b59a23ccd24b76d21" kindref="member">PBUF_POOL</ref>);</highlight></codeline>
<codeline lineno="592"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Check<sp/>that<sp/>we<sp/>aren&apos;t<sp/>going<sp/>to<sp/>move<sp/>off<sp/>the<sp/>beginning<sp/>of<sp/>the<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="593"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;p-&gt;payload<sp/>-<sp/>increment_magnitude<sp/>&gt;=<sp/>p<sp/>+<sp/>SIZEOF_STRUCT_PBUF&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="594"><highlight class="normal"><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/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>-<sp/>increment_magnitude<sp/>&gt;=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)p<sp/>+<sp/><ref refid="pbuf_8c_1a8357a994e45ff94c9494aa55b6c3ecb3" kindref="member">SIZEOF_STRUCT_PBUF</ref>);</highlight></codeline>
<codeline lineno="595"><highlight class="normal"></highlight><highlight class="preprocessor">#endif</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="596"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="597"><highlight class="normal"></highlight></codeline>
<codeline lineno="598"><highlight class="normal"><sp/><sp/><ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>=<sp/>p-&gt;<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="599"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>current<sp/>payload<sp/>pointer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="600"><highlight class="normal"><sp/><sp/><ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="601"><highlight class="normal"></highlight></codeline>
<codeline lineno="602"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>pbuf<sp/>types<sp/>containing<sp/>payloads?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="603"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref><sp/>||<sp/><ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbae969347127387b9b59a23ccd24b76d21" kindref="member">PBUF_POOL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="604"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>set<sp/>new<sp/>payload<sp/>pointer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="605"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>-<sp/>header_size_increment;</highlight></codeline>
<codeline lineno="606"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>boundary<sp/>check<sp/>fails?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="607"><highlight class="normal"><sp/><sp/><sp/><sp/>if<sp/>((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>&lt;<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)p<sp/>+<sp/><ref refid="pbuf_8c_1a8357a994e45ff94c9494aa55b6c3ecb3" kindref="member">SIZEOF_STRUCT_PBUF</ref>)<sp/>{</highlight></codeline>
<codeline lineno="608"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<sp/><ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,</highlight></codeline>
<codeline lineno="609"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_header:<sp/>failed<sp/>as<sp/>%p<sp/>&lt;<sp/>%p<sp/>(not<sp/>enough<sp/>space<sp/>for<sp/>new<sp/>header<sp/>size)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="610"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)p<sp/>+<sp/><ref refid="pbuf_8c_1a8357a994e45ff94c9494aa55b6c3ecb3" kindref="member">SIZEOF_STRUCT_PBUF</ref>)));</highlight></codeline>
<codeline lineno="611"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>restore<sp/>old<sp/>payload<sp/>pointer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="612"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>=<sp/><ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="613"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>bail<sp/>out<sp/>unsuccessfully<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="614"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="615"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="616"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>pbuf<sp/>types<sp/>referring<sp/>to<sp/>external<sp/>payloads?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="617"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac9b6ba960fdea6f2e8f35c8313b77e4e" kindref="member">PBUF_REF</ref><sp/>||<sp/><ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac120b0fe39efe35bb682e4aa3b82e2c9" kindref="member">PBUF_ROM</ref>)<sp/>{</highlight></codeline>
<codeline lineno="618"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>hide<sp/>a<sp/>header<sp/>in<sp/>the<sp/>payload?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="619"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((header_size_increment<sp/>&lt;<sp/>0)<sp/>&amp;&amp;<sp/>(increment_magnitude<sp/>&lt;=<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>))<sp/>{</highlight></codeline>
<codeline lineno="620"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>increase<sp/>payload<sp/>pointer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="621"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>-<sp/>header_size_increment;</highlight></codeline>
<codeline lineno="622"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((header_size_increment<sp/>&gt;<sp/>0)<sp/>&amp;&amp;<sp/>force)<sp/>{</highlight></codeline>
<codeline lineno="623"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>=<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref><sp/>-<sp/>header_size_increment;</highlight></codeline>
<codeline lineno="624"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="625"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>cannot<sp/>expand<sp/>payload<sp/>to<sp/>front<sp/>(yet!)</highlight></codeline>
<codeline lineno="626"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>*<sp/>bail<sp/>out<sp/>unsuccessfully<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="627"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="628"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="629"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="630"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Unknown<sp/>type<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="631"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;bad<sp/>pbuf<sp/>type&quot;</highlight><highlight class="normal">,<sp/>0);</highlight></codeline>
<codeline lineno="632"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>1;</highlight></codeline>
<codeline lineno="633"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="634"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>modify<sp/>pbuf<sp/>length<sp/>fields<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="635"><highlight class="normal"><sp/><sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>+=<sp/>header_size_increment;</highlight></codeline>
<codeline lineno="636"><highlight class="normal"><sp/><sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>+=<sp/>header_size_increment;</highlight></codeline>
<codeline lineno="637"><highlight class="normal"></highlight></codeline>
<codeline lineno="638"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_header:<sp/>old<sp/>%p<sp/>new<sp/>%p<sp/>(%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gac05a82d37afb251470f5e17ca15ab6e9" kindref="member">S16_F</ref></highlight><highlight class="stringliteral">&quot;)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="639"><highlight class="normal"><sp/><sp/><sp/><sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>,<sp/>header_size_increment));</highlight></codeline>
<codeline lineno="640"><highlight class="normal"></highlight></codeline>
<codeline lineno="641"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="642"><highlight class="normal">}</highlight></codeline>
<codeline lineno="643"><highlight class="normal"></highlight></codeline>
<codeline lineno="664"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></highlight></codeline>
<codeline lineno="665" refid="pbuf_8c_1a0f81deff4a0e6e8e0ff161a7b9871449" refkind="member"><highlight class="normal"><ref refid="pbuf_8c_1a0f81deff4a0e6e8e0ff161a7b9871449" kindref="member">pbuf_header</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/><ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref><sp/>header_size_increment)</highlight></codeline>
<codeline lineno="666"><highlight class="normal">{</highlight></codeline>
<codeline lineno="667"><highlight class="normal"><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>pbuf_header_impl(p,<sp/>header_size_increment,<sp/>0);</highlight></codeline>
<codeline lineno="668"><highlight class="normal">}</highlight></codeline>
<codeline lineno="669"><highlight class="normal"></highlight></codeline>
<codeline lineno="674"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></highlight></codeline>
<codeline lineno="675" refid="pbuf_8c_1ad0e64d6fbc423593461063da97da9ce6" refkind="member"><highlight class="normal"><ref refid="pbuf_8c_1ad0e64d6fbc423593461063da97da9ce6" kindref="member">pbuf_header_force</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/><ref refid="group__compiler__abstraction_1gacf46f4df0ebab84edebcb69967fdf86b" kindref="member">s16_t</ref><sp/>header_size_increment)</highlight></codeline>
<codeline lineno="676"><highlight class="normal">{</highlight></codeline>
<codeline lineno="677"><highlight class="normal"><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>pbuf_header_impl(p,<sp/>header_size_increment,<sp/>1);</highlight></codeline>
<codeline lineno="678"><highlight class="normal">}</highlight></codeline>
<codeline lineno="679"><highlight class="normal"></highlight></codeline>
<codeline lineno="714"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></highlight></codeline>
<codeline lineno="715" refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p)</highlight></codeline>
<codeline lineno="716"><highlight class="normal">{</highlight></codeline>
<codeline lineno="717"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/><ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref>;</highlight></codeline>
<codeline lineno="718"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*q;</highlight></codeline>
<codeline lineno="719"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>count;</highlight></codeline>
<codeline lineno="720"><highlight class="normal"></highlight></codeline>
<codeline lineno="721"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="722"><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="723"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>if<sp/>assertions<sp/>are<sp/>disabled,<sp/>proceed<sp/>with<sp/>debug<sp/>output<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="724"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga0269bdc51f1e8a5ecf9af72c6e1c996c" kindref="member">LWIP_DBG_LEVEL_SERIOUS</ref>,</highlight></codeline>
<codeline lineno="725"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_free(p<sp/>==<sp/>NULL)<sp/>was<sp/>called.\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="726"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="727"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="728"><highlight class="normal"></highlight></codeline>
<codeline lineno="729"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_free(%p)\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)p));</highlight></codeline>
<codeline lineno="730"><highlight class="normal"></highlight></codeline>
<codeline lineno="731"><highlight class="normal"><sp/><sp/><ref refid="perf_8h_1aa1d6977095e51331f65dcfb2b076da52" kindref="member">PERF_START</ref>;</highlight></codeline>
<codeline lineno="732"><highlight class="normal"></highlight></codeline>
<codeline lineno="733"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_free:<sp/>sane<sp/>type&quot;</highlight><highlight class="normal">,<sp/>p-&gt;type<sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref><sp/>||<sp/>p-&gt;type<sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac120b0fe39efe35bb682e4aa3b82e2c9" kindref="member">PBUF_ROM</ref><sp/>||<sp/>p-&gt;type<sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac9b6ba960fdea6f2e8f35c8313b77e4e" kindref="member">PBUF_REF</ref><sp/>||<sp/>p-&gt;type<sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbae969347127387b9b59a23ccd24b76d21" kindref="member">PBUF_POOL</ref>);</highlight></codeline>
<codeline lineno="734"><highlight class="normal"></highlight></codeline>
<codeline lineno="735"><highlight class="normal"><sp/><sp/>count<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="736"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>de-allocate<sp/>all<sp/>consecutive<sp/>pbufs<sp/>from<sp/>the<sp/>head<sp/>of<sp/>the<sp/>chain<sp/>that</highlight></codeline>
<codeline lineno="737"><highlight class="comment"><sp/><sp/><sp/>*<sp/>obtain<sp/>a<sp/>zero<sp/>reference<sp/>count<sp/>after<sp/>decrementing*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="738"><highlight class="normal"></highlight></codeline>
<codeline lineno="739"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="740"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/><ref refid="structpbuf_1a18e2c02942feb1baa3756fcd585b6731" kindref="member">ref</ref>;</highlight></codeline>
<codeline lineno="741"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="sys_8h_1a945395fa326214fc9736487242710a90" kindref="member">SYS_ARCH_DECL_PROTECT</ref>(old_level);</highlight></codeline>
<codeline lineno="742"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Since<sp/>decrementing<sp/>ref<sp/>cannot<sp/>be<sp/>guaranteed<sp/>to<sp/>be<sp/>a<sp/>single<sp/>machine<sp/>operation</highlight></codeline>
<codeline lineno="743"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>we<sp/>must<sp/>protect<sp/>it.<sp/>We<sp/>put<sp/>the<sp/>new<sp/>ref<sp/>into<sp/>a<sp/>local<sp/>variable<sp/>to<sp/>prevent</highlight></codeline>
<codeline lineno="744"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>*<sp/>further<sp/>protection.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="745"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="sys_8h_1a3d0e48feafd378e9c26c64567ecd8bab" kindref="member">SYS_ARCH_PROTECT</ref>(old_level);</highlight></codeline>
<codeline lineno="746"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>all<sp/>pbufs<sp/>in<sp/>a<sp/>chain<sp/>are<sp/>referenced<sp/>at<sp/>least<sp/>once<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="747"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="armv6_2sched_8c_1a54397bfe18d5da4d50ff03b15f540858" kindref="member">_current</ref>-&gt;<ref refid="structtaskStruct_1a30966587a60db6b40c8be6c387e11d81" kindref="member">id</ref><sp/>==<sp/>4)</highlight></codeline>
<codeline lineno="748"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_free:<sp/>p-&gt;ref<sp/>&gt;<sp/>0&quot;</highlight><highlight class="normal">,<sp/>p-&gt;ref<sp/>&gt;<sp/>0);</highlight></codeline>
<codeline lineno="749"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>decrease<sp/>reference<sp/>count<sp/>(number<sp/>of<sp/>pointers<sp/>to<sp/>pbuf)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="750"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structpbuf_1a18e2c02942feb1baa3756fcd585b6731" kindref="member">ref</ref><sp/>=<sp/>--(p-&gt;ref);</highlight></codeline>
<codeline lineno="751"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="sys_8h_1a2f48e97047945642ddeb27e65bf4ffe2" kindref="member">SYS_ARCH_UNPROTECT</ref>(old_level);</highlight></codeline>
<codeline lineno="752"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>pbuf<sp/>is<sp/>no<sp/>longer<sp/>referenced<sp/>to?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="753"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structpbuf_1a18e2c02942feb1baa3756fcd585b6731" kindref="member">ref</ref><sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="754"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>remember<sp/>next<sp/>pbuf<sp/>in<sp/>chain<sp/>for<sp/>next<sp/>iteration<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="755"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>q<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="756"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<sp/><ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_free:<sp/>deallocating<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)p));</highlight></codeline>
<codeline lineno="757"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structpbuf_1afd7bff5210a022424caa97d2f25fe8e6" kindref="member">type</ref><sp/>=<sp/>p-&gt;type;</highlight></codeline>
<codeline lineno="758"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_SUPPORT_CUSTOM_PBUF</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="759"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>is<sp/>this<sp/>a<sp/>custom<sp/>pbuf?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="760"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((p-&gt;flags<sp/>&amp;<sp/><ref refid="pbuf_8h_1af78a7e1815dc0e31884d095b666d997f" kindref="member">PBUF_FLAG_IS_CUSTOM</ref>)<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="761"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">pbuf_custom<sp/>*pc<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">pbuf_custom*)p;</highlight></codeline>
<codeline lineno="762"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pc-&gt;custom_free_function<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>pc-&gt;custom_free_function<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="763"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pc-&gt;custom_free_function(p);</highlight></codeline>
<codeline lineno="764"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="765"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_SUPPORT_CUSTOM_PBUF<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="766"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>{</highlight></codeline>
<codeline lineno="767"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>is<sp/>this<sp/>a<sp/>pbuf<sp/>from<sp/>the<sp/>pool?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="768"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(type<sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbae969347127387b9b59a23ccd24b76d21" kindref="member">PBUF_POOL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="769"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_PBUF_POOL,<sp/>p);</highlight></codeline>
<codeline lineno="770"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>is<sp/>this<sp/>a<sp/>ROM<sp/>or<sp/>RAM<sp/>referencing<sp/>pbuf?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="771"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(type<sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac120b0fe39efe35bb682e4aa3b82e2c9" kindref="member">PBUF_ROM</ref><sp/>||<sp/>type<sp/>==<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac9b6ba960fdea6f2e8f35c8313b77e4e" kindref="member">PBUF_REF</ref>)<sp/>{</highlight></codeline>
<codeline lineno="772"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_PBUF,<sp/>p);</highlight></codeline>
<codeline lineno="773"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>type<sp/>==<sp/>PBUF_RAM<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="774"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="775"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="mem_8h_1a2fd7aa1adf6e394d3be7c7734e7df41a" kindref="member">mem_free</ref>(p);</highlight></codeline>
<codeline lineno="776"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="777"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="778"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>count++;</highlight></codeline>
<codeline lineno="779"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>proceed<sp/>to<sp/>next<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="780"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>p<sp/>=<sp/>q;</highlight></codeline>
<codeline lineno="781"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>p-&gt;ref<sp/>&gt;<sp/>0,<sp/>this<sp/>pbuf<sp/>is<sp/>still<sp/>referenced<sp/>to<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="782"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>(and<sp/>so<sp/>the<sp/>remaining<sp/>pbufs<sp/>in<sp/>chain<sp/>as<sp/>well)<sp/>*/</highlight><highlight class="normal"></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/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<sp/><ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_free:<sp/>%p<sp/>has<sp/>ref<sp/>%&quot;</highlight><highlight class="normal"><ref refid="group__compiler__abstraction_1gaa9d7f6eb2ee9fcc5eda3545dbb1886e0" kindref="member">U16_F</ref></highlight><highlight class="stringliteral">&quot;,<sp/>ending<sp/>here.\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)p,<sp/>ref));</highlight></codeline>
<codeline lineno="785"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>stop<sp/>walking<sp/>through<sp/>the<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="786"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>p<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="787"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="788"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="789"><highlight class="normal"><sp/><sp/><ref refid="perf_8h_1a8ac3afe5d720793a229fbf70a78eb82f" kindref="member">PERF_STOP</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_free&quot;</highlight><highlight class="normal">);</highlight></codeline>
<codeline lineno="790"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>return<sp/>number<sp/>of<sp/>de-allocated<sp/>pbufs<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="791"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>count;</highlight></codeline>
<codeline lineno="792"><highlight class="normal">}</highlight></codeline>
<codeline lineno="793"><highlight class="normal"></highlight></codeline>
<codeline lineno="800"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></highlight></codeline>
<codeline lineno="801" refid="pbuf_8c_1a5df7ac5ae59012fe9aeddba375a72190" refkind="member"><highlight class="normal"><ref refid="pbuf_8c_1a5df7ac5ae59012fe9aeddba375a72190" kindref="member">pbuf_clen</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p)</highlight></codeline>
<codeline lineno="802"><highlight class="normal">{</highlight></codeline>
<codeline lineno="803"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>len;</highlight></codeline>
<codeline lineno="804"><highlight class="normal"></highlight></codeline>
<codeline lineno="805"><highlight class="normal"><sp/><sp/>len<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="806"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="807"><highlight class="normal"><sp/><sp/><sp/><sp/>++len;</highlight></codeline>
<codeline lineno="808"><highlight class="normal"><sp/><sp/><sp/><sp/>p<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="809"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="810"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>len;</highlight></codeline>
<codeline lineno="811"><highlight class="normal">}</highlight></codeline>
<codeline lineno="812"><highlight class="normal"></highlight></codeline>
<codeline lineno="820"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="821" refid="group__pbuf_1ga77f6bbd69e45e542014d9c547c7da74e" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1ga77f6bbd69e45e542014d9c547c7da74e" kindref="member">pbuf_ref</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p)</highlight></codeline>
<codeline lineno="822"><highlight class="normal">{</highlight></codeline>
<codeline lineno="823"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>pbuf<sp/>given?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="824"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="825"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="sys_8h_1acc5f7f8cbd020de628d1e9a0443da4c7" kindref="member">SYS_ARCH_INC</ref>(p-&gt;<ref refid="structpbuf_1a18e2c02942feb1baa3756fcd585b6731" kindref="member">ref</ref>,<sp/>1);</highlight></codeline>
<codeline lineno="826"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf<sp/>ref<sp/>overflow&quot;</highlight><highlight class="normal">,<sp/>p-&gt;<ref refid="structpbuf_1a18e2c02942feb1baa3756fcd585b6731" kindref="member">ref</ref><sp/>&gt;<sp/>0);</highlight></codeline>
<codeline lineno="827"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="828"><highlight class="normal">}</highlight></codeline>
<codeline lineno="829"><highlight class="normal"></highlight></codeline>
<codeline lineno="840"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="841" refid="group__pbuf_1ga82429084fe29015509c9b4a072707cd4" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1ga82429084fe29015509c9b4a072707cd4" kindref="member">pbuf_cat</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*h,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*t)</highlight></codeline>
<codeline lineno="842"><highlight class="normal">{</highlight></codeline>
<codeline lineno="843"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p;</highlight></codeline>
<codeline lineno="844"><highlight class="normal"></highlight></codeline>
<codeline lineno="845"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;(h<sp/>!=<sp/>NULL)<sp/>&amp;&amp;<sp/>(t<sp/>!=<sp/>NULL)<sp/>(programmer<sp/>violates<sp/>API)&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="846"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>((h<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(t<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="847"><highlight class="normal"></highlight></codeline>
<codeline lineno="848"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>proceed<sp/>to<sp/>last<sp/>pbuf<sp/>of<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="849"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(p<sp/>=<sp/>h;<sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>p<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>)<sp/>{</highlight></codeline>
<codeline lineno="850"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>add<sp/>total<sp/>length<sp/>of<sp/>second<sp/>chain<sp/>to<sp/>all<sp/>totals<sp/>of<sp/>first<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="851"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>+=<sp/>t-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>;</highlight></codeline>
<codeline lineno="852"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="853"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>{<sp/>p<sp/>is<sp/>last<sp/>pbuf<sp/>of<sp/>first<sp/>h<sp/>chain,<sp/>p-&gt;next<sp/>==<sp/>NULL<sp/>}<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="854"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;p-&gt;tot_len<sp/>==<sp/>p-&gt;len<sp/>(of<sp/>last<sp/>pbuf<sp/>in<sp/>chain)&quot;</highlight><highlight class="normal">,<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>==<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>);</highlight></codeline>
<codeline lineno="855"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;p-&gt;next<sp/>==<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="856"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>add<sp/>total<sp/>length<sp/>of<sp/>second<sp/>chain<sp/>to<sp/>last<sp/>pbuf<sp/>total<sp/>of<sp/>first<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="857"><highlight class="normal"><sp/><sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>+=<sp/>t-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>;</highlight></codeline>
<codeline lineno="858"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>chain<sp/>last<sp/>pbuf<sp/>of<sp/>head<sp/>(p)<sp/>with<sp/>first<sp/>of<sp/>tail<sp/>(t)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="859"><highlight class="normal"><sp/><sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>=<sp/>t;</highlight></codeline>
<codeline lineno="860"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>p-&gt;next<sp/>now<sp/>references<sp/>t,<sp/>but<sp/>the<sp/>caller<sp/>will<sp/>drop<sp/>its<sp/>reference<sp/>to<sp/>t,</highlight></codeline>
<codeline lineno="861"><highlight class="comment"><sp/><sp/><sp/>*<sp/>so<sp/>netto<sp/>there<sp/>is<sp/>no<sp/>change<sp/>to<sp/>the<sp/>reference<sp/>count<sp/>of<sp/>t.</highlight></codeline>
<codeline lineno="862"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="863"><highlight class="normal">}</highlight></codeline>
<codeline lineno="864"><highlight class="normal"></highlight></codeline>
<codeline lineno="882"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="883" refid="group__pbuf_1ga831c9a72bda1d3bd4c7b96f5a0e3b891" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1ga831c9a72bda1d3bd4c7b96f5a0e3b891" kindref="member">pbuf_chain</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*h,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*t)</highlight></codeline>
<codeline lineno="884"><highlight class="normal">{</highlight></codeline>
<codeline lineno="885"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1ga82429084fe29015509c9b4a072707cd4" kindref="member">pbuf_cat</ref>(h,<sp/>t);</highlight></codeline>
<codeline lineno="886"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>t<sp/>is<sp/>now<sp/>referenced<sp/>by<sp/>h<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="887"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1ga77f6bbd69e45e542014d9c547c7da74e" kindref="member">pbuf_ref</ref>(t);</highlight></codeline>
<codeline lineno="888"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_chain:<sp/>%p<sp/>references<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)h,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)t));</highlight></codeline>
<codeline lineno="889"><highlight class="normal">}</highlight></codeline>
<codeline lineno="890"><highlight class="normal"></highlight></codeline>
<codeline lineno="899"><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*</highlight></codeline>
<codeline lineno="900" refid="pbuf_8c_1abf3d29c4f43986b4cb5eb314d5b9729d" refkind="member"><highlight class="normal"><ref refid="pbuf_8c_1abf3d29c4f43986b4cb5eb314d5b9729d" kindref="member">pbuf_dechain</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p)</highlight></codeline>
<codeline lineno="901"><highlight class="normal">{</highlight></codeline>
<codeline lineno="902"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*q;</highlight></codeline>
<codeline lineno="903"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>tail_gone<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="904"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>tail<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="905"><highlight class="normal"><sp/><sp/>q<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="906"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>pbuf<sp/>has<sp/>successor<sp/>in<sp/>chain?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="907"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="908"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>assert<sp/>tot_len<sp/>invariant:<sp/>(p-&gt;tot_len<sp/>==<sp/>p-&gt;len<sp/>+<sp/>(p-&gt;next?<sp/>p-&gt;next-&gt;tot_len:<sp/>0)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="909"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;p-&gt;tot_len<sp/>==<sp/>p-&gt;len<sp/>+<sp/>q-&gt;tot_len&quot;</highlight><highlight class="normal">,<sp/>q-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>==<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>-<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>);</highlight></codeline>
<codeline lineno="910"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>enforce<sp/>invariant<sp/>if<sp/>assertion<sp/>is<sp/>disabled<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="911"><highlight class="normal"><sp/><sp/><sp/><sp/>q-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>-<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="912"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>decouple<sp/>pbuf<sp/>from<sp/>remainder<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="913"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="914"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>total<sp/>length<sp/>of<sp/>pbuf<sp/>p<sp/>is<sp/>its<sp/>own<sp/>length<sp/>only<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="915"><highlight class="normal"><sp/><sp/><sp/><sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="916"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>q<sp/>is<sp/>no<sp/>longer<sp/>referenced<sp/>by<sp/>p,<sp/>free<sp/>it<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="917"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_dechain:<sp/>unreferencing<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)q));</highlight></codeline>
<codeline lineno="918"><highlight class="normal"><sp/><sp/><sp/><sp/>tail_gone<sp/>=<sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(q);</highlight></codeline>
<codeline lineno="919"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tail_gone<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="920"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,</highlight></codeline>
<codeline lineno="921"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_dechain:<sp/>deallocated<sp/>%p<sp/>(as<sp/>it<sp/>is<sp/>no<sp/>longer<sp/>referenced)\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*)q));</highlight></codeline>
<codeline lineno="922"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="923"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>return<sp/>remaining<sp/>tail<sp/>or<sp/>NULL<sp/>if<sp/>deallocated<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="924"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="925"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>assert<sp/>tot_len<sp/>invariant:<sp/>(p-&gt;tot_len<sp/>==<sp/>p-&gt;len<sp/>+<sp/>(p-&gt;next?<sp/>p-&gt;next-&gt;tot_len:<sp/>0)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="926"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;p-&gt;tot_len<sp/>==<sp/>p-&gt;len&quot;</highlight><highlight class="normal">,<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>==<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>);</highlight></codeline>
<codeline lineno="927"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>((tail_gone<sp/>&gt;<sp/>0)<sp/>?<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref><sp/>:<sp/>q);</highlight></codeline>
<codeline lineno="928"><highlight class="normal">}</highlight></codeline>
<codeline lineno="929"><highlight class="normal"></highlight></codeline>
<codeline lineno="948"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="949" refid="group__pbuf_1gaba88511dee3df4b631fde691f421320d" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1gaba88511dee3df4b631fde691f421320d" kindref="member">pbuf_copy</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p_to,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p_from)</highlight></codeline>
<codeline lineno="950"><highlight class="normal">{</highlight></codeline>
<codeline lineno="951"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset_to=0,<sp/>offset_from=0,<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="952"><highlight class="normal"></highlight></codeline>
<codeline lineno="953"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_copy(%p,<sp/>%p)\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="954"><highlight class="normal"><sp/><sp/><sp/><sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)p_to,<sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)p_from));</highlight></codeline>
<codeline lineno="955"><highlight class="normal"></highlight></codeline>
<codeline lineno="956"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>is<sp/>the<sp/>target<sp/>big<sp/>enough<sp/>to<sp/>hold<sp/>the<sp/>source?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="957"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_copy:<sp/>target<sp/>not<sp/>big<sp/>enough<sp/>to<sp/>hold<sp/>source&quot;</highlight><highlight class="normal">,<sp/>((p_to<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="958"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(p_from<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(p_to-&gt;tot_len<sp/>&gt;=<sp/>p_from-&gt;tot_len)),<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="959"><highlight class="normal"></highlight></codeline>
<codeline lineno="960"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>iterate<sp/>through<sp/>pbuf<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="961"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">do</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="962"><highlight class="normal"><sp/><sp/>{</highlight></codeline>
<codeline lineno="963"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>one<sp/>part<sp/>of<sp/>the<sp/>original<sp/>chain<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="964"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((p_to-&gt;len<sp/>-<sp/>offset_to)<sp/>&gt;=<sp/>(p_from-&gt;len<sp/>-<sp/>offset_from))<sp/>{</highlight></codeline>
<codeline lineno="965"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>complete<sp/>current<sp/>p_from<sp/>fits<sp/>into<sp/>current<sp/>p_to<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="966"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>=<sp/>p_from-&gt;len<sp/>-<sp/>offset_from;</highlight></codeline>
<codeline lineno="967"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="968"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>current<sp/>p_from<sp/>does<sp/>not<sp/>fit<sp/>into<sp/>current<sp/>p_to<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="969"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>=<sp/>p_to-&gt;len<sp/>-<sp/>offset_to;</highlight></codeline>
<codeline lineno="970"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="971"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p_to-&gt;payload<sp/>+<sp/>offset_to,<sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)p_from-&gt;payload<sp/>+<sp/>offset_from,<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>);</highlight></codeline>
<codeline lineno="972"><highlight class="normal"><sp/><sp/><sp/><sp/>offset_to<sp/>+=<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="973"><highlight class="normal"><sp/><sp/><sp/><sp/>offset_from<sp/>+=<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="974"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;offset_to<sp/>&lt;=<sp/>p_to-&gt;len&quot;</highlight><highlight class="normal">,<sp/>offset_to<sp/>&lt;=<sp/>p_to-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>);</highlight></codeline>
<codeline lineno="975"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;offset_from<sp/>&lt;=<sp/>p_from-&gt;len&quot;</highlight><highlight class="normal">,<sp/>offset_from<sp/>&lt;=<sp/>p_from-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>);</highlight></codeline>
<codeline lineno="976"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(offset_from<sp/>&gt;=<sp/>p_from-&gt;len)<sp/>{</highlight></codeline>
<codeline lineno="977"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>on<sp/>to<sp/>next<sp/>p_from<sp/>(if<sp/>any)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="978"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>offset_from<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="979"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>p_from<sp/>=<sp/>p_from-&gt;next;</highlight></codeline>
<codeline lineno="980"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="981"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(offset_to<sp/>==<sp/>p_to-&gt;len)<sp/>{</highlight></codeline>
<codeline lineno="982"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>on<sp/>to<sp/>next<sp/>p_to<sp/>(if<sp/>any)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="983"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>offset_to<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="984"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>p_to<sp/>=<sp/>p_to-&gt;next;</highlight></codeline>
<codeline lineno="985"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;p_to<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>(p_to<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/>(p_from<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<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="986"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="987"><highlight class="normal"></highlight></codeline>
<codeline lineno="988"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((p_from<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(p_from-&gt;len<sp/>==<sp/>p_from-&gt;tot_len))<sp/>{</highlight></codeline>
<codeline lineno="989"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>copy<sp/>more<sp/>than<sp/>one<sp/>packet!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="990"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_copy()<sp/>does<sp/>not<sp/>allow<sp/>packet<sp/>queues!&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="991"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(p_from-&gt;next<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="992"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="993"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((p_to<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(p_to-&gt;len<sp/>==<sp/>p_to-&gt;tot_len))<sp/>{</highlight></codeline>
<codeline lineno="994"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>copy<sp/>more<sp/>than<sp/>one<sp/>packet!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="995"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_copy()<sp/>does<sp/>not<sp/>allow<sp/>packet<sp/>queues!&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="996"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(p_to-&gt;next<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>),<sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;);</highlight></codeline>
<codeline lineno="997"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="998"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(p_from);</highlight></codeline>
<codeline lineno="999"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a5c3d44a0ec3bb8bd66f776c70d5c6a6c" kindref="member">PBUF_DEBUG</ref><sp/>|<sp/><ref refid="group__debugging__levels_1ga988147559b78642ac881815b66023646" kindref="member">LWIP_DBG_TRACE</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;pbuf_copy:<sp/>end<sp/>of<sp/>chain<sp/>reached.\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="1000"><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="1001"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1002"><highlight class="normal"></highlight></codeline>
<codeline lineno="1015"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></highlight></codeline>
<codeline lineno="1016" refid="group__pbuf_1gac2f1f58fd36042e82af46f5015720899" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1gac2f1f58fd36042e82af46f5015720899" kindref="member">pbuf_copy_partial</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><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/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset)</highlight></codeline>
<codeline lineno="1017"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1018"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p;</highlight></codeline>
<codeline lineno="1019"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>left;</highlight></codeline>
<codeline lineno="1020"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>buf_copy_len;</highlight></codeline>
<codeline lineno="1021"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>copied_total<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1022"><highlight class="normal"></highlight></codeline>
<codeline lineno="1023"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_copy_partial:<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/>0;);</highlight></codeline>
<codeline lineno="1024"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_copy_partial:<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/>0;);</highlight></codeline>
<codeline lineno="1025"><highlight class="normal"></highlight></codeline>
<codeline lineno="1026"><highlight class="normal"><sp/><sp/>left<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1027"><highlight class="normal"></highlight></codeline>
<codeline lineno="1028"><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/>||<sp/>(dataptr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1029"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="1030"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1031"><highlight class="normal"></highlight></codeline>
<codeline lineno="1032"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Note<sp/>some<sp/>systems<sp/>use<sp/>byte<sp/>copy<sp/>if<sp/>dataptr<sp/>or<sp/>one<sp/>of<sp/>the<sp/>pbuf<sp/>payload<sp/>pointers<sp/>are<sp/>unaligned.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1033"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(p<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>;<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>!=<sp/>0<sp/>&amp;&amp;<sp/>p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>p<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1034"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((offset<sp/>!=<sp/>0)<sp/>&amp;&amp;<sp/>(offset<sp/>&gt;=<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1035"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>copy<sp/>from<sp/>this<sp/>buffer<sp/>-&gt;<sp/>on<sp/>to<sp/>the<sp/>next<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1036"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>offset<sp/>-=<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="1037"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="1038"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>from<sp/>this<sp/>buffer.<sp/>maybe<sp/>only<sp/>partially.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1039"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>buf_copy_len<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>-<sp/>offset;</highlight></codeline>
<codeline lineno="1040"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(buf_copy_len<sp/>&gt;<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1041"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>buf_copy_len<sp/>=<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="1042"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1043"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>the<sp/>necessary<sp/>parts<sp/>of<sp/>the<sp/>buffer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1044"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(&amp;((</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)dataptr)[left],<sp/>&amp;((</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>)[offset],<sp/>buf_copy_len);</highlight></codeline>
<codeline lineno="1045"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>copied_total<sp/>+=<sp/>buf_copy_len;</highlight></codeline>
<codeline lineno="1046"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>left<sp/>+=<sp/>buf_copy_len;</highlight></codeline>
<codeline lineno="1047"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>-=<sp/>buf_copy_len;</highlight></codeline>
<codeline lineno="1048"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>offset<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1049"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1050"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1051"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>copied_total;</highlight></codeline>
<codeline lineno="1052"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1053"><highlight class="normal"></highlight></codeline>
<codeline lineno="1054"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_TCP<sp/>&amp;&amp;<sp/>TCP_QUEUE_OOSEQ<sp/>&amp;&amp;<sp/>LWIP_WND_SCALE</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1055"><highlight class="normal"></highlight></codeline>
<codeline lineno="1067"><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>pbuf_split_64k(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>**rest)</highlight></codeline>
<codeline lineno="1068"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1069"><highlight class="normal"><sp/><sp/>*rest<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1070"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1071"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>tot_len_front<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="1072"><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/>*i<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="1073"><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/>*r<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="1074"><highlight class="normal"></highlight></codeline>
<codeline lineno="1075"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>continue<sp/>until<sp/>the<sp/>total<sp/>length<sp/>(summed<sp/>up<sp/>as<sp/>u16_t)<sp/>overflows<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1076"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>((r<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>((<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)(tot_len_front<sp/>+<sp/>r-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>)<sp/>&gt;<sp/>tot_len_front))<sp/>{</highlight></codeline>
<codeline lineno="1077"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tot_len_front<sp/>+=<sp/>r-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="1078"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>i<sp/>=<sp/>r;</highlight></codeline>
<codeline lineno="1079"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>r<sp/>=<sp/>r-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="1080"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1081"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>i<sp/>now<sp/>points<sp/>to<sp/>last<sp/>packet<sp/>of<sp/>the<sp/>first<sp/>segment.<sp/>Set<sp/>next</highlight></codeline>
<codeline lineno="1082"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/><sp/><sp/>pointer<sp/>to<sp/>NULL<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1083"><highlight class="normal"><sp/><sp/><sp/><sp/>i-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="1084"><highlight class="normal"></highlight></codeline>
<codeline lineno="1085"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(r<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1086"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Update<sp/>the<sp/>tot_len<sp/>field<sp/>in<sp/>the<sp/>first<sp/>part<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1087"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>p;<sp/>i<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>i<sp/>=<sp/>i-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1088"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>i-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>-=<sp/>r-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>;</highlight></codeline>
<codeline lineno="1089"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;tot_len/len<sp/>mismatch<sp/>in<sp/>last<sp/>pbuf&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="1090"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(i-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/>(i-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>==<sp/>i-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>));</highlight></codeline>
<codeline lineno="1091"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1092"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1aa4d1af2cab3d9280d29212095b5b872a" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="pbuf_8h_1a36a915aa2f6a188baa2862881407971e" kindref="member">PBUF_FLAG_TCP_FIN</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1093"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>r-&gt;<ref refid="structpbuf_1aa4d1af2cab3d9280d29212095b5b872a" kindref="member">flags</ref><sp/>|=<sp/><ref refid="pbuf_8h_1a36a915aa2f6a188baa2862881407971e" kindref="member">PBUF_FLAG_TCP_FIN</ref>;</highlight></codeline>
<codeline lineno="1094"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1095"><highlight class="normal"></highlight></codeline>
<codeline lineno="1096"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>tot_len<sp/>field<sp/>in<sp/>rest<sp/>does<sp/>not<sp/>need<sp/>modifications<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1097"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>reference<sp/>counters<sp/>do<sp/>not<sp/>need<sp/>modifications<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1098"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>*rest<sp/>=<sp/>r;</highlight></codeline>
<codeline lineno="1099"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1100"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1101"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1102"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_TCP<sp/>&amp;&amp;<sp/>TCP_QUEUE_OOSEQ<sp/>&amp;&amp;<sp/>LWIP_WND_SCALE<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1103"><highlight class="normal"></highlight></codeline>
<codeline lineno="1104"><highlight class="normal"></highlight><highlight class="comment">/*<sp/>Actual<sp/>implementation<sp/>of<sp/>pbuf_skip()<sp/>but<sp/>returning<sp/>const<sp/>pointer...<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1105"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref>*</highlight></codeline>
<codeline lineno="1106"><highlight class="normal">pbuf_skip_const(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>in,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>in_offset,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>*<sp/>out_offset)</highlight></codeline>
<codeline lineno="1107"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1108"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset_left<sp/>=<sp/>in_offset;</highlight></codeline>
<codeline lineno="1109"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>q<sp/>=<sp/>in;</highlight></codeline>
<codeline lineno="1110"><highlight class="normal"></highlight></codeline>
<codeline lineno="1111"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>get<sp/>the<sp/>correct<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1112"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>((q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;=<sp/>offset_left))<sp/>{</highlight></codeline>
<codeline lineno="1113"><highlight class="normal"><sp/><sp/><sp/><sp/>offset_left<sp/>-=<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="1114"><highlight class="normal"><sp/><sp/><sp/><sp/>q<sp/>=<sp/>q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="1115"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1116"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(out_offset<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1117"><highlight class="normal"><sp/><sp/><sp/><sp/>*out_offset<sp/>=<sp/>offset_left;</highlight></codeline>
<codeline lineno="1118"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1119"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>q;</highlight></codeline>
<codeline lineno="1120"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1121"><highlight class="normal"></highlight></codeline>
<codeline lineno="1131"><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref>*</highlight></codeline>
<codeline lineno="1132" refid="group__pbuf_1ga6a961522d81f0327aaf4d4ee6d96c583" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1ga6a961522d81f0327aaf4d4ee6d96c583" kindref="member">pbuf_skip</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>in,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>in_offset,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>*<sp/>out_offset)</highlight></codeline>
<codeline lineno="1133"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1134"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>out<sp/>=<sp/>pbuf_skip_const(in,<sp/>in_offset,<sp/>out_offset);</highlight></codeline>
<codeline lineno="1135"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1gaa0dd3f76dd9a837feaac61fedc0dbe72" kindref="member">LWIP_CONST_CAST</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>*,<sp/>out);</highlight></codeline>
<codeline lineno="1136"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1137"><highlight class="normal"></highlight></codeline>
<codeline lineno="1149"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1150" refid="group__pbuf_1gad1e31e370271335b197272af2724ca85" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1gad1e31e370271335b197272af2724ca85" kindref="member">pbuf_take</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><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/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>)</highlight></codeline>
<codeline lineno="1151"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1152"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p;</highlight></codeline>
<codeline lineno="1153"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>buf_copy_len;</highlight></codeline>
<codeline lineno="1154"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>total_copy_len<sp/>=<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="1155"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>copied_total<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="1156"><highlight class="normal"></highlight></codeline>
<codeline lineno="1157"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_take:<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="1158"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_take:<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="1159"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_take:<sp/>buf<sp/>not<sp/>large<sp/>enough&quot;</highlight><highlight class="normal">,<sp/>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;tot_len<sp/>&gt;=<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>),<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="1160"><highlight class="normal"></highlight></codeline>
<codeline lineno="1161"><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/>||<sp/>(dataptr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/>(<ref refid="structbuf" kindref="compound">buf</ref>-&gt;tot_len<sp/>&lt;<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1162"><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="1163"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1164"><highlight class="normal"></highlight></codeline>
<codeline lineno="1165"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Note<sp/>some<sp/>systems<sp/>use<sp/>byte<sp/>copy<sp/>if<sp/>dataptr<sp/>or<sp/>one<sp/>of<sp/>the<sp/>pbuf<sp/>payload<sp/>pointers<sp/>are<sp/>unaligned.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1166"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(p<sp/>=<sp/><ref refid="structbuf" kindref="compound">buf</ref>;<sp/>total_copy_len<sp/>!=<sp/>0;<sp/>p<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1167"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_take:<sp/>invalid<sp/>pbuf&quot;</highlight><highlight class="normal">,<sp/>p<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1168"><highlight class="normal"><sp/><sp/><sp/><sp/>buf_copy_len<sp/>=<sp/>total_copy_len;</highlight></codeline>
<codeline lineno="1169"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(buf_copy_len<sp/>&gt;<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1170"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>pbuf<sp/>cannot<sp/>hold<sp/>all<sp/>remaining<sp/>data<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1171"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>buf_copy_len<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="1172"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1173"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>the<sp/>necessary<sp/>parts<sp/>of<sp/>the<sp/>buffer<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1174"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>,<sp/>&amp;((</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)dataptr)[copied_total],<sp/>buf_copy_len);</highlight></codeline>
<codeline lineno="1175"><highlight class="normal"><sp/><sp/><sp/><sp/>total_copy_len<sp/>-=<sp/>buf_copy_len;</highlight></codeline>
<codeline lineno="1176"><highlight class="normal"><sp/><sp/><sp/><sp/>copied_total<sp/>+=<sp/>buf_copy_len;</highlight></codeline>
<codeline lineno="1177"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1178"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;did<sp/>not<sp/>copy<sp/>all<sp/>data&quot;</highlight><highlight class="normal">,<sp/>total_copy_len<sp/>==<sp/>0<sp/>&amp;&amp;<sp/>copied_total<sp/>==<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>);</highlight></codeline>
<codeline lineno="1179"><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="1180"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1181"><highlight class="normal"></highlight></codeline>
<codeline lineno="1193"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1194" refid="group__pbuf_1gae1cf2bf7454ff87ff377b0b2262f9b44" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1gae1cf2bf7454ff87ff377b0b2262f9b44" kindref="member">pbuf_take_at</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><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/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset)</highlight></codeline>
<codeline lineno="1195"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1196"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>target_offset;</highlight></codeline>
<codeline lineno="1197"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>q<sp/>=<sp/><ref refid="group__pbuf_1ga6a961522d81f0327aaf4d4ee6d96c583" kindref="member">pbuf_skip</ref>(<ref refid="structbuf" kindref="compound">buf</ref>,<sp/>offset,<sp/>&amp;target_offset);</highlight></codeline>
<codeline lineno="1198"><highlight class="normal"></highlight></codeline>
<codeline lineno="1199"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>return<sp/>requested<sp/>data<sp/>if<sp/>pbuf<sp/>is<sp/>OK<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1200"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(q-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>&gt;=<sp/>target_offset<sp/>+<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1201"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>remaining_len<sp/>=<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="1202"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*<sp/>src_ptr<sp/>=<sp/>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)dataptr;</highlight></codeline>
<codeline lineno="1203"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>copy<sp/>the<sp/>part<sp/>that<sp/>goes<sp/>into<sp/>the<sp/>first<sp/>pbuf<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1204"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>first_copy_len<sp/>=<sp/><ref refid="def_8h_1a748f5df614a3fc989e8900fd229d6e4e" kindref="member">LWIP_MIN</ref>(q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>-<sp/>target_offset,<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>);</highlight></codeline>
<codeline lineno="1205"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="lwipopts_8h_1aa1dd57a66b6de8c0593e9e3e8d1411f6" kindref="member">MEMCPY</ref>(((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)q-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>)<sp/>+<sp/>target_offset,<sp/>dataptr,<sp/>first_copy_len);</highlight></codeline>
<codeline lineno="1206"><highlight class="normal"><sp/><sp/><sp/><sp/>remaining_len<sp/>-=<sp/>first_copy_len;</highlight></codeline>
<codeline lineno="1207"><highlight class="normal"><sp/><sp/><sp/><sp/>src_ptr<sp/>+=<sp/>first_copy_len;</highlight></codeline>
<codeline lineno="1208"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(remaining_len<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1209"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1gad1e31e370271335b197272af2724ca85" kindref="member">pbuf_take</ref>(q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>,<sp/>src_ptr,<sp/>remaining_len);</highlight></codeline>
<codeline lineno="1210"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1211"><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="1212"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1213"><highlight class="normal"><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="1214"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1215"><highlight class="normal"></highlight></codeline>
<codeline lineno="1229"><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref>*</highlight></codeline>
<codeline lineno="1230" refid="group__pbuf_1ga54ac7b116c6f53c704cbf74f35a8b35c" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1ga54ac7b116c6f53c704cbf74f35a8b35c" kindref="member">pbuf_coalesce</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/><ref refid="group__pbuf_1gaee1baa59bb2f85ba575b5a8619ac1ebf" kindref="member">pbuf_layer</ref><sp/>layer)</highlight></codeline>
<codeline lineno="1231"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1232"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*q;</highlight></codeline>
<codeline lineno="1233"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err;</highlight></codeline>
<codeline lineno="1234"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref><sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1235"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>p;</highlight></codeline>
<codeline lineno="1236"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1237"><highlight class="normal"><sp/><sp/>q<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(layer,<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref>,<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>);</highlight></codeline>
<codeline lineno="1238"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(q<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="1239"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>@todo:<sp/>what<sp/>do<sp/>we<sp/>do<sp/>now?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1240"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>p;</highlight></codeline>
<codeline lineno="1241"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1242"><highlight class="normal"><sp/><sp/>err<sp/>=<sp/><ref refid="group__pbuf_1gaba88511dee3df4b631fde691f421320d" kindref="member">pbuf_copy</ref>(q,<sp/>p);</highlight></codeline>
<codeline lineno="1243"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga70624a5deb8b9199406372a7f3603ecf" kindref="member">LWIP_UNUSED_ARG</ref>(err);<sp/></highlight><highlight class="comment">/*<sp/>in<sp/>case<sp/>of<sp/>LWIP_NOASSERT<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1244"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;pbuf_copy<sp/>failed&quot;</highlight><highlight class="normal">,<sp/>err<sp/>==<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>);</highlight></codeline>
<codeline lineno="1245"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="1246"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>q;</highlight></codeline>
<codeline lineno="1247"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1248"><highlight class="normal"></highlight></codeline>
<codeline lineno="1249"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_CHECKSUM_ON_COPY</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1250"><highlight class="normal"></highlight></codeline>
<codeline lineno="1262"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="1263"><highlight class="normal">pbuf_fill_chksum(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref><sp/>*p,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>start_offset,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>*dataptr,</highlight></codeline>
<codeline lineno="1264"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>*chksum)</highlight></codeline>
<codeline lineno="1265"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1266"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga4c14294869aceba3ef9d4c0c302d0f33" kindref="member">u32_t</ref><sp/>acc;</highlight></codeline>
<codeline lineno="1267"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>copy_chksum;</highlight></codeline>
<codeline lineno="1268"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal"><sp/>*dst_ptr;</highlight></codeline>
<codeline lineno="1269"><highlight class="normal"><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="1270"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;dataptr<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>dataptr<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1271"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;chksum<sp/>!=<sp/>NULL&quot;</highlight><highlight class="normal">,<sp/>chksum<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="1272"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;len<sp/>!=<sp/>0&quot;</highlight><highlight class="normal">,<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>!=<sp/>0);</highlight></codeline>
<codeline lineno="1273"><highlight class="normal"></highlight></codeline>
<codeline lineno="1274"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((start_offset<sp/>&gt;=<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>)<sp/>||<sp/>(start_offset<sp/>+<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&gt;<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>))<sp/>{</highlight></codeline>
<codeline lineno="1275"><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="1276"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1277"><highlight class="normal"></highlight></codeline>
<codeline lineno="1278"><highlight class="normal"><sp/><sp/>dst_ptr<sp/>=<sp/>((</highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>)<sp/>+<sp/>start_offset;</highlight></codeline>
<codeline lineno="1279"><highlight class="normal"><sp/><sp/>copy_chksum<sp/>=<sp/>LWIP_CHKSUM_COPY(dst_ptr,<sp/>dataptr,<sp/><ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>);</highlight></codeline>
<codeline lineno="1280"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((start_offset<sp/>&amp;<sp/>1)<sp/>!=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1281"><highlight class="normal"><sp/><sp/><sp/><sp/>copy_chksum<sp/>=<sp/><ref refid="inet__chksum_8h_1a0196bd603262882d16b5264b52eafe18" kindref="member">SWAP_BYTES_IN_WORD</ref>(copy_chksum);</highlight></codeline>
<codeline lineno="1282"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1283"><highlight class="normal"><sp/><sp/>acc<sp/>=<sp/>*chksum;</highlight></codeline>
<codeline lineno="1284"><highlight class="normal"><sp/><sp/>acc<sp/>+=<sp/>copy_chksum;</highlight></codeline>
<codeline lineno="1285"><highlight class="normal"><sp/><sp/>*chksum<sp/>=<sp/><ref refid="inet__chksum_8h_1a6ffe83b4bdd1784a0671ee4778966a01" kindref="member">FOLD_U32T</ref>(acc);</highlight></codeline>
<codeline lineno="1286"><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="1287"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1288"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_CHECKSUM_ON_COPY<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1289"><highlight class="normal"></highlight></codeline>
<codeline lineno="1299"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref></highlight></codeline>
<codeline lineno="1300" refid="group__pbuf_1ga6d803d9945bffb7ad97743f2fa503da6" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1ga6d803d9945bffb7ad97743f2fa503da6" kindref="member">pbuf_get_at</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>p,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset)</highlight></codeline>
<codeline lineno="1301"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1302"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">int</highlight><highlight class="normal"><sp/>ret<sp/>=<sp/><ref refid="group__pbuf_1ga839f342803b0cf89049744124c5a98ad" kindref="member">pbuf_try_get_at</ref>(p,<sp/>offset);</highlight></codeline>
<codeline lineno="1303"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ret<sp/>&gt;=<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1304"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>(<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>)ret;</highlight></codeline>
<codeline lineno="1305"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1306"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="1307"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1308"><highlight class="normal"></highlight></codeline>
<codeline lineno="1317"><highlight class="keywordtype">int</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1318" refid="group__pbuf_1ga839f342803b0cf89049744124c5a98ad" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1ga839f342803b0cf89049744124c5a98ad" kindref="member">pbuf_try_get_at</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>p,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset)</highlight></codeline>
<codeline lineno="1319"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1320"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>q_idx;</highlight></codeline>
<codeline lineno="1321"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>q<sp/>=<sp/>pbuf_skip_const(p,<sp/>offset,<sp/>&amp;q_idx);</highlight></codeline>
<codeline lineno="1322"><highlight class="normal"></highlight></codeline>
<codeline lineno="1323"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>return<sp/>requested<sp/>data<sp/>if<sp/>pbuf<sp/>is<sp/>OK<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1324"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&gt;<sp/>q_idx))<sp/>{</highlight></codeline>
<codeline lineno="1325"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)q-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>)[q_idx];</highlight></codeline>
<codeline lineno="1326"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1327"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>-1;</highlight></codeline>
<codeline lineno="1328"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1329"><highlight class="normal"></highlight></codeline>
<codeline lineno="1339"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1340" refid="group__pbuf_1gaf76863707dc02993eae116574b1ea03f" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1gaf76863707dc02993eae116574b1ea03f" kindref="member">pbuf_put_at</ref>(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>p,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>data)</highlight></codeline>
<codeline lineno="1341"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1342"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>q_idx;</highlight></codeline>
<codeline lineno="1343"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>q<sp/>=<sp/><ref refid="group__pbuf_1ga6a961522d81f0327aaf4d4ee6d96c583" kindref="member">pbuf_skip</ref>(p,<sp/>offset,<sp/>&amp;q_idx);</highlight></codeline>
<codeline lineno="1344"><highlight class="normal"></highlight></codeline>
<codeline lineno="1345"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>write<sp/>requested<sp/>data<sp/>if<sp/>pbuf<sp/>is<sp/>OK<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1346"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&gt;<sp/>q_idx))<sp/>{</highlight></codeline>
<codeline lineno="1347"><highlight class="normal"><sp/><sp/><sp/><sp/>((<ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)q-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>)[q_idx]<sp/>=<sp/>data;</highlight></codeline>
<codeline lineno="1348"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1349"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1350"><highlight class="normal"></highlight></codeline>
<codeline lineno="1362"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></highlight></codeline>
<codeline lineno="1363" refid="group__pbuf_1ga2170ccbbb13238380dbb203ee1b85974" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1ga2170ccbbb13238380dbb203ee1b85974" kindref="member">pbuf_memcmp</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>p,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>offset,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*<sp/>s2,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>n)</highlight></codeline>
<codeline lineno="1364"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1365"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>start<sp/>=<sp/>offset;</highlight></codeline>
<codeline lineno="1366"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>q<sp/>=<sp/>p;</highlight></codeline>
<codeline lineno="1367"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1368"><highlight class="normal"><sp/></highlight></codeline>
<codeline lineno="1369"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>pbuf<sp/>long<sp/>enough<sp/>to<sp/>perform<sp/>check?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1370"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>&lt;<sp/>(offset<sp/>+<sp/>n))<sp/>{</highlight></codeline>
<codeline lineno="1371"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0xffff;</highlight></codeline>
<codeline lineno="1372"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1373"><highlight class="normal"><sp/></highlight></codeline>
<codeline lineno="1374"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>get<sp/>the<sp/>correct<sp/>pbuf<sp/>from<sp/>chain.<sp/>We<sp/>know<sp/>it<sp/>succeeds<sp/>because<sp/>of<sp/>p-&gt;tot_len<sp/>check<sp/>above.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1375"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>((q<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>&amp;&amp;<sp/>(q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;=<sp/>start))<sp/>{</highlight></codeline>
<codeline lineno="1376"><highlight class="normal"><sp/><sp/><sp/><sp/>start<sp/>-=<sp/>q-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>;</highlight></codeline>
<codeline lineno="1377"><highlight class="normal"><sp/><sp/><sp/><sp/>q<sp/>=<sp/>q-&gt;<ref refid="structpbuf_1a5e5763c94fd18d78937b0b58ce7df341" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="1378"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1379"><highlight class="normal"><sp/></highlight></codeline>
<codeline lineno="1380"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>return<sp/>requested<sp/>data<sp/>if<sp/>pbuf<sp/>is<sp/>OK<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1381"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>0;<sp/>i<sp/>&lt;<sp/>n;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1382"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>We<sp/>know<sp/>pbuf_get_at()<sp/>succeeds<sp/>because<sp/>of<sp/>p-&gt;tot_len<sp/>check<sp/>above.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="1383"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>a<sp/>=<sp/><ref refid="group__pbuf_1ga6d803d9945bffb7ad97743f2fa503da6" kindref="member">pbuf_get_at</ref>(q,<sp/>start<sp/>+<sp/>i);</highlight></codeline>
<codeline lineno="1384"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>b<sp/>=<sp/>((</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref>*)s2)[i];</highlight></codeline>
<codeline lineno="1385"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(a<sp/>!=<sp/>b)<sp/>{</highlight></codeline>
<codeline lineno="1386"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i+1;</highlight></codeline>
<codeline lineno="1387"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1388"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1389"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0;</highlight></codeline>
<codeline lineno="1390"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1391"><highlight class="normal"></highlight></codeline>
<codeline lineno="1404"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></highlight></codeline>
<codeline lineno="1405" refid="group__pbuf_1ga18c164a6e4a24d89ea9eb7571a886448" refkind="member"><highlight class="normal"><ref refid="group__pbuf_1ga18c164a6e4a24d89ea9eb7571a886448" kindref="member">pbuf_memfind</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>p,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*<sp/><ref refid="structmem" kindref="compound">mem</ref>,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>mem_len,<sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>start_offset)</highlight></codeline>
<codeline lineno="1406"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1407"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>i;</highlight></codeline>
<codeline lineno="1408"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>max<sp/>=<sp/>p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>-<sp/>mem_len;</highlight></codeline>
<codeline lineno="1409"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>&gt;=<sp/>mem_len<sp/>+<sp/>start_offset)<sp/>{</highlight></codeline>
<codeline lineno="1410"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(i<sp/>=<sp/>start_offset;<sp/>i<sp/>&lt;=<sp/>max;<sp/>i++)<sp/>{</highlight></codeline>
<codeline lineno="1411"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>plus<sp/>=<sp/><ref refid="group__pbuf_1ga2170ccbbb13238380dbb203ee1b85974" kindref="member">pbuf_memcmp</ref>(p,<sp/>i,<sp/><ref refid="structmem" kindref="compound">mem</ref>,<sp/>mem_len);</highlight></codeline>
<codeline lineno="1412"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(plus<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="1413"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>i;</highlight></codeline>
<codeline lineno="1414"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1415"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="1416"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1417"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0xFFFF;</highlight></codeline>
<codeline lineno="1418"><highlight class="normal">}</highlight></codeline>
<codeline lineno="1419"><highlight class="normal"></highlight></codeline>
<codeline lineno="1431"><highlight class="normal"><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref></highlight></codeline>
<codeline lineno="1432" refid="pbuf_8c_1a9ba3f7b705309ceadb147692fd5a1c7d" refkind="member"><highlight class="normal"><ref refid="pbuf_8c_1a9ba3f7b705309ceadb147692fd5a1c7d" kindref="member">pbuf_strstr</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/>p,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">char</highlight><highlight class="normal">*<sp/>substr)</highlight></codeline>
<codeline lineno="1433"><highlight class="normal">{</highlight></codeline>
<codeline lineno="1434"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">size_t</highlight><highlight class="normal"><sp/>substr_len;</highlight></codeline>
<codeline lineno="1435"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((substr<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>||<sp/>(substr[0]<sp/>==<sp/>0)<sp/>||<sp/>(p-&gt;<ref refid="structpbuf_1a5259e7ec29bab9c0999b64f2e86b411f" kindref="member">tot_len</ref><sp/>==<sp/>0xFFFF))<sp/>{</highlight></codeline>
<codeline lineno="1436"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0xFFFF;</highlight></codeline>
<codeline lineno="1437"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1438"><highlight class="normal"><sp/><sp/>substr_len<sp/>=<sp/><ref refid="lib_8h_1ae6c8de953239811a34eeeab09458e55e" kindref="member">strlen</ref>(substr);</highlight></codeline>
<codeline lineno="1439"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(substr_len<sp/>&gt;=<sp/>0xFFFF)<sp/>{</highlight></codeline>
<codeline lineno="1440"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>0xFFFF;</highlight></codeline>
<codeline lineno="1441"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="1442"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__pbuf_1ga18c164a6e4a24d89ea9eb7571a886448" kindref="member">pbuf_memfind</ref>(p,<sp/>substr,<sp/>(<ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref>)substr_len,<sp/>0);</highlight></codeline>
<codeline lineno="1443"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/net/core/pbuf.c"/>
  </compounddef>
</doxygen>
