\section{IGMP}

% Short description/overview of module functions
This module allows the user to join and leave ipv4 multicast groups. The module is based on the IGMP version 3 protocol and it's backwards compatible with version 2. Version 1 is not supported. 
The IGMP module is completly driven from socket calls (\ref{socket:setoption}) and non of the IGMP application interface functions should be called by the user. If however, by any reason, it's necessary for the user to do this, the following function call is provided:

\subsection{pico\_igmp\_state\_change}

\subsubsection*{Description}
Change the state of the host to Non-member, Idle member or Delaying member.

\subsubsection*{Function prototype}
\begin{verbatim}
int pico_igmp_state_change(struct pico_ip4 *mcast_link, struct pico_ip4 *mcast_group,
 uint8_t filter_mode, struct pico_tree *_MCASTFilter, uint8_t state)
\end{verbatim}

\subsubsection*{Parameters}
\begin{itemize}[noitemsep]
\item \texttt{mcast\_link} - the link on which that multicast group should be joined.
\item \texttt{mcast\_group} - the address of the multicast group you want to join.
\item \texttt{filter\_mode} - the kind of source filtering, if applied.
\item \texttt{\_MCASTFilter} - list of multicast sources on which source filtering might be applied. 
\item \texttt{state} - the prefered new state.
\end{itemize}

\subsubsection*{Errors}
In case of failure, -1 is returned, and the value of pico$\_$err
is set as follows:

\begin{itemize}[noitemsep]
\item \texttt{PICO$\_$ERR$\_$EINVAL}          - Invalid argument provided
\item \texttt{PICO$\_$ERR$\_$ENOMEM}          - Not enough space
\item \texttt{PICO$\_$ERR$\_$EPROTONOSUPPORT} - Invalid protocol (or protocol version) found on the link
\item \texttt{PICO$\_$ERR$\_$EFAULT}          - Internal error
\end{itemize}

%\subsubsection*{Example}

%\subsubsection*{Errors}

%\subsubsection*{Example}
