Skip to content

Commit 05873a1

Browse files
author
Emil Popov
committed
Cleanup and refactoring
1 parent 985b14b commit 05873a1

File tree

6 files changed

+274
-282
lines changed

6 files changed

+274
-282
lines changed

source/FreeRTOS_IGMP.c

+263-267
Large diffs are not rendered by default.

source/FreeRTOS_IP.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ void vIPNetworkUpCalls( struct xNetworkEndPoint * pxEndPoint )
676676
if( NULL != ( pxMRD = ( MCastReportData_t * ) pvPortMalloc( sizeof( MCastReportData_t ) ) ) )
677677
{
678678
listSET_LIST_ITEM_OWNER( &( pxMRD->xListItem ), ( void * ) pxMRD );
679-
pxMRD->pxEndPoint = pxEndPoint;
679+
pxMRD->pxInterface = pxEndPoint->pxNetworkInterface;
680680
pxMRD->xMCastGroupAddress.xIs_IPv6 = pdTRUE_UNSIGNED;
681681

682682
/* Generate the solicited-node multicast address in the form of
@@ -718,9 +718,9 @@ void vIPNetworkUpCalls( struct xNetworkEndPoint * pxEndPoint )
718718
* they will soon ask us for reports anyways, so sending these unsolicited reports is not required. It simply enhances the user
719719
* experience by shortening the time it takes before we begin receiving the multicasts that we care for. */
720720
/* _EP_: vRescheduleAllMulticastReports() is NOT declared in header files because I don't want to expose it to the user */
721-
extern void vRescheduleAllMulticastReports( NetworkEndPoint_t * pxEndPoint,
721+
extern void vRescheduleAllMulticastReports( NetworkInterface_t * pxInterface,
722722
BaseType_t xMaxCountdown );
723-
vRescheduleAllMulticastReports( pxEndPoint, 5 );
723+
vRescheduleAllMulticastReports( pxEndPoint->pxNetworkInterface, 5 );
724724
#endif /* ( ipconfigSUPPORT_IP_MULTICAST != 0 ) */
725725

726726
#if ( ipconfigUSE_NETWORK_EVENT_HOOK == 1 )

source/FreeRTOS_Sockets.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -6432,7 +6432,7 @@ void * pvSocketGetSocketID( const ConstSocket_t xSocket )
64326432
if( ( pxSocket->ucProtocol != ( uint8_t ) FREERTOS_IPPROTO_UDP ) ||
64336433
( uxOptionLength != sizeof( uint8_t ) ) )
64346434
{
6435-
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
6435+
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
64366436
}
64376437

64386438
/* Set the new TTL/HOPS value. */
@@ -6508,8 +6508,7 @@ void * pvSocketGetSocketID( const ConstSocket_t xSocket )
65086508
* Store the IP version information in the report so the timer event knows whether to send an IGMP or MLD report. */
65096509
pxMRD->xMCastGroupAddress.xIs_IPv6 = pxSocket->bits.bIsIPv6;
65106510
listSET_LIST_ITEM_OWNER( &( pxMRD->xListItem ), ( void * ) pxMRD );
6511-
/* Quick and dirty assignment of end-point. This will probably have to be re-designed and re-done. */
6512-
pxMRD->pxEndPoint = ( pxSocket->bits.bIsIPv6 ) ? FreeRTOS_FirstEndPoint_IPv6( FreeRTOS_FirstNetworkInterface() ) : FreeRTOS_FirstEndPoint( FreeRTOS_FirstNetworkInterface() );
6511+
pxMRD->pxInterface = pMReq->pxMulticastNetIf;
65136512

65146513
/* Pass the multicast report data inside the multicast group descriptor,
65156514
* so we can easily pass it to the IP task in one message. */
@@ -6574,7 +6573,7 @@ void * pvSocketGetSocketID( const ConstSocket_t xSocket )
65746573
if( pMReq->pxMulticastNetIf != pxSocket->u.xUDP.pxMulticastNetIf )
65756574
{
65766575
/* The socket was not subscribed on this interface. */
6577-
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
6576+
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
65786577
}
65796578

65806579
/* Allocate some RAM to remember the multicast group that is being dropped */

source/include/FreeRTOSIPConfigDefaults.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -3308,7 +3308,7 @@
33083308

33093309
/*---------------------------------------------------------------------------*/
33103310

3311-
/*
3311+
/*
33123312
* ipconfigSUPPORT_IP_MULTICAST
33133313
*
33143314
* Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE )
@@ -3321,7 +3321,7 @@
33213321

33223322
/*---------------------------------------------------------------------------*/
33233323

3324-
/*
3324+
/*
33253325
* ipconfigMULTICAST_DEFAULT_TTL
33263326
*
33273327
* Type: uint8_t
@@ -3331,7 +3331,7 @@
33313331
* Specifies the TTL value that will be used for multicast
33323332
* UDP packets by default. Can be overridden per socket by
33333333
* setting the FREERTOS_SO_IP_MULTICAST_TTL socket option or by
3334-
* setting the FREERTOS_SO_IPV6_MULTICAST_HOPS in case of an IPv6 socket.
3334+
* setting the FREERTOS_SO_IPV6_MULTICAST_HOPS in case of an IPv6 socket.
33353335
* Please note that in certain situations, RFCs or standards may require
33363336
* a certain value to be used,like in Neighbor Solicitation where the hop
33373337
* limit field must be set to 255. In those cases, the value is hard-coded
@@ -3342,7 +3342,7 @@
33423342

33433343
/*---------------------------------------------------------------------------*/
33443344

3345-
/*
3345+
/*
33463346
* ipconfigSUPPORT_IP_MULTICAST
33473347
*
33483348
* Type: BaseType_t ( ipconfigENABLE | ipconfigDISABLE )

source/include/FreeRTOS_IGMP.h

-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@
9191
BaseType_t xAddIGMPReportToList( MCastReportData_t * pNewEntry );
9292
eFrameProcessingResult_t eProcessIGMPPacket( NetworkBufferDescriptor_t * const pxNetworkBuffer );
9393
void vProcessMLDPacket( NetworkBufferDescriptor_t * const pxNetworkBuffer );
94-
BaseType_t xSendMulticastListenerReport_v1( const IPv6_Address_t * pxGroupAddress,
95-
NetworkEndPoint_t * pxEndPoint,
96-
TickType_t uxBlockTimeTicks );
9794
void prvDropMulticastMembership( FreeRTOS_Socket_t * pxSocket ); /* move to Sockets.c as static */
9895

9996

source/include/FreeRTOS_IP_Utils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
{
7272
IPv46_Address_t xMCastGroupAddress; /**< Holds the IPv4/IPv6 multicast group address. xMCastGroupAddress.xIs_IPv6 denotes whether this represents and IGMP or MLD report. */
7373
ListItem_t xListItem; /**< List item for adding to the global list of reports. */
74-
NetworkEndPoint_t * pxEndPoint; /**< The end-point whose source address will be send for sending this report. NULL to send on the first end-point of every interface. */
74+
NetworkInterface_t * pxInterface; /**< The network interface used for sending this report. NULL to send on all interfaces. */
7575
BaseType_t xNumSockets; /**< The number of sockets that are subscribed to this multicast group. */
7676
BaseType_t xCountDown;
7777
} MCastReportData_t;

0 commit comments

Comments
 (0)