Skip to content
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

Fix #274, send packet when transaction resets #302

Merged
merged 3 commits into from
Aug 5, 2022

Conversation

havencarlson
Copy link
Contributor

Checklist (Please check before submitting)

Describe the contribution
Fix #274, when a transaction resets, an information packet is sent

Testing performed
Unit testing

Expected behavior changes
Sending a packet of information on a transaction when it is reset.

System(s) tested on

  • OS: Ubuntu 18.04

Contributor Info - All information REQUIRED for consideration of pull request
Haven Carlson - NASA

@havencarlson havencarlson requested review from a user and skliper August 3, 2022 01:35

if (PktBuf != NULL)
{
CFE_MSG_Init(&PktBuf->eot.tlm_header.Msg, CFE_SB_ValueToMsgId(CF_EOT_TLM_MID), sizeof(*PktBuf));

Check warning

Code scanning / CodeQL-coding-standard

Unchecked return value

The return value of non-void function [CFE_MSG_Init](1) is not checked.
** Timestamp and send eod of transaction telemetry
*/
CFE_SB_TimeStampMsg(&PktBuf->eot.tlm_header.Msg);
CFE_SB_TransmitBuffer(&PktBuf->SBBuf, true);

Check warning

Code scanning / CodeQL-coding-standard

Unchecked return value

The return value of non-void function [CFE_SB_TransmitBuffer](1) is not checked.
fsw/src/cf_cfdp.c Fixed Show fixed Hide fixed
* See description in cf_cfdp.h for argument/return detail
*
*-----------------------------------------------------------------*/
void CF_CFDP_SendEotPkt(CF_Transaction_t *t)

Check notice

Code scanning / CodeQL-coding-standard

Long function without assertion

All functions of more than 10 lines should have at least one assertion.
fsw/src/cf_msg.h Fixed Show fixed Hide fixed
fsw/src/cf_msg.h Fixed Show fixed Hide fixed
fsw/src/cf_msg.h Fixed Show fixed Hide fixed
fsw/src/cf_msg.h Fixed Show fixed Hide fixed
fsw/src/cf_msg.h Fixed Show fixed Hide fixed
fsw/src/cf_msg.h Fixed Show fixed Hide fixed
Copy link
Contributor

@skliper skliper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add a requirement and update design slides (and or coordinate w/ update in progress if @acudmore is working them). Requirement could be done as a follow-on issue/pr.

fsw/src/cf_msg.h Outdated Show resolved Hide resolved
fsw/src/cf_msg.h Outdated Show resolved Hide resolved
unit-test/cf_cfdp_tests.c Outdated Show resolved Hide resolved
fsw/src/cf_msg.h Fixed Show fixed Hide fixed
CF_TxnFilenames_t fnames; /**< \brief file names associated with this transaction */
CF_TxnState_t state; /**< \brief Transaction state */
CF_CFDP_ConditionCode_t cc; /**< \brief final condition code of operation */
CF_EntityId_t src_eid; /**< \brief the source eid of the transaction */

Check notice

Code scanning / CodeQL-coding-standard

Use of basic integral type

src_eid uses the basic integral type unsigned int rather than a typedef with size and signedness.
fsw/src/cf_msg.h Fixed Show fixed Hide fixed
fsw/src/cf_msg.h Fixed Show fixed Hide fixed
fsw/src/cf_msg.h Fixed Show fixed Hide fixed
* that compiles with the alignment constraints of a CFE_SB_Buffer_t
*/
typedef union
{

Check notice

Code scanning / CodeQL-coding-standard

AV Rule 153

AV Rule 153: Unions shall not be used.
Copy link
Contributor

@skliper skliper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there were whitespace changes to the requirements. Preference is to use output exactly as provided from JIRA to make tracking changes more manageable. Maybe your editor added them? Also may want to add a requirement as to when the packet gets generated. Testers will need to add verification of this packet on transaction termination.

@havencarlson havencarlson force-pushed the fix#274-eot_pkt branch 3 times, most recently from 009c1ac to 11a111d Compare August 3, 2022 15:51
@dzbaker
Copy link
Contributor

dzbaker commented Aug 3, 2022

CCB 3 Aug 2022: Approved pending addition of NULL test, verifying no implicit padding, and review.

{
CFE_MSG_Init(&PktBuf->eot.tlm_header.Msg, CFE_SB_ValueToMsgId(CF_EOT_TLM_MID), sizeof(*PktBuf));

PktBuf->eot.channel = t->chan_num;

Check warning

Code scanning / CodeQL-coding-standard

Unchecked function argument

This use of parameter t has not been checked.
CF_TxnState_t state; /**< \brief Transaction state */
CF_CFDP_ConditionCode_t cc; /**< \brief final condition code of operation */
CF_EntityId_t src_eid; /**< \brief the source eid of the transaction */
CF_EntityId_t peer_eid; /**< \brief peer_eid is always the "other guy", same src_eid for RX */

Check notice

Code scanning / CodeQL-coding-standard

Use of basic integral type

peer_eid uses the basic integral type unsigned int rather than a typedef with size and signedness.
fsw/src/cf_msg.h Fixed Show fixed Hide fixed
fsw/src/cf_msg.h Fixed Show fixed Hide fixed
fsw/src/cf_msg.h Fixed Show fixed Hide fixed
@havencarlson havencarlson force-pushed the fix#274-eot_pkt branch 2 times, most recently from 6f1c629 to 02f86c7 Compare August 5, 2022 15:17
{
CFE_MSG_TelemetryHeader_t tlm_header; /**< \brief Telemetry header */
CF_TransactionSeq_t seq_num; /**< \brief transaction identifier, stays constant for entire transfer */
uint32 channel; /**< \brief Channel number */

Check notice

Code scanning / CodeQL-coding-standard

Use of basic integral type

channel uses the basic integral type unsigned int rather than a typedef with size and signedness.
typedef struct CF_EotPacket
{
CFE_MSG_TelemetryHeader_t tlm_header; /**< \brief Telemetry header */
CF_TransactionSeq_t seq_num; /**< \brief transaction identifier, stays constant for entire transfer */

Check notice

Code scanning / CodeQL-coding-standard

Use of basic integral type

seq_num uses the basic integral type unsigned int rather than a typedef with size and signedness.
Copy link
Contributor

@skliper skliper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments, nothing required to change but possible suggestions if you want.

Comment on lines +143 to +150
1. Transaction identifier
2. Channel number
3. Direction of transaction
4. Filenames associated with transaction
5. Transaction state
6. Condition code
7. Source EID of transaction
8. Peer EID of transaction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine in this commit if this was already done in JIRA but in the future I wouldn't update a requirement just to change the order of parameters in a structure. Our requirements shouldn't dictate design/implementation down to that level. The goal is to keep requirements stable (minimize required document updates and all the associated analysis for a "requirements change")

fsw/src/cf_msg.h Outdated
uint32 fsize; /**< \brief File size */
CF_Crc_t crc; /**< \brief CRC state object */
CF_TxnFilenames_t fnames; /**< \brief file names associated with this transaction */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually strings are at the end? OK as is if there are no gaps... but just surprised to see it before a uint32.

Comment on lines 1401 to 1403
/* setup for a call to CFE_SB_AllocateMessageBuffer() */
PktBufPtr = NULL;
UT_SetDataBuffer(UT_KEY(CFE_SB_AllocateMessageBuffer), &PktBufPtr, sizeof(PktBufPtr), true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC if you don't pass in a buffer it'll return NULL anyways, so you probably don't need this.

CF_CFDP_ConditionCode_t cc; /**< \brief final condition code of operation */
CF_EntityId_t src_eid; /**< \brief the source eid of the transaction */
CF_EntityId_t peer_eid; /**< \brief peer_eid is always the "other guy", same src_eid for RX */
uint32 fsize; /**< \brief File size */

Check notice

Code scanning / CodeQL-coding-standard

Use of basic integral type

fsize uses the basic integral type unsigned int rather than a typedef with size and signedness.
CF_EntityId_t src_eid; /**< \brief the source eid of the transaction */
CF_EntityId_t peer_eid; /**< \brief peer_eid is always the "other guy", same src_eid for RX */
uint32 fsize; /**< \brief File size */
uint32 crc_result; /**< \brief CRC result */

Check notice

Code scanning / CodeQL-coding-standard

Use of basic integral type

crc_result uses the basic integral type unsigned int rather than a typedef with size and signedness.
@dzbaker dzbaker merged commit d623fa9 into nasa:main Aug 5, 2022
@skliper
Copy link
Contributor

skliper commented Aug 5, 2022

@dzbaker @havencarlson - heads up it looks like I missed the whitespace changes that snuck into the requirements .cvs. I recommend an export from JIRA again and put directly in w/o whitespace changes so the next person doesn't get surprised by the number of changes.

skliper added a commit to skliper/CF that referenced this pull request Aug 8, 2022
dzbaker added a commit that referenced this pull request Aug 10, 2022
Fix #308, Revert requirements whitespace changes from #302
@skliper skliper added this to the Draco milestone Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate diagnostics/info packet on transaction closure
5 participants