<?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="igmp_8c" kind="file" language="C++">
    <compoundname>igmp.c</compoundname>
    <includes refid="opt_8h" local="yes">net/opt.h</includes>
    <incdepgraph>
      <node id="17">
        <label>stdarg.h</label>
        <link refid="stdarg_8h"/>
      </node>
      <node id="18">
        <label>ubixos/kpanic.h</label>
        <link refid="kpanic_8h"/>
      </node>
      <node id="15">
        <label>sys/io.h</label>
        <link refid="io_8h"/>
      </node>
      <node id="8">
        <label>sys/select.h</label>
        <link refid="select_8h"/>
        <childnode refid="9" relation="include">
        </childnode>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="11" relation="include">
        </childnode>
        <childnode refid="12" relation="include">
        </childnode>
      </node>
      <node id="13">
        <label>net/arch/cc.h</label>
        <link refid="cc_8h"/>
        <childnode refid="14" relation="include">
        </childnode>
      </node>
      <node id="12">
        <label>sys/_sigset.h</label>
        <link refid="__sigset_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
      <node id="3">
        <label>net/lwipopts.h</label>
        <link refid="lwipopts_8h"/>
      </node>
      <node id="6">
        <label>sys/types.h</label>
        <link refid="include_2sys_2types_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
        <childnode refid="8" relation="include">
        </childnode>
      </node>
      <node id="5">
        <label>net/arch.h</label>
        <link refid="arch_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="13" relation="include">
        </childnode>
        <childnode refid="16" relation="include">
        </childnode>
        <childnode refid="18" relation="include">
        </childnode>
      </node>
      <node id="2">
        <label>net/opt.h</label>
        <link refid="opt_8h"/>
        <childnode refid="3" relation="include">
        </childnode>
        <childnode refid="4" relation="include">
        </childnode>
      </node>
      <node id="16">
        <label>lib/kprintf.h</label>
        <link refid="kprintf_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="17" relation="include">
        </childnode>
      </node>
      <node id="4">
        <label>net/debug.h</label>
        <link refid="debug_8h"/>
        <childnode refid="5" relation="include">
        </childnode>
        <childnode refid="2" relation="include">
        </childnode>
      </node>
      <node id="9">
        <label>sys/cdefs.h</label>
        <link refid="cdefs_8h"/>
      </node>
      <node id="14">
        <label>ubixos/time.h</label>
        <link refid="time_8h"/>
        <childnode refid="6" relation="include">
        </childnode>
        <childnode refid="10" relation="include">
        </childnode>
        <childnode refid="15" relation="include">
        </childnode>
      </node>
      <node id="7">
        <label>sys/_types.h</label>
        <link refid="__types_8h"/>
      </node>
      <node id="1">
        <label>C:/Dev/git/UbixOS/sys/net/core/ipv4/igmp.c</label>
        <link refid="igmp_8c"/>
        <childnode refid="2" 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="11">
        <label>sys/_timeval.h</label>
        <link refid="__timeval_8h"/>
        <childnode refid="7" relation="include">
        </childnode>
      </node>
    </incdepgraph>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
<para>IGMP - Internet Group Management Protocol </para>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"></codeline>
<codeline lineno="10"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="11"><highlight class="comment"><sp/>*<sp/>Copyright<sp/>(c)<sp/>2002<sp/>CITEL<sp/>Technologies<sp/>Ltd.</highlight></codeline>
<codeline lineno="12"><highlight class="comment"><sp/>*<sp/>All<sp/>rights<sp/>reserved.</highlight></codeline>
<codeline lineno="13"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="14"><highlight class="comment"><sp/>*<sp/>Redistribution<sp/>and<sp/>use<sp/>in<sp/>source<sp/>and<sp/>binary<sp/>forms,<sp/>with<sp/>or<sp/>without</highlight></codeline>
<codeline lineno="15"><highlight class="comment"><sp/>*<sp/>modification,<sp/>are<sp/>permitted<sp/>provided<sp/>that<sp/>the<sp/>following<sp/>conditions</highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>*<sp/>are<sp/>met:</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/>1.<sp/>Redistributions<sp/>of<sp/>source<sp/>code<sp/>must<sp/>retain<sp/>the<sp/>above<sp/>copyright</highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>notice,<sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer.</highlight></codeline>
<codeline lineno="19"><highlight class="comment"><sp/>*<sp/>2.<sp/>Redistributions<sp/>in<sp/>binary<sp/>form<sp/>must<sp/>reproduce<sp/>the<sp/>above<sp/>copyright</highlight></codeline>
<codeline lineno="20"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>notice,<sp/>this<sp/>list<sp/>of<sp/>conditions<sp/>and<sp/>the<sp/>following<sp/>disclaimer<sp/>in<sp/>the</highlight></codeline>
<codeline lineno="21"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>documentation<sp/>and/or<sp/>other<sp/>materials<sp/>provided<sp/>with<sp/>the<sp/>distribution.</highlight></codeline>
<codeline lineno="22"><highlight class="comment"><sp/>*<sp/>3.<sp/>Neither<sp/>the<sp/>name<sp/>of<sp/>CITEL<sp/>Technologies<sp/>Ltd<sp/>nor<sp/>the<sp/>names<sp/>of<sp/>its<sp/>contributors</highlight></codeline>
<codeline lineno="23"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>may<sp/>be<sp/>used<sp/>to<sp/>endorse<sp/>or<sp/>promote<sp/>products<sp/>derived<sp/>from<sp/>this<sp/>software</highlight></codeline>
<codeline lineno="24"><highlight class="comment"><sp/>*<sp/><sp/><sp/><sp/>without<sp/>specific<sp/>prior<sp/>written<sp/>permission.</highlight></codeline>
<codeline lineno="25"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="26"><highlight class="comment"><sp/>*<sp/>THIS<sp/>SOFTWARE<sp/>IS<sp/>PROVIDED<sp/>BY<sp/>CITEL<sp/>TECHNOLOGIES<sp/>AND<sp/>CONTRIBUTORS<sp/>``AS<sp/>IS&apos;&apos;</highlight></codeline>
<codeline lineno="27"><highlight class="comment"><sp/>*<sp/>AND<sp/>ANY<sp/>EXPRESS<sp/>OR<sp/>IMPLIED<sp/>WARRANTIES,<sp/>INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>THE</highlight></codeline>
<codeline lineno="28"><highlight class="comment"><sp/>*<sp/>IMPLIED<sp/>WARRANTIES<sp/>OF<sp/>MERCHANTABILITY<sp/>AND<sp/>FITNESS<sp/>FOR<sp/>A<sp/>PARTICULAR<sp/>PURPOSE</highlight></codeline>
<codeline lineno="29"><highlight class="comment"><sp/>*<sp/>ARE<sp/>DISCLAIMED.<sp/><sp/>IN<sp/>NO<sp/>EVENT<sp/>SHALL<sp/>CITEL<sp/>TECHNOLOGIES<sp/>OR<sp/>CONTRIBUTORS<sp/>BE<sp/>LIABLE</highlight></codeline>
<codeline lineno="30"><highlight class="comment"><sp/>*<sp/>FOR<sp/>ANY<sp/>DIRECT,<sp/>INDIRECT,<sp/>INCIDENTAL,<sp/>SPECIAL,<sp/>EXEMPLARY,<sp/>OR<sp/>CONSEQUENTIAL</highlight></codeline>
<codeline lineno="31"><highlight class="comment"><sp/>*<sp/>DAMAGES<sp/>(INCLUDING,<sp/>BUT<sp/>NOT<sp/>LIMITED<sp/>TO,<sp/>PROCUREMENT<sp/>OF<sp/>SUBSTITUTE<sp/>GOODS</highlight></codeline>
<codeline lineno="32"><highlight class="comment"><sp/>*<sp/>OR<sp/>SERVICES;<sp/>LOSS<sp/>OF<sp/>USE,<sp/>DATA,<sp/>OR<sp/>PROFITS;<sp/>OR<sp/>BUSINESS<sp/>INTERRUPTION)</highlight></codeline>
<codeline lineno="33"><highlight class="comment"><sp/>*<sp/>HOWEVER<sp/>CAUSED<sp/>AND<sp/>ON<sp/>ANY<sp/>THEORY<sp/>OF<sp/>LIABILITY,<sp/>WHETHER<sp/>IN<sp/>CONTRACT,<sp/>STRICT</highlight></codeline>
<codeline lineno="34"><highlight class="comment"><sp/>*<sp/>LIABILITY,<sp/>OR<sp/>TORT<sp/>(INCLUDING<sp/>NEGLIGENCE<sp/>OR<sp/>OTHERWISE)<sp/>ARISING<sp/>IN<sp/>ANY<sp/>WAY</highlight></codeline>
<codeline lineno="35"><highlight class="comment"><sp/>*<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<sp/>OF</highlight></codeline>
<codeline lineno="36"><highlight class="comment"><sp/>*<sp/>SUCH<sp/>DAMAGE.</highlight></codeline>
<codeline lineno="37"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="38"><highlight class="comment"><sp/>*<sp/>This<sp/>file<sp/>is<sp/>a<sp/>contribution<sp/>to<sp/>the<sp/>lwIP<sp/>TCP/IP<sp/>stack.</highlight></codeline>
<codeline lineno="39"><highlight class="comment"><sp/>*<sp/>The<sp/>Swedish<sp/>Institute<sp/>of<sp/>Computer<sp/>Science<sp/>and<sp/>Adam<sp/>Dunkels</highlight></codeline>
<codeline lineno="40"><highlight class="comment"><sp/>*<sp/>are<sp/>specifically<sp/>granted<sp/>permission<sp/>to<sp/>redistribute<sp/>this</highlight></codeline>
<codeline lineno="41"><highlight class="comment"><sp/>*<sp/>source<sp/>code.</highlight></codeline>
<codeline lineno="42"><highlight class="comment">*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="43"><highlight class="normal"></highlight></codeline>
<codeline lineno="44"><highlight class="normal"></highlight><highlight class="comment">/*-------------------------------------------------------------</highlight></codeline>
<codeline lineno="45"><highlight class="comment">Note<sp/>1)</highlight></codeline>
<codeline lineno="46"><highlight class="comment">Although<sp/>the<sp/>rfc<sp/>requires<sp/>V1<sp/>AND<sp/>V2<sp/>capability</highlight></codeline>
<codeline lineno="47"><highlight class="comment">we<sp/>will<sp/>only<sp/>support<sp/>v2<sp/>since<sp/>now<sp/>V1<sp/>is<sp/>very<sp/>old<sp/>(August<sp/>1989)</highlight></codeline>
<codeline lineno="48"><highlight class="comment">V1<sp/>can<sp/>be<sp/>added<sp/>if<sp/>required</highlight></codeline>
<codeline lineno="49"><highlight class="comment"></highlight></codeline>
<codeline lineno="50"><highlight class="comment">a<sp/>debug<sp/>print<sp/>and<sp/>statistic<sp/>have<sp/>been<sp/>implemented<sp/>to</highlight></codeline>
<codeline lineno="51"><highlight class="comment">show<sp/>this<sp/>up.</highlight></codeline>
<codeline lineno="52"><highlight class="comment">-------------------------------------------------------------</highlight></codeline>
<codeline lineno="53"><highlight class="comment">-------------------------------------------------------------</highlight></codeline>
<codeline lineno="54"><highlight class="comment">Note<sp/>2)</highlight></codeline>
<codeline lineno="55"><highlight class="comment">A<sp/>query<sp/>for<sp/>a<sp/>specific<sp/>group<sp/>address<sp/>(as<sp/>opposed<sp/>to<sp/>ALLHOSTS)</highlight></codeline>
<codeline lineno="56"><highlight class="comment">has<sp/>now<sp/>been<sp/>implemented<sp/>as<sp/>I<sp/>am<sp/>unsure<sp/>if<sp/>it<sp/>is<sp/>required</highlight></codeline>
<codeline lineno="57"><highlight class="comment"></highlight></codeline>
<codeline lineno="58"><highlight class="comment">a<sp/>debug<sp/>print<sp/>and<sp/>statistic<sp/>have<sp/>been<sp/>implemented<sp/>to</highlight></codeline>
<codeline lineno="59"><highlight class="comment">show<sp/>this<sp/>up.</highlight></codeline>
<codeline lineno="60"><highlight class="comment">-------------------------------------------------------------</highlight></codeline>
<codeline lineno="61"><highlight class="comment">-------------------------------------------------------------</highlight></codeline>
<codeline lineno="62"><highlight class="comment">Note<sp/>3)</highlight></codeline>
<codeline lineno="63"><highlight class="comment">The<sp/>router<sp/>alert<sp/>rfc<sp/>2113<sp/>is<sp/>implemented<sp/>in<sp/>outgoing<sp/>packets</highlight></codeline>
<codeline lineno="64"><highlight class="comment">but<sp/>not<sp/>checked<sp/>rigorously<sp/>incoming</highlight></codeline>
<codeline lineno="65"><highlight class="comment">-------------------------------------------------------------</highlight></codeline>
<codeline lineno="66"><highlight class="comment">Steve<sp/>Reynolds</highlight></codeline>
<codeline lineno="67"><highlight class="comment">------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="68"><highlight class="normal"></highlight></codeline>
<codeline lineno="69"><highlight class="normal"></highlight><highlight class="comment">/*-----------------------------------------------------------------------------</highlight></codeline>
<codeline lineno="70"><highlight class="comment"><sp/>*<sp/>RFC<sp/>988<sp/><sp/>-<sp/>Host<sp/>extensions<sp/>for<sp/>IP<sp/>multicasting<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>-<sp/>V0</highlight></codeline>
<codeline lineno="71"><highlight class="comment"><sp/>*<sp/>RFC<sp/>1054<sp/>-<sp/>Host<sp/>extensions<sp/>for<sp/>IP<sp/>multicasting<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>-</highlight></codeline>
<codeline lineno="72"><highlight class="comment"><sp/>*<sp/>RFC<sp/>1112<sp/>-<sp/>Host<sp/>extensions<sp/>for<sp/>IP<sp/>multicasting<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>-<sp/>V1</highlight></codeline>
<codeline lineno="73"><highlight class="comment"><sp/>*<sp/>RFC<sp/>2236<sp/>-<sp/>Internet<sp/>Group<sp/>Management<sp/>Protocol,<sp/>Version<sp/>2<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>-<sp/>V2<sp/><sp/>&lt;-<sp/>this<sp/>code<sp/>is<sp/>based<sp/>on<sp/>this<sp/>RFC<sp/>(it&apos;s<sp/>the<sp/>&quot;de<sp/>facto&quot;<sp/>standard)</highlight></codeline>
<codeline lineno="74"><highlight class="comment"><sp/>*<sp/>RFC<sp/>3376<sp/>-<sp/>Internet<sp/>Group<sp/>Management<sp/>Protocol,<sp/>Version<sp/>3<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>-<sp/>V3</highlight></codeline>
<codeline lineno="75"><highlight class="comment"><sp/>*<sp/>RFC<sp/>4604<sp/>-<sp/>Using<sp/>Internet<sp/>Group<sp/>Management<sp/>Protocol<sp/>Version<sp/>3...<sp/><sp/><sp/><sp/><sp/><sp/><sp/>-<sp/>V3+</highlight></codeline>
<codeline lineno="76"><highlight class="comment"><sp/>*<sp/>RFC<sp/>2113<sp/>-<sp/>IP<sp/>Router<sp/>Alert<sp/>Option<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>-</highlight></codeline>
<codeline lineno="77"><highlight class="comment"><sp/>*----------------------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="78"><highlight class="normal"></highlight></codeline>
<codeline lineno="79"><highlight class="normal"></highlight><highlight class="comment">/*-----------------------------------------------------------------------------</highlight></codeline>
<codeline lineno="80"><highlight class="comment"><sp/>*<sp/>Includes</highlight></codeline>
<codeline lineno="81"><highlight class="comment"><sp/>*----------------------------------------------------------------------------*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="82"><highlight class="normal"></highlight></codeline>
<codeline lineno="83"><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="84"><highlight class="normal"></highlight></codeline>
<codeline lineno="85"><highlight class="normal"></highlight><highlight class="preprocessor">#if<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IGMP<sp/></highlight><highlight class="comment">/*<sp/>don&apos;t<sp/>build<sp/>if<sp/>not<sp/>configured<sp/>for<sp/>use<sp/>in<sp/>lwipopts.h<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="86"><highlight class="normal"></highlight></codeline>
<codeline lineno="87"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="igmp_8h" kindref="compound">net/igmp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="88"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="debug_8h" kindref="compound">net/debug.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="89"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="def_8h" kindref="compound">net/def.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="90"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="mem_8h" kindref="compound">net/mem.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="91"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="ip_8h" kindref="compound">net/ip.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="92"><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="93"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="netif_8h" kindref="compound">net/netif.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="94"><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="95"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="prot_2igmp_8h" kindref="compound">net/prot/igmp.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="96"><highlight class="normal"></highlight></codeline>
<codeline lineno="97"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="string_8h" kindref="compound">string.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="98"><highlight class="normal"></highlight></codeline>
<codeline lineno="99"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*igmp_lookup_group(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*ifp,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*addr);</highlight></codeline>
<codeline lineno="100"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/><sp/>igmp_remove_group(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref>*<sp/><ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>igmp_group<sp/>*group);</highlight></codeline>
<codeline lineno="101"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><sp/><sp/>igmp_timeout(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>igmp_group<sp/>*group);</highlight></codeline>
<codeline lineno="102"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><sp/><sp/>igmp_start_timer(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>igmp_group<sp/>*group,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>max_time);</highlight></codeline>
<codeline lineno="103"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><sp/><sp/>igmp_delaying_member(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>igmp_group<sp/>*group,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>maxresp);</highlight></codeline>
<codeline lineno="104"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/><sp/>igmp_ip_output_if(</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/>ip4_addr_t<sp/>*src,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*dest,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="105"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><sp/><sp/>igmp_send(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>igmp_group<sp/>*group,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>type);</highlight></codeline>
<codeline lineno="106"><highlight class="normal"></highlight></codeline>
<codeline lineno="107"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/><sp/><sp/><sp/><sp/>allsystems;</highlight></codeline>
<codeline lineno="108"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/><sp/><sp/><sp/><sp/>allrouters;</highlight></codeline>
<codeline lineno="109"><highlight class="normal"></highlight></codeline>
<codeline lineno="113"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="114"><highlight class="normal">igmp_init(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="115"><highlight class="normal">{</highlight></codeline>
<codeline lineno="116"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_init:<sp/>initializing\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="117"><highlight class="normal"></highlight></codeline>
<codeline lineno="118"><highlight class="normal"><sp/><sp/>IP4_ADDR(&amp;allsystems,<sp/>224,<sp/>0,<sp/>0,<sp/>1);</highlight></codeline>
<codeline lineno="119"><highlight class="normal"><sp/><sp/>IP4_ADDR(&amp;allrouters,<sp/>224,<sp/>0,<sp/>0,<sp/>2);</highlight></codeline>
<codeline lineno="120"><highlight class="normal">}</highlight></codeline>
<codeline lineno="121"><highlight class="normal"></highlight></codeline>
<codeline lineno="127"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="128"><highlight class="normal">igmp_start(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="129"><highlight class="normal">{</highlight></codeline>
<codeline lineno="130"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group*<sp/>group;</highlight></codeline>
<codeline lineno="131"><highlight class="normal"></highlight></codeline>
<codeline lineno="132"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_start:<sp/>starting<sp/>IGMP<sp/>processing<sp/>on<sp/>if<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="133"><highlight class="normal"></highlight></codeline>
<codeline lineno="134"><highlight class="normal"><sp/><sp/>group<sp/>=<sp/>igmp_lookup_group(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;allsystems);</highlight></codeline>
<codeline lineno="135"><highlight class="normal"></highlight></codeline>
<codeline lineno="136"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(group<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="137"><highlight class="normal"><sp/><sp/><sp/><sp/>group-&gt;group_state<sp/>=<sp/><ref refid="prot_2igmp_8h_1a5b9419fe533da22ca7015cac97e8b1e3" kindref="member">IGMP_GROUP_IDLE_MEMBER</ref>;</highlight></codeline>
<codeline lineno="138"><highlight class="normal"><sp/><sp/><sp/><sp/>group-&gt;use++;</highlight></codeline>
<codeline lineno="139"><highlight class="normal"></highlight></codeline>
<codeline lineno="140"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Allow<sp/>the<sp/>igmp<sp/>messages<sp/>at<sp/>the<sp/>MAC<sp/>level<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="141"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;igmp_mac_filter<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="142"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_start:<sp/>igmp_mac_filter(ADD<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="143"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_debug_print_val(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>allsystems);</highlight></codeline>
<codeline lineno="144"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;)<sp/>on<sp/>if<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="145"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;igmp_mac_filter(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;allsystems,<sp/><ref refid="netif_8h_1ab194ec4241fad8b6e9aac51e3ec23de0a4186fbaf94be956ea1a3b02cd1cccb1f" kindref="member">NETIF_ADD_MAC_FILTER</ref>);</highlight></codeline>
<codeline lineno="146"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="147"><highlight class="normal"></highlight></codeline>
<codeline lineno="148"><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="149"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="150"><highlight class="normal"></highlight></codeline>
<codeline lineno="151"><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="152"><highlight class="normal">}</highlight></codeline>
<codeline lineno="153"><highlight class="normal"></highlight></codeline>
<codeline lineno="159"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="160"><highlight class="normal">igmp_stop(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="161"><highlight class="normal">{</highlight></codeline>
<codeline lineno="162"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*group<sp/>=<sp/>netif_igmp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="163"><highlight class="normal"></highlight></codeline>
<codeline lineno="164"><highlight class="normal"><sp/><sp/>netif_set_client_data(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>LWIP_NETIF_CLIENT_DATA_INDEX_IGMP,<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>);</highlight></codeline>
<codeline lineno="165"><highlight class="normal"></highlight></codeline>
<codeline lineno="166"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(group<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="167"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*next<sp/>=<sp/>group-&gt;next;<sp/></highlight><highlight class="comment">/*<sp/>avoid<sp/>use-after-free<sp/>below<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="168"><highlight class="normal"></highlight></codeline>
<codeline lineno="169"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>disable<sp/>the<sp/>group<sp/>at<sp/>the<sp/>MAC<sp/>level<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="170"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;igmp_mac_filter<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="171"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_stop:<sp/>igmp_mac_filter(DEL<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="172"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_debug_print(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>&amp;group-&gt;group_address);</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_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;)<sp/>on<sp/>if<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="174"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;igmp_mac_filter(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>&amp;(group-&gt;group_address),<sp/><ref refid="netif_8h_1ab194ec4241fad8b6e9aac51e3ec23de0a7ad3406353906deb4e64ebeed349e07e" kindref="member">NETIF_DEL_MAC_FILTER</ref>);</highlight></codeline>
<codeline lineno="175"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="176"><highlight class="normal"></highlight></codeline>
<codeline lineno="177"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>free<sp/>group<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="178"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_IGMP_GROUP,<sp/>group);</highlight></codeline>
<codeline lineno="179"><highlight class="normal"></highlight></codeline>
<codeline lineno="180"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>move<sp/>to<sp/>&quot;next&quot;<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="181"><highlight class="normal"><sp/><sp/><sp/><sp/>group<sp/>=<sp/>next;</highlight></codeline>
<codeline lineno="182"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="183"><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="184"><highlight class="normal">}</highlight></codeline>
<codeline lineno="185"><highlight class="normal"></highlight></codeline>
<codeline lineno="191"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="192"><highlight class="normal">igmp_report_groups(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="193"><highlight class="normal">{</highlight></codeline>
<codeline lineno="194"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*group<sp/>=<sp/>netif_igmp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="195"><highlight class="normal"></highlight></codeline>
<codeline lineno="196"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_report_groups:<sp/>sending<sp/>IGMP<sp/>reports<sp/>on<sp/>if<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="197"><highlight class="normal"></highlight></codeline>
<codeline lineno="198"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Skip<sp/>the<sp/>first<sp/>group<sp/>in<sp/>the<sp/>list,<sp/>it<sp/>is<sp/>always<sp/>the<sp/>allsystems<sp/>group<sp/>added<sp/>in<sp/>igmp_start()<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="199"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(group<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="200"><highlight class="normal"><sp/><sp/><sp/><sp/>group<sp/>=<sp/>group-&gt;next;</highlight></codeline>
<codeline lineno="201"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="202"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="203"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(group<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="204"><highlight class="normal"><sp/><sp/><sp/><sp/>igmp_delaying_member(group,<sp/>IGMP_JOIN_DELAYING_MEMBER_TMR);</highlight></codeline>
<codeline lineno="205"><highlight class="normal"><sp/><sp/><sp/><sp/>group<sp/>=<sp/>group-&gt;next;</highlight></codeline>
<codeline lineno="206"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="207"><highlight class="normal">}</highlight></codeline>
<codeline lineno="208"><highlight class="normal"></highlight></codeline>
<codeline lineno="217"><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*</highlight></codeline>
<codeline lineno="218"><highlight class="normal">igmp_lookfor_group(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*ifp,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*addr)</highlight></codeline>
<codeline lineno="219"><highlight class="normal">{</highlight></codeline>
<codeline lineno="220"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*group<sp/>=<sp/>netif_igmp_data(ifp);</highlight></codeline>
<codeline lineno="221"><highlight class="normal"></highlight></codeline>
<codeline lineno="222"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(group<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="223"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_cmp(&amp;(group-&gt;group_address),<sp/>addr))<sp/>{</highlight></codeline>
<codeline lineno="224"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>group;</highlight></codeline>
<codeline lineno="225"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="226"><highlight class="normal"><sp/><sp/><sp/><sp/>group<sp/>=<sp/>group-&gt;next;</highlight></codeline>
<codeline lineno="227"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="228"><highlight class="normal"></highlight></codeline>
<codeline lineno="229"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>to<sp/>be<sp/>clearer,<sp/>we<sp/>return<sp/>NULL<sp/>here<sp/>instead<sp/>of</highlight></codeline>
<codeline lineno="230"><highlight class="comment"><sp/><sp/><sp/>*<sp/>&apos;group&apos;<sp/>(which<sp/>is<sp/>also<sp/>NULL<sp/>at<sp/>this<sp/>point).</highlight></codeline>
<codeline lineno="231"><highlight class="comment"><sp/><sp/><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="232"><highlight class="normal"><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="233"><highlight class="normal">}</highlight></codeline>
<codeline lineno="234"><highlight class="normal"></highlight></codeline>
<codeline lineno="243"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*</highlight></codeline>
<codeline lineno="244"><highlight class="normal">igmp_lookup_group(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*ifp,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*addr)</highlight></codeline>
<codeline lineno="245"><highlight class="normal">{</highlight></codeline>
<codeline lineno="246"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*group;</highlight></codeline>
<codeline lineno="247"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*list_head<sp/>=<sp/>netif_igmp_data(ifp);</highlight></codeline>
<codeline lineno="248"><highlight class="normal"></highlight></codeline>
<codeline lineno="249"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Search<sp/>if<sp/>the<sp/>group<sp/>already<sp/>exists<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="250"><highlight class="normal"><sp/><sp/>group<sp/>=<sp/>igmp_lookfor_group(ifp,<sp/>addr);</highlight></codeline>
<codeline lineno="251"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(group<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="252"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Group<sp/>already<sp/>exists.<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="253"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>group;</highlight></codeline>
<codeline lineno="254"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="255"><highlight class="normal"><sp/><sp/></highlight></codeline>
<codeline lineno="256"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Group<sp/>doesn&apos;t<sp/>exist<sp/>yet,<sp/>create<sp/>a<sp/>new<sp/>one<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="257"><highlight class="normal"><sp/><sp/>group<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*)<ref refid="memp_8h_1a2b00593d086313c267b54a976bf67aa5" kindref="member">memp_malloc</ref>(MEMP_IGMP_GROUP);</highlight></codeline>
<codeline lineno="258"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(group<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="259"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_set(&amp;(group-&gt;group_address),<sp/>addr);</highlight></codeline>
<codeline lineno="260"><highlight class="normal"><sp/><sp/><sp/><sp/>group-&gt;timer<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0;<sp/></highlight><highlight class="comment">/*<sp/>Not<sp/>running<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="261"><highlight class="normal"><sp/><sp/><sp/><sp/>group-&gt;group_state<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/><ref refid="prot_2igmp_8h_1a0357ddf34e5e88adaa654ad562adab54" kindref="member">IGMP_GROUP_NON_MEMBER</ref>;</highlight></codeline>
<codeline lineno="262"><highlight class="normal"><sp/><sp/><sp/><sp/>group-&gt;last_reporter_flag<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="263"><highlight class="normal"><sp/><sp/><sp/><sp/>group-&gt;use<sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="264"><highlight class="normal"></highlight></codeline>
<codeline lineno="265"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Ensure<sp/>allsystems<sp/>group<sp/>is<sp/>always<sp/>first<sp/>in<sp/>list<sp/>*/</highlight><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="266"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(list_head<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="267"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>this<sp/>is<sp/>the<sp/>first<sp/>entry<sp/>in<sp/>linked<sp/>list<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="268"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;igmp_lookup_group:<sp/>first<sp/>group<sp/>must<sp/>be<sp/>allsystems&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="269"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(ip4_addr_cmp(addr,<sp/>&amp;allsystems)<sp/>!=<sp/>0));</highlight></codeline>
<codeline lineno="270"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>group-&gt;next<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="271"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>netif_set_client_data(ifp,<sp/>LWIP_NETIF_CLIENT_DATA_INDEX_IGMP,<sp/>group);</highlight></codeline>
<codeline lineno="272"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="273"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>append<sp/>_after_<sp/>first<sp/>entry<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="274"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;igmp_lookup_group:<sp/>all<sp/>except<sp/>first<sp/>group<sp/>must<sp/>not<sp/>be<sp/>allsystems&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="275"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(ip4_addr_cmp(addr,<sp/>&amp;allsystems)<sp/>==<sp/>0));</highlight></codeline>
<codeline lineno="276"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>group-&gt;next<sp/>=<sp/>list_head-&gt;next;</highlight></codeline>
<codeline lineno="277"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>list_head-&gt;next<sp/>=<sp/>group;</highlight></codeline>
<codeline lineno="278"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="279"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="280"><highlight class="normal"></highlight></codeline>
<codeline lineno="281"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_lookup_group:<sp/>%sallocated<sp/>a<sp/>new<sp/>group<sp/>with<sp/>address<sp/>&quot;</highlight><highlight class="normal">,<sp/>(group?</highlight><highlight class="stringliteral">&quot;&quot;</highlight><highlight class="normal">:</highlight><highlight class="stringliteral">&quot;impossible<sp/>to<sp/>&quot;</highlight><highlight class="normal">)));</highlight></codeline>
<codeline lineno="282"><highlight class="normal"><sp/><sp/>ip4_addr_debug_print(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>addr);</highlight></codeline>
<codeline lineno="283"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;<sp/>on<sp/>if<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)ifp));</highlight></codeline>
<codeline lineno="284"><highlight class="normal"></highlight></codeline>
<codeline lineno="285"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>group;</highlight></codeline>
<codeline lineno="286"><highlight class="normal">}</highlight></codeline>
<codeline lineno="287"><highlight class="normal"></highlight></codeline>
<codeline lineno="294"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="295"><highlight class="normal">igmp_remove_group(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref>*<sp/><ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>igmp_group<sp/>*group)</highlight></codeline>
<codeline lineno="296"><highlight class="normal">{</highlight></codeline>
<codeline lineno="297"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="298"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*tmp_group;</highlight></codeline>
<codeline lineno="299"><highlight class="normal"></highlight></codeline>
<codeline lineno="300"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Skip<sp/>the<sp/>first<sp/>group<sp/>in<sp/>the<sp/>list,<sp/>it<sp/>is<sp/>always<sp/>the<sp/>allsystems<sp/>group<sp/>added<sp/>in<sp/>igmp_start()<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="301"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">for</highlight><highlight class="normal"><sp/>(tmp_group<sp/>=<sp/>netif_igmp_data(<ref refid="structnetif" kindref="compound">netif</ref>);<sp/>tmp_group<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;<sp/>tmp_group<sp/>=<sp/>tmp_group-&gt;next)<sp/>{</highlight></codeline>
<codeline lineno="302"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tmp_group-&gt;next<sp/>==<sp/>group)<sp/>{</highlight></codeline>
<codeline lineno="303"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>tmp_group-&gt;next<sp/>=<sp/>group-&gt;next;</highlight></codeline>
<codeline lineno="304"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="305"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="306"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="307"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Group<sp/>not<sp/>found<sp/>in<sp/>the<sp/>global<sp/>igmp_group_list<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="308"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(tmp_group<sp/>==<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="309"><highlight class="normal"><sp/><sp/><sp/><sp/>err<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcab508ce0ebdf3ca735208b00a80a45c91" kindref="member">ERR_ARG</ref>;</highlight></codeline>
<codeline lineno="310"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="311"><highlight class="normal"></highlight></codeline>
<codeline lineno="312"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="313"><highlight class="normal">}</highlight></codeline>
<codeline lineno="314"><highlight class="normal"></highlight></codeline>
<codeline lineno="322"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="323"><highlight class="normal">igmp_input(</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="structnetif" kindref="compound">netif</ref><sp/>*inp,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*dest)</highlight></codeline>
<codeline lineno="324"><highlight class="normal">{</highlight></codeline>
<codeline lineno="325"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structigmp__msg" kindref="compound">igmp_msg</ref>*<sp/><sp/><sp/>igmp;</highlight></codeline>
<codeline lineno="326"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group*<sp/>group;</highlight></codeline>
<codeline lineno="327"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group*<sp/>groupref;</highlight></codeline>
<codeline lineno="328"><highlight class="normal"></highlight></codeline>
<codeline lineno="329"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.recv);</highlight></codeline>
<codeline lineno="330"><highlight class="normal"></highlight></codeline>
<codeline lineno="331"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Note<sp/>that<sp/>the<sp/>length<sp/>CAN<sp/>be<sp/>greater<sp/>than<sp/>8<sp/>but<sp/>only<sp/>8<sp/>are<sp/>used<sp/>-<sp/>All<sp/>are<sp/>included<sp/>in<sp/>the<sp/>checksum<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="332"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&lt;<sp/><ref refid="prot_2igmp_8h_1ad91c1a732326c16656dc7059f807acfd" kindref="member">IGMP_MINLEN</ref>)<sp/>{</highlight></codeline>
<codeline lineno="333"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="334"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.lenerr);</highlight></codeline>
<codeline lineno="335"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_input:<sp/>length<sp/>error\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="336"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="337"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="338"><highlight class="normal"></highlight></codeline>
<codeline lineno="339"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_input:<sp/>message<sp/>from<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="340"><highlight class="normal"><sp/><sp/>ip4_addr_debug_print(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>&amp;(ip4_current_header()-&gt;src));</highlight></codeline>
<codeline lineno="341"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;<sp/>to<sp/>address<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="342"><highlight class="normal"><sp/><sp/>ip4_addr_debug_print(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>&amp;(ip4_current_header()-&gt;dest));</highlight></codeline>
<codeline lineno="343"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;<sp/>on<sp/>if<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)inp));</highlight></codeline>
<codeline lineno="344"><highlight class="normal"></highlight></codeline>
<codeline lineno="345"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Now<sp/>calculate<sp/>and<sp/>check<sp/>the<sp/>checksum<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="346"><highlight class="normal"><sp/><sp/>igmp<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structigmp__msg" kindref="compound">igmp_msg</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="347"><highlight class="normal"><sp/><sp/>if<sp/>(<ref refid="inet__chksum_8h_1a34f1aa1587562a09e11b704b51bab043" kindref="member">inet_chksum</ref>(igmp,<sp/>p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref>))<sp/>{</highlight></codeline>
<codeline lineno="348"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="349"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.chkerr);</highlight></codeline>
<codeline lineno="350"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_input:<sp/>checksum<sp/>error\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="351"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="352"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="353"><highlight class="normal"></highlight></codeline>
<codeline lineno="354"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>Packet<sp/>is<sp/>ok<sp/>so<sp/>find<sp/>an<sp/>existing<sp/>group<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="355"><highlight class="normal"><sp/><sp/>group<sp/>=<sp/>igmp_lookfor_group(inp,<sp/>dest);<sp/></highlight><highlight class="comment">/*<sp/>use<sp/>the<sp/>destination<sp/>IP<sp/>address<sp/>of<sp/>incoming<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="356"><highlight class="normal"></highlight></codeline>
<codeline lineno="357"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>group<sp/>can<sp/>be<sp/>found<sp/>or<sp/>create...<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="358"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!group)<sp/>{</highlight></codeline>
<codeline lineno="359"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="360"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.drop);</highlight></codeline>
<codeline lineno="361"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_input:<sp/>IGMP<sp/>frame<sp/>not<sp/>for<sp/>us\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="362"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="363"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="364"><highlight class="normal"></highlight></codeline>
<codeline lineno="365"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>NOW<sp/>ACT<sp/>ON<sp/>THE<sp/>INCOMING<sp/>MESSAGE<sp/>TYPE...<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="366"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">switch</highlight><highlight class="normal"><sp/>(igmp-&gt;igmp_msgtype)<sp/>{</highlight></codeline>
<codeline lineno="367"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2igmp_8h_1a0f85ab43aac98cc525c4d21b45bb08c9" kindref="member">IGMP_MEMB_QUERY</ref>:</highlight></codeline>
<codeline lineno="368"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>IGMP_MEMB_QUERY<sp/>to<sp/>the<sp/>&quot;all<sp/>systems&quot;<sp/>address<sp/>?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="369"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((ip4_addr_cmp(dest,<sp/>&amp;allsystems))<sp/>&amp;&amp;<sp/>ip4_addr_isany(&amp;igmp-&gt;igmp_group_address))<sp/>{</highlight></codeline>
<codeline lineno="370"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>THIS<sp/>IS<sp/>THE<sp/>GENERAL<sp/>QUERY<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="371"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_input:<sp/>General<sp/>IGMP_MEMB_QUERY<sp/>on<sp/>\&quot;ALL<sp/>SYSTEMS\&quot;<sp/>address<sp/>(224.0.0.1)<sp/>[igmp_maxresp=%i]\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal">)(igmp-&gt;igmp_maxresp)));</highlight></codeline>
<codeline lineno="372"><highlight class="normal"></highlight></codeline>
<codeline lineno="373"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(igmp-&gt;igmp_maxresp<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="374"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.rx_v1);</highlight></codeline>
<codeline lineno="375"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_input:<sp/>got<sp/>an<sp/>all<sp/>hosts<sp/>query<sp/>with<sp/>time==<sp/>0<sp/>-<sp/>this<sp/>is<sp/>V1<sp/>and<sp/>not<sp/>implemented<sp/>-<sp/>treat<sp/>as<sp/>v2\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="376"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>igmp-&gt;igmp_maxresp<sp/>=<sp/>IGMP_V1_DELAYING_MEMBER_TMR;</highlight></codeline>
<codeline lineno="377"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="378"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.rx_general);</highlight></codeline>
<codeline lineno="379"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="380"><highlight class="normal"></highlight></codeline>
<codeline lineno="381"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>groupref<sp/>=<sp/>netif_igmp_data(inp);</highlight></codeline>
<codeline lineno="382"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="383"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Do<sp/>not<sp/>send<sp/>messages<sp/>on<sp/>the<sp/>all<sp/>systems<sp/>group<sp/>address!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="384"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Skip<sp/>the<sp/>first<sp/>group<sp/>in<sp/>the<sp/>list,<sp/>it<sp/>is<sp/>always<sp/>the<sp/>allsystems<sp/>group<sp/>added<sp/>in<sp/>igmp_start()<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="385"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal">(groupref<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="386"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>groupref<sp/>=<sp/>groupref-&gt;next;</highlight></codeline>
<codeline lineno="387"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="388"><highlight class="normal"></highlight></codeline>
<codeline lineno="389"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(groupref)<sp/>{</highlight></codeline>
<codeline lineno="390"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>igmp_delaying_member(groupref,<sp/>igmp-&gt;igmp_maxresp);</highlight></codeline>
<codeline lineno="391"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>groupref<sp/>=<sp/>groupref-&gt;next;</highlight></codeline>
<codeline lineno="392"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="393"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="394"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>IGMP_MEMB_QUERY<sp/>to<sp/>a<sp/>specific<sp/>group<sp/>?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="395"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(!ip4_addr_isany(&amp;igmp-&gt;igmp_group_address))<sp/>{</highlight></codeline>
<codeline lineno="396"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_input:<sp/>IGMP_MEMB_QUERY<sp/>to<sp/>a<sp/>specific<sp/>group<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="397"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_debug_print(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>&amp;igmp-&gt;igmp_group_address);</highlight></codeline>
<codeline lineno="398"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(ip4_addr_cmp(dest,<sp/>&amp;allsystems))<sp/>{</highlight></codeline>
<codeline lineno="399"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_t<sp/>groupaddr;</highlight></codeline>
<codeline lineno="400"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;<sp/>using<sp/>\&quot;ALL<sp/>SYSTEMS\&quot;<sp/>address<sp/>(224.0.0.1)<sp/>[igmp_maxresp=%i]\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal">)(igmp-&gt;igmp_maxresp)));</highlight></codeline>
<codeline lineno="401"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>we<sp/>first<sp/>need<sp/>to<sp/>re-look<sp/>for<sp/>the<sp/>group<sp/>since<sp/>we<sp/>used<sp/>dest<sp/>last<sp/>time<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="402"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_copy(groupaddr,<sp/>igmp-&gt;igmp_group_address);</highlight></codeline>
<codeline lineno="403"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>group<sp/>=<sp/>igmp_lookfor_group(inp,<sp/>&amp;groupaddr);</highlight></codeline>
<codeline lineno="404"><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="405"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;<sp/>with<sp/>the<sp/>group<sp/>address<sp/>as<sp/>destination<sp/>[igmp_maxresp=%i]\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">int</highlight><highlight class="normal">)(igmp-&gt;igmp_maxresp)));</highlight></codeline>
<codeline lineno="406"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="407"><highlight class="normal"></highlight></codeline>
<codeline lineno="408"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(group<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="409"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.rx_group);</highlight></codeline>
<codeline lineno="410"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>igmp_delaying_member(group,<sp/>igmp-&gt;igmp_maxresp);</highlight></codeline>
<codeline lineno="411"><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="412"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.drop);</highlight></codeline>
<codeline lineno="413"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="414"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="415"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.proterr);</highlight></codeline>
<codeline lineno="416"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="417"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="418"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="419"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">case</highlight><highlight class="normal"><sp/><ref refid="prot_2igmp_8h_1a26b6b8b5dc43098b16d417a29b31a9e0" kindref="member">IGMP_V2_MEMB_REPORT</ref>:</highlight></codeline>
<codeline lineno="420"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_input:<sp/>IGMP_V2_MEMB_REPORT\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="421"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.rx_report);</highlight></codeline>
<codeline lineno="422"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(group-&gt;group_state<sp/>==<sp/><ref refid="prot_2igmp_8h_1a9c2129b3fb6f212eac44192ced19d33d" kindref="member">IGMP_GROUP_DELAYING_MEMBER</ref>)<sp/>{</highlight></codeline>
<codeline lineno="423"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>is<sp/>on<sp/>a<sp/>specific<sp/>group<sp/>we<sp/>have<sp/>already<sp/>looked<sp/>up<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="424"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>group-&gt;timer<sp/>=<sp/>0;<sp/></highlight><highlight class="comment">/*<sp/>stopped<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="425"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>group-&gt;group_state<sp/>=<sp/><ref refid="prot_2igmp_8h_1a5b9419fe533da22ca7015cac97e8b1e3" kindref="member">IGMP_GROUP_IDLE_MEMBER</ref>;</highlight></codeline>
<codeline lineno="426"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>group-&gt;last_reporter_flag<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="427"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="428"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="429"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">default</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="430"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_input:<sp/>unexpected<sp/>msg<sp/>%d<sp/>in<sp/>state<sp/>%d<sp/>on<sp/>group<sp/>%p<sp/>on<sp/>if<sp/>%p\n&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="431"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>igmp-&gt;igmp_msgtype,<sp/>group-&gt;group_state,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)&amp;group,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)inp));</highlight></codeline>
<codeline lineno="432"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.proterr);</highlight></codeline>
<codeline lineno="433"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">break</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="434"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="435"><highlight class="normal"></highlight></codeline>
<codeline lineno="436"><highlight class="normal"><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="437"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="438"><highlight class="normal">}</highlight></codeline>
<codeline lineno="439"><highlight class="normal"></highlight></codeline>
<codeline lineno="448"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="449"><highlight class="normal">igmp_joingroup(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ifaddr,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*groupaddr)</highlight></codeline>
<codeline lineno="450"><highlight class="normal">{</highlight></codeline>
<codeline lineno="451"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;<sp/></highlight><highlight class="comment">/*<sp/>no<sp/>matching<sp/>interface<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="452"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="453"><highlight class="normal"></highlight></codeline>
<codeline lineno="454"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>make<sp/>sure<sp/>it<sp/>is<sp/>multicast<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="455"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;igmp_joingroup:<sp/>attempt<sp/>to<sp/>join<sp/>non-multicast<sp/>address&quot;</highlight><highlight class="normal">,<sp/>ip4_addr_ismulticast(groupaddr),<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="456"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;igmp_joingroup:<sp/>attempt<sp/>to<sp/>join<sp/>allsystems<sp/>address&quot;</highlight><highlight class="normal">,<sp/>(!ip4_addr_cmp(groupaddr,<sp/>&amp;allsystems)),<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="457"><highlight class="normal"></highlight></codeline>
<codeline lineno="458"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>loop<sp/>through<sp/>netif&apos;s<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="459"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="netif_8h_1a1c8141eaa98f6dc6dfddbb23a706656c" kindref="member">netif_list</ref>;</highlight></codeline>
<codeline lineno="460"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="461"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Should<sp/>we<sp/>join<sp/>this<sp/>interface<sp/>?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="462"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="group__netif__flags_1gac9493b923d733c73f6006d9714826558" kindref="member">NETIF_FLAG_IGMP</ref>)<sp/>&amp;&amp;<sp/>((ip4_addr_isany(ifaddr)<sp/>||<sp/>ip4_addr_cmp(netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>),<sp/>ifaddr))))<sp/>{</highlight></codeline>
<codeline lineno="463"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>err<sp/>=<sp/>igmp_joingroup_netif(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>groupaddr);</highlight></codeline>
<codeline lineno="464"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="465"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Return<sp/>an<sp/>error<sp/>even<sp/>if<sp/>some<sp/>network<sp/>interfaces<sp/>are<sp/>joined<sp/>*/</highlight></codeline>
<codeline lineno="467"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="468"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="469"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="470"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>proceed<sp/>to<sp/>next<sp/>network<sp/>interface<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="471"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ae77736b64df442242795220d76be6b86" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="472"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="473"><highlight class="normal"></highlight></codeline>
<codeline lineno="474"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="475"><highlight class="normal">}</highlight></codeline>
<codeline lineno="476"><highlight class="normal"></highlight></codeline>
<codeline lineno="485"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="486"><highlight class="normal">igmp_joingroup_netif(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*groupaddr)</highlight></codeline>
<codeline lineno="487"><highlight class="normal">{</highlight></codeline>
<codeline lineno="488"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*group;</highlight></codeline>
<codeline lineno="489"><highlight class="normal"></highlight></codeline>
<codeline lineno="490"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>make<sp/>sure<sp/>it<sp/>is<sp/>multicast<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="491"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;igmp_joingroup_netif:<sp/>attempt<sp/>to<sp/>join<sp/>non-multicast<sp/>address&quot;</highlight><highlight class="normal">,<sp/>ip4_addr_ismulticast(groupaddr),<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="492"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;igmp_joingroup_netif:<sp/>attempt<sp/>to<sp/>join<sp/>allsystems<sp/>address&quot;</highlight><highlight class="normal">,<sp/>(!ip4_addr_cmp(groupaddr,<sp/>&amp;allsystems)),<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="493"><highlight class="normal"></highlight></codeline>
<codeline lineno="494"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>make<sp/>sure<sp/>it<sp/>is<sp/>an<sp/>igmp-enabled<sp/>netif<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="495"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;igmp_joingroup_netif:<sp/>attempt<sp/>to<sp/>join<sp/>on<sp/>non-IGMP<sp/>netif&quot;</highlight><highlight class="normal">,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="group__netif__flags_1gac9493b923d733c73f6006d9714826558" kindref="member">NETIF_FLAG_IGMP</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="496"><highlight class="normal"></highlight></codeline>
<codeline lineno="497"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>find<sp/>group<sp/>or<sp/>create<sp/>a<sp/>new<sp/>one<sp/>if<sp/>not<sp/>found<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="498"><highlight class="normal"><sp/><sp/>group<sp/>=<sp/>igmp_lookup_group(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>groupaddr);</highlight></codeline>
<codeline lineno="499"><highlight class="normal"></highlight></codeline>
<codeline lineno="500"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(group<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="501"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>should<sp/>create<sp/>a<sp/>new<sp/>group,<sp/>check<sp/>the<sp/>state<sp/>to<sp/>make<sp/>sure<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="502"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(group-&gt;group_state<sp/>!=<sp/><ref refid="prot_2igmp_8h_1a0357ddf34e5e88adaa654ad562adab54" kindref="member">IGMP_GROUP_NON_MEMBER</ref>)<sp/>{</highlight></codeline>
<codeline lineno="503"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_joingroup_netif:<sp/>join<sp/>to<sp/>group<sp/>not<sp/>in<sp/>state<sp/>IGMP_GROUP_NON_MEMBER\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="504"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="505"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>OK<sp/>-<sp/>it<sp/>was<sp/>new<sp/>group<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="506"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_joingroup_netif:<sp/>join<sp/>to<sp/>new<sp/>group:<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="507"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_debug_print(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>groupaddr);</highlight></codeline>
<codeline lineno="508"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="509"><highlight class="normal"></highlight></codeline>
<codeline lineno="510"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>first<sp/>use<sp/>of<sp/>the<sp/>group,<sp/>allow<sp/>the<sp/>group<sp/>at<sp/>the<sp/>MAC<sp/>level<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="511"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((group-&gt;use==0)<sp/>&amp;&amp;<sp/>(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;igmp_mac_filter<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>))<sp/>{</highlight></codeline>
<codeline lineno="512"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_joingroup_netif:<sp/>igmp_mac_filter(ADD<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="513"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_debug_print(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>groupaddr);</highlight></codeline>
<codeline lineno="514"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;)<sp/>on<sp/>if<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="515"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;igmp_mac_filter(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>groupaddr,<sp/><ref refid="netif_8h_1ab194ec4241fad8b6e9aac51e3ec23de0a4186fbaf94be956ea1a3b02cd1cccb1f" kindref="member">NETIF_ADD_MAC_FILTER</ref>);</highlight></codeline>
<codeline lineno="516"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="517"><highlight class="normal"></highlight></codeline>
<codeline lineno="518"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.tx_join);</highlight></codeline>
<codeline lineno="519"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>igmp_send(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>group,<sp/><ref refid="prot_2igmp_8h_1a26b6b8b5dc43098b16d417a29b31a9e0" kindref="member">IGMP_V2_MEMB_REPORT</ref>);</highlight></codeline>
<codeline lineno="520"><highlight class="normal"></highlight></codeline>
<codeline lineno="521"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>igmp_start_timer(group,<sp/>IGMP_JOIN_DELAYING_MEMBER_TMR);</highlight></codeline>
<codeline lineno="522"><highlight class="normal"></highlight></codeline>
<codeline lineno="523"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Need<sp/>to<sp/>work<sp/>out<sp/>where<sp/>this<sp/>timer<sp/>comes<sp/>from<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="524"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>group-&gt;group_state<sp/>=<sp/><ref refid="prot_2igmp_8h_1a9c2129b3fb6f212eac44192ced19d33d" kindref="member">IGMP_GROUP_DELAYING_MEMBER</ref>;</highlight></codeline>
<codeline lineno="525"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="526"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Increment<sp/>group<sp/>use<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="527"><highlight class="normal"><sp/><sp/><sp/><sp/>group-&gt;use++;</highlight></codeline>
<codeline lineno="528"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Join<sp/>on<sp/>this<sp/>interface<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="529"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>;</highlight></codeline>
<codeline lineno="530"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="531"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_joingroup_netif:<sp/>Not<sp/>enough<sp/>memory<sp/>to<sp/>join<sp/>to<sp/>group\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="532"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaaaeafdbf3aecc46864daa3cd829c7e05" kindref="member">ERR_MEM</ref>;</highlight></codeline>
<codeline lineno="533"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="534"><highlight class="normal">}</highlight></codeline>
<codeline lineno="535"><highlight class="normal"></highlight></codeline>
<codeline lineno="544"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="545"><highlight class="normal">igmp_leavegroup(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*ifaddr,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*groupaddr)</highlight></codeline>
<codeline lineno="546"><highlight class="normal">{</highlight></codeline>
<codeline lineno="547"><highlight class="normal"><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>err<sp/>=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;<sp/></highlight><highlight class="comment">/*<sp/>no<sp/>matching<sp/>interface<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="548"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>;</highlight></codeline>
<codeline lineno="549"><highlight class="normal"></highlight></codeline>
<codeline lineno="550"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>make<sp/>sure<sp/>it<sp/>is<sp/>multicast<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="551"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;igmp_leavegroup:<sp/>attempt<sp/>to<sp/>leave<sp/>non-multicast<sp/>address&quot;</highlight><highlight class="normal">,<sp/>ip4_addr_ismulticast(groupaddr),<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="552"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;igmp_leavegroup:<sp/>attempt<sp/>to<sp/>leave<sp/>allsystems<sp/>address&quot;</highlight><highlight class="normal">,<sp/>(!ip4_addr_cmp(groupaddr,<sp/>&amp;allsystems)),<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="553"><highlight class="normal"></highlight></codeline>
<codeline lineno="554"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>loop<sp/>through<sp/>netif&apos;s<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="555"><highlight class="normal"><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="netif_8h_1a1c8141eaa98f6dc6dfddbb23a706656c" kindref="member">netif_list</ref>;</highlight></codeline>
<codeline lineno="556"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="557"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Should<sp/>we<sp/>leave<sp/>this<sp/>interface<sp/>?<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="558"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((<ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="group__netif__flags_1gac9493b923d733c73f6006d9714826558" kindref="member">NETIF_FLAG_IGMP</ref>)<sp/>&amp;&amp;<sp/>((ip4_addr_isany(ifaddr)<sp/>||<sp/>ip4_addr_cmp(netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>),<sp/>ifaddr))))<sp/>{</highlight></codeline>
<codeline lineno="559"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref><sp/>res<sp/>=<sp/>igmp_leavegroup_netif(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>groupaddr);</highlight></codeline>
<codeline lineno="560"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(err<sp/>!=<sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa26c163b80b1f6786ca81dadc14b00fb" kindref="member">ERR_OK</ref>)<sp/>{</highlight></codeline>
<codeline lineno="561"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Store<sp/>this<sp/>result<sp/>if<sp/>we<sp/>have<sp/>not<sp/>yet<sp/>gotten<sp/>a<sp/>success<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="562"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>err<sp/>=<sp/>res;</highlight></codeline>
<codeline lineno="563"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="564"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="565"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>proceed<sp/>to<sp/>next<sp/>network<sp/>interface<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="566"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ae77736b64df442242795220d76be6b86" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="567"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="568"><highlight class="normal"></highlight></codeline>
<codeline lineno="569"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>err;</highlight></codeline>
<codeline lineno="570"><highlight class="normal">}</highlight></codeline>
<codeline lineno="571"><highlight class="normal"></highlight></codeline>
<codeline lineno="580"><highlight class="normal"><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="581"><highlight class="normal">igmp_leavegroup_netif(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*groupaddr)</highlight></codeline>
<codeline lineno="582"><highlight class="normal">{</highlight></codeline>
<codeline lineno="583"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*group;</highlight></codeline>
<codeline lineno="584"><highlight class="normal"></highlight></codeline>
<codeline lineno="585"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>make<sp/>sure<sp/>it<sp/>is<sp/>multicast<sp/>address<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="586"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;igmp_leavegroup_netif:<sp/>attempt<sp/>to<sp/>leave<sp/>non-multicast<sp/>address&quot;</highlight><highlight class="normal">,<sp/>ip4_addr_ismulticast(groupaddr),<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="587"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;igmp_leavegroup_netif:<sp/>attempt<sp/>to<sp/>leave<sp/>allsystems<sp/>address&quot;</highlight><highlight class="normal">,<sp/>(!ip4_addr_cmp(groupaddr,<sp/>&amp;allsystems)),<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="588"><highlight class="normal"></highlight></codeline>
<codeline lineno="589"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>make<sp/>sure<sp/>it<sp/>is<sp/>an<sp/>igmp-enabled<sp/>netif<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="590"><highlight class="normal"><sp/><sp/><ref refid="debug_8h_1a827bc03cd7889e7c007df39d33b33d18" kindref="member">LWIP_ERROR</ref>(</highlight><highlight class="stringliteral">&quot;igmp_leavegroup_netif:<sp/>attempt<sp/>to<sp/>leave<sp/>on<sp/>non-IGMP<sp/>netif&quot;</highlight><highlight class="normal">,<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1a1c171db6097bbb6f09f63549a66e00ea" kindref="member">flags</ref><sp/>&amp;<sp/><ref refid="group__netif__flags_1gac9493b923d733c73f6006d9714826558" kindref="member">NETIF_FLAG_IGMP</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="591"><highlight class="normal"></highlight></codeline>
<codeline lineno="592"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>find<sp/>group<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="593"><highlight class="normal"><sp/><sp/>group<sp/>=<sp/>igmp_lookfor_group(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>groupaddr);</highlight></codeline>
<codeline lineno="594"><highlight class="normal"></highlight></codeline>
<codeline lineno="595"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(group<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="596"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Only<sp/>send<sp/>a<sp/>leave<sp/>if<sp/>the<sp/>flag<sp/>is<sp/>set<sp/>according<sp/>to<sp/>the<sp/>state<sp/>diagram<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="597"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_leavegroup_netif:<sp/>Leaving<sp/>group:<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="598"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_debug_print(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>groupaddr);</highlight></codeline>
<codeline lineno="599"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="600"><highlight class="normal"></highlight></codeline>
<codeline lineno="601"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>there<sp/>is<sp/>no<sp/>other<sp/>use<sp/>of<sp/>the<sp/>group<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="602"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(group-&gt;use<sp/>&lt;=<sp/>1)<sp/>{</highlight></codeline>
<codeline lineno="603"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Remove<sp/>the<sp/>group<sp/>from<sp/>the<sp/>list<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="604"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>igmp_remove_group(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>group);</highlight></codeline>
<codeline lineno="605"><highlight class="normal"></highlight></codeline>
<codeline lineno="606"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>we<sp/>are<sp/>the<sp/>last<sp/>reporter<sp/>for<sp/>this<sp/>group<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="607"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(group-&gt;last_reporter_flag)<sp/>{</highlight></codeline>
<codeline lineno="608"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_leavegroup_netif:<sp/>sending<sp/>leaving<sp/>group\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="609"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.tx_leave);</highlight></codeline>
<codeline lineno="610"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>igmp_send(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>group,<sp/><ref refid="prot_2igmp_8h_1a4d87457009ed27ade2309cebe7a1dfcf" kindref="member">IGMP_LEAVE_GROUP</ref>);</highlight></codeline>
<codeline lineno="611"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="612"><highlight class="normal"></highlight></codeline>
<codeline lineno="613"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Disable<sp/>the<sp/>group<sp/>at<sp/>the<sp/>MAC<sp/>level<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="614"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref>-&gt;igmp_mac_filter<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="615"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_leavegroup_netif:<sp/>igmp_mac_filter(DEL<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="616"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_debug_print(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>groupaddr);</highlight></codeline>
<codeline lineno="617"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;)<sp/>on<sp/>if<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="618"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;igmp_mac_filter(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>groupaddr,<sp/><ref refid="netif_8h_1ab194ec4241fad8b6e9aac51e3ec23de0a7ad3406353906deb4e64ebeed349e07e" kindref="member">NETIF_DEL_MAC_FILTER</ref>);</highlight></codeline>
<codeline lineno="619"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="620"><highlight class="normal"></highlight></codeline>
<codeline lineno="621"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Free<sp/>group<sp/>struct<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="622"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><ref refid="memp_8h_1aecd94926b7c2a0e23ae195f4ae97581f" kindref="member">memp_free</ref>(MEMP_IGMP_GROUP,<sp/>group);</highlight></codeline>
<codeline lineno="623"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="624"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="comment">/*<sp/>Decrement<sp/>group<sp/>use<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="625"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>group-&gt;use--;</highlight></codeline>
<codeline lineno="626"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="627"><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="628"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="629"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_leavegroup_netif:<sp/>not<sp/>member<sp/>of<sp/>group\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="630"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1ggae2e66c7d13afc90ffecd6151680fbadcaa9a1c5a6fdeed0aad7fe41d538482bbd" kindref="member">ERR_VAL</ref>;</highlight></codeline>
<codeline lineno="631"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="632"><highlight class="normal">}</highlight></codeline>
<codeline lineno="633"><highlight class="normal"></highlight></codeline>
<codeline lineno="638"><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="639"><highlight class="normal">igmp_tmr(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">)</highlight></codeline>
<codeline lineno="640"><highlight class="normal">{</highlight></codeline>
<codeline lineno="641"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="netif_8h_1a1c8141eaa98f6dc6dfddbb23a706656c" kindref="member">netif_list</ref>;</highlight></codeline>
<codeline lineno="642"><highlight class="normal"></highlight></codeline>
<codeline lineno="643"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(<ref refid="structnetif" kindref="compound">netif</ref><sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="644"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">igmp_group<sp/>*group<sp/>=<sp/>netif_igmp_data(<ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="645"><highlight class="normal"></highlight></codeline>
<codeline lineno="646"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">while</highlight><highlight class="normal"><sp/>(group<sp/>!=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>)<sp/>{</highlight></codeline>
<codeline lineno="647"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(group-&gt;timer<sp/>&gt;<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="648"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>group-&gt;timer--;</highlight></codeline>
<codeline lineno="649"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(group-&gt;timer<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="650"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>igmp_timeout(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>group);</highlight></codeline>
<codeline lineno="651"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="652"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="653"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>group<sp/>=<sp/>group-&gt;next;</highlight></codeline>
<codeline lineno="654"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="655"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>=<sp/><ref refid="structnetif" kindref="compound">netif</ref>-&gt;<ref refid="structnetif_1ae77736b64df442242795220d76be6b86" kindref="member">next</ref>;</highlight></codeline>
<codeline lineno="656"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="657"><highlight class="normal">}</highlight></codeline>
<codeline lineno="658"><highlight class="normal"></highlight></codeline>
<codeline lineno="665"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="666"><highlight class="normal">igmp_timeout(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>igmp_group<sp/>*group)</highlight></codeline>
<codeline lineno="667"><highlight class="normal">{</highlight></codeline>
<codeline lineno="668"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>If<sp/>the<sp/>state<sp/>is<sp/>IGMP_GROUP_DELAYING_MEMBER<sp/>then<sp/>we<sp/>send<sp/>a<sp/>report<sp/>for<sp/>this<sp/>group</highlight></codeline>
<codeline lineno="669"><highlight class="comment"><sp/><sp/><sp/><sp/><sp/>(unless<sp/>it<sp/>is<sp/>the<sp/>allsystems<sp/>group)<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="670"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((group-&gt;group_state<sp/>==<sp/><ref refid="prot_2igmp_8h_1a9c2129b3fb6f212eac44192ced19d33d" kindref="member">IGMP_GROUP_DELAYING_MEMBER</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="671"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>(!(ip4_addr_cmp(&amp;(group-&gt;group_address),<sp/>&amp;allsystems))))<sp/>{</highlight></codeline>
<codeline lineno="672"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_timeout:<sp/>report<sp/>membership<sp/>for<sp/>group<sp/>with<sp/>address<sp/>&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="673"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_debug_print(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>&amp;(group-&gt;group_address));</highlight></codeline>
<codeline lineno="674"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;<sp/>on<sp/>if<sp/>%p\n&quot;</highlight><highlight class="normal">,<sp/>(</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">*)<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="675"><highlight class="normal"></highlight></codeline>
<codeline lineno="676"><highlight class="normal"><sp/><sp/><sp/><sp/>group-&gt;group_state<sp/>=<sp/><ref refid="prot_2igmp_8h_1a5b9419fe533da22ca7015cac97e8b1e3" kindref="member">IGMP_GROUP_IDLE_MEMBER</ref>;</highlight></codeline>
<codeline lineno="677"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight></codeline>
<codeline lineno="678"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.tx_report);</highlight></codeline>
<codeline lineno="679"><highlight class="normal"><sp/><sp/><sp/><sp/>igmp_send(<ref refid="structnetif" kindref="compound">netif</ref>,<sp/>group,<sp/><ref refid="prot_2igmp_8h_1a26b6b8b5dc43098b16d417a29b31a9e0" kindref="member">IGMP_V2_MEMB_REPORT</ref>);</highlight></codeline>
<codeline lineno="680"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="681"><highlight class="normal">}</highlight></codeline>
<codeline lineno="682"><highlight class="normal"></highlight></codeline>
<codeline lineno="690"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="691"><highlight class="normal">igmp_start_timer(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>igmp_group<sp/>*group,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>max_time)</highlight></codeline>
<codeline lineno="692"><highlight class="normal">{</highlight></codeline>
<codeline lineno="693"><highlight class="normal"></highlight><highlight class="preprocessor">#ifdef<sp/>LWIP_RAND</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="694"><highlight class="normal"><sp/><sp/>group-&gt;timer<sp/>=<sp/>max_time<sp/>&gt;<sp/>2<sp/>?<sp/>(LWIP_RAND()<sp/>%<sp/>max_time)<sp/>:<sp/>1;</highlight></codeline>
<codeline lineno="695"><highlight class="normal"></highlight><highlight class="preprocessor">#else<sp/></highlight><highlight class="comment">/*<sp/>LWIP_RAND<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="696"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>ATTENTION:<sp/>use<sp/>this<sp/>only<sp/>if<sp/>absolutely<sp/>necessary!<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="697"><highlight class="normal"><sp/><sp/>group-&gt;timer<sp/>=<sp/>max_time<sp/>/<sp/>2;</highlight></codeline>
<codeline lineno="698"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_RAND<sp/>*/</highlight><highlight class="preprocessor"></highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="699"><highlight class="normal"></highlight></codeline>
<codeline lineno="700"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(group-&gt;timer<sp/>==<sp/>0)<sp/>{</highlight></codeline>
<codeline lineno="701"><highlight class="normal"><sp/><sp/><sp/><sp/>group-&gt;timer<sp/>=<sp/>1;</highlight></codeline>
<codeline lineno="702"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="703"><highlight class="normal">}</highlight></codeline>
<codeline lineno="704"><highlight class="normal"></highlight></codeline>
<codeline lineno="711"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="712"><highlight class="normal">igmp_delaying_member(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>igmp_group<sp/>*group,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>maxresp)</highlight></codeline>
<codeline lineno="713"><highlight class="normal">{</highlight></codeline>
<codeline lineno="714"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((group-&gt;group_state<sp/>==<sp/><ref refid="prot_2igmp_8h_1a5b9419fe533da22ca7015cac97e8b1e3" kindref="member">IGMP_GROUP_IDLE_MEMBER</ref>)<sp/>||</highlight></codeline>
<codeline lineno="715"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/>((group-&gt;group_state<sp/>==<sp/><ref refid="prot_2igmp_8h_1a9c2129b3fb6f212eac44192ced19d33d" kindref="member">IGMP_GROUP_DELAYING_MEMBER</ref>)<sp/>&amp;&amp;</highlight></codeline>
<codeline lineno="716"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>((group-&gt;timer<sp/>==<sp/>0)<sp/>||<sp/>(maxresp<sp/>&lt;<sp/>group-&gt;timer))))<sp/>{</highlight></codeline>
<codeline lineno="717"><highlight class="normal"><sp/><sp/><sp/><sp/>igmp_start_timer(group,<sp/>maxresp);</highlight></codeline>
<codeline lineno="718"><highlight class="normal"><sp/><sp/><sp/><sp/>group-&gt;group_state<sp/>=<sp/><ref refid="prot_2igmp_8h_1a9c2129b3fb6f212eac44192ced19d33d" kindref="member">IGMP_GROUP_DELAYING_MEMBER</ref>;</highlight></codeline>
<codeline lineno="719"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="720"><highlight class="normal">}</highlight></codeline>
<codeline lineno="721"><highlight class="normal"></highlight></codeline>
<codeline lineno="722"><highlight class="normal"></highlight></codeline>
<codeline lineno="739"><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="group__infrastructure__errors_1gaf02d9da80fd66b4f986d2c53d7231ddb" kindref="member">err_t</ref></highlight></codeline>
<codeline lineno="740"><highlight class="normal">igmp_ip_output_if(</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/>ip4_addr_t<sp/>*src,<sp/></highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/>ip4_addr_t<sp/>*dest,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>)</highlight></codeline>
<codeline lineno="741"><highlight class="normal">{</highlight></codeline>
<codeline lineno="742"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>This<sp/>is<sp/>the<sp/>&quot;router<sp/>alert&quot;<sp/>option<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="743"><highlight class="normal"><sp/><sp/><ref refid="group__compiler__abstraction_1ga77570ac4fcab86864fa1916e55676da2" kindref="member">u16_t</ref><sp/>ra[2];</highlight></codeline>
<codeline lineno="744"><highlight class="normal"><sp/><sp/>ra[0]<sp/>=<sp/><ref refid="def_8h_1a0dfd02d7c09f9c698a5a7ecc0b7287ad" kindref="member">PP_HTONS</ref>(<ref refid="prot_2igmp_8h_1a0b0944c1c4f2a64c79831d18f7d31802" kindref="member">ROUTER_ALERT</ref>);</highlight></codeline>
<codeline lineno="745"><highlight class="normal"><sp/><sp/>ra[1]<sp/>=<sp/>0x0000;<sp/></highlight><highlight class="comment">/*<sp/>Router<sp/>shall<sp/>examine<sp/>packet<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="746"><highlight class="normal"><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.xmit);</highlight></codeline>
<codeline lineno="747"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>ip4_output_if_opt(p,<sp/>src,<sp/>dest,<sp/><ref refid="prot_2igmp_8h_1a6ff76a6f7654b21a70e216151c97a869" kindref="member">IGMP_TTL</ref>,<sp/>0,<sp/><ref refid="prot_2ip_8h_1a4f8609139fce15ace0c6d117021e29a4" kindref="member">IP_PROTO_IGMP</ref>,<sp/><ref refid="structnetif" kindref="compound">netif</ref>,<sp/>ra,<sp/><ref refid="prot_2igmp_8h_1aa4bce84f942c375b780404c56f0ed51c" kindref="member">ROUTER_ALERTLEN</ref>);</highlight></codeline>
<codeline lineno="748"><highlight class="normal">}</highlight></codeline>
<codeline lineno="749"><highlight class="normal"></highlight></codeline>
<codeline lineno="756"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="757"><highlight class="normal">igmp_send(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structnetif" kindref="compound">netif</ref><sp/>*<ref refid="structnetif" kindref="compound">netif</ref>,<sp/></highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/>igmp_group<sp/>*group,<sp/><ref refid="group__compiler__abstraction_1ga4caecabca98b43919dd11be1c0d4cd8e" kindref="member">u8_t</ref><sp/>type)</highlight></codeline>
<codeline lineno="758"><highlight class="normal">{</highlight></codeline>
<codeline lineno="759"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structpbuf" kindref="compound">pbuf</ref>*<sp/><sp/><sp/><sp/><sp/>p<sp/><sp/><sp/><sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="760"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structigmp__msg" kindref="compound">igmp_msg</ref>*<sp/>igmp<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="761"><highlight class="normal"><sp/><sp/>ip4_addr_t<sp/><sp/><sp/>src<sp/><sp/>=<sp/>*IP4_ADDR_ANY4;</highlight></codeline>
<codeline lineno="762"><highlight class="normal"><sp/><sp/>ip4_addr_t*<sp/><sp/>dest<sp/>=<sp/><ref refid="fat__string_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4" kindref="member">NULL</ref>;</highlight></codeline>
<codeline lineno="763"><highlight class="normal"></highlight></codeline>
<codeline lineno="764"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">/*<sp/>IP<sp/>header<sp/>+<sp/>&quot;router<sp/>alert&quot;<sp/>option<sp/>+<sp/>IGMP<sp/>header<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="765"><highlight class="normal"><sp/><sp/>p<sp/>=<sp/><ref refid="group__pbuf_1gacfcb0a2af918658ba0afe36499c65f47" kindref="member">pbuf_alloc</ref>(<ref refid="group__pbuf_1ggaee1baa59bb2f85ba575b5a8619ac1ebfa2ded3594a3977f8bf9cf09552be327b5" kindref="member">PBUF_TRANSPORT</ref>,<sp/><ref refid="prot_2igmp_8h_1ad91c1a732326c16656dc7059f807acfd" kindref="member">IGMP_MINLEN</ref>,<sp/><ref refid="group__pbuf_1ggab7e0e32fcc292c0d7107721766ed92fbac5e9f28455bca98944a030d4b84ecfab" kindref="member">PBUF_RAM</ref>);</highlight></codeline>
<codeline lineno="766"><highlight class="normal"></highlight></codeline>
<codeline lineno="767"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(p)<sp/>{</highlight></codeline>
<codeline lineno="768"><highlight class="normal"><sp/><sp/><sp/><sp/>igmp<sp/>=<sp/>(</highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal"><ref refid="structigmp__msg" kindref="compound">igmp_msg</ref><sp/>*)p-&gt;<ref refid="structpbuf_1a8d32dc3e964369d4eec638fc37fbc460" kindref="member">payload</ref>;</highlight></codeline>
<codeline lineno="769"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a94ad086267808462beae2b38f91996ed" kindref="member">LWIP_ASSERT</ref>(</highlight><highlight class="stringliteral">&quot;igmp_send:<sp/>check<sp/>that<sp/>first<sp/>pbuf<sp/>can<sp/>hold<sp/>struct<sp/>igmp_msg&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="770"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>(p-&gt;<ref refid="structpbuf_1a6f82449625e36e294f5d210268c0703f" kindref="member">len</ref><sp/>&gt;=<sp/></highlight><highlight class="keyword">sizeof</highlight><highlight class="normal">(</highlight><highlight class="keyword">struct</highlight><highlight class="normal"><sp/><ref refid="structigmp__msg" kindref="compound">igmp_msg</ref>)));</highlight></codeline>
<codeline lineno="771"><highlight class="normal"><sp/><sp/><sp/><sp/>ip4_addr_copy(src,<sp/>*netif_ip4_addr(<ref refid="structnetif" kindref="compound">netif</ref>));</highlight></codeline>
<codeline lineno="772"><highlight class="normal"></highlight></codeline>
<codeline lineno="773"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(type<sp/>==<sp/><ref refid="prot_2igmp_8h_1a26b6b8b5dc43098b16d417a29b31a9e0" kindref="member">IGMP_V2_MEMB_REPORT</ref>)<sp/>{</highlight></codeline>
<codeline lineno="774"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>dest<sp/>=<sp/>&amp;(group-&gt;group_address);</highlight></codeline>
<codeline lineno="775"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_copy(igmp-&gt;igmp_group_address,<sp/>group-&gt;group_address);</highlight></codeline>
<codeline lineno="776"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>group-&gt;last_reporter_flag<sp/>=<sp/>1;<sp/></highlight><highlight class="comment">/*<sp/>Remember<sp/>we<sp/>were<sp/>the<sp/>last<sp/>to<sp/>report<sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="777"><highlight class="normal"><sp/><sp/><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="778"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>(type<sp/>==<sp/><ref refid="prot_2igmp_8h_1a4d87457009ed27ade2309cebe7a1dfcf" kindref="member">IGMP_LEAVE_GROUP</ref>)<sp/>{</highlight></codeline>
<codeline lineno="779"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>dest<sp/>=<sp/>&amp;allrouters;</highlight></codeline>
<codeline lineno="780"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>ip4_addr_copy(igmp-&gt;igmp_group_address,<sp/>group-&gt;group_address);</highlight></codeline>
<codeline lineno="781"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="782"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="783"><highlight class="normal"></highlight></codeline>
<codeline lineno="784"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">if</highlight><highlight class="normal"><sp/>((type<sp/>==<sp/><ref refid="prot_2igmp_8h_1a26b6b8b5dc43098b16d417a29b31a9e0" kindref="member">IGMP_V2_MEMB_REPORT</ref>)<sp/>||<sp/>(type<sp/>==<sp/><ref refid="prot_2igmp_8h_1a4d87457009ed27ade2309cebe7a1dfcf" kindref="member">IGMP_LEAVE_GROUP</ref>))<sp/>{</highlight></codeline>
<codeline lineno="785"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>igmp-&gt;igmp_msgtype<sp/><sp/>=<sp/>type;</highlight></codeline>
<codeline lineno="786"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>igmp-&gt;igmp_maxresp<sp/><sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="787"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>igmp-&gt;igmp_checksum<sp/>=<sp/>0;</highlight></codeline>
<codeline lineno="788"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>igmp-&gt;igmp_checksum<sp/>=<sp/><ref refid="inet__chksum_8h_1a34f1aa1587562a09e11b704b51bab043" kindref="member">inet_chksum</ref>(igmp,<sp/><ref refid="prot_2igmp_8h_1ad91c1a732326c16656dc7059f807acfd" kindref="member">IGMP_MINLEN</ref>);</highlight></codeline>
<codeline lineno="789"><highlight class="normal"></highlight></codeline>
<codeline lineno="790"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/>igmp_ip_output_if(p,<sp/>&amp;src,<sp/>dest,<sp/><ref refid="structnetif" kindref="compound">netif</ref>);</highlight></codeline>
<codeline lineno="791"><highlight class="normal"><sp/><sp/><sp/><sp/>}</highlight></codeline>
<codeline lineno="792"><highlight class="normal"></highlight></codeline>
<codeline lineno="793"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="group__pbuf_1gab0dd696fb4b6bc65e548944584f1738b" kindref="member">pbuf_free</ref>(p);</highlight></codeline>
<codeline lineno="794"><highlight class="normal"><sp/><sp/>}<sp/></highlight><highlight class="keywordflow">else</highlight><highlight class="normal"><sp/>{</highlight></codeline>
<codeline lineno="795"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="debug_8h_1a63a04edf7ff63c951bd8706711956cdb" kindref="member">LWIP_DEBUGF</ref>(<ref refid="lwipopts_8h_1a8da07508ee75704362d45eee3eb857fa" kindref="member">IGMP_DEBUG</ref>,<sp/>(</highlight><highlight class="stringliteral">&quot;igmp_send:<sp/>not<sp/>enough<sp/>memory<sp/>for<sp/>igmp_send\n&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="796"><highlight class="normal"><sp/><sp/><sp/><sp/><ref refid="stats_8h_1ad4ddb71a8ddf444971069c1569f0cd03" kindref="member">IGMP_STATS_INC</ref>(igmp.memerr);</highlight></codeline>
<codeline lineno="797"><highlight class="normal"><sp/><sp/>}</highlight></codeline>
<codeline lineno="798"><highlight class="normal">}</highlight></codeline>
<codeline lineno="799"><highlight class="normal"></highlight></codeline>
<codeline lineno="800"><highlight class="normal"></highlight><highlight class="preprocessor">#endif<sp/></highlight><highlight class="comment">/*<sp/>LWIP_IPV4<sp/>&amp;&amp;<sp/>LWIP_IGMP<sp/>*/</highlight><highlight class="preprocessor"></highlight></codeline>
    </programlisting>
    <location file="C:/Dev/git/UbixOS/sys/net/core/ipv4/igmp.c"/>
  </compounddef>
</doxygen>
