xref: /FreeRTOS-Plus-TCP-v4.0.0/test/unit-test/FreeRTOS_TCP_WIN/FreeRTOS_TCP_WIN_stubs.c (revision 2d3f4daa567ffe71aeda2e0f6d0bc02850db0627)
1 /* Include Unity header */
2 #include <unity.h>
3 
4 /* Include standard libraries */
5 #include <stdlib.h>
6 #include <string.h>
7 #include <stdint.h>
8 #include "FreeRTOS.h"
9 #include "task.h"
10 #include "list.h"
11 
12 #include "FreeRTOS_IP.h"
13 #include "FreeRTOS_IP_Private.h"
14 
15 volatile BaseType_t xInsideInterrupt = pdFALSE;
16 
17 /** @brief The expected IP version and header length coded into the IP header itself. */
18 #define ipIP_VERSION_AND_HEADER_LENGTH_BYTE    ( ( uint8_t ) 0x45 )
19 
20 UDPPacketHeader_t xDefaultPartUDPPacketHeader =
21 {
22     /* .ucBytes : */
23     {
24         0x11, 0x22, 0x33, 0x44, 0x55, 0x66,  /* Ethernet source MAC address. */
25         0x08, 0x00,                          /* Ethernet frame type. */
26         ipIP_VERSION_AND_HEADER_LENGTH_BYTE, /* ucVersionHeaderLength. */
27         0x00,                                /* ucDifferentiatedServicesCode. */
28         0x00, 0x00,                          /* usLength. */
29         0x00, 0x00,                          /* usIdentification. */
30         0x00, 0x00,                          /* usFragmentOffset. */
31         ipconfigUDP_TIME_TO_LIVE,            /* ucTimeToLive */
32         ipPROTOCOL_UDP,                      /* ucProtocol. */
33         0x00, 0x00,                          /* usHeaderChecksum. */
34         0x00, 0x00, 0x00, 0x00               /* Source IP address. */
35     }
36 };
37 
38 
39 /*
40  * IP-clash detection is currently only used internally. When DHCP doesn't respond, the
41  * driver can try out a random LinkLayer IP address (169.254.x.x).  It will send out a
42  * gratuitous ARP message and, after a period of time, check the variables here below:
43  */
44 #if ( ipconfigARP_USE_CLASH_DETECTION != 0 )
45     /* Becomes non-zero if another device responded to a gratuitous ARP message. */
46     BaseType_t xARPHadIPClash;
47     /* MAC-address of the other device containing the same IP-address. */
48     MACAddress_t xARPClashMacAddress;
49 #endif /* ipconfigARP_USE_CLASH_DETECTION */
50 
51 
52 /** @brief For convenience, a MAC address of all 0xffs is defined const for quick
53  * reference. */
54 const MACAddress_t xBroadcastMACAddress = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
55 
56 /** @brief Structure that stores the netmask, gateway address and DNS server addresses. */
57 NetworkAddressingParameters_t xNetworkAddressing =
58 {
59     0xC0C0C0C0, /* 192.192.192.192 - Default IP address. */
60     0xFFFFFF00, /* 255.255.255.0 - Netmask. */
61     0xC0C0C001, /* 192.192.192.1 - Gateway Address. */
62     0x01020304, /* 1.2.3.4 - DNS server address. */
63     0xC0C0C0FF
64 };              /* 192.192.192.255 - Broadcast address. */
65 
66 /** @brief Structure that stores the netmask, gateway address and DNS server addresses. */
67 NetworkAddressingParameters_t xDefaultAddressing =
68 {
69     0xC0C0C0C0, /* 192.192.192.192 - Default IP address. */
70     0xFFFFFF00, /* 255.255.255.0 - Netmask. */
71     0xC0C0C001, /* 192.192.192.1 - Gateway Address. */
72     0x01020304, /* 1.2.3.4 - DNS server address. */
73     0xC0C0C0FF
74 };
75 
xPortGetMinimumEverFreeHeapSize(void)76 size_t xPortGetMinimumEverFreeHeapSize( void )
77 {
78     return 0;
79 }
80 
xApplicationDNSQueryHook_Multi(struct xNetworkEndPoint * pxEndPoint,const char * pcName)81 BaseType_t xApplicationDNSQueryHook_Multi( struct xNetworkEndPoint * pxEndPoint,
82                                            const char * pcName )
83 {
84     return 0;
85 }
86 
pxPortInitialiseStack(StackType_t * pxTopOfStack,StackType_t * pxEndOfStack,TaskFunction_t pxCode,void * pvParameters)87 StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
88                                      StackType_t * pxEndOfStack,
89                                      TaskFunction_t pxCode,
90                                      void * pvParameters )
91 {
92     return 0;
93 }
94 
ulApplicationGetNextSequenceNumber(uint32_t ulSourceAddress,uint16_t usSourcePort,uint32_t ulDestinationAddress,uint16_t usDestinationPort)95 uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
96                                              uint16_t usSourcePort,
97                                              uint32_t ulDestinationAddress,
98                                              uint16_t usDestinationPort )
99 {
100     return 0;
101 }
102 
xNetworkInterfaceInitialise(void)103 BaseType_t xNetworkInterfaceInitialise( void )
104 {
105     return 0;
106 }
107 
108 /* This function shall be defined by the application. */
vApplicationIPNetworkEventHook_Multi(eIPCallbackEvent_t eNetworkEvent,struct xNetworkEndPoint * pxEndPoint)109 void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
110                                            struct xNetworkEndPoint * pxEndPoint )
111 {
112 }
113 
vApplicationDaemonTaskStartupHook(void)114 void vApplicationDaemonTaskStartupHook( void )
115 {
116 }
117 
vApplicationGetTimerTaskMemory(StaticTask_t ** ppxTimerTaskTCBBuffer,StackType_t ** ppxTimerTaskStackBuffer,uint32_t * pulTimerTaskStackSize)118 void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
119                                      StackType_t ** ppxTimerTaskStackBuffer,
120                                      uint32_t * pulTimerTaskStackSize )
121 {
122 }
123 
vPortDeleteThread(void * pvTaskToDelete)124 void vPortDeleteThread( void * pvTaskToDelete )
125 {
126 }
127 
vApplicationIdleHook(void)128 void vApplicationIdleHook( void )
129 {
130 }
131 
vApplicationTickHook(void)132 void vApplicationTickHook( void )
133 {
134 }
135 
ulGetRunTimeCounterValue(void)136 unsigned long ulGetRunTimeCounterValue( void )
137 {
138     return 0;
139 }
140 
vPortEndScheduler(void)141 void vPortEndScheduler( void )
142 {
143 }
144 
xPortStartScheduler(void)145 BaseType_t xPortStartScheduler( void )
146 {
147     return 0;
148 }
149 
vPortEnterCritical(void)150 void vPortEnterCritical( void )
151 {
152 }
153 
vPortExitCritical(void)154 void vPortExitCritical( void )
155 {
156 }
157 
vPortGenerateSimulatedInterrupt(uint32_t ulInterruptNumber)158 void vPortGenerateSimulatedInterrupt( uint32_t ulInterruptNumber )
159 {
160 }
161 
vPortCloseRunningThread(void * pvTaskToDelete,volatile BaseType_t * pxPendYield)162 void vPortCloseRunningThread( void * pvTaskToDelete,
163                               volatile BaseType_t * pxPendYield )
164 {
165 }
166 
vApplicationGetIdleTaskMemory(StaticTask_t ** ppxIdleTaskTCBBuffer,StackType_t ** ppxIdleTaskStackBuffer,uint32_t * pulIdleTaskStackSize)167 void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
168                                     StackType_t ** ppxIdleTaskStackBuffer,
169                                     uint32_t * pulIdleTaskStackSize )
170 {
171 }
172 
vConfigureTimerForRunTimeStats(void)173 void vConfigureTimerForRunTimeStats( void )
174 {
175 }
176 
177 /*-----------------------------------------------------------*/
178