-
Notifications
You must be signed in to change notification settings - Fork 33
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
ci_lab Integration candidate: Caelum-rc4+dev64 #155
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a421335
Fix #149, add decode hooks
jphickey ea9219f
Fix #52, Add version information to NOOP event
thnkslprpt a7d1d05
Merge pull request #152 from jphickey:fix-149-decode
dzbaker dd837b1
Merge pull request #153 from thnkslprpt:fix-52-add-version-informatio…
dzbaker baed83d
Updating documentation and version numbers for v2.5.0-rc4+dev69
dzbaker 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 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 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/************************************************************************ | ||
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” | ||
* | ||
* Copyright (c) 2020 United States Government as represented by the | ||
* Administrator of the National Aeronautics and Space Administration. | ||
* All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. You may obtain | ||
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
************************************************************************/ | ||
|
||
/** | ||
* @file | ||
* This is the dispatch hdr file for the Command Ingest lab application. | ||
*/ | ||
#ifndef CI_LAB_DECODE_H | ||
#define CI_LAB_DECODE_H | ||
|
||
/* | ||
** Required header files... | ||
*/ | ||
#include "common_types.h" | ||
#include "cfe_sb_api_typedefs.h" | ||
|
||
CFE_Status_t CI_LAB_GetInputBuffer(void **BufferOut, size_t *SizeOut); | ||
CFE_Status_t CI_LAB_DecodeInputMessage(void *SourceBuffer, size_t SourceSize, CFE_SB_Buffer_t **DestBufferOut); | ||
|
||
#endif |
This file contains 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 |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/************************************************************************ | ||
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” | ||
* | ||
* Copyright (c) 2020 United States Government as represented by the | ||
* Administrator of the National Aeronautics and Space Administration. | ||
* All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. You may obtain | ||
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
************************************************************************/ | ||
|
||
/** | ||
* \file | ||
* This file contains the source code for the Command Ingest task. | ||
*/ | ||
|
||
/* | ||
** Include Files: | ||
*/ | ||
#include "cfe.h" | ||
|
||
#include "ci_lab_app.h" | ||
#include "ci_lab_perfids.h" | ||
#include "ci_lab_msgids.h" | ||
#include "ci_lab_decode.h" | ||
|
||
/* | ||
* --------------------------------------- | ||
* In a "passthrough" configuration - the data from the network | ||
* is expected to be a direct instance of the CFE_MSG_Message_t base, | ||
* and thus something can be sent directly to SB. | ||
* | ||
* Instead of using an intermediate buffer, just get a buffer from | ||
* SB and put it directly in there. This reduces copying. | ||
* --------------------------------------- | ||
*/ | ||
CFE_Status_t CI_LAB_GetInputBuffer(void **BufferOut, size_t *SizeOut) | ||
{ | ||
CFE_SB_Buffer_t *IngestBuffer; | ||
const size_t IngestSize = CI_LAB_MAX_INGEST; | ||
|
||
IngestBuffer = CFE_SB_AllocateMessageBuffer(IngestSize); | ||
if (IngestBuffer == NULL) | ||
{ | ||
*BufferOut = NULL; | ||
*SizeOut = 0; | ||
|
||
CFE_EVS_SendEvent(CI_LAB_INGEST_ALLOC_ERR_EID, CFE_EVS_EventType_ERROR, "CI_LAB: buffer allocation failed\n"); | ||
|
||
return CFE_SB_BUF_ALOC_ERR; | ||
} | ||
|
||
*BufferOut = IngestBuffer; | ||
*SizeOut = IngestSize; | ||
|
||
return CFE_SUCCESS; | ||
} | ||
|
||
/* | ||
* --------------------------------------- | ||
* In a "passthrough" configuration - the data from the network | ||
* is expected to be a direct instance of the CFE_MSG_Message_t base, | ||
* and thus something can be sent directly to SB. | ||
* | ||
* This just does a simple sanity check on the message size. But | ||
* otherwise, the source buffer is used directly as the output buffer. | ||
* --------------------------------------- | ||
*/ | ||
CFE_Status_t CI_LAB_DecodeInputMessage(void *SourceBuffer, size_t SourceSize, CFE_SB_Buffer_t **DestBufferOut) | ||
Check notice Code scanning / CodeQL-coding-standard Long function without assertion Note
All functions of more than 10 lines should have at least one assertion.
|
||
{ | ||
CFE_SB_Buffer_t *MsgBufPtr; | ||
CFE_MSG_Size_t MsgSize; | ||
CFE_Status_t Status; | ||
|
||
if (SourceSize < sizeof(CFE_MSG_CommandHeader_t)) | ||
{ | ||
MsgBufPtr = NULL; | ||
Status = CFE_STATUS_WRONG_MSG_LENGTH; | ||
|
||
CFE_EVS_SendEvent(CI_LAB_INGEST_LEN_ERR_EID, CFE_EVS_EventType_ERROR, | ||
"CI: cmd dropped, bad packet length=%lu\n", (unsigned long)SourceSize); | ||
} | ||
else | ||
{ | ||
MsgBufPtr = SourceBuffer; | ||
|
||
/* Check the size from within the header itself, compare against network buffer size */ | ||
CFE_MSG_GetSize(&MsgBufPtr->Msg, &MsgSize); | ||
|
||
if (MsgSize > SourceSize) | ||
{ | ||
Status = CFE_STATUS_WRONG_MSG_LENGTH; | ||
|
||
CFE_EVS_SendEvent(CI_LAB_INGEST_LEN_ERR_EID, CFE_EVS_EventType_ERROR, | ||
"CI: cmd dropped - length mismatch, %lu (hdr) / %lu (packet)\n", (unsigned long)MsgSize, | ||
(unsigned long)SourceSize); | ||
} | ||
else | ||
{ | ||
Status = CFE_SUCCESS; | ||
} | ||
} | ||
|
||
*DestBufferOut = MsgBufPtr; | ||
|
||
return Status; | ||
} |
This file contains 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
Oops, something went wrong.
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.
Check notice
Code scanning / CodeQL-coding-standard
Long function without assertion Note