MISRA compliance changes in FreeRTOS_Sockets{.c/.h} (#161)

* MISRA changes Sockets

* add other changes

* Update FreeRTOSIPConfig.h

* Update FreeRTOSIPConfig.h

* Update FreeRTOSIPConfig.h

* Update FreeRTOSIPConfig.h

* correction

* Add 'U'

* Update FreeRTOS_Sockets.h

* Update FreeRTOS_Sockets.h

* Update FreeRTOS_Sockets.c

* Update FreeRTOS_Sockets.h

* Update after Gary's comments

* Correction reverted
This commit is contained in:
Aniruddha Kanhere 2020-07-29 15:38:37 -07:00 committed by GitHub
parent ae4d4d38d9
commit f2611cc5e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 337 additions and 330 deletions

View file

@ -137,7 +137,7 @@ free) the network buffers are themselves blocked waiting for a network buffer.
ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
milliseconds can be converted to a time in ticks by dividing the time in milliseconds can be converted to a time in ticks by dividing the time in
milliseconds by portTICK_PERIOD_MS. */ milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
address, netmask, DNS server address and gateway address from a DHCP server. If address, netmask, DNS server address and gateway address from a DHCP server. If
@ -155,7 +155,7 @@ ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the
static IP address passed as a parameter to FreeRTOS_IPInit() if the static IP address passed as a parameter to FreeRTOS_IPInit() if the
re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
a DHCP reply being received. */ a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000 / portTICK_PERIOD_MS ) #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
stack can only send a UDP message to a remove IP address if it knowns the MAC stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -233,7 +233,7 @@ contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
lower value can save RAM, depending on the buffer management scheme used. If lower value can save RAM, depending on the buffer management scheme used. If
ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
be divisible by 8. */ be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
through the FreeRTOS_gethostbyname() API function. */ through the FreeRTOS_gethostbyname() API function. */
@ -274,7 +274,7 @@ block occasionally to allow other tasks to run. */
32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits. 32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits.
This has to do with the contents of the IP-packets: all 32-bit fields are This has to do with the contents of the IP-packets: all 32-bit fields are
32-bit-aligned, plus 16-bit(!) */ 32-bit-aligned, plus 16-bit(!) */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6

View file

@ -648,155 +648,155 @@ EventBits_t xEventBits = ( EventBits_t ) 0;
if( prvValidSocket( pxSocket, FREERTOS_IPPROTO_UDP, pdTRUE ) == pdFALSE ) if( prvValidSocket( pxSocket, FREERTOS_IPPROTO_UDP, pdTRUE ) == pdFALSE )
{ {
return -pdFREERTOS_ERRNO_EINVAL; lReturn = -pdFREERTOS_ERRNO_EINVAL;
} }
else
lPacketCount = ( BaseType_t ) listCURRENT_LIST_LENGTH( &( pxSocket->u.xUDP.xWaitingPacketsList ) );
/* The function prototype is designed to maintain the expected Berkeley
sockets standard, but this implementation does not use all the parameters. */
( void ) pxSourceAddressLength;
while( lPacketCount == 0 )
{ {
if( xTimed == pdFALSE )
{
/* Check to see if the socket is non blocking on the first
iteration. */
xRemainingTime = pxSocket->xReceiveBlockTime;
if( xRemainingTime == ( TickType_t ) 0 )
{
#if( ipconfigSUPPORT_SIGNALS != 0 )
{
/* Just check for the interrupt flag. */
xEventBits = xEventGroupWaitBits( pxSocket->xEventGroup, ( EventBits_t ) eSOCKET_INTR,
pdTRUE /*xClearOnExit*/, pdFALSE /*xWaitAllBits*/, socketDONT_BLOCK );
}
#endif /* ipconfigSUPPORT_SIGNALS */
break;
}
if( ( ( ( UBaseType_t ) xFlags ) & ( ( UBaseType_t ) FREERTOS_MSG_DONTWAIT ) ) != 0U )
{
break;
}
/* To ensure this part only executes once. */
xTimed = pdTRUE;
/* Fetch the current time. */
vTaskSetTimeOutState( &xTimeOut );
}
/* Wait for arrival of data. While waiting, the IP-task may set the
'eSOCKET_RECEIVE' bit in 'xEventGroup', if it receives data for this
socket, thus unblocking this API call. */
xEventBits = xEventGroupWaitBits( pxSocket->xEventGroup, ( ( EventBits_t ) eSOCKET_RECEIVE ) | ( ( EventBits_t ) eSOCKET_INTR ),
pdTRUE /*xClearOnExit*/, pdFALSE /*xWaitAllBits*/, xRemainingTime );
#if( ipconfigSUPPORT_SIGNALS != 0 )
{
if( ( xEventBits & ( EventBits_t ) eSOCKET_INTR ) != 0U )
{
if( ( xEventBits & ( EventBits_t ) eSOCKET_RECEIVE ) != 0U )
{
/* Shouldn't have cleared the eSOCKET_RECEIVE flag. */
( void ) xEventGroupSetBits( pxSocket->xEventGroup, ( EventBits_t ) eSOCKET_RECEIVE );
}
break;
}
}
#else
{
( void ) xEventBits;
}
#endif /* ipconfigSUPPORT_SIGNALS */
lPacketCount = ( BaseType_t ) listCURRENT_LIST_LENGTH( &( pxSocket->u.xUDP.xWaitingPacketsList ) ); lPacketCount = ( BaseType_t ) listCURRENT_LIST_LENGTH( &( pxSocket->u.xUDP.xWaitingPacketsList ) );
/* The function prototype is designed to maintain the expected Berkeley
sockets standard, but this implementation does not use all the parameters. */
( void ) pxSourceAddressLength;
while( lPacketCount == 0 )
{
if( xTimed == pdFALSE )
{
/* Check to see if the socket is non blocking on the first
iteration. */
xRemainingTime = pxSocket->xReceiveBlockTime;
if( xRemainingTime == ( TickType_t ) 0 )
{
#if( ipconfigSUPPORT_SIGNALS != 0 )
{
/* Just check for the interrupt flag. */
xEventBits = xEventGroupWaitBits( pxSocket->xEventGroup, ( EventBits_t ) eSOCKET_INTR,
pdTRUE /*xClearOnExit*/, pdFALSE /*xWaitAllBits*/, socketDONT_BLOCK );
}
#endif /* ipconfigSUPPORT_SIGNALS */
break;
}
if( ( ( ( UBaseType_t ) xFlags ) & ( ( UBaseType_t ) FREERTOS_MSG_DONTWAIT ) ) != 0U )
{
break;
}
/* To ensure this part only executes once. */
xTimed = pdTRUE;
/* Fetch the current time. */
vTaskSetTimeOutState( &xTimeOut );
}
/* Wait for arrival of data. While waiting, the IP-task may set the
'eSOCKET_RECEIVE' bit in 'xEventGroup', if it receives data for this
socket, thus unblocking this API call. */
xEventBits = xEventGroupWaitBits( pxSocket->xEventGroup, ( ( EventBits_t ) eSOCKET_RECEIVE ) | ( ( EventBits_t ) eSOCKET_INTR ),
pdTRUE /*xClearOnExit*/, pdFALSE /*xWaitAllBits*/, xRemainingTime );
#if( ipconfigSUPPORT_SIGNALS != 0 )
{
if( ( xEventBits & ( EventBits_t ) eSOCKET_INTR ) != 0U )
{
if( ( xEventBits & ( EventBits_t ) eSOCKET_RECEIVE ) != 0U )
{
/* Shouldn't have cleared the eSOCKET_RECEIVE flag. */
( void ) xEventGroupSetBits( pxSocket->xEventGroup, ( EventBits_t ) eSOCKET_RECEIVE );
}
break;
}
}
#else
{
( void ) xEventBits;
}
#endif /* ipconfigSUPPORT_SIGNALS */
lPacketCount = ( BaseType_t ) listCURRENT_LIST_LENGTH( &( pxSocket->u.xUDP.xWaitingPacketsList ) );
if( lPacketCount != 0 )
{
break;
}
/* Has the timeout been reached ? */
if( xTaskCheckForTimeOut( &xTimeOut, &xRemainingTime ) != pdFALSE )
{
break;
}
} /* while( lPacketCount == 0 ) */
if( lPacketCount != 0 ) if( lPacketCount != 0 )
{ {
break; taskENTER_CRITICAL();
}
/* Has the timeout been reached ? */
if( xTaskCheckForTimeOut( &xTimeOut, &xRemainingTime ) != pdFALSE )
{
break;
}
} /* while( lPacketCount == 0 ) */
if( lPacketCount != 0 )
{
taskENTER_CRITICAL();
{
/* The owner of the list item is the network buffer. */
pxNetworkBuffer = ipPOINTER_CAST( NetworkBufferDescriptor_t *, listGET_OWNER_OF_HEAD_ENTRY( &( pxSocket->u.xUDP.xWaitingPacketsList ) ) );
if( ( ( UBaseType_t ) xFlags & ( UBaseType_t ) FREERTOS_MSG_PEEK ) == 0U )
{ {
/* Remove the network buffer from the list of buffers waiting to /* The owner of the list item is the network buffer. */
be processed by the socket. */ pxNetworkBuffer = ipPOINTER_CAST( NetworkBufferDescriptor_t *, listGET_OWNER_OF_HEAD_ENTRY( &( pxSocket->u.xUDP.xWaitingPacketsList ) ) );
( void ) uxListRemove( &( pxNetworkBuffer->xBufferListItem ) );
if( ( ( UBaseType_t ) xFlags & ( UBaseType_t ) FREERTOS_MSG_PEEK ) == 0U )
{
/* Remove the network buffer from the list of buffers waiting to
be processed by the socket. */
( void ) uxListRemove( &( pxNetworkBuffer->xBufferListItem ) );
}
} }
} taskEXIT_CRITICAL();
taskEXIT_CRITICAL();
/* The returned value is the length of the payload data, which is /* The returned value is the length of the payload data, which is
calculated at the total packet size minus the headers. calculated at the total packet size minus the headers.
The validity of `xDataLength` prvProcessIPPacket has been confirmed The validity of `xDataLength` prvProcessIPPacket has been confirmed
in 'prvProcessIPPacket()'. */ in 'prvProcessIPPacket()'. */
lReturn = ( int32_t ) ( pxNetworkBuffer->xDataLength - sizeof( UDPPacket_t ) ); lReturn = ( int32_t ) ( pxNetworkBuffer->xDataLength - sizeof( UDPPacket_t ) );
if( pxSourceAddress != NULL ) if( pxSourceAddress != NULL )
{
pxSourceAddress->sin_port = pxNetworkBuffer->usPort;
pxSourceAddress->sin_addr = pxNetworkBuffer->ulIPAddress;
}
if( ( ( UBaseType_t ) xFlags & ( UBaseType_t ) FREERTOS_ZERO_COPY ) == 0U )
{
/* The zero copy flag is not set. Truncate the length if it won't
fit in the provided buffer. */
if( lReturn > ( int32_t ) uxBufferLength )
{ {
iptraceRECVFROM_DISCARDING_BYTES( ( uxBufferLength - lReturn ) ); pxSourceAddress->sin_port = pxNetworkBuffer->usPort;
lReturn = ( int32_t ) uxBufferLength; pxSourceAddress->sin_addr = pxNetworkBuffer->ulIPAddress;
} }
/* Copy the received data into the provided buffer, then release the if( ( ( UBaseType_t ) xFlags & ( UBaseType_t ) FREERTOS_ZERO_COPY ) == 0U )
network buffer. */
( void ) memcpy( pvBuffer, &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] ), ( size_t )lReturn );
if( ( ( UBaseType_t ) xFlags & ( UBaseType_t ) FREERTOS_MSG_PEEK ) == 0U )
{ {
vReleaseNetworkBufferAndDescriptor( pxNetworkBuffer ); /* The zero copy flag is not set. Truncate the length if it won't
fit in the provided buffer. */
if( lReturn > ( int32_t ) uxBufferLength )
{
iptraceRECVFROM_DISCARDING_BYTES( ( uxBufferLength - lReturn ) );
lReturn = ( int32_t ) uxBufferLength;
}
/* Copy the received data into the provided buffer, then release the
network buffer. */
( void ) memcpy( pvBuffer, &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] ), ( size_t )lReturn );
if( ( ( UBaseType_t ) xFlags & ( UBaseType_t ) FREERTOS_MSG_PEEK ) == 0U )
{
vReleaseNetworkBufferAndDescriptor( pxNetworkBuffer );
}
} }
else
{
/* The zero copy flag was set. pvBuffer is not a buffer into which
the received data can be copied, but a pointer that must be set to
point to the buffer in which the received data has already been
placed. */
*( ( void** ) pvBuffer ) = ipPOINTER_CAST( void *, &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] ) );
}
} }
#if( ipconfigSUPPORT_SIGNALS != 0 )
else if( ( xEventBits & ( EventBits_t ) eSOCKET_INTR ) != 0U )
{
lReturn = -pdFREERTOS_ERRNO_EINTR;
iptraceRECVFROM_INTERRUPTED();
}
#endif /* ipconfigSUPPORT_SIGNALS */
else else
{ {
/* The zero copy flag was set. pvBuffer is not a buffer into which lReturn = -pdFREERTOS_ERRNO_EWOULDBLOCK;
the received data can be copied, but a pointer that must be set to iptraceRECVFROM_TIMEOUT();
point to the buffer in which the received data has already been
placed. */
/* 9079: (Note -- conversion from pointer to void to pointer to other type [MISRA 2012 Rule 11.5, advisory]) */
/* 9087: (Note -- cast performed between a pointer to object type and a pointer to a different object type [MISRA 2012 Rule 11.3, required]) */
*( ( void** ) pvBuffer ) = ipPOINTER_CAST( void *, &( pxNetworkBuffer->pucEthernetBuffer[ ipUDP_PAYLOAD_OFFSET_IPv4 ] ) );
} }
}
#if( ipconfigSUPPORT_SIGNALS != 0 )
else if( ( xEventBits & ( EventBits_t ) eSOCKET_INTR ) != 0U )
{
lReturn = -pdFREERTOS_ERRNO_EINTR;
iptraceRECVFROM_INTERRUPTED();
}
#endif /* ipconfigSUPPORT_SIGNALS */
else
{
lReturn = -pdFREERTOS_ERRNO_EWOULDBLOCK;
iptraceRECVFROM_TIMEOUT();
} }
return lReturn; return lReturn;
@ -1071,60 +1071,65 @@ struct freertos_sockaddr * pxAddress = pxBindAddress;
if( pxAddress != NULL ) if( pxAddress != NULL )
#endif #endif
{ {
if( pxAddress->sin_port == 0U ) /* Add a do-while loop to facilitate use of 'break' statements. */
do
{ {
pxAddress->sin_port = prvGetPrivatePortNumber( ( BaseType_t ) pxSocket->ucProtocol ); if( pxAddress->sin_port == 0U )
if( pxAddress->sin_port == ( uint16_t ) 0U )
{ {
return -pdFREERTOS_ERRNO_EADDRNOTAVAIL; pxAddress->sin_port = prvGetPrivatePortNumber( ( BaseType_t ) pxSocket->ucProtocol );
if( pxAddress->sin_port == ( uint16_t ) 0U )
{
xReturn = -pdFREERTOS_ERRNO_EADDRNOTAVAIL;
break;
}
} }
}
/* If vSocketBind() is called from the API FreeRTOS_bind() it has been /* If vSocketBind() is called from the API FreeRTOS_bind() it has been
confirmed that the socket was not yet bound to a port. If it is called confirmed that the socket was not yet bound to a port. If it is called
from the IP-task, no such check is necessary. */ from the IP-task, no such check is necessary. */
/* Check to ensure the port is not already in use. If the bind is /* Check to ensure the port is not already in use. If the bind is
called internally, a port MAY be used by more than one socket. */ called internally, a port MAY be used by more than one socket. */
if( ( ( xInternal == pdFALSE ) || ( pxSocket->ucProtocol != ( uint8_t ) FREERTOS_IPPROTO_TCP ) ) && if( ( ( xInternal == pdFALSE ) || ( pxSocket->ucProtocol != ( uint8_t ) FREERTOS_IPPROTO_TCP ) ) &&
( pxListFindListItemWithValue( pxSocketList, ( TickType_t ) pxAddress->sin_port ) != NULL ) ) ( pxListFindListItemWithValue( pxSocketList, ( TickType_t ) pxAddress->sin_port ) != NULL ) )
{
FreeRTOS_debug_printf( ( "vSocketBind: %sP port %d in use\n",
( pxSocket->ucProtocol == ( uint8_t ) FREERTOS_IPPROTO_TCP ) ? "TC" : "UD",
FreeRTOS_ntohs( pxAddress->sin_port ) ) );
xReturn = -pdFREERTOS_ERRNO_EADDRINUSE;
}
else
{
/* Allocate the port number to the socket.
This macro will set 'xBoundSocketListItem->xItemValue' */
socketSET_SOCKET_PORT( pxSocket, pxAddress->sin_port );
/* And also store it in a socket field 'usLocalPort' in host-byte-order,
mostly used for logging and debugging purposes */
pxSocket->usLocalPort = FreeRTOS_ntohs( pxAddress->sin_port );
/* Add the socket to the list of bound ports. */
{ {
/* If the network driver can iterate through 'xBoundUDPSocketsList', FreeRTOS_debug_printf( ( "vSocketBind: %sP port %d in use\n",
by calling xPortHasUDPSocket() then the IP-task must temporarily ( pxSocket->ucProtocol == ( uint8_t ) FREERTOS_IPPROTO_TCP ) ? "TC" : "UD",
suspend the scheduler to keep the list in a consistent state. */ FreeRTOS_ntohs( pxAddress->sin_port ) ) );
#if( ipconfigETHERNET_DRIVER_FILTERS_PACKETS == 1 ) xReturn = -pdFREERTOS_ERRNO_EADDRINUSE;
{
vTaskSuspendAll();
}
#endif /* ipconfigETHERNET_DRIVER_FILTERS_PACKETS */
/* Add the socket to 'xBoundUDPSocketsList' or 'xBoundTCPSocketsList' */
vListInsertEnd( pxSocketList, &( pxSocket->xBoundSocketListItem ) );
#if( ipconfigETHERNET_DRIVER_FILTERS_PACKETS == 1 )
{
( void ) xTaskResumeAll();
}
#endif /* ipconfigETHERNET_DRIVER_FILTERS_PACKETS */
} }
} else
{
/* Allocate the port number to the socket.
This macro will set 'xBoundSocketListItem->xItemValue' */
socketSET_SOCKET_PORT( pxSocket, pxAddress->sin_port );
/* And also store it in a socket field 'usLocalPort' in host-byte-order,
mostly used for logging and debugging purposes */
pxSocket->usLocalPort = FreeRTOS_ntohs( pxAddress->sin_port );
/* Add the socket to the list of bound ports. */
{
/* If the network driver can iterate through 'xBoundUDPSocketsList',
by calling xPortHasUDPSocket() then the IP-task must temporarily
suspend the scheduler to keep the list in a consistent state. */
#if( ipconfigETHERNET_DRIVER_FILTERS_PACKETS == 1 )
{
vTaskSuspendAll();
}
#endif /* ipconfigETHERNET_DRIVER_FILTERS_PACKETS */
/* Add the socket to 'xBoundUDPSocketsList' or 'xBoundTCPSocketsList' */
vListInsertEnd( pxSocketList, &( pxSocket->xBoundSocketListItem ) );
#if( ipconfigETHERNET_DRIVER_FILTERS_PACKETS == 1 )
{
( void ) xTaskResumeAll();
}
#endif /* ipconfigETHERNET_DRIVER_FILTERS_PACKETS */
}
}
} while( ipFALSE_BOOL );
} }
#if( ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND == 0 ) #if( ipconfigALLOW_SOCKET_SEND_WITHOUT_BIND == 0 )
else else
@ -1351,9 +1356,8 @@ BaseType_t xReturn;
( lOptionName == FREERTOS_SO_SNDBUF ) ? "SND" : "RCV" ) ); ( lOptionName == FREERTOS_SO_SNDBUF ) ? "SND" : "RCV" ) );
xReturn = -pdFREERTOS_ERRNO_EINVAL; xReturn = -pdFREERTOS_ERRNO_EINVAL;
} }
else else if( ( ( lOptionName == FREERTOS_SO_SNDBUF ) && ( pxSocket->u.xTCP.txStream != NULL ) ) ||
if( ( ( lOptionName == FREERTOS_SO_SNDBUF ) && ( pxSocket->u.xTCP.txStream != NULL ) ) || ( ( lOptionName == FREERTOS_SO_RCVBUF ) && ( pxSocket->u.xTCP.rxStream != NULL ) ) )
( ( lOptionName == FREERTOS_SO_RCVBUF ) && ( pxSocket->u.xTCP.rxStream != NULL ) ) )
{ {
FreeRTOS_debug_printf( ( "Set SO_%sBUF: buffer already created\n", FreeRTOS_debug_printf( ( "Set SO_%sBUF: buffer already created\n",
( lOptionName == FREERTOS_SO_SNDBUF ) ? "SND" : "RCV" ) ); ( lOptionName == FREERTOS_SO_SNDBUF ) ? "SND" : "RCV" ) );
@ -1361,7 +1365,7 @@ BaseType_t xReturn;
} }
else else
{ {
ulNewValue = *( ipPOINTER_CAST( uint32_t *, pvOptionValue ) ); ulNewValue = *( ipPOINTER_CAST( const uint32_t *, pvOptionValue ) );
if( lOptionName == FREERTOS_SO_SNDBUF ) if( lOptionName == FREERTOS_SO_SNDBUF )
{ {
@ -1386,7 +1390,6 @@ BaseType_t FreeRTOS_setsockopt( Socket_t xSocket, int32_t lLevel, int32_t lOptio
{ {
/* The standard Berkeley function returns 0 for success. */ /* The standard Berkeley function returns 0 for success. */
BaseType_t xReturn = -pdFREERTOS_ERRNO_EINVAL; BaseType_t xReturn = -pdFREERTOS_ERRNO_EINVAL;
BaseType_t lOptionValue;
FreeRTOS_Socket_t *pxSocket; FreeRTOS_Socket_t *pxSocket;
pxSocket = ( FreeRTOS_Socket_t * ) xSocket; pxSocket = ( FreeRTOS_Socket_t * ) xSocket;
@ -1443,11 +1446,10 @@ FreeRTOS_Socket_t *pxSocket;
#endif /* ipconfigUDP_MAX_RX_PACKETS */ #endif /* ipconfigUDP_MAX_RX_PACKETS */
case FREERTOS_SO_UDPCKSUM_OUT : case FREERTOS_SO_UDPCKSUM_OUT :
/* Turn calculating of the UDP checksum on/off for this socket. */ /* Turn calculating of the UDP checksum on/off for this socket. If pvOptionValue
/* The expression "pvOptionValue" of type "void const *" is cast to type "BaseType_t". */ * is anything else than NULL, the checksum generation will be turned on. */
lOptionValue = ipNUMERIC_CAST( BaseType_t, pvOptionValue );
if( lOptionValue == 0 ) if( pvOptionValue == NULL )
{ {
pxSocket->ucSocketOptions &= ~( ( uint8_t ) FREERTOS_SO_UDPCKSUM_OUT ); pxSocket->ucSocketOptions &= ~( ( uint8_t ) FREERTOS_SO_UDPCKSUM_OUT );
} }
@ -1540,7 +1542,7 @@ FreeRTOS_Socket_t *pxSocket;
when there is an event the socket's owner might want to when there is an event the socket's owner might want to
process. */ process. */
/* The type cast of the pointer expression "A" to type "B" removes const qualifier from the pointed to type. */ /* The type cast of the pointer expression "A" to type "B" removes const qualifier from the pointed to type. */
pxSocket->pxUserWakeCallback = ( SocketWakeupCallback_t ) pvOptionValue; pxSocket->pxUserWakeCallback = ( const SocketWakeupCallback_t ) pvOptionValue;
xReturn = 0; xReturn = 0;
} }
break; break;
@ -1548,7 +1550,7 @@ FreeRTOS_Socket_t *pxSocket;
case FREERTOS_SO_SET_LOW_HIGH_WATER: case FREERTOS_SO_SET_LOW_HIGH_WATER:
{ {
const LowHighWater_t *pxLowHighWater = ipPOINTER_CAST( LowHighWater_t *, pvOptionValue ); const LowHighWater_t *pxLowHighWater = ipPOINTER_CAST( const LowHighWater_t *, pvOptionValue );
if( pxSocket->ucProtocol != ( uint8_t ) FREERTOS_IPPROTO_TCP ) if( pxSocket->ucProtocol != ( uint8_t ) FREERTOS_IPPROTO_TCP )
{ {
@ -1594,7 +1596,7 @@ FreeRTOS_Socket_t *pxSocket;
break; /* will return -pdFREERTOS_ERRNO_EINVAL */ break; /* will return -pdFREERTOS_ERRNO_EINVAL */
} }
pxProps = ipPOINTER_CAST( WinProperties_t *, pvOptionValue ); pxProps = ipPOINTER_CAST( const WinProperties_t *, pvOptionValue );
xReturn = prvSockopt_so_buffer( pxSocket, FREERTOS_SO_SNDBUF, &( pxProps->lTxBufSize ) ); xReturn = prvSockopt_so_buffer( pxSocket, FREERTOS_SO_SNDBUF, &( pxProps->lTxBufSize ) );
if ( xReturn != 0 ) if ( xReturn != 0 )
@ -1638,7 +1640,7 @@ FreeRTOS_Socket_t *pxSocket;
{ {
break; /* will return -pdFREERTOS_ERRNO_EINVAL */ break; /* will return -pdFREERTOS_ERRNO_EINVAL */
} }
if( *( ipPOINTER_CAST( BaseType_t *, pvOptionValue ) ) != 0 ) if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
{ {
pxSocket->u.xTCP.bits.bReuseSocket = pdTRUE; pxSocket->u.xTCP.bits.bReuseSocket = pdTRUE;
} }
@ -1657,7 +1659,7 @@ FreeRTOS_Socket_t *pxSocket;
break; /* will return -pdFREERTOS_ERRNO_EINVAL */ break; /* will return -pdFREERTOS_ERRNO_EINVAL */
} }
if( *( ipPOINTER_CAST( BaseType_t *, pvOptionValue ) ) != 0 ) if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
{ {
pxSocket->u.xTCP.bits.bCloseAfterSend = pdTRUE; pxSocket->u.xTCP.bits.bCloseAfterSend = pdTRUE;
} }
@ -1676,7 +1678,7 @@ FreeRTOS_Socket_t *pxSocket;
break; /* will return -pdFREERTOS_ERRNO_EINVAL */ break; /* will return -pdFREERTOS_ERRNO_EINVAL */
} }
if( *( ipPOINTER_CAST( BaseType_t *, pvOptionValue ) ) != 0 ) if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
{ {
pxSocket->u.xTCP.xTCPWindow.u.bits.bSendFullSize = pdTRUE; pxSocket->u.xTCP.xTCPWindow.u.bits.bSendFullSize = pdTRUE;
} }
@ -1702,7 +1704,7 @@ FreeRTOS_Socket_t *pxSocket;
{ {
break; /* will return -pdFREERTOS_ERRNO_EINVAL */ break; /* will return -pdFREERTOS_ERRNO_EINVAL */
} }
if( *( ipPOINTER_CAST( BaseType_t *, pvOptionValue ) ) != 0 ) if( *( ipPOINTER_CAST( const BaseType_t *, pvOptionValue ) ) != 0 )
{ {
pxSocket->u.xTCP.bits.bRxStopped = pdTRUE; pxSocket->u.xTCP.bits.bRxStopped = pdTRUE;
} }
@ -1850,7 +1852,7 @@ const char *pcResult = pcBuffer;
const socklen_t uxSize = 16; const socklen_t uxSize = 16;
/* Each nibble is expressed in at most 3 digits, like e.g. "192". */ /* Each nibble is expressed in at most 3 digits, like e.g. "192". */
#define sockDIGIT_COUNT 3 #define sockDIGIT_COUNT ( 3U )
for( uxNibble = 0; uxNibble < ipSIZE_OF_IPv4_ADDRESS; uxNibble++ ) for( uxNibble = 0; uxNibble < ipSIZE_OF_IPv4_ADDRESS; uxNibble++ )
{ {
@ -2072,7 +2074,7 @@ uint32_t ulReturn = 0UL;
/* Function to get the local address and IP port */ /* Function to get the local address and IP port */
size_t FreeRTOS_GetLocalAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress ) size_t FreeRTOS_GetLocalAddress( ConstSocket_t xSocket, struct freertos_sockaddr *pxAddress )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
@ -2725,7 +2727,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
/* Get a direct pointer to the circular transmit buffer. /* Get a direct pointer to the circular transmit buffer.
'*pxLength' will contain the number of bytes that may be written. */ '*pxLength' will contain the number of bytes that may be written. */
uint8_t *FreeRTOS_get_tx_head( Socket_t xSocket, BaseType_t *pxLength ) uint8_t *FreeRTOS_get_tx_head( ConstSocket_t xSocket, BaseType_t *pxLength )
{ {
uint8_t *pucReturn = NULL; uint8_t *pucReturn = NULL;
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
@ -3186,10 +3188,11 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* For the web server: borrow the circular Rx buffer for inspection
const struct xSTREAM_BUFFER *FreeRTOS_get_rx_buf( Socket_t xSocket ) * HTML driver wants to see if a sequence of 13/10/13/10 is available. */
const struct xSTREAM_BUFFER *FreeRTOS_get_rx_buf( ConstSocket_t xSocket )
{ {
FreeRTOS_Socket_t const * pxSocket = ( FreeRTOS_Socket_t const * )xSocket; const FreeRTOS_Socket_t * pxSocket = ( const FreeRTOS_Socket_t * )xSocket;
const struct xSTREAM_BUFFER *pxReturn = NULL; const struct xSTREAM_BUFFER *pxReturn = NULL;
/* Confirm that this is a TCP socket before dereferencing structure /* Confirm that this is a TCP socket before dereferencing structure
@ -3288,7 +3291,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
int32_t lTCPAddRxdata( FreeRTOS_Socket_t *pxSocket, size_t uxOffset, const uint8_t *pcData, uint32_t ulByteCount ) int32_t lTCPAddRxdata( FreeRTOS_Socket_t *pxSocket, size_t uxOffset, const uint8_t *pcData, uint32_t ulByteCount )
{ {
StreamBuffer_t *pxStream = pxSocket->u.xTCP.rxStream; StreamBuffer_t *pxStream = pxSocket->u.xTCP.rxStream;
int32_t xResult; int32_t xResult = 0;
#if( ipconfigUSE_CALLBACKS == 1 ) #if( ipconfigUSE_CALLBACKS == 1 )
BaseType_t bHasHandler = ipconfigIS_VALID_PROG_ADDRESS( pxSocket->u.xTCP.pxHandleReceive ) ? pdTRUE : pdFALSE; BaseType_t bHasHandler = ipconfigIS_VALID_PROG_ADDRESS( pxSocket->u.xTCP.pxHandleReceive ) ? pdTRUE : pdFALSE;
const uint8_t *pucBuffer = NULL; const uint8_t *pucBuffer = NULL;
@ -3304,101 +3307,104 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
pxStream = prvTCPCreateStream( pxSocket, pdTRUE ); pxStream = prvTCPCreateStream( pxSocket, pdTRUE );
if( pxStream == NULL ) if( pxStream == NULL )
{ {
return -1; xResult = -1;
} }
} }
#if( ipconfigUSE_CALLBACKS == 1 ) if( xResult >= 0 )
{ {
if( ( bHasHandler != pdFALSE ) && ( uxStreamBufferGetSize( pxStream ) == 0U ) && ( uxOffset == 0UL ) && ( pcData != NULL ) )
{
/* Data can be passed directly to the user */
pucBuffer = pcData;
pcData = NULL;
}
}
#endif /* ipconfigUSE_CALLBACKS */
xResult = ( int32_t ) uxStreamBufferAdd( pxStream, uxOffset, pcData, ( size_t ) ulByteCount );
#if( ipconfigHAS_DEBUG_PRINTF != 0 )
{
if( xResult != ( int32_t ) ulByteCount )
{
FreeRTOS_debug_printf( ( "lTCPAddRxdata: at %u: %d/%u bytes (tail %u head %u space %u front %u)\n",
( UBaseType_t ) uxOffset,
( BaseType_t ) xResult,
( UBaseType_t ) ulByteCount,
( UBaseType_t ) pxStream->uxTail,
( UBaseType_t ) pxStream->uxHead,
( UBaseType_t ) uxStreamBufferFrontSpace( pxStream ),
( UBaseType_t ) pxStream->uxFront ) );
}
}
#endif /* ipconfigHAS_DEBUG_PRINTF */
if( uxOffset == 0U )
{
/* Data is being added to rxStream at the head (offs = 0) */
#if( ipconfigUSE_CALLBACKS == 1 ) #if( ipconfigUSE_CALLBACKS == 1 )
if( bHasHandler != pdFALSE )
{ {
/* The socket owner has installed an OnReceive handler. Pass the if( ( bHasHandler != pdFALSE ) && ( uxStreamBufferGetSize( pxStream ) == 0U ) && ( uxOffset == 0UL ) && ( pcData != NULL ) )
Rx data, without copying from the rxStream, to the user. */
for (;;)
{ {
uint8_t *ucReadPtr = NULL; /* Data can be passed directly to the user */
uint32_t ulCount; pucBuffer = pcData;
if( pucBuffer != NULL )
{
ucReadPtr = ipPOINTER_CAST( uint8_t *, pucBuffer );
ulCount = ulByteCount;
pucBuffer = NULL;
}
else
{
ulCount = ( uint32_t ) uxStreamBufferGetPtr( pxStream, &( ucReadPtr ) );
}
if( ulCount == 0UL ) pcData = NULL;
{
break;
}
( void ) pxSocket->u.xTCP.pxHandleReceive( pxSocket, ucReadPtr, ( size_t ) ulCount );
( void ) uxStreamBufferGet( pxStream, 0UL, NULL, ( size_t ) ulCount, pdFALSE );
} }
} else }
#endif /* ipconfigUSE_CALLBACKS */ #endif /* ipconfigUSE_CALLBACKS */
xResult = ( int32_t ) uxStreamBufferAdd( pxStream, uxOffset, pcData, ( size_t ) ulByteCount );
#if( ipconfigHAS_DEBUG_PRINTF != 0 )
{ {
/* See if running out of space. */ if( xResult != ( int32_t ) ulByteCount )
if( pxSocket->u.xTCP.bits.bLowWater == pdFALSE_UNSIGNED )
{ {
size_t uxFrontSpace = uxStreamBufferFrontSpace( pxSocket->u.xTCP.rxStream ); FreeRTOS_debug_printf( ( "lTCPAddRxdata: at %u: %d/%u bytes (tail %u head %u space %u front %u)\n",
if( uxFrontSpace <= pxSocket->u.xTCP.uxLittleSpace ) ( UBaseType_t ) uxOffset,
{ ( BaseType_t ) xResult,
pxSocket->u.xTCP.bits.bLowWater = pdTRUE; ( UBaseType_t ) ulByteCount,
pxSocket->u.xTCP.bits.bWinChange = pdTRUE; ( UBaseType_t ) pxStream->uxTail,
( UBaseType_t ) pxStream->uxHead,
/* bLowWater was reached, send the changed window size. */ ( UBaseType_t ) uxStreamBufferFrontSpace( pxStream ),
pxSocket->u.xTCP.usTimeout = 1U; ( UBaseType_t ) pxStream->uxFront ) );
( void ) xSendEventToIPTask( eTCPTimerEvent );
}
} }
}
#endif /* ipconfigHAS_DEBUG_PRINTF */
/* New incoming data is available, wake up the user. User's if( uxOffset == 0U )
semaphores will be set just before the IP-task goes asleep. */ {
pxSocket->xEventBits |= ( EventBits_t ) eSOCKET_RECEIVE; /* Data is being added to rxStream at the head (offs = 0) */
#if( ipconfigUSE_CALLBACKS == 1 )
#if ipconfigSUPPORT_SELECT_FUNCTION == 1 if( bHasHandler != pdFALSE )
{ {
if( ( pxSocket->xSelectBits & ( EventBits_t ) eSELECT_READ ) != 0U ) /* The socket owner has installed an OnReceive handler. Pass the
Rx data, without copying from the rxStream, to the user. */
for (;;)
{ {
pxSocket->xEventBits |= ( ( ( EventBits_t ) eSELECT_READ ) << SOCKET_EVENT_BIT_COUNT ); uint8_t *ucReadPtr = NULL;
uint32_t ulCount;
if( pucBuffer != NULL )
{
ucReadPtr = ipPOINTER_CAST( uint8_t *, pucBuffer );
ulCount = ulByteCount;
pucBuffer = NULL;
}
else
{
ulCount = ( uint32_t ) uxStreamBufferGetPtr( pxStream, &( ucReadPtr ) );
}
if( ulCount == 0UL )
{
break;
}
( void ) pxSocket->u.xTCP.pxHandleReceive( pxSocket, ucReadPtr, ( size_t ) ulCount );
( void ) uxStreamBufferGet( pxStream, 0UL, NULL, ( size_t ) ulCount, pdFALSE );
} }
} else
#endif /* ipconfigUSE_CALLBACKS */
{
/* See if running out of space. */
if( pxSocket->u.xTCP.bits.bLowWater == pdFALSE_UNSIGNED )
{
size_t uxFrontSpace = uxStreamBufferFrontSpace( pxSocket->u.xTCP.rxStream );
if( uxFrontSpace <= pxSocket->u.xTCP.uxLittleSpace )
{
pxSocket->u.xTCP.bits.bLowWater = pdTRUE;
pxSocket->u.xTCP.bits.bWinChange = pdTRUE;
/* bLowWater was reached, send the changed window size. */
pxSocket->u.xTCP.usTimeout = 1U;
( void ) xSendEventToIPTask( eTCPTimerEvent );
}
}
/* New incoming data is available, wake up the user. User's
semaphores will be set just before the IP-task goes asleep. */
pxSocket->xEventBits |= ( EventBits_t ) eSOCKET_RECEIVE;
#if ipconfigSUPPORT_SELECT_FUNCTION == 1
{
if( ( pxSocket->xSelectBits & ( EventBits_t ) eSELECT_READ ) != 0U )
{
pxSocket->xEventBits |= ( ( ( EventBits_t ) eSELECT_READ ) << SOCKET_EVENT_BIT_COUNT );
}
}
#endif
} }
#endif
} }
} }
@ -3411,7 +3417,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* Function to get the remote address and IP port */ /* Function to get the remote address and IP port */
BaseType_t FreeRTOS_GetRemoteAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress ) BaseType_t FreeRTOS_GetRemoteAddress( ConstSocket_t xSocket, struct freertos_sockaddr *pxAddress )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xResult; BaseType_t xResult;
@ -3443,7 +3449,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* Returns the number of bytes that may be added to txStream */ /* Returns the number of bytes that may be added to txStream */
BaseType_t FreeRTOS_maywrite( Socket_t xSocket ) BaseType_t FreeRTOS_maywrite( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xResult; BaseType_t xResult;
@ -3480,7 +3486,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
BaseType_t FreeRTOS_tx_space( Socket_t xSocket ) BaseType_t FreeRTOS_tx_space( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xReturn; BaseType_t xReturn;
@ -3509,7 +3515,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
BaseType_t FreeRTOS_tx_size( Socket_t xSocket ) BaseType_t FreeRTOS_tx_size( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xReturn; BaseType_t xReturn;
@ -3539,7 +3545,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* Returns pdTRUE if TCP socket is connected. */ /* Returns pdTRUE if TCP socket is connected. */
BaseType_t FreeRTOS_issocketconnected( Socket_t xSocket ) BaseType_t FreeRTOS_issocketconnected( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xReturn = pdFALSE; BaseType_t xReturn = pdFALSE;
@ -3567,8 +3573,8 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* returns the actual size of MSS being used */ /* Returns the actual size of MSS being used. */
BaseType_t FreeRTOS_mss( Socket_t xSocket ) BaseType_t FreeRTOS_mss( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xReturn; BaseType_t xReturn;
@ -3593,8 +3599,8 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* HT: for internal use only: return the connection status */ /* For internal use only: return the connection status. */
BaseType_t FreeRTOS_connstatus( Socket_t xSocket ) BaseType_t FreeRTOS_connstatus( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xReturn; BaseType_t xReturn;
@ -3605,7 +3611,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
} }
else else
{ {
/* Cast it to BaseType_t */ /* Cast it to BaseType_t. */
xReturn = ( BaseType_t ) ( pxSocket->u.xTCP.ucTCPState ); xReturn = ( BaseType_t ) ( pxSocket->u.xTCP.ucTCPState );
} }
@ -3620,7 +3626,7 @@ void vSocketWakeUpUser( FreeRTOS_Socket_t *pxSocket )
/* /*
* Returns the number of bytes which can be read. * Returns the number of bytes which can be read.
*/ */
BaseType_t FreeRTOS_rx_size( Socket_t xSocket ) BaseType_t FreeRTOS_rx_size( ConstSocket_t xSocket )
{ {
const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; const FreeRTOS_Socket_t *pxSocket = ( const FreeRTOS_Socket_t * ) xSocket;
BaseType_t xReturn; BaseType_t xReturn;

View file

@ -203,6 +203,7 @@ extern const char *FreeRTOS_inet_ntoa( uint32_t ulIPAddress, char *pcBuffer );
/* The socket type itself. */ /* The socket type itself. */
struct xSOCKET; struct xSOCKET;
typedef struct xSOCKET *Socket_t; typedef struct xSOCKET *Socket_t;
typedef struct xSOCKET const * ConstSocket_t;
#if( ipconfigSUPPORT_SELECT_FUNCTION == 1 ) #if( ipconfigSUPPORT_SELECT_FUNCTION == 1 )
/* The SocketSet_t type is the equivalent to the fd_set type used by the /* The SocketSet_t type is the equivalent to the fd_set type used by the
@ -222,7 +223,7 @@ int32_t FreeRTOS_sendto( Socket_t xSocket, const void *pvBuffer, size_t uxTotalD
BaseType_t FreeRTOS_bind( Socket_t xSocket, struct freertos_sockaddr const * pxAddress, socklen_t xAddressLength ); BaseType_t FreeRTOS_bind( Socket_t xSocket, struct freertos_sockaddr const * pxAddress, socklen_t xAddressLength );
/* function to get the local address and IP port */ /* function to get the local address and IP port */
size_t FreeRTOS_GetLocalAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress ); size_t FreeRTOS_GetLocalAddress( ConstSocket_t xSocket, struct freertos_sockaddr *pxAddress );
#if( ipconfigETHERNET_DRIVER_FILTERS_PACKETS == 1 ) #if( ipconfigETHERNET_DRIVER_FILTERS_PACKETS == 1 )
/* Returns true if an UDP socket exists bound to mentioned port number. */ /* Returns true if an UDP socket exists bound to mentioned port number. */
@ -248,23 +249,23 @@ BaseType_t FreeRTOS_shutdown (Socket_t xSocket, BaseType_t xHow);
#endif /* ipconfigSUPPORT_SIGNALS */ #endif /* ipconfigSUPPORT_SIGNALS */
/* Return the remote address and IP port. */ /* Return the remote address and IP port. */
BaseType_t FreeRTOS_GetRemoteAddress( Socket_t xSocket, struct freertos_sockaddr *pxAddress ); BaseType_t FreeRTOS_GetRemoteAddress( ConstSocket_t xSocket, struct freertos_sockaddr *pxAddress );
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
/* returns pdTRUE if TCP socket is connected */ /* Returns pdTRUE if TCP socket is connected. */
BaseType_t FreeRTOS_issocketconnected( Socket_t xSocket ); BaseType_t FreeRTOS_issocketconnected( ConstSocket_t xSocket );
/* returns the actual size of MSS being used */ /* Returns the actual size of MSS being used. */
BaseType_t FreeRTOS_mss( Socket_t xSocket ); BaseType_t FreeRTOS_mss( ConstSocket_t xSocket );
#endif #endif
/* for internal use only: return the connection status */ /* For internal use only: return the connection status. */
BaseType_t FreeRTOS_connstatus( Socket_t xSocket ); BaseType_t FreeRTOS_connstatus( ConstSocket_t xSocket );
/* Returns the number of bytes that may be added to txStream */ /* Returns the number of bytes that may be added to txStream */
BaseType_t FreeRTOS_maywrite( Socket_t xSocket ); BaseType_t FreeRTOS_maywrite( ConstSocket_t xSocket );
/* /*
* Two helper functions, mostly for testing * Two helper functions, mostly for testing
@ -272,9 +273,9 @@ BaseType_t FreeRTOS_maywrite( Socket_t xSocket );
* tx_space returns the free space in the Tx buffer * tx_space returns the free space in the Tx buffer
*/ */
#if( ipconfigUSE_TCP == 1 ) #if( ipconfigUSE_TCP == 1 )
BaseType_t FreeRTOS_rx_size( Socket_t xSocket ); BaseType_t FreeRTOS_rx_size( ConstSocket_t xSocket );
BaseType_t FreeRTOS_tx_space( Socket_t xSocket ); BaseType_t FreeRTOS_tx_space( ConstSocket_t xSocket );
BaseType_t FreeRTOS_tx_size( Socket_t xSocket ); BaseType_t FreeRTOS_tx_size( ConstSocket_t xSocket );
#endif #endif
/* Returns the number of outstanding bytes in txStream. */ /* Returns the number of outstanding bytes in txStream. */
@ -292,7 +293,7 @@ FreeRTOS_rx_size(). */
* Get a direct pointer to the circular transmit buffer. * Get a direct pointer to the circular transmit buffer.
* '*pxLength' will contain the number of bytes that may be written. * '*pxLength' will contain the number of bytes that may be written.
*/ */
uint8_t *FreeRTOS_get_tx_head( Socket_t xSocket, BaseType_t *pxLength ); uint8_t *FreeRTOS_get_tx_head( ConstSocket_t xSocket, BaseType_t *pxLength );
#endif /* ipconfigUSE_TCP */ #endif /* ipconfigUSE_TCP */
@ -382,7 +383,7 @@ const char *FreeRTOS_inet_ntop4( const void *pvSource, char *pcDestination, sock
* For the web server: borrow the circular Rx buffer for inspection * For the web server: borrow the circular Rx buffer for inspection
* HTML driver wants to see if a sequence of 13/10/13/10 is available * HTML driver wants to see if a sequence of 13/10/13/10 is available
*/ */
const struct xSTREAM_BUFFER *FreeRTOS_get_rx_buf( Socket_t xSocket ); const struct xSTREAM_BUFFER *FreeRTOS_get_rx_buf( ConstSocket_t xSocket );
void FreeRTOS_netstat( void ); void FreeRTOS_netstat( void );

View file

@ -119,7 +119,7 @@ extern uint32_t ulRand();
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks by dividing the time in * milliseconds can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */ * milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
* address, netmask, DNS server address and gateway address from a DHCP server. If * address, netmask, DNS server address and gateway address from a DHCP server. If
@ -145,7 +145,7 @@ extern uint32_t ulRand();
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
* a DHCP reply being received. */ * a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \ #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \
( 120000 / portTICK_PERIOD_MS ) ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
* stack can only send a UDP message to a remove IP address if it knowns the MAC * stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -225,7 +225,7 @@ extern uint32_t ulRand();
* lower value can save RAM, depending on the buffer management scheme used. If * lower value can save RAM, depending on the buffer management scheme used. If
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must * ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
* be divisible by 8. */ * be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
* through the FreeRTOS_gethostbyname() API function. */ * through the FreeRTOS_gethostbyname() API function. */
@ -266,7 +266,7 @@ extern uint32_t ulRand();
* 32-bit memory instructions, all packets will be stored 32-bit-aligned, * 32-bit memory instructions, all packets will be stored 32-bit-aligned,
* plus 16-bits. This has to do with the contents of the IP-packets: all * plus 16-bits. This has to do with the contents of the IP-packets: all
* 32-bit fields are 32-bit-aligned, plus 16-bit. */ * 32-bit fields are 32-bit-aligned, plus 16-bit. */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
* TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 * TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6

View file

@ -140,7 +140,7 @@ free) the network buffers are themselves blocked waiting for a network buffer.
ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
milliseconds can be converted to a time in ticks by dividing the time in milliseconds can be converted to a time in ticks by dividing the time in
milliseconds by portTICK_PERIOD_MS. */ milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
address, netmask, DNS server address and gateway address from a DHCP server. If address, netmask, DNS server address and gateway address from a DHCP server. If
@ -158,7 +158,7 @@ ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the
static IP address passed as a parameter to FreeRTOS_IPInit() if the static IP address passed as a parameter to FreeRTOS_IPInit() if the
re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
a DHCP reply being received. */ a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000 / portTICK_PERIOD_MS ) #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
stack can only send a UDP message to a remove IP address if it knowns the MAC stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -236,7 +236,7 @@ contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
lower value can save RAM, depending on the buffer management scheme used. If lower value can save RAM, depending on the buffer management scheme used. If
ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
be divisible by 8. */ be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
through the FreeRTOS_gethostbyname() API function. */ through the FreeRTOS_gethostbyname() API function. */
@ -277,7 +277,7 @@ block occasionally to allow other tasks to run. */
32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits. 32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits.
This has to do with the contents of the IP-packets: all 32-bit fields are This has to do with the contents of the IP-packets: all 32-bit fields are
32-bit-aligned, plus 16-bit(!) */ 32-bit-aligned, plus 16-bit(!) */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6

View file

@ -123,7 +123,7 @@ extern uint32_t ulRand();
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks by dividing the time in * milliseconds can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */ * milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
* address, netmask, DNS server address and gateway address from a DHCP server. If * address, netmask, DNS server address and gateway address from a DHCP server. If
@ -149,7 +149,7 @@ extern uint32_t ulRand();
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
* a DHCP reply being received. */ * a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \ #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \
( 120000 / portTICK_PERIOD_MS ) ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
* stack can only send a UDP message to a remove IP address if it knowns the MAC * stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -229,7 +229,7 @@ extern uint32_t ulRand();
* lower value can save RAM, depending on the buffer management scheme used. If * lower value can save RAM, depending on the buffer management scheme used. If
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must * ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
* be divisible by 8. */ * be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
* through the FreeRTOS_gethostbyname() API function. */ * through the FreeRTOS_gethostbyname() API function. */
@ -270,7 +270,7 @@ extern uint32_t ulRand();
* 32-bit memory instructions, all packets will be stored 32-bit-aligned, * 32-bit memory instructions, all packets will be stored 32-bit-aligned,
* plus 16-bits. This has to do with the contents of the IP-packets: all * plus 16-bits. This has to do with the contents of the IP-packets: all
* 32-bit fields are 32-bit-aligned, plus 16-bit. */ * 32-bit fields are 32-bit-aligned, plus 16-bit. */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
* TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 * TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6

View file

@ -119,7 +119,7 @@ extern uint32_t ulRand();
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks by dividing the time in * milliseconds can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */ * milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
* address, netmask, DNS server address and gateway address from a DHCP server. If * address, netmask, DNS server address and gateway address from a DHCP server. If
@ -145,7 +145,7 @@ extern uint32_t ulRand();
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
* a DHCP reply being received. */ * a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \ #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \
( 120000 / portTICK_PERIOD_MS ) ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
* stack can only send a UDP message to a remove IP address if it knowns the MAC * stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -225,7 +225,7 @@ extern uint32_t ulRand();
* lower value can save RAM, depending on the buffer management scheme used. If * lower value can save RAM, depending on the buffer management scheme used. If
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must * ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
* be divisible by 8. */ * be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
* through the FreeRTOS_gethostbyname() API function. */ * through the FreeRTOS_gethostbyname() API function. */
@ -266,7 +266,7 @@ extern uint32_t ulRand();
* 32-bit memory instructions, all packets will be stored 32-bit-aligned, * 32-bit memory instructions, all packets will be stored 32-bit-aligned,
* plus 16-bits. This has to do with the contents of the IP-packets: all * plus 16-bits. This has to do with the contents of the IP-packets: all
* 32-bit fields are 32-bit-aligned, plus 16-bit. */ * 32-bit fields are 32-bit-aligned, plus 16-bit. */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
* TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 * TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6

View file

@ -137,7 +137,7 @@ free) the network buffers are themselves blocked waiting for a network buffer.
ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
milliseconds can be converted to a time in ticks by dividing the time in milliseconds can be converted to a time in ticks by dividing the time in
milliseconds by portTICK_PERIOD_MS. */ milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
address, netmask, DNS server address and gateway address from a DHCP server. If address, netmask, DNS server address and gateway address from a DHCP server. If
@ -155,7 +155,7 @@ ipconfigMAXIMUM_DISCOVER_TX_PERIOD. The IP stack will revert to using the
static IP address passed as a parameter to FreeRTOS_IPInit() if the static IP address passed as a parameter to FreeRTOS_IPInit() if the
re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
a DHCP reply being received. */ a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000 / portTICK_PERIOD_MS ) #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
stack can only send a UDP message to a remove IP address if it knowns the MAC stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -233,7 +233,7 @@ contain. For normal Ethernet V2 frames the maximum MTU is 1500. Setting a
lower value can save RAM, depending on the buffer management scheme used. If lower value can save RAM, depending on the buffer management scheme used. If
ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
be divisible by 8. */ be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
through the FreeRTOS_gethostbyname() API function. */ through the FreeRTOS_gethostbyname() API function. */
@ -274,7 +274,7 @@ block occasionally to allow other tasks to run. */
32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits. 32-bit memory instructions, all packets will be stored 32-bit-aligned, plus 16-bits.
This has to do with the contents of the IP-packets: all 32-bit fields are This has to do with the contents of the IP-packets: all 32-bit fields are
32-bit-aligned, plus 16-bit(!) */ 32-bit-aligned, plus 16-bit(!) */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6

View file

@ -119,7 +119,7 @@ extern uint32_t ulRand();
* ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in * ipconfigMAX_SEND_BLOCK_TIME_TICKS is specified in RTOS ticks. A time in
* milliseconds can be converted to a time in ticks by dividing the time in * milliseconds can be converted to a time in ticks by dividing the time in
* milliseconds by portTICK_PERIOD_MS. */ * milliseconds by portTICK_PERIOD_MS. */
#define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000 / portTICK_PERIOD_MS ) #define ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS ( 5000U / portTICK_PERIOD_MS )
/* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP /* If ipconfigUSE_DHCP is 1 then FreeRTOS+TCP will attempt to retrieve an IP
* address, netmask, DNS server address and gateway address from a DHCP server. If * address, netmask, DNS server address and gateway address from a DHCP server. If
@ -145,7 +145,7 @@ extern uint32_t ulRand();
* re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without * re-transmission time interval reaches ipconfigMAXIMUM_DISCOVER_TX_PERIOD without
* a DHCP reply being received. */ * a DHCP reply being received. */
#define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \ #define ipconfigMAXIMUM_DISCOVER_TX_PERIOD \
( 120000 / portTICK_PERIOD_MS ) ( 120000U / portTICK_PERIOD_MS )
/* The ARP cache is a table that maps IP addresses to MAC addresses. The IP /* The ARP cache is a table that maps IP addresses to MAC addresses. The IP
* stack can only send a UDP message to a remove IP address if it knowns the MAC * stack can only send a UDP message to a remove IP address if it knowns the MAC
@ -227,7 +227,7 @@ extern uint32_t ulRand();
* lower value can save RAM, depending on the buffer management scheme used. If * lower value can save RAM, depending on the buffer management scheme used. If
* ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must * ipconfigCAN_FRAGMENT_OUTGOING_PACKETS is 1 then (ipconfigNETWORK_MTU - 28) must
* be divisible by 8. */ * be divisible by 8. */
#define ipconfigNETWORK_MTU 1200 #define ipconfigNETWORK_MTU 1200U
/* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used /* Set ipconfigUSE_DNS to 1 to include a basic DNS client/resolver. DNS is used
* through the FreeRTOS_gethostbyname() API function. */ * through the FreeRTOS_gethostbyname() API function. */
@ -268,7 +268,7 @@ extern uint32_t ulRand();
* 32-bit memory instructions, all packets will be stored 32-bit-aligned, * 32-bit memory instructions, all packets will be stored 32-bit-aligned,
* plus 16-bits. This has to do with the contents of the IP-packets: all * plus 16-bits. This has to do with the contents of the IP-packets: all
* 32-bit fields are 32-bit-aligned, plus 16-bit. */ * 32-bit fields are 32-bit-aligned, plus 16-bit. */
#define ipconfigPACKET_FILLER_SIZE 2 #define ipconfigPACKET_FILLER_SIZE 2U
/* Define the size of the pool of TCP window descriptors. On the average, each /* Define the size of the pool of TCP window descriptors. On the average, each
* TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6 * TCP socket will use up to 2 x 6 descriptors, meaning that it can have 2 x 6