From 17fc1546931b31dd1bd2b58a4b45772a20ec13c9 Mon Sep 17 00:00:00 2001 From: Hein Tibosch Date: Fri, 2 Sep 2022 14:04:30 +0800 Subject: [PATCH 1/7] IPv4/Single: Add a SocketID to a socket --- source/FreeRTOS_Sockets.c | 43 +++++++++++++++++++++++ source/include/FreeRTOSIPConfigDefaults.h | 8 +++++ source/include/FreeRTOS_IP_Private.h | 7 ++++ source/include/FreeRTOS_Sockets.h | 12 +++++++ 4 files changed, 70 insertions(+) diff --git a/source/FreeRTOS_Sockets.c b/source/FreeRTOS_Sockets.c index 48579124e6..97970a5971 100644 --- a/source/FreeRTOS_Sockets.c +++ b/source/FreeRTOS_Sockets.c @@ -4780,6 +4780,49 @@ BaseType_t xSocketValid( const ConstSocket_t xSocket ) #endif /* ipconfigUSE_TCP */ /*-----------------------------------------------------------*/ +#if( ipconfigUSE_SetSocketID != 0 ) +/** + * @brief Set the value of the SocketID of a socket. + * @param[in] xSocket: The socket whose ID should be set. + * @param[in] pvSocketID: The new value for the SocketID. + * @return Zero if the socket was valid, otherwise -EINVAL. + */ + BaseType_t xSocketSetSocketID( const Socket_t xSocket, void * pvSocketID ) + { + FreeRTOS_Socket_t * pxSocket = ( FreeRTOS_Socket_t * ) xSocket; + BaseType_t xReturn = -pdFREERTOS_ERRNO_EINVAL; + + if( xSocketValid( pxSocket ) ) + { + xReturn = 0; + pxSocket->pvSocketID = pvSocketID; + } + return xReturn; + } +#endif /* ipconfigUSE_SetSocketID */ +/*-----------------------------------------------------------*/ + +#if( ipconfigUSE_SetSocketID != 0 ) +/** + * @brief Retrieve the SocketID that is associated with a socket. + * @param[in] xSocket: The socket whose ID should be set. + * @return The current value of pvSocketID, or NULL in case + * the socket pointer is not valid. + */ + void * pvSocketGetSocketID( const ConstSocket_t xSocket ) + { + const FreeRTOS_Socket_t * pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; + void * pvReturn = NULL; + + if( xSocketValid( pxSocket ) ) + { + pvReturn = pxSocket->pvSocketID; + } + return pvReturn; + } +#endif /* ipconfigUSE_SetSocketID */ +/*-----------------------------------------------------------*/ + #if ( ( ipconfigHAS_PRINTF != 0 ) && ( ipconfigUSE_TCP == 1 ) ) /** diff --git a/source/include/FreeRTOSIPConfigDefaults.h b/source/include/FreeRTOSIPConfigDefaults.h index d830e03220..b3b40f4bd3 100644 --- a/source/include/FreeRTOSIPConfigDefaults.h +++ b/source/include/FreeRTOSIPConfigDefaults.h @@ -1068,4 +1068,12 @@ #define ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES 0 #endif +/* This option adds the possibility to have a user-ID attached to a socket. + * The type of this ID is a void *. Both UDP and TCP sockets have + * this ID. It has a default value of NULL. + */ +#ifndef ipconfigUSE_SetSocketID + #define ipconfigUSE_SetSocketID 0 +#endif + #endif /* FREERTOS_DEFAULT_IP_CONFIG_H */ diff --git a/source/include/FreeRTOS_IP_Private.h b/source/include/FreeRTOS_IP_Private.h index d3e970f553..9625f315ad 100644 --- a/source/include/FreeRTOS_IP_Private.h +++ b/source/include/FreeRTOS_IP_Private.h @@ -680,6 +680,13 @@ typedef struct xSOCKET EventBits_t xSocketBits; /**< These bits indicate the events which have actually occurred. * They are maintained by the IP-task */ #endif /* ipconfigSUPPORT_SELECT_FUNCTION */ + #if( ipconfigUSE_SetSocketID != 0 ) + /* This field is only only by the user, and can be accessed with + * vSocketSetSocketID() / vSocketGetSocketID(). + * All fields of a socket will be cleared by memset() in FreeRTOS_socket(). + */ + void * pvSocketID; + #endif /* TCP/UDP specific fields: */ /* Before accessing any member of this structure, it should be confirmed */ /* that the protocol corresponds with the type of structure */ diff --git a/source/include/FreeRTOS_Sockets.h b/source/include/FreeRTOS_Sockets.h index f3095268d1..4c6ef6a2b6 100644 --- a/source/include/FreeRTOS_Sockets.h +++ b/source/include/FreeRTOS_Sockets.h @@ -366,6 +366,18 @@ void FreeRTOS_netstat( void ); + #if( ipconfigUSE_SetSocketID != 0 ) +/* This option adds the possibility to have a user-ID attached to a socket. + * The type of this ID is a void *. Both UDP and TCP sockets have + * this ID. It has a default value of NULL. + */ + BaseType_t xSocketSetSocketID( const Socket_t xSocket, void * pvSocketID ); + #endif + + #if( ipconfigUSE_SetSocketID != 0 ) + void * pvSocketGetSocketID( const ConstSocket_t xSocket ); + #endif + /* End TCP Socket Attributes. */ From 05919a9c055f2fef3e776a1b9a89d4354d3170f8 Mon Sep 17 00:00:00 2001 From: Hein Tibosch Date: Fri, 2 Sep 2022 14:25:51 +0800 Subject: [PATCH 2/7] Change in comment --- source/FreeRTOS_Sockets.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/FreeRTOS_Sockets.c b/source/FreeRTOS_Sockets.c index 97970a5971..33b364d18d 100644 --- a/source/FreeRTOS_Sockets.c +++ b/source/FreeRTOS_Sockets.c @@ -4805,9 +4805,10 @@ BaseType_t xSocketValid( const ConstSocket_t xSocket ) #if( ipconfigUSE_SetSocketID != 0 ) /** * @brief Retrieve the SocketID that is associated with a socket. - * @param[in] xSocket: The socket whose ID should be set. + * @param[in] xSocket: The socket whose ID should be returned. * @return The current value of pvSocketID, or NULL in case - * the socket pointer is not valid. + * the socket pointer is not valid or when the ID was not + * yet set. */ void * pvSocketGetSocketID( const ConstSocket_t xSocket ) { From 8c57056b423959482b171f428fe11129b2193887 Mon Sep 17 00:00:00 2001 From: Hein Tibosch Date: Fri, 2 Sep 2022 15:24:36 +0800 Subject: [PATCH 3/7] Applied uncrustify to format the source code --- source/FreeRTOS_Sockets.c | 45 +++++++++++++---------- source/include/FreeRTOSIPConfigDefaults.h | 2 +- source/include/FreeRTOS_IP_Private.h | 11 +++--- source/include/FreeRTOS_Sockets.h | 14 ++++--- 4 files changed, 40 insertions(+), 32 deletions(-) diff --git a/source/FreeRTOS_Sockets.c b/source/FreeRTOS_Sockets.c index 33b364d18d..bffc2ec04b 100644 --- a/source/FreeRTOS_Sockets.c +++ b/source/FreeRTOS_Sockets.c @@ -4780,29 +4780,33 @@ BaseType_t xSocketValid( const ConstSocket_t xSocket ) #endif /* ipconfigUSE_TCP */ /*-----------------------------------------------------------*/ -#if( ipconfigUSE_SetSocketID != 0 ) +#if ( ipconfigUSE_SetSocketID != 0 ) + /** * @brief Set the value of the SocketID of a socket. * @param[in] xSocket: The socket whose ID should be set. * @param[in] pvSocketID: The new value for the SocketID. * @return Zero if the socket was valid, otherwise -EINVAL. */ - BaseType_t xSocketSetSocketID( const Socket_t xSocket, void * pvSocketID ) + BaseType_t xSocketSetSocketID( const Socket_t xSocket, + void * pvSocketID ) { - FreeRTOS_Socket_t * pxSocket = ( FreeRTOS_Socket_t * ) xSocket; - BaseType_t xReturn = -pdFREERTOS_ERRNO_EINVAL; - - if( xSocketValid( pxSocket ) ) - { - xReturn = 0; - pxSocket->pvSocketID = pvSocketID; - } - return xReturn; + FreeRTOS_Socket_t * pxSocket = ( FreeRTOS_Socket_t * ) xSocket; + BaseType_t xReturn = -pdFREERTOS_ERRNO_EINVAL; + + if( xSocketValid( pxSocket ) ) + { + xReturn = 0; + pxSocket->pvSocketID = pvSocketID; + } + + return xReturn; } #endif /* ipconfigUSE_SetSocketID */ /*-----------------------------------------------------------*/ -#if( ipconfigUSE_SetSocketID != 0 ) +#if ( ipconfigUSE_SetSocketID != 0 ) + /** * @brief Retrieve the SocketID that is associated with a socket. * @param[in] xSocket: The socket whose ID should be returned. @@ -4812,14 +4816,15 @@ BaseType_t xSocketValid( const ConstSocket_t xSocket ) */ void * pvSocketGetSocketID( const ConstSocket_t xSocket ) { - const FreeRTOS_Socket_t * pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; - void * pvReturn = NULL; - - if( xSocketValid( pxSocket ) ) - { - pvReturn = pxSocket->pvSocketID; - } - return pvReturn; + const FreeRTOS_Socket_t * pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; + void * pvReturn = NULL; + + if( xSocketValid( pxSocket ) ) + { + pvReturn = pxSocket->pvSocketID; + } + + return pvReturn; } #endif /* ipconfigUSE_SetSocketID */ /*-----------------------------------------------------------*/ diff --git a/source/include/FreeRTOSIPConfigDefaults.h b/source/include/FreeRTOSIPConfigDefaults.h index b3b40f4bd3..7aa4c8efad 100644 --- a/source/include/FreeRTOSIPConfigDefaults.h +++ b/source/include/FreeRTOSIPConfigDefaults.h @@ -1073,7 +1073,7 @@ * this ID. It has a default value of NULL. */ #ifndef ipconfigUSE_SetSocketID - #define ipconfigUSE_SetSocketID 0 + #define ipconfigUSE_SetSocketID 0 #endif #endif /* FREERTOS_DEFAULT_IP_CONFIG_H */ diff --git a/source/include/FreeRTOS_IP_Private.h b/source/include/FreeRTOS_IP_Private.h index 9625f315ad..fc3ede9a3a 100644 --- a/source/include/FreeRTOS_IP_Private.h +++ b/source/include/FreeRTOS_IP_Private.h @@ -680,11 +680,12 @@ typedef struct xSOCKET EventBits_t xSocketBits; /**< These bits indicate the events which have actually occurred. * They are maintained by the IP-task */ #endif /* ipconfigSUPPORT_SELECT_FUNCTION */ - #if( ipconfigUSE_SetSocketID != 0 ) - /* This field is only only by the user, and can be accessed with - * vSocketSetSocketID() / vSocketGetSocketID(). - * All fields of a socket will be cleared by memset() in FreeRTOS_socket(). - */ + #if ( ipconfigUSE_SetSocketID != 0 ) + + /* This field is only only by the user, and can be accessed with + * vSocketSetSocketID() / vSocketGetSocketID(). + * All fields of a socket will be cleared by memset() in FreeRTOS_socket(). + */ void * pvSocketID; #endif /* TCP/UDP specific fields: */ diff --git a/source/include/FreeRTOS_Sockets.h b/source/include/FreeRTOS_Sockets.h index 4c6ef6a2b6..5bf754d055 100644 --- a/source/include/FreeRTOS_Sockets.h +++ b/source/include/FreeRTOS_Sockets.h @@ -366,17 +366,19 @@ void FreeRTOS_netstat( void ); - #if( ipconfigUSE_SetSocketID != 0 ) + #if ( ipconfigUSE_SetSocketID != 0 ) + /* This option adds the possibility to have a user-ID attached to a socket. * The type of this ID is a void *. Both UDP and TCP sockets have * this ID. It has a default value of NULL. */ - BaseType_t xSocketSetSocketID( const Socket_t xSocket, void * pvSocketID ); - #endif + BaseType_t xSocketSetSocketID( const Socket_t xSocket, + void * pvSocketID ); + #endif - #if( ipconfigUSE_SetSocketID != 0 ) - void * pvSocketGetSocketID( const ConstSocket_t xSocket ); - #endif + #if ( ipconfigUSE_SetSocketID != 0 ) + void * pvSocketGetSocketID( const ConstSocket_t xSocket ); + #endif /* End TCP Socket Attributes. */ From 40dec1794a5749974d9be678980e5e284cc4121d Mon Sep 17 00:00:00 2001 From: Hein Tibosch Date: Fri, 2 Sep 2022 15:30:09 +0800 Subject: [PATCH 4/7] Added a few entries to lexicon.txt --- .github/lexicon.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/lexicon.txt b/.github/lexicon.txt index 1ea58fbfd5..949a065e28 100644 --- a/.github/lexicon.txt +++ b/.github/lexicon.txt @@ -230,6 +230,7 @@ egetlinklayeraddress ehertype einitialwait einprogress +einval einvalidchecksum einvaliddata eleasedaddress @@ -785,6 +786,7 @@ pvparameters pvportmalloc pvportmallocsocket pvsearchid +pvsocketid pvsource pxackmessage pxaddr @@ -981,6 +983,7 @@ skipnamefield snd snprintf sockaddr +socketid socketset sockopt sof @@ -1392,7 +1395,9 @@ vrxfaultinjection vsocketbind vsocketclose vsocketclosenexttime +vsocketgetsocketid vsocketselect +vsocketsetsocketid vsocketwakeupuser vtasklist vtasknotifygivefromisr From 1e5ac852614ff648e02aec056208dfac43c599be Mon Sep 17 00:00:00 2001 From: Hein Tibosch Date: Sat, 1 Oct 2022 16:02:10 +0800 Subject: [PATCH 5/7] Removed the 'ipconfigUSE_SetSocketID' option --- source/FreeRTOS_Sockets.c | 50 ++++++++++------------- source/include/FreeRTOSIPConfigDefaults.h | 8 ---- source/include/FreeRTOS_IP_Private.h | 13 +++--- source/include/FreeRTOS_Sockets.h | 12 ++---- 4 files changed, 31 insertions(+), 52 deletions(-) diff --git a/source/FreeRTOS_Sockets.c b/source/FreeRTOS_Sockets.c index bffc2ec04b..563a79ac77 100644 --- a/source/FreeRTOS_Sockets.c +++ b/source/FreeRTOS_Sockets.c @@ -4780,32 +4780,27 @@ BaseType_t xSocketValid( const ConstSocket_t xSocket ) #endif /* ipconfigUSE_TCP */ /*-----------------------------------------------------------*/ -#if ( ipconfigUSE_SetSocketID != 0 ) - /** * @brief Set the value of the SocketID of a socket. * @param[in] xSocket: The socket whose ID should be set. * @param[in] pvSocketID: The new value for the SocketID. * @return Zero if the socket was valid, otherwise -EINVAL. */ - BaseType_t xSocketSetSocketID( const Socket_t xSocket, - void * pvSocketID ) - { - FreeRTOS_Socket_t * pxSocket = ( FreeRTOS_Socket_t * ) xSocket; - BaseType_t xReturn = -pdFREERTOS_ERRNO_EINVAL; - - if( xSocketValid( pxSocket ) ) - { - xReturn = 0; - pxSocket->pvSocketID = pvSocketID; - } +BaseType_t xSocketSetSocketID( const Socket_t xSocket, + void * pvSocketID ) +{ + FreeRTOS_Socket_t * pxSocket = ( FreeRTOS_Socket_t * ) xSocket; + BaseType_t xReturn = -pdFREERTOS_ERRNO_EINVAL; - return xReturn; + if( xSocketValid( pxSocket ) ) + { + xReturn = 0; + pxSocket->pvSocketID = pvSocketID; } -#endif /* ipconfigUSE_SetSocketID */ -/*-----------------------------------------------------------*/ -#if ( ipconfigUSE_SetSocketID != 0 ) + return xReturn; +} +/*-----------------------------------------------------------*/ /** * @brief Retrieve the SocketID that is associated with a socket. @@ -4814,19 +4809,18 @@ BaseType_t xSocketValid( const ConstSocket_t xSocket ) * the socket pointer is not valid or when the ID was not * yet set. */ - void * pvSocketGetSocketID( const ConstSocket_t xSocket ) - { - const FreeRTOS_Socket_t * pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; - void * pvReturn = NULL; - - if( xSocketValid( pxSocket ) ) - { - pvReturn = pxSocket->pvSocketID; - } +void * pvSocketGetSocketID( const ConstSocket_t xSocket ) +{ + const FreeRTOS_Socket_t * pxSocket = ( const FreeRTOS_Socket_t * ) xSocket; + void * pvReturn = NULL; - return pvReturn; + if( xSocketValid( pxSocket ) ) + { + pvReturn = pxSocket->pvSocketID; } -#endif /* ipconfigUSE_SetSocketID */ + + return pvReturn; +} /*-----------------------------------------------------------*/ #if ( ( ipconfigHAS_PRINTF != 0 ) && ( ipconfigUSE_TCP == 1 ) ) diff --git a/source/include/FreeRTOSIPConfigDefaults.h b/source/include/FreeRTOSIPConfigDefaults.h index 7aa4c8efad..d830e03220 100644 --- a/source/include/FreeRTOSIPConfigDefaults.h +++ b/source/include/FreeRTOSIPConfigDefaults.h @@ -1068,12 +1068,4 @@ #define ipconfigPROCESS_CUSTOM_ETHERNET_FRAMES 0 #endif -/* This option adds the possibility to have a user-ID attached to a socket. - * The type of this ID is a void *. Both UDP and TCP sockets have - * this ID. It has a default value of NULL. - */ -#ifndef ipconfigUSE_SetSocketID - #define ipconfigUSE_SetSocketID 0 -#endif - #endif /* FREERTOS_DEFAULT_IP_CONFIG_H */ diff --git a/source/include/FreeRTOS_IP_Private.h b/source/include/FreeRTOS_IP_Private.h index fc3ede9a3a..6259979938 100644 --- a/source/include/FreeRTOS_IP_Private.h +++ b/source/include/FreeRTOS_IP_Private.h @@ -680,14 +680,13 @@ typedef struct xSOCKET EventBits_t xSocketBits; /**< These bits indicate the events which have actually occurred. * They are maintained by the IP-task */ #endif /* ipconfigSUPPORT_SELECT_FUNCTION */ - #if ( ipconfigUSE_SetSocketID != 0 ) - /* This field is only only by the user, and can be accessed with - * vSocketSetSocketID() / vSocketGetSocketID(). - * All fields of a socket will be cleared by memset() in FreeRTOS_socket(). - */ - void * pvSocketID; - #endif + /* This field is only only by the user, and can be accessed with + * vSocketSetSocketID() / vSocketGetSocketID(). + * All fields of a socket will be cleared by memset() in FreeRTOS_socket(). + */ + void * pvSocketID; + /* TCP/UDP specific fields: */ /* Before accessing any member of this structure, it should be confirmed */ /* that the protocol corresponds with the type of structure */ diff --git a/source/include/FreeRTOS_Sockets.h b/source/include/FreeRTOS_Sockets.h index 5bf754d055..cf3a20c57e 100644 --- a/source/include/FreeRTOS_Sockets.h +++ b/source/include/FreeRTOS_Sockets.h @@ -366,20 +366,14 @@ void FreeRTOS_netstat( void ); - #if ( ipconfigUSE_SetSocketID != 0 ) - /* This option adds the possibility to have a user-ID attached to a socket. * The type of this ID is a void *. Both UDP and TCP sockets have * this ID. It has a default value of NULL. */ - BaseType_t xSocketSetSocketID( const Socket_t xSocket, - void * pvSocketID ); - #endif - - #if ( ipconfigUSE_SetSocketID != 0 ) - void * pvSocketGetSocketID( const ConstSocket_t xSocket ); - #endif + BaseType_t xSocketSetSocketID( const Socket_t xSocket, + void * pvSocketID ); + void * pvSocketGetSocketID( const ConstSocket_t xSocket ); /* End TCP Socket Attributes. */ From 986c5aa7e8140e4d8f0ac860a6d47171c421a7ce Mon Sep 17 00:00:00 2001 From: Hein Tibosch Date: Thu, 27 Oct 2022 12:29:43 +0800 Subject: [PATCH 6/7] Change to lexicon.txt --- .github/lexicon.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/lexicon.txt b/.github/lexicon.txt index 949a065e28..dfff7e4ae1 100644 --- a/.github/lexicon.txt +++ b/.github/lexicon.txt @@ -1396,6 +1396,7 @@ vsocketbind vsocketclose vsocketclosenexttime vsocketgetsocketid +vsocketlistennexttime vsocketselect vsocketsetsocketid vsocketwakeupuser From 8d2b49f83b1c03d96c4fe0221e83c17165e3df70 Mon Sep 17 00:00:00 2001 From: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> Date: Thu, 3 Nov 2022 06:44:34 +0000 Subject: [PATCH 7/7] Add unit tests for the newly added API --- .../FreeRTOS_Sockets_GenericAPI_utest.c | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/test/unit-test/FreeRTOS_Sockets/FreeRTOS_Sockets_GenericAPI_utest.c b/test/unit-test/FreeRTOS_Sockets/FreeRTOS_Sockets_GenericAPI_utest.c index 4dbd0f4cf0..f93ce1626a 100644 --- a/test/unit-test/FreeRTOS_Sockets/FreeRTOS_Sockets_GenericAPI_utest.c +++ b/test/unit-test/FreeRTOS_Sockets/FreeRTOS_Sockets_GenericAPI_utest.c @@ -2903,6 +2903,89 @@ void test_FreeRTOS_maywrite_HappyPath( void ) TEST_ASSERT_EQUAL( 0x3344, xReturn ); } +/* + * @brief Test setting socket ID when the socket is NULL. + */ +void test_xSocketSetSocketID_NULLSocket( void ) +{ + BaseType_t xReturn; + + xReturn = xSocketSetSocketID( NULL, NULL ); + + TEST_ASSERT_EQUAL( -pdFREERTOS_ERRNO_EINVAL, xReturn ); +} + +/* + * @brief Test setting socket ID when the socket is invalid. + */ +void test_xSocketSetSocketID_InvalidSocket( void ) +{ + BaseType_t xReturn; + + xReturn = xSocketSetSocketID( FREERTOS_INVALID_SOCKET, NULL ); + + TEST_ASSERT_EQUAL( -pdFREERTOS_ERRNO_EINVAL, xReturn ); +} + +/* + * @brief Test setting socket ID when the socket is Valid. + */ +void test_xSocketSetSocketID_ValidSocket( void ) +{ + BaseType_t xReturn; + FreeRTOS_Socket_t xSocket; + BaseType_t AnchorVariable; + + memset( &xSocket, 0, sizeof( xSocket ) ); + + xReturn = xSocketSetSocketID( &xSocket, &AnchorVariable ); + + TEST_ASSERT_EQUAL( 0, xReturn ); + TEST_ASSERT_EQUAL( &AnchorVariable, xSocket.pvSocketID ); +} + +/* + * @brief Test setting socket ID when the socket is NULL. + */ +void test_pvSocketGetSocketID_NULLSocket( void ) +{ + void * pvReturn; + + pvReturn = pvSocketGetSocketID( NULL ); + + TEST_ASSERT_EQUAL( NULL, pvReturn ); +} + +/* + * @brief Test setting socket ID when the socket is invalid. + */ +void test_pvSocketGetSocketID_InvalidSocket( void ) +{ + void * pvReturn; + + pvReturn = pvSocketGetSocketID( FREERTOS_INVALID_SOCKET ); + + TEST_ASSERT_EQUAL( NULL, pvReturn ); +} + +/* + * @brief Test setting socket ID when the socket is Valid. + */ +void test_pvSocketGetSocketID_ValidSocket( void ) +{ + BaseType_t pvReturn; + FreeRTOS_Socket_t xSocket; + BaseType_t AnchorVariable; + + memset( &xSocket, 0, sizeof( xSocket ) ); + + xSocket.pvSocketID = &AnchorVariable; + + pvReturn = pvSocketGetSocketID( &xSocket ); + + TEST_ASSERT_EQUAL( &AnchorVariable, pvReturn ); +} + /* * @brief This function just prints out some data. It is expected to make calls to the * below functions when IP stack is not initialised.