mirror of
https://github.com/FreeRTOS/FreeRTOS-Plus-TCP
synced 2025-10-24 20:29:40 +08:00
Remove use of ipconfigCOMPATIBLE_WITH_SINGLE (#646)
As ipconfigCOMPATIBLE_WITH_SINGLE is never enabled and used partially, removing the rest of the instances of the same. Ran uncrustify.
This commit is contained in:
@@ -602,7 +602,6 @@ void vARPRefreshCacheEntry( const MACAddress_t * pxMACAddress,
|
||||
* network, than the MAC address of the gateway should not be
|
||||
* overwritten. */
|
||||
BaseType_t xOtherIsLocal = ( FreeRTOS_FindEndPointOnNetMask( xARPCache[ x ].ulIPAddress, 3 ) != NULL ) ? 1 : 0; /* ARP remote address. */
|
||||
|
||||
#else /* if ( ipconfigARP_STORES_REMOTE_ADDRESSES != 0 ) */
|
||||
xMacEntry = x;
|
||||
#endif /* if ( ipconfigARP_STORES_REMOTE_ADDRESSES != 0 ) */
|
||||
|
||||
@@ -588,10 +588,6 @@
|
||||
/* 'sin_len' doesn't really matter, 'sockaddr' and 'sockaddr6'
|
||||
* have the same size. */
|
||||
pxAddress->sin_len = ( uint8_t ) sizeof( struct freertos_sockaddr );
|
||||
#if ( ipconfigCOMPATIBLE_WITH_SINGLE == 1 )
|
||||
/* Obtain the DNS server address. */
|
||||
FreeRTOS_GetAddressConfiguration( NULL, NULL, NULL, &ulIPAddress );
|
||||
#endif
|
||||
|
||||
BaseType_t bHasDot = llmnr_has_dot( pcHostName );
|
||||
/* For local resolution, mDNS uses names ending with the string ".local" */
|
||||
@@ -650,13 +646,7 @@
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif /* if ( ipconfigUSE_LLMNR == 1 ) */
|
||||
{
|
||||
/* Use DNS server. */
|
||||
pxAddress->sin_addr.xIP_IPv4 = ulIPAddress; /*TODO */
|
||||
pxAddress->sin_port = dnsDNS_PORT;
|
||||
}
|
||||
|
||||
if( xNeed_Endpoint == pdTRUE )
|
||||
{
|
||||
|
||||
@@ -622,17 +622,9 @@ void vIPNetworkUpCalls( NetworkEndPoint_t * pxEndPoint )
|
||||
pxEndPoint->bits.bEndPointUp = pdTRUE_UNSIGNED;
|
||||
|
||||
#if ( ipconfigUSE_NETWORK_EVENT_HOOK == 1 )
|
||||
{
|
||||
#if ( ipconfigCOMPATIBLE_WITH_SINGLE == 1 )
|
||||
{
|
||||
vApplicationIPNetworkEventHook( eNetworkUp );
|
||||
}
|
||||
#else
|
||||
{
|
||||
vApplicationIPNetworkEventHook( eNetworkUp, pxEndPoint );
|
||||
}
|
||||
#endif /* ( ipconfigCOMPATIBLE_WITH_SINGLE == 1 ) */
|
||||
}
|
||||
#endif /* ipconfigUSE_NETWORK_EVENT_HOOK */
|
||||
|
||||
#if ( ipconfigDNS_USE_CALLBACKS != 0 )
|
||||
@@ -991,6 +983,64 @@ BaseType_t FreeRTOS_IPInit( const uint8_t ucIPAddress[ ipIP_ADDRESS_LENGTH_BYTES
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Release the UDP payload buffer.
|
||||
*
|
||||
* @param[in] pvBuffer: Pointer to the UDP buffer that is to be released.
|
||||
*/
|
||||
void FreeRTOS_ReleaseUDPPayloadBuffer( void const * pvBuffer )
|
||||
{
|
||||
NetworkBufferDescriptor_t * pxBuffer;
|
||||
|
||||
pxBuffer = pxUDPPayloadBuffer_to_NetworkBuffer( pvBuffer );
|
||||
configASSERT( pxBuffer != NULL );
|
||||
vReleaseNetworkBufferAndDescriptor( pxBuffer );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Get the current address configuration. Only non-NULL pointers will
|
||||
* be filled in. pxEndPoint must be non-NULL.
|
||||
*
|
||||
* @param[out] pulIPAddress: The current IP-address assigned.
|
||||
* @param[out] pulNetMask: The netmask used for current subnet.
|
||||
* @param[out] pulGatewayAddress: The gateway address.
|
||||
* @param[out] pulDNSServerAddress: The DNS server address.
|
||||
* @param[in] pxEndPoint: The end-point which is being questioned.
|
||||
*/
|
||||
void FreeRTOS_GetEndPointConfiguration( uint32_t * pulIPAddress,
|
||||
uint32_t * pulNetMask,
|
||||
uint32_t * pulGatewayAddress,
|
||||
uint32_t * pulDNSServerAddress,
|
||||
struct xNetworkEndPoint * pxEndPoint )
|
||||
{
|
||||
if( ENDPOINT_IS_IPv4( pxEndPoint ) )
|
||||
{
|
||||
/* Return the address configuration to the caller. */
|
||||
|
||||
if( pulIPAddress != NULL )
|
||||
{
|
||||
*pulIPAddress = pxEndPoint->ipv4_settings.ulIPAddress;
|
||||
}
|
||||
|
||||
if( pulNetMask != NULL )
|
||||
{
|
||||
*pulNetMask = pxEndPoint->ipv4_settings.ulNetMask;
|
||||
}
|
||||
|
||||
if( pulGatewayAddress != NULL )
|
||||
{
|
||||
*pulGatewayAddress = pxEndPoint->ipv4_settings.ulGatewayAddress;
|
||||
}
|
||||
|
||||
if( pulDNSServerAddress != NULL )
|
||||
{
|
||||
*pulDNSServerAddress = pxEndPoint->ipv4_settings.ulDNSServerAddresses[ 0 ]; /*_RB_ Only returning the address of the first DNS server. */
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Set the current network address configuration. Only non-NULL pointers will
|
||||
* be used. pxEndPoint must pointer to a valid end-point.
|
||||
@@ -1034,55 +1084,6 @@ void FreeRTOS_SetEndPointConfiguration( const uint32_t * pulIPAddress,
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigCOMPATIBLE_WITH_SINGLE == 1 )
|
||||
|
||||
/**
|
||||
* @brief Get the current address configuration. Only non-NULL pointers will
|
||||
* be filled in.
|
||||
*
|
||||
* @param[out] pulIPAddress: The current IP-address assigned.
|
||||
* @param[out] pulNetMask: The netmask used for current subnet.
|
||||
* @param[out] pulGatewayAddress: The gateway address.
|
||||
* @param[out] pulDNSServerAddress: The DNS server address.
|
||||
*/
|
||||
void FreeRTOS_GetAddressConfiguration( uint32_t * pulIPAddress,
|
||||
uint32_t * pulNetMask,
|
||||
uint32_t * pulGatewayAddress,
|
||||
uint32_t * pulDNSServerAddress )
|
||||
{
|
||||
struct xNetworkEndPoint * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
|
||||
|
||||
FreeRTOS_GetEndPointConfiguration( pulIPAddress, pulNetMask, pulGatewayAddress, pulDNSServerAddress, pxEndPoint );
|
||||
}
|
||||
|
||||
void FreeRTOS_SetAddressConfiguration( const uint32_t * pulIPAddress,
|
||||
const uint32_t * pulNetMask,
|
||||
const uint32_t * pulGatewayAddress,
|
||||
const uint32_t * pulDNSServerAddress )
|
||||
{
|
||||
struct xNetworkEndPoint * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
|
||||
|
||||
FreeRTOS_SetEndPointConfiguration( pulIPAddress, pulNetMask, pulGatewayAddress, pulDNSServerAddress, pxEndPoint );
|
||||
}
|
||||
#endif /* ( ipconfigCOMPATIBLE_WITH_SINGLE ) */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Release the UDP payload buffer.
|
||||
*
|
||||
* @param[in] pvBuffer: Pointer to the UDP buffer that is to be released.
|
||||
*/
|
||||
void FreeRTOS_ReleaseUDPPayloadBuffer( void const * pvBuffer )
|
||||
{
|
||||
NetworkBufferDescriptor_t * pxBuffer;
|
||||
|
||||
pxBuffer = pxUDPPayloadBuffer_to_NetworkBuffer( pvBuffer );
|
||||
configASSERT( pxBuffer != NULL );
|
||||
vReleaseNetworkBufferAndDescriptor( pxBuffer );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigUSE_TCP == 1 )
|
||||
|
||||
/**
|
||||
@@ -2104,158 +2105,6 @@ uint32_t FreeRTOS_GetIPAddress( void )
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( ipconfigCOMPATIBLE_WITH_SINGLE != 0 )
|
||||
|
||||
/*
|
||||
* The helper functions here below assume that there is a single
|
||||
* interface and a single end-point (ipconfigCOMPATIBLE_WITH_SINGLE)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Sets the IP address of the NIC.
|
||||
*
|
||||
* @param[in] ulIPAddress: IP address of the NIC to be set.
|
||||
*/
|
||||
void FreeRTOS_SetIPAddress( uint32_t ulIPAddress )
|
||||
{
|
||||
/* Sets the IP address of the NIC. */
|
||||
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
|
||||
|
||||
if( pxEndPoint != NULL )
|
||||
{
|
||||
pxEndPoint->ipv4_settings.ulIPAddress = ulIPAddress;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Get the gateway address of the subnet.
|
||||
*
|
||||
* @return The IP-address of the gateway, zero if a gateway is
|
||||
* not used/defined.
|
||||
*/
|
||||
uint32_t FreeRTOS_GetGatewayAddress( void )
|
||||
{
|
||||
uint32_t ulIPAddress = 0U;
|
||||
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
|
||||
|
||||
if( pxEndPoint != NULL )
|
||||
{
|
||||
ulIPAddress = pxEndPoint->ipv4_settings.ulGatewayAddress;
|
||||
}
|
||||
|
||||
return ulIPAddress;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Get the DNS server address.
|
||||
*
|
||||
* @return The IP address of the DNS server.
|
||||
*/
|
||||
uint32_t FreeRTOS_GetDNSServerAddress( void )
|
||||
{
|
||||
uint32_t ulIPAddress = 0U;
|
||||
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
|
||||
|
||||
if( pxEndPoint != NULL )
|
||||
{
|
||||
ulIPAddress = pxEndPoint->ipv4_settings.ulDNSServerAddresses[ 0 ];
|
||||
}
|
||||
|
||||
return ulIPAddress;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Get the netmask for the subnet.
|
||||
*
|
||||
* @return The 32 bit netmask for the subnet.
|
||||
*/
|
||||
uint32_t FreeRTOS_GetNetmask( void )
|
||||
{
|
||||
uint32_t ulIPAddress = 0U;
|
||||
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
|
||||
|
||||
if( pxEndPoint != NULL )
|
||||
{
|
||||
ulIPAddress = pxEndPoint->ipv4_settings.ulNetMask;
|
||||
}
|
||||
|
||||
return ulIPAddress;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Update the MAC address.
|
||||
*
|
||||
* @param[in] ucMACAddress: the MAC address to be set.
|
||||
*/
|
||||
void FreeRTOS_UpdateMACAddress( const uint8_t ucMACAddress[ ipMAC_ADDRESS_LENGTH_BYTES ] )
|
||||
{
|
||||
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
|
||||
|
||||
if( pxEndPoint != NULL )
|
||||
{
|
||||
/* Copy the MAC address at the start of the default packet header fragment. */
|
||||
( void ) memcpy( pxEndPoint->xMACAddress.ucBytes, ( const void * ) ucMACAddress, ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Get the MAC address.
|
||||
*
|
||||
* @return The pointer to MAC address.
|
||||
*/
|
||||
const uint8_t * FreeRTOS_GetMACAddress( void )
|
||||
{
|
||||
const uint8_t * pucReturn = NULL;
|
||||
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
|
||||
|
||||
if( pxEndPoint != NULL )
|
||||
{
|
||||
/* Copy the MAC address at the start of the default packet header fragment. */
|
||||
pucReturn = pxEndPoint->xMACAddress.ucBytes;
|
||||
}
|
||||
|
||||
return pucReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Set the netmask for the subnet.
|
||||
*
|
||||
* @param[in] ulNetmask: The 32 bit netmask of the subnet.
|
||||
*/
|
||||
void FreeRTOS_SetNetmask( uint32_t ulNetmask )
|
||||
{
|
||||
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
|
||||
|
||||
if( pxEndPoint != NULL )
|
||||
{
|
||||
pxEndPoint->ipv4_settings.ulNetMask = ulNetmask;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Set the gateway address.
|
||||
*
|
||||
* @param[in] ulGatewayAddress: The gateway address.
|
||||
*/
|
||||
void FreeRTOS_SetGatewayAddress( uint32_t ulGatewayAddress )
|
||||
{
|
||||
NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint( NULL );
|
||||
|
||||
if( pxEndPoint != NULL )
|
||||
{
|
||||
pxEndPoint->ipv4_settings.ulGatewayAddress = ulGatewayAddress;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
#endif /* ( ipconfigCOMPATIBLE_WITH_SINGLE != 0 ) */
|
||||
|
||||
/**
|
||||
* @brief Returns whether the IP task is ready.
|
||||
*
|
||||
|
||||
@@ -744,8 +744,6 @@ void prvProcessNetworkDownEvent( NetworkInterface_t * pxInterface )
|
||||
FreeRTOS_ClearARP( pxEndPoint );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* The network has been disconnected (or is being initialised for the first
|
||||
* time). Perform whatever hardware processing is necessary to bring it up
|
||||
* again, or wait for it to be available again. This is hardware dependent. */
|
||||
|
||||
@@ -185,7 +185,6 @@
|
||||
/* coverity[misra_c_2012_rule_11_3_violation] */
|
||||
pxProtocolHeaders = ( ProtocolHeaders_t * ) &( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + uxIPHeaderSize ] );
|
||||
|
||||
|
||||
if( pxNetworkBuffer->pxEndPoint == NULL )
|
||||
{
|
||||
prvTCPReturn_SetEndPoint( pxSocket, pxNetworkBuffer, uxIPHeaderSize );
|
||||
|
||||
@@ -299,6 +299,24 @@ BaseType_t FreeRTOS_IPInit( const uint8_t ucIPAddress[ ipIP_ADDRESS_LENGTH_BYTES
|
||||
const uint8_t ucDNSServerAddress[ ipIP_ADDRESS_LENGTH_BYTES ],
|
||||
const uint8_t ucMACAddress[ ipMAC_ADDRESS_LENGTH_BYTES ] );
|
||||
|
||||
|
||||
/*
|
||||
* Returns the addresses stored in an end-point structure.
|
||||
* This function already existed in the release with the single-interface.
|
||||
* Only the first parameters is new: an end-point
|
||||
*/
|
||||
void FreeRTOS_GetEndPointConfiguration( uint32_t * pulIPAddress,
|
||||
uint32_t * pulNetMask,
|
||||
uint32_t * pulGatewayAddress,
|
||||
uint32_t * pulDNSServerAddress,
|
||||
struct xNetworkEndPoint * pxEndPoint );
|
||||
|
||||
void FreeRTOS_SetEndPointConfiguration( const uint32_t * pulIPAddress,
|
||||
const uint32_t * pulNetMask,
|
||||
const uint32_t * pulGatewayAddress,
|
||||
const uint32_t * pulDNSServerAddress,
|
||||
struct xNetworkEndPoint * pxEndPoint );
|
||||
|
||||
TaskHandle_t FreeRTOS_GetIPTaskHandle( void );
|
||||
|
||||
void * FreeRTOS_GetUDPPayloadBuffer( size_t uxRequestedSizeBytes,
|
||||
|
||||
@@ -106,23 +106,6 @@ eFrameProcessingResult_t prvAllowIPPacketIPv6( const IPHeader_IPv6_t * const pxI
|
||||
eFrameProcessingResult_t eHandleIPv6ExtensionHeaders( NetworkBufferDescriptor_t * const pxNetworkBuffer,
|
||||
BaseType_t xDoRemove );
|
||||
|
||||
/*
|
||||
* Returns the addresses stored in an end-point structure.
|
||||
* This function already existed in the release with the single-interface.
|
||||
* Only the first parameters is new: an end-point
|
||||
*/
|
||||
void FreeRTOS_GetEndPointConfiguration( uint32_t * pulIPAddress,
|
||||
uint32_t * pulNetMask,
|
||||
uint32_t * pulGatewayAddress,
|
||||
uint32_t * pulDNSServerAddress,
|
||||
struct xNetworkEndPoint * pxEndPoint );
|
||||
|
||||
void FreeRTOS_SetEndPointConfiguration( const uint32_t * pulIPAddress,
|
||||
const uint32_t * pulNetMask,
|
||||
const uint32_t * pulGatewayAddress,
|
||||
const uint32_t * pulDNSServerAddress,
|
||||
struct xNetworkEndPoint * pxEndPoint );
|
||||
|
||||
/* Return true if a given end-point is up and running.
|
||||
* When FreeRTOS_IsNetworkUp() is called with NULL as a parameter,
|
||||
* it will return pdTRUE when all end-points are up. */
|
||||
|
||||
Reference in New Issue
Block a user