Skip to content

Commit

Permalink
Changed resolution enum name
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Aug 1, 2024
1 parent afd4666 commit 9d5ec49
Show file tree
Hide file tree
Showing 20 changed files with 193 additions and 193 deletions.
64 changes: 32 additions & 32 deletions source/FreeRTOS_ARP.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@
/*
* Lookup an MAC address in the ARP cache from the IP address.
*/
static eAddrResLookupResult_t prvCacheLookup( uint32_t ulAddressToLookup,
static eResolutionLookupResult_t prvCacheLookup( uint32_t ulAddressToLookup,
MACAddress_t * const pxMACAddress,
NetworkEndPoint_t ** ppxEndPoint );

static eAddrResLookupResult_t eARPGetCacheEntryGateWay( uint32_t * pulIPAddress,
static eResolutionLookupResult_t eARPGetCacheEntryGateWay( uint32_t * pulIPAddress,
MACAddress_t * const pxMACAddress,
struct xNetworkEndPoint ** ppxEndPoint );

Expand Down Expand Up @@ -318,7 +318,7 @@
/* The request is a Gratuitous ARP message.
* Refresh the entry if it already exists. */
/* Determine the ARP cache status for the requested IP address. */
if( eARPGetCacheEntry( &( ulSenderProtocolAddress ), &( xHardwareAddress ), &( pxCachedEndPoint ) ) == eAddrResCacheHit )
if( eARPGetCacheEntry( &( ulSenderProtocolAddress ), &( xHardwareAddress ), &( pxCachedEndPoint ) ) == eResolutionCacheHit )
{
/* Check if the endpoint matches with the one present in the ARP cache */
if( pxCachedEndPoint == pxTargetEndPoint )
Expand Down Expand Up @@ -819,14 +819,14 @@
* @param[in] pxMACAddress The MAC-address of the entry of interest.
* @param[out] pulIPAddress set to the IP-address found, or unchanged when not found.
*
* @return Either eAddrResCacheMiss or eAddrResCacheHit.
* @return Either eResolutionCacheMiss or eResolutionCacheHit.
*/
eAddrResLookupResult_t eARPGetCacheEntryByMac( const MACAddress_t * const pxMACAddress,
eResolutionLookupResult_t eARPGetCacheEntryByMac( const MACAddress_t * const pxMACAddress,
uint32_t * pulIPAddress,
struct xNetworkInterface ** ppxInterface )
{
BaseType_t x;
eAddrResLookupResult_t eReturn = eResolutionCacheMiss;
eResolutionLookupResult_t eReturn = eResolutionCacheMiss;

configASSERT( pxMACAddress != NULL );
configASSERT( pulIPAddress != NULL );
Expand All @@ -851,7 +851,7 @@
*( ppxInterface ) = xARPCache[ x ].pxEndPoint->pxNetworkInterface;
}

eReturn = eAddrResCacheHit;
eReturn = eResolutionCacheHit;
break;
}
}
Expand All @@ -871,17 +871,17 @@
* @param[out] ppxEndPoint Pointer to the end-point of the gateway will be stored.
*
* @return If the IP address exists, copy the associated MAC address into pxMACAddress,
* refresh the ARP cache entry's age, and return eAddrResCacheHit. If the IP
* address does not exist in the ARP cache return eAddrResCacheMiss. If the packet
* refresh the ARP cache entry's age, and return eResolutionCacheHit. If the IP
* address does not exist in the ARP cache return eResolutionCacheMiss. If the packet
* cannot be sent for any reason (maybe DHCP is still in process, or the
* addressing needs a gateway but there isn't a gateway defined) then return
* eCantSendPacket.
* eResolutionFailed.
*/
eAddrResLookupResult_t eARPGetCacheEntry( uint32_t * pulIPAddress,
eResolutionLookupResult_t eARPGetCacheEntry( uint32_t * pulIPAddress,
MACAddress_t * const pxMACAddress,
struct xNetworkEndPoint ** ppxEndPoint )
{
eAddrResLookupResult_t eReturn;
eResolutionLookupResult_t eReturn;
uint32_t ulAddressToLookup;
NetworkEndPoint_t * pxEndPoint = NULL;

Expand All @@ -898,7 +898,7 @@
/* Get the lowest 23 bits of the IP-address. */
vSetMultiCastIPv4MacAddress( ulAddressToLookup, pxMACAddress );

eReturn = eCantSendPacket;
eReturn = eResolutionFailed;
pxEndPoint = FreeRTOS_FirstEndPoint( NULL );

for( ;
Expand All @@ -909,7 +909,7 @@
{
/* For multi-cast, use the first IPv4 end-point. */
*( ppxEndPoint ) = pxEndPoint;
eReturn = eAddrResCacheHit;
eReturn = eResolutionCacheHit;
break;
}
}
Expand All @@ -925,7 +925,7 @@
*( ppxEndPoint ) = pxEndPoint;
}

eReturn = eAddrResCacheHit;
eReturn = eResolutionCacheHit;
}
else
{
Expand All @@ -944,11 +944,11 @@
* stored to the buffer provided.
* @param[out] ppxEndPoint The end-point of the gateway will be copy to the pointee.
*/
static eAddrResLookupResult_t eARPGetCacheEntryGateWay( uint32_t * pulIPAddress,
static eResolutionLookupResult_t eARPGetCacheEntryGateWay( uint32_t * pulIPAddress,
MACAddress_t * const pxMACAddress,
struct xNetworkEndPoint ** ppxEndPoint )
{
eAddrResLookupResult_t eReturn = eAddrResCacheMiss;
eResolutionLookupResult_t eReturn = eResolutionCacheMiss;
uint32_t ulAddressToLookup = *( pulIPAddress );
NetworkEndPoint_t * pxEndPoint;
uint32_t ulOriginal = *pulIPAddress;
Expand All @@ -963,7 +963,7 @@
#if ( ipconfigARP_STORES_REMOTE_ADDRESSES == 1 )
eReturn = prvCacheLookup( ulAddressToLookup, pxMACAddress, ppxEndPoint );

if( eReturn == eAddrResCacheHit )
if( eReturn == eResolutionCacheHit )
{
/* The stack is configured to store 'remote IP addresses', i.e. addresses
* belonging to a different the netmask. prvCacheLookup() returned a hit, so
Expand Down Expand Up @@ -996,24 +996,24 @@
}

#if ( ipconfigARP_STORES_REMOTE_ADDRESSES == 1 )
if( eReturn == eAddrResCacheMiss )
if( eReturn == eResolutionCacheMiss )
#endif
{
if( ulAddressToLookup == 0U )
{
/* The address is not on the local network, and there is not a
* router. */
eReturn = eCantSendPacket;
eReturn = eResolutionFailed;
}
else
{
eReturn = prvCacheLookup( ulAddressToLookup, pxMACAddress, ppxEndPoint );

if( ( eReturn != eAddrResCacheHit ) || ( ulOriginal != ulAddressToLookup ) )
if( ( eReturn != eResolutionCacheHit ) || ( ulOriginal != ulAddressToLookup ) )
{
FreeRTOS_debug_printf( ( "ARP %xip %s using %xip\n",
( unsigned ) FreeRTOS_ntohl( ulOriginal ),
( eReturn == eAddrResCacheHit ) ? "hit" : "miss",
( eReturn == eResolutionCacheHit ) ? "hit" : "miss",
( unsigned ) FreeRTOS_ntohl( ulAddressToLookup ) ) );
}

Expand All @@ -1036,15 +1036,15 @@
* the IP address will be stored.
* @param[in,out] ppxEndPoint a pointer to the end-point will be stored.
*
* @return When the IP-address is found: eAddrResCacheHit, when not found: eAddrResCacheMiss,
* and when waiting for a ARP reply: eCantSendPacket.
* @return When the IP-address is found: eResolutionCacheHit, when not found: eResolutionCacheMiss,
* and when waiting for a ARP reply: eResolutionFailed.
*/
static eAddrResLookupResult_t prvCacheLookup( uint32_t ulAddressToLookup,
static eResolutionLookupResult_t prvCacheLookup( uint32_t ulAddressToLookup,
MACAddress_t * const pxMACAddress,
NetworkEndPoint_t ** ppxEndPoint )
{
BaseType_t x;
eAddrResLookupResult_t eReturn = eAddrResCacheMiss;
eResolutionLookupResult_t eReturn = eResolutionCacheMiss;

/* Loop through each entry in the ARP cache. */
for( x = 0; x < ipconfigARP_CACHE_ENTRIES; x++ )
Expand All @@ -1057,15 +1057,15 @@
if( xARPCache[ x ].ucValid == ( uint8_t ) pdFALSE )
{
/* This entry is waiting an ARP reply, so is not valid. */
eReturn = eCantSendPacket;
eReturn = eResolutionFailed;
}
else
{
/* A valid entry was found. */
( void ) memcpy( pxMACAddress->ucBytes, xARPCache[ x ].xMACAddress.ucBytes, sizeof( MACAddress_t ) );
/* ppxEndPoint != NULL was tested in the only caller eARPGetCacheEntry(). */
*( ppxEndPoint ) = xARPCache[ x ].pxEndPoint;
eReturn = eAddrResCacheHit;
eReturn = eResolutionCacheHit;
}

break;
Expand Down Expand Up @@ -1274,7 +1274,7 @@
BaseType_t xResult = -pdFREERTOS_ERRNO_EADDRNOTAVAIL;
TimeOut_t xTimeOut;
MACAddress_t xMACAddress;
eAddrResLookupResult_t xLookupResult;
eResolutionLookupResult_t xLookupResult;
NetworkEndPoint_t * pxEndPoint;
size_t uxSendCount = ipconfigMAX_ARP_RETRANSMISSIONS;
uint32_t ulIPAddressCopy = ulIPAddress;
Expand All @@ -1284,7 +1284,7 @@

xLookupResult = eARPGetCacheEntry( &( ulIPAddressCopy ), &( xMACAddress ), &( pxEndPoint ) );

if( xLookupResult == eAddrResCacheMiss )
if( xLookupResult == eResolutionCacheMiss )
{
const TickType_t uxSleepTime = pdMS_TO_TICKS( 250U );

Expand All @@ -1300,7 +1300,7 @@
xLookupResult = eARPGetCacheEntry( &( ulIPAddressCopy ), &( xMACAddress ), &( pxEndPoint ) );

if( ( xTaskCheckForTimeOut( &( xTimeOut ), &( uxTicksToWait ) ) == pdTRUE ) ||
( xLookupResult != eAddrResCacheMiss ) )
( xLookupResult != eResolutionCacheMiss ) )
{
break;
}
Expand All @@ -1310,7 +1310,7 @@
}
}

if( xLookupResult == eAddrResCacheHit )
if( xLookupResult == eResolutionCacheHit )
{
xResult = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion source/FreeRTOS_IP.c
Original file line number Diff line number Diff line change
Expand Up @@ -2101,7 +2101,7 @@ void vReturnEthernetFrame( NetworkBufferDescriptor_t * pxNetworkBuffer,

#if ( ipconfigUSE_IPv4 != 0 )
MACAddress_t xMACAddress;
eAddrResLookupResult_t eResult;
eResolutionLookupResult_t eResult;
uint32_t ulDestinationIPAddress = 0U;
#endif /* ( ipconfigUSE_IPv4 != 0 ) */

Expand Down
44 changes: 22 additions & 22 deletions source/FreeRTOS_ND.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@
const uint8_t pcLOCAL_ALL_NODES_MULTICAST_MAC[ ipMAC_ADDRESS_LENGTH_BYTES ] = { 0x33U, 0x33U, 0x00U, 0x00U, 0x00U, 0x01U };

/** @brief See if the MAC-address can be resolved because it is a multi-cast address. */
static eAddrResLookupResult_t prvMACResolve( const IPv6_Address_t * pxAddressToLookup,
static eResolutionLookupResult_t prvMACResolve( const IPv6_Address_t * pxAddressToLookup,
MACAddress_t * const pxMACAddress,
NetworkEndPoint_t ** ppxEndPoint );

/** @brief Lookup an MAC address in the ND cache from the IP address. */
static eAddrResLookupResult_t prvNDCacheLookup( const IPv6_Address_t * pxAddressToLookup,
static eResolutionLookupResult_t prvNDCacheLookup( const IPv6_Address_t * pxAddressToLookup,
MACAddress_t * const pxMACAddress,
NetworkEndPoint_t ** ppxEndPoint );

Expand Down Expand Up @@ -140,13 +140,13 @@
* @param[out] pxMACAddress The resulting MAC-address is stored here.
* @param[out] ppxEndPoint A pointer to an end-point pointer where the end-point will be stored.
*
* @return An enum, either eAddrResCacheHit or eAddrResCacheMiss.
* @return An enum, either eResolutionCacheHit or eResolutionCacheMiss.
*/
static eAddrResLookupResult_t prvMACResolve( const IPv6_Address_t * pxAddressToLookup,
static eResolutionLookupResult_t prvMACResolve( const IPv6_Address_t * pxAddressToLookup,
MACAddress_t * const pxMACAddress,
NetworkEndPoint_t ** ppxEndPoint )
{
eAddrResLookupResult_t eReturn;
eResolutionLookupResult_t eReturn;

/* Mostly used multi-cast address is ff02::. */
if( xIsIPv6AllowedMulticast( pxAddressToLookup ) != pdFALSE )
Expand All @@ -158,12 +158,12 @@
*ppxEndPoint = pxFindLocalEndpoint();
}

eReturn = eAddrResCacheHit;
eReturn = eResolutionCacheHit;
}
else
{
/* Not a multicast IP address. */
eReturn = eAddrResCacheMiss;
eReturn = eResolutionCacheMiss;
}

return eReturn;
Expand All @@ -178,30 +178,30 @@
* @param[out] pxMACAddress The MAC-address found.
* @param[out] ppxEndPoint A pointer to a pointer to an end-point, where the end-point will be stored.
*
* @return An enum which says whether the address was found: eAddrResCacheHit or eAddrResCacheMiss.
* @return An enum which says whether the address was found: eResolutionCacheHit or eResolutionCacheMiss.
*/
eAddrResLookupResult_t eNDGetCacheEntry( IPv6_Address_t * pxIPAddress,
eResolutionLookupResult_t eNDGetCacheEntry( IPv6_Address_t * pxIPAddress,
MACAddress_t * const pxMACAddress,
struct xNetworkEndPoint ** ppxEndPoint )
{
eAddrResLookupResult_t eReturn;
eResolutionLookupResult_t eReturn;
NetworkEndPoint_t * pxEndPoint;

/* Multi-cast addresses can be resolved immediately. */
eReturn = prvMACResolve( pxIPAddress, pxMACAddress, ppxEndPoint );

if( eReturn == eAddrResCacheMiss )
if( eReturn == eResolutionCacheMiss )
{
/* See if the IP-address has an entry in the cache. */
eReturn = prvNDCacheLookup( pxIPAddress, pxMACAddress, ppxEndPoint );
}

if( eReturn == eAddrResCacheMiss )
if( eReturn == eResolutionCacheMiss )
{
FreeRTOS_printf( ( "eNDGetCacheEntry: lookup %pip miss\n", ( void * ) pxIPAddress->ucBytes ) );
}

if( eReturn == eAddrResCacheMiss )
if( eReturn == eResolutionCacheMiss )
{
IPv6_Type_t eIPType = xIPv6_GetIPType( pxIPAddress );

Expand Down Expand Up @@ -236,7 +236,7 @@
}

FreeRTOS_printf( ( "eNDGetCacheEntry: LinkLocal %pip \"%s\"\n", ( void * ) pxIPAddress->ucBytes,
( eReturn == eAddrResCacheHit ) ? "hit" : "miss" ) );
( eReturn == eResolutionCacheHit ) ? "hit" : "miss" ) );
}
else
{
Expand Down Expand Up @@ -446,14 +446,14 @@
* @param[out] pxMACAddress The resulting MAC-address will be stored here.
* @param[out] ppxEndPoint A pointer to a pointer to an end-point, where the end-point will be stored.
*
* @return An enum: either eAddrResCacheHit or eAddrResCacheMiss.
* @return An enum: either eResolutionCacheHit or eResolutionCacheMiss.
*/
static eAddrResLookupResult_t prvNDCacheLookup( const IPv6_Address_t * pxAddressToLookup,
static eResolutionLookupResult_t prvNDCacheLookup( const IPv6_Address_t * pxAddressToLookup,
MACAddress_t * const pxMACAddress,
NetworkEndPoint_t ** ppxEndPoint )
{
BaseType_t x;
eAddrResLookupResult_t eReturn = eAddrResCacheMiss;
eResolutionLookupResult_t eReturn = eResolutionCacheMiss;

/* For each entry in the ND cache table. */
for( x = 0; x < ipconfigND_CACHE_ENTRIES; x++ )
Expand All @@ -465,7 +465,7 @@
else if( memcmp( xNDCache[ x ].xIPAddress.ucBytes, pxAddressToLookup->ucBytes, ipSIZE_OF_IPv6_ADDRESS ) == 0 )
{
( void ) memcpy( pxMACAddress->ucBytes, xNDCache[ x ].xMACAddress.ucBytes, sizeof( MACAddress_t ) );
eReturn = eAddrResCacheHit;
eReturn = eResolutionCacheHit;

if( ppxEndPoint != NULL )
{
Expand All @@ -489,7 +489,7 @@
}
}

if( eReturn == eAddrResCacheMiss )
if( eReturn == eResolutionCacheMiss )
{
FreeRTOS_printf( ( "prvNDCacheLookup %pip Miss\n", ( void * ) pxAddressToLookup->ucBytes ) );

Expand Down Expand Up @@ -1366,14 +1366,14 @@
{
MACAddress_t xMACAddress;
NetworkEndPoint_t * pxEndPoint;
eAddrResLookupResult_t eResult;
eResolutionLookupResult_t eResult;
char pcName[ 80 ];

( void ) memset( &( pcName ), 0, sizeof( pcName ) );
eResult = eNDGetCacheEntry( pxIPAddress, &xMACAddress, &pxEndPoint );
FreeRTOS_printf( ( "xCheckRequiresNDResolution: eResult %s with EP %s\n", ( eResult == eAddrResCacheMiss ) ? "Miss" : ( eResult == eAddrResCacheHit ) ? "Hit" : "Error", pcEndpointName( pxEndPoint, pcName, sizeof pcName ) ) );
FreeRTOS_printf( ( "xCheckRequiresNDResolution: eResult %s with EP %s\n", ( eResult == eResolutionCacheMiss ) ? "Miss" : ( eResult == eResolutionCacheHit ) ? "Hit" : "Error", pcEndpointName( pxEndPoint, pcName, sizeof pcName ) ) );

if( eResult == eAddrResCacheMiss )
if( eResult == eResolutionCacheMiss )
{
NetworkBufferDescriptor_t * pxTempBuffer;
size_t uxNeededSize;
Expand Down
4 changes: 2 additions & 2 deletions source/FreeRTOS_TCP_Transmission_IPv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void prvTCPReturnPacket_IPV4( FreeRTOS_Socket_t * pxSocket,
void * pvCopyDest = NULL;
const size_t uxIPHeaderSize = ipSIZE_OF_IPv4_HEADER;
uint32_t ulDestinationIPAddress;
eAddrResLookupResult_t eResult;
eResolutionLookupResult_t eResult;
NetworkEndPoint_t * pxEndPoint = NULL;

do
Expand Down Expand Up @@ -355,7 +355,7 @@ BaseType_t prvTCPPrepareConnect_IPV4( FreeRTOS_Socket_t * pxSocket )
break; /* We can now prepare the SYN packet. */

case eResolutionCacheMiss: /* An ARP table lookup did not find a valid entry. */
case eCantSendPacket: /* There is no IP address, or an ARP is still in progress. */
case eResolutionFailed: /* There is no IP address, or an ARP is still in progress. */
default:
/* Count the number of times it could not find the ARP address. */
pxSocket->u.xTCP.ucRepCount++;
Expand Down
Loading

0 comments on commit 9d5ec49

Please sign in to comment.