mld_common.c File Reference

Definitions common to MLD node, router and snooping switch. More...

#include "core/net.h"
#include "ipv6/ipv6_multicast.h"
#include "ipv6/icmpv6.h"
#include "mld/mld_node.h"
#include "mld/mld_node_misc.h"
#include "mld/mld_common.h"
#include "mld/mld_debug.h"
#include "mibs/ip_mib_module.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   MLD_TRACE_LEVEL
 

Functions

error_t mldInit (NetInterface *interface)
 MLD initialization. More...
 
void mldTick (NetInterface *interface)
 MLD node timer handler. More...
 
void mldLinkChangeEvent (NetInterface *interface)
 Callback function for link change event. More...
 
error_t mldSendMessage (NetInterface *interface, const Ipv6Addr *destAddr, NetBuffer *buffer, size_t offset)
 Send MLD message. More...
 
void mldProcessMessage (NetInterface *interface, const Ipv6PseudoHeader *pseudoHeader, const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary)
 Process incoming MLD message. More...
 
systime_t mldGetRandomDelay (systime_t maxDelay)
 Generate a random delay. More...
 
uint32_t mldDecodeFloatingPointValue8 (uint8_t code)
 Decode a floating-point value (8-bit code) More...
 
uint32_t mldDecodeFloatingPointValue16 (uint16_t code)
 Decode a floating-point value (16-bit code) More...
 

Variables

const Ipv6Addr MLD_V2_ALL_ROUTERS_ADDR
 
systime_t mldTickCounter
 

Detailed Description

Definitions common to MLD node, router and snooping switch.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Description

MLD is used by an IPv6 router to discover the presence of multicast listeners on its directly attached links, and to discover specifically which multicast addresses are of interest to those neighboring nodes. Refer to the following RFCs for complete details:

  • RFC 2710: Multicast Listener Discovery (MLD) for IPv6
  • RFC 3590: Source Address Selection for MLD Protocol
  • RFC 3810: Multicast Listener Discovery Version 2 (MLDv2) for IPv6
Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file mld_common.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   MLD_TRACE_LEVEL

Definition at line 42 of file mld_common.c.

Function Documentation

◆ mldDecodeFloatingPointValue16()

uint32_t mldDecodeFloatingPointValue16 ( uint16_t  code)

Decode a floating-point value (16-bit code)

Parameters
[in]codeFloating-point representation
Returns
Decoded value

Definition at line 315 of file mld_common.c.

◆ mldDecodeFloatingPointValue8()

uint32_t mldDecodeFloatingPointValue8 ( uint8_t  code)

Decode a floating-point value (8-bit code)

Parameters
[in]codeFloating-point representation
Returns
Decoded value

Definition at line 294 of file mld_common.c.

◆ mldGetRandomDelay()

systime_t mldGetRandomDelay ( systime_t  maxDelay)

Generate a random delay.

Parameters
[in]maxDelaymaximum delay
Returns
Random amount of time

Definition at line 269 of file mld_common.c.

◆ mldInit()

error_t mldInit ( NetInterface interface)

MLD initialization.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 72 of file mld_common.c.

◆ mldLinkChangeEvent()

void mldLinkChangeEvent ( NetInterface interface)

Callback function for link change event.

Parameters
[in]interfaceUnderlying network interface

Definition at line 118 of file mld_common.c.

◆ mldProcessMessage()

void mldProcessMessage ( NetInterface interface,
const Ipv6PseudoHeader pseudoHeader,
const NetBuffer buffer,
size_t  offset,
const NetRxAncillary ancillary 
)

Process incoming MLD message.

Parameters
[in]interfaceUnderlying network interface
[in]pseudoHeaderIPv6 pseudo header
[in]bufferMulti-part buffer containing the incoming MLD message
[in]offsetOffset to the first byte of the MLD message
[in]ancillaryAdditional options passed to the stack along with the packet

Definition at line 226 of file mld_common.c.

◆ mldSendMessage()

error_t mldSendMessage ( NetInterface interface,
const Ipv6Addr destAddr,
NetBuffer buffer,
size_t  offset 
)

Send MLD message.

Parameters
[in]interfaceUnderlying network interface
[in]destAddrDestination IP address
[in]bufferMulti-part buffer containing the payload
[in]offsetOffset to the first byte of the payload
Returns
Error code

Definition at line 136 of file mld_common.c.

◆ mldTick()

void mldTick ( NetInterface interface)

MLD node timer handler.

This routine must be periodically called by the TCP/IP stack to handle MLD related timers

Parameters
[in]interfaceUnderlying network interface

Definition at line 104 of file mld_common.c.

Variable Documentation

◆ MLD_V2_ALL_ROUTERS_ADDR

const Ipv6Addr MLD_V2_ALL_ROUTERS_ADDR
Initial value:
=
IPV6_ADDR(0xFF02, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0016)

Definition at line 59 of file mld_common.c.

◆ mldTickCounter

systime_t mldTickCounter

Definition at line 63 of file mld_common.c.

#define IPV6_ADDR(a, b, c, d, e, f, g, h)
Definition: ipv6.h:118