igmp_host_misc.c File Reference

Helper functions for IGMP host. More...

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

Go to the source code of this file.

Macros

#define TRACE_LEVEL   IGMP_TRACE_LEVEL
 

Functions

void igmpHostChangeCompatibilityMode (IgmpHostContext *context, IgmpVersion compatibilityMode)
 Change host compatibility mode. More...
 
void igmpHostSendMembershipReport (IgmpHostContext *context, Ipv4Addr groupAddr)
 Send Membership Report message. More...
 
void igmpHostSendLeaveGroup (IgmpHostContext *context, Ipv4Addr groupAddr)
 Send Leave Group message. More...
 
void igmpHostSendCurrentStateReport (IgmpHostContext *context, Ipv4Addr groupAddr)
 Send Current-State Report message. More...
 
void igmpHostSendStateChangeReport (IgmpHostContext *context)
 Send State-Change Report message. More...
 
void igmpHostFlushReportRecords (IgmpHostContext *context, NetBuffer *buffer, size_t offset, size_t *length)
 Flush report records. More...
 
void igmpHostProcessMessage (IgmpHostContext *context, const Ipv4PseudoHeader *pseudoHeader, const IgmpMessage *message, size_t length)
 Process incoming IGMP message. More...
 
void igmpHostProcessMembershipQuery (IgmpHostContext *context, const Ipv4PseudoHeader *pseudoHeader, const IgmpMessage *message, size_t length)
 Process incoming Membership Query message. More...
 
void igmpHostProcessMembershipQueryV3 (IgmpHostContext *context, const Ipv4PseudoHeader *pseudoHeader, const IgmpMembershipQueryV3 *message, size_t length)
 Process incoming Version 3 Membership Query message. More...
 
void igmpHostProcessMembershipReport (IgmpHostContext *context, const Ipv4PseudoHeader *pseudoHeader, const IgmpMessage *message, size_t length)
 Process incoming Membership Report message. More...
 
void igmpHostMergeReports (IgmpHostGroup *group, IpFilterMode newFilterMode, const Ipv4SrcAddrList *newFilter)
 Merge difference the report and the pending report. More...
 
bool_t igmpHostGetRetransmitStatus (IgmpHostContext *context)
 Get the retransmission status of the State-Change report. More...
 
bool_t igmpHostGetGroupRetransmitStatus (IgmpHostGroup *group)
 Get the retransmission status for a given group. More...
 
void igmpHostDecGroupRetransmitCounters (IgmpHostGroup *group)
 Decrement retransmission counters for a given group. More...
 
IgmpHostGroupigmpHostCreateGroup (IgmpHostContext *context, Ipv4Addr groupAddr)
 Create a new multicast group. More...
 
IgmpHostGroupigmpHostFindGroup (IgmpHostContext *context, Ipv4Addr groupAddr)
 Search the list of multicast groups for a given group address. More...
 
bool_t igmpHostMatchGroup (IgmpHostGroup *group, Ipv4Addr multicastAddr)
 Check whether a group matches a given multicast address. More...
 
void igmpHostDeleteGroup (IgmpHostGroup *group)
 Delete a multicast group. More...
 
void igmpHostFlushUnusedGroups (IgmpHostContext *context)
 Delete groups in "non-existent" state. More...
 
error_t igmpHostAddSrcAddr (IgmpHostSrcAddrList *list, Ipv4Addr srcAddr)
 Append a source address to a given list. More...
 
void igmpHostRemoveSrcAddr (IgmpHostSrcAddrList *list, Ipv4Addr srcAddr)
 Remove a source address from a given list. More...
 
int_t igmpHostFindSrcAddr (const IgmpHostSrcAddrList *list, Ipv4Addr srcAddr)
 Search the list of sources for a given IP address. More...
 

Detailed Description

Helper functions for IGMP host.

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 igmp_host_misc.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   IGMP_TRACE_LEVEL

Definition at line 32 of file igmp_host_misc.c.

Function Documentation

◆ igmpHostAddSrcAddr()

error_t igmpHostAddSrcAddr ( IgmpHostSrcAddrList list,
Ipv4Addr  srcAddr 
)

Append a source address to a given list.

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

Definition at line 1474 of file igmp_host_misc.c.

◆ igmpHostChangeCompatibilityMode()

void igmpHostChangeCompatibilityMode ( IgmpHostContext context,
IgmpVersion  compatibilityMode 
)

Change host compatibility mode.

Parameters
[in]contextPointer to the IGMP host context
[in]compatibilityModeNew host compatibility mode

Definition at line 53 of file igmp_host_misc.c.

◆ igmpHostCreateGroup()

IgmpHostGroup* igmpHostCreateGroup ( IgmpHostContext context,
Ipv4Addr  groupAddr 
)

Create a new multicast group.

Parameters
[in]contextPointer to the IGMP host context
[in]groupAddrMulticast group address
Returns
Pointer to the newly created multicast group

Definition at line 1299 of file igmp_host_misc.c.

◆ igmpHostDecGroupRetransmitCounters()

void igmpHostDecGroupRetransmitCounters ( IgmpHostGroup group)

Decrement retransmission counters for a given group.

Parameters
[in]groupPointer to the multicast group

Definition at line 1238 of file igmp_host_misc.c.

◆ igmpHostDeleteGroup()

void igmpHostDeleteGroup ( IgmpHostGroup group)

Delete a multicast group.

Parameters
[in]groupPointer to the multicast group

Definition at line 1420 of file igmp_host_misc.c.

◆ igmpHostFindGroup()

IgmpHostGroup* igmpHostFindGroup ( IgmpHostContext context,
Ipv4Addr  groupAddr 
)

Search the list of multicast groups for a given group address.

Parameters
[in]contextPointer to the IGMP host context
[in]groupAddrMulticast group address
Returns
Pointer to the matching multicast group, if any

Definition at line 1359 of file igmp_host_misc.c.

◆ igmpHostFindSrcAddr()

int_t igmpHostFindSrcAddr ( const IgmpHostSrcAddrList 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 1559 of file igmp_host_misc.c.

◆ igmpHostFlushReportRecords()

void igmpHostFlushReportRecords ( IgmpHostContext context,
NetBuffer buffer,
size_t  offset,
size_t *  length 
)

Flush report records.

Parameters
[in]contextPointer to the IGMP host context
[in]bufferMulti-part buffer containing the report message
[in]offsetOffset to the first byte of the report message
[in,out]lengthLength of the report message, in bytes

Definition at line 625 of file igmp_host_misc.c.

◆ igmpHostFlushUnusedGroups()

void igmpHostFlushUnusedGroups ( IgmpHostContext context)

Delete groups in "non-existent" state.

Parameters
[in]contextPointer to the IGMP host context

Definition at line 1436 of file igmp_host_misc.c.

◆ igmpHostGetGroupRetransmitStatus()

bool_t igmpHostGetGroupRetransmitStatus ( IgmpHostGroup group)

Get the retransmission status for a given group.

Parameters
[in]groupPointer to the multicast group
Returns
TRUE if additional retransmissions are needed, else FALSE

Definition at line 1206 of file igmp_host_misc.c.

◆ igmpHostGetRetransmitStatus()

bool_t igmpHostGetRetransmitStatus ( IgmpHostContext context)

Get the retransmission status of the State-Change report.

Parameters
[in]contextPointer to the IGMP host context
Returns
TRUE if additional retransmissions are needed, else FALSE

Definition at line 1168 of file igmp_host_misc.c.

◆ igmpHostMatchGroup()

bool_t igmpHostMatchGroup ( IgmpHostGroup group,
Ipv4Addr  multicastAddr 
)

Check whether a group matches a given multicast address.

Parameters
[in]groupPointer to the multicast group
[in]multicastAddrIPv4 multicast address
Returns
TRUE if the group matches the specified multicast address, else FALSE

Definition at line 1392 of file igmp_host_misc.c.

◆ igmpHostMergeReports()

void igmpHostMergeReports ( IgmpHostGroup group,
IpFilterMode  newFilterMode,
const Ipv4SrcAddrList newFilter 
)

Merge difference the report and the pending report.

Parameters
[in]groupPointer to the multicast group
[in]newFilterModeNew filter mode for the affected group
[in]newFilterNew interface state for the affected group

Definition at line 1073 of file igmp_host_misc.c.

◆ igmpHostProcessMembershipQuery()

void igmpHostProcessMembershipQuery ( IgmpHostContext context,
const Ipv4PseudoHeader pseudoHeader,
const IgmpMessage message,
size_t  length 
)

Process incoming Membership Query message.

Parameters
[in]contextPointer to the IGMP host context
[in]pseudoHeaderIPv4 pseudo header
[in]messagePointer to the incoming IGMP message
[in]lengthLength of the IGMP message, in bytes

Definition at line 717 of file igmp_host_misc.c.

◆ igmpHostProcessMembershipQueryV3()

void igmpHostProcessMembershipQueryV3 ( IgmpHostContext context,
const Ipv4PseudoHeader pseudoHeader,
const IgmpMembershipQueryV3 message,
size_t  length 
)

Process incoming Version 3 Membership Query message.

Parameters
[in]contextPointer to the IGMP host context
[in]pseudoHeaderIPv4 pseudo header
[in]messagePointer to the incoming IGMP message
[in]lengthLength of the IGMP message, in bytes

Definition at line 833 of file igmp_host_misc.c.

◆ igmpHostProcessMembershipReport()

void igmpHostProcessMembershipReport ( IgmpHostContext context,
const Ipv4PseudoHeader pseudoHeader,
const IgmpMessage message,
size_t  length 
)

Process incoming Membership Report message.

Parameters
[in]contextPointer to the IGMP host context
[in]pseudoHeaderIPv4 pseudo header
[in]messagePointer to the incoming IGMP message
[in]lengthLength of the IGMP message, in bytes

Definition at line 1031 of file igmp_host_misc.c.

◆ igmpHostProcessMessage()

void igmpHostProcessMessage ( IgmpHostContext context,
const Ipv4PseudoHeader pseudoHeader,
const IgmpMessage message,
size_t  length 
)

Process incoming IGMP message.

Parameters
[in]contextPointer to the IGMP host context
[in]pseudoHeaderIPv4 pseudo header
[in]messagePointer to the incoming IGMP message
[in]lengthLength of the IGMP message, in bytes

Definition at line 671 of file igmp_host_misc.c.

◆ igmpHostRemoveSrcAddr()

void igmpHostRemoveSrcAddr ( IgmpHostSrcAddrList list,
Ipv4Addr  srcAddr 
)

Remove a source address from a given list.

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

Definition at line 1522 of file igmp_host_misc.c.

◆ igmpHostSendCurrentStateReport()

void igmpHostSendCurrentStateReport ( IgmpHostContext context,
Ipv4Addr  groupAddr 
)

Send Current-State Report message.

Parameters
[in]contextPointer to the IGMP host context
[in]groupAddrIPv4 address specifying the group address

Definition at line 200 of file igmp_host_misc.c.

◆ igmpHostSendLeaveGroup()

void igmpHostSendLeaveGroup ( IgmpHostContext context,
Ipv4Addr  groupAddr 
)

Send Leave Group message.

Parameters
[in]contextPointer to the IGMP host context
[in]groupAddrIPv4 address specifying the group address being left

Definition at line 155 of file igmp_host_misc.c.

◆ igmpHostSendMembershipReport()

void igmpHostSendMembershipReport ( IgmpHostContext context,
Ipv4Addr  groupAddr 
)

Send Membership Report message.

Parameters
[in]contextPointer to the IGMP host context
[in]groupAddrIPv4 address specifying the group address

Definition at line 108 of file igmp_host_misc.c.

◆ igmpHostSendStateChangeReport()

void igmpHostSendStateChangeReport ( IgmpHostContext context)

Send State-Change Report message.

Parameters
[in]contextPointer to the IGMP host context

Definition at line 426 of file igmp_host_misc.c.