Rtos API example

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 /* IGMP timer */
00055 #define IGMP_TMR_INTERVAL              100 /* Milliseconds */
00056 #define IGMP_V1_DELAYING_MEMBER_TMR   (1000/IGMP_TMR_INTERVAL)
00057 #define IGMP_JOIN_DELAYING_MEMBER_TMR (500 /IGMP_TMR_INTERVAL)
00058 
00059 /* Compatibility defines (don't use for new code) */
00060 #define IGMP_DEL_MAC_FILTER            NETIF_DEL_MAC_FILTER
00061 #define IGMP_ADD_MAC_FILTER            NETIF_ADD_MAC_FILTER
00062 
00063 /**
00064  * igmp group structure - there is
00065  * a list of groups for each interface
00066  * these should really be linked from the interface, but
00067  * if we keep them separate we will not affect the lwip original code
00068  * too much
00069  *
00070  * There will be a group for the all systems group address but this
00071  * will not run the state machine as it is used to kick off reports
00072  * from all the other groups
00073  */
00074 struct igmp_group {
00075   /** next link */
00076   struct igmp_group *next;
00077   /** multicast address */
00078   ip4_addr_t         group_address;
00079   /** signifies we were the last person to report */
00080   u8_t               last_reporter_flag;
00081   /** current state of the group */
00082   u8_t               group_state;
00083   /** timer for reporting, negative is OFF */
00084   u16_t              timer;
00085   /** counter of simultaneous uses */
00086   u8_t               use;
00087 };
00088 
00089 /*  Prototypes */
00090 void   igmp_init(void);
00091 err_t  igmp_start(struct netif *netif);
00092 err_t  igmp_stop(struct netif *netif);
00093 void   igmp_report_groups(struct netif *netif);
00094 struct igmp_group *igmp_lookfor_group(struct netif *ifp, const ip4_addr_t *addr);
00095 void   igmp_input(struct pbuf *p, struct netif *inp, const ip4_addr_t *dest);
00096 err_t  igmp_joingroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr);
00097 err_t  igmp_joingroup_netif(struct netif *netif, const ip4_addr_t *groupaddr);
00098 err_t  igmp_leavegroup(const ip4_addr_t *ifaddr, const ip4_addr_t *groupaddr);
00099 err_t  igmp_leavegroup_netif(struct netif *netif, const ip4_addr_t *groupaddr);
00100 void   igmp_tmr(void);
00101 
00102 /** @ingroup igmp 
00103  * Get list head of IGMP groups for netif.
00104  * Note: The allsystems group IP is contained in the list as first entry.
00105  * @see @ref netif_set_igmp_mac_filter()
00106  */
00107 #define netif_igmp_data(netif) ((struct igmp_group *)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_IGMP))
00108 
00109 #ifdef __cplusplus
00110 }
00111 #endif
00112 
00113 #endif /* LWIP_IPV4 && LWIP_IGMP */
00114 
00115 #endif /* LWIP_HDR_IGMP_H */