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 /* =========================== EXTERN VARIABLES =========================== */
16
17 BaseType_t NetworkInterfaceOutputFunction_Stub_Called = 0;
18
19 /* ======================== Stub Callback Functions ========================= */
20
NetworkInterfaceOutputFunction_Stub(struct xNetworkInterface * pxDescriptor,NetworkBufferDescriptor_t * const pxNetworkBuffer,BaseType_t xReleaseAfterSend)21 BaseType_t NetworkInterfaceOutputFunction_Stub( struct xNetworkInterface * pxDescriptor,
22 NetworkBufferDescriptor_t * const pxNetworkBuffer,
23 BaseType_t xReleaseAfterSend )
24 {
25 NetworkInterfaceOutputFunction_Stub_Called++;
26 return 0;
27 }
28
29 /**
30 * @brief Called by prvTCPReturnPacket(), this function makes sure that the network buffer
31 * has 'pxEndPoint' set properly.
32 * @param[in] pxSocket The socket on which the packet is being sent.
33 * @param[in] pxNetworkBuffer The network buffer carrying the outgoing message.
34 * @param[in] uxIPHeaderSize The size of the IP-header, which depends on the IP-type.
35 */
prvTCPReturn_SetEndPoint(const FreeRTOS_Socket_t * pxSocket,NetworkBufferDescriptor_t * pxNetworkBuffer,size_t uxIPHeaderSize)36 void prvTCPReturn_SetEndPoint( const FreeRTOS_Socket_t * pxSocket,
37 NetworkBufferDescriptor_t * pxNetworkBuffer,
38 size_t uxIPHeaderSize )
39 {
40 const IPHeader_IPv6_t * pxIPHeader_IPv6 = NULL;
41
42 if( ( pxSocket != NULL ) && ( pxSocket->pxEndPoint != NULL ) )
43 {
44 pxNetworkBuffer->pxEndPoint = pxSocket->pxEndPoint;
45 }
46 else
47 {
48 /* Not able to find the endpoint */
49 pxNetworkBuffer->pxEndPoint = NULL;
50 }
51 }
52
53 /**
54 * Called by prvTCPReturnPacket(), this function will set the the window
55 * size on this side: 'xTCPHeader.usWindow'.
56 */
prvTCPReturn_CheckTCPWindow(FreeRTOS_Socket_t * pxSocket,const NetworkBufferDescriptor_t * pxNetworkBuffer,size_t uxIPHeaderSize)57 void prvTCPReturn_CheckTCPWindow( FreeRTOS_Socket_t * pxSocket,
58 const NetworkBufferDescriptor_t * pxNetworkBuffer,
59 size_t uxIPHeaderSize )
60 {
61 }
62
63 /*
64 * Called by prvTCPReturnPacket(), this function sets the sequence and ack numbers
65 * in the TCP-header.
66 */
prvTCPReturn_SetSequenceNumber(FreeRTOS_Socket_t * pxSocket,const NetworkBufferDescriptor_t * pxNetworkBuffer,size_t uxIPHeaderSize,uint32_t ulLen)67 void prvTCPReturn_SetSequenceNumber( FreeRTOS_Socket_t * pxSocket,
68 const NetworkBufferDescriptor_t * pxNetworkBuffer,
69 size_t uxIPHeaderSize,
70 uint32_t ulLen )
71 {
72 }
73
74 /*
75 * Initialise the data structures which keep track of the TCP windowing system.
76 */
prvTCPCreateWindow(FreeRTOS_Socket_t * pxSocket)77 void prvTCPCreateWindow( FreeRTOS_Socket_t * pxSocket )
78 {
79 }
80
81 /*
82 * Return or send a packet to the other party.
83 */
prvTCPReturnPacket(FreeRTOS_Socket_t * pxSocket,NetworkBufferDescriptor_t * pxDescriptor,uint32_t ulLen,BaseType_t xReleaseAfterSend)84 void prvTCPReturnPacket( FreeRTOS_Socket_t * pxSocket,
85 NetworkBufferDescriptor_t * pxDescriptor,
86 uint32_t ulLen,
87 BaseType_t xReleaseAfterSend )
88 {
89 }
90