Simon Cooksey / mbed-os
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers igmp.h Source File

igmp.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  * IGMP API
00004  */
00005 
00006 /*
00007  * Copyright (c) 2002 CITEL Technologies Ltd.
00008  * All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without
00011  * modification, are permitted provided that the following conditions
00012  * are met:
00013  * 1. Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  * 3. Neither the name of CITEL Technologies Ltd nor the names of its contributors
00019  *    may be used to endorse or promote products derived from this software
00020  *    without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY CITEL TECHNOLOGIES AND CONTRIBUTORS ``AS IS''
00023  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00024  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00025  * ARE DISCLAIMED.  IN NO EVENT SHALL CITEL TECHNOLOGIES OR CONTRIBUTORS BE LIABLE
00026  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00027  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00028  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00029  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00031  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00032  * SUCH DAMAGE.
00033  *
00034  * This file is a contribution to the lwIP TCP/IP stack.
00035  * The Swedish Institute of Computer Science and Adam Dunkels
00036  * are specifically granted permission to redistribute this
00037  * source code.
00038 */
00039 
00040 #ifndef LWIP_HDR_IGMP_H
00041 #define LWIP_HDR_IGMP_H
00042 
00043 #include "lwip/opt.h"
00044 #include "lwip/ip_addr.h"
00045 #include "lwip/netif.h"
00046 #include "lwip/pbuf.h"
00047 
00048 #if LWIP_IPV4 && LWIP_IGMP /* don't build if not configured for use in lwipopts.h */
00049 
00050 #ifdef __cplusplus
00051 extern "C" {
00052 #endif
00053 
00054 
00055 /* IGMP timer */
00056 #define IGMP_TMR_INTERVAL              100 /* Milliseconds */
00057 #define IGMP_V1_DELAYING_MEMBER_TMR   (1000/IGMP_TMR_INTERVAL)
00058 #define IGMP_JOIN_DELAYING_MEMBER_TMR (500 /IGMP_TMR_INTERVAL)
00059 
00060 /* MAC Filter Actions, these are passed to a netif's
00061  * igmp_mac_filter callback function. */
00062 #define IGMP_DEL_MAC_FILTER            0
00063 #define IGMP_ADD_MAC_FILTER            1
00064 
00065 
00066 /**
00067  * igmp group structure - there is
00068  * a list of groups for each interface
00069  * these should really be linked from the interface, but
00070  * if we keep them separate we will not affect the lwip original code
00071  * too much
00072  *
00073  * There will be a group for the all systems group address but this
00074  * will not run the state machine as it is used to kick off reports
00075  * from all the other groups
00076  */
00077 struct igmp_group {
00078   /** next link */
00079   struct igmp_group *next;
00080   /** interface on which the group is active */
00081   struct netif      *netif;
00082   /** multicast address */
00083   ip4_addr_t         group_address;
00084   /** signifies we were the last person to report */
00085   u8_t               last_reporter_flag;
00086   /** current state of the group */
00087   u8_t               group_state;
00088   /** timer for reporting, negative is OFF */
00089   u16_t              timer;
00090   /** counter of simultaneous uses */
00091   u8_t               use;
00092 };
00093 
00094 /*  Prototypes */
00095 void   igmp_init(void);
00096 err_t  igmp_start(struct netif *netif);
00097 err_t  igmp_stop(struct netif *netif);
00098 void   igmp_report_groups(struct netif *netif);
00099 struct igmp_group *igmp_lookfor_group(struct netif *ifp, const ip4_addr_t *addr);
00100 void   igmp_input(struct pbuf *p, struct netif *inp, const ip4_addr_t *dest);
00101 err_t  igmp_joingroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr);
00102 err_t  igmp_joingroup_netif(struct netif *netif, const ip4_addr_t *groupaddr);
00103 err_t  igmp_leavegroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr);
00104 err_t  igmp_leavegroup_netif(struct netif *netif, const ip4_addr_t *groupaddr);
00105 void   igmp_tmr(void);
00106 
00107 #ifdef __cplusplus
00108 }
00109 #endif
00110 
00111 #endif /* LWIP_IPV4 && LWIP_IGMP */
00112 
00113 #endif /* LWIP_HDR_IGMP_H */