diff --git a/fsw/src/cf_cfdp.c b/fsw/src/cf_cfdp.c index ecd0d808..8f4ee7d4 100644 --- a/fsw/src/cf_cfdp.c +++ b/fsw/src/cf_cfdp.c @@ -126,10 +126,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; } /*---------------------------------------------------------------- @@ -139,10 +139,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)); } /*---------------------------------------------------------------- @@ -152,12 +152,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 int CF_CFDP_IsSender(CF_Transaction_t *t) +static inline int 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)); } /*---------------------------------------------------------------- @@ -167,9 +167,9 @@ static inline int 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); } /*---------------------------------------------------------------- @@ -180,7 +180,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, @@ -189,8 +189,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 */ } /*---------------------------------------------------------------- @@ -200,12 +200,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); } /*---------------------------------------------------------------- @@ -215,14 +215,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; } @@ -257,7 +257,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) { @@ -266,7 +266,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) { @@ -275,7 +275,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) @@ -308,7 +308,7 @@ CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *t, CF /* If directive code is zero, the pdu is a file data pdu which has no directive code field. * So only set if non-zero, otherwise it will write a 0 to a byte in a file data pdu where we - * don't necessarily want a 0. */ + * don'txn necessarily want a 0. */ if (directive_code) { /* set values which can be determined at this time */ @@ -347,11 +347,11 @@ static inline size_t CF_strnlen(const char *s, size_t maxlen) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CF_SendRet_t CF_CFDP_SendMd(CF_Transaction_t *t) +CF_SendRet_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; CF_SendRet_t sret; @@ -366,21 +366,22 @@ CF_SendRet_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; @@ -394,7 +395,7 @@ CF_SendRet_t CF_CFDP_SendMd(CF_Transaction_t *t) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CF_SendRet_t CF_CFDP_SendFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CF_SendRet_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 */ CF_SendRet_t ret = CF_SendRet_SUCCESS; @@ -403,7 +404,7 @@ CF_SendRet_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; } @@ -455,11 +456,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 * *-----------------------------------------------------------------*/ -CF_SendRet_t CF_CFDP_SendEof(CF_Transaction_t *t) +CF_SendRet_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; CF_SendRet_t ret = CF_SendRet_SUCCESS; @@ -471,9 +472,9 @@ CF_SendRet_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) { @@ -482,7 +483,7 @@ CF_SendRet_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; @@ -496,7 +497,7 @@ CF_SendRet_t CF_CFDP_SendEof(CF_Transaction_t *t) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CF_SendRet_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_CFDP_FileDirective_t dir_code, +CF_SendRet_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; @@ -507,7 +508,7 @@ CF_SendRet_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; @@ -518,7 +519,7 @@ CF_SendRet_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) { @@ -535,7 +536,7 @@ CF_SendRet_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; @@ -549,12 +550,12 @@ CF_SendRet_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_ * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CF_SendRet_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, +CF_SendRet_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; CF_SendRet_t ret = CF_SendRet_SUCCESS; @@ -577,7 +578,7 @@ CF_SendRet_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; @@ -591,7 +592,7 @@ CF_SendRet_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -CF_SendRet_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CF_SendRet_t CF_CFDP_SendNak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { CF_Logical_PduNak_t *nak; CF_SendRet_t ret = CF_SendRet_SUCCESS; @@ -603,7 +604,7 @@ CF_SendRet_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; @@ -614,7 +615,7 @@ CF_SendRet_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; @@ -648,7 +649,7 @@ int CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph) /* * The "large file" flag is not supported by this implementation yet. * This means file sizes and offsets will be 64 bits, so codec routines - * will need to be updated to understand this. OSAL also doesn't support + * will need to be updated to understand this. OSAL also doesn'txn support * 64-bit file access yet. */ else if (CF_CODEC_IS_OK(ph->pdec) && ph->pdu_header.large_flag) @@ -690,7 +691,7 @@ int CF_CFDP_RecvPh(uint8 chan_num, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -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) { const CF_Logical_PduMd_t *md = &ph->int_header.md; int lv_ret; @@ -702,7 +703,7 @@ int 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; /* error return path */ ret = -1; } @@ -710,7 +711,7 @@ int CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) { /* store the expected file size in transaction */ - t->fsize = md->size; + txn->fsize = md->size; /* * store the filenames in transaction. @@ -719,35 +720,35 @@ int 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; /* error return path */ ret = -1; } else { - lv_ret = CF_CFDP_CopyStringFromLV(t->history->fnames.dst_filename, sizeof(t->history->fnames.dst_filename), - &md->dest_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; /* error return path */ ret = -1; } 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); } } } @@ -764,7 +765,7 @@ int CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -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) { int ret = 0; @@ -787,8 +788,8 @@ int 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 = -1; } else if (ph->pdu_header.segment_meta_flag) @@ -796,8 +797,8 @@ int 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 = -1; } @@ -812,7 +813,7 @@ int CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -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) { int ret = 0; @@ -836,7 +837,7 @@ int CF_CFDP_RecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -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) { int ret = 0; @@ -861,7 +862,7 @@ int CF_CFDP_RecvAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -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) { int ret = 0; @@ -874,7 +875,7 @@ int CF_CFDP_RecvFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) ret = -1; } - /* NOTE: right now we don't care about the fault location */ + /* NOTE: right now we don'txn care about the fault location */ /* nothing to do for this one. All fields are bytes */ return ret; } @@ -887,7 +888,7 @@ int CF_CFDP_RecvFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -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) { int ret = 0; @@ -911,9 +912,9 @@ int 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; } /*---------------------------------------------------------------- @@ -924,20 +925,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 */ @@ -948,19 +949,19 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * about the transaction in progress, so most likely PDUs were missed. */ /* if class 2, switch into R2 state and let it handle */ - /* don't forget to bind the transaction */ + /* don'txn forget to bind the transaction */ if (ph->pdu_header.txm_mode) { - /* R1, can't do anything without metadata first */ - t->state = CF_TxnState_DROP; /* drop all incoming */ + /* R1, can'txn do anything without metadata first */ + 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 @@ -971,34 +972,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); } } @@ -1016,8 +1017,8 @@ int32 CF_CFDP_InitEngine(void) int i; int j; int chunk_mem_offset = 0; - CF_Transaction_t * t = CF_AppData.engine.transactions; - CF_ChunkWrapper_t *c = CF_AppData.engine.chunks; + CF_Transaction_t * txn = CF_AppData.engine.transactions; + CF_ChunkWrapper_t *chan = CF_AppData.engine.chunks; int32 ret = CFE_SUCCESS; static const int CF_DIR_MAX_CHUNKS[CF_Direction_NUM][CF_NUM_CHANNELS] = {CF_CHANNEL_NUM_RX_CHUNKS_PER_TRANSACTION, @@ -1062,28 +1063,29 @@ int32 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) { int k; - 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, ++chan) { 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(&chan->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(&chan->cl_node); + CF_CList_InsertBack(&CF_AppData.engine.channels[i].cs[k], &chan->cl_node); } } for (j = 0; j < CF_NUM_HISTORIES_PER_CHANNEL; ++j) { - CF_History_t *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); + CF_History_t *histories = &CF_AppData.engine.histories[(i * CF_NUM_HISTORIES_PER_CHANNEL) + j]; + CF_CList_InitNode(&histories->cl_node); + CF_CList_InsertBack_Ex(&CF_AppData.engine.channels[i], CF_QueueIdx_HIST_FREE, &histories->cl_node); } } @@ -1106,25 +1108,25 @@ int32 CF_CFDP_InitEngine(void) int 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); int 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; @@ -1141,40 +1143,40 @@ int 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) - { /* don't enter if cur is set, since we need to pick up where we left off on tick processing next wakeup */ + if (!chan->cur) + { /* don'txn 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; } } @@ -1188,29 +1190,29 @@ void CF_CFDP_CycleTx(CF_Channel_t *c) *-----------------------------------------------------------------*/ int CF_CFDP_DoTick(CF_CListNode_t *node, void *context) { - int ret = CF_CLIST_CONT; /* CF_CLIST_CONT means don't tick one, keep looking for cur */ + int ret = CF_CLIST_CONT; /* CF_CLIST_CONT means don'txn 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 */ - /* NOTE: if channel is frozen, then tick processing won't have been entered. + /* if args->chan->cur was set to not-NULL above, then exit early */ + /* NOTE: if channel is frozen, then tick processing won'txn 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; } } - return ret; /* don't tick one, keep looking for cur */ + return ret; /* don'txn tick one, keep looking for cur */ } /*---------------------------------------------------------------- @@ -1221,7 +1223,7 @@ int 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; @@ -1229,16 +1231,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. @@ -1247,7 +1249,7 @@ void CF_CFDP_TickTransactions(CF_Channel_t *c) * * If RX ticks use up all available messages, then we pick up where we left * off on the next cycle. (This causes some RX tick counts to be missed, - * but that's ok. Precise timing isn't required.) + * but that's ok. Precise timing isn'txn required.) * * This scheme allows the following priority for use of outgoing messages: * @@ -1257,7 +1259,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; } @@ -1274,7 +1276,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 */ } } @@ -1286,12 +1288,13 @@ 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_num, + 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_num; + txn->priority = priority; + txn->keep = keep; + txn->state = cfdp_class ? CF_TxnState_S2 : CF_TxnState_S1; } /*---------------------------------------------------------------- @@ -1301,31 +1304,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_num, 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_num, 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_num], CF_Direction_TX); + CF_InsertSortPrio(txn, CF_QueueIdx_PEND); } /*---------------------------------------------------------------- @@ -1337,15 +1340,15 @@ static void CF_CFDP_TxFile_Initiate(CF_Transaction_t *t, CF_CFDP_Class_t cfdp_cl * *-----------------------------------------------------------------*/ int32 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); int32 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"); @@ -1354,20 +1357,20 @@ int32 CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, CF_CFDP 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; @@ -1380,34 +1383,34 @@ int32 CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, CF_CFDP * Internal helper routine only, not part of API. * *-----------------------------------------------------------------*/ -static int32 CF_CFDP_PlaybackDir_Initiate(CF_Playback_t *p, const char *src_filename, const char *dst_filename, - CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, +static int32 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_num, uint8 priority, CF_EntityId_t dest_id) { int32 ret = CFE_SUCCESS; /* 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, - "CF: failed to open playback directory %s, error=%ld", src_filename, (long)ret); - ++CF_AppData.hk.channel_hk[chan].counters.fault.directory_read; + "CF: failed to open pb directory %s, error=%ld", src_filename, (long)ret); + ++CF_AppData.hk.channel_hk[chan_num].counters.fault.directory_read; } 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 */ @@ -1423,15 +1426,15 @@ static int32 CF_CFDP_PlaybackDir_Initiate(CF_Playback_t *p, const char *src_file * *-----------------------------------------------------------------*/ int32 CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filename, CF_CFDP_Class_t cfdp_class, uint8 keep, - uint8 chan, uint8 priority, uint16 dest_id) + uint8 chan_num, 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_num].playback[i]; + if (!pb->busy) { break; } @@ -1439,11 +1442,11 @@ int32 CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filename, CF if (i == CF_MAX_COMMANDED_PLAYBACK_DIRECTORIES_PER_CHAN) { - CFE_EVS_SendEvent(CF_EID_ERR_CFDP_DIR_SLOT, CFE_EVS_EventType_ERROR, "CF: no playback dir slot available"); + CFE_EVS_SendEvent(CF_EID_ERR_CFDP_DIR_SLOT, CFE_EVS_EventType_ERROR, "CF: no pb dir slot available"); return -1; } - 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_num, priority, dest_id); } /*---------------------------------------------------------------- @@ -1454,19 +1457,19 @@ int32 CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filename, CF * 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) { os_dirent_t dirent; /* either there's no transaction (first one) or the last one was finished, so check for a new one */ 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)) { int32 status; 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) @@ -1477,40 +1480,40 @@ void CF_CFDP_ProcessPlaybackDirectory(CF_Channel_t *c, CF_Playback_t *p) } { - CF_Transaction_t *pt = CF_FindUnusedTransaction(c); + CF_Transaction_t *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 */ + /* in case snprintf didn'txn 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; + * for this pb -- so mark it as not busy */ + pb->busy = 0; } } @@ -1534,7 +1537,7 @@ static void CF_CFDP_UpdatePollPbCounted(CF_Playback_t *pb, int up, uint8 *counte } else { - CF_Assert(*counter); /* sanity check it isn't zero */ + CF_Assert(*counter); /* sanity check it isn'txn zero */ --*counter; } } @@ -1547,15 +1550,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); } } @@ -1568,14 +1571,14 @@ 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) { int i; for (i = 0; i < CF_MAX_POLLING_DIR_PER_CHAN; ++i) { - CF_Poll_t * p = &c->poll[i]; - int chan_index = (c - CF_AppData.engine.channels); + CF_Poll_t * pb = &chan->poll[i]; + int chan_index = (chan - CF_AppData.engine.channels); CF_ChannelConfig_t *cc = &CF_AppData.config_table->chan[chan_index]; CF_PollDir_t * pd = &cc->polldir[i]; int count_check = 0; @@ -1583,44 +1586,44 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c) if (pd->enabled && pd->interval_sec) { /* only handle polling for polldirs configured with a non-zero interval */ - if (!p->pb.busy && !p->pb.num_ts) + if (!pb->pb.busy && !pb->pb.num_ts) { - if (!p->timer_set) + if (!pb->timer_set) { /* timer was not set, so set it now */ - CF_Timer_InitRelSec(&p->interval_timer, pd->interval_sec); - p->timer_set = 1; + CF_Timer_InitRelSec(&pb->interval_timer, pd->interval_sec); + pb->timer_set = 1; } - else if (CF_Timer_Expired(&p->interval_timer)) + else if (CF_Timer_Expired(&pb->interval_timer)) { /* the timer has expired */ - int ret = CF_CFDP_PlaybackDir_Initiate(&p->pb, pd->src_dir, pd->dst_dir, pd->cfdp_class, 0, + int ret = CF_CFDP_PlaybackDir_Initiate(&pb->pb, pd->src_dir, pd->dst_dir, pd->cfdp_class, 0, chan_index, pd->priority, pd->dest_eid); if (!ret) { - p->timer_set = 0; + pb->timer_set = 0; } else { - /* error occurred in playback directory, so reset the timer */ + /* error occurred in pb 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(&pb->interval_timer, pd->interval_sec); } } else - CF_Timer_Tick(&p->interval_timer); + CF_Timer_Tick(&pb->interval_timer); } else { - /* playback is active, so step it */ - CF_CFDP_ProcessPlaybackDirectory(c, &p->pb); + /* pb is active, so step it */ + CF_CFDP_ProcessPlaybackDirectory(chan, &pb->pb); } count_check = 1; } - CF_CFDP_UpdatePollPbCounted(&p->pb, count_check, &CF_AppData.hk.channel_hk[chan_index].poll_counter); + CF_CFDP_UpdatePollPbCounted(&pb->pb, count_check, &CF_AppData.hk.channel_hk[chan_index].poll_counter); } } @@ -1640,11 +1643,11 @@ void CF_CFDP_CycleEngine(void) { for (i = 0; i < CF_NUM_CHANNELS; ++i) { - CF_Channel_t *c = &CF_AppData.engine.channels[i]; + CF_Channel_t *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) { @@ -1653,13 +1656,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); } } } @@ -1673,45 +1676,45 @@ 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) { - 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)) { - 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; + /* a pb's transaction is now done, decrement the pb counter */ + CF_Assert(txn->pb->num_ts); + --txn->pb->num_ts; } } @@ -1719,20 +1722,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'txn get a message previously, so clear it here to avoid problems */ } - CF_FreeTransaction(t); + CF_FreeTransaction(txn); } /*---------------------------------------------------------------- @@ -1743,11 +1746,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; } } @@ -1759,7 +1762,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; @@ -1772,16 +1775,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)); - 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 @@ -1821,14 +1824,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); } } @@ -1840,12 +1843,12 @@ void CF_CFDP_CancelTransaction(CF_Transaction_t *t) * See description in cf_cfdp.h for argument/return detail * *-----------------------------------------------------------------*/ -int CF_CFDP_CloseFiles(CF_CListNode_t *n, void *context) +int 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; } @@ -1863,40 +1866,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 */ + /* any pb 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 a2dba4ce..7b90b4eb 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 @@ -111,11 +111,11 @@ void CF_CFDP_SetTxnStatus(CF_Transaction_t *t, 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 @@ -164,7 +164,7 @@ void CF_CFDP_DisableEngine(void); * @param dst_filename Remote filename * @param cfdp_class Whether to perform a class 1 or class 2 transfer * @param keep Whether to keep or delete the local file after completion - * @param chan CF channel number to use + * @param chan_num CF channel number to use * @param priority CF priority level * @param dest_id Entity ID of remote receiver * @@ -172,7 +172,7 @@ void CF_CFDP_DisableEngine(void); * @returns Anything else on error. */ int32 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); /************************************************************************/ /** @brief Begin transmit of a directory. @@ -188,7 +188,7 @@ int32 CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, CF_CFDP * @param dst_filename Remote filename * @param cfdp_class Whether to perform a class 1 or class 2 transfer * @param keep Whether to keep or delete the local file after completion - * @param chan CF channel number to use + * @param chan_num CF channel number to use * @param priority CF priority level * @param dest_id Entity ID of remote receiver * @@ -196,15 +196,15 @@ int32 CF_CFDP_TxFile(const char *src_filename, const char *dst_filename, CF_CFDP * @returns Anything else on error. */ int32 CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filename, CF_CFDP_Class_t cfdp_class, uint8 keep, - uint8 chan, uint8 priority, uint16 dest_id); + uint8 chan_num, uint8 priority, uint16 dest_id); /************************************************************************/ /** @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 @@ int32 CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filename, CF * @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,24 +223,24 @@ 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 CF_SendRet_t status code * @retval CF_SendRet_SUCCESS on success. * @retval CF_SendRet_NO_MSG if message buffer cannot be obtained. * @retval CF_SendRet_ERROR if an error occurred while building the packet. */ -CF_SendRet_t CF_CFDP_SendMd(CF_Transaction_t *t); +CF_SendRet_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 @@ -251,34 +251,34 @@ CF_SendRet_t CF_CFDP_SendMd(CF_Transaction_t *t); * @returns CF_SendRet_t status code * @retval CF_SendRet_SUCCESS on success. */ -CF_SendRet_t CF_CFDP_SendFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +CF_SendRet_t CF_CFDP_SendFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Build a 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 CF_SendRet_t status code * @retval CF_SendRet_SUCCESS on success. * @retval CF_SendRet_NO_MSG if message buffer cannot be obtained. * @retval CF_SendRet_ERROR if an error occurred while building the packet. */ -CF_SendRet_t CF_CFDP_SendEof(CF_Transaction_t *t); +CF_SendRet_t CF_CFDP_SendEof(CF_Transaction_t *txn); /************************************************************************/ /** @brief Build a 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 @@ -291,16 +291,16 @@ CF_SendRet_t CF_CFDP_SendEof(CF_Transaction_t *t); * @retval CF_SendRet_ERROR if an error occurred while building the packet. * */ -CF_SendRet_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_CFDP_FileDirective_t dir_code, +CF_SendRet_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 @@ -310,16 +310,16 @@ CF_SendRet_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_ * @retval CF_SendRet_NO_MSG if message buffer cannot be obtained. * @retval CF_SendRet_ERROR if an error occurred while building the packet. */ -CF_SendRet_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, +CF_SendRet_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 @@ -330,7 +330,7 @@ CF_SendRet_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, * @returns CF_SendRet_t status code * @retval CF_SendRet_SUCCESS on success. */ -CF_SendRet_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); +CF_SendRet_t CF_CFDP_SendNak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph); /************************************************************************/ /** @brief Appends a single TLV value to the logical PDU data @@ -374,16 +374,16 @@ int 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 0 on success * @retval -1 on error */ -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); /************************************************************************/ /** @brief Unpack a file data PDU from a received message. @@ -392,9 +392,9 @@ int 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 @@ -402,7 +402,7 @@ int CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * @retval -1 on error * */ -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); /************************************************************************/ /** @brief Unpack an eof PDU from a received message. @@ -411,9 +411,9 @@ int 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 @@ -421,7 +421,7 @@ int CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * @retval -1 on error * */ -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); /************************************************************************/ /** @brief Unpack an ack PDU from a received message. @@ -430,9 +430,9 @@ int 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 @@ -440,7 +440,7 @@ int CF_CFDP_RecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * @retval -1 on error * */ -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); /************************************************************************/ /** @brief Unpack an fin PDU from a received message. @@ -449,9 +449,9 @@ int CF_CFDP_RecvAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * as an 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 @@ -459,7 +459,7 @@ int CF_CFDP_RecvAck(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * @retval -1 on error * */ -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); /************************************************************************/ /** @brief Unpack a nak PDU from a received message. @@ -468,9 +468,9 @@ int CF_CFDP_RecvFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * as an 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 @@ -478,7 +478,7 @@ int CF_CFDP_RecvFin(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * @retval -1 on error * */ -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); /************************************************************************/ /** @brief Dispatch received packet to its handler. @@ -487,24 +487,24 @@ int 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. @@ -513,16 +513,17 @@ 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 chan_num 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_num, + uint8 priority); /* functions to handle LVs (length-value, cfdp spec) */ /* returns number of bytes copied, or -1 on error */ @@ -557,26 +558,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. @@ -589,12 +590,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. @@ -602,15 +603,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. */ -int CF_CFDP_CloseFiles(CF_CListNode_t *n, void *context); +int CF_CFDP_CloseFiles(CF_CListNode_t *node, void *context); /************************************************************************/ /** @brief Cycle the current active tx or make a new one active. @@ -624,9 +625,9 @@ int 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. @@ -659,40 +660,40 @@ int 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. +/** @brief Step each active pb directory. * * @par Description - * Check if a playback directory needs iterated, and if so does, and - * if a valid file is found initiates playback on it. + * Check if a pb directory needs iterated, and if so does, and + * if a valid file is found initiates pb 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 pb + * @param pb The pb 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. +/** @brief Kick the dir pb if timer elapsed. * * @par Description * This function waits for the polling directory interval timer, - * and if it has expired, starts a playback in the polling directory. + * and if it has expired, starts a pb 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 pb */ -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 69e7c838..2056d5f6 100644 --- a/fsw/src/cf_cfdp_dispatch.c +++ b/fsw/src/cf_cfdp_dispatch.c @@ -39,10 +39,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; @@ -54,29 +54,30 @@ 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; } } @@ -86,7 +87,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); } } @@ -98,10 +99,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; @@ -114,7 +115,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]; @@ -122,18 +123,19 @@ 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, @@ -144,7 +146,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); } } @@ -156,14 +158,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); } } @@ -175,15 +177,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); } } @@ -195,15 +197,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 716e2b4b..1886f907 100644 --- a/fsw/src/cf_cfdp_r.c +++ b/fsw/src/cf_cfdp_r.c @@ -46,10 +46,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; } /*---------------------------------------------------------------- @@ -60,9 +60,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); } /*---------------------------------------------------------------- @@ -73,18 +73,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; } } @@ -96,18 +96,18 @@ void CF_CFDP_R2_Reset(CF_Transaction_t *t) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -int CF_CFDP_R_CheckCrc(CF_Transaction_t *t, uint32 expected_crc) +int CF_CFDP_R_CheckCrc(CF_Transaction_t *txn, uint32 expected_crc) { int ret = 0; - 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; } @@ -122,31 +122,31 @@ int 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) { int send_nak = 0; int send_fin = 0; /* 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 */ - uint32 ret = CF_ChunkList_ComputeGaps(&t->chunks->chunks, 1, t->fsize, 0, NULL, NULL); + uint32 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; @@ -156,37 +156,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; } } @@ -198,7 +198,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 * *-----------------------------------------------------------------*/ -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) { const CF_Logical_PduFileDataHeader_t *fd; int32 fret; @@ -214,38 +214,38 @@ int 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, - (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 %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(txn, CF_TxnStatus_FILE_SIZE_ERROR); + ++CF_AppData.hk.channel_hk[txn->chan_num].counters.fault.file_seek; ret = -1; /* connection will reset in caller */ } } if (ret != -1) { - 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 = -1; /* 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; } } @@ -260,33 +260,34 @@ int CF_CFDP_R_ProcessFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -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) { int ret = CF_RxEofRet_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_RxEofRet_FSIZE_MISMATCH; } } 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_RxEofRet_BAD_EOF; } @@ -301,9 +302,9 @@ int CF_CFDP_R_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_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; @@ -314,17 +315,17 @@ void CF_CFDP_R1_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) if (ret == CF_RxEofRet_SUCCESS) { /* Verify crc */ - if (CF_CFDP_R_CheckCrc(t, crc) == 0) + if (CF_CFDP_R_CheckCrc(txn, crc) == 0) { /* 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); } /*---------------------------------------------------------------- @@ -335,39 +336,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 == CF_RxEofRet_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 @@ -375,12 +376,12 @@ void CF_CFDP_R2_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) /* bad eof sent? */ if (ret == CF_RxEofRet_FSIZE_MISMATCH) { - 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; } } } @@ -394,26 +395,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 == 0) { - ret = CF_CFDP_R_ProcessFd(t, ph); + ret = CF_CFDP_R_ProcessFd(txn, ph); } if (ret == 0) { /* 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); } } @@ -425,7 +426,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; @@ -434,33 +435,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 == 0) { - ret = CF_CFDP_R_ProcessFd(t, ph); + ret = CF_CFDP_R_ProcessFd(txn, ph); } if (ret == 0) { /* 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); } } @@ -506,11 +507,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 * *-----------------------------------------------------------------*/ -int CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t) +int 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; CF_SendRet_t sret; @@ -520,37 +521,37 @@ int 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}; uint32 cret; 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 */ - ret = 0; + txn->flags.rx.complete = 1; /* we know md was received, and there's no gaps -- it's complete */ + ret = 0; } 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 */ + nak->scope_end = 0; + 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_SendRet_ERROR); /* NOTE: this CF_Assert is here because CF_CFDP_SendNak() does not return CF_SendRet_ERROR, so if it's ever added to that function we need to test handling it here */ if (sret == CF_SendRet_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 = 0; } } @@ -560,8 +561,8 @@ int 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; @@ -569,7 +570,7 @@ int 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_SendRet_ERROR); /* this CF_Assert is here because CF_CFDP_SendNak() does not return CF_SendRet_ERROR */ if (sret == CF_SendRet_SUCCESS) @@ -590,51 +591,51 @@ int 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; } } @@ -646,7 +647,7 @@ void CF_CFDP_R_Init(CF_Transaction_t *t) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -int CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) +int CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *txn) { uint8 buf[CF_R2_CRC_CHUNK_SIZE]; size_t count_bytes; @@ -661,78 +662,78 @@ int CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) count_bytes = 0; ret = -1; - 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 = 0; } @@ -748,15 +749,15 @@ int CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) * See description in cf_cfdp_r.h for argument/return detail * *-----------------------------------------------------------------*/ -int CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t) +int CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *txn) { CF_SendRet_t sret; int ret = 0; - 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 = -1; /* signal to caller to re-enter next tick */ } @@ -764,10 +765,10 @@ int CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t) if (ret != -1) { - 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_SendRet_ERROR); /* CF_CFDP_SendFin does not return CF_SendRet_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 != CF_SendRet_SUCCESS) { @@ -787,19 +788,19 @@ int 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; } } @@ -811,14 +812,14 @@ 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) { 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 */ @@ -827,23 +828,23 @@ void CF_CFDP_R2_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) 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; } } @@ -851,56 +852,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 { - int32 ret = - CF_WrappedOpenCreate(&t->fd, t->history->fnames.dst_filename, OS_FILE_FLAG_NONE, OS_READ_WRITE); + int32 ret = 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 */ } } @@ -914,7 +915,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}}; @@ -923,7 +924,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); } /*---------------------------------------------------------------- @@ -934,7 +935,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 = { @@ -951,7 +952,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); } /*---------------------------------------------------------------- @@ -962,16 +963,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 */ } } @@ -983,12 +984,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; } /*---------------------------------------------------------------- @@ -999,7 +1000,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 @@ -1009,49 +1010,50 @@ 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) { - CF_SendRet_t 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); + CF_SendRet_t 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_SendRet_ERROR); /* if CF_SendRet_SUCCESS, then move on in the state machine. CF_CFDP_SendAck does not return * CF_SendRet_ERROR */ if (sret != CF_SendRet_NO_MSG) { - 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 @@ -1059,58 +1061,60 @@ 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 */ + /* whether sending fin or waiting for more filedata, need ack timer armed */ + CF_CFDP_ArmAckTimer(txn); } } 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 5354444f..89723eff 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 cc Status Code value to set within transaction + * @param txn Pointer to the transaction object + * @param cc 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 0 on CRC match, otherwise error. * * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * @param expected_crc Expected CRC */ -int CF_CFDP_R_CheckCrc(CF_Transaction_t *t, uint32 expected_crc); +int CF_CFDP_R_CheckCrc(CF_Transaction_t *txn, uint32 expected_crc); /************************************************************************/ /** @brief Checks R2 transaction state for transaction completion status. @@ -170,27 +170,27 @@ int 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 0 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 */ -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); /************************************************************************/ /** @brief Processing receive EOF common functionality for R1/R2. @@ -201,16 +201,16 @@ int 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 0 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 */ -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); /************************************************************************/ /** @brief Process receive EOF for R1. @@ -219,13 +219,13 @@ int CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); * 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. @@ -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 0 on success. Returns anything else on error. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -int CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t); +int CF_CFDP_R_SubstateSendNak(CF_Transaction_t *txn); /************************************************************************/ /** @brief Calculate up to the configured amount of bytes of CRC. @@ -324,26 +324,26 @@ int 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 0 on completion * @retval -1 on non-completion. Error status is stored in condition code. * */ -int CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t); +int 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 0 on success. Returns anything else on error. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object * */ -int CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t); +int CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *txn); /************************************************************************/ /** @brief Process receive FIN-ACK pdu. @@ -353,12 +353,12 @@ int 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 2b2d93ad..1105cfd9 100644 --- a/fsw/src/cf_cfdp_s.c +++ b/fsw/src/cf_cfdp_s.c @@ -48,9 +48,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); } /*---------------------------------------------------------------- @@ -61,14 +61,14 @@ static inline void CF_CFDP_S_Reset(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -CF_SendRet_t CF_CFDP_S_SendEof(CF_Transaction_t *t) +CF_SendRet_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); } /*---------------------------------------------------------------- @@ -79,14 +79,14 @@ CF_SendRet_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_SendRet_NO_MSG) + if (CF_CFDP_S_SendEof(txn) != CF_SendRet_NO_MSG) { - CF_CFDP_S_Reset(t); /* all done, so clean up */ + CF_CFDP_S_Reset(txn); /* all done, so clean up */ } } @@ -98,16 +98,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); } /*---------------------------------------------------------------- @@ -118,13 +118,13 @@ void CF_CFDP_S2_SubstateSendEof(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -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) { bool success = true; int status = 0; int32 ret = -1; - 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; @@ -172,38 +172,38 @@ int32 CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 bytes_to_ 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, - (long)status); - ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; + "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[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_SendRet_NO_MSG) { ret = 0; /* no bytes were processed */ @@ -211,18 +211,18 @@ int32 CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 bytes_to_ else if (status == CF_SendRet_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 = -1; } 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; @@ -241,24 +241,24 @@ int32 CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 bytes_to_ * 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 { @@ -274,14 +274,14 @@ void CF_CFDP_S_SubstateSendFileData(CF_Transaction_t *t) * See description in cf_cfdp_s.h for argument/return detail * *-----------------------------------------------------------------*/ -int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) +int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *txn) { const CF_Chunk_t *c; int ret = 0; - if (t->flags.tx.md_need_send) + if (txn->flags.tx.md_need_send) { - CF_SendRet_t sret = CF_CFDP_SendMd(t); + CF_SendRet_t sret = CF_CFDP_SendMd(txn); if (sret == CF_SendRet_ERROR) { ret = -1; /* error occurred */ @@ -290,7 +290,7 @@ int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) { if (sret == CF_SendRet_SUCCESS) { - t->flags.tx.md_need_send = 0; + txn->flags.tx.md_need_send = 0; } /* unless CF_SendRet_ERROR, return 1 to keep caller from sending file data */ ret = 1; /* 1 means nak processed, so don't send filedata */ @@ -299,13 +299,13 @@ int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) else { /* Get first chunk and process if available */ - c = CF_ChunkList_GetFirstChunk(&t->chunks->chunks); + c = CF_ChunkList_GetFirstChunk(&txn->chunks->chunks); if (c != NULL) { - ret = CF_CFDP_S_SendFileData(t, c->offset, c->size, 0); + ret = CF_CFDP_S_SendFileData(txn, c->offset, c->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) @@ -330,18 +330,18 @@ int 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 { @@ -357,67 +357,69 @@ 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) { bool success = true; int status = 0; CF_SendRet_t sret; - if (!OS_ObjectIdDefined(t->fd)) + if (!OS_ObjectIdDefined(txn->fd)) { int32 ret; - 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; } } @@ -425,31 +427,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_SendRet_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 == CF_SendRet_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_SendRet_NO_MSG, 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);*/ } /*---------------------------------------------------------------- @@ -460,14 +462,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_SendRet_NO_MSG) + 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_SendRet_NO_MSG) { - 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); } } @@ -479,14 +481,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); } /*---------------------------------------------------------------- @@ -497,10 +499,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; } /*---------------------------------------------------------------- @@ -511,7 +513,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; @@ -523,7 +525,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) == 0 && nak->segment_list.num_segments > 0) + if (CF_CFDP_RecvNak(txn, ph) == 0 && nak->segment_list.num_segments > 0) { for (counter = 0; counter < nak->segment_list.num_segments; ++counter) { @@ -532,7 +534,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 { @@ -543,31 +545,32 @@ 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; } } @@ -579,10 +582,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); } /*---------------------------------------------------------------- @@ -593,28 +596,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; } } @@ -626,11 +629,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); } /*---------------------------------------------------------------- @@ -641,7 +644,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, @@ -668,7 +671,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); } /*---------------------------------------------------------------- @@ -679,7 +682,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 = { @@ -688,7 +691,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); } /*---------------------------------------------------------------- @@ -699,7 +702,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 = { @@ -708,7 +711,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); } /*---------------------------------------------------------------- @@ -719,12 +722,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; } } @@ -736,7 +739,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 @@ -745,74 +748,76 @@ 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 { - CF_SendRet_t sret = CF_CFDP_S_SendEof(t); + CF_SendRet_t sret = CF_CFDP_S_SendEof(txn); if (sret == CF_SendRet_NO_MSG) { early_exit = true; } else if (sret == CF_SendRet_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); } } } @@ -826,9 +831,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 bed94e84..1953a412 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 CF_SendRet_SUCCESS on success. * @retval CF_SendRet_NO_MSG if message buffer cannot be obtained. * @retval CF_SendRet_ERROR if an error occurred while building the packet. * - * @param t Pointer to the transaction object + * @param txn Pointer to the transaction object */ -CF_SendRet_t CF_CFDP_S_SendEof(CF_Transaction_t *t); +CF_SendRet_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,17 +166,17 @@ 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, or negative value 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 * */ -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); /************************************************************************/ /** @brief Standard state function to send the next file data PDU for active transaction. @@ -188,11 +188,11 @@ int32 CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 bytes_to_ * 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. @@ -202,15 +202,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 negative value 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 */ -int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t); +int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *txn); /************************************************************************/ /** @brief Send filedata handling for S2. @@ -220,11 +220,11 @@ int 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. @@ -234,43 +234,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. @@ -281,23 +281,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. @@ -307,11 +307,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 f275665c..c23cb7b8 100644 --- a/fsw/src/cf_cfdp_sbintf.c +++ b/fsw/src/cf_cfdp_sbintf.c @@ -60,10 +60,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; @@ -78,21 +78,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 */ - success = false; + 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 { @@ -107,7 +107,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) { CFE_EVS_SendEvent(CF_EID_ERR_CFDP_NO_MSG, CFE_EVS_EventType_ERROR, @@ -119,7 +119,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), 0); + CFE_SB_ValueToMsgId(CF_AppData.config_table->chan[txn->chan_num].mid_output), 0); ++CF_AppData.engine.outgoing_counter; /* even if max_outgoing_messages_per_wakeup is 0 (unlimited), it's ok to inc this */ @@ -175,12 +175,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; @@ -189,7 +189,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 */ @@ -215,12 +215,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 { @@ -235,7 +235,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)) { CF_Transaction_t t_finack; @@ -247,8 +247,8 @@ void CF_CFDP_ReceiveMessage(CF_Channel_t *c) ph->pdu_header.sequence_num) != CF_SendRet_NO_MSG) { /* 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 142b5d29..49ea1a31 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 2ee4af19..d769748a 100644 --- a/fsw/src/cf_cfdp_types.h +++ b/fsw/src/cf_cfdp_types.h @@ -217,7 +217,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 { @@ -346,8 +346,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; /** @@ -376,7 +376,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; @@ -423,7 +423,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_clist.c b/fsw/src/cf_clist.c index 2e252c7a..ae30aa26 100644 --- a/fsw/src/cf_clist.c +++ b/fsw/src/cf_clist.c @@ -198,21 +198,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; } @@ -220,11 +220,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); } } @@ -241,24 +241,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; } @@ -267,11 +267,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 73a8e2ba..9ab3aa8f 100644 --- a/fsw/src/cf_cmd.c +++ b/fsw/src/cf_cmd.c @@ -360,10 +360,10 @@ int CF_TsnChanAction(CF_TransactionCmd_t *cmd, const char *cmdstr, CF_TsnChanAct { /* special value 254 means to use the compound key (cmd->eid, cmd->ts) to find the transaction * to act upon */ - CF_Transaction_t *t = CF_FindTransactionBySequenceNumberAllChannels(cmd->ts, cmd->eid); - if (t) + CF_Transaction_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 @@ -400,16 +400,16 @@ int CF_TsnChanAction(CF_TransactionCmd_t *cmd, const char *cmdstr, CF_TsnChanAct * 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; } } @@ -490,9 +490,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); } /*---------------------------------------------------------------- @@ -527,9 +527,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); } /*---------------------------------------------------------------- @@ -717,10 +717,10 @@ void CF_CmdDisablePolldir(CFE_SB_Buffer_t *msg) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -int CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c) +int 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; } @@ -732,10 +732,10 @@ int CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c) * See description in cf_cmd.h for argument/return detail * *-----------------------------------------------------------------*/ -int CF_PurgeTransaction(CF_CListNode_t *n, void *ignored) +int 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; } @@ -751,7 +751,7 @@ int CF_DoPurgeQueue(uint8 chan_num, CF_UnionArgsCmd_t *cmd) { int ret = 0; /* 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; @@ -780,12 +780,12 @@ int 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; @@ -825,7 +825,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; @@ -865,7 +865,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, @@ -878,7 +878,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, @@ -900,7 +900,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, @@ -916,7 +916,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, @@ -930,7 +930,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 3c25a3bc..62ff5a35 100644 --- a/fsw/src/cf_cmd.h +++ b/fsw/src/cf_cmd.h @@ -232,12 +232,12 @@ int CF_TsnChanAction(CF_TransactionCmd_t *cmd, const char *cmdstr, CF_TsnChanAct /** @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 */ -int CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c); +int CF_PurgeHistory(CF_CListNode_t *node, CF_Channel_t *chan); /************************************************************************/ /** @brief Purge the pending transaction queue. @@ -410,14 +410,14 @@ int 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 */ -int CF_PurgeTransaction(CF_CListNode_t *n, void *ignored); +int CF_PurgeTransaction(CF_CListNode_t *node, void *ignored); /************************************************************************/ /** @brief Channel action command to perform purge queue operations. diff --git a/fsw/src/cf_timer.c b/fsw/src/cf_timer.c index 96c05324..e7974787 100644 --- a/fsw/src/cf_timer.c +++ b/fsw/src/cf_timer.c @@ -55,9 +55,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 *timer, uint32 rel_sec) { - t->tick = CF_Timer_Sec2Ticks(rel_sec); + timer->tick = CF_Timer_Sec2Ticks(rel_sec); } /*---------------------------------------------------------------- @@ -68,9 +68,9 @@ void CF_Timer_InitRelSec(CF_Timer_t *t, uint32 rel_sec) * See description in cf_timer.h for argument/return detail * *-----------------------------------------------------------------*/ -int CF_Timer_Expired(const CF_Timer_t *t) +int CF_Timer_Expired(const CF_Timer_t *timer) { - return !t->tick; + return !timer->tick; } /*---------------------------------------------------------------- @@ -81,8 +81,8 @@ int 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 *timer) { - CF_Assert(t->tick); - --t->tick; + CF_Assert(timer->tick); + --timer->tick; } diff --git a/fsw/src/cf_timer.h b/fsw/src/cf_timer.h index aca1e54d..da057618 100644 --- a/fsw/src/cf_timer.h +++ b/fsw/src/cf_timer.h @@ -32,7 +32,7 @@ * @brief Type for a timer tick count * * @note We expect ticks to be 100/sec, so using uint32 for sec could have a bounds condition - * with uint32. But, we don't expect to use more than 400,000,000 seconds for any reason so + * with uint32. But, we don'timer expect to use more than 400,000,000 seconds for any reason so * let's just live with it. */ typedef uint32 CF_Timer_Ticks_t; @@ -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. + * timer must not be NULL. * - * @param t Timer object to initialize + * @param timer 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 *timer, CF_Timer_Seconds_t rel_sec); /************************************************************************/ /** @brief Check if a timer has expired. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * timer must not be NULL. * - * @param t Timer object to check + * @param timer Timer object to check * * @returns status code indicating whether timer has expired * @retval 1 if expired * @retval 0 if not expired */ -int CF_Timer_Expired(const CF_Timer_t *t); +int CF_Timer_Expired(const CF_Timer_t *timer); /************************************************************************/ /** @brief Notify a timer object a tick has occurred. * * @par Assumptions, External Events, and Notes: - * t must not be NULL. + * timer must not be NULL. * - * @param t Timer object to tick + * @param timer Timer object to tick */ -void CF_Timer_Tick(CF_Timer_t *t); +void CF_Timer_Tick(CF_Timer_t *timer); /************************************************************************/ /** @brief Converts seconds into scheduler ticks. diff --git a/fsw/src/cf_utils.c b/fsw/src/cf_utils.c index 6ea22c98..066f20e6 100644 --- a/fsw/src/cf_utils.c +++ b/fsw/src/cf_utils.c @@ -42,37 +42,37 @@ * 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_Assert(c); + CF_Assert(chan); - if (c->qs[CF_QueueIdx_FREE]) + if (chan->qs[CF_QueueIdx_FREE]) { int q_index; /* initialized below in if */ - CF_CListNode_t * n = c->qs[CF_QueueIdx_FREE]; - CF_Transaction_t *t = container_of(n, CF_Transaction_t, cl_node); + CF_CListNode_t * node = chan->qs[CF_QueueIdx_FREE]; + CF_Transaction_t *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 { @@ -88,10 +88,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); } /*---------------------------------------------------------------- @@ -102,16 +102,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); } /*---------------------------------------------------------------- @@ -122,15 +122,15 @@ void CF_FreeTransaction(CF_Transaction_t *t) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -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_Transaction_t *t = container_of(n, CF_Transaction_t, cl_node); + CF_Transaction_t *txn = container_of(node, CF_Transaction_t, cl_node); int 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; - ret = 1; /* exit early */ + context->txn = txn; + ret = 1; /* exit early */ } return ret; @@ -144,25 +144,26 @@ int CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Traverse_Trans * 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_EntityId_t src_eid) +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), * or on Q_TX or Q_RX. Once a transaction moves to history, then it's done. * * 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; } } @@ -178,7 +179,7 @@ CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_Transac * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -int CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h) +int 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 */ @@ -192,17 +193,17 @@ int 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\txn", 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\node", history->fnames.dst_filename); break; } @@ -227,15 +228,15 @@ int CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -int CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *arg) +int 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; @@ -256,12 +257,12 @@ int CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *arg) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -int CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *n, void *arg) +int 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; @@ -280,7 +281,7 @@ int CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *n, void *arg) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -int32 CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_QueueIdx_t q) +int32 CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *chan, CF_QueueIdx_t queueidx) { CF_Traverse_WriteTxnFileArg_t arg; @@ -288,7 +289,7 @@ int32 CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_QueueIdx_t q) arg.error = false; arg.counter = 0; - CF_CList_Traverse(c->qs[q], CF_Traverse_WriteTxnQueueEntryToFile, &arg); + CF_CList_Traverse(chan->qs[queueidx], CF_Traverse_WriteTxnQueueEntryToFile, &arg); return arg.error; } @@ -300,7 +301,7 @@ int32 CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_QueueIdx_t q) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -int32 CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Direction_t dir) +int32 CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *chan, CF_Direction_t dir) { CF_Traverse_WriteHistoryFileArg_t arg; @@ -309,7 +310,7 @@ int32 CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Direction 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; } @@ -323,16 +324,16 @@ int32 CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Direction *-----------------------------------------------------------------*/ int 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 *priority = (CF_Traverse_PriorityArg_t *)context; - if (t->priority <= p->priority) + if (txn->priority <= priority->priority) { /* found it! * * the current transaction's prio is less than desired (higher) */ - p->t = t; + priority->txn = txn; return CF_CLIST_EXIT; } @@ -347,28 +348,28 @@ int 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 queueidx) { int insert_back = 0; - CF_Channel_t *c = &CF_AppData.engine.channels[t->chan_num]; - CF_Assert(t->chan_num < CF_NUM_CHANNELS); - CF_Assert(t->state != CF_TxnState_IDLE); + CF_Channel_t *chan = &CF_AppData.engine.channels[txn->chan_num]; + 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[queueidx]) { /* 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 priority = {NULL, txn->priority}; + CF_CList_Traverse_R(chan->qs[queueidx], CF_PrioSearch, &priority); + if (priority.txn) { - CF_CList_InsertAfter_Ex(c, q, &p.t->cl_node, &t->cl_node); + CF_CList_InsertAfter_Ex(chan, queueidx, &priority.txn->cl_node, &txn->cl_node); } else { @@ -378,9 +379,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, queueidx, &txn->cl_node); } - t->flags.com.q_index = q; + txn->flags.com.q_index = queueidx; } /*---------------------------------------------------------------- @@ -391,10 +392,10 @@ void CF_InsertSortPrio(CF_Transaction_t *t, CF_QueueIdx_t q) * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -int CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_Arg_t *args) +int 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; } @@ -407,12 +408,12 @@ int CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_Arg_t *arg * See description in cf_utils.h for argument/return detail * *-----------------------------------------------------------------*/ -int CF_TraverseAllTransactions(CF_Channel_t *c, CF_TraverseAllTransactions_fn_t fn, void *context) +int 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 e15bc1c9..09423523 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 queueidx) { - 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[queueidx], &txn->cl_node); + txn->flags.com.q_index = queueidx; + ++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,33 @@ 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_EntityId_t src_eid); +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 * */ -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); /************************************************************************/ /** @brief Write a single history to a file. @@ -245,42 +246,42 @@ int CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Traverse_Trans * 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 0 on success * @retval -1 on error */ -int CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h); +int 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 queueidx Queue Index to write * * @retval 0 on success * @retval 1 on error */ -int32 CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_QueueIdx_t q); +int32 CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *chan, CF_QueueIdx_t queueidx); /************************************************************************/ /** @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 */ -int32 CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Direction_t dir); +int32 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 +293,26 @@ int32 CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Direction * 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 queueidx 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 queueidx); /************************************************************************/ /** @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 */ -int CF_TraverseAllTransactions(CF_Channel_t *c, CF_TraverseAllTransactions_fn_t fn, void *context); +int 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 +335,14 @@ int CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_fn_t fn, * 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) */ -int CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_Arg_t *args); +int 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 +354,15 @@ int CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_Arg_t *arg * 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 */ -int CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *arg); +int 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 +371,15 @@ int CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *arg); * 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 */ -int CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *n, void *arg); +int 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 d205d576..c7377347 100644 --- a/unit-test/cf_cfdp_dispatch_tests.c +++ b/unit-test/cf_cfdp_dispatch_tests.c @@ -128,10 +128,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; @@ -144,41 +144,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); } @@ -186,10 +186,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; @@ -202,35 +202,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 */ @@ -238,22 +238,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)); @@ -261,23 +261,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; @@ -286,13 +286,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 3876d06d..fb52bd3a 100644 --- a/unit-test/cf_cfdp_r_tests.c +++ b/unit-test/cf_cfdp_r_tests.c @@ -150,451 +150,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_SendRet_NO_MSG); - 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_SendRet_NO_MSG); - 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_SendRet_NO_MSG); - 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); - fd = &ph->int_header.fd; - fd->data_len = 100; - fd->offset = 300; - t->state_data.r.cached_pos = 300; + 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; + 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); - fd = &ph->int_header.fd; - fd->data_len = 100; - fd->offset = 200; - t->state_data.r.cached_pos = 300; + 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; + 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); @@ -604,37 +604,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); - eof = &ph->int_header.eof; - t->flags.rx.md_recv = true; - eof->size = 200; - t->fsize = 200; - UtAssert_INT32_EQ(CF_CFDP_R_SubstateRecvEof(t, ph), 0); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + eof = &ph->int_header.eof; + txn->flags.rx.md_recv = true; + eof->size = 200; + 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); - eof = &ph->int_header.eof; - t->flags.rx.md_recv = true; - eof->size = 100; - t->fsize = 300; - UtAssert_INT32_EQ(CF_CFDP_R_SubstateRecvEof(t, ph), CF_RxEofRet_FSIZE_MISMATCH); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + eof = &ph->int_header.eof; + txn->flags.rx.md_recv = true; + eof->size = 100; + txn->fsize = 300; + UtAssert_INT32_EQ(CF_CFDP_R_SubstateRecvEof(txn, ph), CF_RxEofRet_FSIZE_MISMATCH); 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_RxEofRet_BAD_EOF); + UtAssert_INT32_EQ(CF_CFDP_R_SubstateRecvEof(txn, ph), CF_RxEofRet_BAD_EOF); UT_CF_AssertEventID(CF_EID_ERR_CFDP_R_PDU_EOF); /* these counters should have been updated during the test */ @@ -645,162 +645,162 @@ 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); - eof = &ph->int_header.eof; - eof->crc = 0xf007ba11; - t->crc.result = eof->crc; - eof->size = 0xccc; - t->fsize = eof->size; - UtAssert_VOIDCALL(CF_CFDP_R1_SubstateRecvEof(t, ph)); - UtAssert_BOOL_TRUE(t->keep); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + eof = &ph->int_header.eof; + eof->crc = 0xf007ba11; + txn->crc.result = eof->crc; + eof->size = 0xccc; + 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); - 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); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + eof = &ph->int_header.eof; + eof->crc = 0xf007ba11; + 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); - eof = &ph->int_header.eof; - eof->crc = 0xf007ba11; - t->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); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + eof = &ph->int_header.eof; + eof->crc = 0xf007ba11; + txn->crc.result = eof->crc; + eof->size = 0xbbb; + 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_RxEofRet_BAD_EOF 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); - 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); + UT_CFDP_R_SetupBasicTestState(UT_CF_Setup_RX, &ph, NULL, NULL, &txn, NULL); + eof = &ph->int_header.eof; + eof->size = 0xddd; + 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)); - UtAssert_STUB_COUNT(CF_CFDP_ArmAckTimer, 2); /* does NOT increment here */ - UtAssert_ZERO(t->state_data.r.r2.acknak_count); /* this resets the counter */ + 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(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 */ } @@ -841,273 +841,273 @@ void Test_CF_CFDP_R2_GapCompute(void) 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_SendRet_NO_MSG); - 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_SendRet_NO_MSG); - 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; - 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); + 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; + 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; - config->rx_crc_calc_bytes_per_wakeup = 100; - t->fsize = 50; + 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; + 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_SendRet_NO_MSG); - 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, -1); - 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, -1); - 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, -1); - 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 30f2b056..530b3724 100644 --- a/unit-test/cf_cfdp_s_tests.c +++ b/unit-test/cf_cfdp_s_tests.c @@ -174,253 +174,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_SendRet_NO_MSG); - 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_SendRet_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: - * CF_SendRet_t CF_CFDP_S_SendEof(CF_Transaction_t *t); + * CF_SendRet_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), CF_SendRet_SUCCESS); + UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_S_SendEof(txn), CF_SendRet_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), CF_SendRet_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), CF_SendRet_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_SendRet_NO_MSG); - UtAssert_INT32_EQ(CF_CFDP_S_SendEof(t), CF_SendRet_NO_MSG); + UtAssert_INT32_EQ(CF_CFDP_S_SendEof(txn), CF_SendRet_NO_MSG); } 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_SendRet_NO_MSG); - 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; @@ -431,138 +431,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_SendRet_NO_MSG); 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_SendRet_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; @@ -574,289 +574,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_SendRet_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_SendRet_NO_MSG); - 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_SendRet_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_SendRet_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_SendRet_NO_MSG); - 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_SendRet_NO_MSG 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_SendRet_NO_MSG); - 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 b0737868..0c7522ff 100644 --- a/unit-test/cf_cfdp_sbintf_tests.c +++ b/unit-test/cf_cfdp_sbintf_tests.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. * @@ -214,107 +214,107 @@ 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; /* 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)); /* * - CF_CFDP_RecvPh() succeeds * - 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_STUB_COUNT(CF_CFDP_SendAck, 1); /* no increment */ - UtAssert_NULL(c->cur); /* cleared */ + 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(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_SendRet_NO_MSG); 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; - config->local_eid = 123; - ph->pdu_header.destination_eid = config->local_eid; - UtAssert_VOIDCALL(CF_CFDP_ReceiveMessage(c)); + 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(chan)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_RX_DROPPED); } @@ -336,59 +336,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_SetDefaultReturnValue(UT_KEY(OS_CountSemTimedWait), OS_ERROR_TIMEOUT); - UtAssert_NULL(CF_CFDP_MsgOutGet(t, false)); + UtAssert_NULL(CF_CFDP_MsgOutGet(txn, false)); UT_CF_AssertEventID(CF_EID_ERR_CFDP_NO_MSG); /* transaction is suspended */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, NULL, NULL, &t, NULL); - t->flags.com.suspended = 1; - UtAssert_NULL(CF_CFDP_MsgOutGet(t, false)); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, 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_TX, NULL, NULL, NULL, &t, NULL); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, 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 supress 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); } @@ -405,6 +405,6 @@ void UtTest_Setup(void) UtTest_Add(Test_CF_CFDP_MsgOutGet, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_MsgOutGet"); UtTest_Add(Test_CF_CFDP_Send, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_Send"); -} /* end UtTest_Setup for cf_cfdp_tests.c */ +} /* end UtTest_Setup for cf_cfdp_tests.chan */ -/* end cf_cfdp_tests.c */ +/* end cf_cfdp_tests.chan */ diff --git a/unit-test/cf_cfdp_tests.c b/unit-test/cf_cfdp_tests.c index 248190d2..5f5275c9 100644 --- a/unit-test/cf_cfdp_tests.c +++ b/unit-test/cf_cfdp_tests.c @@ -244,15 +244,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) @@ -293,190 +293,190 @@ 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)); /* deode 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), -1); + UtAssert_INT32_EQ(CF_CFDP_RecvMd(txn, ph), -1); 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), -1); + UtAssert_INT32_EQ(CF_CFDP_RecvMd(txn, ph), -1); 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), -1); + UtAssert_INT32_EQ(CF_CFDP_RecvMd(txn, ph), -1); 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); /* deode 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), -1); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_PROTOCOL_ERROR); + UtAssert_INT32_EQ(CF_CFDP_RecvFd(txn, ph), -1); + UtAssert_INT32_EQ(txn->history->txn_stat, CF_TxnStatus_PROTOCOL_ERROR); UT_CF_AssertEventID(CF_EID_ERR_PDU_FD_SHORT); /* deode 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), -1); + UtAssert_INT32_EQ(CF_CFDP_RecvFd(txn, ph), -1); 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), -1); - UtAssert_INT32_EQ(t->history->txn_stat, CF_TxnStatus_PROTOCOL_ERROR); + UtAssert_INT32_EQ(CF_CFDP_RecvFd(txn, ph), -1); + 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); /* deode 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), -1); + UtAssert_INT32_EQ(CF_CFDP_RecvEof(txn, ph), -1); 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); /* deode 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), -1); + UtAssert_INT32_EQ(CF_CFDP_RecvAck(txn, ph), -1); 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); /* deode 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), -1); + UtAssert_INT32_EQ(CF_CFDP_RecvFin(txn, ph), -1); 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); /* deode 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), -1); + UtAssert_INT32_EQ(CF_CFDP_RecvNak(txn, ph), -1); 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; @@ -487,46 +487,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); } @@ -549,23 +549,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); @@ -578,10 +578,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); @@ -597,61 +597,61 @@ CF_Logical_PduBuffer_t *CF_CFDP_ConstructPduHeader(const CF_Transaction_t *t, CF void Test_CF_CFDP_SendMd(void) { /* Test case for: - CF_SendRet_t CF_CFDP_SendMd(CF_Transaction_t *t); + CF_SendRet_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_SendRet_NO_MSG); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_SendMd(txn), CF_SendRet_NO_MSG); - 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), CF_SendRet_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), CF_SendRet_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), CF_SendRet_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), CF_SendRet_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: - CF_SendRet_t CF_CFDP_SendFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + CF_SendRet_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), CF_SendRet_SUCCESS); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_SendFd(txn, ph), CF_SendRet_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), CF_SendRet_SUCCESS); + UtAssert_INT32_EQ(CF_CFDP_SendFd(txn, ph), CF_SendRet_SUCCESS); UtAssert_UINT32_EQ(ph->pdu_header.data_encoded_length, 0); } @@ -659,29 +659,29 @@ void Test_CF_CFDP_SendFd(void) void Test_CF_CFDP_SendEof(void) { /* Test case for: - CF_SendRet_t CF_CFDP_SendEof(CF_Transaction_t *t); + CF_SendRet_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_SendRet_NO_MSG); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_SendEof(txn), CF_SendRet_NO_MSG); /* 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), CF_SendRet_SUCCESS); + UtAssert_INT32_EQ(CF_CFDP_SendEof(txn), CF_SendRet_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), CF_SendRet_SUCCESS); + UtAssert_INT32_EQ(CF_CFDP_SendEof(txn), CF_SendRet_SUCCESS); UtAssert_UINT32_EQ(eof->tlv_list.num_tlv, 1); UtAssert_STUB_COUNT(CF_CFDP_Send, 2); } @@ -689,25 +689,25 @@ void Test_CF_CFDP_SendEof(void) void Test_CF_CFDP_SendAck(void) { /* Test case for: - CF_SendRet_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_CFDP_FileDirective_t dir_code, + CF_SendRet_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_SendRet_NO_MSG); /* nominal as receiver */ - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &t, 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, + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); + ack = &ph->int_header.ack; + 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), CF_SendRet_SUCCESS); UtAssert_UINT32_EQ(ack->ack_directive_code, CF_CFDP_FileDirective_EOF); @@ -716,10 +716,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); - 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, + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); + ack = &ph->int_header.ack; + 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), CF_SendRet_SUCCESS); UtAssert_UINT32_EQ(ack->ack_directive_code, CF_CFDP_FileDirective_EOF); @@ -728,10 +728,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); - 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, + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, &ph, NULL, NULL, &txn, NULL); + ack = &ph->int_header.ack; + 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), CF_SendRet_SUCCESS); UtAssert_UINT32_EQ(ack->ack_directive_code, CF_CFDP_FileDirective_FIN); @@ -743,24 +743,24 @@ void Test_CF_CFDP_SendAck(void) void Test_CF_CFDP_SendFin(void) { /* Test case for: - CF_SendRet_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, + CF_SendRet_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_SendRet_NO_MSG); /* 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), CF_SendRet_SUCCESS); UtAssert_ZERO(fin->tlv_list.num_tlv); @@ -769,9 +769,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), CF_SendRet_SUCCESS); UtAssert_UINT32_EQ(fin->delivery_code, CF_CFDP_FinDeliveryCode_INCOMPLETE); @@ -784,17 +784,17 @@ void Test_CF_CFDP_SendFin(void) void Test_CF_CFDP_SendNak(void) { /* Test case for: - CF_SendRet_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph); + CF_SendRet_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_SendRet_NO_MSG); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, &ph, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_SendNak(txn, ph), CF_SendRet_NO_MSG); - 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), CF_SendRet_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), CF_SendRet_SUCCESS); UtAssert_STUB_COUNT(CF_CFDP_Send, 1); } @@ -832,17 +832,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_SendRet_NO_MSG); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_NONE, &ph, NULL, NULL, &txn, NULL); + UtAssert_INT32_EQ(CF_CFDP_SendNak(txn, ph), CF_SendRet_NO_MSG); - 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), CF_SendRet_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), CF_SendRet_SUCCESS); UtAssert_STUB_COUNT(CF_CFDP_Send, 1); } @@ -895,9 +895,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)); @@ -905,30 +905,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); } @@ -943,12 +943,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)); @@ -963,10 +963,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); @@ -989,43 +989,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; memset(&t2, 0, sizeof(t2)); /* 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] = &t2.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; } @@ -1035,41 +1035,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) @@ -1077,7 +1077,7 @@ 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 * txn; CF_Transaction_t t2; CF_CFDP_Tick_args_t args; @@ -1085,68 +1085,68 @@ void Test_CF_CFDP_DoTick(void) memset(&t2, 0, sizeof(t2)); args.fn = DoTickFnClearCont; - UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &args.c, NULL, &t, NULL); - args.c->cur = &t2; - args.cont = true; - 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 = &t2; + args.cont = true; + 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; - args.cont = true; - 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); + txn->flags.com.suspended = 1; + args.cont = true; + 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, w/engine 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, w/engine enabled, polldir enabled but interval_sec == 0 */ CF_AppData.engine.enabled = 1; pdcfg->enabled = 1; - 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); /* 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, 0); 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, 1); /* 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); @@ -1156,7 +1156,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); @@ -1168,28 +1168,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]; @@ -1198,14 +1198,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); @@ -1218,7 +1218,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); @@ -1239,14 +1239,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); } @@ -1281,33 +1281,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) @@ -1315,10 +1315,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 */ @@ -1333,88 +1333,88 @@ 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_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, 3); - 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, 5); - 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, 7); /* 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_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &c, &h, &t, 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); + UT_CFDP_SetupBasicTestState(UT_CF_Setup_TX, NULL, &chan, &history, &txn, NULL); + pb.num_ts = 10; + 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, 8); } 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) @@ -1422,15 +1422,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); @@ -1444,7 +1444,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); @@ -1476,35 +1476,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)); } /******************************************************************************* @@ -1565,6 +1565,6 @@ void UtTest_Setup(void) UtTest_Add(Test_CF_CFDP_SendNak, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_SendNak"); UtTest_Add(Test_CF_CFDP_AppendTlv, cf_cfdp_tests_Setup, cf_cfdp_tests_Teardown, "CF_CFDP_AppendTlv"); -} /* end UtTest_Setup for cf_cfdp_tests.c */ +} /* end UtTest_Setup for cf_cfdp_tests.chan */ -/* end cf_cfdp_tests.c */ +/* end cf_cfdp_tests.chan */ diff --git a/unit-test/cf_cmd_tests.c b/unit-test/cf_cmd_tests.c index dba29a03..77d57cd5 100644 --- a/unit-test/cf_cmd_tests.c +++ b/unit-test/cf_cmd_tests.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. * @@ -144,7 +144,7 @@ CF_TransactionSeq_t Any_CF_TransactionSeq_t(void) typedef struct { - CF_Transaction_t *t; + CF_Transaction_t *txn; void * context; } Dummy_CF_TsnChanAction_fn_t_context_t; @@ -154,14 +154,14 @@ int Dummy_chan_action_fn_t(uint8 chan_num, void *context) return UT_DEFAULT_IMPL(Dummy_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) { Dummy_CF_TsnChanAction_fn_t_context_t *ctxt = UT_CF_GetContextBuffer(UT_KEY(Dummy_CF_TsnChanAction_fn_t), Dummy_CF_TsnChanAction_fn_t_context_t); if (ctxt) { - ctxt->t = t; + ctxt->txn = txn; ctxt->context = context; } @@ -1078,7 +1078,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); @@ -1118,11 +1118,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); @@ -1216,7 +1216,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_Dummy_CF_TsnChanAction_fn_t.t, &dummy_t); + UtAssert_ADDRESS_EQ(context_Dummy_CF_TsnChanAction_fn_t.txn, &dummy_t); UtAssert_ADDRESS_EQ(context_Dummy_CF_TsnChanAction_fn_t.context, arg_context); } /* end Test_CF_TsnChanAction_cmd_chan_Eq_CF_COMPOUND_KEY_TransactionFoundRun_fn_AndReturn_CFE_SUCCESS */ @@ -1568,7 +1568,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); @@ -2119,8 +2119,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, &dummy_h); + UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetHistory.chan, arg_c); + UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetHistory.history, &dummy_h); UtAssert_True(local_result == CF_CLIST_CONT, "CF_PurgeHistory returned %d and should be %d (CF_CLIST_CONT)", local_result, CF_CLIST_CONT); @@ -2149,7 +2149,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, &dummy_t); + UtAssert_ADDRESS_EQ(context_CF_CFDP_ResetTransaction.txn, &dummy_t); 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); @@ -4580,6 +4580,6 @@ void UtTest_Setup(void) add_CF_ProcessGroundCommand_tests(); -} /* end UtTest_Setup for cf_cmd_tests.c */ +} /* end UtTest_Setup for cf_cmd_tests.chan */ -/* end cf_cmd_tests.c */ +/* end cf_cmd_tests.chan */ diff --git a/unit-test/cf_utils_tests.c b/unit-test/cf_utils_tests.c index 757f0806..7bef8209 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; @@ -92,14 +92,14 @@ 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; } } @@ -108,14 +108,14 @@ static void UT_Callback_CF_TraverseAllTransactions(CF_Transaction_t *t, void *co * * Function: UT_AltHandler_CF_CList_Traverse_SeqArg_SetTxn * - * 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; } /******************************************************************************* @@ -127,70 +127,71 @@ 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]; - CF_AppData.hk.channel_hk[UT_CFDP_CHANNEL].q_size[CF_QueueIdx_FREE] = 2; + 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; @@ -208,7 +209,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; @@ -216,7 +217,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; @@ -224,7 +225,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; @@ -232,28 +233,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 */ @@ -338,7 +339,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); } /* end Test_cf_move_transaction_Call_CF_CList_InsertBack_AndSet_q_index_ToGiven_q */ @@ -465,7 +466,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; @@ -513,7 +514,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; @@ -547,26 +548,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); } @@ -670,7 +671,7 @@ void Test_CF_PrioSearch_When_t_PrioIsEqToContextPrio_Set_context_t_To_t_AndRetur /* Assert */ UtAssert_INT32_EQ(result, CF_CLIST_EXIT); - UtAssert_ADDRESS_EQ(dummy_p.t, &dummy_t); + UtAssert_ADDRESS_EQ(dummy_p.txn, &dummy_t); } /* end Test_CF_PrioSearch_When_t_PrioIsEqToContextPrio_Set_context_t_To_t_AndReturn_CLIST_EXIT */ @@ -694,7 +695,7 @@ void Test_CF_PrioSearch_When_t_PrioIsLessThanContextPrio_Set_context_t_To_t_AndR /* Assert */ UtAssert_INT32_EQ(result, CF_CLIST_EXIT); - UtAssert_ADDRESS_EQ(dummy_p.t, &dummy_t); + UtAssert_ADDRESS_EQ(dummy_p.txn, &dummy_t); } /* end Test_CF_PrioSearch_When_t_PrioIsLessThanContextPrio_Set_context_t_To_t_AndReturn_CLIST_EXIT */ @@ -797,7 +798,7 @@ 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); } /* end Test_CF_InsertSortPrio_Call_CF_CList_InsertAfter_Ex_AndSet_q_index_To_q */ @@ -852,7 +853,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); } /* end Test_CF_InsertSortPrio_When_p_t_Is_NULL_Call_CF_CList_InsertBack_Ex */ @@ -897,7 +898,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", @@ -1378,6 +1379,6 @@ void UtTest_Setup(void) add_CF_WrappedLseek_tests(); -} /* end UtTest_Setup for cf_utils_tests.c */ +} /* end UtTest_Setup for cf_utils_tests.chan */ -/* end cf_utils_tests.c */ +/* end cf_utils_tests.chan */ 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 7544dca8..fa82632e 100644 --- a/unit-test/stubs/cf_cfdp_handlers.c +++ b/unit-test/stubs/cf_cfdp_handlers.c @@ -131,7 +131,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); } } @@ -150,6 +150,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 8048e021..978a4184 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() * ---------------------------------------------------- */ -int CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *t) +int CF_CFDP_R2_CalcCrcChunk(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_R2_CalcCrcChunk, int); - 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 @@ int 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); @@ -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() * ---------------------------------------------------- */ -int CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *t) +int CF_CFDP_R2_SubstateSendFin(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_R2_SubstateSendFin, int); - 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 @@ int 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() * ---------------------------------------------------- */ -int CF_CFDP_R_CheckCrc(CF_Transaction_t *t, uint32 expected_crc) +int CF_CFDP_R_CheckCrc(CF_Transaction_t *txn, uint32 expected_crc) { UT_GenStub_SetupReturnBuffer(CF_CFDP_R_CheckCrc, int); - 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 @@ int 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() * ---------------------------------------------------- */ -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) { UT_GenStub_SetupReturnBuffer(CF_CFDP_R_ProcessFd, int); - 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 @@ int 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() * ---------------------------------------------------- */ -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) { UT_GenStub_SetupReturnBuffer(CF_CFDP_R_SubstateRecvEof, int); - 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 @@ int CF_CFDP_R_SubstateRecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_R_SubstateSendNak() * ---------------------------------------------------- */ -int CF_CFDP_R_SubstateSendNak(CF_Transaction_t *t) +int CF_CFDP_R_SubstateSendNak(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_R_SubstateSendNak, int); - 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 @@ int 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 eb46401d..c923414b 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() * ---------------------------------------------------- */ -int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) +int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_S_CheckAndRespondNak, int); - 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 @@ int CF_CFDP_S_CheckAndRespondNak(CF_Transaction_t *t) * Generated stub function for CF_CFDP_S_SendEof() * ---------------------------------------------------- */ -CF_SendRet_t CF_CFDP_S_SendEof(CF_Transaction_t *t) +CF_SendRet_t CF_CFDP_S_SendEof(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_S_SendEof, CF_SendRet_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 @@ CF_SendRet_t CF_CFDP_S_SendEof(CF_Transaction_t *t) * Generated stub function for CF_CFDP_S_SendFileData() * ---------------------------------------------------- */ -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) { UT_GenStub_SetupReturnBuffer(CF_CFDP_S_SendFileData, int32); - 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 @@ int32 CF_CFDP_S_SendFileData(CF_Transaction_t *t, uint32 foffs, uint32 bytes_to_ * 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 32c7801f..fb7056c4 100644 --- a/unit-test/stubs/cf_cfdp_stubs.c +++ b/unit-test/stubs/cf_cfdp_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. * @@ -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() * ---------------------------------------------------- */ -int CF_CFDP_CloseFiles(CF_CListNode_t *n, void *context) +int CF_CFDP_CloseFiles(CF_CListNode_t *node, void *context) { UT_GenStub_SetupReturnBuffer(CF_CFDP_CloseFiles, int); - 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 @@ int 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); @@ -144,9 +144,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); } @@ -201,9 +201,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); @@ -262,12 +262,13 @@ int32 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_num, + 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); + UT_GenStub_AddParam(CF_CFDP_InitTxnTxFile, uint8, chan_num); UT_GenStub_AddParam(CF_CFDP_InitTxnTxFile, uint8, priority); UT_GenStub_Execute(CF_CFDP_InitTxnTxFile, Basic, NULL); @@ -301,10 +302,10 @@ int32 CF_CFDP_PlaybackDir(const char *src_filename, const char *dst_filename, CF * 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); } @@ -314,9 +315,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); } @@ -326,11 +327,11 @@ void CF_CFDP_ProcessPollingDirectories(CF_Channel_t *c) * Generated stub function for CF_CFDP_RecvAck() * ---------------------------------------------------- */ -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) { UT_GenStub_SetupReturnBuffer(CF_CFDP_RecvAck, int); - 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); @@ -343,9 +344,9 @@ int 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); @@ -356,11 +357,11 @@ void CF_CFDP_RecvDrop(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_RecvEof() * ---------------------------------------------------- */ -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) { UT_GenStub_SetupReturnBuffer(CF_CFDP_RecvEof, int); - 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); @@ -373,11 +374,11 @@ int CF_CFDP_RecvEof(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_RecvFd() * ---------------------------------------------------- */ -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) { UT_GenStub_SetupReturnBuffer(CF_CFDP_RecvFd, int); - 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); @@ -390,11 +391,11 @@ int CF_CFDP_RecvFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_RecvFin() * ---------------------------------------------------- */ -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) { UT_GenStub_SetupReturnBuffer(CF_CFDP_RecvFin, int); - 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); @@ -407,9 +408,9 @@ int 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); @@ -420,11 +421,11 @@ void CF_CFDP_RecvIdle(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_RecvMd() * ---------------------------------------------------- */ -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) { UT_GenStub_SetupReturnBuffer(CF_CFDP_RecvMd, int); - 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); @@ -437,11 +438,11 @@ int CF_CFDP_RecvMd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_RecvNak() * ---------------------------------------------------- */ -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) { UT_GenStub_SetupReturnBuffer(CF_CFDP_RecvNak, int); - 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); @@ -471,9 +472,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); @@ -484,12 +485,12 @@ void CF_CFDP_ResetTransaction(CF_Transaction_t *t, int keep_history) * Generated stub function for CF_CFDP_SendAck() * ---------------------------------------------------- */ -CF_SendRet_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_CFDP_FileDirective_t dir_code, +CF_SendRet_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, CF_SendRet_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); @@ -506,11 +507,11 @@ CF_SendRet_t CF_CFDP_SendAck(CF_Transaction_t *t, CF_CFDP_AckTxnStatus_t ts, CF_ * Generated stub function for CF_CFDP_SendEof() * ---------------------------------------------------- */ -CF_SendRet_t CF_CFDP_SendEof(CF_Transaction_t *t) +CF_SendRet_t CF_CFDP_SendEof(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_SendEof, CF_SendRet_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); @@ -534,11 +535,11 @@ void CF_CFDP_SendEotPkt(CF_Transaction_t *t) * Generated stub function for CF_CFDP_SendFd() * ---------------------------------------------------- */ -CF_SendRet_t CF_CFDP_SendFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CF_SendRet_t CF_CFDP_SendFd(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { UT_GenStub_SetupReturnBuffer(CF_CFDP_SendFd, CF_SendRet_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); @@ -551,12 +552,12 @@ CF_SendRet_t CF_CFDP_SendFd(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) * Generated stub function for CF_CFDP_SendFin() * ---------------------------------------------------- */ -CF_SendRet_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, +CF_SendRet_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, CF_SendRet_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); @@ -571,11 +572,11 @@ CF_SendRet_t CF_CFDP_SendFin(CF_Transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, * Generated stub function for CF_CFDP_SendMd() * ---------------------------------------------------- */ -CF_SendRet_t CF_CFDP_SendMd(CF_Transaction_t *t) +CF_SendRet_t CF_CFDP_SendMd(CF_Transaction_t *txn) { UT_GenStub_SetupReturnBuffer(CF_CFDP_SendMd, CF_SendRet_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); @@ -587,11 +588,11 @@ CF_SendRet_t CF_CFDP_SendMd(CF_Transaction_t *t) * Generated stub function for CF_CFDP_SendNak() * ---------------------------------------------------- */ -CF_SendRet_t CF_CFDP_SendNak(CF_Transaction_t *t, CF_Logical_PduBuffer_t *ph) +CF_SendRet_t CF_CFDP_SendNak(CF_Transaction_t *txn, CF_Logical_PduBuffer_t *ph) { UT_GenStub_SetupReturnBuffer(CF_CFDP_SendNak, CF_SendRet_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); @@ -617,9 +618,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_cmd_stubs.c b/unit-test/stubs/cf_cmd_stubs.c index e3c56acd..5d3a4981 100644 --- a/unit-test/stubs/cf_cmd_stubs.c +++ b/unit-test/stubs/cf_cmd_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. * @@ -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() * ---------------------------------------------------- */ -int CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c) +int CF_PurgeHistory(CF_CListNode_t *node, CF_Channel_t *chan) { UT_GenStub_SetupReturnBuffer(CF_PurgeHistory, int); - 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 @@ int CF_PurgeHistory(CF_CListNode_t *n, CF_Channel_t *c) * Generated stub function for CF_PurgeTransaction() * ---------------------------------------------------- */ -int CF_PurgeTransaction(CF_CListNode_t *n, void *ignored) +int CF_PurgeTransaction(CF_CListNode_t *node, void *ignored) { UT_GenStub_SetupReturnBuffer(CF_PurgeTransaction, int); - 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_utils_handlers.c b/unit-test/stubs/cf_utils_handlers.c index 32b17098..84f17319 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. * @@ -54,8 +54,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 *); } } @@ -76,7 +76,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); @@ -121,9 +121,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); } } @@ -143,9 +143,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); } } @@ -163,7 +163,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 451163f1..be83c6a2 100644 --- a/unit-test/stubs/cf_utils_stubs.c +++ b/unit-test/stubs/cf_utils_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. * @@ -41,12 +41,13 @@ 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_EntityId_t src_eid) +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 +61,11 @@ CF_Transaction_t *CF_FindTransactionBySequenceNumber(CF_Channel_t *c, CF_Transac * Generated stub function for CF_FindTransactionBySequenceNumber_Impl() * ---------------------------------------------------- */ -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) { UT_GenStub_SetupReturnBuffer(CF_FindTransactionBySequenceNumber_Impl, int); - 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 +78,11 @@ int CF_FindTransactionBySequenceNumber_Impl(CF_CListNode_t *n, CF_Traverse_Trans * 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 +94,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 +106,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 queueidx) { - 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, queueidx); UT_GenStub_Execute(CF_InsertSortPrio, Basic, NULL); } @@ -135,10 +136,10 @@ int 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 +149,11 @@ void CF_ResetHistory(CF_Channel_t *c, CF_History_t *h) * Generated stub function for CF_TraverseAllTransactions() * ---------------------------------------------------- */ -int CF_TraverseAllTransactions(CF_Channel_t *c, CF_TraverseAllTransactions_fn_t fn, void *context) +int CF_TraverseAllTransactions(CF_Channel_t *chan, CF_TraverseAllTransactions_fn_t fn, void *context) { UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions, int); - 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 +185,11 @@ int CF_TraverseAllTransactions_All_Channels(CF_TraverseAllTransactions_fn_t fn, * Generated stub function for CF_TraverseAllTransactions_Impl() * ---------------------------------------------------- */ -int CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_Arg_t *args) +int CF_TraverseAllTransactions_Impl(CF_CListNode_t *node, CF_TraverseAll_Arg_t *args) { UT_GenStub_SetupReturnBuffer(CF_TraverseAllTransactions_Impl, int); - 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 +202,11 @@ int CF_TraverseAllTransactions_Impl(CF_CListNode_t *n, CF_TraverseAll_Arg_t *arg * Generated stub function for CF_Traverse_WriteHistoryQueueEntryToFile() * ---------------------------------------------------- */ -int CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *arg) +int CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *node, void *arg) { UT_GenStub_SetupReturnBuffer(CF_Traverse_WriteHistoryQueueEntryToFile, int); - 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 +219,11 @@ int CF_Traverse_WriteHistoryQueueEntryToFile(CF_CListNode_t *n, void *arg) * Generated stub function for CF_Traverse_WriteTxnQueueEntryToFile() * ---------------------------------------------------- */ -int CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *n, void *arg) +int CF_Traverse_WriteTxnQueueEntryToFile(CF_CListNode_t *node, void *arg) { UT_GenStub_SetupReturnBuffer(CF_Traverse_WriteTxnQueueEntryToFile, int); - 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 +369,12 @@ int32 CF_WrappedWrite(osal_id_t fd, const void *buf, size_t write_size) * Generated stub function for CF_WriteHistoryEntryToFile() * ---------------------------------------------------- */ -int CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h) +int CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *history) { UT_GenStub_SetupReturnBuffer(CF_WriteHistoryEntryToFile, int); 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 +386,12 @@ int CF_WriteHistoryEntryToFile(osal_id_t fd, const CF_History_t *h) * Generated stub function for CF_WriteHistoryQueueDataToFile() * ---------------------------------------------------- */ -int32 CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Direction_t dir) +int32 CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *chan, CF_Direction_t dir) { UT_GenStub_SetupReturnBuffer(CF_WriteHistoryQueueDataToFile, int32); 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 +404,13 @@ int32 CF_WriteHistoryQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_Direction * Generated stub function for CF_WriteTxnQueueDataToFile() * ---------------------------------------------------- */ -int32 CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *c, CF_QueueIdx_t q) +int32 CF_WriteTxnQueueDataToFile(osal_id_t fd, CF_Channel_t *chan, CF_QueueIdx_t queueidx) { UT_GenStub_SetupReturnBuffer(CF_WriteTxnQueueDataToFile, int32); 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, queueidx); 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 76f3d731..4ecc6cb7 100644 --- a/unit-test/utilities/cf_test_alt_handler.c +++ b/unit-test/utilities/cf_test_alt_handler.c @@ -131,7 +131,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 0db2a631..c10eed08 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. * @@ -88,7 +88,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; @@ -103,14 +103,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 @@ -123,20 +123,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;