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 /** @brief A list of all network end-points. Each element has a next pointer. */
16 struct xNetworkEndPoint * pxNetworkEndPoints = NULL;
17
18 NetworkBufferDescriptor_t * pxARPWaitingNetworkBuffer = NULL;
19
20 volatile BaseType_t xInsideInterrupt = pdFALSE;
21
22 /** @brief The expected IP version and header length coded into the IP header itself. */
23 #define ipIP_VERSION_AND_HEADER_LENGTH_BYTE ( ( uint8_t ) 0x45 )
24
25 UDPPacketHeader_t xDefaultPartUDPPacketHeader =
26 {
27 /* .ucBytes : */
28 {
29 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, /* Ethernet source MAC address. */
30 0x08, 0x00, /* Ethernet frame type. */
31 ipIP_VERSION_AND_HEADER_LENGTH_BYTE, /* ucVersionHeaderLength. */
32 0x00, /* ucDifferentiatedServicesCode. */
33 0x00, 0x00, /* usLength. */
34 0x00, 0x00, /* usIdentification. */
35 0x00, 0x00, /* usFragmentOffset. */
36 ipconfigUDP_TIME_TO_LIVE, /* ucTimeToLive */
37 ipPROTOCOL_UDP, /* ucProtocol. */
38 0x00, 0x00, /* usHeaderChecksum. */
39 0x00, 0x00, 0x00, 0x00 /* Source IP address. */
40 }
41 };
42
43 /** @brief For convenience, a MAC address of all 0xffs is defined const for quick
44 * reference. */
45 const MACAddress_t xBroadcastMACAddress = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
46
47 /** @brief Structure that stores the netmask, gateway address and DNS server addresses. */
48 NetworkAddressingParameters_t xNetworkAddressing =
49 {
50 0xC0C0C0C0, /* 192.192.192.192 - Default IP address. */
51 0xFFFFFF00, /* 255.255.255.0 - Netmask. */
52 0xC0C0C001, /* 192.192.192.1 - Gateway Address. */
53 0x01020304, /* 1.2.3.4 - DNS server address. */
54 0xC0C0C0FF
55 }; /* 192.192.192.255 - Broadcast address. */
56
57 /* ======================== Stub Callback Functions ========================= */
58
xPortGetMinimumEverFreeHeapSize(void)59 size_t xPortGetMinimumEverFreeHeapSize( void )
60 {
61 return 0;
62 }
63
64
xApplicationDNSQueryHook_Multi(struct xNetworkEndPoint * pxEndPoint,const char * pcName)65 BaseType_t xApplicationDNSQueryHook_Multi( struct xNetworkEndPoint * pxEndPoint,
66 const char * pcName )
67 {
68 }
69
pxPortInitialiseStack(StackType_t * pxTopOfStack,StackType_t * pxEndOfStack,TaskFunction_t pxCode,void * pvParameters)70 StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
71 StackType_t * pxEndOfStack,
72 TaskFunction_t pxCode,
73 void * pvParameters )
74 {
75 }
76
pcApplicationHostnameHook(void)77 const char * pcApplicationHostnameHook( void )
78 {
79 }
ulApplicationGetNextSequenceNumber(uint32_t ulSourceAddress,uint16_t usSourcePort,uint32_t ulDestinationAddress,uint16_t usDestinationPort)80 uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
81 uint16_t usSourcePort,
82 uint32_t ulDestinationAddress,
83 uint16_t usDestinationPort )
84 {
85 }
xNetworkInterfaceInitialise(void)86 BaseType_t xNetworkInterfaceInitialise( void )
87 {
88 }
89 /* This function shall be defined by the application. */
vApplicationIPNetworkEventHook_Multi(eIPCallbackEvent_t eNetworkEvent,struct xNetworkEndPoint * pxEndPoint)90 void vApplicationIPNetworkEventHook_Multi( eIPCallbackEvent_t eNetworkEvent,
91 struct xNetworkEndPoint * pxEndPoint )
92 {
93 }
xApplicationGetRandomNumber(uint32_t * pulNumber)94 BaseType_t xApplicationGetRandomNumber( uint32_t * pulNumber )
95 {
96 }
vApplicationDaemonTaskStartupHook(void)97 void vApplicationDaemonTaskStartupHook( void )
98 {
99 }
vApplicationGetTimerTaskMemory(StaticTask_t ** ppxTimerTaskTCBBuffer,StackType_t ** ppxTimerTaskStackBuffer,uint32_t * pulTimerTaskStackSize)100 void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
101 StackType_t ** ppxTimerTaskStackBuffer,
102 uint32_t * pulTimerTaskStackSize )
103 {
104 }
vPortDeleteThread(void * pvTaskToDelete)105 void vPortDeleteThread( void * pvTaskToDelete )
106 {
107 }
vApplicationIdleHook(void)108 void vApplicationIdleHook( void )
109 {
110 }
vApplicationTickHook(void)111 void vApplicationTickHook( void )
112 {
113 }
ulGetRunTimeCounterValue(void)114 unsigned long ulGetRunTimeCounterValue( void )
115 {
116 }
vPortEndScheduler(void)117 void vPortEndScheduler( void )
118 {
119 }
xPortStartScheduler(void)120 BaseType_t xPortStartScheduler( void )
121 {
122 }
vPortEnterCritical(void)123 void vPortEnterCritical( void )
124 {
125 }
vPortExitCritical(void)126 void vPortExitCritical( void )
127 {
128 }
129
pvPortMalloc(size_t xWantedSize)130 void * pvPortMalloc( size_t xWantedSize )
131 {
132 return malloc( xWantedSize );
133 }
134
vPortFree(void * pv)135 void vPortFree( void * pv )
136 {
137 free( pv );
138 }
139
vPortGenerateSimulatedInterrupt(uint32_t ulInterruptNumber)140 void vPortGenerateSimulatedInterrupt( uint32_t ulInterruptNumber )
141 {
142 }
vPortCloseRunningThread(void * pvTaskToDelete,volatile BaseType_t * pxPendYield)143 void vPortCloseRunningThread( void * pvTaskToDelete,
144 volatile BaseType_t * pxPendYield )
145 {
146 }
vApplicationGetIdleTaskMemory(StaticTask_t ** ppxIdleTaskTCBBuffer,StackType_t ** ppxIdleTaskStackBuffer,uint32_t * pulIdleTaskStackSize)147 void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
148 StackType_t ** ppxIdleTaskStackBuffer,
149 uint32_t * pulIdleTaskStackSize )
150 {
151 }
vConfigureTimerForRunTimeStats(void)152 void vConfigureTimerForRunTimeStats( void )
153 {
154 }
155
156
xNetworkInterfaceOutput(NetworkInterface_t * pxInterface,NetworkBufferDescriptor_t * const pxNetworkBuffer,BaseType_t bReleaseAfterSend)157 BaseType_t xNetworkInterfaceOutput( NetworkInterface_t * pxInterface,
158 NetworkBufferDescriptor_t * const pxNetworkBuffer,
159 BaseType_t bReleaseAfterSend )
160 {
161 return pdPASS;
162 }
163
164 /**
165 * @brief Send an ND advertisement.
166 * @param[in] pxEndPoint: The end-point for which an ND advertisement should be sent.
167 */
FreeRTOS_OutputAdvertiseIPv6(NetworkEndPoint_t * pxEndPoint)168 void FreeRTOS_OutputAdvertiseIPv6( NetworkEndPoint_t * pxEndPoint )
169 {
170 }
171 /*-----------------------------------------------------------*/
172