ON Semiconductor / mbed-os

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mld6.h Source File

mld6.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  *
00004  * Multicast listener discovery for IPv6. Aims to be compliant with RFC 2710.
00005  * No support for MLDv2.
00006  */
00007 
00008 /*
00009  * Copyright (c) 2010 Inico Technologies Ltd.
00010  * All rights reserved.
00011  *
00012  * Redistribution and use in source and binary forms, with or without modification,
00013  * are permitted provided that the following conditions are met:
00014  *
00015  * 1. Redistributions of source code must retain the above copyright notice,
00016  *    this list of conditions and the following disclaimer.
00017  * 2. Redistributions in binary form must reproduce the above copyright notice,
00018  *    this list of conditions and the following disclaimer in the documentation
00019  *    and/or other materials provided with the distribution.
00020  * 3. The name of the author may not be used to endorse or promote products
00021  *    derived from this software without specific prior written permission.
00022  *
00023  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00024  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00025  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00026  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00027  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00028  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00029  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00030  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00031  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00032  * OF SUCH DAMAGE.
00033  *
00034  * This file is part of the lwIP TCP/IP stack.
00035  *
00036  * Author: Ivan Delamer <delamer@inicotech.com>
00037  *
00038  *
00039  * Please coordinate changes and requests with Ivan Delamer
00040  * <delamer@inicotech.com>
00041  */
00042 
00043 #ifndef LWIP_HDR_MLD6_H
00044 #define LWIP_HDR_MLD6_H
00045 
00046 #include "lwip/opt.h"
00047 
00048 #if LWIP_IPV6_MLD && LWIP_IPV6  /* don't build if not configured for use in lwipopts.h */
00049 
00050 #include "lwip/pbuf.h"
00051 #include "lwip/netif.h"
00052 
00053 
00054 #ifdef __cplusplus
00055 extern "C" {
00056 #endif
00057 
00058 /** MLD group */
00059 struct mld_group {
00060   /** next link */
00061   struct mld_group *next;
00062   /** interface on which the group is active */
00063   struct netif      *netif;
00064   /** multicast address */
00065   ip6_addr_t         group_address;
00066   /** signifies we were the last person to report */
00067   u8_t               last_reporter_flag;
00068   /** current state of the group */
00069   u8_t               group_state;
00070   /** timer for reporting */
00071   u16_t              timer;
00072   /** counter of simultaneous uses */
00073   u8_t               use;
00074 };
00075 
00076 /** Multicast listener report/query/done message header. */
00077 #ifdef PACK_STRUCT_USE_INCLUDES
00078 #  include "arch/bpstruct.h"
00079 #endif
00080 PACK_STRUCT_BEGIN
00081 struct mld_header {
00082   PACK_STRUCT_FLD_8(u8_t type);
00083   PACK_STRUCT_FLD_8(u8_t code);
00084   PACK_STRUCT_FIELD(u16_t chksum);
00085   PACK_STRUCT_FIELD(u16_t max_resp_delay);
00086   PACK_STRUCT_FIELD(u16_t reserved);
00087   PACK_STRUCT_FLD_S(ip6_addr_p_t multicast_address);
00088   /* Options follow. */
00089 } PACK_STRUCT_STRUCT;
00090 PACK_STRUCT_END
00091 #ifdef PACK_STRUCT_USE_INCLUDES
00092 #  include "arch/epstruct.h"
00093 #endif
00094 
00095 #define MLD6_TMR_INTERVAL              100 /* Milliseconds */
00096 
00097 /* MAC Filter Actions, these are passed to a netif's
00098  * mld_mac_filter callback function. */
00099 #define MLD6_DEL_MAC_FILTER            0
00100 #define MLD6_ADD_MAC_FILTER            1
00101 
00102 
00103 err_t  mld6_stop(struct netif *netif);
00104 void   mld6_report_groups(struct netif *netif);
00105 void   mld6_tmr(void);
00106 struct mld_group *mld6_lookfor_group(struct netif *ifp, const ip6_addr_t *addr);
00107 void   mld6_input(struct pbuf *p, struct netif *inp);
00108 err_t  mld6_joingroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr);
00109 err_t  mld6_joingroup_netif(struct netif *netif, const ip6_addr_t *groupaddr);
00110 err_t  mld6_leavegroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr);
00111 err_t  mld6_leavegroup_netif(struct netif *netif, const ip6_addr_t *groupaddr);
00112 
00113 
00114 #ifdef __cplusplus
00115 }
00116 #endif
00117 
00118 #endif /* LWIP_IPV6_MLD && LWIP_IPV6 */
00119 
00120 #endif /* LWIP_HDR_MLD6_H */