mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2025-06-19 14:54:28 +08:00
TCP: Address MISRA rule11.3 violations (#225)
This commit is contained in:

committed by
GitHub

parent
66371d0cf0
commit
3fc432f7be
@ -656,7 +656,7 @@ ARPPacket_t *pxARPPacket;
|
|||||||
configASSERT( pxNetworkBuffer != NULL );
|
configASSERT( pxNetworkBuffer != NULL );
|
||||||
configASSERT( pxNetworkBuffer->xDataLength >= sizeof(ARPPacket_t) );
|
configASSERT( pxNetworkBuffer->xDataLength >= sizeof(ARPPacket_t) );
|
||||||
|
|
||||||
pxARPPacket = ipPOINTER_CAST( ARPPacket_t *, pxNetworkBuffer->pucEthernetBuffer );
|
pxARPPacket = ipCAST_PTR_TO_TYPE_PTR( ARPPacket_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||||
|
|
||||||
/* memcpy the const part of the header information into the correct
|
/* memcpy the const part of the header information into the correct
|
||||||
location in the packet. This copies:
|
location in the packet. This copies:
|
||||||
@ -693,7 +693,7 @@ BaseType_t xCheckLoopback( NetworkBufferDescriptor_t * const pxDescriptor, BaseT
|
|||||||
{
|
{
|
||||||
BaseType_t xResult = pdFALSE;
|
BaseType_t xResult = pdFALSE;
|
||||||
NetworkBufferDescriptor_t * pxUseDescriptor = pxDescriptor;
|
NetworkBufferDescriptor_t * pxUseDescriptor = pxDescriptor;
|
||||||
const IPPacket_t *pxIPPacket = ipPOINTER_CAST( IPPacket_t *, pxUseDescriptor->pucEthernetBuffer );
|
const IPPacket_t *pxIPPacket = ipCAST_PTR_TO_TYPE_PTR( IPPacket_t, pxUseDescriptor->pucEthernetBuffer );
|
||||||
|
|
||||||
/* This function will check if the target IP-address belongs to this device.
|
/* This function will check if the target IP-address belongs to this device.
|
||||||
* If so, the packet will be passed to the IP-stack, who will answer it.
|
* If so, the packet will be passed to the IP-stack, who will answer it.
|
||||||
|
@ -154,6 +154,16 @@ struct xDHCPMessage_IPv4
|
|||||||
#include "pack_struct_end.h"
|
#include "pack_struct_end.h"
|
||||||
typedef struct xDHCPMessage_IPv4 DHCPMessage_IPv4_t;
|
typedef struct xDHCPMessage_IPv4 DHCPMessage_IPv4_t;
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( DHCPMessage_IPv4_t )
|
||||||
|
{
|
||||||
|
return ( DHCPMessage_IPv4_t *)pvArgument;
|
||||||
|
}
|
||||||
|
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( DHCPMessage_IPv4_t )
|
||||||
|
{
|
||||||
|
return ( const DHCPMessage_IPv4_t *) pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* The UDP socket used for all incoming and outgoing DHCP traffic. */
|
/* The UDP socket used for all incoming and outgoing DHCP traffic. */
|
||||||
_static Socket_t xDHCPSocket;
|
_static Socket_t xDHCPSocket;
|
||||||
|
|
||||||
@ -639,7 +649,7 @@ const uint32_t ulMandatoryOptions = 2UL; /* DHCP server address, and the correct
|
|||||||
if( lBytes > 0 )
|
if( lBytes > 0 )
|
||||||
{
|
{
|
||||||
/* Map a DHCP structure onto the received data. */
|
/* Map a DHCP structure onto the received data. */
|
||||||
pxDHCPMessage = ipPOINTER_CAST( const DHCPMessage_IPv4_t *, pucUDPPayload );
|
pxDHCPMessage = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( DHCPMessage_IPv4_t, pucUDPPayload );
|
||||||
|
|
||||||
/* Sanity check. */
|
/* Sanity check. */
|
||||||
if( lBytes < ( int32_t ) sizeof( DHCPMessage_IPv4_t ) )
|
if( lBytes < ( int32_t ) sizeof( DHCPMessage_IPv4_t ) )
|
||||||
@ -887,7 +897,7 @@ uint8_t *pucUDPPayloadBuffer;
|
|||||||
|
|
||||||
/* Leave space for the UPD header. */
|
/* Leave space for the UPD header. */
|
||||||
pucUDPPayloadBuffer = &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] );
|
pucUDPPayloadBuffer = &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] );
|
||||||
pxDHCPMessage = ipPOINTER_CAST( DHCPMessage_IPv4_t *, pucUDPPayloadBuffer );
|
pxDHCPMessage = ipCAST_PTR_TO_TYPE_PTR( DHCPMessage_IPv4_t, pucUDPPayloadBuffer );
|
||||||
|
|
||||||
/* Most fields need to be zero. */
|
/* Most fields need to be zero. */
|
||||||
( void ) memset( pxDHCPMessage, 0x00, sizeof( DHCPMessage_IPv4_t ) );
|
( void ) memset( pxDHCPMessage, 0x00, sizeof( DHCPMessage_IPv4_t ) );
|
||||||
|
@ -250,16 +250,14 @@ struct xDNSMessage
|
|||||||
#include "pack_struct_end.h"
|
#include "pack_struct_end.h"
|
||||||
typedef struct xDNSMessage DNSMessage_t;
|
typedef struct xDNSMessage DNSMessage_t;
|
||||||
|
|
||||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( DNSMessage_t )
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( DNSMessage_t )
|
||||||
{
|
{
|
||||||
/* coverity[misra_c_2012_rule_11_3_violation] */
|
return ( DNSMessage_t *)pvArgument;
|
||||||
return ( DNSMessage_t *)pvArgument;
|
}
|
||||||
}
|
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( DNSMessage_t )
|
||||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( DNSMessage_t )
|
{
|
||||||
{
|
return ( const DNSMessage_t *) pvArgument;
|
||||||
/* coverity[misra_c_2012_rule_11_3_violation] */
|
}
|
||||||
return ( const DNSMessage_t *) pvArgument;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* A DNS query consists of a header, as described in 'struct xDNSMessage'
|
/* A DNS query consists of a header, as described in 'struct xDNSMessage'
|
||||||
It is followed by 1 or more queries, each one consisting of a name and a tail,
|
It is followed by 1 or more queries, each one consisting of a name and a tail,
|
||||||
@ -274,11 +272,10 @@ struct xDNSTail
|
|||||||
#include "pack_struct_end.h"
|
#include "pack_struct_end.h"
|
||||||
typedef struct xDNSTail DNSTail_t;
|
typedef struct xDNSTail DNSTail_t;
|
||||||
|
|
||||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( DNSTail_t )
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( DNSTail_t )
|
||||||
{
|
{
|
||||||
/* coverity[misra_c_2012_rule_11_3_violation] */
|
return ( DNSTail_t * ) pvArgument;
|
||||||
return ( DNSTail_t * ) pvArgument;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* DNS answer record header. */
|
/* DNS answer record header. */
|
||||||
#include "pack_struct_start.h"
|
#include "pack_struct_start.h"
|
||||||
@ -292,11 +289,10 @@ struct xDNSAnswerRecord
|
|||||||
#include "pack_struct_end.h"
|
#include "pack_struct_end.h"
|
||||||
typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
||||||
|
|
||||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( DNSAnswerRecord_t )
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( DNSAnswerRecord_t )
|
||||||
{
|
{
|
||||||
/* coverity[misra_c_2012_rule_11_3_violation] */
|
return ( DNSAnswerRecord_t * ) pvArgument;
|
||||||
return ( DNSAnswerRecord_t * ) pvArgument;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#if( ipconfigUSE_LLMNR == 1 )
|
#if( ipconfigUSE_LLMNR == 1 )
|
||||||
|
|
||||||
@ -314,6 +310,12 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
|||||||
#include "pack_struct_end.h"
|
#include "pack_struct_end.h"
|
||||||
typedef struct xLLMNRAnswer LLMNRAnswer_t;
|
typedef struct xLLMNRAnswer LLMNRAnswer_t;
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( LLMNRAnswer_t )
|
||||||
|
{
|
||||||
|
return ( LLMNRAnswer_t *)pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* ipconfigUSE_LLMNR == 1 */
|
#endif /* ipconfigUSE_LLMNR == 1 */
|
||||||
|
|
||||||
#if( ipconfigUSE_NBNS == 1 )
|
#if( ipconfigUSE_NBNS == 1 )
|
||||||
@ -349,6 +351,11 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
|||||||
#include "pack_struct_end.h"
|
#include "pack_struct_end.h"
|
||||||
typedef struct xNBNSAnswer NBNSAnswer_t;
|
typedef struct xNBNSAnswer NBNSAnswer_t;
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( NBNSAnswer_t )
|
||||||
|
{
|
||||||
|
return ( NBNSAnswer_t *)pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* ipconfigUSE_NBNS == 1 */
|
#endif /* ipconfigUSE_NBNS == 1 */
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
@ -376,6 +383,11 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
|||||||
char pcName[ 1 ];
|
char pcName[ 1 ];
|
||||||
} DNSCallback_t;
|
} DNSCallback_t;
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( DNSCallback_t )
|
||||||
|
{
|
||||||
|
return ( DNSCallback_t *)pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
static List_t xCallbackList;
|
static List_t xCallbackList;
|
||||||
|
|
||||||
/* Define FreeRTOS_gethostbyname() as a normal blocking call. */
|
/* Define FreeRTOS_gethostbyname() as a normal blocking call. */
|
||||||
@ -408,7 +420,7 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
|||||||
pxIterator != xEnd;
|
pxIterator != xEnd;
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DNSCallback_t *pxCallback = ipPOINTER_CAST( DNSCallback_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
DNSCallback_t *pxCallback = ipCAST_PTR_TO_TYPE_PTR( DNSCallback_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||||
/* Move to the next item because we might remove this item */
|
/* Move to the next item because we might remove this item */
|
||||||
pxIterator = ( const ListItem_t * ) listGET_NEXT( pxIterator );
|
pxIterator = ( const ListItem_t * ) listGET_NEXT( pxIterator );
|
||||||
if( ( pvSearchID != NULL ) && ( pvSearchID == pxCallback->pvSearchID ) )
|
if( ( pvSearchID != NULL ) && ( pvSearchID == pxCallback->pvSearchID ) )
|
||||||
@ -453,7 +465,7 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
|||||||
TickType_t uxIdentifier )
|
TickType_t uxIdentifier )
|
||||||
{
|
{
|
||||||
size_t lLength = strlen( pcHostName );
|
size_t lLength = strlen( pcHostName );
|
||||||
DNSCallback_t *pxCallback = ipPOINTER_CAST( DNSCallback_t *, pvPortMalloc( sizeof( *pxCallback ) + lLength ) );
|
DNSCallback_t *pxCallback = ipCAST_PTR_TO_TYPE_PTR( DNSCallback_t, pvPortMalloc( sizeof( *pxCallback ) + lLength ) );
|
||||||
|
|
||||||
/* Translate from ms to number of clock ticks. */
|
/* Translate from ms to number of clock ticks. */
|
||||||
uxTimeout /= portTICK_PERIOD_MS;
|
uxTimeout /= portTICK_PERIOD_MS;
|
||||||
@ -471,7 +483,7 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
|||||||
pxCallback->pvSearchID = pvSearchID;
|
pxCallback->pvSearchID = pvSearchID;
|
||||||
pxCallback->uxRemaningTime = uxTimeout;
|
pxCallback->uxRemaningTime = uxTimeout;
|
||||||
vTaskSetTimeOutState( &pxCallback->uxTimeoutState );
|
vTaskSetTimeOutState( &pxCallback->uxTimeoutState );
|
||||||
listSET_LIST_ITEM_OWNER( &( pxCallback->xListItem ), ipPOINTER_CAST( void *, pxCallback ) );
|
listSET_LIST_ITEM_OWNER( &( pxCallback->xListItem ), ( void *) pxCallback );
|
||||||
listSET_LIST_ITEM_VALUE( &( pxCallback->xListItem ), uxIdentifier );
|
listSET_LIST_ITEM_VALUE( &( pxCallback->xListItem ), uxIdentifier );
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
@ -500,7 +512,7 @@ typedef struct xDNSAnswerRecord DNSAnswerRecord_t;
|
|||||||
{
|
{
|
||||||
if( listGET_LIST_ITEM_VALUE( pxIterator ) == uxIdentifier )
|
if( listGET_LIST_ITEM_VALUE( pxIterator ) == uxIdentifier )
|
||||||
{
|
{
|
||||||
DNSCallback_t *pxCallback = ipPOINTER_CAST( DNSCallback_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
DNSCallback_t *pxCallback = ipCAST_PTR_TO_TYPE_PTR( DNSCallback_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||||
|
|
||||||
pxCallback->pCallbackFunction( pcName, pxCallback->pvSearchID, ulIPAddress );
|
pxCallback->pCallbackFunction( pcName, pxCallback->pvSearchID, ulIPAddress );
|
||||||
( void ) uxListRemove( &pxCallback->xListItem );
|
( void ) uxListRemove( &pxCallback->xListItem );
|
||||||
@ -1415,7 +1427,7 @@ BaseType_t xReturn = pdTRUE;
|
|||||||
/* The test on 'pucNewBuffer' is only to satisfy lint. */
|
/* The test on 'pucNewBuffer' is only to satisfy lint. */
|
||||||
if( ( pxNetworkBuffer != NULL ) && ( pucNewBuffer != NULL ) )
|
if( ( pxNetworkBuffer != NULL ) && ( pucNewBuffer != NULL ) )
|
||||||
{
|
{
|
||||||
pxAnswer = ipPOINTER_CAST( LLMNRAnswer_t *, pucByte );
|
pxAnswer = ipCAST_PTR_TO_TYPE_PTR( LLMNRAnswer_t, pucByte );
|
||||||
|
|
||||||
/* We leave 'usIdentifier' and 'usQuestions' untouched */
|
/* We leave 'usIdentifier' and 'usQuestions' untouched */
|
||||||
#ifndef _lint
|
#ifndef _lint
|
||||||
@ -1604,8 +1616,8 @@ BaseType_t xReturn = pdTRUE;
|
|||||||
#else
|
#else
|
||||||
( void ) pxMessage;
|
( void ) pxMessage;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pxAnswer = ipPOINTER_CAST( NBNSAnswer_t *, &( pucUDPPayloadBuffer[ offsetof( NBNSRequest_t, usType ) ] ) );
|
pxAnswer = ipCAST_PTR_TO_TYPE_PTR( NBNSAnswer_t, &( pucUDPPayloadBuffer[ offsetof( NBNSRequest_t, usType ) ] ) );
|
||||||
|
|
||||||
#ifndef _lint
|
#ifndef _lint
|
||||||
vSetField16( pxAnswer, NBNSAnswer_t, usType, usType ); /* Type */
|
vSetField16( pxAnswer, NBNSAnswer_t, usType, usType ); /* Type */
|
||||||
|
@ -158,6 +158,16 @@ typedef union _xUnionPtr
|
|||||||
uint8_t *u8ptr;
|
uint8_t *u8ptr;
|
||||||
} xUnionPtr;
|
} xUnionPtr;
|
||||||
|
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( NetworkBufferDescriptor_t )
|
||||||
|
{
|
||||||
|
return ( NetworkBufferDescriptor_t *)pvArgument;
|
||||||
|
}
|
||||||
|
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( NetworkBufferDescriptor_t )
|
||||||
|
{
|
||||||
|
return ( const NetworkBufferDescriptor_t *) pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -362,7 +372,7 @@ struct freertos_sockaddr xAddress;
|
|||||||
/* Wait until there is something to do. If the following call exits
|
/* Wait until there is something to do. If the following call exits
|
||||||
* due to a time out rather than a message being received, set a
|
* due to a time out rather than a message being received, set a
|
||||||
* 'NoEvent' value. */
|
* 'NoEvent' value. */
|
||||||
if ( xQueueReceive( xNetworkEventQueue, ipPOINTER_CAST( void *, &xReceivedEvent ), xNextIPSleep ) == pdFALSE )
|
if ( xQueueReceive( xNetworkEventQueue, ( void *) &xReceivedEvent, xNextIPSleep ) == pdFALSE )
|
||||||
{
|
{
|
||||||
xReceivedEvent.eEventType = eNoEvent;
|
xReceivedEvent.eEventType = eNoEvent;
|
||||||
}
|
}
|
||||||
@ -395,14 +405,14 @@ struct freertos_sockaddr xAddress;
|
|||||||
case eNetworkRxEvent:
|
case eNetworkRxEvent:
|
||||||
/* The network hardware driver has received a new packet. A
|
/* The network hardware driver has received a new packet. A
|
||||||
pointer to the received buffer is located in the pvData member
|
pointer to the received buffer is located in the pvData member
|
||||||
of the received event structure. */
|
of the received event structure. */
|
||||||
prvHandleEthernetPacket( ipPOINTER_CAST( NetworkBufferDescriptor_t *, xReceivedEvent.pvData ) );
|
prvHandleEthernetPacket( ipCAST_PTR_TO_TYPE_PTR( NetworkBufferDescriptor_t, xReceivedEvent.pvData ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eNetworkTxEvent:
|
case eNetworkTxEvent:
|
||||||
/* Send a network packet. The ownership will be transferred to
|
/* Send a network packet. The ownership will be transferred to
|
||||||
the driver, which will release it after delivery. */
|
the driver, which will release it after delivery. */
|
||||||
( void ) xNetworkInterfaceOutput( ipPOINTER_CAST( NetworkBufferDescriptor_t *, xReceivedEvent.pvData ), pdTRUE );
|
( void ) xNetworkInterfaceOutput( ipCAST_PTR_TO_TYPE_PTR( NetworkBufferDescriptor_t, xReceivedEvent.pvData ), pdTRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eARPTimerEvent :
|
case eARPTimerEvent :
|
||||||
@ -416,7 +426,7 @@ struct freertos_sockaddr xAddress;
|
|||||||
usLocalPort. vSocketBind() will actually bind the socket and the
|
usLocalPort. vSocketBind() will actually bind the socket and the
|
||||||
API will unblock as soon as the eSOCKET_BOUND event is
|
API will unblock as soon as the eSOCKET_BOUND event is
|
||||||
triggered. */
|
triggered. */
|
||||||
pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, xReceivedEvent.pvData );
|
pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, xReceivedEvent.pvData );
|
||||||
xAddress.sin_addr = 0U; /* For the moment. */
|
xAddress.sin_addr = 0U; /* For the moment. */
|
||||||
xAddress.sin_port = FreeRTOS_ntohs( pxSocket->usLocalPort );
|
xAddress.sin_port = FreeRTOS_ntohs( pxSocket->usLocalPort );
|
||||||
pxSocket->usLocalPort = 0U;
|
pxSocket->usLocalPort = 0U;
|
||||||
@ -434,14 +444,14 @@ struct freertos_sockaddr xAddress;
|
|||||||
IP-task to actually close a socket. This is handled in
|
IP-task to actually close a socket. This is handled in
|
||||||
vSocketClose(). As the socket gets closed, there is no way to
|
vSocketClose(). As the socket gets closed, there is no way to
|
||||||
report back to the API, so the API won't wait for the result */
|
report back to the API, so the API won't wait for the result */
|
||||||
( void ) vSocketClose( ipPOINTER_CAST( FreeRTOS_Socket_t *, xReceivedEvent.pvData ) );
|
( void ) vSocketClose( ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, xReceivedEvent.pvData ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eStackTxEvent :
|
case eStackTxEvent :
|
||||||
/* The network stack has generated a packet to send. A
|
/* The network stack has generated a packet to send. A
|
||||||
pointer to the generated buffer is located in the pvData
|
pointer to the generated buffer is located in the pvData
|
||||||
member of the received event structure. */
|
member of the received event structure. */
|
||||||
vProcessGeneratedUDPPacket( ipPOINTER_CAST( NetworkBufferDescriptor_t *, xReceivedEvent.pvData ) );
|
vProcessGeneratedUDPPacket( ipCAST_PTR_TO_TYPE_PTR( NetworkBufferDescriptor_t, xReceivedEvent.pvData ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eDHCPEvent:
|
case eDHCPEvent:
|
||||||
@ -462,13 +472,13 @@ struct freertos_sockaddr xAddress;
|
|||||||
{
|
{
|
||||||
#if( ipconfigSELECT_USES_NOTIFY != 0 )
|
#if( ipconfigSELECT_USES_NOTIFY != 0 )
|
||||||
{
|
{
|
||||||
SocketSelectMessage_t *pxMessage = ipPOINTER_CAST( SocketSelectMessage_t *, xReceivedEvent.pvData );
|
SocketSelectMessage_t *pxMessage = ipCAST_PTR_TO_TYPE_PTR( SocketSelectMessage_t, xReceivedEvent.pvData );
|
||||||
vSocketSelect( pxMessage->pxSocketSet );
|
vSocketSelect( pxMessage->pxSocketSet );
|
||||||
( void ) xTaskNotifyGive( pxMessage->xTaskhandle );
|
( void ) xTaskNotifyGive( pxMessage->xTaskhandle );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
vSocketSelect( ipPOINTER_CAST( SocketSelect_t *, xReceivedEvent.pvData ) );
|
vSocketSelect( ipCAST_PTR_TO_TYPE_PTR( SocketSelect_t, xReceivedEvent.pvData ) );
|
||||||
}
|
}
|
||||||
#endif /* ( ipconfigSELECT_USES_NOTIFY != 0 ) */
|
#endif /* ( ipconfigSELECT_USES_NOTIFY != 0 ) */
|
||||||
}
|
}
|
||||||
@ -501,7 +511,7 @@ struct freertos_sockaddr xAddress;
|
|||||||
received a new connection. */
|
received a new connection. */
|
||||||
#if( ipconfigUSE_TCP == 1 )
|
#if( ipconfigUSE_TCP == 1 )
|
||||||
{
|
{
|
||||||
pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, xReceivedEvent.pvData );
|
pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, xReceivedEvent.pvData );
|
||||||
|
|
||||||
if( xTCPCheckNewClient( pxSocket ) != pdFALSE )
|
if( xTCPCheckNewClient( pxSocket ) != pdFALSE )
|
||||||
{
|
{
|
||||||
@ -1153,11 +1163,10 @@ void FreeRTOS_SetAddressConfiguration( const uint32_t *pulIPAddress,
|
|||||||
}
|
}
|
||||||
if( ( uxGetNumberOfFreeNetworkBuffers() >= 3U ) && ( uxNumberOfBytesToSend >= 1U ) && ( xEnoughSpace != pdFALSE ) )
|
if( ( uxGetNumberOfFreeNetworkBuffers() >= 3U ) && ( uxNumberOfBytesToSend >= 1U ) && ( xEnoughSpace != pdFALSE ) )
|
||||||
{
|
{
|
||||||
pxEthernetHeader = ipPOINTER_CAST( EthernetHeader_t *, pxNetworkBuffer->pucEthernetBuffer );
|
pxEthernetHeader = ipCAST_PTR_TO_TYPE_PTR( EthernetHeader_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||||
pxEthernetHeader->usFrameType = ipIPv4_FRAME_TYPE;
|
pxEthernetHeader->usFrameType = ipIPv4_FRAME_TYPE;
|
||||||
|
|
||||||
|
pxICMPHeader = ipCAST_PTR_TO_TYPE_PTR( ICMPHeader_t, &( pxNetworkBuffer->pucEthernetBuffer[ ipIP_PAYLOAD_OFFSET ] ) );
|
||||||
pxICMPHeader = ipPOINTER_CAST( ICMPHeader_t *, &( pxNetworkBuffer->pucEthernetBuffer[ ipIP_PAYLOAD_OFFSET ] ) );
|
|
||||||
usSequenceNumber++;
|
usSequenceNumber++;
|
||||||
|
|
||||||
/* Fill in the basic header information. */
|
/* Fill in the basic header information. */
|
||||||
@ -1289,7 +1298,7 @@ eFrameProcessingResult_t eReturn;
|
|||||||
const EthernetHeader_t *pxEthernetHeader;
|
const EthernetHeader_t *pxEthernetHeader;
|
||||||
|
|
||||||
/* Map the buffer onto Ethernet Header struct for easy access to fields. */
|
/* Map the buffer onto Ethernet Header struct for easy access to fields. */
|
||||||
pxEthernetHeader = ipPOINTER_CAST( const EthernetHeader_t *, pucEthernetBuffer );
|
pxEthernetHeader = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( EthernetHeader_t, pucEthernetBuffer );
|
||||||
|
|
||||||
if( memcmp( ipLOCAL_MAC_ADDRESS, pxEthernetHeader->xDestinationAddress.ucBytes, sizeof( MACAddress_t ) ) == 0 )
|
if( memcmp( ipLOCAL_MAC_ADDRESS, pxEthernetHeader->xDestinationAddress.ucBytes, sizeof( MACAddress_t ) ) == 0 )
|
||||||
{
|
{
|
||||||
@ -1430,7 +1439,7 @@ eFrameProcessingResult_t eReturned = eReleaseBuffer;
|
|||||||
eReturned = ipCONSIDER_FRAME_FOR_PROCESSING( pxNetworkBuffer->pucEthernetBuffer );
|
eReturned = ipCONSIDER_FRAME_FOR_PROCESSING( pxNetworkBuffer->pucEthernetBuffer );
|
||||||
|
|
||||||
/* Map the buffer onto the Ethernet Header struct for easy access to the fields. */
|
/* Map the buffer onto the Ethernet Header struct for easy access to the fields. */
|
||||||
pxEthernetHeader = ipPOINTER_CAST( const EthernetHeader_t *, pxNetworkBuffer->pucEthernetBuffer );
|
pxEthernetHeader = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( EthernetHeader_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||||
|
|
||||||
/* The condition "eReturned == eProcessBuffer" must be true. */
|
/* The condition "eReturned == eProcessBuffer" must be true. */
|
||||||
#if( ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES == 0 )
|
#if( ipconfigETHERNET_DRIVER_FILTERS_FRAME_TYPES == 0 )
|
||||||
@ -1444,7 +1453,7 @@ eFrameProcessingResult_t eReturned = eReleaseBuffer;
|
|||||||
/* The Ethernet frame contains an ARP packet. */
|
/* The Ethernet frame contains an ARP packet. */
|
||||||
if( pxNetworkBuffer->xDataLength >= sizeof( ARPPacket_t ) )
|
if( pxNetworkBuffer->xDataLength >= sizeof( ARPPacket_t ) )
|
||||||
{
|
{
|
||||||
eReturned = eARPProcessPacket( ipPOINTER_CAST( ARPPacket_t *, pxNetworkBuffer->pucEthernetBuffer ) );
|
eReturned = eARPProcessPacket( ipCAST_PTR_TO_TYPE_PTR( ARPPacket_t, pxNetworkBuffer->pucEthernetBuffer ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1456,7 +1465,7 @@ eFrameProcessingResult_t eReturned = eReleaseBuffer;
|
|||||||
/* The Ethernet frame contains an IP packet. */
|
/* The Ethernet frame contains an IP packet. */
|
||||||
if( pxNetworkBuffer->xDataLength >= sizeof( IPPacket_t ) )
|
if( pxNetworkBuffer->xDataLength >= sizeof( IPPacket_t ) )
|
||||||
{
|
{
|
||||||
eReturned = prvProcessIPPacket( ipPOINTER_CAST( IPPacket_t *, pxNetworkBuffer->pucEthernetBuffer ), pxNetworkBuffer );
|
eReturned = prvProcessIPPacket( ipCAST_PTR_TO_TYPE_PTR( IPPacket_t, pxNetworkBuffer->pucEthernetBuffer ), pxNetworkBuffer );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1643,7 +1652,7 @@ eFrameProcessingResult_t eReturn = eProcessBuffer;
|
|||||||
const uint16_t *pusChecksum;
|
const uint16_t *pusChecksum;
|
||||||
|
|
||||||
/* pxProtPack will point to the offset were the protocols begin. */
|
/* pxProtPack will point to the offset were the protocols begin. */
|
||||||
pxProtPack = ipPOINTER_CAST( ProtocolPacket_t *, &( pxNetworkBuffer->pucEthernetBuffer[ uxHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
pxProtPack = ipCAST_PTR_TO_TYPE_PTR( ProtocolPacket_t, &( pxNetworkBuffer->pucEthernetBuffer[ uxHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
||||||
pusChecksum = ( const uint16_t * ) ( &( pxProtPack->xUDPPacket.xUDPHeader.usChecksum ) );
|
pusChecksum = ( const uint16_t * ) ( &( pxProtPack->xUDPPacket.xUDPHeader.usChecksum ) );
|
||||||
if( *pusChecksum == ( uint16_t ) 0U )
|
if( *pusChecksum == ( uint16_t ) 0U )
|
||||||
{
|
{
|
||||||
@ -1762,7 +1771,7 @@ uint8_t ucProtocol;
|
|||||||
{
|
{
|
||||||
/* Map the buffer onto a ICMP-Packet struct to easily access the
|
/* Map the buffer onto a ICMP-Packet struct to easily access the
|
||||||
* fields of ICMP packet. */
|
* fields of ICMP packet. */
|
||||||
ICMPPacket_t *pxICMPPacket = ipPOINTER_CAST( ICMPPacket_t *, pxNetworkBuffer->pucEthernetBuffer );
|
ICMPPacket_t *pxICMPPacket = ipCAST_PTR_TO_TYPE_PTR( ICMPPacket_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||||
if( pxIPHeader->ulDestinationIPAddress == *ipLOCAL_IP_ADDRESS_POINTER )
|
if( pxIPHeader->ulDestinationIPAddress == *ipLOCAL_IP_ADDRESS_POINTER )
|
||||||
{
|
{
|
||||||
eReturn = prvProcessICMPPacket( pxICMPPacket );
|
eReturn = prvProcessICMPPacket( pxICMPPacket );
|
||||||
@ -1782,7 +1791,7 @@ uint8_t ucProtocol;
|
|||||||
|
|
||||||
/* Map the buffer onto a UDP-Packet struct to easily access the
|
/* Map the buffer onto a UDP-Packet struct to easily access the
|
||||||
* fields of UDP packet. */
|
* fields of UDP packet. */
|
||||||
const UDPPacket_t *pxUDPPacket = ipPOINTER_CAST( const UDPPacket_t *, pxNetworkBuffer->pucEthernetBuffer );
|
const UDPPacket_t *pxUDPPacket = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( UDPPacket_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||||
uint16_t usLength;
|
uint16_t usLength;
|
||||||
|
|
||||||
/* Note the header values required prior to the checksum
|
/* Note the header values required prior to the checksum
|
||||||
@ -2010,7 +2019,7 @@ uint8_t ucProtocol;
|
|||||||
|
|
||||||
/* Map the buffer onto a IP-Packet struct to easily access the
|
/* Map the buffer onto a IP-Packet struct to easily access the
|
||||||
* fields of the IP packet. */
|
* fields of the IP packet. */
|
||||||
pxIPPacket = ipPOINTER_CAST( const IPPacket_t *, pucEthernetBuffer );
|
pxIPPacket = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( IPPacket_t, pucEthernetBuffer );
|
||||||
|
|
||||||
ucVersionHeaderLength = pxIPPacket->xIPHeader.ucVersionHeaderLength;
|
ucVersionHeaderLength = pxIPPacket->xIPHeader.ucVersionHeaderLength;
|
||||||
/* Test if the length of the IP-header is between 20 and 60 bytes,
|
/* Test if the length of the IP-header is between 20 and 60 bytes,
|
||||||
@ -2049,7 +2058,7 @@ uint8_t ucProtocol;
|
|||||||
of this calculation. */
|
of this calculation. */
|
||||||
/* Map the Buffer onto the Protocol Packet struct for easy access to the
|
/* Map the Buffer onto the Protocol Packet struct for easy access to the
|
||||||
* struct fields. */
|
* struct fields. */
|
||||||
pxProtPack = ipPOINTER_CAST( ProtocolPacket_t *, &( pucEthernetBuffer[ uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
pxProtPack = ipCAST_PTR_TO_TYPE_PTR( ProtocolPacket_t, &( pucEthernetBuffer[ uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
||||||
|
|
||||||
/* Switch on the Layer 3/4 protocol. */
|
/* Switch on the Layer 3/4 protocol. */
|
||||||
if( ucProtocol == ( uint8_t ) ipPROTOCOL_UDP )
|
if( ucProtocol == ( uint8_t ) ipPROTOCOL_UDP )
|
||||||
@ -2133,7 +2142,7 @@ BaseType_t location = 0;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the packet length. */
|
/* Parse the packet length. */
|
||||||
pxIPPacket = ipPOINTER_CAST( const IPPacket_t *, pucEthernetBuffer );
|
pxIPPacket = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( IPPacket_t, pucEthernetBuffer );
|
||||||
|
|
||||||
/* Per https://tools.ietf.org/html/rfc791, the four-bit Internet Header
|
/* Per https://tools.ietf.org/html/rfc791, the four-bit Internet Header
|
||||||
Length field contains the length of the internet header in 32-bit words. */
|
Length field contains the length of the internet header in 32-bit words. */
|
||||||
@ -2165,7 +2174,7 @@ BaseType_t location = 0;
|
|||||||
and IP headers incorrectly aligned. However, either way, the "third"
|
and IP headers incorrectly aligned. However, either way, the "third"
|
||||||
protocol (Layer 3 or 4) header will be aligned, which is the convenience
|
protocol (Layer 3 or 4) header will be aligned, which is the convenience
|
||||||
of this calculation. */
|
of this calculation. */
|
||||||
pxProtPack = ipPOINTER_CAST( ProtocolPacket_t *, &( pucEthernetBuffer[ uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
pxProtPack = ipCAST_PTR_TO_TYPE_PTR( ProtocolPacket_t, &( pucEthernetBuffer[ uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
||||||
|
|
||||||
/* Switch on the Layer 3/4 protocol. */
|
/* Switch on the Layer 3/4 protocol. */
|
||||||
if( ucProtocol == ( uint8_t ) ipPROTOCOL_UDP )
|
if( ucProtocol == ( uint8_t ) ipPROTOCOL_UDP )
|
||||||
@ -2578,7 +2587,7 @@ EthernetHeader_t *pxEthernetHeader;
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* Map the Buffer to Ethernet Header struct for easy access to fields. */
|
/* Map the Buffer to Ethernet Header struct for easy access to fields. */
|
||||||
pxEthernetHeader = ipPOINTER_CAST( EthernetHeader_t *, pxNetworkBuffer->pucEthernetBuffer );
|
pxEthernetHeader = ipCAST_PTR_TO_TYPE_PTR( EthernetHeader_t, pxNetworkBuffer->pucEthernetBuffer );
|
||||||
|
|
||||||
/* Swap source and destination MAC addresses. */
|
/* Swap source and destination MAC addresses. */
|
||||||
( void ) memcpy( &( pxEthernetHeader->xDestinationAddress ), &( pxEthernetHeader->xSourceAddress ), sizeof( pxEthernetHeader->xDestinationAddress ) );
|
( void ) memcpy( &( pxEthernetHeader->xDestinationAddress ), &( pxEthernetHeader->xSourceAddress ), sizeof( pxEthernetHeader->xDestinationAddress ) );
|
||||||
|
@ -87,7 +87,28 @@ range 1024-65535" excluding those already in use (inbound or outbound). */
|
|||||||
#define sock80_PERCENT 80U
|
#define sock80_PERCENT 80U
|
||||||
#define sock100_PERCENT 100U
|
#define sock100_PERCENT 100U
|
||||||
|
|
||||||
|
#if( ipconfigUSE_CALLBACKS != 0 )
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( F_TCP_UDP_Handler_t )
|
||||||
|
{
|
||||||
|
return ( F_TCP_UDP_Handler_t *)pvArgument;
|
||||||
|
}
|
||||||
|
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( F_TCP_UDP_Handler_t )
|
||||||
|
{
|
||||||
|
return ( const F_TCP_UDP_Handler_t *) pvArgument;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( NetworkBufferDescriptor_t )
|
||||||
|
{
|
||||||
|
return ( NetworkBufferDescriptor_t *)pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( StreamBuffer_t )
|
||||||
|
{
|
||||||
|
return ( StreamBuffer_t *)pvArgument;
|
||||||
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -294,7 +315,7 @@ Socket_t xReturn;
|
|||||||
size depends on the type of socket: UDP sockets need less space. A
|
size depends on the type of socket: UDP sockets need less space. A
|
||||||
define 'pvPortMallocSocket' will used to allocate the necessary space.
|
define 'pvPortMallocSocket' will used to allocate the necessary space.
|
||||||
By default it points to the FreeRTOS function 'pvPortMalloc()'. */
|
By default it points to the FreeRTOS function 'pvPortMalloc()'. */
|
||||||
pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, pvPortMallocSocket( uxSocketSize ) );
|
pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, pvPortMallocSocket( uxSocketSize ) );
|
||||||
|
|
||||||
if( pxSocket == NULL )
|
if( pxSocket == NULL )
|
||||||
{
|
{
|
||||||
@ -394,7 +415,7 @@ Socket_t xReturn;
|
|||||||
{
|
{
|
||||||
SocketSelect_t *pxSocketSet;
|
SocketSelect_t *pxSocketSet;
|
||||||
|
|
||||||
pxSocketSet = ipPOINTER_CAST( SocketSelect_t *, pvPortMalloc( sizeof( *pxSocketSet ) ) );
|
pxSocketSet = ipCAST_PTR_TO_TYPE_PTR( SocketSelect_t, pvPortMalloc( sizeof( *pxSocketSet ) ) );
|
||||||
|
|
||||||
if( pxSocketSet != NULL )
|
if( pxSocketSet != NULL )
|
||||||
{
|
{
|
||||||
@ -733,7 +754,7 @@ EventBits_t xEventBits = ( EventBits_t ) 0;
|
|||||||
taskENTER_CRITICAL();
|
taskENTER_CRITICAL();
|
||||||
{
|
{
|
||||||
/* The owner of the list item is the network buffer. */
|
/* The owner of the list item is the network buffer. */
|
||||||
pxNetworkBuffer = ipPOINTER_CAST( NetworkBufferDescriptor_t *, listGET_OWNER_OF_HEAD_ENTRY( &( pxSocket->u.xUDP.xWaitingPacketsList ) ) );
|
pxNetworkBuffer = ipCAST_PTR_TO_TYPE_PTR( NetworkBufferDescriptor_t, listGET_OWNER_OF_HEAD_ENTRY( &( pxSocket->u.xUDP.xWaitingPacketsList ) ) );
|
||||||
|
|
||||||
if( ( ( UBaseType_t ) xFlags & ( UBaseType_t ) FREERTOS_MSG_PEEK ) == 0U )
|
if( ( ( UBaseType_t ) xFlags & ( UBaseType_t ) FREERTOS_MSG_PEEK ) == 0U )
|
||||||
{
|
{
|
||||||
@ -1273,7 +1294,7 @@ NetworkBufferDescriptor_t *pxNetworkBuffer;
|
|||||||
{
|
{
|
||||||
while( listCURRENT_LIST_LENGTH( &( pxSocket->u.xUDP.xWaitingPacketsList ) ) > 0U )
|
while( listCURRENT_LIST_LENGTH( &( pxSocket->u.xUDP.xWaitingPacketsList ) ) > 0U )
|
||||||
{
|
{
|
||||||
pxNetworkBuffer = ipPOINTER_CAST( NetworkBufferDescriptor_t *, listGET_OWNER_OF_HEAD_ENTRY( &( pxSocket->u.xUDP.xWaitingPacketsList ) ) );
|
pxNetworkBuffer = ipCAST_PTR_TO_TYPE_PTR( NetworkBufferDescriptor_t, listGET_OWNER_OF_HEAD_ENTRY( &( pxSocket->u.xUDP.xWaitingPacketsList ) ) );
|
||||||
( void ) uxListRemove( &( pxNetworkBuffer->xBufferListItem ) );
|
( void ) uxListRemove( &( pxNetworkBuffer->xBufferListItem ) );
|
||||||
vReleaseNetworkBufferAndDescriptor( pxNetworkBuffer );
|
vReleaseNetworkBufferAndDescriptor( pxNetworkBuffer );
|
||||||
}
|
}
|
||||||
@ -1317,7 +1338,7 @@ NetworkBufferDescriptor_t *pxNetworkBuffer;
|
|||||||
static void prvTCPSetSocketCount( FreeRTOS_Socket_t const * pxSocketToDelete )
|
static void prvTCPSetSocketCount( FreeRTOS_Socket_t const * pxSocketToDelete )
|
||||||
{
|
{
|
||||||
const ListItem_t *pxIterator;
|
const ListItem_t *pxIterator;
|
||||||
const ListItem_t *pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundTCPSocketsList ) );
|
const ListItem_t *pxEnd = listGET_END_MARKER( &xBoundTCPSocketsList );
|
||||||
FreeRTOS_Socket_t *pxOtherSocket;
|
FreeRTOS_Socket_t *pxOtherSocket;
|
||||||
uint16_t usLocalPort = pxSocketToDelete->usLocalPort;
|
uint16_t usLocalPort = pxSocketToDelete->usLocalPort;
|
||||||
|
|
||||||
@ -1325,7 +1346,7 @@ NetworkBufferDescriptor_t *pxNetworkBuffer;
|
|||||||
pxIterator != pxEnd;
|
pxIterator != pxEnd;
|
||||||
pxIterator = listGET_NEXT( pxIterator ) )
|
pxIterator = listGET_NEXT( pxIterator ) )
|
||||||
{
|
{
|
||||||
pxOtherSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
pxOtherSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||||
if( ( pxOtherSocket->u.xTCP.ucTCPState == ( uint8_t ) eTCP_LISTEN ) &&
|
if( ( pxOtherSocket->u.xTCP.ucTCPState == ( uint8_t ) eTCP_LISTEN ) &&
|
||||||
( pxOtherSocket->usLocalPort == usLocalPort ) &&
|
( pxOtherSocket->usLocalPort == usLocalPort ) &&
|
||||||
( pxOtherSocket->u.xTCP.usChildCount != 0U ) )
|
( pxOtherSocket->u.xTCP.usChildCount != 0U ) )
|
||||||
@ -1409,12 +1430,12 @@ FreeRTOS_Socket_t *pxSocket;
|
|||||||
{
|
{
|
||||||
case FREERTOS_SO_RCVTIMEO :
|
case FREERTOS_SO_RCVTIMEO :
|
||||||
/* Receive time out. */
|
/* Receive time out. */
|
||||||
pxSocket->xReceiveBlockTime = *( ipPOINTER_CAST( const TickType_t *, pvOptionValue ) );
|
pxSocket->xReceiveBlockTime = *( ( TickType_t *) pvOptionValue );
|
||||||
xReturn = 0;
|
xReturn = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FREERTOS_SO_SNDTIMEO :
|
case FREERTOS_SO_SNDTIMEO :
|
||||||
pxSocket->xSendBlockTime = *( ipPOINTER_CAST( const TickType_t *, pvOptionValue ) );
|
pxSocket->xSendBlockTime = *( ( TickType_t *) pvOptionValue );
|
||||||
if( pxSocket->ucProtocol == ( uint8_t ) FREERTOS_IPPROTO_UDP )
|
if( pxSocket->ucProtocol == ( uint8_t ) FREERTOS_IPPROTO_UDP )
|
||||||
{
|
{
|
||||||
/* The send time out is capped for the reason stated in the
|
/* The send time out is capped for the reason stated in the
|
||||||
@ -1498,20 +1519,20 @@ FreeRTOS_Socket_t *pxSocket;
|
|||||||
{
|
{
|
||||||
#if ipconfigUSE_TCP == 1
|
#if ipconfigUSE_TCP == 1
|
||||||
case FREERTOS_SO_TCP_CONN_HANDLER:
|
case FREERTOS_SO_TCP_CONN_HANDLER:
|
||||||
pxSocket->u.xTCP.pxHandleConnected = ipPOINTER_CAST( const F_TCP_UDP_Handler_t *, pvOptionValue )->pxOnTCPConnected;
|
pxSocket->u.xTCP.pxHandleConnected = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( F_TCP_UDP_Handler_t, pvOptionValue )->pxOnTCPConnected;
|
||||||
break;
|
break;
|
||||||
case FREERTOS_SO_TCP_RECV_HANDLER:
|
case FREERTOS_SO_TCP_RECV_HANDLER:
|
||||||
pxSocket->u.xTCP.pxHandleReceive = ipPOINTER_CAST( const F_TCP_UDP_Handler_t *, pvOptionValue )->pxOnTCPReceive;
|
pxSocket->u.xTCP.pxHandleReceive = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( F_TCP_UDP_Handler_t, pvOptionValue )->pxOnTCPReceive;
|
||||||
break;
|
break;
|
||||||
case FREERTOS_SO_TCP_SENT_HANDLER:
|
case FREERTOS_SO_TCP_SENT_HANDLER:
|
||||||
pxSocket->u.xTCP.pxHandleSent = ipPOINTER_CAST( const F_TCP_UDP_Handler_t *, pvOptionValue )->pxOnTCPSent;
|
pxSocket->u.xTCP.pxHandleSent = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( F_TCP_UDP_Handler_t, pvOptionValue )->pxOnTCPSent;
|
||||||
break;
|
break;
|
||||||
#endif /* ipconfigUSE_TCP */
|
#endif /* ipconfigUSE_TCP */
|
||||||
case FREERTOS_SO_UDP_RECV_HANDLER:
|
case FREERTOS_SO_UDP_RECV_HANDLER:
|
||||||
pxSocket->u.xUDP.pxHandleReceive = ipPOINTER_CAST( const F_TCP_UDP_Handler_t *, pvOptionValue )->pxOnUDPReceive;
|
pxSocket->u.xUDP.pxHandleReceive = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( F_TCP_UDP_Handler_t, pvOptionValue )->pxOnUDPReceive;
|
||||||
break;
|
break;
|
||||||
case FREERTOS_SO_UDP_SENT_HANDLER:
|
case FREERTOS_SO_UDP_SENT_HANDLER:
|
||||||
pxSocket->u.xUDP.pxHandleSent = ipPOINTER_CAST( const F_TCP_UDP_Handler_t *, pvOptionValue )->pxOnUDPSent;
|
pxSocket->u.xUDP.pxHandleSent = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( F_TCP_UDP_Handler_t, pvOptionValue )->pxOnUDPSent;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Should it throw an error here? */
|
/* Should it throw an error here? */
|
||||||
@ -1640,7 +1661,7 @@ FreeRTOS_Socket_t *pxSocket;
|
|||||||
{
|
{
|
||||||
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
||||||
}
|
}
|
||||||
if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
|
if( *( ( BaseType_t * ) pvOptionValue ) != 0 )
|
||||||
{
|
{
|
||||||
pxSocket->u.xTCP.bits.bReuseSocket = pdTRUE;
|
pxSocket->u.xTCP.bits.bReuseSocket = pdTRUE;
|
||||||
}
|
}
|
||||||
@ -1659,7 +1680,7 @@ FreeRTOS_Socket_t *pxSocket;
|
|||||||
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
|
if( *( ( BaseType_t * ) pvOptionValue ) != 0 )
|
||||||
{
|
{
|
||||||
pxSocket->u.xTCP.bits.bCloseAfterSend = pdTRUE;
|
pxSocket->u.xTCP.bits.bCloseAfterSend = pdTRUE;
|
||||||
}
|
}
|
||||||
@ -1678,7 +1699,7 @@ FreeRTOS_Socket_t *pxSocket;
|
|||||||
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
|
if( *( ( BaseType_t *) pvOptionValue ) != 0 )
|
||||||
{
|
{
|
||||||
pxSocket->u.xTCP.xTCPWindow.u.bits.bSendFullSize = pdTRUE;
|
pxSocket->u.xTCP.xTCPWindow.u.bits.bSendFullSize = pdTRUE;
|
||||||
}
|
}
|
||||||
@ -1704,7 +1725,7 @@ FreeRTOS_Socket_t *pxSocket;
|
|||||||
{
|
{
|
||||||
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
||||||
}
|
}
|
||||||
if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
|
if( *( ( BaseType_t * ) pvOptionValue ) != 0 )
|
||||||
{
|
{
|
||||||
pxSocket->u.xTCP.bits.bRxStopped = pdTRUE;
|
pxSocket->u.xTCP.bits.bRxStopped = pdTRUE;
|
||||||
}
|
}
|
||||||
@ -1803,7 +1824,7 @@ const ListItem_t * pxResult = NULL;
|
|||||||
if( ( xIPIsNetworkTaskReady() != pdFALSE ) && ( pxList != NULL ) )
|
if( ( xIPIsNetworkTaskReady() != pdFALSE ) && ( pxList != NULL ) )
|
||||||
{
|
{
|
||||||
const ListItem_t *pxIterator;
|
const ListItem_t *pxIterator;
|
||||||
const ListItem_t *pxEnd = ipPOINTER_CAST( const ListItem_t*, listGET_END_MARKER( pxList ) );
|
const ListItem_t *pxEnd = listGET_END_MARKER( pxList );
|
||||||
for( pxIterator = listGET_NEXT( pxEnd );
|
for( pxIterator = listGET_NEXT( pxEnd );
|
||||||
pxIterator != pxEnd;
|
pxIterator != pxEnd;
|
||||||
pxIterator = listGET_NEXT( pxIterator ) )
|
pxIterator = listGET_NEXT( pxIterator ) )
|
||||||
@ -1835,7 +1856,7 @@ FreeRTOS_Socket_t *pxSocket = NULL;
|
|||||||
if( pxListItem != NULL )
|
if( pxListItem != NULL )
|
||||||
{
|
{
|
||||||
/* The owner of the list item is the socket itself. */
|
/* The owner of the list item is the socket itself. */
|
||||||
pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, listGET_LIST_ITEM_OWNER( pxListItem ) );
|
pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, listGET_LIST_ITEM_OWNER( pxListItem ) );
|
||||||
configASSERT( pxSocket != NULL );
|
configASSERT( pxSocket != NULL );
|
||||||
}
|
}
|
||||||
return pxSocket;
|
return pxSocket;
|
||||||
@ -3058,7 +3079,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
|
|||||||
TickType_t xNow = xTaskGetTickCount();
|
TickType_t xNow = xTaskGetTickCount();
|
||||||
static TickType_t xLastTime = 0U;
|
static TickType_t xLastTime = 0U;
|
||||||
TickType_t xDelta = xNow - xLastTime;
|
TickType_t xDelta = xNow - xLastTime;
|
||||||
const ListItem_t* pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundTCPSocketsList ) );
|
const ListItem_t* pxEnd = listGET_END_MARKER( &xBoundTCPSocketsList );
|
||||||
const ListItem_t *pxIterator = ( const ListItem_t * ) listGET_HEAD_ENTRY( &xBoundTCPSocketsList );
|
const ListItem_t *pxIterator = ( const ListItem_t * ) listGET_HEAD_ENTRY( &xBoundTCPSocketsList );
|
||||||
|
|
||||||
xLastTime = xNow;
|
xLastTime = xNow;
|
||||||
@ -3070,7 +3091,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
|
|||||||
|
|
||||||
while( pxIterator != pxEnd )
|
while( pxIterator != pxEnd )
|
||||||
{
|
{
|
||||||
pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||||
pxIterator = ( ListItem_t * ) listGET_NEXT( pxIterator );
|
pxIterator = ( ListItem_t * ) listGET_NEXT( pxIterator );
|
||||||
|
|
||||||
/* Sockets with 'tmout == 0' do not need any regular attention. */
|
/* Sockets with 'tmout == 0' do not need any regular attention. */
|
||||||
@ -3142,7 +3163,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
|
|||||||
{
|
{
|
||||||
const ListItem_t *pxIterator;
|
const ListItem_t *pxIterator;
|
||||||
FreeRTOS_Socket_t *pxResult = NULL, *pxListenSocket = NULL;
|
FreeRTOS_Socket_t *pxResult = NULL, *pxListenSocket = NULL;
|
||||||
const ListItem_t *pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundTCPSocketsList ) );
|
const ListItem_t *pxEnd = listGET_END_MARKER( &xBoundTCPSocketsList );
|
||||||
|
|
||||||
/* Parameter not yet supported. */
|
/* Parameter not yet supported. */
|
||||||
( void ) ulLocalIP;
|
( void ) ulLocalIP;
|
||||||
@ -3151,7 +3172,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
|
|||||||
pxIterator != pxEnd;
|
pxIterator != pxEnd;
|
||||||
pxIterator = listGET_NEXT( pxIterator ) )
|
pxIterator = listGET_NEXT( pxIterator ) )
|
||||||
{
|
{
|
||||||
FreeRTOS_Socket_t *pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
FreeRTOS_Socket_t *pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||||
|
|
||||||
if( pxSocket->usLocalPort == ( uint16_t ) uxLocalPort )
|
if( pxSocket->usLocalPort == ( uint16_t ) uxLocalPort )
|
||||||
{
|
{
|
||||||
@ -3245,7 +3266,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
|
|||||||
|
|
||||||
uxSize = ( sizeof( *pxBuffer ) + uxLength ) - sizeof( pxBuffer->ucArray );
|
uxSize = ( sizeof( *pxBuffer ) + uxLength ) - sizeof( pxBuffer->ucArray );
|
||||||
|
|
||||||
pxBuffer = ipPOINTER_CAST( StreamBuffer_t *, pvPortMallocLarge( uxSize ) );
|
pxBuffer = ipCAST_PTR_TO_TYPE_PTR( StreamBuffer_t, pvPortMallocLarge( uxSize ) );
|
||||||
|
|
||||||
if( pxBuffer == NULL )
|
if( pxBuffer == NULL )
|
||||||
{
|
{
|
||||||
@ -3701,14 +3722,14 @@ BaseType_t FreeRTOS_udp_rx_size( Socket_t xSocket )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const ListItem_t *pxEndTCP = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundTCPSocketsList ) );
|
const ListItem_t *pxEndTCP = listGET_END_MARKER( &xBoundTCPSocketsList );
|
||||||
const ListItem_t *pxEndUDP = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundUDPSocketsList ) );
|
const ListItem_t *pxEndUDP = listGET_END_MARKER( &xBoundUDPSocketsList );
|
||||||
FreeRTOS_printf( ( "Prot Port IP-Remote : Port R/T Status Alive tmout Child\n" ) );
|
FreeRTOS_printf( ( "Prot Port IP-Remote : Port R/T Status Alive tmout Child\n" ) );
|
||||||
for( pxIterator = listGET_HEAD_ENTRY( &xBoundTCPSocketsList );
|
for( pxIterator = listGET_HEAD_ENTRY( &xBoundTCPSocketsList );
|
||||||
pxIterator != pxEndTCP;
|
pxIterator != pxEndTCP;
|
||||||
pxIterator = listGET_NEXT( pxIterator ) )
|
pxIterator = listGET_NEXT( pxIterator ) )
|
||||||
{
|
{
|
||||||
const FreeRTOS_Socket_t *pxSocket = ipPOINTER_CAST( const FreeRTOS_Socket_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
const FreeRTOS_Socket_t *pxSocket = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( FreeRTOS_Socket_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||||
#if( ipconfigTCP_KEEP_ALIVE == 1 )
|
#if( ipconfigTCP_KEEP_ALIVE == 1 )
|
||||||
TickType_t age = xTaskGetTickCount() - pxSocket->u.xTCP.xLastAliveTime;
|
TickType_t age = xTaskGetTickCount() - pxSocket->u.xTCP.xLastAliveTime;
|
||||||
#else
|
#else
|
||||||
@ -3782,19 +3803,19 @@ BaseType_t FreeRTOS_udp_rx_size( Socket_t xSocket )
|
|||||||
const ListItem_t *pxEnd;
|
const ListItem_t *pxEnd;
|
||||||
if( xRound == 0 )
|
if( xRound == 0 )
|
||||||
{
|
{
|
||||||
pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundUDPSocketsList ) );
|
pxEnd = listGET_END_MARKER( &xBoundUDPSocketsList );
|
||||||
}
|
}
|
||||||
#if ipconfigUSE_TCP == 1
|
#if ipconfigUSE_TCP == 1
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pxEnd = ipPOINTER_CAST( const ListItem_t *, listGET_END_MARKER( &xBoundTCPSocketsList ) );
|
pxEnd = listGET_END_MARKER( &xBoundTCPSocketsList );
|
||||||
}
|
}
|
||||||
#endif /* ipconfigUSE_TCP == 1 */
|
#endif /* ipconfigUSE_TCP == 1 */
|
||||||
for( pxIterator = listGET_NEXT( pxEnd );
|
for( pxIterator = listGET_NEXT( pxEnd );
|
||||||
pxIterator != pxEnd;
|
pxIterator != pxEnd;
|
||||||
pxIterator = listGET_NEXT( pxIterator ) )
|
pxIterator = listGET_NEXT( pxIterator ) )
|
||||||
{
|
{
|
||||||
FreeRTOS_Socket_t *pxSocket = ipPOINTER_CAST( FreeRTOS_Socket_t *, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
FreeRTOS_Socket_t *pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, listGET_LIST_ITEM_OWNER( pxIterator ) );
|
||||||
if( pxSocket->pxSocketSet != pxSocketSet )
|
if( pxSocket->pxSocketSet != pxSocketSet )
|
||||||
{
|
{
|
||||||
/* Socket does not belong to this select group. */
|
/* Socket does not belong to this select group. */
|
||||||
|
@ -85,6 +85,17 @@ struct xETH_HEADER
|
|||||||
#include "pack_struct_end.h"
|
#include "pack_struct_end.h"
|
||||||
typedef struct xETH_HEADER EthernetHeader_t;
|
typedef struct xETH_HEADER EthernetHeader_t;
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( EthernetHeader_t )
|
||||||
|
{
|
||||||
|
return ( EthernetHeader_t *)pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( EthernetHeader_t )
|
||||||
|
{
|
||||||
|
return ( const EthernetHeader_t *) pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "pack_struct_start.h"
|
#include "pack_struct_start.h"
|
||||||
struct xARP_HEADER
|
struct xARP_HEADER
|
||||||
{
|
{
|
||||||
@ -130,6 +141,16 @@ struct xICMP_HEADER
|
|||||||
#include "pack_struct_end.h"
|
#include "pack_struct_end.h"
|
||||||
typedef struct xICMP_HEADER ICMPHeader_t;
|
typedef struct xICMP_HEADER ICMPHeader_t;
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( ICMPHeader_t )
|
||||||
|
{
|
||||||
|
return ( ICMPHeader_t *)pvArgument;
|
||||||
|
}
|
||||||
|
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( ICMPHeader_t )
|
||||||
|
{
|
||||||
|
return ( const ICMPHeader_t *) pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "pack_struct_start.h"
|
#include "pack_struct_start.h"
|
||||||
struct xUDP_HEADER
|
struct xUDP_HEADER
|
||||||
{
|
{
|
||||||
@ -174,6 +195,16 @@ struct xARP_PACKET
|
|||||||
#include "pack_struct_end.h"
|
#include "pack_struct_end.h"
|
||||||
typedef struct xARP_PACKET ARPPacket_t;
|
typedef struct xARP_PACKET ARPPacket_t;
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( ARPPacket_t )
|
||||||
|
{
|
||||||
|
return ( ARPPacket_t *)pvArgument;
|
||||||
|
}
|
||||||
|
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( ARPPacket_t )
|
||||||
|
{
|
||||||
|
return ( const ARPPacket_t *) pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "pack_struct_start.h"
|
#include "pack_struct_start.h"
|
||||||
struct xIP_PACKET
|
struct xIP_PACKET
|
||||||
{
|
{
|
||||||
@ -183,6 +214,16 @@ struct xIP_PACKET
|
|||||||
#include "pack_struct_end.h"
|
#include "pack_struct_end.h"
|
||||||
typedef struct xIP_PACKET IPPacket_t;
|
typedef struct xIP_PACKET IPPacket_t;
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( IPPacket_t )
|
||||||
|
{
|
||||||
|
return ( IPPacket_t *)pvArgument;
|
||||||
|
}
|
||||||
|
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( IPPacket_t )
|
||||||
|
{
|
||||||
|
return ( const IPPacket_t *) pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "pack_struct_start.h"
|
#include "pack_struct_start.h"
|
||||||
struct xICMP_PACKET
|
struct xICMP_PACKET
|
||||||
{
|
{
|
||||||
@ -193,6 +234,12 @@ struct xICMP_PACKET
|
|||||||
#include "pack_struct_end.h"
|
#include "pack_struct_end.h"
|
||||||
typedef struct xICMP_PACKET ICMPPacket_t;
|
typedef struct xICMP_PACKET ICMPPacket_t;
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( ICMPPacket_t )
|
||||||
|
{
|
||||||
|
return ( ICMPPacket_t *)pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "pack_struct_start.h"
|
#include "pack_struct_start.h"
|
||||||
struct xUDP_PACKET
|
struct xUDP_PACKET
|
||||||
{
|
{
|
||||||
@ -205,12 +252,10 @@ typedef struct xUDP_PACKET UDPPacket_t;
|
|||||||
|
|
||||||
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( UDPPacket_t )
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( UDPPacket_t )
|
||||||
{
|
{
|
||||||
/* coverity[misra_c_2012_rule_11_3_violation] */
|
|
||||||
return ( UDPPacket_t *)pvArgument;
|
return ( UDPPacket_t *)pvArgument;
|
||||||
}
|
}
|
||||||
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( UDPPacket_t )
|
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( UDPPacket_t )
|
||||||
{
|
{
|
||||||
/* coverity[misra_c_2012_rule_11_3_violation] */
|
|
||||||
return ( const UDPPacket_t *) pvArgument;
|
return ( const UDPPacket_t *) pvArgument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,6 +277,15 @@ typedef union XPROT_PACKET
|
|||||||
ICMPPacket_t xICMPPacket;
|
ICMPPacket_t xICMPPacket;
|
||||||
} ProtocolPacket_t;
|
} ProtocolPacket_t;
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( ProtocolPacket_t )
|
||||||
|
{
|
||||||
|
return ( ProtocolPacket_t *)pvArgument;
|
||||||
|
}
|
||||||
|
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( ProtocolPacket_t )
|
||||||
|
{
|
||||||
|
return ( const ProtocolPacket_t *) pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
typedef union xPROT_HEADERS
|
typedef union xPROT_HEADERS
|
||||||
{
|
{
|
||||||
ICMPHeader_t xICMPHeader;
|
ICMPHeader_t xICMPHeader;
|
||||||
@ -690,6 +744,15 @@ typedef struct xSOCKET
|
|||||||
} u;
|
} u;
|
||||||
} FreeRTOS_Socket_t;
|
} FreeRTOS_Socket_t;
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( FreeRTOS_Socket_t )
|
||||||
|
{
|
||||||
|
return ( FreeRTOS_Socket_t *)pvArgument;
|
||||||
|
}
|
||||||
|
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( FreeRTOS_Socket_t )
|
||||||
|
{
|
||||||
|
return ( const FreeRTOS_Socket_t *) pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
#if( ipconfigUSE_TCP == 1 )
|
#if( ipconfigUSE_TCP == 1 )
|
||||||
/*
|
/*
|
||||||
* Lookup a TCP socket, using a multiple matching: both port numbers and
|
* Lookup a TCP socket, using a multiple matching: both port numbers and
|
||||||
@ -826,6 +889,15 @@ typedef struct xSOCKET_SET
|
|||||||
EventGroupHandle_t xSelectGroup;
|
EventGroupHandle_t xSelectGroup;
|
||||||
} SocketSelect_t;
|
} SocketSelect_t;
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( SocketSelect_t )
|
||||||
|
{
|
||||||
|
return ( SocketSelect_t *)pvArgument;
|
||||||
|
}
|
||||||
|
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( SocketSelect_t )
|
||||||
|
{
|
||||||
|
return ( const SocketSelect_t *) pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
extern void vSocketSelect( SocketSelect_t *pxSocketSet );
|
extern void vSocketSelect( SocketSelect_t *pxSocketSet );
|
||||||
|
|
||||||
/* Define the data that must be passed for a 'eSocketSelectEvent'. */
|
/* Define the data that must be passed for a 'eSocketSelectEvent'. */
|
||||||
@ -835,6 +907,15 @@ typedef struct xSocketSelectMessage
|
|||||||
SocketSelect_t *pxSocketSet;
|
SocketSelect_t *pxSocketSet;
|
||||||
} SocketSelectMessage_t;
|
} SocketSelectMessage_t;
|
||||||
|
|
||||||
|
static portINLINE ipDECL_CAST_PTR_FUNC_FOR_TYPE( SocketSelectMessage_t )
|
||||||
|
{
|
||||||
|
return ( SocketSelectMessage_t *)pvArgument;
|
||||||
|
}
|
||||||
|
static portINLINE ipDECL_CAST_CONST_PTR_FUNC_FOR_TYPE( SocketSelectMessage_t )
|
||||||
|
{
|
||||||
|
return ( const SocketSelectMessage_t *) pvArgument;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* ipconfigSUPPORT_SELECT_FUNCTION */
|
#endif /* ipconfigSUPPORT_SELECT_FUNCTION */
|
||||||
|
|
||||||
void vIPSetDHCPTimerEnableState( BaseType_t xEnableState );
|
void vIPSetDHCPTimerEnableState( BaseType_t xEnableState );
|
||||||
|
Reference in New Issue
Block a user