generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 207
IPv4/Single: Add a SocketID to a socket #546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
AniruddhaKanhere
merged 12 commits into
FreeRTOS:main
from
htibosch:IPv4_single_Add_SocketSetSocketID
Nov 3, 2022
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
17fc154
IPv4/Single: Add a SocketID to a socket
05919a9
Change in comment
8c57056
Applied uncrustify to format the source code
40dec17
Added a few entries to lexicon.txt
936b143
Merge branch 'main' into IPv4_single_Add_SocketSetSocketID
alfred2g 2a6ff39
Merge branch 'main' into IPv4_single_Add_SocketSetSocketID
AniruddhaKanhere 2ca2401
Merge branch 'FreeRTOS:main' into IPv4_single_Add_SocketSetSocketID
htibosch 1e5ac85
Removed the 'ipconfigUSE_SetSocketID' option
986c5aa
Change to lexicon.txt
bfd9819
Merge branch 'main' into IPv4_single_Add_SocketSetSocketID
htibosch 8d2b49f
Add unit tests for the newly added API
AniruddhaKanhere 1513593
Merge branch 'main' into IPv4_single_Add_SocketSetSocketID
AniruddhaKanhere File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 ); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What will be the value of the anchor variable here. |
||
|
|
||
| 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. | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a query here. How are we getting the value of the socket_id. I mean, is it left to the test application to assign a value or will the TCP stack maintain a sequence.