[457] | 1 | /**
|
---|
| 2 | * @file
|
---|
| 3 | *
|
---|
| 4 | * Multicast listener discovery for IPv6. Aims to be compliant with RFC 2710.
|
---|
| 5 | * No support for MLDv2.
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | /*
|
---|
| 9 | * Copyright (c) 2010 Inico Technologies Ltd.
|
---|
| 10 | * All rights reserved.
|
---|
| 11 | *
|
---|
| 12 | * Redistribution and use in source and binary forms, with or without modification,
|
---|
| 13 | * are permitted provided that the following conditions are met:
|
---|
| 14 | *
|
---|
| 15 | * 1. Redistributions of source code must retain the above copyright notice,
|
---|
| 16 | * this list of conditions and the following disclaimer.
|
---|
| 17 | * 2. Redistributions in binary form must reproduce the above copyright notice,
|
---|
| 18 | * this list of conditions and the following disclaimer in the documentation
|
---|
| 19 | * and/or other materials provided with the distribution.
|
---|
| 20 | * 3. The name of the author may not be used to endorse or promote products
|
---|
| 21 | * derived from this software without specific prior written permission.
|
---|
| 22 | *
|
---|
| 23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
---|
| 24 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
---|
| 25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
---|
| 26 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
---|
| 27 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
---|
| 28 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
---|
| 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
---|
| 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
---|
| 31 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
---|
| 32 | * OF SUCH DAMAGE.
|
---|
| 33 | *
|
---|
| 34 | * This file is part of the lwIP TCP/IP stack.
|
---|
| 35 | *
|
---|
| 36 | * Author: Ivan Delamer <delamer@inicotech.com>
|
---|
| 37 | *
|
---|
| 38 | *
|
---|
| 39 | * Please coordinate changes and requests with Ivan Delamer
|
---|
| 40 | * <delamer@inicotech.com>
|
---|
| 41 | */
|
---|
| 42 |
|
---|
| 43 | #ifndef LWIP_HDR_MLD6_H
|
---|
| 44 | #define LWIP_HDR_MLD6_H
|
---|
| 45 |
|
---|
| 46 | #include "lwip/opt.h"
|
---|
| 47 |
|
---|
| 48 | #if LWIP_IPV6_MLD && LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */
|
---|
| 49 |
|
---|
| 50 | #include "lwip/pbuf.h"
|
---|
| 51 | #include "lwip/netif.h"
|
---|
| 52 |
|
---|
| 53 | #ifdef __cplusplus
|
---|
| 54 | extern "C" {
|
---|
| 55 | #endif
|
---|
| 56 |
|
---|
| 57 | /** MLD group */
|
---|
| 58 | struct mld_group {
|
---|
| 59 | /** next link */
|
---|
| 60 | struct mld_group *next;
|
---|
| 61 | /** multicast address */
|
---|
| 62 | ip6_addr_t group_address;
|
---|
| 63 | /** signifies we were the last person to report */
|
---|
| 64 | u8_t last_reporter_flag;
|
---|
| 65 | /** current state of the group */
|
---|
| 66 | u8_t group_state;
|
---|
| 67 | /** timer for reporting */
|
---|
| 68 | u16_t timer;
|
---|
| 69 | /** counter of simultaneous uses */
|
---|
| 70 | u8_t use;
|
---|
| 71 | };
|
---|
| 72 |
|
---|
| 73 | #define MLD6_TMR_INTERVAL 100 /* Milliseconds */
|
---|
| 74 |
|
---|
| 75 | err_t mld6_stop(struct netif *netif);
|
---|
| 76 | void mld6_report_groups(struct netif *netif);
|
---|
| 77 | void mld6_tmr(void);
|
---|
| 78 | struct mld_group *mld6_lookfor_group(struct netif *ifp, const ip6_addr_t *addr);
|
---|
| 79 | void mld6_input(struct pbuf *p, struct netif *inp);
|
---|
| 80 | err_t mld6_joingroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr);
|
---|
| 81 | err_t mld6_joingroup_netif(struct netif *netif, const ip6_addr_t *groupaddr);
|
---|
| 82 | err_t mld6_leavegroup(const ip6_addr_t *srcaddr, const ip6_addr_t *groupaddr);
|
---|
| 83 | err_t mld6_leavegroup_netif(struct netif *netif, const ip6_addr_t *groupaddr);
|
---|
| 84 |
|
---|
| 85 | /** @ingroup mld6
|
---|
| 86 | * Get list head of MLD6 groups for netif.
|
---|
| 87 | * Note: The allnodes group IP is NOT in the list, since it must always
|
---|
| 88 | * be received for correct IPv6 operation.
|
---|
| 89 | * @see @ref netif_set_mld_mac_filter()
|
---|
| 90 | */
|
---|
| 91 | #define netif_mld6_data(netif) ((struct mld_group *)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_MLD6))
|
---|
| 92 |
|
---|
| 93 | #ifdef __cplusplus
|
---|
| 94 | }
|
---|
| 95 | #endif
|
---|
| 96 |
|
---|
| 97 | #endif /* LWIP_IPV6_MLD && LWIP_IPV6 */
|
---|
| 98 |
|
---|
| 99 | #endif /* LWIP_HDR_MLD6_H */
|
---|