ipv4_multicast.c File Reference

IPv4 multicast filtering. More...

#include "core/net.h"
#include "core/socket_misc.h"
#include "ipv4/ipv4.h"
#include "ipv4/ipv4_multicast.h"
#include "igmp/igmp_host.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   IPV4_TRACE_LEVEL
 

Functions

error_t ipv4MulticastFilter (NetInterface *interface, Ipv4Addr destAddr, Ipv4Addr srcAddr)
 Filter out incoming multicast traffic. More...
 
error_t ipv4JoinMulticastGroup (NetInterface *interface, Ipv4Addr groupAddr)
 Join the specified host group. More...
 
error_t ipv4LeaveMulticastGroup (NetInterface *interface, Ipv4Addr groupAddr)
 Leave the specified host group. More...
 
void ipv4UpdateMulticastFilter (NetInterface *interface, Ipv4Addr groupAddr)
 Update IPv4 multicast filter table. More...
 
void ipv4DeriveInterfaceState (Ipv4FilterEntry *entry, SocketMulticastGroup *group)
 Derive the per-interface state from the per-socket state. More...
 
error_t ipv4AcceptMulticastAddr (NetInterface *interface, Ipv4Addr groupAddr)
 Reconfigure the MAC layer to accept multicast traffic. More...
 
void ipv4DropMulticastAddr (NetInterface *interface, Ipv4Addr groupAddr)
 Reconfigure the MAC layer to reject multicast traffic. More...
 
error_t ipv4MapMulticastAddrToMac (Ipv4Addr ipAddr, MacAddr *macAddr)
 Map an host group address to a MAC-layer multicast address. More...
 
Ipv4FilterEntryipv4CreateMulticastFilterEntry (NetInterface *interface, Ipv4Addr multicastAddr)
 Create a new multicast filter entry. More...
 
Ipv4FilterEntryipv4FindMulticastFilterEntry (NetInterface *interface, Ipv4Addr multicastAddr)
 Search the multicast filter for a given address. More...
 
void ipv4DeleteMulticastFilterEntry (Ipv4FilterEntry *entry)
 Delete a multicast filter entry. More...
 
error_t ipv4AddSrcAddr (Ipv4SrcAddrList *list, Ipv4Addr srcAddr)
 Append a source address to a given list. More...
 
void ipv4RemoveSrcAddr (Ipv4SrcAddrList *list, Ipv4Addr srcAddr)
 Remove a source address from a given list. More...
 
int_t ipv4FindSrcAddr (const Ipv4SrcAddrList *list, Ipv4Addr srcAddr)
 Search the list of sources for a given IP address. More...
 
bool_t ipv4CompareSrcAddrLists (const Ipv4SrcAddrList *list1, const Ipv4SrcAddrList *list2)
 Compare lists of sources. More...
 

Detailed Description

IPv4 multicast filtering.

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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file ipv4_multicast.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   IPV4_TRACE_LEVEL

Definition at line 32 of file ipv4_multicast.c.

Function Documentation

◆ ipv4AcceptMulticastAddr()

error_t ipv4AcceptMulticastAddr ( NetInterface interface,
Ipv4Addr  groupAddr 
)

Reconfigure the MAC layer to accept multicast traffic.

Parameters
[in]interfaceUnderlying network interface
[in]groupAddrIPv4 multicast address to accept
Returns
Error code

Definition at line 480 of file ipv4_multicast.c.

◆ ipv4AddSrcAddr()

error_t ipv4AddSrcAddr ( Ipv4SrcAddrList list,
Ipv4Addr  srcAddr 
)

Append a source address to a given list.

Parameters
[in]listPointer to the list of source addresses
[in]srcAddrSource IP address to be added

Definition at line 701 of file ipv4_multicast.c.

◆ ipv4CompareSrcAddrLists()

bool_t ipv4CompareSrcAddrLists ( const Ipv4SrcAddrList list1,
const Ipv4SrcAddrList list2 
)

Compare lists of sources.

Parameters
[in]list1Pointer to the first list of source addresses
[in]list2Pointer to the first list of source addresses
Returns
TRUE if the lists contain the same set of addresses, else FALSE

Definition at line 814 of file ipv4_multicast.c.

◆ ipv4CreateMulticastFilterEntry()

Ipv4FilterEntry* ipv4CreateMulticastFilterEntry ( NetInterface interface,
Ipv4Addr  multicastAddr 
)

Create a new multicast filter entry.

Parameters
[in]interfaceUnderlying network interface
[in]multicastAddrIPv4 multicast address
Returns
Pointer to the newly created multicast filter entry

Definition at line 614 of file ipv4_multicast.c.

◆ ipv4DeleteMulticastFilterEntry()

void ipv4DeleteMulticastFilterEntry ( Ipv4FilterEntry entry)

Delete a multicast filter entry.

Parameters
[in]entryPointer to the multicast filter entry

Definition at line 688 of file ipv4_multicast.c.

◆ ipv4DeriveInterfaceState()

void ipv4DeriveInterfaceState ( Ipv4FilterEntry entry,
SocketMulticastGroup group 
)

Derive the per-interface state from the per-socket state.

Parameters
[in]entryPointer to the per-interface state
[in]groupPointer to the per-socket state

Definition at line 379 of file ipv4_multicast.c.

◆ ipv4DropMulticastAddr()

void ipv4DropMulticastAddr ( NetInterface interface,
Ipv4Addr  groupAddr 
)

Reconfigure the MAC layer to reject multicast traffic.

Parameters
[in]interfaceUnderlying network interface
[in]groupAddrIPv4 multicast address to reject

Definition at line 531 of file ipv4_multicast.c.

◆ ipv4FindMulticastFilterEntry()

Ipv4FilterEntry* ipv4FindMulticastFilterEntry ( NetInterface interface,
Ipv4Addr  multicastAddr 
)

Search the multicast filter for a given address.

Parameters
[in]interfaceUnderlying network interface
[in]multicastAddrIPv4 multicast address
Returns
A pointer to the matching multicast filter entry is returned. NULL is returned if the specified group address cannot be found

Definition at line 657 of file ipv4_multicast.c.

◆ ipv4FindSrcAddr()

int_t ipv4FindSrcAddr ( const Ipv4SrcAddrList list,
Ipv4Addr  srcAddr 
)

Search the list of sources for a given IP address.

Parameters
[in]listPointer to the list of source addresses
[in]srcAddrSource IP address
Returns
Index of the matching IP address is returned. -1 is returned if the specified IP address cannot be found

Definition at line 778 of file ipv4_multicast.c.

◆ ipv4JoinMulticastGroup()

error_t ipv4JoinMulticastGroup ( NetInterface interface,
Ipv4Addr  groupAddr 
)

Join the specified host group.

Parameters
[in]interfaceUnderlying network interface
[in]groupAddrIPv4 address identifying the host group to join
Returns
Error code

Definition at line 127 of file ipv4_multicast.c.

◆ ipv4LeaveMulticastGroup()

error_t ipv4LeaveMulticastGroup ( NetInterface interface,
Ipv4Addr  groupAddr 
)

Leave the specified host group.

Parameters
[in]interfaceUnderlying network interface
[in]groupAddrIPv4 address identifying the host group to leave
Returns
Error code

Definition at line 185 of file ipv4_multicast.c.

◆ ipv4MapMulticastAddrToMac()

error_t ipv4MapMulticastAddrToMac ( Ipv4Addr  ipAddr,
MacAddr macAddr 
)

Map an host group address to a MAC-layer multicast address.

Parameters
[in]ipAddrIPv4 host group address
[out]macAddrCorresponding MAC-layer multicast address
Returns
Error code

Definition at line 563 of file ipv4_multicast.c.

◆ ipv4MulticastFilter()

error_t ipv4MulticastFilter ( NetInterface interface,
Ipv4Addr  destAddr,
Ipv4Addr  srcAddr 
)

Filter out incoming multicast traffic.

Parameters
[in]interfaceThe interface on which the packet was received
[in]destAddrDestination IP address of the received packet
[in]srcAddrSource IP address of the received packet
Returns
Error code

Definition at line 54 of file ipv4_multicast.c.

◆ ipv4RemoveSrcAddr()

void ipv4RemoveSrcAddr ( Ipv4SrcAddrList list,
Ipv4Addr  srcAddr 
)

Remove a source address from a given list.

Parameters
[in]listPointer to the list of source addresses
[in]srcAddrSource IP address to be removed

Definition at line 741 of file ipv4_multicast.c.

◆ ipv4UpdateMulticastFilter()

void ipv4UpdateMulticastFilter ( NetInterface interface,
Ipv4Addr  groupAddr 
)

Update IPv4 multicast filter table.

Parameters
[in]interfaceUnderlying network interface
[in]groupAddrIPv4 multicast address

Definition at line 229 of file ipv4_multicast.c.