diff --git a/fsw/src/cf_cfdp.c b/fsw/src/cf_cfdp.c index 44f5bc0e..5bf927f6 100644 --- a/fsw/src/cf_cfdp.c +++ b/fsw/src/cf_cfdp.c @@ -120,10 +120,10 @@ void CF_CFDP_DecodeStart(CF_DecoderState_t *pdec, const void *msgbuf, CF_Logical * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_ArmAckTimer(CF_Transaction_t *t) +void CF_CFDP_ArmAckTimer(CF_Transaction_t *txn) { - CF_Timer_InitRelSec(&t->ack_timer, CF_AppData.config_table->chan[t->chan_num].ack_timer_s); - t->flags.com.ack_timer_armed = 1; + CF_Timer_InitRelSec(&txn->ack_timer, CF_AppData.config_table->chan[txn->chan_num].ack_timer_s); + txn->flags.com.ack_timer_armed = 1; } /*---------------------------------------------------------------- @@ -131,10 +131,10 @@ void CF_CFDP_ArmAckTimer(CF_Transaction_t *t) * Internal helper routine only, not part of API. * *-----------------------------------------------------------------*/ -static inline CF_CFDP_Class_t CF_CFDP_GetClass(const CF_Transaction_t *t) +static inline CF_CFDP_Class_t CF_CFDP_GetClass(const CF_Transaction_t *txn) { - CF_Assert(t->flags.com.q_index != CF_QueueIdx_FREE); - return !!((t->state == CF_TxnState_S2) || (t->state == CF_TxnState_R2)); + CF_Assert(txn->flags.com.q_index != CF_QueueIdx_FREE); + return !!((txn->state == CF_TxnState_S2) || (txn->state == CF_TxnState_R2)); } /*---------------------------------------------------------------- @@ -142,12 +142,12 @@ static inline CF_CFDP_Class_t CF_CFDP_GetClass(const CF_Transaction_t *t) * Internal helper routine only, not part of API. * *-----------------------------------------------------------------*/ -static inline bool CF_CFDP_IsSender(CF_Transaction_t *t) +static inline bool CF_CFDP_IsSender(CF_Transaction_t *txn) { - CF_Assert(t->flags.com.q_index != CF_QueueIdx_FREE); + CF_Assert(txn->flags.com.q_index != CF_QueueIdx_FREE); /* the state could actually be CF_TxnState_IDLE, which is still not a sender. This would * be an unused transaction in the RX (CF_CFDP_ReceiveMessage) path. */ - return !!((t->state == CF_TxnState_S1) || (t->state == CF_TxnState_S2)); + return !!((txn->state == CF_TxnState_S1) || (txn->state == CF_TxnState_S2)); } /*---------------------------------------------------------------- @@ -155,9 +155,9 @@ static inline bool CF_CFDP_IsSender(CF_Transaction_t *t) * Internal helper routine only, not part of API. * *-----------------------------------------------------------------*/ -static inline void CF_CFDP_ArmInactTimer(CF_Transaction_t *t) +static inline void CF_CFDP_ArmInactTimer(CF_Transaction_t *txn) { - CF_Timer_InitRelSec(&t->inactivity_timer, CF_AppData.config_table->chan[t->chan_num].inactivity_timer_s); + CF_Timer_InitRelSec(&txn->inactivity_timer, CF_AppData.config_table->chan[txn->chan_num].inactivity_timer_s); } /*---------------------------------------------------------------- @@ -166,7 +166,7 @@ static inline void CF_CFDP_ArmInactTimer(CF_Transaction_t *t) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_DispatchRecv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { static const CF_CFDP_TxnRecvDispatchTable_t state_fns = {.rx = {[CF_TxnState_IDLE] = CF_CFDP_RecvIdle, [CF_TxnState_R1] = CF_CFDP_R1_Recv, @@ -175,8 +175,8 @@ void CF_CFDP_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) [CF_TxnState_S2] = CF_CFDP_S2_Recv, [CF_TxnState_DROP] = CF_CFDP_RecvDrop}}; - CF_CFDP_RxStateDispatch(t, ph, &state_fns); - CF_CFDP_ArmInactTimer(t); /* whenever a packet was received by the other size, always arm its inactivity timer */ + CF_CFDP_RxStateDispatch(txn, ph, &state_fns); + CF_CFDP_ArmInactTimer(txn); /* whenever a packet was received by the other size, always arm its inactivity timer */ } /*---------------------------------------------------------------- @@ -184,12 +184,12 @@ void CF_CFDP_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Internal helper routine only, not part of API. * *-----------------------------------------------------------------*/ -static void CF_CFDP_DispatchTx(CF_Transaction_t *t) +static void CF_CFDP_DispatchTx(CF_Transaction_t *txn) { static const CF_CFDP_TxnSendDispatchTable_t state_fns = { .tx = {[CF_TxnState_S1] = CF_CFDP_S1_Tx, [CF_TxnState_S2] = CF_CFDP_S2_Tx}}; - CF_CFDP_TxStateDispatch(t, &state_fns); + CF_CFDP_TxStateDispatch(txn, &state_fns); } /*---------------------------------------------------------------- @@ -197,14 +197,14 @@ static void CF_CFDP_DispatchTx(CF_Transaction_t *t) * Internal helper routine only, not part of API. * *-----------------------------------------------------------------*/ -static CF_ChunkWrapper_t *CF_CFDP_FindUnusedChunks(CF_Channel_t *c, CF_Direction_t dir) +static CF_ChunkWrapper_t *CF_CFDP_FindUnusedChunks(CF_Channel_t *chan, CF_Direction_t dir) { CF_ChunkWrapper_t *ret; CF_Assert(dir < CF_Direction_NUM); - CF_Assert(c->cs[dir]); + CF_Assert(chan->cs[dir]); - ret = container_of(CF_CList_Pop(&c->cs[dir]), CF_ChunkWrapper_t, cl_node); + ret = container_of(CF_CList_Pop(&chan->cs[dir]), CF_ChunkWrapper_t, cl_node); return ret; } @@ -235,7 +235,7 @@ static void CF_CFDP_SetPduLength(CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *t, CF_CFDP_FileDirective_t directive_code, +CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *txn, CF_CFDP_FileDirective_t directive_code, CF_EntityId_t src_eid, CF_EntityId_t dst_eid, bool towards_sender, CF_TransactionSeq_t tsn, bool silent) { @@ -244,7 +244,7 @@ CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *t, CF CF_Logical_PduHeader_t *hdr; uint8 eid_len; - ph = CF_CFDP_MsgOutGet(t, silent); + ph = CF_CFDP_MsgOutGet(txn, silent); if (ph) { @@ -253,7 +253,7 @@ CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *t, CF hdr->version = 1; hdr->pdu_type = (directive_code == 0); /* set to '1' for file data PDU, '0' for a directive PDU */ hdr->direction = (towards_sender != 0); /* set to '1' for toward sender, '0' for toward receiver */ - hdr->txm_mode = (CF_CFDP_GetClass(t) == CF_CFDP_CLASS_1); /* set to '1' for class 1 data, '0' for class 2 */ + hdr->txm_mode = (CF_CFDP_GetClass(txn) == CF_CFDP_CLASS_1); /* set to '1' for class 1 data, '0' for class 2 */ /* choose the larger of the two EIDs to determine size */ if (src_eid > dst_eid) @@ -304,13 +304,13 @@ CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *t, CF * Internal helper routine only, not part of API. * *-----------------------------------------------------------------*/ -static inline size_t CF_strnlen(const char *s, size_t maxlen) +static inline size_t CF_strnlen(const char *str, size_t maxlen) { - const char *end = memchr(s, 0, maxlen); + const char *end = memchr(str, 0, maxlen); if (end != NULL) { /* actual length of string is difference */ - maxlen = end - s; + maxlen = end - str; } return maxlen; } @@ -321,11 +321,11 @@ static inline size_t CF_strnlen(const char *s, size_t maxlen) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_SendMd(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_SendMd(CF_Transaction_t *txn) { CF_Logical_PduBuffer_t *ph = - CF_CFDP_ConstructPduHeader(t, CF_CFDP_FileDirective_METADATA, CF_AppData.config_table->local_eid, - t->history->peer_eid, 0, t->history->seq_num, 0); + CF_CFDP_ConstructPduHeader(txn, CF_CFDP_FileDirective_METADATA, CF_AppData.config_table->local_eid, + txn->history->peer_eid, 0, txn->history->seq_num, 0); CF_Logical_PduMd_t *md; CFE_Status_t sret = CFE_SUCCESS; @@ -337,21 +337,21 @@ CFE_Status_t CF_CFDP_SendMd(CF_Transaction_t *t) { md = &ph->int_header.md; - CF_Assert((t->state == CF_TxnState_S1) || (t->state == CF_TxnState_S2)); + CF_Assert((txn->state == CF_TxnState_S1) || (txn->state == CF_TxnState_S2)); - md->size = t->fsize; + md->size = txn->fsize; /* at this point, need to append filenames into md packet */ /* this does not actually copy here - that is done during encode */ md->source_filename.length = - CF_strnlen(t->history->fnames.src_filename, sizeof(t->history->fnames.src_filename)); - md->source_filename.data_ptr = t->history->fnames.src_filename; - md->dest_filename.length = CF_strnlen(t->history->fnames.dst_filename, sizeof(t->history->fnames.dst_filename)); - md->dest_filename.data_ptr = t->history->fnames.dst_filename; + CF_strnlen(txn->history->fnames.src_filename, sizeof(txn->history->fnames.src_filename)); + md->source_filename.data_ptr = txn->history->fnames.src_filename; + md->dest_filename.length = CF_strnlen(txn->history->fnames.dst_filename, sizeof(txn->history->fnames.dst_filename)); + md->dest_filename.data_ptr = txn->history->fnames.dst_filename; CF_CFDP_EncodeMd(ph->penc, md); CF_CFDP_SetPduLength(ph); - CF_CFDP_Send(t->chan_num, ph); + CF_CFDP_Send(txn->chan_num, ph); } return sret; @@ -363,7 +363,7 @@ CFE_Status_t CF_CFDP_SendMd(CF_Transaction_t *t) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_SendFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_SendFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { /* NOTE: SendFd does not need a call to CF_CFDP_MsgOutGet, as the caller already has it */ CFE_Status_t ret = CFE_SUCCESS; @@ -372,7 +372,7 @@ CFE_Status_t CF_CFDP_SendFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) /* update PDU length */ CF_CFDP_SetPduLength(ph); - CF_CFDP_Send(t->chan_num, ph); + CF_CFDP_Send(txn->chan_num, ph); return ret; } @@ -420,11 +420,11 @@ void CF_CFDP_AppendTlv(CF_Logical_TlvList_t *ptlv_list, CF_CFDP_TlvType_t tlv_ty * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_SendEof(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_SendEof(CF_Transaction_t *txn) { CF_Logical_PduBuffer_t *ph = - CF_CFDP_ConstructPduHeader(t, CF_CFDP_FileDirective_EOF, CF_AppData.config_table->local_eid, - t->history->peer_eid, 0, t->history->seq_num, 0); + CF_CFDP_ConstructPduHeader(txn, CF_CFDP_FileDirective_EOF, CF_AppData.config_table->local_eid, + txn->history->peer_eid, 0, txn->history->seq_num, 0); CF_Logical_PduEof_t *eof; CFE_Status_t ret = CFE_SUCCESS; @@ -436,9 +436,9 @@ CFE_Status_t CF_CFDP_SendEof(CF_Transaction_t *t) { eof = &ph->int_header.eof; - eof->cc = CF_TxnStatus_To_ConditionCode(t->history->txn_stat); - eof->crc = t->crc.result; - eof->size = t->fsize; + eof->cc = CF_TxnStatus_To_ConditionCode(txn->history->txn_stat); + eof->crc = txn->crc.result; + eof->size = txn->fsize; if (eof->cc != CF_CFDP_ConditionCode_NO_ERROR) { @@ -447,7 +447,7 @@ CFE_Status_t CF_CFDP_SendEof(CF_Transaction_t *t) CF_CFDP_EncodeEof(ph->penc, eof); CF_CFDP_SetPduLength(ph); - CF_CFDP_Send(t->chan_num, ph); + CF_CFDP_Send(txn->chan_num, ph); } return ret; @@ -459,7 +459,7 @@ CFE_Status_t CF_CFDP_SendEof(CF_Transaction_t *t) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_CFDP_FileDirective_t dir_code, +CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *txn, CF_CFDP_AckTxnStatus_t ts, CF_CFDP_FileDirective_t dir_code, CF_CFDP_ConditionCode_t cc, CF_EntityId_t peer_eid, CF_TransactionSeq_t tsn) { CF_Logical_PduBuffer_t *ph; @@ -470,7 +470,7 @@ CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_ CF_Assert((dir_code == CF_CFDP_FileDirective_EOF) || (dir_code == CF_CFDP_FileDirective_FIN)); - if (CF_CFDP_IsSender(t)) + if (CF_CFDP_IsSender(txn)) { src_eid = CF_AppData.config_table->local_eid; dst_eid = peer_eid; @@ -481,7 +481,7 @@ CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_ dst_eid = CF_AppData.config_table->local_eid; } - ph = CF_CFDP_ConstructPduHeader(t, CF_CFDP_FileDirective_ACK, src_eid, dst_eid, + ph = CF_CFDP_ConstructPduHeader(txn, CF_CFDP_FileDirective_ACK, src_eid, dst_eid, (dir_code == CF_CFDP_FileDirective_EOF), tsn, 0); if (!ph) { @@ -498,7 +498,7 @@ CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_ CF_CFDP_EncodeAck(ph->penc, ack); CF_CFDP_SetPduLength(ph); - CF_CFDP_Send(t->chan_num, ph); + CF_CFDP_Send(txn->chan_num, ph); } return ret; @@ -510,12 +510,12 @@ CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_ * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, +CFE_Status_t CF_CFDP_SendFin(CF_Transaction_t *txn, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, CF_CFDP_ConditionCode_t cc) { CF_Logical_PduBuffer_t *ph = - CF_CFDP_ConstructPduHeader(t, CF_CFDP_FileDirective_FIN, t->history->peer_eid, - CF_AppData.config_table->local_eid, 1, t->history->seq_num, 0); + CF_CFDP_ConstructPduHeader(txn, CF_CFDP_FileDirective_FIN, txn->history->peer_eid, + CF_AppData.config_table->local_eid, 1, txn->history->seq_num, 0); CF_Logical_PduFin_t *fin; CFE_Status_t ret = CFE_SUCCESS; @@ -538,7 +538,7 @@ CFE_Status_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_EncodeFin(ph->penc, fin); CF_CFDP_SetPduLength(ph); - CF_CFDP_Send(t->chan_num, ph); + CF_CFDP_Send(txn->chan_num, ph); } return ret; @@ -550,7 +550,7 @@ CFE_Status_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_SendNak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { CF_Logical_PduNak_t *nak; CFE_Status_t ret = CFE_SUCCESS; @@ -561,7 +561,7 @@ CFE_Status_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } else { - CF_Assert(CF_CFDP_GetClass(t) == CF_CFDP_CLASS_2); + CF_Assert(CF_CFDP_GetClass(txn) == CF_CFDP_CLASS_2); nak = &ph->int_header.nak; @@ -572,7 +572,7 @@ CFE_Status_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) CF_CFDP_EncodeNak(ph->penc, nak); CF_CFDP_SetPduLength(ph); - CF_CFDP_Send(t->chan_num, ph); + CF_CFDP_Send(txn->chan_num, ph); } return ret; @@ -644,7 +644,7 @@ CFE_Status_t CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { const CF_Logical_PduMd_t *md = &ph->int_header.md; int lv_ret; @@ -656,13 +656,13 @@ CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) CFE_EVS_SendEvent(CF_EID_ERR_PDU_MD_SHORT, CFE_EVS_EventType_ERROR, "CF: metadata packet too short: %lu bytes received", (unsigned long)CF_CODEC_GET_SIZE(ph->pdec)); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error; ret = CF_PDU_METADATA_ERROR; } else { /* store the expected file size in transaction */ - t->fsize = md->size; + txn->fsize = md->size; /* * store the filenames in transaction. @@ -671,33 +671,33 @@ CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * and ensures that the output content is properly terminated, so this only needs to check that * it worked. */ - lv_ret = CF_CFDP_CopyStringFromLV(t->history->fnames.src_filename, sizeof(t->history->fnames.src_filename), + lv_ret = CF_CFDP_CopyStringFromLV(txn->history->fnames.src_filename, sizeof(txn->history->fnames.src_filename), &md->source_filename); if (lv_ret < 0) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_INVALID_SRC_LEN, CFE_EVS_EventType_ERROR, "CF: metadata PDU rejected due to invalid length in source filename of 0x%02x", md->source_filename.length); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error; ret = CF_PDU_METADATA_ERROR; } else { - lv_ret = CF_CFDP_CopyStringFromLV(t->history->fnames.dst_filename, sizeof(t->history->fnames.dst_filename), + lv_ret = CF_CFDP_CopyStringFromLV(txn->history->fnames.dst_filename, sizeof(txn->history->fnames.dst_filename), &md->dest_filename); if (lv_ret < 0) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_INVALID_DST_LEN, CFE_EVS_EventType_ERROR, "CF: metadata PDU rejected due to invalid length in dest filename of 0x%02x", md->dest_filename.length); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error; ret = CF_PDU_METADATA_ERROR; } else { CFE_EVS_SendEvent(CF_EID_INF_PDU_MD_RECVD, CFE_EVS_EventType_INFORMATION, - "CF: md received for source: %s, dest: %s", t->history->fnames.src_filename, - t->history->fnames.dst_filename); + "CF: md received for source: %s, dest: %s", txn->history->fnames.src_filename, + txn->history->fnames.dst_filename); } } } @@ -711,7 +711,7 @@ CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { CFE_Status_t ret = CFE_SUCCESS; @@ -734,8 +734,8 @@ CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_FD_SHORT, CFE_EVS_EventType_ERROR, "CF: filedata PDU too short: %lu bytes received", (unsigned long)CF_CODEC_GET_SIZE(ph->pdec)); - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_PROTOCOL_ERROR); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_PROTOCOL_ERROR); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error; ret = CF_SHORT_PDU_ERROR; } else if (ph->pdu_header.segment_meta_flag) @@ -743,8 +743,8 @@ CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) /* If recv PDU has the "segment_meta_flag" set, this is not currently handled in CF. */ CFE_EVS_SendEvent(CF_EID_ERR_PDU_FD_UNSUPPORTED, CFE_EVS_EventType_ERROR, "CF: filedata PDU with segment metadata received"); - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_PROTOCOL_ERROR); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_PROTOCOL_ERROR); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error; ret = CF_ERROR; } @@ -757,7 +757,7 @@ CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_RecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_RecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { CFE_Status_t ret = CFE_SUCCESS; @@ -779,7 +779,7 @@ CFE_Status_t CF_CFDP_RecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_RecvAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_RecvAck(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { CFE_Status_t ret = CFE_SUCCESS; @@ -802,7 +802,7 @@ CFE_Status_t CF_CFDP_RecvAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_RecvFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_RecvFin(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { CFE_Status_t ret = CFE_SUCCESS; @@ -826,7 +826,7 @@ CFE_Status_t CF_CFDP_RecvFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_RecvNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_RecvNak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { CFE_Status_t ret = CFE_SUCCESS; @@ -848,9 +848,9 @@ CFE_Status_t CF_CFDP_RecvNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_RecvDrop(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_RecvDrop(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.dropped; + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.dropped; } /*---------------------------------------------------------------- @@ -859,20 +859,20 @@ void CF_CFDP_RecvDrop(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_RecvIdle(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { CF_Logical_PduFileDirectiveHeader_t *fdh; int status; /* only RX transactions dare tread here */ - t->history->seq_num = ph->pdu_header.sequence_num; + txn->history->seq_num = ph->pdu_header.sequence_num; /* peer_eid is always the remote partner. src_eid is always the transaction source. * in this case, they are the same */ - t->history->peer_eid = ph->pdu_header.source_eid; - t->history->src_eid = ph->pdu_header.source_eid; + txn->history->peer_eid = ph->pdu_header.source_eid; + txn->history->src_eid = ph->pdu_header.source_eid; - t->chunks = CF_CFDP_FindUnusedChunks(&CF_AppData.engine.channels[t->chan_num], CF_Direction_RX); + txn->chunks = CF_CFDP_FindUnusedChunks(&CF_AppData.engine.channels[txn->chan_num], CF_Direction_RX); /* this is an idle transaction, so see if there's a received packet that can * be bound to the transaction */ @@ -887,15 +887,15 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) if (ph->pdu_header.txm_mode) { /* R1, can't do anything without metadata first */ - t->state = CF_TxnState_DROP; /* drop all incoming */ + txn->state = CF_TxnState_DROP; /* drop all incoming */ /* use inactivity timer to ultimately free the state */ } else { /* R2 can handle missing metadata, so go ahead and create a temp file */ - t->state = CF_TxnState_R2; - CF_CFDP_R_Init(t); - CF_CFDP_DispatchRecv(t, ph); /* re-dispatch to enter r2 */ + txn->state = CF_TxnState_R2; + CF_CFDP_R_Init(txn); + CF_CFDP_DispatchRecv(txn, ph); /* re-dispatch to enter r2 */ } } else @@ -906,34 +906,34 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) switch (fdh->directive_code) { case CF_CFDP_FileDirective_METADATA: - status = CF_CFDP_RecvMd(t, ph); + status = CF_CFDP_RecvMd(txn, ph); if (!status) { /* NOTE: whether or not class 1 or 2, get a free chunks. It's cheap, and simplifies cleanup path */ - t->state = ph->pdu_header.txm_mode ? CF_TxnState_R1 : CF_TxnState_R2; - t->flags.rx.md_recv = 1; - CF_CFDP_R_Init(t); /* initialize R */ + txn->state = ph->pdu_header.txm_mode ? CF_TxnState_R1 : CF_TxnState_R2; + txn->flags.rx.md_recv = 1; + CF_CFDP_R_Init(txn); /* initialize R */ } else { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_IDLE_MD, CFE_EVS_EventType_ERROR, "CF: got invalid md PDU -- abandoning transaction"); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error; /* leave state as idle, which will reset below */ } break; default: CFE_EVS_SendEvent(CF_EID_ERR_CFDP_FD_UNHANDLED, CFE_EVS_EventType_ERROR, "CF: unhandled file directive code 0x%02x in idle state", fdh->directive_code); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error; break; } } - if (t->state == CF_TxnState_IDLE) + if (txn->state == CF_TxnState_IDLE) { /* state was not changed, so free the transaction */ - CF_CFDP_ResetTransaction(t, 0); + CF_CFDP_ResetTransaction(txn, 0); } } @@ -946,9 +946,9 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) CFE_Status_t CF_CFDP_InitEngine(void) { /* initialize all transaction nodes */ - CF_History_t * h; - CF_Transaction_t * t = CF_AppData.engine.transactions; - CF_ChunkWrapper_t *c = CF_AppData.engine.chunks; + CF_History_t * history; + CF_Transaction_t * txn = CF_AppData.engine.transactions; + CF_ChunkWrapper_t *cw = CF_AppData.engine.chunks; CFE_Status_t ret = CFE_SUCCESS; int chunk_mem_offset = 0; int i; @@ -1016,26 +1016,26 @@ CFE_Status_t CF_CFDP_InitEngine(void) } } - for (j = 0; j < CF_NUM_TRANSACTIONS_PER_CHANNEL; ++j, ++t) + for (j = 0; j < CF_NUM_TRANSACTIONS_PER_CHANNEL; ++j, ++txn) { - t->chan_num = i; - CF_FreeTransaction(t); + txn->chan_num = i; + CF_FreeTransaction(txn); - for (k = 0; k < CF_Direction_NUM; ++k, ++c) + for (k = 0; k < CF_Direction_NUM; ++k, ++cw) { CF_Assert((chunk_mem_offset + CF_DIR_MAX_CHUNKS[k][i]) <= CF_NUM_CHUNKS_ALL_CHANNELS); - CF_ChunkListInit(&c->chunks, CF_DIR_MAX_CHUNKS[k][i], &CF_AppData.engine.chunk_mem[chunk_mem_offset]); + CF_ChunkListInit(&cw->chunks, CF_DIR_MAX_CHUNKS[k][i], &CF_AppData.engine.chunk_mem[chunk_mem_offset]); chunk_mem_offset += CF_DIR_MAX_CHUNKS[k][i]; - CF_CList_InitNode(&c->cl_node); - CF_CList_InsertBack(&CF_AppData.engine.channels[i].cs[k], &c->cl_node); + CF_CList_InitNode(&cw->cl_node); + CF_CList_InsertBack(&CF_AppData.engine.channels[i].cs[k], &cw->cl_node); } } for (j = 0; j < CF_NUM_HISTORIES_PER_CHANNEL; ++j) { - h = &CF_AppData.engine.histories[(i * CF_NUM_HISTORIES_PER_CHANNEL) + j]; - CF_CList_InitNode(&h->cl_node); - CF_CList_InsertBack_Ex(&CF_AppData.engine.channels[i], CF_QueueIdx_HIST_FREE, &h->cl_node); + history = &CF_AppData.engine.histories[(i * CF_NUM_HISTORIES_PER_CHANNEL) + j]; + CF_CList_InitNode(&history->cl_node); + CF_CList_InsertBack_Ex(&CF_AppData.engine.channels[i], CF_QueueIdx_HIST_FREE, &history->cl_node); } } @@ -1056,25 +1056,25 @@ CFE_Status_t CF_CFDP_InitEngine(void) CFE_Status_t CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context) { CF_CFDP_CycleTx_args_t *args = (CF_CFDP_CycleTx_args_t *)context; - CF_Transaction_t * t = container_of(node, CF_Transaction_t, cl_node); + CF_Transaction_t * txn = container_of(node, CF_Transaction_t, cl_node); CFE_Status_t ret = 1; /* default option is exit traversal */ - if (t->flags.com.suspended) + if (txn->flags.com.suspended) { ret = 0; /* suspended, so move on to next */ } else { - CF_Assert(t->flags.com.q_index == CF_QueueIdx_TXA); /* huh? */ + CF_Assert(txn->flags.com.q_index == CF_QueueIdx_TXA); /* huh? */ - /* if no more messages, then c->cur will be set. + /* if no more messages, then chan->cur will be set. * If the transaction sent the last filedata PDU and EOF, it will move itself * off the active queue. Run until either of these occur. */ - while (!args->c->cur && t->flags.com.q_index == CF_QueueIdx_TXA) + while (!args->chan->cur && txn->flags.com.q_index == CF_QueueIdx_TXA) { - CFE_ES_PerfLogEntry(CF_PERF_ID_PDUSENT(t->chan_num)); - CF_CFDP_DispatchTx(t); - CFE_ES_PerfLogExit(CF_PERF_ID_PDUSENT(t->chan_num)); + CFE_ES_PerfLogEntry(CF_PERF_ID_PDUSENT(txn->chan_num)); + CF_CFDP_DispatchTx(txn); + CFE_ES_PerfLogExit(CF_PERF_ID_PDUSENT(txn->chan_num)); } args->ran_one = 1; @@ -1089,40 +1089,40 @@ CFE_Status_t CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_CycleTx(CF_Channel_t *c) +void CF_CFDP_CycleTx(CF_Channel_t *chan) { - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_CFDP_CycleTx_args_t args; - if (CF_AppData.config_table->chan[(c - CF_AppData.engine.channels)].dequeue_enabled) + if (CF_AppData.config_table->chan[(chan - CF_AppData.engine.channels)].dequeue_enabled) { - args = (CF_CFDP_CycleTx_args_t) {c, 0}; + args = (CF_CFDP_CycleTx_args_t) {chan, 0}; /* loop through as long as there are pending transactions, and a message buffer to send their PDUs on */ /* NOTE: tick processing is higher priority than sending new filedata PDUs, so only send however many * PDUs that can be sent once we get to here */ - if (!c->cur) + if (!chan->cur) { /* don't enter if cur is set, since we need to pick up where we left off on tick processing next wakeup */ while (true) { /* Attempt to run something on TXA */ - CF_CList_Traverse(c->qs[CF_QueueIdx_TXA], CF_CFDP_CycleTxFirstActive, &args); + CF_CList_Traverse(chan->qs[CF_QueueIdx_TXA], CF_CFDP_CycleTxFirstActive, &args); /* Keep going until CF_QueueIdx_PEND is empty or something is run */ - if (args.ran_one || c->qs[CF_QueueIdx_PEND] == NULL) + if (args.ran_one || chan->qs[CF_QueueIdx_PEND] == NULL) { break; } - t = container_of(c->qs[CF_QueueIdx_PEND], CF_Transaction_t, cl_node); - CF_MoveTransaction(t, CF_QueueIdx_TXA); + txn = container_of(chan->qs[CF_QueueIdx_PEND], CF_Transaction_t, cl_node); + CF_MoveTransaction(txn, CF_QueueIdx_TXA); } } /* in case the loop exited due to no message buffers, clear it and start from the top next time */ - c->cur = NULL; + chan->cur = NULL; } } @@ -1136,20 +1136,20 @@ CFE_Status_t CF_CFDP_DoTick(CF_CListNode_t *node, void *context) { CFE_Status_t ret = CF_CLIST_CONT; /* CF_CLIST_CONT means don't tick one, keep looking for cur */ CF_CFDP_Tick_args_t *args = (CF_CFDP_Tick_args_t *)context; - CF_Transaction_t * t = container_of(node, CF_Transaction_t, cl_node); - if (!args->c->cur || (args->c->cur == t)) + CF_Transaction_t * txn = container_of(node, CF_Transaction_t, cl_node); + if (!args->chan->cur || (args->chan->cur == txn)) { /* found where we left off, so clear that and move on */ - args->c->cur = NULL; - if (!t->flags.com.suspended) + args->chan->cur = NULL; + if (!txn->flags.com.suspended) { - args->fn(t, &args->cont); + args->fn(txn, &args->cont); } - /* if args->c->cur was set to not-NULL above, then exit early */ + /* if args->chan->cur was set to not-NULL above, then exit early */ /* NOTE: if channel is frozen, then tick processing won't have been entered. * so there is no need to check it here */ - if (args->c->cur) + if (args->chan->cur) { ret = CF_CLIST_EXIT; args->early_exit = 1; @@ -1165,7 +1165,7 @@ CFE_Status_t CF_CFDP_DoTick(CF_CListNode_t *node, void *context) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_TickTransactions(CF_Channel_t *c) +void CF_CFDP_TickTransactions(CF_Channel_t *chan) { bool reset = true; @@ -1173,16 +1173,16 @@ void CF_CFDP_TickTransactions(CF_Channel_t *c) CF_CFDP_S_Tick_Nak}; int qs[CF_TickType_NUM_TYPES] = {CF_QueueIdx_RX, CF_QueueIdx_TXW, CF_QueueIdx_TXW}; - CF_Assert(c->tick_type < CF_TickType_NUM_TYPES); + CF_Assert(chan->tick_type < CF_TickType_NUM_TYPES); - for (; c->tick_type < CF_TickType_NUM_TYPES; ++c->tick_type) + for (; chan->tick_type < CF_TickType_NUM_TYPES; ++chan->tick_type) { - CF_CFDP_Tick_args_t args = {c, fns[c->tick_type], 0, 0}; + CF_CFDP_Tick_args_t args = {chan, fns[chan->tick_type], 0, 0}; do { args.cont = 0; - CF_CList_Traverse(c->qs[qs[c->tick_type]], CF_CFDP_DoTick, &args); + CF_CList_Traverse(chan->qs[qs[chan->tick_type]], CF_CFDP_DoTick, &args); if (args.early_exit) { /* early exit means we ran out of available outgoing messages this wakeup. @@ -1201,7 +1201,7 @@ void CF_CFDP_TickTransactions(CF_Channel_t *c) * * New file data on TXA */ - if (c->tick_type != CF_TickType_TXW_NAK) + if (chan->tick_type != CF_TickType_TXW_NAK) { reset = false; } @@ -1218,7 +1218,7 @@ void CF_CFDP_TickTransactions(CF_Channel_t *c) if (reset) { - c->tick_type = CF_TickType_RX; /* reset tick type */ + chan->tick_type = CF_TickType_RX; /* reset tick type */ } } @@ -1228,12 +1228,12 @@ void CF_CFDP_TickTransactions(CF_Channel_t *c) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_InitTxnTxFile(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority) +void CF_CFDP_InitTxnTxFile(CF_Transaction_t *txn, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority) { - t->chan_num = chan; - t->priority = priority; - t->keep = keep; - t->state = cfdp_class ? CF_TxnState_S2 : CF_TxnState_S1; + txn->chan_num = chan; + txn->priority = priority; + txn->keep = keep; + txn->state = cfdp_class ? CF_TxnState_S2 : CF_TxnState_S1; } /*---------------------------------------------------------------- @@ -1241,31 +1241,31 @@ void CF_CFDP_InitTxnTxFile(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_class, uint * Internal helper routine only, not part of API. * *-----------------------------------------------------------------*/ -static void CF_CFDP_TxFile_Initiate(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, +static void CF_CFDP_TxFile_Initiate(CF_Transaction_t *txn, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, CF_EntityId_t dest_id) { CFE_EVS_SendEvent(CF_EID_INF_CFDP_S_START_SEND, CFE_EVS_EventType_INFORMATION, "CF: start class %d tx of file %lu:%.*s -> %lu:%.*s", cfdp_class + 1, (unsigned long)CF_AppData.config_table->local_eid, CF_FILENAME_MAX_LEN, - t->history->fnames.src_filename, (unsigned long)dest_id, CF_FILENAME_MAX_LEN, - t->history->fnames.dst_filename); + txn->history->fnames.src_filename, (unsigned long)dest_id, CF_FILENAME_MAX_LEN, + txn->history->fnames.dst_filename); - CF_CFDP_InitTxnTxFile(t, cfdp_class, keep, chan, priority); + CF_CFDP_InitTxnTxFile(txn, cfdp_class, keep, chan, priority); /* Increment sequence number for new transaction */ ++CF_AppData.engine.seq_num; /* Capture info for history */ - t->history->dir = CF_Direction_TX; - t->history->seq_num = CF_AppData.engine.seq_num; - t->history->src_eid = CF_AppData.config_table->local_eid; - t->history->peer_eid = dest_id; + txn->history->dir = CF_Direction_TX; + txn->history->seq_num = CF_AppData.engine.seq_num; + txn->history->src_eid = CF_AppData.config_table->local_eid; + txn->history->peer_eid = dest_id; - CF_CFDP_ArmInactTimer(t); + CF_CFDP_ArmInactTimer(txn); /* NOTE: whether or not class 1 or 2, get a free chunks. It's cheap, and simplifies cleanup path */ - t->chunks = CF_CFDP_FindUnusedChunks(&CF_AppData.engine.channels[chan], CF_Direction_TX); - CF_InsertSortPrio(t, CF_QueueIdx_PEND); + txn->chunks = CF_CFDP_FindUnusedChunks(&CF_AppData.engine.channels[chan], CF_Direction_TX); + CF_InsertSortPrio(txn, CF_QueueIdx_PEND); } /*---------------------------------------------------------------- @@ -1275,15 +1275,15 @@ static void CF_CFDP_TxFile_Initiate(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_cl * *-----------------------------------------------------------------*/ CFE_Status_t CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, CF_CFDP_Class_t cfdp_class, uint8 keep, - uint8 chan, uint8 priority, CF_EntityId_t dest_id) + uint8 chan_num, uint8 priority, CF_EntityId_t dest_id) { - CF_Transaction_t *t; - CF_Channel_t * c = &CF_AppData.engine.channels[chan]; - CF_Assert(chan < CF_NUM_CHANNELS); + CF_Transaction_t *txn; + CF_Channel_t * chan = &CF_AppData.engine.channels[chan_num]; + CF_Assert(chan_num < CF_NUM_CHANNELS); CFE_Status_t ret = CFE_SUCCESS; - if (c->num_cmd_tx == CF_MAX_COMMANDED_PLAYBACK_FILES_PER_CHAN) + if (chan->num_cmd_tx == CF_MAX_COMMANDED_PLAYBACK_FILES_PER_CHAN) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_MAX_CMD_TX, CFE_EVS_EventType_ERROR, "CF: max number of commanded files reached"); @@ -1291,20 +1291,20 @@ CFE_Status_t CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, } else { - t = CF_FindUnusedTransaction(&CF_AppData.engine.channels[chan]); - CF_Assert(t); /* should always have a free transaction at this point */ + txn = CF_FindUnusedTransaction(&CF_AppData.engine.channels[chan_num]); + CF_Assert(txn); /* should always have a free transaction at this point */ - CF_Assert(t->state == CF_TxnState_IDLE); + CF_Assert(txn->state == CF_TxnState_IDLE); /* NOTE: the caller of this function ensures the provided src and dst filenames are NULL terminated */ - strncpy(t->history->fnames.src_filename, src_filename, sizeof(t->history->fnames.src_filename) - 1); - t->history->fnames.src_filename[sizeof(t->history->fnames.src_filename) - 1] = 0; - strncpy(t->history->fnames.dst_filename, dst_filename, sizeof(t->history->fnames.dst_filename) - 1); - t->history->fnames.dst_filename[sizeof(t->history->fnames.dst_filename) - 1] = 0; - CF_CFDP_TxFile_Initiate(t, cfdp_class, keep, chan, priority, dest_id); + strncpy(txn->history->fnames.src_filename, src_filename, sizeof(txn->history->fnames.src_filename) - 1); + txn->history->fnames.src_filename[sizeof(txn->history->fnames.src_filename) - 1] = 0; + strncpy(txn->history->fnames.dst_filename, dst_filename, sizeof(txn->history->fnames.dst_filename) - 1); + txn->history->fnames.dst_filename[sizeof(txn->history->fnames.dst_filename) - 1] = 0; + CF_CFDP_TxFile_Initiate(txn, cfdp_class, keep, chan_num, priority, dest_id); - ++c->num_cmd_tx; - t->flags.tx.cmd_tx = 1; + ++chan->num_cmd_tx; + txn->flags.tx.cmd_tx = 1; } return ret; @@ -1315,14 +1315,14 @@ CFE_Status_t CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, * Internal helper routine only, not part of API. * *-----------------------------------------------------------------*/ -static CFE_Status_t CF_CFDP_PlaybackDir_Initiate(CF_Playback_t *p, const char *src_filename, const char *dst_filename, +static CFE_Status_t CF_CFDP_PlaybackDir_Initiate(CF_Playback_t *pb, const char *src_filename, const char *dst_filename, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, CF_EntityId_t dest_id) { CFE_Status_t ret; /* make sure the directory can be open */ - ret = OS_DirectoryOpen(&p->dir_id, src_filename); + ret = OS_DirectoryOpen(&pb->dir_id, src_filename); if (ret != OS_SUCCESS) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_OPENDIR, CFE_EVS_EventType_ERROR, @@ -1331,18 +1331,18 @@ static CFE_Status_t CF_CFDP_PlaybackDir_Initiate(CF_Playback_t *p, const char *s } else { - p->diropen = 1; - p->busy = 1; - p->keep = keep; - p->priority = priority; - p->dest_id = dest_id; - p->cfdp_class = cfdp_class; + pb->diropen = 1; + pb->busy = 1; + pb->keep = keep; + pb->priority = priority; + pb->dest_id = dest_id; + pb->cfdp_class = cfdp_class; /* NOTE: the caller of this function ensures the provided src and dst filenames are NULL terminated */ - strncpy(p->fnames.src_filename, src_filename, sizeof(p->fnames.src_filename) - 1); - p->fnames.src_filename[sizeof(p->fnames.src_filename) - 1] = 0; - strncpy(p->fnames.dst_filename, dst_filename, sizeof(p->fnames.dst_filename) - 1); - p->fnames.dst_filename[sizeof(p->fnames.dst_filename) - 1] = 0; + strncpy(pb->fnames.src_filename, src_filename, sizeof(pb->fnames.src_filename) - 1); + pb->fnames.src_filename[sizeof(pb->fnames.src_filename) - 1] = 0; + strncpy(pb->fnames.dst_filename, dst_filename, sizeof(pb->fnames.dst_filename) - 1); + pb->fnames.dst_filename[sizeof(pb->fnames.dst_filename) - 1] = 0; } /* the executor will start the transfer next cycle */ @@ -1359,12 +1359,12 @@ CFE_Status_t CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filen uint8 keep, uint8 chan, uint8 priority, uint16 dest_id) { int i; - CF_Playback_t *p; + CF_Playback_t *pb; for (i = 0; i < CF_MAX_COMMANDED_PLAYBACK_DIRECTORIES_PER_CHAN; ++i) { - p = &CF_AppData.engine.channels[chan].playback[i]; - if (!p->busy) + pb = &CF_AppData.engine.channels[chan].playback[i]; + if (!pb->busy) { break; } @@ -1376,7 +1376,7 @@ CFE_Status_t CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filen return CF_ERROR; } - return CF_CFDP_PlaybackDir_Initiate(p, src_filename, dst_filename, cfdp_class, keep, chan, priority, dest_id); + return CF_CFDP_PlaybackDir_Initiate(pb, src_filename, dst_filename, cfdp_class, keep, chan, priority, dest_id); } /*---------------------------------------------------------------- @@ -1385,7 +1385,7 @@ CFE_Status_t CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filen * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p) +void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *chan, CF_Playback_t *pb) { CF_Transaction_t *pt; os_dirent_t dirent; @@ -1395,10 +1395,10 @@ void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p) memset(&dirent, 0, sizeof(dirent)); - while (p->diropen && (p->num_ts < CF_NUM_TRANSACTIONS_PER_PLAYBACK)) + while (pb->diropen && (pb->num_ts < CF_NUM_TRANSACTIONS_PER_PLAYBACK)) { CFE_ES_PerfLogEntry(CF_PERF_ID_DIRREAD); - status = OS_DirectoryRead(p->dir_id, &dirent); + status = OS_DirectoryRead(pb->dir_id, &dirent); CFE_ES_PerfLogExit(CF_PERF_ID_DIRREAD); if (status == CFE_SUCCESS) @@ -1408,39 +1408,39 @@ void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p) continue; } - pt = CF_FindUnusedTransaction(c); + pt = CF_FindUnusedTransaction(chan); CF_Assert(pt); /* should be impossible not to have one because there are limits on the number of uses of them */ /* the -1 below is to make room for the slash */ snprintf(pt->history->fnames.src_filename, sizeof(pt->history->fnames.src_filename), "%.*s/%.*s", - CF_FILENAME_MAX_PATH - 1, p->fnames.src_filename, CF_FILENAME_MAX_NAME - 1, dirent.FileName); + CF_FILENAME_MAX_PATH - 1, pb->fnames.src_filename, CF_FILENAME_MAX_NAME - 1, dirent.FileName); snprintf(pt->history->fnames.dst_filename, sizeof(pt->history->fnames.dst_filename), "%.*s/%.*s", - CF_FILENAME_MAX_PATH - 1, p->fnames.dst_filename, CF_FILENAME_MAX_NAME - 1, dirent.FileName); + CF_FILENAME_MAX_PATH - 1, pb->fnames.dst_filename, CF_FILENAME_MAX_NAME - 1, dirent.FileName); /* in case snprintf didn't have room for NULL terminator */ pt->history->fnames.src_filename[CF_FILENAME_MAX_LEN - 1] = 0; pt->history->fnames.dst_filename[CF_FILENAME_MAX_LEN - 1] = 0; - CF_CFDP_TxFile_Initiate(pt, p->cfdp_class, p->keep, (c - CF_AppData.engine.channels), p->priority, - p->dest_id); + CF_CFDP_TxFile_Initiate(pt, pb->cfdp_class, pb->keep, (chan - CF_AppData.engine.channels), pb->priority, + pb->dest_id); - pt->p = p; - ++p->num_ts; + pt->pb = pb; + ++pb->num_ts; } else { /* PFTO: can we figure out the difference between "end of dir" and an error? */ - OS_DirectoryClose(p->dir_id); - p->diropen = 0; + OS_DirectoryClose(pb->dir_id); + pb->diropen = 0; } } - if (!p->diropen && !p->num_ts) + if (!pb->diropen && !pb->num_ts) { /* the directory has been exhausted, and there are no more active transactions * for this playback -- so mark it as not busy */ - p->busy = 0; + pb->busy = 0; } } @@ -1473,15 +1473,15 @@ static void CF_CFDP_UpdatePollPbCounted(CF_Playback_t *pb, int up, uint8 *counte * Internal helper routine only, not part of API. * *-----------------------------------------------------------------*/ -static void CF_CFDP_ProcessPlaybackDirectories(CF_Channel_t *c) +static void CF_CFDP_ProcessPlaybackDirectories(CF_Channel_t *chan) { int i; - const int chan_index = (c - CF_AppData.engine.channels); + const int chan_index = (chan - CF_AppData.engine.channels); for (i = 0; i < CF_MAX_COMMANDED_PLAYBACK_DIRECTORIES_PER_CHAN; ++i) { - CF_CFDP_ProcessPlaybackDirectory(c, &c->playback[i]); - CF_CFDP_UpdatePollPbCounted(&c->playback[i], c->playback[i].busy, + CF_CFDP_ProcessPlaybackDirectory(chan, &chan->playback[i]); + CF_CFDP_UpdatePollPbCounted(&chan->playback[i], chan->playback[i].busy, &CF_AppData.hk.channel_hk[chan_index].playback_counter); } } @@ -1492,9 +1492,9 @@ static void CF_CFDP_ProcessPlaybackDirectories(CF_Channel_t *c) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c) +void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *chan) { - CF_Poll_t * p; + CF_Poll_t * poll; CF_ChannelConfig_t *cc; CF_PollDir_t * pd; int i; @@ -1504,54 +1504,54 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c) for (i = 0; i < CF_MAX_POLLING_DIR_PER_CHAN; ++i) { - p = &c->poll[i]; - chan_index = (c - CF_AppData.engine.channels); + poll = &chan->poll[i]; + chan_index = (chan - CF_AppData.engine.channels); cc = &CF_AppData.config_table->chan[chan_index]; pd = &cc->polldir[i]; count_check = 0; if (pd->enabled) { - if (!p->pb.busy && !p->pb.num_ts) + if (!poll->pb.busy && !poll->pb.num_ts) { - if (!p->timer_set && pd->interval_sec) + if (!poll->timer_set && pd->interval_sec) { /* timer was not set, so set it now */ - CF_Timer_InitRelSec(&p->interval_timer, pd->interval_sec); - p->timer_set = 1; + CF_Timer_InitRelSec(&poll->interval_timer, pd->interval_sec); + poll->timer_set = 1; } - else if (CF_Timer_Expired(&p->interval_timer)) + else if (CF_Timer_Expired(&poll->interval_timer)) { /* the timer has expired */ - ret = CF_CFDP_PlaybackDir_Initiate(&p->pb, pd->src_dir, pd->dst_dir, pd->cfdp_class, 0, chan_index, + ret = CF_CFDP_PlaybackDir_Initiate(&poll->pb, pd->src_dir, pd->dst_dir, pd->cfdp_class, 0, chan_index, pd->priority, pd->dest_eid); if (!ret) { - p->timer_set = 0; + poll->timer_set = 0; } else { /* error occurred in playback directory, so reset the timer */ /* an event is sent in CF_CFDP_PlaybackDir_Initiate so there is no reason to * to have another here */ - CF_Timer_InitRelSec(&p->interval_timer, pd->interval_sec); + CF_Timer_InitRelSec(&poll->interval_timer, pd->interval_sec); } } else { - CF_Timer_Tick(&p->interval_timer); + CF_Timer_Tick(&poll->interval_timer); } } else { /* playback is active, so step it */ - CF_CFDP_ProcessPlaybackDirectory(c, &p->pb); + CF_CFDP_ProcessPlaybackDirectory(chan, &poll->pb); } count_check = 1; } - CF_CFDP_UpdatePollPbCounted(&p->pb, count_check, &CF_AppData.hk.channel_hk[chan_index].poll_counter); + CF_CFDP_UpdatePollPbCounted(&poll->pb, count_check, &CF_AppData.hk.channel_hk[chan_index].poll_counter); } } @@ -1563,18 +1563,18 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c) *-----------------------------------------------------------------*/ void CF_CFDP_CycleEngine(void) { - CF_Channel_t *c; + CF_Channel_t *chan; int i; if (CF_AppData.engine.enabled) { for (i = 0; i < CF_NUM_CHANNELS; ++i) { - c = &CF_AppData.engine.channels[i]; + chan = &CF_AppData.engine.channels[i]; CF_AppData.engine.outgoing_counter = 0; /* consume all received messages, even if channel is frozen */ - CF_CFDP_ReceiveMessage(c); + CF_CFDP_ReceiveMessage(chan); if (!CF_AppData.hk.channel_hk[i].frozen) { @@ -1583,13 +1583,13 @@ void CF_CFDP_CycleEngine(void) * PDUs. */ /* cycle all transactions (tick) */ - CF_CFDP_TickTransactions(c); + CF_CFDP_TickTransactions(chan); /* cycle the current tx transaction */ - CF_CFDP_CycleTx(c); + CF_CFDP_CycleTx(chan); - CF_CFDP_ProcessPlaybackDirectories(c); - CF_CFDP_ProcessPollingDirectories(c); + CF_CFDP_ProcessPlaybackDirectories(chan); + CF_CFDP_ProcessPollingDirectories(chan); } } } @@ -1601,63 +1601,63 @@ void CF_CFDP_CycleEngine(void) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_ResetTransaction(CF_Transaction_t *t, int keep_history) +void CF_CFDP_ResetTransaction(CF_Transaction_t *txn, int keep_history) { char * filename; char destination[OS_MAX_PATH_LEN]; osal_status_t status = OS_ERROR; - CF_Channel_t *c = &CF_AppData.engine.channels[t->chan_num]; - CF_Assert(t->chan_num < CF_NUM_CHANNELS); + CF_Channel_t *chan = &CF_AppData.engine.channels[txn->chan_num]; + CF_Assert(txn->chan_num < CF_NUM_CHANNELS); - CF_CFDP_SendEotPkt(t); + CF_CFDP_SendEotPkt(txn); - CF_DequeueTransaction(t); + CF_DequeueTransaction(txn); - if (OS_ObjectIdDefined(t->fd)) + if (OS_ObjectIdDefined(txn->fd)) { - CF_WrappedClose(t->fd); - if (!t->keep) + CF_WrappedClose(txn->fd); + if (!txn->keep) { - if (CF_CFDP_IsSender(t)) + if (CF_CFDP_IsSender(txn)) { /* If move directory is defined attempt move */ - if (CF_AppData.config_table->chan[t->chan_num].move_dir[0] != 0) + if (CF_AppData.config_table->chan[txn->chan_num].move_dir[0] != 0) { - filename = strrchr(t->history->fnames.src_filename, '/'); + filename = strrchr(txn->history->fnames.src_filename, '/'); if (filename != NULL) { snprintf(destination, sizeof(destination), "%s%s", - CF_AppData.config_table->chan[t->chan_num].move_dir, filename); - status = OS_mv(t->history->fnames.src_filename, destination); + CF_AppData.config_table->chan[txn->chan_num].move_dir, filename); + status = OS_mv(txn->history->fnames.src_filename, destination); } } if (status != OS_SUCCESS) { - OS_remove(t->history->fnames.src_filename); + OS_remove(txn->history->fnames.src_filename); } } else { - OS_remove(t->history->fnames.dst_filename); + OS_remove(txn->history->fnames.dst_filename); } } } /* extra bookkeeping for tx direction only */ - if (t->history->dir == CF_Direction_TX) + if (txn->history->dir == CF_Direction_TX) { - if (t->flags.tx.cmd_tx) + if (txn->flags.tx.cmd_tx) { - CF_Assert(c->num_cmd_tx); /* sanity check */ - --c->num_cmd_tx; + CF_Assert(chan->num_cmd_tx); /* sanity check */ + --chan->num_cmd_tx; } - if (t->p) + if (txn->pb) { /* a playback's transaction is now done, decrement the playback counter */ - CF_Assert(t->p->num_ts); - --t->p->num_ts; + CF_Assert(txn->pb->num_ts); + --txn->pb->num_ts; } } @@ -1665,20 +1665,20 @@ void CF_CFDP_ResetTransaction(CF_Transaction_t *t, int keep_history) /* move transaction history to history queue */ if (keep_history) { - CF_CList_InsertBack_Ex(c, CF_QueueIdx_HIST, &t->history->cl_node); + CF_CList_InsertBack_Ex(chan, CF_QueueIdx_HIST, &txn->history->cl_node); } else { - CF_CList_InsertBack_Ex(c, CF_QueueIdx_HIST_FREE, &t->history->cl_node); + CF_CList_InsertBack_Ex(chan, CF_QueueIdx_HIST_FREE, &txn->history->cl_node); } - CF_CList_InsertBack(&c->cs[!!CF_CFDP_IsSender(t)], &t->chunks->cl_node); + CF_CList_InsertBack(&chan->cs[!!CF_CFDP_IsSender(txn)], &txn->chunks->cl_node); - if (c->cur == t) + if (chan->cur == txn) { - c->cur = NULL; /* this transaction couldn't get a message previously, so clear it here to avoid problems */ + chan->cur = NULL; /* this transaction couldn't get a message previously, so clear it here to avoid problems */ } - CF_FreeTransaction(t); + CF_FreeTransaction(txn); } /*---------------------------------------------------------------- @@ -1687,11 +1687,11 @@ void CF_CFDP_ResetTransaction(CF_Transaction_t *t, int keep_history) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_SetTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) +void CF_CFDP_SetTxnStatus(CF_Transaction_t *txn, CF_TxnStatus_t txn_stat) { - if (!CF_TxnStatus_IsError(t->history->txn_stat)) + if (!CF_TxnStatus_IsError(txn->history->txn_stat)) { - t->history->txn_stat = txn_stat; + txn->history->txn_stat = txn_stat; } } @@ -1701,7 +1701,7 @@ void CF_CFDP_SetTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_SendEotPkt(CF_Transaction_t *t) +void CF_CFDP_SendEotPkt(CF_Transaction_t *txn) { CF_EotPktBuf_t *PktBuf; @@ -1714,16 +1714,16 @@ void CF_CFDP_SendEotPkt(CF_Transaction_t *t) { CFE_MSG_Init(&PktBuf->eot.tlm_header.Msg, CFE_SB_ValueToMsgId(CF_EOT_TLM_MID), sizeof(PktBuf->eot)); - PktBuf->eot.channel = t->chan_num; - PktBuf->eot.direction = t->history->dir; - PktBuf->eot.fnames = t->history->fnames; - PktBuf->eot.state = t->state; - PktBuf->eot.txn_stat = t->history->txn_stat; - PktBuf->eot.src_eid = t->history->src_eid; - PktBuf->eot.peer_eid = t->history->peer_eid; - PktBuf->eot.seq_num = t->history->seq_num; - PktBuf->eot.fsize = t->fsize; - PktBuf->eot.crc_result = t->crc.result; + PktBuf->eot.channel = txn->chan_num; + PktBuf->eot.direction = txn->history->dir; + PktBuf->eot.fnames = txn->history->fnames; + PktBuf->eot.state = txn->state; + PktBuf->eot.txn_stat = txn->history->txn_stat; + PktBuf->eot.src_eid = txn->history->src_eid; + PktBuf->eot.peer_eid = txn->history->peer_eid; + PktBuf->eot.seq_num = txn->history->seq_num; + PktBuf->eot.fsize = txn->fsize; + PktBuf->eot.crc_result = txn->crc.result; /* ** Timestamp and send eod of transaction telemetry @@ -1759,14 +1759,14 @@ int CF_CFDP_CopyStringFromLV(char *buf, size_t buf_maxsz, const CF_Logical_Lv_t * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_CancelTransaction(CF_Transaction_t *t) +void CF_CFDP_CancelTransaction(CF_Transaction_t *txn) { - void (*fns[2])(CF_Transaction_t * t) = {CF_CFDP_R_Cancel, CF_CFDP_S_Cancel}; - if (!t->flags.com.canceled) + void (*fns[2])(CF_Transaction_t * txn) = {CF_CFDP_R_Cancel, CF_CFDP_S_Cancel}; + if (!txn->flags.com.canceled) { - t->flags.com.canceled = 1; - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_CANCEL_REQUEST_RECEIVED); - fns[!!CF_CFDP_IsSender(t)](t); + txn->flags.com.canceled = 1; + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_CANCEL_REQUEST_RECEIVED); + fns[!!CF_CFDP_IsSender(txn)](txn); } } @@ -1776,12 +1776,12 @@ void CF_CFDP_CancelTransaction(CF_Transaction_t *t) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *n, void *context) +CFE_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *node, void *context) { - CF_Transaction_t *t = container_of(n, CF_Transaction_t, cl_node); - if (OS_ObjectIdDefined(t->fd)) + CF_Transaction_t *txn = container_of(node, CF_Transaction_t, cl_node); + if (OS_ObjectIdDefined(txn->fd)) { - CF_WrappedClose(t->fd); + CF_WrappedClose(txn->fd); } return CF_CLIST_CONT; } @@ -1797,40 +1797,40 @@ void CF_CFDP_DisableEngine(void) int i; int j; static const CF_QueueIdx_t CLOSE_QUEUES[] = {CF_QueueIdx_RX, CF_QueueIdx_TXA, CF_QueueIdx_TXW}; - CF_Channel_t * c; + CF_Channel_t * chan; CF_AppData.engine.enabled = 0; for (i = 0; i < CF_NUM_CHANNELS; ++i) { - c = &CF_AppData.engine.channels[i]; + chan = &CF_AppData.engine.channels[i]; /* first, close all active files */ for (j = 0; j < (sizeof(CLOSE_QUEUES) / sizeof(CLOSE_QUEUES[0])); ++j) { - CF_CList_Traverse(c->qs[CLOSE_QUEUES[j]], CF_CFDP_CloseFiles, NULL); + CF_CList_Traverse(chan->qs[CLOSE_QUEUES[j]], CF_CFDP_CloseFiles, NULL); } /* any playback directories need to have their directory ids closed */ for (j = 0; j < CF_MAX_COMMANDED_PLAYBACK_DIRECTORIES_PER_CHAN; ++j) { - if (c->playback[j].busy) + if (chan->playback[j].busy) { - OS_DirectoryClose(c->playback[j].dir_id); + OS_DirectoryClose(chan->playback[j].dir_id); } } for (j = 0; j < CF_MAX_POLLING_DIR_PER_CHAN; ++j) { - if (c->poll[j].pb.busy) + if (chan->poll[j].pb.busy) { - OS_DirectoryClose(c->poll[j].pb.dir_id); + OS_DirectoryClose(chan->poll[j].pb.dir_id); } } /* finally all queue counters must be reset */ memset(&CF_AppData.hk.channel_hk[i].q_size, 0, sizeof(CF_AppData.hk.channel_hk[i].q_size)); - CFE_SB_DeletePipe(c->pipe); + CFE_SB_DeletePipe(chan->pipe); } } diff --git a/fsw/src/cf_cfdp.h b/fsw/src/cf_cfdp.h index 836881ea..e7e14564 100644 --- a/fsw/src/cf_cfdp.h +++ b/fsw/src/cf_cfdp.h @@ -33,7 +33,7 @@ */ typedef struct CF_CFDP_CycleTx_args { - CF_Channel_t *c; /**< \brief channel structure */ + CF_Channel_t *chan; /**< \brief channel structure */ int ran_one; /**< \brief should be set to 1 if a transaction was cycled */ } CF_CFDP_CycleTx_args_t; @@ -42,7 +42,7 @@ typedef struct CF_CFDP_CycleTx_args */ typedef struct CF_CFDP_Tick_args { - CF_Channel_t *c; /**< \brief channel structure */ + CF_Channel_t *chan; /**< \brief channel structure */ void (*fn)(CF_Transaction_t *, int *); /**< \brief function pointer */ int early_exit; /**< \brief early exit result */ int cont; /**< \brief if 1, then re-traverse the list */ @@ -86,12 +86,12 @@ void CF_CFDP_DecodeStart(CF_DecoderState_t *pdec, const void *msgbuf, CF_Logical /** @brief Reset a transaction and all its internals to an unused state. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param keep_history Whether the transaction info should be preserved in history */ -void CF_CFDP_ResetTransaction(CF_Transaction_t *t, int keep_history); +void CF_CFDP_ResetTransaction(CF_Transaction_t *txn, int keep_history); /************************************************************************/ /** @brief Helper function to store transaction status code only @@ -100,22 +100,22 @@ void CF_CFDP_ResetTransaction(CF_Transaction_t *t, int keep_history); * or take any other protocol/state machine actions. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param txn_stat Status Code value to set within transaction */ -void CF_CFDP_SetTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat); +void CF_CFDP_SetTxnStatus(CF_Transaction_t *txn, CF_TxnStatus_t txn_stat); /************************************************************************/ /** @brief Send an end of transaction packet. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_SendEotPkt(CF_Transaction_t *t); +void CF_CFDP_SendEotPkt(CF_Transaction_t *txn); /************************************************************************/ /** @brief Initialization function for the CFDP engine @@ -202,9 +202,9 @@ CFE_Status_t CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filen /** @brief Build the PDU header in the output buffer to prepare to send a packet. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param directive_code Code to use for file directive headers (set to 0 for data) * @param src_eid Value to set in source entity ID field * @param dst_eid Value to set in destination entity ID field @@ -215,7 +215,7 @@ CFE_Status_t CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filen * @returns Pointer to PDU buffer which may be filled with additional data * @retval NULL if no message buffer available */ -CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *t, CF_CFDP_FileDirective_t directive_code, +CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *txn, CF_CFDP_FileDirective_t directive_code, CF_EntityId_t src_eid, CF_EntityId_t dst_eid, bool towards_sender, CF_TransactionSeq_t tsn, bool silent); @@ -223,23 +223,23 @@ CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *t, CF /** @brief Build a metadata PDU for transmit. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * * @returns CFE_Status_t status code * @retval CFE_SUCCESS on success. * @retval CF_SEND_PDU_NO_BUF_AVAIL_ERROR if message buffer cannot be obtained. */ -CFE_Status_t CF_CFDP_SendMd(CF_Transaction_t *t); +CFE_Status_t CF_CFDP_SendMd(CF_Transaction_t *txn); /************************************************************************/ /** @brief Send a previously-assembled filedata PDU for transmit. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to logical PDU buffer content * * @note Unlike other "send" routines, the file data PDU must be acquired and @@ -250,33 +250,33 @@ CFE_Status_t CF_CFDP_SendMd(CF_Transaction_t *t); * @returns CFE_Status_t status code * @retval CFE_SUCCESS on success. (error checks not yet implemented) */ -CFE_Status_t CF_CFDP_SendFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +CFE_Status_t CF_CFDP_SendFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Build an EOF PDU for transmit. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * * @returns CFE_Status_t status code * @retval CFE_SUCCESS on success. * @retval CF_SEND_PDU_NO_BUF_AVAIL_ERROR if message buffer cannot be obtained. */ -CFE_Status_t CF_CFDP_SendEof(CF_Transaction_t *t); +CFE_Status_t CF_CFDP_SendEof(CF_Transaction_t *txn); /************************************************************************/ /** @brief Build an ACK PDU for transmit. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * * @note CF_CFDP_SendAck() takes a CF_TransactionSeq_t instead of getting it from transaction history because * of the special case where a FIN-ACK must be sent for an unknown transaction. It's better for * long term maintenance to not build an incomplete CF_History_t for it. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ts Transaction ACK status * @param dir_code File directive code being ACK'ed * @param cc Condition code of transaction @@ -287,16 +287,16 @@ CFE_Status_t CF_CFDP_SendEof(CF_Transaction_t *t); * @retval CFE_SUCCESS on success. * @retval CF_SEND_PDU_NO_BUF_AVAIL_ERROR if message buffer cannot be obtained. */ -CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_CFDP_FileDirective_t dir_code, +CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *txn, CF_CFDP_AckTxnStatus_t ts, CF_CFDP_FileDirective_t dir_code, CF_CFDP_ConditionCode_t cc, CF_EntityId_t peer_eid, CF_TransactionSeq_t tsn); /************************************************************************/ /** @brief Build a FIN PDU for transmit. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param dc Final delivery status code (complete or incomplete) * @param fs Final file status (retained or rejected, etc) * @param cc Final CFDP condition code @@ -305,16 +305,16 @@ CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_ * @retval CFE_SUCCESS on success. * @retval CF_SEND_PDU_NO_BUF_AVAIL_ERROR if message buffer cannot be obtained. */ -CFE_Status_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, +CFE_Status_t CF_CFDP_SendFin(CF_Transaction_t *txn, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, CF_CFDP_ConditionCode_t cc); /************************************************************************/ /** @brief Send a previously-assembled NAK PDU for transmit. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to logical PDU buffer content * * @note Unlike other "send" routines, the NAK PDU must be acquired and @@ -326,7 +326,7 @@ CFE_Status_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, * @retval CFE_SUCCESS on success. * @retval CF_SEND_PDU_NO_BUF_AVAIL_ERROR if message buffer cannot be obtained. */ -CFE_Status_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +CFE_Status_t CF_CFDP_SendNak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Appends a single TLV value to the logical PDU data @@ -370,16 +370,16 @@ CFE_Status_t CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph); * as a metadata PDU. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction state + * @param txn Pointer to the transaction state * @param ph The logical PDU buffer being received * * @returns integer status code * @retval CFE_SUCCESS on success * @retval CF_PDU_METADATA_ERROR on error */ -CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Unpack a file data PDU from a received message. @@ -388,9 +388,9 @@ CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * as a file data PDU. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction state + * @param txn Pointer to the transaction state * @param ph The logical PDU buffer being received * * @returns integer status code @@ -398,7 +398,7 @@ CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * @retval CF_ERROR for general errors * @retval CF_SHORT_PDU_ERROR PDU too short */ -CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Unpack an EOF PDU from a received message. @@ -407,16 +407,16 @@ CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * as an end of file PDU. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction state + * @param txn Pointer to the transaction state * @param ph The logical PDU buffer being received * * @returns integer status code * @retval CFE_SUCCESS on success * @retval CF_SHORT_PDU_ERROR on error */ -CFE_Status_t CF_CFDP_RecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +CFE_Status_t CF_CFDP_RecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Unpack an ACK PDU from a received message. @@ -425,16 +425,16 @@ CFE_Status_t CF_CFDP_RecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * as an acknowledgment PDU. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction state + * @param txn Pointer to the transaction state * @param ph The logical PDU buffer being received * * @returns integer status code * @retval CFE_SUCCESS on success * @retval CF_SHORT_PDU_ERROR on error */ -CFE_Status_t CF_CFDP_RecvAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +CFE_Status_t CF_CFDP_RecvAck(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Unpack an FIN PDU from a received message. @@ -443,16 +443,16 @@ CFE_Status_t CF_CFDP_RecvAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * as a final PDU. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction state + * @param txn Pointer to the transaction state * @param ph The logical PDU buffer being received * * @returns integer status code * @retval CFE_SUCCESS on success * @retval CF_SHORT_PDU_ERROR on error */ -CFE_Status_t CF_CFDP_RecvFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +CFE_Status_t CF_CFDP_RecvFin(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Unpack a NAK PDU from a received message. @@ -461,16 +461,16 @@ CFE_Status_t CF_CFDP_RecvFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * as a negative/non-acknowledgment PDU. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction state + * @param txn Pointer to the transaction state * @param ph The logical PDU buffer being received * * @returns integer status code * @retval CFE_SUCCESS on success * @retval CF_SHORT_PDU_ERROR on error */ -CFE_Status_t CF_CFDP_RecvNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +CFE_Status_t CF_CFDP_RecvNak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Dispatch received packet to its handler. @@ -479,24 +479,24 @@ CFE_Status_t CF_CFDP_RecvNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * based on the transaction state * * @par Assumptions, External Events, and Notes: - * t must not be null. It must be an initialized transaction. + * txn must not be null. It must be an initialized transaction. * - * @param t Pointer to the transaction state + * @param txn Pointer to the transaction state * @param ph The logical PDU buffer being received * */ -void CF_CFDP_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_DispatchRecv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Cancels a transaction. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction state + * @param txn Pointer to the transaction state * */ -void CF_CFDP_CancelTransaction(CF_Transaction_t *t); +void CF_CFDP_CancelTransaction(CF_Transaction_t *txn); /************************************************************************/ /** @brief Helper function to set tx file state in a transaction. @@ -505,16 +505,16 @@ void CF_CFDP_CancelTransaction(CF_Transaction_t *t); * structure appropriately for sending a file. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction state + * @param txn Pointer to the transaction state * @param cfdp_class Set to class 1 or class 2 * @param keep Whether to keep the local file * @param chan CF channel number * @param priority Priority of transfer * */ -void CF_CFDP_InitTxnTxFile(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority); +void CF_CFDP_InitTxnTxFile(CF_Transaction_t *txn, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority); /* functions to handle LVs (length-value, CFDP spec) */ /* returns number of bytes copied, or -1 on error */ @@ -549,26 +549,26 @@ int CF_CFDP_CopyStringFromLV(char *buf, size_t buf_maxsz, const CF_Logical_Lv_t * Helper function to arm the ACK timer and set the flag. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction state + * @param txn Pointer to the transaction state */ -void CF_CFDP_ArmAckTimer(CF_Transaction_t *t); +void CF_CFDP_ArmAckTimer(CF_Transaction_t *txn); /************************************************************************/ /** @brief Receive state function to ignore a packet. * * @par Description * This function signature must match all receive state functions. - * The parameter t is ignored here. + * The parameter txn is ignored here. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction state + * @param txn Pointer to the transaction state * @param ph The logical PDU buffer being received */ -void CF_CFDP_RecvDrop(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_RecvDrop(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Receive state function to process new rx transaction. @@ -581,12 +581,12 @@ void CF_CFDP_RecvDrop(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * an R2 transaction must still be started. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. There must be a received message. + * txn must not be NULL. There must be a received message. * - * @param t Pointer to the transaction state + * @param txn Pointer to the transaction state * @param ph The logical PDU buffer being received */ -void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_RecvIdle(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief List traversal function to close all files in all active transactions. @@ -594,15 +594,15 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * This helper is used in conjunction with CF_CList_Traverse(). * * @par Assumptions, External Events, and Notes: - * n must not be NULL. + * node must not be NULL. * - * @param n List node pointer + * @param node List node pointer * @param context Opaque pointer, not used in this function * * @returns integer traversal code * @retval Always CF_LIST_CONT indicate list traversal should not exit early. */ -CFE_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *n, void *context); +CFE_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *node, void *context); /************************************************************************/ /** @brief Cycle the current active tx or make a new one active. @@ -616,9 +616,9 @@ CFE_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *n, void *context); * @par Assumptions, External Events, and Notes: * None * - * @param c Channel to cycle + * @param chan Channel to cycle */ -void CF_CFDP_CycleTx(CF_Channel_t *c); +void CF_CFDP_CycleTx(CF_Channel_t *chan); /************************************************************************/ /** @brief List traversal function that cycles the first active tx. @@ -651,11 +651,11 @@ CFE_Status_t CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context); * once for regular tick processing, and one for NAK response. * * @par Assumptions, External Events, and Notes: - * c must not be NULL. + * chan must not be NULL. * - * @param c Channel to tick + * @param chan Channel to tick */ -void CF_CFDP_TickTransactions(CF_Channel_t *c); +void CF_CFDP_TickTransactions(CF_Channel_t *chan); /************************************************************************/ /** @brief Step each active playback directory. @@ -665,12 +665,12 @@ void CF_CFDP_TickTransactions(CF_Channel_t *c); * if a valid file is found initiates playback on it. * * @par Assumptions, External Events, and Notes: - * c must not be NULL, p must not be NULL. + * chan must not be NULL, pb must not be NULL. * - * @param c The channel associated with the playback - * @param p The playback state + * @param chan The channel associated with the playback + * @param pb The playback state */ -void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p); +void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *chan, CF_Playback_t *pb); /************************************************************************/ /** @brief Kick the dir playback if timer elapsed. @@ -680,11 +680,11 @@ void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p); * and if it has expired, starts a playback in the polling directory. * * @par Assumptions, External Events, and Notes: - * c must not be NULL. + * chan must not be NULL. * - * @param c The channel associated with the playback + * @param chan The channel associated with the playback */ -void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c); +void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *chan); /************************************************************************/ /** @brief List traversal function that calls a r or s tick function. diff --git a/fsw/src/cf_cfdp_dispatch.c b/fsw/src/cf_cfdp_dispatch.c index 085c1019..4e40b82d 100644 --- a/fsw/src/cf_cfdp_dispatch.c +++ b/fsw/src/cf_cfdp_dispatch.c @@ -37,10 +37,10 @@ * See description in cf_cfdp_dispatch.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, +void CF_CFDP_R_DispatchRecv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph, const CF_CFDP_R_SubstateDispatchTable_t *dispatch, CF_CFDP_StateRecvFunc_t fd_fn) { - CF_Assert(t->state_data.r.sub_state < CF_RxSubState_NUM_STATES); + CF_Assert(txn->state_data.receive.sub_state < CF_RxSubState_NUM_STATES); CF_CFDP_StateRecvFunc_t selected_handler; CF_Logical_PduFileDirectiveHeader_t *fdh; @@ -52,29 +52,29 @@ void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, fdh = &ph->fdirective; if (fdh->directive_code < CF_CFDP_FileDirective_INVALID_MAX) { - if (dispatch->state[t->state_data.r.sub_state] != NULL) + if (dispatch->state[txn->state_data.receive.sub_state] != NULL) { - selected_handler = dispatch->state[t->state_data.r.sub_state]->fdirective[fdh->directive_code]; + selected_handler = dispatch->state[txn->state_data.receive.sub_state]->fdirective[fdh->directive_code]; } } else { - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious; + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.spurious; CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_DC_INV, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): received PDU with invalid directive code %d for sub-state %d", - (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num, fdh->directive_code, t->state_data.r.sub_state); + (txn->state == CF_TxnState_R2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num, fdh->directive_code, txn->state_data.receive.sub_state); } } else { - if (!CF_TxnStatus_IsError(t->history->txn_stat)) + if (!CF_TxnStatus_IsError(txn->history->txn_stat)) { selected_handler = fd_fn; } else { - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.dropped; + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.dropped; } } @@ -84,7 +84,7 @@ void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, */ if (selected_handler != NULL) { - selected_handler(t, ph); + selected_handler(txn, ph); } } @@ -94,10 +94,10 @@ void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, * See description in cf_cfdp_dispatch.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, +void CF_CFDP_S_DispatchRecv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph, const CF_CFDP_S_SubstateRecvDispatchTable_t *dispatch) { - CF_Assert(t->state_data.s.sub_state < CF_TxSubState_NUM_STATES); + CF_Assert(txn->state_data.send.sub_state < CF_TxSubState_NUM_STATES); const CF_CFDP_FileDirectiveDispatchTable_t *substate_tbl; CF_CFDP_StateRecvFunc_t selected_handler; CF_Logical_PduFileDirectiveHeader_t * fdh; @@ -110,7 +110,7 @@ void CF_CFDP_S_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, if (fdh->directive_code < CF_CFDP_FileDirective_INVALID_MAX) { /* This should be silent (no event) if no handler is defined in the table */ - substate_tbl = dispatch->substate[t->state_data.s.sub_state]; + substate_tbl = dispatch->substate[txn->state_data.send.sub_state]; if (substate_tbl != NULL) { selected_handler = substate_tbl->fdirective[fdh->directive_code]; @@ -118,18 +118,18 @@ void CF_CFDP_S_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, } else { - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious; + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.spurious; CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_DC_INV, CFE_EVS_EventType_ERROR, "CF S%d(%lu:%lu): received PDU with invalid directive code %d for sub-state %d", - (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num, fdh->directive_code, t->state_data.s.sub_state); + (txn->state == CF_TxnState_S2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num, fdh->directive_code, txn->state_data.send.sub_state); } } else { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_NON_FD_PDU, CFE_EVS_EventType_ERROR, - "CF S%d(%lu:%lu): received non-file directive PDU", (t->state == CF_TxnState_S2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); + "CF S%d(%lu:%lu): received non-file directive PDU", (txn->state == CF_TxnState_S2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num); } /* check that there's a valid function pointer. If there isn't, @@ -140,7 +140,7 @@ void CF_CFDP_S_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, * ignore the received packet and keep chugging along. */ if (selected_handler) { - selected_handler(t, ph); + selected_handler(txn, ph); } } @@ -150,14 +150,14 @@ void CF_CFDP_S_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, * See description in cf_cfdp_dispatch.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S_DispatchTransmit(CF_Transaction_t *t, const CF_CFDP_S_SubstateSendDispatchTable_t *dispatch) +void CF_CFDP_S_DispatchTransmit(CF_Transaction_t *txn, const CF_CFDP_S_SubstateSendDispatchTable_t *dispatch) { CF_CFDP_StateSendFunc_t selected_handler; - selected_handler = dispatch->substate[t->state_data.s.sub_state]; + selected_handler = dispatch->substate[txn->state_data.send.sub_state]; if (selected_handler != NULL) { - selected_handler(t); + selected_handler(txn); } } @@ -167,15 +167,15 @@ void CF_CFDP_S_DispatchTransmit(CF_Transaction_t *t, const CF_CFDP_S_SubstateSen * See description in cf_cfdp_dispatch.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_TxStateDispatch(CF_Transaction_t *t, const CF_CFDP_TxnSendDispatchTable_t *dispatch) +void CF_CFDP_TxStateDispatch(CF_Transaction_t *txn, const CF_CFDP_TxnSendDispatchTable_t *dispatch) { CF_CFDP_StateSendFunc_t selected_handler; - CF_Assert(t->state < CF_TxnState_INVALID); - selected_handler = dispatch->tx[t->state]; + CF_Assert(txn->state < CF_TxnState_INVALID); + selected_handler = dispatch->tx[txn->state]; if (selected_handler != NULL) { - selected_handler(t); + selected_handler(txn); } } @@ -185,15 +185,15 @@ void CF_CFDP_TxStateDispatch(CF_Transaction_t *t, const CF_CFDP_TxnSendDispatchT * See description in cf_cfdp_dispatch.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_RxStateDispatch(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, +void CF_CFDP_RxStateDispatch(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph, const CF_CFDP_TxnRecvDispatchTable_t *dispatch) { CF_CFDP_StateRecvFunc_t selected_handler; - CF_Assert(t->state < CF_TxnState_INVALID); - selected_handler = dispatch->rx[t->state]; + CF_Assert(txn->state < CF_TxnState_INVALID); + selected_handler = dispatch->rx[txn->state]; if (selected_handler != NULL) { - selected_handler(t, ph); + selected_handler(txn, ph); } } diff --git a/fsw/src/cf_cfdp_dispatch.h b/fsw/src/cf_cfdp_dispatch.h index f3149f6a..6679d311 100644 --- a/fsw/src/cf_cfdp_dispatch.h +++ b/fsw/src/cf_cfdp_dispatch.h @@ -36,9 +36,9 @@ * used on the transmit side, where a PDU will likely be generated/sent by the handler being * invoked. * - * @param[inout] t The transaction object + * @param[inout] txn The transaction object */ -typedef void (*CF_CFDP_StateSendFunc_t)(CF_Transaction_t *t); +typedef void (*CF_CFDP_StateSendFunc_t)(CF_Transaction_t *txn); /** * @brief A function for dispatching actions to a handler, with existing PDU data @@ -47,10 +47,10 @@ typedef void (*CF_CFDP_StateSendFunc_t)(CF_Transaction_t *t); * used on the receive side where a PDU buffer is associated with the activity, which is then * interpreted by the handler being invoked. * - * @param[inout] t The transaction object + * @param[inout] txn The transaction object * @param[inout] ph The PDU buffer currently being received/processed */ -typedef void (*CF_CFDP_StateRecvFunc_t)(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +typedef void (*CF_CFDP_StateRecvFunc_t)(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /** * @brief A table of transmit handler functions based on transaction state @@ -129,12 +129,12 @@ typedef struct * * Receive file transactions primarily only react/respond to received PDUs * - * @param t Transaction + * @param txn Transaction * @param ph PDU Buffer * @param dispatch Dispatch table for file directive PDUs * @param fd_fn Function to handle file data PDUs */ -void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, +void CF_CFDP_R_DispatchRecv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph, const CF_CFDP_R_SubstateDispatchTable_t *dispatch, CF_CFDP_StateRecvFunc_t fd_fn); /************************************************************************/ @@ -144,11 +144,11 @@ void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, * Send file transactions also react/respond to received PDUs. Note that * a file data PDU is not expected here. * - * @param t Transaction + * @param txn Transaction * @param ph PDU Buffer * @param dispatch Dispatch table for file directive PDUs */ -void CF_CFDP_S_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, +void CF_CFDP_S_DispatchRecv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph, const CF_CFDP_S_SubstateRecvDispatchTable_t *dispatch); /************************************************************************/ @@ -160,10 +160,10 @@ void CF_CFDP_S_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, * This does not have an existing PDU buffer at the time of dispatch, but one may * be generated by the invoked function. * - * @param t Transaction + * @param txn Transaction * @param dispatch State-based dispatch table */ -void CF_CFDP_S_DispatchTransmit(CF_Transaction_t *t, const CF_CFDP_S_SubstateSendDispatchTable_t *dispatch); +void CF_CFDP_S_DispatchTransmit(CF_Transaction_t *txn, const CF_CFDP_S_SubstateSendDispatchTable_t *dispatch); /************************************************************************/ /** @@ -172,20 +172,20 @@ void CF_CFDP_S_DispatchTransmit(CF_Transaction_t *t, const CF_CFDP_S_SubstateSen * This does not have an existing PDU buffer at the time of dispatch, but one may * be generated by the invoked function. * - * @param t Transaction + * @param txn Transaction * @param dispatch Transaction State-based Dispatch table */ -void CF_CFDP_TxStateDispatch(CF_Transaction_t *t, const CF_CFDP_TxnSendDispatchTable_t *dispatch); +void CF_CFDP_TxStateDispatch(CF_Transaction_t *txn, const CF_CFDP_TxnSendDispatchTable_t *dispatch); /************************************************************************/ /** * @brief Top-level Dispatch function receive a PDU based on current state of a transaction * - * @param t Transaction + * @param txn Transaction * @param ph Received PDU Buffer * @param dispatch Transaction State-based Dispatch table */ -void CF_CFDP_RxStateDispatch(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, +void CF_CFDP_RxStateDispatch(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph, const CF_CFDP_TxnRecvDispatchTable_t *dispatch); #endif /* CF_CFDP_DISPATCH_H */ diff --git a/fsw/src/cf_cfdp_r.c b/fsw/src/cf_cfdp_r.c index 8d037429..2436e5fb 100644 --- a/fsw/src/cf_cfdp_r.c +++ b/fsw/src/cf_cfdp_r.c @@ -44,10 +44,10 @@ * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) +void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *txn, CF_TxnStatus_t txn_stat) { - CF_CFDP_SetTxnStatus(t, txn_stat); - t->flags.rx.send_fin = 1; + CF_CFDP_SetTxnStatus(txn, txn_stat); + txn->flags.rx.send_fin = 1; } /*---------------------------------------------------------------- @@ -56,9 +56,9 @@ void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R1_Reset(CF_Transaction_t *t) +void CF_CFDP_R1_Reset(CF_Transaction_t *txn) { - CF_CFDP_ResetTransaction(t, 1); + CF_CFDP_ResetTransaction(txn, 1); } /*---------------------------------------------------------------- @@ -67,18 +67,18 @@ void CF_CFDP_R1_Reset(CF_Transaction_t *t) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R2_Reset(CF_Transaction_t *t) +void CF_CFDP_R2_Reset(CF_Transaction_t *txn) { - if ((t->state_data.r.sub_state == CF_RxSubState_WAIT_FOR_FIN_ACK) || - (t->state_data.r.r2.eof_cc != CF_CFDP_ConditionCode_NO_ERROR) || CF_TxnStatus_IsError(t->history->txn_stat) || - t->flags.com.canceled) + if ((txn->state_data.receive.sub_state == CF_RxSubState_WAIT_FOR_FIN_ACK) || + (txn->state_data.receive.r2.eof_cc != CF_CFDP_ConditionCode_NO_ERROR) || CF_TxnStatus_IsError(txn->history->txn_stat) || + txn->flags.com.canceled) { - CF_CFDP_R1_Reset(t); /* it's done */ + CF_CFDP_R1_Reset(txn); /* it's done */ } else { /* not waiting for FIN ACK, so trigger send FIN */ - t->flags.rx.send_fin = 1; + txn->flags.rx.send_fin = 1; } } @@ -88,18 +88,18 @@ void CF_CFDP_R2_Reset(CF_Transaction_t *t) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_R_CheckCrc(CF_Transaction_t *t, uint32 expected_crc) +CFE_Status_t CF_CFDP_R_CheckCrc(CF_Transaction_t *txn, uint32 expected_crc) { CFE_Status_t ret = CFE_SUCCESS; - CF_CRC_Finalize(&t->crc); - if (t->crc.result != expected_crc) + CF_CRC_Finalize(&txn->crc); + if (txn->crc.result != expected_crc) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_CRC, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): CRC mismatch for R trans. got 0x%08lx expected 0x%08lx", - (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num, (unsigned long)t->crc.result, + (txn->state == CF_TxnState_R2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num, (unsigned long)txn->crc.result, (unsigned long)expected_crc); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.crc_mismatch; + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.crc_mismatch; ret = 1; } @@ -112,7 +112,7 @@ CFE_Status_t CF_CFDP_R_CheckCrc(CF_Transaction_t *t, uint32 expected_crc) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak) +void CF_CFDP_R2_Complete(CF_Transaction_t *txn, int ok_to_send_nak) { uint32 ret; int send_nak = 0; @@ -120,24 +120,24 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak) /* checking if r2 is complete. Check NAK list, and send NAK if appropriate */ /* if all data is present, then there will be no gaps in the chunk */ - if (!CF_TxnStatus_IsError(t->history->txn_stat)) + if (!CF_TxnStatus_IsError(txn->history->txn_stat)) { /* first, check if md is received. If not, send specialized NAK */ - if (!t->flags.rx.md_recv) + if (!txn->flags.rx.md_recv) { send_nak = 1; } else { /* only look for 1 gap, since the goal here is just to know that there are gaps */ - ret = CF_ChunkList_ComputeGaps(&t->chunks->chunks, 1, t->fsize, 0, NULL, NULL); + ret = CF_ChunkList_ComputeGaps(&txn->chunks->chunks, 1, txn->fsize, 0, NULL, NULL); if (ret) { /* there is at least 1 gap, so send a NAK */ send_nak = 1; } - else if (t->flags.rx.eof_recv) + else if (txn->flags.rx.eof_recv) { /* the EOF was received, and there are no NAKs -- process completion in send FIN state */ send_fin = 1; @@ -147,37 +147,37 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak) if (send_nak && ok_to_send_nak) { /* Increment the acknak counter */ - ++t->state_data.r.r2.acknak_count; + ++txn->state_data.receive.r2.acknak_count; /* Check limit and handle if needed */ - if (t->state_data.r.r2.acknak_count >= CF_AppData.config_table->chan[t->chan_num].nak_limit) + if (txn->state_data.receive.r2.acknak_count >= CF_AppData.config_table->chan[txn->chan_num].nak_limit) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_NAK_LIMIT, CFE_EVS_EventType_ERROR, - "CF R%d(%lu:%lu): NAK limited reach", (t->state == CF_TxnState_R2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); + "CF R%d(%lu:%lu): NAK limited reach", (txn->state == CF_TxnState_R2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num); send_fin = 1; - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.nak_limit; + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.nak_limit; /* don't use CF_CFDP_R2_SetFinTxnStatus because many places in this function set send_fin */ - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_NAK_LIMIT_REACHED); - t->state_data.r.r2.acknak_count = 0; /* reset for fin/ack */ + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_NAK_LIMIT_REACHED); + txn->state_data.receive.r2.acknak_count = 0; /* reset for fin/ack */ } else { - t->flags.rx.send_nak = 1; + txn->flags.rx.send_nak = 1; } } if (send_fin) { - t->flags.rx.complete = 1; /* latch completeness, since send_fin is cleared later */ + txn->flags.rx.complete = 1; /* latch completeness, since send_fin is cleared later */ /* the transaction is now considered complete, but this will not overwrite an * error status code if there was one set */ - CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_NO_ERROR); + CF_CFDP_R2_SetFinTxnStatus(txn, CF_TxnStatus_NO_ERROR); } /* always go to CF_RxSubState_FILEDATA, and let tick change state */ - t->state_data.r.sub_state = CF_RxSubState_FILEDATA; + txn->state_data.receive.sub_state = CF_RxSubState_FILEDATA; } } @@ -187,7 +187,7 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_R_ProcessFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { const CF_Logical_PduFileDataHeader_t *fd; int32 fret; @@ -203,38 +203,38 @@ CFE_Status_t CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph * adjustments here, just write it. */ - if (t->state_data.r.cached_pos != fd->offset) + if (txn->state_data.receive.cached_pos != fd->offset) { - fret = CF_WrappedLseek(t->fd, fd->offset, OS_SEEK_SET); + fret = CF_WrappedLseek(txn->fd, fd->offset, OS_SEEK_SET); if (fret != fd->offset) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_SEEK_FD, CFE_EVS_EventType_ERROR, - "CF R%d(%lu:%lu): failed to seek offset %ld, got %ld", (t->state == CF_TxnState_R2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (long)fd->offset, + "CF R%d(%lu:%lu): failed to seek offset %ld, got %ld", (txn->state == CF_TxnState_R2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num, (long)fd->offset, (long)fret); - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_FILE_SIZE_ERROR); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_seek; ret = CF_ERROR; /* connection will reset in caller */ } } if (ret != CF_ERROR) { - fret = CF_WrappedWrite(t->fd, fd->data_ptr, fd->data_len); + fret = CF_WrappedWrite(txn->fd, fd->data_ptr, fd->data_len); if (fret != fd->data_len) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_WRITE, CFE_EVS_EventType_ERROR, - "CF R%d(%lu:%lu): OS_write expected %ld, got %ld", (t->state == CF_TxnState_R2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, + "CF R%d(%lu:%lu): OS_write expected %ld, got %ld", (txn->state == CF_TxnState_R2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num, (long)fd->data_len, (long)fret); - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_write; + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_FILESTORE_REJECTION); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_write; ret = CF_ERROR; /* connection will reset in caller */ } else { - t->state_data.r.cached_pos = fd->data_len + fd->offset; - CF_AppData.hk.channel_hk[t->chan_num].counters.recv.file_data_bytes += fd->data_len; + txn->state_data.receive.cached_pos = fd->data_len + fd->offset; + CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.file_data_bytes += fd->data_len; } } @@ -247,33 +247,33 @@ CFE_Status_t CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { CFE_Status_t ret = CFE_SUCCESS; const CF_Logical_PduEof_t *eof; - if (!CF_CFDP_RecvEof(t, ph)) + if (!CF_CFDP_RecvEof(txn, ph)) { /* this function is only entered for PDUs identified as EOF type */ eof = &ph->int_header.eof; /* only check size if MD received, otherwise it's still OK */ - if (t->flags.rx.md_recv && (eof->size != t->fsize)) + if (txn->flags.rx.md_recv && (eof->size != txn->fsize)) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_SIZE_MISMATCH, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): EOF file size mismatch: got %lu expected %lu", - (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num, (unsigned long)eof->size, (unsigned long)t->fsize); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_size_mismatch; + (txn->state == CF_TxnState_R2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num, (unsigned long)eof->size, (unsigned long)txn->fsize); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_size_mismatch; ret = CF_REC_PDU_FSIZE_MISMATCH_ERROR; } } else { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_PDU_EOF, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): invalid EOF packet", - (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; + (txn->state == CF_TxnState_R2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error; ret = CF_REC_PDU_BAD_EOF_ERROR; } @@ -286,9 +286,9 @@ CFE_Status_t CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - int ret = CF_CFDP_R_SubstateRecvEof(t, ph); + int ret = CF_CFDP_R_SubstateRecvEof(txn, ph); uint32 crc; const CF_Logical_PduEof_t *eof; @@ -299,17 +299,17 @@ void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) if (ret == CFE_SUCCESS) { /* Verify CRC */ - if (CF_CFDP_R_CheckCrc(t, crc) == CFE_SUCCESS) + if (CF_CFDP_R_CheckCrc(txn, crc) == CFE_SUCCESS) { /* successfully processed the file */ - t->keep = 1; /* save the file */ + txn->keep = 1; /* save the file */ } /* if file failed to process, there's nothing to do. CF_CFDP_R_CheckCrc() generates an event on failure */ } /* after exit, always reset since we are done */ /* reset even if the EOF failed -- class 1, so it won't come again! */ - CF_CFDP_R1_Reset(t); + CF_CFDP_R1_Reset(txn); } /*---------------------------------------------------------------- @@ -318,39 +318,39 @@ void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { const CF_Logical_PduEof_t *eof; int ret; - if (!t->flags.rx.eof_recv) + if (!txn->flags.rx.eof_recv) { - ret = CF_CFDP_R_SubstateRecvEof(t, ph); + ret = CF_CFDP_R_SubstateRecvEof(txn, ph); /* did receiving EOF succeed? */ if (ret == CFE_SUCCESS) { eof = &ph->int_header.eof; - t->flags.rx.eof_recv = 1; + txn->flags.rx.eof_recv = 1; /* need to remember the EOF CRC for later */ - t->state_data.r.r2.eof_crc = eof->crc; - t->state_data.r.r2.eof_size = eof->size; + txn->state_data.receive.r2.eof_crc = eof->crc; + txn->state_data.receive.r2.eof_size = eof->size; /* always ACK the EOF, even if we're not done */ - t->state_data.r.r2.eof_cc = eof->cc; - t->flags.rx.send_ack = 1; /* defer sending ACK to tick handling */ + txn->state_data.receive.r2.eof_cc = eof->cc; + txn->flags.rx.send_ack = 1; /* defer sending ACK to tick handling */ /* only check for complete if EOF with no errors */ - if (t->state_data.r.r2.eof_cc == CF_CFDP_ConditionCode_NO_ERROR) + if (txn->state_data.receive.r2.eof_cc == CF_CFDP_ConditionCode_NO_ERROR) { - CF_CFDP_R2_Complete(t, 1); /* CF_CFDP_R2_Complete() will change state */ + CF_CFDP_R2_Complete(txn, 1); /* CF_CFDP_R2_Complete() will change state */ } else { - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_From_ConditionCode(t->state_data.r.r2.eof_cc)); - CF_CFDP_R2_Reset(t); + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_From_ConditionCode(txn->state_data.receive.r2.eof_cc)); + CF_CFDP_R2_Reset(txn); } } else @@ -358,12 +358,12 @@ void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) /* bad EOF sent? */ if (ret == CF_REC_PDU_FSIZE_MISMATCH_ERROR) { - CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); + CF_CFDP_R2_SetFinTxnStatus(txn, CF_TxnStatus_FILE_SIZE_ERROR); } else { /* can't do anything with this bad EOF, so return to FILEDATA */ - t->state_data.r.sub_state = CF_RxSubState_FILEDATA; + txn->state_data.receive.sub_state = CF_RxSubState_FILEDATA; } } } @@ -375,26 +375,26 @@ void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R1_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R1_SubstateRecvFileData(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { int ret; /* got file data PDU? */ - ret = CF_CFDP_RecvFd(t, ph); + ret = CF_CFDP_RecvFd(txn, ph); if (ret == CFE_SUCCESS) { - ret = CF_CFDP_R_ProcessFd(t, ph); + ret = CF_CFDP_R_ProcessFd(txn, ph); } if (ret == CFE_SUCCESS) { /* class 1 digests CRC */ - CF_CRC_Digest(&t->crc, ph->int_header.fd.data_ptr, ph->int_header.fd.data_len); + CF_CRC_Digest(&txn->crc, ph->int_header.fd.data_ptr, ph->int_header.fd.data_len); } else { /* Reset transaction on failure */ - CF_CFDP_R1_Reset(t); + CF_CFDP_R1_Reset(txn); } } @@ -404,7 +404,7 @@ void CF_CFDP_R1_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { const CF_Logical_PduFileDataHeader_t *fd; int ret; @@ -413,33 +413,33 @@ void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t fd = &ph->int_header.fd; /* got file data PDU? */ - ret = CF_CFDP_RecvFd(t, ph); + ret = CF_CFDP_RecvFd(txn, ph); if (ret == CFE_SUCCESS) { - ret = CF_CFDP_R_ProcessFd(t, ph); + ret = CF_CFDP_R_ProcessFd(txn, ph); } if (ret == CFE_SUCCESS) { /* class 2 does CRC at FIN, but track gaps */ - CF_ChunkListAdd(&t->chunks->chunks, fd->offset, fd->data_len); + CF_ChunkListAdd(&txn->chunks->chunks, fd->offset, fd->data_len); - if (t->flags.rx.fd_nak_sent) + if (txn->flags.rx.fd_nak_sent) { - CF_CFDP_R2_Complete(t, 0); /* once nak-retransmit received, start checking for completion at each fd */ + CF_CFDP_R2_Complete(txn, 0); /* once nak-retransmit received, start checking for completion at each fd */ } - if (!t->flags.rx.complete) + if (!txn->flags.rx.complete) { - CF_CFDP_ArmAckTimer(t); /* re-arm ACK timer, since we got data */ + CF_CFDP_ArmAckTimer(txn); /* re-arm ACK timer, since we got data */ } - t->state_data.r.r2.acknak_count = 0; + txn->state_data.receive.r2.acknak_count = 0; } else { /* Reset transaction on failure */ - CF_CFDP_R2_Reset(t); + CF_CFDP_R2_Reset(txn); } } @@ -449,7 +449,7 @@ void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *c, void *opaque) +void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *chunk, void *opaque) { CF_GapComputeArgs_t * args = (CF_GapComputeArgs_t *)opaque; CF_Logical_SegmentRequest_t *pseg; @@ -459,7 +459,7 @@ void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *c, vo /* This function is only invoked for NAK types */ nak = args->nak; pseglist = &nak->segment_list; - CF_Assert(c->size > 0); + CF_Assert(chunk->size > 0); /* it seems that scope in the old engine is not used the way I read it in the spec, so * leave this code here for now for future reference */ @@ -468,8 +468,8 @@ void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *c, vo { pseg = &pseglist->segments[pseglist->num_segments]; - pseg->offset_start = c->offset - nak->scope_start; - pseg->offset_end = pseg->offset_start + c->size; + pseg->offset_start = chunk->offset - nak->scope_start; + pseg->offset_end = pseg->offset_start + chunk->size; ++pseglist->num_segments; } @@ -481,11 +481,11 @@ void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *c, vo * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *txn) { CF_Logical_PduBuffer_t *ph = - CF_CFDP_ConstructPduHeader(t, CF_CFDP_FileDirective_NAK, t->history->peer_eid, - CF_AppData.config_table->local_eid, 1, t->history->seq_num, 1); + CF_CFDP_ConstructPduHeader(txn, CF_CFDP_FileDirective_NAK, txn->history->peer_eid, + CF_AppData.config_table->local_eid, 1, txn->history->seq_num, 1); CF_Logical_PduNak_t *nak; CFE_Status_t sret; uint32 cret; @@ -495,36 +495,36 @@ CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t) { nak = &ph->int_header.nak; - if (t->flags.rx.md_recv) + if (txn->flags.rx.md_recv) { /* we have metadata, so send valid NAK */ - CF_GapComputeArgs_t args = {t, nak}; + CF_GapComputeArgs_t args = {txn, nak}; nak->scope_start = 0; - cret = CF_ChunkList_ComputeGaps(&t->chunks->chunks, - (t->chunks->chunks.count < t->chunks->chunks.max_chunks) - ? t->chunks->chunks.max_chunks - : (t->chunks->chunks.max_chunks - 1), - t->fsize, 0, CF_CFDP_R2_GapCompute, &args); + cret = CF_ChunkList_ComputeGaps(&txn->chunks->chunks, + (txn->chunks->chunks.count < txn->chunks->chunks.max_chunks) + ? txn->chunks->chunks.max_chunks + : (txn->chunks->chunks.max_chunks - 1), + txn->fsize, 0, CF_CFDP_R2_GapCompute, &args); if (!cret) { /* no gaps left, so go ahead and check for completion */ - t->flags.rx.complete = 1; /* we know md was received, and there's no gaps -- it's complete */ + txn->flags.rx.complete = 1; /* we know md was received, and there's no gaps -- it's complete */ ret = CFE_SUCCESS; } else { /* gaps are present, so let's send the NAK PDU */ nak->scope_end = 0; - sret = CF_CFDP_SendNak(t, ph); - t->flags.rx.fd_nak_sent = 1; /* latch that at least one NAK has been sent requesting filedata */ + sret = CF_CFDP_SendNak(txn, ph); + txn->flags.rx.fd_nak_sent = 1; /* latch that at least one NAK has been sent requesting filedata */ CF_Assert(sret != CF_SEND_PDU_ERROR); /* NOTE: this CF_Assert is here because CF_CFDP_SendNak() does not return CF_SEND_PDU_ERROR, so if it's ever added to that function we need to test handling it here */ if (sret == CFE_SUCCESS) { - CF_AppData.hk.channel_hk[t->chan_num].counters.sent.nak_segment_requests += cret; + CF_AppData.hk.channel_hk[txn->chan_num].counters.sent.nak_segment_requests += cret; ret = CFE_SUCCESS; } } @@ -534,8 +534,8 @@ CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t) /* need to send simple NAK packet to request metadata PDU again */ /* after doing so, transition to recv md state */ CFE_EVS_SendEvent(CF_EID_INF_CFDP_R_REQUEST_MD, CFE_EVS_EventType_INFORMATION, - "CF R%d(%lu:%lu): requesting MD", (t->state == CF_TxnState_R2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); + "CF R%d(%lu:%lu): requesting MD", (txn->state == CF_TxnState_R2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num); /* scope start/end, and sr[0] start/end == 0 special value to request metadata */ nak->scope_start = 0; nak->scope_end = 0; @@ -543,7 +543,7 @@ CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t) nak->segment_list.segments[0].offset_end = 0; nak->segment_list.num_segments = 1; - sret = CF_CFDP_SendNak(t, ph); + sret = CF_CFDP_SendNak(txn, ph); CF_Assert(sret != CF_SEND_PDU_ERROR); /* this CF_Assert is here because CF_CFDP_SendNak() does not return CF_SEND_PDU_ERROR */ if (sret == CFE_SUCCESS) @@ -562,51 +562,51 @@ CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R_Init(CF_Transaction_t *t) +void CF_CFDP_R_Init(CF_Transaction_t *txn) { int32 ret; - if (t->state == CF_TxnState_R2) + if (txn->state == CF_TxnState_R2) { - if (!t->flags.rx.md_recv) + if (!txn->flags.rx.md_recv) { /* we need to make a temp file and then do a NAK for md PDU */ /* the transaction already has a history, and that has a buffer that we can use to * hold the temp filename */ /* the -1 below is to make room for the slash */ - snprintf(t->history->fnames.dst_filename, sizeof(t->history->fnames.dst_filename) - 1, "%.*s/%lu.tmp", - CF_FILENAME_MAX_PATH - 1, CF_AppData.config_table->tmp_dir, (unsigned long)t->history->seq_num); + snprintf(txn->history->fnames.dst_filename, sizeof(txn->history->fnames.dst_filename) - 1, "%.*s/%lu.tmp", + CF_FILENAME_MAX_PATH - 1, CF_AppData.config_table->tmp_dir, (unsigned long)txn->history->seq_num); CFE_EVS_SendEvent(CF_EID_INF_CFDP_R_TEMP_FILE, CFE_EVS_EventType_INFORMATION, "CF R%d(%lu:%lu): making temp file %s for transaction without MD", - (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num, t->history->fnames.dst_filename); + (txn->state == CF_TxnState_R2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num, txn->history->fnames.dst_filename); } - CF_CFDP_ArmAckTimer(t); + CF_CFDP_ArmAckTimer(txn); } - ret = CF_WrappedOpenCreate(&t->fd, t->history->fnames.dst_filename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, + ret = CF_WrappedOpenCreate(&txn->fd, txn->history->fnames.dst_filename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_READ_WRITE); if (ret < 0) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_CREAT, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): failed to create file %s for writing, error=%ld", - (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num, t->history->fnames.dst_filename, (long)ret); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open; - t->fd = OS_OBJECT_ID_UNDEFINED; /* just in case */ - if (t->state == CF_TxnState_R2) + (txn->state == CF_TxnState_R2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num, txn->history->fnames.dst_filename, (long)ret); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_open; + txn->fd = OS_OBJECT_ID_UNDEFINED; /* just in case */ + if (txn->state == CF_TxnState_R2) { - CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); + CF_CFDP_R2_SetFinTxnStatus(txn, CF_TxnStatus_FILESTORE_REJECTION); } else { - CF_CFDP_R1_Reset(t); + CF_CFDP_R1_Reset(txn); } } else { - t->state_data.r.sub_state = CF_RxSubState_FILEDATA; + txn->state_data.receive.sub_state = CF_RxSubState_FILEDATA; } } @@ -616,7 +616,7 @@ void CF_CFDP_R_Init(CF_Transaction_t *t) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *txn) { uint8 buf[CF_R2_CRC_CHUNK_SIZE]; size_t count_bytes; @@ -631,78 +631,78 @@ CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) count_bytes = 0; ret = CF_ERROR; - if (t->state_data.r.r2.rx_crc_calc_bytes == 0) + if (txn->state_data.receive.r2.rx_crc_calc_bytes == 0) { - CF_CRC_Start(&t->crc); + CF_CRC_Start(&txn->crc); } while ((count_bytes < CF_AppData.config_table->rx_crc_calc_bytes_per_wakeup) && - (t->state_data.r.r2.rx_crc_calc_bytes < t->fsize)) + (txn->state_data.receive.r2.rx_crc_calc_bytes < txn->fsize)) { - want_offs_size = t->state_data.r.r2.rx_crc_calc_bytes + sizeof(buf); + want_offs_size = txn->state_data.receive.r2.rx_crc_calc_bytes + sizeof(buf); - if (want_offs_size > t->fsize) + if (want_offs_size > txn->fsize) { - read_size = t->fsize - t->state_data.r.r2.rx_crc_calc_bytes; + read_size = txn->fsize - txn->state_data.receive.r2.rx_crc_calc_bytes; } else { read_size = sizeof(buf); } - if (t->state_data.r.cached_pos != t->state_data.r.r2.rx_crc_calc_bytes) + if (txn->state_data.receive.cached_pos != txn->state_data.receive.r2.rx_crc_calc_bytes) { - fret = CF_WrappedLseek(t->fd, t->state_data.r.r2.rx_crc_calc_bytes, OS_SEEK_SET); - if (fret != t->state_data.r.r2.rx_crc_calc_bytes) + fret = CF_WrappedLseek(txn->fd, txn->state_data.receive.r2.rx_crc_calc_bytes, OS_SEEK_SET); + if (fret != txn->state_data.receive.r2.rx_crc_calc_bytes) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_SEEK_CRC, CFE_EVS_EventType_ERROR, - "CF R%d(%lu:%lu): failed to seek offset %lu, got %ld", (t->state == CF_TxnState_R2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, - (unsigned long)t->state_data.r.r2.rx_crc_calc_bytes, (long)fret); - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; + "CF R%d(%lu:%lu): failed to seek offset %lu, got %ld", (txn->state == CF_TxnState_R2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num, + (unsigned long)txn->state_data.receive.r2.rx_crc_calc_bytes, (long)fret); + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_FILE_SIZE_ERROR); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_seek; success = false; break; } } - fret = CF_WrappedRead(t->fd, buf, read_size); + fret = CF_WrappedRead(txn->fd, buf, read_size); if (fret != read_size) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_READ, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): failed to read file expected %lu, got %ld", - (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num, (unsigned long)read_size, (long)fret); - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_read; + (txn->state == CF_TxnState_R2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num, (unsigned long)read_size, (long)fret); + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_FILE_SIZE_ERROR); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_read; success = false; break; } - CF_CRC_Digest(&t->crc, buf, read_size); - t->state_data.r.r2.rx_crc_calc_bytes += read_size; - t->state_data.r.cached_pos = t->state_data.r.r2.rx_crc_calc_bytes; + CF_CRC_Digest(&txn->crc, buf, read_size); + txn->state_data.receive.r2.rx_crc_calc_bytes += read_size; + txn->state_data.receive.cached_pos = txn->state_data.receive.r2.rx_crc_calc_bytes; count_bytes += read_size; } - if (success && t->state_data.r.r2.rx_crc_calc_bytes == t->fsize) + if (success && txn->state_data.receive.r2.rx_crc_calc_bytes == txn->fsize) { /* all bytes calculated, so now check */ - if (!CF_CFDP_R_CheckCrc(t, t->state_data.r.r2.eof_crc)) + if (!CF_CFDP_R_CheckCrc(txn, txn->state_data.receive.r2.eof_crc)) { /* CRC matched! We are happy */ - t->keep = 1; /* save the file */ + txn->keep = 1; /* save the file */ /* set FIN PDU status */ - t->state_data.r.r2.dc = CF_CFDP_FinDeliveryCode_COMPLETE; - t->state_data.r.r2.fs = CF_CFDP_FinFileStatus_RETAINED; + txn->state_data.receive.r2.dc = CF_CFDP_FinDeliveryCode_COMPLETE; + txn->state_data.receive.r2.fs = CF_CFDP_FinFileStatus_RETAINED; } else { - CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILE_CHECKSUM_FAILURE); + CF_CFDP_R2_SetFinTxnStatus(txn, CF_TxnStatus_FILE_CHECKSUM_FAILURE); } - t->flags.com.crc_calc = 1; + txn->flags.com.crc_calc = 1; ret = CFE_SUCCESS; } @@ -716,15 +716,15 @@ CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *txn) { CFE_Status_t sret; CFE_Status_t ret = CFE_SUCCESS; - if (!CF_TxnStatus_IsError(t->history->txn_stat) && !t->flags.com.crc_calc) + if (!CF_TxnStatus_IsError(txn->history->txn_stat) && !txn->flags.com.crc_calc) { /* no error, and haven't checked CRC -- so start checking it */ - if (CF_CFDP_R2_CalcCrcChunk(t)) + if (CF_CFDP_R2_CalcCrcChunk(txn)) { ret = CF_ERROR; /* signal to caller to re-enter next tick */ } @@ -732,10 +732,10 @@ CFE_Status_t CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t) if (ret != CF_ERROR) { - sret = CF_CFDP_SendFin(t, t->state_data.r.r2.dc, t->state_data.r.r2.fs, - CF_TxnStatus_To_ConditionCode(t->history->txn_stat)); + sret = CF_CFDP_SendFin(txn, txn->state_data.receive.r2.dc, txn->state_data.receive.r2.fs, + CF_TxnStatus_To_ConditionCode(txn->history->txn_stat)); CF_Assert(sret != CF_SEND_PDU_ERROR); /* CF_CFDP_SendFin does not return CF_SEND_PDU_ERROR */ - t->state_data.r.sub_state = + txn->state_data.receive.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; /* whether or not FIN send successful, ok to transition state */ if (sret != CFE_SUCCESS) { @@ -753,19 +753,19 @@ CFE_Status_t CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R2_Recv_fin_ack(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R2_Recv_fin_ack(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - if (!CF_CFDP_RecvAck(t, ph)) + if (!CF_CFDP_RecvAck(txn, ph)) { /* got fin-ack, so time to close the state */ - CF_CFDP_R2_Reset(t); + CF_CFDP_R2_Reset(txn); } else { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_PDU_FINACK, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): invalid fin-ack", - (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; + (txn->state == CF_TxnState_R2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error; } } @@ -775,7 +775,7 @@ void CF_CFDP_R2_Recv_fin_ack(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R2_RecvMd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { char fname[CF_FILENAME_MAX_LEN]; int status; @@ -783,32 +783,32 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) bool success = true; /* it isn't an error to get another MD PDU, right? */ - if (!t->flags.rx.md_recv) + if (!txn->flags.rx.md_recv) { - /* NOTE: t->flags.rx.md_recv always 1 in R1, so this is R2 only */ + /* NOTE: txn->flags.rx.md_recv always 1 in R1, so this is R2 only */ /* parse the md PDU. this will overwrite the transaction's history, which contains our filename. so let's * save the filename in a local buffer so it can be used with OS_mv upon successful parsing of * the md PDU */ strcpy( fname, - t->history->fnames.dst_filename); /* strcpy is ok, since fname is CF_FILENAME_MAX_LEN like dst_filename */ - status = CF_CFDP_RecvMd(t, ph); + txn->history->fnames.dst_filename); /* strcpy is ok, since fname is CF_FILENAME_MAX_LEN like dst_filename */ + status = CF_CFDP_RecvMd(txn, ph); if (!status) { /* successfully obtained md PDU */ - if (t->flags.rx.eof_recv) + if (txn->flags.rx.eof_recv) { /* EOF was received, so check that md and EOF sizes match */ - if (t->state_data.r.r2.eof_size != t->fsize) + if (txn->state_data.receive.r2.eof_size != txn->fsize) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_EOF_MD_SIZE, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): EOF/md size mismatch md: %lu, EOF: %lu", - (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num, (unsigned long)t->fsize, - (unsigned long)t->state_data.r.r2.eof_size); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_size_mismatch; - CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILE_SIZE_ERROR); + (txn->state == CF_TxnState_R2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num, (unsigned long)txn->fsize, + (unsigned long)txn->state_data.receive.r2.eof_size); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_size_mismatch; + CF_CFDP_R2_SetFinTxnStatus(txn, CF_TxnStatus_FILE_SIZE_ERROR); success = false; } } @@ -816,56 +816,56 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) if (success) { /* close and rename file */ - CF_WrappedClose(t->fd); + CF_WrappedClose(txn->fd); CFE_ES_PerfLogEntry(CF_PERF_ID_RENAME); /* Note OS_mv attempts a rename, then copy/delete if that fails so it works across file systems */ - status = OS_mv(fname, t->history->fnames.dst_filename); + status = OS_mv(fname, txn->history->fnames.dst_filename); CFE_ES_PerfLogExit(CF_PERF_ID_RENAME); if (status != OS_SUCCESS) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_RENAME, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): failed to rename file in R2, error=%ld", - (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num, (long)status); - t->fd = OS_OBJECT_ID_UNDEFINED; - CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_rename; + (txn->state == CF_TxnState_R2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num, (long)status); + txn->fd = OS_OBJECT_ID_UNDEFINED; + CF_CFDP_R2_SetFinTxnStatus(txn, CF_TxnStatus_FILESTORE_REJECTION); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_rename; success = false; } else { ret = - CF_WrappedOpenCreate(&t->fd, t->history->fnames.dst_filename, OS_FILE_FLAG_NONE, OS_READ_WRITE); + CF_WrappedOpenCreate(&txn->fd, txn->history->fnames.dst_filename, OS_FILE_FLAG_NONE, OS_READ_WRITE); if (ret < 0) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_OPEN, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): failed to open renamed file in R2, error=%ld", - (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num, (long)ret); - CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open; - t->fd = OS_OBJECT_ID_UNDEFINED; /* just in case */ + (txn->state == CF_TxnState_R2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num, (long)ret); + CF_CFDP_R2_SetFinTxnStatus(txn, CF_TxnStatus_FILESTORE_REJECTION); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_open; + txn->fd = OS_OBJECT_ID_UNDEFINED; /* just in case */ success = false; } } if (success) { - t->state_data.r.cached_pos = 0; /* reset psn due to open */ - t->flags.rx.md_recv = 1; - t->state_data.r.r2.acknak_count = 0; /* in case part of NAK */ - CF_CFDP_R2_Complete(t, 1); /* check for completion now that md is received */ + txn->state_data.receive.cached_pos = 0; /* reset psn due to open */ + txn->flags.rx.md_recv = 1; + txn->state_data.receive.r2.acknak_count = 0; /* in case part of NAK */ + CF_CFDP_R2_Complete(txn, 1); /* check for completion now that md is received */ } } } else { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_PDU_MD, CFE_EVS_EventType_ERROR, "CF R%d(%lu:%lu): invalid md received", - (t->state == CF_TxnState_R2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; + (txn->state == CF_TxnState_R2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error; /* do nothing here, since it will be NAK'd again later */ } } @@ -877,7 +877,7 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R1_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { static const CF_CFDP_FileDirectiveDispatchTable_t r1_fdir_handlers = { .fdirective = {[CF_CFDP_FileDirective_EOF] = CF_CFDP_R1_SubstateRecvEof}}; @@ -886,7 +886,7 @@ void CF_CFDP_R1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) [CF_RxSubState_EOF] = &r1_fdir_handlers, [CF_RxSubState_WAIT_FOR_FIN_ACK] = &r1_fdir_handlers}}; - CF_CFDP_R_DispatchRecv(t, ph, &substate_fns, CF_CFDP_R1_SubstateRecvFileData); + CF_CFDP_R_DispatchRecv(txn, ph, &substate_fns, CF_CFDP_R1_SubstateRecvFileData); } /*---------------------------------------------------------------- @@ -895,7 +895,7 @@ void CF_CFDP_R1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R2_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { static const CF_CFDP_FileDirectiveDispatchTable_t r2_fdir_handlers_normal = { .fdirective = { @@ -912,7 +912,7 @@ void CF_CFDP_R2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) [CF_RxSubState_EOF] = &r2_fdir_handlers_normal, [CF_RxSubState_WAIT_FOR_FIN_ACK] = &r2_fdir_handlers_finack}}; - CF_CFDP_R_DispatchRecv(t, ph, &substate_fns, CF_CFDP_R2_SubstateRecvFileData); + CF_CFDP_R_DispatchRecv(txn, ph, &substate_fns, CF_CFDP_R2_SubstateRecvFileData); } /*---------------------------------------------------------------- @@ -921,16 +921,16 @@ void CF_CFDP_R2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R_Cancel(CF_Transaction_t *t) +void CF_CFDP_R_Cancel(CF_Transaction_t *txn) { /* for cancel, only need to send FIN if R2 */ - if ((t->state == CF_TxnState_R2) && (t->state_data.r.sub_state < CF_RxSubState_WAIT_FOR_FIN_ACK)) + if ((txn->state == CF_TxnState_R2) && (txn->state_data.receive.sub_state < CF_RxSubState_WAIT_FOR_FIN_ACK)) { - t->flags.rx.send_fin = 1; + txn->flags.rx.send_fin = 1; } else { - CF_CFDP_R1_Reset(t); /* if R1, just call it quits */ + CF_CFDP_R1_Reset(txn); /* if R1, just call it quits */ } } @@ -940,12 +940,12 @@ void CF_CFDP_R_Cancel(CF_Transaction_t *t) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R_SendInactivityEvent(CF_Transaction_t *t) +void CF_CFDP_R_SendInactivityEvent(CF_Transaction_t *txn) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_INACT_TIMER, CFE_EVS_EventType_ERROR, - "CF R%d(%lu:%lu): inactivity timer expired", (t->state == CF_TxnState_R2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.inactivity_timer; + "CF R%d(%lu:%lu): inactivity timer expired", (txn->state == CF_TxnState_R2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.inactivity_timer; } /*---------------------------------------------------------------- @@ -954,7 +954,7 @@ void CF_CFDP_R_SendInactivityEvent(CF_Transaction_t *t) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_R_Tick(CF_Transaction_t *t, int *cont /* unused */) +void CF_CFDP_R_Tick(CF_Transaction_t *txn, int *cont /* unused */) { /* Steven is not real happy with this function. There should be a better way to separate out * the logic by state so that it isn't a bunch of if statements for different flags @@ -965,49 +965,49 @@ void CF_CFDP_R_Tick(CF_Transaction_t *t, int *cont /* unused */) /* at each tick, various timers used by R are checked */ /* first, check inactivity timer */ - if (t->state == CF_TxnState_R2) + if (txn->state == CF_TxnState_R2) { - if (!t->flags.rx.inactivity_fired) + if (!txn->flags.rx.inactivity_fired) { - if (CF_Timer_Expired(&t->inactivity_timer)) + if (CF_Timer_Expired(&txn->inactivity_timer)) { - CF_CFDP_R_SendInactivityEvent(t); + CF_CFDP_R_SendInactivityEvent(txn); - CF_CFDP_R2_SetFinTxnStatus(t, CF_TxnStatus_INACTIVITY_DETECTED); - t->flags.rx.inactivity_fired = 1; + CF_CFDP_R2_SetFinTxnStatus(txn, CF_TxnStatus_INACTIVITY_DETECTED); + txn->flags.rx.inactivity_fired = 1; } else { - CF_Timer_Tick(&t->inactivity_timer); + CF_Timer_Tick(&txn->inactivity_timer); } } /* rx maintenance: possibly process send_eof_ack, send_nak or send_fin */ - if (t->flags.rx.send_ack) + if (txn->flags.rx.send_ack) { - sret = CF_CFDP_SendAck(t, CF_CFDP_AckTxnStatus_ACTIVE, CF_CFDP_FileDirective_EOF, t->state_data.r.r2.eof_cc, - t->history->peer_eid, t->history->seq_num); + sret = CF_CFDP_SendAck(txn, CF_CFDP_AckTxnStatus_ACTIVE, CF_CFDP_FileDirective_EOF, txn->state_data.receive.r2.eof_cc, + txn->history->peer_eid, txn->history->seq_num); CF_Assert(sret != CF_SEND_PDU_ERROR); /* if CFE_SUCCESS, then move on in the state machine. CF_CFDP_SendAck does not return * CF_SEND_PDU_ERROR */ if (sret != CF_SEND_PDU_NO_BUF_AVAIL_ERROR) { - t->flags.rx.send_ack = 0; + txn->flags.rx.send_ack = 0; } } - else if (t->flags.rx.send_nak) + else if (txn->flags.rx.send_nak) { - if (!CF_CFDP_R_SubstateSendNak(t)) + if (!CF_CFDP_R_SubstateSendNak(txn)) { - t->flags.rx.send_nak = 0; /* will re-enter on error */ + txn->flags.rx.send_nak = 0; /* will re-enter on error */ } } - else if (t->flags.rx.send_fin) + else if (txn->flags.rx.send_fin) { - if (!CF_CFDP_R2_SubstateSendFin(t)) + if (!CF_CFDP_R2_SubstateSendFin(txn)) { - t->flags.rx.send_fin = 0; /* will re-enter on error */ + txn->flags.rx.send_fin = 0; /* will re-enter on error */ } } else @@ -1015,58 +1015,58 @@ void CF_CFDP_R_Tick(CF_Transaction_t *t, int *cont /* unused */) /* don't care about any other cases */ } - if (t->flags.com.ack_timer_armed) + if (txn->flags.com.ack_timer_armed) { - if (CF_Timer_Expired(&t->ack_timer)) + if (CF_Timer_Expired(&txn->ack_timer)) { /* ACK timer expired, so check for completion */ - if (!t->flags.rx.complete) + if (!txn->flags.rx.complete) { - CF_CFDP_R2_Complete(t, 1); + CF_CFDP_R2_Complete(txn, 1); } - else if (t->state_data.r.sub_state == CF_RxSubState_WAIT_FOR_FIN_ACK) + else if (txn->state_data.receive.sub_state == CF_RxSubState_WAIT_FOR_FIN_ACK) { /* Increment acknak counter */ - ++t->state_data.r.r2.acknak_count; + ++txn->state_data.receive.r2.acknak_count; /* Check limit and handle if needed */ - if (t->state_data.r.r2.acknak_count >= CF_AppData.config_table->chan[t->chan_num].ack_limit) + if (txn->state_data.receive.r2.acknak_count >= CF_AppData.config_table->chan[txn->chan_num].ack_limit) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_ACK_LIMIT, CFE_EVS_EventType_ERROR, "CF R2(%lu:%lu): ACK limit reached, no fin-ack", - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_ACK_LIMIT_NO_FIN); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.ack_limit; - CF_CFDP_R2_Reset(t); + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num); + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_ACK_LIMIT_NO_FIN); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.ack_limit; + CF_CFDP_R2_Reset(txn); success = false; } else { - t->flags.rx.send_fin = 1; + txn->flags.rx.send_fin = 1; } } if (success) { - CF_CFDP_ArmAckTimer(t); /* whether sending FIN or waiting for more filedata, need ACK timer armed */ + CF_CFDP_ArmAckTimer(txn); /* whether sending FIN or waiting for more filedata, need ACK timer armed */ } } else { - CF_Timer_Tick(&t->ack_timer); + CF_Timer_Tick(&txn->ack_timer); } } } else { - if (CF_Timer_Expired(&t->inactivity_timer)) + if (CF_Timer_Expired(&txn->inactivity_timer)) { - CF_CFDP_R_SendInactivityEvent(t); - CF_CFDP_R1_Reset(t); + CF_CFDP_R_SendInactivityEvent(txn); + CF_CFDP_R1_Reset(txn); } else { - CF_Timer_Tick(&t->inactivity_timer); + CF_Timer_Tick(&txn->inactivity_timer); } } } diff --git a/fsw/src/cf_cfdp_r.h b/fsw/src/cf_cfdp_r.h index 2788e364..a8c0a361 100644 --- a/fsw/src/cf_cfdp_r.h +++ b/fsw/src/cf_cfdp_r.h @@ -38,7 +38,7 @@ */ typedef struct { - CF_Transaction_t * t; /**< \brief Current transaction being processed */ + CF_Transaction_t * txn; /**< \brief Current transaction being processed */ CF_Logical_PduNak_t *nak; /**< \brief Current NAK PDU contents */ } CF_GapComputeArgs_t; @@ -46,23 +46,23 @@ typedef struct /** @brief R1 receive PDU processing. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -void CF_CFDP_R1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_R1_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief R2 receive PDU processing. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -void CF_CFDP_R2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_R2_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Perform tick (time-based) processing for R transactions. @@ -75,44 +75,44 @@ void CF_CFDP_R2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * that require acknowledgment. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. cont is unused, so may be NULL + * txn must not be NULL. cont is unused, so may be NULL * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param cont Ignored/Unused * */ -void CF_CFDP_R_Tick(CF_Transaction_t *t, int *cont); +void CF_CFDP_R_Tick(CF_Transaction_t *txn, int *cont); /************************************************************************/ /** @brief Cancel an R transaction. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_R_Cancel(CF_Transaction_t *t); +void CF_CFDP_R_Cancel(CF_Transaction_t *txn); /************************************************************************/ /** @brief Initialize a transaction structure for R. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_R_Init(CF_Transaction_t *t); +void CF_CFDP_R_Init(CF_Transaction_t *txn); /************************************************************************/ /** @brief Helper function to store transaction status code and set send_fin flag. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param txn_stat Status Code value to set within transaction */ -void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat); +void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *txn, CF_TxnStatus_t txn_stat); /************************************************************************/ /** @brief CFDP R1 transaction reset function. @@ -123,11 +123,11 @@ void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat); * only calls CF_CFDP_ResetTransaction(), it is here as a placeholder. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_R1_Reset(CF_Transaction_t *t); +void CF_CFDP_R1_Reset(CF_Transaction_t *txn); /************************************************************************/ /** @brief CFDP R2 transaction reset function. @@ -136,26 +136,26 @@ void CF_CFDP_R1_Reset(CF_Transaction_t *t); * Handles reset logic for R2, then calls R1 reset logic. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_R2_Reset(CF_Transaction_t *t); +void CF_CFDP_R2_Reset(CF_Transaction_t *txn); /************************************************************************/ /** @brief Checks that the transaction file's CRC matches expected. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * * * @retval CFE_SUCCESS on CRC match, otherwise error. * * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param expected_crc Expected CRC */ -CFE_Status_t CF_CFDP_R_CheckCrc(CF_Transaction_t *t, uint32 expected_crc); +CFE_Status_t CF_CFDP_R_CheckCrc(CF_Transaction_t *txn, uint32 expected_crc); /************************************************************************/ /** @brief Checks R2 transaction state for transaction completion status. @@ -170,27 +170,27 @@ CFE_Status_t CF_CFDP_R_CheckCrc(CF_Transaction_t *t, uint32 expected_crc); * it's only called from functions after EOF is received. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ok_to_send_nak If set to 0, suppress sending of a NAK packet */ -void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak); +void CF_CFDP_R2_Complete(CF_Transaction_t *txn, int ok_to_send_nak); /************************************************************************/ /** @brief Process a filedata PDU on a transaction. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * * * @retval CFE_SUCCESS on success. CF_ERROR on error. * * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -CFE_Status_t CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +CFE_Status_t CF_CFDP_R_ProcessFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Processing receive EOF common functionality for R1/R2. @@ -201,16 +201,16 @@ CFE_Status_t CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph * data against the PDU. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. ph must not be NULL. + * txn must not be NULL. ph must not be NULL. * * * @retval CFE_SUCCESS on success. Returns anything else on error. * * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -CFE_Status_t CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +CFE_Status_t CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Process receive EOF for R1. @@ -219,13 +219,13 @@ CFE_Status_t CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer * Only need to confirm CRC for R1. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. ph must not be NULL. + * txn must not be NULL. ph must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information * */ -void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Process receive EOF for R2. @@ -235,13 +235,13 @@ void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * check complete function which will either send NAK or FIN. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. ph must not be NULL. + * txn must not be NULL. ph must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information * */ -void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Process received file data for R1. @@ -250,12 +250,12 @@ void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * For R1, only need to digest the CRC. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. ph must not be NULL. + * txn must not be NULL. ph must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -void CF_CFDP_R1_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_R1_SubstateRecvFileData(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Process received file data for R2. @@ -268,12 +268,12 @@ void CF_CFDP_R1_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t * the ACK timer. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. ph must not be NULL. + * txn must not be NULL. ph must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Loads a single NAK segment request. @@ -282,13 +282,13 @@ void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t * This is a function callback from CF_ChunkList_ComputeGaps(). * * @par Assumptions, External Events, and Notes: - * chunks must not be NULL, c must not be NULL, opaque must not be NULL. + * chunks must not be NULL, chunk must not be NULL, opaque must not be NULL. * * @param chunks Not used, required for compatibility with CF_ChunkList_ComputeGaps - * @param c Pointer to a single chunk information + * @param chunk Pointer to a single chunk information * @param opaque Pointer to a CF_GapComputeArgs_t object (passed via CF_ChunkList_ComputeGaps) */ -void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *c, void *opaque); +void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *chunk, void *opaque); /************************************************************************/ /** @brief Send a NAK PDU for R2. @@ -301,13 +301,13 @@ void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *c, vo * packet will be sent to request another. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * * @retval CFE_SUCCESS on success. CF_ERROR on error. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t); +CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *txn); /************************************************************************/ /** @brief Calculate up to the configured amount of bytes of CRC. @@ -324,26 +324,26 @@ CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t); * of the value in the configuration table. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * * @retval CFE_SUCCESS on completion. * @retval CF_ERROR on non-completion. * */ -CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t); +CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *txn); /************************************************************************/ /** @brief Send a FIN PDU. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * * @retval CFE_SUCCESS on success. CF_ERROR on error. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * */ -CFE_Status_t CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t); +CFE_Status_t CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *txn); /************************************************************************/ /** @brief Process receive FIN-ACK PDU. @@ -353,12 +353,12 @@ CFE_Status_t CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t); * state. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. ph must not be NULL. + * txn must not be NULL. ph must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -void CF_CFDP_R2_Recv_fin_ack(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_R2_Recv_fin_ack(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Process receive metadata PDU for R2. @@ -371,21 +371,21 @@ void CF_CFDP_R2_Recv_fin_ack(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * destination according to the metadata PDU. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. ph must not be NULL. + * txn must not be NULL. ph must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_R2_RecvMd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Sends an inactivity timer expired event to EVS. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_R_SendInactivityEvent(CF_Transaction_t *t); +void CF_CFDP_R_SendInactivityEvent(CF_Transaction_t *txn); #endif /* CF_CFDP_R_H */ diff --git a/fsw/src/cf_cfdp_s.c b/fsw/src/cf_cfdp_s.c index f7d3a903..a23d260a 100644 --- a/fsw/src/cf_cfdp_s.c +++ b/fsw/src/cf_cfdp_s.c @@ -46,9 +46,9 @@ * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -static inline void CF_CFDP_S_Reset(CF_Transaction_t *t) +static inline void CF_CFDP_S_Reset(CF_Transaction_t *txn) { - CF_CFDP_ResetTransaction(t, 1); + CF_CFDP_ResetTransaction(txn, 1); } /*---------------------------------------------------------------- @@ -57,14 +57,14 @@ static inline void CF_CFDP_S_Reset(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_S_SendEof(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_S_SendEof(CF_Transaction_t *txn) { - if (!t->flags.com.crc_calc) + if (!txn->flags.com.crc_calc) { - CF_CRC_Finalize(&t->crc); - t->flags.com.crc_calc = 1; + CF_CRC_Finalize(&txn->crc); + txn->flags.com.crc_calc = 1; } - return CF_CFDP_SendEof(t); + return CF_CFDP_SendEof(txn); } /*---------------------------------------------------------------- @@ -73,14 +73,14 @@ CFE_Status_t CF_CFDP_S_SendEof(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S1_SubstateSendEof(CF_Transaction_t *t) +void CF_CFDP_S1_SubstateSendEof(CF_Transaction_t *txn) { /* this looks weird, but the idea is we want to reset the transaction if some error occurs while sending * and we want to reset the transaction if no error occurs. But, if we couldn't send because there are * no buffers, then we need to try and send again next time. */ - if (CF_CFDP_S_SendEof(t) != CF_SEND_PDU_NO_BUF_AVAIL_ERROR) + if (CF_CFDP_S_SendEof(txn) != CF_SEND_PDU_NO_BUF_AVAIL_ERROR) { - CF_CFDP_S_Reset(t); /* all done, so clean up */ + CF_CFDP_S_Reset(txn); /* all done, so clean up */ } } @@ -90,16 +90,16 @@ void CF_CFDP_S1_SubstateSendEof(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *t) +void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *txn) { - t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; - t->flags.com.ack_timer_armed = 1; /* will cause tick to see ack_timer as expired, and act */ + txn->state_data.send.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; + txn->flags.com.ack_timer_armed = 1; /* will cause tick to see ack_timer as expired, and act */ /* no longer need to send file data PDU except in the case of NAK response */ /* move this transaction off Q_PEND */ - CF_DequeueTransaction(t); - CF_InsertSortPrio(t, CF_QueueIdx_TXW); + CF_DequeueTransaction(txn); + CF_InsertSortPrio(txn, CF_QueueIdx_TXW); } /*---------------------------------------------------------------- @@ -108,13 +108,13 @@ void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 bytes_to_read, uint8 calc_crc) +CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *txn, uint32 foffs, uint32 bytes_to_read, uint8 calc_crc) { bool success = true; int status = 0; CFE_Status_t ret = CF_ERROR; - CF_Logical_PduBuffer_t * ph = CF_CFDP_ConstructPduHeader(t, 0, CF_AppData.config_table->local_eid, - t->history->peer_eid, 0, t->history->seq_num, 1); + CF_Logical_PduBuffer_t * ph = CF_CFDP_ConstructPduHeader(txn, 0, CF_AppData.config_table->local_eid, + txn->history->peer_eid, 0, txn->history->seq_num, 1); CF_Logical_PduFileDataHeader_t *fd; size_t actual_bytes; void * data_ptr; @@ -162,38 +162,38 @@ CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 by fd->data_len = actual_bytes; fd->data_ptr = data_ptr; - if (t->state_data.s.cached_pos != foffs) + if (txn->state_data.send.cached_pos != foffs) { - status = CF_WrappedLseek(t->fd, foffs, OS_SEEK_SET); + status = CF_WrappedLseek(txn->fd, foffs, OS_SEEK_SET); if (status != foffs) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_SEEK_FD, CFE_EVS_EventType_ERROR, - "CF S%d(%lu:%lu): error seeking to offset %ld, got %ld", (t->state == CF_TxnState_S2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, (long)foffs, + "CF S%d(%lu:%lu): error seeking to offset %ld, got %ld", (txn->state == CF_TxnState_S2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num, (long)foffs, (long)status); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_seek; success = false; } } if (success) { - status = CF_WrappedRead(t->fd, data_ptr, actual_bytes); + status = CF_WrappedRead(txn->fd, data_ptr, actual_bytes); if (status != actual_bytes) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_READ, CFE_EVS_EventType_ERROR, "CF S%d(%lu:%lu): error reading bytes: expected %ld, got %ld", - (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num, (long)actual_bytes, (long)status); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_read; + (txn->state == CF_TxnState_S2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num, (long)actual_bytes, (long)status); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_read; success = false; } } if (success) { - t->state_data.s.cached_pos += status; - status = CF_CFDP_SendFd(t, ph); + txn->state_data.send.cached_pos += status; + status = CF_CFDP_SendFd(txn, ph); if (status == CF_SEND_PDU_NO_BUF_AVAIL_ERROR) { ret = CFE_SUCCESS; /* no bytes were processed */ @@ -201,18 +201,18 @@ CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 by else if (status == CF_SEND_PDU_ERROR) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_SEND_FD, CFE_EVS_EventType_ERROR, - "CF S%d(%lu:%lu): error sending fd", (t->state == CF_TxnState_S2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); + "CF S%d(%lu:%lu): error sending fd", (txn->state == CF_TxnState_S2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num); ret = CF_ERROR; } else { - CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes += actual_bytes; + CF_AppData.hk.channel_hk[txn->chan_num].counters.sent.file_data_bytes += actual_bytes; - CF_Assert((foffs + actual_bytes) <= t->fsize); /* sanity check */ + CF_Assert((foffs + actual_bytes) <= txn->fsize); /* sanity check */ if (calc_crc) { - CF_CRC_Digest(&t->crc, fd->data_ptr, fd->data_len); + CF_CRC_Digest(&txn->crc, fd->data_ptr, fd->data_len); } ret = actual_bytes; @@ -229,24 +229,24 @@ CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 by * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *t) +void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *txn) { - int32 bytes_processed = CF_CFDP_S_SendFileData(t, t->foffs, (t->fsize - t->foffs), 1); + int32 bytes_processed = CF_CFDP_S_SendFileData(txn, txn->foffs, (txn->fsize - txn->foffs), 1); if (bytes_processed > 0) { - t->foffs += bytes_processed; - if (t->foffs == t->fsize) + txn->foffs += bytes_processed; + if (txn->foffs == txn->fsize) { /* file is done */ - t->state_data.s.sub_state = CF_TxSubState_EOF; + txn->state_data.send.sub_state = CF_TxSubState_EOF; } } else if (bytes_processed < 0) { /* IO error -- change state and send EOF */ - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); - t->state_data.s.sub_state = CF_TxSubState_EOF; + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_FILESTORE_REJECTION); + txn->state_data.send.sub_state = CF_TxSubState_EOF; } else { @@ -260,15 +260,15 @@ void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *txn) { - const CF_Chunk_t *c; + const CF_Chunk_t *chunk; CFE_Status_t sret; CFE_Status_t ret = 0; - if (t->flags.tx.md_need_send) + if (txn->flags.tx.md_need_send) { - sret = CF_CFDP_SendMd(t); + sret = CF_CFDP_SendMd(txn); if (sret == CF_SEND_PDU_ERROR) { ret = CF_ERROR; /* error occurred */ @@ -277,7 +277,7 @@ CFE_Status_t CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) { if (sret == CFE_SUCCESS) { - t->flags.tx.md_need_send = 0; + txn->flags.tx.md_need_send = 0; } /* unless CF_SEND_PDU_ERROR, return 1 to keep caller from sending file data */ ret = 1; /* 1 means nak processed, so don't send filedata */ @@ -286,13 +286,13 @@ CFE_Status_t CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) else { /* Get first chunk and process if available */ - c = CF_ChunkList_GetFirstChunk(&t->chunks->chunks); - if (c != NULL) + chunk = CF_ChunkList_GetFirstChunk(&txn->chunks->chunks); + if (chunk != NULL) { - ret = CF_CFDP_S_SendFileData(t, c->offset, c->size, 0); + ret = CF_CFDP_S_SendFileData(txn, chunk->offset, chunk->size, 0); if (ret > 0) { - CF_ChunkList_RemoveFromFirst(&t->chunks->chunks, ret); + CF_ChunkList_RemoveFromFirst(&txn->chunks->chunks, ret); ret = 1; /* processed nak, so caller doesn't send file data */ } else if (ret < 0) @@ -315,18 +315,18 @@ CFE_Status_t CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S2_SubstateSendFileData(CF_Transaction_t *t) +void CF_CFDP_S2_SubstateSendFileData(CF_Transaction_t *txn) { - int ret = CF_CFDP_S_CheckAndRespondNak(t); + int ret = CF_CFDP_S_CheckAndRespondNak(txn); if (!ret) { - CF_CFDP_S_SubstateSendFileData(t); + CF_CFDP_S_SubstateSendFileData(txn); } else if (ret < 0) { - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_NAK_RESPONSE_ERROR); - CF_CFDP_S_Reset(t); + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_NAK_RESPONSE_ERROR); + CF_CFDP_S_Reset(txn); } else { @@ -340,66 +340,66 @@ void CF_CFDP_S2_SubstateSendFileData(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *t) +void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *txn) { CFE_Status_t sret; int32 ret; int status = 0; bool success = true; - if (!OS_ObjectIdDefined(t->fd)) + if (!OS_ObjectIdDefined(txn->fd)) { - if (OS_FileOpenCheck(t->history->fnames.src_filename) == OS_SUCCESS) + if (OS_FileOpenCheck(txn->history->fnames.src_filename) == OS_SUCCESS) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_ALREADY_OPEN, CFE_EVS_EventType_ERROR, - "CF S%d(%lu:%lu): file %s already open", (t->state == CF_TxnState_S2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, - t->history->fnames.src_filename); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open; + "CF S%d(%lu:%lu): file %s already open", (txn->state == CF_TxnState_S2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num, + txn->history->fnames.src_filename); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_open; success = false; } if (success) { - ret = CF_WrappedOpenCreate(&t->fd, t->history->fnames.src_filename, OS_FILE_FLAG_NONE, OS_READ_ONLY); + ret = CF_WrappedOpenCreate(&txn->fd, txn->history->fnames.src_filename, OS_FILE_FLAG_NONE, OS_READ_ONLY); if (ret < 0) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_OPEN, CFE_EVS_EventType_ERROR, - "CF S%d(%lu:%lu): failed to open file %s, error=%ld", (t->state == CF_TxnState_S2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, - t->history->fnames.src_filename, (long)ret); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open; - t->fd = OS_OBJECT_ID_UNDEFINED; /* just in case */ + "CF S%d(%lu:%lu): failed to open file %s, error=%ld", (txn->state == CF_TxnState_S2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num, + txn->history->fnames.src_filename, (long)ret); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_open; + txn->fd = OS_OBJECT_ID_UNDEFINED; /* just in case */ success = false; } } if (success) { - status = CF_WrappedLseek(t->fd, 0, OS_SEEK_END); + status = CF_WrappedLseek(txn->fd, 0, OS_SEEK_END); if (status < 0) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_SEEK_END, CFE_EVS_EventType_ERROR, "CF S%d(%lu:%lu): failed to seek end file %s, error=%ld", - (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num, t->history->fnames.src_filename, (long)status); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; + (txn->state == CF_TxnState_S2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num, txn->history->fnames.src_filename, (long)status); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_seek; success = false; } } if (success) { - t->fsize = status; + txn->fsize = status; - status = CF_WrappedLseek(t->fd, 0, OS_SEEK_SET); + status = CF_WrappedLseek(txn->fd, 0, OS_SEEK_SET); if (status != 0) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_SEEK_BEG, CFE_EVS_EventType_ERROR, "CF S%d(%lu:%lu): failed to seek begin file %s, got %ld", - (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num, t->history->fnames.src_filename, (long)status); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; + (txn->state == CF_TxnState_S2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num, txn->history->fnames.src_filename, (long)status); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_seek; success = false; } } @@ -407,31 +407,31 @@ void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *t) if (success) { - sret = CF_CFDP_SendMd(t); + sret = CF_CFDP_SendMd(txn); if (sret == CF_SEND_PDU_ERROR) { /* failed to send md */ CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_SEND_MD, CFE_EVS_EventType_ERROR, "CF S%d(%lu:%lu): failed to send md", - (t->state == CF_TxnState_S2), (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num); + (txn->state == CF_TxnState_S2), (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num); success = false; } else if (sret == CFE_SUCCESS) { /* once metadata is sent, switch to filedata mode */ - t->state_data.s.sub_state = CF_TxSubState_FILEDATA; + txn->state_data.send.sub_state = CF_TxSubState_FILEDATA; } /* if sret==CF_SEND_PDU_NO_BUF_AVAIL_ERROR, then try to send md again next cycle */ } if (!success) { - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION); - CF_CFDP_S_Reset(t); + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_FILESTORE_REJECTION); + CF_CFDP_S_Reset(txn); } /* don't need CF_CRC_Start() since taken care of by reset_cfdp() */ - /*CF_CRC_Start(&t->crc);*/ + /*CF_CRC_Start(&txn->crc);*/ } /*---------------------------------------------------------------- @@ -440,14 +440,14 @@ void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S_SubstateSendFinAck(CF_Transaction_t *t) +void CF_CFDP_S_SubstateSendFinAck(CF_Transaction_t *txn) { /* if send, or error, reset. if no message, try again next cycle */ - if (CF_CFDP_SendAck(t, CF_CFDP_AckTxnStatus_ACTIVE, CF_CFDP_FileDirective_FIN, t->state_data.s.s2.fin_cc, - t->history->peer_eid, t->history->seq_num) != CF_SEND_PDU_NO_BUF_AVAIL_ERROR) + if (CF_CFDP_SendAck(txn, CF_CFDP_AckTxnStatus_ACTIVE, CF_CFDP_FileDirective_FIN, txn->state_data.send.s2.fin_cc, + txn->history->peer_eid, txn->history->seq_num) != CF_SEND_PDU_NO_BUF_AVAIL_ERROR) { - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_NO_ERROR); - CF_CFDP_S_Reset(t); + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_NO_ERROR); + CF_CFDP_S_Reset(txn); } } @@ -457,14 +457,14 @@ void CF_CFDP_S_SubstateSendFinAck(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S2_EarlyFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S2_EarlyFin(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { /* received early fin, so just cancel */ CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_EARLY_FIN, CFE_EVS_EventType_ERROR, - "CF S%d(%lu:%lu): got early FIN -- cancelling", (t->state == CF_TxnState_S2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_EARLY_FIN); - CF_CFDP_S_Reset(t); + "CF S%d(%lu:%lu): got early FIN -- cancelling", (txn->state == CF_TxnState_S2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num); + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_EARLY_FIN); + CF_CFDP_S_Reset(txn); } /*---------------------------------------------------------------- @@ -473,10 +473,10 @@ void CF_CFDP_S2_EarlyFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S2_Fin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S2_Fin(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - t->state_data.s.s2.fin_cc = ph->int_header.fin.cc; - t->state_data.s.sub_state = CF_TxSubState_SEND_FIN_ACK; + txn->state_data.send.s2.fin_cc = ph->int_header.fin.cc; + txn->state_data.send.sub_state = CF_TxSubState_SEND_FIN_ACK; } /*---------------------------------------------------------------- @@ -485,7 +485,7 @@ void CF_CFDP_S2_Fin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S2_Nak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S2_Nak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { const CF_Logical_SegmentRequest_t *sr; const CF_Logical_PduNak_t * nak; @@ -497,7 +497,7 @@ void CF_CFDP_S2_Nak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) /* this function is only invoked for NAK PDU types */ nak = &ph->int_header.nak; - if (CF_CFDP_RecvNak(t, ph) == CFE_SUCCESS && nak->segment_list.num_segments > 0) + if (CF_CFDP_RecvNak(txn, ph) == CFE_SUCCESS && nak->segment_list.num_segments > 0) { for (counter = 0; counter < nak->segment_list.num_segments; ++counter) { @@ -506,7 +506,7 @@ void CF_CFDP_S2_Nak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) if (sr->offset_start == 0 && sr->offset_end == 0) { /* need to re-send metadata PDU */ - t->flags.tx.md_need_send = 1; + txn->flags.tx.md_need_send = 1; } else { @@ -517,31 +517,31 @@ void CF_CFDP_S2_Nak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) } /* overflow probably won't be an issue */ - if (sr->offset_end > t->fsize) + if (sr->offset_end > txn->fsize) { ++bad_sr; continue; } /* insert gap data in chunks */ - CF_ChunkListAdd(&t->chunks->chunks, sr->offset_start, sr->offset_end - sr->offset_start); + CF_ChunkListAdd(&txn->chunks->chunks, sr->offset_start, sr->offset_end - sr->offset_start); } } - CF_AppData.hk.channel_hk[t->chan_num].counters.recv.nak_segment_requests += nak->segment_list.num_segments; + CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.nak_segment_requests += nak->segment_list.num_segments; if (bad_sr) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_INVALID_SR, CFE_EVS_EventType_ERROR, - "CF S%d(%lu:%lu): received %d invalid NAK segment requests", (t->state == CF_TxnState_S2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num, bad_sr); + "CF S%d(%lu:%lu): received %d invalid NAK segment requests", (txn->state == CF_TxnState_S2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num, bad_sr); } } else { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_PDU_NAK, CFE_EVS_EventType_ERROR, - "CF S%d(%lu:%lu): received invalid NAK PDU", (t->state == CF_TxnState_S2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; + "CF S%d(%lu:%lu): received invalid NAK PDU", (txn->state == CF_TxnState_S2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error; } } @@ -551,10 +551,10 @@ void CF_CFDP_S2_Nak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S2_Nak_Arm(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S2_Nak_Arm(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - CF_CFDP_ArmAckTimer(t); - CF_CFDP_S2_Nak(t, ph); + CF_CFDP_ArmAckTimer(txn); + CF_CFDP_S2_Nak(txn, ph); } /*---------------------------------------------------------------- @@ -563,28 +563,28 @@ void CF_CFDP_S2_Nak_Arm(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - if (!CF_CFDP_RecvAck(t, ph)) + if (!CF_CFDP_RecvAck(txn, ph)) { /* don't send FIN if error. Don't check the EOF CC, just go with * the stored one we sent before */ - if (CF_TxnStatus_IsError(t->history->txn_stat)) + if (CF_TxnStatus_IsError(txn->history->txn_stat)) { - CF_CFDP_S_Reset(t); + CF_CFDP_S_Reset(txn); } else { - t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_FIN; - t->flags.com.ack_timer_armed = 0; /* just wait for FIN now, nothing to re-send */ + txn->state_data.send.sub_state = CF_TxSubState_WAIT_FOR_FIN; + txn->flags.com.ack_timer_armed = 0; /* just wait for FIN now, nothing to re-send */ } } else { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_PDU_EOF, CFE_EVS_EventType_ERROR, - "CF S%d(%lu:%lu): received invalid EOF PDU", (t->state == CF_TxnState_S2), - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error; + "CF S%d(%lu:%lu): received invalid EOF PDU", (txn->state == CF_TxnState_S2), + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error; } } @@ -594,11 +594,11 @@ void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S1_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { /* s1 doesn't need to receive anything */ static const CF_CFDP_S_SubstateRecvDispatchTable_t substate_fns = {{NULL}}; - CF_CFDP_S_DispatchRecv(t, ph, &substate_fns); + CF_CFDP_S_DispatchRecv(txn, ph, &substate_fns); } /*---------------------------------------------------------------- @@ -607,7 +607,7 @@ void CF_CFDP_S1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S2_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { static const CF_CFDP_FileDirectiveDispatchTable_t s2_meta = {.fdirective = { [CF_CFDP_FileDirective_FIN] = CF_CFDP_S2_EarlyFin, @@ -634,7 +634,7 @@ void CF_CFDP_S2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) [CF_TxSubState_SEND_FIN_ACK] = &s2_fin_ack, }}; - CF_CFDP_S_DispatchRecv(t, ph, &substate_fns); + CF_CFDP_S_DispatchRecv(txn, ph, &substate_fns); } /*---------------------------------------------------------------- @@ -643,7 +643,7 @@ void CF_CFDP_S2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S1_Tx(CF_Transaction_t *t) +void CF_CFDP_S1_Tx(CF_Transaction_t *txn) { static const CF_CFDP_S_SubstateSendDispatchTable_t substate_fns = { .substate = { @@ -652,7 +652,7 @@ void CF_CFDP_S1_Tx(CF_Transaction_t *t) [CF_TxSubState_EOF] = CF_CFDP_S1_SubstateSendEof, }}; - CF_CFDP_S_DispatchTransmit(t, &substate_fns); + CF_CFDP_S_DispatchTransmit(txn, &substate_fns); } /*---------------------------------------------------------------- @@ -661,7 +661,7 @@ void CF_CFDP_S1_Tx(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S2_Tx(CF_Transaction_t *t) +void CF_CFDP_S2_Tx(CF_Transaction_t *txn) { static const CF_CFDP_S_SubstateSendDispatchTable_t substate_fns = { .substate = { @@ -670,7 +670,7 @@ void CF_CFDP_S2_Tx(CF_Transaction_t *t) [CF_TxSubState_EOF] = CF_CFDP_S2_SubstateSendEof, }}; - CF_CFDP_S_DispatchTransmit(t, &substate_fns); + CF_CFDP_S_DispatchTransmit(txn, &substate_fns); } /*---------------------------------------------------------------- @@ -679,12 +679,12 @@ void CF_CFDP_S2_Tx(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S_Cancel(CF_Transaction_t *t) +void CF_CFDP_S_Cancel(CF_Transaction_t *txn) { - if (t->state_data.s.sub_state < CF_TxSubState_EOF) + if (txn->state_data.send.sub_state < CF_TxSubState_EOF) { /* if state has not reached CF_TxSubState_EOF, then set it to CF_TxSubState_EOF now. */ - t->state_data.s.sub_state = CF_TxSubState_EOF; + txn->state_data.send.sub_state = CF_TxSubState_EOF; } } @@ -694,7 +694,7 @@ void CF_CFDP_S_Cancel(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont /* unused */) +void CF_CFDP_S_Tick(CF_Transaction_t *txn, int *cont /* unused */) { /* Steven is not real happy with this function. There should be a better way to separate out * the logic by state so that it isn't a bunch of if statements for different flags @@ -704,74 +704,74 @@ void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont /* unused */) /* at each tick, various timers used by S are checked */ /* first, check inactivity timer */ - if (t->state == CF_TxnState_S2) + if (txn->state == CF_TxnState_S2) { - if (CF_Timer_Expired(&t->inactivity_timer)) + if (CF_Timer_Expired(&txn->inactivity_timer)) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_INACT_TIMER, CFE_EVS_EventType_ERROR, - "CF S2(%lu:%lu): inactivity timer expired", (unsigned long)t->history->src_eid, - (unsigned long)t->history->seq_num); - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_INACTIVITY_DETECTED); + "CF S2(%lu:%lu): inactivity timer expired", (unsigned long)txn->history->src_eid, + (unsigned long)txn->history->seq_num); + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_INACTIVITY_DETECTED); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.inactivity_timer; - CF_CFDP_S_Reset(t); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.inactivity_timer; + CF_CFDP_S_Reset(txn); } else { - CF_Timer_Tick(&t->inactivity_timer); + CF_Timer_Tick(&txn->inactivity_timer); - if (t->flags.com.ack_timer_armed) + if (txn->flags.com.ack_timer_armed) { - if (CF_Timer_Expired(&t->ack_timer)) + if (CF_Timer_Expired(&txn->ack_timer)) { - if (t->state_data.s.sub_state == CF_TxSubState_WAIT_FOR_EOF_ACK) + if (txn->state_data.send.sub_state == CF_TxSubState_WAIT_FOR_EOF_ACK) { /* Increment acknak counter */ - ++t->state_data.s.s2.acknak_count; + ++txn->state_data.send.s2.acknak_count; /* Check limit and handle if needed */ - if (t->state_data.s.s2.acknak_count >= CF_AppData.config_table->chan[t->chan_num].ack_limit) + if (txn->state_data.send.s2.acknak_count >= CF_AppData.config_table->chan[txn->chan_num].ack_limit) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_ACK_LIMIT, CFE_EVS_EventType_ERROR, "CF S2(%lu:%lu), ack limit reached, no eof-ack", - (unsigned long)t->history->src_eid, (unsigned long)t->history->seq_num); - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_ACK_LIMIT_NO_EOF); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.ack_limit; + (unsigned long)txn->history->src_eid, (unsigned long)txn->history->seq_num); + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_ACK_LIMIT_NO_EOF); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.ack_limit; /* no reason to reset this timer, as it isn't used again */ - CF_CFDP_S_Reset(t); + CF_CFDP_S_Reset(txn); early_exit = true; /* must exit after reset */ } else { - sret = CF_CFDP_S_SendEof(t); + sret = CF_CFDP_S_SendEof(txn); if (sret == CF_SEND_PDU_NO_BUF_AVAIL_ERROR) { early_exit = true; } else if (sret == CF_SEND_PDU_ERROR) { - CF_CFDP_SetTxnStatus(t, CF_TxnStatus_SEND_EOF_FAILURE); - CF_CFDP_S_Reset(t); /* can't go on, error occurred */ + CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_SEND_EOF_FAILURE); + CF_CFDP_S_Reset(txn); /* can't go on, error occurred */ early_exit = true; } if (!early_exit) { - CF_CFDP_ArmAckTimer(t); /* re-arm ack timer */ + CF_CFDP_ArmAckTimer(txn); /* re-arm ack timer */ } } } } else { - CF_Timer_Tick(&t->ack_timer); + CF_Timer_Tick(&txn->ack_timer); } } - if (!early_exit && t->state_data.s.sub_state == CF_TxSubState_SEND_FIN_ACK) + if (!early_exit && txn->state_data.send.sub_state == CF_TxSubState_SEND_FIN_ACK) { - CF_CFDP_S_SubstateSendFinAck(t); + CF_CFDP_S_SubstateSendFinAck(txn); } } } @@ -783,9 +783,9 @@ void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont /* unused */) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_S_Tick_Nak(CF_Transaction_t *t, int *cont) +void CF_CFDP_S_Tick_Nak(CF_Transaction_t *txn, int *cont) { - int ret = CF_CFDP_S_CheckAndRespondNak(t); + int ret = CF_CFDP_S_CheckAndRespondNak(txn); if (ret == 1) *cont = 1; /* cause dispatcher to re-enter this wakeup */ diff --git a/fsw/src/cf_cfdp_s.h b/fsw/src/cf_cfdp_s.h index 4d81408e..953471b6 100644 --- a/fsw/src/cf_cfdp_s.h +++ b/fsw/src/cf_cfdp_s.h @@ -35,43 +35,43 @@ /** @brief S1 receive PDU processing. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -void CF_CFDP_S1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_S1_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief S2 receive PDU processing. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -void CF_CFDP_S2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_S2_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief S1 dispatch function. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_S1_Tx(CF_Transaction_t *t); +void CF_CFDP_S1_Tx(CF_Transaction_t *txn); /************************************************************************/ /** @brief S2 dispatch function. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_S2_Tx(CF_Transaction_t *t); +void CF_CFDP_S2_Tx(CF_Transaction_t *txn); /************************************************************************/ /** @brief Perform tick (time-based) processing for S transactions. @@ -83,12 +83,12 @@ void CF_CFDP_S2_Tx(CF_Transaction_t *t); * retransmit must occur. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. cont is unused, so may be NULL + * txn must not be NULL. cont is unused, so may be NULL * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param cont Unused, exists for compatibility with tick processor */ -void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont); +void CF_CFDP_S_Tick(CF_Transaction_t *txn, int *cont); /************************************************************************/ /** @brief Perform NAK response for TX transactions @@ -99,22 +99,22 @@ void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont); * left to send. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. cont must not be NULL. + * txn must not be NULL. cont must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param cont Set to 1 if a NAK was generated */ -void CF_CFDP_S_Tick_Nak(CF_Transaction_t *t, int *cont); +void CF_CFDP_S_Tick_Nak(CF_Transaction_t *txn, int *cont); /************************************************************************/ /** @brief Cancel an S transaction. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_S_Cancel(CF_Transaction_t *t); +void CF_CFDP_S_Cancel(CF_Transaction_t *txn); /*********************************************************************** * @@ -127,35 +127,35 @@ void CF_CFDP_S_Cancel(CF_Transaction_t *t); /** @brief Send an EOF PDU. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * * @retval CFE_SUCCESS on success. * @retval CF_SEND_PDU_NO_BUF_AVAIL_ERROR if message buffer cannot be obtained. * @retval CF_SEND_PDU_ERROR if an error occurred while building the packet. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -CFE_Status_t CF_CFDP_S_SendEof(CF_Transaction_t *t); +CFE_Status_t CF_CFDP_S_SendEof(CF_Transaction_t *txn); /************************************************************************/ /** @brief Sends an EOF for S1. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_S1_SubstateSendEof(CF_Transaction_t *t); +void CF_CFDP_S1_SubstateSendEof(CF_Transaction_t *txn); /************************************************************************/ /** @brief Triggers tick processing to send an EOF and wait for EOF-ACK for S2 * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *t); +void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *txn); /************************************************************************/ /** @brief Helper function to populate the PDU with file data and send it. @@ -166,18 +166,18 @@ void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *t); * The file is read into the filedata PDU and then the PDU is sent. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * * @returns The number of bytes sent in the file data PDU (CFE_SUCCESS, * i.e. 0, if no bytes were processed), or CF_ERROR on error * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param foffs Position in file to send data from * @param bytes_to_read Number of bytes to send (maximum) * @param calc_crc Enable CRC/Checksum calculation * */ -CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 bytes_to_read, uint8 calc_crc); +CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *txn, uint32 foffs, uint32 bytes_to_read, uint8 calc_crc); /************************************************************************/ /** @brief Standard state function to send the next file data PDU for active transaction. @@ -189,11 +189,11 @@ CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 by * state. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *t); +void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *txn); /************************************************************************/ /** @brief Respond to a NAK by sending filedata PDUs as response. @@ -203,15 +203,15 @@ void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *t); * occur. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * * @returns CF_ERROR if error. * @retval 0 if no NAK processed. * @retval 1 if NAK processed. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -CFE_Status_t CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t); +CFE_Status_t CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *txn); /************************************************************************/ /** @brief Send filedata handling for S2. @@ -221,11 +221,11 @@ CFE_Status_t CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t); * absence of a NAK, it will send more of the original file data. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_S2_SubstateSendFileData(CF_Transaction_t *t); +void CF_CFDP_S2_SubstateSendFileData(CF_Transaction_t *txn); /************************************************************************/ /** @brief Send metadata PDU. @@ -235,43 +235,43 @@ void CF_CFDP_S2_SubstateSendFileData(CF_Transaction_t *t); * size of the file to put in the metadata PDU. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *t); +void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *txn); /************************************************************************/ /** @brief Send FIN-ACK packet for S2. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_CFDP_S_SubstateSendFinAck(CF_Transaction_t *t); +void CF_CFDP_S_SubstateSendFinAck(CF_Transaction_t *txn); /************************************************************************/ /** @brief A FIN was received before file complete, so abandon the transaction. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. ph must not be NULL. + * txn must not be NULL. ph must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -void CF_CFDP_S2_EarlyFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_S2_EarlyFin(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief S2 received FIN, so set flag to send FIN-ACK. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. ph must not be NULL. + * txn must not be NULL. ph must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -void CF_CFDP_S2_Fin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_S2_Fin(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief S2 NAK PDU received handling. @@ -282,23 +282,23 @@ void CF_CFDP_S2_Fin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * PDUs. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. ph must not be NULL. + * txn must not be NULL. ph must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -void CF_CFDP_S2_Nak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_S2_Nak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief S2 NAK handling but with arming the NAK timer. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. ph must not be NULL. + * txn must not be NULL. ph must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -void CF_CFDP_S2_Nak_Arm(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_S2_Nak_Arm(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief S2 received ACK PDU in wait for EOF-ACK state. @@ -308,11 +308,11 @@ void CF_CFDP_S2_Nak_Arm(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * which waits for a FIN PDU. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. ph must not be NULL. + * txn must not be NULL. ph must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param ph Pointer to the PDU information */ -void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); #endif /* !CF_CFDP_S_H */ diff --git a/fsw/src/cf_cfdp_sbintf.c b/fsw/src/cf_cfdp_sbintf.c index eb07391d..a40db7ab 100644 --- a/fsw/src/cf_cfdp_sbintf.c +++ b/fsw/src/cf_cfdp_sbintf.c @@ -58,10 +58,10 @@ * See description in cf_cfdp_sbintf.h for argument/return detail * *-----------------------------------------------------------------*/ -CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *t, bool silent) +CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *txn, bool silent) { /* if channel is frozen, do not take message */ - CF_Channel_t * c = CF_AppData.engine.channels + t->chan_num; + CF_Channel_t * chan = CF_AppData.engine.channels + txn->chan_num; bool success = true; CF_Logical_PduBuffer_t *ret; int32 os_status; @@ -76,21 +76,21 @@ CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *t, bool silent CF_AppData.engine.out.msg = NULL; } - if (CF_AppData.config_table->chan[t->chan_num].max_outgoing_messages_per_wakeup && + if (CF_AppData.config_table->chan[txn->chan_num].max_outgoing_messages_per_wakeup && (CF_AppData.engine.outgoing_counter == - CF_AppData.config_table->chan[t->chan_num].max_outgoing_messages_per_wakeup)) + CF_AppData.config_table->chan[txn->chan_num].max_outgoing_messages_per_wakeup)) { /* no more messages this wakeup allowed */ - c->cur = t; /* remember where we were for next time */ + chan->cur = txn; /* remember where we were for next time */ success = false; } - if (success && !CF_AppData.hk.channel_hk[t->chan_num].frozen && !t->flags.com.suspended) + if (success && !CF_AppData.hk.channel_hk[txn->chan_num].frozen && !txn->flags.com.suspended) { /* first, check if there's room in the pipe for the message we want to build */ - if (OS_ObjectIdDefined(c->sem_id)) + if (OS_ObjectIdDefined(chan->sem_id)) { - os_status = OS_CountSemTimedWait(c->sem_id, 0); + os_status = OS_CountSemTimedWait(chan->sem_id, 0); } else { @@ -106,7 +106,7 @@ CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *t, bool silent if (!CF_AppData.engine.out.msg) { - c->cur = t; /* remember where we were for next time */ + chan->cur = txn; /* remember where we were for next time */ if (!silent && (os_status == OS_SUCCESS)) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_NO_MSG, CFE_EVS_EventType_ERROR, @@ -118,7 +118,7 @@ CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *t, bool silent if (success) { CFE_MSG_Init(&CF_AppData.engine.out.msg->Msg, - CFE_SB_ValueToMsgId(CF_AppData.config_table->chan[t->chan_num].mid_output), offsetof(CF_PduTlmMsg_t, ph)); + CFE_SB_ValueToMsgId(CF_AppData.config_table->chan[txn->chan_num].mid_output), offsetof(CF_PduTlmMsg_t, ph)); ++CF_AppData.engine.outgoing_counter; /* even if max_outgoing_messages_per_wakeup is 0 (unlimited), it's ok to inc this */ @@ -171,12 +171,12 @@ void CF_CFDP_Send(uint8 chan_num, const CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_sbintf.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CFDP_ReceiveMessage(CF_Channel_t *c) +void CF_CFDP_ReceiveMessage(CF_Channel_t *chan) { - CF_Transaction_t *t; /* initialized below */ + CF_Transaction_t *txn; /* initialized below */ uint32 count = 0; int32 status; - const int chan_num = (c - CF_AppData.engine.channels); + const int chan_num = (chan - CF_AppData.engine.channels); CFE_SB_Buffer_t * bufptr; CFE_MSG_Size_t msg_size; CFE_MSG_Type_t msg_type = CFE_MSG_Type_Invalid; @@ -186,7 +186,7 @@ void CF_CFDP_ReceiveMessage(CF_Channel_t *c) for (; count < CF_AppData.config_table->chan[chan_num].rx_max_messages_per_wakeup; ++count) { - status = CFE_SB_ReceiveBuffer(&bufptr, c->pipe, CFE_SB_POLL); + status = CFE_SB_ReceiveBuffer(&bufptr, chan->pipe, CFE_SB_POLL); if (status != CFE_SUCCESS) { break; /* no more messages */ @@ -217,12 +217,12 @@ void CF_CFDP_ReceiveMessage(CF_Channel_t *c) if (!CF_CFDP_RecvPh(chan_num, ph)) { /* got a valid PDU -- look it up by sequence number */ - t = CF_FindTransactionBySequenceNumber(c, ph->pdu_header.sequence_num, ph->pdu_header.source_eid); - if (t) + txn = CF_FindTransactionBySequenceNumber(chan, ph->pdu_header.sequence_num, ph->pdu_header.source_eid); + if (txn) { /* found one! Send it to the transaction state processor */ - CF_Assert(t->state > CF_TxnState_IDLE); - CF_CFDP_DispatchRecv(t, ph); + CF_Assert(txn->state > CF_TxnState_IDLE); + CF_CFDP_DispatchRecv(txn, ph); } else { @@ -237,7 +237,7 @@ void CF_CFDP_ReceiveMessage(CF_Channel_t *c) if (ph->pdu_header.source_eid == CF_AppData.config_table->local_eid && ph->fdirective.directive_code == CF_CFDP_FileDirective_FIN) { - if (!CF_CFDP_RecvFin(t, ph)) + if (!CF_CFDP_RecvFin(txn, ph)) { memset(&t_finack, 0, sizeof(t_finack)); CF_CFDP_InitTxnTxFile(&t_finack, CF_CFDP_CLASS_2, 1, chan_num, @@ -247,8 +247,8 @@ void CF_CFDP_ReceiveMessage(CF_Channel_t *c) ph->pdu_header.sequence_num) != CF_SEND_PDU_NO_BUF_AVAIL_ERROR) { /* couldn't get output buffer -- don't care about a send error (oh well, can't send) but we - * do care that there was no message because c->cur will be set to this transaction */ - c->cur = NULL; /* do not remember temp transaction for next time */ + * do care that there was no message because chan->cur will be set to this transaction */ + chan->cur = NULL; /* do not remember temp transaction for next time */ } /* NOTE: recv and recv_spurious will both be incremented */ @@ -271,22 +271,22 @@ void CF_CFDP_ReceiveMessage(CF_Channel_t *c) "CF: dropping packet from %lu transaction number 0x%08lx due max RX transactions reached", (unsigned long)ph->pdu_header.source_eid, (unsigned long)ph->pdu_header.sequence_num); - /* NOTE: as there is no transaction (t) associated with this, there is no known channel, + /* NOTE: as there is no transaction (txn) associated with this, there is no known channel, and therefore no known counter to account it to (because dropped is per-chan) */ } else { - t = CF_FindUnusedTransaction(c); - CF_Assert(t); - t->history->dir = CF_Direction_RX; + txn = CF_FindUnusedTransaction(chan); + CF_Assert(txn); + txn->history->dir = CF_Direction_RX; /* set default FIN status */ - t->state_data.r.r2.dc = CF_CFDP_FinDeliveryCode_INCOMPLETE; - t->state_data.r.r2.fs = CF_CFDP_FinFileStatus_DISCARDED; + txn->state_data.receive.r2.dc = CF_CFDP_FinDeliveryCode_INCOMPLETE; + txn->state_data.receive.r2.fs = CF_CFDP_FinFileStatus_DISCARDED; - t->flags.com.q_index = CF_QueueIdx_RX; - CF_CList_InsertBack_Ex(c, t->flags.com.q_index, &t->cl_node); - CF_CFDP_DispatchRecv(t, ph); /* will enter idle state */ + txn->flags.com.q_index = CF_QueueIdx_RX; + CF_CList_InsertBack_Ex(chan, txn->flags.com.q_index, &txn->cl_node); + CF_CFDP_DispatchRecv(txn, ph); /* will enter idle state */ } } else diff --git a/fsw/src/cf_cfdp_sbintf.h b/fsw/src/cf_cfdp_sbintf.h index dea590dc..ac49e710 100644 --- a/fsw/src/cf_cfdp_sbintf.h +++ b/fsw/src/cf_cfdp_sbintf.h @@ -75,15 +75,15 @@ typedef struct CF_PduTlmMsg * printed in the case of no buffer available. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param silent If true, suppresses error events if no message can be allocated * * @returns Pointer to a CF_Logical_PduBuffer_t on success. * @retval NULL on error */ -CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *t, bool silent); +CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *txn, bool silent); /************************************************************************/ /** @brief Sends the current output buffer via the software bus. @@ -101,11 +101,11 @@ void CF_CFDP_Send(uint8 chan_num, const CF_Logical_PduBuffer_t *ph); /** @brief Process received message on channel PDU input pipe. * * @par Assumptions, External Events, and Notes: - * c must be a member of the array within the CF_AppData global object + * chan must be a member of the array within the CF_AppData global object * - * @param c Channel to receive message on + * @param chan Channel to receive message on * */ -void CF_CFDP_ReceiveMessage(CF_Channel_t *c); +void CF_CFDP_ReceiveMessage(CF_Channel_t *chan); #endif /* !CF_CFDP_SBINTF_H */ diff --git a/fsw/src/cf_cfdp_types.h b/fsw/src/cf_cfdp_types.h index a4d9c85a..cac7271b 100644 --- a/fsw/src/cf_cfdp_types.h +++ b/fsw/src/cf_cfdp_types.h @@ -195,7 +195,7 @@ typedef struct CF_ChunkWrapper /** * @brief CF Playback entry * - * Keeps the state of CF playback requests + * Keeps the state of CF pb requests */ typedef struct CF_Playback { @@ -324,8 +324,8 @@ typedef union CF_StateFlags */ typedef union CF_StateData { - CF_TxState_Data_t s; /**< \brief applies to only send file transactions */ - CF_RxState_Data_t r; /**< \brief applies to only receive file transactions */ + CF_TxState_Data_t send; /**< \brief applies to only send file transactions */ + CF_RxState_Data_t receive; /**< \brief applies to only receive file transactions */ } CF_StateData_t; /** @@ -354,7 +354,7 @@ typedef struct CF_Transaction CF_CListNode_t cl_node; - CF_Playback_t *p; /**< \brief NULL if transaction does not belong to a playback */ + CF_Playback_t *pb; /**< \brief NULL if transaction does not belong to a playback */ CF_StateData_t state_data; @@ -385,7 +385,7 @@ typedef enum * * This keeps the state of CF channels * - * Each CF channel has a separate transaction list, PDU throttle, playback, + * Each CF channel has a separate transaction list, PDU throttle, pb, * and poll state, as well as separate addresses on the underlying message * transport (e.g. SB). */ diff --git a/fsw/src/cf_chunk.c b/fsw/src/cf_chunk.c index 94afd2d6..0e42520c 100644 --- a/fsw/src/cf_chunk.c +++ b/fsw/src/cf_chunk.c @@ -298,21 +298,21 @@ void CF_ChunkListAdd(CF_ChunkList_t *chunks, CF_ChunkOffset_t offset, CF_ChunkSi *-----------------------------------------------------------------*/ void CF_ChunkList_RemoveFromFirst(CF_ChunkList_t *chunks, CF_ChunkSize_t size) { - CF_Chunk_t *c = &chunks->chunks[0]; /* front is always 0 */ + CF_Chunk_t *chunk = &chunks->chunks[0]; /* front is always 0 */ - if (size > c->size) + if (size > chunk->size) { - size = c->size; + size = chunk->size; } - c->size -= size; + chunk->size -= size; - if (!c->size) + if (!chunk->size) { CF_Chunks_EraseChunk(chunks, 0); } else { - c->offset += size; + chunk->offset += size; } } @@ -366,7 +366,7 @@ uint32 CF_ChunkList_ComputeGaps(const CF_ChunkList_t *chunks, CF_ChunkIdx_t max_ CF_ChunkIdx_t i = 0; CF_ChunkOffset_t next_off; CF_ChunkOffset_t gap_start; - CF_Chunk_t c; + CF_Chunk_t chunk; CF_Assert(total); /* does it make sense to have a 0 byte file? */ CF_Assert(start < total); @@ -374,11 +374,11 @@ uint32 CF_ChunkList_ComputeGaps(const CF_ChunkList_t *chunks, CF_ChunkIdx_t max_ /* simple case: there is no chunk data, which means there is a single gap of the entire size */ if (!chunks->count) { - c.offset = 0; - c.size = total; + chunk.offset = 0; + chunk.size = total; if (compute_gap_fn) { - compute_gap_fn(chunks, &c, opaque); + compute_gap_fn(chunks, &chunk, opaque); } ret = 1; } @@ -387,11 +387,11 @@ uint32 CF_ChunkList_ComputeGaps(const CF_ChunkList_t *chunks, CF_ChunkIdx_t max_ /* Handle initial gap if needed */ if (start < chunks->chunks[0].offset) { - c.offset = start; - c.size = chunks->chunks[0].offset - start; + chunk.offset = start; + chunk.size = chunks->chunks[0].offset - start; if (compute_gap_fn) { - compute_gap_fn(chunks, &c, opaque); + compute_gap_fn(chunks, &chunk, opaque); } ret = 1; } @@ -401,8 +401,8 @@ uint32 CF_ChunkList_ComputeGaps(const CF_ChunkList_t *chunks, CF_ChunkIdx_t max_ next_off = (i == (chunks->count - 1)) ? total : chunks->chunks[i + 1].offset; gap_start = (chunks->chunks[i].offset + chunks->chunks[i].size); - c.offset = (gap_start > start) ? gap_start : start; - c.size = (next_off - c.offset); + chunk.offset = (gap_start > start) ? gap_start : start; + chunk.size = (next_off - chunk.offset); if (gap_start >= total) { @@ -413,7 +413,7 @@ uint32 CF_ChunkList_ComputeGaps(const CF_ChunkList_t *chunks, CF_ChunkIdx_t max_ /* Only report if gap finishes after start */ if (compute_gap_fn) { - compute_gap_fn(chunks, &c, opaque); + compute_gap_fn(chunks, &chunk, opaque); } ++ret; } diff --git a/fsw/src/cf_chunk.h b/fsw/src/cf_chunk.h index 68c79fcd..46a59c5a 100644 --- a/fsw/src/cf_chunk.h +++ b/fsw/src/cf_chunk.h @@ -57,10 +57,10 @@ typedef struct CF_ChunkList * @brief Function for use with CF_ChunkList_ComputeGaps() * * @param cs Pointer to the CF_ChunkList_t object - * @param c Pointer to the chunk being currently processed + * @param chunk Pointer to the chunk being currently processed * @param opaque Opaque pointer passed through from initial call */ -typedef void (*CF_ChunkList_ComputeGapFn_t)(const CF_ChunkList_t *cs, const CF_Chunk_t *c, void *opaque); +typedef void (*CF_ChunkList_ComputeGapFn_t)(const CF_ChunkList_t *cs, const CF_Chunk_t *chunk, void *opaque); /** * @brief Selects the larger of the two passed-in offsets diff --git a/fsw/src/cf_clist.c b/fsw/src/cf_clist.c index 07d0632f..b7c99007 100644 --- a/fsw/src/cf_clist.c +++ b/fsw/src/cf_clist.c @@ -188,21 +188,21 @@ void CF_CList_InsertAfter(CF_CListNode_t **head, CF_CListNode_t *start, CF_CList *-----------------------------------------------------------------*/ void CF_CList_Traverse(CF_CListNode_t *start, CF_CListFn_t fn, void *context) { - CF_CListNode_t *n = start; - CF_CListNode_t *nn; + CF_CListNode_t *node = start; + CF_CListNode_t *node_next; int last = 0; - if (n) + if (node) { do { - /* set nn in case callback removes this node from the list */ - nn = n->next; - if (nn == start) + /* set node_next in case callback removes this node from the list */ + node_next = node->next; + if (node_next == start) { last = 1; } - if (fn(n, context)) + if (fn(node, context)) { break; } @@ -210,11 +210,11 @@ void CF_CList_Traverse(CF_CListNode_t *start, CF_CListFn_t fn, void *context) * but there is a special case if that item is the starting node. Since this is * a circular list, start is remembered so we know when to stop. Must set start * to the next node in this case. */ - if ((start == n) && (n->next != nn)) + if ((start == node) && (node->next != node_next)) { - start = nn; + start = node_next; } - n = nn; + node = node_next; } while (!last); } } @@ -229,24 +229,24 @@ void CF_CList_Traverse_R(CF_CListNode_t *end, CF_CListFn_t fn, void *context) { if (end) { - CF_CListNode_t *n = end->prev; - CF_CListNode_t *nn; + CF_CListNode_t *node = end->prev; + CF_CListNode_t *node_next; int last = 0; - if (n) + if (node) { - end = n; + end = node; do { - /* set nn in case callback removes this node from the list */ - nn = n->prev; - if (nn == end) + /* set node_next in case callback removes this node from the list */ + node_next = node->prev; + if (node_next == end) { last = 1; } - if (fn(n, context)) + if (fn(node, context)) { break; } @@ -255,11 +255,11 @@ void CF_CList_Traverse_R(CF_CListNode_t *end, CF_CListFn_t fn, void *context) * but there is a special case if that item is the starting node. Since this is * a circular list, "end" is remembered so we know when to stop. Must set "end" * to the next node in this case. */ - if ((end == n) && (n->prev != nn)) + if ((end == node) && (node->prev != node_next)) { - end = nn; + end = node_next; } - n = nn; + node = node_next; } while (!last); } } diff --git a/fsw/src/cf_cmd.c b/fsw/src/cf_cmd.c index e87b1d72..0241e674 100644 --- a/fsw/src/cf_cmd.c +++ b/fsw/src/cf_cmd.c @@ -334,17 +334,17 @@ CF_Transaction_t *CF_FindTransactionBySequenceNumberAllChannels(CF_TransactionSe *-----------------------------------------------------------------*/ CFE_Status_t CF_TsnChanAction(CF_TransactionCmd_t *cmd, const char *cmdstr, CF_TsnChanAction_fn_t fn, void *context) { - CF_Transaction_t *t; + CF_Transaction_t *txn; CFE_Status_t ret = CF_ERROR; if (cmd->chan == CF_COMPOUND_KEY) { /* special value 254 means to use the compound key (cmd->eid, cmd->ts) to find the transaction * to act upon */ - t = CF_FindTransactionBySequenceNumberAllChannels(cmd->ts, cmd->eid); - if (t) + txn = CF_FindTransactionBySequenceNumberAllChannels(cmd->ts, cmd->eid); + if (txn) { - fn(t, context); + fn(txn, context); ret = 1; /* because one transaction was matched - this should return a count */ } else @@ -379,16 +379,16 @@ CFE_Status_t CF_TsnChanAction(CF_TransactionCmd_t *cmd, const char *cmdstr, CF_T * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_DoSuspRes_Txn(CF_Transaction_t *t, CF_ChanAction_SuspResArg_t *context) +void CF_DoSuspRes_Txn(CF_Transaction_t *txn, CF_ChanAction_SuspResArg_t *context) { - CF_Assert(t); - if (t->flags.com.suspended == context->action) + CF_Assert(txn); + if (txn->flags.com.suspended == context->action) { context->same = 1; } else { - t->flags.com.suspended = context->action; + txn->flags.com.suspended = context->action; } } @@ -461,9 +461,9 @@ void CF_CmdResume(CFE_SB_Buffer_t *msg) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CmdCancel_Txn(CF_Transaction_t *t, void *ignored) +void CF_CmdCancel_Txn(CF_Transaction_t *txn, void *ignored) { - CF_CFDP_CancelTransaction(t); + CF_CFDP_CancelTransaction(txn); } /*---------------------------------------------------------------- @@ -494,9 +494,9 @@ void CF_CmdCancel(CFE_SB_Buffer_t *msg) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CmdAbandon_Txn(CF_Transaction_t *t, void *ignored) +void CF_CmdAbandon_Txn(CF_Transaction_t *txn, void *ignored) { - CF_CFDP_ResetTransaction(t, 0); + CF_CFDP_ResetTransaction(txn, 0); } /*---------------------------------------------------------------- @@ -668,10 +668,10 @@ void CF_CmdDisablePolldir(CFE_SB_Buffer_t *msg) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c) +CFE_Status_t CF_PurgeHistory(CF_CListNode_t *node, CF_Channel_t *chan) { - CF_History_t *h = container_of(n, CF_History_t, cl_node); - CF_ResetHistory(c, h); /* ok to reset transaction since it's in PEND it hasn't started yet */ + CF_History_t *history = container_of(node, CF_History_t, cl_node); + CF_ResetHistory(chan, history); /* ok to reset transaction since it's in PEND it hasn't started yet */ return CF_CLIST_CONT; } @@ -681,10 +681,10 @@ CFE_Status_t CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_PurgeTransaction(CF_CListNode_t *n, void *ignored) +CFE_Status_t CF_PurgeTransaction(CF_CListNode_t *node, void *ignored) { - CF_Transaction_t *t = container_of(n, CF_Transaction_t, cl_node); - CF_CFDP_ResetTransaction(t, 0); + CF_Transaction_t *txn = container_of(node, CF_Transaction_t, cl_node); + CF_CFDP_ResetTransaction(txn, 0); return CF_CLIST_CONT; } @@ -698,7 +698,7 @@ CFE_Status_t CF_DoPurgeQueue(uint8 chan_num, CF_UnionArgsCmd_t *cmd) { CFE_Status_t ret = CFE_SUCCESS; /* no need to bounds check chan_num, done in caller */ - CF_Channel_t *c = &CF_AppData.engine.channels[chan_num]; + CF_Channel_t *chan = &CF_AppData.engine.channels[chan_num]; int pend = 0; int hist = 0; @@ -727,12 +727,12 @@ CFE_Status_t CF_DoPurgeQueue(uint8 chan_num, CF_UnionArgsCmd_t *cmd) if (pend) { - CF_CList_Traverse(c->qs[CF_QueueIdx_PEND], CF_PurgeTransaction, NULL); + CF_CList_Traverse(chan->qs[CF_QueueIdx_PEND], CF_PurgeTransaction, NULL); } if (hist) { - CF_CList_Traverse(c->qs[CF_QueueIdx_HIST], (CF_CListFn_t)CF_PurgeHistory, c); + CF_CList_Traverse(chan->qs[CF_QueueIdx_HIST], (CF_CListFn_t)CF_PurgeHistory, chan); } return ret; @@ -768,7 +768,7 @@ void CF_CmdPurgeQueue(CFE_SB_Buffer_t *msg) void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) { CF_WriteQueueCmd_t *wq = (CF_WriteQueueCmd_t *)msg; - CF_Channel_t * c = &CF_AppData.engine.channels[wq->chan]; + CF_Channel_t * chan = &CF_AppData.engine.channels[wq->chan]; osal_id_t fd = OS_OBJECT_ID_UNDEFINED; bool success = true; int32 ret; @@ -808,7 +808,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) /* process uplink queue data */ if ((wq->queue == CF_Queue_all) || (wq->queue == CF_Queue_active)) { - ret = CF_WriteTxnQueueDataToFile(fd, c, CF_QueueIdx_RX); + ret = CF_WriteTxnQueueDataToFile(fd, chan, CF_QueueIdx_RX); if (ret) { CFE_EVS_SendEvent(CF_EID_ERR_CMD_WQ_WRITEQ_RX, CFE_EVS_EventType_ERROR, @@ -821,7 +821,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) if (success && ((wq->queue == CF_Queue_all) || (wq->queue == CF_Queue_history))) { - ret = CF_WriteHistoryQueueDataToFile(fd, c, CF_Direction_RX); + ret = CF_WriteHistoryQueueDataToFile(fd, chan, CF_Direction_RX); if (ret) { CFE_EVS_SendEvent(CF_EID_ERR_CMD_WQ_WRITEHIST_RX, CFE_EVS_EventType_ERROR, @@ -843,7 +843,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) static const int qs[2] = {CF_QueueIdx_TXA, CF_QueueIdx_TXW}; for (i = 0; i < 2; ++i) { - ret = CF_WriteTxnQueueDataToFile(fd, c, qs[i]); + ret = CF_WriteTxnQueueDataToFile(fd, chan, qs[i]); if (ret) { CFE_EVS_SendEvent(CF_EID_ERR_CMD_WQ_WRITEQ_TX, CFE_EVS_EventType_ERROR, @@ -859,7 +859,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) if (success && ((wq->queue == CF_Queue_all) || (wq->queue == CF_Queue_pend))) { /* write pending queue */ - ret = CF_WriteTxnQueueDataToFile(fd, c, CF_QueueIdx_PEND); + ret = CF_WriteTxnQueueDataToFile(fd, chan, CF_QueueIdx_PEND); if (ret) { CFE_EVS_SendEvent(CF_EID_ERR_CMD_WQ_WRITEQ_PEND, CFE_EVS_EventType_ERROR, @@ -873,7 +873,7 @@ void CF_CmdWriteQueue(CFE_SB_Buffer_t *msg) if (success && ((wq->queue == CF_Queue_all) || (wq->queue == CF_Queue_history))) { /* write history queue */ - ret = CF_WriteHistoryQueueDataToFile(fd, c, CF_Direction_TX); + ret = CF_WriteHistoryQueueDataToFile(fd, chan, CF_Direction_TX); if (ret) { CFE_EVS_SendEvent(CF_EID_ERR_CMD_WQ_WRITEHIST_TX, CFE_EVS_EventType_ERROR, diff --git a/fsw/src/cf_cmd.h b/fsw/src/cf_cmd.h index 85148d44..9b6660f4 100644 --- a/fsw/src/cf_cmd.h +++ b/fsw/src/cf_cmd.h @@ -232,12 +232,12 @@ CFE_Status_t CF_TsnChanAction(CF_TransactionCmd_t *cmd, const char *cmdstr, CF_T /** @brief Set the suspended bit in a transaction. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. context must not be NULL. + * txn must not be NULL. context must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param context Pointer to CF_ChanAction_SuspResArg_t structure from initial call */ -void CF_DoSuspRes_Txn(CF_Transaction_t *t, CF_ChanAction_SuspResArg_t *context); +void CF_DoSuspRes_Txn(CF_Transaction_t *txn, CF_ChanAction_SuspResArg_t *context); /************************************************************************/ /** @brief Handle transaction suspend and resume commands. @@ -280,12 +280,12 @@ void CF_CmdResume(CFE_SB_Buffer_t *msg); * This helper function is used with CF_TsnChanAction() to cancel matched transactions * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to transaction object + * @param txn Pointer to transaction object * @param ignored Not used by this function */ -void CF_CmdCancel_Txn(CF_Transaction_t *t, void *ignored); +void CF_CmdCancel_Txn(CF_Transaction_t *txn, void *ignored); /************************************************************************/ /** @brief Handle a cancel ground command. @@ -305,10 +305,10 @@ void CF_CmdCancel(CFE_SB_Buffer_t *msg); * @par Assumptions, External Events, and Notes: * msg must not be NULL. * - * @param t Pointer to transaction object + * @param txn Pointer to transaction object * @param ignored Not used by this function */ -void CF_CmdAbandon_Txn(CF_Transaction_t *t, void *ignored); +void CF_CmdAbandon_Txn(CF_Transaction_t *txn, void *ignored); /************************************************************************/ /** @brief Handle an abandon ground command. @@ -395,14 +395,14 @@ void CF_CmdDisablePolldir(CFE_SB_Buffer_t *msg); * This helper function is used in conjunction with CF_CList_Traverse() * * @par Assumptions, External Events, and Notes: - * n must not be NULL. c must not be NULL. + * node must not be NULL. chan must not be NULL. * - * @param n Current list node being traversed - * @param c Channel pointer passed through as opaque object + * @param node Current list node being traversed + * @param chan Channel pointer passed through as opaque object * * @returns Always #CF_CLIST_CONT to process all entries */ -CFE_Status_t CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c); +CFE_Status_t CF_PurgeHistory(CF_CListNode_t *node, CF_Channel_t *chan); /************************************************************************/ /** @brief Purge the pending transaction queue. @@ -410,14 +410,14 @@ CFE_Status_t CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c); * This helper function is used in conjunction with CF_CList_Traverse() * * @par Assumptions, External Events, and Notes: - * n must not be NULL. + * node must not be NULL. * - * @param n Current list node being traversed + * @param node Current list node being traversed * @param ignored Not used by this implementation * * @returns Always #CF_CLIST_CONT to process all entries */ -CFE_Status_t CF_PurgeTransaction(CF_CListNode_t *n, void *ignored); +CFE_Status_t CF_PurgeTransaction(CF_CListNode_t *node, void *ignored); /************************************************************************/ /** @brief Channel action command to perform purge queue operations. diff --git a/fsw/src/cf_crc.c b/fsw/src/cf_crc.c index d8e6bfa1..0031f9ad 100644 --- a/fsw/src/cf_crc.c +++ b/fsw/src/cf_crc.c @@ -39,9 +39,9 @@ * See description in cf_crc.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CRC_Start(CF_Crc_t *c) +void CF_CRC_Start(CF_Crc_t *crc) { - memset(c, 0, sizeof(*c)); + memset(crc, 0, sizeof(*crc)); } /*---------------------------------------------------------------- @@ -50,21 +50,21 @@ void CF_CRC_Start(CF_Crc_t *c) * See description in cf_crc.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CRC_Digest(CF_Crc_t *c, const uint8 *data, int len) +void CF_CRC_Digest(CF_Crc_t *crc, const uint8 *data, int len) { int i = 0; for (; i < len; ++i) { - c->working <<= 8; - c->working |= data[i]; + crc->working <<= 8; + crc->working |= data[i]; - ++c->index; + ++crc->index; - if (c->index == 4) + if (crc->index == 4) { - c->result += c->working; - c->index = 0; + crc->result += crc->working; + crc->index = 0; } } } @@ -75,16 +75,16 @@ void CF_CRC_Digest(CF_Crc_t *c, const uint8 *data, int len) * See description in cf_crc.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_CRC_Finalize(CF_Crc_t *c) +void CF_CRC_Finalize(CF_Crc_t *crc) { - if (c->index) + if (crc->index) { - c->result += (c->working << (8 * (4 - c->index))); + crc->result += (crc->working << (8 * (4 - crc->index))); /* set the index to 0 in case the user calls CF_CRC_Digest() again. It * will add the new data to the CRC result. This lets the user get * the current result in the stream if they want. */ - c->index = 0; - c->working = 0; + crc->index = 0; + crc->working = 0; } } diff --git a/fsw/src/cf_crc.h b/fsw/src/cf_crc.h index fd1b862e..043efaa8 100644 --- a/fsw/src/cf_crc.h +++ b/fsw/src/cf_crc.h @@ -42,11 +42,11 @@ typedef struct CF_Crc /** @brief Start a CRC streamable digest. * * @par Assumptions, External Events, and Notes: - * c must not be NULL. + * crc must not be NULL. * - * @param c CRC object to operate on + * @param crc CRC object to operate on */ -void CF_CRC_Start(CF_Crc_t *c); +void CF_CRC_Start(CF_Crc_t *crc); /************************************************************************/ /** @brief Digest a chunk for CRC calculation. @@ -56,14 +56,14 @@ void CF_CRC_Start(CF_Crc_t *c); * 4-byte word in case the input was not evenly divisible for 4. * * @par Assumptions, External Events, and Notes: - * c must not be NULL. + * crc must not be NULL. * - * @param c CRC object to operate on + * @param crc CRC object to operate on * @param data Pointer to data to digest * @param len Length of data to digest * */ -void CF_CRC_Digest(CF_Crc_t *c, const uint8 *data, int len); +void CF_CRC_Digest(CF_Crc_t *crc, const uint8 *data, int len); /************************************************************************/ /** @brief Finalize a CRC calculation. @@ -74,11 +74,11 @@ void CF_CRC_Digest(CF_Crc_t *c, const uint8 *data, int len); * result field of the structure holds the result. * * @par Assumptions, External Events, and Notes: - * c must not be NULL. + * crc must not be NULL. * - * @param c CRC object to operate on + * @param crc CRC object to operate on * */ -void CF_CRC_Finalize(CF_Crc_t *c); +void CF_CRC_Finalize(CF_Crc_t *crc); #endif /* !CF_CRC_H */ diff --git a/fsw/src/cf_timer.c b/fsw/src/cf_timer.c index 8430bf5e..4ea2600e 100644 --- a/fsw/src/cf_timer.c +++ b/fsw/src/cf_timer.c @@ -51,9 +51,9 @@ uint32 CF_Timer_Sec2Ticks(CF_Timer_Seconds_t sec) * See description in cf_timer.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_Timer_InitRelSec(CF_Timer_t *t, uint32 rel_sec) +void CF_Timer_InitRelSec(CF_Timer_t *txn, uint32 rel_sec) { - t->tick = CF_Timer_Sec2Ticks(rel_sec); + txn->tick = CF_Timer_Sec2Ticks(rel_sec); } /*---------------------------------------------------------------- @@ -62,9 +62,9 @@ void CF_Timer_InitRelSec(CF_Timer_t *t, uint32 rel_sec) * See description in cf_timer.h for argument/return detail * *-----------------------------------------------------------------*/ -bool CF_Timer_Expired(const CF_Timer_t *t) +bool CF_Timer_Expired(const CF_Timer_t *txn) { - return !t->tick; + return !txn->tick; } /*---------------------------------------------------------------- @@ -73,8 +73,8 @@ bool CF_Timer_Expired(const CF_Timer_t *t) * See description in cf_timer.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_Timer_Tick(CF_Timer_t *t) +void CF_Timer_Tick(CF_Timer_t *txn) { - CF_Assert(t->tick); - --t->tick; + CF_Assert(txn->tick); + --txn->tick; } diff --git a/fsw/src/cf_timer.h b/fsw/src/cf_timer.h index bd7e2527..f1896cd1 100644 --- a/fsw/src/cf_timer.h +++ b/fsw/src/cf_timer.h @@ -54,36 +54,36 @@ typedef struct CF_Timer /** @brief Initialize a timer with a relative number of seconds. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Timer object to initialize + * @param txn Timer object to initialize * @param rel_sec Relative number of seconds */ -void CF_Timer_InitRelSec(CF_Timer_t *t, CF_Timer_Seconds_t rel_sec); +void CF_Timer_InitRelSec(CF_Timer_t *txn, CF_Timer_Seconds_t rel_sec); /************************************************************************/ /** @brief Check if a timer has expired. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Timer object to check + * @param txn Timer object to check * * @returns status code indicating whether timer has expired * @retval 1 if expired * @retval 0 if not expired */ -bool CF_Timer_Expired(const CF_Timer_t *t); +bool CF_Timer_Expired(const CF_Timer_t *txn); /************************************************************************/ /** @brief Notify a timer object a tick has occurred. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Timer object to tick + * @param txn Timer object to tick */ -void CF_Timer_Tick(CF_Timer_t *t); +void CF_Timer_Tick(CF_Timer_t *txn); /************************************************************************/ /** @brief Converts seconds into scheduler ticks. diff --git a/fsw/src/cf_utils.c b/fsw/src/cf_utils.c index 89171407..adf97bcf 100644 --- a/fsw/src/cf_utils.c +++ b/fsw/src/cf_utils.c @@ -40,39 +40,39 @@ * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CF_Transaction_t *CF_FindUnusedTransaction(CF_Channel_t *c) +CF_Transaction_t *CF_FindUnusedTransaction(CF_Channel_t *chan) { - CF_CListNode_t * n; - CF_Transaction_t *t; + CF_CListNode_t * node; + CF_Transaction_t *txn; int q_index; /* initialized below in if */ - CF_Assert(c); + CF_Assert(chan); - if (c->qs[CF_QueueIdx_FREE]) + if (chan->qs[CF_QueueIdx_FREE]) { - n = c->qs[CF_QueueIdx_FREE]; - t = container_of(n, CF_Transaction_t, cl_node); + node = chan->qs[CF_QueueIdx_FREE]; + txn = container_of(node, CF_Transaction_t, cl_node); - CF_CList_Remove_Ex(c, CF_QueueIdx_FREE, &t->cl_node); + CF_CList_Remove_Ex(chan, CF_QueueIdx_FREE, &txn->cl_node); /* now that a transaction is acquired, must also acquire a history slot to go along with it */ - if (c->qs[CF_QueueIdx_HIST_FREE]) + if (chan->qs[CF_QueueIdx_HIST_FREE]) { q_index = CF_QueueIdx_HIST_FREE; } else { /* no free history, so take the oldest one from the channel's history queue */ - CF_Assert(c->qs[CF_QueueIdx_HIST]); + CF_Assert(chan->qs[CF_QueueIdx_HIST]); q_index = CF_QueueIdx_HIST; } - t->history = container_of(c->qs[q_index], CF_History_t, cl_node); - t->history->dir = CF_Direction_NUM; /* start with no direction */ + txn->history = container_of(chan->qs[q_index], CF_History_t, cl_node); + txn->history->dir = CF_Direction_NUM; /* start with no direction */ - CF_CList_Remove_Ex(c, q_index, &t->history->cl_node); + CF_CList_Remove_Ex(chan, q_index, &txn->history->cl_node); - return t; + return txn; } else { @@ -86,10 +86,10 @@ CF_Transaction_t *CF_FindUnusedTransaction(CF_Channel_t *c) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_ResetHistory(CF_Channel_t *c, CF_History_t *h) +void CF_ResetHistory(CF_Channel_t *chan, CF_History_t *history) { - CF_CList_Remove_Ex(c, CF_QueueIdx_HIST, &h->cl_node); - CF_CList_InsertBack_Ex(c, CF_QueueIdx_HIST_FREE, &h->cl_node); + CF_CList_Remove_Ex(chan, CF_QueueIdx_HIST, &history->cl_node); + CF_CList_InsertBack_Ex(chan, CF_QueueIdx_HIST_FREE, &history->cl_node); } /*---------------------------------------------------------------- @@ -98,16 +98,16 @@ void CF_ResetHistory(CF_Channel_t *c, CF_History_t *h) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_FreeTransaction(CF_Transaction_t *t) +void CF_FreeTransaction(CF_Transaction_t *txn) { - uint8 c = t->chan_num; - memset(t, 0, sizeof(*t)); - t->flags.com.q_index = CF_QueueIdx_FREE; - t->fd = OS_OBJECT_ID_UNDEFINED; - t->chan_num = c; - t->state = CF_TxnState_IDLE; /* NOTE: this is redundant as long as CF_TxnState_IDLE == 0 */ - CF_CList_InitNode(&t->cl_node); - CF_CList_InsertBack_Ex(&CF_AppData.engine.channels[c], CF_QueueIdx_FREE, &t->cl_node); + uint8 chan = txn->chan_num; + memset(txn, 0, sizeof(*txn)); + txn->flags.com.q_index = CF_QueueIdx_FREE; + txn->fd = OS_OBJECT_ID_UNDEFINED; + txn->chan_num = chan; + txn->state = CF_TxnState_IDLE; /* NOTE: this is redundant as long as CF_TxnState_IDLE == 0 */ + CF_CList_InitNode(&txn->cl_node); + CF_CList_InsertBack_Ex(&CF_AppData.engine.channels[chan], CF_QueueIdx_FREE, &txn->cl_node); } /*---------------------------------------------------------------- @@ -116,14 +116,14 @@ void CF_FreeTransaction(CF_Transaction_t *t) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Traverse_TransSeqArg_t *context) +CFE_Status_t CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *node, CF_Traverse_TransSeqArg_t *context) { - CF_Transaction_t *t = container_of(n, CF_Transaction_t, cl_node); + CF_Transaction_t *txn = container_of(node, CF_Transaction_t, cl_node); CFE_Status_t ret = 0; - if ((t->history->src_eid == context->src_eid) && (t->history->seq_num == context->transaction_sequence_number)) + if ((txn->history->src_eid == context->src_eid) && (txn->history->seq_num == context->transaction_sequence_number)) { - context->t = t; + context->txn = txn; ret = 1; /* exit early */ } @@ -136,7 +136,7 @@ CFE_Status_t CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Trave * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_TransactionSeq_t transaction_sequence_number, +CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *chan, CF_TransactionSeq_t transaction_sequence_number, CF_EntityId_t src_eid) { /* need to find transaction by sequence number. It will either be the active transaction (front of Q_PEND), @@ -144,17 +144,17 @@ CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_Transac * * Let's put CF_QueueIdx_RX up front, because most RX packets will be file data PDUs */ CF_Traverse_TransSeqArg_t ctx = {transaction_sequence_number, src_eid, NULL}; - CF_CListNode_t * ptrs[] = {c->qs[CF_QueueIdx_RX], c->qs[CF_QueueIdx_PEND], c->qs[CF_QueueIdx_TXA], - c->qs[CF_QueueIdx_TXW]}; + CF_CListNode_t * ptrs[] = {chan->qs[CF_QueueIdx_RX], chan->qs[CF_QueueIdx_PEND], chan->qs[CF_QueueIdx_TXA], + chan->qs[CF_QueueIdx_TXW]}; int i; CF_Transaction_t * ret = NULL; for (i = 0; i < (sizeof(ptrs) / sizeof(ptrs[0])); ++i) { CF_CList_Traverse(ptrs[i], (CF_CListFn_t)CF_FindTransactionBySequenceNumber_Impl, &ctx); - if (ctx.t) + if (ctx.txn) { - ret = ctx.t; + ret = ctx.txn; break; } } @@ -168,7 +168,7 @@ CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_Transac * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h) +CFE_Status_t CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *history) { static const char *CF_DSTR[] = {"RX", "TX"}; /* conversion of CF_Direction_t to string */ @@ -182,17 +182,17 @@ CFE_Status_t CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h) switch (i) { case 0: - CF_Assert(h->dir < CF_Direction_NUM); + CF_Assert(history->dir < CF_Direction_NUM); snprintf(linebuf, sizeof(linebuf), "SEQ (%lu, %lu)\tDIR: %s\tPEER %lu\tSTAT: %d\t", - (unsigned long)h->src_eid, (unsigned long)h->seq_num, CF_DSTR[h->dir], - (unsigned long)h->peer_eid, (int)h->txn_stat); + (unsigned long)history->src_eid, (unsigned long)history->seq_num, CF_DSTR[history->dir], + (unsigned long)history->peer_eid, (int)history->txn_stat); break; case 1: - snprintf(linebuf, sizeof(linebuf), "SRC: %s\t", h->fnames.src_filename); + snprintf(linebuf, sizeof(linebuf), "SRC: %s\t", history->fnames.src_filename); break; case 2: default: - snprintf(linebuf, sizeof(linebuf), "DST: %s\n", h->fnames.dst_filename); + snprintf(linebuf, sizeof(linebuf), "DST: %s\n", history->fnames.dst_filename); break; } @@ -215,15 +215,15 @@ CFE_Status_t CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *arg) +CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void *arg) { CF_Traverse_WriteHistoryFileArg_t *context = arg; - CF_History_t * h = container_of(n, CF_History_t, cl_node); + CF_History_t * history = container_of(node, CF_History_t, cl_node); /* if filter_dir is CF_Direction_NUM, this means both directions (all match) */ - if (context->filter_dir == CF_Direction_NUM || h->dir == context->filter_dir) + if (context->filter_dir == CF_Direction_NUM || history->dir == context->filter_dir) { - if (CF_WriteHistoryEntryToFile(context->fd, h) < 0) + if (CF_WriteHistoryEntryToFile(context->fd, history) < 0) { /* failed */ context->error = true; @@ -242,12 +242,12 @@ CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *a * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *n, void *arg) +CFE_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *node, void *arg) { CF_Traverse_WriteTxnFileArg_t *context = arg; - CF_Transaction_t * t = container_of(n, CF_Transaction_t, cl_node); + CF_Transaction_t * txn = container_of(node, CF_Transaction_t, cl_node); - if (CF_WriteHistoryEntryToFile(context->fd, t->history) < 0) + if (CF_WriteHistoryEntryToFile(context->fd, txn->history) < 0) { /* failed */ context->error = true; @@ -264,7 +264,7 @@ CFE_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *n, void *arg) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_QueueIdx_t q) +CFE_Status_t CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *chan, CF_QueueIdx_t queue) { CF_Traverse_WriteTxnFileArg_t arg; @@ -272,7 +272,7 @@ CFE_Status_t CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_QueueI arg.error = false; arg.counter = 0; - CF_CList_Traverse(c->qs[q], CF_Traverse_WriteTxnQueueEntryToFile, &arg); + CF_CList_Traverse(chan->qs[queue], CF_Traverse_WriteTxnQueueEntryToFile, &arg); return arg.error; } @@ -282,7 +282,7 @@ CFE_Status_t CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_QueueI * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Direction_t dir) +CFE_Status_t CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *chan, CF_Direction_t dir) { CF_Traverse_WriteHistoryFileArg_t arg; @@ -291,7 +291,7 @@ CFE_Status_t CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Di arg.error = false; arg.counter = 0; - CF_CList_Traverse(c->qs[CF_QueueIdx_HIST], CF_Traverse_WriteHistoryQueueEntryToFile, &arg); + CF_CList_Traverse(chan->qs[CF_QueueIdx_HIST], CF_Traverse_WriteHistoryQueueEntryToFile, &arg); return arg.error; } @@ -303,16 +303,16 @@ CFE_Status_t CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Di *-----------------------------------------------------------------*/ CFE_Status_t CF_PrioSearch(CF_CListNode_t *node, void *context) { - CF_Transaction_t * t = container_of(node, CF_Transaction_t, cl_node); - CF_Traverse_PriorityArg_t *p = (CF_Traverse_PriorityArg_t *)context; + CF_Transaction_t * txn = container_of(node, CF_Transaction_t, cl_node); + CF_Traverse_PriorityArg_t *arg = (CF_Traverse_PriorityArg_t *)context; - if (t->priority <= p->priority) + if (txn->priority <= arg->priority) { /* found it! * * the current transaction's prio is less than desired (higher) */ - p->t = t; + arg->txn = txn; return CF_CLIST_EXIT; } @@ -325,29 +325,29 @@ CFE_Status_t CF_PrioSearch(CF_CListNode_t *node, void *context) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -void CF_InsertSortPrio(CF_Transaction_t *t, CF_QueueIdx_t q) +void CF_InsertSortPrio(CF_Transaction_t *txn, CF_QueueIdx_t queue) { int insert_back = 0; - CF_Channel_t *c = &CF_AppData.engine.channels[t->chan_num]; + CF_Channel_t *chan = &CF_AppData.engine.channels[txn->chan_num]; - CF_Assert(t->chan_num < CF_NUM_CHANNELS); - CF_Assert(t->state != CF_TxnState_IDLE); + CF_Assert(txn->chan_num < CF_NUM_CHANNELS); + CF_Assert(txn->state != CF_TxnState_IDLE); /* look for proper position on PEND queue for this transaction. * This is a simple priority sort. */ - if (!c->qs[q]) + if (!chan->qs[queue]) { /* list is empty, so just insert */ insert_back = 1; } else { - CF_Traverse_PriorityArg_t p = {NULL, t->priority}; - CF_CList_Traverse_R(c->qs[q], CF_PrioSearch, &p); - if (p.t) + CF_Traverse_PriorityArg_t arg = {NULL, txn->priority}; + CF_CList_Traverse_R(chan->qs[queue], CF_PrioSearch, &arg); + if (arg.txn) { - CF_CList_InsertAfter_Ex(c, q, &p.t->cl_node, &t->cl_node); + CF_CList_InsertAfter_Ex(chan, queue, &arg.txn->cl_node, &txn->cl_node); } else { @@ -357,9 +357,9 @@ void CF_InsertSortPrio(CF_Transaction_t *t, CF_QueueIdx_t q) if (insert_back) { - CF_CList_InsertBack_Ex(c, q, &t->cl_node); + CF_CList_InsertBack_Ex(chan, queue, &txn->cl_node); } - t->flags.com.q_index = q; + txn->flags.com.q_index = queue; } /*---------------------------------------------------------------- @@ -368,10 +368,10 @@ void CF_InsertSortPrio(CF_Transaction_t *t, CF_QueueIdx_t q) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_Arg_t *args) +CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *node, CF_TraverseAll_Arg_t *args) { - CF_Transaction_t *t = container_of(n, CF_Transaction_t, cl_node); - args->fn(t, args->context); + CF_Transaction_t *txn = container_of(node, CF_Transaction_t, cl_node); + args->fn(txn, args->context); ++args->counter; return CF_CLIST_CONT; } @@ -382,12 +382,12 @@ CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_A * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -CFE_Status_t CF_TraverseAllTransactions(CF_Channel_t *c, CF_TraverseAllTransactions_fn_t fn, void *context) +CFE_Status_t CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransactions_fn_t fn, void *context) { CF_TraverseAll_Arg_t args = {fn, context, 0}; CF_QueueIdx_t queueidx; for (queueidx = CF_QueueIdx_PEND; queueidx <= CF_QueueIdx_RX; ++queueidx) - CF_CList_Traverse(c->qs[queueidx], (CF_CListFn_t)CF_TraverseAllTransactions_Impl, &args); + CF_CList_Traverse(chan->qs[queueidx], (CF_CListFn_t)CF_TraverseAllTransactions_Impl, &args); return args.counter; } diff --git a/fsw/src/cf_utils.h b/fsw/src/cf_utils.h index 03a3070d..bf8ce9d0 100644 --- a/fsw/src/cf_utils.h +++ b/fsw/src/cf_utils.h @@ -40,7 +40,7 @@ typedef struct CF_Traverse_TransSeqArg { CF_TransactionSeq_t transaction_sequence_number; CF_EntityId_t src_eid; - CF_Transaction_t * t; /**< \brief output transaction pointer */ + CF_Transaction_t * txn; /**< \brief output transaction pointer */ } CF_Traverse_TransSeqArg_t; /** @@ -82,10 +82,10 @@ typedef struct CF_Traverse_WriteTxnFileArg /** * @brief Callback function type for use with CF_TraverseAllTransactions() * - * @param t Pointer to current transaction being traversed + * @param txn Pointer to current transaction being traversed * @param context Opaque object passed from initial call */ -typedef void (*CF_TraverseAllTransactions_fn_t)(CF_Transaction_t *t, void *context); +typedef void (*CF_TraverseAllTransactions_fn_t)(CF_Transaction_t *txn, void *context); /** * @brief Argument structure for use with CF_TraverseAllTransactions() @@ -106,7 +106,7 @@ typedef struct CF_TraverseAll_Arg */ typedef struct CF_Traverse_PriorityArg { - CF_Transaction_t *t; /**< \brief OUT: holds value of transaction with which to call CF_CList_InsertAfter on */ + CF_Transaction_t *txn; /**< \brief OUT: holds value of transaction with which to call CF_CList_InsertAfter on */ uint8 priority; /**< \brief seeking this priority */ } CF_Traverse_PriorityArg_t; @@ -119,57 +119,57 @@ typedef struct CF_Traverse_PriorityArg * otherwise if the structure is zero'd out the queue * will become corrupted due to other nodes on the queue * pointing to an invalid node */ -static inline void CF_DequeueTransaction(CF_Transaction_t *t) +static inline void CF_DequeueTransaction(CF_Transaction_t *txn) { - CF_Assert(t && (t->chan_num < CF_NUM_CHANNELS)); - CF_CList_Remove(&CF_AppData.engine.channels[t->chan_num].qs[t->flags.com.q_index], &t->cl_node); - CF_Assert(CF_AppData.hk.channel_hk[t->chan_num].q_size[t->flags.com.q_index]); /* sanity check */ - --CF_AppData.hk.channel_hk[t->chan_num].q_size[t->flags.com.q_index]; + CF_Assert(txn && (txn->chan_num < CF_NUM_CHANNELS)); + CF_CList_Remove(&CF_AppData.engine.channels[txn->chan_num].qs[txn->flags.com.q_index], &txn->cl_node); + CF_Assert(CF_AppData.hk.channel_hk[txn->chan_num].q_size[txn->flags.com.q_index]); /* sanity check */ + --CF_AppData.hk.channel_hk[txn->chan_num].q_size[txn->flags.com.q_index]; } -static inline void CF_MoveTransaction(CF_Transaction_t *t, CF_QueueIdx_t q) +static inline void CF_MoveTransaction(CF_Transaction_t *txn, CF_QueueIdx_t queue) { - CF_Assert(t && (t->chan_num < CF_NUM_CHANNELS)); - CF_CList_Remove(&CF_AppData.engine.channels[t->chan_num].qs[t->flags.com.q_index], &t->cl_node); - CF_Assert(CF_AppData.hk.channel_hk[t->chan_num].q_size[t->flags.com.q_index]); /* sanity check */ - --CF_AppData.hk.channel_hk[t->chan_num].q_size[t->flags.com.q_index]; - CF_CList_InsertBack(&CF_AppData.engine.channels[t->chan_num].qs[q], &t->cl_node); - t->flags.com.q_index = q; - ++CF_AppData.hk.channel_hk[t->chan_num].q_size[t->flags.com.q_index]; + CF_Assert(txn && (txn->chan_num < CF_NUM_CHANNELS)); + CF_CList_Remove(&CF_AppData.engine.channels[txn->chan_num].qs[txn->flags.com.q_index], &txn->cl_node); + CF_Assert(CF_AppData.hk.channel_hk[txn->chan_num].q_size[txn->flags.com.q_index]); /* sanity check */ + --CF_AppData.hk.channel_hk[txn->chan_num].q_size[txn->flags.com.q_index]; + CF_CList_InsertBack(&CF_AppData.engine.channels[txn->chan_num].qs[queue], &txn->cl_node); + txn->flags.com.q_index = queue; + ++CF_AppData.hk.channel_hk[txn->chan_num].q_size[txn->flags.com.q_index]; } -static inline void CF_CList_Remove_Ex(CF_Channel_t *c, CF_QueueIdx_t queueidx, CF_CListNode_t *node) +static inline void CF_CList_Remove_Ex(CF_Channel_t *chan, CF_QueueIdx_t queueidx, CF_CListNode_t *node) { - CF_CList_Remove(&c->qs[queueidx], node); - CF_Assert(CF_AppData.hk.channel_hk[c - CF_AppData.engine.channels].q_size[queueidx]); /* sanity check */ - --CF_AppData.hk.channel_hk[c - CF_AppData.engine.channels].q_size[queueidx]; + CF_CList_Remove(&chan->qs[queueidx], node); + CF_Assert(CF_AppData.hk.channel_hk[chan - CF_AppData.engine.channels].q_size[queueidx]); /* sanity check */ + --CF_AppData.hk.channel_hk[chan - CF_AppData.engine.channels].q_size[queueidx]; } -static inline void CF_CList_InsertAfter_Ex(CF_Channel_t *c, CF_QueueIdx_t queueidx, CF_CListNode_t *start, +static inline void CF_CList_InsertAfter_Ex(CF_Channel_t *chan, CF_QueueIdx_t queueidx, CF_CListNode_t *start, CF_CListNode_t *after) { - CF_CList_InsertAfter(&c->qs[queueidx], start, after); - ++CF_AppData.hk.channel_hk[c - CF_AppData.engine.channels].q_size[queueidx]; + CF_CList_InsertAfter(&chan->qs[queueidx], start, after); + ++CF_AppData.hk.channel_hk[chan - CF_AppData.engine.channels].q_size[queueidx]; } -static inline void CF_CList_InsertBack_Ex(CF_Channel_t *c, CF_QueueIdx_t queueidx, CF_CListNode_t *node) +static inline void CF_CList_InsertBack_Ex(CF_Channel_t *chan, CF_QueueIdx_t queueidx, CF_CListNode_t *node) { - CF_CList_InsertBack(&c->qs[queueidx], node); - ++CF_AppData.hk.channel_hk[c - CF_AppData.engine.channels].q_size[queueidx]; + CF_CList_InsertBack(&chan->qs[queueidx], node); + ++CF_AppData.hk.channel_hk[chan - CF_AppData.engine.channels].q_size[queueidx]; } /************************************************************************/ /** @brief Find an unused transaction on a channel. * * @par Assumptions, External Events, and Notes: - * c must not be NULL. + * chan must not be NULL. * - * @param c Pointer to the CF channel + * @param chan Pointer to the CF channel * * @returns Pointer to a free transaction * @retval NULL if no free transactions available. */ -CF_Transaction_t *CF_FindUnusedTransaction(CF_Channel_t *c); +CF_Transaction_t *CF_FindUnusedTransaction(CF_Channel_t *chan); /************************************************************************/ /** @brief Returns a history structure back to its unused state. @@ -179,22 +179,22 @@ CF_Transaction_t *CF_FindUnusedTransaction(CF_Channel_t *c); * from its current queue and put it back on CF_QueueIdx_HIST_FREE. * * @par Assumptions, External Events, and Notes: - * c must not be NULL. h must not be NULL. + * chan must not be NULL. history must not be NULL. * - * @param c Pointer to the CF channel - * @param h Pointer to the history entry + * @param chan Pointer to the CF channel + * @param history Pointer to the history entry */ -void CF_ResetHistory(CF_Channel_t *c, CF_History_t *h); +void CF_ResetHistory(CF_Channel_t *chan, CF_History_t *history); /************************************************************************/ /** @brief Frees and resets a transaction and returns it for later use. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -void CF_FreeTransaction(CF_Transaction_t *t); +void CF_FreeTransaction(CF_Transaction_t *txn); /************************************************************************/ /** @brief Finds an active transaction by sequence number. @@ -204,32 +204,32 @@ void CF_FreeTransaction(CF_Transaction_t *t); * transaction and looks for the requested transaction. * * @par Assumptions, External Events, and Notes: - * c must not be NULL. + * chan must not be NULL. * - * @param c Pointer to the CF channel + * @param chan Pointer to the CF channel * @param transaction_sequence_number Sequence number to find * @param src_eid Entity ID associated with sequence number * * @returns Pointer to the given transaction if found * @retval NULL if the transaction is not found */ -CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_TransactionSeq_t transaction_sequence_number, +CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *chan, CF_TransactionSeq_t transaction_sequence_number, CF_EntityId_t src_eid); /************************************************************************/ /** @brief List traversal function to check if the desired sequence number matches. * * @par Assumptions, External Events, and Notes: - * context must not be NULL. n must not be NULL. + * context must not be NULL. node must not be NULL. * - * @param n Pointer to node currently being traversed + * @param node Pointer to node currently being traversed * @param context Pointer to state object passed through from initial call * * @retval 1 when it's found, which terminates list traversal * @retval 0 when it isn't found, which causes list traversal to continue * */ -CFE_Status_t CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Traverse_TransSeqArg_t *context); +CFE_Status_t CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *node, CF_Traverse_TransSeqArg_t *context); /************************************************************************/ /** @brief Write a single history to a file. @@ -245,42 +245,42 @@ CFE_Status_t CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Trave * fd should be a valid file descriptor, open for writing. * * @param fd Open File descriptor to write to - * @param h Pointer to CF history object to write + * @param history Pointer to CF history object to write * * @retval CFE_SUCCESS on success * @retval CF_ERROR on error */ -CFE_Status_t CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h); +CFE_Status_t CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *history); /************************************************************************/ /** @brief Write a transaction-based queue's transaction history to a file. * * @par Assumptions, External Events, and Notes: - * c must not be NULL. + * chan must not be NULL. * * @param fd Open File descriptor to write to - * @param c Pointer to associated CF channel object - * @param q Queue Index to write + * @param chan Pointer to associated CF channel object + * @param queue Queue Index to write * * @retval 0 on success * @retval 1 on error */ -CFE_Status_t CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_QueueIdx_t q); +CFE_Status_t CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *chan, CF_QueueIdx_t queue); /************************************************************************/ /** @brief Write a history-based queue's entries to a file. * * @par Assumptions, External Events, and Notes: - * c must not be NULL. + * chan must not be NULL. * * @param fd Open File descriptor to write to - * @param c Pointer to associated CF channel object + * @param chan Pointer to associated CF channel object * @param dir Direction to match/filter * * @retval 0 on success * @retval 1 on error */ -CFE_Status_t CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Direction_t dir); +CFE_Status_t CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *chan, CF_Direction_t dir); /************************************************************************/ /** @brief Insert a transaction into a priority sorted transaction queue. @@ -292,26 +292,26 @@ CFE_Status_t CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Di * would be the next lower priority. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * txn must not be NULL. * - * @param t Pointer to the transaction object - * @param q Index of queue to insert into + * @param txn Pointer to the transaction object + * @param queue Index of queue to insert into */ -void CF_InsertSortPrio(CF_Transaction_t *t, CF_QueueIdx_t q); +void CF_InsertSortPrio(CF_Transaction_t *txn, CF_QueueIdx_t queue); /************************************************************************/ /** @brief Traverses all transactions on all active queues and performs an operation on them. * * @par Assumptions, External Events, and Notes: - * c must not be NULL. fn must be a valid function. context must not be NULL. + * chan must not be NULL. fn must be a valid function. context must not be NULL. * - * @param c Channel to operate on + * @param chan Channel to operate on * @param fn Callback to invoke for all traversed transactions * @param context Opaque object to pass to all callbacks * * @returns Number of transactions traversed */ -CFE_Status_t CF_TraverseAllTransactions(CF_Channel_t *c, CF_TraverseAllTransactions_fn_t fn, void *context); +CFE_Status_t CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransactions_fn_t fn, void *context); /************************************************************************/ /** @brief Traverses all transactions on all channels and performs an operation on them. @@ -334,14 +334,14 @@ CFE_Status_t CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_ * on that transaction. * * @par Assumptions, External Events, and Notes: - * n must not be NULL. args must not be NULL. + * node must not be NULL. args must not be NULL. * - * @param n Node being currently traversed + * @param node Node being currently traversed * @param args Intermediate context object from initial call * * @retval 0 for do not exit early (always continue) */ -CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_Arg_t *args); +CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *node, CF_TraverseAll_Arg_t *args); /************************************************************************/ /** @brief Writes a human readable representation of a history queue entry to a file @@ -353,15 +353,15 @@ CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_A * to the file. * * @par Assumptions, External Events, and Notes: - * n must not be NULL. arg must not be NULL. + * node must not be NULL. arg must not be NULL. * - * @param n Node being currently traversed + * @param node Node being currently traversed * @param arg Pointer to CF_Traverse_WriteHistoryFileArg_t indicating the file information * * @retval CF_CLIST_CONT if everything is going well * @retval CF_CLIST_EXIT if a write error occurred, which means traversal should stop */ -CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *arg); +CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void *arg); /************************************************************************/ /** @brief Writes a human readable representation of a transaction history entry to a file @@ -370,15 +370,15 @@ CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *a * CF_Traverse() to write transaction queue entries to the file. * * @par Assumptions, External Events, and Notes: - * n must not be NULL. arg must not be NULL. + * node must not be NULL. arg must not be NULL. * - * @param n Node being currently traversed + * @param node Node being currently traversed * @param arg Pointer to CF_Traverse_WriteTxnFileArg_t indicating the file information * * @retval CF_CLIST_CONT if everything is going well * @retval CF_CLIST_EXIT if a write error occurred, which means traversal should stop */ -CFE_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *n, void *arg); +CFE_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *node, void *arg); /************************************************************************/ /** @brief Searches for the first transaction with a lower priority than given. diff --git a/unit-test/cf_cfdp_dispatch_tests.c b/unit-test/cf_cfdp_dispatch_tests.c index 3e8416e9..84e87865 100644 --- a/unit-test/cf_cfdp_dispatch_tests.c +++ b/unit-test/cf_cfdp_dispatch_tests.c @@ -125,10 +125,10 @@ void cf_cfdp_dispatch_tests_Teardown(void) void Test_CF_CFDP_R_DispatchRecv(void) { /* Test case for: - * void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, const + * void CF_CFDP_R_DispatchRecv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph, const * CF_CFDP_R_SubstateDispatchTable_t *dispatch, CF_CFDP_StateRecvFunc_t fd_fn); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t * ph; CF_CFDP_R_SubstateDispatchTable_t dispatch; CF_CFDP_FileDirectiveDispatchTable_t fddt; @@ -141,41 +141,41 @@ void Test_CF_CFDP_R_DispatchRecv(void) dispatch.state[CF_RxSubState_EOF] = &fddt; /* nominal (file directive) */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); ph->pdu_header.pdu_type = 0; - UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(t, ph, &dispatch, NULL)); + UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(txn, ph, &dispatch, NULL)); /* nominal (file data) */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); ph->pdu_header.pdu_type = 1; - UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(t, ph, &dispatch, NULL)); + UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(txn, ph, &dispatch, NULL)); /* directive code beyond range */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); ph->fdirective.directive_code = CF_CFDP_FileDirective_INVALID_MAX; - UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(t, ph, &dispatch, NULL)); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious, 1); + UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(txn, ph, &dispatch, NULL)); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.spurious, 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_DC_INV); /* file data with error */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); ph->pdu_header.pdu_type = 1; UT_SetDeferredRetcode(UT_KEY(CF_TxnStatus_IsError), 1, true); - UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(t, ph, &dispatch, NULL)); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.dropped, 1); + UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(txn, ph, &dispatch, NULL)); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.dropped, 1); /* test actual dispatch */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - ph->fdirective.directive_code = CF_CFDP_FileDirective_METADATA; - t->state_data.r.sub_state = CF_RxSubState_EOF; - UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(t, ph, &dispatch, CF_CFDP_R2_Recv)); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + ph->fdirective.directive_code = CF_CFDP_FileDirective_METADATA; + txn->state_data.receive.sub_state = CF_RxSubState_EOF; + UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(txn, ph, &dispatch, CF_CFDP_R2_Recv)); UtAssert_STUB_COUNT(CF_CFDP_R1_Recv, 1); UtAssert_STUB_COUNT(CF_CFDP_R2_Recv, 0); - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - ph->pdu_header.pdu_type = 1; - t->state_data.r.sub_state = CF_RxSubState_EOF; - UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(t, ph, &dispatch, CF_CFDP_R2_Recv)); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + ph->pdu_header.pdu_type = 1; + txn->state_data.receive.sub_state = CF_RxSubState_EOF; + UtAssert_VOIDCALL(CF_CFDP_R_DispatchRecv(txn, ph, &dispatch, CF_CFDP_R2_Recv)); UtAssert_STUB_COUNT(CF_CFDP_R1_Recv, 1); UtAssert_STUB_COUNT(CF_CFDP_R2_Recv, 1); } @@ -183,10 +183,10 @@ void Test_CF_CFDP_R_DispatchRecv(void) void Test_CF_CFDP_S_DispatchRecv(void) { /* Test case for: - * void CF_CFDP_S_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, + * void CF_CFDP_S_DispatchRecv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph, const CF_CFDP_S_SubstateRecvDispatchTable_t *dispatch) */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t * ph; CF_CFDP_S_SubstateRecvDispatchTable_t dispatch; CF_CFDP_FileDirectiveDispatchTable_t fddt; @@ -199,35 +199,35 @@ void Test_CF_CFDP_S_DispatchRecv(void) dispatch.substate[CF_TxSubState_EOF] = &fddt; /* nominal, no handler */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S_DispatchRecv(t, ph, &dispatch)); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S_DispatchRecv(txn, ph, &dispatch)); /* directive code beyond range */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); ph->fdirective.directive_code = CF_CFDP_FileDirective_INVALID_MAX; - UtAssert_VOIDCALL(CF_CFDP_S_DispatchRecv(t, ph, &dispatch)); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious, 1); + UtAssert_VOIDCALL(CF_CFDP_S_DispatchRecv(txn, ph, &dispatch)); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.spurious, 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_DC_INV); /* file data PDU, not expected in this type of txn */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); ph->pdu_header.pdu_type = 1; - UtAssert_VOIDCALL(CF_CFDP_S_DispatchRecv(t, ph, &dispatch)); + UtAssert_VOIDCALL(CF_CFDP_S_DispatchRecv(txn, ph, &dispatch)); /* test actual dispatch */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - ph->fdirective.directive_code = CF_CFDP_FileDirective_METADATA; - t->state_data.s.sub_state = CF_TxSubState_EOF; - UtAssert_VOIDCALL(CF_CFDP_S_DispatchRecv(t, ph, &dispatch)); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + ph->fdirective.directive_code = CF_CFDP_FileDirective_METADATA; + txn->state_data.send.sub_state = CF_TxSubState_EOF; + UtAssert_VOIDCALL(CF_CFDP_S_DispatchRecv(txn, ph, &dispatch)); UtAssert_STUB_COUNT(CF_CFDP_S1_Recv, 1); } void Test_CF_CFDP_S_DispatchTransmit(void) { /* Test case for: - * void CF_CFDP_S_DispatchTransmit(CF_Transaction_t *t, const CF_CFDP_S_SubstateSendDispatchTable_t *dispatch); + * void CF_CFDP_S_DispatchTransmit(CF_Transaction_t *txn, const CF_CFDP_S_SubstateSendDispatchTable_t *dispatch); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_CFDP_S_SubstateSendDispatchTable_t dispatch; /* The CF_CFDP_S2_Tx is just used as a convenient stub to target */ @@ -235,22 +235,22 @@ void Test_CF_CFDP_S_DispatchTransmit(void) dispatch.substate[CF_TxSubState_EOF] = CF_CFDP_S2_Tx; /* nominal, no handler */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S_DispatchTransmit(t, &dispatch)); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S_DispatchTransmit(txn, &dispatch)); /* test actual dispatch */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->state_data.s.sub_state = CF_TxSubState_EOF; - UtAssert_VOIDCALL(CF_CFDP_S_DispatchTransmit(t, &dispatch)); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->state_data.send.sub_state = CF_TxSubState_EOF; + UtAssert_VOIDCALL(CF_CFDP_S_DispatchTransmit(txn, &dispatch)); UtAssert_STUB_COUNT(CF_CFDP_S2_Tx, 1); } void Test_CF_CFDP_TxStateDispatch(void) { /* Test case for: - * void CF_CFDP_TxStateDispatch(CF_Transaction_t *t, const CF_CFDP_TxnSendDispatchTable_t *dispatch); + * void CF_CFDP_TxStateDispatch(CF_Transaction_t *txn, const CF_CFDP_TxnSendDispatchTable_t *dispatch); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_CFDP_TxnSendDispatchTable_t dispatch; memset(&dispatch, 0, sizeof(dispatch)); @@ -258,23 +258,23 @@ void Test_CF_CFDP_TxStateDispatch(void) dispatch.tx[CF_TxnState_S1] = CF_CFDP_S1_Tx; /* nominal, no handler */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_TxStateDispatch(t, &dispatch)); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_TxStateDispatch(txn, &dispatch)); /* nominal, with handler */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_S1; - UtAssert_VOIDCALL(CF_CFDP_TxStateDispatch(t, &dispatch)); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_S1; + UtAssert_VOIDCALL(CF_CFDP_TxStateDispatch(txn, &dispatch)); UtAssert_STUB_COUNT(CF_CFDP_S1_Tx, 1); } void Test_CF_CFDP_RxStateDispatch(void) { /* Test case for: - * void CF_CFDP_RxStateDispatch(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, const + * void CF_CFDP_RxStateDispatch(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph, const * CF_CFDP_TxnRecvDispatchTable_t *dispatch); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t * ph; CF_CFDP_TxnRecvDispatchTable_t dispatch; @@ -283,13 +283,13 @@ void Test_CF_CFDP_RxStateDispatch(void) dispatch.rx[CF_TxnState_R1] = CF_CFDP_R1_Recv; /* nominal, no handler */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_RxStateDispatch(t, ph, &dispatch)); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_RxStateDispatch(txn, ph, &dispatch)); /* nominal, with handler */ - UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R1; - UtAssert_VOIDCALL(CF_CFDP_RxStateDispatch(t, ph, &dispatch)); + UT_CFDP_Dispatch_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R1; + UtAssert_VOIDCALL(CF_CFDP_RxStateDispatch(txn, ph, &dispatch)); UtAssert_STUB_COUNT(CF_CFDP_R1_Recv, 1); } diff --git a/unit-test/cf_cfdp_r_tests.c b/unit-test/cf_cfdp_r_tests.c index 594b373f..b31be9eb 100644 --- a/unit-test/cf_cfdp_r_tests.c +++ b/unit-test/cf_cfdp_r_tests.c @@ -147,451 +147,451 @@ void cf_cfdp_r_tests_Teardown(void) void Test_CF_CFDP_R1_Recv(void) { /* Test case for: - * void CF_CFDP_R1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_R1_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); - UtAssert_VOIDCALL(CF_CFDP_R1_Recv(t, ph)); + UtAssert_VOIDCALL(CF_CFDP_R1_Recv(txn, ph)); } void Test_CF_CFDP_R2_Recv(void) { /* Test case for: - * void CF_CFDP_R2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_R2_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); - UtAssert_VOIDCALL(CF_CFDP_R2_Recv(t, ph)); + UtAssert_VOIDCALL(CF_CFDP_R2_Recv(txn, ph)); } void Test_CF_CFDP_R_Tick(void) { /* Test case for: - * void CF_CFDP_R_Tick(CF_Transaction_t *t, int *cont); + * void CF_CFDP_R_Tick(CF_Transaction_t *txn, int *cont); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; CF_ConfigTable_t *config; int cont; /* nominal, not in R2 state - just ticks */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_Timer_Tick, 1); /* not in R2 state, timer expired */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, 1); - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* nominal, in R2 state */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R2; - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R2; + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_Timer_Tick, 2); /* in R2 state, timer expired */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R2; + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R2; UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, 1); - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); - UtAssert_BOOL_TRUE(t->flags.rx.inactivity_fired); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_INACTIVITY_DETECTED); + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); + UtAssert_BOOL_TRUE(txn->flags.rx.inactivity_fired); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_INACTIVITY_DETECTED); /* in R2 state, send_ack set */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R2; - t->flags.rx.send_ack = true; - t->flags.rx.inactivity_fired = true; - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R2; + txn->flags.rx.send_ack = true; + txn->flags.rx.inactivity_fired = true; + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_CFDP_SendAck, 1); - UtAssert_BOOL_FALSE(t->flags.rx.send_ack); + UtAssert_BOOL_FALSE(txn->flags.rx.send_ack); /* same as above, but SendAck fails */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendAck), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - t->state = CF_TxnState_R2; - t->flags.rx.send_ack = true; - t->flags.rx.inactivity_fired = true; - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); - UtAssert_BOOL_TRUE(t->flags.rx.send_ack); + txn->state = CF_TxnState_R2; + txn->flags.rx.send_ack = true; + txn->flags.rx.inactivity_fired = true; + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); + UtAssert_BOOL_TRUE(txn->flags.rx.send_ack); /* in R2 state, send_nak set */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R2; - t->flags.rx.send_nak = true; - t->flags.rx.inactivity_fired = true; - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); - UtAssert_BOOL_FALSE(t->flags.rx.send_nak); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R2; + txn->flags.rx.send_nak = true; + txn->flags.rx.inactivity_fired = true; + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); + UtAssert_BOOL_FALSE(txn->flags.rx.send_nak); /* same as above, but CF_CFDP_R_SubstateSendNak fails */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendNak), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - t->state = CF_TxnState_R2; - t->flags.rx.send_nak = true; - t->flags.rx.inactivity_fired = true; - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); - UtAssert_BOOL_TRUE(t->flags.rx.send_nak); + txn->state = CF_TxnState_R2; + txn->flags.rx.send_nak = true; + txn->flags.rx.inactivity_fired = true; + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); + UtAssert_BOOL_TRUE(txn->flags.rx.send_nak); /* in R2 state, send_fin set */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R2; - t->flags.rx.send_fin = true; - t->flags.rx.inactivity_fired = true; - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); - UtAssert_BOOL_FALSE(t->flags.rx.send_fin); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R2; + txn->flags.rx.send_fin = true; + txn->flags.rx.inactivity_fired = true; + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); + UtAssert_BOOL_FALSE(txn->flags.rx.send_fin); /* same as above, but CF_CFDP_R2_SubstateSendFin fails */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendFin), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - t->state = CF_TxnState_R2; - t->flags.rx.send_fin = true; - t->flags.rx.inactivity_fired = true; - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); - UtAssert_BOOL_TRUE(t->flags.rx.send_fin); + txn->state = CF_TxnState_R2; + txn->flags.rx.send_fin = true; + txn->flags.rx.inactivity_fired = true; + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); + UtAssert_BOOL_TRUE(txn->flags.rx.send_fin); /* in R2 state, ack_timer_armed set */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R2; - t->flags.com.ack_timer_armed = true; - t->flags.rx.inactivity_fired = true; - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R2; + txn->flags.com.ack_timer_armed = true; + txn->flags.rx.inactivity_fired = true; + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_Timer_Tick, 3); /* in R2 state, ack_timer_armed set, timer expires */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R2; - t->flags.com.ack_timer_armed = true; - t->flags.rx.inactivity_fired = true; + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R2; + txn->flags.com.ack_timer_armed = true; + txn->flags.rx.inactivity_fired = true; UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, 1); - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_CFDP_ArmAckTimer, 1); - UtAssert_BOOL_TRUE(t->flags.rx.complete); + UtAssert_BOOL_TRUE(txn->flags.rx.complete); /* in R2 state, ack_timer_armed set, timer expires, finack substate */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); - config->chan[t->chan_num].ack_limit = 10; - t->state = CF_TxnState_R2; - t->flags.com.ack_timer_armed = true; - t->flags.rx.inactivity_fired = true; - t->flags.rx.complete = true; - t->state_data.r.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); + config->chan[txn->chan_num].ack_limit = 10; + txn->state = CF_TxnState_R2; + txn->flags.com.ack_timer_armed = true; + txn->flags.rx.inactivity_fired = true; + txn->flags.rx.complete = true; + txn->state_data.receive.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, 1); - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_CFDP_ArmAckTimer, 2); - UtAssert_BOOL_TRUE(t->flags.rx.send_fin); + UtAssert_BOOL_TRUE(txn->flags.rx.send_fin); /* same as above, but acknak limit reached */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); - config->chan[t->chan_num].ack_limit = 10; - t->state = CF_TxnState_R2; - t->flags.com.ack_timer_armed = true; - t->flags.rx.inactivity_fired = true; - t->flags.rx.complete = true; - t->state_data.r.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; - t->state_data.r.r2.acknak_count = 9; + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); + config->chan[txn->chan_num].ack_limit = 10; + txn->state = CF_TxnState_R2; + txn->flags.com.ack_timer_armed = true; + txn->flags.rx.inactivity_fired = true; + txn->flags.rx.complete = true; + txn->state_data.receive.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; + txn->state_data.receive.r2.acknak_count = 9; UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, 1); - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 2); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.ack_limit, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.ack_limit, 1); /* in R2 state, ack_timer_armed set, timer expires, not in finack substate */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); - config->chan[t->chan_num].ack_limit = 10; - t->state = CF_TxnState_R2; - t->flags.com.ack_timer_armed = true; - t->flags.rx.inactivity_fired = true; - t->flags.rx.complete = true; - t->state_data.r.sub_state = CF_RxSubState_EOF; + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); + config->chan[txn->chan_num].ack_limit = 10; + txn->state = CF_TxnState_R2; + txn->flags.com.ack_timer_armed = true; + txn->flags.rx.inactivity_fired = true; + txn->flags.rx.complete = true; + txn->state_data.receive.sub_state = CF_RxSubState_EOF; UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, 1); - UtAssert_VOIDCALL(CF_CFDP_R_Tick(t, &cont)); + UtAssert_VOIDCALL(CF_CFDP_R_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_CFDP_ArmAckTimer, 3); - UtAssert_BOOL_FALSE(t->flags.rx.send_fin); + UtAssert_BOOL_FALSE(txn->flags.rx.send_fin); } void Test_CF_CFDP_R_Cancel(void) { /* Test case for: - * void CF_CFDP_R_Cancel(CF_Transaction_t *t); + * void CF_CFDP_R_Cancel(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal, calls reset */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_R_Cancel(t)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_R_Cancel(txn)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* trigger send_fin on R2 */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R2; - UtAssert_VOIDCALL(CF_CFDP_R_Cancel(t)); - UtAssert_BOOL_TRUE(t->flags.rx.send_fin); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R2; + UtAssert_VOIDCALL(CF_CFDP_R_Cancel(txn)); + UtAssert_BOOL_TRUE(txn->flags.rx.send_fin); /* for coverage, this should also go to reset */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R2; - t->state_data.r.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; - UtAssert_VOIDCALL(CF_CFDP_R_Cancel(t)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R2; + txn->state_data.receive.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; + UtAssert_VOIDCALL(CF_CFDP_R_Cancel(txn)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 2); } void Test_CF_CFDP_R_Init(void) { /* Test case for: - * void CF_CFDP_R_Init(CF_Transaction_t *t); + * void CF_CFDP_R_Init(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - t->state_data.r.sub_state = CF_RxSubState_NUM_STATES; /* bogus; will get reset */ - UtAssert_VOIDCALL(CF_CFDP_R_Init(t)); - UtAssert_UINT32_EQ(t->state_data.r.sub_state, CF_RxSubState_FILEDATA); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + txn->state_data.receive.sub_state = CF_RxSubState_NUM_STATES; /* bogus; will get reset */ + UtAssert_VOIDCALL(CF_CFDP_R_Init(txn)); + UtAssert_UINT32_EQ(txn->state_data.receive.sub_state, CF_RxSubState_FILEDATA); /* nominal, R2 state, no md_recv (creates tempfile) */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R2; - UtAssert_VOIDCALL(CF_CFDP_R_Init(t)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R2; + UtAssert_VOIDCALL(CF_CFDP_R_Init(txn)); UtAssert_STUB_COUNT(CF_CFDP_ArmAckTimer, 1); UT_CF_AssertEventID(CF_EID_INF_CFDP_R_TEMP_FILE); /* nominal, R2 state, with md_recv (no tempfile) */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R2; - t->flags.rx.md_recv = true; - UtAssert_VOIDCALL(CF_CFDP_R_Init(t)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R2; + txn->flags.rx.md_recv = true; + UtAssert_VOIDCALL(CF_CFDP_R_Init(txn)); UtAssert_STUB_COUNT(CF_CFDP_ArmAckTimer, 2); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); /* failure of file open, class 1 */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_WrappedOpenCreate), 1, -1); - t->state = CF_TxnState_R1; - UtAssert_VOIDCALL(CF_CFDP_R_Init(t)); + txn->state = CF_TxnState_R1; + UtAssert_VOIDCALL(CF_CFDP_R_Init(txn)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_CREAT); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_open, 1); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* failure of file open, class 2 */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_WrappedOpenCreate), 1, -1); - t->state = CF_TxnState_R2; - UtAssert_VOIDCALL(CF_CFDP_R_Init(t)); + txn->state = CF_TxnState_R2; + UtAssert_VOIDCALL(CF_CFDP_R_Init(txn)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_CREAT); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open, 2); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_open, 2); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); } void Test_CF_CFDP_R2_SetFinTxnStatus(void) { /* Test case for: - * void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *t, CF_CFDP_ConditionCode_t cc); + * void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *txn, CF_CFDP_ConditionCode_t cc); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal, should save whatever cc is passed, and set "send_fin" */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_R2_SetFinTxnStatus(t, CF_CFDP_ConditionCode_INVALID_FILE_STRUCTURE)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_R2_SetFinTxnStatus(txn, CF_CFDP_ConditionCode_INVALID_FILE_STRUCTURE)); UtAssert_STUB_COUNT(CF_CFDP_SetTxnStatus, 1); - UtAssert_BOOL_TRUE(t->flags.rx.send_fin); + UtAssert_BOOL_TRUE(txn->flags.rx.send_fin); } void Test_CF_CFDP_R1_Reset(void) { /* Test case for: - * void CF_CFDP_R1_Reset(CF_Transaction_t *t); + * void CF_CFDP_R1_Reset(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal, this just resets */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_R1_Reset(t)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_R1_Reset(txn)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); } void Test_CF_CFDP_R2_Reset(void) { /* Test case for: - * void CF_CFDP_R2_Reset(CF_Transaction_t *t); + * void CF_CFDP_R2_Reset(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal, sets "send_fin" to 1, does not reset */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_R2_Reset(t)); - UtAssert_BOOL_TRUE(t->flags.rx.send_fin); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_R2_Reset(txn)); + UtAssert_BOOL_TRUE(txn->flags.rx.send_fin); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 0); /* test the various conditions that do cause reset */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - t->state_data.r.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; - UtAssert_VOIDCALL(CF_CFDP_R2_Reset(t)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + txn->state_data.receive.sub_state = CF_RxSubState_WAIT_FOR_FIN_ACK; + UtAssert_VOIDCALL(CF_CFDP_R2_Reset(txn)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - t->state_data.r.r2.eof_cc = CF_CFDP_ConditionCode_INVALID_TRANSMISSION_MODE; /* not NO_ERROR */ - UtAssert_VOIDCALL(CF_CFDP_R2_Reset(t)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + txn->state_data.receive.r2.eof_cc = CF_CFDP_ConditionCode_INVALID_TRANSMISSION_MODE; /* not NO_ERROR */ + UtAssert_VOIDCALL(CF_CFDP_R2_Reset(txn)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 2); - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_TxnStatus_IsError), 1, true); - UtAssert_VOIDCALL(CF_CFDP_R2_Reset(t)); + UtAssert_VOIDCALL(CF_CFDP_R2_Reset(txn)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 3); - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - t->flags.com.canceled = true; - UtAssert_VOIDCALL(CF_CFDP_R2_Reset(t)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + txn->flags.com.canceled = true; + UtAssert_VOIDCALL(CF_CFDP_R2_Reset(txn)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 4); } void Test_CF_CFDP_R_CheckCrc(void) { /* Test case for: - * int CF_CFDP_R_CheckCrc(CF_Transaction_t *t, uint32 expected_crc); + * int CF_CFDP_R_CheckCrc(CF_Transaction_t *txn, uint32 expected_crc); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* CRC mismatch, class 1 */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R1; - t->crc.result = 0xdeadbeef; - UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(t, 0x1badc0de), 1); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R1; + txn->crc.result = 0xdeadbeef; + UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(txn, 0x1badc0de), 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_CRC); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.crc_mismatch, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.crc_mismatch, 1); /* CRC mismatch, class 2 */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_R2; - t->crc.result = 0xdeadbeef; - UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(t, 0x2badc0de), 1); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_R2; + txn->crc.result = 0xdeadbeef; + UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(txn, 0x2badc0de), 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_CRC); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.crc_mismatch, 2); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.crc_mismatch, 2); /* CRC match */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - t->crc.result = 0xc0ffee; - UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(t, 0xc0ffee), 0); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + txn->crc.result = 0xc0ffee; + UtAssert_INT32_EQ(CF_CFDP_R_CheckCrc(txn, 0xc0ffee), 0); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } void Test_CF_CFDP_R2_Complete(void) { /* Test case for: - * void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak); + * void CF_CFDP_R2_Complete(CF_Transaction_t *txn, int ok_to_send_nak); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; CF_ConfigTable_t *config; /* nominal */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_R2_Complete(t, 0)); - UtAssert_UINT32_EQ(t->state_data.r.sub_state, CF_RxSubState_FILEDATA); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_R2_Complete(txn, 0)); + UtAssert_UINT32_EQ(txn->state_data.receive.sub_state, CF_RxSubState_FILEDATA); /* test with error cc */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_TxnStatus_IsError), 1, true); - UtAssert_VOIDCALL(CF_CFDP_R2_Complete(t, 0)); + UtAssert_VOIDCALL(CF_CFDP_R2_Complete(txn, 0)); /* nominal, send NAK */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, &config); - config->chan[t->chan_num].nak_limit = 2; - UtAssert_VOIDCALL(CF_CFDP_R2_Complete(t, 1)); - UtAssert_BOOL_TRUE(t->flags.rx.send_nak); - UtAssert_UINT32_EQ(t->state_data.r.sub_state, CF_RxSubState_FILEDATA); - UtAssert_UINT32_EQ(t->state_data.r.r2.acknak_count, 1); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, &config); + config->chan[txn->chan_num].nak_limit = 2; + UtAssert_VOIDCALL(CF_CFDP_R2_Complete(txn, 1)); + UtAssert_BOOL_TRUE(txn->flags.rx.send_nak); + UtAssert_UINT32_EQ(txn->state_data.receive.sub_state, CF_RxSubState_FILEDATA); + UtAssert_UINT32_EQ(txn->state_data.receive.r2.acknak_count, 1); /* same call again should trigger nak_limit */ - UtAssert_VOIDCALL(CF_CFDP_R2_Complete(t, 1)); - UtAssert_BOOL_TRUE(t->flags.rx.send_fin); - UtAssert_BOOL_TRUE(t->flags.rx.complete); + UtAssert_VOIDCALL(CF_CFDP_R2_Complete(txn, 1)); + UtAssert_BOOL_TRUE(txn->flags.rx.send_fin); + UtAssert_BOOL_TRUE(txn->flags.rx.complete); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_NAK_LIMIT); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.nak_limit, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.nak_limit, 1); /* test with md_recv - with no more setup this only sets filedata state */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, &config); - config->chan[t->chan_num].nak_limit = 2; - t->flags.rx.md_recv = true; - UtAssert_VOIDCALL(CF_CFDP_R2_Complete(t, 0)); - UtAssert_UINT32_EQ(t->state_data.r.sub_state, CF_RxSubState_FILEDATA); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, &config); + config->chan[txn->chan_num].nak_limit = 2; + txn->flags.rx.md_recv = true; + UtAssert_VOIDCALL(CF_CFDP_R2_Complete(txn, 0)); + UtAssert_UINT32_EQ(txn->state_data.receive.sub_state, CF_RxSubState_FILEDATA); /* with md_recv and eof_recv this should set send_fin */ - t->flags.rx.eof_recv = true; - UtAssert_VOIDCALL(CF_CFDP_R2_Complete(t, 1)); - UtAssert_BOOL_FALSE(t->flags.rx.send_nak); - UtAssert_BOOL_TRUE(t->flags.rx.send_fin); - UtAssert_BOOL_TRUE(t->flags.rx.complete); + txn->flags.rx.eof_recv = true; + UtAssert_VOIDCALL(CF_CFDP_R2_Complete(txn, 1)); + UtAssert_BOOL_FALSE(txn->flags.rx.send_nak); + UtAssert_BOOL_TRUE(txn->flags.rx.send_fin); + UtAssert_BOOL_TRUE(txn->flags.rx.complete); /* with gaps, this should send NAK */ UT_SetDeferredRetcode(UT_KEY(CF_ChunkList_ComputeGaps), 1, 1); - UtAssert_VOIDCALL(CF_CFDP_R2_Complete(t, 1)); - UtAssert_BOOL_TRUE(t->flags.rx.send_nak); - UtAssert_UINT32_EQ(t->state_data.r.sub_state, CF_RxSubState_FILEDATA); - UtAssert_UINT32_EQ(t->state_data.r.r2.acknak_count, 1); + UtAssert_VOIDCALL(CF_CFDP_R2_Complete(txn, 1)); + UtAssert_BOOL_TRUE(txn->flags.rx.send_nak); + UtAssert_UINT32_EQ(txn->state_data.receive.sub_state, CF_RxSubState_FILEDATA); + UtAssert_UINT32_EQ(txn->state_data.receive.r2.acknak_count, 1); } void Test_CF_CFDP_R_ProcessFd(void) { /* Test case for: - * int CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * int CF_CFDP_R_ProcessFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t * ph; CF_Logical_PduFileDataHeader_t *fd; /* nominal */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); fd = &ph->int_header.fd; fd->data_len = 100; UT_SetDefaultReturnValue(UT_KEY(CF_WrappedWrite), fd->data_len); - UtAssert_INT32_EQ(CF_CFDP_R_ProcessFd(t, ph), 0); - UtAssert_UINT32_EQ(t->state_data.r.cached_pos, 100); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.file_data_bytes, 100); + UtAssert_INT32_EQ(CF_CFDP_R_ProcessFd(txn, ph), 0); + UtAssert_UINT32_EQ(txn->state_data.receive.cached_pos, 100); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.file_data_bytes, 100); UtAssert_STUB_COUNT(CF_WrappedLseek, 0); UtAssert_STUB_COUNT(CF_WrappedWrite, 1); /* call again, but for something at a different offset */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); fd = &ph->int_header.fd; fd->data_len = 100; fd->offset = 200; UT_SetDefaultReturnValue(UT_KEY(CF_WrappedLseek), fd->offset); - UtAssert_INT32_EQ(CF_CFDP_R_ProcessFd(t, ph), 0); - UtAssert_UINT32_EQ(t->state_data.r.cached_pos, 300); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.file_data_bytes, 200); + UtAssert_INT32_EQ(CF_CFDP_R_ProcessFd(txn, ph), 0); + UtAssert_UINT32_EQ(txn->state_data.receive.cached_pos, 300); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.file_data_bytes, 200); UtAssert_STUB_COUNT(CF_WrappedLseek, 1); UtAssert_STUB_COUNT(CF_WrappedWrite, 2); - UtAssert_UINT32_EQ(t->state_data.r.cached_pos, 300); + UtAssert_UINT32_EQ(txn->state_data.receive.cached_pos, 300); /* call again, but with a failed write */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); fd = &ph->int_header.fd; fd->data_len = 100; fd->offset = 300; - t->state_data.r.cached_pos = 300; + txn->state_data.receive.cached_pos = 300; UT_SetDefaultReturnValue(UT_KEY(CF_WrappedWrite), -1); - UtAssert_INT32_EQ(CF_CFDP_R_ProcessFd(t, ph), -1); - UtAssert_UINT32_EQ(t->state_data.r.cached_pos, 300); + UtAssert_INT32_EQ(CF_CFDP_R_ProcessFd(txn, ph), -1); + UtAssert_UINT32_EQ(txn->state_data.receive.cached_pos, 300); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_WRITE); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* call again, but with a failed lseek */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); fd = &ph->int_header.fd; fd->data_len = 100; fd->offset = 200; - t->state_data.r.cached_pos = 300; + txn->state_data.receive.cached_pos = 300; UT_SetDefaultReturnValue(UT_KEY(CF_WrappedLseek), -1); - UtAssert_INT32_EQ(CF_CFDP_R_ProcessFd(t, ph), -1); - UtAssert_UINT32_EQ(t->state_data.r.cached_pos, 300); + UtAssert_INT32_EQ(CF_CFDP_R_ProcessFd(txn, ph), -1); + UtAssert_UINT32_EQ(txn->state_data.receive.cached_pos, 300); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_SEEK_FD); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); /* these stats should have been updated during the course of this test */ UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].counters.fault.file_write, 1); @@ -601,37 +601,37 @@ void Test_CF_CFDP_R_ProcessFd(void) void Test_CF_CFDP_R_SubstateRecvEof(void) { /* Test case for: - * int CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * int CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; CF_Logical_PduEof_t * eof; /* nominal */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_R_SubstateRecvEof(t, ph), 0); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_R_SubstateRecvEof(txn, ph), 0); /* with md_recv and a matching size */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); eof = &ph->int_header.eof; - t->flags.rx.md_recv = true; + txn->flags.rx.md_recv = true; eof->size = 200; - t->fsize = 200; - UtAssert_INT32_EQ(CF_CFDP_R_SubstateRecvEof(t, ph), 0); + txn->fsize = 200; + UtAssert_INT32_EQ(CF_CFDP_R_SubstateRecvEof(txn, ph), 0); /* with md_recv and a different size */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); eof = &ph->int_header.eof; - t->flags.rx.md_recv = true; + txn->flags.rx.md_recv = true; eof->size = 100; - t->fsize = 300; - UtAssert_INT32_EQ(CF_CFDP_R_SubstateRecvEof(t, ph), CF_REC_PDU_FSIZE_MISMATCH_ERROR); + txn->fsize = 300; + UtAssert_INT32_EQ(CF_CFDP_R_SubstateRecvEof(txn, ph), CF_REC_PDU_FSIZE_MISMATCH_ERROR); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_SIZE_MISMATCH); /* with failure of CF_CFDP_RecvEof() */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_RecvEof), -1); - UtAssert_INT32_EQ(CF_CFDP_R_SubstateRecvEof(t, ph), CF_REC_PDU_BAD_EOF_ERROR); + UtAssert_INT32_EQ(CF_CFDP_R_SubstateRecvEof(txn, ph), CF_REC_PDU_BAD_EOF_ERROR); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_PDU_EOF); /* these counters should have been updated during the test */ @@ -642,187 +642,187 @@ void Test_CF_CFDP_R_SubstateRecvEof(void) void Test_CF_CFDP_R1_SubstateRecvEof(void) { /* Test case for: - * void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; CF_Logical_PduEof_t * eof; /* nominal */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); eof = &ph->int_header.eof; eof->crc = 0xf007ba11; - t->crc.result = eof->crc; + txn->crc.result = eof->crc; eof->size = 0xccc; - t->fsize = eof->size; - UtAssert_VOIDCALL(CF_CFDP_R1_SubstateRecvEof(t, ph)); - UtAssert_BOOL_TRUE(t->keep); + txn->fsize = eof->size; + UtAssert_VOIDCALL(CF_CFDP_R1_SubstateRecvEof(txn, ph)); + UtAssert_BOOL_TRUE(txn->keep); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* failure in CF_CFDP_R_SubstateRecvEof - not a stub, but calls CF_CFDP_RecvEof, which is. */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvEof), 1, -1); - UtAssert_VOIDCALL(CF_CFDP_R1_SubstateRecvEof(t, ph)); - UtAssert_BOOL_FALSE(t->keep); + UtAssert_VOIDCALL(CF_CFDP_R1_SubstateRecvEof(txn, ph)); + UtAssert_BOOL_FALSE(txn->keep); /* failure in CF_CFDP_R_CheckCrc */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); eof = &ph->int_header.eof; eof->crc = 0xf007ba11; - t->crc.result = ~eof->crc; - UtAssert_VOIDCALL(CF_CFDP_R1_SubstateRecvEof(t, ph)); - UtAssert_BOOL_FALSE(t->keep); + txn->crc.result = ~eof->crc; + UtAssert_VOIDCALL(CF_CFDP_R1_SubstateRecvEof(txn, ph)); + UtAssert_BOOL_FALSE(txn->keep); } void Test_CF_CFDP_R2_SubstateRecvEof(void) { /* Test case for: - * void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; CF_Logical_PduEof_t * eof; /* nominal */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); eof = &ph->int_header.eof; eof->crc = 0xf007ba11; - t->crc.result = eof->crc; + txn->crc.result = eof->crc; eof->size = 0xbbb; - t->fsize = 0xbbb; - UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvEof(t, ph)); - UtAssert_BOOL_TRUE(t->flags.rx.eof_recv); - UtAssert_BOOL_TRUE(t->flags.rx.send_ack); - UtAssert_UINT32_EQ(t->state_data.r.r2.eof_crc, eof->crc); - UtAssert_UINT32_EQ(t->state_data.r.r2.eof_size, eof->size); - UtAssert_UINT32_EQ(t->state_data.r.r2.eof_cc, eof->cc); + txn->fsize = 0xbbb; + UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvEof(txn, ph)); + UtAssert_BOOL_TRUE(txn->flags.rx.eof_recv); + UtAssert_BOOL_TRUE(txn->flags.rx.send_ack); + UtAssert_UINT32_EQ(txn->state_data.receive.r2.eof_crc, eof->crc); + UtAssert_UINT32_EQ(txn->state_data.receive.r2.eof_size, eof->size); + UtAssert_UINT32_EQ(txn->state_data.receive.r2.eof_cc, eof->cc); /* non-success condition code - this resets the transaction */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); eof = &ph->int_header.eof; eof->cc = CF_CFDP_ConditionCode_CANCEL_REQUEST_RECEIVED; - UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvEof(t, ph)); + UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvEof(txn, ph)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* eof already recvd - noop */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - t->flags.rx.eof_recv = true; - UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvEof(t, ph)); - UtAssert_BOOL_TRUE(t->flags.rx.eof_recv); /* unchanged */ - UtAssert_BOOL_FALSE(t->flags.rx.send_ack); /* unchanged */ + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + txn->flags.rx.eof_recv = true; + UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvEof(txn, ph)); + UtAssert_BOOL_TRUE(txn->flags.rx.eof_recv); /* unchanged */ + UtAssert_BOOL_FALSE(txn->flags.rx.send_ack); /* unchanged */ UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* unchanged */ /* failure in CF_CFDP_R_SubstateRecvEof - not a stub, but calls CF_CFDP_RecvEof, which is. */ /* This will follow the CF_REC_PDU_BAD_EOF_ERROR processing path, which just sets state to FILEDATA */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvEof), 1, -1); - UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvEof(t, ph)); - UtAssert_UINT32_EQ(t->state_data.r.sub_state, CF_RxSubState_FILEDATA); + UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvEof(txn, ph)); + UtAssert_UINT32_EQ(txn->state_data.receive.sub_state, CF_RxSubState_FILEDATA); /* failure in CF_CFDP_R_SubstateRecvEof - set up for file size mismatch error */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); eof = &ph->int_header.eof; eof->size = 0xddd; - t->fsize = 0xbbb; - t->flags.rx.md_recv = true; - UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvEof(t, ph)); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); + txn->fsize = 0xbbb; + txn->flags.rx.md_recv = true; + UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvEof(txn, ph)); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); } void Test_CF_CFDP_R1_SubstateRecvFileData(void) { /* Test case for: - * void CF_CFDP_R1_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_R1_SubstateRecvFileData(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_R1_SubstateRecvFileData(t, ph)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_R1_SubstateRecvFileData(txn, ph)); UtAssert_STUB_COUNT(CF_CRC_Digest, 1); /* failure in CF_CFDP_RecvFd */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvFd), 1, -1); - UtAssert_VOIDCALL(CF_CFDP_R1_SubstateRecvFileData(t, ph)); + UtAssert_VOIDCALL(CF_CFDP_R1_SubstateRecvFileData(txn, ph)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* failure in CF_CFDP_R_ProcessFd (via failure of CF_WrappedWrite) */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_WrappedWrite), 1, -1); - UtAssert_VOIDCALL(CF_CFDP_R1_SubstateRecvFileData(t, ph)); + UtAssert_VOIDCALL(CF_CFDP_R1_SubstateRecvFileData(txn, ph)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 2); } void Test_CF_CFDP_R2_SubstateRecvFileData(void) { /* Test case for: - * void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - t->state_data.r.r2.acknak_count = 1; /* make nonzero so it can be checked */ - UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvFileData(t, ph)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + txn->state_data.receive.r2.acknak_count = 1; /* make nonzero so it can be checked */ + UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvFileData(txn, ph)); UtAssert_STUB_COUNT(CF_ChunkListAdd, 1); - UtAssert_ZERO(t->state_data.r.r2.acknak_count); /* this resets the counter */ + UtAssert_ZERO(txn->state_data.receive.r2.acknak_count); /* this resets the counter */ UtAssert_STUB_COUNT(CF_CFDP_ArmAckTimer, 1); /* with fd_nak_sent flag */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - t->state_data.r.r2.acknak_count = 1; /* make nonzero so it can be checked */ - t->flags.rx.fd_nak_sent = true; - UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvFileData(t, ph)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + txn->state_data.receive.r2.acknak_count = 1; /* make nonzero so it can be checked */ + txn->flags.rx.fd_nak_sent = true; + UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvFileData(txn, ph)); UtAssert_STUB_COUNT(CF_CFDP_ArmAckTimer, 2); - UtAssert_ZERO(t->state_data.r.r2.acknak_count); /* this resets the counter */ + UtAssert_ZERO(txn->state_data.receive.r2.acknak_count); /* this resets the counter */ /* with rx.complete flag */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - t->state_data.r.r2.acknak_count = 1; /* make nonzero so it can be checked */ - t->flags.rx.complete = true; - UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvFileData(t, ph)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + txn->state_data.receive.r2.acknak_count = 1; /* make nonzero so it can be checked */ + txn->flags.rx.complete = true; + UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvFileData(txn, ph)); UtAssert_STUB_COUNT(CF_CFDP_ArmAckTimer, 2); /* does NOT increment here */ - UtAssert_ZERO(t->state_data.r.r2.acknak_count); /* this resets the counter */ + UtAssert_ZERO(txn->state_data.receive.r2.acknak_count); /* this resets the counter */ /* failure in CF_CFDP_RecvFd (bad packet) */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvFd), 1, -1); - UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvFileData(t, ph)); - UtAssert_BOOL_TRUE(t->flags.rx.send_fin); /* this just goes to FIN */ + UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvFileData(txn, ph)); + UtAssert_BOOL_TRUE(txn->flags.rx.send_fin); /* this just goes to FIN */ /* failure in CF_CFDP_R_ProcessFd (via failure of CF_WrappedWrite) */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_TxnStatus_IsError), 1, true); UT_SetDeferredRetcode(UT_KEY(CF_WrappedWrite), 1, -1); - UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvFileData(t, ph)); + UtAssert_VOIDCALL(CF_CFDP_R2_SubstateRecvFileData(txn, ph)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* this resets the transaction */ } void Test_CF_CFDP_R2_GapCompute(void) { /* Test case for: - * void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *c, void *opaque); + * void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *chunk, void *opaque); */ CF_ChunkList_t chunks; - CF_Chunk_t c; + CF_Chunk_t chunk; CF_GapComputeArgs_t args; CF_Logical_PduNak_t nak; memset(&chunks, 0, sizeof(chunks)); - memset(&c, 0, sizeof(c)); + memset(&chunk, 0, sizeof(chunk)); memset(&args, 0, sizeof(args)); memset(&nak, 0, sizeof(nak)); args.nak = &nak; /* nominal */ - c.offset = 11000; - c.size = 100; + chunk.offset = 11000; + chunk.size = 100; nak.scope_start = 10000; nak.scope_end = 20000; - UtAssert_VOIDCALL(CF_CFDP_R2_GapCompute(&chunks, &c, &args)); + UtAssert_VOIDCALL(CF_CFDP_R2_GapCompute(&chunks, &chunk, &args)); UtAssert_UINT32_EQ(nak.segment_list.num_segments, 1); /* the offset start/end should be normalized to the scope start/end */ @@ -831,280 +831,280 @@ void Test_CF_CFDP_R2_GapCompute(void) /* confirm that CF_PDU_MAX_SEGMENTS is not exceeded */ nak.segment_list.num_segments = CF_PDU_MAX_SEGMENTS; - UtAssert_VOIDCALL(CF_CFDP_R2_GapCompute(&chunks, &c, &args)); + UtAssert_VOIDCALL(CF_CFDP_R2_GapCompute(&chunks, &chunk, &args)); UtAssert_UINT32_EQ(nak.segment_list.num_segments, CF_PDU_MAX_SEGMENTS); } void Test_CF_CFDP_R_SubstateSendNak(void) { /* Test case for: - * int CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t); + * int CF_CFDP_R_SubstateSendNak(CF_Transaction_t *txn); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; CF_ChunkWrapper_t chunks; memset(&chunks, 0, sizeof(chunks)); /* no packet available */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(t), -1); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(txn), -1); /* with md_recv flag false, this should request one by sending a blank NAK */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(t), 0); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(txn), 0); UT_CF_AssertEventID(CF_EID_INF_CFDP_R_REQUEST_MD); UtAssert_STUB_COUNT(CF_CFDP_SendNak, 1); /* same, but with failure of CF_CFDP_SendNak */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendNak), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(t), -1); + UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(txn), -1); UT_CF_AssertEventID(CF_EID_INF_CFDP_R_REQUEST_MD); UtAssert_STUB_COUNT(CF_CFDP_SendNak, 2); /* with md_recv flag true, this should call gap compute to assemble the NAK */ /* this requires the chunks list to be set up, and by default compute_gaps will return 0 (no gaps) so the transaction goes to complete */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); - t->flags.rx.md_recv = true; - t->chunks = &chunks; + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); + txn->flags.rx.md_recv = true; + txn->chunks = &chunks; chunks.chunks.count = 1; chunks.chunks.max_chunks = 2; - UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(t), 0); + UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(txn), 0); UtAssert_STUB_COUNT(CF_ChunkList_ComputeGaps, 1); UtAssert_STUB_COUNT(CF_CFDP_SendNak, 2); /* did not increment */ - UtAssert_BOOL_TRUE(t->flags.rx.complete); + UtAssert_BOOL_TRUE(txn->flags.rx.complete); /* same, but return nonzero number of gaps */ /* this also should use the max chunks instead of count */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_ChunkList_ComputeGaps), 1, 1); - t->flags.rx.md_recv = true; - t->chunks = &chunks; + txn->flags.rx.md_recv = true; + txn->chunks = &chunks; chunks.chunks.count = 3; chunks.chunks.max_chunks = 2; - UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(t), 0); + UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(txn), 0); UtAssert_STUB_COUNT(CF_CFDP_SendNak, 3); - UtAssert_BOOL_TRUE(t->flags.rx.fd_nak_sent); + UtAssert_BOOL_TRUE(txn->flags.rx.fd_nak_sent); /* same, nonzero number of gaps, but get failure in SendNak */ /* this also should use the max chunks instead of count */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_ChunkList_ComputeGaps), 1, 1); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendNak), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - t->flags.rx.md_recv = true; - t->chunks = &chunks; - UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(t), -1); - UtAssert_BOOL_TRUE(t->flags.rx.fd_nak_sent); /* this flag is still set, even when it fails to send? */ + txn->flags.rx.md_recv = true; + txn->chunks = &chunks; + UtAssert_INT32_EQ(CF_CFDP_R_SubstateSendNak(txn), -1); + UtAssert_BOOL_TRUE(txn->flags.rx.fd_nak_sent); /* this flag is still set, even when it fails to send? */ } void Test_CF_CFDP_R2_CalcCrcChunk(void) { /* Test case for: - * int CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t); + * int CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; CF_ConfigTable_t *config; /* nominal with zero size file */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(t), 0); - UtAssert_BOOL_TRUE(t->flags.com.crc_calc); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(txn), 0); + UtAssert_BOOL_TRUE(txn->flags.com.crc_calc); /* nominal with non zero size file, runs the loop */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, &config); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, &config); config->rx_crc_calc_bytes_per_wakeup = 100; - t->fsize = 70; - UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, t->fsize); - UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(t), 0); - UtAssert_BOOL_TRUE(t->flags.com.crc_calc); + txn->fsize = 70; + UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, txn->fsize); + UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(txn), 0); + UtAssert_BOOL_TRUE(txn->flags.com.crc_calc); /* force a CRC mismatch */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - t->crc.result = 0xabadf00d; - t->state_data.r.r2.eof_crc = 0xdeadbeef; - UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(t), 0); - UtAssert_BOOL_TRUE(t->flags.com.crc_calc); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_CHECKSUM_FAILURE); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + txn->crc.result = 0xabadf00d; + txn->state_data.receive.r2.eof_crc = 0xdeadbeef; + UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(txn), 0); + UtAssert_BOOL_TRUE(txn->flags.com.crc_calc); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILE_CHECKSUM_FAILURE); /* nominal with file larger than rx_crc_calc_bytes_per_wakeup */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, &config); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, &config); config->rx_crc_calc_bytes_per_wakeup = CF_R2_CRC_CHUNK_SIZE; - t->fsize = CF_R2_CRC_CHUNK_SIZE + 100; + txn->fsize = CF_R2_CRC_CHUNK_SIZE + 100; UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, CF_R2_CRC_CHUNK_SIZE); - UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(t), -1); /* -1 because its incomplete */ - UtAssert_BOOL_FALSE(t->flags.com.crc_calc); + UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(txn), -1); /* -1 because its incomplete */ + UtAssert_BOOL_FALSE(txn->flags.com.crc_calc); /* nominal with file size larger than CF_R2_CRC_CHUNK_SIZE (this will do 2 reads) */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, &config); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, &config); config->rx_crc_calc_bytes_per_wakeup = CF_R2_CRC_CHUNK_SIZE * 2; - t->fsize = CF_R2_CRC_CHUNK_SIZE + 100; + txn->fsize = CF_R2_CRC_CHUNK_SIZE + 100; UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, CF_R2_CRC_CHUNK_SIZE); UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, 100); - UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(t), 0); - UtAssert_BOOL_TRUE(t->flags.com.crc_calc); + UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(txn), 0); + UtAssert_BOOL_TRUE(txn->flags.com.crc_calc); /* nominal with seek required */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, &config); - t->state_data.r.r2.rx_crc_calc_bytes = 10; - t->state_data.r.cached_pos = 20; + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, &config); + txn->state_data.receive.r2.rx_crc_calc_bytes = 10; + txn->state_data.receive.cached_pos = 20; config->rx_crc_calc_bytes_per_wakeup = 100; - t->fsize = 50; - UT_SetDeferredRetcode(UT_KEY(CF_WrappedLseek), 1, t->state_data.r.r2.rx_crc_calc_bytes); - UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, t->fsize - t->state_data.r.r2.rx_crc_calc_bytes); - UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(t), 0); - UtAssert_BOOL_TRUE(t->flags.com.crc_calc); + txn->fsize = 50; + UT_SetDeferredRetcode(UT_KEY(CF_WrappedLseek), 1, txn->state_data.receive.r2.rx_crc_calc_bytes); + UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, txn->fsize - txn->state_data.receive.r2.rx_crc_calc_bytes); + UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(txn), 0); + UtAssert_BOOL_TRUE(txn->flags.com.crc_calc); /* failure of read */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, &config); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, &config); config->rx_crc_calc_bytes_per_wakeup = 100; - t->fsize = 50; + txn->fsize = 50; UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, -1); - UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(t), -1); + UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(txn), -1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_READ); - UtAssert_BOOL_FALSE(t->flags.com.crc_calc); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_read, 1); + UtAssert_BOOL_FALSE(txn->flags.com.crc_calc); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_read, 1); /* failure of lseek */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, &config); - t->state_data.r.r2.rx_crc_calc_bytes = 20; - t->state_data.r.cached_pos = 10; + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, &config); + txn->state_data.receive.r2.rx_crc_calc_bytes = 20; + txn->state_data.receive.cached_pos = 10; config->rx_crc_calc_bytes_per_wakeup = 100; - t->fsize = 50; + txn->fsize = 50; UT_SetDeferredRetcode(UT_KEY(CF_WrappedLseek), 1, -1); - UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(t), -1); + UtAssert_INT32_EQ(CF_CFDP_R2_CalcCrcChunk(txn), -1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_SEEK_CRC); - UtAssert_BOOL_FALSE(t->flags.com.crc_calc); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek, 1); + UtAssert_BOOL_FALSE(txn->flags.com.crc_calc); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_seek, 1); } void Test_CF_CFDP_R2_SubstateSendFin(void) { /* Test case for: - * int CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t); + * int CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_R2_SubstateSendFin(t), 0); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_R2_SubstateSendFin(txn), 0); /* CRC failure - can get this by having rx_crc_calc_bytes_per_wakeup less than fsize */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->fsize = 100; - UtAssert_INT32_EQ(CF_CFDP_R2_SubstateSendFin(t), -1); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->fsize = 100; + UtAssert_INT32_EQ(CF_CFDP_R2_SubstateSendFin(txn), -1); /* failure in CF_CFDP_SendFin */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendFin), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - UtAssert_INT32_EQ(CF_CFDP_R2_SubstateSendFin(t), -1); + UtAssert_INT32_EQ(CF_CFDP_R2_SubstateSendFin(txn), -1); /* non-success transaction status code */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_TxnStatus_IsError), 1, true); - UtAssert_INT32_EQ(CF_CFDP_R2_SubstateSendFin(t), 0); + UtAssert_INT32_EQ(CF_CFDP_R2_SubstateSendFin(txn), 0); /* already calculated CRC */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->flags.com.crc_calc = true; - UtAssert_INT32_EQ(CF_CFDP_R2_SubstateSendFin(t), 0); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->flags.com.crc_calc = true; + UtAssert_INT32_EQ(CF_CFDP_R2_SubstateSendFin(txn), 0); } void Test_CF_CFDP_R2_Recv_fin_ack(void) { /* Test case for: - * void CF_CFDP_R2_Recv_fin_ack(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_R2_Recv_fin_ack(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_R2_Recv_fin_ack(t, ph)); - UtAssert_BOOL_TRUE(t->flags.rx.send_fin); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_R2_Recv_fin_ack(txn, ph)); + UtAssert_BOOL_TRUE(txn->flags.rx.send_fin); /* failure in CF_CFDP_RecvAck */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvAck), 1, -1); - UtAssert_VOIDCALL(CF_CFDP_R2_Recv_fin_ack(t, ph)); + UtAssert_VOIDCALL(CF_CFDP_R2_Recv_fin_ack(txn, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_PDU_FINACK); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error, 1); } void Test_CF_CFDP_R2_RecvMd(void) { /* Test case for: - * void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_R2_RecvMd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - t->state_data.r.cached_pos = 1; - t->state_data.r.r2.acknak_count = 1; - UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(t, ph)); - UtAssert_UINT32_EQ(t->state_data.r.cached_pos, 0); - UtAssert_UINT32_EQ(t->flags.rx.md_recv, 1); - UtAssert_UINT32_EQ(t->state_data.r.r2.acknak_count, 0); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + txn->state_data.receive.cached_pos = 1; + txn->state_data.receive.r2.acknak_count = 1; + UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(txn, ph)); + UtAssert_UINT32_EQ(txn->state_data.receive.cached_pos, 0); + UtAssert_UINT32_EQ(txn->flags.rx.md_recv, 1); + UtAssert_UINT32_EQ(txn->state_data.receive.r2.acknak_count, 0); /* md_recv already set */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - t->flags.rx.md_recv = true; - UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(t, ph)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + txn->flags.rx.md_recv = true; + UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(txn, ph)); /* EOF already received, file size match */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - t->fsize = 100; - t->state_data.r.r2.eof_size = 100; - t->flags.rx.eof_recv = true; - UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(t, ph)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + txn->fsize = 100; + txn->state_data.receive.r2.eof_size = 100; + txn->flags.rx.eof_recv = true; + UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(txn, ph)); /* EOF already received, file size different */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - t->fsize = 100; - t->state_data.r.r2.eof_size = 120; - t->flags.rx.eof_recv = true; - UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(t, ph)); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + txn->fsize = 100; + txn->state_data.receive.r2.eof_size = 120; + txn->flags.rx.eof_recv = true; + UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(txn, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_EOF_MD_SIZE); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILE_SIZE_ERROR); /* OS_mv failure */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(OS_mv), 1, CF_ERROR); - UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(t, ph)); + UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(txn, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_RENAME); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* reopen failure */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_WrappedOpenCreate), 1, CF_ERROR); - UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(t, ph)); + UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(txn, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_OPEN); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* CF_CFDP_RecvMd failure */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvMd), 1, CF_PDU_METADATA_ERROR); - UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(t, ph)); + UtAssert_VOIDCALL(CF_CFDP_R2_RecvMd(txn, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_PDU_MD); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error, 1); } void Test_CF_CFDP_R_SendInactivityEvent(void) { /* Test case for: - * void CF_CFDP_R_SendInactivityEvent(CF_Transaction_t *t); + * void CF_CFDP_R_SendInactivityEvent(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal */ - UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_R_SendInactivityEvent(t)); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.inactivity_timer, 1); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_R_SendInactivityEvent(txn)); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.inactivity_timer, 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_INACT_TIMER); } diff --git a/unit-test/cf_cfdp_s_tests.c b/unit-test/cf_cfdp_s_tests.c index c2e2c5a4..5cd75851 100644 --- a/unit-test/cf_cfdp_s_tests.c +++ b/unit-test/cf_cfdp_s_tests.c @@ -171,253 +171,253 @@ void cf_cfdp_s_tests_Teardown(void) void Test_CF_CFDP_S1_Recv(void) { /* Test case for: - * void CF_CFDP_S1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_S1_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* class 1 recv is really a noop, it basically drops all packets. nothing to verify, just call for coverage */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S1_Recv(t, ph)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S1_Recv(txn, ph)); } void Test_CF_CFDP_S2_Recv(void) { /* Test case for: - * void CF_CFDP_S2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_S2_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* class 2 recv just invokes a dispatcher to functions that should be tested separately. nothing to verify here. */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S2_Recv(t, ph)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S2_Recv(txn, ph)); } void Test_CF_CFDP_S1_Tx(void) { /* Test case for: - * void CF_CFDP_S1_Tx(CF_Transaction_t *t); + * void CF_CFDP_S1_Tx(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S1_Tx(t)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S1_Tx(txn)); } void Test_CF_CFDP_S2_Tx(void) { /* Test case for: - * void CF_CFDP_S2_Tx(CF_Transaction_t *t); + * void CF_CFDP_S2_Tx(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S2_Tx(t)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S2_Tx(txn)); } void Test_CF_CFDP_S_Tick(void) { /* Test case for: - * void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont); + * void CF_CFDP_S_Tick(CF_Transaction_t *txn, int *cont); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; CF_ConfigTable_t *config; int cont; cont = 0; /* nominal, not in CF_TxnState_S2 (noop) */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S_Tick(txn, &cont)); /* nominal, in CF_TxnState_S2, no timer expiry */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_S2; - UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_S2; + UtAssert_VOIDCALL(CF_CFDP_S_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_Timer_Tick, 1); /* nominal, in CF_TxnState_S2, with timer expiry */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, 1); - t->state = CF_TxnState_S2; - UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); + txn->state = CF_TxnState_S2; + UtAssert_VOIDCALL(CF_CFDP_S_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_Timer_Tick, 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_INACT_TIMER); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.inactivity_timer, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.inactivity_timer, 1); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* in CF_TxnState_S2, ack_timer_armed */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_S2; - t->flags.com.ack_timer_armed = true; - UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_S2; + txn->flags.com.ack_timer_armed = true; + UtAssert_VOIDCALL(CF_CFDP_S_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_Timer_Tick, 3); /* called twice! */ /* in CF_TxnState_S2, ack_timer_armed + expiry */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 2, 1); - t->state = CF_TxnState_S2; - t->flags.com.ack_timer_armed = true; - UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); + txn->state = CF_TxnState_S2; + txn->flags.com.ack_timer_armed = true; + UtAssert_VOIDCALL(CF_CFDP_S_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_Timer_Tick, 4); /* in CF_TxnState_S2, ack_timer_armed + expiry + finack substate */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 2, 1); - config->chan[t->chan_num].ack_limit = 10; - t->state = CF_TxnState_S2; - t->flags.com.ack_timer_armed = true; - t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; - UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); + config->chan[txn->chan_num].ack_limit = 10; + txn->state = CF_TxnState_S2; + txn->flags.com.ack_timer_armed = true; + txn->state_data.send.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; + UtAssert_VOIDCALL(CF_CFDP_S_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_CFDP_SendEof, 1); /* same, with acklimit reached */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 2, 1); - config->chan[t->chan_num].ack_limit = 10; - t->state = CF_TxnState_S2; - t->flags.com.ack_timer_armed = true; - t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; - t->state_data.s.s2.acknak_count = 9; - UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); + config->chan[txn->chan_num].ack_limit = 10; + txn->state = CF_TxnState_S2; + txn->flags.com.ack_timer_armed = true; + txn->state_data.send.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; + txn->state_data.send.s2.acknak_count = 9; + UtAssert_VOIDCALL(CF_CFDP_S_Tick(txn, &cont)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_ACK_LIMIT); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.ack_limit, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.ack_limit, 1); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 2); /* same, with CF_CFDP_S_SendEof no message */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 2, 1); - config->chan[t->chan_num].ack_limit = 10; - t->state = CF_TxnState_S2; - t->flags.com.ack_timer_armed = true; - t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; + config->chan[txn->chan_num].ack_limit = 10; + txn->state = CF_TxnState_S2; + txn->flags.com.ack_timer_armed = true; + txn->state_data.send.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendEof), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); + UtAssert_VOIDCALL(CF_CFDP_S_Tick(txn, &cont)); /* same, with CF_CFDP_S_SendEof Error */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 2, 1); - config->chan[t->chan_num].ack_limit = 10; - t->state = CF_TxnState_S2; - t->flags.com.ack_timer_armed = true; - t->state_data.s.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; + config->chan[txn->chan_num].ack_limit = 10; + txn->state = CF_TxnState_S2; + txn->flags.com.ack_timer_armed = true; + txn->state_data.send.sub_state = CF_TxSubState_WAIT_FOR_EOF_ACK; UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendEof), 1, CF_SEND_PDU_ERROR); - UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); + UtAssert_VOIDCALL(CF_CFDP_S_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 3); - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_S2; - t->state_data.s.sub_state = CF_TxSubState_SEND_FIN_ACK; - UtAssert_VOIDCALL(CF_CFDP_S_Tick(t, &cont)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_S2; + txn->state_data.send.sub_state = CF_TxSubState_SEND_FIN_ACK; + UtAssert_VOIDCALL(CF_CFDP_S_Tick(txn, &cont)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 4); } void Test_CF_CFDP_S_Tick_Nak(void) { /* Test case for: - * void CF_CFDP_S_Tick_Nak(CF_Transaction_t *t, int *cont); + * void CF_CFDP_S_Tick_Nak(CF_Transaction_t *txn, int *cont); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; int cont; cont = 0; /* nominal */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S_Tick_Nak(t, &cont)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S_Tick_Nak(txn, &cont)); UtAssert_ZERO(cont); /* CF_CFDP_S_CheckAndRespondNak returns 1 */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->flags.tx.md_need_send = true; - UtAssert_VOIDCALL(CF_CFDP_S_Tick_Nak(t, &cont)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->flags.tx.md_need_send = true; + UtAssert_VOIDCALL(CF_CFDP_S_Tick_Nak(txn, &cont)); UtAssert_NONZERO(cont); } void Test_CF_CFDP_S_Cancel(void) { /* Test case for: - * void CF_CFDP_S_Cancel(CF_Transaction_t *t); + * void CF_CFDP_S_Cancel(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S_Cancel(t)); - UtAssert_UINT32_EQ(t->state_data.s.sub_state, CF_TxSubState_EOF); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S_Cancel(txn)); + UtAssert_UINT32_EQ(txn->state_data.send.sub_state, CF_TxSubState_EOF); /* already EOF state */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->state_data.s.sub_state = CF_TxSubState_EOF; - UtAssert_VOIDCALL(CF_CFDP_S_Cancel(t)); - UtAssert_UINT32_EQ(t->state_data.s.sub_state, CF_TxSubState_EOF); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->state_data.send.sub_state = CF_TxSubState_EOF; + UtAssert_VOIDCALL(CF_CFDP_S_Cancel(txn)); + UtAssert_UINT32_EQ(txn->state_data.send.sub_state, CF_TxSubState_EOF); } void Test_CF_CFDP_S_SendEof(void) { /* Test case for: - * CFE_Status_t CF_CFDP_S_SendEof(CF_Transaction_t *t); + * CFE_Status_t CF_CFDP_S_SendEof(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_S_SendEof(t), CFE_SUCCESS); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_S_SendEof(txn), CFE_SUCCESS); /* with CRC calc */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->flags.com.crc_calc = true; - UtAssert_INT32_EQ(CF_CFDP_S_SendEof(t), CFE_SUCCESS); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->flags.com.crc_calc = true; + UtAssert_INT32_EQ(CF_CFDP_S_SendEof(txn), CFE_SUCCESS); /* confirm retcode from CF_CFDP_SendEof is carried through */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendEof), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - UtAssert_INT32_EQ(CF_CFDP_S_SendEof(t), CF_SEND_PDU_NO_BUF_AVAIL_ERROR); + UtAssert_INT32_EQ(CF_CFDP_S_SendEof(txn), CF_SEND_PDU_NO_BUF_AVAIL_ERROR); } void Test_CF_CFDP_S1_SubstateSendEof(void) { /* Test case for: - * void CF_CFDP_S1_SubstateSendEof(CF_Transaction_t *t); + * void CF_CFDP_S1_SubstateSendEof(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal, should reset */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S1_SubstateSendEof(t)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S1_SubstateSendEof(txn)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* should not reset transaction if error */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendEof), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - UtAssert_VOIDCALL(CF_CFDP_S1_SubstateSendEof(t)); + UtAssert_VOIDCALL(CF_CFDP_S1_SubstateSendEof(txn)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* no increment */ } void Test_CF_CFDP_S2_SubstateSendEof(void) { /* Test case for: - * void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *t); + * void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal, this dequeues a transaction so q_size must be nonzero */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - CF_AppData.hk.channel_hk[t->chan_num].q_size[t->flags.com.q_index] = 10; - UtAssert_VOIDCALL(CF_CFDP_S2_SubstateSendEof(t)); - UtAssert_UINT32_EQ(t->state_data.s.sub_state, CF_TxSubState_WAIT_FOR_EOF_ACK); - UtAssert_BOOL_TRUE(t->flags.com.ack_timer_armed); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + CF_AppData.hk.channel_hk[txn->chan_num].q_size[txn->flags.com.q_index] = 10; + UtAssert_VOIDCALL(CF_CFDP_S2_SubstateSendEof(txn)); + UtAssert_UINT32_EQ(txn->state_data.send.sub_state, CF_TxSubState_WAIT_FOR_EOF_ACK); + UtAssert_BOOL_TRUE(txn->flags.com.ack_timer_armed); } void Test_CF_CFDP_S_SendFileData(void) { /* Test case for: - * int32 CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 bytes_to_read, uint8 calc_crc); + * int32 CF_CFDP_S_SendFileData(CF_Transaction_t *txn, uint32 foffs, uint32 bytes_to_read, uint8 calc_crc); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; CF_ConfigTable_t *config; uint32 cumulative_read; uint32 read_size; @@ -428,138 +428,138 @@ void Test_CF_CFDP_S_SendFileData(void) read_size = 100; /* failure of CF_CFDP_ConstructPduHeader */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), 0); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(txn, offset, read_size, true), 0); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.sent.file_data_bytes, cumulative_read); /* nominal, smaller than chunk, no CRC */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); config->outgoing_file_chunk_size = 150; - t->fsize = 300; + txn->fsize = 300; UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, read_size); - UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, false), read_size); + UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(txn, offset, read_size, false), read_size); cumulative_read += read_size; - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.sent.file_data_bytes, cumulative_read); /* nominal, larger than PDU, no CRC */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); config->outgoing_file_chunk_size = CF_MAX_PDU_SIZE * 2; - t->fsize = CF_MAX_PDU_SIZE * 2; + txn->fsize = CF_MAX_PDU_SIZE * 2; read_size = CF_MAX_PDU_SIZE; UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, read_size); - UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size * 2, false), read_size); + UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(txn, offset, read_size * 2, false), read_size); cumulative_read += read_size; - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.sent.file_data_bytes, cumulative_read); UtAssert_STUB_COUNT(CF_CRC_Digest, 0); /* nominal, larger than chunk, with CRC */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); config->outgoing_file_chunk_size = 50; read_size = 100; - t->fsize = 300; + txn->fsize = 300; UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, config->outgoing_file_chunk_size); - UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), config->outgoing_file_chunk_size); + UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(txn, offset, read_size, true), config->outgoing_file_chunk_size); cumulative_read += config->outgoing_file_chunk_size; - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.sent.file_data_bytes, cumulative_read); UtAssert_STUB_COUNT(CF_CRC_Digest, 1); /* no message available */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendFd), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, read_size); config->outgoing_file_chunk_size = read_size; - t->fsize = 300; - UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), 0); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + txn->fsize = 300; + UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(txn, offset, read_size, true), 0); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.sent.file_data_bytes, cumulative_read); /* other send error */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendFd), 1, CF_SEND_PDU_ERROR); UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, read_size); config->outgoing_file_chunk_size = read_size; - t->fsize = 300; - UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), -1); + txn->fsize = 300; + UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(txn, offset, read_size, true), -1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_SEND_FD); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.sent.file_data_bytes, cumulative_read); /* read w/failure */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, -1); config->outgoing_file_chunk_size = read_size; - t->fsize = 300; - UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), -1); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_read, 1); + txn->fsize = 300; + UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(txn, offset, read_size, true), -1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_read, 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_READ); /* require lseek */ offset = 25; - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_WrappedLseek), 1, offset); UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, read_size); config->outgoing_file_chunk_size = read_size; - t->fsize = 300; - UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), read_size); + txn->fsize = 300; + UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(txn, offset, read_size, true), read_size); cumulative_read += read_size; - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.sent.file_data_bytes, cumulative_read); /* lseek w/failure */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_WrappedLseek), 1, -1); config->outgoing_file_chunk_size = read_size; - t->fsize = 300; - UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(t, offset, read_size, true), -1); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.sent.file_data_bytes, cumulative_read); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek, 1); + txn->fsize = 300; + UtAssert_INT32_EQ(CF_CFDP_S_SendFileData(txn, offset, read_size, true), -1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.sent.file_data_bytes, cumulative_read); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_seek, 1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_SEEK_FD); } void Test_CF_CFDP_S_SubstateSendFileData(void) { /* Test case for: - * void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *t); + * void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; CF_ConfigTable_t *config; /* nominal, zero bytes processed */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFileData(t)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFileData(txn)); /* nominal, whole file at once */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); config->outgoing_file_chunk_size = CF_MAX_PDU_SIZE; - t->state_data.s.sub_state = CF_TxSubState_FILEDATA; - t->fsize = CF_MAX_PDU_SIZE / 2; - UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, t->fsize); - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFileData(t)); - UtAssert_UINT32_EQ(t->state_data.s.sub_state, CF_TxSubState_EOF); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_UNDEFINED); + txn->state_data.send.sub_state = CF_TxSubState_FILEDATA; + txn->fsize = CF_MAX_PDU_SIZE / 2; + UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, txn->fsize); + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFileData(txn)); + UtAssert_UINT32_EQ(txn->state_data.send.sub_state, CF_TxSubState_EOF); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_UNDEFINED); /* nominal, less than whole file at once */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); config->outgoing_file_chunk_size = CF_MAX_PDU_SIZE / 2; - t->state_data.s.sub_state = CF_TxSubState_FILEDATA; - t->fsize = CF_MAX_PDU_SIZE; + txn->state_data.send.sub_state = CF_TxSubState_FILEDATA; + txn->fsize = CF_MAX_PDU_SIZE; UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, config->outgoing_file_chunk_size); - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFileData(t)); - UtAssert_UINT32_EQ(t->state_data.s.sub_state, CF_TxSubState_FILEDATA); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_UNDEFINED); + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFileData(txn)); + UtAssert_UINT32_EQ(txn->state_data.send.sub_state, CF_TxSubState_FILEDATA); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_UNDEFINED); /* error during read */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, -1); - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFileData(t)); - UtAssert_UINT32_EQ(t->state_data.s.sub_state, CF_TxSubState_EOF); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFileData(txn)); + UtAssert_UINT32_EQ(txn->state_data.send.sub_state, CF_TxSubState_EOF); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); } void Test_CF_CFDP_S_CheckAndRespondNak(void) { /* Test case for: - * int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t); + * int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; CF_ChunkWrapper_t chunks; CF_Chunk_t ut_chunk; CF_ConfigTable_t *config; @@ -571,289 +571,289 @@ void Test_CF_CFDP_S_CheckAndRespondNak(void) ut_chunk.size = CF_MAX_PDU_SIZE / 2; /* nominal */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(t), 0); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(txn), 0); /* with md_need_send flag set */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->flags.tx.md_need_send = true; - UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(t), 1); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->flags.tx.md_need_send = true; + UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(txn), 1); UtAssert_STUB_COUNT(CF_CFDP_SendMd, 1); - UtAssert_BOOL_FALSE(t->flags.tx.md_need_send); + UtAssert_BOOL_FALSE(txn->flags.tx.md_need_send); /* with md_need_send flag set, but failed */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->flags.tx.md_need_send = true; + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->flags.tx.md_need_send = true; UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendMd), 1, CF_SEND_PDU_ERROR); - UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(t), -1); - UtAssert_BOOL_TRUE(t->flags.tx.md_need_send); /* still set */ + UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(txn), -1); + UtAssert_BOOL_TRUE(txn->flags.tx.md_need_send); /* still set */ /* with md_need_send flag set, but no message */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->flags.tx.md_need_send = true; + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->flags.tx.md_need_send = true; UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendMd), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(t), 1); - UtAssert_BOOL_TRUE(t->flags.tx.md_need_send); /* still set */ + UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(txn), 1); + UtAssert_BOOL_TRUE(txn->flags.tx.md_need_send); /* still set */ /* with chunklist - this will send file data, which needs to be set up for */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); config->outgoing_file_chunk_size = CF_MAX_PDU_SIZE; - t->fsize = ut_chunk.size; - t->chunks = &chunks; + txn->fsize = ut_chunk.size; + txn->chunks = &chunks; UT_SetHandlerFunction(UT_KEY(CF_ChunkList_GetFirstChunk), UT_AltHandler_GenericPointerReturn, &ut_chunk); UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, ut_chunk.size); - UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(t), 1); + UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(txn), 1); /* with chunklist - failure to send file data */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); config->outgoing_file_chunk_size = CF_MAX_PDU_SIZE; - t->fsize = ut_chunk.size; - t->chunks = &chunks; + txn->fsize = ut_chunk.size; + txn->chunks = &chunks; UT_SetHandlerFunction(UT_KEY(CF_ChunkList_GetFirstChunk), UT_AltHandler_GenericPointerReturn, &ut_chunk); UT_SetDeferredRetcode(UT_KEY(CF_WrappedRead), 1, -1); - UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(t), -1); + UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(txn), -1); /* with chunklist but CF_CFDP_S_SendFileData returning 0 (nothing to send) */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); config->outgoing_file_chunk_size = CF_MAX_PDU_SIZE; - t->fsize = ut_chunk.size; - t->chunks = &chunks; + txn->fsize = ut_chunk.size; + txn->chunks = &chunks; UT_SetHandlerFunction(UT_KEY(CF_ChunkList_GetFirstChunk), UT_AltHandler_GenericPointerReturn, &ut_chunk); UT_ResetState(UT_KEY(CF_CFDP_ConstructPduHeader)); /* Returns NULL by default */ - UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(t), 0); + UtAssert_INT32_EQ(CF_CFDP_S_CheckAndRespondNak(txn), 0); } void Test_CF_CFDP_S2_SubstateSendFileData(void) { /* Test case for: - * void CF_CFDP_S2_SubstateSendFileData(CF_Transaction_t *t); + * void CF_CFDP_S2_SubstateSendFileData(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal, just invokes CF_CFDP_S_SubstateSendFileData */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S2_SubstateSendFileData(t)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S2_SubstateSendFileData(txn)); /* If CF_CFDP_S_CheckAndRespondNak returns > 0 */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->flags.tx.md_need_send = true; - UtAssert_VOIDCALL(CF_CFDP_S2_SubstateSendFileData(t)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->flags.tx.md_need_send = true; + UtAssert_VOIDCALL(CF_CFDP_S2_SubstateSendFileData(txn)); /* failure in CF_CFDP_S_CheckAndRespondNak, resets transaction */ /* easiest way to trigger is via SendMd failure */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->flags.tx.md_need_send = true; + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->flags.tx.md_need_send = true; UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendMd), 1, CF_SEND_PDU_ERROR); - UtAssert_VOIDCALL(CF_CFDP_S2_SubstateSendFileData(t)); + UtAssert_VOIDCALL(CF_CFDP_S2_SubstateSendFileData(txn)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); } void Test_CF_CFDP_S_SubstateSendMetadata(void) { /* Test case for: - * void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *t); + * void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* with no setup, OS_FileOpenCheck returns SUCCESS (true) */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(txn)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_ALREADY_OPEN); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_open, 1); /* file already open */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - OS_OpenCreate(&t->fd, "ut", 0, 0); /* sets fd */ - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + OS_OpenCreate(&txn->fd, "ut", 0, 0); /* sets fd */ + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(txn)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); - UtAssert_UINT32_EQ(t->state_data.s.sub_state, CF_TxSubState_FILEDATA); + UtAssert_UINT32_EQ(txn->state_data.send.sub_state, CF_TxSubState_FILEDATA); /* this retval is sticky and applies for the rest of the test cases */ UT_SetDefaultReturnValue(UT_KEY(OS_FileOpenCheck), OS_ERROR); /* OS_FileOpenCheck does not succeed, then WrappedOpenCreate fails */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_WrappedOpenCreate), 1, -1); - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(txn)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_OPEN); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open, 2); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_open, 2); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* first CF_WrappedLseek fails */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_WrappedLseek), 1, -1); - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(txn)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_SEEK_END); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek, 1); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_seek, 1); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* second CF_WrappedLseek fails */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_WrappedLseek), 2, -1); - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(txn)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_SEEK_BEG); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek, 2); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_seek, 2); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* CF_CFDP_SendMd fails w/ ERROR */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendMd), 1, CF_SEND_PDU_ERROR); - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(txn)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_SEND_MD); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* CF_CFDP_SendMd fails w/ NO_MSG (no event here) */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendMd), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(txn)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_UNDEFINED); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_UNDEFINED); /* everything works */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(t)); - UtAssert_UINT32_EQ(t->state_data.s.sub_state, CF_TxSubState_FILEDATA); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendMetadata(txn)); + UtAssert_UINT32_EQ(txn->state_data.send.sub_state, CF_TxSubState_FILEDATA); } void Test_CF_CFDP_S_SubstateSendFinAck(void) { /* Test case for: - * void CF_CFDP_S_SubstateSendFinAck(CF_Transaction_t *t); + * void CF_CFDP_S_SubstateSendFinAck(CF_Transaction_t *txn); */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFinAck(t)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFinAck(txn)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* CF_SEND_PDU_NO_BUF_AVAIL_ERROR status */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendAck), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFinAck(t)); + UtAssert_VOIDCALL(CF_CFDP_S_SubstateSendFinAck(txn)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); /* not incremented */ } void Test_CF_CFDP_S2_EarlyFin(void) { /* Test case for: - * void CF_CFDP_S2_EarlyFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_S2_EarlyFin(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S2_EarlyFin(t, ph)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S2_EarlyFin(txn, ph)); } void Test_CF_CFDP_S2_Fin(void) { /* Test case for: - * void CF_CFDP_S2_Fin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_S2_Fin(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S2_Fin(t, ph)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S2_Fin(txn, ph)); } void Test_CF_CFDP_S2_Nak(void) { /* Test case for: - * void CF_CFDP_S2_Nak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_S2_Nak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; CF_Logical_PduNak_t * nak; /* no segments */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S2_Nak(t, ph)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S2_Nak(txn, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_PDU_NAK); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error, 1); /* nominal, re-send md request (0,0) */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); nak = &ph->int_header.nak; nak->segment_list.num_segments = 1; nak->segment_list.segments[0] = (CF_Logical_SegmentRequest_t) {0, 0}; - UtAssert_VOIDCALL(CF_CFDP_S2_Nak(t, ph)); - UtAssert_BOOL_TRUE(t->flags.tx.md_need_send); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.nak_segment_requests, 1); + UtAssert_VOIDCALL(CF_CFDP_S2_Nak(txn, ph)); + UtAssert_BOOL_TRUE(txn->flags.tx.md_need_send); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.nak_segment_requests, 1); /* nominal, nonzero offsets */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); nak = &ph->int_header.nak; nak->segment_list.num_segments = 2; nak->segment_list.segments[0] = (CF_Logical_SegmentRequest_t) {0, 200}; nak->segment_list.segments[1] = (CF_Logical_SegmentRequest_t) {200, 300}; - t->fsize = 300; - UtAssert_VOIDCALL(CF_CFDP_S2_Nak(t, ph)); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.nak_segment_requests, 3); + txn->fsize = 300; + UtAssert_VOIDCALL(CF_CFDP_S2_Nak(txn, ph)); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.nak_segment_requests, 3); /* bad segments */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); nak = &ph->int_header.nak; nak->segment_list.num_segments = 3; nak->segment_list.segments[0] = (CF_Logical_SegmentRequest_t) {200, 100}; nak->segment_list.segments[1] = (CF_Logical_SegmentRequest_t) {100, 400}; nak->segment_list.segments[2] = (CF_Logical_SegmentRequest_t) {400, 0}; - t->fsize = 300; - UtAssert_VOIDCALL(CF_CFDP_S2_Nak(t, ph)); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.nak_segment_requests, 6); + txn->fsize = 300; + UtAssert_VOIDCALL(CF_CFDP_S2_Nak(txn, ph)); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.nak_segment_requests, 6); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_INVALID_SR); /* bad decode */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvNak), 1, -1); nak = &ph->int_header.nak; nak->segment_list.num_segments = 1; - UtAssert_VOIDCALL(CF_CFDP_S2_Nak(t, ph)); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error, 2); + UtAssert_VOIDCALL(CF_CFDP_S2_Nak(txn, ph)); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error, 2); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_PDU_NAK); } void Test_CF_CFDP_S2_Nak_Arm(void) { /* Test case for: - * void CF_CFDP_S2_Nak_Arm(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_S2_Nak_Arm(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S2_Nak_Arm(t, ph)); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S2_Nak_Arm(txn, ph)); } void Test_CF_CFDP_S2_WaitForEofAck(void) { /* Test case for: - * void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_S2_WaitForEofAck(t, ph)); - UtAssert_UINT32_EQ(t->state_data.s.sub_state, CF_TxSubState_WAIT_FOR_FIN); - UtAssert_BOOL_FALSE(t->flags.com.ack_timer_armed); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_S2_WaitForEofAck(txn, ph)); + UtAssert_UINT32_EQ(txn->state_data.send.sub_state, CF_TxSubState_WAIT_FOR_FIN); + UtAssert_BOOL_FALSE(txn->flags.com.ack_timer_armed); /* failure of CF_CFDP_RecvAck */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvAck), 1, -1); - UtAssert_VOIDCALL(CF_CFDP_S2_WaitForEofAck(t, ph)); + UtAssert_VOIDCALL(CF_CFDP_S2_WaitForEofAck(txn, ph)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_S_PDU_EOF); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.error, 1); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.error, 1); /* with error status */ - UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); UT_SetDefaultReturnValue(UT_KEY(CF_TxnStatus_IsError), true); - UtAssert_VOIDCALL(CF_CFDP_S2_WaitForEofAck(t, ph)); + UtAssert_VOIDCALL(CF_CFDP_S2_WaitForEofAck(txn, ph)); UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); } diff --git a/unit-test/cf_cfdp_sbintf_tests.c b/unit-test/cf_cfdp_sbintf_tests.c index bf926adb..1e1d7df2 100644 --- a/unit-test/cf_cfdp_sbintf_tests.c +++ b/unit-test/cf_cfdp_sbintf_tests.c @@ -211,31 +211,31 @@ void cf_cfdp_tests_Teardown(void) void Test_CF_CFDP_ReceiveMessage(void) { /* Test case for: - * void CF_CFDP_ReceiveMessage(CF_Channel_t *c); + * void CF_CFDP_ReceiveMessage(CF_Channel_t *chan); */ - CF_Channel_t * c; + CF_Channel_t * chan; CF_ConfigTable_t * config; - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; CFE_MSG_Type_t msg_type = CFE_MSG_Type_Tlm; size_t * msg_size_buf; /* no-config - the max per wakeup will be 0, and this is a noop */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, &c, NULL, NULL, NULL); - UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, &chan, NULL, NULL, NULL); + UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(chan)); /* failure in CFE_SB_ReceiveBuffer */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, &c, NULL, NULL, &config); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, &chan, NULL, NULL, &config); config->chan[UT_CFDP_CHANNEL].rx_max_messages_per_wakeup = 1; UT_SetDeferredRetcode(UT_KEY(CFE_SB_ReceiveBuffer), 1, CFE_SB_NO_MESSAGE); - UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); + UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(chan)); /* Set up with a zero size input message, this should fail decoding */ msg_size_buf = 0; UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvPh), 1, -1); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &msg_size_buf, sizeof(msg_size_buf), false); UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &msg_type, sizeof(msg_type), false); - UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); + UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(chan)); UT_ResetState(UT_KEY(CF_CFDP_RecvPh)); UT_ResetState(UT_KEY(CFE_MSG_GetSize)); UT_ResetState(UT_KEY(CFE_MSG_GetType)); @@ -245,84 +245,84 @@ void Test_CF_CFDP_ReceiveMessage(void) * - CF_FindTransactionBySequenceNumber() returns NULL * - CF_CFDP_FindUnusedTransaction() needs to return non-NULL */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, NULL, &c, NULL, &t, &config); - UT_SetHandlerFunction(UT_KEY(CF_FindUnusedTransaction), UT_AltHandler_GenericPointerReturn, t); - UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, NULL, &chan, NULL, &txn, &config); + UT_SetHandlerFunction(UT_KEY(CF_FindUnusedTransaction), UT_AltHandler_GenericPointerReturn, txn); + UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(chan)); UtAssert_STUB_COUNT(CF_CFDP_DispatchRecv, 1); /* should be dispatched */ - UtAssert_UINT32_EQ(t->history->dir, CF_Direction_RX); - UtAssert_UINT32_EQ(t->state_data.r.r2.dc, CF_CFDP_FinDeliveryCode_INCOMPLETE); - UtAssert_UINT32_EQ(t->state_data.r.r2.fs, CF_CFDP_FinFileStatus_DISCARDED); + UtAssert_UINT32_EQ(txn->history->dir, CF_Direction_RX); + UtAssert_UINT32_EQ(txn->state_data.receive.r2.dc, CF_CFDP_FinDeliveryCode_INCOMPLETE); + UtAssert_UINT32_EQ(txn->state_data.receive.r2.fs, CF_CFDP_FinFileStatus_DISCARDED); /* failure in CF_CFDP_RecvPh - nothing really happens here */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, NULL, &c, NULL, &t, &config); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, NULL, &chan, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvPh), 1, -1); - UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); + UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(chan)); /* Test the path where the function recieves a telemetry packet on it's pipe */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, NULL, &c, NULL, &t, &config); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, NULL, &chan, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvPh), 1, -1); /* Override message type to take the command branch of the if then/else clause */ UT_ResetState(UT_KEY(CFE_MSG_GetType)); /* clears the previous cmd type */ UT_SetDataBuffer(UT_KEY(CFE_MSG_GetType), &msg_type, sizeof(msg_type), false); - UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); + UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(chan)); /* * - CF_CFDP_RecvPh() succeeds * - CF_FindTransactionBySequenceNumber() returns non-NULL */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, NULL, &c, NULL, &t, &config); - t->state = CF_TxnState_R2; - UT_SetHandlerFunction(UT_KEY(CF_FindTransactionBySequenceNumber), UT_AltHandler_GenericPointerReturn, t); - UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, NULL, &chan, NULL, &txn, &config); + txn->state = CF_TxnState_R2; + UT_SetHandlerFunction(UT_KEY(CF_FindTransactionBySequenceNumber), UT_AltHandler_GenericPointerReturn, txn); + UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(chan)); UtAssert_STUB_COUNT(CF_CFDP_DispatchRecv, 2); /* should be dispatched */ UT_ResetState(UT_KEY(CF_FindTransactionBySequenceNumber)); /* clears it */ /* FIN handling special case */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, &c, NULL, &t, &config); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, &chan, NULL, &txn, &config); config->local_eid = 123; ph->pdu_header.source_eid = config->local_eid; ph->fdirective.directive_code = CF_CFDP_FileDirective_FIN; - c->cur = t; - UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious, 1); + chan->cur = txn; + UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(chan)); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.spurious, 1); UtAssert_STUB_COUNT(CF_CFDP_SendAck, 1); - UtAssert_NULL(c->cur); /* cleared */ + UtAssert_NULL(chan->cur); /* cleared */ /* FIN handling special case, but failure of CF_CFDP_RecvFin */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, &c, NULL, &t, &config); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, &chan, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_RecvFin), 1, -1); config->local_eid = 123; ph->pdu_header.source_eid = config->local_eid; ph->fdirective.directive_code = CF_CFDP_FileDirective_FIN; - UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious, 1); /* no increment */ + UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(chan)); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.spurious, 1); /* no increment */ UtAssert_STUB_COUNT(CF_CFDP_SendAck, 1); /* no increment */ - UtAssert_NULL(c->cur); /* cleared */ + UtAssert_NULL(chan->cur); /* cleared */ /* FIN handling special case, but failure of CF_CFDP_SendAck */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, &c, NULL, &t, &config); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, &chan, NULL, &txn, &config); UT_SetDeferredRetcode(UT_KEY(CF_CFDP_SendAck), 1, CF_SEND_PDU_NO_BUF_AVAIL_ERROR); config->local_eid = 123; ph->pdu_header.source_eid = config->local_eid; ph->fdirective.directive_code = CF_CFDP_FileDirective_FIN; - c->cur = t; - UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); - UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[t->chan_num].counters.recv.spurious, 2); /* this does get increment */ - UtAssert_ADDRESS_EQ(c->cur, t); /* not changed */ + chan->cur = txn; + UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(chan)); + UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[txn->chan_num].counters.recv.spurious, 2); /* this does get increment */ + UtAssert_ADDRESS_EQ(chan->cur, txn); /* not changed */ /* recv but not the correct destination_eid */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, &c, NULL, &t, &config); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, &chan, NULL, &txn, &config); config->local_eid = 123; ph->pdu_header.destination_eid = ~config->local_eid; - UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); + UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(chan)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_INVALID_DST_EID); /* recv correct destination_eid but CF_MAX_SIMULTANEOUS_RX hit */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, &c, NULL, &t, &config); - CF_AppData.hk.channel_hk[t->chan_num].q_size[CF_QueueIdx_RX] = CF_MAX_SIMULTANEOUS_RX; + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, &chan, NULL, &txn, &config); + CF_AppData.hk.channel_hk[txn->chan_num].q_size[CF_QueueIdx_RX] = CF_MAX_SIMULTANEOUS_RX; config->local_eid = 123; ph->pdu_header.destination_eid = config->local_eid; - UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); + UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(chan)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_RX_DROPPED); } @@ -344,59 +344,59 @@ void Test_CF_CFDP_Send(void) void Test_CF_CFDP_MsgOutGet(void) { /* Test case for: - CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *t, bool silent) + CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *txn, bool silent) */ - CF_Transaction_t *t; + CF_Transaction_t *txn; CF_ConfigTable_t *config; - CF_Channel_t * c; + CF_Channel_t * chan; /* nominal */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_NOT_NULL(CF_CFDP_MsgOutGet(t, false)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_NOT_NULL(CF_CFDP_MsgOutGet(txn, false)); UtAssert_STUB_COUNT(CFE_SB_ReleaseMessageBuffer, 0); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); /* This should discard the old message, and get a new one */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_NOT_NULL(CF_CFDP_MsgOutGet(t, false)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_NOT_NULL(CF_CFDP_MsgOutGet(txn, false)); UtAssert_STUB_COUNT(CFE_SB_ReleaseMessageBuffer, 1); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); /* test the various throttling mechanisms */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, &config); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, &config); config->chan[UT_CFDP_CHANNEL].max_outgoing_messages_per_wakeup = 3; - UtAssert_NOT_NULL(CF_CFDP_MsgOutGet(t, false)); - UtAssert_NULL(CF_CFDP_MsgOutGet(t, false)); + UtAssert_NOT_NULL(CF_CFDP_MsgOutGet(txn, false)); + UtAssert_NULL(CF_CFDP_MsgOutGet(txn, false)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &c, NULL, &t, NULL); - c->sem_id = OS_ObjectIdFromInteger(123); - UtAssert_NOT_NULL(CF_CFDP_MsgOutGet(t, false)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &chan, NULL, &txn, NULL); + chan->sem_id = OS_ObjectIdFromInteger(123); + UtAssert_NOT_NULL(CF_CFDP_MsgOutGet(txn, false)); UT_SetDeferredRetcode(UT_KEY(OS_CountSemTimedWait), 1, OS_ERROR_TIMEOUT); - UtAssert_NULL(CF_CFDP_MsgOutGet(t, false)); + UtAssert_NULL(CF_CFDP_MsgOutGet(txn, false)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); /* transaction is suspended */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - t->flags.com.suspended = 1; - UtAssert_NULL(CF_CFDP_MsgOutGet(t, false)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + txn->flags.com.suspended = 1; + UtAssert_NULL(CF_CFDP_MsgOutGet(txn, false)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); /* channel is frozen */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].frozen = 1; - UtAssert_NULL(CF_CFDP_MsgOutGet(t, false)); + UtAssert_NULL(CF_CFDP_MsgOutGet(txn, false)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].frozen = 0; /* no msg available from SB */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - UtAssert_NULL(CF_CFDP_MsgOutGet(t, false)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_NULL(CF_CFDP_MsgOutGet(txn, false)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_NO_MSG); /* same, but the silent flag should suppress the event */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - UtAssert_NULL(CF_CFDP_MsgOutGet(t, true)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_NULL(CF_CFDP_MsgOutGet(txn, true)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } diff --git a/unit-test/cf_cfdp_tests.c b/unit-test/cf_cfdp_tests.c index d17d8c16..e1ffde5f 100644 --- a/unit-test/cf_cfdp_tests.c +++ b/unit-test/cf_cfdp_tests.c @@ -239,15 +239,15 @@ void Test_CF_CFDP_CF_CFDP_DecodeStart(void) void Test_CF_CFDP_ArmAckTimer(void) { /* Test case for: - * void CF_CFDP_ArmAckTimer(CF_Transaction_t *t) + * void CF_CFDP_ArmAckTimer(CF_Transaction_t *txn) */ - CF_Transaction_t *t; + CF_Transaction_t *txn; CF_ConfigTable_t *config; - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, &config); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, &config); /* nominal call */ - UtAssert_VOIDCALL(CF_CFDP_ArmAckTimer(t)); + UtAssert_VOIDCALL(CF_CFDP_ArmAckTimer(txn)); } void Test_CF_CFDP_RecvPh(void) @@ -288,191 +288,191 @@ void Test_CF_CFDP_RecvPh(void) void Test_CF_CFDP_RecvMd(void) { /* Test case for: - * int CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) + * int CF_CFDP_RecvMd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) */ - CF_Transaction_t * t; - CF_History_t * h; + CF_Transaction_t * txn; + CF_History_t * history; CF_Logical_PduBuffer_t *ph; CF_Logical_PduMd_t * md; const char src[] = "mds"; const char dest[] = "mdd"; /* nominal call */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &h, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &history, &txn, NULL); md = &ph->int_header.md; md->size = 10; md->dest_filename.length = sizeof(dest) - 1; md->dest_filename.data_ptr = dest; md->source_filename.length = sizeof(src) - 1; md->source_filename.data_ptr = src; - UtAssert_INT32_EQ(CF_CFDP_RecvMd(t, ph), 0); - UtAssert_UINT32_EQ(t->fsize, md->size); - UtAssert_STRINGBUF_EQ(md->dest_filename.data_ptr, md->dest_filename.length, h->fnames.dst_filename, - sizeof(h->fnames.dst_filename)); - UtAssert_STRINGBUF_EQ(md->source_filename.data_ptr, md->source_filename.length, h->fnames.src_filename, - sizeof(h->fnames.src_filename)); + UtAssert_INT32_EQ(CF_CFDP_RecvMd(txn, ph), 0); + UtAssert_UINT32_EQ(txn->fsize, md->size); + UtAssert_STRINGBUF_EQ(md->dest_filename.data_ptr, md->dest_filename.length, history->fnames.dst_filename, + sizeof(history->fnames.dst_filename)); + UtAssert_STRINGBUF_EQ(md->source_filename.data_ptr, md->source_filename.length, history->fnames.src_filename, + sizeof(history->fnames.src_filename)); /* decode errors: fixed part */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); CF_CODEC_SET_DONE(ph->pdec); - UtAssert_INT32_EQ(CF_CFDP_RecvMd(t, ph), CF_PDU_METADATA_ERROR); + UtAssert_INT32_EQ(CF_CFDP_RecvMd(txn, ph), CF_PDU_METADATA_ERROR); UT_CF_AssertEventID(CF_EID_ERR_PDU_MD_SHORT); /* decode errors: LV dest filename too long */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); md = &ph->int_header.md; md->dest_filename.length = CF_FILENAME_MAX_LEN + 1; - UtAssert_INT32_EQ(CF_CFDP_RecvMd(t, ph), CF_PDU_METADATA_ERROR); + UtAssert_INT32_EQ(CF_CFDP_RecvMd(txn, ph), CF_PDU_METADATA_ERROR); UT_CF_AssertEventID(CF_EID_ERR_PDU_INVALID_DST_LEN); /* decode errors: LV source filename too long */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); md = &ph->int_header.md; md->source_filename.length = CF_FILENAME_MAX_LEN + 1; - UtAssert_INT32_EQ(CF_CFDP_RecvMd(t, ph), CF_PDU_METADATA_ERROR); + UtAssert_INT32_EQ(CF_CFDP_RecvMd(txn, ph), CF_PDU_METADATA_ERROR); UT_CF_AssertEventID(CF_EID_ERR_PDU_INVALID_SRC_LEN); } void Test_CF_CFDP_RecvFd(void) { /* Test case for: - * int CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) + * int CF_CFDP_RecvFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal call, no CRC */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_RecvFd(t, ph), 0); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_RecvFd(txn, ph), 0); /* nominal call, with CRC */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); ph->pdu_header.crc_flag = 1; ph->int_header.fd.data_len = 10 + sizeof(CF_CFDP_uint32_t); - UtAssert_INT32_EQ(CF_CFDP_RecvFd(t, ph), 0); + UtAssert_INT32_EQ(CF_CFDP_RecvFd(txn, ph), 0); UtAssert_UINT32_EQ(ph->int_header.fd.data_len, 10); /* decode errors: fixed part */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); CF_CODEC_SET_DONE(ph->pdec); - UtAssert_INT32_EQ(CF_CFDP_RecvFd(t, ph), CF_SHORT_PDU_ERROR); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_PROTOCOL_ERROR); + UtAssert_INT32_EQ(CF_CFDP_RecvFd(txn, ph), CF_SHORT_PDU_ERROR); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_PROTOCOL_ERROR); UT_CF_AssertEventID(CF_EID_ERR_PDU_FD_SHORT); /* decode errors: CRC part */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); ph->pdu_header.crc_flag = 1; ph->int_header.fd.data_len = sizeof(CF_CFDP_uint32_t) - 1; - UtAssert_INT32_EQ(CF_CFDP_RecvFd(t, ph), CF_SHORT_PDU_ERROR); + UtAssert_INT32_EQ(CF_CFDP_RecvFd(txn, ph), CF_SHORT_PDU_ERROR); UtAssert_BOOL_FALSE(CF_CODEC_IS_OK(ph->pdec)); /* with segment metadata (unimplemented) */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); ph->pdu_header.segment_meta_flag = 1; - UtAssert_INT32_EQ(CF_CFDP_RecvFd(t, ph), CF_ERROR); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_PROTOCOL_ERROR); + UtAssert_INT32_EQ(CF_CFDP_RecvFd(txn, ph), CF_ERROR); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_PROTOCOL_ERROR); UT_CF_AssertEventID(CF_EID_ERR_PDU_FD_UNSUPPORTED); } void Test_CF_CFDP_RecvEof(void) { /* Test case for: - * int CF_CFDP_RecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) + * int CF_CFDP_RecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal call */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_RecvEof(t, ph), 0); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_RecvEof(txn, ph), 0); /* decode errors: fixed part */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); CF_CODEC_SET_DONE(ph->pdec); - UtAssert_INT32_EQ(CF_CFDP_RecvEof(t, ph), CF_SHORT_PDU_ERROR); + UtAssert_INT32_EQ(CF_CFDP_RecvEof(txn, ph), CF_SHORT_PDU_ERROR); UT_CF_AssertEventID(CF_EID_ERR_PDU_EOF_SHORT); } void Test_CF_CFDP_RecvAck(void) { /* Test case for: - * int CF_CFDP_RecvAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) + * int CF_CFDP_RecvAck(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal call */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_RecvAck(t, ph), 0); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_RecvAck(txn, ph), 0); /* decode errors: fixed part */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); CF_CODEC_SET_DONE(ph->pdec); - UtAssert_INT32_EQ(CF_CFDP_RecvAck(t, ph), CF_SHORT_PDU_ERROR); + UtAssert_INT32_EQ(CF_CFDP_RecvAck(txn, ph), CF_SHORT_PDU_ERROR); UT_CF_AssertEventID(CF_EID_ERR_PDU_ACK_SHORT); } void Test_CF_CFDP_RecvFin(void) { /* Test case for: - * int CF_CFDP_RecvFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) + * int CF_CFDP_RecvFin(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal call */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_RecvFin(t, ph), 0); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_RecvFin(txn, ph), 0); /* decode errors: fixed part */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); CF_CODEC_SET_DONE(ph->pdec); - UtAssert_INT32_EQ(CF_CFDP_RecvFin(t, ph), CF_SHORT_PDU_ERROR); + UtAssert_INT32_EQ(CF_CFDP_RecvFin(txn, ph), CF_SHORT_PDU_ERROR); UT_CF_AssertEventID(CF_EID_ERR_PDU_FIN_SHORT); } void Test_CF_CFDP_RecvNak(void) { /* Test case for: - * int CF_CFDP_RecvNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) + * int CF_CFDP_RecvNak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal call */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_RecvNak(t, ph), 0); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_RecvNak(txn, ph), 0); /* decode errors: fixed part */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); CF_CODEC_SET_DONE(ph->pdec); - UtAssert_INT32_EQ(CF_CFDP_RecvNak(t, ph), CF_SHORT_PDU_ERROR); + UtAssert_INT32_EQ(CF_CFDP_RecvNak(txn, ph), CF_SHORT_PDU_ERROR); UT_CF_AssertEventID(CF_EID_ERR_PDU_NAK_SHORT); } void Test_CF_CFDP_RecvDrop(void) { /* Test case for: - * void CF_CFDP_RecvDrop(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_RecvDrop(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; /* nominal call */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_RecvDrop(t, ph)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_RecvDrop(txn, ph)); } void Test_CF_CFDP_RecvIdle(void) { /* Test case for: - * void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + * void CF_CFDP_RecvIdle(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; - CF_History_t * h; + CF_Transaction_t * txn; + CF_History_t * history; CF_Logical_PduBuffer_t *ph; CF_ChunkWrapper_t ut_unused_chunks; @@ -483,46 +483,46 @@ void Test_CF_CFDP_RecvIdle(void) UT_SetHandlerFunction(UT_KEY(CF_CList_Pop), UT_AltHandler_GenericPointerReturn, &ut_unused_chunks.cl_node); /* nominal call, file data, class 1 */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &h, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &history, &txn, NULL); ph->pdu_header.pdu_type = 1; /* follow file data path */ ph->pdu_header.txm_mode = 1; /* class 1 */ - UtAssert_VOIDCALL(CF_CFDP_RecvIdle(t, ph)); - UtAssert_INT32_EQ(t->state, CF_TxnState_DROP); + UtAssert_VOIDCALL(CF_CFDP_RecvIdle(txn, ph)); + UtAssert_INT32_EQ(txn->state, CF_TxnState_DROP); /* nominal call, file data, class 2 */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &h, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &history, &txn, NULL); ph->pdu_header.pdu_type = 1; /* follow file data path */ ph->pdu_header.txm_mode = 0; /* class 2 */ - UtAssert_VOIDCALL(CF_CFDP_RecvIdle(t, ph)); - UtAssert_INT32_EQ(t->state, CF_TxnState_R2); + UtAssert_VOIDCALL(CF_CFDP_RecvIdle(txn, ph)); + UtAssert_INT32_EQ(txn->state, CF_TxnState_R2); /* nominal call, file metadata, class 1 */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &h, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &history, &txn, NULL); ph->fdirective.directive_code = CF_CFDP_FileDirective_METADATA; ph->pdu_header.txm_mode = 1; /* class 1 */ - UtAssert_VOIDCALL(CF_CFDP_RecvIdle(t, ph)); - UtAssert_INT32_EQ(t->state, CF_TxnState_R1); + UtAssert_VOIDCALL(CF_CFDP_RecvIdle(txn, ph)); + UtAssert_INT32_EQ(txn->state, CF_TxnState_R1); /* nominal call, file metadata, class 2 */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &h, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &history, &txn, NULL); ph->fdirective.directive_code = CF_CFDP_FileDirective_METADATA; - UtAssert_VOIDCALL(CF_CFDP_RecvIdle(t, ph)); - UtAssert_INT32_EQ(t->state, CF_TxnState_R2); + UtAssert_VOIDCALL(CF_CFDP_RecvIdle(txn, ph)); + UtAssert_INT32_EQ(txn->state, CF_TxnState_R2); /* decode error in RecvMd */ /* This will proceed to call CF_CFDP_ResetTransaction() which needs * the q_size to be nonzero */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &h, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &history, &txn, NULL); ph->fdirective.directive_code = CF_CFDP_FileDirective_METADATA; CF_CODEC_SET_DONE(ph->pdec); - UtAssert_VOIDCALL(CF_CFDP_RecvIdle(t, ph)); - UtAssert_INT32_EQ(t->state, CF_TxnState_IDLE); + UtAssert_VOIDCALL(CF_CFDP_RecvIdle(txn, ph)); + UtAssert_INT32_EQ(txn->state, CF_TxnState_IDLE); UT_CF_AssertEventID(CF_EID_ERR_CFDP_IDLE_MD); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &h, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, &history, &txn, NULL); ph->fdirective.directive_code = CF_CFDP_FileDirective_INVALID_MIN; - UtAssert_VOIDCALL(CF_CFDP_RecvIdle(t, ph)); - UtAssert_INT32_EQ(t->state, CF_TxnState_IDLE); + UtAssert_VOIDCALL(CF_CFDP_RecvIdle(txn, ph)); + UtAssert_INT32_EQ(txn->state, CF_TxnState_IDLE); UT_CF_AssertEventID(CF_EID_ERR_CFDP_FD_UNHANDLED); } @@ -545,23 +545,23 @@ void Test_CF_CFDP_CopyStringFromLV(void) void Test_CF_CFDP_ConstructPduHeader(void) { /* Test case for: -CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *t, CF_CFDP_FileDirective_t directive_code, +CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *txn, CF_CFDP_FileDirective_t directive_code, CF_EntityId_t src_eid, CF_EntityId_t dst_eid, bool towards_sender, CF_TransactionSeq_t tsn, bool silent); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; CF_Logical_PduHeader_t *hdr; - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - UtAssert_NULL(CF_CFDP_ConstructPduHeader(t, CF_CFDP_FileDirective_ACK, 3, 2, true, 42, false)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_NULL(CF_CFDP_ConstructPduHeader(txn, CF_CFDP_FileDirective_ACK, 3, 2, true, 42, false)); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - UtAssert_NULL(CF_CFDP_ConstructPduHeader(t, CF_CFDP_FileDirective_ACK, 3, 2, true, 42, true)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_NULL(CF_CFDP_ConstructPduHeader(txn, CF_CFDP_FileDirective_ACK, 3, 2, true, 42, true)); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); - t->state = CF_TxnState_S1; - UtAssert_NOT_NULL(CF_CFDP_ConstructPduHeader(t, CF_CFDP_FileDirective_ACK, 3, 2, true, 42, false)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_S1; + UtAssert_NOT_NULL(CF_CFDP_ConstructPduHeader(txn, CF_CFDP_FileDirective_ACK, 3, 2, true, 42, false)); hdr = &ph->pdu_header; UtAssert_UINT32_EQ(hdr->version, 1); UtAssert_UINT32_EQ(hdr->pdu_type, 0); @@ -574,10 +574,10 @@ CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *t, CF UtAssert_UINT32_EQ(hdr->sequence_num, 42); UtAssert_UINT32_EQ(ph->fdirective.directive_code, CF_CFDP_FileDirective_ACK); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_GetValueEncodedSize), 5); - t->state = CF_TxnState_S2; - UtAssert_NOT_NULL(CF_CFDP_ConstructPduHeader(t, 0, 7, 6, false, 44, false)); + txn->state = CF_TxnState_S2; + UtAssert_NOT_NULL(CF_CFDP_ConstructPduHeader(txn, 0, 7, 6, false, 44, false)); hdr = &ph->pdu_header; UtAssert_UINT32_EQ(hdr->version, 1); UtAssert_UINT32_EQ(hdr->pdu_type, 1); @@ -593,62 +593,62 @@ CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *t, CF void Test_CF_CFDP_SendMd(void) { /* Test case for: - CFE_Status_t CF_CFDP_SendMd(CF_Transaction_t *t); + CFE_Status_t CF_CFDP_SendMd(CF_Transaction_t *txn); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; - CF_History_t * h; + CF_History_t * history; CF_Logical_PduMd_t * md; /* setup without a tx message */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_SendMd(t), CF_SEND_PDU_NO_BUF_AVAIL_ERROR); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_SendMd(txn), CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, &h, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, &history, &txn, NULL); md = &ph->int_header.md; - strncpy(h->fnames.dst_filename, "dst1", sizeof(h->fnames.dst_filename)); - strncpy(h->fnames.src_filename, "src1", sizeof(h->fnames.src_filename)); - t->state = CF_TxnState_S1; - t->fsize = 1234; - UtAssert_INT32_EQ(CF_CFDP_SendMd(t), CFE_SUCCESS); - UtAssert_UINT32_EQ(md->size, t->fsize); - UtAssert_STRINGBUF_EQ(md->dest_filename.data_ptr, md->dest_filename.length, h->fnames.dst_filename, - sizeof(h->fnames.dst_filename)); - UtAssert_STRINGBUF_EQ(md->source_filename.data_ptr, md->source_filename.length, h->fnames.src_filename, - sizeof(h->fnames.src_filename)); + strncpy(history->fnames.dst_filename, "dst1", sizeof(history->fnames.dst_filename)); + strncpy(history->fnames.src_filename, "src1", sizeof(history->fnames.src_filename)); + txn->state = CF_TxnState_S1; + txn->fsize = 1234; + UtAssert_INT32_EQ(CF_CFDP_SendMd(txn), CFE_SUCCESS); + UtAssert_UINT32_EQ(md->size, txn->fsize); + UtAssert_STRINGBUF_EQ(md->dest_filename.data_ptr, md->dest_filename.length, history->fnames.dst_filename, + sizeof(history->fnames.dst_filename)); + UtAssert_STRINGBUF_EQ(md->source_filename.data_ptr, md->source_filename.length, history->fnames.src_filename, + sizeof(history->fnames.src_filename)); /* Class 2, also hit maximum string length */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, &h, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, &history, &txn, NULL); md = &ph->int_header.md; - memset(h->fnames.dst_filename, 0xFF, sizeof(h->fnames.dst_filename)); - strncpy(h->fnames.src_filename, "src2", sizeof(h->fnames.src_filename)); - t->state = CF_TxnState_S2; - t->fsize = 5678; - UtAssert_INT32_EQ(CF_CFDP_SendMd(t), CFE_SUCCESS); - UtAssert_UINT32_EQ(md->size, t->fsize); - UtAssert_UINT32_EQ(md->dest_filename.length, sizeof(h->fnames.dst_filename)); - UtAssert_STRINGBUF_EQ(md->source_filename.data_ptr, md->source_filename.length, h->fnames.src_filename, - sizeof(h->fnames.src_filename)); + memset(history->fnames.dst_filename, 0xFF, sizeof(history->fnames.dst_filename)); + strncpy(history->fnames.src_filename, "src2", sizeof(history->fnames.src_filename)); + txn->state = CF_TxnState_S2; + txn->fsize = 5678; + UtAssert_INT32_EQ(CF_CFDP_SendMd(txn), CFE_SUCCESS); + UtAssert_UINT32_EQ(md->size, txn->fsize); + UtAssert_UINT32_EQ(md->dest_filename.length, sizeof(history->fnames.dst_filename)); + UtAssert_STRINGBUF_EQ(md->source_filename.data_ptr, md->source_filename.length, history->fnames.src_filename, + sizeof(history->fnames.src_filename)); } void Test_CF_CFDP_SendFd(void) { /* Test case for: - CFE_Status_t CF_CFDP_SendFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + CFE_Status_t CF_CFDP_SendFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_SendFd(t, ph), CFE_SUCCESS); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_SendFd(txn, ph), CFE_SUCCESS); /* Hit CF_CFDP_SetPduLength condition where final_pos < the header_encoded_length */ ph->pdu_header.header_encoded_length = CF_CODEC_GET_POSITION(ph->penc) + 1; ph->pdu_header.data_encoded_length = 0; - UtAssert_INT32_EQ(CF_CFDP_SendFd(t, ph), CFE_SUCCESS); + UtAssert_INT32_EQ(CF_CFDP_SendFd(txn, ph), CFE_SUCCESS); UtAssert_UINT32_EQ(ph->pdu_header.data_encoded_length, 0); } @@ -656,29 +656,29 @@ void Test_CF_CFDP_SendFd(void) void Test_CF_CFDP_SendEof(void) { /* Test case for: - CFE_Status_t CF_CFDP_SendEof(CF_Transaction_t *t); + CFE_Status_t CF_CFDP_SendEof(CF_Transaction_t *txn); */ - CF_Transaction_t * t; - CF_History_t * h; + CF_Transaction_t * txn; + CF_History_t * history; CF_Logical_PduBuffer_t *ph; CF_Logical_PduEof_t * eof; /* setup without a tx message */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_SendEof(t), CF_SEND_PDU_NO_BUF_AVAIL_ERROR); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_SendEof(txn), CF_SEND_PDU_NO_BUF_AVAIL_ERROR); /* nominal */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); eof = &ph->int_header.eof; - UtAssert_INT32_EQ(CF_CFDP_SendEof(t), CFE_SUCCESS); + UtAssert_INT32_EQ(CF_CFDP_SendEof(txn), CFE_SUCCESS); UtAssert_ZERO(eof->tlv_list.num_tlv); /* test with a transaction error status, which should append a TLV */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, &h, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, &history, &txn, NULL); eof = &ph->int_header.eof; UT_SetDefaultReturnValue(UT_KEY(CF_TxnStatus_To_ConditionCode), CF_CFDP_ConditionCode_FILESTORE_REJECTION); - UtAssert_INT32_EQ(CF_CFDP_SendEof(t), CFE_SUCCESS); + UtAssert_INT32_EQ(CF_CFDP_SendEof(txn), CFE_SUCCESS); UtAssert_UINT32_EQ(eof->tlv_list.num_tlv, 1); UtAssert_STUB_COUNT(CF_CFDP_Send, 2); } @@ -686,25 +686,25 @@ void Test_CF_CFDP_SendEof(void) void Test_CF_CFDP_SendAck(void) { /* Test case for: - CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_CFDP_FileDirective_t dir_code, + CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *txn, CF_CFDP_AckTxnStatus_t ts, CF_CFDP_FileDirective_t dir_code, CF_CFDP_ConditionCode_t cc, CF_EntityId_t peer_eid, CF_TransactionSeq_t tsn); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; CF_Logical_PduAck_t * ack; /* setup without a tx message */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_SendAck(t, CF_CFDP_AckTxnStatus_ACTIVE, CF_CFDP_FileDirective_EOF, + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_SendAck(txn, CF_CFDP_AckTxnStatus_ACTIVE, CF_CFDP_FileDirective_EOF, CF_CFDP_ConditionCode_NO_ERROR, 1, 42), CF_SEND_PDU_NO_BUF_AVAIL_ERROR); /* nominal as receiver */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); ack = &ph->int_header.ack; - t->state = CF_TxnState_R2; - UtAssert_INT32_EQ(CF_CFDP_SendAck(t, CF_CFDP_AckTxnStatus_ACTIVE, CF_CFDP_FileDirective_EOF, + txn->state = CF_TxnState_R2; + UtAssert_INT32_EQ(CF_CFDP_SendAck(txn, CF_CFDP_AckTxnStatus_ACTIVE, CF_CFDP_FileDirective_EOF, CF_CFDP_ConditionCode_NO_ERROR, 1, 42), CFE_SUCCESS); UtAssert_UINT32_EQ(ack->ack_directive_code, CF_CFDP_FileDirective_EOF); @@ -713,10 +713,10 @@ void Test_CF_CFDP_SendAck(void) UtAssert_UINT32_EQ(ack->cc, CF_CFDP_ConditionCode_NO_ERROR); /* nominal as sender */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); ack = &ph->int_header.ack; - t->state = CF_TxnState_S2; - UtAssert_INT32_EQ(CF_CFDP_SendAck(t, CF_CFDP_AckTxnStatus_ACTIVE, CF_CFDP_FileDirective_EOF, + txn->state = CF_TxnState_S2; + UtAssert_INT32_EQ(CF_CFDP_SendAck(txn, CF_CFDP_AckTxnStatus_ACTIVE, CF_CFDP_FileDirective_EOF, CF_CFDP_ConditionCode_NO_ERROR, 1, 42), CFE_SUCCESS); UtAssert_UINT32_EQ(ack->ack_directive_code, CF_CFDP_FileDirective_EOF); @@ -725,10 +725,10 @@ void Test_CF_CFDP_SendAck(void) UtAssert_UINT32_EQ(ack->cc, CF_CFDP_ConditionCode_NO_ERROR); /* still success path but with non-nominal values */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); ack = &ph->int_header.ack; - t->state = CF_TxnState_R2; - UtAssert_INT32_EQ(CF_CFDP_SendAck(t, CF_CFDP_AckTxnStatus_TERMINATED, CF_CFDP_FileDirective_FIN, + txn->state = CF_TxnState_R2; + UtAssert_INT32_EQ(CF_CFDP_SendAck(txn, CF_CFDP_AckTxnStatus_TERMINATED, CF_CFDP_FileDirective_FIN, CF_CFDP_ConditionCode_FILESTORE_REJECTION, 1, 42), CFE_SUCCESS); UtAssert_UINT32_EQ(ack->ack_directive_code, CF_CFDP_FileDirective_FIN); @@ -740,24 +740,24 @@ void Test_CF_CFDP_SendAck(void) void Test_CF_CFDP_SendFin(void) { /* Test case for: - CFE_Status_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, + CFE_Status_t CF_CFDP_SendFin(CF_Transaction_t *txn, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, CF_CFDP_ConditionCode_t cc); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; CF_Logical_PduFin_t * fin; /* setup without a tx message */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_SendFin(t, CF_CFDP_FinDeliveryCode_COMPLETE, CF_CFDP_FinFileStatus_RETAINED, + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_SendFin(txn, CF_CFDP_FinDeliveryCode_COMPLETE, CF_CFDP_FinFileStatus_RETAINED, CF_CFDP_ConditionCode_NO_ERROR), CF_SEND_PDU_NO_BUF_AVAIL_ERROR); /* nominal */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); fin = &ph->int_header.fin; - UtAssert_INT32_EQ(CF_CFDP_SendFin(t, CF_CFDP_FinDeliveryCode_COMPLETE, CF_CFDP_FinFileStatus_RETAINED, + UtAssert_INT32_EQ(CF_CFDP_SendFin(txn, CF_CFDP_FinDeliveryCode_COMPLETE, CF_CFDP_FinFileStatus_RETAINED, CF_CFDP_ConditionCode_NO_ERROR), CFE_SUCCESS); UtAssert_ZERO(fin->tlv_list.num_tlv); @@ -766,9 +766,9 @@ void Test_CF_CFDP_SendFin(void) UtAssert_UINT32_EQ(fin->cc, CF_CFDP_ConditionCode_NO_ERROR); /* test with an alternate condition code, which should append a TLV */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); fin = &ph->int_header.fin; - UtAssert_INT32_EQ(CF_CFDP_SendFin(t, CF_CFDP_FinDeliveryCode_INCOMPLETE, CF_CFDP_FinFileStatus_DISCARDED, + UtAssert_INT32_EQ(CF_CFDP_SendFin(txn, CF_CFDP_FinDeliveryCode_INCOMPLETE, CF_CFDP_FinFileStatus_DISCARDED, CF_CFDP_ConditionCode_FILESTORE_REJECTION), CFE_SUCCESS); UtAssert_UINT32_EQ(fin->delivery_code, CF_CFDP_FinDeliveryCode_INCOMPLETE); @@ -781,17 +781,17 @@ void Test_CF_CFDP_SendFin(void) void Test_CF_CFDP_SendNak(void) { /* Test case for: - CFE_Status_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + CFE_Status_t CF_CFDP_SendNak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, &ph, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_SendNak(t, ph), CF_SEND_PDU_NO_BUF_AVAIL_ERROR); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, &ph, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_SendNak(txn, ph), CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); - t->state = CF_TxnState_S2; - UtAssert_INT32_EQ(CF_CFDP_SendNak(t, ph), CFE_SUCCESS); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_S2; + UtAssert_INT32_EQ(CF_CFDP_SendNak(txn, ph), CFE_SUCCESS); UtAssert_STUB_COUNT(CF_CFDP_Send, 1); } @@ -829,17 +829,17 @@ void Test_CF_CFDP_AppendTlv(void) void Test_CF_CFDP_FindUnusedTransaction(void) { /* Test case for: - CF_Transaction_t *CF_CFDP_FindUnusedTransaction(CF_Channel_t *c) + CF_Transaction_t *CF_CFDP_FindUnusedTransaction(CF_Channel_t *chan) */ - CF_Transaction_t * t; + CF_Transaction_t * txn; CF_Logical_PduBuffer_t *ph; - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, &ph, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_SendNak(t, ph), CF_SEND_PDU_NO_BUF_AVAIL_ERROR); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, &ph, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_SendNak(txn, ph), CF_SEND_PDU_NO_BUF_AVAIL_ERROR); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, NULL); - t->state = CF_TxnState_S2; - UtAssert_INT32_EQ(CF_CFDP_SendNak(t, ph), CFE_SUCCESS); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_S2; + UtAssert_INT32_EQ(CF_CFDP_SendNak(txn, ph), CFE_SUCCESS); UtAssert_STUB_COUNT(CF_CFDP_Send, 1); } @@ -910,9 +910,9 @@ void Test_CF_CFDP_TxFile(void) */ const char src[] = "tsrc"; const char dest[] = "tdest"; - CF_History_t * h; - CF_Transaction_t *t; - CF_Channel_t * c; + CF_History_t * history; + CF_Transaction_t *txn; + CF_Channel_t * chan; CF_ChunkWrapper_t chunk_wrap; memset(&chunk_wrap, 0, sizeof(chunk_wrap)); @@ -920,30 +920,30 @@ void Test_CF_CFDP_TxFile(void) /* nominal call */ /* make sure call to CF_FindUnusedTransaction() returns this buffer */ /* Also need to set up for call to CF_CFDP_FindUnusedChunks which calls CF_CList_Pop */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &c, &h, &t, NULL); - UT_SetHandlerFunction(UT_KEY(CF_FindUnusedTransaction), UT_AltHandler_GenericPointerReturn, t); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &chan, &history, &txn, NULL); + UT_SetHandlerFunction(UT_KEY(CF_FindUnusedTransaction), UT_AltHandler_GenericPointerReturn, txn); UT_SetHandlerFunction(UT_KEY(CF_CList_Pop), UT_AltHandler_GenericPointerReturn, &chunk_wrap.cl_node); - c->cs[CF_Direction_TX] = &chunk_wrap.cl_node; + chan->cs[CF_Direction_TX] = &chunk_wrap.cl_node; UtAssert_INT32_EQ(CF_CFDP_TxFile(src, dest, CF_CFDP_CLASS_1, 1, UT_CFDP_CHANNEL, 0, 1), 0); - UtAssert_STRINGBUF_EQ(dest, -1, h->fnames.dst_filename, sizeof(h->fnames.dst_filename)); - UtAssert_STRINGBUF_EQ(src, -1, h->fnames.src_filename, sizeof(h->fnames.src_filename)); - UtAssert_UINT32_EQ(c->num_cmd_tx, 1); + UtAssert_STRINGBUF_EQ(dest, -1, history->fnames.dst_filename, sizeof(history->fnames.dst_filename)); + UtAssert_STRINGBUF_EQ(src, -1, history->fnames.src_filename, sizeof(history->fnames.src_filename)); + UtAssert_UINT32_EQ(chan->num_cmd_tx, 1); UT_CF_AssertEventID(CF_EID_INF_CFDP_S_START_SEND); /* same but for class 2 (for branch coverage) */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &c, &h, &t, NULL); - UT_SetHandlerFunction(UT_KEY(CF_FindUnusedTransaction), UT_AltHandler_GenericPointerReturn, t); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &chan, &history, &txn, NULL); + UT_SetHandlerFunction(UT_KEY(CF_FindUnusedTransaction), UT_AltHandler_GenericPointerReturn, txn); UT_SetHandlerFunction(UT_KEY(CF_CList_Pop), UT_AltHandler_GenericPointerReturn, &chunk_wrap.cl_node); - c->cs[CF_Direction_TX] = &chunk_wrap.cl_node; + chan->cs[CF_Direction_TX] = &chunk_wrap.cl_node; UtAssert_INT32_EQ(CF_CFDP_TxFile(src, dest, CF_CFDP_CLASS_2, 1, UT_CFDP_CHANNEL, 0, 1), 0); - UtAssert_STRINGBUF_EQ(dest, -1, h->fnames.dst_filename, sizeof(h->fnames.dst_filename)); - UtAssert_STRINGBUF_EQ(src, -1, h->fnames.src_filename, sizeof(h->fnames.src_filename)); - UtAssert_UINT32_EQ(c->num_cmd_tx, 2); + UtAssert_STRINGBUF_EQ(dest, -1, history->fnames.dst_filename, sizeof(history->fnames.dst_filename)); + UtAssert_STRINGBUF_EQ(src, -1, history->fnames.src_filename, sizeof(history->fnames.src_filename)); + UtAssert_UINT32_EQ(chan->num_cmd_tx, 2); UT_CF_AssertEventID(CF_EID_INF_CFDP_S_START_SEND); /* max TX */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &c, &h, &t, NULL); - c->num_cmd_tx = CF_MAX_COMMANDED_PLAYBACK_FILES_PER_CHAN; + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &chan, &history, &txn, NULL); + chan->num_cmd_tx = CF_MAX_COMMANDED_PLAYBACK_FILES_PER_CHAN; UtAssert_INT32_EQ(CF_CFDP_TxFile(src, dest, CF_CFDP_CLASS_1, 1, UT_CFDP_CHANNEL, 0, 1), -1); UT_CF_AssertEventID(CF_EID_ERR_CFDP_MAX_CMD_TX); } @@ -958,12 +958,12 @@ void Test_CF_CFDP_PlaybackDir(void) const char src[] = "psrc"; const char dest[] = "pdest"; CF_Playback_t *pb; - CF_Channel_t * c; + CF_Channel_t * chan; uint8 i; /* nominal call */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, &c, NULL, NULL, NULL); - pb = &c->playback[0]; + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, &chan, NULL, NULL, NULL); + pb = &chan->playback[0]; memset(pb, 0, sizeof(*pb)); UtAssert_INT32_EQ(CF_CFDP_PlaybackDir(src, dest, CF_CFDP_CLASS_1, 1, UT_CFDP_CHANNEL, 0, 1), 0); UtAssert_STRINGBUF_EQ(dest, -1, pb->fnames.dst_filename, sizeof(pb->fnames.dst_filename)); @@ -978,10 +978,10 @@ void Test_CF_CFDP_PlaybackDir(void) UT_CF_AssertEventID(CF_EID_ERR_CFDP_OPENDIR); /* no non-busy entries */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, &c, NULL, NULL, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, &chan, NULL, NULL, NULL); for (i = 0; i < CF_MAX_COMMANDED_PLAYBACK_DIRECTORIES_PER_CHAN; ++i) { - pb = &c->playback[i]; + pb = &chan->playback[i]; pb->busy = 1; } UtAssert_INT32_EQ(CF_CFDP_PlaybackDir(src, dest, CF_CFDP_CLASS_1, 1, UT_CFDP_CHANNEL, 0, 1), -1); @@ -1004,43 +1004,43 @@ static int32 Ut_Hook_CycleTx_SetRanOne(void *UserObj, int32 StubRetcode, uint32 void Test_CF_CFDP_CycleTx(void) { /* Test case for: - * void CF_CFDP_CycleTx(CF_Channel_t *c) + * void CF_CFDP_CycleTx(CF_Channel_t *chan) */ - CF_Channel_t * c; - CF_Transaction_t *t; + CF_Channel_t * chan; + CF_Transaction_t *txn; CF_ConfigTable_t *config; - CF_Transaction_t t2; + CF_Transaction_t txn2; - memset(&t2, 0, sizeof(t2)); + memset(&txn2, 0, sizeof(txn2)); /* need to set dequeue_enabled so it enters the actual logic */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &c, NULL, &t, &config); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &chan, NULL, &txn, &config); CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[0] = 10; CF_AppData.engine.enabled = 1; config->chan[UT_CFDP_CHANNEL].dequeue_enabled = 1; - /* nominal call, w/c->cur non-null */ - c->cur = t; - UtAssert_VOIDCALL(CF_CFDP_CycleTx(c)); + /* nominal call, w/chan->cur non-null */ + chan->cur = txn; + UtAssert_VOIDCALL(CF_CFDP_CycleTx(chan)); UtAssert_STUB_COUNT(CF_CList_Traverse, 0); - /* nominal call, w/c->cur null, but queue empty */ - UtAssert_VOIDCALL(CF_CFDP_CycleTx(c)); + /* nominal call, w/chan->cur null, but queue empty */ + UtAssert_VOIDCALL(CF_CFDP_CycleTx(chan)); UtAssert_STUB_COUNT(CF_CList_Traverse, 1); - /* nominal call, w/c->cur null, queue not empty */ + /* nominal call, w/chan->cur null, queue not empty */ UT_ResetState(UT_KEY(CF_CList_Traverse)); UT_SetHookFunction(UT_KEY(CF_CList_Traverse), Ut_Hook_CycleTx_SetRanOne, false); - c->qs[CF_QueueIdx_PEND] = &t2.cl_node; - UtAssert_VOIDCALL(CF_CFDP_CycleTx(c)); + chan->qs[CF_QueueIdx_PEND] = &txn2.cl_node; + UtAssert_VOIDCALL(CF_CFDP_CycleTx(chan)); UtAssert_STUB_COUNT(CF_CList_Traverse, 2); } static int32 Ut_Hook_StateHandler_SetQIndex(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context) { - CF_Transaction_t *t = UT_Hook_GetArgValueByName(Context, "t", CF_Transaction_t *); - t->flags.com.q_index = 0; + CF_Transaction_t *txn = UT_Hook_GetArgValueByName(Context, "txn", CF_Transaction_t *); + txn->flags.com.q_index = 0; return StubRetcode; } @@ -1050,41 +1050,41 @@ void Test_CF_CFDP_CycleTxFirstActive(void) int CF_CFDP_CycleTxFirstActive(CF_CListNode_t *node, void *context); */ CF_CFDP_CycleTx_args_t args; - CF_Transaction_t * t; + CF_Transaction_t * txn; memset(&args, 0, sizeof(args)); /* suspended, should return 0 */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->flags.com.suspended = 1; - UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&t->cl_node, &args), 0); - - /* nominal, with c->cur set non-null, should skip loop and return 1 */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.c, NULL, &t, NULL); - t->flags.com.q_index = CF_QueueIdx_TXA; /* must be this */ - args.c->cur = t; - UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&t->cl_node, &args), 1); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->flags.com.suspended = 1; + UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&txn->cl_node, &args), 0); + + /* nominal, with chan->cur set non-null, should skip loop and return 1 */ + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.chan, NULL, &txn, NULL); + txn->flags.com.q_index = CF_QueueIdx_TXA; /* must be this */ + args.chan->cur = txn; + UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&txn->cl_node, &args), 1); UtAssert_BOOL_TRUE(args.ran_one); - /* nominal, with c->cur set null, should do loop and return 1 */ + /* nominal, with chan->cur set null, should do loop and return 1 */ /* will call the handler for this state, which is a stub */ /* need to use a hook function or else this is infinite loop */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->state = CF_TxnState_S1; - t->flags.com.q_index = CF_QueueIdx_TXA; /* must be this */ - args.c->cur = NULL; + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->state = CF_TxnState_S1; + txn->flags.com.q_index = CF_QueueIdx_TXA; /* must be this */ + args.chan->cur = NULL; UT_SetHookFunction(UT_KEY(CF_CFDP_TxStateDispatch), Ut_Hook_StateHandler_SetQIndex, NULL); - UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&t->cl_node, &args), 1); + UtAssert_INT32_EQ(CF_CFDP_CycleTxFirstActive(&txn->cl_node, &args), 1); } -static void DoTickFnClearCont(CF_Transaction_t *t, int *cont) +static void DoTickFnClearCont(CF_Transaction_t *txn, int *cont) { *cont = 0; } -static void DoTickFnSetCur(CF_Transaction_t *t, int *cont) +static void DoTickFnSetCur(CF_Transaction_t *txn, int *cont) { - CF_AppData.engine.channels[t->chan_num].cur = t; + CF_AppData.engine.channels[txn->chan_num].cur = txn; } void Test_CF_CFDP_DoTick(void) @@ -1092,78 +1092,78 @@ void Test_CF_CFDP_DoTick(void) /* Test case for: * int CF_CFDP_DoTick(CF_CListNode_t *node, void *context); */ - CF_Transaction_t * t; - CF_Transaction_t t2; + CF_Transaction_t * txn; + CF_Transaction_t txn2; CF_CFDP_Tick_args_t args; memset(&args, 0, sizeof(args)); - memset(&t2, 0, sizeof(t2)); + memset(&txn2, 0, sizeof(txn2)); args.fn = DoTickFnClearCont; - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.c, NULL, &t, NULL); - args.c->cur = &t2; + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.chan, NULL, &txn, NULL); + args.chan->cur = &txn2; args.cont = true; - UtAssert_INT32_EQ(CF_CFDP_DoTick(&t->cl_node, &args), CF_CLIST_CONT); + UtAssert_INT32_EQ(CF_CFDP_DoTick(&txn->cl_node, &args), CF_CLIST_CONT); UtAssert_BOOL_TRUE(args.cont); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.c, NULL, &t, NULL); - args.c->cur = t; - UtAssert_INT32_EQ(CF_CFDP_DoTick(&t->cl_node, &args), CF_CLIST_CONT); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.chan, NULL, &txn, NULL); + args.chan->cur = txn; + UtAssert_INT32_EQ(CF_CFDP_DoTick(&txn->cl_node, &args), CF_CLIST_CONT); UtAssert_BOOL_FALSE(args.cont); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.c, NULL, &t, NULL); - t->flags.com.suspended = 1; + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.chan, NULL, &txn, NULL); + txn->flags.com.suspended = 1; args.cont = true; - UtAssert_INT32_EQ(CF_CFDP_DoTick(&t->cl_node, &args), CF_CLIST_CONT); + UtAssert_INT32_EQ(CF_CFDP_DoTick(&txn->cl_node, &args), CF_CLIST_CONT); UtAssert_BOOL_TRUE(args.cont); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.c, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.chan, NULL, &txn, NULL); args.fn = DoTickFnSetCur; - UtAssert_INT32_EQ(CF_CFDP_DoTick(&t->cl_node, &args), CF_CLIST_EXIT); + UtAssert_INT32_EQ(CF_CFDP_DoTick(&txn->cl_node, &args), CF_CLIST_EXIT); UtAssert_BOOL_TRUE(args.early_exit); } void Test_CF_CFDP_ProcessPollingDirectories(void) { /* Test case for: - * void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c) + * void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *chan) */ - CF_Channel_t * c; + CF_Channel_t * chan; CF_ConfigTable_t *config; CF_PollDir_t * pdcfg; CF_Poll_t * poll; - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &c, NULL, NULL, &config); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &chan, NULL, NULL, &config); pdcfg = &config->chan[UT_CFDP_CHANNEL].polldir[0]; - poll = &c->poll[0]; + poll = &chan->poll[0]; /* nominal call, polldir disabled (noop) */ - UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); + UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(chan)); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].poll_counter, 0); /* nominal call, polldir enabled but interval_sec == 0 */ /* Will tick because CF_Timer_Expired stub returns 0 by default (not expired) */ pdcfg->enabled = 1; - UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); + UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(chan)); UtAssert_BOOL_FALSE(poll->timer_set); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].poll_counter, 1); UtAssert_STUB_COUNT(CF_Timer_Tick, 1); /* with interval_sec nonzero the timer should get set, but not tick */ pdcfg->interval_sec = 1; - UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); + UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(chan)); UtAssert_BOOL_TRUE(poll->timer_set); UtAssert_STUB_COUNT(CF_Timer_Tick, 1); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].poll_counter, 1); /* call again should tick */ - UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); + UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(chan)); UtAssert_BOOL_TRUE(poll->timer_set); UtAssert_STUB_COUNT(CF_Timer_Tick, 2); /* call again timer should expire and start a playback */ UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, true); - UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); + UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(chan)); UtAssert_BOOL_FALSE(poll->timer_set); UtAssert_BOOL_TRUE(poll->pb.busy); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].poll_counter, 1); @@ -1173,7 +1173,7 @@ void Test_CF_CFDP_ProcessPollingDirectories(void) poll->timer_set = true; UT_SetDeferredRetcode(UT_KEY(CF_Timer_Expired), 1, true); UT_SetDeferredRetcode(UT_KEY(OS_DirectoryOpen), 1, OS_ERROR); - UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); + UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(chan)); UtAssert_BOOL_TRUE(poll->timer_set); UT_CF_AssertEventID(CF_EID_ERR_CFDP_OPENDIR); @@ -1185,28 +1185,28 @@ void Test_CF_CFDP_ProcessPollingDirectories(void) poll->pb.busy = false; poll->pb.diropen = false; poll->pb.num_ts = 1; - UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); + UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(chan)); UtAssert_BOOL_FALSE(poll->pb.busy); poll->pb.busy = true; poll->pb.num_ts = 0; - UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); + UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(chan)); UtAssert_BOOL_FALSE(poll->pb.busy); /* because num_ts == 0 */ /* test that call to CF_CFDP_UpdatePollPbCounted will decrement back to 0 again */ pdcfg->enabled = 0; - UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(c)); + UtAssert_VOIDCALL(CF_CFDP_ProcessPollingDirectories(chan)); UtAssert_UINT32_EQ(CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].poll_counter, 0); } void Test_CF_CFDP_ProcessPlaybackDirectory(void) { /* Test case for: - * void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p) + * void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *chan, CF_Playback_t *pb) */ - CF_Transaction_t *t; - CF_History_t * h; - CF_Channel_t * c; + CF_Transaction_t *txn; + CF_History_t * history; + CF_Channel_t * chan; CF_ConfigTable_t *config; CF_Playback_t pb; os_dirent_t dirent[3]; @@ -1215,14 +1215,14 @@ void Test_CF_CFDP_ProcessPlaybackDirectory(void) memset(&chunk_wrap, 0, sizeof(chunk_wrap)); memset(&pb, 0, sizeof(pb)); memset(dirent, 0, sizeof(dirent)); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, &c, &h, &t, &config); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, &chan, &history, &txn, &config); CF_AppData.engine.enabled = 1; /* diropen is true but num_ts is high so operations are restricted */ pb.busy = 1; pb.num_ts = CF_NUM_TRANSACTIONS_PER_PLAYBACK + 1; pb.diropen = true; - UtAssert_VOIDCALL(CF_CFDP_ProcessPlaybackDirectory(c, &pb)); + UtAssert_VOIDCALL(CF_CFDP_ProcessPlaybackDirectory(chan, &pb)); UtAssert_BOOL_TRUE(pb.busy); UtAssert_BOOL_TRUE(pb.diropen); @@ -1235,7 +1235,7 @@ void Test_CF_CFDP_ProcessPlaybackDirectory(void) pb.num_ts = 0; OS_DirectoryOpen(&pb.dir_id, "ut"); UT_SetDeferredRetcode(UT_KEY(OS_DirectoryRead), 1, OS_ERROR); - UtAssert_VOIDCALL(CF_CFDP_ProcessPlaybackDirectory(c, &pb)); + UtAssert_VOIDCALL(CF_CFDP_ProcessPlaybackDirectory(chan, &pb)); UtAssert_STUB_COUNT(OS_DirectoryClose, 1); UtAssert_BOOL_FALSE(pb.busy); UtAssert_BOOL_FALSE(pb.diropen); @@ -1256,14 +1256,14 @@ void Test_CF_CFDP_ProcessPlaybackDirectory(void) OS_DirectoryOpen(&pb.dir_id, "ut"); UT_SetDataBuffer(UT_KEY(OS_DirectoryRead), dirent, sizeof(dirent), false); UT_SetDeferredRetcode(UT_KEY(OS_DirectoryRead), 4, OS_ERROR); /* end of dir */ - UT_SetHandlerFunction(UT_KEY(CF_FindUnusedTransaction), UT_AltHandler_GenericPointerReturn, t); + UT_SetHandlerFunction(UT_KEY(CF_FindUnusedTransaction), UT_AltHandler_GenericPointerReturn, txn); UT_SetHandlerFunction(UT_KEY(CF_CList_Pop), UT_AltHandler_GenericPointerReturn, &chunk_wrap.cl_node); - c->cs[CF_Direction_TX] = &chunk_wrap.cl_node; - UtAssert_VOIDCALL(CF_CFDP_ProcessPlaybackDirectory(c, &pb)); + chan->cs[CF_Direction_TX] = &chunk_wrap.cl_node; + UtAssert_VOIDCALL(CF_CFDP_ProcessPlaybackDirectory(chan, &pb)); UtAssert_BOOL_TRUE(pb.busy); UtAssert_BOOL_FALSE(pb.diropen); - UtAssert_STRINGBUF_EQ(h->fnames.src_filename, sizeof(h->fnames.src_filename), "/ut", -1); - UtAssert_STRINGBUF_EQ(h->fnames.dst_filename, sizeof(h->fnames.dst_filename), "/ut", -1); + UtAssert_STRINGBUF_EQ(history->fnames.src_filename, sizeof(history->fnames.src_filename), "/ut", -1); + UtAssert_STRINGBUF_EQ(history->fnames.dst_filename, sizeof(history->fnames.dst_filename), "/ut", -1); UT_CF_AssertEventID(CF_EID_INF_CFDP_S_START_SEND); } @@ -1298,33 +1298,33 @@ static int32 Ut_Hook_TickTransactions_SetCont(void *UserObj, int32 StubRetcode, void Test_CF_CFDP_TickTransactions(void) { /* Test case for: - void CF_CFDP_TickTransactions(CF_Channel_t *c); + void CF_CFDP_TickTransactions(CF_Channel_t *chan); */ - CF_Channel_t *c; + CF_Channel_t *chan; /* nominal */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &c, NULL, NULL, NULL); - UtAssert_VOIDCALL(CF_CFDP_TickTransactions(c)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &chan, NULL, NULL, NULL); + UtAssert_VOIDCALL(CF_CFDP_TickTransactions(chan)); UtAssert_STUB_COUNT(CF_CList_Traverse, CF_TickType_NUM_TYPES); - UtAssert_UINT32_EQ(c->tick_type, CF_TickType_RX); + UtAssert_UINT32_EQ(chan->tick_type, CF_TickType_RX); /* invoke "early exit" block via hook */ /* The flag is set on the second call, so this should increment tick_type */ UT_ResetState(UT_KEY(CF_CList_Traverse)); UT_SetHookFunction(UT_KEY(CF_CList_Traverse), Ut_Hook_TickTransactions_SetEarlyExit, NULL); - UtAssert_VOIDCALL(CF_CFDP_TickTransactions(c)); - UtAssert_UINT32_EQ(c->tick_type, CF_TickType_TXW_NORM); + UtAssert_VOIDCALL(CF_CFDP_TickTransactions(chan)); + UtAssert_UINT32_EQ(chan->tick_type, CF_TickType_TXW_NORM); /* this should resume where it left from the last call, * and then reset the tick_type */ - UtAssert_VOIDCALL(CF_CFDP_TickTransactions(c)); - UtAssert_UINT32_EQ(c->tick_type, CF_TickType_RX); + UtAssert_VOIDCALL(CF_CFDP_TickTransactions(chan)); + UtAssert_UINT32_EQ(chan->tick_type, CF_TickType_RX); UT_ResetState(UT_KEY(CF_CList_Traverse)); UT_SetHookFunction(UT_KEY(CF_CList_Traverse), Ut_Hook_TickTransactions_SetCont, NULL); - UtAssert_VOIDCALL(CF_CFDP_TickTransactions(c)); - UtAssert_UINT32_EQ(c->tick_type, CF_TickType_RX); + UtAssert_VOIDCALL(CF_CFDP_TickTransactions(chan)); + UtAssert_UINT32_EQ(chan->tick_type, CF_TickType_RX); } void Test_CF_CFDP_CycleEngine(void) @@ -1332,10 +1332,10 @@ void Test_CF_CFDP_CycleEngine(void) /* Test case for: * void CF_CFDP_CycleEngine(void) */ - CF_Channel_t *c; + CF_Channel_t *chan; /* nominal with engine disabled, noop */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, &c, NULL, NULL, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, &chan, NULL, NULL, NULL); UtAssert_VOIDCALL(CF_CFDP_CycleEngine()); /* enabled but frozen */ @@ -1350,44 +1350,44 @@ void Test_CF_CFDP_CycleEngine(void) void Test_CF_CFDP_ResetTransaction(void) { /* Test case for: - * void CF_CFDP_ResetTransaction(CF_Transaction_t *t, int keep_history) + * void CF_CFDP_ResetTransaction(CF_Transaction_t *txn, int keep_history) */ - CF_Transaction_t *t; - CF_History_t * h; - CF_Channel_t * c; + CF_Transaction_t *txn; + CF_History_t * history; + CF_Channel_t * chan; CF_Playback_t pb; memset(&pb, 0, sizeof(pb)); /* nominal call */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[t->flags.com.q_index] = 10; - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(t, 1)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[txn->flags.com.q_index] = 10; + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 1)); UtAssert_STUB_COUNT(CF_FreeTransaction, 1); UT_ResetState(UT_KEY(CF_FreeTransaction)); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, &h, &t, NULL); - t->fd = OS_ObjectIdFromInteger(1); - h->dir = CF_Direction_TX; - t->state = CF_TxnState_S1; - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(t, 1)); - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(t, 0)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, &history, &txn, NULL); + txn->fd = OS_ObjectIdFromInteger(1); + history->dir = CF_Direction_TX; + txn->state = CF_TxnState_S1; + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 1)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 0)); UtAssert_STUB_COUNT(CF_FreeTransaction, 2); /* Transmit with move_dir set, without '/' in filename */ UT_ResetState(UT_KEY(OS_remove)); - snprintf(CF_AppData.config_table->chan[t->chan_num].move_dir, - sizeof(CF_AppData.config_table->chan[t->chan_num].move_dir), "/test"); - memset(t->history->fnames.src_filename, 0, sizeof(t->history->fnames.src_filename)); - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(t, 0)); + snprintf(CF_AppData.config_table->chan[txn->chan_num].move_dir, + sizeof(CF_AppData.config_table->chan[txn->chan_num].move_dir), "/test"); + memset(txn->history->fnames.src_filename, 0, sizeof(txn->history->fnames.src_filename)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 0)); UtAssert_STUB_COUNT(OS_mv, 0); UtAssert_STUB_COUNT(OS_remove, 1); /* Transmit with move_dir set with '/' in filename */ UT_ResetState(UT_KEY(OS_remove)); - snprintf(t->history->fnames.src_filename, sizeof(t->history->fnames.src_filename), "/ram/test"); - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(t, 0)); + snprintf(txn->history->fnames.src_filename, sizeof(txn->history->fnames.src_filename), "/ram/test"); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 0)); UtAssert_STUB_COUNT(OS_mv, 1); UtAssert_STUB_COUNT(OS_remove, 0); @@ -1395,71 +1395,71 @@ void Test_CF_CFDP_ResetTransaction(void) UT_ResetState(UT_KEY(OS_remove)); UT_ResetState(UT_KEY(OS_mv)); UT_SetDefaultReturnValue(UT_KEY(OS_mv), -1); - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(t, 0)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 0)); UtAssert_STUB_COUNT(OS_mv, 1); UtAssert_STUB_COUNT(OS_remove, 1); UT_ResetState(UT_KEY(CF_FreeTransaction)); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, &h, &t, NULL); - t->fd = OS_ObjectIdFromInteger(1); - h->dir = CF_Direction_RX; - t->state = CF_TxnState_R1; - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(t, 1)); - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(t, 0)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_RX, NULL, NULL, &history, &txn, NULL); + txn->fd = OS_ObjectIdFromInteger(1); + history->dir = CF_Direction_RX; + txn->state = CF_TxnState_R1; + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 1)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 0)); UtAssert_STUB_COUNT(CF_FreeTransaction, 2); UT_ResetState(UT_KEY(CF_FreeTransaction)); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->fd = OS_ObjectIdFromInteger(1); - h->dir = CF_Direction_TX; - t->keep = 1; - t->state = CF_TxnState_S1; - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(t, 1)); - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(t, 0)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->fd = OS_ObjectIdFromInteger(1); + history->dir = CF_Direction_TX; + txn->keep = 1; + txn->state = CF_TxnState_S1; + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 1)); + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 0)); UtAssert_STUB_COUNT(CF_FreeTransaction, 2); /* coverage completeness: - * test decrement of c->num_cmd_tx + * test decrement of chan->num_cmd_tx * test decrement of playback num_ts * test reset of "cur" pointer */ UT_ResetState(UT_KEY(CF_FreeTransaction)); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &c, &h, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &chan, &history, &txn, NULL); pb.num_ts = 10; - t->p = &pb; - c->cur = t; - t->flags.tx.cmd_tx = 5; - c->num_cmd_tx = 8; - h->dir = CF_Direction_TX; - t->state = CF_TxnState_S1; - UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(t, 1)); - UtAssert_NULL(c->cur); + txn->pb = &pb; + chan->cur = txn; + txn->flags.tx.cmd_tx = 5; + chan->num_cmd_tx = 8; + history->dir = CF_Direction_TX; + txn->state = CF_TxnState_S1; + UtAssert_VOIDCALL(CF_CFDP_ResetTransaction(txn, 1)); + UtAssert_NULL(chan->cur); UtAssert_UINT32_EQ(pb.num_ts, 9); - UtAssert_UINT32_EQ(c->num_cmd_tx, 7); + UtAssert_UINT32_EQ(chan->num_cmd_tx, 7); UtAssert_STUB_COUNT(CF_FreeTransaction, 1); } void Test_CF_CFDP_SetTxnStatus(void) { /* Test case for: - * void CF_CFDP_SetTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) + * void CF_CFDP_SetTxnStatus(CF_Transaction_t *txn, CF_TxnStatus_t txn_stat) */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal call */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); - UtAssert_VOIDCALL(CF_CFDP_SetTxnStatus(t, CF_TxnStatus_NO_ERROR)); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_NO_ERROR); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_VOIDCALL(CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_NO_ERROR)); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_NO_ERROR); /* set an error */ - UtAssert_VOIDCALL(CF_CFDP_SetTxnStatus(t, CF_TxnStatus_FILESTORE_REJECTION)); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); + UtAssert_VOIDCALL(CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_FILESTORE_REJECTION)); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); /* confirm errors are "sticky" */ UT_SetDefaultReturnValue(UT_KEY(CF_TxnStatus_IsError), true); - UtAssert_VOIDCALL(CF_CFDP_SetTxnStatus(t, CF_TxnStatus_NO_ERROR)); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); + UtAssert_VOIDCALL(CF_CFDP_SetTxnStatus(txn, CF_TxnStatus_NO_ERROR)); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_FILESTORE_REJECTION); } void Test_CF_CFDP_SendEotPkt(void) @@ -1467,15 +1467,15 @@ void Test_CF_CFDP_SendEotPkt(void) CF_EotPktBuf_t PktBuf; CF_EotPktBuf_t *PktBufPtr; - CF_Transaction_t *t; + CF_Transaction_t *txn; CF_Playback_t pb; memset(&pb, 0, sizeof(pb)); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); /* Test case where CF_EotPktBuf_t is NULL */ - UtAssert_VOIDCALL(CF_CFDP_SendEotPkt(t)); + UtAssert_VOIDCALL(CF_CFDP_SendEotPkt(txn)); /* Verify results */ UtAssert_STUB_COUNT(CFE_MSG_Init, 0); @@ -1489,7 +1489,7 @@ void Test_CF_CFDP_SendEotPkt(void) /* Execute the function being tested */ /* nominal call */ - UtAssert_VOIDCALL(CF_CFDP_SendEotPkt(t)); + UtAssert_VOIDCALL(CF_CFDP_SendEotPkt(txn)); /* Verify results */ UtAssert_STUB_COUNT(CFE_MSG_Init, 1); @@ -1521,35 +1521,35 @@ void Test_CF_CFDP_DisableEngine(void) void Test_CF_CFDP_CloseFiles(void) { /* Test case for: - * int CF_CFDP_CloseFiles(CF_CListNode_t *n, void *context) + * int CF_CFDP_CloseFiles(CF_CListNode_t *node, void *context) */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal call, no file */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - UtAssert_INT32_EQ(CF_CFDP_CloseFiles(&t->cl_node, NULL), CF_CLIST_CONT); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_CloseFiles(&txn->cl_node, NULL), CF_CLIST_CONT); /* nominal call, w/ file */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->fd = OS_ObjectIdFromInteger(1); - UtAssert_INT32_EQ(CF_CFDP_CloseFiles(&t->cl_node, NULL), CF_CLIST_CONT); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->fd = OS_ObjectIdFromInteger(1); + UtAssert_INT32_EQ(CF_CFDP_CloseFiles(&txn->cl_node, NULL), CF_CLIST_CONT); } void Test_CF_CFDP_CancelTransaction(void) { /* Test case for: - * void CF_CFDP_CancelTransaction(CF_Transaction_t *t) + * void CF_CFDP_CancelTransaction(CF_Transaction_t *txn) */ - CF_Transaction_t *t; + CF_Transaction_t *txn; /* nominal; cover both "flags.com.canceled" branches in here */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->flags.com.canceled = 1; - UtAssert_VOIDCALL(CF_CFDP_CancelTransaction(t)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->flags.com.canceled = 1; + UtAssert_VOIDCALL(CF_CFDP_CancelTransaction(txn)); - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->flags.com.canceled = 0; - UtAssert_VOIDCALL(CF_CFDP_CancelTransaction(t)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + txn->flags.com.canceled = 0; + UtAssert_VOIDCALL(CF_CFDP_CancelTransaction(txn)); } /******************************************************************************* diff --git a/unit-test/cf_cmd_tests.c b/unit-test/cf_cmd_tests.c index 0fc3bd15..3709b1f5 100644 --- a/unit-test/cf_cmd_tests.c +++ b/unit-test/cf_cmd_tests.c @@ -140,7 +140,7 @@ CF_TransactionSeq_t Any_CF_TransactionSeq_t(void) typedef struct { - CF_Transaction_t *t; + CF_Transaction_t *txn; void * context; } CF_TsnChanAction_fn_t_context_t; @@ -150,14 +150,14 @@ int Chan_action_fn_t(uint8 chan_num, void *context) return UT_DEFAULT_IMPL(Chan_action_fn_t); } -void Dummy_CF_TsnChanAction_fn_t(CF_Transaction_t *t, void *context) +void Dummy_CF_TsnChanAction_fn_t(CF_Transaction_t *txn, void *context) { CF_TsnChanAction_fn_t_context_t *ctxt = UT_CF_GetContextBuffer(UT_KEY(Dummy_CF_TsnChanAction_fn_t), CF_TsnChanAction_fn_t_context_t); if (ctxt) { - ctxt->t = t; + ctxt->txn = txn; ctxt->context = context; } @@ -1043,7 +1043,7 @@ void Test_CF_FindTransactionBySequenceNumberAllChannels_WhenNoTransactionFoundRe /* Assert */ UtAssert_STUB_COUNT(CF_FindTransactionBySequenceNumber, CF_NUM_CHANNELS); - UtAssert_ADDRESS_EQ(context_CF_CFDP_FTBSN.c, CF_AppData.engine.channels); + UtAssert_ADDRESS_EQ(context_CF_CFDP_FTBSN.chan, CF_AppData.engine.channels); UtAssert_UINT32_EQ(context_CF_CFDP_FTBSN.transaction_sequence_number, arg_ts); UtAssert_UINT32_EQ(context_CF_CFDP_FTBSN.src_eid, arg_eid); UtAssert_ADDRESS_EQ(local_result, expected_result); @@ -1082,11 +1082,11 @@ void Test_CF_FindTransactionBySequenceNumberAllChannels_Return_TransactionFound( UtAssert_STUB_COUNT(CF_FindTransactionBySequenceNumber, number_transaction_match + 1); for (i = 0; i < number_transaction_match; ++i) { - UtAssert_ADDRESS_EQ(contexts_CF_CFDP_FTBSN[i].c, CF_AppData.engine.channels + i); + UtAssert_ADDRESS_EQ(contexts_CF_CFDP_FTBSN[i].chan, CF_AppData.engine.channels + i); UtAssert_UINT32_EQ(contexts_CF_CFDP_FTBSN[i].transaction_sequence_number, arg_ts); UtAssert_UINT32_EQ(contexts_CF_CFDP_FTBSN[i].src_eid, arg_eid); } - UtAssert_ADDRESS_EQ(contexts_CF_CFDP_FTBSN[i].c, CF_AppData.engine.channels + i); + UtAssert_ADDRESS_EQ(contexts_CF_CFDP_FTBSN[i].chan, CF_AppData.engine.channels + i); UtAssert_UINT32_EQ(contexts_CF_CFDP_FTBSN[i].transaction_sequence_number, arg_ts); UtAssert_UINT32_EQ(contexts_CF_CFDP_FTBSN[i].src_eid, arg_eid); UtAssert_ADDRESS_EQ(local_result, expected_result); @@ -1150,7 +1150,7 @@ void Test_CF_TsnChanAction_cmd_chan_Eq_CF_COMPOUND_KEY_TransactionFoundRun_fn_An CF_TsnChanAction_fn_t arg_fn = &Dummy_CF_TsnChanAction_fn_t; int context; void * arg_context = &context; - CF_Transaction_t t; + CF_Transaction_t txn; CF_TsnChanAction_fn_t_context_t context_CF_TsnChanAction_fn_t; memset(&utbuf, 0, sizeof(utbuf)); @@ -1166,7 +1166,7 @@ void Test_CF_TsnChanAction_cmd_chan_Eq_CF_COMPOUND_KEY_TransactionFoundRun_fn_An CF_FindTransactionBySequenceNumber_context_t context_CF_CFDP_FTBSN; /* set matching transaction */ - context_CF_CFDP_FTBSN.forced_return = &t; + context_CF_CFDP_FTBSN.forced_return = &txn; UT_SetDataBuffer(UT_KEY(CF_FindTransactionBySequenceNumber), &context_CF_CFDP_FTBSN, sizeof(context_CF_CFDP_FTBSN), false); @@ -1179,7 +1179,7 @@ void Test_CF_TsnChanAction_cmd_chan_Eq_CF_COMPOUND_KEY_TransactionFoundRun_fn_An /* Assert */ UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_STUB_COUNT(Dummy_CF_TsnChanAction_fn_t, 1); - UtAssert_ADDRESS_EQ(context_CF_TsnChanAction_fn_t.t, &t); + UtAssert_ADDRESS_EQ(context_CF_TsnChanAction_fn_t.txn, &txn); UtAssert_ADDRESS_EQ(context_CF_TsnChanAction_fn_t.context, arg_context); } @@ -1262,8 +1262,8 @@ void Test_CF_TsnChanAction_cmd_FailBecause_cmd_chan_IsInvalid(void) void Test_CF_DoSuspRes_Txn_Set_context_same_To_1_suspended_Eq_action(void) { /* Arrange */ - CF_Transaction_t t; - CF_Transaction_t * arg_t = &t; + CF_Transaction_t txn; + CF_Transaction_t * arg_t = &txn; CF_ChanAction_SuspResArg_t context; CF_ChanAction_SuspResArg_t *arg_context = &context; @@ -1285,8 +1285,8 @@ void Test_CF_DoSuspRes_Txn_Set_context_same_To_1_suspended_Eq_action(void) void Test_CF_DoSuspRes_Txn_When_suspended_NotEqTo_action_Set_suspended_To_action(void) { /* Arrange */ - CF_Transaction_t t; - CF_Transaction_t * arg_t = &t; + CF_Transaction_t txn; + CF_Transaction_t * arg_t = &txn; CF_ChanAction_SuspResArg_t context; CF_ChanAction_SuspResArg_t *arg_context = &context; @@ -1443,8 +1443,8 @@ void Test_CF_CmdResume_Call_CF_DoSuspRes_WithGiven_msg_And_action_0(void) void Test_CF_CmdCancel_Txn_Call_CF_CFDP_CancelTransaction_WithGiven_t(void) { /* Arrange */ - CF_Transaction_t t; - CF_Transaction_t *arg_t = &t; + CF_Transaction_t txn; + CF_Transaction_t *arg_t = &txn; void * arg_ignored = NULL; CF_Transaction_t *context_CF_CFDP_CancelTransaction; @@ -1512,8 +1512,8 @@ void Test_CF_CmdCancel_Failure(void) void Test_CF_CmdAbandon_Txn_Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0(void) { /* Arrange */ - CF_Transaction_t t; - CF_Transaction_t * arg_t = &t; + CF_Transaction_t txn; + CF_Transaction_t * arg_t = &txn; void * arg_ignored = NULL; CF_CFDP_ResetTransaction_context_t context_CF_CFDP_ResetTransaction; @@ -1524,7 +1524,7 @@ void Test_CF_CmdAbandon_Txn_Call_CF_CFDP_ResetTransaction_WithGiven_t_And_0(void CF_CmdAbandon_Txn(arg_t, arg_ignored); /* Assert */ - UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetTransaction.t, arg_t); + UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetTransaction.txn, arg_t); UtAssert_True(context_CF_CFDP_ResetTransaction.keep_history == 0, "CF_CFDP_CancelTransaction was called with int %d and should be 0 (constant in call)", context_CF_CFDP_ResetTransaction.keep_history); @@ -2052,10 +2052,10 @@ void Test_CF_CmdDisablePolldir_FailWhenActionFail(void) void Test_CF_PurgeHistory_Call_CF_CFDP_ResetHistory_AndReturn_CLIST_CONT(void) { /* Arrange */ - CF_History_t h; - CF_CListNode_t * arg_n = &h.cl_node; - CF_Channel_t c; - CF_Channel_t * arg_c = &c; + CF_History_t history; + CF_CListNode_t * arg_n = &history.cl_node; + CF_Channel_t chan; + CF_Channel_t * arg_c = &chan; int local_result; CF_CFDP_ResetHistory_context_t context_CF_CFDP_ResetHistory; @@ -2066,8 +2066,8 @@ void Test_CF_PurgeHistory_Call_CF_CFDP_ResetHistory_AndReturn_CLIST_CONT(void) local_result = CF_PurgeHistory(arg_n, arg_c); /* Assert */ - UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetHistory.c, arg_c); - UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetHistory.h, &h); + UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetHistory.chan, arg_c); + UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetHistory.history, &history); UtAssert_True(local_result == CF_CLIST_CONT, "CF_PurgeHistory returned %d and should be %d (CF_CLIST_CONT)", local_result, CF_CLIST_CONT); } @@ -2081,8 +2081,8 @@ void Test_CF_PurgeHistory_Call_CF_CFDP_ResetHistory_AndReturn_CLIST_CONT(void) void Test_CF_PurgeTransaction_Call_CF_CFDP_ResetTransaction_AndReturn_CLIST_CONT(void) { /* Arrange */ - CF_Transaction_t t; - CF_CListNode_t * arg_n = &t.cl_node; + CF_Transaction_t txn; + CF_CListNode_t * arg_n = &txn.cl_node; int ignored; void * arg_ignored = &ignored; int local_result; @@ -2095,7 +2095,7 @@ void Test_CF_PurgeTransaction_Call_CF_CFDP_ResetTransaction_AndReturn_CLIST_CONT local_result = CF_PurgeTransaction(arg_n, arg_ignored); /* Assert */ - UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetTransaction.t, &t); + UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetTransaction.txn, &txn); UtAssert_True(context_CF_CFDP_ResetTransaction.keep_history == 0, "CF_CFDP_ResetTransaction received keep_history %u and should be 0 (constant)", context_CF_CFDP_ResetTransaction.keep_history); @@ -2115,7 +2115,7 @@ void Test_CF_DoPurgeQueue_PendOnly(void) uint8 arg_chan_num = Any_cf_channel(); CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * arg_cmd = &utbuf.ua; - CF_Channel_t * c; + CF_Channel_t * chan; CF_CListNode_t start; CF_CListNode_t * expected_start = &start; CFE_Status_t local_result; @@ -2127,8 +2127,8 @@ void Test_CF_DoPurgeQueue_PendOnly(void) UT_SetHandlerFunction(UT_KEY(CF_CList_Traverse), UT_AltHandler_CF_CList_Traverse_POINTER, &context_CF_CList_Traverse); - c = &CF_AppData.engine.channels[arg_chan_num]; - c->qs[CF_QueueIdx_PEND] = expected_start; + chan = &CF_AppData.engine.channels[arg_chan_num]; + chan->qs[CF_QueueIdx_PEND] = expected_start; /* Act */ local_result = CF_DoPurgeQueue(arg_chan_num, arg_cmd); @@ -2151,7 +2151,7 @@ void Test_CF_DoPurgeQueue_HistoryOnly(void) uint8 arg_chan_num = Any_cf_channel(); CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * arg_cmd = &utbuf.ua; - CF_Channel_t * c; + CF_Channel_t * chan; CF_CListNode_t start; CF_CListNode_t * expected_start = &start; CFE_Status_t local_result; @@ -2165,8 +2165,8 @@ void Test_CF_DoPurgeQueue_HistoryOnly(void) UT_SetHandlerFunction(UT_KEY(CF_CList_Traverse), UT_AltHandler_CF_CList_Traverse_POINTER, &context_CF_CList_Traverse); - c = &CF_AppData.engine.channels[arg_chan_num]; - c->qs[CF_QueueIdx_HIST] = expected_start; + chan = &CF_AppData.engine.channels[arg_chan_num]; + chan->qs[CF_QueueIdx_HIST] = expected_start; /* Act */ local_result = CF_DoPurgeQueue(arg_chan_num, arg_cmd); @@ -2178,7 +2178,7 @@ void Test_CF_DoPurgeQueue_HistoryOnly(void) UtAssert_ADDRESS_EQ(context_CF_CList_Traverse.start, expected_start); UtAssert_True(context_CF_CList_Traverse.fn == (CF_CListFn_t)CF_PurgeHistory, "context_CF_CList_Traverse.fn == (CF_CListFn_t )CF_PurgeHistory"); - UtAssert_ADDRESS_EQ(context_CF_CList_Traverse.context, c); + UtAssert_ADDRESS_EQ(context_CF_CList_Traverse.context, chan); UtAssert_True(local_result == CFE_SUCCESS, "CF_DoPurgeQueue returned %d and should be 0 (CFE_SUCCESS)", local_result); } @@ -2189,7 +2189,7 @@ void Test_CF_DoPurgeQueue_Both(void) uint8 arg_chan_num = Any_cf_channel(); CF_UT_cmd_unionargs_buf_t utbuf; CF_UnionArgsCmd_t * arg_cmd = &utbuf.ua; - CF_Channel_t * c; + CF_Channel_t * chan; CF_CListNode_t pend_start; CF_CListNode_t * expected_pend_start = &pend_start; CF_CListNode_t history_start; @@ -2206,9 +2206,9 @@ void Test_CF_DoPurgeQueue_Both(void) UT_SetHandlerFunction(UT_KEY(CF_CList_Traverse), UT_AltHandler_CF_CList_Traverse_POINTER, NULL); UT_SetDataBuffer(UT_KEY(CF_CList_Traverse), context_CF_CList_Traverse, sizeof(context_CF_CList_Traverse), false); - c = &CF_AppData.engine.channels[arg_chan_num]; - c->qs[CF_QueueIdx_PEND] = expected_pend_start; - c->qs[CF_QueueIdx_HIST] = expected_history_start; + chan = &CF_AppData.engine.channels[arg_chan_num]; + chan->qs[CF_QueueIdx_PEND] = expected_pend_start; + chan->qs[CF_QueueIdx_HIST] = expected_history_start; /* Act */ local_result = CF_DoPurgeQueue(arg_chan_num, arg_cmd); @@ -2224,7 +2224,7 @@ void Test_CF_DoPurgeQueue_Both(void) UtAssert_ADDRESS_EQ(context_CF_CList_Traverse[1].start, expected_history_start); UtAssert_True(context_CF_CList_Traverse[1].fn == (CF_CListFn_t)CF_PurgeHistory, "context_CF_CList_Traverse[1].fn == (CF_CListFn_t )CF_PurgeHistory"); - UtAssert_ADDRESS_EQ(context_CF_CList_Traverse[1].context, c); + UtAssert_ADDRESS_EQ(context_CF_CList_Traverse[1].context, chan); UtAssert_True(local_result == CFE_SUCCESS, "CF_DoPurgeQueue returned %d and should be 0 (CFE_SUCCESS)", local_result); } diff --git a/unit-test/cf_crc_tests.c b/unit-test/cf_crc_tests.c index 4fb7edca..6e732af3 100644 --- a/unit-test/cf_crc_tests.c +++ b/unit-test/cf_crc_tests.c @@ -23,62 +23,62 @@ void Test_CF_CRC_Start(void) { /* Arrange */ - CF_Crc_t c; + CF_Crc_t crc; - memset(&c, 0xFF, sizeof(c)); + memset(&crc, 0xFF, sizeof(crc)); /* Act */ - UtAssert_VOIDCALL(CF_CRC_Start(&c)); + UtAssert_VOIDCALL(CF_CRC_Start(&crc)); /* Assert */ - UtAssert_ZERO(c.working); - UtAssert_ZERO(c.result); - UtAssert_ZERO(c.index); + UtAssert_ZERO(crc.working); + UtAssert_ZERO(crc.result); + UtAssert_ZERO(crc.index); } void Test_CF_CRC_Digest(void) { - CF_Crc_t c; + CF_Crc_t crc; uint8 data[] = {1, 2, 3, 4, 5}; /* Already tested, so OK to use */ - CF_CRC_Start(&c); + CF_CRC_Start(&crc); - /* Zero length should leave c as zeros */ - UtAssert_VOIDCALL(CF_CRC_Digest(&c, NULL, 0)); - UtAssert_ZERO(c.working); - UtAssert_ZERO(c.result); - UtAssert_ZERO(c.index); + /* Zero length should leave crc as zeros */ + UtAssert_VOIDCALL(CF_CRC_Digest(&crc, NULL, 0)); + UtAssert_ZERO(crc.working); + UtAssert_ZERO(crc.result); + UtAssert_ZERO(crc.index); /* Digest data and confirm */ - UtAssert_VOIDCALL(CF_CRC_Digest(&c, data, sizeof(data))); - UtAssert_UINT32_EQ(c.working, (data[1] << 24) + (data[2] << 16) + (data[3] << 8) + data[4]); - UtAssert_UINT32_EQ(c.result, (data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3]); - UtAssert_UINT32_EQ(c.index, 1); + UtAssert_VOIDCALL(CF_CRC_Digest(&crc, data, sizeof(data))); + UtAssert_UINT32_EQ(crc.working, (data[1] << 24) + (data[2] << 16) + (data[3] << 8) + data[4]); + UtAssert_UINT32_EQ(crc.result, (data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3]); + UtAssert_UINT32_EQ(crc.index, 1); } void Test_CF_CRC_Finalize(void) { - CF_Crc_t c; + CF_Crc_t crc; uint8 data[] = {1, 2, 3, 4, 5}; /* Already tested, so OK to use */ - CF_CRC_Start(&c); + CF_CRC_Start(&crc); - /* Test with clear c */ - UtAssert_VOIDCALL(CF_CRC_Finalize(&c)); - UtAssert_ZERO(c.working); - UtAssert_ZERO(c.result); - UtAssert_ZERO(c.index); + /* Test with clear crc */ + UtAssert_VOIDCALL(CF_CRC_Finalize(&crc)); + UtAssert_ZERO(crc.working); + UtAssert_ZERO(crc.result); + UtAssert_ZERO(crc.index); /* Already tested, so OK to use */ - CF_CRC_Digest(&c, data, sizeof(data)); + CF_CRC_Digest(&crc, data, sizeof(data)); - /* Test with filled in c */ - UtAssert_VOIDCALL(CF_CRC_Finalize(&c)); - UtAssert_ZERO(c.working); - UtAssert_UINT32_EQ(c.result, ((data[0] + data[4]) << 24) + (data[1] << 16) + (data[2] << 8) + data[3]); - UtAssert_ZERO(c.index); + /* Test with filled in crc */ + UtAssert_VOIDCALL(CF_CRC_Finalize(&crc)); + UtAssert_ZERO(crc.working); + UtAssert_UINT32_EQ(crc.result, ((data[0] + data[4]) << 24) + (data[1] << 16) + (data[2] << 8) + data[3]); + UtAssert_ZERO(crc.index); } void UtTest_Setup(void) diff --git a/unit-test/cf_timer_tests.c b/unit-test/cf_timer_tests.c index 8655bfc7..38739520 100644 --- a/unit-test/cf_timer_tests.c +++ b/unit-test/cf_timer_tests.c @@ -138,8 +138,8 @@ void Test_CF_Timer_Tick_When_t_tick_Is_non0_Decrement_t_tick(void) { /* Arrange */ uint32 initial_tick = Any_uint32_Except(0); - CF_Timer_t t; - CF_Timer_t *arg_t = &t; + CF_Timer_t txn; + CF_Timer_t *arg_t = &txn; arg_t->tick = initial_tick; diff --git a/unit-test/cf_utils_tests.c b/unit-test/cf_utils_tests.c index 55dbd372..b7c8f71a 100644 --- a/unit-test/cf_utils_tests.c +++ b/unit-test/cf_utils_tests.c @@ -28,7 +28,7 @@ typedef struct { - CF_Transaction_t *t; + CF_Transaction_t *txn; void * context; } UT_Callback_CF_TraverseAllTransactions_context_t; @@ -88,28 +88,28 @@ void local_handler_OS_close(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubC * A UT-specific callback that can be used with CF_TraverseAllTransactions * *-----------------------------------------------------------------*/ -static void UT_Callback_CF_TraverseAllTransactions(CF_Transaction_t *t, void *context) +static void UT_Callback_CF_TraverseAllTransactions(CF_Transaction_t *txn, void *context) { UT_Callback_CF_TraverseAllTransactions_context_t *ctxt = UT_CF_GetContextBuffer( UT_KEY(UT_Callback_CF_TraverseAllTransactions), UT_Callback_CF_TraverseAllTransactions_context_t); if (ctxt) { - ctxt->t = t; + ctxt->txn = txn; ctxt->context = context; } } /*---------------------------------------------------------------- * - * A simple handler that just sets the "t" output in the state object + * A simple handler that just sets the "txn" output in the state object * *-----------------------------------------------------------------*/ static void UT_AltHandler_CF_CList_Traverse_SeqArg_SetTxn(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { CF_Traverse_TransSeqArg_t *arg = UT_Hook_GetArgValueByName(Context, "context", CF_Traverse_TransSeqArg_t *); - arg->t = UserObj; + arg->txn = UserObj; } /******************************************************************************* @@ -121,70 +121,70 @@ static void UT_AltHandler_CF_CList_Traverse_SeqArg_SetTxn(void *UserObj, UT_Entr void Test_CF_ResetHistory(void) { /* Test case for: - * void CF_ResetHistory(CF_Channel_t *c, CF_History_t *h) + * void CF_ResetHistory(CF_Channel_t *chan, CF_History_t *history) */ - CF_History_t h; + CF_History_t history; - memset(&h, 0, sizeof(h)); + memset(&history, 0, sizeof(history)); CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[CF_QueueIdx_HIST] = 4; /* nominal call */ - UtAssert_VOIDCALL(CF_ResetHistory(&CF_AppData.engine.channels[UT_CFDP_CHANNEL], &h)); + UtAssert_VOIDCALL(CF_ResetHistory(&CF_AppData.engine.channels[UT_CFDP_CHANNEL], &history)); } void Test_CF_FindUnusedTransaction(void) { /* Test case for: - * CF_Transaction_t *CF_FindUnusedTransaction(CF_Channel_t *c) + * CF_Transaction_t *CF_FindUnusedTransaction(CF_Channel_t *chan) */ - CF_Channel_t * c; + CF_Channel_t * chan; CF_Transaction_t txn; CF_History_t hist; memset(&hist, 0, sizeof(hist)); memset(&txn, 0, sizeof(txn)); memset(&CF_AppData, 0, sizeof(CF_AppData)); - c = &CF_AppData.engine.channels[UT_CFDP_CHANNEL]; + chan = &CF_AppData.engine.channels[UT_CFDP_CHANNEL]; CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[CF_QueueIdx_FREE] = 2; CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[CF_QueueIdx_HIST_FREE] = 1; CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[CF_QueueIdx_HIST] = 1; - UtAssert_NULL(CF_FindUnusedTransaction(c)); + UtAssert_NULL(CF_FindUnusedTransaction(chan)); - c->qs[CF_QueueIdx_FREE] = &txn.cl_node; - c->qs[CF_QueueIdx_HIST_FREE] = &hist.cl_node; - c->qs[CF_QueueIdx_HIST] = NULL; - UtAssert_ADDRESS_EQ(CF_FindUnusedTransaction(c), &txn); + chan->qs[CF_QueueIdx_FREE] = &txn.cl_node; + chan->qs[CF_QueueIdx_HIST_FREE] = &hist.cl_node; + chan->qs[CF_QueueIdx_HIST] = NULL; + UtAssert_ADDRESS_EQ(CF_FindUnusedTransaction(chan), &txn); UtAssert_ADDRESS_EQ(txn.history, &hist); - c->qs[CF_QueueIdx_FREE] = &txn.cl_node; - c->qs[CF_QueueIdx_HIST_FREE] = NULL; - c->qs[CF_QueueIdx_HIST] = &hist.cl_node; - UtAssert_ADDRESS_EQ(CF_FindUnusedTransaction(c), &txn); + chan->qs[CF_QueueIdx_FREE] = &txn.cl_node; + chan->qs[CF_QueueIdx_HIST_FREE] = NULL; + chan->qs[CF_QueueIdx_HIST] = &hist.cl_node; + UtAssert_ADDRESS_EQ(CF_FindUnusedTransaction(chan), &txn); UtAssert_ADDRESS_EQ(txn.history, &hist); } void Test_CF_FreeTransaction(void) { /* Test case for: - * void CF_FreeTransaction(CF_Transaction_t *t) + * void CF_FreeTransaction(CF_Transaction_t *txn) */ - CF_Transaction_t *t; + CF_Transaction_t *txn; memset(&CF_AppData, 0, sizeof(CF_AppData)); - t = &CF_AppData.engine.transactions[UT_CFDP_CHANNEL]; + txn = &CF_AppData.engine.transactions[UT_CFDP_CHANNEL]; - UtAssert_VOIDCALL(CF_FreeTransaction(t)); + UtAssert_VOIDCALL(CF_FreeTransaction(txn)); - UtAssert_UINT32_EQ(t->state, CF_TxnState_IDLE); - UtAssert_UINT32_EQ(t->flags.com.q_index, CF_QueueIdx_FREE); + UtAssert_UINT32_EQ(txn->state, CF_TxnState_IDLE); + UtAssert_UINT32_EQ(txn->flags.com.q_index, CF_QueueIdx_FREE); } void Test_CF_FindTransactionBySequenceNumber_Impl(void) { /* Test case for: - * int CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Traverse_TransSeqArg_t *context) + * int CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *node, CF_Traverse_TransSeqArg_t *context) */ CF_Traverse_TransSeqArg_t ctxt; CF_Transaction_t txn; @@ -202,7 +202,7 @@ void Test_CF_FindTransactionBySequenceNumber_Impl(void) hist.seq_num = 56; ctxt.transaction_sequence_number = 78; UtAssert_INT32_EQ(CF_FindTransactionBySequenceNumber_Impl(&txn.cl_node, &ctxt), 0); - UtAssert_NULL(ctxt.t); + UtAssert_NULL(ctxt.txn); /* matching eid and non-matching sequence */ hist.src_eid = 13; @@ -210,7 +210,7 @@ void Test_CF_FindTransactionBySequenceNumber_Impl(void) hist.seq_num = 56; ctxt.transaction_sequence_number = 78; UtAssert_INT32_EQ(CF_FindTransactionBySequenceNumber_Impl(&txn.cl_node, &ctxt), 0); - UtAssert_NULL(ctxt.t); + UtAssert_NULL(ctxt.txn); /* non-matching eid and matching sequence */ hist.src_eid = 12; @@ -218,7 +218,7 @@ void Test_CF_FindTransactionBySequenceNumber_Impl(void) hist.seq_num = 57; ctxt.transaction_sequence_number = 57; UtAssert_INT32_EQ(CF_FindTransactionBySequenceNumber_Impl(&txn.cl_node, &ctxt), 0); - UtAssert_NULL(ctxt.t); + UtAssert_NULL(ctxt.txn); /* matching eid and matching sequence */ hist.src_eid = 23; @@ -226,28 +226,28 @@ void Test_CF_FindTransactionBySequenceNumber_Impl(void) hist.seq_num = 67; ctxt.transaction_sequence_number = 67; UtAssert_INT32_EQ(CF_FindTransactionBySequenceNumber_Impl(&txn.cl_node, &ctxt), 1); - UtAssert_ADDRESS_EQ(ctxt.t, &txn); + UtAssert_ADDRESS_EQ(ctxt.txn, &txn); } void Test_CF_FindTransactionBySequenceNumber(void) { /* Test case for: - * CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_TransactionSeq_t + * CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *chan, CF_TransactionSeq_t * transaction_sequence_number, CF_EntityId_t src_eid) */ - CF_Transaction_t *t; - CF_Channel_t * c; + CF_Transaction_t *txn; + CF_Channel_t * chan; memset(&CF_AppData, 0, sizeof(CF_AppData)); - c = &CF_AppData.engine.channels[UT_CFDP_CHANNEL]; + chan = &CF_AppData.engine.channels[UT_CFDP_CHANNEL]; - UtAssert_NULL(CF_FindTransactionBySequenceNumber(c, 12, 34)); + UtAssert_NULL(CF_FindTransactionBySequenceNumber(chan, 12, 34)); UtAssert_STUB_COUNT(CF_CList_Traverse, 4); /* this checks 4 different queues */ - t = &CF_AppData.engine.transactions[UT_CFDP_CHANNEL]; - UT_SetHandlerFunction(UT_KEY(CF_CList_Traverse), UT_AltHandler_CF_CList_Traverse_SeqArg_SetTxn, t); - UtAssert_ADDRESS_EQ(CF_FindTransactionBySequenceNumber(c, 12, 34), t); + txn = &CF_AppData.engine.transactions[UT_CFDP_CHANNEL]; + UT_SetHandlerFunction(UT_KEY(CF_CList_Traverse), UT_AltHandler_CF_CList_Traverse_SeqArg_SetTxn, txn); + UtAssert_ADDRESS_EQ(CF_FindTransactionBySequenceNumber(chan, 12, 34), txn); } /* CF_DequeueTransaction tests */ @@ -291,8 +291,8 @@ void Test_cf_dequeue_transaction_Call_CF_CList_Remove_AndDecrement_q_size(void) void Test_cf_move_transaction_Call_CF_CList_InsertBack_AndSet_q_index_ToGiven_q(void) { /* Arrange */ - CF_Transaction_t t; - CF_Transaction_t * arg_t = &t; + CF_Transaction_t txn; + CF_Transaction_t * arg_t = &txn; uint8 chan_num = Any_uint8_LessThan(CF_NUM_CHANNELS); CF_CListNode_t ** expected_remove_head; CF_CListNode_t * expected_remove_node; @@ -302,7 +302,7 @@ void Test_cf_move_transaction_Call_CF_CList_InsertBack_AndSet_q_index_ToGiven_q( CF_CList_Remove_context_t context_clist_remove; CF_CList_InsertBack_context_t context_clist_insert_back; - memset(&t, 0, sizeof(t)); + memset(&txn, 0, sizeof(txn)); arg_t->chan_num = chan_num; @@ -330,7 +330,7 @@ void Test_cf_move_transaction_Call_CF_CList_InsertBack_AndSet_q_index_ToGiven_q( UtAssert_ADDRESS_EQ(context_clist_insert_back.head, expected_insert_back_head); UtAssert_ADDRESS_EQ(context_clist_insert_back.node, expected_insert_back_node); UtAssert_True(arg_t->flags.com.q_index == arg_q, - "t->flags.com.q_index set to %u and should equal passed in q value %u", arg_t->flags.com.q_index, + "txn->flags.com.q_index set to %u and should equal passed in q value %u", arg_t->flags.com.q_index, arg_q); } @@ -450,7 +450,7 @@ void Test_CF_CList_InsertBack_Ex_Call_CF_CList_InsertBack_AndIncrement_q_size(vo void Test_CF_Traverse_WriteHistoryQueueEntryToFile(void) { /* Test case for: - * int CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *arg); + * int CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void *arg); */ CF_History_t hist; CF_Traverse_WriteHistoryFileArg_t args; @@ -497,7 +497,7 @@ void Test_CF_Traverse_WriteHistoryQueueEntryToFile(void) void Test_CF_Traverse_WriteTxnQueueEntryToFile(void) { /* Test case for: - * int CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *n, void *arg); + * int CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *node, void *arg); */ CF_Transaction_t txn; CF_History_t hist; @@ -529,26 +529,26 @@ void Test_CF_Traverse_WriteTxnQueueEntryToFile(void) void Test_CF_WriteHistoryEntryToFile(void) { /* Test case for: - * int CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h) + * int CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *history) */ osal_id_t arg_fd = OS_ObjectIdFromInteger(1); - CF_History_t h; + CF_History_t history; - memset(&h, 0, sizeof(h)); - strcpy(h.fnames.src_filename, "sf"); - strcpy(h.fnames.dst_filename, "df"); + memset(&history, 0, sizeof(history)); + strcpy(history.fnames.src_filename, "sf"); + strcpy(history.fnames.dst_filename, "df"); /* Successful write - need to set up for 3 successful calls to OS_write() */ UT_SetDeferredRetcode(UT_KEY(OS_write), 1, 44); - UT_SetDeferredRetcode(UT_KEY(OS_write), 1, strlen(h.fnames.src_filename) + 6); - UT_SetDeferredRetcode(UT_KEY(OS_write), 1, strlen(h.fnames.dst_filename) + 6); - UtAssert_INT32_EQ(CF_WriteHistoryEntryToFile(arg_fd, &h), 0); + UT_SetDeferredRetcode(UT_KEY(OS_write), 1, strlen(history.fnames.src_filename) + 6); + UT_SetDeferredRetcode(UT_KEY(OS_write), 1, strlen(history.fnames.dst_filename) + 6); + UtAssert_INT32_EQ(CF_WriteHistoryEntryToFile(arg_fd, &history), 0); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); /* Unsuccessful write */ UT_CF_ResetEventCapture(); UT_SetDeferredRetcode(UT_KEY(OS_write), 1, -1); - UtAssert_INT32_EQ(CF_WriteHistoryEntryToFile(arg_fd, &h), -1); + UtAssert_INT32_EQ(CF_WriteHistoryEntryToFile(arg_fd, &history), -1); UT_CF_AssertEventID(CF_EID_ERR_CMD_WHIST_WRITE); } @@ -611,14 +611,14 @@ void Test_CF_WriteHistoryQueueDataToFile(void) void Test_CF_PrioSearch_When_t_PrioIsGreaterThanContextPrioReturn_CLIST_CONT(void) { /* Arrange */ - CF_Transaction_t t; - CF_CListNode_t * arg_node = &t.cl_node; - CF_Traverse_PriorityArg_t p; - void * arg_context = (void *)&p; + CF_Transaction_t txn; + CF_CListNode_t * arg_node = &txn.cl_node; + CF_Traverse_PriorityArg_t arg; + void * arg_context = (void *)&arg; int32 result; - t.priority = Any_uint8_Except(0); - p.priority = Any_uint8_LessThan(t.priority); + txn.priority = Any_uint8_Except(0); + arg.priority = Any_uint8_LessThan(txn.priority); /* Act */ result = CF_PrioSearch(arg_node, arg_context); @@ -630,47 +630,47 @@ void Test_CF_PrioSearch_When_t_PrioIsGreaterThanContextPrioReturn_CLIST_CONT(voi void Test_CF_PrioSearch_When_t_PrioIsEqToContextPrio_Set_context_t_To_t_AndReturn_CLIST_EXIT(void) { /* Arrange */ - CF_Transaction_t t; - CF_CListNode_t * arg_node = &t.cl_node; - CF_Traverse_PriorityArg_t p; - void * arg_context = (void *)&p; + CF_Transaction_t txn; + CF_CListNode_t * arg_node = &txn.cl_node; + CF_Traverse_PriorityArg_t arg; + void * arg_context = (void *)&arg; int32 result; - memset(&p, 0, sizeof(p)); + memset(&arg, 0, sizeof(arg)); /* NOTE: these are inverted from previous test! */ - t.priority = Any_uint8_Except(0); - p.priority = t.priority; + txn.priority = Any_uint8_Except(0); + arg.priority = txn.priority; /* Act */ result = CF_PrioSearch(arg_node, arg_context); /* Assert */ UtAssert_INT32_EQ(result, CF_CLIST_EXIT); - UtAssert_ADDRESS_EQ(p.t, &t); + UtAssert_ADDRESS_EQ(arg.txn, &txn); } void Test_CF_PrioSearch_When_t_PrioIsLessThanContextPrio_Set_context_t_To_t_AndReturn_CLIST_EXIT(void) { /* Arrange */ - CF_Transaction_t t; - CF_CListNode_t * arg_node = &t.cl_node; - CF_Traverse_PriorityArg_t p; - void * arg_context = (void *)&p; + CF_Transaction_t txn; + CF_CListNode_t * arg_node = &txn.cl_node; + CF_Traverse_PriorityArg_t arg; + void * arg_context = (void *)&arg; int32 result; - memset(&p, 0, sizeof(p)); + memset(&arg, 0, sizeof(arg)); /* NOTE: these are inverted from previous test! */ - p.priority = Any_uint8_Except(0); - t.priority = Any_uint8_LessThan(p.priority); + arg.priority = Any_uint8_Except(0); + txn.priority = Any_uint8_LessThan(arg.priority); /* Act */ result = CF_PrioSearch(arg_node, arg_context); /* Assert */ UtAssert_INT32_EQ(result, CF_CLIST_EXIT); - UtAssert_ADDRESS_EQ(p.t, &t); + UtAssert_ADDRESS_EQ(arg.txn, &txn); } /******************************************************************************* @@ -682,27 +682,27 @@ void Test_CF_PrioSearch_When_t_PrioIsLessThanContextPrio_Set_context_t_To_t_AndR void Test_CF_InsertSortPrio_Call_CF_CList_InsertBack_Ex_ListIsEmpty_AndSet_q_index_To_q(void) { /* Arrange */ - CF_Transaction_t t; - CF_Transaction_t *arg_t = &t; + CF_Transaction_t txn; + CF_Transaction_t *arg_t = &txn; CF_QueueIdx_t arg_q = Any_cf_queue_index_t(); - CF_Channel_t * c; + CF_Channel_t * chan; CF_CListNode_t ** expected_insert_back_head; CF_CListNode_t * expected_insert_back_node; CF_CList_InsertBack_context_t context_clist_insert_back; - /* t settings to bypass CF_Assert */ - t.chan_num = Any_uint8_LessThan(CF_NUM_CHANNELS); - t.state = Any_uint8_Except(CF_TxnState_IDLE); + /* txn settings to bypass CF_Assert */ + txn.chan_num = Any_uint8_LessThan(CF_NUM_CHANNELS); + txn.state = Any_uint8_Except(CF_TxnState_IDLE); UT_SetDataBuffer(UT_KEY(CF_CList_InsertBack), &context_clist_insert_back, sizeof(context_clist_insert_back), false); /* setting (&CF_AppData.engine.channels[arg_t->chan_num])->qs[arg_q] to NULL * makes the list empty */ - c = &CF_AppData.engine.channels[arg_t->chan_num]; - c->qs[arg_q] = NULL; + chan = &CF_AppData.engine.channels[arg_t->chan_num]; + chan->qs[arg_q] = NULL; - expected_insert_back_head = &c->qs[arg_q]; + expected_insert_back_head = &chan->qs[arg_q]; expected_insert_back_node = &arg_t->cl_node; /* Act */ @@ -713,7 +713,7 @@ void Test_CF_InsertSortPrio_Call_CF_CList_InsertBack_Ex_ListIsEmpty_AndSet_q_ind UtAssert_ADDRESS_EQ(context_clist_insert_back.head, expected_insert_back_head); UtAssert_ADDRESS_EQ(context_clist_insert_back.node, expected_insert_back_node); UtAssert_True(arg_t->flags.com.q_index == arg_q, - "arg_t->flags.com.q_index set to %d and should be %d (CF_QueueIdx_t q)", arg_t->flags.com.q_index, + "arg_t->flags.com.q_index set to %d and should be %d (CF_QueueIdx_t queue)", arg_t->flags.com.q_index, arg_q); } @@ -721,11 +721,11 @@ void Test_CF_InsertSortPrio_Call_CF_CList_InsertAfter_Ex_AndSet_q_index_To_q(voi { /* Arrange */ CF_Transaction_t p_t; - CF_Transaction_t t; - CF_Transaction_t *arg_t = &t; + CF_Transaction_t txn; + CF_Transaction_t *arg_t = &txn; CF_QueueIdx_t arg_q = Any_cf_queue_index_t(); CF_CListNode_t * qs; - CF_Channel_t * c; + CF_Channel_t * chan; CF_CListNode_t * expected_end; CF_CListFn_t expected_fn; CF_CListNode_t ** expected_insert_after_head; @@ -738,14 +738,14 @@ void Test_CF_InsertSortPrio_Call_CF_CList_InsertAfter_Ex_AndSet_q_index_To_q(voi UT_SetHandlerFunction(UT_KEY(CF_CList_Traverse_R), UT_AltHandler_CF_CList_Traverse_R_PRIO, &context_cf_clist_traverse_r); - /* t settings to bypass CF_Assert */ - t.chan_num = Any_uint8_LessThan(CF_NUM_CHANNELS); - t.state = Any_uint8_Except(CF_TxnState_IDLE); + /* txn settings to bypass CF_Assert */ + txn.chan_num = Any_uint8_LessThan(CF_NUM_CHANNELS); + txn.state = Any_uint8_Except(CF_TxnState_IDLE); /* setting (&CF_AppData.engine.channels[arg_t->chan_num])->qs[arg_q] to * &qs makes the list NOT empty */ - c = &CF_AppData.engine.channels[arg_t->chan_num]; - c->qs[arg_q] = (CF_CListNode_t *)&qs; + chan = &CF_AppData.engine.channels[arg_t->chan_num]; + chan->qs[arg_q] = (CF_CListNode_t *)&qs; /* setup CF_Traverse_PriorityArg_t altered value */ context_cf_clist_traverse_r.context_t = &p_t; @@ -755,9 +755,9 @@ void Test_CF_InsertSortPrio_Call_CF_CList_InsertAfter_Ex_AndSet_q_index_To_q(voi false); /* set expected values */ - expected_end = c->qs[arg_q]; + expected_end = chan->qs[arg_q]; expected_fn = CF_PrioSearch; - expected_insert_after_head = (CF_CListNode_t **)&c->qs[arg_q]; + expected_insert_after_head = (CF_CListNode_t **)&chan->qs[arg_q]; expected_insert_after_start = (CF_CListNode_t **)&p_t.cl_node; expected_insert_after_after = (CF_CListNode_t **)&arg_t->cl_node; @@ -772,18 +772,18 @@ void Test_CF_InsertSortPrio_Call_CF_CList_InsertAfter_Ex_AndSet_q_index_To_q(voi UtAssert_ADDRESS_EQ(context_CF_CList_InsertAfter.head, (CF_CListNode_t **)expected_insert_after_head); UtAssert_ADDRESS_EQ(context_CF_CList_InsertAfter.start, (CF_CListNode_t *)expected_insert_after_start); UtAssert_ADDRESS_EQ(context_CF_CList_InsertAfter.after, (CF_CListNode_t *)expected_insert_after_after); - UtAssert_True(arg_t->flags.com.q_index == arg_q, "t->flags.com.q_index is %u and should be %u (q)", + UtAssert_True(arg_t->flags.com.q_index == arg_q, "txn->flags.com.q_index is %u and should be %u (q)", arg_t->flags.com.q_index, arg_q); } void Test_CF_InsertSortPrio_When_p_t_Is_NULL_Call_CF_CList_InsertBack_Ex(void) { /* Arrange */ - CF_Transaction_t t; - CF_Transaction_t *arg_t = &t; + CF_Transaction_t txn; + CF_Transaction_t *arg_t = &txn; CF_QueueIdx_t arg_q = Any_cf_queue_index_t(); CF_CListNode_t * qs; - CF_Channel_t * c; + CF_Channel_t * chan; CF_CListNode_t * expected_end; CF_CListFn_t expected_fn; CF_CListNode_t ** expected_insert_back_head; @@ -795,22 +795,22 @@ void Test_CF_InsertSortPrio_When_p_t_Is_NULL_Call_CF_CList_InsertBack_Ex(void) UT_SetDataBuffer(UT_KEY(CF_CList_Traverse_R), &context_cf_clist_traverse_r, sizeof(context_cf_clist_traverse_r), false); - /* t settings to bypass CF_Assert */ - t.chan_num = Any_uint8_LessThan(CF_NUM_CHANNELS); - t.state = Any_uint8_Except(CF_TxnState_IDLE); + /* txn settings to bypass CF_Assert */ + txn.chan_num = Any_uint8_LessThan(CF_NUM_CHANNELS); + txn.state = Any_uint8_Except(CF_TxnState_IDLE); /* setting (&CF_AppData.engine.channels[arg_t->chan_num])->qs[arg_q] to * &qs makes the list NOT empty */ - c = &CF_AppData.engine.channels[arg_t->chan_num]; - c->qs[arg_q] = (CF_CListNode_t *)&qs; + chan = &CF_AppData.engine.channels[arg_t->chan_num]; + chan->qs[arg_q] = (CF_CListNode_t *)&qs; /* setup CF_Traverse_PriorityArg_t altered value */ context_cf_clist_traverse_r.context_t = NULL; /* set expected values */ - expected_end = c->qs[arg_q]; + expected_end = chan->qs[arg_q]; expected_fn = CF_PrioSearch; - expected_insert_back_head = &c->qs[arg_q]; + expected_insert_back_head = &chan->qs[arg_q]; expected_insert_back_node = &arg_t->cl_node; /* Arrange for CF_CList_InsertBack_Ex */ @@ -827,7 +827,7 @@ void Test_CF_InsertSortPrio_When_p_t_Is_NULL_Call_CF_CList_InsertBack_Ex(void) UtAssert_STUB_COUNT(CF_CList_InsertBack, 1); UtAssert_ADDRESS_EQ(context_clist_insert_back.head, expected_insert_back_head); UtAssert_ADDRESS_EQ(context_clist_insert_back.node, expected_insert_back_node); - UtAssert_True(arg_t->flags.com.q_index == arg_q, "t->flags.com.q_index is %u and should be %u (q)", + UtAssert_True(arg_t->flags.com.q_index == arg_q, "txn->flags.com.q_index is %u and should be %u (q)", arg_t->flags.com.q_index, arg_q); } @@ -840,8 +840,8 @@ void Test_CF_InsertSortPrio_When_p_t_Is_NULL_Call_CF_CList_InsertBack_Ex(void) void Test_CF_TraverseAllTransactions_Impl_GetContainer_t_Call_args_fn_AndAdd_1_ToCounter(void) { /* Arrange */ - CF_Transaction_t t; - CF_CListNode_t * arg_n = &t.cl_node; + CF_Transaction_t txn; + CF_CListNode_t * arg_n = &txn.cl_node; CF_TraverseAll_Arg_t args; CF_TraverseAll_Arg_t *arg_args; int context_val; @@ -860,7 +860,7 @@ void Test_CF_TraverseAllTransactions_Impl_GetContainer_t_Call_args_fn_AndAdd_1_T arg_args = &args; /* set expected values */ - expected_t = &t; + expected_t = &txn; expected_context = context; UT_SetDataBuffer(UT_KEY(UT_Callback_CF_TraverseAllTransactions), &func_ptr_context, sizeof(func_ptr_context), @@ -870,7 +870,7 @@ void Test_CF_TraverseAllTransactions_Impl_GetContainer_t_Call_args_fn_AndAdd_1_T result = CF_TraverseAllTransactions_Impl(arg_n, arg_args); /* Assert */ - UtAssert_ADDRESS_EQ(func_ptr_context.t, expected_t); + UtAssert_ADDRESS_EQ(func_ptr_context.txn, expected_t); UtAssert_ADDRESS_EQ(func_ptr_context.context, expected_context); UtAssert_True(arg_args->counter == initial_args_counter + 1, "CF_TraverseAllTransactions_Impl set args->counter to %d which is 1 more than initial value %d", @@ -887,7 +887,7 @@ void Test_CF_TraverseAllTransactions_Impl_GetContainer_t_Call_args_fn_AndAdd_1_T void Test_CF_TraverseAllTransactions_CallOtherFunction_CF_Q_RX_TimesAndReturn_args_counter(void) { /* Arrange */ - CF_Channel_t c; + CF_Channel_t chan; CF_Channel_t * arg_c; int context; void * arg_context = &context; @@ -900,7 +900,7 @@ void Test_CF_TraverseAllTransactions_CallOtherFunction_CF_Q_RX_TimesAndReturn_ar for (i = 0; i < expected_count; ++i) { - c.qs[i] = (CF_CListNode_t *)&expected_qs_nodes[i]; + chan.qs[i] = (CF_CListNode_t *)&expected_qs_nodes[i]; } /* set context */ @@ -909,7 +909,7 @@ void Test_CF_TraverseAllTransactions_CallOtherFunction_CF_Q_RX_TimesAndReturn_ar UT_SetDataBuffer(UT_KEY(CF_CList_Traverse), contexts_cf_clist_traverse, sizeof(contexts_cf_clist_traverse), false); /* finalize arguments */ - arg_c = &c; + arg_c = &chan; /* Act */ UtAssert_INT32_EQ(CF_TraverseAllTransactions(arg_c, arg_fn, arg_context), expected_count); diff --git a/unit-test/stubs/cf_cfdp_dispatch_stubs.c b/unit-test/stubs/cf_cfdp_dispatch_stubs.c index 04364311..e98241ef 100644 --- a/unit-test/stubs/cf_cfdp_dispatch_stubs.c +++ b/unit-test/stubs/cf_cfdp_dispatch_stubs.c @@ -31,10 +31,10 @@ * Generated stub function for CF_CFDP_R_DispatchRecv() * ---------------------------------------------------- */ -void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, +void CF_CFDP_R_DispatchRecv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph, const CF_CFDP_R_SubstateDispatchTable_t *dispatch, CF_CFDP_StateRecvFunc_t fd_fn) { - UT_GenStub_AddParam(CF_CFDP_R_DispatchRecv, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R_DispatchRecv, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R_DispatchRecv, CF_Logical_PduBuffer_t *, ph); UT_GenStub_AddParam(CF_CFDP_R_DispatchRecv, const CF_CFDP_R_SubstateDispatchTable_t *, dispatch); UT_GenStub_AddParam(CF_CFDP_R_DispatchRecv, CF_CFDP_StateRecvFunc_t, fd_fn); @@ -47,10 +47,10 @@ void CF_CFDP_R_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, * Generated stub function for CF_CFDP_RxStateDispatch() * ---------------------------------------------------- */ -void CF_CFDP_RxStateDispatch(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, +void CF_CFDP_RxStateDispatch(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph, const CF_CFDP_TxnRecvDispatchTable_t *dispatch) { - UT_GenStub_AddParam(CF_CFDP_RxStateDispatch, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_RxStateDispatch, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_RxStateDispatch, CF_Logical_PduBuffer_t *, ph); UT_GenStub_AddParam(CF_CFDP_RxStateDispatch, const CF_CFDP_TxnRecvDispatchTable_t *, dispatch); @@ -62,10 +62,10 @@ void CF_CFDP_RxStateDispatch(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, * Generated stub function for CF_CFDP_S_DispatchRecv() * ---------------------------------------------------- */ -void CF_CFDP_S_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, +void CF_CFDP_S_DispatchRecv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph, const CF_CFDP_S_SubstateRecvDispatchTable_t *dispatch) { - UT_GenStub_AddParam(CF_CFDP_S_DispatchRecv, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S_DispatchRecv, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_S_DispatchRecv, CF_Logical_PduBuffer_t *, ph); UT_GenStub_AddParam(CF_CFDP_S_DispatchRecv, const CF_CFDP_S_SubstateRecvDispatchTable_t *, dispatch); @@ -77,9 +77,9 @@ void CF_CFDP_S_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph, * Generated stub function for CF_CFDP_S_DispatchTransmit() * ---------------------------------------------------- */ -void CF_CFDP_S_DispatchTransmit(CF_Transaction_t *t, const CF_CFDP_S_SubstateSendDispatchTable_t *dispatch) +void CF_CFDP_S_DispatchTransmit(CF_Transaction_t *txn, const CF_CFDP_S_SubstateSendDispatchTable_t *dispatch) { - UT_GenStub_AddParam(CF_CFDP_S_DispatchTransmit, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S_DispatchTransmit, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_S_DispatchTransmit, const CF_CFDP_S_SubstateSendDispatchTable_t *, dispatch); UT_GenStub_Execute(CF_CFDP_S_DispatchTransmit, Basic, NULL); @@ -90,9 +90,9 @@ void CF_CFDP_S_DispatchTransmit(CF_Transaction_t *t, const CF_CFDP_S_SubstateSen * Generated stub function for CF_CFDP_TxStateDispatch() * ---------------------------------------------------- */ -void CF_CFDP_TxStateDispatch(CF_Transaction_t *t, const CF_CFDP_TxnSendDispatchTable_t *dispatch) +void CF_CFDP_TxStateDispatch(CF_Transaction_t *txn, const CF_CFDP_TxnSendDispatchTable_t *dispatch) { - UT_GenStub_AddParam(CF_CFDP_TxStateDispatch, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_TxStateDispatch, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_TxStateDispatch, const CF_CFDP_TxnSendDispatchTable_t *, dispatch); UT_GenStub_Execute(CF_CFDP_TxStateDispatch, Basic, NULL); diff --git a/unit-test/stubs/cf_cfdp_handlers.c b/unit-test/stubs/cf_cfdp_handlers.c index f785c545..83a8c10a 100644 --- a/unit-test/stubs/cf_cfdp_handlers.c +++ b/unit-test/stubs/cf_cfdp_handlers.c @@ -123,7 +123,7 @@ void UT_DefaultHandler_CF_CFDP_ResetTransaction(void *UserObj, UT_EntryKey_t Fun if (ctxt) { - ctxt->t = UT_Hook_GetArgValueByName(Context, "t", CF_Transaction_t *); + ctxt->txn = UT_Hook_GetArgValueByName(Context, "txn", CF_Transaction_t *); ctxt->keep_history = UT_Hook_GetArgValueByName(Context, "keep_history", int); } } @@ -140,6 +140,6 @@ void UT_DefaultHandler_CF_CFDP_CancelTransaction(void *UserObj, UT_EntryKey_t Fu if (ctxt) { - *ctxt = UT_Hook_GetArgValueByName(Context, "t", CF_Transaction_t *); + *ctxt = UT_Hook_GetArgValueByName(Context, "txn", CF_Transaction_t *); } } diff --git a/unit-test/stubs/cf_cfdp_r_stubs.c b/unit-test/stubs/cf_cfdp_r_stubs.c index ea098129..1fa9e7a3 100644 --- a/unit-test/stubs/cf_cfdp_r_stubs.c +++ b/unit-test/stubs/cf_cfdp_r_stubs.c @@ -31,9 +31,9 @@ * Generated stub function for CF_CFDP_R1_Recv() * ---------------------------------------------------- */ -void CF_CFDP_R1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R1_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_R1_Recv, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R1_Recv, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R1_Recv, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_R1_Recv, Basic, NULL); @@ -44,9 +44,9 @@ void CF_CFDP_R1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_R1_Reset() * ---------------------------------------------------- */ -void CF_CFDP_R1_Reset(CF_Transaction_t *t) +void CF_CFDP_R1_Reset(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_R1_Reset, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R1_Reset, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_R1_Reset, Basic, NULL); } @@ -56,9 +56,9 @@ void CF_CFDP_R1_Reset(CF_Transaction_t *t) * Generated stub function for CF_CFDP_R1_SubstateRecvEof() * ---------------------------------------------------- */ -void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_R1_SubstateRecvEof, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R1_SubstateRecvEof, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R1_SubstateRecvEof, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_R1_SubstateRecvEof, Basic, NULL); @@ -69,9 +69,9 @@ void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_R1_SubstateRecvFileData() * ---------------------------------------------------- */ -void CF_CFDP_R1_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R1_SubstateRecvFileData(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_R1_SubstateRecvFileData, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R1_SubstateRecvFileData, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R1_SubstateRecvFileData, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_R1_SubstateRecvFileData, Basic, NULL); @@ -82,11 +82,11 @@ void CF_CFDP_R1_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t * Generated stub function for CF_CFDP_R2_CalcCrcChunk() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_R2_CalcCrcChunk, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_R2_CalcCrcChunk, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R2_CalcCrcChunk, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_R2_CalcCrcChunk, Basic, NULL); @@ -98,9 +98,9 @@ CFE_Status_t CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) * Generated stub function for CF_CFDP_R2_Complete() * ---------------------------------------------------- */ -void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak) +void CF_CFDP_R2_Complete(CF_Transaction_t *txn, int ok_to_send_nak) { - UT_GenStub_AddParam(CF_CFDP_R2_Complete, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R2_Complete, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R2_Complete, int, ok_to_send_nak); UT_GenStub_Execute(CF_CFDP_R2_Complete, Basic, NULL); @@ -111,10 +111,10 @@ void CF_CFDP_R2_Complete(CF_Transaction_t *t, int ok_to_send_nak) * Generated stub function for CF_CFDP_R2_GapCompute() * ---------------------------------------------------- */ -void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *c, void *opaque) +void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *chunk, void *opaque) { UT_GenStub_AddParam(CF_CFDP_R2_GapCompute, const CF_ChunkList_t *, chunks); - UT_GenStub_AddParam(CF_CFDP_R2_GapCompute, const CF_Chunk_t *, c); + UT_GenStub_AddParam(CF_CFDP_R2_GapCompute, const CF_Chunk_t *, chunk); UT_GenStub_AddParam(CF_CFDP_R2_GapCompute, void *, opaque); UT_GenStub_Execute(CF_CFDP_R2_GapCompute, Basic, NULL); @@ -125,9 +125,9 @@ void CF_CFDP_R2_GapCompute(const CF_ChunkList_t *chunks, const CF_Chunk_t *c, vo * Generated stub function for CF_CFDP_R2_Recv() * ---------------------------------------------------- */ -void CF_CFDP_R2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R2_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_R2_Recv, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R2_Recv, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R2_Recv, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_R2_Recv, Basic, NULL); @@ -138,9 +138,9 @@ void CF_CFDP_R2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_R2_RecvMd() * ---------------------------------------------------- */ -void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R2_RecvMd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_R2_RecvMd, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R2_RecvMd, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R2_RecvMd, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_R2_RecvMd, Basic, NULL); @@ -151,9 +151,9 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_R2_Recv_fin_ack() * ---------------------------------------------------- */ -void CF_CFDP_R2_Recv_fin_ack(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R2_Recv_fin_ack(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_R2_Recv_fin_ack, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R2_Recv_fin_ack, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R2_Recv_fin_ack, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_R2_Recv_fin_ack, Basic, NULL); @@ -164,9 +164,9 @@ void CF_CFDP_R2_Recv_fin_ack(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_R2_Reset() * ---------------------------------------------------- */ -void CF_CFDP_R2_Reset(CF_Transaction_t *t) +void CF_CFDP_R2_Reset(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_R2_Reset, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R2_Reset, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_R2_Reset, Basic, NULL); } @@ -176,9 +176,9 @@ void CF_CFDP_R2_Reset(CF_Transaction_t *t) * Generated stub function for CF_CFDP_R2_SetFinTxnStatus() * ---------------------------------------------------- */ -void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) +void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *txn, CF_TxnStatus_t txn_stat) { - UT_GenStub_AddParam(CF_CFDP_R2_SetFinTxnStatus, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R2_SetFinTxnStatus, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R2_SetFinTxnStatus, CF_TxnStatus_t, txn_stat); UT_GenStub_Execute(CF_CFDP_R2_SetFinTxnStatus, Basic, NULL); @@ -189,9 +189,9 @@ void CF_CFDP_R2_SetFinTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) * Generated stub function for CF_CFDP_R2_SubstateRecvEof() * ---------------------------------------------------- */ -void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_R2_SubstateRecvEof, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R2_SubstateRecvEof, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R2_SubstateRecvEof, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_R2_SubstateRecvEof, Basic, NULL); @@ -202,9 +202,9 @@ void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_R2_SubstateRecvFileData() * ---------------------------------------------------- */ -void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_R2_SubstateRecvFileData, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R2_SubstateRecvFileData, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R2_SubstateRecvFileData, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_R2_SubstateRecvFileData, Basic, NULL); @@ -215,11 +215,11 @@ void CF_CFDP_R2_SubstateRecvFileData(CF_Transaction_t *t, CF_Logical_PduBuffer_t * Generated stub function for CF_CFDP_R2_SubstateSendFin() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_R2_SubstateSendFin, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_R2_SubstateSendFin, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R2_SubstateSendFin, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_R2_SubstateSendFin, Basic, NULL); @@ -231,9 +231,9 @@ CFE_Status_t CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t) * Generated stub function for CF_CFDP_R_Cancel() * ---------------------------------------------------- */ -void CF_CFDP_R_Cancel(CF_Transaction_t *t) +void CF_CFDP_R_Cancel(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_R_Cancel, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R_Cancel, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_R_Cancel, Basic, NULL); } @@ -243,11 +243,11 @@ void CF_CFDP_R_Cancel(CF_Transaction_t *t) * Generated stub function for CF_CFDP_R_CheckCrc() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_R_CheckCrc(CF_Transaction_t *t, uint32 expected_crc) +CFE_Status_t CF_CFDP_R_CheckCrc(CF_Transaction_t *txn, uint32 expected_crc) { UT_GenStub_SetupReturnBuffer(CF_CFDP_R_CheckCrc, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_R_CheckCrc, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R_CheckCrc, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R_CheckCrc, uint32, expected_crc); UT_GenStub_Execute(CF_CFDP_R_CheckCrc, Basic, NULL); @@ -260,9 +260,9 @@ CFE_Status_t CF_CFDP_R_CheckCrc(CF_Transaction_t *t, uint32 expected_crc) * Generated stub function for CF_CFDP_R_Init() * ---------------------------------------------------- */ -void CF_CFDP_R_Init(CF_Transaction_t *t) +void CF_CFDP_R_Init(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_R_Init, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R_Init, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_R_Init, Basic, NULL); } @@ -272,11 +272,11 @@ void CF_CFDP_R_Init(CF_Transaction_t *t) * Generated stub function for CF_CFDP_R_ProcessFd() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_R_ProcessFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { UT_GenStub_SetupReturnBuffer(CF_CFDP_R_ProcessFd, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_R_ProcessFd, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R_ProcessFd, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R_ProcessFd, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_R_ProcessFd, Basic, NULL); @@ -289,9 +289,9 @@ CFE_Status_t CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph * Generated stub function for CF_CFDP_R_SendInactivityEvent() * ---------------------------------------------------- */ -void CF_CFDP_R_SendInactivityEvent(CF_Transaction_t *t) +void CF_CFDP_R_SendInactivityEvent(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_R_SendInactivityEvent, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R_SendInactivityEvent, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_R_SendInactivityEvent, Basic, NULL); } @@ -301,11 +301,11 @@ void CF_CFDP_R_SendInactivityEvent(CF_Transaction_t *t) * Generated stub function for CF_CFDP_R_SubstateRecvEof() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { UT_GenStub_SetupReturnBuffer(CF_CFDP_R_SubstateRecvEof, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_R_SubstateRecvEof, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R_SubstateRecvEof, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R_SubstateRecvEof, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_R_SubstateRecvEof, Basic, NULL); @@ -318,11 +318,11 @@ CFE_Status_t CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer * Generated stub function for CF_CFDP_R_SubstateSendNak() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_R_SubstateSendNak, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_R_SubstateSendNak, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R_SubstateSendNak, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_R_SubstateSendNak, Basic, NULL); @@ -334,9 +334,9 @@ CFE_Status_t CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t) * Generated stub function for CF_CFDP_R_Tick() * ---------------------------------------------------- */ -void CF_CFDP_R_Tick(CF_Transaction_t *t, int *cont) +void CF_CFDP_R_Tick(CF_Transaction_t *txn, int *cont) { - UT_GenStub_AddParam(CF_CFDP_R_Tick, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_R_Tick, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_R_Tick, int *, cont); UT_GenStub_Execute(CF_CFDP_R_Tick, Basic, NULL); diff --git a/unit-test/stubs/cf_cfdp_s_stubs.c b/unit-test/stubs/cf_cfdp_s_stubs.c index 0c5a5db9..6ec0d771 100644 --- a/unit-test/stubs/cf_cfdp_s_stubs.c +++ b/unit-test/stubs/cf_cfdp_s_stubs.c @@ -31,9 +31,9 @@ * Generated stub function for CF_CFDP_S1_Recv() * ---------------------------------------------------- */ -void CF_CFDP_S1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S1_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_S1_Recv, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S1_Recv, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_S1_Recv, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_S1_Recv, Basic, NULL); @@ -44,9 +44,9 @@ void CF_CFDP_S1_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_S1_SubstateSendEof() * ---------------------------------------------------- */ -void CF_CFDP_S1_SubstateSendEof(CF_Transaction_t *t) +void CF_CFDP_S1_SubstateSendEof(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_S1_SubstateSendEof, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S1_SubstateSendEof, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_S1_SubstateSendEof, Basic, NULL); } @@ -56,9 +56,9 @@ void CF_CFDP_S1_SubstateSendEof(CF_Transaction_t *t) * Generated stub function for CF_CFDP_S1_Tx() * ---------------------------------------------------- */ -void CF_CFDP_S1_Tx(CF_Transaction_t *t) +void CF_CFDP_S1_Tx(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_S1_Tx, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S1_Tx, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_S1_Tx, Basic, NULL); } @@ -68,9 +68,9 @@ void CF_CFDP_S1_Tx(CF_Transaction_t *t) * Generated stub function for CF_CFDP_S2_EarlyFin() * ---------------------------------------------------- */ -void CF_CFDP_S2_EarlyFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S2_EarlyFin(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_S2_EarlyFin, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S2_EarlyFin, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_S2_EarlyFin, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_S2_EarlyFin, Basic, NULL); @@ -81,9 +81,9 @@ void CF_CFDP_S2_EarlyFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_S2_Fin() * ---------------------------------------------------- */ -void CF_CFDP_S2_Fin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S2_Fin(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_S2_Fin, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S2_Fin, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_S2_Fin, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_S2_Fin, Basic, NULL); @@ -94,9 +94,9 @@ void CF_CFDP_S2_Fin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_S2_Nak() * ---------------------------------------------------- */ -void CF_CFDP_S2_Nak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S2_Nak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_S2_Nak, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S2_Nak, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_S2_Nak, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_S2_Nak, Basic, NULL); @@ -107,9 +107,9 @@ void CF_CFDP_S2_Nak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_S2_Nak_Arm() * ---------------------------------------------------- */ -void CF_CFDP_S2_Nak_Arm(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S2_Nak_Arm(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_S2_Nak_Arm, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S2_Nak_Arm, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_S2_Nak_Arm, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_S2_Nak_Arm, Basic, NULL); @@ -120,9 +120,9 @@ void CF_CFDP_S2_Nak_Arm(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_S2_Recv() * ---------------------------------------------------- */ -void CF_CFDP_S2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S2_Recv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_S2_Recv, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S2_Recv, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_S2_Recv, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_S2_Recv, Basic, NULL); @@ -133,9 +133,9 @@ void CF_CFDP_S2_Recv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_S2_SubstateSendEof() * ---------------------------------------------------- */ -void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *t) +void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_S2_SubstateSendEof, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S2_SubstateSendEof, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_S2_SubstateSendEof, Basic, NULL); } @@ -145,9 +145,9 @@ void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *t) * Generated stub function for CF_CFDP_S2_SubstateSendFileData() * ---------------------------------------------------- */ -void CF_CFDP_S2_SubstateSendFileData(CF_Transaction_t *t) +void CF_CFDP_S2_SubstateSendFileData(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_S2_SubstateSendFileData, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S2_SubstateSendFileData, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_S2_SubstateSendFileData, Basic, NULL); } @@ -157,9 +157,9 @@ void CF_CFDP_S2_SubstateSendFileData(CF_Transaction_t *t) * Generated stub function for CF_CFDP_S2_Tx() * ---------------------------------------------------- */ -void CF_CFDP_S2_Tx(CF_Transaction_t *t) +void CF_CFDP_S2_Tx(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_S2_Tx, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S2_Tx, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_S2_Tx, Basic, NULL); } @@ -169,9 +169,9 @@ void CF_CFDP_S2_Tx(CF_Transaction_t *t) * Generated stub function for CF_CFDP_S2_WaitForEofAck() * ---------------------------------------------------- */ -void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_S2_WaitForEofAck, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S2_WaitForEofAck, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_S2_WaitForEofAck, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_S2_WaitForEofAck, Basic, NULL); @@ -182,9 +182,9 @@ void CF_CFDP_S2_WaitForEofAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_S_Cancel() * ---------------------------------------------------- */ -void CF_CFDP_S_Cancel(CF_Transaction_t *t) +void CF_CFDP_S_Cancel(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_S_Cancel, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S_Cancel, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_S_Cancel, Basic, NULL); } @@ -194,11 +194,11 @@ void CF_CFDP_S_Cancel(CF_Transaction_t *t) * Generated stub function for CF_CFDP_S_CheckAndRespondNak() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_S_CheckAndRespondNak, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_S_CheckAndRespondNak, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S_CheckAndRespondNak, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_S_CheckAndRespondNak, Basic, NULL); @@ -210,11 +210,11 @@ CFE_Status_t CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) * Generated stub function for CF_CFDP_S_SendEof() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_S_SendEof(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_S_SendEof(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_S_SendEof, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_S_SendEof, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S_SendEof, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_S_SendEof, Basic, NULL); @@ -226,11 +226,11 @@ CFE_Status_t CF_CFDP_S_SendEof(CF_Transaction_t *t) * Generated stub function for CF_CFDP_S_SendFileData() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 bytes_to_read, uint8 calc_crc) +CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *txn, uint32 foffs, uint32 bytes_to_read, uint8 calc_crc) { UT_GenStub_SetupReturnBuffer(CF_CFDP_S_SendFileData, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_S_SendFileData, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S_SendFileData, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_S_SendFileData, uint32, foffs); UT_GenStub_AddParam(CF_CFDP_S_SendFileData, uint32, bytes_to_read); UT_GenStub_AddParam(CF_CFDP_S_SendFileData, uint8, calc_crc); @@ -245,9 +245,9 @@ CFE_Status_t CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 by * Generated stub function for CF_CFDP_S_SubstateSendFileData() * ---------------------------------------------------- */ -void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *t) +void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_S_SubstateSendFileData, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S_SubstateSendFileData, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_S_SubstateSendFileData, Basic, NULL); } @@ -257,9 +257,9 @@ void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *t) * Generated stub function for CF_CFDP_S_SubstateSendFinAck() * ---------------------------------------------------- */ -void CF_CFDP_S_SubstateSendFinAck(CF_Transaction_t *t) +void CF_CFDP_S_SubstateSendFinAck(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_S_SubstateSendFinAck, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S_SubstateSendFinAck, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_S_SubstateSendFinAck, Basic, NULL); } @@ -269,9 +269,9 @@ void CF_CFDP_S_SubstateSendFinAck(CF_Transaction_t *t) * Generated stub function for CF_CFDP_S_SubstateSendMetadata() * ---------------------------------------------------- */ -void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *t) +void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_S_SubstateSendMetadata, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S_SubstateSendMetadata, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_S_SubstateSendMetadata, Basic, NULL); } @@ -281,9 +281,9 @@ void CF_CFDP_S_SubstateSendMetadata(CF_Transaction_t *t) * Generated stub function for CF_CFDP_S_Tick() * ---------------------------------------------------- */ -void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont) +void CF_CFDP_S_Tick(CF_Transaction_t *txn, int *cont) { - UT_GenStub_AddParam(CF_CFDP_S_Tick, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S_Tick, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_S_Tick, int *, cont); UT_GenStub_Execute(CF_CFDP_S_Tick, Basic, NULL); @@ -294,9 +294,9 @@ void CF_CFDP_S_Tick(CF_Transaction_t *t, int *cont) * Generated stub function for CF_CFDP_S_Tick_Nak() * ---------------------------------------------------- */ -void CF_CFDP_S_Tick_Nak(CF_Transaction_t *t, int *cont) +void CF_CFDP_S_Tick_Nak(CF_Transaction_t *txn, int *cont) { - UT_GenStub_AddParam(CF_CFDP_S_Tick_Nak, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_S_Tick_Nak, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_S_Tick_Nak, int *, cont); UT_GenStub_Execute(CF_CFDP_S_Tick_Nak, Basic, NULL); diff --git a/unit-test/stubs/cf_cfdp_sbintf_stubs.c b/unit-test/stubs/cf_cfdp_sbintf_stubs.c index e83fe54e..52d5dc58 100644 --- a/unit-test/stubs/cf_cfdp_sbintf_stubs.c +++ b/unit-test/stubs/cf_cfdp_sbintf_stubs.c @@ -2,7 +2,7 @@ * NASA Docket No. GSC-18,447-1, and identified as “CFS CFDP (CF) * Application version 3.0.0” * - * Copyright (c) 2019 United States Government as represented by the + * Copyright (chan) 2019 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -33,11 +33,11 @@ void UT_DefaultHandler_CF_CFDP_MsgOutGet(void *, UT_EntryKey_t, const UT_StubCon * Generated stub function for CF_CFDP_MsgOutGet() * ---------------------------------------------------- */ -CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *t, bool silent) +CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *txn, bool silent) { UT_GenStub_SetupReturnBuffer(CF_CFDP_MsgOutGet, CF_Logical_PduBuffer_t *); - UT_GenStub_AddParam(CF_CFDP_MsgOutGet, const CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_MsgOutGet, const CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_MsgOutGet, bool, silent); UT_GenStub_Execute(CF_CFDP_MsgOutGet, Basic, UT_DefaultHandler_CF_CFDP_MsgOutGet); @@ -50,9 +50,9 @@ CF_Logical_PduBuffer_t *CF_CFDP_MsgOutGet(const CF_Transaction_t *t, bool silent * Generated stub function for CF_CFDP_ReceiveMessage() * ---------------------------------------------------- */ -void CF_CFDP_ReceiveMessage(CF_Channel_t *c) +void CF_CFDP_ReceiveMessage(CF_Channel_t *chan) { - UT_GenStub_AddParam(CF_CFDP_ReceiveMessage, CF_Channel_t *, c); + UT_GenStub_AddParam(CF_CFDP_ReceiveMessage, CF_Channel_t *, chan); UT_GenStub_Execute(CF_CFDP_ReceiveMessage, Basic, NULL); } diff --git a/unit-test/stubs/cf_cfdp_stubs.c b/unit-test/stubs/cf_cfdp_stubs.c index c62c3b56..3fddfa68 100644 --- a/unit-test/stubs/cf_cfdp_stubs.c +++ b/unit-test/stubs/cf_cfdp_stubs.c @@ -50,9 +50,9 @@ void CF_CFDP_AppendTlv(CF_Logical_TlvList_t *ptlv_list, CF_CFDP_TlvType_t tlv_ty * Generated stub function for CF_CFDP_ArmAckTimer() * ---------------------------------------------------- */ -void CF_CFDP_ArmAckTimer(CF_Transaction_t *t) +void CF_CFDP_ArmAckTimer(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_ArmAckTimer, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_ArmAckTimer, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_ArmAckTimer, Basic, NULL); } @@ -62,9 +62,9 @@ void CF_CFDP_ArmAckTimer(CF_Transaction_t *t) * Generated stub function for CF_CFDP_CancelTransaction() * ---------------------------------------------------- */ -void CF_CFDP_CancelTransaction(CF_Transaction_t *t) +void CF_CFDP_CancelTransaction(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_CancelTransaction, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_CancelTransaction, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_CancelTransaction, Basic, UT_DefaultHandler_CF_CFDP_CancelTransaction); } @@ -74,11 +74,11 @@ void CF_CFDP_CancelTransaction(CF_Transaction_t *t) * Generated stub function for CF_CFDP_CloseFiles() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *n, void *context) +CFE_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *node, void *context) { UT_GenStub_SetupReturnBuffer(CF_CFDP_CloseFiles, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_CloseFiles, CF_CListNode_t *, n); + UT_GenStub_AddParam(CF_CFDP_CloseFiles, CF_CListNode_t *, node); UT_GenStub_AddParam(CF_CFDP_CloseFiles, void *, context); UT_GenStub_Execute(CF_CFDP_CloseFiles, Basic, NULL); @@ -91,13 +91,13 @@ CFE_Status_t CF_CFDP_CloseFiles(CF_CListNode_t *n, void *context) * Generated stub function for CF_CFDP_ConstructPduHeader() * ---------------------------------------------------- */ -CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *t, CF_CFDP_FileDirective_t directive_code, +CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *txn, CF_CFDP_FileDirective_t directive_code, CF_EntityId_t src_eid, CF_EntityId_t dst_eid, bool towards_sender, CF_TransactionSeq_t tsn, bool silent) { UT_GenStub_SetupReturnBuffer(CF_CFDP_ConstructPduHeader, CF_Logical_PduBuffer_t *); - UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, const CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, const CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, CF_CFDP_FileDirective_t, directive_code); UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, CF_EntityId_t, src_eid); UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, CF_EntityId_t, dst_eid); @@ -143,9 +143,9 @@ void CF_CFDP_CycleEngine(void) * Generated stub function for CF_CFDP_CycleTx() * ---------------------------------------------------- */ -void CF_CFDP_CycleTx(CF_Channel_t *c) +void CF_CFDP_CycleTx(CF_Channel_t *chan) { - UT_GenStub_AddParam(CF_CFDP_CycleTx, CF_Channel_t *, c); + UT_GenStub_AddParam(CF_CFDP_CycleTx, CF_Channel_t *, chan); UT_GenStub_Execute(CF_CFDP_CycleTx, Basic, NULL); } @@ -199,9 +199,9 @@ void CF_CFDP_DisableEngine(void) * Generated stub function for CF_CFDP_DispatchRecv() * ---------------------------------------------------- */ -void CF_CFDP_DispatchRecv(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_DispatchRecv(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_DispatchRecv, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_DispatchRecv, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_DispatchRecv, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_DispatchRecv, Basic, NULL); @@ -260,9 +260,9 @@ CFE_Status_t CF_CFDP_InitEngine(void) * Generated stub function for CF_CFDP_InitTxnTxFile() * ---------------------------------------------------- */ -void CF_CFDP_InitTxnTxFile(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority) +void CF_CFDP_InitTxnTxFile(CF_Transaction_t *txn, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority) { - UT_GenStub_AddParam(CF_CFDP_InitTxnTxFile, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_InitTxnTxFile, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_InitTxnTxFile, CF_CFDP_Class_t, cfdp_class); UT_GenStub_AddParam(CF_CFDP_InitTxnTxFile, uint8, keep); UT_GenStub_AddParam(CF_CFDP_InitTxnTxFile, uint8, chan); @@ -299,10 +299,10 @@ CFE_Status_t CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filen * Generated stub function for CF_CFDP_ProcessPlaybackDirectory() * ---------------------------------------------------- */ -void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p) +void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *chan, CF_Playback_t *pb) { - UT_GenStub_AddParam(CF_CFDP_ProcessPlaybackDirectory, CF_Channel_t *, c); - UT_GenStub_AddParam(CF_CFDP_ProcessPlaybackDirectory, CF_Playback_t *, p); + UT_GenStub_AddParam(CF_CFDP_ProcessPlaybackDirectory, CF_Channel_t *, chan); + UT_GenStub_AddParam(CF_CFDP_ProcessPlaybackDirectory, CF_Playback_t *, pb); UT_GenStub_Execute(CF_CFDP_ProcessPlaybackDirectory, Basic, NULL); } @@ -312,9 +312,9 @@ void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p) * Generated stub function for CF_CFDP_ProcessPollingDirectories() * ---------------------------------------------------- */ -void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c) +void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *chan) { - UT_GenStub_AddParam(CF_CFDP_ProcessPollingDirectories, CF_Channel_t *, c); + UT_GenStub_AddParam(CF_CFDP_ProcessPollingDirectories, CF_Channel_t *, chan); UT_GenStub_Execute(CF_CFDP_ProcessPollingDirectories, Basic, NULL); } @@ -324,11 +324,11 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c) * Generated stub function for CF_CFDP_RecvAck() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_RecvAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_RecvAck(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { UT_GenStub_SetupReturnBuffer(CF_CFDP_RecvAck, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_RecvAck, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_RecvAck, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_RecvAck, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_RecvAck, Basic, NULL); @@ -341,9 +341,9 @@ CFE_Status_t CF_CFDP_RecvAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_RecvDrop() * ---------------------------------------------------- */ -void CF_CFDP_RecvDrop(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_RecvDrop(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_RecvDrop, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_RecvDrop, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_RecvDrop, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_RecvDrop, Basic, NULL); @@ -354,11 +354,11 @@ void CF_CFDP_RecvDrop(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_RecvEof() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_RecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_RecvEof(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { UT_GenStub_SetupReturnBuffer(CF_CFDP_RecvEof, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_RecvEof, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_RecvEof, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_RecvEof, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_RecvEof, Basic, NULL); @@ -371,11 +371,11 @@ CFE_Status_t CF_CFDP_RecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_RecvFd() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { UT_GenStub_SetupReturnBuffer(CF_CFDP_RecvFd, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_RecvFd, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_RecvFd, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_RecvFd, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_RecvFd, Basic, NULL); @@ -388,11 +388,11 @@ CFE_Status_t CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_RecvFin() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_RecvFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_RecvFin(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { UT_GenStub_SetupReturnBuffer(CF_CFDP_RecvFin, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_RecvFin, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_RecvFin, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_RecvFin, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_RecvFin, Basic, NULL); @@ -405,9 +405,9 @@ CFE_Status_t CF_CFDP_RecvFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_RecvIdle() * ---------------------------------------------------- */ -void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +void CF_CFDP_RecvIdle(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { - UT_GenStub_AddParam(CF_CFDP_RecvIdle, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_RecvIdle, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_RecvIdle, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_RecvIdle, Basic, NULL); @@ -418,11 +418,11 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_RecvMd() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { UT_GenStub_SetupReturnBuffer(CF_CFDP_RecvMd, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_RecvMd, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_RecvMd, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_RecvMd, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_RecvMd, Basic, NULL); @@ -435,11 +435,11 @@ CFE_Status_t CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_RecvNak() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_RecvNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_RecvNak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { UT_GenStub_SetupReturnBuffer(CF_CFDP_RecvNak, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_RecvNak, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_RecvNak, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_RecvNak, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_RecvNak, Basic, NULL); @@ -469,9 +469,9 @@ int CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_ResetTransaction() * ---------------------------------------------------- */ -void CF_CFDP_ResetTransaction(CF_Transaction_t *t, int keep_history) +void CF_CFDP_ResetTransaction(CF_Transaction_t *txn, int keep_history) { - UT_GenStub_AddParam(CF_CFDP_ResetTransaction, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_ResetTransaction, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_ResetTransaction, int, keep_history); UT_GenStub_Execute(CF_CFDP_ResetTransaction, Basic, UT_DefaultHandler_CF_CFDP_ResetTransaction); @@ -482,12 +482,12 @@ void CF_CFDP_ResetTransaction(CF_Transaction_t *t, int keep_history) * Generated stub function for CF_CFDP_SendAck() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_CFDP_FileDirective_t dir_code, +CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *txn, CF_CFDP_AckTxnStatus_t ts, CF_CFDP_FileDirective_t dir_code, CF_CFDP_ConditionCode_t cc, CF_EntityId_t peer_eid, CF_TransactionSeq_t tsn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_SendAck, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_SendAck, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_SendAck, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_SendAck, CF_CFDP_AckTxnStatus_t, ts); UT_GenStub_AddParam(CF_CFDP_SendAck, CF_CFDP_FileDirective_t, dir_code); UT_GenStub_AddParam(CF_CFDP_SendAck, CF_CFDP_ConditionCode_t, cc); @@ -504,11 +504,11 @@ CFE_Status_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_ * Generated stub function for CF_CFDP_SendEof() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_SendEof(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_SendEof(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_SendEof, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_SendEof, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_SendEof, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_SendEof, Basic, NULL); @@ -520,9 +520,9 @@ CFE_Status_t CF_CFDP_SendEof(CF_Transaction_t *t) * Generated stub function for CF_CFDP_SendEotPkt() * ---------------------------------------------------- */ -void CF_CFDP_SendEotPkt(CF_Transaction_t *t) +void CF_CFDP_SendEotPkt(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_CFDP_SendEotPkt, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_SendEotPkt, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_SendEotPkt, Basic, NULL); } @@ -532,11 +532,11 @@ void CF_CFDP_SendEotPkt(CF_Transaction_t *t) * Generated stub function for CF_CFDP_SendFd() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_SendFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_SendFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { UT_GenStub_SetupReturnBuffer(CF_CFDP_SendFd, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_SendFd, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_SendFd, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_SendFd, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_SendFd, Basic, NULL); @@ -549,12 +549,12 @@ CFE_Status_t CF_CFDP_SendFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_SendFin() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, +CFE_Status_t CF_CFDP_SendFin(CF_Transaction_t *txn, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, CF_CFDP_ConditionCode_t cc) { UT_GenStub_SetupReturnBuffer(CF_CFDP_SendFin, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_SendFin, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_SendFin, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_SendFin, CF_CFDP_FinDeliveryCode_t, dc); UT_GenStub_AddParam(CF_CFDP_SendFin, CF_CFDP_FinFileStatus_t, fs); UT_GenStub_AddParam(CF_CFDP_SendFin, CF_CFDP_ConditionCode_t, cc); @@ -569,11 +569,11 @@ CFE_Status_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, * Generated stub function for CF_CFDP_SendMd() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_SendMd(CF_Transaction_t *t) +CFE_Status_t CF_CFDP_SendMd(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_SendMd, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_SendMd, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_SendMd, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_CFDP_SendMd, Basic, NULL); @@ -585,11 +585,11 @@ CFE_Status_t CF_CFDP_SendMd(CF_Transaction_t *t) * Generated stub function for CF_CFDP_SendNak() * ---------------------------------------------------- */ -CFE_Status_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CFE_Status_t CF_CFDP_SendNak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { UT_GenStub_SetupReturnBuffer(CF_CFDP_SendNak, CFE_Status_t); - UT_GenStub_AddParam(CF_CFDP_SendNak, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_SendNak, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_SendNak, CF_Logical_PduBuffer_t *, ph); UT_GenStub_Execute(CF_CFDP_SendNak, Basic, NULL); @@ -602,9 +602,9 @@ CFE_Status_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_SetTxnStatus() * ---------------------------------------------------- */ -void CF_CFDP_SetTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) +void CF_CFDP_SetTxnStatus(CF_Transaction_t *txn, CF_TxnStatus_t txn_stat) { - UT_GenStub_AddParam(CF_CFDP_SetTxnStatus, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CFDP_SetTxnStatus, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CFDP_SetTxnStatus, CF_TxnStatus_t, txn_stat); UT_GenStub_Execute(CF_CFDP_SetTxnStatus, Basic, NULL); @@ -615,9 +615,9 @@ void CF_CFDP_SetTxnStatus(CF_Transaction_t *t, CF_TxnStatus_t txn_stat) * Generated stub function for CF_CFDP_TickTransactions() * ---------------------------------------------------- */ -void CF_CFDP_TickTransactions(CF_Channel_t *c) +void CF_CFDP_TickTransactions(CF_Channel_t *chan) { - UT_GenStub_AddParam(CF_CFDP_TickTransactions, CF_Channel_t *, c); + UT_GenStub_AddParam(CF_CFDP_TickTransactions, CF_Channel_t *, chan); UT_GenStub_Execute(CF_CFDP_TickTransactions, Basic, NULL); } diff --git a/unit-test/stubs/cf_chunk_handlers.c b/unit-test/stubs/cf_chunk_handlers.c index 1db02b84..ad0cadf3 100644 --- a/unit-test/stubs/cf_chunk_handlers.c +++ b/unit-test/stubs/cf_chunk_handlers.c @@ -47,6 +47,6 @@ *-----------------------------------------------------------------*/ void UT_DefaultHandler_CF_ChunkList_GetFirstChunk(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { - CF_Chunk_t *c = NULL; - UT_Stub_SetReturnValue(FuncKey, c); + CF_Chunk_t *chunk = NULL; + UT_Stub_SetReturnValue(FuncKey, chunk); } diff --git a/unit-test/stubs/cf_cmd_stubs.c b/unit-test/stubs/cf_cmd_stubs.c index 4fff043e..2224cda9 100644 --- a/unit-test/stubs/cf_cmd_stubs.c +++ b/unit-test/stubs/cf_cmd_stubs.c @@ -45,9 +45,9 @@ void CF_CmdAbandon(CFE_SB_Buffer_t *msg) * Generated stub function for CF_CmdAbandon_Txn() * ---------------------------------------------------- */ -void CF_CmdAbandon_Txn(CF_Transaction_t *t, void *ignored) +void CF_CmdAbandon_Txn(CF_Transaction_t *txn, void *ignored) { - UT_GenStub_AddParam(CF_CmdAbandon_Txn, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CmdAbandon_Txn, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CmdAbandon_Txn, void *, ignored); UT_GenStub_Execute(CF_CmdAbandon_Txn, Basic, NULL); @@ -70,9 +70,9 @@ void CF_CmdCancel(CFE_SB_Buffer_t *msg) * Generated stub function for CF_CmdCancel_Txn() * ---------------------------------------------------- */ -void CF_CmdCancel_Txn(CF_Transaction_t *t, void *ignored) +void CF_CmdCancel_Txn(CF_Transaction_t *txn, void *ignored) { - UT_GenStub_AddParam(CF_CmdCancel_Txn, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_CmdCancel_Txn, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_CmdCancel_Txn, void *, ignored); UT_GenStub_Execute(CF_CmdCancel_Txn, Basic, NULL); @@ -448,9 +448,9 @@ void CF_DoSuspRes(CF_TransactionCmd_t *cmd, uint8 action) * Generated stub function for CF_DoSuspRes_Txn() * ---------------------------------------------------- */ -void CF_DoSuspRes_Txn(CF_Transaction_t *t, CF_ChanAction_SuspResArg_t *context) +void CF_DoSuspRes_Txn(CF_Transaction_t *txn, CF_ChanAction_SuspResArg_t *context) { - UT_GenStub_AddParam(CF_DoSuspRes_Txn, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_DoSuspRes_Txn, CF_Transaction_t *, txn); UT_GenStub_AddParam(CF_DoSuspRes_Txn, CF_ChanAction_SuspResArg_t *, context); UT_GenStub_Execute(CF_DoSuspRes_Txn, Basic, NULL); @@ -490,12 +490,12 @@ void CF_ProcessGroundCommand(CFE_SB_Buffer_t *msg) * Generated stub function for CF_PurgeHistory() * ---------------------------------------------------- */ -CFE_Status_t CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c) +CFE_Status_t CF_PurgeHistory(CF_CListNode_t *node, CF_Channel_t *chan) { UT_GenStub_SetupReturnBuffer(CF_PurgeHistory, CFE_Status_t); - UT_GenStub_AddParam(CF_PurgeHistory, CF_CListNode_t *, n); - UT_GenStub_AddParam(CF_PurgeHistory, CF_Channel_t *, c); + UT_GenStub_AddParam(CF_PurgeHistory, CF_CListNode_t *, node); + UT_GenStub_AddParam(CF_PurgeHistory, CF_Channel_t *, chan); UT_GenStub_Execute(CF_PurgeHistory, Basic, NULL); @@ -507,11 +507,11 @@ CFE_Status_t CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c) * Generated stub function for CF_PurgeTransaction() * ---------------------------------------------------- */ -CFE_Status_t CF_PurgeTransaction(CF_CListNode_t *n, void *ignored) +CFE_Status_t CF_PurgeTransaction(CF_CListNode_t *node, void *ignored) { UT_GenStub_SetupReturnBuffer(CF_PurgeTransaction, CFE_Status_t); - UT_GenStub_AddParam(CF_PurgeTransaction, CF_CListNode_t *, n); + UT_GenStub_AddParam(CF_PurgeTransaction, CF_CListNode_t *, node); UT_GenStub_AddParam(CF_PurgeTransaction, void *, ignored); UT_GenStub_Execute(CF_PurgeTransaction, Basic, NULL); diff --git a/unit-test/stubs/cf_crc_stubs.c b/unit-test/stubs/cf_crc_stubs.c index 148a29d9..05396bd0 100644 --- a/unit-test/stubs/cf_crc_stubs.c +++ b/unit-test/stubs/cf_crc_stubs.c @@ -31,9 +31,9 @@ * Generated stub function for CF_CRC_Digest() * ---------------------------------------------------- */ -void CF_CRC_Digest(CF_Crc_t *c, const uint8 *data, int len) +void CF_CRC_Digest(CF_Crc_t *crc, const uint8 *data, int len) { - UT_GenStub_AddParam(CF_CRC_Digest, CF_Crc_t *, c); + UT_GenStub_AddParam(CF_CRC_Digest, CF_Crc_t *, crc); UT_GenStub_AddParam(CF_CRC_Digest, const uint8 *, data); UT_GenStub_AddParam(CF_CRC_Digest, int, len); @@ -45,9 +45,9 @@ void CF_CRC_Digest(CF_Crc_t *c, const uint8 *data, int len) * Generated stub function for CF_CRC_Finalize() * ---------------------------------------------------- */ -void CF_CRC_Finalize(CF_Crc_t *c) +void CF_CRC_Finalize(CF_Crc_t *crc) { - UT_GenStub_AddParam(CF_CRC_Finalize, CF_Crc_t *, c); + UT_GenStub_AddParam(CF_CRC_Finalize, CF_Crc_t *, crc); UT_GenStub_Execute(CF_CRC_Finalize, Basic, NULL); } @@ -57,9 +57,9 @@ void CF_CRC_Finalize(CF_Crc_t *c) * Generated stub function for CF_CRC_Start() * ---------------------------------------------------- */ -void CF_CRC_Start(CF_Crc_t *c) +void CF_CRC_Start(CF_Crc_t *crc) { - UT_GenStub_AddParam(CF_CRC_Start, CF_Crc_t *, c); + UT_GenStub_AddParam(CF_CRC_Start, CF_Crc_t *, crc); UT_GenStub_Execute(CF_CRC_Start, Basic, NULL); } diff --git a/unit-test/stubs/cf_timer_stubs.c b/unit-test/stubs/cf_timer_stubs.c index f56cde46..bc0fa419 100644 --- a/unit-test/stubs/cf_timer_stubs.c +++ b/unit-test/stubs/cf_timer_stubs.c @@ -31,11 +31,11 @@ * Generated stub function for CF_Timer_Expired() * ---------------------------------------------------- */ -bool CF_Timer_Expired(const CF_Timer_t *t) +bool CF_Timer_Expired(const CF_Timer_t *txn) { UT_GenStub_SetupReturnBuffer(CF_Timer_Expired, int); - UT_GenStub_AddParam(CF_Timer_Expired, const CF_Timer_t *, t); + UT_GenStub_AddParam(CF_Timer_Expired, const CF_Timer_t *, txn); UT_GenStub_Execute(CF_Timer_Expired, Basic, NULL); @@ -47,9 +47,9 @@ bool CF_Timer_Expired(const CF_Timer_t *t) * Generated stub function for CF_Timer_InitRelSec() * ---------------------------------------------------- */ -void CF_Timer_InitRelSec(CF_Timer_t *t, CF_Timer_Seconds_t rel_sec) +void CF_Timer_InitRelSec(CF_Timer_t *txn, CF_Timer_Seconds_t rel_sec) { - UT_GenStub_AddParam(CF_Timer_InitRelSec, CF_Timer_t *, t); + UT_GenStub_AddParam(CF_Timer_InitRelSec, CF_Timer_t *, txn); UT_GenStub_AddParam(CF_Timer_InitRelSec, CF_Timer_Seconds_t, rel_sec); UT_GenStub_Execute(CF_Timer_InitRelSec, Basic, NULL); @@ -76,9 +76,9 @@ uint32 CF_Timer_Sec2Ticks(CF_Timer_Seconds_t sec) * Generated stub function for CF_Timer_Tick() * ---------------------------------------------------- */ -void CF_Timer_Tick(CF_Timer_t *t) +void CF_Timer_Tick(CF_Timer_t *txn) { - UT_GenStub_AddParam(CF_Timer_Tick, CF_Timer_t *, t); + UT_GenStub_AddParam(CF_Timer_Tick, CF_Timer_t *, txn); UT_GenStub_Execute(CF_Timer_Tick, Basic, NULL); } diff --git a/unit-test/stubs/cf_utils_handlers.c b/unit-test/stubs/cf_utils_handlers.c index 05af6e10..3db59177 100644 --- a/unit-test/stubs/cf_utils_handlers.c +++ b/unit-test/stubs/cf_utils_handlers.c @@ -2,7 +2,7 @@ * NASA Docket No. GSC-18,447-1, and identified as “CFS CFDP (CF) * Application version 3.0.0” * - * Copyright (c) 2019 United States Government as represented by the + * Copyright (chan) 2019 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -52,8 +52,8 @@ void UT_DefaultHandler_CF_ResetHistory(void *UserObj, UT_EntryKey_t FuncKey, con if (ctxt) { - ctxt->c = UT_Hook_GetArgValueByName(Context, "c", CF_Channel_t *); - ctxt->h = UT_Hook_GetArgValueByName(Context, "h", CF_History_t *); + ctxt->chan = UT_Hook_GetArgValueByName(Context, "chan", CF_Channel_t *); + ctxt->history = UT_Hook_GetArgValueByName(Context, "history", CF_History_t *); } } @@ -72,7 +72,7 @@ void UT_DefaultHandler_CF_FindTransactionBySequenceNumber(void *UserObj, UT_Entr if (ctxt) { - ctxt->c = UT_Hook_GetArgValueByName(Context, "c", CF_Channel_t *); + ctxt->chan = UT_Hook_GetArgValueByName(Context, "chan", CF_Channel_t *); ctxt->transaction_sequence_number = UT_Hook_GetArgValueByName(Context, "transaction_sequence_number", CF_TransactionSeq_t); ctxt->src_eid = UT_Hook_GetArgValueByName(Context, "src_eid", CF_EntityId_t); @@ -113,9 +113,9 @@ void UT_DefaultHandler_CF_WriteTxnQueueDataToFile(void *UserObj, UT_EntryKey_t F if (ctxt) { - ctxt->fd = UT_Hook_GetArgValueByName(Context, "fd", int32); - ctxt->c = UT_Hook_GetArgValueByName(Context, "c", CF_Channel_t *); - ctxt->q = UT_Hook_GetArgValueByName(Context, "q", CF_QueueIdx_t); + ctxt->fd = UT_Hook_GetArgValueByName(Context, "fd", int32); + ctxt->chan = UT_Hook_GetArgValueByName(Context, "chan", CF_Channel_t *); + ctxt->queueidx = UT_Hook_GetArgValueByName(Context, "queueidx", CF_QueueIdx_t); } } @@ -133,9 +133,9 @@ void UT_DefaultHandler_CF_WriteHistoryQueueDataToFile(void *UserObj, UT_EntryKey if (ctxt) { - ctxt->fd = UT_Hook_GetArgValueByName(Context, "fd", int32); - ctxt->c = UT_Hook_GetArgValueByName(Context, "c", CF_Channel_t *); - ctxt->dir = UT_Hook_GetArgValueByName(Context, "dir", CF_Direction_t); + ctxt->fd = UT_Hook_GetArgValueByName(Context, "fd", int32); + ctxt->chan = UT_Hook_GetArgValueByName(Context, "chan", CF_Channel_t *); + ctxt->dir = UT_Hook_GetArgValueByName(Context, "dir", CF_Direction_t); } } @@ -151,7 +151,7 @@ void UT_DefaultHandler_CF_TraverseAllTransactions(void *UserObj, UT_EntryKey_t F if (ctxt) { - ctxt->c = UT_Hook_GetArgValueByName(Context, "c", CF_Channel_t *); + ctxt->chan = UT_Hook_GetArgValueByName(Context, "chan", CF_Channel_t *); ctxt->fn = UT_Hook_GetArgValueByName(Context, "fn", CF_TraverseAllTransactions_fn_t); ctxt->context = UT_Hook_GetArgValueByName(Context, "context", void *); } diff --git a/unit-test/stubs/cf_utils_stubs.c b/unit-test/stubs/cf_utils_stubs.c index f12c8e05..7ad5d0b1 100644 --- a/unit-test/stubs/cf_utils_stubs.c +++ b/unit-test/stubs/cf_utils_stubs.c @@ -41,12 +41,12 @@ void UT_DefaultHandler_CF_WriteTxnQueueDataToFile(void *, UT_EntryKey_t, const U * Generated stub function for CF_FindTransactionBySequenceNumber() * ---------------------------------------------------- */ -CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_TransactionSeq_t transaction_sequence_number, +CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *chan, CF_TransactionSeq_t transaction_sequence_number, CF_EntityId_t src_eid) { UT_GenStub_SetupReturnBuffer(CF_FindTransactionBySequenceNumber, CF_Transaction_t *); - UT_GenStub_AddParam(CF_FindTransactionBySequenceNumber, CF_Channel_t *, c); + UT_GenStub_AddParam(CF_FindTransactionBySequenceNumber, CF_Channel_t *, chan); UT_GenStub_AddParam(CF_FindTransactionBySequenceNumber, CF_TransactionSeq_t, transaction_sequence_number); UT_GenStub_AddParam(CF_FindTransactionBySequenceNumber, CF_EntityId_t, src_eid); @@ -60,11 +60,11 @@ CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_Transac * Generated stub function for CF_FindTransactionBySequenceNumber_Impl() * ---------------------------------------------------- */ -CFE_Status_t CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Traverse_TransSeqArg_t *context) +CFE_Status_t CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *node, CF_Traverse_TransSeqArg_t *context) { UT_GenStub_SetupReturnBuffer(CF_FindTransactionBySequenceNumber_Impl, CFE_Status_t); - UT_GenStub_AddParam(CF_FindTransactionBySequenceNumber_Impl, CF_CListNode_t *, n); + UT_GenStub_AddParam(CF_FindTransactionBySequenceNumber_Impl, CF_CListNode_t *, node); UT_GenStub_AddParam(CF_FindTransactionBySequenceNumber_Impl, CF_Traverse_TransSeqArg_t *, context); UT_GenStub_Execute(CF_FindTransactionBySequenceNumber_Impl, Basic, NULL); @@ -77,11 +77,11 @@ CFE_Status_t CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Trave * Generated stub function for CF_FindUnusedTransaction() * ---------------------------------------------------- */ -CF_Transaction_t *CF_FindUnusedTransaction(CF_Channel_t *c) +CF_Transaction_t *CF_FindUnusedTransaction(CF_Channel_t *chan) { UT_GenStub_SetupReturnBuffer(CF_FindUnusedTransaction, CF_Transaction_t *); - UT_GenStub_AddParam(CF_FindUnusedTransaction, CF_Channel_t *, c); + UT_GenStub_AddParam(CF_FindUnusedTransaction, CF_Channel_t *, chan); UT_GenStub_Execute(CF_FindUnusedTransaction, Basic, UT_DefaultHandler_CF_FindUnusedTransaction); @@ -93,9 +93,9 @@ CF_Transaction_t *CF_FindUnusedTransaction(CF_Channel_t *c) * Generated stub function for CF_FreeTransaction() * ---------------------------------------------------- */ -void CF_FreeTransaction(CF_Transaction_t *t) +void CF_FreeTransaction(CF_Transaction_t *txn) { - UT_GenStub_AddParam(CF_FreeTransaction, CF_Transaction_t *, t); + UT_GenStub_AddParam(CF_FreeTransaction, CF_Transaction_t *, txn); UT_GenStub_Execute(CF_FreeTransaction, Basic, NULL); } @@ -105,10 +105,10 @@ void CF_FreeTransaction(CF_Transaction_t *t) * Generated stub function for CF_InsertSortPrio() * ---------------------------------------------------- */ -void CF_InsertSortPrio(CF_Transaction_t *t, CF_QueueIdx_t q) +void CF_InsertSortPrio(CF_Transaction_t *txn, CF_QueueIdx_t queue) { - UT_GenStub_AddParam(CF_InsertSortPrio, CF_Transaction_t *, t); - UT_GenStub_AddParam(CF_InsertSortPrio, CF_QueueIdx_t, q); + UT_GenStub_AddParam(CF_InsertSortPrio, CF_Transaction_t *, txn); + UT_GenStub_AddParam(CF_InsertSortPrio, CF_QueueIdx_t, queue); UT_GenStub_Execute(CF_InsertSortPrio, Basic, NULL); } @@ -135,10 +135,10 @@ CFE_Status_t CF_PrioSearch(CF_CListNode_t *node, void *context) * Generated stub function for CF_ResetHistory() * ---------------------------------------------------- */ -void CF_ResetHistory(CF_Channel_t *c, CF_History_t *h) +void CF_ResetHistory(CF_Channel_t *chan, CF_History_t *history) { - UT_GenStub_AddParam(CF_ResetHistory, CF_Channel_t *, c); - UT_GenStub_AddParam(CF_ResetHistory, CF_History_t *, h); + UT_GenStub_AddParam(CF_ResetHistory, CF_Channel_t *, chan); + UT_GenStub_AddParam(CF_ResetHistory, CF_History_t *, history); UT_GenStub_Execute(CF_ResetHistory, Basic, UT_DefaultHandler_CF_ResetHistory); } @@ -148,11 +148,11 @@ void CF_ResetHistory(CF_Channel_t *c, CF_History_t *h) * Generated stub function for CF_TraverseAllTransactions() * ---------------------------------------------------- */ -CFE_Status_t CF_TraverseAllTransactions(CF_Channel_t *c, CF_TraverseAllTransactions_fn_t fn, void *context) +CFE_Status_t CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransactions_fn_t fn, void *context) { UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions, CFE_Status_t); - UT_GenStub_AddParam(CF_TraverseAllTransactions, CF_Channel_t *, c); + UT_GenStub_AddParam(CF_TraverseAllTransactions, CF_Channel_t *, chan); UT_GenStub_AddParam(CF_TraverseAllTransactions, CF_TraverseAllTransactions_fn_t, fn); UT_GenStub_AddParam(CF_TraverseAllTransactions, void *, context); @@ -184,11 +184,11 @@ CFE_Status_t CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_ * Generated stub function for CF_TraverseAllTransactions_Impl() * ---------------------------------------------------- */ -CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_Arg_t *args) +CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *node, CF_TraverseAll_Arg_t *args) { UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions_Impl, CFE_Status_t); - UT_GenStub_AddParam(CF_TraverseAllTransactions_Impl, CF_CListNode_t *, n); + UT_GenStub_AddParam(CF_TraverseAllTransactions_Impl, CF_CListNode_t *, node); UT_GenStub_AddParam(CF_TraverseAllTransactions_Impl, CF_TraverseAll_Arg_t *, args); UT_GenStub_Execute(CF_TraverseAllTransactions_Impl, Basic, NULL); @@ -201,11 +201,11 @@ CFE_Status_t CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_A * Generated stub function for CF_Traverse_WriteHistoryQueueEntryToFile() * ---------------------------------------------------- */ -CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *arg) +CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void *arg) { UT_GenStub_SetupReturnBuffer(CF_Traverse_WriteHistoryQueueEntryToFile, CFE_Status_t); - UT_GenStub_AddParam(CF_Traverse_WriteHistoryQueueEntryToFile, CF_CListNode_t *, n); + UT_GenStub_AddParam(CF_Traverse_WriteHistoryQueueEntryToFile, CF_CListNode_t *, node); UT_GenStub_AddParam(CF_Traverse_WriteHistoryQueueEntryToFile, void *, arg); UT_GenStub_Execute(CF_Traverse_WriteHistoryQueueEntryToFile, Basic, NULL); @@ -218,11 +218,11 @@ CFE_Status_t CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *a * Generated stub function for CF_Traverse_WriteTxnQueueEntryToFile() * ---------------------------------------------------- */ -CFE_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *n, void *arg) +CFE_Status_t CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *node, void *arg) { UT_GenStub_SetupReturnBuffer(CF_Traverse_WriteTxnQueueEntryToFile, CFE_Status_t); - UT_GenStub_AddParam(CF_Traverse_WriteTxnQueueEntryToFile, CF_CListNode_t *, n); + UT_GenStub_AddParam(CF_Traverse_WriteTxnQueueEntryToFile, CF_CListNode_t *, node); UT_GenStub_AddParam(CF_Traverse_WriteTxnQueueEntryToFile, void *, arg); UT_GenStub_Execute(CF_Traverse_WriteTxnQueueEntryToFile, Basic, NULL); @@ -368,12 +368,12 @@ CFE_Status_t CF_WrappedWrite(osal_id_t fd, const void *buf, size_t write_size) * Generated stub function for CF_WriteHistoryEntryToFile() * ---------------------------------------------------- */ -CFE_Status_t CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h) +CFE_Status_t CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *history) { UT_GenStub_SetupReturnBuffer(CF_WriteHistoryEntryToFile, CFE_Status_t); UT_GenStub_AddParam(CF_WriteHistoryEntryToFile, osal_id_t, fd); - UT_GenStub_AddParam(CF_WriteHistoryEntryToFile, const CF_History_t *, h); + UT_GenStub_AddParam(CF_WriteHistoryEntryToFile, const CF_History_t *, history); UT_GenStub_Execute(CF_WriteHistoryEntryToFile, Basic, NULL); @@ -385,12 +385,12 @@ CFE_Status_t CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h) * Generated stub function for CF_WriteHistoryQueueDataToFile() * ---------------------------------------------------- */ -CFE_Status_t CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Direction_t dir) +CFE_Status_t CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *chan, CF_Direction_t dir) { UT_GenStub_SetupReturnBuffer(CF_WriteHistoryQueueDataToFile, CFE_Status_t); UT_GenStub_AddParam(CF_WriteHistoryQueueDataToFile, osal_id_t, fd); - UT_GenStub_AddParam(CF_WriteHistoryQueueDataToFile, CF_Channel_t *, c); + UT_GenStub_AddParam(CF_WriteHistoryQueueDataToFile, CF_Channel_t *, chan); UT_GenStub_AddParam(CF_WriteHistoryQueueDataToFile, CF_Direction_t, dir); UT_GenStub_Execute(CF_WriteHistoryQueueDataToFile, Basic, UT_DefaultHandler_CF_WriteHistoryQueueDataToFile); @@ -403,13 +403,13 @@ CFE_Status_t CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Di * Generated stub function for CF_WriteTxnQueueDataToFile() * ---------------------------------------------------- */ -CFE_Status_t CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_QueueIdx_t q) +CFE_Status_t CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *chan, CF_QueueIdx_t queue) { UT_GenStub_SetupReturnBuffer(CF_WriteTxnQueueDataToFile, CFE_Status_t); UT_GenStub_AddParam(CF_WriteTxnQueueDataToFile, osal_id_t, fd); - UT_GenStub_AddParam(CF_WriteTxnQueueDataToFile, CF_Channel_t *, c); - UT_GenStub_AddParam(CF_WriteTxnQueueDataToFile, CF_QueueIdx_t, q); + UT_GenStub_AddParam(CF_WriteTxnQueueDataToFile, CF_Channel_t *, chan); + UT_GenStub_AddParam(CF_WriteTxnQueueDataToFile, CF_QueueIdx_t, queue); UT_GenStub_Execute(CF_WriteTxnQueueDataToFile, Basic, UT_DefaultHandler_CF_WriteTxnQueueDataToFile); diff --git a/unit-test/utilities/cf_test_alt_handler.c b/unit-test/utilities/cf_test_alt_handler.c index 25f7bb39..4852caa9 100644 --- a/unit-test/utilities/cf_test_alt_handler.c +++ b/unit-test/utilities/cf_test_alt_handler.c @@ -125,7 +125,7 @@ void UT_AltHandler_CF_CList_Traverse_R_PRIO(void *UserObj, UT_EntryKey_t FuncKey /* This handler is a little different in that it sets the output to the caller */ if (arg) { - arg->t = ctxt->context_t; + arg->txn = ctxt->context_t; } } } diff --git a/unit-test/utilities/cf_test_utils.h b/unit-test/utilities/cf_test_utils.h index b38ffabb..ef833a9e 100644 --- a/unit-test/utilities/cf_test_utils.h +++ b/unit-test/utilities/cf_test_utils.h @@ -2,7 +2,7 @@ * NASA Docket No. GSC-18,447-1, and identified as “CFS CFDP (CF) * Application version 3.0.0” * - * Copyright (c) 2019 United States Government as represented by the + * Copyright (chan) 2019 United States Government as represented by the * Administrator of the National Aeronautics and Space Administration. * All Rights Reserved. * @@ -87,7 +87,7 @@ typedef struct typedef struct { - CF_Channel_t * c; + CF_Channel_t * chan; CF_TransactionSeq_t transaction_sequence_number; CF_EntityId_t src_eid; CF_Transaction_t * forced_return; @@ -102,14 +102,14 @@ typedef struct typedef struct { - CF_Transaction_t *t; + CF_Transaction_t *txn; int keep_history; } CF_CFDP_ResetTransaction_context_t; typedef struct { - CF_Channel_t *c; - CF_History_t *h; + CF_Channel_t *chan; + CF_History_t *history; } CF_CFDP_ResetHistory_context_t; typedef struct @@ -122,20 +122,20 @@ typedef struct typedef struct { int32 fd; - CF_Channel_t *c; - CF_QueueIdx_t q; + CF_Channel_t *chan; + CF_QueueIdx_t queueidx; } CF_WriteTxnQueueDataToFile_context_t; typedef struct { int32 fd; - CF_Channel_t * c; + CF_Channel_t * chan; CF_Direction_t dir; } CF_WriteHistoryQueueDataToFile_context_t; typedef struct { - CF_Channel_t * c; + CF_Channel_t * chan; CF_TraverseAllTransactions_fn_t fn; void * context; } CF_TraverseAllTransactions_context_t;