mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2025-06-20 23:27:39 +08:00
Address MISRA errors of various kinds (#234)
* MISRA 21.15 changes * MISRA 11.8 changes
This commit is contained in:

committed by
GitHub

parent
a72f040861
commit
0341050048
@ -96,7 +96,7 @@ uint32_t ulTargetProtocolAddress, ulSenderProtocolAddress;
|
|||||||
pxARPHeader = &( pxARPFrame->xARPHeader );
|
pxARPHeader = &( pxARPFrame->xARPHeader );
|
||||||
|
|
||||||
/* The field ulSenderProtocolAddress is badly aligned, copy byte-by-byte. */
|
/* The field ulSenderProtocolAddress is badly aligned, copy byte-by-byte. */
|
||||||
( void ) memcpy( &( ulSenderProtocolAddress ), pxARPHeader->ucSenderProtocolAddress, sizeof( ulSenderProtocolAddress ) );
|
( void ) memcpy( ( void * ) ( &( ulSenderProtocolAddress ) ), ( const void * ) ( pxARPHeader->ucSenderProtocolAddress ), sizeof( ulSenderProtocolAddress ) );
|
||||||
/* The field ulTargetProtocolAddress is well-aligned, a 32-bits copy. */
|
/* The field ulTargetProtocolAddress is well-aligned, a 32-bits copy. */
|
||||||
ulTargetProtocolAddress = pxARPHeader->ulTargetProtocolAddress;
|
ulTargetProtocolAddress = pxARPHeader->ulTargetProtocolAddress;
|
||||||
|
|
||||||
@ -135,8 +135,8 @@ uint32_t ulTargetProtocolAddress, ulSenderProtocolAddress;
|
|||||||
( void ) memcpy( pxARPHeader->xTargetHardwareAddress.ucBytes, pxARPHeader->xSenderHardwareAddress.ucBytes, sizeof( MACAddress_t ) );
|
( void ) memcpy( pxARPHeader->xTargetHardwareAddress.ucBytes, pxARPHeader->xSenderHardwareAddress.ucBytes, sizeof( MACAddress_t ) );
|
||||||
pxARPHeader->ulTargetProtocolAddress = ulSenderProtocolAddress;
|
pxARPHeader->ulTargetProtocolAddress = ulSenderProtocolAddress;
|
||||||
}
|
}
|
||||||
( void ) memcpy( pxARPHeader->xSenderHardwareAddress.ucBytes, ipLOCAL_MAC_ADDRESS, sizeof( MACAddress_t ) );
|
( void ) memcpy( ( void * ) ( pxARPHeader->xSenderHardwareAddress.ucBytes ), ( const void * ) ( ipLOCAL_MAC_ADDRESS ), sizeof( MACAddress_t ) );
|
||||||
( void ) memcpy( pxARPHeader->ucSenderProtocolAddress, ipLOCAL_IP_ADDRESS_POINTER, sizeof( pxARPHeader->ucSenderProtocolAddress ) );
|
( void ) memcpy( ( void * ) ( pxARPHeader->ucSenderProtocolAddress ), ( const void * ) ( ipLOCAL_IP_ADDRESS_POINTER ), sizeof( pxARPHeader->ucSenderProtocolAddress ) );
|
||||||
|
|
||||||
eReturn = eReturnEthernetFrame;
|
eReturn = eReturnEthernetFrame;
|
||||||
}
|
}
|
||||||
@ -669,11 +669,11 @@ ARPPacket_t *pxARPPacket;
|
|||||||
xARPHeader.usOperation;
|
xARPHeader.usOperation;
|
||||||
xARPHeader.xTargetHardwareAddress;
|
xARPHeader.xTargetHardwareAddress;
|
||||||
*/
|
*/
|
||||||
( void ) memcpy( pxARPPacket, xDefaultPartARPPacketHeader, sizeof( xDefaultPartARPPacketHeader ) );
|
( void ) memcpy( ( void * ) pxARPPacket, ( const void * ) xDefaultPartARPPacketHeader, sizeof( xDefaultPartARPPacketHeader ) );
|
||||||
( void ) memcpy( pxARPPacket->xEthernetHeader.xSourceAddress.ucBytes , ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
( void ) memcpy( ( void * ) ( pxARPPacket->xEthernetHeader.xSourceAddress.ucBytes ) , ( const void * ) ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||||
( void ) memcpy( pxARPPacket->xARPHeader.xSenderHardwareAddress.ucBytes, ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
( void ) memcpy( ( void * ) ( pxARPPacket->xARPHeader.xSenderHardwareAddress.ucBytes ), ( const void * ) ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||||
|
|
||||||
( void ) memcpy( pxARPPacket->xARPHeader.ucSenderProtocolAddress, ipLOCAL_IP_ADDRESS_POINTER, sizeof( pxARPPacket->xARPHeader.ucSenderProtocolAddress ) );
|
( void ) memcpy( ( void * ) ( pxARPPacket->xARPHeader.ucSenderProtocolAddress ), ( const void * ) ipLOCAL_IP_ADDRESS_POINTER, sizeof( pxARPPacket->xARPHeader.ucSenderProtocolAddress ) );
|
||||||
pxARPPacket->xARPHeader.ulTargetProtocolAddress = pxNetworkBuffer->ulIPAddress;
|
pxARPPacket->xARPHeader.ulTargetProtocolAddress = pxNetworkBuffer->ulIPAddress;
|
||||||
|
|
||||||
pxNetworkBuffer->xDataLength = sizeof( ARPPacket_t );
|
pxNetworkBuffer->xDataLength = sizeof( ARPPacket_t );
|
||||||
|
@ -726,8 +726,8 @@ const uint32_t ulMandatoryOptions = 2UL; /* DHCP server address, and the correct
|
|||||||
just get it once here and use later. */
|
just get it once here and use later. */
|
||||||
if( uxLength >= sizeof( ulParameter ) )
|
if( uxLength >= sizeof( ulParameter ) )
|
||||||
{
|
{
|
||||||
( void ) memcpy( &( ulParameter ),
|
( void ) memcpy( ( void * ) ( &( ulParameter ) ),
|
||||||
&( pucByte[ uxIndex ] ),
|
( const void * ) ( &( pucByte[ uxIndex ] ) ),
|
||||||
( size_t ) sizeof( ulParameter ) );
|
( size_t ) sizeof( ulParameter ) );
|
||||||
/* 'uxIndex' will be increased at the end of this loop. */
|
/* 'uxIndex' will be increased at the end of this loop. */
|
||||||
}
|
}
|
||||||
@ -931,7 +931,7 @@ uint8_t *pucUDPPayloadBuffer;
|
|||||||
pucPtr = &( pucUDPPayloadBuffer[ dhcpFIRST_OPTION_BYTE_OFFSET + ( *pxOptionsArraySize - 1U ) ] );
|
pucPtr = &( pucUDPPayloadBuffer[ dhcpFIRST_OPTION_BYTE_OFFSET + ( *pxOptionsArraySize - 1U ) ] );
|
||||||
pucPtr[ 0U ] = dhcpIPv4_DNS_HOSTNAME_OPTIONS_CODE;
|
pucPtr[ 0U ] = dhcpIPv4_DNS_HOSTNAME_OPTIONS_CODE;
|
||||||
pucPtr[ 1U ] = ( uint8_t ) uxNameLength;
|
pucPtr[ 1U ] = ( uint8_t ) uxNameLength;
|
||||||
( void ) memcpy( &( pucPtr[ 2U ] ), pucHostName, uxNameLength );
|
( void ) memcpy( ( void * ) ( &( pucPtr[ 2U ] ) ), ( const void * ) pucHostName, uxNameLength );
|
||||||
pucPtr[ 2U + uxNameLength ] = ( uint8_t ) dhcpOPTION_END_BYTE;
|
pucPtr[ 2U + uxNameLength ] = ( uint8_t ) dhcpOPTION_END_BYTE;
|
||||||
*pxOptionsArraySize += ( size_t ) ( 2U + uxNameLength );
|
*pxOptionsArraySize += ( size_t ) ( 2U + uxNameLength );
|
||||||
}
|
}
|
||||||
@ -972,13 +972,13 @@ size_t uxOptionsLength = sizeof( ucDHCPRequestOptions );
|
|||||||
&( uxOptionsLength ) );
|
&( uxOptionsLength ) );
|
||||||
|
|
||||||
/* Copy in the IP address being requested. */
|
/* Copy in the IP address being requested. */
|
||||||
( void ) memcpy( &( pucUDPPayloadBuffer[ dhcpFIRST_OPTION_BYTE_OFFSET + dhcpREQUESTED_IP_ADDRESS_OFFSET ] ),
|
( void ) memcpy( ( void * ) ( &( pucUDPPayloadBuffer[ dhcpFIRST_OPTION_BYTE_OFFSET + dhcpREQUESTED_IP_ADDRESS_OFFSET ] ) ),
|
||||||
&( EP_DHCPData.ulOfferedIPAddress ),
|
( const void * ) ( &( EP_DHCPData.ulOfferedIPAddress ) ),
|
||||||
sizeof( EP_DHCPData.ulOfferedIPAddress ) );
|
sizeof( EP_DHCPData.ulOfferedIPAddress ) );
|
||||||
|
|
||||||
/* Copy in the address of the DHCP server being used. */
|
/* Copy in the address of the DHCP server being used. */
|
||||||
( void ) memcpy( &( pucUDPPayloadBuffer[ dhcpFIRST_OPTION_BYTE_OFFSET + dhcpDHCP_SERVER_IP_ADDRESS_OFFSET ] ),
|
( void ) memcpy( ( void * ) ( &( pucUDPPayloadBuffer[ dhcpFIRST_OPTION_BYTE_OFFSET + dhcpDHCP_SERVER_IP_ADDRESS_OFFSET ] ) ),
|
||||||
&( EP_DHCPData.ulDHCPServerAddress ),
|
( const void * ) ( &( EP_DHCPData.ulDHCPServerAddress ) ),
|
||||||
sizeof( EP_DHCPData.ulDHCPServerAddress ) );
|
sizeof( EP_DHCPData.ulDHCPServerAddress ) );
|
||||||
|
|
||||||
FreeRTOS_debug_printf( ( "vDHCPProcess: reply %lxip\n", FreeRTOS_ntohl( EP_DHCPData.ulOfferedIPAddress ) ) );
|
FreeRTOS_debug_printf( ( "vDHCPProcess: reply %lxip\n", FreeRTOS_ntohl( EP_DHCPData.ulOfferedIPAddress ) ) );
|
||||||
|
@ -846,7 +846,7 @@ static const DNSMessage_t xDefaultPartDNSHeader =
|
|||||||
|
|
||||||
/* Copy in the const part of the header. Intentionally using different
|
/* Copy in the const part of the header. Intentionally using different
|
||||||
* pointers with memcpy() to put the information in to correct place. */
|
* pointers with memcpy() to put the information in to correct place. */
|
||||||
( void ) memcpy( pucUDPPayloadBuffer, &( xDefaultPartDNSHeader ), sizeof( xDefaultPartDNSHeader ) );
|
( void ) memcpy( ( void * ) pucUDPPayloadBuffer, ( const void * ) ( &( xDefaultPartDNSHeader ) ), sizeof( xDefaultPartDNSHeader ) );
|
||||||
|
|
||||||
/* Write in a unique identifier. Cast the Payload Buffer to DNSMessage_t
|
/* Write in a unique identifier. Cast the Payload Buffer to DNSMessage_t
|
||||||
* to easily access fields of the DNS Message. */
|
* to easily access fields of the DNS Message. */
|
||||||
@ -1308,8 +1308,8 @@ BaseType_t xReturn = pdTRUE;
|
|||||||
{
|
{
|
||||||
/* Copy the IP address out of the record. Using different pointers
|
/* Copy the IP address out of the record. Using different pointers
|
||||||
* to copy only the portion we want is intentional here. */
|
* to copy only the portion we want is intentional here. */
|
||||||
( void ) memcpy( &( ulIPAddress ),
|
( void ) memcpy( ( void * ) ( &( ulIPAddress ) ),
|
||||||
&( pucByte[ sizeof( DNSAnswerRecord_t ) ] ),
|
( const void * ) ( &( pucByte[ sizeof( DNSAnswerRecord_t ) ] ) ),
|
||||||
sizeof( uint32_t ) );
|
sizeof( uint32_t ) );
|
||||||
|
|
||||||
#if( ipconfigDNS_USE_CALLBACKS == 1 )
|
#if( ipconfigDNS_USE_CALLBACKS == 1 )
|
||||||
|
@ -954,7 +954,7 @@ NetworkBufferDescriptor_t *pxResult;
|
|||||||
/* The following statement may trigger a:
|
/* The following statement may trigger a:
|
||||||
warning: cast increases required alignment of target type [-Wcast-align].
|
warning: cast increases required alignment of target type [-Wcast-align].
|
||||||
It has been confirmed though that the alignment is suitable. */
|
It has been confirmed though that the alignment is suitable. */
|
||||||
pxResult = * ( ipPOINTER_CAST( NetworkBufferDescriptor_t **, pucBuffer ) );
|
pxResult = * ( ( const NetworkBufferDescriptor_t **) pucBuffer );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2000,7 +2000,7 @@ uint8_t ucProtocol;
|
|||||||
size_t uxLength;
|
size_t uxLength;
|
||||||
const IPPacket_t * pxIPPacket;
|
const IPPacket_t * pxIPPacket;
|
||||||
UBaseType_t uxIPHeaderLength;
|
UBaseType_t uxIPHeaderLength;
|
||||||
ProtocolPacket_t *pxProtPack;
|
const ProtocolPacket_t *pxProtPack;
|
||||||
uint8_t ucProtocol;
|
uint8_t ucProtocol;
|
||||||
uint16_t usLength;
|
uint16_t usLength;
|
||||||
uint16_t ucVersionHeaderLength;
|
uint16_t ucVersionHeaderLength;
|
||||||
@ -2058,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 = ipCAST_PTR_TO_TYPE_PTR( ProtocolPacket_t, &( pucEthernetBuffer[ uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
pxProtPack = ipCAST_CONST_PTR_TO_CONST_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 )
|
||||||
@ -2123,7 +2123,7 @@ uint32_t ulLength;
|
|||||||
uint16_t usChecksum, *pusChecksum;
|
uint16_t usChecksum, *pusChecksum;
|
||||||
const IPPacket_t * pxIPPacket;
|
const IPPacket_t * pxIPPacket;
|
||||||
UBaseType_t uxIPHeaderLength;
|
UBaseType_t uxIPHeaderLength;
|
||||||
ProtocolPacket_t *pxProtPack;
|
const ProtocolPacket_t *pxProtPack;
|
||||||
uint8_t ucProtocol;
|
uint8_t ucProtocol;
|
||||||
#if( ipconfigHAS_DEBUG_PRINTF != 0 )
|
#if( ipconfigHAS_DEBUG_PRINTF != 0 )
|
||||||
const char *pcType;
|
const char *pcType;
|
||||||
@ -2179,7 +2179,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 = ipCAST_PTR_TO_TYPE_PTR( ProtocolPacket_t, &( pucEthernetBuffer[ uxIPHeaderLength - ipSIZE_OF_IPv4_HEADER ] ) );
|
pxProtPack = ipCAST_CONST_PTR_TO_CONST_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 )
|
||||||
@ -2315,7 +2315,7 @@ BaseType_t location = 0;
|
|||||||
/* ICMP/IGMP do not have a pseudo header for CRC-calculation. */
|
/* ICMP/IGMP do not have a pseudo header for CRC-calculation. */
|
||||||
usChecksum = ( uint16_t )
|
usChecksum = ( uint16_t )
|
||||||
( ~usGenerateChecksum( 0U,
|
( ~usGenerateChecksum( 0U,
|
||||||
( uint8_t * ) &( pxProtPack->xTCPPacket.xTCPHeader ), ( size_t ) ulLength ) );
|
( const uint8_t * ) &( pxProtPack->xTCPPacket.xTCPHeader ), ( size_t ) ulLength ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2600,8 +2600,8 @@ EthernetHeader_t *pxEthernetHeader;
|
|||||||
pxEthernetHeader = ipCAST_PTR_TO_TYPE_PTR( 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( ( void * ) &( pxEthernetHeader->xDestinationAddress ), ( const void * ) ( &( pxEthernetHeader->xSourceAddress ) ), sizeof( pxEthernetHeader->xDestinationAddress ) );
|
||||||
( void ) memcpy( &( pxEthernetHeader->xSourceAddress) , ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
( void ) memcpy( ( void * ) &( pxEthernetHeader->xSourceAddress) , ( const void * ) ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||||
|
|
||||||
/* Send! */
|
/* Send! */
|
||||||
( void ) xNetworkInterfaceOutput( pxNetworkBuffer, xReleaseAfterSend );
|
( void ) xNetworkInterfaceOutput( pxNetworkBuffer, xReleaseAfterSend );
|
||||||
|
@ -901,7 +901,7 @@ const size_t uxPayloadOffset = ( size_t ) ipUDP_PAYLOAD_OFFSET_IPv4;
|
|||||||
/* When zero copy is used, pvBuffer is a pointer to the
|
/* When zero copy is used, pvBuffer is a pointer to the
|
||||||
payload of a buffer that has already been obtained from the
|
payload of a buffer that has already been obtained from the
|
||||||
stack. Obtain the network buffer pointer from the buffer. */
|
stack. Obtain the network buffer pointer from the buffer. */
|
||||||
pxNetworkBuffer = pxUDPPayloadBuffer_to_NetworkBuffer( ( void * ) pvBuffer );
|
pxNetworkBuffer = pxUDPPayloadBuffer_to_NetworkBuffer( pvBuffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pxNetworkBuffer != NULL )
|
if( pxNetworkBuffer != NULL )
|
||||||
@ -1434,12 +1434,12 @@ FreeRTOS_Socket_t *pxSocket;
|
|||||||
{
|
{
|
||||||
case FREERTOS_SO_RCVTIMEO :
|
case FREERTOS_SO_RCVTIMEO :
|
||||||
/* Receive time out. */
|
/* Receive time out. */
|
||||||
pxSocket->xReceiveBlockTime = *( ( TickType_t *) pvOptionValue );
|
pxSocket->xReceiveBlockTime = *( ( const TickType_t *) pvOptionValue );
|
||||||
xReturn = 0;
|
xReturn = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FREERTOS_SO_SNDTIMEO :
|
case FREERTOS_SO_SNDTIMEO :
|
||||||
pxSocket->xSendBlockTime = *( ( TickType_t *) pvOptionValue );
|
pxSocket->xSendBlockTime = *( ( const 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
|
||||||
@ -1665,7 +1665,7 @@ FreeRTOS_Socket_t *pxSocket;
|
|||||||
{
|
{
|
||||||
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
||||||
}
|
}
|
||||||
if( *( ( BaseType_t * ) pvOptionValue ) != 0 )
|
if( *( ( const BaseType_t * ) pvOptionValue ) != 0 )
|
||||||
{
|
{
|
||||||
pxSocket->u.xTCP.bits.bReuseSocket = pdTRUE;
|
pxSocket->u.xTCP.bits.bReuseSocket = pdTRUE;
|
||||||
}
|
}
|
||||||
@ -1684,7 +1684,7 @@ FreeRTOS_Socket_t *pxSocket;
|
|||||||
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
if( *( ( BaseType_t * ) pvOptionValue ) != 0 )
|
if( *( ( const BaseType_t * ) pvOptionValue ) != 0 )
|
||||||
{
|
{
|
||||||
pxSocket->u.xTCP.bits.bCloseAfterSend = pdTRUE;
|
pxSocket->u.xTCP.bits.bCloseAfterSend = pdTRUE;
|
||||||
}
|
}
|
||||||
@ -1703,7 +1703,7 @@ FreeRTOS_Socket_t *pxSocket;
|
|||||||
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
if( *( ( BaseType_t *) pvOptionValue ) != 0 )
|
if( *( ( const BaseType_t *) pvOptionValue ) != 0 )
|
||||||
{
|
{
|
||||||
pxSocket->u.xTCP.xTCPWindow.u.bits.bSendFullSize = pdTRUE;
|
pxSocket->u.xTCP.xTCPWindow.u.bits.bSendFullSize = pdTRUE;
|
||||||
}
|
}
|
||||||
@ -1729,7 +1729,7 @@ FreeRTOS_Socket_t *pxSocket;
|
|||||||
{
|
{
|
||||||
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
break; /* will return -pdFREERTOS_ERRNO_EINVAL */
|
||||||
}
|
}
|
||||||
if( *( ( BaseType_t * ) pvOptionValue ) != 0 )
|
if( *( ( const BaseType_t * ) pvOptionValue ) != 0 )
|
||||||
{
|
{
|
||||||
pxSocket->u.xTCP.bits.bRxStopped = pdTRUE;
|
pxSocket->u.xTCP.bits.bRxStopped = pdTRUE;
|
||||||
}
|
}
|
||||||
@ -1883,7 +1883,7 @@ const socklen_t uxSize = 16;
|
|||||||
{
|
{
|
||||||
uint8_t pucDigits[ sockDIGIT_COUNT ];
|
uint8_t pucDigits[ sockDIGIT_COUNT ];
|
||||||
uint8_t ucValue = pucAddress[ uxNibble ];
|
uint8_t ucValue = pucAddress[ uxNibble ];
|
||||||
socklen_t uxSource = sockDIGIT_COUNT - 1;
|
socklen_t uxSource = sockDIGIT_COUNT - 1U;
|
||||||
socklen_t uxNeeded;
|
socklen_t uxNeeded;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
@ -1899,7 +1899,7 @@ const socklen_t uxSize = 16;
|
|||||||
pucDigits[ 0 ] = ucValue;
|
pucDigits[ 0 ] = ucValue;
|
||||||
|
|
||||||
/* Skip leading zeros. */
|
/* Skip leading zeros. */
|
||||||
for( uxSource = 0; uxSource < ( socklen_t ) ( sockDIGIT_COUNT - 1 ); uxSource++ )
|
for( uxSource = 0; uxSource < ( socklen_t ) ( sockDIGIT_COUNT - 1U ); uxSource++ )
|
||||||
{
|
{
|
||||||
if( pucDigits[ uxSource ] != 0U )
|
if( pucDigits[ uxSource ] != 0U )
|
||||||
{
|
{
|
||||||
|
@ -907,12 +907,12 @@ NetworkBufferDescriptor_t xTempBuffer;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Fill in the destination MAC addresses. */
|
/* Fill in the destination MAC addresses. */
|
||||||
( void ) memcpy( &( pxEthernetHeader->xDestinationAddress ),
|
( void ) memcpy( ( void * ) ( &( pxEthernetHeader->xDestinationAddress ) ),
|
||||||
&( pxEthernetHeader->xSourceAddress ),
|
( const void * ) ( &( pxEthernetHeader->xSourceAddress ) ),
|
||||||
sizeof( pxEthernetHeader->xDestinationAddress ) );
|
sizeof( pxEthernetHeader->xDestinationAddress ) );
|
||||||
|
|
||||||
/* The source MAC addresses is fixed to 'ipLOCAL_MAC_ADDRESS'. */
|
/* The source MAC addresses is fixed to 'ipLOCAL_MAC_ADDRESS'. */
|
||||||
( void ) memcpy( &( pxEthernetHeader->xSourceAddress ), ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
( void ) memcpy( ( void * ) ( &( pxEthernetHeader->xSourceAddress ) ), ( const void * ) ipLOCAL_MAC_ADDRESS, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||||
|
|
||||||
#if defined( ipconfigETHERNET_MINIMUM_PACKET_BYTES )
|
#if defined( ipconfigETHERNET_MINIMUM_PACKET_BYTES )
|
||||||
{
|
{
|
||||||
@ -938,7 +938,7 @@ NetworkBufferDescriptor_t xTempBuffer;
|
|||||||
containing the packet header. */
|
containing the packet header. */
|
||||||
vFlip_16( pxTCPPacket->xTCPHeader.usSourcePort, pxTCPPacket->xTCPHeader.usDestinationPort);
|
vFlip_16( pxTCPPacket->xTCPHeader.usSourcePort, pxTCPPacket->xTCPHeader.usDestinationPort);
|
||||||
pxTCPPacket->xIPHeader.ulSourceIPAddress = pxTCPPacket->xIPHeader.ulDestinationIPAddress;
|
pxTCPPacket->xIPHeader.ulSourceIPAddress = pxTCPPacket->xIPHeader.ulDestinationIPAddress;
|
||||||
( void ) memcpy( pxEthernetHeader->xSourceAddress.ucBytes, pxEthernetHeader->xDestinationAddress.ucBytes, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
( void ) memcpy( ( void * ) ( pxEthernetHeader->xSourceAddress.ucBytes ), ( const void * ) ( pxEthernetHeader->xDestinationAddress.ucBytes ), ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1066,7 +1066,7 @@ uint32_t ulInitialSequenceNumber = 0;
|
|||||||
|
|
||||||
/* Write the Ethernet address in Source, because it will be swapped by
|
/* Write the Ethernet address in Source, because it will be swapped by
|
||||||
prvTCPReturnPacket(). */
|
prvTCPReturnPacket(). */
|
||||||
( void ) memcpy( &pxTCPPacket->xEthernetHeader.xSourceAddress, &xEthAddress, sizeof( xEthAddress ) );
|
( void ) memcpy( ( void * ) ( &pxTCPPacket->xEthernetHeader.xSourceAddress ), ( const void * ) ( &xEthAddress ), sizeof( xEthAddress ) );
|
||||||
|
|
||||||
/* 'ipIPv4_FRAME_TYPE' is already in network-byte-order. */
|
/* 'ipIPv4_FRAME_TYPE' is already in network-byte-order. */
|
||||||
pxTCPPacket->xEthernetHeader.usFrameType = ipIPv4_FRAME_TYPE;
|
pxTCPPacket->xEthernetHeader.usFrameType = ipIPv4_FRAME_TYPE;
|
||||||
@ -2344,7 +2344,7 @@ UBaseType_t uxOptionsLength = pxTCPWindow->ucOptionLength;
|
|||||||
FreeRTOS_ntohl( pxTCPWindow->ulOptionsData[ 1 ] ) - pxSocket->u.xTCP.xTCPWindow.rx.ulFirstSequenceNumber,
|
FreeRTOS_ntohl( pxTCPWindow->ulOptionsData[ 1 ] ) - pxSocket->u.xTCP.xTCPWindow.rx.ulFirstSequenceNumber,
|
||||||
FreeRTOS_ntohl( pxTCPWindow->ulOptionsData[ 2 ] ) - pxSocket->u.xTCP.xTCPWindow.rx.ulFirstSequenceNumber ) );
|
FreeRTOS_ntohl( pxTCPWindow->ulOptionsData[ 2 ] ) - pxSocket->u.xTCP.xTCPWindow.rx.ulFirstSequenceNumber ) );
|
||||||
}
|
}
|
||||||
( void ) memcpy( pxTCPHeader->ucOptdata, pxTCPWindow->ulOptionsData, ( size_t ) uxOptionsLength );
|
( void ) memcpy( ( void * ) ( pxTCPHeader->ucOptdata ), ( const void * ) ( pxTCPWindow->ulOptionsData ), ( size_t ) uxOptionsLength );
|
||||||
|
|
||||||
/* The header length divided by 4, goes into the higher nibble,
|
/* The header length divided by 4, goes into the higher nibble,
|
||||||
effectively a shift-left 2. */
|
effectively a shift-left 2. */
|
||||||
@ -3215,8 +3215,8 @@ const IPHeader_t *pxIPHeader;
|
|||||||
headers). It might be used later on, whenever data must be sent
|
headers). It might be used later on, whenever data must be sent
|
||||||
to the peer. */
|
to the peer. */
|
||||||
const size_t lOffset = ipNUMERIC_CAST( size_t, ipSIZE_OF_ETH_HEADER + uxIPHeaderSizeSocket( pxSocket ) );
|
const size_t lOffset = ipNUMERIC_CAST( size_t, ipSIZE_OF_ETH_HEADER + uxIPHeaderSizeSocket( pxSocket ) );
|
||||||
( void ) memcpy( &( pxSocket->u.xTCP.xPacket.u.ucLastPacket[ lOffset ] ),
|
( void ) memcpy( ( void * ) ( &( pxSocket->u.xTCP.xPacket.u.ucLastPacket[ lOffset ] ) ),
|
||||||
&( pxNetworkBuffer->pucEthernetBuffer[ lOffset ] ),
|
( const void * ) ( &( pxNetworkBuffer->pucEthernetBuffer[ lOffset ] ) ),
|
||||||
ipSIZE_OF_TCP_HEADER );
|
ipSIZE_OF_TCP_HEADER );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3380,7 +3380,7 @@ uint32_t ulInitialSequenceNumber;
|
|||||||
|
|
||||||
/* Make a copy of the header up to the TCP header. It is needed later
|
/* Make a copy of the header up to the TCP header. It is needed later
|
||||||
on, whenever data must be sent to the peer. */
|
on, whenever data must be sent to the peer. */
|
||||||
( void ) memcpy( pxReturn->u.xTCP.xPacket.u.ucLastPacket, pxNetworkBuffer->pucEthernetBuffer, sizeof( pxReturn->u.xTCP.xPacket.u.ucLastPacket ) );
|
( void ) memcpy( ( void * ) ( pxReturn->u.xTCP.xPacket.u.ucLastPacket ), ( const void * ) ( pxNetworkBuffer->pucEthernetBuffer ), sizeof( pxReturn->u.xTCP.xPacket.u.ucLastPacket ) );
|
||||||
}
|
}
|
||||||
return pxReturn;
|
return pxReturn;
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ size_t uxPayloadSize;
|
|||||||
*/
|
*/
|
||||||
/* The Ethernet source address is at offset 6. */
|
/* The Ethernet source address is at offset 6. */
|
||||||
char *pxUdpSrcAddrOffset = ( char *) ( &( pxNetworkBuffer->pucEthernetBuffer[ sizeof( MACAddress_t ) ] ) );
|
char *pxUdpSrcAddrOffset = ( char *) ( &( pxNetworkBuffer->pucEthernetBuffer[ sizeof( MACAddress_t ) ] ) );
|
||||||
( void ) memcpy( pxUdpSrcAddrOffset, xDefaultPartUDPPacketHeader.ucBytes, sizeof( xDefaultPartUDPPacketHeader ) );
|
( void ) memcpy( ( void * ) pxUdpSrcAddrOffset, ( const void * ) ( xDefaultPartUDPPacketHeader.ucBytes ), sizeof( xDefaultPartUDPPacketHeader ) );
|
||||||
|
|
||||||
#if ipconfigSUPPORT_OUTGOING_PINGS == 1
|
#if ipconfigSUPPORT_OUTGOING_PINGS == 1
|
||||||
if( pxNetworkBuffer->usPort == ( uint16_t ) ipPACKET_CONTAINS_ICMP_DATA )
|
if( pxNetworkBuffer->usPort == ( uint16_t ) ipPACKET_CONTAINS_ICMP_DATA )
|
||||||
|
Reference in New Issue
Block a user