mirror of
https://github.com/FreeRTOS/FreeRTOS-Plus-TCP
synced 2025-10-23 10:07:43 +08:00

* use matching endpoint instead of first endpoint * update with @htibosch latest changes * fix formatting * fix misra and spellings * code clean up * wip separation IP * separation IP * separation IP * wip buils separation * fixing unit tests * fix unit tests * fix formatting * wip , next prvProcessNetworkDownEvent * adding build separation to ip utils * fix unit tests * fix formatting * update xCheckRequiresARPResolution * update vARPAgeCache * update vARPAgeCache * misra checks * fix formatting * fix misra * wip s/w: FreeRTOS_recvfrom * wip sockets till prvSocketBindAdd * adding build separation to FreeRTOS_Sockets.c * add build config support to FreeRTOS_inet_pton FreeRTOS_inet_ntop FreeRTOS_GetIPType * adding build config support * fix build issues * check misra * minor fix * fix unit tests * fix unit tests build * Uncrustify: triggered by comment * fix formatting * build separate FreeRTOS_TCP_IP.c * build separate FreeRTOS_TCP_Reception.c * misra fix * build separate FreeRTOS_TCP_State_Handling.c * build separate FreeRTOS_TCP_Transmission.c * build separate FreeRTOS_TCP_Transmission.c fix build * adding build separation for FreeRTOS_TCP_Utils.c and FreeRTOS_TCP_Transmission.c * fix formatting * UDP: Build Separation Changes Changes in UDP files to support IPv4 and IPv6 Build Separation. * fix IPv4 build issues post build sep merge * IPv4 only build * more - fix IPv4 build issues post build sep merge * fix DHCP v4 * fix v6 build * add v6 build checks * separate v4v6 tcp files * fix rebase conflicts * fix formatting * fix build when TCP disabled * add more build checks * adding more ipv4 flags to v4 specific files * fix udp unit tests * add build config build tests to CI * fix formatting * fix build checks yml * DNS: Build Separation Changes Changes for supporting IPv4 and IPv6 build separation in DNS. * Routing: Build Separtion Changes Changes for supporting IPv4 and IPv6 build separation in Routing. * DNS build fix and rebase to latest changes * fix formatting * fix unit tests * fix formatting * fix MISRA * updaating ARP functions to be available on all configs * plus_tcp_demo_cli build config changes * fix formatting, guard FreeRTOS_FillEndPoint inside ipconfigUSE_IPv4 check * more build sepration changes to routing * build separation plus_tcp_demo_cli.c * fixing issues with routing, fix formatting * adding pxFindEndpoint of plus_tcp_demo_cli inside ipconfigUSE_IPv6 != 0 check * minor build fix * moving usDNSType of endpoint struct out of ipconfigUSE_IPv6 check * update code to use IP family while using socket APIs * moving vSetMultiCastIPv4MacAddress to FreeRTOS_IPv4_Utils.c * fix routing * build DNS only if IPv4 is enabled * fix review feedback * fix build * fix build * fix formatting * fix comment * fix wrt reeview feedback * fix unit tests * cleanup FreeRTOS_MatchingEndpoint * fix FreeRTOS_MatchingEndpoint to handle cusstom frames --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: shubnil <103672514+shubnil@users.noreply.github.com>
69 lines
2.1 KiB
C
69 lines
2.1 KiB
C
/* Include Unity header */
|
|
#include "unity.h"
|
|
|
|
/* Include standard libraries */
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdint.h>
|
|
|
|
#include "FreeRTOSIPConfig.h"
|
|
|
|
#include "mock_FreeRTOS_IP.h"
|
|
#include "mock_FreeRTOS_Routing.h"
|
|
#include "mock_FreeRTOS_IP_Utils.h"
|
|
#include "mock_FreeRTOS_IP_Timers.h"
|
|
#include "mock_FreeRTOS_IP_Private.h"
|
|
#include "mock_task.h"
|
|
#include "mock_NetworkBufferManagement.h"
|
|
#include "mock_NetworkInterface.h"
|
|
#include "mock_ARP_DataLenLessThanMinPacket_list_macros.h"
|
|
#include "FreeRTOS_ARP_DataLenLessThanMinPacket_stubs.c"
|
|
|
|
#include "FreeRTOS_ARP.h"
|
|
|
|
#include "catch_assert.h"
|
|
|
|
static uint32_t uInterfaceOut_Called = 0;
|
|
|
|
BaseType_t xNetworkInterfaceOutput_ARP_Stub( NetworkInterface_t * pxInterface,
|
|
NetworkBufferDescriptor_t * const pxNetworkBuffer,
|
|
BaseType_t bReleaseAfterSend )
|
|
{
|
|
uInterfaceOut_Called = 1;
|
|
|
|
return pdTRUE_UNSIGNED;
|
|
}
|
|
|
|
|
|
void test_FreeRTOS_OutputARPRequest_MinimumPacketSizeLessThanARPPacket( void )
|
|
{
|
|
NetworkEndPoint_t xEndPoint = { 0 };
|
|
NetworkInterface_t xInterface;
|
|
uint8_t ucBuffer[ sizeof( ARPPacket_t ) + ipBUFFER_PADDING + ipconfigETHERNET_MINIMUM_PACKET_BYTES ];
|
|
NetworkBufferDescriptor_t xNetworkBuffer = { 0 };
|
|
uint32_t ulIPAddress = 0xAAAAAAAA;
|
|
|
|
xNetworkBuffer.pucEthernetBuffer = ucBuffer;
|
|
xNetworkBuffer.xDataLength = sizeof( ARPPacket_t );
|
|
|
|
xInterface.pfOutput = xNetworkInterfaceOutput_ARP_Stub;
|
|
|
|
xEndPoint.pxNetworkInterface = &xInterface;
|
|
xEndPoint.bits.bIPv6 = pdFALSE_UNSIGNED;
|
|
xEndPoint.ipv4_settings.ulIPAddress = 0xC0C0C0C0;
|
|
|
|
/* =================================================== */
|
|
|
|
FreeRTOS_FirstEndPoint_ExpectAndReturn( NULL, &xEndPoint );
|
|
|
|
pxGetNetworkBufferWithDescriptor_ExpectAndReturn( sizeof( ARPPacket_t ), 0, &xNetworkBuffer );
|
|
xIsCallingFromIPTask_IgnoreAndReturn( pdTRUE );
|
|
|
|
FreeRTOS_NextEndPoint_ExpectAndReturn( NULL, &xEndPoint, NULL );
|
|
|
|
FreeRTOS_OutputARPRequest( ulIPAddress );
|
|
|
|
TEST_ASSERT_EQUAL( uInterfaceOut_Called, 1 );
|
|
/* =================================================== */
|
|
}
|