diff --git a/fsw/platform_inc/cf_platform_cfg.h b/fsw/platform_inc/cf_platform_cfg.h index ecb34df5a..45b597234 100644 --- a/fsw/platform_inc/cf_platform_cfg.h +++ b/fsw/platform_inc/cf_platform_cfg.h @@ -43,7 +43,7 @@ ** \par Limits ** Must be one of uint8, uint16, uint32, uint64. */ -typedef uint8 cf_entity_id_t; +typedef uint8 CF_EntityId_t; /** ** \cfcfg transaction sequence number size @@ -56,7 +56,7 @@ typedef uint8 cf_entity_id_t; ** \par Limits ** Must be one of uint8, uint16, uint32, uint64. */ -typedef uint32 cf_transaction_seq_t; +typedef uint32 CF_TransactionSeq_t; /** ** \cfcfg CF_HW_ALIGNMENT and CF_SW_ALIGNMENT diff --git a/fsw/platform_inc/cf_tbldefs.h b/fsw/platform_inc/cf_tbldefs.h index 8e70ffe9c..d7e30327c 100644 --- a/fsw/platform_inc/cf_tbldefs.h +++ b/fsw/platform_inc/cf_tbldefs.h @@ -32,14 +32,14 @@ typedef struct { - uint32_t interval_sec; /* number of seconds to wait before trying a new directory. - Must be >0 or slot is inactive. */ - uint8 priority; /* priority to use when placing transactions on the pending queue */ - cfdp_class_t cfdp_class; /* the CFDP class to send */ - cf_entity_id_t dest_eid; /* destination entity id */ - char src_dir[CF_FILENAME_MAX_PATH]; /* path to source dir */ - char dst_dir[CF_FILENAME_MAX_PATH]; /* path to destination dir */ - uint8 enabled; + uint32_t interval_sec; /* number of seconds to wait before trying a new directory. + Must be >0 or slot is inactive. */ + uint8 priority; /* priority to use when placing transactions on the pending queue */ + CF_CFDP_Class_t cfdp_class; /* the CFDP class to send */ + CF_EntityId_t dest_eid; /* destination entity id */ + char src_dir[CF_FILENAME_MAX_PATH]; /* path to source dir */ + char dst_dir[CF_FILENAME_MAX_PATH]; /* path to destination dir */ + uint8 enabled; } polldir_t; typedef struct @@ -64,7 +64,7 @@ typedef struct uint32 rx_crc_calc_bytes_per_wakeup; /* max number of bytes per wakeup to calculate r2 crc for recvd file (must by 1024-byte aligned */ - cf_entity_id_t local_eid; /* the local entity ID of the CF app */ + CF_EntityId_t local_eid; /* the local entity ID of the CF app */ cf_channel_t chan[CF_NUM_CHANNELS]; uint32 ack_timer_s; /* in seconds */ diff --git a/fsw/src/cf_app.c b/fsw/src/cf_app.c index 7ddb537c5..9d427580e 100644 --- a/fsw/src/cf_app.c +++ b/fsw/src/cf_app.c @@ -129,7 +129,7 @@ static int32 CF_ValidateConfigTable(void *tbl_ptr) "CF: config table has rx crc size not aligned with 1024"); ret = crc_alignment; /* must be 1024-byte aligned */ } - else if (tbl->outgoing_file_chunk_size > sizeof(pdu_fd_data_t)) + else if (tbl->outgoing_file_chunk_size > sizeof(CF_CFDP_PduFileDataContent_t)) { CFE_EVS_SendEvent(CF_EID_ERR_INIT_OUTGOING_SIZE, CFE_EVS_EventType_ERROR, "CF: config table has outgoing file chunk size too large"); diff --git a/fsw/src/cf_cfdp.c b/fsw/src/cf_cfdp.c index e3a034fef..22e7b1a3d 100644 --- a/fsw/src/cf_cfdp.c +++ b/fsw/src/cf_cfdp.c @@ -50,13 +50,13 @@ const int CF_max_chunks[CF_DIR_NUM][CF_NUM_CHANNELS] = {CF_CHANNEL_NUM_RX_CHUNKS static void CF_CFDP_RecvIdle(transaction_t *); static void CF_CFDP_RecvDrop(transaction_t *); -static void CF_CFDP_TxFile__(transaction_t *t, cfdp_class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority); +static void CF_CFDP_TxFile__(transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority); typedef struct trans_seq_arg_t { - cf_transaction_seq_t transaction_sequence_number; - cf_entity_id_t src_eid; - transaction_t *t; /* out param */ + CF_TransactionSeq_t transaction_sequence_number; + CF_EntityId_t src_eid; + transaction_t *t; /* out param */ } trans_seq_arg_t; typedef struct CF_CFDP_CycleTx_args_t @@ -100,7 +100,7 @@ void CF_CFDP_ArmAckTimer(transaction_t *t) ** \endreturns ** *************************************************************************/ -static inline cfdp_class_t CF_CFDP_GetClass(const transaction_t *ti) +static inline CF_CFDP_Class_t CF_CFDP_GetClass(const transaction_t *ti) { CF_Assert(ti->flags.com.q_index != CF_Q_FREE); return !!((ti->state == CFDP_S2) || (ti->state == CFDP_R2)); @@ -327,8 +327,8 @@ static int CF_CFDP_FindTransactionBySequenceNumber_(clist_node n, trans_seq_arg_ ** \endreturns ** *************************************************************************/ -transaction_t *CF_CFDP_FindTransactionBySequenceNumber(channel_t *c, cf_transaction_seq_t transaction_sequence_number, - cf_entity_id_t src_eid) +transaction_t *CF_CFDP_FindTransactionBySequenceNumber(channel_t *c, 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. @@ -367,15 +367,15 @@ transaction_t *CF_CFDP_FindTransactionBySequenceNumber(channel_t *c, cf_transact ** t must not be NULL. ** ** \returns -** \retstmt Pointer to a pdu_header_t within a software bus buffer on success. Otherwise NULL. \endcode +** \retstmt Pointer to a CF_CFDP_PduHeader_t within a software bus buffer on success. Otherwise NULL. \endcode ** \endreturns ** *************************************************************************/ -pdu_header_t *CF_CFDP_MsgOutGet(const transaction_t *t, int silent) +CF_CFDP_PduHeader_t *CF_CFDP_MsgOutGet(const transaction_t *t, int silent) { /* if channel is frozen, do not take message */ - channel_t *c = CF_AppData.engine.channels + t->chan_num; - pdu_header_t *ret = NULL; + channel_t *c = CF_AppData.engine.channels + t->chan_num; + CF_CFDP_PduHeader_t *ret = NULL; /* this function can be called more than once before the message * is sent, so if there's already an outgoing message allocated @@ -398,7 +398,8 @@ pdu_header_t *CF_CFDP_MsgOutGet(const transaction_t *t, int silent) (OS_CountSemTimedWait(c->sem_id, 0) == OS_SUCCESS)) || (!CF_AppData.config_table->chan[t->chan_num].sem_name[0]))) { - CF_AppData.engine.out.msg = CFE_SB_AllocateMessageBuffer(offsetof(pdu_s_msg_t, ph) + CF_MAX_PDU_SIZE); + CF_AppData.engine.out.msg = + CFE_SB_AllocateMessageBuffer(offsetof(CF_PduSendMsg_t, ph) + CF_MAX_PDU_SIZE); } if (!CF_AppData.engine.out.msg) @@ -416,7 +417,7 @@ pdu_header_t *CF_CFDP_MsgOutGet(const transaction_t *t, int silent) } } - ret = &((pdu_s_msg_t *)CF_AppData.engine.out.msg)->ph; + ret = &((CF_PduSendMsg_t *)CF_AppData.engine.out.msg)->ph; error_out: return ret; @@ -433,7 +434,7 @@ static void CF_CFDP_Send(uint8 chan_num, uint32 len) { CF_Assert(chan_num < CF_NUM_CHANNELS); CFE_SB_SetUserDataLength(&CF_AppData.engine.out.msg->Msg, - len + CF_HeaderSize(&((pdu_s_msg_t *)CF_AppData.engine.out.msg)->ph)); + len + CF_HeaderSize(&((CF_PduSendMsg_t *)CF_AppData.engine.out.msg)->ph)); CFE_MSG_SetMsgTime(&CF_AppData.engine.out.msg->Msg, CFE_TIME_GetTime()); /* PTFO: CFS apps typically do not check CFE_SB_Send or CFE_SB_ZeroCopySend return values. * This means the packet will be dropped, but the state machine will think it was sent. @@ -452,7 +453,7 @@ static void CF_CFDP_Send(uint8 chan_num, uint32 len) ** ph must not be NULL. ** *************************************************************************/ -static void CF_CFDP_SetPduLength(pdu_header_t *ph, uint16 length) +static void CF_CFDP_SetPduLength(CF_CFDP_PduHeader_t *ph, uint16 length) { cfdp_set_uint16(ph->length, length); /* does not include generic header length */ } @@ -465,19 +466,19 @@ static void CF_CFDP_SetPduLength(pdu_header_t *ph, uint16 length) ** CF_AppData.engine.out.msg must not be NULL. ** *************************************************************************/ -pdu_header_t *CF_CFDP_ConstructPduHeader(const transaction_t *t, uint8 directive_code, cf_entity_id_t src_eid, - cf_entity_id_t dst_eid, uint8 towards_sender, cf_transaction_seq_t tsn, - int silent) +CF_CFDP_PduHeader_t *CF_CFDP_ConstructPduHeader(const transaction_t *t, uint8 directive_code, CF_EntityId_t src_eid, + CF_EntityId_t dst_eid, uint8 towards_sender, CF_TransactionSeq_t tsn, + int silent) { /* directive_code == 0 if file data */ - pdu_header_t *ph = CF_CFDP_MsgOutGet(t, silent); + CF_CFDP_PduHeader_t *ph = CF_CFDP_MsgOutGet(t, silent); if (ph) { ph->flags = 0; - FSV(ph->flags, PDU_HDR_FLAGS_DIR, !!towards_sender); - FSV(ph->flags, PDU_HDR_FLAGS_TYPE, + FSV(ph->flags, CF_CFDP_PduHeader_FLAGS_DIR, !!towards_sender); + FSV(ph->flags, CF_CFDP_PduHeader_FLAGS_TYPE, !directive_code); /* directive code 0 is reserved, so use it to indicate file data */ - FSV(ph->flags, PDU_HDR_FLAGS_MODE, !CF_CFDP_GetClass(t)); + FSV(ph->flags, CF_CFDP_PduHeader_FLAGS_MODE, !CF_CFDP_GetClass(t)); CF_SetVariableHeader(src_eid, dst_eid, tsn); @@ -486,7 +487,7 @@ pdu_header_t *CF_CFDP_ConstructPduHeader(const transaction_t *t, uint8 directive * don't necessarily want a 0. */ if (directive_code) { - cfdp_set_uint8(STATIC_CAST(ph, pdu_file_directive_header_t)->directive_code, directive_code); + cfdp_set_uint8(STATIC_CAST(ph, CF_CFDP_PduFileDirectiveHeader_t)->directive_code, directive_code); } } @@ -532,9 +533,10 @@ static inline size_t CF_strnlen(const char *s, size_t maxlen) *************************************************************************/ cfdp_send_ret_t CF_CFDP_SendMd(transaction_t *t) { - pdu_header_t *ph = CF_CFDP_ConstructPduHeader(t, PDU_METADATA, CF_AppData.config_table->local_eid, - t->history->peer_eid, 0, t->history->seq_num, 0); - pdu_md_t *md; + CF_CFDP_PduHeader_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_PduMd_t *md; cfdp_send_ret_t sret = CF_SEND_SUCCESS; @@ -544,7 +546,7 @@ cfdp_send_ret_t CF_CFDP_SendMd(transaction_t *t) goto err_out; } - md = STATIC_CAST(ph, pdu_md_t); + md = STATIC_CAST(ph, CF_CFDP_PduMd_t); const int src_len = CF_strnlen(t->history->fnames.src_filename, sizeof(t->history->fnames.src_filename)); const int dst_len = CF_strnlen(t->history->fnames.dst_filename, sizeof(t->history->fnames.dst_filename)); @@ -561,7 +563,8 @@ cfdp_send_ret_t CF_CFDP_SendMd(transaction_t *t) cfdp_set_uint32(md->size, t->fsize); /* at this point, need to copy filenames into md packet */ - ret = CF_CFDP_CopyDataToLv((lv_t *)md->filename_lvs, (const uint8 *)t->history->fnames.src_filename, src_len); + ret = + CF_CFDP_CopyDataToLv((CF_CFDP_lv_t *)md->filename_lvs, (const uint8 *)t->history->fnames.src_filename, src_len); if (ret < 0) { sret = CF_SEND_ERROR; /* should not happen, since filename lengths are checked above */ @@ -569,8 +572,8 @@ cfdp_send_ret_t CF_CFDP_SendMd(transaction_t *t) } lv_ret = ret; - ret = CF_CFDP_CopyDataToLv((lv_t *)(md->filename_lvs + lv_ret), (const uint8 *)t->history->fnames.dst_filename, - dst_len); + ret = CF_CFDP_CopyDataToLv((CF_CFDP_lv_t *)(md->filename_lvs + lv_ret), + (const uint8 *)t->history->fnames.dst_filename, dst_len); if (ret < 0) { sret = CF_SEND_ERROR; /* should not happen, since filename lengths are checked above */ @@ -579,9 +582,9 @@ cfdp_send_ret_t CF_CFDP_SendMd(transaction_t *t) lv_ret += ret; - CF_CFDP_SetPduLength(ph, (offsetof(pdu_md_t, filename_lvs) + lv_ret)); + CF_CFDP_SetPduLength(ph, (offsetof(CF_CFDP_PduMd_t, filename_lvs) + lv_ret)); - CF_CFDP_Send(t->chan_num, offsetof(pdu_md_t, filename_lvs) + lv_ret); + CF_CFDP_Send(t->chan_num, offsetof(CF_CFDP_PduMd_t, filename_lvs) + lv_ret); err_out: return sret; @@ -602,12 +605,12 @@ cfdp_send_ret_t CF_CFDP_SendMd(transaction_t *t) *************************************************************************/ cfdp_send_ret_t CF_CFDP_SendFd(transaction_t *t, uint32 offset, int len) { - pdu_header_t *ph = &((pdu_s_msg_t *)CF_AppData.engine.out.msg)->ph; - pdu_fd_t *fd = STATIC_CAST(ph, pdu_fd_t); + CF_CFDP_PduHeader_t *ph = &((CF_PduSendMsg_t *)CF_AppData.engine.out.msg)->ph; + CF_CFDP_PduFd_t *fd = STATIC_CAST(ph, CF_CFDP_PduFd_t); /* NOTE: SendFd does not need a call to CF_CFDP_MsgOutGet, as the caller already has it */ cfdp_send_ret_t ret = CF_SEND_SUCCESS; - if (len > sizeof(pdu_fd_data_t)) + if (len > sizeof(CF_CFDP_PduFileDataContent_t)) { ret = CF_SEND_ERROR; goto err_out; @@ -616,8 +619,8 @@ cfdp_send_ret_t CF_CFDP_SendFd(transaction_t *t, uint32 offset, int len) cfdp_set_uint32(fd->fdh.offset, offset); /* update pdu length */ - CF_CFDP_SetPduLength(ph, offsetof(pdu_fd_t, fdd) + len); /* does not include generic header length */ - CF_CFDP_Send(t->chan_num, offsetof(pdu_fd_t, fdd) + len); + CF_CFDP_SetPduLength(ph, offsetof(CF_CFDP_PduFd_t, fdd) + len); /* does not include generic header length */ + CF_CFDP_Send(t->chan_num, offsetof(CF_CFDP_PduFd_t, fdd) + len); err_out: return ret; @@ -636,7 +639,7 @@ cfdp_send_ret_t CF_CFDP_SendFd(transaction_t *t, uint32 offset, int len) ** \endreturns ** *************************************************************************/ -static int CF_CFDP_FinishEofAck(tlv_t *tlv) +static int CF_CFDP_FinishEofAck(CF_CFDP_tlv_t *tlv) { const int csize = CF_GetMemcpySize((uint8 *)&CF_AppData.config_table->local_eid, sizeof(CF_AppData.config_table->local_eid)); @@ -644,9 +647,9 @@ static int CF_CFDP_FinishEofAck(tlv_t *tlv) CF_MemcpyToBE(tlv->data, (uint8 *)&CF_AppData.config_table->local_eid, sizeof(CF_AppData.config_table->local_eid), csize); cfdp_set_uint8(tlv->length, csize); - cfdp_set_uint8(tlv->type, ENTITY_ID_TLV_TYPE); + cfdp_set_uint8(tlv->type, CF_CFDP_TLV_TYPE_ENTITY_ID); - return offsetof(tlv_t, data) + csize; + return offsetof(CF_CFDP_tlv_t, data) + csize; } /************************************************************************/ @@ -664,11 +667,12 @@ static int CF_CFDP_FinishEofAck(tlv_t *tlv) *************************************************************************/ cfdp_send_ret_t CF_CFDP_SendEof(transaction_t *t) { - pdu_header_t *ph = CF_CFDP_ConstructPduHeader(t, PDU_EOF, CF_AppData.config_table->local_eid, t->history->peer_eid, - 0, t->history->seq_num, 0); - pdu_eof_t *eof; - int tlv_length = 0; - cfdp_send_ret_t ret = CF_SEND_SUCCESS; + CF_CFDP_PduHeader_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_PduEof_t *eof; + int tlv_length = 0; + cfdp_send_ret_t ret = CF_SEND_SUCCESS; if (!ph) { @@ -676,18 +680,18 @@ cfdp_send_ret_t CF_CFDP_SendEof(transaction_t *t) goto err_out; } - eof = STATIC_CAST(ph, pdu_eof_t); + eof = STATIC_CAST(ph, CF_CFDP_PduEof_t); - FSV(eof->cc, PDU_FLAGS_CC, t->history->cc); + FSV(eof->cc, CF_CFDP_PduEof_FLAGS_CC, t->history->cc); cfdp_set_uint32(eof->crc, t->crc.result); cfdp_set_uint32(eof->size, t->fsize); - if (t->history->cc != CC_NO_ERROR) + if (t->history->cc != CF_CFDP_ConditionCode_NO_ERROR) { - tlv_length += CF_CFDP_FinishEofAck(eof->fault_location); + tlv_length += CF_CFDP_FinishEofAck((CF_CFDP_tlv_t *)eof->fault_location); } - CF_CFDP_SetPduLength(ph, offsetof(pdu_eof_t, fault_location) + tlv_length); - CF_CFDP_Send(t->chan_num, offsetof(pdu_eof_t, fault_location) + tlv_length); + CF_CFDP_SetPduLength(ph, offsetof(CF_CFDP_PduEof_t, fault_location) + tlv_length); + CF_CFDP_Send(t->chan_num, offsetof(CF_CFDP_PduEof_t, fault_location) + tlv_length); err_out: return ret; @@ -706,22 +710,22 @@ cfdp_send_ret_t CF_CFDP_SendEof(transaction_t *t) ** \endreturns ** *************************************************************************/ -cfdp_send_ret_t CF_CFDP_SendAck(transaction_t *t, ack_transaction_status_t ts, file_directive_t dir_code, - condition_code_t cc, cf_entity_id_t peer_eid, cf_transaction_seq_t tsn) +cfdp_send_ret_t CF_CFDP_SendAck(transaction_t *t, 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) { - pdu_header_t *ph; - pdu_ack_t *ack; - cfdp_send_ret_t ret = CF_SEND_SUCCESS; + CF_CFDP_PduHeader_t *ph; + CF_CFDP_PduAck_t *ack; + cfdp_send_ret_t ret = CF_SEND_SUCCESS; if (CF_CFDP_IsSender(t)) { - ph = CF_CFDP_ConstructPduHeader(t, PDU_ACK, CF_AppData.config_table->local_eid, peer_eid, - dir_code == PDU_EOF ? 1 : 0, tsn, 0); + ph = CF_CFDP_ConstructPduHeader(t, CF_CFDP_FileDirective_ACK, CF_AppData.config_table->local_eid, peer_eid, + dir_code == CF_CFDP_FileDirective_EOF ? 1 : 0, tsn, 0); } else { - ph = CF_CFDP_ConstructPduHeader(t, PDU_ACK, peer_eid, CF_AppData.config_table->local_eid, - dir_code == PDU_EOF ? 1 : 0, tsn, 0); + ph = CF_CFDP_ConstructPduHeader(t, CF_CFDP_FileDirective_ACK, peer_eid, CF_AppData.config_table->local_eid, + dir_code == CF_CFDP_FileDirective_EOF ? 1 : 0, tsn, 0); } if (!ph) @@ -730,17 +734,17 @@ cfdp_send_ret_t CF_CFDP_SendAck(transaction_t *t, ack_transaction_status_t ts, f goto err_out; } - ack = STATIC_CAST(ph, pdu_ack_t); + ack = STATIC_CAST(ph, CF_CFDP_PduAck_t); - CF_Assert((dir_code == PDU_EOF) || (dir_code == PDU_FIN)); - FSV(ack->directive_and_subtype_code, PDU_ACK_DIR_CODE, dir_code); - FSV(ack->directive_and_subtype_code, PDU_ACK_DIR_SUBTYPE_CODE, + CF_Assert((dir_code == CF_CFDP_FileDirective_EOF) || (dir_code == CF_CFDP_FileDirective_FIN)); + FSV(ack->directive_and_subtype_code, CF_CFDP_PduAck_DIR_CODE, dir_code); + FSV(ack->directive_and_subtype_code, CF_CFDP_PduAck_DIR_SUBTYPE_CODE, 1); /* looks like always 1 if not extended features */ - FSV(ack->cc_and_transaction_status, PDU_ACK_CC, cc); - FSV(ack->cc_and_transaction_status, PDU_ACK_TRANSACTION_STATUS, ts); + FSV(ack->cc_and_transaction_status, CF_CFDP_PduAck_CC, cc); + FSV(ack->cc_and_transaction_status, CF_CFDP_PduAck_TRANSACTION_STATUS, ts); - CF_CFDP_SetPduLength(ph, sizeof(pdu_ack_t)); - CF_CFDP_Send(t->chan_num, sizeof(pdu_ack_t)); + CF_CFDP_SetPduLength(ph, sizeof(CF_CFDP_PduAck_t)); + CF_CFDP_Send(t->chan_num, sizeof(CF_CFDP_PduAck_t)); err_out: return ret; } @@ -758,12 +762,13 @@ cfdp_send_ret_t CF_CFDP_SendAck(transaction_t *t, ack_transaction_status_t ts, f ** \endreturns ** *************************************************************************/ -cfdp_send_ret_t CF_CFDP_SendFin(transaction_t *t, fin_delivery_code_t dc, fin_file_status_t fs, condition_code_t cc) +cfdp_send_ret_t CF_CFDP_SendFin(transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, + CF_CFDP_ConditionCode_t cc) { - pdu_header_t *ph = CF_CFDP_ConstructPduHeader(t, PDU_FIN, t->history->peer_eid, CF_AppData.config_table->local_eid, - 1, t->history->seq_num, 0); - cfdp_send_ret_t ret = CF_SEND_SUCCESS; - int tlv_length = 0; + CF_CFDP_PduHeader_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); + cfdp_send_ret_t ret = CF_SEND_SUCCESS; + int tlv_length = 0; if (!ph) { @@ -771,19 +776,19 @@ cfdp_send_ret_t CF_CFDP_SendFin(transaction_t *t, fin_delivery_code_t dc, fin_fi goto err_out; } - pdu_fin_t *fin = STATIC_CAST(ph, pdu_fin_t); + CF_CFDP_PduFin_t *fin = STATIC_CAST(ph, CF_CFDP_PduFin_t); cfdp_set_uint8(fin->flags, 0); - FSV(fin->flags, PDU_FLAGS_CC, cc); - FSV(fin->flags, PDU_FIN_FLAGS_DELIVERY_CODE, dc); - FSV(fin->flags, PDU_FIN_FLAGS_FILE_STATUS, fs); - FSV(fin->flags, PDU_FIN_FLAGS_END_SYSTEM_STATUS, 1); /* seems to always be 1 without extended features */ - if (cc != CC_NO_ERROR) + FSV(fin->flags, CF_CFDP_PduFin_FLAGS_CC, cc); + FSV(fin->flags, CF_CFDP_PduFin_FLAGS_DELIVERY_CODE, dc); + FSV(fin->flags, CF_CFDP_PduFin_FLAGS_FILE_STATUS, fs); + FSV(fin->flags, CF_CFDP_PduFin_FLAGS_END_SYSTEM_STATUS, 1); /* seems to always be 1 without extended features */ + if (cc != CF_CFDP_ConditionCode_NO_ERROR) { - tlv_length += CF_CFDP_FinishEofAck(fin->fault_location); + tlv_length += CF_CFDP_FinishEofAck((CF_CFDP_tlv_t *)fin->fault_location); } - CF_CFDP_SetPduLength(ph, offsetof(pdu_fin_t, fault_location) + tlv_length); - CF_CFDP_Send(t->chan_num, offsetof(pdu_fin_t, fault_location) + tlv_length); + CF_CFDP_SetPduLength(ph, offsetof(CF_CFDP_PduFin_t, fault_location) + tlv_length); + CF_CFDP_Send(t->chan_num, offsetof(CF_CFDP_PduFin_t, fault_location) + tlv_length); err_out: return ret; @@ -804,10 +809,10 @@ cfdp_send_ret_t CF_CFDP_SendFin(transaction_t *t, fin_delivery_code_t dc, fin_fi *************************************************************************/ cfdp_send_ret_t CF_CFDP_SendNak(transaction_t *t, int num_segment_requests) { - pdu_header_t *ph = &((pdu_s_msg_t *)CF_AppData.engine.out.msg)->ph; - pdu_nak_t *nak = STATIC_CAST(ph, pdu_nak_t); - int index; - cfdp_send_ret_t ret = CF_SEND_SUCCESS; + CF_CFDP_PduHeader_t *ph = &((CF_PduSendMsg_t *)CF_AppData.engine.out.msg)->ph; + CF_CFDP_PduNak_t *nak = STATIC_CAST(ph, CF_CFDP_PduNak_t); + int index; + cfdp_send_ret_t ret = CF_SEND_SUCCESS; if (!ph) { @@ -815,7 +820,7 @@ cfdp_send_ret_t CF_CFDP_SendNak(transaction_t *t, int num_segment_requests) goto err_out; } - CF_Assert(CF_CFDP_GetClass(t) == CLASS_2); + CF_Assert(CF_CFDP_GetClass(t) == CF_CFDP_CLASS_2); cfdp_set_uint32(nak->scope_start, nak->scope_start); cfdp_set_uint32(nak->scope_end, nak->scope_end); @@ -823,13 +828,14 @@ cfdp_send_ret_t CF_CFDP_SendNak(transaction_t *t, int num_segment_requests) for (index = 0; index < num_segment_requests; ++index) { /* nak->segment_requests is a pointer, so no need to use accessor function for alignment */ - struct segment_request_t *s = nak->segment_requests + index; + CF_CFDP_SegmentRequest_t *s = nak->segment_requests + index; cfdp_set_uint32(s->offset_start, s->offset_start); cfdp_set_uint32(s->offset_end, s->offset_end); } - index = offsetof(pdu_nak_t, segment_requests) + (index * sizeof(struct segment_request_t)); /* calculate pdu size */ - CF_CFDP_SetPduLength(ph, index); /* does not include generic header length */ + index = offsetof(CF_CFDP_PduNak_t, segment_requests) + + (index * sizeof(CF_CFDP_SegmentRequest_t)); /* calculate pdu size */ + CF_CFDP_SetPduLength(ph, index); /* does not include generic header length */ CF_CFDP_Send(t->chan_num, index); err_out: @@ -857,9 +863,9 @@ static int CF_CFDP_RecvPh(uint8 chan_num) CF_Assert(chan_num < CF_NUM_CHANNELS); CF_Assert(CF_AppData.engine.in.msg); - pdu_header_t *ph = &((pdu_r_msg_t *)CF_AppData.engine.in.msg)->ph; - uint16 temp; - const int hsize = CF_HeaderSize(ph); + CF_CFDP_PduHeader_t *ph = &((CF_PduRecvMsg_t *)CF_AppData.engine.in.msg)->ph; + uint16 temp; + const int hsize = CF_HeaderSize(ph); CF_AppData.engine.in.bytes_received = CFE_SB_GetUserDataLength(&CF_AppData.engine.in.msg->Msg); @@ -911,11 +917,11 @@ int CF_CFDP_RecvMd(transaction_t *t) { /* CF_CFDP_RecvPh() must have been called before this, so use ldst to access pdu header */ CF_Assert(CF_AppData.engine.in.msg); - pdu_header_t *ph = &((pdu_r_msg_t *)CF_AppData.engine.in.msg)->ph; - pdu_md_t *md = STATIC_CAST(ph, pdu_md_t); - int offs = 0, lv_ret; + CF_CFDP_PduHeader_t *ph = &((CF_PduRecvMsg_t *)CF_AppData.engine.in.msg)->ph; + CF_CFDP_PduMd_t *md = STATIC_CAST(ph, CF_CFDP_PduMd_t); + int offs = 0, lv_ret; - if (CF_AppData.engine.in.bytes_received < (CF_HeaderSize(ph) + sizeof(pdu_md_t))) + if (CF_AppData.engine.in.bytes_received < (CF_HeaderSize(ph) + sizeof(CF_CFDP_PduMd_t))) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_MD_SHORT, CFE_EVS_EventType_ERROR, "CF: metadata packet too short: %d bytes received", @@ -928,23 +934,24 @@ int CF_CFDP_RecvMd(transaction_t *t) /* store the filenames */ /* PTFO: could maybe make this a loop of 2 to store the filenames */ - lv_ret = CF_CFDP_CopyDataFromLv((uint8 *)t->history->fnames.src_filename, (lv_t *)md->filename_lvs); + lv_ret = CF_CFDP_CopyDataFromLv((uint8 *)t->history->fnames.src_filename, (CF_CFDP_lv_t *)md->filename_lvs); 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", - ((lv_t *)md->filename_lvs + offs)->length); + ((CF_CFDP_lv_t *)md->filename_lvs + offs)->length); goto err_out; } /* need to null-terminate file name */ t->history->fnames.src_filename[lv_ret] = 0; offs += lv_ret + 1; /* +1 for the length byte in the lv -- CF_CFDP_CopyDataFromLv returns bytes copied to buffer */ - lv_ret = CF_CFDP_CopyDataFromLv((uint8 *)t->history->fnames.dst_filename, (lv_t *)(md->filename_lvs + offs)); + lv_ret = + CF_CFDP_CopyDataFromLv((uint8 *)t->history->fnames.dst_filename, (CF_CFDP_lv_t *)(md->filename_lvs + offs)); 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", - ((lv_t *)md->filename_lvs + offs)->length); + ((CF_CFDP_lv_t *)md->filename_lvs + offs)->length); goto err_out; } t->history->fnames.dst_filename[lv_ret] = 0; @@ -979,10 +986,10 @@ int CF_CFDP_RecvFd(transaction_t *t) /* CF_CFDP_RecvPh() must have been called before this, so use ldst to access pdu header */ int ret = 0; CF_Assert(CF_AppData.engine.in.msg); - pdu_header_t *ph = &((pdu_r_msg_t *)CF_AppData.engine.in.msg)->ph; - pdu_fd_t *fd = STATIC_CAST(ph, pdu_fd_t); + CF_CFDP_PduHeader_t *ph = &((CF_PduRecvMsg_t *)CF_AppData.engine.in.msg)->ph; + CF_CFDP_PduFd_t *fd = STATIC_CAST(ph, CF_CFDP_PduFd_t); - if (CF_AppData.engine.in.bytes_received < (CF_HeaderSize(ph) + sizeof(pdu_file_data_header_t))) + if (CF_AppData.engine.in.bytes_received < (CF_HeaderSize(ph) + sizeof(CF_CFDP_PduFileDataHeader_t))) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_FD_SHORT, CFE_EVS_EventType_ERROR, "CF: filedata pdu too short: %d bytes received", (uint32)CF_AppData.engine.in.bytes_received); @@ -1014,10 +1021,10 @@ int CF_CFDP_RecvEof(void) /* CF_CFDP_RecvPh() must have been called before this, so use ldst to access pdu header */ int ret = 0; CF_Assert(CF_AppData.engine.in.msg); - pdu_header_t *ph = &((pdu_r_msg_t *)CF_AppData.engine.in.msg)->ph; - pdu_eof_t *eof = STATIC_CAST(ph, pdu_eof_t); + CF_CFDP_PduHeader_t *ph = &((CF_PduRecvMsg_t *)CF_AppData.engine.in.msg)->ph; + CF_CFDP_PduEof_t *eof = STATIC_CAST(ph, CF_CFDP_PduEof_t); - if (CF_AppData.engine.in.bytes_received < (CF_HeaderSize(ph) + offsetof(pdu_eof_t, fault_location))) + if (CF_AppData.engine.in.bytes_received < (CF_HeaderSize(ph) + offsetof(CF_CFDP_PduEof_t, fault_location))) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_EOF_SHORT, CFE_EVS_EventType_ERROR, "CF: eof pdu too short: %d bytes received", (uint32)CF_AppData.engine.in.bytes_received); @@ -1050,9 +1057,9 @@ int CF_CFDP_RecvAck(void) /* CF_CFDP_RecvPh() must have been called before this, so use ldst to access pdu header */ int ret = 0; CF_Assert(CF_AppData.engine.in.msg); - pdu_header_t *ph = &((pdu_r_msg_t *)CF_AppData.engine.in.msg)->ph; + CF_CFDP_PduHeader_t *ph = &((CF_PduRecvMsg_t *)CF_AppData.engine.in.msg)->ph; - if (CF_AppData.engine.in.bytes_received < (CF_HeaderSize(ph) + sizeof(pdu_ack_t))) + if (CF_AppData.engine.in.bytes_received < (CF_HeaderSize(ph) + sizeof(CF_CFDP_PduAck_t))) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_ACK_SHORT, CFE_EVS_EventType_ERROR, "CF: ack pdu too short: %d bytes received", (uint32)CF_AppData.engine.in.bytes_received); @@ -1080,9 +1087,9 @@ int CF_CFDP_RecvFin(void) /* CF_CFDP_RecvPh() must have been called before this, so use ldst to access pdu header */ int ret = 0; CF_Assert(CF_AppData.engine.in.msg); - pdu_header_t *ph = &((pdu_r_msg_t *)CF_AppData.engine.in.msg)->ph; + CF_CFDP_PduHeader_t *ph = &((CF_PduRecvMsg_t *)CF_AppData.engine.in.msg)->ph; - if (CF_AppData.engine.in.bytes_received < (CF_HeaderSize(ph) + offsetof(pdu_fin_t, fault_location))) + if (CF_AppData.engine.in.bytes_received < (CF_HeaderSize(ph) + offsetof(CF_CFDP_PduFin_t, fault_location))) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_FIN_SHORT, CFE_EVS_EventType_ERROR, "CF: fin pdu too short: %d bytes received", (uint32)CF_AppData.engine.in.bytes_received); @@ -1112,11 +1119,11 @@ int CF_CFDP_RecvNak(int *num_segment_requests) CF_Assert(CF_AppData.engine.in.msg); CF_Assert(num_segment_requests); - int ret = 0; - pdu_header_t *ph = &((pdu_r_msg_t *)CF_AppData.engine.in.msg)->ph; - pdu_nak_t *nak = STATIC_CAST(ph, pdu_nak_t); + int ret = 0; + CF_CFDP_PduHeader_t *ph = &((CF_PduRecvMsg_t *)CF_AppData.engine.in.msg)->ph; + CF_CFDP_PduNak_t *nak = STATIC_CAST(ph, CF_CFDP_PduNak_t); - if (CF_AppData.engine.in.bytes_received < (CF_HeaderSize(ph) + offsetof(pdu_nak_t, segment_requests))) + if (CF_AppData.engine.in.bytes_received < (CF_HeaderSize(ph) + offsetof(CF_CFDP_PduNak_t, segment_requests))) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_NAK_SHORT, CFE_EVS_EventType_ERROR, "CF: nak pdu too short: %d bytes received", (uint32)CF_AppData.engine.in.bytes_received); @@ -1131,10 +1138,11 @@ int CF_CFDP_RecvNak(int *num_segment_requests) *num_segment_requests = 0; while ((*num_segment_requests < CF_NAK_MAX_SEGMENTS) && - (offsetof(pdu_nak_t, segment_requests[*num_segment_requests + 1]) <= CF_AppData.engine.in.bytes_received)) + (offsetof(CF_CFDP_PduNak_t, segment_requests[*num_segment_requests + 1]) <= + CF_AppData.engine.in.bytes_received)) { /* segment_requests is a pointer, so its value does not need to consider alignment to access */ - struct segment_request_t *s = nak->segment_requests + *num_segment_requests; + struct CF_CFDP_SegmentRequest *s = nak->segment_requests + *num_segment_requests; cfdp_get_uint32(s->offset_start, s->offset_start); cfdp_get_uint32(s->offset_end, s->offset_end); ++*num_segment_requests; @@ -1178,7 +1186,7 @@ static void CF_CFDP_RecvIdle(transaction_t *t) /* only RX transactions dare tread here */ int ok_to_reset = 1; CF_Assert(CF_AppData.engine.in.msg); - pdu_header_t *ph = &((pdu_r_msg_t *)CF_AppData.engine.in.msg)->ph; + CF_CFDP_PduHeader_t *ph = &((CF_PduRecvMsg_t *)CF_AppData.engine.in.msg)->ph; t->history->seq_num = CF_AppData.engine.in.tsn; @@ -1191,7 +1199,7 @@ static void CF_CFDP_RecvIdle(transaction_t *t) /* this is an idle transaction, so see if there's a received packet that can * be bound to the transaction */ - if (FGV(ph->flags, PDU_HDR_FLAGS_TYPE)) + if (FGV(ph->flags, CF_CFDP_PduHeader_FLAGS_TYPE)) { /* file data PDU */ /* being idle and receiving a file data PDU means that no active transaction knew @@ -1199,7 +1207,7 @@ static void CF_CFDP_RecvIdle(transaction_t *t) /* if class 2, switch into R2 state and let it handle */ /* don't forget to bind the transaction */ - if (FGV(ph->flags, PDU_HDR_FLAGS_MODE)) + if (FGV(ph->flags, CF_CFDP_PduHeader_FLAGS_MODE)) { /* R1, can't do anything without metadata first */ t->state = CFDP_DROP; /* drop all incoming */ @@ -1215,18 +1223,18 @@ static void CF_CFDP_RecvIdle(transaction_t *t) } else { - int status; - pdu_file_directive_header_t *fdh = STATIC_CAST(ph, pdu_file_directive_header_t); + int status; + CF_CFDP_PduFileDirectiveHeader_t *fdh = STATIC_CAST(ph, CF_CFDP_PduFileDirectiveHeader_t); /* file directive PDU, but we are in an idle state. It only makes sense right now to accept metadata PDU. */ switch (fdh->directive_code) { - case PDU_METADATA: + case CF_CFDP_FileDirective_METADATA: status = CF_CFDP_RecvMd(t); if (!status) { /* NOTE: whether or not class 1 or 2, get a free chunks. it's cheap, and simplifies cleanup path */ - t->state = FGV(ph->flags, PDU_HDR_FLAGS_MODE) ? CFDP_R1 : CFDP_R2; + t->state = FGV(ph->flags, CF_CFDP_PduHeader_FLAGS_MODE) ? CFDP_R1 : CFDP_R2; t->flags.rx.md_recv = 1; CF_CFDP_R_Init(t); /* initialize R */ ok_to_reset = 0; /* if error in CF_CFDP_R_Init(), the transaction will be reset. if no error, then @@ -1371,7 +1379,7 @@ static void CF_CFDP_ReceiveMessage(channel_t *c) CFE_ES_PerfLogEntry(CF_PERF_ID_PDURCVD(chan_num)); if (!CF_CFDP_RecvPh(chan_num)) { - pdu_header_t *ph = &((pdu_r_msg_t *)CF_AppData.engine.in.msg)->ph; + CF_CFDP_PduHeader_t *ph = &((CF_PduRecvMsg_t *)CF_AppData.engine.in.msg)->ph; /* got a valid pdu -- look it up by sequence number */ t = CF_CFDP_FindTransactionBySequenceNumber(c, CF_AppData.engine.in.tsn, CF_AppData.engine.in.src); @@ -1392,20 +1400,20 @@ static void CF_CFDP_ReceiveMessage(channel_t *c) * So, send a FIN-ACK by cobbling together a temporary transaction on the * stack and calling CF_CFDP_SendAck() */ if (CF_AppData.engine.in.src == CF_AppData.config_table->local_eid && - !FGV(ph->flags, PDU_HDR_FLAGS_TYPE) && + !FGV(ph->flags, CF_CFDP_PduHeader_FLAGS_TYPE) && (CF_AppData.engine.in.bytes_received >= - (sizeof(pdu_file_directive_header_t) + CF_HeaderSize(ph))) && - (STATIC_CAST(ph, pdu_file_directive_header_t)->directive_code == PDU_FIN)) + (sizeof(CF_CFDP_PduFileDirectiveHeader_t) + CF_HeaderSize(ph))) && + (STATIC_CAST(ph, CF_CFDP_PduFileDirectiveHeader_t)->directive_code == CF_CFDP_FileDirective_FIN)) { if (!CF_CFDP_RecvFin()) { transaction_t t; const uint8 chan_num = (c - CF_AppData.engine.channels); memset(&t, 0, sizeof(t)); - CF_CFDP_TxFile__(&t, CLASS_2, 1, chan_num, + CF_CFDP_TxFile__(&t, CF_CFDP_CLASS_2, 1, chan_num, 0); /* populate transaction with needed fields for CF_CFDP_SendAck() */ - if (CF_CFDP_SendAck(&t, ACK_TS_UNRECOGNIZED, PDU_FIN, - FGV(STATIC_CAST(ph, pdu_fin_t)->flags, PDU_FLAGS_CC), + if (CF_CFDP_SendAck(&t, CF_CFDP_AckTxnStatus_UNRECOGNIZED, CF_CFDP_FileDirective_FIN, + FGV(STATIC_CAST(ph, CF_CFDP_PduFin_t)->flags, CF_CFDP_PduFin_FLAGS_CC), CF_AppData.engine.in.dst, CF_AppData.engine.in.tsn) != CF_SEND_NO_MSG) { /* couldn't get output buffer -- don't care about a send error (oh well, can't send) but we @@ -1441,8 +1449,8 @@ static void CF_CFDP_ReceiveMessage(channel_t *c) t->history->dir = CF_DIR_RX; /* set default fin status */ - t->state_data.r.r2.dc = FIN_INCOMPLETE; - t->state_data.r.r2.fs = FIN_DISCARDED; + t->state_data.r.r2.dc = CF_CFDP_FinDeliveryCode_INCOMPLETE; + t->state_data.r.r2.fs = CF_CFDP_FinFileStatus_DISCARDED; CF_CList_InsertBack_Ex(c, (t->flags.com.q_index = CF_Q_RX), &t->cl_node); CF_CFDP_DispatchRecv(t); /* will enter idle state */ @@ -1664,7 +1672,7 @@ early_exit:; ** t must not be NULL. ** *************************************************************************/ -static void CF_CFDP_TxFile__(transaction_t *t, cfdp_class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority) +static void CF_CFDP_TxFile__(transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority) { t->chan_num = chan; t->priority = priority; @@ -1683,8 +1691,8 @@ static void CF_CFDP_TxFile__(transaction_t *t, cfdp_class_t cfdp_class, uint8 ke ** t must not be NULL. ** *************************************************************************/ -static void CF_CFDP_TxFile_(transaction_t *t, cfdp_class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, - cf_entity_id_t dest_id) +static void CF_CFDP_TxFile_(transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, + CF_EntityId_t dest_id) { CFE_EVS_SendEvent(CF_EID_INF_CFDP_S_START_SEND, CFE_EVS_EventType_INFORMATION, "CF: start class %d tx of file %d:%.*s -> %d:%.*s", cfdp_class + 1, @@ -1721,7 +1729,7 @@ static void CF_CFDP_TxFile_(transaction_t *t, cfdp_class_t cfdp_class, uint8 kee ** *************************************************************************/ int32 CF_CFDP_TxFile(const char src_filename[CF_FILENAME_MAX_LEN], const char dst_filename[CF_FILENAME_MAX_LEN], - cfdp_class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, cf_entity_id_t dest_id) + CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, CF_EntityId_t dest_id) { transaction_t *t; channel_t *c = &CF_AppData.engine.channels[chan]; @@ -1770,8 +1778,8 @@ int32 CF_CFDP_TxFile(const char src_filename[CF_FILENAME_MAX_LEN], const char ds ** *************************************************************************/ static int32 CF_CFDP_PlaybackDir_(playback_t *p, const char *src_filename, const char *dst_filename, - cfdp_class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, - cf_entity_id_t dest_id) + CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, + CF_EntityId_t dest_id) { int32 ret = CFE_SUCCESS; @@ -1819,7 +1827,7 @@ static int32 CF_CFDP_PlaybackDir_(playback_t *p, const char *src_filename, const ** *************************************************************************/ int32 CF_CFDP_PlaybackDir(const char src_filename[CF_FILENAME_MAX_LEN], const char dst_filename[CF_FILENAME_MAX_LEN], - cfdp_class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, uint16 dest_id) + CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, uint16 dest_id) { int i; playback_t *p; @@ -2158,9 +2166,11 @@ void CF_CFDP_ResetTransaction(transaction_t *t, int keep_history) ** \endreturns ** *************************************************************************/ -int CF_CFDP_CopyDataToLv(lv_t *dest_lv, const uint8 *data, uint32 len) +int CF_CFDP_CopyDataToLv(CF_CFDP_lv_t *dest_lv, const uint8 *data, uint32 len) { - if (len < sizeof(dest_lv->data)) + /* Per CFDP spec, an LV is limited to 255 bytes, but CF app does + * not encode anything bigger than a filename */ + if (len < CF_FILENAME_MAX_LEN) { dest_lv->length = len; memcpy(dest_lv->data, data, len); @@ -2182,9 +2192,9 @@ int CF_CFDP_CopyDataToLv(lv_t *dest_lv, const uint8 *data, uint32 len) ** \endreturns ** *************************************************************************/ -int CF_CFDP_CopyDataFromLv(uint8 buf[CF_FILENAME_MAX_LEN], const lv_t *src_lv) +int CF_CFDP_CopyDataFromLv(uint8 buf[CF_FILENAME_MAX_LEN], const CF_CFDP_lv_t *src_lv) { - if (src_lv->length < sizeof(src_lv->data)) + if (src_lv->length < CF_FILENAME_MAX_LEN) { memcpy(buf, src_lv->data, src_lv->length); return src_lv->length; @@ -2206,7 +2216,7 @@ void CF_CFDP_CancelTransaction(transaction_t *t) if (!t->flags.com.canceled) { t->flags.com.canceled = 1; - t->history->cc = CC_CANCEL_REQUEST_RECEIVED; + t->history->cc = CF_CFDP_ConditionCode_CANCEL_REQUEST_RECEIVED; fns[!!CF_CFDP_IsSender(t)](t); } } diff --git a/fsw/src/cf_cfdp.h b/fsw/src/cf_cfdp.h index 3b9c26473..0613bcb42 100644 --- a/fsw/src/cf_cfdp.h +++ b/fsw/src/cf_cfdp.h @@ -97,13 +97,13 @@ typedef enum direction_t typedef struct { - transaction_fnames_t fnames; - clist_node_t cl_node; - direction_t dir; - condition_code_t cc; - cf_entity_id_t src_eid; /* src_eid is always the source eid */ - cf_entity_id_t peer_eid; /* peer_eid is always the "other guy", which is the same src_eid for RX */ - cf_transaction_seq_t seq_num; /* stays constant for entire transfer */ + transaction_fnames_t fnames; + clist_node_t cl_node; + direction_t dir; + CF_CFDP_ConditionCode_t cc; + CF_EntityId_t src_eid; /* src_eid is always the source eid */ + CF_EntityId_t peer_eid; /* peer_eid is always the "other guy", which is the same src_eid for RX */ + CF_TransactionSeq_t seq_num; /* stays constant for entire transfer */ } history_t; typedef struct @@ -117,11 +117,11 @@ struct transaction_t; typedef struct { uint32 dir_id; - cfdp_class_t cfdp_class; + CF_CFDP_Class_t cfdp_class; transaction_fnames_t fnames; uint16 num_ts; /* number of transactions -- 16 bit should be enough */ uint8 priority; - cf_entity_id_t dest_id; + CF_EntityId_t dest_id; bool busy; bool diropen; @@ -158,13 +158,13 @@ typedef struct typedef struct { - uint32 eof_crc; - uint32 eof_size; - uint32 rx_crc_calc_bytes; - fin_delivery_code_t dc; - fin_file_status_t fs; - uint8 eof_cc; /* remember the cc in the received eof pdu to echo in eof-ack */ - rxtx_counters_t counter; + uint32 eof_crc; + uint32 eof_size; + uint32 rx_crc_calc_bytes; + CF_CFDP_FinDeliveryCode_t dc; + CF_CFDP_FinFileStatus_t fs; + uint8 eof_cc; /* remember the cc in the received eof pdu to echo in eof-ack */ + rxtx_counters_t counter; } rx_r2_data_t; typedef struct @@ -308,11 +308,11 @@ typedef struct typedef struct { - CFE_SB_Buffer_t *msg; - CFE_MSG_Size_t bytes_received; - cf_entity_id_t src; - cf_entity_id_t dst; - cf_transaction_seq_t tsn; + CFE_SB_Buffer_t *msg; + CFE_MSG_Size_t bytes_received; + CF_EntityId_t src; + CF_EntityId_t dst; + CF_TransactionSeq_t tsn; } in_t; /* An engine represents a pairing to a local EID @@ -320,7 +320,7 @@ typedef struct * Each engine can have at most CF_MAX_SIMULTANEOUS_TRANSACTIONS */ typedef struct { - cf_transaction_seq_t seq_num; /* keep track of the next sequence number to use for sends */ + CF_TransactionSeq_t seq_num; /* keep track of the next sequence number to use for sends */ out_t out; in_t in; @@ -351,28 +351,28 @@ extern void CF_CFDP_DisableEngine(void); /* ground commands into the engine */ /* returns NULL on err */ extern int32 CF_CFDP_TxFile(const char src_filename[CF_FILENAME_MAX_LEN], const char dst_filename[CF_FILENAME_MAX_LEN], - cfdp_class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, cf_entity_id_t dest_id); + CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, CF_EntityId_t dest_id); extern int32 CF_CFDP_PlaybackDir(const char src_filename[CF_FILENAME_MAX_LEN], - const char dst_filename[CF_FILENAME_MAX_LEN], cfdp_class_t cfdp_class, uint8 keep, + const char dst_filename[CF_FILENAME_MAX_LEN], CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, uint16 dest_id); /* PDU send functions */ /* CF_CFDP_ConstructPduHeader sets length of 0. Must set it after building packet */ -extern pdu_header_t *CF_CFDP_ConstructPduHeader(const transaction_t *t, uint8 directive_code, cf_entity_id_t src_eid, - cf_entity_id_t dst_eid, uint8 towards_sender, cf_transaction_seq_t tsn, - int silent); -extern cfdp_send_ret_t CF_CFDP_SendMd(transaction_t *t); -extern cfdp_send_ret_t CF_CFDP_SendFd(transaction_t *t, uint32 offset, int len); +extern CF_CFDP_PduHeader_t *CF_CFDP_ConstructPduHeader(const transaction_t *t, uint8 directive_code, + CF_EntityId_t src_eid, CF_EntityId_t dst_eid, + uint8 towards_sender, CF_TransactionSeq_t tsn, int silent); +extern cfdp_send_ret_t CF_CFDP_SendMd(transaction_t *t); +extern cfdp_send_ret_t CF_CFDP_SendFd(transaction_t *t, uint32 offset, int len); extern cfdp_send_ret_t CF_CFDP_SendEof(transaction_t *t); -/* NOTE: CF_CFDP_SendAck() takes a cf_transaction_seq_t instead of getting it from transaction history because +/* 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 history_t for it. */ -extern cfdp_send_ret_t CF_CFDP_SendAck(transaction_t *t, ack_transaction_status_t ts, file_directive_t dir_code, - condition_code_t cc, cf_entity_id_t peer_eid, cf_transaction_seq_t tsn); -extern cfdp_send_ret_t CF_CFDP_SendFin(transaction_t *t, fin_delivery_code_t dc, fin_file_status_t fs, - condition_code_t cc); +extern cfdp_send_ret_t CF_CFDP_SendAck(transaction_t *t, 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); +extern cfdp_send_ret_t CF_CFDP_SendFin(transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, + CF_CFDP_ConditionCode_t cc); extern cfdp_send_ret_t CF_CFDP_SendNak(transaction_t *t, int num_segment_requests); /* PDU receive functions */ @@ -400,18 +400,18 @@ extern void CF_CFDP_R_Init(transaction_t *t); extern void CF_CFDP_CancelTransaction(transaction_t *t); -extern pdu_header_t *CF_CFDP_MsgOutGet(const transaction_t *t, int silent); +extern CF_CFDP_PduHeader_t *CF_CFDP_MsgOutGet(const transaction_t *t, int silent); /* functions to handle LVs (length-value, cfdp spec) */ /* returns number of bytes copied, or -1 on error */ -extern int CF_CFDP_CopyDataToLv(lv_t *dest_lv, const uint8 *data, uint32 len); -extern int CF_CFDP_CopyDataFromLv(uint8 buf[CF_FILENAME_MAX_LEN], const lv_t *dest_lv); +extern int CF_CFDP_CopyDataToLv(CF_CFDP_lv_t *dest_lv, const uint8 *data, uint32 len); +extern int CF_CFDP_CopyDataFromLv(uint8 buf[CF_FILENAME_MAX_LEN], const CF_CFDP_lv_t *dest_lv); extern const int CF_max_chunks[CF_DIR_NUM][CF_NUM_CHANNELS]; extern void CF_CFDP_ArmAckTimer(transaction_t *); extern transaction_t *CF_CFDP_FindTransactionBySequenceNumber(channel_t *c, uint32 transaction_sequence_number, - cf_entity_id_t src_eid); + CF_EntityId_t src_eid); #endif /* !CF_CFDP__H */ diff --git a/fsw/src/cf_cfdp_helpers.c b/fsw/src/cf_cfdp_helpers.c index 106573d04..3df6c8e40 100644 --- a/fsw/src/cf_cfdp_helpers.c +++ b/fsw/src/cf_cfdp_helpers.c @@ -95,37 +95,37 @@ static void CF_MemcpyFromBE(uint8 *dst, const uint8 *src, int src_size, int dst_ #endif } -static int CF_GetTSNSize(const pdu_header_t *ph) +static int CF_GetTSNSize(const CF_CFDP_PduHeader_t *ph) { uint8 field; int ret; cfdp_get_uint8(field, ph->eid_tsn_lengths); - ret = FGV(field, PDU_LENGTHS_TRANSACTION_SEQUENCE) + 1; + ret = FGV(field, CF_CFDP_PduHeader_LENGTHS_TRANSACTION_SEQUENCE) + 1; - if (ret > sizeof(cf_transaction_seq_t)) + if (ret > sizeof(CF_TransactionSeq_t)) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_GET_TSN_SIZE, CFE_EVS_EventType_ERROR, "received TSN size %d too large for compiled max of %d", ret, - (uint32)sizeof(cf_transaction_seq_t)); + (uint32)sizeof(CF_TransactionSeq_t)); return -1; } return ret; } -static int CF_GetEIDSize(const pdu_header_t *ph) +static int CF_GetEIDSize(const CF_CFDP_PduHeader_t *ph) { uint8 field; int ret; cfdp_get_uint8(field, ph->eid_tsn_lengths); - ret = FGV(field, PDU_LENGTHS_ENTITY) + 1; + ret = FGV(field, CF_CFDP_PduHeader_LENGTHS_ENTITY) + 1; - if (ret > sizeof(cf_entity_id_t)) + if (ret > sizeof(CF_EntityId_t)) { CFE_EVS_SendEvent(CF_EID_ERR_PDU_GET_EID_SIZE, CFE_EVS_EventType_ERROR, - "received EID size %d too large for compiled max of %d", ret, (uint32)sizeof(cf_entity_id_t)); + "received EID size %d too large for compiled max of %d", ret, (uint32)sizeof(CF_EntityId_t)); return -1; } @@ -136,33 +136,33 @@ static int CF_GetEIDSize(const pdu_header_t *ph) /* in.msg must be valid PDU message */ int CF_GetVariableHeader(void) { - pdu_header_t *ph = &((pdu_r_msg_t *)CF_AppData.engine.in.msg)->ph; - const int eid_l = CF_GetEIDSize(ph); - const int tsn_l = CF_GetTSNSize(ph); - int offs = sizeof(*ph); - int ret = -1; + CF_CFDP_PduHeader_t *ph = &((CF_PduRecvMsg_t *)CF_AppData.engine.in.msg)->ph; + const int eid_l = CF_GetEIDSize(ph); + const int tsn_l = CF_GetTSNSize(ph); + int offs = sizeof(*ph); + int ret = -1; if ((eid_l > 0) && (tsn_l > 0)) { - CF_MemcpyFromBE((uint8 *)&CF_AppData.engine.in.src, ((uint8 *)ph) + offs, eid_l, sizeof(cf_entity_id_t)); + CF_MemcpyFromBE((uint8 *)&CF_AppData.engine.in.src, ((uint8 *)ph) + offs, eid_l, sizeof(CF_EntityId_t)); offs += eid_l; - CF_MemcpyFromBE((uint8 *)&CF_AppData.engine.in.tsn, ((uint8 *)ph) + offs, tsn_l, sizeof(cf_transaction_seq_t)); + CF_MemcpyFromBE((uint8 *)&CF_AppData.engine.in.tsn, ((uint8 *)ph) + offs, tsn_l, sizeof(CF_TransactionSeq_t)); offs += tsn_l; - CF_MemcpyFromBE((uint8 *)&CF_AppData.engine.in.dst, ((uint8 *)ph) + offs, eid_l, sizeof(cf_entity_id_t)); + CF_MemcpyFromBE((uint8 *)&CF_AppData.engine.in.dst, ((uint8 *)ph) + offs, eid_l, sizeof(CF_EntityId_t)); ret = 0; } return ret; } -void CF_SetVariableHeader(cf_entity_id_t src_eid, cf_entity_id_t dst_eid, cf_transaction_seq_t tsn) +void CF_SetVariableHeader(CF_EntityId_t src_eid, CF_EntityId_t dst_eid, CF_TransactionSeq_t tsn) { - pdu_header_t *ph = &((pdu_s_msg_t *)CF_AppData.engine.out.msg)->ph; - int offs = sizeof(*ph); - const int eid_s_l = CF_GetMemcpySize((uint8 *)&src_eid, sizeof(src_eid)); - const int eid_d_l = CF_GetMemcpySize((uint8 *)&dst_eid, sizeof(dst_eid)); - const int tsn_l = CF_GetMemcpySize((uint8 *)&tsn, sizeof(tsn)); - const int csize = ((eid_s_l > eid_d_l) ? eid_s_l : eid_d_l); + CF_CFDP_PduHeader_t *ph = &((CF_PduSendMsg_t *)CF_AppData.engine.out.msg)->ph; + int offs = sizeof(*ph); + const int eid_s_l = CF_GetMemcpySize((uint8 *)&src_eid, sizeof(src_eid)); + const int eid_d_l = CF_GetMemcpySize((uint8 *)&dst_eid, sizeof(dst_eid)); + const int tsn_l = CF_GetMemcpySize((uint8 *)&tsn, sizeof(tsn)); + const int csize = ((eid_s_l > eid_d_l) ? eid_s_l : eid_d_l); CF_MemcpyToBE(((uint8 *)ph) + offs, (uint8 *)&src_eid, sizeof(src_eid), csize); offs += csize; @@ -170,20 +170,20 @@ void CF_SetVariableHeader(cf_entity_id_t src_eid, cf_entity_id_t dst_eid, cf_tra offs += tsn_l; CF_MemcpyToBE(((uint8 *)ph) + offs, (uint8 *)&dst_eid, sizeof(dst_eid), csize); - FSV(ph->eid_tsn_lengths, PDU_LENGTHS_ENTITY, csize - 1); - FSV(ph->eid_tsn_lengths, PDU_LENGTHS_TRANSACTION_SEQUENCE, tsn_l - 1); + FSV(ph->eid_tsn_lengths, CF_CFDP_PduHeader_LENGTHS_ENTITY, csize - 1); + FSV(ph->eid_tsn_lengths, CF_CFDP_PduHeader_LENGTHS_TRANSACTION_SEQUENCE, tsn_l - 1); } -int CF_HeaderSize(const pdu_header_t *ph) +int CF_HeaderSize(const CF_CFDP_PduHeader_t *ph) { uint8 temp; /* NOTE: assume header size is correct here (packet already validated via CF_GetVariableHeader, or * set by CF for outgoing PDU */ cfdp_ldst_uint8(temp, ph->eid_tsn_lengths); - const int eid_l = 1 + FGV(temp, PDU_LENGTHS_ENTITY); - const int tsn_l = 1 + FGV(temp, PDU_LENGTHS_TRANSACTION_SEQUENCE); + const int eid_l = 1 + FGV(temp, CF_CFDP_PduHeader_LENGTHS_ENTITY); + const int tsn_l = 1 + FGV(temp, CF_CFDP_PduHeader_LENGTHS_TRANSACTION_SEQUENCE); CF_Assert((eid_l > 0) && (tsn_l > 0)); - return sizeof(pdu_header_t) + (2 * eid_l) + tsn_l; + return sizeof(CF_CFDP_PduHeader_t) + (2 * eid_l) + tsn_l; } diff --git a/fsw/src/cf_cfdp_pdu.h b/fsw/src/cf_cfdp_pdu.h index e55fbaf53..434a5c64b 100644 --- a/fsw/src/cf_cfdp_pdu.h +++ b/fsw/src/cf_cfdp_pdu.h @@ -24,8 +24,27 @@ ** *************************************************************************/ -#ifndef CF_CFDPU_PDU__H -#define CF_CFDPU_PDU__H +/** + * @file + * + * Structures defining to CFDP PDUs + * + * Note that structures and enumerations defined in this file with a CF_CFDP + * prefix are defined according to the CCSDS CFDP specifiction (727.0-B-5). + * These values must match the specification for that structure/field, they are + * not locally changeable. + * + * @note Many of the structures defined in this file are variably-sized when + * encoded for network transmission. As a result, C structures used to map + * to these structures are of limited usefulness, generally only capable + * of describing the first element(s) where offsets are fixed. A marker member + * is utilized to indicate where the fixed data ends and variable + * length data begins. At some point, the structures in this file + * should change to encode/decode functions. + */ + +#ifndef CF_CFDP_PDU_H +#define CF_CFDP_PDU_H #include "cfe.h" #include "cf_field.h" @@ -33,225 +52,376 @@ #define CF_PACK __attribute__((packed)) -/* NOTE: these structures are all needed to work with CFDP PDUs. +/* + * For now, the CFDP-encoded integers are just represented + * as normal integer types. This makes it compatible with + * the source code as written, for now. * - * These are all C representations. Marshal/unmarshal functions will be required to move them into and out of buffers */ - -/* NOTE: TLV (type-length-value) is not supported as the CF app does not support file directive PDUs. - * CF 2.0 also did not support these. LV (length-value) is supported */ -typedef struct + * Once the source code is updated, these types will be updated + * accordingly, to reflect the fact that they are not normal + * integer values. + */ +typedef uint8 CF_CFDP_uint8_t; +typedef uint16 CF_CFDP_uint16_t; +typedef uint32 CF_CFDP_uint32_t; + +/** + * @brief Structure representing base CFDP PDU header + * + * This header appears at the beginning of all CFDP PDUs, of all types. + * Note that the header is variable length, it also contains source + * and destination entity IDs, and the transaction sequence number. + * + * Defined per section 5.1 of CCSDS 727.0-B-5 + * + * @note this contains variable length data for the EID+TSN, which is _not_ included + * in this definition. As a result, the sizeof(CF_CFDP_PduHeader_t) reflects only the + * size of the fixed fields. Use CF_HeaderSize() to get the actual size of this structure. + */ +typedef struct CF_CFDP_PduHeader { - uint8 flags; - uint16 length; - uint8 eid_tsn_lengths; - - /* NOTE: the rest of the header is variable length */ -#if 0 - /* NOTE: these are variable length, from 1-8. For now, only support 32-bit */ - cf_entity_id_t source_entity_id; - cf_transaction_seq_t transaction_sequence_number; - cf_entity_id_t destination_entity_id; -#endif -} CF_PACK pdu_header_t; + CF_CFDP_uint8_t flags; /**< Flags indicating the PDU type, direction, mode, etc */ + CF_CFDP_uint16_t length; /**< Length of the entire PDU, in octets */ + CF_CFDP_uint8_t eid_tsn_lengths; /**< Lengths of the EID+TSN data (bitfields) */ + + /* variable-length data goes here - it is at least 3 additional bytes */ + +} CF_PACK CF_CFDP_PduHeader_t; + +/* + * Fields within the "flags" byte of the PDU header + */ +DECLARE_FIELD(CF_CFDP_PduHeader_FLAGS_VERSION, 3, 5) +DECLARE_FIELD(CF_CFDP_PduHeader_FLAGS_TYPE, 1, 4) +DECLARE_FIELD(CF_CFDP_PduHeader_FLAGS_DIR, 1, 3) +DECLARE_FIELD(CF_CFDP_PduHeader_FLAGS_MODE, 1, 2) +DECLARE_FIELD(CF_CFDP_PduHeader_FLAGS_CRC, 1, 1) +DECLARE_FIELD(CF_CFDP_PduHeader_FLAGS_LARGEFILE, 1, 0) + +/* + * Fields within the "eid_tsn_lengths" byte of the PDU header + */ +DECLARE_FIELD(CF_CFDP_PduHeader_LENGTHS_ENTITY, 3, 4) +DECLARE_FIELD(CF_CFDP_PduHeader_LENGTHS_TRANSACTION_SEQUENCE, 3, 0) extern int CF_GetMemcpySize(const uint8 *num, int size); extern void CF_MemcpyToBE(uint8 *dst, const uint8 *src, int src_size, int dst_size); extern int CF_GetVariableHeader(void); -extern void CF_SetVariableHeader(cf_entity_id_t src_eid, cf_entity_id_t dst_eid, cf_transaction_seq_t tsn); -extern int CF_HeaderSize(const pdu_header_t *ph); +extern void CF_SetVariableHeader(CF_EntityId_t src_eid, CF_EntityId_t dst_eid, CF_TransactionSeq_t tsn); +extern int CF_HeaderSize(const CF_CFDP_PduHeader_t *ph); -#define CF_MAX_HEADER_SIZE (sizeof(pdu_header_t) + (2 * sizeof(cf_entity_id_t)) + sizeof(cf_transaction_seq_t)) +#define CF_MAX_HEADER_SIZE (sizeof(CF_CFDP_PduHeader_t) + (2 * sizeof(CF_EntityId_t)) + sizeof(CF_TransactionSeq_t)) #define STATIC_CAST(ph, t) ((t *)(((uint8 *)ph) + CF_HeaderSize(ph))) -typedef struct +/** + * @brief Structure representing CFDP File Directive Header + * + * Defined per section 5.2 of CCSDS 727.0-B-5 + */ +typedef struct CF_CFDP_PduFileDirectiveHeader { - // pdu_header_t ph; - uint8 directive_code; -} CF_PACK pdu_file_directive_header_t; - -DECLARE_FIELD(PDU_HDR_FLAGS_VERSION, 3, 5) -DECLARE_FIELD(PDU_HDR_FLAGS_TYPE, 1, 4) -DECLARE_FIELD(PDU_HDR_FLAGS_DIR, 1, 3) -DECLARE_FIELD(PDU_HDR_FLAGS_MODE, 1, 2) -DECLARE_FIELD(PDU_HDR_FLAGS_CRC, 1, 1) -DECLARE_FIELD(PDU_HDR_FLAGS_RESERVED, 1, 0) -DECLARE_FIELD(PDU_LENGTHS_ENTITY, 3, 4) -DECLARE_FIELD(PDU_LENGTHS_TRANSACTION_SEQUENCE, 3, 0) - -/* NOTE: the longest LV seem to be filenames, so clamp their size to CF_FILENAME_MAX_LEN */ -#define LV_MAX_LEN CF_FILENAME_MAX_LEN -typedef struct + CF_CFDP_uint8_t directive_code; +} CF_PACK CF_CFDP_PduFileDirectiveHeader_t; + +/** + * @brief Structure representing CFDP LV Object format + * + * These Length + Value pairs used in several CFDP PDU types, + * typically for storage of strings such as file names. + * + * Defined per table 5-2 of CCSDS 727.0-B-5 + */ +typedef struct CF_CFDP_lv { - uint8 length; - uint8 data[CF_FILENAME_MAX_LEN]; -} CF_PACK lv_t; + CF_CFDP_uint8_t length; /**< Length of data field */ + CF_CFDP_uint8_t data[CF_FILENAME_MAX_LEN]; /**< Variable-length Data */ +} CF_PACK CF_CFDP_lv_t; -typedef struct +/** + * @brief Structure representing CFDP TLV Object format + * + * These Type + Length + Value pairs used in several CFDP PDU types, + * typically for file storage requests (section 5.4). + * + * Defined per table 5-3 of CCSDS 727.0-B-5 + */ +typedef struct CF_CFDP_tlv { - uint8 type; - uint8 length; - uint8 data[CF_FILENAME_MAX_LEN]; -} CF_PACK tlv_t; + CF_CFDP_uint8_t type; /**< Nature of data field */ + CF_CFDP_uint8_t length; /**< Length of data field */ + CF_CFDP_uint8_t data[1]; /**< Variable-length Data */ +} CF_PACK CF_CFDP_tlv_t; +/** + * @brief Values for "type" field of TLV structure + * + * Defined per section 5.4 of CCSDS 727.0-B-5 + */ typedef enum { - CLASS_1 = 0, - CLASS_2 = 1, -} cfdp_class_t; - + CF_CFDP_TLV_TYPE_FILESTORE_REQUEST = 0, + CF_CFDP_TLV_TYPE_FILESTORE_RESPONSE = 1, + CF_CFDP_TLV_TYPE_MESSAGE_TO_USER = 2, + CF_CFDP_TLV_TYPE_FAULT_HANDLER_OVERRIDE = 4, + CF_CFDP_TLV_TYPE_FLOW_LABEL = 5, + CF_CFDP_TLV_TYPE_ENTITY_ID = 6, + CF_CFDP_TLV_TYPE_INVALID_MAX = 7 +} CF_CFDP_TlvType_t; + +/** + * @brief Values for "directive_code" within CF_CFDP_PduFileDirectiveHeader_t + * + * Defined per table 5-4 of CCSDS 727.0-B-5 + */ typedef enum { - ACK_TS_INACTIVE = 0, - ACK_TS_ACTIVE = 1, - ACK_TS_TERMINATED = 2, - ACK_TS_UNRECOGNIZED = 3, - ACK_TS_INVALID = 4, -} ack_transaction_status_t; - + CF_CFDP_FileDirective_INVALID_MIN = 0, /* used to limit range */ + CF_CFDP_FileDirective_EOF = 4, + CF_CFDP_FileDirective_FIN = 5, + CF_CFDP_FileDirective_ACK = 6, + CF_CFDP_FileDirective_METADATA = 7, + CF_CFDP_FileDirective_NAK = 8, + CF_CFDP_FileDirective_PROMPT = 9, + CF_CFDP_FileDirective_KEEP_ALIVE = 12, + CF_CFDP_FileDirective_INVALID_MAX = 11, /* used to limit range */ +} CF_CFDP_FileDirective_t; + +/** + * @brief Values for CFDP file transfer class + * + * The CFDP specification prescribes two classes/modes of file + * transfer protocol operation - unacknowledged/simple or + * acknowledged/reliable. + * + * Defined per section 7.1 of CCSDS 727.0-B-5 + */ typedef enum { - FIN_COMPLETE = 0, - FIN_INCOMPLETE = 1, - FIN_DELIVERY_CODE_INVALID = 2, -} fin_delivery_code_t; + CF_CFDP_CLASS_1 = 0, /**< CFDP class 1 - Unreliable transfer */ + CF_CFDP_CLASS_2 = 1, /**< CFDP class 2 - Reliable transfer */ +} CF_CFDP_Class_t; +/** + * @brief Values for "acknowledgement transfer status" + * + * This enum is pertient to the ACK PDU type, defines the + * values for the directive field. + * + * Defined per section 5.2.4 / table 5-8 of CCSDS 727.0-B-5 + */ typedef enum { - FIN_DISCARDED = 0, - FIN_DISCARDED_FILESTORE = 1, - FIN_RETAINED = 2, - FIN_UNREPORTED = 3, - FIN_FILE_STATUS_INVALID = 4, -} fin_file_status_t; - + CF_CFDP_AckTxnStatus_UNDEFINED = 0, + CF_CFDP_AckTxnStatus_ACTIVE = 1, + CF_CFDP_AckTxnStatus_TERMINATED = 2, + CF_CFDP_AckTxnStatus_UNRECOGNIZED = 3, + CF_CFDP_AckTxnStatus_INVALID = 4, +} CF_CFDP_AckTxnStatus_t; + +/** + * @brief Values for "finished delivery code" + * + * This enum is pertient to the FIN PDU type, defines the + * values for the delivery code field. + * + * Defined per section 5.2.3 / table 5-7 of CCSDS 727.0-B-5 + */ typedef enum { - PDU_INVALID_MIN = 0, /* used to limit range */ - PDU_EOF = 4, - PDU_FIN = 5, - PDU_ACK = 6, - PDU_METADATA = 7, - PDU_NAK = 8, - PDU_PROMPT = 9, - PDU_KEEP_ALIVE = 10, - PDU_INVALID_MAX = 11, /* used to limit range */ -} file_directive_t; + CF_CFDP_FinDeliveryCode_COMPLETE = 0, + CF_CFDP_FinDeliveryCode_INCOMPLETE = 1, + CF_CFDP_FinDeliveryCode_INVALID = 2, +} CF_CFDP_FinDeliveryCode_t; +/** + * @brief Values for "finished file status" + * + * This enum is pertient to the FIN PDU type, defines the + * values for the file status field. + * + * Defined per section 5.2.3 / table 5-7 of CCSDS 727.0-B-5 + */ typedef enum { - CC_NO_ERROR = 0, - CC_POS_ACK_LIMIT_REACHED = 1, - CC_KEEP_ALIVE_LIMIT_REACHED = 2, - CC_INVALID_TRANSMISSION_MODE = 3, - CC_FILESTORE_REJECTION = 4, - CC_FILE_CHECKSUM_FAILURE = 5, - CC_FILE_SIZE_ERROR = 6, - CC_NAK_LIMIT_REACHED = 7, - CC_INACTIVITY_DETECTED = 8, - CC_INVALID_FILE_STRUCTURE = 9, - CC_CHECK_LIMIT_REACHED = 10, - CC_SUSPEND_REQUEST_RECEIVED = 14, - CC_CANCEL_REQUEST_RECEIVED = 15, -} condition_code_t; - -typedef struct + CF_CFDP_FinFileStatus_DISCARDED = 0, + CF_CFDP_FinFileStatus_DISCARDED_FILESTORE = 1, + CF_CFDP_FinFileStatus_RETAINED = 2, + CF_CFDP_FinFileStatus_UNREPORTED = 3, + CF_CFDP_FinFileStatus_INVALID = 4, +} CF_CFDP_FinFileStatus_t; + +/** + * @brief Values for "condition code" + * + * This enum defines the values for the condition code field + * for the PDU types which have this field (EOF, FIN, ACK) + * + * Defined per table 5-5 of CCSDS 727.0-B-5 + */ +typedef enum { - pdu_file_directive_header_t fdh; - uint8 cc; - uint32 crc; - uint32 size; - tlv_t fault_location[1]; /* may be omitted when sent or received */ -} CF_PACK pdu_eof_t; - -DECLARE_FIELD(PDU_FLAGS_CC, 4, 4) - -typedef struct + CF_CFDP_ConditionCode_NO_ERROR = 0, + CF_CFDP_ConditionCode_POS_ACK_LIMIT_REACHED = 1, + CF_CFDP_ConditionCode_KEEP_ALIVE_LIMIT_REACHED = 2, + CF_CFDP_ConditionCode_INVALID_TRANSMISSION_MODE = 3, + CF_CFDP_ConditionCode_FILESTORE_REJECTION = 4, + CF_CFDP_ConditionCode_FILE_CHECKSUM_FAILURE = 5, + CF_CFDP_ConditionCode_FILE_SIZE_ERROR = 6, + CF_CFDP_ConditionCode_NAK_LIMIT_REACHED = 7, + CF_CFDP_ConditionCode_INACTIVITY_DETECTED = 8, + CF_CFDP_ConditionCode_INVALID_FILE_STRUCTURE = 9, + CF_CFDP_ConditionCode_CHECK_LIMIT_REACHED = 10, + CF_CFDP_ConditionCode_UNSUPPORTED_CHECKSUM_TYPE = 11, + CF_CFDP_ConditionCode_SUSPEND_REQUEST_RECEIVED = 14, + CF_CFDP_ConditionCode_CANCEL_REQUEST_RECEIVED = 15, +} CF_CFDP_ConditionCode_t; + +/** + * @brief Structure representing CFDP End of file PDU + * + * Defined per section 5.2.2 / table 5-6 of CCSDS 727.0-B-5 + */ +typedef struct CF_CFDP_PduEof { - pdu_file_directive_header_t fdh; - uint8 flags; - tlv_t fault_location[1]; -} CF_PACK pdu_fin_t; - -DECLARE_FIELD(PDU_FIN_FLAGS_END_SYSTEM_STATUS, 1, 3) -DECLARE_FIELD(PDU_FIN_FLAGS_DELIVERY_CODE, 1, 2) -DECLARE_FIELD(PDU_FIN_FLAGS_FILE_STATUS, 2, 0) - -typedef struct + CF_CFDP_PduFileDirectiveHeader_t fdh; + CF_CFDP_uint8_t cc; + CF_CFDP_uint32_t crc; + CF_CFDP_uint32_t size; + + /* variable length member is of TLV type, placeholder declared as uint8 */ + /* may be omitted entirely in some cases */ + CF_CFDP_uint8_t fault_location[1]; +} CF_PACK CF_CFDP_PduEof_t; + +/* + * Position of the condition code value within the CC field + */ +DECLARE_FIELD(CF_CFDP_PduEof_FLAGS_CC, 4, 4) + +/** + * @brief Structure representing CFDP Finished PDU + * + * Defined per section 5.2.3 / table 5-7 of CCSDS 727.0-B-5 + */ +typedef struct CF_CFDP_PduFin { - pdu_file_directive_header_t fdh; - uint8 directive_and_subtype_code; - uint8 cc_and_transaction_status; -} CF_PACK pdu_ack_t; - -DECLARE_FIELD(PDU_ACK_DIR_CODE, 4, 4) -DECLARE_FIELD(PDU_ACK_DIR_SUBTYPE_CODE, 4, 0) -DECLARE_FIELD(PDU_ACK_CC, 4, 4) -DECLARE_FIELD(PDU_ACK_TRANSACTION_STATUS, 2, 0) - -typedef struct segment_request_t + CF_CFDP_PduFileDirectiveHeader_t fdh; + CF_CFDP_uint8_t flags; + + /* variable length member is of TLV type, placeholder declared as uint8 */ + CF_CFDP_uint8_t fault_location[1]; +} CF_PACK CF_CFDP_PduFin_t; + +/* + * Position of the sub-field values within the flags field + */ +DECLARE_FIELD(CF_CFDP_PduFin_FLAGS_CC, 4, 4) +DECLARE_FIELD(CF_CFDP_PduFin_FLAGS_END_SYSTEM_STATUS, 1, 3) +DECLARE_FIELD(CF_CFDP_PduFin_FLAGS_DELIVERY_CODE, 1, 2) +DECLARE_FIELD(CF_CFDP_PduFin_FLAGS_FILE_STATUS, 2, 0) + +/** + * @brief Structure representing CFDP Acknowledge PDU + * + * Defined per section 5.2.4 / table 5-8 of CCSDS 727.0-B-5 + */ +typedef struct CF_CFDP_PduAck { - uint32 offset_start; - uint32 offset_end; -} segment_request_t; + CF_CFDP_PduFileDirectiveHeader_t fdh; + CF_CFDP_uint8_t directive_and_subtype_code; + CF_CFDP_uint8_t cc_and_transaction_status; +} CF_PACK CF_CFDP_PduAck_t; + +/* + * Position of the sub-field values within the directive_and_subtype_code + * and cc_and_transaction_status fields within the ACK PDU. + */ +DECLARE_FIELD(CF_CFDP_PduAck_DIR_CODE, 4, 4) +DECLARE_FIELD(CF_CFDP_PduAck_DIR_SUBTYPE_CODE, 4, 0) +DECLARE_FIELD(CF_CFDP_PduAck_CC, 4, 4) +DECLARE_FIELD(CF_CFDP_PduAck_TRANSACTION_STATUS, 2, 0) + +/** + * @brief Structure representing CFDP Segment Request + * + * Defined per section 5.2.6 / table 5-11 of CCSDS 727.0-B-5 + */ +typedef struct CF_CFDP_SegmentRequest +{ + CF_CFDP_uint32_t offset_start; + CF_CFDP_uint32_t offset_end; +} CF_CFDP_SegmentRequest_t; -typedef struct +/** + * @brief Structure representing CFDP Non-Acknowledge PDU + * + * Defined per section 5.2.6 / table 5-10 of CCSDS 727.0-B-5 + */ +typedef struct CF_CFDP_PduNak { - pdu_file_directive_header_t fdh; - uint32 scope_start; - uint32 scope_end; + CF_CFDP_PduFileDirectiveHeader_t fdh; + CF_CFDP_uint32_t scope_start; + CF_CFDP_uint32_t scope_end; - /* NOTE: if offset_start and offset_end == 0, then the nak is the metadata pdu */ - segment_request_t segment_requests[1]; -} CF_PACK pdu_nak_t; + /* variable length member is of SegmentRequest type */ + CF_CFDP_SegmentRequest_t segment_requests[1]; +} CF_PACK CF_CFDP_PduNak_t; -typedef struct +/** + * @brief Structure representing CFDP Metadata PDU + * + * Defined per section 5.2.5 / table 5-9 of CCSDS 727.0-B-5 + */ +typedef struct CF_CFDP_PduMd { - pdu_file_directive_header_t fdh; - uint8 segmentation_control; - uint32 size; - /* use a byte array for the two LVs because their size is variable */ - uint8 filename_lvs[1]; /* is it ok to use 0-length array? it works because pdu_md_t is contained in larger union */ - /* SDS no md tlv supported? */ -} CF_PACK pdu_md_t; - -typedef struct + CF_CFDP_PduFileDirectiveHeader_t fdh; + CF_CFDP_uint8_t segmentation_control; + CF_CFDP_uint32_t size; + + /* variable length member is of LV type, placeholder declared as uint8 */ + CF_CFDP_uint8_t filename_lvs[1]; +} CF_PACK CF_CFDP_PduMd_t; + +/* + * Position of the sub-field values within the directive_and_subtype_code + * and cc_and_transaction_status fields within the ACK PDU. + */ +DECLARE_FIELD(CF_CFDP_PduMd_CLOSURE_REQUESTED, 1, 7) +DECLARE_FIELD(CF_CFDP_PduMd_CHECKSUM_TYPE, 4, 0) + +typedef struct CF_CFDP_PduFileDataHeader { - // pdu_header_t ph; - uint32 offset; -} CF_PACK pdu_file_data_header_t; + CF_CFDP_uint32_t offset; +} CF_PACK CF_CFDP_PduFileDataHeader_t; -typedef struct +typedef struct CF_CFDP_PduFileDataContent { - uint8 data[CF_MAX_PDU_SIZE - sizeof(pdu_file_data_header_t) - CF_MAX_HEADER_SIZE]; -} CF_PACK pdu_fd_data_t; + uint8 data[CF_MAX_PDU_SIZE - sizeof(CF_CFDP_PduFileDataHeader_t) - CF_MAX_HEADER_SIZE]; +} CF_PACK CF_CFDP_PduFileDataContent_t; -typedef struct +typedef struct CF_CFDP_PduFd { - pdu_file_data_header_t fdh; - pdu_fd_data_t fdd; -} CF_PACK pdu_fd_t; + CF_CFDP_PduFileDataHeader_t fdh; + CF_CFDP_PduFileDataContent_t fdd; +} CF_PACK CF_CFDP_PduFd_t; -/* NOTE: the use of pdu_header_t below is correct, but the pdu_r_msg_t and pdu_s_msg_t +/* NOTE: the use of CF_CFDP_PduHeader_t below is correct, but the CF_PduRecvMsg_t and CF_PduSendMsg_t * structures are both longer than these definitions. They are always backed by a buffer * of size CF_MAX_PDU_SIZE */ -typedef struct +typedef struct CF_PduRecvMsg { CFE_MSG_CommandHeader_t hdr; - pdu_header_t ph; -} CF_PACK pdu_r_msg_t; + CF_CFDP_PduHeader_t ph; +} CF_PACK CF_PduRecvMsg_t; -typedef struct +typedef struct CF_PduSendMsg { CFE_MSG_TelemetryHeader_t hdr; - pdu_header_t ph; -} CF_PACK pdu_s_msg_t; - -DECLARE_FIELD(PDU_MD_SEGMENTATION_CONTROL, 1, 7) + CF_CFDP_PduHeader_t ph; +} CF_PACK CF_PduSendMsg_t; /* portable static CF_Assert that size of CF_NAK_MAX_SEGMENTS is small enough to fit in CF_MAX_PDU_SIZE */ typedef char - p__LINE__[((CF_NAK_MAX_SEGMENTS * 8) + sizeof(pdu_nak_t) + CF_MAX_HEADER_SIZE) <= CF_MAX_PDU_SIZE ? 1 : -1]; - -#define ENTITY_ID_TLV_TYPE 6 + p__LINE__[((CF_NAK_MAX_SEGMENTS * 8) + sizeof(CF_CFDP_PduNak_t) + CF_MAX_HEADER_SIZE) <= CF_MAX_PDU_SIZE ? 1 : -1]; -#endif /* !CF_CFDPU_PDU__H */ +#endif /* !CF_CFDP_PDU_H */ diff --git a/fsw/src/cf_cfdp_r.c b/fsw/src/cf_cfdp_r.c index c5f08d2da..3a537cc65 100644 --- a/fsw/src/cf_cfdp_r.c +++ b/fsw/src/cf_cfdp_r.c @@ -41,9 +41,9 @@ typedef struct { - transaction_t *t; - pdu_header_t *ph; - uint32 gap_counter; + transaction_t *t; + CF_CFDP_PduHeader_t *ph; + uint32 gap_counter; } gap_compute_args_t; /************************************************************************/ @@ -53,7 +53,7 @@ typedef struct ** t must not be NULL. ** *************************************************************************/ -static void CF_CFDP_R2_SetCc(transaction_t *t, condition_code_t cc) +static void CF_CFDP_R2_SetCc(transaction_t *t, CF_CFDP_ConditionCode_t cc) { t->history->cc = cc; t->flags.rx.send_fin = 1; @@ -88,8 +88,9 @@ static inline void CF_CFDP_R1_Reset(transaction_t *t) *************************************************************************/ static void CF_CFDP_R2_Reset(transaction_t *t) { - if ((t->state_data.r.sub_state == RECV_WAIT_FOR_FIN_ACK) || (t->state_data.r.r2.eof_cc != CC_NO_ERROR) || - (t->history->cc != CC_NO_ERROR) || t->flags.com.canceled) + if ((t->state_data.r.sub_state == RECV_WAIT_FOR_FIN_ACK) || + (t->state_data.r.r2.eof_cc != CF_CFDP_ConditionCode_NO_ERROR) || + (t->history->cc != CF_CFDP_ConditionCode_NO_ERROR) || t->flags.com.canceled) { CF_CFDP_R1_Reset(t); /* it's done */ } @@ -150,7 +151,7 @@ static void CF_CFDP_R2_Complete(transaction_t *t, int ok_to_send_nak) /* checking if r2 is complete. check nak list, and send NAK if appropriate */ /* if all data is present, then there will be no gaps in the chunk */ - if (t->history->cc != CC_NO_ERROR) + if (t->history->cc != CF_CFDP_ConditionCode_NO_ERROR) { goto err_out; /* nothing to do here if error cc is set */ } @@ -185,9 +186,9 @@ static void CF_CFDP_R2_Complete(transaction_t *t, int ok_to_send_nak) (t->state == CFDP_R2), t->history->src_eid, t->history->seq_num); send_fin = 1; ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.nak_limit; - t->history->cc = - CC_NAK_LIMIT_REACHED; /* don't use CF_CFDP_R2_SetCc because many places in this function set send_fin */ - t->state_data.r.r2.counter.nak = 0; /* reset for fin/ack */ + t->history->cc = CF_CFDP_ConditionCode_NAK_LIMIT_REACHED; /* don't use CF_CFDP_R2_SetCc because many places + in this function set send_fin */ + t->state_data.r.r2.counter.nak = 0; /* reset for fin/ack */ } else { @@ -220,8 +221,8 @@ err_out:; *************************************************************************/ static int CF_CFDP_R_ProcessFd(transaction_t *t, CFE_MSG_Size_t *bytes_received) { - pdu_header_t *ph = &((pdu_r_msg_t *)CF_AppData.engine.in.msg)->ph; - *bytes_received = CF_AppData.engine.in.bytes_received; + CF_CFDP_PduHeader_t *ph = &((CF_PduRecvMsg_t *)CF_AppData.engine.in.msg)->ph; + *bytes_received = CF_AppData.engine.in.bytes_received; int ret = -1; @@ -229,17 +230,17 @@ static int CF_CFDP_R_ProcessFd(transaction_t *t, CFE_MSG_Size_t *bytes_received) *bytes_received -= CF_HeaderSize(ph); /* if crc field is present in the pdu header, subtract that from bytes_received */ - if (FGV(ph->flags, PDU_HDR_FLAGS_CRC)) + if (FGV(ph->flags, CF_CFDP_PduHeader_FLAGS_CRC)) { *bytes_received -= 4; } /* bytes_received now contains the number of bytes of file data in the pdu */ - if (*bytes_received > sizeof(pdu_file_data_header_t)) + if (*bytes_received > sizeof(CF_CFDP_PduFileDataHeader_t)) { - pdu_fd_t *fd = STATIC_CAST(ph, pdu_fd_t); - int fret; - uint32 offset; + CF_CFDP_PduFd_t *fd = STATIC_CAST(ph, CF_CFDP_PduFd_t); + int fret; + uint32 offset; cfdp_ldst_uint32(offset, fd->fdh.offset); if (t->state_data.r.cached_pos != offset) { @@ -249,13 +250,13 @@ static int CF_CFDP_R_ProcessFd(transaction_t *t, CFE_MSG_Size_t *bytes_received) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_SEEK_FD, CFE_EVS_EventType_ERROR, "CF R%d(%u:%u): failed to seek offset %u, got 0x%08x", (t->state == CFDP_R2), t->history->src_eid, t->history->seq_num, offset, fret); - t->history->cc = CC_FILE_SIZE_ERROR; + t->history->cc = CF_CFDP_ConditionCode_FILE_SIZE_ERROR; ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; goto err_out; /* connection will reset in caller */ } } - *bytes_received -= sizeof(pdu_file_data_header_t); + *bytes_received -= sizeof(CF_CFDP_PduFileDataHeader_t); fret = CF_WrappedWrite(t->fd, fd->fdd.data, *bytes_received); if (fret != *bytes_received) { @@ -263,7 +264,7 @@ static int CF_CFDP_R_ProcessFd(transaction_t *t, CFE_MSG_Size_t *bytes_received) "CF R%d(%u:%u): OS_write returned 0x%08x, got 0x%08x", (t->state == CFDP_R2), t->history->src_eid, t->history->seq_num, offset, fret); ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_write; - t->history->cc = CC_FILESTORE_REJECTION; + t->history->cc = CF_CFDP_ConditionCode_FILESTORE_REJECTION; goto err_out; /* connection will reset in caller */ } @@ -297,7 +298,7 @@ static int CF_CFDP_R_ProcessFd(transaction_t *t, CFE_MSG_Size_t *bytes_received) ** \endreturns ** *************************************************************************/ -static int CF_CFDP_R_SubstateRecvEof(transaction_t *t, const pdu_header_t *ph) +static int CF_CFDP_R_SubstateRecvEof(transaction_t *t, const CF_CFDP_PduHeader_t *ph) { int ret = R_EOF_SUCCESS; @@ -305,7 +306,7 @@ static int CF_CFDP_R_SubstateRecvEof(transaction_t *t, const pdu_header_t *ph) { uint32 size; - cfdp_ldst_uint32(size, STATIC_CAST(ph, pdu_eof_t)->size); + cfdp_ldst_uint32(size, STATIC_CAST(ph, CF_CFDP_PduEof_t)->size); /* only check size if MD received, otherwise it's still OK */ if (t->flags.rx.md_recv && (size != t->fsize)) { @@ -344,12 +345,12 @@ static int CF_CFDP_R_SubstateRecvEof(transaction_t *t, const pdu_header_t *ph) ** \endreturns ** *************************************************************************/ -static void CF_CFDP_R1_SubstateRecvEof(transaction_t *t, const pdu_header_t *ph) +static void CF_CFDP_R1_SubstateRecvEof(transaction_t *t, const CF_CFDP_PduHeader_t *ph) { int ret = CF_CFDP_R_SubstateRecvEof(t, ph); uint32 crc; - cfdp_ldst_uint32(crc, STATIC_CAST(ph, pdu_eof_t)->crc); + cfdp_ldst_uint32(crc, STATIC_CAST(ph, CF_CFDP_PduEof_t)->crc); if ((ret == R_EOF_SUCCESS) && !CF_CFDP_R_CheckCrc(t, crc)) { /* successfully processed the file */ @@ -377,7 +378,7 @@ static void CF_CFDP_R1_SubstateRecvEof(transaction_t *t, const pdu_header_t *ph) ** \endreturns ** *************************************************************************/ -static void CF_CFDP_R2_SubstateRecvEof(transaction_t *t, const pdu_header_t *ph) +static void CF_CFDP_R2_SubstateRecvEof(transaction_t *t, const CF_CFDP_PduHeader_t *ph) { if (!t->flags.rx.eof_recv) { @@ -386,19 +387,19 @@ static void CF_CFDP_R2_SubstateRecvEof(transaction_t *t, const pdu_header_t *ph) /* did receiving eof succeed? */ if (ret == R_EOF_SUCCESS) { - pdu_eof_t *eof = STATIC_CAST(ph, pdu_eof_t); - t->flags.rx.eof_recv = 1; + CF_CFDP_PduEof_t *eof = STATIC_CAST(ph, CF_CFDP_PduEof_t); + t->flags.rx.eof_recv = 1; /* need to remember the eof crc for later */ cfdp_ldst_uint32(t->state_data.r.r2.eof_crc, eof->crc); cfdp_ldst_uint32(t->state_data.r.r2.eof_size, eof->size); /* always ack the EOF, even if we're not done */ - t->state_data.r.r2.eof_cc = FGV(eof->cc, PDU_FLAGS_CC); + t->state_data.r.r2.eof_cc = FGV(eof->cc, CF_CFDP_PduEof_FLAGS_CC); t->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 == CC_NO_ERROR) + if (t->state_data.r.r2.eof_cc == CF_CFDP_ConditionCode_NO_ERROR) { CF_CFDP_R2_Complete(t, 1); /* CF_CFDP_R2_Complete() will change state */ } @@ -412,7 +413,7 @@ static void CF_CFDP_R2_SubstateRecvEof(transaction_t *t, const pdu_header_t *ph) /* bad eof sent? */ if (ret == R_EOF_FSIZE_MISMATCH) { - CF_CFDP_R2_SetCc(t, CC_FILE_SIZE_ERROR); + CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_FILE_SIZE_ERROR); } else { @@ -433,7 +434,7 @@ static void CF_CFDP_R2_SubstateRecvEof(transaction_t *t, const pdu_header_t *ph) ** t must not be NULL. ph must not be NULL. ** *************************************************************************/ -static void CF_CFDP_R1_SubstateRecvFileData(transaction_t *t, const pdu_header_t *ph) +static void CF_CFDP_R1_SubstateRecvFileData(transaction_t *t, const CF_CFDP_PduHeader_t *ph) { CFE_MSG_Size_t bytes_received; /* initialized in CF_CFDP_R_ProcessFd() */ @@ -444,7 +445,7 @@ static void CF_CFDP_R1_SubstateRecvFileData(transaction_t *t, const pdu_header_t } /* class 1 digests crc */ - CF_CRC_Digest(&t->crc, STATIC_CAST(ph, pdu_fd_t)->fdd.data, (uint32)bytes_received); + CF_CRC_Digest(&t->crc, STATIC_CAST(ph, CF_CFDP_PduFd_t)->fdd.data, (uint32)bytes_received); return; @@ -466,7 +467,7 @@ static void CF_CFDP_R1_SubstateRecvFileData(transaction_t *t, const pdu_header_t ** t must not be NULL. ph must not be NULL. ** *************************************************************************/ -static void CF_CFDP_R2_SubstateRecvFileData(transaction_t *t, const pdu_header_t *ph) +static void CF_CFDP_R2_SubstateRecvFileData(transaction_t *t, const CF_CFDP_PduHeader_t *ph) { CFE_MSG_Size_t bytes_received; /* initialized in CF_CFDP_R_ProcessFd() */ uint32 offset; @@ -477,7 +478,7 @@ static void CF_CFDP_R2_SubstateRecvFileData(transaction_t *t, const pdu_header_t goto err_out; } - cfdp_ldst_uint32(offset, STATIC_CAST(ph, pdu_fd_t)->fdh.offset); + cfdp_ldst_uint32(offset, STATIC_CAST(ph, CF_CFDP_PduFd_t)->fdh.offset); /* class 2 does crc at FIN, but track gaps */ CF_Chunks_Add(&t->chunks->chunks, offset, (uint32)bytes_received); @@ -516,7 +517,7 @@ static void CF_CFDP_R2_SubstateRecvFileData(transaction_t *t, const pdu_header_t static void CF_CFDP_R2_GapCompute(const chunks_t *chunks, const chunk_t *c, void *opaque) { gap_compute_args_t *args = (gap_compute_args_t *)opaque; - pdu_nak_t *nak = STATIC_CAST(args->ph, pdu_nak_t); + CF_CFDP_PduNak_t *nak = STATIC_CAST(args->ph, CF_CFDP_PduNak_t); CF_Assert(c->size > 0); @@ -549,10 +550,10 @@ static void CF_CFDP_R2_GapCompute(const chunks_t *chunks, const chunk_t *c, void *************************************************************************/ static int CF_CFDP_R_SubstateSendNak(transaction_t *t) { - pdu_header_t *ph = CF_CFDP_ConstructPduHeader(t, PDU_NAK, t->history->peer_eid, CF_AppData.config_table->local_eid, - 1, t->history->seq_num, 1); - pdu_nak_t *nak = STATIC_CAST(ph, pdu_nak_t); - cfdp_send_ret_t sret; + CF_CFDP_PduHeader_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_PduNak_t *nak = STATIC_CAST(ph, CF_CFDP_PduNak_t); + cfdp_send_ret_t sret; int ret = -1; @@ -658,7 +659,7 @@ void CF_CFDP_R_Init(transaction_t *t) t->fd = OS_OBJECT_ID_UNDEFINED; /* just in case */ if (t->state == CFDP_R2) { - CF_CFDP_R2_SetCc(t, CC_FILESTORE_REJECTION); + CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_FILESTORE_REJECTION); } else { @@ -719,7 +720,7 @@ static int CF_CFDP_R2_CalcCrcChunk(transaction_t *t) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_SEEK_CRC, CFE_EVS_EventType_ERROR, "CF R%d(%u:%u): failed to seek offset %u, got 0x%08x", (t->state == CFDP_R2), t->history->src_eid, t->history->seq_num, RXC, fret); - t->history->cc = CC_FILE_SIZE_ERROR; /* should be ok to use this one */ + t->history->cc = CF_CFDP_ConditionCode_FILE_SIZE_ERROR; /* should be ok to use this one */ ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_seek; goto err_out; } @@ -731,7 +732,7 @@ static int CF_CFDP_R2_CalcCrcChunk(transaction_t *t) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_READ, CFE_EVS_EventType_ERROR, "CF R%d(%u:%u): failed to read file expected %u, got 0x%08x", (t->state == CFDP_R2), t->history->src_eid, t->history->seq_num, read_size, fret); - t->history->cc = CC_FILE_SIZE_ERROR; /* should be ok to use this one */ + t->history->cc = CF_CFDP_ConditionCode_FILE_SIZE_ERROR; /* should be ok to use this one */ ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_read; goto err_out; } @@ -750,12 +751,12 @@ static int CF_CFDP_R2_CalcCrcChunk(transaction_t *t) t->keep = 1; /* save the file */ /* set fin pdu status */ - t->state_data.r.r2.dc = FIN_COMPLETE; - t->state_data.r.r2.fs = FIN_RETAINED; + t->state_data.r.r2.dc = CF_CFDP_FinDeliveryCode_COMPLETE; + t->state_data.r.r2.fs = CF_CFDP_FinFileStatus_RETAINED; } else { - CF_CFDP_R2_SetCc(t, CC_FILE_CHECKSUM_FAILURE); + CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_FILE_CHECKSUM_FAILURE); } t->flags.com.crc_calc = 1; @@ -783,7 +784,7 @@ static int CF_CFDP_R2_SubstateSendFin(transaction_t *t) cfdp_send_ret_t sret; int ret = -1; - if (t->history->cc == CC_NO_ERROR && !t->flags.com.crc_calc) + if (t->history->cc == CF_CFDP_ConditionCode_NO_ERROR && !t->flags.com.crc_calc) { /* no error, and haven't checked crc -- so start checking it */ if (CF_CFDP_R2_CalcCrcChunk(t)) @@ -818,7 +819,7 @@ static int CF_CFDP_R2_SubstateSendFin(transaction_t *t) ** t must not be NULL. ph must not be NULL. ** *************************************************************************/ -static void CF_CFDP_R2_Recv_fin_ack(transaction_t *t, const pdu_header_t *ph) +static void CF_CFDP_R2_Recv_fin_ack(transaction_t *t, const CF_CFDP_PduHeader_t *ph) { if (!CF_CFDP_RecvAck()) { @@ -847,7 +848,7 @@ static void CF_CFDP_R2_Recv_fin_ack(transaction_t *t, const pdu_header_t *ph) ** t must not be NULL. ph must not be NULL. ** *************************************************************************/ -static void CF_CFDP_R2_RecvMd(transaction_t *t, const pdu_header_t *ph) +static void CF_CFDP_R2_RecvMd(transaction_t *t, const CF_CFDP_PduHeader_t *ph) { /* it isn't an error to get another MD pdu, right? */ if (!t->flags.rx.md_recv) @@ -875,7 +876,7 @@ static void CF_CFDP_R2_RecvMd(transaction_t *t, const pdu_header_t *ph) "CF R%d(%u:%u): eof/md size mismatch md: %d, eof: %d", (t->state == CFDP_R2), t->history->src_eid, t->history->seq_num, t->fsize, t->state_data.r.r2.eof_size); ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_size_mismatch; - CF_CFDP_R2_SetCc(t, CC_FILE_SIZE_ERROR); + CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_FILE_SIZE_ERROR); goto err_out; } } @@ -891,7 +892,7 @@ static void CF_CFDP_R2_RecvMd(transaction_t *t, const pdu_header_t *ph) "CF R%d(%u:%u): failed to rename file in R2, error=0x%08x", (t->state == CFDP_R2), t->history->src_eid, t->history->seq_num, status); t->fd = OS_OBJECT_ID_UNDEFINED; - CF_CFDP_R2_SetCc(t, CC_FILESTORE_REJECTION); + CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_FILESTORE_REJECTION); ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_rename; goto err_out; } @@ -904,7 +905,7 @@ static void CF_CFDP_R2_RecvMd(transaction_t *t, const pdu_header_t *ph) CFE_EVS_SendEvent(CF_EID_ERR_CFDP_R_OPEN, CFE_EVS_EventType_ERROR, "CF R%d(%u:%u): failed to open renamed file in R2, error=0x%08x", (t->state == CFDP_R2), t->history->src_eid, t->history->seq_num, ret); - CF_CFDP_R2_SetCc(t, CC_FILESTORE_REJECTION); + CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_FILESTORE_REJECTION); ++CF_AppData.hk.channel_hk[t->chan_num].counters.fault.file_open; t->fd = OS_OBJECT_ID_UNDEFINED; /* just in case */ goto err_out; @@ -939,21 +940,21 @@ err_out:; ** t must not be NULL. fns must not be NULL. ** *************************************************************************/ -static void CF_CFDP_R_DispatchRecv(transaction_t *t, - void (*const fns[RECV_NUM_STATES][PDU_INVALID_MAX])(transaction_t *, - const pdu_header_t *), - void (*const fd_fn)(transaction_t *, const pdu_header_t *)) +static void CF_CFDP_R_DispatchRecv( + transaction_t *t, + void (*const fns[RECV_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])(transaction_t *, const CF_CFDP_PduHeader_t *), + void (*const fd_fn)(transaction_t *, const CF_CFDP_PduHeader_t *)) { CF_Assert(t->state_data.r.sub_state < RECV_NUM_STATES); CF_Assert(CF_AppData.engine.in.msg); - pdu_header_t *ph = &((pdu_r_msg_t *)CF_AppData.engine.in.msg)->ph; + CF_CFDP_PduHeader_t *ph = &((CF_PduRecvMsg_t *)CF_AppData.engine.in.msg)->ph; /* the 2d jump table is only used with file directive pdu */ - if (!FGV(ph->flags, PDU_HDR_FLAGS_TYPE)) + if (!FGV(ph->flags, CF_CFDP_PduHeader_FLAGS_TYPE)) { - pdu_file_directive_header_t *fdh = STATIC_CAST(ph, pdu_file_directive_header_t); - if (fdh->directive_code < PDU_INVALID_MAX) + CF_CFDP_PduFileDirectiveHeader_t *fdh = STATIC_CAST(ph, CF_CFDP_PduFileDirectiveHeader_t); + if (fdh->directive_code < CF_CFDP_FileDirective_INVALID_MAX) { if (fns[t->state_data.r.sub_state][fdh->directive_code]) { @@ -971,7 +972,7 @@ static void CF_CFDP_R_DispatchRecv(transaction_t *t, } else { - if (t->history->cc == CC_NO_ERROR) + if (t->history->cc == CF_CFDP_ConditionCode_NO_ERROR) { fd_fn(t, ph); /* if history shows error, drop filedata pdu on the floor */ } @@ -991,7 +992,8 @@ static void CF_CFDP_R_DispatchRecv(transaction_t *t, *************************************************************************/ void CF_CFDP_R1_Recv(transaction_t *t) { - static void (*const substate_fns[RECV_NUM_STATES][PDU_INVALID_MAX])(transaction_t * t, const pdu_header_t *) = { + static void (*const substate_fns[RECV_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])( + transaction_t * t, const CF_CFDP_PduHeader_t *) = { {NULL, NULL, NULL, NULL, CF_CFDP_R1_SubstateRecvEof, NULL, NULL, NULL, NULL, NULL, NULL}, /* RECV_FILEDATA */ {NULL, NULL, NULL, NULL, CF_CFDP_R1_SubstateRecvEof, NULL, NULL, NULL, NULL, NULL, NULL}, /* RECV_EOF */ {NULL, NULL, NULL, NULL, CF_CFDP_R1_SubstateRecvEof, NULL, NULL, NULL, NULL, NULL, @@ -1010,7 +1012,8 @@ void CF_CFDP_R1_Recv(transaction_t *t) *************************************************************************/ void CF_CFDP_R2_Recv(transaction_t *t) { - static void (*const substate_fns[RECV_NUM_STATES][PDU_INVALID_MAX])(transaction_t * t, const pdu_header_t *) = { + static void (*const substate_fns[RECV_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])( + transaction_t * t, const CF_CFDP_PduHeader_t *) = { {NULL, NULL, NULL, NULL, CF_CFDP_R2_SubstateRecvEof, NULL, NULL, CF_CFDP_R2_RecvMd, NULL, NULL, NULL}, /* RECV_FILEDATA */ {NULL, NULL, NULL, NULL, CF_CFDP_R2_SubstateRecvEof, NULL, NULL, CF_CFDP_R2_RecvMd, NULL, NULL, @@ -1085,7 +1088,7 @@ void CF_CFDP_R_Tick(transaction_t *t, int *cont /* unused */) { CF_CFDP_R_SendInactivityEvent(t); - CF_CFDP_R2_SetCc(t, CC_INACTIVITY_DETECTED); + CF_CFDP_R2_SetCc(t, CF_CFDP_ConditionCode_INACTIVITY_DETECTED); t->flags.rx.inactivity_fired = 1; } else @@ -1097,8 +1100,9 @@ void CF_CFDP_R_Tick(transaction_t *t, int *cont /* unused */) /* rx maintenance: possibly process send_eof_ack, send_nak or send_fin */ if (t->flags.rx.send_ack) { - cfdp_send_ret_t sret = CF_CFDP_SendAck(t, ACK_TS_ACTIVE, PDU_EOF, t->state_data.r.r2.eof_cc, - t->history->peer_eid, t->history->seq_num); + cfdp_send_ret_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_Assert(sret != CF_SEND_ERROR); /* if CF_SEND_SUCCESS, then move on in the state machine. CF_CFDP_SendAck does not return CF_SEND_ERROR */ diff --git a/fsw/src/cf_cfdp_s.c b/fsw/src/cf_cfdp_s.c index d7ee68c3a..729beca39 100644 --- a/fsw/src/cf_cfdp_s.c +++ b/fsw/src/cf_cfdp_s.c @@ -135,10 +135,10 @@ static void CF_CFDP_S2_SubstateSendEof(transaction_t *t) /* if bytes_to_read is 0, then read max possible */ static int32 CF_CFDP_S_SendFileData(transaction_t *t, uint32 foffs, uint32 bytes_to_read, uint8 calc_crc) { - int32 ret = -1; - pdu_header_t *ph = CF_CFDP_ConstructPduHeader(t, 0, CF_AppData.config_table->local_eid, t->history->peer_eid, 0, - t->history->seq_num, 1); - pdu_fd_t *fd; + int32 ret = -1; + CF_CFDP_PduHeader_t *ph = CF_CFDP_ConstructPduHeader(t, 0, CF_AppData.config_table->local_eid, t->history->peer_eid, + 0, t->history->seq_num, 1); + CF_CFDP_PduFd_t *fd; if (!ph) { ret = 0; @@ -146,7 +146,7 @@ static int32 CF_CFDP_S_SendFileData(transaction_t *t, uint32 foffs, uint32 bytes } int status; - fd = STATIC_CAST(ph, pdu_fd_t); + fd = STATIC_CAST(ph, CF_CFDP_PduFd_t); if (bytes_to_read > CF_AppData.config_table->outgoing_file_chunk_size) { @@ -240,7 +240,7 @@ static void CF_CFDP_S_SubstateSendFileData(transaction_t *t) else if (bytes_processed < 0) { /* IO error -- change state and send EOF */ - t->history->cc = CC_FILESTORE_REJECTION; + t->history->cc = CF_CFDP_ConditionCode_FILESTORE_REJECTION; t->state_data.s.sub_state = SEND_EOF; } else @@ -426,7 +426,7 @@ static void CF_CFDP_S_SubstateSendMetadata(transaction_t *t) return; err_out: - t->history->cc = CC_FILESTORE_REJECTION; + t->history->cc = CF_CFDP_ConditionCode_FILESTORE_REJECTION; CF_CFDP_S_Reset(t); } @@ -440,8 +440,8 @@ static void CF_CFDP_S_SubstateSendMetadata(transaction_t *t) static void CF_CFDP_S_SubstateSendFinAck(transaction_t *t) { /* if send, or error, reset. if no message, try again next cycle */ - if (CF_CFDP_SendAck(t, ACK_TS_ACTIVE, PDU_FIN, t->state_data.s.s2.fin_cc, t->history->peer_eid, - t->history->seq_num) != CF_SEND_NO_MSG) + if (CF_CFDP_SendAck(t, CF_CFDP_AckTxnStatus_ACTIVE, CF_CFDP_FileDirective_FIN, t->state_data.s.s2.fin_cc, + t->history->peer_eid, t->history->seq_num) != CF_SEND_NO_MSG) { CF_CFDP_S_Reset(t); } @@ -454,7 +454,7 @@ static void CF_CFDP_S_SubstateSendFinAck(transaction_t *t) ** t must not be NULL. ph must not be NULL. ** *************************************************************************/ -static void CF_CFDP_S2_EarlyFin(transaction_t *t, const pdu_header_t *ph) +static void CF_CFDP_S2_EarlyFin(transaction_t *t, const CF_CFDP_PduHeader_t *ph) { /* received early fin, so just cancel */ CFE_EVS_SendEvent(CF_EID_ERR_CFDP_S_EARLY_FIN, CFE_EVS_EventType_ERROR, @@ -470,11 +470,11 @@ static void CF_CFDP_S2_EarlyFin(transaction_t *t, const pdu_header_t *ph) ** t must not be NULL. ph must not be NULL. ** *************************************************************************/ -static void CF_CFDP_S2_Fin(transaction_t *t, const pdu_header_t *ph) +static void CF_CFDP_S2_Fin(transaction_t *t, const CF_CFDP_PduHeader_t *ph) { if (!CF_CFDP_RecvFin()) { - t->state_data.s.s2.fin_cc = FGV(STATIC_CAST(ph, pdu_fin_t)->flags, PDU_FLAGS_CC); + t->state_data.s.s2.fin_cc = FGV(STATIC_CAST(ph, CF_CFDP_PduFin_t)->flags, CF_CFDP_PduFin_FLAGS_CC); t->state_data.s.sub_state = SEND_SEND_FIN_ACK; } else @@ -497,7 +497,7 @@ static void CF_CFDP_S2_Fin(transaction_t *t, const pdu_header_t *ph) ** t must not be NULL. ph must not be NULL. ** *************************************************************************/ -static void CF_CFDP_S2_Nak(transaction_t *t, const pdu_header_t *ph) +static void CF_CFDP_S2_Nak(transaction_t *t, const CF_CFDP_PduHeader_t *ph) { /* temporary function to respond to naks */ int counter; @@ -506,7 +506,7 @@ static void CF_CFDP_S2_Nak(transaction_t *t, const pdu_header_t *ph) if (!CF_CFDP_RecvNak(&num_sr) && num_sr) { - pdu_nak_t *nak = STATIC_CAST(ph, pdu_nak_t); + CF_CFDP_PduNak_t *nak = STATIC_CAST(ph, CF_CFDP_PduNak_t); CF_Assert(num_sr <= CF_NAK_MAX_SEGMENTS); // sanity check for (counter = 0; counter < num_sr; ++counter) @@ -567,7 +567,7 @@ static void CF_CFDP_S2_Nak(transaction_t *t, const pdu_header_t *ph) ** t must not be NULL. ph must not be NULL. ** *************************************************************************/ -static void CF_CFDP_S2_Nak_Arm(transaction_t *t, const pdu_header_t *ph) +static void CF_CFDP_S2_Nak_Arm(transaction_t *t, const CF_CFDP_PduHeader_t *ph) { CF_CFDP_ArmAckTimer(t); CF_CFDP_S2_Nak(t, ph); @@ -584,13 +584,13 @@ static void CF_CFDP_S2_Nak_Arm(transaction_t *t, const pdu_header_t *ph) ** t must not be NULL. ph must not be NULL. ** *************************************************************************/ -static void CF_CFDP_S2_WaitForEofAck(transaction_t *t, const pdu_header_t *ph) +static void CF_CFDP_S2_WaitForEofAck(transaction_t *t, const CF_CFDP_PduHeader_t *ph) { if (!CF_CFDP_RecvAck()) { /* don't send fin if error. Don't check the eof CC, just go with * the stored one we sent before */ - if (t->history->cc != CC_NO_ERROR) + if (t->history->cc != CF_CFDP_ConditionCode_NO_ERROR) { CF_CFDP_S_Reset(t); } @@ -620,20 +620,20 @@ static void CF_CFDP_S2_WaitForEofAck(transaction_t *t, const pdu_header_t *ph) ** t must not be NULL. fns must not be NULL. ** *************************************************************************/ -static void CF_CFDP_S_DispatchRecv(transaction_t *t, - void (*const fns[SEND_NUM_STATES][PDU_INVALID_MAX])(transaction_t *, - const pdu_header_t *)) +static void CF_CFDP_S_DispatchRecv( + transaction_t *t, + void (*const fns[SEND_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])(transaction_t *, const CF_CFDP_PduHeader_t *)) { CF_Assert(t->state_data.s.sub_state < SEND_NUM_STATES); CF_Assert(CF_AppData.engine.in.msg); /* at this point, pdu header for recv message is unmarshaled */ - pdu_header_t *ph = &((pdu_r_msg_t *)CF_AppData.engine.in.msg)->ph; + CF_CFDP_PduHeader_t *ph = &((CF_PduRecvMsg_t *)CF_AppData.engine.in.msg)->ph; /* send state, so we only care about file directive PDU */ - if (!FGV(ph->flags, PDU_HDR_FLAGS_TYPE)) + if (!FGV(ph->flags, CF_CFDP_PduHeader_FLAGS_TYPE)) { - pdu_file_directive_header_t *fdh = STATIC_CAST(ph, pdu_file_directive_header_t); - if (fdh->directive_code < PDU_INVALID_MAX) + CF_CFDP_PduFileDirectiveHeader_t *fdh = STATIC_CAST(ph, CF_CFDP_PduFileDirectiveHeader_t); + if (fdh->directive_code < CF_CFDP_FileDirective_INVALID_MAX) { /* check that there's a valid function pointer. if there isn't, * then silently ignore. We may want to discuss if it's worth @@ -673,8 +673,8 @@ static void CF_CFDP_S_DispatchRecv(transaction_t *t, void CF_CFDP_S1_Recv(transaction_t *t) { /* s1 doesn't need to receive anything */ - static void (*const substate_fns[SEND_NUM_STATES][PDU_INVALID_MAX])(transaction_t *, - const pdu_header_t *) = {{NULL}}; + static void (*const substate_fns[SEND_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])( + transaction_t *, const CF_CFDP_PduHeader_t *) = {{NULL}}; CF_CFDP_S_DispatchRecv(t, substate_fns); } @@ -687,7 +687,8 @@ void CF_CFDP_S1_Recv(transaction_t *t) *************************************************************************/ void CF_CFDP_S2_Recv(transaction_t *t) { - static void (*const substate_fns[SEND_NUM_STATES][PDU_INVALID_MAX])(transaction_t *, const pdu_header_t *) = { + static void (*const substate_fns[SEND_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])( + transaction_t *, const CF_CFDP_PduHeader_t *) = { {NULL, NULL, NULL, NULL, NULL, CF_CFDP_S2_EarlyFin, NULL, NULL, NULL, NULL, NULL}, /* SEND_METADATA */ {NULL, NULL, NULL, NULL, NULL, CF_CFDP_S2_EarlyFin, NULL, NULL, CF_CFDP_S2_Nak, NULL, NULL}, /* SEND_FILEDATA */ {NULL, NULL, NULL, NULL, NULL, CF_CFDP_S2_EarlyFin, NULL, NULL, CF_CFDP_S2_Nak, NULL, NULL}, /* SEND_EOF */ diff --git a/fsw/src/cf_cmd.c b/fsw/src/cf_cmd.c index 3367cad71..f2c64c747 100644 --- a/fsw/src/cf_cmd.c +++ b/fsw/src/cf_cmd.c @@ -345,7 +345,7 @@ static void CF_CmdThaw(CFE_SB_Buffer_t *msg) ** \endreturns ** *************************************************************************/ -static transaction_t *CF_CFDP_FindTransactionBySequenceNumberAllChannels(cf_transaction_seq_t ts, cf_entity_id_t eid) +static transaction_t *CF_CFDP_FindTransactionBySequenceNumberAllChannels(CF_TransactionSeq_t ts, CF_EntityId_t eid) { int i; transaction_t *ret = NULL; @@ -925,7 +925,7 @@ static void CF_CmdSendCfgParams(CFE_SB_Buffer_t *msg) static int CF_CmdValidateChunkSize(uint32 val, uint8 chan_num /* ignored */) { int ret = 0; - if (val > sizeof(pdu_fd_data_t)) + if (val > sizeof(CF_CFDP_PduFileDataContent_t)) { ret = 1; /* failed */ } diff --git a/fsw/src/cf_msg.h b/fsw/src/cf_msg.h index dfe14a8fc..1b76db700 100644 --- a/fsw/src/cf_msg.h +++ b/fsw/src/cf_msg.h @@ -117,7 +117,7 @@ typedef struct uint8 ack_limit; /* number of times to retry ACK (for ex, send fin and wait for fin-ack) */ uint8 nak_limit; /* number of times to retry NAK before giving up (resets on a single response */ - cf_entity_id_t local_eid; + CF_EntityId_t local_eid; /* must #define the number of data items in this struct for command processing */ #define CF_NUM_CFG_PACKET_ITEMS 10 } CF_PACK cf_cfg_packet_t; @@ -206,7 +206,7 @@ typedef struct uint8 keep; /* if 1, then keep the file -- otherwise delete */ uint8 chan_num; uint8 priority; - cf_entity_id_t dest_id; + CF_EntityId_t dest_id; char src_filename[CF_FILENAME_MAX_LEN]; char dst_filename[CF_FILENAME_MAX_LEN]; } CF_PACK cf_cmd_tx_file_t; @@ -226,8 +226,8 @@ typedef cf_cmd_tx_file_t cf_cmd_playback_dir_t; typedef struct { CFE_MSG_CommandHeader_t cmd_header; - cf_transaction_seq_t ts; - cf_entity_id_t eid; + CF_TransactionSeq_t ts; + CF_EntityId_t eid; uint8 chan; /* if 254, use ts. if 255, all channels */ } CF_PACK cf_cmd_transaction_t; diff --git a/fsw/tables/cf_def_config.c b/fsw/tables/cf_def_config.c index 46f7b94d4..7e644417d 100644 --- a/fsw/tables/cf_def_config.c +++ b/fsw/tables/cf_def_config.c @@ -38,7 +38,7 @@ cf_config_table_t CF_config_table = { 0x18c8, 0x08c2, 16, - {{5, 25, CLASS_2, 23, "/cf/poll_dir", "./poll_dir", 0}, {0}, {0}, {0}, {0}}, + {{5, 25, CF_CFDP_CLASS_2, 23, "/cf/poll_dir", "./poll_dir", 0}, {0}, {0}, {0}, {0}}, "cf_1_sem", 1, }, diff --git a/unit-test/CMakeLists.txt b/unit-test/CMakeLists.txt index ec4cf62f7..ab2712a8b 100644 --- a/unit-test/CMakeLists.txt +++ b/unit-test/CMakeLists.txt @@ -86,4 +86,4 @@ foreach(SRCFILE ${source_files_under_test}) # app_stub_and_utility_filenames are used when building (TODO: ? is this comment correct?) add_cfe_coverage_dependency(cf "${TESTS_NAME}" cf) -endforeach() \ No newline at end of file +endforeach() diff --git a/unit-test/cf_app_tests.c b/unit-test/cf_app_tests.c index e79f8439f..c66f12277 100644 --- a/unit-test/cf_app_tests.c +++ b/unit-test/cf_app_tests.c @@ -215,8 +215,8 @@ void cf_config_table_tests_set_dummy_table_to_nominal(void) dummy_table.ticks_per_second = Any_uint32_Except(0); // all values (except 0) & 3ff == 0 are nominal (1024 byte aligned) dummy_table.rx_crc_calc_bytes_per_wakeup = Any_uint32_Except(0) << 10; - // all values less than sizeof(pdu_fd_data_t) are nominal - dummy_table.outgoing_file_chunk_size = Any_uint16_LessThan(sizeof(pdu_fd_data_t)); + // all values less than sizeof(CF_CFDP_PduFileDataContent_t) are nominal + dummy_table.outgoing_file_chunk_size = Any_uint16_LessThan(sizeof(CF_CFDP_PduFileDataContent_t)); } /* end cf_config_table_tests_set_dummy_table_to_nominal */ void Setup_cf_config_table_tests(void) @@ -279,10 +279,10 @@ void Test_CF_ValidateConfigTable_FailBecauseOutgoingFileChunkSmallerThanDataArra /* Arrange */ cf_config_table_t *arg_table = &dummy_table; - // outgoing_file_chunk_size set to greater than sizeof(pdu_fd_data_t) + // outgoing_file_chunk_size set to greater than sizeof(CF_CFDP_PduFileDataContent_t) arg_table->ticks_per_second = 1; arg_table->rx_crc_calc_bytes_per_wakeup = 0x0400; /* 1024 aligned */ - arg_table->outgoing_file_chunk_size = sizeof(pdu_fd_data_t) + 1; + arg_table->outgoing_file_chunk_size = sizeof(CF_CFDP_PduFileDataContent_t) + 1; /* Act */ result = CF_ValidateConfigTable(arg_table); @@ -298,7 +298,7 @@ void Test_CF_ValidateConfigTable_Success(void) arg_table->ticks_per_second = 1; arg_table->rx_crc_calc_bytes_per_wakeup = 0x0400; /* 1024 aligned */ - arg_table->outgoing_file_chunk_size = sizeof(pdu_fd_data_t); + arg_table->outgoing_file_chunk_size = sizeof(CF_CFDP_PduFileDataContent_t); /* Act */ result = CF_ValidateConfigTable(arg_table); diff --git a/unit-test/cf_cfdp_helpers_tests.c b/unit-test/cf_cfdp_helpers_tests.c index 40cb536fd..bb78a6ba1 100644 --- a/unit-test/cf_cfdp_helpers_tests.c +++ b/unit-test/cf_cfdp_helpers_tests.c @@ -636,12 +636,12 @@ void Test_CF_MemcpyFromBE_When_src_size_IsEqTo_dst_size_CopyAllRequisite_src_Val ** *******************************************************************************/ -void Test_CF_GetTSNSize_When_ret_IsGreaterThan_size_of_cf_transaction_seq_t_ReturnThatValue(void) +void Test_CF_GetTSNSize_When_ret_IsGreaterThan_size_of_CF_TransactionSeq_t_ReturnThatValue(void) { /* Arrange */ - pdu_header_t dummy_ph; - pdu_header_t *arg_ph = &dummy_ph; - uint8 forced_return_FGV = sizeof(cf_transaction_seq_t); /* CUT adds +1 to this value making it greater than */ + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; + uint8 forced_return_FGV = sizeof(CF_TransactionSeq_t); /* CUT adds +1 to this value making it greater than */ int local_result; UT_SetDefaultReturnValue(UT_KEY(FGV), forced_return_FGV); @@ -652,16 +652,16 @@ void Test_CF_GetTSNSize_When_ret_IsGreaterThan_size_of_cf_transaction_seq_t_Retu /* Assert */ UtAssert_True(local_result == -1, "CF_GetTSNSize returned %d and should be -1", local_result); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); -} /* end Test_CF_GetTSNSize_When_ret_IsGreaterThan_size_of_cf_transaction_seq_t_ReturnThatValue */ +} /* end Test_CF_GetTSNSize_When_ret_IsGreaterThan_size_of_CF_TransactionSeq_t_ReturnThatValue */ -void Test_CF_GetTSNSize_When_ret_Is_1_LessThan_size_of_cf_transaction_seq_t_Add_1_MakingItEqToThatSizeReturnThatValue( +void Test_CF_GetTSNSize_When_ret_Is_1_LessThan_size_of_CF_TransactionSeq_t_Add_1_MakingItEqToThatSizeReturnThatValue( void) { /* Arrange */ - pdu_header_t dummy_ph; - pdu_header_t *arg_ph = &dummy_ph; - uint8 forced_return_FGV = sizeof(cf_transaction_seq_t) - 1; /* CUT adds +1 to this value making it equal to */ - int expected_result = forced_return_FGV + 1; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; + uint8 forced_return_FGV = sizeof(CF_TransactionSeq_t) - 1; /* CUT adds +1 to this value making it equal to */ + int expected_result = forced_return_FGV + 1; int local_result; UT_SetDefaultReturnValue(UT_KEY(FGV), forced_return_FGV); @@ -671,20 +671,20 @@ void Test_CF_GetTSNSize_When_ret_Is_1_LessThan_size_of_cf_transaction_seq_t_Add_ /* Assert */ UtAssert_True(local_result == expected_result, - "CF_GetTSNSize returned %d and should be %ld (sizeof(cf_transaction_seq_t))", local_result, - sizeof(cf_transaction_seq_t)); + "CF_GetTSNSize returned %d and should be %ld (sizeof(CF_TransactionSeq_t))", local_result, + sizeof(CF_TransactionSeq_t)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); } /* end - Test_CF_GetTSNSize_When_ret_Is_1_LessThan_size_of_cf_transaction_seq_t_Add_1_MakingItEqToThatSizeReturnThatValue */ + Test_CF_GetTSNSize_When_ret_Is_1_LessThan_size_of_CF_TransactionSeq_t_Add_1_MakingItEqToThatSizeReturnThatValue */ -void Test_CF_GetTSNSize_When_ret_Is_LessThan_size_of_cf_transaction_seq_t_Add_1_AndReturnThatValue(void) +void Test_CF_GetTSNSize_When_ret_Is_LessThan_size_of_CF_TransactionSeq_t_Add_1_AndReturnThatValue(void) { /* Arrange */ - pdu_header_t dummy_ph; - pdu_header_t *arg_ph = &dummy_ph; - uint8 forced_return_FGV = Any_uint8_LessThan(sizeof(cf_transaction_seq_t)); /* CUT adds +1 to this value */ - int expected_result = forced_return_FGV + 1; - int local_result; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; + uint8 forced_return_FGV = Any_uint8_LessThan(sizeof(CF_TransactionSeq_t)); /* CUT adds +1 to this value */ + int expected_result = forced_return_FGV + 1; + int local_result; UT_SetDefaultReturnValue(UT_KEY(FGV), forced_return_FGV); @@ -695,7 +695,7 @@ void Test_CF_GetTSNSize_When_ret_Is_LessThan_size_of_cf_transaction_seq_t_Add_1_ UtAssert_True(local_result == expected_result, "CF_GetTSNSize returned %d and should be 1 more than %d (FGV)", local_result, forced_return_FGV); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); -} /* end Test_CF_GetTSNSize_When_ret_Is_LessThan_size_of_cf_transaction_seq_t_Add_1_AndReturnThatValue */ +} /* end Test_CF_GetTSNSize_When_ret_Is_LessThan_size_of_CF_TransactionSeq_t_Add_1_AndReturnThatValue */ /* end CF_GetTSNSize tests */ @@ -705,13 +705,13 @@ void Test_CF_GetTSNSize_When_ret_Is_LessThan_size_of_cf_transaction_seq_t_Add_1_ ** *******************************************************************************/ -void Test_CF_GetEIDSize_When_ret_IsGreaterThan_size_of_cf_entity_id_t_ReturnThatValue(void) +void Test_CF_GetEIDSize_When_ret_IsGreaterThan_size_of_CF_EntityId_t_ReturnThatValue(void) { /* Arrange */ - pdu_header_t dummy_ph; - pdu_header_t *arg_ph = &dummy_ph; - uint8 forced_return_FGV = sizeof(cf_entity_id_t); /* CUT adds +1 to this value making it greater than */ - int local_result; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; + uint8 forced_return_FGV = sizeof(CF_EntityId_t); /* CUT adds +1 to this value making it greater than */ + int local_result; UT_SetDefaultReturnValue(UT_KEY(FGV), forced_return_FGV); @@ -721,16 +721,16 @@ void Test_CF_GetEIDSize_When_ret_IsGreaterThan_size_of_cf_entity_id_t_ReturnThat /* Assert */ UtAssert_True(local_result == -1, "CF_GetEIDSize returned %d and should be -1", local_result); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 1); -} /* end Test_CF_GetEIDSize_When_ret_IsGreaterThan_size_of_cf_entity_id_t_ReturnThatValue */ +} /* end Test_CF_GetEIDSize_When_ret_IsGreaterThan_size_of_CF_EntityId_t_ReturnThatValue */ -void Test_CF_GetEIDSize_When_ret_Is_1_LessThan_size_of_cf_entity_id_t_Add_1_MakingItEqToThatSizeReturnThatValue(void) +void Test_CF_GetEIDSize_When_ret_Is_1_LessThan_size_of_CF_EntityId_t_Add_1_MakingItEqToThatSizeReturnThatValue(void) { /* Arrange */ - pdu_header_t dummy_ph; - pdu_header_t *arg_ph = &dummy_ph; - uint8 forced_return_FGV = sizeof(cf_entity_id_t) - 1; /* CUT adds +1 to this value making it equal to */ - int expected_result = forced_return_FGV + 1; - int local_result; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; + uint8 forced_return_FGV = sizeof(CF_EntityId_t) - 1; /* CUT adds +1 to this value making it equal to */ + int expected_result = forced_return_FGV + 1; + int local_result; UT_SetDefaultReturnValue(UT_KEY(FGV), forced_return_FGV); @@ -739,19 +739,19 @@ void Test_CF_GetEIDSize_When_ret_Is_1_LessThan_size_of_cf_entity_id_t_Add_1_Maki /* Assert */ UtAssert_True(local_result == expected_result, - "CF_GetEIDSize returned %d and should be %ld (sizeof(cf_entity_id_t))", local_result, - sizeof(cf_entity_id_t)); + "CF_GetEIDSize returned %d and should be %ld (sizeof(CF_EntityId_t))", local_result, + sizeof(CF_EntityId_t)); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); -} /* end Test_CF_GetEIDSize_When_ret_Is_1_LessThan_size_of_cf_entity_id_t_Add_1_MakingItEqToThatSizeReturnThatValue */ +} /* end Test_CF_GetEIDSize_When_ret_Is_1_LessThan_size_of_CF_EntityId_t_Add_1_MakingItEqToThatSizeReturnThatValue */ -void Test_CF_GetEIDSize_When_ret_Is_LessThan_size_of_cf_entity_id_t_Add_1_AndReturnThatValue(void) +void Test_CF_GetEIDSize_When_ret_Is_LessThan_size_of_CF_EntityId_t_Add_1_AndReturnThatValue(void) { /* Arrange */ - pdu_header_t dummy_ph; - pdu_header_t *arg_ph = &dummy_ph; - uint8 forced_return_FGV = Any_uint8_LessThan(sizeof(cf_entity_id_t)); /* CUT adds +1 to this value */ - int expected_result = forced_return_FGV + 1; - int local_result; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; + uint8 forced_return_FGV = Any_uint8_LessThan(sizeof(CF_EntityId_t)); /* CUT adds +1 to this value */ + int expected_result = forced_return_FGV + 1; + int local_result; UT_SetDefaultReturnValue(UT_KEY(FGV), forced_return_FGV); @@ -762,7 +762,7 @@ void Test_CF_GetEIDSize_When_ret_Is_LessThan_size_of_cf_entity_id_t_Add_1_AndRet UtAssert_True(local_result == expected_result, "CF_GetEIDSize returned %d and should be 1 more than %d (FGV)", local_result, forced_return_FGV); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); -} /* end Test_CF_GetEIDSize_When_ret_Is_LessThan_size_of_cf_entity_id_t_Add_1_AndReturnThatValue */ +} /* end Test_CF_GetEIDSize_When_ret_Is_LessThan_size_of_CF_EntityId_t_Add_1_AndReturnThatValue */ /* end CF_GetEIDSize tests */ @@ -783,16 +783,16 @@ void Test_CF_GetVariableHeader_When_eid_l_AND_tsn_l_AreNotGreaterThan_0_DoesNotC CF_AppData.engine.in.msg = &dummy_ph.cfe_sb_buffer; /* Arrange for CF_GetEIDSize */ - uint32 forced_return_FGV_from_EID = sizeof(cf_entity_id_t); /* unstubbable code adds +1 to this value */ + uint32 forced_return_FGV_from_EID = sizeof(CF_EntityId_t); /* unstubbable code adds +1 to this value */ UT_SetDeferredRetcode(UT_KEY(FGV), 1, - forced_return_FGV_from_EID); /* FGV + 1 > sizeof(cf_entity_id_t) causes ret to be -1 */ + forced_return_FGV_from_EID); /* FGV + 1 > sizeof(CF_EntityId_t) causes ret to be -1 */ /* Arrange for CF_GetTSNSize */ - uint32 forced_return_FGV_from_TSN = sizeof(cf_transaction_seq_t); /* unstubbable code adds +1 to this value */ + uint32 forced_return_FGV_from_TSN = sizeof(CF_TransactionSeq_t); /* unstubbable code adds +1 to this value */ UT_SetDeferredRetcode(UT_KEY(FGV), 1, - forced_return_FGV_from_TSN); /* FGV + 1 > sizeof(cf_transaction_seq_t) causes ret to be -1 */ + forced_return_FGV_from_TSN); /* FGV + 1 > sizeof(CF_TransactionSeq_t) causes ret to be -1 */ /* Act */ local_result = CF_GetVariableHeader(); @@ -814,18 +814,17 @@ void Test_CF_GetVariableHeader_WhenOnly_eid_l_IsGreaterThan_0_DoesNotCallAnyMemC CF_AppData.engine.in.msg = &dummy_ph.cfe_sb_buffer; /* Arrange for CF_GetEIDSize */ - uint32 forced_return_FGV_from_EID = sizeof(cf_entity_id_t) - 1; /* unstubbable code adds +1 to this value */ + uint32 forced_return_FGV_from_EID = sizeof(CF_EntityId_t) - 1; /* unstubbable code adds +1 to this value */ UT_SetDeferredRetcode( - UT_KEY(FGV), 1, - forced_return_FGV_from_EID); /* Call to FGV returns sizeof(cf_entity_id_t) - 1 + 1 = sizeof(cf_entity_id_t) - causes ret to be sizeof(cf_entity_id_t) */ + UT_KEY(FGV), 1, forced_return_FGV_from_EID); /* Call to FGV returns sizeof(CF_EntityId_t) - 1 + 1 = + sizeof(CF_EntityId_t) causes ret to be sizeof(CF_EntityId_t) */ /* Arrange for CF_GetTSNSize */ - uint32 forced_return_FGV_from_TSN = sizeof(cf_transaction_seq_t); /* unstubbable code adds +1 to this value */ + uint32 forced_return_FGV_from_TSN = sizeof(CF_TransactionSeq_t); /* unstubbable code adds +1 to this value */ UT_SetDeferredRetcode(UT_KEY(FGV), 1, - forced_return_FGV_from_TSN); /* FGV + 1 > sizeof(cf_transaction_seq_t) causes ret to be -1 */ + forced_return_FGV_from_TSN); /* FGV + 1 > sizeof(CF_TransactionSeq_t) causes ret to be -1 */ /* Act */ local_result = CF_GetVariableHeader(); @@ -847,18 +846,18 @@ void Test_CF_GetVariableHeader_WhenOnly_tsn_l_IsGreaterThan_0_DoesNotCallAnyMemC CF_AppData.engine.in.msg = &dummy_ph.cfe_sb_buffer; /* Arrange for CF_GetEIDSize */ - uint32 forced_return_FGV_from_EID = sizeof(cf_entity_id_t); /* unstubbable code adds +1 to this value */ + uint32 forced_return_FGV_from_EID = sizeof(CF_EntityId_t); /* unstubbable code adds +1 to this value */ UT_SetDeferredRetcode(UT_KEY(FGV), 1, - forced_return_FGV_from_EID); /* FGV + 1 > sizeof(cf_entity_id_t) causes ret to be -1 */ + forced_return_FGV_from_EID); /* FGV + 1 > sizeof(CF_EntityId_t) causes ret to be -1 */ /* Arrange for CF_GetTSNSize */ - uint32 forced_return_FGV_from_TSN = sizeof(cf_transaction_seq_t) - 1; /* unstubbable code adds +1 to this value */ + uint32 forced_return_FGV_from_TSN = sizeof(CF_TransactionSeq_t) - 1; /* unstubbable code adds +1 to this value */ UT_SetDeferredRetcode( UT_KEY(FGV), 1, - forced_return_FGV_from_TSN); /* Call to FGV returns sizeof(cf_transaction_seq_t) - 1 + 1 = - sizeof(cf_transaction_seq_t) causes ret to be sizeof(cf_transaction_seq_t) */ + forced_return_FGV_from_TSN); /* Call to FGV returns sizeof(CF_TransactionSeq_t) - 1 + 1 = + sizeof(CF_TransactionSeq_t) causes ret to be sizeof(CF_TransactionSeq_t) */ /* Act */ local_result = CF_GetVariableHeader(); @@ -881,15 +880,15 @@ void Test_CF_GetVariableHeader_GetsAllThreeVariableLengthItemsOutOfHeaderAndRetu /* Arrange for CF_GetEIDSize */ uint32 forced_return_FGV_from_EID = - Any_uint32_LessThan(sizeof(cf_entity_id_t)); /* unstubbable code adds +1 to this value */ + Any_uint32_LessThan(sizeof(CF_EntityId_t)); /* unstubbable code adds +1 to this value */ - UT_SetDeferredRetcode(UT_KEY(FGV), 1, forced_return_FGV_from_EID); /* FGV + 1 <= sizeof(cf_entity_id_t) */ + UT_SetDeferredRetcode(UT_KEY(FGV), 1, forced_return_FGV_from_EID); /* FGV + 1 <= sizeof(CF_EntityId_t) */ /* Arrange for CF_GetTSNSize */ uint32 forced_return_FGV_from_TSN = - Any_uint32_LessThan(sizeof(cf_transaction_seq_t)); /* unstubbable code adds +1 to this value */ + Any_uint32_LessThan(sizeof(CF_TransactionSeq_t)); /* unstubbable code adds +1 to this value */ - UT_SetDeferredRetcode(UT_KEY(FGV), 1, forced_return_FGV_from_TSN); /* FGV + 1 <= sizeof(cf_transaction_seq_t) */ + UT_SetDeferredRetcode(UT_KEY(FGV), 1, forced_return_FGV_from_TSN); /* FGV + 1 <= sizeof(CF_TransactionSeq_t) */ /* Act */ local_result = CF_GetVariableHeader(); @@ -911,9 +910,9 @@ void Test_CF_GetVariableHeader_GetsAllThreeVariableLengthItemsOutOfHeaderAndRetu void Test_CF_SetVariableHeader_Call_FSV_Twice(void) { /* Arrange */ - cf_entity_id_t arg_src_eid = 1; - cf_entity_id_t arg_dst_eid = 1; - cf_transaction_seq_t arg_tsn = 1; + CF_EntityId_t arg_src_eid = 1; + CF_EntityId_t arg_dst_eid = 1; + CF_TransactionSeq_t arg_tsn = 1; CF_UT_outmsg_buffer_t dummy_msg; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -938,8 +937,8 @@ void Test_CF_SetVariableHeader_Call_FSV_Twice(void) void Test_CF_HeaderSize_AssertsWhen_eid_l_IsNotGreaterThan_0(void) { // /* Arrange */ - // pdu_header_t dummy_ph; - // pdu_header_t* arg_ph = &dummy_ph; + // CF_CFDP_PduHeader_t dummy_ph; + // CF_CFDP_PduHeader_t* arg_ph = &dummy_ph; // int32 forced_return_FGV_for_eid_l = Any_int32_Negative(); /* negative forces error */ // int32 forced_return_FGV_for_tsn_l = Any_uint8(); /* uint8 used arbitrarily for small size */ // int local_result; @@ -957,8 +956,8 @@ void Test_CF_HeaderSize_AssertsWhen_eid_l_IsNotGreaterThan_0(void) void Test_CF_HeaderSize_AssertsWhen_tsn_l_IsNotGreaterThan_0(void) { // /* Arrange */ - // pdu_header_t dummy_ph; - // pdu_header_t* arg_ph = &dummy_ph; + // CF_CFDP_PduHeader_t dummy_ph; + // CF_CFDP_PduHeader_t* arg_ph = &dummy_ph; // int32 forced_return_FGV_for_eid_l = Any_uint8(); /* uint8 used arbitrarily for small size */ // int32 forced_return_FGV_for_tsn_l = Any_int32_Negative(); /* negative forces error */ // int local_result; @@ -973,14 +972,14 @@ void Test_CF_HeaderSize_AssertsWhen_tsn_l_IsNotGreaterThan_0(void) UtAssert_MIR("JIRA: GSFCCFS-1733 CF_Assert - (eid_l>0)&&(tsn_l>0)"); } /* end Test_CF_HeaderSize_AssertsWhen_tsn_l_IsNotGreaterThan_0 */ -void Test_CF_HeaderSize_Return_sizeof_pdu_header_t_Plus_2_Times_eid_l_Plus_tsn_l(void) +void Test_CF_HeaderSize_Return_sizeof_CF_PduHeader_t_Plus_2_Times_eid_l_Plus_tsn_l(void) { /* Arrange */ - pdu_header_t dummy_ph; - pdu_header_t *arg_ph = &dummy_ph; - int32 forced_return_FGV_for_eid_l = Any_uint8(); /* uint8 used arbitrarily for small size */ - int32 forced_return_FGV_for_tsn_l = Any_uint8(); /* uint8 used arbitrarily for small size */ - int expected_result = sizeof(pdu_header_t) + (2 * (forced_return_FGV_for_eid_l + 1)) + + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; + int32 forced_return_FGV_for_eid_l = Any_uint8(); /* uint8 used arbitrarily for small size */ + int32 forced_return_FGV_for_tsn_l = Any_uint8(); /* uint8 used arbitrarily for small size */ + int expected_result = sizeof(CF_CFDP_PduHeader_t) + (2 * (forced_return_FGV_for_eid_l + 1)) + (forced_return_FGV_for_tsn_l + 1); /* each +1 added by CUT */ int local_result; @@ -995,10 +994,10 @@ void Test_CF_HeaderSize_Return_sizeof_pdu_header_t_Plus_2_Times_eid_l_Plus_tsn_l /* Assert */ UtAssert_True( local_result == expected_result, - "CF_GetVariableHeader returned %d and should be %d (sizeof(pdu_header_t) + (2 * (%u + 1))) + (%u + 1))", + "CF_GetVariableHeader returned %d and should be %d (sizeof(CF_CFDP_PduHeader_t) + (2 * (%u + 1))) + (%u + 1))", local_result, expected_result, forced_return_FGV_for_eid_l, forced_return_FGV_for_tsn_l); UtAssert_STUB_COUNT(FGV, 2); -} /* end Test_CF_HeaderSize_Return_sizeof_pdu_header_t_Plus_2_Times_eid_l_Plus_tsn_l */ +} /* end Test_CF_HeaderSize_Return_sizeof_CF_PduHeader_t_Plus_2_Times_eid_l_Plus_tsn_l */ /* end CF_SetVariableHeader tests */ @@ -1090,31 +1089,31 @@ void add_CF_MemcpyFromBE_tests(void) void add_CF_GetTSNSize_tests(void) { - UtTest_Add(Test_CF_GetTSNSize_When_ret_IsGreaterThan_size_of_cf_transaction_seq_t_ReturnThatValue, + UtTest_Add(Test_CF_GetTSNSize_When_ret_IsGreaterThan_size_of_CF_TransactionSeq_t_ReturnThatValue, cf_cfdp_helpers_tests_Setup, cf_cfdp_helpers_tests_Teardown, - "Test_CF_GetTSNSize_When_ret_IsGreaterThan_size_of_cf_transaction_seq_t_ReturnThatValue"); + "Test_CF_GetTSNSize_When_ret_IsGreaterThan_size_of_CF_TransactionSeq_t_ReturnThatValue"); UtTest_Add( - Test_CF_GetTSNSize_When_ret_Is_1_LessThan_size_of_cf_transaction_seq_t_Add_1_MakingItEqToThatSizeReturnThatValue, + Test_CF_GetTSNSize_When_ret_Is_1_LessThan_size_of_CF_TransactionSeq_t_Add_1_MakingItEqToThatSizeReturnThatValue, cf_cfdp_helpers_tests_Setup, cf_cfdp_helpers_tests_Teardown, - "Test_CF_GetTSNSize_When_ret_Is_1_LessThan_size_of_cf_transaction_seq_t_Add_1_" + "Test_CF_GetTSNSize_When_ret_Is_1_LessThan_size_of_CF_TransactionSeq_t_Add_1_" "MakingItEqToThatSizeReturnThatValue"); - UtTest_Add(Test_CF_GetTSNSize_When_ret_Is_LessThan_size_of_cf_transaction_seq_t_Add_1_AndReturnThatValue, + UtTest_Add(Test_CF_GetTSNSize_When_ret_Is_LessThan_size_of_CF_TransactionSeq_t_Add_1_AndReturnThatValue, cf_cfdp_helpers_tests_Setup, cf_cfdp_helpers_tests_Teardown, - "Test_CF_GetTSNSize_When_ret_Is_LessThan_size_of_cf_transaction_seq_t_Add_1_AndReturnThatValue"); + "Test_CF_GetTSNSize_When_ret_Is_LessThan_size_of_CF_TransactionSeq_t_Add_1_AndReturnThatValue"); } /* end add_CF_GetTSNSize_tests */ void add_CF_GetEIDSize_tests(void) { - UtTest_Add(Test_CF_GetEIDSize_When_ret_IsGreaterThan_size_of_cf_entity_id_t_ReturnThatValue, + UtTest_Add(Test_CF_GetEIDSize_When_ret_IsGreaterThan_size_of_CF_EntityId_t_ReturnThatValue, cf_cfdp_helpers_tests_Setup, cf_cfdp_helpers_tests_Teardown, - "Test_CF_GetEIDSize_When_ret_IsGreaterThan_size_of_cf_entity_id_t_ReturnThatValue"); + "Test_CF_GetEIDSize_When_ret_IsGreaterThan_size_of_CF_EntityId_t_ReturnThatValue"); UtTest_Add( - Test_CF_GetEIDSize_When_ret_Is_1_LessThan_size_of_cf_entity_id_t_Add_1_MakingItEqToThatSizeReturnThatValue, + Test_CF_GetEIDSize_When_ret_Is_1_LessThan_size_of_CF_EntityId_t_Add_1_MakingItEqToThatSizeReturnThatValue, cf_cfdp_helpers_tests_Setup, cf_cfdp_helpers_tests_Teardown, - "Test_CF_GetEIDSize_When_ret_Is_1_LessThan_size_of_cf_entity_id_t_Add_1_MakingItEqToThatSizeReturnThatValue"); - UtTest_Add(Test_CF_GetEIDSize_When_ret_Is_LessThan_size_of_cf_entity_id_t_Add_1_AndReturnThatValue, + "Test_CF_GetEIDSize_When_ret_Is_1_LessThan_size_of_CF_EntityId_t_Add_1_MakingItEqToThatSizeReturnThatValue"); + UtTest_Add(Test_CF_GetEIDSize_When_ret_Is_LessThan_size_of_CF_EntityId_t_Add_1_AndReturnThatValue, cf_cfdp_helpers_tests_Setup, cf_cfdp_helpers_tests_Teardown, - "Test_CF_GetEIDSize_When_ret_Is_LessThan_size_of_cf_entity_id_t_Add_1_AndReturnThatValue"); + "Test_CF_GetEIDSize_When_ret_Is_LessThan_size_of_CF_EntityId_t_Add_1_AndReturnThatValue"); } /* end add_CF_GetEIDSize_tests */ void add_CF_GetVariableHeader_tests(void) @@ -1145,9 +1144,9 @@ void add_CF_HeaderSize_tests(void) cf_cfdp_helpers_tests_Teardown, "Test_CF_HeaderSize_AssertsWhen_eid_l_IsNotGreaterThan_0"); UtTest_Add(Test_CF_HeaderSize_AssertsWhen_tsn_l_IsNotGreaterThan_0, cf_cfdp_helpers_tests_Setup, cf_cfdp_helpers_tests_Teardown, "Test_CF_HeaderSize_AssertsWhen_tsn_l_IsNotGreaterThan_0"); - UtTest_Add(Test_CF_HeaderSize_Return_sizeof_pdu_header_t_Plus_2_Times_eid_l_Plus_tsn_l, cf_cfdp_helpers_tests_Setup, - cf_cfdp_helpers_tests_Teardown, - "Test_CF_HeaderSize_Return_sizeof_pdu_header_t_Plus_2_Times_eid_l_Plus_tsn_l"); + UtTest_Add(Test_CF_HeaderSize_Return_sizeof_CF_PduHeader_t_Plus_2_Times_eid_l_Plus_tsn_l, + cf_cfdp_helpers_tests_Setup, cf_cfdp_helpers_tests_Teardown, + "Test_CF_HeaderSize_Return_sizeof_CF_PduHeader_t_Plus_2_Times_eid_l_Plus_tsn_l"); } /* end add_CF_HeaderSize_tests */ /* end cf_cfdp_helpers_tests UtTest_Add groups */ diff --git a/unit-test/cf_cfdp_r_tests.c b/unit-test/cf_cfdp_r_tests.c index e44ad8663..3c3dbec21 100644 --- a/unit-test/cf_cfdp_r_tests.c +++ b/unit-test/cf_cfdp_r_tests.c @@ -21,7 +21,7 @@ uint8 Stub_FGV(uint8 source, CF_FIELD_FIELD name); ** *******************************************************************************/ -static void Dummy_fd_fn(transaction_t *t, const pdu_header_t *pdu) +static void Dummy_fd_fn(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) { UT_Stub_CopyFromLocal(UT_KEY(Dummy_fd_fn), &t, sizeof(t)); UT_Stub_CopyFromLocal(UT_KEY(Dummy_fd_fn), &pdu, sizeof(pdu)); @@ -29,7 +29,7 @@ static void Dummy_fd_fn(transaction_t *t, const pdu_header_t *pdu) UT_DEFAULT_IMPL(Dummy_fd_fn); } -static void Dummy_fns(transaction_t *t, const pdu_header_t *pdu) +static void Dummy_fns(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) { UT_Stub_CopyFromLocal(UT_KEY(Dummy_fns), &t, sizeof(t)); UT_Stub_CopyFromLocal(UT_KEY(Dummy_fns), &pdu, sizeof(pdu)); @@ -89,12 +89,12 @@ void cf_cfdp_r_tests_Teardown(void) void Test_CF_CFDP_R2_SetCc_StoreGivenConditionCodeAndSetFinFlag(void) { /* Arrange */ - history_t dummy_history; - transaction_t arg_t; - condition_code_t arg_cc = CC_NO_ERROR; // TODO:Any_condition_code_t(); + history_t dummy_history; + transaction_t arg_t; + CF_CFDP_ConditionCode_t arg_cc = CF_CFDP_ConditionCode_NO_ERROR; // TODO:Any_condition_code_t(); arg_t.history = &dummy_history; - arg_t.history->cc = CC_POS_ACK_LIMIT_REACHED; // TODO Any_condition_code_t_Except(arg_cc); + arg_t.history->cc = CF_CFDP_ConditionCode_POS_ACK_LIMIT_REACHED; // TODO Any_condition_code_t_Except(arg_cc); arg_t.flags.rx.send_fin = 0; /* Act */ @@ -150,8 +150,8 @@ void Test_CFDP_R2_Reset_WhenTransactionSubStateIs_RECV_WAIT_FOR_FIN_ACK_Call_CF_ arg_t.history = &dummy_history; arg_t.state_data.r.sub_state = RECV_WAIT_FOR_FIN_ACK; - arg_t.state_data.r.r2.eof_cc = CC_NO_ERROR; - arg_t.history->cc = CC_NO_ERROR; + arg_t.state_data.r.r2.eof_cc = CF_CFDP_ConditionCode_NO_ERROR; + arg_t.history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t.flags.com.canceled = 0; arg_t.flags.rx.send_fin = 0; @@ -172,11 +172,13 @@ void Test_CFDP_R2_Reset_When_r_r2_eof_cc_IsErrorConditionCall_CF_CFDP_R1_Reset(v history_t dummy_history; arg_t.history = &dummy_history; - arg_t.state_data.r.sub_state = RECV_FILEDATA; // TODO: Any_rx_sub_state_Except(RECV_WAIT_FOR_FIN_ACK); - arg_t.state_data.r.r2.eof_cc = CC_POS_ACK_LIMIT_REACHED; // TODO: Any_condition_code_t_Except(CC_NO_ERROR); - arg_t.history->cc = CC_NO_ERROR; - arg_t.flags.com.canceled = 0; - arg_t.flags.rx.send_fin = 0; + arg_t.state_data.r.sub_state = RECV_FILEDATA; // TODO: Any_rx_sub_state_Except(RECV_WAIT_FOR_FIN_ACK); + arg_t.state_data.r.r2.eof_cc = + CF_CFDP_ConditionCode_POS_ACK_LIMIT_REACHED; // TODO: + // Any_condition_code_t_Except(CF_CFDP_ConditionCode_NO_ERROR); + arg_t.history->cc = CF_CFDP_ConditionCode_NO_ERROR; + arg_t.flags.com.canceled = 0; + arg_t.flags.rx.send_fin = 0; /* Act */ CF_CFDP_R2_Reset(&arg_t); @@ -196,10 +198,12 @@ void Test_CFDP_R2_Reset_When_t_history_cc_IsErrorConditionCall_CF_CFDP_R1_Reset( arg_t.history = &dummy_history; arg_t.state_data.r.sub_state = RECV_FILEDATA; // TODO: Any_rx_sub_state_Except(RECV_WAIT_FOR_FIN_ACK); - arg_t.state_data.r.r2.eof_cc = CC_NO_ERROR; - arg_t.history->cc = CC_POS_ACK_LIMIT_REACHED; // TODO: Any_condition_code_t_Except(CC_NO_ERROR);; - arg_t.flags.com.canceled = 0; - arg_t.flags.rx.send_fin = 0; + arg_t.state_data.r.r2.eof_cc = CF_CFDP_ConditionCode_NO_ERROR; + arg_t.history->cc = + CF_CFDP_ConditionCode_POS_ACK_LIMIT_REACHED; // TODO: + // Any_condition_code_t_Except(CF_CFDP_ConditionCode_NO_ERROR);; + arg_t.flags.com.canceled = 0; + arg_t.flags.rx.send_fin = 0; /* Act */ CF_CFDP_R2_Reset(&arg_t); @@ -219,8 +223,8 @@ void Test_CFDP_R2_Reset_When_t_flags_rx_cancelled_Is_1_Call_CF_CFDP_R1_Reset(voi arg_t.history = &dummy_history; arg_t.state_data.r.sub_state = RECV_FILEDATA; // TODO: Any_rx_sub_state_Except(RECV_WAIT_FOR_FIN_ACK); - arg_t.state_data.r.r2.eof_cc = CC_NO_ERROR; - arg_t.history->cc = CC_NO_ERROR; + arg_t.state_data.r.r2.eof_cc = CF_CFDP_ConditionCode_NO_ERROR; + arg_t.history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t.flags.com.canceled = 1; // TODO Any but 0? arg_t.flags.rx.send_fin = 0; @@ -242,8 +246,8 @@ void Test_CFDP_R2_Reset_Set_flags_rx_send_fin_To_1(void) arg_t.history = &dummy_history; arg_t.state_data.r.sub_state = RECV_FILEDATA; // TODO: Any_rx_sub_state_Except(RECV_WAIT_FOR_FIN_ACK); - arg_t.state_data.r.r2.eof_cc = CC_NO_ERROR; - arg_t.history->cc = CC_NO_ERROR; + arg_t.state_data.r.r2.eof_cc = CF_CFDP_ConditionCode_NO_ERROR; + arg_t.history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t.flags.com.canceled = 0; arg_t.flags.rx.send_fin = 0; @@ -268,19 +272,19 @@ void Test_CFDP_R2_Reset_Set_flags_rx_send_fin_To_1(void) void Test_CF_CFDP_R_CheckCrc_When_crc_NotEq_expected_crc_SendEventAndCountMismatch(void) { /* Arrange */ - transaction_t arg_t; - cfdp_state_t dummy_state; - history_t dummy_history; - cf_entity_id_t dummy_src_eid = Any_uint8(); - cf_transaction_seq_t dummy_seq_num = Any_uint32(); - cf_crc_t dummy_crc; - cf_crc_t *received_crc; - uint32 arg_expected_crc = Any_uint32(); - int expected_result = 1; - int local_result; - hk_channel_data_t dummy_channel_hk; - uint16 initial_crc_mismatch = Any_uint16(); - uint16 expectedEventID = CF_EID_ERR_CFDP_R_CRC; + transaction_t arg_t; + cfdp_state_t dummy_state; + history_t dummy_history; + CF_EntityId_t dummy_src_eid = Any_uint8(); + CF_TransactionSeq_t dummy_seq_num = Any_uint32(); + cf_crc_t dummy_crc; + cf_crc_t *received_crc; + uint32 arg_expected_crc = Any_uint32(); + int expected_result = 1; + int local_result; + hk_channel_data_t dummy_channel_hk; + uint16 initial_crc_mismatch = Any_uint16(); + uint16 expectedEventID = CF_EID_ERR_CFDP_R_CRC; dummy_state = CFDP_R2; arg_t.state = dummy_state; @@ -358,9 +362,10 @@ void Test_CF_CFDP_R2_Complete_Given_t_history_cc_IsNotEqTo_CC_NO_ERROR_DoNothing Any_uint8_Except(RECV_FILEDATA); /* uint8 used for rx_sub_state because it is a small valuation right now, TODO: create any_cf_rx_sub_state */ - arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except(CC_NO_ERROR); /* uint8 used for condition_code_t because it is a small - valuation right now, TODO: create any_cf_condition_code_t */ + arg_t->history = &dummy_history; + arg_t->history->cc = + Any_uint8_Except(CF_CFDP_ConditionCode_NO_ERROR); /* uint8 used for CF_CFDP_ConditionCode_t because it is a + small valuation right now, TODO: create any_cf_condition_code_t */ arg_t->state_data.r.sub_state = initial_sub_state; /* Act */ @@ -388,7 +393,7 @@ void Test_CF_CFDP_R2_Complete_Given_t_Sets_send_nak_To_1_Given_ok_to_send_nak_Is create any_cf_rx_sub_state */ arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->state_data.r.sub_state = initial_sub_state; arg_t->flags.rx.md_recv = 0; @@ -420,7 +425,7 @@ void Test_CF_CFDP_R2_Complete_Given_t_Sets_send_nak_To_1_Given_ok_to_send_nak_Is cf_config_table_t dummy_config_table; arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->state_data.r.sub_state = initial_sub_state; arg_t->flags.rx.md_recv = 0; @@ -456,7 +461,7 @@ void Test_CF_CFDP_R2_Complete_Given_t_Sets_send_nak_To_1_Given_ok_to_send_nak_Is cf_config_table_t dummy_config_table; arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->state_data.r.sub_state = initial_sub_state; arg_t->flags.rx.md_recv = 0; arg_t->flags.rx.send_nak = 0; @@ -495,7 +500,7 @@ void Test_CF_CFDP_R2_Complete_Calls_CF_Chunks_ComputeGaps_Returns_non0_Set_send_ cf_config_table_t dummy_config_table; arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->state_data.r.sub_state = initial_sub_state; arg_t->flags.rx.md_recv = 1; arg_t->flags.rx.send_nak = 0; @@ -536,7 +541,7 @@ void Test_CF_CFDP_R2_Complete_Calls_CF_Chunks_ComputeGaps_Returns_non0_Set_send_ cf_config_table_t dummy_config_table; arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->state_data.r.sub_state = initial_sub_state; arg_t->flags.rx.md_recv = 1; arg_t->flags.rx.send_nak = 0; @@ -578,7 +583,7 @@ void Test_CF_CFDP_R2_Complete_Calls_CF_Chunks_ComputeGaps_Returns_non0_Set_send_ cf_config_table_t dummy_config_table; arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->state_data.r.sub_state = initial_sub_state; arg_t->flags.rx.md_recv = 1; arg_t->flags.rx.send_nak = 0; @@ -625,7 +630,7 @@ void Test_CF_CFDP_R_ProcessFd_NoCrcWhen_bytes_received_IsLessThan_size_of_pdu_fi transaction_t *arg_t = &dummy_t; CFE_MSG_Size_t dummy_bytes_received; CFE_MSG_Size_t *arg_bytes_received = &dummy_bytes_received; - CFE_MSG_Size_t initial_bytes_received = Any_uint32_LessThan(sizeof(pdu_file_data_header_t)); + CFE_MSG_Size_t initial_bytes_received = Any_uint32_LessThan(sizeof(CF_CFDP_PduFileDataHeader_t)); int local_result; memset(&dummy_ph, 0, sizeof(dummy_ph)); @@ -658,7 +663,7 @@ void Test_CF_CFDP_R_ProcessFd_HasCrcBut_bytes_received_Minus_4_IsLessThan_size_o transaction_t *arg_t = &dummy_t; CFE_MSG_Size_t dummy_bytes_received; CFE_MSG_Size_t *arg_bytes_received = &dummy_bytes_received; - CFE_MSG_Size_t initial_bytes_received = Any_uint32_LessThan(sizeof(pdu_file_data_header_t)) + 4; + CFE_MSG_Size_t initial_bytes_received = Any_uint32_LessThan(sizeof(CF_CFDP_PduFileDataHeader_t)) + 4; int local_result; memset(&dummy_ph, 0, sizeof(dummy_ph)); @@ -691,18 +696,19 @@ void Test_CF_CFDP_R_ProcessFd_NoCrc_cached_pos_NotEqTo_offset_And_fret_NotEqTo_o transaction_t dummy_t; transaction_t *arg_t = &dummy_t; CFE_MSG_Size_t dummy_bytes_received; - CFE_MSG_Size_t *arg_bytes_received = &dummy_bytes_received; - CFE_MSG_Size_t initial_bytes_received = Any_uint32_GreaterThan(sizeof( - pdu_file_data_header_t)); /*TODO Any_uint32_GreaterThan runs test fine, but should really be an unsigned long */ - uint16 initial_fault_file_seek = Any_uint16(); - int local_result; + CFE_MSG_Size_t *arg_bytes_received = &dummy_bytes_received; + CFE_MSG_Size_t initial_bytes_received = + Any_uint32_GreaterThan(sizeof(CF_CFDP_PduFileDataHeader_t)); /*TODO Any_uint32_GreaterThan runs test fine, but + should really be an unsigned long */ + uint16 initial_fault_file_seek = Any_uint16(); + int local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; CF_AppData.engine.in.bytes_received = initial_bytes_received; - UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(pdu_header_t)); + UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(CF_CFDP_PduHeader_t)); UT_SetDefaultReturnValue(UT_KEY(FGV), 0); dummy_msg.content.cfdp.secondary.fdatah.offset = dummy_offset; @@ -740,18 +746,19 @@ void Test_CF_CFDP_R_ProcessFd_NoCrc_fret_NotEqTo_bytes_received_Value_SendEventS transaction_t dummy_t; transaction_t *arg_t = &dummy_t; CFE_MSG_Size_t dummy_bytes_received; - CFE_MSG_Size_t *arg_bytes_received = &dummy_bytes_received; - CFE_MSG_Size_t initial_bytes_received = Any_uint32_GreaterThan(sizeof( - pdu_file_data_header_t)); /*TODO Any_uint32_GreaterThan runs test fine, but should really be an unsigned long */ - uint16 initial_fault_file_write = Any_uint16(); - int local_result; + CFE_MSG_Size_t *arg_bytes_received = &dummy_bytes_received; + CFE_MSG_Size_t initial_bytes_received = + Any_uint32_GreaterThan(sizeof(CF_CFDP_PduFileDataHeader_t)); /*TODO Any_uint32_GreaterThan runs test fine, but + should really be an unsigned long */ + uint16 initial_fault_file_write = Any_uint16(); + int local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; CF_AppData.engine.in.bytes_received = initial_bytes_received; - UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(pdu_header_t)); + UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(CF_CFDP_PduHeader_t)); UT_SetDefaultReturnValue(UT_KEY(FGV), 0); dummy_msg.content.cfdp.secondary.fdatah.offset = dummy_offset; @@ -791,20 +798,21 @@ void Test_CF_CFDP_R_ProcessFd_NoCrc_cached_pos_Gets_bytes_received_Plus_offset_A CFE_MSG_Size_t dummy_bytes_received; CFE_MSG_Size_t *arg_bytes_received = &dummy_bytes_received; uint32 fake_bytes_received = - Any_uint32_BetweenExcludeMax(4 + sizeof(pdu_header_t) + sizeof(pdu_file_data_header_t), + Any_uint32_BetweenExcludeMax(4 + sizeof(CF_CFDP_PduHeader_t) + sizeof(CF_CFDP_PduFileDataHeader_t), UINT16_MAX); /*TODO Any_uint32_GreaterThan runs test fine, but should really be an unsigned long , UINT16_MAX used for size constraint testability */ CFE_MSG_Size_t initial_bytes_received = fake_bytes_received; - CFE_MSG_Size_t updated_bytes_received = fake_bytes_received - sizeof(pdu_file_data_header_t) - sizeof(pdu_header_t); - uint64 initial_file_data_bytes = Any_uint64(); - int local_result; + CFE_MSG_Size_t updated_bytes_received = + fake_bytes_received - sizeof(CF_CFDP_PduFileDataHeader_t) - sizeof(CF_CFDP_PduHeader_t); + uint64 initial_file_data_bytes = Any_uint64(); + int local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; CF_AppData.engine.in.bytes_received = initial_bytes_received; - UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(pdu_header_t)); + UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(CF_CFDP_PduHeader_t)); UT_SetDefaultReturnValue(UT_KEY(FGV), 0); dummy_msg.content.cfdp.secondary.fdatah.offset = dummy_offset; @@ -849,20 +857,21 @@ void Test_CF_CFDP_R_ProcessFd_NoCrc_cached_pos_NotEqTo_offset_But_fret_IsEqTo_of CFE_MSG_Size_t dummy_bytes_received; CFE_MSG_Size_t *arg_bytes_received = &dummy_bytes_received; uint32 fake_bytes_received = - Any_uint32_BetweenExcludeMax(4 + sizeof(pdu_header_t) + sizeof(pdu_file_data_header_t), + Any_uint32_BetweenExcludeMax(4 + sizeof(CF_CFDP_PduHeader_t) + sizeof(CF_CFDP_PduFileDataHeader_t), UINT16_MAX); /*TODO Any_uint32_GreaterThan runs test fine, but should really be an unsigned long , UINT16_MAX used for size constraint testability */ CFE_MSG_Size_t initial_bytes_received = fake_bytes_received; - CFE_MSG_Size_t updated_bytes_received = fake_bytes_received - sizeof(pdu_file_data_header_t) - sizeof(pdu_header_t); - uint64 initial_file_data_bytes = Any_uint64(); - int local_result; + CFE_MSG_Size_t updated_bytes_received = + fake_bytes_received - sizeof(CF_CFDP_PduFileDataHeader_t) - sizeof(CF_CFDP_PduHeader_t); + uint64 initial_file_data_bytes = Any_uint64(); + int local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; CF_AppData.engine.in.bytes_received = initial_bytes_received; - UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(pdu_header_t)); + UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(CF_CFDP_PduHeader_t)); UT_SetDefaultReturnValue(UT_KEY(FGV), 0); dummy_msg.content.cfdp.secondary.fdatah.offset = dummy_offset; @@ -909,12 +918,12 @@ void Test_CF_CFDP_R_SubstateRecvEof_CallTo_CF_CFDP_RecvEof_Returns_non0_SendEven void) { /* Arrange */ - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_header_t *arg_ph = NULL; - uint32 initial_recv_error = Any_uint32(); - int local_result; + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduHeader_t *arg_ph = NULL; + uint32 initial_recv_error = Any_uint32(); + int local_result; UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_RecvEof), Any_uint32_Except(0)); @@ -941,13 +950,13 @@ void Test_CF_CFDP_R_SubstateRecvEof_md_recv_IsEqTo_1_And_ph_size_IsNotEqTo_t_fsi void) { /* Arrange */ - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_eof_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; - uint16 initial_file_size_mismatch = Any_uint16(); - int local_result; + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduEof_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; + uint16 initial_file_size_mismatch = Any_uint16(); + int local_result; UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_RecvEof), 0); @@ -977,13 +986,13 @@ void Test_CF_CFDP_R_SubstateRecvEof_md_recv_IsEqTo_1_And_ph_size_IsNotEqTo_t_fsi void Test_CF_CFDP_R_SubstateRecvEof_md_recv_IsEqTo_0_And_ph_size_IsNotEqTo_t_fsize_Return_R_EOF_SUCCESS(void) { /* Arrange */ - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_eof_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; - uint16 initial_file_size_mismatch = Any_uint16(); - int local_result; + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduEof_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; + uint16 initial_file_size_mismatch = Any_uint16(); + int local_result; UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_RecvEof), 0); @@ -1009,13 +1018,13 @@ void Test_CF_CFDP_R_SubstateRecvEof_md_recv_IsEqTo_0_And_ph_size_IsNotEqTo_t_fsi void Test_CF_CFDP_R_SubstateRecvEof_md_recv_IsEqTo_1_And_ph_size_IsEqTo_t_fsize_Return_R_EOF_SUCCESS(void) { /* Arrange */ - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_eof_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; - uint16 initial_file_size_mismatch = Any_uint16(); - int local_result; + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduEof_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; + uint16 initial_file_size_mismatch = Any_uint16(); + int local_result; UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_RecvEof), 0); @@ -1051,11 +1060,11 @@ void Test_CF_CFDP_R1_SubstateRecvEof_CallTo_CF_CFDP_R_SubstateRecvEof_NotEqTo_R_ void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_eof_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; - uint32 initial_keep = Any_uint8_Except(1); + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduEof_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; + uint32 initial_keep = Any_uint8_Except(1); arg_t->keep = initial_keep; @@ -1082,11 +1091,11 @@ void Test_CF_CFDP_R1_SubstateRecvEof_CallTo_CF_CFDP_R_SubstateRecvEof_NotEqTo_R_ void Test_CF_CFDP_R1_SubstateRecvEof_CallTo_CF_CFDP_R_CheckCrc_Returns_non0_DoNotSetGiven_t_keep_To_1(void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_eof_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; - uint32 initial_keep = Any_uint8_Except(1); + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduEof_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; + uint32 initial_keep = Any_uint8_Except(1); dummy_ph.crc = Any_uint32(); @@ -1125,11 +1134,11 @@ void Test_CF_CFDP_R1_SubstateRecvEof_CallTo_CF_CFDP_R_CheckCrc_Returns_non0_DoNo void Test_CF_CFDP_R1_SubstateRecvEof_SetGiven_t_keep_To_1(void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_eof_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; - uint32 initial_keep = Any_uint8_Except(1); + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduEof_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; + uint32 initial_keep = Any_uint8_Except(1); dummy_ph.crc = Any_uint32(); @@ -1176,9 +1185,9 @@ void Test_CF_CFDP_R1_SubstateRecvEof_SetGiven_t_keep_To_1(void) void Test_CF_CFDP_R2_SubstateRecvEof_Given_t_flags_rx_eof_recv_Is_1_DoNothing(void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_header_t *arg_ph = NULL; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduHeader_t *arg_ph = NULL; arg_t->flags.rx.eof_recv = 1; @@ -1194,9 +1203,9 @@ void Test_CF_CFDP_R2_SubstateRecvEof_CallTo_CF_CFDP_R_SubstateRecvEof_ReturnsAny void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_header_t *arg_ph = NULL; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduHeader_t *arg_ph = NULL; arg_t->flags.rx.eof_recv = 0; @@ -1228,10 +1237,10 @@ void Test_CF_CFDP_R2_SubstateRecvEof_CallTo_CF_CFDP_R_SubstateRecvEof_Returns_R_ void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_eof_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduEof_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; arg_t->flags.rx.eof_recv = 0; @@ -1241,14 +1250,14 @@ void Test_CF_CFDP_R2_SubstateRecvEof_CallTo_CF_CFDP_R_SubstateRecvEof_Returns_R_ UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_RecvEof), 0); /* TODO: int32 used because stub is not yet using new handler style */ - arg_t->flags.rx.md_recv = 1; - ((pdu_eof_t *)arg_ph)->size = Any_uint32(); - arg_t->fsize = Any_uint32_Except(((pdu_eof_t *)arg_ph)->size); + arg_t->flags.rx.md_recv = 1; + ((CF_CFDP_PduEof_t *)arg_ph)->size = Any_uint32(); + arg_t->fsize = Any_uint32_Except(((CF_CFDP_PduEof_t *)arg_ph)->size); arg_t->history = &dummy_history; /* Arrange for CF_CFDP_R2_SetCc */ - arg_t->history->cc = Any_uint8_Except(CC_FILE_SIZE_ERROR); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_FILE_SIZE_ERROR); /* Act */ CF_CFDP_R2_SubstateRecvEof(arg_t, arg_ph); @@ -1257,8 +1266,9 @@ void Test_CF_CFDP_R2_SubstateRecvEof_CallTo_CF_CFDP_R_SubstateRecvEof_Returns_R_ /* Assert for CF_CFDP_R_SubstateRecvEof */ UtAssert_STUB_COUNT(CF_CFDP_RecvEof, 1); /* Assert for CF_CFDP_R2_SetCc */ - UtAssert_True(arg_t->history->cc == CC_FILE_SIZE_ERROR, - "t->history->cc is %u and should be %u (CC_FILE_SIZE_ERROR)", arg_t->history->cc, CC_FILE_SIZE_ERROR); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILE_SIZE_ERROR, + "t->history->cc is %u and should be %u (CF_CFDP_ConditionCode_FILE_SIZE_ERROR)", arg_t->history->cc, + CF_CFDP_ConditionCode_FILE_SIZE_ERROR); } /* end Test_CF_CFDP_R2_SubstateRecvEof_CallTo_CF_CFDP_R_SubstateRecvEof_Returns_R_EOF_FSIZE_MISMATCH_Call_CF_CFDP_R2_SetCc */ @@ -1267,29 +1277,29 @@ void Test_CF_CFDP_R2_SubstateRecvEof_CallTo_CF_CFDP_R_SubstateRecvEof_Returns_R_ void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_eof_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduEof_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; arg_t->flags.rx.eof_recv = 0; - UT_SetDefaultReturnValue(UT_KEY(FGV), CC_NO_ERROR); + UT_SetDefaultReturnValue(UT_KEY(FGV), CF_CFDP_ConditionCode_NO_ERROR); /* Arrange for CF_CFDP_R_SubstateRecvEof */ UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_RecvEof), 0); /* TODO: int32 used because stub is not yet using new handler style */ - arg_t->flags.rx.md_recv = 1; - ((pdu_eof_t *)arg_ph)->size = Any_uint32(); - arg_t->fsize = ((pdu_eof_t *)arg_ph)->size; + arg_t->flags.rx.md_recv = 1; + ((CF_CFDP_PduEof_t *)arg_ph)->size = Any_uint32(); + arg_t->fsize = ((CF_CFDP_PduEof_t *)arg_ph)->size; /* Arrange for CF_CFDP_R2_Complete */ history_t dummy_history; cf_config_table_t dummy_config_table; arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->flags.rx.md_recv = 0; arg_t->state_data.r.r2.counter.nak = 0; CF_AppData.config_table = &dummy_config_table; @@ -1314,22 +1324,22 @@ void Test_CF_CFDP_R2_SubstateRecvEof_CallTo_CF_CFDP_R_SubstateRecvEof_Returns_R_ void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_eof_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduEof_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; arg_t->flags.rx.eof_recv = 0; - UT_SetDefaultReturnValue(UT_KEY(FGV), Any_uint8_Except(CC_NO_ERROR)); + UT_SetDefaultReturnValue(UT_KEY(FGV), Any_uint8_Except(CF_CFDP_ConditionCode_NO_ERROR)); /* Arrange for CF_CFDP_R_SubstateRecvEof */ UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_RecvEof), 0); /* TODO: int32 used because stub is not yet using new handler style */ - arg_t->flags.rx.md_recv = 1; - ((pdu_eof_t *)arg_ph)->size = Any_uint32(); - arg_t->fsize = ((pdu_eof_t *)arg_ph)->size; + arg_t->flags.rx.md_recv = 1; + ((CF_CFDP_PduEof_t *)arg_ph)->size = Any_uint32(); + arg_t->fsize = ((CF_CFDP_PduEof_t *)arg_ph)->size; /* Act */ CF_CFDP_R2_SubstateRecvEof(arg_t, arg_ph); @@ -1353,9 +1363,9 @@ void Test_CF_CFDP_R2_SubstateRecvEof_CallTo_CF_CFDP_R_SubstateRecvEof_Returns_R_ void Test_CF_CFDP_R1_SubstateRecvFileData_CallTo_CF_CFDP_RecvFd_Returns_non0_Call_CF_CFDP_R1_Reset(void) { /* Arrange */ - transaction_t *arg_t = NULL; - pdu_header_t *arg_ph = NULL; - int forced_return_CF_CFDP_RecvFd = Any_int_Except(0); + transaction_t *arg_t = NULL; + CF_CFDP_PduHeader_t *arg_ph = NULL; + int forced_return_CF_CFDP_RecvFd = Any_int_Except(0); UT_SetHandlerFunction(UT_KEY(CF_CFDP_RecvFd), Handler_int_ForcedReturnOnly, &forced_return_CF_CFDP_RecvFd); @@ -1374,9 +1384,9 @@ void Test_CF_CFDP_R1_SubstateRecvFileData_CallTo_CF_CFDP_RecvFd_Returns_0_CallTo void) { /* Arrange */ - transaction_t *arg_t = NULL; - pdu_header_t *arg_ph = NULL; - int forced_return_CF_CFDP_RecvFd = 0; + transaction_t *arg_t = NULL; + CF_CFDP_PduHeader_t *arg_ph = NULL; + int forced_return_CF_CFDP_RecvFd = 0; UT_SetHandlerFunction(UT_KEY(CF_CFDP_RecvFd), Handler_int_ForcedReturnOnly, &forced_return_CF_CFDP_RecvFd); @@ -1406,9 +1416,9 @@ void Test_CF_CFDP_R1_SubstateRecvFileData_CallTo_CF_CFDP_RecvFd_Returns_0_CallTo void) { /* Arrange */ - transaction_t *arg_t = NULL; - pdu_header_t *arg_ph = NULL; - int forced_return_CF_CFDP_RecvFd = 0; + transaction_t *arg_t = NULL; + CF_CFDP_PduHeader_t *arg_ph = NULL; + int forced_return_CF_CFDP_RecvFd = 0; UT_SetHandlerFunction(UT_KEY(CF_CFDP_RecvFd), Handler_int_ForcedReturnOnly, &forced_return_CF_CFDP_RecvFd); @@ -1418,12 +1428,13 @@ void Test_CF_CFDP_R1_SubstateRecvFileData_CallTo_CF_CFDP_RecvFd_Returns_0_CallTo CF_UT_inmsg_buffer_t dummy_msg; history_t dummy_history; uint32 fake_bytes_received = - Any_uint32_BetweenExcludeMax(4 + sizeof(pdu_header_t) + sizeof(pdu_file_data_header_t), + Any_uint32_BetweenExcludeMax(4 + sizeof(CF_CFDP_PduHeader_t) + sizeof(CF_CFDP_PduFileDataHeader_t), UINT16_MAX); /*TODO Any_uint32_GreaterThan runs test fine, but should really be an unsigned long , UINT16_MAX used for size constraint testability */ CFE_MSG_Size_t initial_bytes_received = fake_bytes_received; - CFE_MSG_Size_t updated_bytes_received = fake_bytes_received - sizeof(pdu_file_data_header_t) - sizeof(pdu_header_t); - uint64 initial_file_data_bytes = Any_uint64(); + CFE_MSG_Size_t updated_bytes_received = + fake_bytes_received - sizeof(CF_CFDP_PduFileDataHeader_t) - sizeof(CF_CFDP_PduHeader_t); + uint64 initial_file_data_bytes = Any_uint64(); memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -1431,7 +1442,7 @@ void Test_CF_CFDP_R1_SubstateRecvFileData_CallTo_CF_CFDP_RecvFd_Returns_0_CallTo CF_AppData.engine.in.bytes_received = initial_bytes_received; - UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(pdu_header_t)); + UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(CF_CFDP_PduHeader_t)); UT_SetDefaultReturnValue(UT_KEY(FGV), 0); dummy_msg.content.cfdp.secondary.fdatah.offset = dummy_offset; @@ -1471,9 +1482,9 @@ void Test_CF_CFDP_R1_SubstateRecvFileData_CallTo_CF_CFDP_RecvFd_Returns_0_CallTo void Test_CF_CFDP_R2_SubstateRecvFileData_CallTo_CF_CFDP_RecvFd_Returns_non0_Call_CF_CFDP_R2_Reset(void) { /* Arrange */ - transaction_t *arg_t = NULL; - pdu_header_t *arg_ph = NULL; - int forced_return_CF_CFDP_RecvFd = Any_int_Except(0); + transaction_t *arg_t = NULL; + CF_CFDP_PduHeader_t *arg_ph = NULL; + int forced_return_CF_CFDP_RecvFd = Any_int_Except(0); UT_SetHandlerFunction(UT_KEY(CF_CFDP_RecvFd), Handler_int_ForcedReturnOnly, &forced_return_CF_CFDP_RecvFd); @@ -1499,9 +1510,9 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_CallTo_CF_CFDP_RecvFd_Returns_0_CallTo void) { /* Arrange */ - transaction_t *arg_t = NULL; - pdu_header_t *arg_ph = NULL; - int forced_return_CF_CFDP_RecvFd = 0; + transaction_t *arg_t = NULL; + CF_CFDP_PduHeader_t *arg_ph = NULL; + int forced_return_CF_CFDP_RecvFd = 0; UT_SetHandlerFunction(UT_KEY(CF_CFDP_RecvFd), Handler_int_ForcedReturnOnly, &forced_return_CF_CFDP_RecvFd); @@ -1532,11 +1543,11 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_0_And_t_flag void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_header_t dummy_arg_ph; - pdu_header_t *arg_ph = &dummy_arg_ph; - int forced_return_CF_CFDP_RecvFd = 0; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduHeader_t dummy_arg_ph; + CF_CFDP_PduHeader_t *arg_ph = &dummy_arg_ph; + int forced_return_CF_CFDP_RecvFd = 0; UT_SetHandlerFunction(UT_KEY(CF_CFDP_RecvFd), Handler_int_ForcedReturnOnly, &forced_return_CF_CFDP_RecvFd); @@ -1551,12 +1562,13 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_0_And_t_flag CF_UT_inmsg_buffer_t dummy_msg; history_t dummy_history; uint32 fake_bytes_received = - Any_uint32_BetweenExcludeMax(4 + sizeof(pdu_header_t) + sizeof(pdu_file_data_header_t), + Any_uint32_BetweenExcludeMax(4 + sizeof(CF_CFDP_PduHeader_t) + sizeof(CF_CFDP_PduFileDataHeader_t), UINT16_MAX); /*TODO Any_uint32_GreaterThan runs test fine, but should really be an unsigned long , UINT16_MAX used for size constraint testability */ CFE_MSG_Size_t initial_bytes_received = fake_bytes_received; - CFE_MSG_Size_t updated_bytes_received = fake_bytes_received - sizeof(pdu_file_data_header_t) - sizeof(pdu_header_t); - uint64 initial_file_data_bytes = Any_uint64(); + CFE_MSG_Size_t updated_bytes_received = + fake_bytes_received - sizeof(CF_CFDP_PduFileDataHeader_t) - sizeof(CF_CFDP_PduHeader_t); + uint64 initial_file_data_bytes = Any_uint64(); memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -1564,7 +1576,7 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_0_And_t_flag CF_AppData.engine.in.bytes_received = initial_bytes_received; - UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(pdu_header_t)); + UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(CF_CFDP_PduHeader_t)); UT_SetDefaultReturnValue(UT_KEY(FGV), 0); dummy_msg.content.cfdp.secondary.fdatah.offset = dummy_offset; @@ -1596,11 +1608,11 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_1_Call_CF_CF void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_header_t dummy_arg_ph; - pdu_header_t *arg_ph = &dummy_arg_ph; - int forced_return_CF_CFDP_RecvFd = 0; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduHeader_t dummy_arg_ph; + CF_CFDP_PduHeader_t *arg_ph = &dummy_arg_ph; + int forced_return_CF_CFDP_RecvFd = 0; UT_SetHandlerFunction(UT_KEY(CF_CFDP_RecvFd), Handler_int_ForcedReturnOnly, &forced_return_CF_CFDP_RecvFd); @@ -1615,12 +1627,13 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_1_Call_CF_CF CF_UT_inmsg_buffer_t dummy_msg; history_t dummy_history; uint32 fake_bytes_received = - Any_uint32_BetweenExcludeMax(4 + sizeof(pdu_header_t) + sizeof(pdu_file_data_header_t), + Any_uint32_BetweenExcludeMax(4 + sizeof(CF_CFDP_PduHeader_t) + sizeof(CF_CFDP_PduFileDataHeader_t), UINT16_MAX); /*TODO Any_uint32_GreaterThan runs test fine, but should really be an unsigned long , UINT16_MAX used for size constraint testability */ CFE_MSG_Size_t initial_bytes_received = fake_bytes_received; - CFE_MSG_Size_t updated_bytes_received = fake_bytes_received - sizeof(pdu_file_data_header_t) - sizeof(pdu_header_t); - uint64 initial_file_data_bytes = Any_uint64(); + CFE_MSG_Size_t updated_bytes_received = + fake_bytes_received - sizeof(CF_CFDP_PduFileDataHeader_t) - sizeof(CF_CFDP_PduHeader_t); + uint64 initial_file_data_bytes = Any_uint64(); memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -1628,7 +1641,7 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_1_Call_CF_CF CF_AppData.engine.in.bytes_received = initial_bytes_received; - UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(pdu_header_t)); + UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(CF_CFDP_PduHeader_t)); UT_SetDefaultReturnValue(UT_KEY(FGV), 0); dummy_msg.content.cfdp.secondary.fdatah.offset = dummy_offset; @@ -1641,7 +1654,7 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_1_Call_CF_CF CF_AppData.hk.channel_hk[arg_t->chan_num].counters.recv.file_data_bytes = initial_file_data_bytes; /* Arrange for CF_CFDP_R2_Complete */ - arg_t->history->cc = Any_uint8_Except(CC_NO_ERROR); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_NO_ERROR); /* Act */ CF_CFDP_R2_SubstateRecvFileData(arg_t, arg_ph); @@ -1663,11 +1676,11 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_0_And_t_flag void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_header_t dummy_arg_ph; - pdu_header_t *arg_ph = &dummy_arg_ph; - int forced_return_CF_CFDP_RecvFd = 0; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduHeader_t dummy_arg_ph; + CF_CFDP_PduHeader_t *arg_ph = &dummy_arg_ph; + int forced_return_CF_CFDP_RecvFd = 0; UT_SetHandlerFunction(UT_KEY(CF_CFDP_RecvFd), Handler_int_ForcedReturnOnly, &forced_return_CF_CFDP_RecvFd); @@ -1682,12 +1695,13 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_0_And_t_flag CF_UT_inmsg_buffer_t dummy_msg; history_t dummy_history; uint32 fake_bytes_received = - Any_uint32_BetweenExcludeMax(4 + sizeof(pdu_header_t) + sizeof(pdu_file_data_header_t), + Any_uint32_BetweenExcludeMax(4 + sizeof(CF_CFDP_PduHeader_t) + sizeof(CF_CFDP_PduFileDataHeader_t), UINT16_MAX); /*TODO Any_uint32_GreaterThan runs test fine, but should really be an unsigned long , UINT16_MAX used for size constraint testability */ CFE_MSG_Size_t initial_bytes_received = fake_bytes_received; - CFE_MSG_Size_t updated_bytes_received = fake_bytes_received - sizeof(pdu_file_data_header_t) - sizeof(pdu_header_t); - uint64 initial_file_data_bytes = Any_uint64(); + CFE_MSG_Size_t updated_bytes_received = + fake_bytes_received - sizeof(CF_CFDP_PduFileDataHeader_t) - sizeof(CF_CFDP_PduHeader_t); + uint64 initial_file_data_bytes = Any_uint64(); memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -1695,7 +1709,7 @@ void Test_CF_CFDP_R2_SubstateRecvFileData_t_flags_rx_fd_nak_sent_Is_0_And_t_flag CF_AppData.engine.in.bytes_received = initial_bytes_received; - UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(pdu_header_t)); + UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(CF_CFDP_PduHeader_t)); UT_SetDefaultReturnValue(UT_KEY(FGV), 0); dummy_msg.content.cfdp.secondary.fdatah.offset = dummy_offset; @@ -1816,8 +1830,8 @@ void Test_CF_CFDP_R_SubstateSendNak_Given_t_md_recv_Is_0_SendEvent_CallTo_CF_CFD history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_nak; - pdu_header_t *dummy_ph = (pdu_header_t *)&dummy_nak; + CF_CFDP_PduNak_t dummy_nak; + CF_CFDP_PduHeader_t *dummy_ph = (CF_CFDP_PduHeader_t *)&dummy_nak; CF_CFDP_ConstructPduHeader_context_t context_CF_CFDP_ConstructPduHeader; CF_CFDP_SendNak_context_t context_CF_CFDP_SendNak; uint8 exceptions[2] = {CF_SEND_ERROR, CF_SEND_SUCCESS}; @@ -1852,8 +1866,8 @@ void Test_CF_CFDP_R_SubstateSendNak_AssertsBecauseGiven_t_md_recv_Is_0_SendEvent // history_t dummy_history; // transaction_t dummy_t; // transaction_t* arg_t = &dummy_t; - // pdu_nak_t dummy_nak; - // pdu_header_t* dummy_ph = (pdu_header_t*)&dummy_nak; + // CF_CFDP_PduNak_t dummy_nak; + // CF_CFDP_PduHeader_t* dummy_ph = (CF_CFDP_PduHeader_t*)&dummy_nak; // CF_CFDP_ConstructPduHeader_context_t context_CF_CFDP_ConstructPduHeader; // CF_CFDP_SendNak_context_t context_CF_CFDP_SendNak; // int local_result; @@ -1891,8 +1905,8 @@ void Test_CF_CFDP_R_SubstateSendNak_Given_t_md_recv_Is_0_SendEvent_CallTo_CF_CFD history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_nak; - pdu_header_t *dummy_ph = (pdu_header_t *)&dummy_nak; + CF_CFDP_PduNak_t dummy_nak; + CF_CFDP_PduHeader_t *dummy_ph = (CF_CFDP_PduHeader_t *)&dummy_nak; CF_CFDP_ConstructPduHeader_context_t context_CF_CFDP_ConstructPduHeader; CF_CFDP_SendNak_context_t context_CF_CFDP_SendNak; int local_result; @@ -1927,8 +1941,8 @@ void Test_CF_CFDP_R_SubstateSendNak_Given_t_md_recv_Is_1_CallTo_CF_Chunks_Comput history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_nak; - pdu_header_t *dummy_ph = (pdu_header_t *)&dummy_nak; + CF_CFDP_PduNak_t dummy_nak; + CF_CFDP_PduHeader_t *dummy_ph = (CF_CFDP_PduHeader_t *)&dummy_nak; CF_CFDP_ConstructPduHeader_context_t context_CF_CFDP_ConstructPduHeader; CF_CFDP_SendNak_context_t context_CF_CFDP_SendNak; uint8 exceptions[2] = {CF_SEND_ERROR, CF_SEND_SUCCESS}; @@ -1968,8 +1982,8 @@ void Test_CF_CFDP_R_SubstateSendNak_AssertsBecauseGiven_t_md_recv_Is_1_CallTo_CF // history_t dummy_history; // transaction_t dummy_t; // transaction_t* arg_t = &dummy_t; - // pdu_nak_t dummy_nak; - // pdu_header_t* dummy_ph = (pdu_header_t*)&dummy_nak; + // CF_CFDP_PduNak_t dummy_nak; + // CF_CFDP_PduHeader_t* dummy_ph = (CF_CFDP_PduHeader_t*)&dummy_nak; // CF_CFDP_ConstructPduHeader_context_t context_CF_CFDP_ConstructPduHeader; // CF_CFDP_SendNak_context_t context_CF_CFDP_SendNak; @@ -2011,8 +2025,8 @@ void Test_CF_CFDP_R_SubstateSendNak_Given_t_md_recv_Is_1_CallTo_CF_Chunks_Comput history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_nak; - pdu_header_t *dummy_ph = (pdu_header_t *)&dummy_nak; + CF_CFDP_PduNak_t dummy_nak; + CF_CFDP_PduHeader_t *dummy_ph = (CF_CFDP_PduHeader_t *)&dummy_nak; CF_CFDP_ConstructPduHeader_context_t context_CF_CFDP_ConstructPduHeader; CF_CFDP_SendNak_context_t context_CF_CFDP_SendNak; int local_result; @@ -2051,8 +2065,8 @@ void Test_CF_CFDP_R_SubstateSendNak_Given_t_md_recv_Is_1_CallTo_CF_Chunks_Comput history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_nak; - pdu_header_t *dummy_ph = (pdu_header_t *)&dummy_nak; + CF_CFDP_PduNak_t dummy_nak; + CF_CFDP_PduHeader_t *dummy_ph = (CF_CFDP_PduHeader_t *)&dummy_nak; CF_CFDP_ConstructPduHeader_context_t context_CF_CFDP_ConstructPduHeader; int local_result; @@ -2089,8 +2103,8 @@ void Test_CF_CFDP_R_SubstateSendNak_Given_t_md_recv_Is_1_CallTo_CF_Chunks_Comput history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_nak; - pdu_header_t *dummy_ph = (pdu_header_t *)&dummy_nak; + CF_CFDP_PduNak_t dummy_nak; + CF_CFDP_PduHeader_t *dummy_ph = (CF_CFDP_PduHeader_t *)&dummy_nak; CF_CFDP_ConstructPduHeader_context_t context_CF_CFDP_ConstructPduHeader; int local_result; @@ -2127,8 +2141,8 @@ void Test_CF_CFDP_R_SubstateSendNak_Given_t_md_recv_Is_1_CallTo_CF_Chunks_Comput history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_nak; - pdu_header_t *dummy_ph = (pdu_header_t *)&dummy_nak; + CF_CFDP_PduNak_t dummy_nak; + CF_CFDP_PduHeader_t *dummy_ph = (CF_CFDP_PduHeader_t *)&dummy_nak; CF_CFDP_ConstructPduHeader_context_t context_CF_CFDP_ConstructPduHeader; int local_result; @@ -2273,7 +2287,7 @@ void Test_CF_CFDP_R_Init_StateIs_CFDP_R2_AndCallTo_CF_WrappedCreat_ReturnedNegat CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_open = initial_file_open; /* Arrange for CF_CFDP_R2_SetCc */ - arg_t->history->cc = Any_uint8_Except(CC_FILESTORE_REJECTION); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Act */ CF_CFDP_R_Init(arg_t); @@ -2292,9 +2306,9 @@ void Test_CF_CFDP_R_Init_StateIs_CFDP_R2_AndCallTo_CF_WrappedCreat_ReturnedNegat "file_open is %u and should be 1 more than %u (value before call)", CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_open, initial_file_open); /* Assert unstubbable - CF_CFDP_R2_SetCc */ - UtAssert_True(arg_t->history->cc == CC_FILESTORE_REJECTION, - "t->history->cc is %u and should be %u (CC_FILESTORE_REJECTION)", arg_t->history->cc, - CC_FILESTORE_REJECTION); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILESTORE_REJECTION, + "t->history->cc is %u and should be %u (CF_CFDP_ConditionCode_FILESTORE_REJECTION)", + arg_t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); } /* end Test_CF_CFDP_R_Init_StateIs_CFDP_R2_AndCallTo_CF_WrappedCreat_ReturnedNegativeSendEventThenIncrement_file_open_But_t_state_IsEqTo_CFDP_R2_SoCall_CFDP_R2_SetCc */ @@ -2328,7 +2342,7 @@ void Test_CF_CFDP_R_Init_StateIs_CFDP_R2_And_t_flags_rx_md_recv_Is_0_SendEventTh CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_open = initial_file_open; /* Arrange for CF_CFDP_R2_SetCc */ - arg_t->history->cc = Any_uint8_Except(CC_FILESTORE_REJECTION); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Act */ CF_CFDP_R_Init(arg_t); @@ -2479,8 +2493,8 @@ void Test_CF_CFDP_R2_CalcCrcChunk_Given_t_state_data_r_r2_rx_crc_calc_bytes_Is_N arg_t->keep = 0; - arg_t->state_data.r.r2.dc = Any_uint8_Except(FIN_COMPLETE); - arg_t->state_data.r.r2.fs = Any_uint8_Except(FIN_RETAINED); + arg_t->state_data.r.r2.dc = Any_uint8_Except(CF_CFDP_FinDeliveryCode_COMPLETE); + arg_t->state_data.r.r2.fs = Any_uint8_Except(CF_CFDP_FinFileStatus_RETAINED); arg_t->flags.com.crc_calc = 0; /* Arrange for CF_CFDP_R_CheckCrc */ @@ -2499,12 +2513,12 @@ void Test_CF_CFDP_R2_CalcCrcChunk_Given_t_state_data_r_r2_rx_crc_calc_bytes_Is_N UtAssert_True(local_result == 0, "CF_CFDP_R2_SubstateSendFin returned %d and should be 0", local_result); UtAssert_STUB_COUNT(CF_CRC_Start, 0); UtAssert_True(arg_t->keep == 1, "t->keep is %u and should be 1", arg_t->keep); - UtAssert_True(arg_t->state_data.r.r2.dc == FIN_COMPLETE, - "t->state_data.r.r2.dc is %u and should be %u (FIN_COMPLETE)", arg_t->state_data.r.r2.dc, - FIN_COMPLETE); - UtAssert_True(arg_t->state_data.r.r2.fs == FIN_RETAINED, - "t->state_data.r.r2.fs is %u and should be %u (FIN_RETAINED)", arg_t->state_data.r.r2.fs, - FIN_RETAINED); + UtAssert_True(arg_t->state_data.r.r2.dc == CF_CFDP_FinDeliveryCode_COMPLETE, + "t->state_data.r.r2.dc is %u and should be %u (CF_CFDP_FinDeliveryCode_COMPLETE)", + arg_t->state_data.r.r2.dc, CF_CFDP_FinDeliveryCode_COMPLETE); + UtAssert_True(arg_t->state_data.r.r2.fs == CF_CFDP_FinFileStatus_RETAINED, + "t->state_data.r.r2.fs is %u and should be %u (CF_CFDP_FinFileStatus_RETAINED)", + arg_t->state_data.r.r2.fs, CF_CFDP_FinFileStatus_RETAINED); UtAssert_True(arg_t->flags.com.crc_calc == 1, "t->flags.com.crc_calc is %u and should be 1", arg_t->flags.com.crc_calc); } /* end @@ -2537,7 +2551,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk_CAllTo_CF_WrappedLseek_ReturnsValueNotEqTo_RXC UT_SetDataBuffer(UT_KEY(CFE_EVS_SendEvent), &EventID, sizeof(EventID), false); arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except(CC_FILE_SIZE_ERROR); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_FILE_SIZE_ERROR); CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_seek = initial_file_seek; @@ -2551,9 +2565,9 @@ void Test_CF_CFDP_R2_CalcCrcChunk_CAllTo_CF_WrappedLseek_ReturnsValueNotEqTo_RXC UtAssert_True(EventID == CF_EID_ERR_CFDP_R_SEEK_CRC, "CFE_EVS_SendEvent receive event id %u and should receive %u (CF_EID_ERR_CFDP_R_SEEK_CRC)", EventID, CF_EID_ERR_CFDP_R_SEEK_CRC); - UtAssert_True(arg_t->history->cc == CC_FILE_SIZE_ERROR, - "t->flags.com.crc_calc is %u and should be %u (CC_FILE_SIZE_ERROR)", arg_t->history->cc, - CC_FILE_SIZE_ERROR); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILE_SIZE_ERROR, + "t->flags.com.crc_calc is %u and should be %u (CF_CFDP_ConditionCode_FILE_SIZE_ERROR)", + arg_t->history->cc, CF_CFDP_ConditionCode_FILE_SIZE_ERROR); UtAssert_True(CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_seek == (uint16)(initial_file_seek + 1), "fault.file_seek is %u and should be 1 more than %u (value before call)", CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_seek, initial_file_seek); @@ -2589,7 +2603,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk_CAllTo_CF_WrappedLseek_ReturnsValueEqTo_RXC_cr UT_SetDataBuffer(UT_KEY(CFE_EVS_SendEvent), &EventID, sizeof(EventID), false); arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except(CC_FILE_SIZE_ERROR); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_FILE_SIZE_ERROR); CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_read = initial_file_read; @@ -2603,9 +2617,9 @@ void Test_CF_CFDP_R2_CalcCrcChunk_CAllTo_CF_WrappedLseek_ReturnsValueEqTo_RXC_cr UtAssert_True(EventID == CF_EID_ERR_CFDP_R_READ, "CFE_EVS_SendEvent receive event id %u and should receive %u (CF_EID_ERR_CFDP_R_READ)", EventID, CF_EID_ERR_CFDP_R_READ); - UtAssert_True(arg_t->history->cc == CC_FILE_SIZE_ERROR, - "t->flags.com.crc_calc is %u and should be %u (CC_FILE_SIZE_ERROR)", arg_t->history->cc, - CC_FILE_SIZE_ERROR); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILE_SIZE_ERROR, + "t->flags.com.crc_calc is %u and should be %u (CF_CFDP_ConditionCode_FILE_SIZE_ERROR)", + arg_t->history->cc, CF_CFDP_ConditionCode_FILE_SIZE_ERROR); UtAssert_True(CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_read == (uint16)(initial_file_read + 1), "fault.file_seek is %u and should be 1 more than %u (value before call)", CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_read, initial_file_read); @@ -2641,7 +2655,7 @@ void Test_CF_CFDP_R2_CalcCrcChunk_Given_t_state_data_r_cached_pos_IsEqTo_RXC_Cal UT_SetDataBuffer(UT_KEY(CFE_EVS_SendEvent), &EventID, sizeof(EventID), false); arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except(CC_FILE_SIZE_ERROR); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_FILE_SIZE_ERROR); /* Arrange for CF_CFDP_R_CheckCrc */ cf_crc_t dummy_crc; @@ -2688,7 +2702,7 @@ void Test_CF_CFDP_R2_SubstateSendFin_Given_t_history_cc_IsEqTo_CC_NO_ERROR_And_t int local_result; arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->flags.com.crc_calc = 0; /* Arrange for CF_CFDP_R2_CalcCrcChunk */ @@ -2722,7 +2736,7 @@ void Test_CF_CFDP_R2_SubstateSendFin_AssertsBecauseCallTo_CF_CFDP_SendFin_Return // int local_result; // arg_t->history = &dummy_history; - // arg_t->history->cc = Any_uint8_Except(CC_NO_ERROR); + // arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_NO_ERROR); // arg_t->flags.com.crc_calc = 0; // UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_SendFin), CF_SEND_ERROR); @@ -2745,7 +2759,7 @@ void Test_CF_CFDP_R2_SubstateSendFin_Given_t_history_cc_IsEqTo_CC_NO_ERROR_CallT int local_result; arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except(CC_NO_ERROR); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_NO_ERROR); arg_t->flags.com.crc_calc = 0; UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_SendFin), Any_uint8_ExceptThese(exceptions, 2)); @@ -2775,7 +2789,7 @@ void Test_CF_CFDP_R2_SubstateSendFin_Given_t_flags_rx_crc_calc_Is_1_CallTo_CF_CF int local_result; arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->flags.com.crc_calc = 1; UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_SendFin), CF_SEND_SUCCESS); @@ -2805,7 +2819,7 @@ void Test_CF_CFDP_R2_SubstateSendFin_CallTo_CF_CFDP_R2_CalcCrcChunk_Returns_0_Gi int local_result; arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->flags.com.crc_calc = 0; UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_SendFin), CF_SEND_SUCCESS); @@ -2859,11 +2873,11 @@ void Test_CF_CFDP_R2_SubstateSendFin_CallTo_CF_CFDP_R2_CalcCrcChunk_Returns_0_Gi void Test_CF_CFDP_R2_Recv_fin_ack_GetsInvalidFinAckFrom_CF_CFDP_RecvAck_SendEventAndIncrement_recv_error(void) { /* Arrange */ - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - const pdu_header_t *arg_pdu = NULL; - uint32 initial_recv_error = Any_uint32(); + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + const CF_CFDP_PduHeader_t *arg_pdu = NULL; + uint32 initial_recv_error = Any_uint32(); UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_RecvAck), -1); /* -1 indicates error from CF_CFDP_RecvAck */ @@ -2889,11 +2903,11 @@ void Test_CF_CFDP_R2_Recv_fin_ack_GetsInvalidFinAckFrom_CF_CFDP_RecvAck_SendEven void Test_CF_CFDP_R2_Recv_fin_ack_GetsValidFinAckFrom_CF_CFDP_RecvAck_Calls_CFDP_R2_Reset(void) { /* Arrange */ - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - const pdu_header_t *arg_pdu = NULL; - uint32 initial_recv_error = Any_uint32(); + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + const CF_CFDP_PduHeader_t *arg_pdu = NULL; + uint32 initial_recv_error = Any_uint32(); UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_RecvAck), 0); /* 0 indicates success from CF_CFDP_RecvAck */ @@ -2906,8 +2920,8 @@ void Test_CF_CFDP_R2_Recv_fin_ack_GetsValidFinAckFrom_CF_CFDP_RecvAck_Calls_CFDP /* Assert unstubbable - CF_CFDP_R2_Reset setting to enter `else` block that sets send_fin */ /* settings for arg_t show it was sent to CF_CFDP_R2_Reset */ arg_t->state_data.r.sub_state = Any_uint8_Except(RECV_WAIT_FOR_FIN_ACK); - arg_t->state_data.r.r2.eof_cc = CC_NO_ERROR; - arg_t->history->cc = CC_NO_ERROR; + arg_t->state_data.r.r2.eof_cc = CF_CFDP_ConditionCode_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->flags.com.canceled = 0; arg_t->flags.rx.send_fin = 0; /* set to see it turn to 1 in CF_CFDP_R2_Reset */ @@ -2936,9 +2950,9 @@ void Test_CF_CFDP_R2_Recv_fin_ack_GetsValidFinAckFrom_CF_CFDP_RecvAck_Calls_CFDP void Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_1_DoNothing(void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_header_t *arg_ph = NULL; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduHeader_t *arg_ph = NULL; arg_t->flags.rx.md_recv = 1; @@ -2953,11 +2967,11 @@ void Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_ButCallTo_CF_CFDP_Recv void) { /* Arrange */ - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_header_t *arg_ph = NULL; - uint32 initial_recv_error = Any_uint32(); + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduHeader_t *arg_ph = NULL; + uint32 initial_recv_error = Any_uint32(); arg_t->flags.rx.md_recv = 0; @@ -2991,11 +3005,11 @@ void Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_ void) { /* Arrange */ - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_header_t *arg_ph = NULL; - uint16 initial_file_size_mismatch = Any_uint16(); + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduHeader_t *arg_ph = NULL; + uint16 initial_file_size_mismatch = Any_uint16(); arg_t->flags.rx.md_recv = 0; @@ -3016,7 +3030,7 @@ void Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_ CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_size_mismatch = initial_file_size_mismatch; /* Arrange for CF_CFDP_R2_SetCc */ - arg_t->history->cc = Any_uint8_Except(CC_FILE_SIZE_ERROR); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_FILE_SIZE_ERROR); /* Act */ CF_CFDP_R2_RecvMd(arg_t, arg_ph); @@ -3030,8 +3044,9 @@ void Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_ UtAssert_INT32_EQ(CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_size_mismatch, (uint16)(initial_file_size_mismatch + 1)); /* Assert for CF_CFDP_R2_SetCc */ - UtAssert_True(arg_t->history->cc == CC_FILE_SIZE_ERROR, - "t->history->cc is %u and should be %u (CC_FILE_SIZE_ERROR)", arg_t->history->cc, CC_FILE_SIZE_ERROR); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILE_SIZE_ERROR, + "t->history->cc is %u and should be %u (CF_CFDP_ConditionCode_FILE_SIZE_ERROR)", arg_t->history->cc, + CF_CFDP_ConditionCode_FILE_SIZE_ERROR); } /* end Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_Returns_0_And_t_flags_rx_eof_recv_Is_1_But_t_state_data_r_r2_eof_size_IsNotEqTo_t_fsize_SendEventAndIncrease_file_size_mismatch_Call_CFDP_R2_SetCc */ @@ -3040,11 +3055,11 @@ void Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_ void) { /* Arrange */ - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_header_t *arg_ph = NULL; - uint16 initial_file_rename = Any_uint16(); + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduHeader_t *arg_ph = NULL; + uint16 initial_file_rename = Any_uint16(); arg_t->flags.rx.md_recv = 0; @@ -3069,7 +3084,7 @@ void Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_ arg_t->fd = Any_uint32_Except(OS_OBJECT_ID_UNDEFINED); /* Arrange for CF_CFDP_R2_SetCc */ - arg_t->history->cc = Any_uint8_Except(CC_FILESTORE_REJECTION); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Act */ CF_CFDP_R2_RecvMd(arg_t, arg_ph); @@ -3087,9 +3102,9 @@ void Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_ UtAssert_INT32_EQ(CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_rename, (uint16)(initial_file_rename + 1)); /* Assert for CF_CFDP_R2_SetCc */ - UtAssert_True(arg_t->history->cc == CC_FILESTORE_REJECTION, - "t->history->cc is %u and should be %u (CC_FILESTORE_REJECTION)", arg_t->history->cc, - CC_FILESTORE_REJECTION); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILESTORE_REJECTION, + "t->history->cc is %u and should be %u (CF_CFDP_ConditionCode_FILESTORE_REJECTION)", + arg_t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); } /* end Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_Returns_0_And_t_flags_rx_eof_recv_Is_1_And_t_state_data_r_r2_eof_size_IsEqTo_t_fsize_CallTo_OS_rename_DoesNotReturn_OS_SUCCESS_SendEventAndUndefine_t_fd_AndCAll_CF_CFDP_R2_SetCc_AndIncrement_fault_file_rename */ @@ -3101,7 +3116,7 @@ void Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_ history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_header_t *arg_ph = NULL; + CF_CFDP_PduHeader_t *arg_ph = NULL; uint16 initial_file_open = Any_uint16(); CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; @@ -3132,7 +3147,7 @@ void Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_ arg_t->fd = Any_uint32_Except(OS_OBJECT_ID_UNDEFINED); /* Arrange for CF_CFDP_R2_SetCc */ - arg_t->history->cc = Any_uint8_Except(CC_FILE_SIZE_ERROR); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_FILE_SIZE_ERROR); /* Act */ CF_CFDP_R2_RecvMd(arg_t, arg_ph); @@ -3151,9 +3166,9 @@ void Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_ (uint16)(initial_file_open + 1)); UtAssert_UINT32_EQ(arg_t->fd, OS_OBJECT_ID_UNDEFINED); /* Assert for CF_CFDP_R2_SetCc */ - UtAssert_True(arg_t->history->cc == CC_FILESTORE_REJECTION, - "t->history->cc is %u and should be %u (CC_FILESTORE_REJECTION)", arg_t->history->cc, - CC_FILESTORE_REJECTION); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILESTORE_REJECTION, + "t->history->cc is %u and should be %u (CF_CFDP_ConditionCode_FILESTORE_REJECTION)", + arg_t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); } /* end Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_Returns_0_And_t_flags_rx_eof_recv_Is_1_And_t_state_data_r_r2_eof_size_IsEqTo_t_fsize_CallTo_OS_rename_Returns_OS_SUCCESS_ButCallTo_CF_WrappedOpenCreate_ReturnsNegativeSoSendEventAndCall_CF_CFDP_R2_SetCc_AndIncrease_fault_file_open */ @@ -3165,7 +3180,7 @@ void Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_ history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_header_t *arg_ph = NULL; + CF_CFDP_PduHeader_t *arg_ph = NULL; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; arg_t->flags.rx.md_recv = 0; @@ -3191,7 +3206,7 @@ void Test_CF_CFDP_R2_RecvMd_Given_t_flags_rx_md_recv_Is_0_CallTo_CF_CFDP_RecvMd_ arg_t->state_data.r.r2.counter.nak = Any_uint8_Except(0); /* Arrange for CF_CFDP_R2_Complete */ - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->state_data.r.sub_state = Any_uint8_Except(RECV_FILEDATA); /* Act */ @@ -3255,10 +3270,11 @@ void Test_CFDP_R_DispatchRecv_FlagsAreSetTo_PDU_HDR_FLAGS_TYPE_And_cc_DoesNotEq_ CF_UT_inmsg_buffer_t dummy_msg; history_t dummy_history; transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - static void (*const arg_fns[RECV_NUM_STATES][PDU_INVALID_MAX])(transaction_t * t, const pdu_header_t *) = {{NULL}}; - void (*const arg_fd_fn)(transaction_t *, const pdu_header_t *) = {NULL}; - uint16 initial_dropped = Any_uint16(); + transaction_t *arg_t = &dummy_t; + static void (*const arg_fns[RECV_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])( + transaction_t * t, const CF_CFDP_PduHeader_t *) = {{NULL}}; + void (*const arg_fd_fn)(transaction_t *, const CF_CFDP_PduHeader_t *) = {NULL}; + uint16 initial_dropped = Any_uint16(); memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -3268,7 +3284,7 @@ void Test_CFDP_R_DispatchRecv_FlagsAreSetTo_PDU_HDR_FLAGS_TYPE_And_cc_DoesNotEq_ UT_SetDefaultReturnValue(UT_KEY(FGV), 1); arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except(CC_NO_ERROR); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_NO_ERROR); arg_t->chan_num = Any_cf_chan_num(); CF_AppData.hk.channel_hk[arg_t->chan_num].counters.recv.dropped = initial_dropped; @@ -3288,12 +3304,13 @@ void Test_CFDP_RTest_CFDP_R_DispatchRecv_FlagsAreSetTo_PDU_HDR_FLAGS_TYPE_And_cc { /* Arrange */ CF_UT_inmsg_buffer_t dummy_msg; - pdu_header_t *dummy_ph = &dummy_msg.pdu_r_msg.ph; + CF_CFDP_PduHeader_t *dummy_ph = &dummy_msg.pdu_r_msg.ph; history_t dummy_history; transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - static void (*const arg_fns[RECV_NUM_STATES][PDU_INVALID_MAX])(transaction_t * t, const pdu_header_t *) = {{NULL}}; - void (*const arg_fd_fn)(transaction_t *, const pdu_header_t *) = Dummy_fd_fn; + transaction_t *arg_t = &dummy_t; + static void (*const arg_fns[RECV_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])( + transaction_t * t, const CF_CFDP_PduHeader_t *) = {{NULL}}; + void (*const arg_fd_fn)(transaction_t *, const CF_CFDP_PduHeader_t *) = Dummy_fd_fn; Dummy_fd_fn_context_t context_Dummy_fd_fn; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -3304,7 +3321,7 @@ void Test_CFDP_RTest_CFDP_R_DispatchRecv_FlagsAreSetTo_PDU_HDR_FLAGS_TYPE_And_cc UT_SetDefaultReturnValue(UT_KEY(FGV), 1); arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; UT_SetDataBuffer(UT_KEY(Dummy_fd_fn), &context_Dummy_fd_fn, sizeof(context_Dummy_fd_fn), false); @@ -3327,10 +3344,11 @@ void Test_CFDP_RTest_CFDP_R_DispatchRecv_FlagsAreNotSetAnd_directive_code_IsEqTo CF_UT_inmsg_buffer_t dummy_msg; history_t dummy_history; transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - static void (*const arg_fns[RECV_NUM_STATES][PDU_INVALID_MAX])(transaction_t * t, const pdu_header_t *) = {{NULL}}; - void (*const arg_fd_fn)(transaction_t *, const pdu_header_t *) = Dummy_fd_fn; - uint16 initial_spurious = Any_uint16(); + transaction_t *arg_t = &dummy_t; + static void (*const arg_fns[RECV_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])( + transaction_t * t, const CF_CFDP_PduHeader_t *) = {{NULL}}; + void (*const arg_fd_fn)(transaction_t *, const CF_CFDP_PduHeader_t *) = Dummy_fd_fn; + uint16 initial_spurious = Any_uint16(); memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -3339,8 +3357,8 @@ void Test_CFDP_RTest_CFDP_R_DispatchRecv_FlagsAreNotSetAnd_directive_code_IsEqTo UT_SetDefaultReturnValue(UT_KEY(FGV), 0); - UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(pdu_header_t)); - dummy_msg.content.cfdp.secondary.fdirh.directive_code = PDU_INVALID_MAX; + UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(CF_CFDP_PduHeader_t)); + dummy_msg.content.cfdp.secondary.fdirh.directive_code = CF_CFDP_FileDirective_INVALID_MAX; CF_AppData.hk.channel_hk[arg_t->chan_num].counters.recv.spurious = initial_spurious; @@ -3369,10 +3387,11 @@ void Test_CFDP_RTest_CFDP_R_DispatchRecv_FlagsAreNotSetAnd_directive_code_IsGrea CF_UT_inmsg_buffer_t dummy_msg; history_t dummy_history; transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - static void (*const arg_fns[RECV_NUM_STATES][PDU_INVALID_MAX])(transaction_t * t, const pdu_header_t *) = {{NULL}}; - void (*const arg_fd_fn)(transaction_t *, const pdu_header_t *) = Dummy_fd_fn; - uint16 initial_spurious = Any_uint16(); + transaction_t *arg_t = &dummy_t; + static void (*const arg_fns[RECV_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])( + transaction_t * t, const CF_CFDP_PduHeader_t *) = {{NULL}}; + void (*const arg_fd_fn)(transaction_t *, const CF_CFDP_PduHeader_t *) = Dummy_fd_fn; + uint16 initial_spurious = Any_uint16(); memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -3381,8 +3400,8 @@ void Test_CFDP_RTest_CFDP_R_DispatchRecv_FlagsAreNotSetAnd_directive_code_IsGrea UT_SetDefaultReturnValue(UT_KEY(FGV), 0); - UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(pdu_header_t)); - dummy_msg.content.cfdp.secondary.fdirh.directive_code = Any_uint8_GreaterThan(PDU_INVALID_MAX); + UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(CF_CFDP_PduHeader_t)); + dummy_msg.content.cfdp.secondary.fdirh.directive_code = Any_uint8_GreaterThan(CF_CFDP_FileDirective_INVALID_MAX); arg_t->chan_num = Any_cf_chan_num(); CF_AppData.hk.channel_hk[arg_t->chan_num].counters.recv.spurious = initial_spurious; @@ -3411,11 +3430,12 @@ void Test_CFDP_RTest_CFDP_R_DispatchRecv_FlagsAreNotSetAnd_directive_code_IsLess /* Arrange */ CF_UT_inmsg_buffer_t dummy_msg; transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - static void (*const arg_fns[RECV_NUM_STATES][PDU_INVALID_MAX])(transaction_t * t, const pdu_header_t *) = {{NULL}}; - void (*const arg_fd_fn)(transaction_t *, const pdu_header_t *) = Dummy_fd_fn; - uint16 initial_dropped = Any_uint16(); - uint16 initial_spurious = Any_uint16(); + transaction_t *arg_t = &dummy_t; + static void (*const arg_fns[RECV_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])( + transaction_t * t, const CF_CFDP_PduHeader_t *) = {{NULL}}; + void (*const arg_fd_fn)(transaction_t *, const CF_CFDP_PduHeader_t *) = Dummy_fd_fn; + uint16 initial_dropped = Any_uint16(); + uint16 initial_spurious = Any_uint16(); memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -3423,9 +3443,9 @@ void Test_CFDP_RTest_CFDP_R_DispatchRecv_FlagsAreNotSetAnd_directive_code_IsLess CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; UT_SetDefaultReturnValue(UT_KEY(FGV), 0); - UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(pdu_header_t)); + UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(CF_CFDP_PduHeader_t)); - dummy_msg.content.cfdp.secondary.fdirh.directive_code = Any_uint8_LessThan(PDU_INVALID_MAX); + dummy_msg.content.cfdp.secondary.fdirh.directive_code = Any_uint8_LessThan(CF_CFDP_FileDirective_INVALID_MAX); arg_t->chan_num = Any_cf_chan_num(); CF_AppData.hk.channel_hk[arg_t->chan_num].counters.recv.dropped = initial_dropped; @@ -3453,11 +3473,12 @@ void Test_CFDP_RTest_CFDP_R_DispatchRecv_FlagsAreNotSetAnd_directive_code_IsLess CF_UT_inmsg_buffer_t dummy_msg; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - void (*const arg_fns[RECV_NUM_STATES][PDU_INVALID_MAX])(transaction_t * t, const pdu_header_t *); - void (*const arg_fd_fn)(transaction_t *, const pdu_header_t *) = Dummy_fd_fn; + void (*const arg_fns[RECV_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])(transaction_t * t, + const CF_CFDP_PduHeader_t *); + void (*const arg_fd_fn)(transaction_t *, const CF_CFDP_PduHeader_t *) = Dummy_fd_fn; rx_sub_state dummy_state = Any_uint8_LessThan(RECV_NUM_STATES); - uint8 dummy_directive_code = Any_uint8_LessThan(PDU_INVALID_MAX); - void (*const fns_pointer)(transaction_t * t, const pdu_header_t *pdu) = Dummy_fns; + uint8 dummy_directive_code = Any_uint8_LessThan(CF_CFDP_FileDirective_INVALID_MAX); + void (*const fns_pointer)(transaction_t * t, const CF_CFDP_PduHeader_t *pdu) = Dummy_fns; Dummy_fns_context_t context_Dummy_fns; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -3467,7 +3488,7 @@ void Test_CFDP_RTest_CFDP_R_DispatchRecv_FlagsAreNotSetAnd_directive_code_IsLess UT_SetDefaultReturnValue(UT_KEY(FGV), 0); - UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(pdu_header_t)); + UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(CF_CFDP_PduHeader_t)); dummy_msg.content.cfdp.secondary.fdirh.directive_code = dummy_directive_code; arg_t->state_data.r.sub_state = dummy_state; @@ -3514,9 +3535,10 @@ void Test_CF_CFDP_R1_Recv_Runs(void) Any_uint8_LessThan(RECV_NUM_STATES); /* Any_uint8_LessThan used because small size of RECV_NUM_STATES*/ CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; - arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR + 1; /* CC_NO_ERROR + 1 so it does not equal in method call */ - arg_t->chan_num = dummy_chan_num; + arg_t->history = &dummy_history; + arg_t->history->cc = + CF_CFDP_ConditionCode_NO_ERROR + 1; /* CF_CFDP_ConditionCode_NO_ERROR + 1 so it does not equal in method call */ + arg_t->chan_num = dummy_chan_num; CF_AppData.hk.channel_hk[dummy_chan_num].counters.recv.dropped = initial_recv_dropped; @@ -3562,9 +3584,10 @@ void Test_CF_CFDP_R2_Recv_Runs(void) Any_uint8_LessThan(RECV_NUM_STATES); /* Any_uint8_LessThan used because small size of RECV_NUM_STATES*/ CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; - arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR + 1; /* CC_NO_ERROR + 1 so it does not equal in method call */ - arg_t->chan_num = dummy_chan_num; + arg_t->history = &dummy_history; + arg_t->history->cc = + CF_CFDP_ConditionCode_NO_ERROR + 1; /* CF_CFDP_ConditionCode_NO_ERROR + 1 so it does not equal in method call */ + arg_t->chan_num = dummy_chan_num; CF_AppData.hk.channel_hk[dummy_chan_num].counters.recv.dropped = initial_recv_dropped; @@ -4117,8 +4140,8 @@ void Test_CF_CFDP_R_Tick_Given_t_state_IsEqTo_CFDP_R2_And_inactivity_fired_Is_1_ cf_config_table_t dummy_config_table; chunks_wrapper_t dummy_chunks; history_t dummy_history; - pdu_nak_t dummy_nak; - pdu_header_t *dummy_ph = (pdu_header_t *)&dummy_nak; + CF_CFDP_PduNak_t dummy_nak; + CF_CFDP_PduHeader_t *dummy_ph = (CF_CFDP_PduHeader_t *)&dummy_nak; CF_CFDP_ConstructPduHeader_context_t context_CF_CFDP_ConstructPduHeader; CF_CFDP_SendNak_context_t context_CF_CFDP_SendNak; @@ -4177,7 +4200,7 @@ void Test_CF_CFDP_R_Tick_Given_t_state_IsEqTo_CFDP_R2_And_inactivity_fired_Is_1_ /* Arrange for CF_CFDP_R_SubstateSendNak */ history_t dummy_history; - pdu_header_t *dummy_ph = NULL; + CF_CFDP_PduHeader_t *dummy_ph = NULL; CF_CFDP_ConstructPduHeader_context_t context_CF_CFDP_ConstructPduHeader; arg_t->history = &dummy_history; @@ -4229,7 +4252,7 @@ void Test_CF_CFDP_R_Tick_Given_t_state_IsEqTo_CFDP_R2_And_inactivity_fired_Is_1_ history_t dummy_history; arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->flags.com.crc_calc = 0; /* Arrange for CF_CFDP_R2_CalcCrcChunk */ @@ -4284,7 +4307,7 @@ void Test_CF_CFDP_R_Tick_Given_t_state_IsEqTo_CFDP_R2_And_inactivity_fired_Is_1_ history_t dummy_history; arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; arg_t->flags.com.crc_calc = 1; UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_SendFin), CF_SEND_SUCCESS); @@ -4426,7 +4449,7 @@ void Test_CF_CFDP_R_Tick_NothingElseSet_ack_timer_armed_Is_1_CAllTo_CF_Timer_Exp history_t dummy_history; arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except(CC_NO_ERROR); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_NO_ERROR); /* Act */ CF_CFDP_R_Tick(arg_t, arg_cont); @@ -4478,7 +4501,7 @@ void Test_CF_CFDP_R_Tick_NothingElseSet_ack_timer_armed_Is_1_CAllTo_CF_Timer_Exp history_t dummy_history; arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except(CC_NO_ERROR); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_NO_ERROR); /* Act */ CF_CFDP_R_Tick(arg_t, arg_cont); @@ -4890,12 +4913,12 @@ void add_CF_CFDP_R2_CalcCrcChunk_tests(void) cf_cfdp_r_tests_Setup, cf_cfdp_r_tests_Teardown, "Test_CF_CFDP_R2_CalcCrcChunk_Given_t_state_data_r_r2_rx_crc_calc_bytes_Is_Non0_And_IsEqTo_t_fsize_CallTo_CF_" "CFDP_R_CheckCrc_Return_0_Set_t_keep_To_1_And_t_state_data_r_r2_cc_To_FIN_COMPLETE_And_t_state_data_r_r2_fs_To_" - "FIN_RETAINED_t_flags_rx_crc_calc_To_1_Return_0"); + "CF_CFDP_FinFileStatus_RETAINED_t_flags_rx_crc_calc_To_1_Return_0"); UtTest_Add( Test_CF_CFDP_R2_CalcCrcChunk_CAllTo_CF_WrappedLseek_ReturnsValueNotEqTo_RXC_SendEventAndSet_t_history_cc_To_CC_FILE_SIZE_ERROR_AndIncrement_fault_file_seek_Return_neg1, cf_cfdp_r_tests_Setup, cf_cfdp_r_tests_Teardown, "Test_CF_CFDP_R2_CalcCrcChunk_CAllTo_CF_WrappedLseek_ReturnsValueNotEqTo_RXC_SendEventAndSet_t_history_cc_To_" - "CC_FILE_SIZE_ERROR_AndIncrement_fault_file_seek_Return_neg1"); + "CF_CFDP_ConditionCode_FILE_SIZE_ERROR_AndIncrement_fault_file_seek_Return_neg1"); UtTest_Add( Test_CF_CFDP_R2_CalcCrcChunk_CAllTo_CF_WrappedLseek_ReturnsValueEqTo_RXC_crc_calc_bytes_CallTo_CF_WrappedRead_ReturnsValueNotEqTo_read_size_WhichIsSetTo_t_fsize_Minus_RXC_SendEventAndSet_t_history_cc_To_CC_FILE_SIZE_ERROR_AndIncrement_fault_file_read_Return_neg1, cf_cfdp_r_tests_Setup, cf_cfdp_r_tests_Teardown, diff --git a/unit-test/cf_cfdp_s_tests.c b/unit-test/cf_cfdp_s_tests.c index 9b44a8326..324e2625c 100644 --- a/unit-test/cf_cfdp_s_tests.c +++ b/unit-test/cf_cfdp_s_tests.c @@ -62,15 +62,15 @@ cfdp_send_ret_t Any_cfdp_send_ret_t_Except(cfdp_send_ret_t exception) *******************************************************************************/ /* NOTE: To use new handler type function for dummy stubs -- replacement is in comment -void Dummy_fns_CF_CFDP_S_DispatchRecv(transaction_t* t, const pdu_header_t* ph) +void Dummy_fns_CF_CFDP_S_DispatchRecv(transaction_t* t, const CF_CFDP_PduHeader_t* ph) { UT_GenStub_AddParam(Stub_FGV, transaction_t*, t); - UT_GenStub_AddParam(Stub_FGV, pdu_header_t*, ph); + UT_GenStub_AddParam(Stub_FGV, CF_CFDP_PduHeader_t*, ph); UT_GenStub_Execute(Stub_FGV, Basic, NULL); } */ -void Dummy_fns_CF_CFDP_S_DispatchRecv(transaction_t *t, const pdu_header_t *pdu) +void Dummy_fns_CF_CFDP_S_DispatchRecv(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) { UT_Stub_CopyFromLocal(UT_KEY(Dummy_fns_CF_CFDP_S_DispatchRecv), &t, sizeof(t)); UT_Stub_CopyFromLocal(UT_KEY(Dummy_fns_CF_CFDP_S_DispatchRecv), &pdu, sizeof(pdu)); @@ -345,14 +345,14 @@ void Test_CF_CFDP_S2_SubstateSendEof_TriggerTickProcessing(void) void Test_CFDP_S_SendFileData_When_ph_Is_NULL_Return_0(void) { /* Arrange */ - cf_config_table_t dummy_config_table; - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - uint32 arg_foffs = Any_uint32(); - uint32 arg_bytes_to_read = Any_uint32(); - uint8 arg_calc_crc = Any_uint8(); - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = NULL; + cf_config_table_t dummy_config_table; + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + uint32 arg_foffs = Any_uint32(); + uint32 arg_bytes_to_read = Any_uint32(); + uint8 arg_calc_crc = Any_uint8(); + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = NULL; CF_AppData.config_table = &dummy_config_table; arg_t->history = &dummy_history; @@ -375,17 +375,17 @@ void Test_CFDP_S_SendFileData_WhenCachedPosNotEq_foffs_CallTo_CF_WrappedLseek_Re void) { /* Arrange */ - cf_config_table_t dummy_config_table; - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - uint32 arg_foffs = Any_uint32(); - uint32 arg_bytes_to_read = Any_uint32(); - uint8 arg_calc_crc = Any_uint8(); - pdu_header_t dummy_ph; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; - int32 forced_return_CF_WrappedLseek = Any_uint32_Except(arg_foffs); - const char *expected_Spec = "CF S%d(%u:%u): error seeking to offset 0x%08x, got 0x%08x"; + cf_config_table_t dummy_config_table; + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + uint32 arg_foffs = Any_uint32(); + uint32 arg_bytes_to_read = Any_uint32(); + uint8 arg_calc_crc = Any_uint8(); + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + int32 forced_return_CF_WrappedLseek = Any_uint32_Except(arg_foffs); + const char *expected_Spec = "CF S%d(%u:%u): error seeking to offset 0x%08x, got 0x%08x"; CF_AppData.config_table = &dummy_config_table; arg_t->history = &dummy_history; @@ -432,11 +432,11 @@ void Test_CFDP_S_SendFileData_CallTo_CF_WrappedRead_ReturnsValueNotEqTo_bytes_to uint32 arg_foffs = Any_uint32(); uint32 arg_bytes_to_read = Any_uint16(); /* Any_uint16_Except(0) used to limit to same type as CF_AppData.config_table->outgoing_file_chunk_size */ - uint8 arg_calc_crc = Any_uint8(); - pdu_header_t dummy_ph; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; - int32 forced_return_CF_WrappedLseek = arg_foffs; - uint16 dummy_chunk_size = Any_uint16(); + uint8 arg_calc_crc = Any_uint8(); + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + int32 forced_return_CF_WrappedLseek = arg_foffs; + uint16 dummy_chunk_size = Any_uint16(); uint32 expected_bytes_to_read = (arg_bytes_to_read < dummy_chunk_size ? arg_bytes_to_read : dummy_chunk_size); int32 forced_return_CF_WrappedRead = Any_int_Except(expected_bytes_to_read); const char *expected_Spec = "CF S%d(%u:%u): error reading bytes: expected 0x%08x, got 0x%08x"; @@ -488,12 +488,12 @@ void Test_CFDP_S_SendFileData_Given_bytes_to_read_GreaterThan_outgoing_file_chun uint32 arg_foffs = Any_uint32(); uint32 arg_bytes_to_read = Any_uint16_Except( 0); /* Any_uint16_Except(0) used to limit to same type as CF_AppData.config_table->outgoing_file_chunk_size */ - uint8 arg_calc_crc = Any_uint8(); - pdu_header_t dummy_ph; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; - uint32 expected_bytes_to_read = arg_bytes_to_read; - int32 forced_return_CF_WrappedRead = expected_bytes_to_read; - const char *expected_Spec = "CF S%d(%u:%u): error reading bytes: expected 0x%08x, got 0x%08x"; + uint8 arg_calc_crc = Any_uint8(); + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + uint32 expected_bytes_to_read = arg_bytes_to_read; + int32 forced_return_CF_WrappedRead = expected_bytes_to_read; + const char *expected_Spec = "CF S%d(%u:%u): error reading bytes: expected 0x%08x, got 0x%08x"; dummy_config_table.outgoing_file_chunk_size = arg_bytes_to_read - 1; /* forces bytes_to_read to be greater than @@ -545,8 +545,8 @@ void Test_CFDP_S_SendFileData_CallTo_CF_CFDP_SendFd_Returns_CF_SEND_NO_MSG_Retur uint32 arg_bytes_to_read = Any_uint16_Except( 0); /* Any_uint16_Except(0) used to limit to same type as CF_AppData.config_table->outgoing_file_chunk_size */ uint8 arg_calc_crc = Any_uint8(); - pdu_header_t dummy_ph; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; uint32 expected_bytes_to_read = arg_bytes_to_read; int32 forced_return_CF_WrappedRead = expected_bytes_to_read; CF_CFDP_SendFd_context_t context_CF_CFDP_SendFd; @@ -592,8 +592,8 @@ void Test_CFDP_S_SendFileData_CallTo_CF_CFDP_SendFd_Returns_CF_SEND_ERROR_SendEv uint32 arg_bytes_to_read = Any_uint16_Except( 0); /* Any_uint16_Except(0) used to limit to same type as CF_AppData.config_table->outgoing_file_chunk_size */ uint8 arg_calc_crc = Any_uint8(); - pdu_header_t dummy_ph; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; uint32 expected_bytes_to_read = arg_bytes_to_read; int32 forced_return_CF_WrappedRead = expected_bytes_to_read; const char *expected_Spec = "CF S%d(%u:%u): error sending fd"; @@ -650,8 +650,8 @@ void Test_CFDP_S_SendFileData_AssertsWhen_foffs_Plus_bytes_to_read_IsLessThanOrE // uint32 arg_foffs = Any_uint32(); // uint32 arg_bytes_to_read = Any_uint16_Except(0); /* Any_uint16_Except(0) used to limit to same // type as CF_AppData.config_table->outgoing_file_chunk_size */ uint8 arg_calc_crc = Any_uint8(); - // pdu_header_t dummy_ph; - // pdu_header_t* forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + // CF_CFDP_PduHeader_t dummy_ph; + // CF_CFDP_PduHeader_t* forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; // uint32 expected_bytes_to_read = arg_bytes_to_read; // int32 forced_return_CF_WrappedRead = expected_bytes_to_read; // CF_CFDP_SendFd_context_t context_CF_CFDP_SendFd; @@ -714,8 +714,8 @@ void Test_CFDP_S_SendFileData_CallTo_CF_CFDP_SendFd_ReturnsDontCareNoCallTo_CF_C uint32 arg_bytes_to_read = Any_uint16_Except( 0); /* Any_uint16_Except(0) used to limit to same type as CF_AppData.config_table->outgoing_file_chunk_size */ uint8 arg_calc_crc = 0; /* 0 means no calc */ - pdu_header_t dummy_ph; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; uint32 expected_bytes_to_read = arg_bytes_to_read; int32 forced_return_CF_WrappedRead = expected_bytes_to_read; cfdp_send_ret_t exceptions[2] = {CF_SEND_NO_MSG, CF_SEND_ERROR}; @@ -772,8 +772,8 @@ void Test_CFDP_S_SendFileData_CallTo_CF_CFDP_SendFd_ReturnsDontCareWithCallTo_CF uint32 arg_bytes_to_read = Any_uint16_Except( 0); /* Any_uint16_Except(0) used to limit to same type as CF_AppData.config_table->outgoing_file_chunk_size */ uint8 arg_calc_crc = Any_uint8_Except(0); /* any but 0 means calc */ - pdu_header_t dummy_ph; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; uint32 expected_bytes_to_read = arg_bytes_to_read; int32 forced_return_CF_WrappedRead = expected_bytes_to_read; cfdp_send_ret_t exceptions[2] = {CF_SEND_NO_MSG, CF_SEND_ERROR}; @@ -837,8 +837,8 @@ void Test_CF_CFDP_S_SubstateSendFileData_CallTo_CFDP_S_SendFileData_Returns_0_Do transaction_t *arg_t = &dummy_t; uint32 initial_foffs = Any_uint32(); uint8 initial_sub_state = Any_uint8_Except(SEND_EOF); /* TODO: any_tx_sub_state_except would be more proper */ - uint8 initial_cc = - Any_uint8_Except(CC_FILESTORE_REJECTION); /* TODO: any_condition_code_except would be more proper */ + uint8 initial_cc = Any_uint8_Except( + CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* TODO: any_condition_code_except would be more proper */ arg_t->foffs = initial_foffs; @@ -848,8 +848,8 @@ void Test_CF_CFDP_S_SubstateSendFileData_CallTo_CFDP_S_SendFileData_Returns_0_Do arg_t->state_data.s.sub_state = initial_sub_state; /* Arrange unstubbable:CF_CFDP_S_SendFileData - pdu will be null err_out returns 0 */ - cf_config_table_t dummy_config_table; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = NULL; + cf_config_table_t dummy_config_table; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = NULL; CF_AppData.config_table = &dummy_config_table; @@ -881,9 +881,9 @@ void Test_CF_CFDP_S_SubstateSendFileData_CallTo_CFDP_S_SendFileData_ReturnsGreat transaction_t *arg_t = &dummy_t; uint32 initial_foffs = Any_uint32(); uint8 initial_sub_state = Any_uint8_Except(SEND_EOF); /* TODO: any_tx_sub_state_except would be more proper */ - uint8 initial_cc = - Any_uint8_Except(CC_FILESTORE_REJECTION); /* TODO: any_condition_code_except would be more proper */ - uint8 dummy_bytes_received = Any_uint8_GreaterThan(1); /* uint8 used for reasonably fast size for testing */ + uint8 initial_cc = Any_uint8_Except( + CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* TODO: any_condition_code_except would be more proper */ + uint8 dummy_bytes_received = Any_uint8_GreaterThan(1); /* uint8 used for reasonably fast size for testing */ arg_t->foffs = initial_foffs; arg_t->fsize = dummy_bytes_received + initial_foffs; @@ -895,8 +895,8 @@ void Test_CF_CFDP_S_SubstateSendFileData_CallTo_CFDP_S_SendFileData_ReturnsGreat /* Arrange unstubbable:CF_CFDP_S_SendFileData - pdu will be null err_out returns 0 */ cf_config_table_t dummy_config_table; - pdu_header_t dummy_ph; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; int32 forced_return_CF_WrappedRead = 1; cfdp_send_ret_t exceptions[2] = {CF_SEND_NO_MSG, CF_SEND_ERROR}; uint64 initial_file_data_bytes = Any_uint64(); @@ -947,9 +947,9 @@ void Test_CF_CFDP_S_SubstateSendFileData_CallTo_CFDP_S_SendFileData_ReturnsGreat transaction_t *arg_t = &dummy_t; uint32 initial_foffs = Any_uint16(); /* uint16 used for reasonably fast testing */ uint8 initial_sub_state = Any_uint8_Except(SEND_EOF); /* TODO: any_tx_sub_state_except would be more proper */ - uint8 initial_cc = - Any_uint8_Except(CC_FILESTORE_REJECTION); /* TODO: any_condition_code_except would be more proper */ - uint8 dummy_bytes_received = Any_uint8_Except(0); /* uint8 used for reasonably fast size for testing */ + uint8 initial_cc = Any_uint8_Except( + CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* TODO: any_condition_code_except would be more proper */ + uint8 dummy_bytes_received = Any_uint8_Except(0); /* uint8 used for reasonably fast size for testing */ arg_t->foffs = initial_foffs; arg_t->fsize = dummy_bytes_received + initial_foffs; @@ -961,8 +961,8 @@ void Test_CF_CFDP_S_SubstateSendFileData_CallTo_CFDP_S_SendFileData_ReturnsGreat /* Arrange unstubbable:CF_CFDP_S_SendFileData - pdu will be null err_out returns 0 */ cf_config_table_t dummy_config_table; - pdu_header_t dummy_ph; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; int32 forced_return_CF_WrappedRead = arg_t->fsize - arg_t->foffs; cfdp_send_ret_t exceptions[2] = {CF_SEND_NO_MSG, CF_SEND_ERROR}; uint64 initial_file_data_bytes = Any_uint64(); @@ -1014,8 +1014,8 @@ void Test_CF_CFDP_S_SubstateSendFileData_CallTo_CFDP_S_SendFileData_ReturnsLessT transaction_t *arg_t = &dummy_t; uint32 initial_foffs = Any_uint32(); uint8 initial_sub_state = Any_uint8_Except(SEND_EOF); /* TODO: any_tx_sub_state_except would be more proper */ - uint8 initial_cc = - Any_uint8_Except(CC_FILESTORE_REJECTION); /* TODO: any_condition_code_except would be more proper */ + uint8 initial_cc = Any_uint8_Except( + CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* TODO: any_condition_code_except would be more proper */ arg_t->foffs = initial_foffs; @@ -1025,10 +1025,10 @@ void Test_CF_CFDP_S_SubstateSendFileData_CallTo_CFDP_S_SendFileData_ReturnsLessT arg_t->state_data.s.sub_state = initial_sub_state; /* Arrange for CF_CFDP_S_SendFileData - ph will be null err_out returns 0 */ - cf_config_table_t dummy_config_table; - pdu_header_t dummy_ph; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; - int32 forced_return_CF_WrappedLseek = Any_uint32_Except(arg_t->foffs); + cf_config_table_t dummy_config_table; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + int32 forced_return_CF_WrappedLseek = Any_uint32_Except(arg_t->foffs); CF_AppData.config_table = &dummy_config_table; @@ -1046,9 +1046,9 @@ void Test_CF_CFDP_S_SubstateSendFileData_CallTo_CFDP_S_SendFileData_ReturnsLessT UtAssert_True(arg_t->foffs == initial_foffs, "t->foffs is %u and should not have changed from %u (value before call)", arg_t->foffs, initial_foffs); - UtAssert_True(arg_t->history->cc == CC_FILESTORE_REJECTION, - "t->history->cc is %u and should be %u (CC_FILESTORE_REJECTION)", arg_t->history->cc, - CC_FILESTORE_REJECTION); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILESTORE_REJECTION, + "t->history->cc is %u and should be %u (CF_CFDP_ConditionCode_FILESTORE_REJECTION)", + arg_t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); UtAssert_True(arg_t->state_data.s.sub_state == SEND_EOF, "t->state_data.s.sub_state is %u and should be %u (SEND_EOF)", arg_t->state_data.s.sub_state, SEND_EOF); @@ -1190,9 +1190,9 @@ void Test_CF_CFDP_S_CheckAndRespondNak_CallTo_CF_Chunks_GetFirstChunkReturns_non sizeof(context_CF_Chunks_GetFirstChunk), false); /* Arrange for CF_CFDP_S_SendFileData - ph will be null err_out returns 0 */ - cf_config_table_t dummy_config_table; - history_t dummy_history; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = NULL; + cf_config_table_t dummy_config_table; + history_t dummy_history; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = NULL; CF_AppData.config_table = &dummy_config_table; arg_t->history = &dummy_history; @@ -1234,11 +1234,11 @@ void Test_CF_CFDP_S_CheckAndRespondNak_CallTo_CF_Chunks_GetFirstChunkReturns_non sizeof(context_CF_Chunks_GetFirstChunk), false); /* Arrange for CF_CFDP_S_SendFileData - fail return -1 */ - cf_config_table_t dummy_config_table; - history_t dummy_history; - pdu_header_t dummy_ph; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; - int32 forced_return_CF_WrappedLseek = Any_uint32_Except(arg_t->foffs); + cf_config_table_t dummy_config_table; + history_t dummy_history; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + int32 forced_return_CF_WrappedLseek = Any_uint32_Except(arg_t->foffs); CF_AppData.config_table = &dummy_config_table; arg_t->history = &dummy_history; @@ -1289,8 +1289,8 @@ void Test_CF_CFDP_S_CheckAndRespondNak_CallTo_CF_Chunks_GetFirstChunkReturned_no /* Arrange for CF_CFDP_S_SendFileData - fail return -1 */ cf_config_table_t dummy_config_table; history_t dummy_history; - pdu_header_t dummy_ph; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; int32 forced_return_CF_WrappedRead = dummy_c->size; cfdp_send_ret_t exceptions[2] = {CF_SEND_NO_MSG, CF_SEND_ERROR}; CF_CFDP_SendFd_context_t context_CF_CFDP_SendFd; @@ -1381,9 +1381,9 @@ void Test_CF_CFDP_S2_SubstateSendFileData_CallTo_CF_CFDP_S_CheckAndRespondNak_Re arg_t->foffs = initial_foffs; /* Arrange for CF_CFDP_S_SendFileData - ph will be null err_out returns 0 */ - cf_config_table_t dummy_config_table; - history_t dummy_history; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = NULL; + cf_config_table_t dummy_config_table; + history_t dummy_history; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = NULL; dummy_config_table.outgoing_file_chunk_size = arg_t->foffs; CF_AppData.config_table = &dummy_config_table; @@ -1489,8 +1489,8 @@ void Test_CF_CFDP_S2_SubstateSendFileData_CallTo_CF_CFDP_S_CheckAndRespondNak_Re /* Arrange for CF_CFDP_S_SendFileData - ph will be null err_out returns 0 */ cf_config_table_t dummy_config_table; history_t dummy_history; - pdu_header_t dummy_ph; - pdu_header_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *forced_return_CF_CFDP_ConstructPduHeader = &dummy_ph; CF_CFDP_SendFd_context_t context_CF_CFDP_SendFd; dummy_config_table.outgoing_file_chunk_size = arg_t->foffs; @@ -1539,9 +1539,10 @@ void Test_CF_CFDP_S_SubstateSendMetadata_CallTo_OS_FileOpenCheck_Returns_OS_SUCC const char *expected_Spec = "CF S%d(%u:%u): file %s already open"; CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; - arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except( - CC_FILESTORE_REJECTION); /* Setting arg_t->history->cc not required to set, but helps verify change */ + arg_t->history = &dummy_history; + arg_t->history->cc = + Any_uint8_Except(CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Setting arg_t->history->cc not required to set, + but helps verify change */ arg_t->fd = 0; UT_SetDefaultReturnValue(UT_KEY(OS_FileOpenCheck), OS_SUCCESS); @@ -1571,9 +1572,9 @@ void Test_CF_CFDP_S_SubstateSendMetadata_CallTo_OS_FileOpenCheck_Returns_OS_SUCC (uint16)(initial_fault_file_open + 1), "fault.file_open was incremented to %u and should be 1 more than %u (value before call)", CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_open, initial_fault_file_open); - UtAssert_True(arg_t->history->cc == CC_FILESTORE_REJECTION, - "t->history->cc was set to %u and should be %u (CC_FILESTORE_REJECTION)", arg_t->history->cc, - CC_FILESTORE_REJECTION); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILESTORE_REJECTION, + "t->history->cc was set to %u and should be %u (CF_CFDP_ConditionCode_FILESTORE_REJECTION)", + arg_t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Assert CF_CFDP_S_Reset */ UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); @@ -1590,9 +1591,10 @@ void Test_CF_CFDP_S_SubstateSendMetadata_CallTo_CF_WrappedOpen_Makes_fd_LessThan CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; - arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except( - CC_FILESTORE_REJECTION); /* Setting arg_t->history->cc not required to set, but helps verify change */ + arg_t->history = &dummy_history; + arg_t->history->cc = + Any_uint8_Except(CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Setting arg_t->history->cc not required to set, + but helps verify change */ arg_t->fd = 0; UT_SetDefaultReturnValue(UT_KEY(OS_FileOpenCheck), Any_int32_Except(OS_SUCCESS)); @@ -1628,9 +1630,9 @@ void Test_CF_CFDP_S_SubstateSendMetadata_CallTo_CF_WrappedOpen_Makes_fd_LessThan (uint16)(initial_fault_file_open + 1), "fault.file_open was incremented to %u and should be 1 more than %u (value before call)", CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_open, initial_fault_file_open); - UtAssert_True(arg_t->history->cc == CC_FILESTORE_REJECTION, - "t->history->cc was set to %u and should be %u (CC_FILESTORE_REJECTION)", arg_t->history->cc, - CC_FILESTORE_REJECTION); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILESTORE_REJECTION, + "t->history->cc was set to %u and should be %u (CF_CFDP_ConditionCode_FILESTORE_REJECTION)", + arg_t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Assert CF_CFDP_S_Reset */ UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); @@ -1649,9 +1651,10 @@ void Test_CF_CFDP_S_SubstateSendMetadata_FirstCallTo_CF_WrappedLseek_Sets_status CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; - arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except( - CC_FILESTORE_REJECTION); /* Setting arg_t->history->cc not required to set, but helps verify change */ + arg_t->history = &dummy_history; + arg_t->history->cc = + Any_uint8_Except(CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Setting arg_t->history->cc not required to set, + but helps verify change */ arg_t->fd = 0; UT_SetDefaultReturnValue(UT_KEY(OS_FileOpenCheck), Any_int32_Except(OS_SUCCESS)); @@ -1690,9 +1693,9 @@ void Test_CF_CFDP_S_SubstateSendMetadata_FirstCallTo_CF_WrappedLseek_Sets_status (uint16)(initial_fault_file_seek + 1), "fault.file_seek was incremented to %u and should be 1 more than %u (value before call)", CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_seek, initial_fault_file_seek); - UtAssert_True(arg_t->history->cc == CC_FILESTORE_REJECTION, - "t->history->cc was set to %u and should be %u (CC_FILESTORE_REJECTION)", arg_t->history->cc, - CC_FILESTORE_REJECTION); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILESTORE_REJECTION, + "t->history->cc was set to %u and should be %u (CF_CFDP_ConditionCode_FILESTORE_REJECTION)", + arg_t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Assert CF_CFDP_S_Reset */ UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); } /* end @@ -1711,9 +1714,10 @@ void Test_CF_CFDP_S_SubstateSendMetadata_SecondCallTo_CF_WrappedLseek_Sets_statu CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; - arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except( - CC_FILESTORE_REJECTION); /* Setting arg_t->history->cc not required to set, but helps verify change */ + arg_t->history = &dummy_history; + arg_t->history->cc = + Any_uint8_Except(CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Setting arg_t->history->cc not required to set, + but helps verify change */ arg_t->fd = 0; UT_SetDefaultReturnValue(UT_KEY(OS_FileOpenCheck), Any_int32_Except(OS_SUCCESS)); @@ -1752,9 +1756,9 @@ void Test_CF_CFDP_S_SubstateSendMetadata_SecondCallTo_CF_WrappedLseek_Sets_statu (uint16)(initial_fault_file_seek + 1), "fault.file_seek was incremented to %u and should be 1 more than %u (value before call)", CF_AppData.hk.channel_hk[arg_t->chan_num].counters.fault.file_seek, initial_fault_file_seek); - UtAssert_True(arg_t->history->cc == CC_FILESTORE_REJECTION, - "t->history->cc was set to %u and should be %u (CC_FILESTORE_REJECTION)", arg_t->history->cc, - CC_FILESTORE_REJECTION); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILESTORE_REJECTION, + "t->history->cc was set to %u and should be %u (CF_CFDP_ConditionCode_FILESTORE_REJECTION)", + arg_t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Assert CF_CFDP_S_Reset */ UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); } /* end Test_CF_CFDP_S_SubstateSendMetadata_SecondCallTo_CF_WrappedLseek_Sets_status_ToNot_0_Increment_fault_file_seek @@ -1771,9 +1775,10 @@ void Test_CF_CFDP_S_SubstateSendMetadata_AllFileChecksPassCallTo_CF_CFDP_SendMd_ CF_WrappedOpenCreate_context_t context_CF_WrappedOpenCreate; transaction_t *context_CF_CFDP_SendMd; - arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except( - CC_FILESTORE_REJECTION); /* Setting arg_t->history->cc not required to set, but helps verify change */ + arg_t->history = &dummy_history; + arg_t->history->cc = + Any_uint8_Except(CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Setting arg_t->history->cc not required to set, + but helps verify change */ arg_t->fd = 0; UT_SetDefaultReturnValue(UT_KEY(OS_FileOpenCheck), Any_int32_Except(OS_SUCCESS)); @@ -1810,9 +1815,9 @@ void Test_CF_CFDP_S_SubstateSendMetadata_AllFileChecksPassCallTo_CF_CFDP_SendMd_ UtAssert_StrCmp(context_CFE_EVS_SendEvent.Spec, expected_Spec, "CFE_EVS_SendEvent received expected Spec\n'%s' - Received\n'%s' - Expected", context_CFE_EVS_SendEvent.Spec, expected_Spec); - UtAssert_True(arg_t->history->cc == CC_FILESTORE_REJECTION, - "t->history->cc was set to %u and should be %u (CC_FILESTORE_REJECTION)", arg_t->history->cc, - CC_FILESTORE_REJECTION); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILESTORE_REJECTION, + "t->history->cc was set to %u and should be %u (CF_CFDP_ConditionCode_FILESTORE_REJECTION)", + arg_t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Assert CF_CFDP_S_Reset */ UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); } /* end Test_CF_CFDP_S_SubstateSendMetadata_AllFileChecksPassCallTo_CF_CFDP_SendMd_Returns_CF_SEND_ERROR_ThenErrorOut @@ -1829,9 +1834,10 @@ void Test_CF_CFDP_S_SubstateSendMetadata_BypassedFileChecks_t_fd_IsNot_0_CallTo_ const char *expected_Spec = "CF S%d(%u:%u): failed to send md"; CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; - arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except( - CC_FILESTORE_REJECTION); /* Setting arg_t->history->cc not required to set, but helps verify change */ + arg_t->history = &dummy_history; + arg_t->history->cc = + Any_uint8_Except(CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Setting arg_t->history->cc not required to set, + but helps verify change */ arg_t->fd = Any_int32_Except(0); UT_SetDataBuffer(UT_KEY(CF_CFDP_SendMd), &context_CF_CFDP_SendMd, sizeof(context_CF_CFDP_SendMd), false); @@ -1858,9 +1864,9 @@ void Test_CF_CFDP_S_SubstateSendMetadata_BypassedFileChecks_t_fd_IsNot_0_CallTo_ UtAssert_StrCmp(context_CFE_EVS_SendEvent.Spec, expected_Spec, "CFE_EVS_SendEvent received expected Spec\n'%s' - Received\n'%s' - Expected", context_CFE_EVS_SendEvent.Spec, expected_Spec); - UtAssert_True(arg_t->history->cc == CC_FILESTORE_REJECTION, - "t->history->cc was set to %u and should be %u (CC_FILESTORE_REJECTION)", arg_t->history->cc, - CC_FILESTORE_REJECTION); + UtAssert_True(arg_t->history->cc == CF_CFDP_ConditionCode_FILESTORE_REJECTION, + "t->history->cc was set to %u and should be %u (CF_CFDP_ConditionCode_FILESTORE_REJECTION)", + arg_t->history->cc, CF_CFDP_ConditionCode_FILESTORE_REJECTION); /* Assert CF_CFDP_S_Reset */ UtAssert_STUB_COUNT(CF_CFDP_ResetTransaction, 1); } /* end @@ -1962,12 +1968,12 @@ void Test_CF_CFDP_S_SubstateSendFinAck_WhenCallTo_CF_CFDP_SendAck_Returns_CF_SEN /* Assert */ UtAssert_STUB_COUNT(CF_CFDP_SendAck, 1); UtAssert_ADDRESS_EQ(context_CF_CFDP_SendAck.t, arg_t); - UtAssert_True(context_CF_CFDP_SendAck.ts == ACK_TS_ACTIVE, - "CF_CFDP_SendAck received ts %u and should be %u (ACK_TS_ACTIVE)", context_CF_CFDP_SendAck.ts, - ACK_TS_ACTIVE); - UtAssert_True(context_CF_CFDP_SendAck.dir_code == PDU_FIN, - "CF_CFDP_SendAck received dir_code %u and should be %u (PDU_FIN)", context_CF_CFDP_SendAck.dir_code, - PDU_FIN); + UtAssert_True(context_CF_CFDP_SendAck.ts == CF_CFDP_AckTxnStatus_ACTIVE, + "CF_CFDP_SendAck received ts %u and should be %u (CF_CFDP_AckTxnStatus_ACTIVE)", + context_CF_CFDP_SendAck.ts, CF_CFDP_AckTxnStatus_ACTIVE); + UtAssert_True(context_CF_CFDP_SendAck.dir_code == CF_CFDP_FileDirective_FIN, + "CF_CFDP_SendAck received dir_code %u and should be %u (CF_CFDP_FileDirective_FIN)", + context_CF_CFDP_SendAck.dir_code, CF_CFDP_FileDirective_FIN); UtAssert_True(context_CF_CFDP_SendAck.cc == arg_t->state_data.s.s2.fin_cc, "CF_CFDP_SendAck received cc %u and should be %u (t->state_data.s.s2.fin_cc)", context_CF_CFDP_SendAck.cc, arg_t->state_data.s.s2.fin_cc); @@ -2013,12 +2019,12 @@ void Test_CF_CFDP_S_SubstateSendFinAck_WhenCallTo_CF_CFDP_SendAck_DoesNotReturn_ /* Assert */ UtAssert_STUB_COUNT(CF_CFDP_SendAck, 1); UtAssert_ADDRESS_EQ(context_CF_CFDP_SendAck.t, arg_t); - UtAssert_True(context_CF_CFDP_SendAck.ts == ACK_TS_ACTIVE, - "CF_CFDP_SendAck received ts %u and should be %u (ACK_TS_ACTIVE)", context_CF_CFDP_SendAck.ts, - ACK_TS_ACTIVE); - UtAssert_True(context_CF_CFDP_SendAck.dir_code == PDU_FIN, - "CF_CFDP_SendAck received dir_code %u and should be %u (PDU_FIN)", context_CF_CFDP_SendAck.dir_code, - PDU_FIN); + UtAssert_True(context_CF_CFDP_SendAck.ts == CF_CFDP_AckTxnStatus_ACTIVE, + "CF_CFDP_SendAck received ts %u and should be %u (CF_CFDP_AckTxnStatus_ACTIVE)", + context_CF_CFDP_SendAck.ts, CF_CFDP_AckTxnStatus_ACTIVE); + UtAssert_True(context_CF_CFDP_SendAck.dir_code == CF_CFDP_FileDirective_FIN, + "CF_CFDP_SendAck received dir_code %u and should be %u (CF_CFDP_FileDirective_FIN)", + context_CF_CFDP_SendAck.dir_code, CF_CFDP_FileDirective_FIN); UtAssert_True(context_CF_CFDP_SendAck.cc == arg_t->state_data.s.s2.fin_cc, "CF_CFDP_SendAck received cc %u and should be %u (t->state_data.s.s2.fin_cc)", context_CF_CFDP_SendAck.cc, arg_t->state_data.s.s2.fin_cc); @@ -2053,8 +2059,8 @@ void Test_CF_CFDP_S2_EarlyFin_SendEventAndCallReset(void) history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - const pdu_header_t dummy_ph; - const pdu_header_t *arg_ph = &dummy_ph; + const CF_CFDP_PduHeader_t dummy_ph; + const CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; const char *expected_Spec = "CF S%d(%u:%u): got early fin -- cancelling"; CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; @@ -2101,12 +2107,12 @@ void Test_CF_CFDP_S2_EarlyFin_SendEventAndCallReset(void) void Test_CF_CFDP_S2_Fin_When_CF_CFDP_RecvFin_Returns_0_Set_fin_cc_And_sub_state(void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - uint8 dummy_flags = Any_uint8(); - const pdu_header_t dummy_ph; - const pdu_header_t *arg_ph; - uint8 expected_fin_cc = FGV(dummy_flags, PDU_FLAGS_CC); + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + uint8 dummy_flags = Any_uint8(); + const CF_CFDP_PduHeader_t dummy_ph; + const CF_CFDP_PduHeader_t *arg_ph; + uint8 expected_fin_cc = FGV(dummy_flags, CF_CFDP_PduFin_FLAGS_CC); memcpy((void *)&dummy_ph.flags, &dummy_flags, 1); arg_ph = &dummy_ph; @@ -2119,7 +2125,7 @@ void Test_CF_CFDP_S2_Fin_When_CF_CFDP_RecvFin_Returns_0_Set_fin_cc_And_sub_state /* Assert */ UtAssert_STUB_COUNT(CF_CFDP_RecvFin, 1); UtAssert_True(arg_t->state_data.s.s2.fin_cc == expected_fin_cc, - "fin_cc is set to %u and should be %u (FGV(pdu->fin.flags, PDU_FLAGS_CC))", + "fin_cc is set to %u and should be %u (FGV(pdu->fin.flags, CF_CFDP_PduFin_FLAGS_CC))", arg_t->state_data.s.s2.fin_cc, expected_fin_cc); UtAssert_True(arg_t->state_data.s.sub_state == SEND_SEND_FIN_ACK, "sub_state is set to %u and should be %u (SEND_SEND_FIN_ACK)", arg_t->state_data.s.sub_state, @@ -2134,8 +2140,8 @@ void Test_CF_CFDP_S2_Fin_When_CF_CFDP_RecvFin_DoesNotReturn_0_SendEventAndCountR history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - const pdu_header_t dummy_ph; - const pdu_header_t *arg_ph = &dummy_ph; + const CF_CFDP_PduHeader_t dummy_ph; + const CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; uint32 initial_recv_error = Any_uint32(); const char *expected_Spec = "CF S%d(%u:%u): received invalid fin pdu"; CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; @@ -2184,8 +2190,8 @@ void Test_CF_CFDP_S2_Nak_CallTo_CF_CFDP_RecvNak_Returns_neg1_SendEventAndIncreme history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; + CF_CFDP_PduNak_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; uint32 initial_recv_error = Any_uint32(); const char *expected_Spec = "CF S%d(%u:%u): received invalid nak pdu"; CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; @@ -2228,8 +2234,8 @@ void Test_CF_CFDP_S2_Nak_CallTo_CF_CFDP_RecvNak_Returns_0_Set_num_sr_to_0_SendEv history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; + CF_CFDP_PduNak_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; uint32 initial_recv_error = Any_uint32(); const char *expected_Spec = "CF S%d(%u:%u): received invalid nak pdu"; CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; @@ -2279,13 +2285,13 @@ void Test_CF_CFDP_S2_Nak_CallTo_CF_CFDP_Sets_md_need_send_To_1_When_offset_start void) { /* Arrange */ - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; - uint32 initial_nak_segment_requests = Any_uint32(); - int context_CF_CFDP_RecvNak_forced_num_sr = 1; + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_PduNak_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; + uint32 initial_nak_segment_requests = Any_uint32(); + int context_CF_CFDP_RecvNak_forced_num_sr = 1; arg_t->history = &dummy_history; arg_t->chan_num = Any_cf_chan_num(); @@ -2325,8 +2331,8 @@ void Test_CF_CFDP_S2_Nak_SendsEventBecause_offset_end_IsLessThan_offset_start(vo history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; + CF_CFDP_PduNak_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; uint32 dummy_offset_start; uint32 dummy_offset_end; uint32 initial_nak_segment_requests = Any_uint32(); @@ -2385,8 +2391,8 @@ void Test_CF_CFDP_S2_Nak_SendsEventBecause_start_Plus_size_IsGreaterThanTransact history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; + CF_CFDP_PduNak_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; uint32 dummy_offset_start; uint32 dummy_offset_end; uint32 initial_nak_segment_requests = Any_uint32(); @@ -2445,8 +2451,8 @@ void Test_CF_CFDP_S2_Nak_Calls_CF_Chunks_Add_Because_start_Plus_size_IsEqualToTr history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; + CF_CFDP_PduNak_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; uint32 dummy_offset_start; uint32 dummy_offset_end; uint32 initial_nak_segment_requests = Any_uint32(); @@ -2503,8 +2509,8 @@ void Test_CF_CFDP_S2_Nak_Calls_CF_Chunks_Add_Because_start_Plus_size_IsLessThanT history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - pdu_nak_t dummy_ph; - pdu_header_t *arg_ph = (pdu_header_t *)&dummy_ph; + CF_CFDP_PduNak_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = (CF_CFDP_PduHeader_t *)&dummy_ph; uint32 dummy_offset_start; uint32 dummy_offset_end; uint32 initial_nak_segment_requests = Any_uint32(); @@ -2569,8 +2575,8 @@ void Test_CF_CFDP_S2_Nak_Arm_Call_CF_CFDP_ArmAckTimer_And_CF_CFDP_S2_Nak(void) history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - const pdu_header_t dummy_ph; - const pdu_header_t *arg_ph = &dummy_ph; + const CF_CFDP_PduHeader_t dummy_ph; + const CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; uint32 initial_recv_error = Any_uint32(); int context_CF_CFDP_RecvNak_forced_num_sr = Any_int(); transaction_t *context_CF_CFDP_ArmAckTimer; @@ -2622,8 +2628,8 @@ void Test_CF_CFDP_S2_WaitForEofAck_CallTo_CF_CFDP_RecvAck_Returns_neg1_SendEvent history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - const pdu_header_t dummy_ph; - const pdu_header_t *arg_ph = &dummy_ph; + const CF_CFDP_PduHeader_t dummy_ph; + const CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; uint32 initial_recv_error = Any_uint32(); const char *expected_Spec = "CF S%d(%u:%u): received invalid eof pdu"; CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; @@ -2660,14 +2666,14 @@ void Test_CF_CFDP_S2_WaitForEofAck_CallTo_CF_CFDP_RecvAck_Returns_0_And_t_histor void) { /* Arrange */ - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - const pdu_header_t dummy_ph; - const pdu_header_t *arg_ph = &dummy_ph; + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + const CF_CFDP_PduHeader_t dummy_ph; + const CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_RecvAck), 0); /* 0 is pass */ @@ -2693,14 +2699,14 @@ void Test_CF_CFDP_S2_WaitForEofAck_CallTo_CF_CFDP_RecvAck_Returns_0_And_t_histor void) { /* Arrange */ - history_t dummy_history; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - const pdu_header_t dummy_ph; - const pdu_header_t *arg_ph = &dummy_ph; + history_t dummy_history; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + const CF_CFDP_PduHeader_t dummy_ph; + const CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except(CC_NO_ERROR); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_NO_ERROR); UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_RecvAck), 0); /* 0 is pass */ @@ -2795,7 +2801,7 @@ void Test_CF_CFDP_S_DispatchRecv_DidNotHaveFlagsSetBut_fdh_directive_code_IsEqTo transaction_t dummy_t; transaction_t *arg_t = &dummy_t; uint8 dummy_chan_num = Any_cf_chan_num(); - uint8 dummy_flags = PDU_INVALID_MAX; + uint8 dummy_flags = CF_CFDP_FileDirective_INVALID_MAX; uint16 initial_recv_spurious = Any_uint16(); const char *expected_Spec = "CF S%d(%u:%u): received pdu with invalid directive code %d for sub-state %d"; void *arg_fns = NULL; @@ -2848,7 +2854,7 @@ void Test_CF_CFDP_S_DispatchRecv_DidNotHaveFlagsSetBut_fdh_directive_code_IsGrea transaction_t dummy_t; transaction_t *arg_t = &dummy_t; uint8 dummy_chan_num = Any_cf_chan_num(); - uint8 dummy_flags = Any_uint8_GreaterThan(PDU_INVALID_MAX); + uint8 dummy_flags = Any_uint8_GreaterThan(CF_CFDP_FileDirective_INVALID_MAX); uint16 initial_recv_spurious = Any_uint16(); const char *expected_Spec = "CF S%d(%u:%u): received pdu with invalid directive code %d for sub-state %d"; void *arg_fns = NULL; @@ -2903,7 +2909,8 @@ void Test_CF_CFDP_S_DispatchRecv_Received_msg_ph_As_fdh_Has_flags_LessThan_PDU_I uint8 dummy_sub_state = 0; /* 0 = always choose Dummy_fns_CF_CFDP_S_DispatchRecv */ uint8 dummy_flags = 0; /* 0 = always choose Dummy_fns_CF_CFDP_S_DispatchRecv */ uint16 initial_recv_spurious = Any_uint16(); - void (*const arg_fns[SEND_NUM_STATES][PDU_INVALID_MAX])(transaction_t *, const pdu_header_t *) = { + void (*const arg_fns[SEND_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])(transaction_t *, + const CF_CFDP_PduHeader_t *) = { {Dummy_fns_CF_CFDP_S_DispatchRecv, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, /* SEND_METADATA */ {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, /* SEND_FILEDATA */ @@ -2946,9 +2953,10 @@ void Test_CF_CFDP_S_DispatchRecv_Received_msg_ph_As_fdh_Has_flags_LessThan_PDU_I transaction_t *arg_t = &dummy_t; uint8 dummy_chan_num = Any_cf_chan_num(); uint8 dummy_sub_state = Any_uint8_LessThan(SEND_NUM_STATES); - uint8 dummy_flags = Any_uint8_LessThan(PDU_INVALID_MAX); + uint8 dummy_flags = Any_uint8_LessThan(CF_CFDP_FileDirective_INVALID_MAX); uint16 initial_recv_spurious = Any_uint16(); - void (*const arg_fns[SEND_NUM_STATES][PDU_INVALID_MAX])(transaction_t *, const pdu_header_t *) = {{NULL}}; + void (*const arg_fns[SEND_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])(transaction_t *, + const CF_CFDP_PduHeader_t *) = {{NULL}}; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -2991,7 +2999,7 @@ void Test_CF_CFDP_S1_Recv_SendsAll_NULL_fns_To_CF_CFDP_S_DispatchRecv(void) CF_UT_inmsg_buffer_t dummy_msg; uint8 dummy_chan_num = Any_cf_chan_num(); uint8 dummy_sub_state = Any_uint8_LessThan(SEND_NUM_STATES); - uint8 dummy_flags = Any_uint8_LessThan(PDU_INVALID_MAX); + uint8 dummy_flags = Any_uint8_LessThan(CF_CFDP_FileDirective_INVALID_MAX); uint16 initial_recv_spurious = Any_uint16(); memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -3026,7 +3034,8 @@ void Test_CF_CFDP_S1_Recv_SendsAll_NULL_fns_To_CF_CFDP_S_DispatchRecv(void) ** TODO: Another example of how the lack of isolation and bad production code desing lead to unit testing nightmares ** Currently (as of the writing of this comment), there is a double array created within the CF_CFDP_S2_Recv ** method that is passed into CF_CFDP_S_DispatchRecv, an unstubbable method. The size of the double -** array is [SEND_NUM_STATES][PDU_INVALID_MAX] and is [6][11] -- or 66 different possible values that may be +** array is [SEND_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX] and is [6][11] -- or 66 different possible +*values that may be ** used in CF_CFDP_S_DispatchRecv. Because it cannot be subbed, the only way to verify the array passed into ** the method is to run 66 tests (!!!), using each array value and then to setup the test in the way that will *run @@ -3935,12 +3944,12 @@ void Test_CF_CFDP_S_Tick_When_sub_state_IsEqTo_SEND_SEND_FIN_ACK_Call_CF_CFDP_S_ /* Assert CF_CFDP_S_SubstateSendFinAck */ UtAssert_STUB_COUNT(CF_CFDP_SendAck, 1); UtAssert_ADDRESS_EQ(context_CF_CFDP_SendAck.t, arg_t); - UtAssert_True(context_CF_CFDP_SendAck.ts == ACK_TS_ACTIVE, - "CF_CFDP_SendAck received ts %u and should be %u (ACK_TS_ACTIVE)", context_CF_CFDP_SendAck.ts, - ACK_TS_ACTIVE); - UtAssert_True(context_CF_CFDP_SendAck.dir_code == PDU_FIN, - "CF_CFDP_SendAck received dir_code %u and should be %u (PDU_FIN)", context_CF_CFDP_SendAck.dir_code, - PDU_FIN); + UtAssert_True(context_CF_CFDP_SendAck.ts == CF_CFDP_AckTxnStatus_ACTIVE, + "CF_CFDP_SendAck received ts %u and should be %u (CF_CFDP_AckTxnStatus_ACTIVE)", + context_CF_CFDP_SendAck.ts, CF_CFDP_AckTxnStatus_ACTIVE); + UtAssert_True(context_CF_CFDP_SendAck.dir_code == CF_CFDP_FileDirective_FIN, + "CF_CFDP_SendAck received dir_code %u and should be %u (CF_CFDP_FileDirective_FIN)", + context_CF_CFDP_SendAck.dir_code, CF_CFDP_FileDirective_FIN); UtAssert_True(context_CF_CFDP_SendAck.cc == arg_t->state_data.s.s2.fin_cc, "CF_CFDP_SendAck received cc %u and should be %u (t->state_data.s.s2.fin_cc)", context_CF_CFDP_SendAck.cc, arg_t->state_data.s.s2.fin_cc); diff --git a/unit-test/cf_cfdp_tests.c b/unit-test/cf_cfdp_tests.c index d408c3bc3..4f45a2673 100644 --- a/unit-test/cf_cfdp_tests.c +++ b/unit-test/cf_cfdp_tests.c @@ -105,11 +105,11 @@ uint8 Any_cfdp_state_t_ExceptThese(uint8 exceptions[], uint8 num_exceptions) return random_val; } -file_directive_t Any_file_directive_t_Except(file_directive_t exception) +CF_CFDP_FileDirective_t Any_file_directive_t_Except(CF_CFDP_FileDirective_t exception) { - uint8 num_tries = 0; - uint8 max_tries = 10; - file_directive_t rand_val = rand() % PDU_INVALID_MAX; + uint8 num_tries = 0; + uint8 max_tries = 10; + CF_CFDP_FileDirective_t rand_val = rand() % CF_CFDP_FileDirective_INVALID_MAX; while (rand_val == exception) { @@ -119,7 +119,7 @@ file_directive_t Any_file_directive_t_Except(file_directive_t exception) UtAssert_Abort(__func__); } - rand_val = rand() % PDU_INVALID_MAX; + rand_val = rand() % CF_CFDP_FileDirective_INVALID_MAX; } return rand_val; @@ -130,15 +130,15 @@ direction_t Any_direction_t(void) return (direction_t)Any_uint8_LessThan(CF_DIR_NUM); } -cfdp_class_t Any_cfdp_class_t(void) +CF_CFDP_Class_t Any_cfdp_class_t(void) { if (AnyCoinFlip()) { - return CLASS_1; + return CF_CFDP_CLASS_1; } else { - return CLASS_2; + return CF_CFDP_CLASS_2; } } @@ -391,10 +391,10 @@ void Test_CF_CFDP_GetClass_AssertsBecause_q_index_IsEqTo_CF_Q_FREE(void) void Test_CF_CFDP_GetClass_WhenNeitherStateIsSet_Return_CLASS_1(void) { /* Arrange */ - uint8 excepted_states[2] = {CFDP_S2, CFDP_R2}; - transaction_t dummy_ti; - transaction_t *arg_ti = &dummy_ti; - cfdp_class_t local_result; + uint8 excepted_states[2] = {CFDP_S2, CFDP_R2}; + transaction_t dummy_ti; + transaction_t *arg_ti = &dummy_ti; + CF_CFDP_Class_t local_result; arg_ti->flags.com.q_index = Any_cf_queue_index_t_Except(CF_Q_FREE); arg_ti->state = Any_cfdp_state_t_ExceptThese(excepted_states, sizeof(excepted_states) / sizeof(excepted_states[0])); @@ -403,16 +403,16 @@ void Test_CF_CFDP_GetClass_WhenNeitherStateIsSet_Return_CLASS_1(void) local_result = CF_CFDP_GetClass(arg_ti); /* Assert */ - UtAssert_True(local_result == CLASS_1, "CF_CFDP_GetClass returned %u and should be %u (CLASS_1)", local_result, - CLASS_1); + UtAssert_True(local_result == CF_CFDP_CLASS_1, "CF_CFDP_GetClass returned %u and should be %u (CF_CFDP_CLASS_1)", + local_result, CF_CFDP_CLASS_1); } /* end Test_CF_CFDP_GetClass_WhenNeitherStateIsSet_Return_CLASS_1 */ void Test_CF_CFDP_GetClass_WhenStateIs_CFDP_S2_Return_CLASS_1(void) { /* Arrange */ - transaction_t dummy_ti; - transaction_t *arg_ti = &dummy_ti; - cfdp_class_t local_result; + transaction_t dummy_ti; + transaction_t *arg_ti = &dummy_ti; + CF_CFDP_Class_t local_result; arg_ti->flags.com.q_index = Any_cf_queue_index_t_Except(CF_Q_FREE); arg_ti->state = CFDP_S2; @@ -421,16 +421,16 @@ void Test_CF_CFDP_GetClass_WhenStateIs_CFDP_S2_Return_CLASS_1(void) local_result = CF_CFDP_GetClass(arg_ti); /* Assert */ - UtAssert_True(local_result == CLASS_2, "CF_CFDP_GetClass returned %u and should be %u (CLASS_2)", local_result, - CLASS_2); + UtAssert_True(local_result == CF_CFDP_CLASS_2, "CF_CFDP_GetClass returned %u and should be %u (CF_CFDP_CLASS_2)", + local_result, CF_CFDP_CLASS_2); } /* end Test_CF_CFDP_GetClass_WhenStateIs_CFDP_S2_Return_CLASS_1 */ void Test_CF_CFDP_GetClass_WhenStateIs_CFDP_R2_Return_CLASS_1(void) { /* Arrange */ - transaction_t dummy_ti; - transaction_t *arg_ti = &dummy_ti; - cfdp_class_t local_result; + transaction_t dummy_ti; + transaction_t *arg_ti = &dummy_ti; + CF_CFDP_Class_t local_result; arg_ti->flags.com.q_index = Any_cf_queue_index_t_Except(CF_Q_FREE); arg_ti->state = CFDP_R2; @@ -439,8 +439,8 @@ void Test_CF_CFDP_GetClass_WhenStateIs_CFDP_R2_Return_CLASS_1(void) local_result = CF_CFDP_GetClass(arg_ti); /* Assert */ - UtAssert_True(local_result == CLASS_2, "CF_CFDP_GetClass returned %u and should be %u (CLASS_2)", local_result, - CLASS_2); + UtAssert_True(local_result == CF_CFDP_CLASS_2, "CF_CFDP_GetClass returned %u and should be %u (CF_CFDP_CLASS_2)", + local_result, CF_CFDP_CLASS_2); } /* end Test_CF_CFDP_GetClass_WhenStateIs_CFDP_R2_Return_CLASS_1 */ /* end CF_CFDP_GetClass tests */ @@ -1241,13 +1241,13 @@ void Test_CF_CFDP_FindTransactionBySequenceNumber__When_history_And_context_Matc void Test_CF_CFDP_FindTransactionBySequenceNumber_DoNotFindTransaction(void) { /* Arrange */ - channel_t dummy_c; - channel_t *arg_c = &dummy_c; - cf_transaction_seq_t arg_transaction_sequence_number = Any_uint32(); - cf_entity_id_t arg_src_eid = Any_uint8(); - clist_node expected_ptrs[NUM_CLISTS]; - transaction_t *local_result; - int i = 0; + channel_t dummy_c; + channel_t *arg_c = &dummy_c; + CF_TransactionSeq_t arg_transaction_sequence_number = Any_uint32(); + CF_EntityId_t arg_src_eid = Any_uint8(); + clist_node expected_ptrs[NUM_CLISTS]; + transaction_t *local_result; + int i = 0; CF_CList_Traverse_FIND_T_BY_SEQ_NUM_context_t context_CF_CList_Traverse[NUM_CLISTS]; @@ -1292,15 +1292,15 @@ void Test_CF_CFDP_FindTransactionBySequenceNumber_DoNotFindTransaction(void) void Test_CF_CFDP_FindTransactionBySequenceNumber_FindTransactionOnLastClist(void) { /* Arrange */ - channel_t dummy_c; - channel_t *arg_c = &dummy_c; - cf_transaction_seq_t arg_transaction_sequence_number = Any_uint32(); - cf_entity_id_t arg_src_eid = Any_uint8(); - clist_node expected_ptrs[NUM_CLISTS]; - transaction_t dummy_result; - transaction_t *expected_result = &dummy_result; - transaction_t *local_result; - int i = 0; + channel_t dummy_c; + channel_t *arg_c = &dummy_c; + CF_TransactionSeq_t arg_transaction_sequence_number = Any_uint32(); + CF_EntityId_t arg_src_eid = Any_uint8(); + clist_node expected_ptrs[NUM_CLISTS]; + transaction_t dummy_result; + transaction_t *expected_result = &dummy_result; + transaction_t *local_result; + int i = 0; CF_CList_Traverse_FIND_T_BY_SEQ_NUM_context_t context_CF_CList_Traverse[NUM_CLISTS]; @@ -1360,7 +1360,7 @@ void Test_CF_CFDP_MsgOutGet_When_CF_AppData_engine_out_msg_Is_notNULL_ReturnPoin transaction_t dummy_t; transaction_t *arg_t = &dummy_t; int arg_silent = Any_int(); - pdu_header_t *local_result; + CF_CFDP_PduHeader_t *local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -1384,12 +1384,12 @@ void Test_CF_CFDP_MsgOutGet_WhenChannel_max_outgoing_messages_per_wakeup_Is_0_An void) { /* Arrange */ - cf_config_table_t dummy_config_table; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - uint32 initial_outgoing_counter = Any_uint32(); - int arg_silent = Any_int(); - pdu_header_t *local_result; + cf_config_table_t dummy_config_table; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + uint32 initial_outgoing_counter = Any_uint32(); + int arg_silent = Any_int(); + CF_CFDP_PduHeader_t *local_result; arg_t->chan_num = Any_cf_chan_num(); @@ -1406,7 +1406,7 @@ void Test_CF_CFDP_MsgOutGet_WhenChannel_max_outgoing_messages_per_wakeup_Is_0_An /* Assert */ UtAssert_MIR("JIRA: GSFCCFS-1726 No coverage impact - Does not return NULL when it should, returns 0x10 " - "(&((pdu_s_msg_t*)NULL)->ph"); + "(&((CF_PduSendMsg_t*)NULL)->ph"); UtPrintf("The returned value is %p", (void *)local_result); // UtAssert_NULL(local_result); UtAssert_True(CF_AppData.engine.outgoing_counter == initial_outgoing_counter, @@ -1419,12 +1419,12 @@ void Test_CF_CFDP_MsgOutGet_When_outgoing_counter_DoesNotEq_max_outgoing_message void) { /* Arrange */ - cf_config_table_t dummy_config_table; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - uint32 initial_outgoing_counter; - int arg_silent = Any_int(); - pdu_header_t *local_result; + cf_config_table_t dummy_config_table; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + uint32 initial_outgoing_counter; + int arg_silent = Any_int(); + CF_CFDP_PduHeader_t *local_result; arg_t->chan_num = Any_cf_chan_num(); @@ -1444,7 +1444,7 @@ void Test_CF_CFDP_MsgOutGet_When_outgoing_counter_DoesNotEq_max_outgoing_message /* Assert */ UtAssert_MIR("JIRA: GSFCCFS-1726 No coverage impact - Does not return NULL when it should, returns 0x10 " - "(&((pdu_s_msg_t*)NULL)->ph"); + "(&((CF_PduSendMsg_t*)NULL)->ph"); UtPrintf("The returned value is %p", (void *)local_result); // UtAssert_NULL(local_result);; UtAssert_True(CF_AppData.engine.outgoing_counter == initial_outgoing_counter, @@ -1458,12 +1458,12 @@ void Test_CF_CFDP_MsgOutGet_When_max_outgoing_messages_per_wakeup_IsNot_0_And_ou void) { /* Arrange */ - cf_config_table_t dummy_config_table; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - uint32 initial_outgoing_counter; - int arg_silent = Any_int(); - pdu_header_t *local_result; + cf_config_table_t dummy_config_table; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + uint32 initial_outgoing_counter; + int arg_silent = Any_int(); + CF_CFDP_PduHeader_t *local_result; arg_t->chan_num = Any_cf_chan_num(); @@ -1500,13 +1500,13 @@ void Test_CF_CFDP_MsgOutGet_When_sem_name_0_Is_non0_But_CallTo_OS_CountSemTimedW void) { /* Arrange */ - cf_config_table_t dummy_config_table; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - uint32 initial_outgoing_counter; - int arg_silent = 0; - const char *expected_Spec = "CF: no output message buffer available"; - pdu_header_t *local_result; + cf_config_table_t dummy_config_table; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + uint32 initial_outgoing_counter; + int arg_silent = 0; + const char *expected_Spec = "CF: no output message buffer available"; + CF_CFDP_PduHeader_t *local_result; arg_t->chan_num = Any_cf_chan_num(); @@ -1552,12 +1552,12 @@ void Test_CF_CFDP_MsgOutGet_When_sem_name_0_Is_non0_But_CallTo_OS_CountSemTimedW void) { /* Arrange */ - cf_config_table_t dummy_config_table; - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - uint32 initial_outgoing_counter; - int arg_silent = Any_int_Except(0); - pdu_header_t *local_result; + cf_config_table_t dummy_config_table; + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + uint32 initial_outgoing_counter; + int arg_silent = Any_int_Except(0); + CF_CFDP_PduHeader_t *local_result; arg_t->chan_num = Any_cf_chan_num(); @@ -1601,7 +1601,7 @@ void Test_CF_CFDP_MsgOutGet_When_sem_name_0_Is_non0_Then_CallTo_OS_CountSemTimed transaction_t *arg_t = &dummy_t; uint32 initial_outgoing_counter; int arg_silent = 0; - pdu_header_t *local_result; + CF_CFDP_PduHeader_t *local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -1631,7 +1631,7 @@ void Test_CF_CFDP_MsgOutGet_When_sem_name_0_Is_non0_Then_CallTo_OS_CountSemTimed local_result = CF_CFDP_MsgOutGet(arg_t, arg_silent); /* Assert */ - UtAssert_ADDRESS_EQ(local_result, &((pdu_s_msg_t *)forced_return_CFE_SB_AllocateMessageBuffer)->ph); + UtAssert_ADDRESS_EQ(local_result, &((CF_PduSendMsg_t *)forced_return_CFE_SB_AllocateMessageBuffer)->ph); UtAssert_STUB_COUNT(CFE_EVS_SendEvent, 0); UtAssert_STUB_COUNT(CFE_MSG_Init, 1); UtAssert_UINT32_EQ(CF_AppData.engine.outgoing_counter, initial_outgoing_counter + 1); @@ -1650,7 +1650,7 @@ void Test_CF_CFDP_MsgOutGet_When_sem_name_0_Is_0_Then_CallTo_OS_CountSemTimedWai transaction_t *arg_t = &dummy_t; uint32 initial_outgoing_counter; int arg_silent = 0; - pdu_header_t *local_result; + CF_CFDP_PduHeader_t *local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -1777,9 +1777,9 @@ void Test_CF_CFDP_Send_InitializeMsgTimestampsItAndSendsIt(void) void Test_CF_CFDP_SetPduLength_SetGiven_ph_length_ToGiven_length(void) { /* Arrange */ - pdu_header_t dummy_ph; - pdu_header_t *arg_ph = &dummy_ph; - uint16 arg_length = Any_uint16(); + CF_CFDP_PduHeader_t dummy_ph; + CF_CFDP_PduHeader_t *arg_ph = &dummy_ph; + uint16 arg_length = Any_uint16(); arg_ph->length = Any_uint16_Except(arg_length); /* Act */ @@ -1805,12 +1805,12 @@ void Test_CF_CFDP_ConstructPduHeader_CallTo_CF_CFDP_MsgOutGet_Returns_NULL_DoNot uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; uint8 arg_directive_code = Any_uint8(); - cf_entity_id_t arg_src_eid = Any_uint8(); - cf_entity_id_t arg_dst_eid = Any_uint8(); + CF_EntityId_t arg_src_eid = Any_uint8(); + CF_EntityId_t arg_dst_eid = Any_uint8(); uint8 arg_towards_sender = Any_uint8(); - cf_transaction_seq_t arg_tsn = Any_uint32(); + CF_TransactionSeq_t arg_tsn = Any_uint32(); int arg_silent = Any_int(); - pdu_header_t *local_result; + CF_CFDP_PduHeader_t *local_result; /* Arrange for CF_CFDP_MsgOutGet*/ CF_AppData.engine.out.msg = NULL; @@ -1836,12 +1836,12 @@ void Test_CF_CFDP_ConstructPduHeader_Given_directive_code_0_CallTo_CF_CFDP_MsgOu uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; uint8 arg_directive_code = 0; - cf_entity_id_t arg_src_eid = Any_uint8(); - cf_entity_id_t arg_dst_eid = Any_uint8(); + CF_EntityId_t arg_src_eid = Any_uint8(); + CF_EntityId_t arg_dst_eid = Any_uint8(); uint8 arg_towards_sender = Any_uint8(); - cf_transaction_seq_t arg_tsn = Any_uint32(); + CF_TransactionSeq_t arg_tsn = Any_uint32(); int arg_silent = Any_int(); - pdu_header_t *local_result; + CF_CFDP_PduHeader_t *local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -1867,12 +1867,12 @@ void Test_CF_CFDP_ConstructPduHeader_Given_directive_code_1_CallTo_CF_CFDP_MsgOu uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; uint8 arg_directive_code = 1; - cf_entity_id_t arg_src_eid = Any_uint8(); - cf_entity_id_t arg_dst_eid = Any_uint8(); + CF_EntityId_t arg_src_eid = Any_uint8(); + CF_EntityId_t arg_dst_eid = Any_uint8(); uint8 arg_towards_sender = Any_uint8(); - cf_transaction_seq_t arg_tsn = Any_uint32(); + CF_TransactionSeq_t arg_tsn = Any_uint32(); int arg_silent = Any_int(); - pdu_header_t *local_result; + CF_CFDP_PduHeader_t *local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -2092,7 +2092,7 @@ void Test_CF_CFDP_SendMd_When_dst_len_Eq_sizeof_dst_filename_Return_CF_SEND_FAIL void Test_CF_CFDP_SendMd_Returns_CF_SEND_ERROR_CF_CFDP_CopyDataToLv_Returns_neg1_On_src_Call(void) { // /* Arrange */ - // pdu_md_t dummy_msg_out; + // CF_CFDP_PduMd_t dummy_msg_out; // history_t dummy_history; // transaction_t dummy_t; // transaction_t* arg_t = &dummy_t; @@ -2134,7 +2134,7 @@ void Test_CF_CFDP_SendMd_Returns_CF_SEND_ERROR_CF_CFDP_CopyDataToLv_Returns_neg1 void Test_CF_CFDP_SendMd_WhenCallTo_CF_CFDP_CopyDataToLv_Returns_neg1_OnThe_dst_Call_Return_CF_SEND_ERROR(void) { // /* Arrange */ - // pdu_md_t dummy_msg_out; + // CF_CFDP_PduMd_t dummy_msg_out; // history_t dummy_history; // transaction_t dummy_t; // transaction_t* arg_t = &dummy_t; @@ -2231,7 +2231,7 @@ void Test_CF_CFDP_SendFd_When_len_GreaterThan_sizeof_pdu_pd_data_t_Return_CF_SEN /* Arrange */ transaction_t *arg_t = NULL; uint32 arg_offset = Any_uint32(); - int arg_len = sizeof(pdu_fd_data_t) + 1; + int arg_len = sizeof(CF_CFDP_PduFileDataContent_t) + 1; cfdp_send_ret_t local_result; /* Act */ @@ -2249,7 +2249,7 @@ void Test_CF_CFDP_SendFd_Return_CF_SEND_SUCCESS(void) transaction_t dummy_t; transaction_t *arg_t = &dummy_t; uint32 arg_offset = Any_uint32(); - int arg_len = sizeof(pdu_fd_data_t) - 1; + int arg_len = sizeof(CF_CFDP_PduFileDataContent_t) - 1; cfdp_send_ret_t local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -2281,9 +2281,9 @@ void Test_CF_CFDP_SendFd_Return_CF_SEND_SUCCESS(void) void Test_CF_CFDP_FinishEofAck_SetExpectedValues(void) { /* Arrange */ - tlv_t dummy_tlv; - tlv_t *arg_tlv = &dummy_tlv; - cf_entity_id_t dummy_eid = Any_uint8(); + CF_CFDP_tlv_t dummy_tlv; + CF_CFDP_tlv_t *arg_tlv = &dummy_tlv; + CF_EntityId_t dummy_eid = Any_uint8(); cf_config_table_t dummy_config_table; int forced_return_CF_GetMemcpySize = Any_int(); int local_result; @@ -2298,9 +2298,9 @@ void Test_CF_CFDP_FinishEofAck_SetExpectedValues(void) local_result = CF_CFDP_FinishEofAck(arg_tlv); /* Assert */ - UtAssert_True(local_result == offsetof(tlv_t, data) + forced_return_CF_GetMemcpySize, - "CF_CFDP_FinishEofAck returned %d and should be %lu (offsetof(tlv_t, data) + %d (csize)", - local_result, offsetof(tlv_t, data), forced_return_CF_GetMemcpySize); + UtAssert_True(local_result == offsetof(CF_CFDP_tlv_t, data) + forced_return_CF_GetMemcpySize, + "CF_CFDP_FinishEofAck returned %d and should be %lu (offsetof(CF_CFDP_tlv_t, data) + %d (csize)", + local_result, offsetof(CF_CFDP_tlv_t, data), forced_return_CF_GetMemcpySize); UtAssert_STUB_COUNT(CF_GetMemcpySize, 1); UtAssert_STUB_COUNT(CF_MemcpyToBE, 1); } /* end Test_CF_CFDP_FinishEofAck_SetExpectedValues */ @@ -2358,7 +2358,7 @@ void Test_CF_CFDP_SendEof_SuccessWithNoError(void) CF_AppData.config_table = &dummy_config_table; arg_t->history = &dummy_history; - arg_t->history->cc = CC_NO_ERROR; + arg_t->history->cc = CF_CFDP_ConditionCode_NO_ERROR; /* Arrange for CF_CFDP_MsgOutGet*/ CF_AppData.engine.out.msg = &dummy_eof.cfe_sb_buffer; @@ -2391,7 +2391,7 @@ void Test_CF_CFDP_SendEof_SuccessWithError(void) CF_AppData.config_table = &dummy_config_table; arg_t->history = &dummy_history; - arg_t->history->cc = Any_uint8_Except(CC_NO_ERROR); + arg_t->history->cc = Any_uint8_Except(CF_CFDP_ConditionCode_NO_ERROR); /* Arrange for CF_CFDP_MsgOutGet*/ CF_AppData.engine.out.msg = &dummy_eof.cfe_sb_buffer; @@ -2425,16 +2425,16 @@ void Test_CF_CFDP_SendEof_SuccessWithError(void) void Test_CF_CFDP_SendAck_When_CF_CFDP_IsSender_Returns_false_Get_NULL_ph_Return_CF_SEND_NO_MSG(void) { /* Arrange */ - cf_config_table_t dummy_config_table; - history_t dummy_history; - uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); - transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; - ack_transaction_status_t arg_ts = Any_uint8(); - file_directive_t arg_dir_code = Any_uint8(); - condition_code_t arg_cc = Any_uint8(); - cf_entity_id_t arg_peer_eid = Any_uint8(); - cf_transaction_seq_t arg_tsn = Any_uint8(); - cfdp_send_ret_t local_result; + cf_config_table_t dummy_config_table; + history_t dummy_history; + uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); + transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; + CF_CFDP_AckTxnStatus_t arg_ts = Any_uint8(); + CF_CFDP_FileDirective_t arg_dir_code = Any_uint8(); + CF_CFDP_ConditionCode_t arg_cc = Any_uint8(); + CF_EntityId_t arg_peer_eid = Any_uint8(); + CF_TransactionSeq_t arg_tsn = Any_uint8(); + cfdp_send_ret_t local_result; CF_AppData.config_table = &dummy_config_table; arg_t->history = &dummy_history; @@ -2462,17 +2462,17 @@ void Test_CF_CFDP_SendAck_When_CF_CFDP_IsSender_Returns_false_Get_NULL_ph_Return void Test_CF_CFDP_SendAck_AssertsBecauseGiven_dir_code_Is_Not_PDU_EOF_Or_PDU_FIN(void) { // /* Arrange */ - // pdu_ack_t dummy_ack; + // CF_CFDP_PduAck_t dummy_ack; // cf_config_table_t dummy_config_table; // history_t dummy_history; // uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); // transaction_t* arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; - // ack_transaction_status_t arg_ts = Any_uint8(); - // uint8 exceptions[2] = {PDU_EOF, PDU_FIN}; - // file_directive_t arg_dir_code = Any_uint8_ExceptThese(exceptions, 2); - // condition_code_t arg_cc = Any_uint8(); - // cf_entity_id_t arg_peer_eid = Any_uint8(); - // cf_transaction_seq_t arg_tsn = Any_uint8(); + // CF_CFDP_AckTxnStatus_t arg_ts = Any_uint8(); + // uint8 exceptions[2] = {CF_CFDP_FileDirective_EOF, CF_CFDP_FileDirective_FIN}; + // CF_CFDP_FileDirective_t arg_dir_code = Any_uint8_ExceptThese(exceptions, 2); + // CF_CFDP_ConditionCode_t arg_cc = Any_uint8(); + // CF_EntityId_t arg_peer_eid = Any_uint8(); + // CF_TransactionSeq_t arg_tsn = Any_uint8(); // cfdp_send_ret_t local_result; // CF_AppData.config_table = &dummy_config_table; @@ -2497,24 +2497,25 @@ void Test_CF_CFDP_SendAck_AssertsBecauseGiven_dir_code_Is_Not_PDU_EOF_Or_PDU_FIN // UtAssert_True(local_result == CF_SEND_NO_MSG, // "CF_CFDP_SendAck returned %u and should be %u (CF_SEND_NO_MSG)", // local_result, CF_SEND_NO_MSG); - UtAssert_MIR("JIRA: GSFCCFS-1733 CF_Assert - (dir_code==PDU_EOF)||(dir_code==PDU_FIN)"); + UtAssert_MIR( + "JIRA: GSFCCFS-1733 CF_Assert - (dir_code==CF_CFDP_FileDirective_EOF)||(dir_code==CF_CFDP_FileDirective_FIN)"); } /* end Test_CF_CFDP_SendAck_AssertsBecauseGiven_dir_code_Is_Not_PDU_EOF_Or_PDU_FIN */ void Test_CF_CFDP_SendAck_WhenGiven_dir_code_Is_PDU_EOF_And_CF_CFDP_IsSender_Returns_true_GetMsg_pdu_Return_CF_SEND_NO_MSG( void) { /* Arrange */ - CF_UT_outmsg_buffer_t dummy_ack; - cf_config_table_t dummy_config_table; - history_t dummy_history; - uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); - transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; - ack_transaction_status_t arg_ts = Any_uint8(); - file_directive_t arg_dir_code = PDU_EOF; - condition_code_t arg_cc = Any_uint8(); - cf_entity_id_t arg_peer_eid = Any_uint8(); - cf_transaction_seq_t arg_tsn = Any_uint8(); - cfdp_send_ret_t local_result; + CF_UT_outmsg_buffer_t dummy_ack; + cf_config_table_t dummy_config_table; + history_t dummy_history; + uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); + transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; + CF_CFDP_AckTxnStatus_t arg_ts = Any_uint8(); + CF_CFDP_FileDirective_t arg_dir_code = CF_CFDP_FileDirective_EOF; + CF_CFDP_ConditionCode_t arg_cc = Any_uint8(); + CF_EntityId_t arg_peer_eid = Any_uint8(); + CF_TransactionSeq_t arg_tsn = Any_uint8(); + cfdp_send_ret_t local_result; memset(&dummy_ack, 0, sizeof(dummy_ack)); @@ -2547,17 +2548,17 @@ void Test_CF_CFDP_SendAck_WhenGiven_dir_code_Is_PDU_FIN_And_CF_CFDP_IsSender_Ret void) { /* Arrange */ - CF_UT_outmsg_buffer_t dummy_ack; - cf_config_table_t dummy_config_table; - history_t dummy_history; - uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); - transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; - ack_transaction_status_t arg_ts = Any_uint8(); - file_directive_t arg_dir_code = PDU_EOF; - condition_code_t arg_cc = Any_uint8(); - cf_entity_id_t arg_peer_eid = Any_uint8(); - cf_transaction_seq_t arg_tsn = Any_uint8(); - cfdp_send_ret_t local_result; + CF_UT_outmsg_buffer_t dummy_ack; + cf_config_table_t dummy_config_table; + history_t dummy_history; + uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); + transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; + CF_CFDP_AckTxnStatus_t arg_ts = Any_uint8(); + CF_CFDP_FileDirective_t arg_dir_code = CF_CFDP_FileDirective_EOF; + CF_CFDP_ConditionCode_t arg_cc = Any_uint8(); + CF_EntityId_t arg_peer_eid = Any_uint8(); + CF_TransactionSeq_t arg_tsn = Any_uint8(); + cfdp_send_ret_t local_result; memset(&dummy_ack, 0, sizeof(dummy_ack)); @@ -2599,14 +2600,14 @@ void Test_CF_CFDP_SendAck_WhenGiven_dir_code_Is_PDU_FIN_And_CF_CFDP_IsSender_Ret void Test_CF_CFDP_SendFin_Get_NULL_ph_Return_CF_SEND_NO_MSG(void) { /* Arrange */ - cf_config_table_t dummy_config_table; - history_t dummy_history; - uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); - transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; - fin_delivery_code_t arg_dc = Any_uint8(); - fin_file_status_t arg_fs = Any_uint8(); - condition_code_t arg_cc = Any_uint8(); - cfdp_send_ret_t local_result; + cf_config_table_t dummy_config_table; + history_t dummy_history; + uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); + transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; + CF_CFDP_FinDeliveryCode_t arg_dc = Any_uint8(); + CF_CFDP_FinFileStatus_t arg_fs = Any_uint8(); + CF_CFDP_ConditionCode_t arg_cc = Any_uint8(); + cfdp_send_ret_t local_result; arg_t->history = &dummy_history; CF_AppData.config_table = &dummy_config_table; @@ -2630,15 +2631,15 @@ void Test_CF_CFDP_SendFin_Get_NULL_ph_Return_CF_SEND_NO_MSG(void) void Test_CF_CFDP_SendFin_Given_cc_NotEqTo_CC_NO_ERROR_GetNull_ph_Return_CF_SEND_SUCCESS(void) { /* Arrange */ - CF_UT_outmsg_buffer_t dummy_ack; - cf_config_table_t dummy_config_table; - history_t dummy_history; - uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); - transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; - fin_delivery_code_t arg_dc = Any_uint8(); - fin_file_status_t arg_fs = Any_uint8(); - condition_code_t arg_cc = CC_POS_ACK_LIMIT_REACHED; - cfdp_send_ret_t local_result; + CF_UT_outmsg_buffer_t dummy_ack; + cf_config_table_t dummy_config_table; + history_t dummy_history; + uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); + transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; + CF_CFDP_FinDeliveryCode_t arg_dc = Any_uint8(); + CF_CFDP_FinFileStatus_t arg_fs = Any_uint8(); + CF_CFDP_ConditionCode_t arg_cc = CF_CFDP_ConditionCode_POS_ACK_LIMIT_REACHED; + cfdp_send_ret_t local_result; memset(&dummy_ack, 0, sizeof(dummy_ack)); @@ -2664,15 +2665,15 @@ void Test_CF_CFDP_SendFin_Given_cc_NotEqTo_CC_NO_ERROR_GetNull_ph_Return_CF_SEND void Test_CF_CFDP_SendFin_Given_cc_EqTo_CC_NO_ERROR_GetNull_ph_Return_CF_SEND_SUCCESS(void) { /* Arrange */ - CF_UT_outmsg_buffer_t dummy_ack; - cf_config_table_t dummy_config_table; - history_t dummy_history; - uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); - transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; - fin_delivery_code_t arg_dc = Any_uint8(); - fin_file_status_t arg_fs = Any_uint8(); - condition_code_t arg_cc = CC_NO_ERROR; - cfdp_send_ret_t local_result; + CF_UT_outmsg_buffer_t dummy_ack; + cf_config_table_t dummy_config_table; + history_t dummy_history; + uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); + transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; + CF_CFDP_FinDeliveryCode_t arg_dc = Any_uint8(); + CF_CFDP_FinFileStatus_t arg_fs = Any_uint8(); + CF_CFDP_ConditionCode_t arg_cc = CF_CFDP_ConditionCode_NO_ERROR; + cfdp_send_ret_t local_result; memset(&dummy_ack, 0, sizeof(dummy_ack)); memset(&dummy_config_table, 0, sizeof(dummy_config_table)); @@ -2714,7 +2715,7 @@ void Test_CF_CFDP_SendNak_GetNull_ph_Return_CF_SEND_NO_MSG(void) // int arg_num_segment_requests = 0; // cfdp_send_ret_t local_result; - // ((pdu_s_msg_t*)CF_AppData.engine.out.msg)->ph = NULL; + // ((CF_PduSendMsg_t*)CF_AppData.engine.out.msg)->ph = NULL; // /* Act */ // local_result = CF_CFDP_SendNak(arg_t, arg_num_segment_requests); @@ -2729,7 +2730,7 @@ void Test_CF_CFDP_SendNak_GetNull_ph_Return_CF_SEND_NO_MSG(void) void Test_CF_CFDP_SendNak_AssertsBecause_CF_CFDP_GetClass_With_t_Eq_CLASS_2(void) { // /* Arrange */ - // pdu_nak_t dummy_nak; + // CF_CFDP_PduNak_t dummy_nak; // uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); // transaction_t* arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; // int arg_num_segment_requests; @@ -2745,19 +2746,19 @@ void Test_CF_CFDP_SendNak_AssertsBecause_CF_CFDP_GetClass_With_t_Eq_CLASS_2(void // local_result = CF_CFDP_SendNak(arg_t, arg_num_segment_requests); // /* Assert */ - UtAssert_MIR("JIRA: GSFCCFS-1733 CF_Assert - CF_CFDP_GetClass(t)==CLASS_2"); + UtAssert_MIR("JIRA: GSFCCFS-1733 CF_Assert - CF_CFDP_GetClass(t)==CF_CFDP_CLASS_2"); } /* end Test_CF_CFDP_SendNak_AssertsBecause_CF_CFDP_GetClass_With_t_Eq_CLASS_2 */ void Test_CF_CFDP_SendNak_Success_Return_CF_SEND_SUCCESS(void) { /* Arrange */ CF_UT_outmsg_buffer_t dummy_msg; - pdu_nak_t *dummy_nak; + CF_CFDP_PduNak_t *dummy_nak; uint8 dummy_chan_num = Any_cf_chan_num(); uint8 dummy_transaction_num = Any_uint8_LessThan(CF_NUM_TRANSACTIONS); transaction_t *arg_t = &CF_AppData.engine.transactions[dummy_transaction_num]; int arg_num_segment_requests = 1; - int forced_return_CF_HeaderSize = sizeof(pdu_header_t); + int forced_return_CF_HeaderSize = sizeof(CF_CFDP_PduHeader_t); cfdp_send_ret_t local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -3066,7 +3067,7 @@ void Test_CF_CFDP_RecvMd_Has_bytes_received_LessThan_sizof_ph_Plus_size_of_pdu_m CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; - CF_AppData.engine.in.bytes_received = Any_uint32_LessThan(sizeof(pdu_md_t)); + CF_AppData.engine.in.bytes_received = Any_uint32_LessThan(sizeof(CF_CFDP_PduMd_t)); UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter, &context_CFE_EVS_SendEvent); @@ -3103,8 +3104,8 @@ void Test_CF_CFDP_RecvMd_HasFirst_lv_ret_LessThan_0_SendsEventCountErrorAndRetur CF_UT_inmsg_buffer_t dummy_msg; const char *expected_Spec = "CF: metadata pdu rejected due to invalid length in source filename of 0x%02x"; uint32 expected_counters_recv_error = Any_uint32(); - int force_return_CF_HeaderSize = sizeof(pdu_header_t); - pdu_md_t *dummy_md; + int force_return_CF_HeaderSize = sizeof(CF_CFDP_PduHeader_t); + CF_CFDP_PduMd_t *dummy_md; int local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -3112,7 +3113,7 @@ void Test_CF_CFDP_RecvMd_HasFirst_lv_ret_LessThan_0_SendsEventCountErrorAndRetur CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; dummy_md = &dummy_msg.content.cfdp.secondary.md; - CF_AppData.engine.in.bytes_received = sizeof(pdu_md_t) + force_return_CF_HeaderSize; + CF_AppData.engine.in.bytes_received = sizeof(CF_CFDP_PduMd_t) + force_return_CF_HeaderSize; UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); dummy_md->size = Any_uint32(); @@ -3122,7 +3123,7 @@ void Test_CF_CFDP_RecvMd_HasFirst_lv_ret_LessThan_0_SendsEventCountErrorAndRetur UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter, &context_CFE_EVS_SendEvent); /* Arrange unstubbable: CF_CFDP_CopyDataFromLv */ - ((lv_t *)dummy_md->filename_lvs)->length = 64; /* 64 is a fail for -1 return */ + ((CF_CFDP_lv_t *)dummy_md->filename_lvs)->length = 64; /* 64 is a fail for -1 return */ arg_t->chan_num = Any_cf_chan_num(); CF_AppData.hk.channel_hk[arg_t->chan_num].counters.recv.error = expected_counters_recv_error - 1; @@ -3154,8 +3155,8 @@ void Test_CF_CFDP_RecvMd_HasSecond_lv_ret_LessThan_0_BecauseLengthEqSizeSendEven CF_UT_inmsg_buffer_t dummy_msg; const char *expected_Spec = "CF: metadata pdu rejected due to invalid length in dest filename of 0x%02x"; uint32 expected_counters_recv_error = Any_uint32(); - int force_return_CF_HeaderSize = sizeof(pdu_header_t); - pdu_md_t *dummy_md; + int force_return_CF_HeaderSize = sizeof(CF_CFDP_PduHeader_t); + CF_CFDP_PduMd_t *dummy_md; int local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -3163,7 +3164,7 @@ void Test_CF_CFDP_RecvMd_HasSecond_lv_ret_LessThan_0_BecauseLengthEqSizeSendEven CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; dummy_md = &dummy_msg.content.cfdp.secondary.md; - CF_AppData.engine.in.bytes_received = sizeof(pdu_md_t) + force_return_CF_HeaderSize; + CF_AppData.engine.in.bytes_received = sizeof(CF_CFDP_PduMd_t) + force_return_CF_HeaderSize; UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); dummy_md->size = Any_uint32(); @@ -3173,8 +3174,8 @@ void Test_CF_CFDP_RecvMd_HasSecond_lv_ret_LessThan_0_BecauseLengthEqSizeSendEven UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter, &context_CFE_EVS_SendEvent); /* Arrange unstubbable: CF_CFDP_CopyDataFromLv */ - ((lv_t *)dummy_md->filename_lvs)->length = 1; /* 19 is arbitrary but small enough to work */ - ((lv_t *)(dummy_md->filename_lvs + 2))->length = 64; /* 64 is a fail for -1 return */ + ((CF_CFDP_lv_t *)dummy_md->filename_lvs)->length = 1; /* 19 is arbitrary but small enough to work */ + ((CF_CFDP_lv_t *)(dummy_md->filename_lvs + 2))->length = 64; /* 64 is a fail for -1 return */ arg_t->chan_num = Any_cf_chan_num(); CF_AppData.hk.channel_hk[arg_t->chan_num].counters.recv.error = expected_counters_recv_error - 1; @@ -3206,8 +3207,8 @@ void Test_CF_CFDP_RecvMd_WhenNoErrorConditions_SendEventAndReturn_0(void) CF_UT_inmsg_buffer_t dummy_msg; const char *expected_Spec = "CF: md received for source: %s, dest: %s"; uint32 initial_counters_recv_error = Any_uint32(); - int force_return_CF_HeaderSize = sizeof(pdu_header_t); - pdu_md_t *dummy_md; + int force_return_CF_HeaderSize = sizeof(CF_CFDP_PduHeader_t); + CF_CFDP_PduMd_t *dummy_md; int local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); @@ -3215,7 +3216,7 @@ void Test_CF_CFDP_RecvMd_WhenNoErrorConditions_SendEventAndReturn_0(void) CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; dummy_md = &dummy_msg.content.cfdp.secondary.md; - CF_AppData.engine.in.bytes_received = sizeof(pdu_md_t) + force_return_CF_HeaderSize; + CF_AppData.engine.in.bytes_received = sizeof(CF_CFDP_PduMd_t) + force_return_CF_HeaderSize; UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); dummy_md->size = Any_uint32(); @@ -3225,8 +3226,8 @@ void Test_CF_CFDP_RecvMd_WhenNoErrorConditions_SendEventAndReturn_0(void) UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter, &context_CFE_EVS_SendEvent); /* Arrange unstubbable: CF_CFDP_CopyDataFromLv */ - ((lv_t *)dummy_md->filename_lvs)->length = 1; /* 19 is arbitrary but small enough to work */ - ((lv_t *)(dummy_md->filename_lvs + 2))->length = 1; /* 1 gets us a success, for a non-negative return */ + ((CF_CFDP_lv_t *)dummy_md->filename_lvs)->length = 1; /* 19 is arbitrary but small enough to work */ + ((CF_CFDP_lv_t *)(dummy_md->filename_lvs + 2))->length = 1; /* 1 gets us a success, for a non-negative return */ arg_t->chan_num = Any_cf_chan_num(); CF_AppData.hk.channel_hk[arg_t->chan_num].counters.recv.error = initial_counters_recv_error; @@ -3282,7 +3283,7 @@ void Test_CF_CFDP_RecvFd_When_bytes_received_LessThan_sizeof_pdu_file_data_heade CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; CF_AppData.engine.in.bytes_received = Any_uint32_LessThan( - force_return_CF_HeaderSize + sizeof(pdu_file_data_header_t)); // TODO Any_CFE_MSG_Size_t_LessThan(); + force_return_CF_HeaderSize + sizeof(CF_CFDP_PduFileDataHeader_t)); // TODO Any_CFE_MSG_Size_t_LessThan(); arg_t->chan_num = Any_uint8_LessThan(CF_NUM_CHANNELS); CF_AppData.hk.channel_hk[arg_t->chan_num].counters.recv.error = expected_counters_recv_error - 1; @@ -3325,7 +3326,7 @@ void Test_CF_CFDP_RecvFd_When_bytes_received_EqTo_sizeof_pdu_file_data_header_t_ memset(&dummy_msg_in, 0, sizeof(dummy_msg_in)); CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; - CF_AppData.engine.in.bytes_received = force_return_CF_HeaderSize + sizeof(pdu_file_data_header_t); + CF_AppData.engine.in.bytes_received = force_return_CF_HeaderSize + sizeof(CF_CFDP_PduFileDataHeader_t); arg_t->chan_num = Any_uint8_LessThan(CF_NUM_CHANNELS); CF_AppData.hk.channel_hk[arg_t->chan_num].counters.recv.error = initial_counters_recv_error; @@ -3358,7 +3359,7 @@ void Test_CF_CFDP_RecvFd_When_bytes_received_GreaterThan_sizeof_pdu_file_data_he CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; CF_AppData.engine.in.bytes_received = - Any_uint32_GreaterThan(force_return_CF_HeaderSize + sizeof(pdu_file_data_header_t)); + Any_uint32_GreaterThan(force_return_CF_HeaderSize + sizeof(CF_CFDP_PduFileDataHeader_t)); arg_t->chan_num = Any_uint8_LessThan(CF_NUM_CHANNELS); CF_AppData.hk.channel_hk[arg_t->chan_num].counters.recv.error = initial_counters_recv_error; @@ -3406,7 +3407,7 @@ void Test_CF_CFDP_RecvEof_When_bytes_received_LessThan_offsetof_pdu_eof_t_fault_ CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; CF_AppData.engine.in.bytes_received = - Any_uint32_LessThan(force_return_CF_HeaderSize + offsetof(pdu_eof_t, fault_location)); + Any_uint32_LessThan(force_return_CF_HeaderSize + offsetof(CF_CFDP_PduEof_t, fault_location)); UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); @@ -3441,7 +3442,7 @@ void Test_CF_CFDP_RecvEof_BytesReceivedEq_offsetof_fault_location_Calls_cfdp_get memset(&dummy_msg_in, 0, sizeof(dummy_msg_in)); CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; - CF_AppData.engine.in.bytes_received = force_return_CF_HeaderSize + offsetof(pdu_eof_t, fault_location); + CF_AppData.engine.in.bytes_received = force_return_CF_HeaderSize + offsetof(CF_CFDP_PduEof_t, fault_location); UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); @@ -3470,7 +3471,7 @@ void Test_CF_CFDP_RecvEof_BytesReceivedGreaterThan_offsetof_fault_location_Calls CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; CF_AppData.engine.in.bytes_received = - Any_uint32_GreaterThan(force_return_CF_HeaderSize + offsetof(pdu_eof_t, fault_location)); + Any_uint32_GreaterThan(force_return_CF_HeaderSize + offsetof(CF_CFDP_PduEof_t, fault_location)); UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); @@ -3512,7 +3513,7 @@ void Test_CF_CFDP_RecvAck_FailsBecause_bytes_received_LessThan_sizeof_pdu_ack_t_ memset(&dummy_msg_in, 0, sizeof(dummy_msg_in)); CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; - CF_AppData.engine.in.bytes_received = Any_uint32_LessThan(sizeof(pdu_ack_t)); // Any_CFE_MSG_Size_t(); + CF_AppData.engine.in.bytes_received = Any_uint32_LessThan(sizeof(CF_CFDP_PduAck_t)); // Any_CFE_MSG_Size_t(); UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter, &context_CFE_EVS_SendEvent); @@ -3542,7 +3543,7 @@ void Test_CF_CFDP_RecvAck_SuccessBecause_bytes_received_EqTo_sizeof_pdu_ack_t_Re memset(&dummy_msg_in, 0, sizeof(dummy_msg_in)); CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; - CF_AppData.engine.in.bytes_received = sizeof(pdu_ack_t); + CF_AppData.engine.in.bytes_received = sizeof(CF_CFDP_PduAck_t); UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter, &context_CFE_EVS_SendEvent); @@ -3563,7 +3564,7 @@ void Test_CF_CFDP_RecvAck_SuccessBecause_bytes_received_GreaterThan_sizeof_pdu_a memset(&dummy_msg_in, 0, sizeof(dummy_msg_in)); CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; - CF_AppData.engine.in.bytes_received = Any_uint32_GreaterThan(sizeof(pdu_ack_t)); + CF_AppData.engine.in.bytes_received = Any_uint32_GreaterThan(sizeof(CF_CFDP_PduAck_t)); UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter, &context_CFE_EVS_SendEvent); @@ -3601,7 +3602,7 @@ void Test_CF_CFDP_RecvFin_FailsBecause_bytes_received_IsLessThan_offsetof_pdu_fi memset(&dummy_msg_in, 0, sizeof(dummy_msg_in)); CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; - CF_AppData.engine.in.bytes_received = Any_uint32_LessThan(offsetof(pdu_fin_t, fault_location)); + CF_AppData.engine.in.bytes_received = Any_uint32_LessThan(offsetof(CF_CFDP_PduFin_t, fault_location)); UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter, &context_CFE_EVS_SendEvent); @@ -3632,7 +3633,7 @@ void Test_CF_CFDP_RecvFin_FailsBecause_bytes_received_Is_1_LessThan_offsetof_pdu memset(&dummy_msg_in, 0, sizeof(dummy_msg_in)); CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; - CF_AppData.engine.in.bytes_received = offsetof(pdu_fin_t, fault_location) - 1; + CF_AppData.engine.in.bytes_received = offsetof(CF_CFDP_PduFin_t, fault_location) - 1; UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter, &context_CFE_EVS_SendEvent); @@ -3663,7 +3664,7 @@ void Test_CF_CFDP_RecvFin_SuccessBecause_bytes_received_IsEqTo_offsetof_pdu_fin_ memset(&dummy_msg_in, 0, sizeof(dummy_msg_in)); CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; - CF_AppData.engine.in.bytes_received = offsetof(pdu_fin_t, fault_location); + CF_AppData.engine.in.bytes_received = offsetof(CF_CFDP_PduFin_t, fault_location); UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter, &context_CFE_EVS_SendEvent); @@ -3684,7 +3685,7 @@ void Test_CF_CFDP_RecvFin_SuccessBecause_bytes_received_IsGreaterThan_offsetof_p memset(&dummy_msg_in, 0, sizeof(dummy_msg_in)); CF_AppData.engine.in.msg = &dummy_msg_in.cfe_sb_buffer; - CF_AppData.engine.in.bytes_received = Any_uint32_GreaterThan(offsetof(pdu_fin_t, fault_location)); + CF_AppData.engine.in.bytes_received = Any_uint32_GreaterThan(offsetof(CF_CFDP_PduFin_t, fault_location)); UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter, &context_CFE_EVS_SendEvent); @@ -3736,7 +3737,7 @@ void Test_CF_CFDP_RecvNak_FailsBecause_bytes_received_IsLessThan_CF_HeaderSize_P CF_AppData.engine.in.msg = &dummy_pdu_msg.cfe_sb_buffer; CF_AppData.engine.in.bytes_received = - Any_uint32_LessThan(force_return_CF_HeaderSize + offsetof(pdu_nak_t, segment_requests)); + Any_uint32_LessThan(force_return_CF_HeaderSize + offsetof(CF_CFDP_PduNak_t, segment_requests)); UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter, &context_CFE_EVS_SendEvent); @@ -3765,17 +3766,18 @@ void Test_CF_CFDP_RecvNak_bytes_received_IsEqTo_CF_HeaderSize_Plus_offsetof_pdu_ int dummy_num_segment_requests; int *arg_num_segment_requests = &dummy_num_segment_requests; int force_return_CF_HeaderSize = Any_uint8_LessThan( - offsetof(pdu_nak_t, segment_requests[2]) - - offsetof(pdu_nak_t, segment_requests[1])); /* Any_uint8_LessThan(offsetof(pdu_nak_t, segment_requests[2]) - - offsetof(pdu_nak_t, segment_requests[1])) provides a value that - will not interfere with the number of segments */ + offsetof(CF_CFDP_PduNak_t, segment_requests[2]) - + offsetof(CF_CFDP_PduNak_t, + segment_requests[1])); /* Any_uint8_LessThan(offsetof(CF_CFDP_PduNak_t, segment_requests[2]) - + offsetof(CF_CFDP_PduNak_t, segment_requests[1])) provides a value that + will not interfere with the number of segments */ int local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; - CF_AppData.engine.in.bytes_received = force_return_CF_HeaderSize + offsetof(pdu_nak_t, segment_requests[1]); + CF_AppData.engine.in.bytes_received = force_return_CF_HeaderSize + offsetof(CF_CFDP_PduNak_t, segment_requests[1]); UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); /* Act */ @@ -3798,17 +3800,18 @@ void Test_CF_CFDP_RecvNak_bytes_received_IsEqTo_CF_HeaderSize_Plus_offsetof_pdu_ int dummy_num_segment_requests; int *arg_num_segment_requests = &dummy_num_segment_requests; int force_return_CF_HeaderSize = Any_uint8_LessThan( - offsetof(pdu_nak_t, segment_requests[2]) - - offsetof(pdu_nak_t, segment_requests[1])); /* Any_uint8_LessThan(offsetof(pdu_nak_t, segment_requests[2]) - - offsetof(pdu_nak_t, segment_requests[1])) provides a value that - will not interfere with the number of segments */ + offsetof(CF_CFDP_PduNak_t, segment_requests[2]) - + offsetof(CF_CFDP_PduNak_t, + segment_requests[1])); /* Any_uint8_LessThan(offsetof(CF_CFDP_PduNak_t, segment_requests[2]) - + offsetof(CF_CFDP_PduNak_t, segment_requests[1])) provides a value that + will not interfere with the number of segments */ int local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; CF_AppData.engine.in.bytes_received = - force_return_CF_HeaderSize + offsetof(pdu_nak_t, segment_requests[CF_NAK_MAX_SEGMENTS - 1]); + force_return_CF_HeaderSize + offsetof(CF_CFDP_PduNak_t, segment_requests[CF_NAK_MAX_SEGMENTS - 1]); UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); /* Act */ @@ -3832,17 +3835,18 @@ void Test_CF_CFDP_RecvNak_bytes_received_IsEqTo_CF_HeaderSize_Plus_offsetof_pdu_ int dummy_num_segment_requests; int *arg_num_segment_requests = &dummy_num_segment_requests; int force_return_CF_HeaderSize = Any_uint8_LessThan( - offsetof(pdu_nak_t, segment_requests[2]) - - offsetof(pdu_nak_t, segment_requests[1])); /* Any_uint8_LessThan(offsetof(pdu_nak_t, segment_requests[2]) - - offsetof(pdu_nak_t, segment_requests[1])) provides a value that - will not interfere with the number of segments */ + offsetof(CF_CFDP_PduNak_t, segment_requests[2]) - + offsetof(CF_CFDP_PduNak_t, + segment_requests[1])); /* Any_uint8_LessThan(offsetof(CF_CFDP_PduNak_t, segment_requests[2]) - + offsetof(CF_CFDP_PduNak_t, segment_requests[1])) provides a value that + will not interfere with the number of segments */ int local_result; memset(&dummy_msg, 0, sizeof(dummy_msg)); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; CF_AppData.engine.in.bytes_received = - force_return_CF_HeaderSize + offsetof(pdu_nak_t, segment_requests[CF_NAK_MAX_SEGMENTS]); + force_return_CF_HeaderSize + offsetof(CF_CFDP_PduNak_t, segment_requests[CF_NAK_MAX_SEGMENTS]); UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); /* Act */ @@ -3865,9 +3869,11 @@ void Test_CF_CFDP_RecvNak_bytes_received_IsEqTo_CF_HeaderSize_Plus_offsetof_pdu_ CF_UT_inmsg_buffer_t dummy_msg; int dummy_num_segment_requests; int *arg_num_segment_requests = &dummy_num_segment_requests; - int segment_size = offsetof(pdu_nak_t, segment_requests[2]) - offsetof(pdu_nak_t, segment_requests[1]); + int segment_size = + offsetof(CF_CFDP_PduNak_t, segment_requests[2]) - offsetof(CF_CFDP_PduNak_t, segment_requests[1]); int force_return_CF_HeaderSize = Any_uint8_LessThan( - segment_size); /* Any_uint8_LessThan(offsetof(pdu_nak_t, segment_requests[2]) - offsetof(pdu_nak_t, + segment_size); /* Any_uint8_LessThan(offsetof(CF_CFDP_PduNak_t, segment_requests[2]) - + offsetof(CF_CFDP_PduNak_t, segment_requests[1])) provides a value that will not interfere with the number of segments */ int local_result; @@ -3875,7 +3881,7 @@ void Test_CF_CFDP_RecvNak_bytes_received_IsEqTo_CF_HeaderSize_Plus_offsetof_pdu_ CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; CF_AppData.engine.in.bytes_received = - force_return_CF_HeaderSize + offsetof(pdu_nak_t, segment_requests[CF_NAK_MAX_SEGMENTS]) + segment_size; + force_return_CF_HeaderSize + offsetof(CF_CFDP_PduNak_t, segment_requests[CF_NAK_MAX_SEGMENTS]) + segment_size; UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); /* Act */ @@ -4168,7 +4174,7 @@ void Test_CF_CFDP_RecvIdle_CheckOf_PDU_HDR_FLAGS_TYPE_Returns_false_But_fdh_dire memset(&dummy_msg, 0, sizeof(dummy_msg)); - dummy_msg.content.cfdp.secondary.fdirh.directive_code = Any_file_directive_t_Except(PDU_METADATA); + dummy_msg.content.cfdp.secondary.fdirh.directive_code = Any_file_directive_t_Except(CF_CFDP_FileDirective_METADATA); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; @@ -4244,7 +4250,7 @@ void Test_CF_CFDP_RecvIdle_CheckOf_PDU_HDR_FLAGS_TYPE_Returns_false_And_fdh_dire memset(&dummy_msg, 0, sizeof(dummy_msg)); - dummy_msg.content.cfdp.secondary.fdirh.directive_code = PDU_METADATA; + dummy_msg.content.cfdp.secondary.fdirh.directive_code = CF_CFDP_FileDirective_METADATA; CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; @@ -4276,7 +4282,7 @@ void Test_CF_CFDP_RecvIdle_CheckOf_PDU_HDR_FLAGS_TYPE_Returns_false_And_fdh_dire context_CF_CList_Pop.forced_return = forced_return_CF_CList_Pop; UT_SetDataBuffer(UT_KEY(CF_CList_Pop), &context_CF_CList_Pop, sizeof(context_CF_CList_Pop), false); - UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(pdu_header_t)); + UT_SetDefaultReturnValue(UT_KEY(CF_HeaderSize), sizeof(CF_CFDP_PduHeader_t)); /* Arrange for CF_CFDP_RecvMd */ CF_AppData.engine.in.bytes_received = 0; /* force err_out */ @@ -4330,7 +4336,7 @@ void Test_CF_CFDP_RecvIdle_CheckOf_PDU_HDR_FLAGS_TYPE_Returns_false_And_fdh_dire memset(&dummy_msg, 0, sizeof(dummy_msg)); - dummy_msg.content.cfdp.secondary.fdirh.directive_code = PDU_METADATA; + dummy_msg.content.cfdp.secondary.fdirh.directive_code = CF_CFDP_FileDirective_METADATA; CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; @@ -4368,17 +4374,17 @@ void Test_CF_CFDP_RecvIdle_CheckOf_PDU_HDR_FLAGS_TYPE_Returns_false_And_fdh_dire UT_SetDataBuffer(UT_KEY(CF_CList_Pop), &context_CF_CList_Pop, sizeof(context_CF_CList_Pop), false); /* Arrange for CF_CFDP_RecvMd */ - CF_AppData.engine.in.bytes_received = sizeof(pdu_header_t) + sizeof(pdu_md_t); - int force_return_CF_HeaderSize = sizeof(pdu_header_t); - pdu_md_t *dummy_msg_in = &dummy_msg.content.cfdp.secondary.md; + CF_AppData.engine.in.bytes_received = sizeof(CF_CFDP_PduHeader_t) + sizeof(CF_CFDP_PduMd_t); + int force_return_CF_HeaderSize = sizeof(CF_CFDP_PduHeader_t); + CF_CFDP_PduMd_t *dummy_msg_in = &dummy_msg.content.cfdp.secondary.md; UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); dummy_msg_in->size = Any_uint32(); // /* Arrange for CF_CFDP_CopyDataFromLv */ - ((lv_t *)dummy_msg_in->filename_lvs)->length = 1; /* 19 is arbitrary but small enough to work */ - ((lv_t *)(dummy_msg_in->filename_lvs + 2))->length = 1; /* 1 gets us a success, for a non-negative return */ + ((CF_CFDP_lv_t *)dummy_msg_in->filename_lvs)->length = 1; /* 19 is arbitrary but small enough to work */ + ((CF_CFDP_lv_t *)(dummy_msg_in->filename_lvs + 2))->length = 1; /* 1 gets us a success, for a non-negative return */ /* Act */ CF_CFDP_RecvIdle(arg_t); @@ -4417,7 +4423,7 @@ void Test_CF_CFDP_RecvIdle_CheckOf_PDU_HDR_FLAGS_TYPE_Returns_false_And_fdh_dire memset(&dummy_msg, 0, sizeof(dummy_msg)); - dummy_msg.content.cfdp.secondary.fdirh.directive_code = PDU_METADATA; + dummy_msg.content.cfdp.secondary.fdirh.directive_code = CF_CFDP_FileDirective_METADATA; CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; @@ -4453,17 +4459,17 @@ void Test_CF_CFDP_RecvIdle_CheckOf_PDU_HDR_FLAGS_TYPE_Returns_false_And_fdh_dire UT_SetDataBuffer(UT_KEY(CF_CList_Pop), &context_CF_CList_Pop, sizeof(context_CF_CList_Pop), false); /* Arrange for CF_CFDP_RecvMd */ - CF_AppData.engine.in.bytes_received = sizeof(pdu_header_t) + sizeof(pdu_md_t); - int force_return_CF_HeaderSize = sizeof(pdu_header_t); - pdu_md_t *dummy_msg_in = &dummy_msg.content.cfdp.secondary.md; + CF_AppData.engine.in.bytes_received = sizeof(CF_CFDP_PduHeader_t) + sizeof(CF_CFDP_PduMd_t); + int force_return_CF_HeaderSize = sizeof(CF_CFDP_PduHeader_t); + CF_CFDP_PduMd_t *dummy_msg_in = &dummy_msg.content.cfdp.secondary.md; UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnOnly, &force_return_CF_HeaderSize); dummy_msg_in->size = Any_uint32(); // /* Arrange for CF_CFDP_CopyDataFromLv */ - ((lv_t *)dummy_msg_in->filename_lvs)->length = 1; /* 19 is arbitrary but small enough to work */ - ((lv_t *)(dummy_msg_in->filename_lvs + 2))->length = 1; /* 1 gets us a success, for a non-negative return */ + ((CF_CFDP_lv_t *)dummy_msg_in->filename_lvs)->length = 1; /* 19 is arbitrary but small enough to work */ + ((CF_CFDP_lv_t *)(dummy_msg_in->filename_lvs + 2))->length = 1; /* 1 gets us a success, for a non-negative return */ /* Act */ CF_CFDP_RecvIdle(arg_t); @@ -4886,7 +4892,7 @@ void Test_CF_CFDP_ReceiveMessage_AssertsBecause_t_state_IsGreaterThan_CFDP_IDLE( // uint8 dummy_chan_num = Any_cf_chan_num(); // cf_config_table_t dummy_config_table; // channel_t* arg_c; - // pdu_r_msg_t dummy_msg; + // CF_PduRecvMsg_t dummy_msg; // arg_c = &CF_AppData.engine.channels[dummy_chan_num]; @@ -4973,7 +4979,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_src_And_dst_AreNot_config_table_local_ei UT_SetDefaultReturnValue(UT_KEY(CFE_SB_ReceiveBuffer), CFE_SUCCESS); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; - CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_cf_entity_id_t */ + CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_CF_EntityId_t */ CF_AppData.engine.in.src = Any_uint8_Except(CF_AppData.config_table->local_eid); /* for src check fail */ CF_AppData.engine.in.dst = Any_uint8_Except(CF_AppData.config_table->local_eid); /* for dst check fail */ @@ -5066,7 +5072,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_CallTo_FGV_Returns_non0_And_dst_IsN UT_SetDefaultReturnValue(UT_KEY(CFE_SB_ReceiveBuffer), CFE_SUCCESS); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; - CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_cf_entity_id_t */ + CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_CF_EntityId_t */ CF_AppData.engine.in.src = CF_AppData.config_table->local_eid; /* for src check fail */ UT_SetDefaultReturnValue(UT_KEY(FGV), 1); @@ -5164,7 +5170,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_bytes_received_IsLessThanExpected_A UT_SetDefaultReturnValue(UT_KEY(CFE_SB_ReceiveBuffer), CFE_SUCCESS); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; - CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_cf_entity_id_t */ + CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_CF_EntityId_t */ CF_AppData.engine.in.src = CF_AppData.config_table->local_eid; /* for src check fail */ UT_SetDefaultReturnValue(UT_KEY(FGV), 0); UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnArray, forced_return_CF_HeaderSize); @@ -5246,7 +5252,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_directive_code_IsNotEqTo_PDU_FIN_An /* 8 arbitrary for a reasonable size (in CF_CFDP_RecvPh call), 8 to force a true (in CUT), offsetof() for nominal value */ - int forced_return_CF_HeaderSize[3] = {8, 8, sizeof(pdu_header_t)}; + int forced_return_CF_HeaderSize[3] = {8, 8, sizeof(CF_CFDP_PduHeader_t)}; CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; @@ -5261,7 +5267,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_directive_code_IsNotEqTo_PDU_FIN_An UT_SetDefaultReturnValue(UT_KEY(CFE_SB_ReceiveBuffer), CFE_SUCCESS); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; - CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_cf_entity_id_t */ + CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_CF_EntityId_t */ CF_AppData.engine.in.src = CF_AppData.config_table->local_eid; /* for src check fail */ UT_SetDefaultReturnValue(UT_KEY(FGV), 0); UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnArray, forced_return_CF_HeaderSize); @@ -5270,7 +5276,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_directive_code_IsNotEqTo_PDU_FIN_An UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter_hook, &context_CFE_EVS_SendEvent); - dummy_msg.content.cfdp.secondary.fdirh.directive_code = Any_uint8_Except(PDU_FIN); + dummy_msg.content.cfdp.secondary.fdirh.directive_code = Any_uint8_Except(CF_CFDP_FileDirective_FIN); /* Arrange for CF_CFDP_RecvPh */ size_t forced_return_CFE_SB_GetUserDataLength = @@ -5344,7 +5350,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_CallTo_CF_CFDP_RecvFin_Returns_neg1 /* 8 arbitrary for a reasonable size (in CF_CFDP_RecvPh call), 8 to force a true (in CUT), offsetof() for nominal value, UINT16_MAX + 1 is to force a false (in CUT) */ - int forced_return_CF_HeaderSize[4] = {8, 8, sizeof(pdu_header_t), UINT16_MAX + 1}; + int forced_return_CF_HeaderSize[4] = {8, 8, sizeof(CF_CFDP_PduHeader_t), UINT16_MAX + 1}; CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; @@ -5357,7 +5363,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_CallTo_CF_CFDP_RecvFin_Returns_neg1 UT_SetDefaultReturnValue(UT_KEY(CFE_SB_ReceiveBuffer), CFE_SUCCESS); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; - CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_cf_entity_id_t */ + CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_CF_EntityId_t */ CF_AppData.engine.in.src = CF_AppData.config_table->local_eid; /* for src check fail */ UT_SetDefaultReturnValue(UT_KEY(FGV), 0); UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnArray, forced_return_CF_HeaderSize); @@ -5366,7 +5372,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_CallTo_CF_CFDP_RecvFin_Returns_neg1 UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter_hook, &context_CFE_EVS_SendEvent); - dummy_msg.content.cfdp.secondary.fdirh.directive_code = PDU_FIN; + dummy_msg.content.cfdp.secondary.fdirh.directive_code = CF_CFDP_FileDirective_FIN; /* Arrange for CF_CFDP_RecvPh */ size_t forced_return_CFE_SB_GetUserDataLength = @@ -5435,7 +5441,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_CallTo_CF_CFDP_RecvFin_Returns_0_In /* 8 arbitrary for a reasonable size (in CF_CFDP_RecvPh call), 8 to force a true (in CUT), offsetof() for nominal value, 0 is to force a true (in CUT), 0 is arbitrary just to have a value */ - int forced_return_CF_HeaderSize[5] = {8, 8, sizeof(pdu_header_t), 0, 0}; + int forced_return_CF_HeaderSize[5] = {8, 8, sizeof(CF_CFDP_PduHeader_t), 0, 0}; uint16 initial_counters_recv_serial = Any_uint16(); CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; @@ -5449,7 +5455,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_CallTo_CF_CFDP_RecvFin_Returns_0_In UT_SetDefaultReturnValue(UT_KEY(CFE_SB_ReceiveBuffer), CFE_SUCCESS); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; - CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_cf_entity_id_t */ + CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_CF_EntityId_t */ CF_AppData.engine.in.src = CF_AppData.config_table->local_eid; /* for src check fail */ UT_SetDefaultReturnValue(UT_KEY(FGV), 0); UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnArray, forced_return_CF_HeaderSize); @@ -5458,7 +5464,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_CallTo_CF_CFDP_RecvFin_Returns_0_In UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter_hook, &context_CFE_EVS_SendEvent); - dummy_msg.content.cfdp.secondary.fdirh.directive_code = PDU_FIN; + dummy_msg.content.cfdp.secondary.fdirh.directive_code = CF_CFDP_FileDirective_FIN; CF_AppData.hk.channel_hk[dummy_chan_num].counters.recv.spurious = initial_counters_recv_serial; @@ -5535,7 +5541,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_CallTo_CF_CFDP_RecvFin_Returns_0_Ca /* 0th 8 arbitrary for a reasonable size (in CF_CFDP_RecvPh call), 8 to force a true (in CUT), 0 to offsetof() for nominal value, 0 is to force a true (in CUT), remaining 0s is arbitrary just to have a value */ - int forced_return_CF_HeaderSize[8] = {8, 8, sizeof(pdu_header_t), 0, 0, 0, 0, 0}; + int forced_return_CF_HeaderSize[8] = {8, 8, sizeof(CF_CFDP_PduHeader_t), 0, 0, 0, 0, 0}; uint16 initial_counters_recv_serial = Any_uint16(); CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; @@ -5550,7 +5556,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_CallTo_CF_CFDP_RecvFin_Returns_0_Ca UT_SetDefaultReturnValue(UT_KEY(CFE_SB_ReceiveBuffer), CFE_SUCCESS); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; - CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_cf_entity_id_t */ + CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_CF_EntityId_t */ CF_AppData.engine.in.src = CF_AppData.config_table->local_eid; /* for src check fail */ UT_SetDefaultReturnValue(UT_KEY(FGV), 0); UT_SetHandlerFunction(UT_KEY(CF_HeaderSize), Handler_int_ForcedReturnArray, forced_return_CF_HeaderSize); @@ -5559,7 +5565,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_Then_CallTo_CF_CFDP_RecvFin_Returns_0_Ca UT_SetHookFunction(UT_KEY(CFE_EVS_SendEvent), stub_reporter_hook, &context_CFE_EVS_SendEvent); - dummy_msg.content.cfdp.secondary.fdirh.directive_code = PDU_FIN; + dummy_msg.content.cfdp.secondary.fdirh.directive_code = CF_CFDP_FileDirective_FIN; CF_AppData.hk.channel_hk[dummy_chan_num].counters.recv.spurious = initial_counters_recv_serial; @@ -5639,7 +5645,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_src_IsNotEqTo_config_table_local_eid_But // uint8 dummy_chan_num = Any_cf_chan_num(); // cf_config_table_t dummy_config_table; // channel_t* arg_c; - // pdu_r_msg_t dummy_msg; + // CF_PduRecvMsg_t dummy_msg; // const char* expected_Spec = "CF: dropping packet from %d transaction number 0x%08x due max RX // transactions reached"; CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; @@ -5651,7 +5657,7 @@ void Test_CF_CFDP_ReceiveMessage_CallTo_src_IsNotEqTo_config_table_local_eid_But // UT_SetDefaultReturnValue(UT_KEY(CFE_SB_ReceiveBuffer), Any_CFE_Status_t_Except(CFE_SB_NO_MESSAGE)); // CF_AppData.engine.in.msg = (CFE_SB_Buffer_t*)&dummy_msg; - // CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_cf_entity_id_t */ + // CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_CF_EntityId_t */ // CF_AppData.engine.in.src = Any_uint8_Except(CF_AppData.config_table->local_eid); /* for src check fail */ // CF_AppData.engine.in.dst = CF_AppData.config_table->local_eid; /* for dst check fail */ @@ -5732,7 +5738,7 @@ void Test_CF_CFDP_ReceiveMessage_AssertsBecause_t_Is_NULL(void) // uint8 dummy_chan_num = Any_cf_chan_num(); // cf_config_table_t dummy_config_table; // channel_t* arg_c; - // pdu_r_msg_t dummy_msg; + // CF_PduRecvMsg_t dummy_msg; // const char* expected_Spec = "CF: dropping packet from %d transaction number 0x%08x due max RX // transactions reached"; CFE_EVS_SendEvent_context_t context_CFE_EVS_SendEvent; @@ -5744,7 +5750,7 @@ void Test_CF_CFDP_ReceiveMessage_AssertsBecause_t_Is_NULL(void) // UT_SetDefaultReturnValue(UT_KEY(CFE_SB_ReceiveBuffer), Any_CFE_Status_t_Except(CFE_SB_NO_MESSAGE)); // CF_AppData.engine.in.msg = (CFE_SB_Buffer_t*)&dummy_msg; - // CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_cf_entity_id_t */ + // CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_CF_EntityId_t */ // CF_AppData.engine.in.src = Any_uint8_Except(CF_AppData.config_table->local_eid); /* for src check fail */ // CF_AppData.engine.in.dst = CF_AppData.config_table->local_eid; /* for dst check fail */ @@ -5839,7 +5845,7 @@ void Test_2CF_CFDP_ReceiveMessage_CallTo_src_IsNotEqTo_config_table_local_eid_Bu UT_SetDefaultReturnValue(UT_KEY(CFE_SB_ReceiveBuffer), CFE_SUCCESS); CF_AppData.engine.in.msg = &dummy_msg.cfe_sb_buffer; - CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_cf_entity_id_t */ + CF_AppData.config_table->local_eid = Any_uint8(); /*TODO: change to any_CF_EntityId_t */ CF_AppData.engine.in.src = Any_uint8_Except(CF_AppData.config_table->local_eid); /* for src check fail */ CF_AppData.engine.in.dst = CF_AppData.config_table->local_eid; /* for dst check fail */ @@ -6621,12 +6627,12 @@ void Test_CF_CFDP_TickTransaction_Given_c_tick_type_Is_CF_TICK_TXW_NAK_RunsLoopA void Test_CF_CFDP_TxFile___SetsGivenValuesOnTransaction_cfdp_class_SetTo_CLASS_1(void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - cfdp_class_t arg_cfdp_class = CLASS_1; - uint8 arg_keep = Any_uint8(); - uint8 arg_chan = Any_uint8(); - uint8 arg_priority = Any_uint8(); + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_Class_t arg_cfdp_class = CF_CFDP_CLASS_1; + uint8 arg_keep = Any_uint8(); + uint8 arg_chan = Any_uint8(); + uint8 arg_priority = Any_uint8(); /* Act */ CF_CFDP_TxFile__(arg_t, arg_cfdp_class, arg_keep, arg_chan, arg_priority); @@ -6638,20 +6644,21 @@ void Test_CF_CFDP_TxFile___SetsGivenValuesOnTransaction_cfdp_class_SetTo_CLASS_1 arg_t->priority, arg_priority); UtAssert_True(arg_t->keep == arg_keep, "CF_CFDP_TxFile__ set t->keep to %u and should be %u (keep)", arg_t->keep, arg_keep); - UtAssert_True(arg_t->state == CFDP_S1, - "CF_CFDP_TxFile__ set t->state to %u and should be %u (CFDP_S1) because cfdp_class is %u (CLASS_1)", - arg_t->state, CFDP_S1, arg_cfdp_class); + UtAssert_True( + arg_t->state == CFDP_S1, + "CF_CFDP_TxFile__ set t->state to %u and should be %u (CFDP_S1) because cfdp_class is %u (CF_CFDP_CLASS_1)", + arg_t->state, CFDP_S1, arg_cfdp_class); } /* end Test_CF_CFDP_TxFile___SetsGivenValuesOnTransaction_cfdp_class_SetTo_CLASS_1 */ void Test_CF_CFDP_TxFile___SetsGivenValuesOnTransaction_cfdp_class_SetTo_CLASS_2(void) { /* Arrange */ - transaction_t dummy_t; - transaction_t *arg_t = &dummy_t; - cfdp_class_t arg_cfdp_class = CLASS_2; - uint8 arg_keep = Any_uint8(); - uint8 arg_chan = Any_uint8(); - uint8 arg_priority = Any_uint8(); + transaction_t dummy_t; + transaction_t *arg_t = &dummy_t; + CF_CFDP_Class_t arg_cfdp_class = CF_CFDP_CLASS_2; + uint8 arg_keep = Any_uint8(); + uint8 arg_chan = Any_uint8(); + uint8 arg_priority = Any_uint8(); /* Act */ CF_CFDP_TxFile__(arg_t, arg_cfdp_class, arg_keep, arg_chan, arg_priority); @@ -6663,9 +6670,10 @@ void Test_CF_CFDP_TxFile___SetsGivenValuesOnTransaction_cfdp_class_SetTo_CLASS_2 arg_t->priority, arg_priority); UtAssert_True(arg_t->keep == arg_keep, "CF_CFDP_TxFile__ set t->keep to %u and should be %u (keep)", arg_t->keep, arg_keep); - UtAssert_True(arg_t->state == CFDP_S2, - "CF_CFDP_TxFile__ set t->state to %u and should be %u (CFDP_S2) because cfdp_class is %u (CLASS_2)", - arg_t->state, CFDP_S2, arg_cfdp_class); + UtAssert_True( + arg_t->state == CFDP_S2, + "CF_CFDP_TxFile__ set t->state to %u and should be %u (CFDP_S2) because cfdp_class is %u (CF_CFDP_CLASS_2)", + arg_t->state, CFDP_S2, arg_cfdp_class); } /* end Test_CF_CFDP_TxFile___SetsGivenValuesOnTransaction */ /* end CF_CFDP_TxFile__ tests */ @@ -6684,11 +6692,11 @@ void Test_CF_CFDP_TxFile_DoesNotError(void) history_t dummy_history; transaction_t dummy_t; transaction_t *arg_t = &dummy_t; - cfdp_class_t arg_cfdp_class = Any_cfdp_class_t(); + CF_CFDP_Class_t arg_cfdp_class = Any_cfdp_class_t(); uint8 arg_keep = Any_uint8(); uint8 arg_chan = Any_cf_chan_num(); uint8 arg_priority = Any_uint8(); - cf_entity_id_t arg_dest_id = Any_uint8(); + CF_EntityId_t arg_dest_id = Any_uint8(); CF_AppData.config_table = &dummy_config_table; @@ -6741,14 +6749,14 @@ void Test_CF_CFDP_TxFile_AssertsBecause_chan_IsGreaterThan_CF_NUM_CHANNELS(void) void Test_CF_CFDP_TxFile_FailsBecause_c_num_cmd_tx_IsEqTo_CF_MAX_COMMANDED_PLAYBACK_FILES_PER_CHAN(void) { /* Arrange */ - channel_t *dummy_c; - char arg_src_filename[CF_FILENAME_MAX_LEN] = "placeholder\0"; - char arg_dst_filename[CF_FILENAME_MAX_LEN] = "dstholder\0"; - cfdp_class_t arg_cfdp_class = Any_cfdp_class_t(); - uint8 arg_keep = Any_uint8(); - uint8 arg_chan = Any_uint8_LessThan(CF_NUM_CHANNELS); - uint8 arg_priority = Any_uint8(); - cf_entity_id_t arg_dest_id = Any_uint8(); + channel_t *dummy_c; + char arg_src_filename[CF_FILENAME_MAX_LEN] = "placeholder\0"; + char arg_dst_filename[CF_FILENAME_MAX_LEN] = "dstholder\0"; + CF_CFDP_Class_t arg_cfdp_class = Any_cfdp_class_t(); + uint8 arg_keep = Any_uint8(); + uint8 arg_chan = Any_uint8_LessThan(CF_NUM_CHANNELS); + uint8 arg_priority = Any_uint8(); + CF_EntityId_t arg_dest_id = Any_uint8(); dummy_c = &CF_AppData.engine.channels[arg_chan]; dummy_c->num_cmd_tx = CF_MAX_COMMANDED_PLAYBACK_FILES_PER_CHAN; @@ -6775,11 +6783,11 @@ void Test_CF_CFDP_TxFile_AssertsBecause_t_IsReturned_NULL_From_CF_CFDP_FindUnuse // channel_t* dummy_c; // char arg_src_filename[CF_FILENAME_MAX_LEN] = "placeholder\0"; // char arg_dst_filename[CF_FILENAME_MAX_LEN] = "dstholder\0"; - // cfdp_class_t arg_cfdp_class = Any_cfdp_class_t(); + // CF_CFDP_Class_t arg_cfdp_class = Any_cfdp_class_t(); // uint8 arg_keep = Any_uint8(); // uint8 arg_chan = Any_uint8_LessThan(CF_NUM_CHANNELS); // uint8 arg_priority = Any_uint8(); - // cf_entity_id_t arg_dest_id = Any_uint8(); + // CF_EntityId_t arg_dest_id = Any_uint8(); // dummy_c = &CF_AppData.engine.channels[arg_chan]; // dummy_c->num_cmd_tx = Any_uint32_Except(CF_MAX_COMMANDED_PLAYBACK_FILES_PER_CHAN); @@ -6821,11 +6829,11 @@ void Test_CF_CFDP_TxFile_AssertsBecause_t_state_IsNotEqTo_CFDP_IDLE(void) // channel_t* dummy_c; // char arg_src_filename[CF_FILENAME_MAX_LEN] = "placeholder\0"; // char arg_dst_filename[CF_FILENAME_MAX_LEN] = "dstholder\0"; - // cfdp_class_t arg_cfdp_class = Any_cfdp_class_t(); + // CF_CFDP_Class_t arg_cfdp_class = Any_cfdp_class_t(); // uint8 arg_keep = Any_uint8(); // uint8 arg_chan = Any_uint8_LessThan(CF_NUM_CHANNELS); // uint8 arg_priority = Any_uint8(); - // cf_entity_id_t arg_dest_id = Any_uint8(); + // CF_EntityId_t arg_dest_id = Any_uint8(); // dummy_c = &CF_AppData.engine.channels[arg_chan]; // dummy_c->num_cmd_tx = Any_uint32_Except(CF_MAX_COMMANDED_PLAYBACK_FILES_PER_CHAN); @@ -6869,16 +6877,16 @@ void Test_CF_CFDP_TxFile_AssertsBecause_t_state_IsNotEqTo_CFDP_IDLE(void) void Test_CF_CFDP_TxFile_SuccessIncrements_c_num_cmd_tx_AndSets_t_flags_tx_cmd_tx_To_1(void) { /* Arrange */ - history_t dummy_history; - transaction_t dummy_t; - channel_t *dummy_c; - char arg_src_filename[CF_FILENAME_MAX_LEN] = "placeholder\0"; - char arg_dst_filename[CF_FILENAME_MAX_LEN] = "dstholder\0"; - cfdp_class_t arg_cfdp_class = Any_cfdp_class_t(); - uint8 arg_keep = Any_uint8(); - uint8 arg_chan = Any_uint8_LessThan(CF_NUM_CHANNELS); - uint8 arg_priority = Any_uint8(); - cf_entity_id_t arg_dest_id = Any_uint8(); + history_t dummy_history; + transaction_t dummy_t; + channel_t *dummy_c; + char arg_src_filename[CF_FILENAME_MAX_LEN] = "placeholder\0"; + char arg_dst_filename[CF_FILENAME_MAX_LEN] = "dstholder\0"; + CF_CFDP_Class_t arg_cfdp_class = Any_cfdp_class_t(); + uint8 arg_keep = Any_uint8(); + uint8 arg_chan = Any_uint8_LessThan(CF_NUM_CHANNELS); + uint8 arg_priority = Any_uint8(); + CF_EntityId_t arg_dest_id = Any_uint8(); dummy_c = &CF_AppData.engine.channels[arg_chan]; dummy_c->num_cmd_tx = Any_uint32_Except(CF_MAX_COMMANDED_PLAYBACK_FILES_PER_CHAN); @@ -6932,17 +6940,17 @@ void Test_CF_CFDP_TxFile_SuccessIncrements_c_num_cmd_tx_AndSets_t_flags_tx_cmd_t void Test_CF_CFDP_PlaybackDir_FailsBecauseDirectoryWasNotOpenedThenIncrements_fault_directory_read(void) { /* Arrange */ - playback_t dummy_p; - playback_t *arg_p = &dummy_p; - char arg_src_filename[CF_FILENAME_MAX_LEN] = "placeholder\0"; - char arg_dst_filename[CF_FILENAME_MAX_LEN] = "dstholder\0"; - cfdp_class_t arg_cfdp_class = Any_cfdp_class_t(); - uint8 arg_keep = Any_uint8(); - uint8 arg_chan = Any_uint8_LessThan(CF_NUM_CHANNELS); - uint8 arg_priority = Any_uint8(); - cf_entity_id_t arg_dest_id = Any_uint8(); - uint16 initial_fault_directory_read = Any_uint16(); - int32 expected_result = Any_int32_Except(OS_SUCCESS); + playback_t dummy_p; + playback_t *arg_p = &dummy_p; + char arg_src_filename[CF_FILENAME_MAX_LEN] = "placeholder\0"; + char arg_dst_filename[CF_FILENAME_MAX_LEN] = "dstholder\0"; + CF_CFDP_Class_t arg_cfdp_class = Any_cfdp_class_t(); + uint8 arg_keep = Any_uint8(); + uint8 arg_chan = Any_uint8_LessThan(CF_NUM_CHANNELS); + uint8 arg_priority = Any_uint8(); + CF_EntityId_t arg_dest_id = Any_uint8(); + uint16 initial_fault_directory_read = Any_uint16(); + int32 expected_result = Any_int32_Except(OS_SUCCESS); CF_AppData.hk.channel_hk[arg_chan].counters.fault.directory_read = initial_fault_directory_read; @@ -6970,17 +6978,17 @@ void Test_CF_CFDP_PlaybackDir_FailsBecauseDirectoryWasNotOpenedThenIncrements_fa void Test_CF_CFDP_PlaybackDir_SuccessSetsCorrect_p_ValuesAndReturns_OS_SUCCESS(void) { /* Arrange */ - playback_t dummy_p; - playback_t *arg_p = &dummy_p; - char arg_src_filename[CF_FILENAME_MAX_LEN]; - char arg_dst_filename[CF_FILENAME_MAX_LEN]; - cfdp_class_t arg_cfdp_class = Any_cfdp_class_t(); - uint8 arg_keep = Any_uint8_LessThan(2); - uint8 arg_chan = Any_uint8_LessThan(CF_NUM_CHANNELS); - uint8 arg_priority = Any_uint8_LessThan(2); - cf_entity_id_t arg_dest_id = Any_uint8(); - uint16 initial_fault_directory_read = Any_uint16(); - int32 expected_result = OS_SUCCESS; + playback_t dummy_p; + playback_t *arg_p = &dummy_p; + char arg_src_filename[CF_FILENAME_MAX_LEN]; + char arg_dst_filename[CF_FILENAME_MAX_LEN]; + CF_CFDP_Class_t arg_cfdp_class = Any_cfdp_class_t(); + uint8 arg_keep = Any_uint8_LessThan(2); + uint8 arg_chan = Any_uint8_LessThan(CF_NUM_CHANNELS); + uint8 arg_priority = Any_uint8_LessThan(2); + CF_EntityId_t arg_dest_id = Any_uint8(); + uint16 initial_fault_directory_read = Any_uint16(); + int32 expected_result = OS_SUCCESS; AnyRandomStringOfLettersOfLengthCopy(arg_src_filename, Any_uint8_LessThan(CF_FILENAME_MAX_LEN)); AnyRandomStringOfLettersOfLengthCopy(arg_dst_filename, Any_uint8_LessThan(CF_FILENAME_MAX_LEN)); @@ -7028,14 +7036,14 @@ void Test_CF_CFDP_PlaybackDir_SuccessSetsCorrect_p_ValuesAndReturns_OS_SUCCESS(v void Test_CF_CFDP_PlaybackDir_All_p_busy_Are_1_SendEventThenReturn_neg1(void) { /* Arrange */ - const char arg_src_filename[CF_FILENAME_MAX_LEN]; - const char arg_dst_filename[CF_FILENAME_MAX_LEN]; - cfdp_class_t arg_cfdp_class = Any_cfdp_class_t(); - uint8 arg_keep = Any_uint8(); - uint8 arg_chan = Any_cf_chan_num(); - uint8 arg_priority = Any_uint8(); - uint16 arg_dest_id = Any_uint16(); - int i = 0; + const char arg_src_filename[CF_FILENAME_MAX_LEN]; + const char arg_dst_filename[CF_FILENAME_MAX_LEN]; + CF_CFDP_Class_t arg_cfdp_class = Any_cfdp_class_t(); + uint8 arg_keep = Any_uint8(); + uint8 arg_chan = Any_cf_chan_num(); + uint8 arg_priority = Any_uint8(); + uint16 arg_dest_id = Any_uint16(); + int i = 0; for (i = 0; i < CF_MAX_COMMANDED_PLAYBACK_DIRECTORIES_PER_CHAN; ++i) { @@ -7054,14 +7062,14 @@ void Test_CF_CFDP_PlaybackDir_All_p_busy_Are_1_SendEventThenReturn_neg1(void) void Test_CF_CFDP_PlaybackDir_First_p_busy_Is_0_Call_CF_CFDP_PlaybackDir__AndReturnCallValue(void) { /* Arrange */ - const char arg_src_filename[CF_FILENAME_MAX_LEN]; - const char arg_dst_filename[CF_FILENAME_MAX_LEN]; - cfdp_class_t arg_cfdp_class = Any_cfdp_class_t(); - uint8 arg_keep = Any_uint8(); - uint8 arg_chan = Any_cf_chan_num(); - uint8 arg_priority = Any_uint8(); - uint16 arg_dest_id = Any_uint16(); - int i = 0; + const char arg_src_filename[CF_FILENAME_MAX_LEN]; + const char arg_dst_filename[CF_FILENAME_MAX_LEN]; + CF_CFDP_Class_t arg_cfdp_class = Any_cfdp_class_t(); + uint8 arg_keep = Any_uint8(); + uint8 arg_chan = Any_cf_chan_num(); + uint8 arg_priority = Any_uint8(); + uint16 arg_dest_id = Any_uint16(); + int i = 0; CF_AppData.engine.channels[arg_chan].playback[i].busy = 0; @@ -8542,11 +8550,11 @@ void Test_CF_CFDP_ResetTransaction_AssertsBecause_t_history_dir_IsNeither_CF_DIR void Test_CF_CFDP_CopyDataToLv_FailsBecause_len_IsGreaterThan_sizeof_dest_lv_data_Returns_neg1(void) { /* Arrange */ - lv_t dummy_dest_lv; - lv_t *arg_dest_lv = &dummy_dest_lv; - uint8 arg_data[sizeof(arg_dest_lv->data)]; - uint32 arg_len = Any_uint32_GreaterThan(sizeof(arg_dest_lv->data)); - int local_result; + CF_CFDP_lv_t dummy_dest_lv; + CF_CFDP_lv_t *arg_dest_lv = &dummy_dest_lv; + uint8 arg_data[sizeof(arg_dest_lv->data)]; + uint32 arg_len = Any_uint32_GreaterThan(sizeof(arg_dest_lv->data)); + int local_result; memset(arg_data, 0xEE, sizeof(arg_data)); @@ -8561,11 +8569,11 @@ void Test_CF_CFDP_CopyDataToLv_FailsBecause_len_IsGreaterThan_sizeof_dest_lv_dat void Test_CF_CFDP_CopyDataToLv_FailsBecause_len_IsEqTo_sizeof_dest_lv_data_Returns_neg1(void) { /* Arrange */ - lv_t dummy_dest_lv; - lv_t *arg_dest_lv = &dummy_dest_lv; - uint8 arg_data[sizeof(arg_dest_lv->data)]; - uint32 arg_len = sizeof(arg_dest_lv->data); - int local_result; + CF_CFDP_lv_t dummy_dest_lv; + CF_CFDP_lv_t *arg_dest_lv = &dummy_dest_lv; + uint8 arg_data[sizeof(arg_dest_lv->data)]; + uint32 arg_len = sizeof(arg_dest_lv->data); + int local_result; memset(arg_data, 0xEE, sizeof(arg_data)); @@ -8580,11 +8588,11 @@ void Test_CF_CFDP_CopyDataToLv_FailsBecause_len_IsEqTo_sizeof_dest_lv_data_Retur void Test_CF_CFDP_CopyDataToLv_Success_len_LessThan_sizeof_dest_lv_data_Copies_data_To_dest_lv_data(void) { /* Arrange */ - lv_t dummy_dest_lv; - lv_t *arg_dest_lv = &dummy_dest_lv; - uint8 arg_data[sizeof(arg_dest_lv->data)]; - uint32 arg_len = Any_uint32_LessThan(sizeof(arg_dest_lv->data)); - int local_result; + CF_CFDP_lv_t dummy_dest_lv; + CF_CFDP_lv_t *arg_dest_lv = &dummy_dest_lv; + uint8 arg_data[sizeof(arg_dest_lv->data)]; + uint32 arg_len = Any_uint32_LessThan(sizeof(arg_dest_lv->data)); + int local_result; AnyBufferOf_uint8_WithSize(arg_data, arg_len); @@ -8609,9 +8617,9 @@ void Test_CF_CFDP_CopyDataToLv_Success_len_LessThan_sizeof_dest_lv_data_Copies_d void Test_CF_CFDP_CopyDataFromLv_FailsBecause_src_lv_len_IsGreaterThan_sizeof_src_lv_data_Returns_neg1(void) { /* Arrange */ - lv_t dummy_src_lv; - lv_t *arg_src_lv = &dummy_src_lv; - uint8 arg_buf[CF_FILENAME_MAX_LEN]; + CF_CFDP_lv_t dummy_src_lv; + CF_CFDP_lv_t *arg_src_lv = &dummy_src_lv; + uint8 arg_buf[CF_FILENAME_MAX_LEN]; // uint32 arg_src_len = Any_uint32_GreaterThan(sizeof(arg_dest_lv->data)); int local_result; @@ -8628,9 +8636,9 @@ void Test_CF_CFDP_CopyDataFromLv_FailsBecause_src_lv_len_IsGreaterThan_sizeof_sr void Test_CF_CFDP_CopyDataFromLv_FailsBecause_src_lv_len_IsEqTo_sizeof_src_lv_data_Returns_neg1(void) { /* Arrange */ - lv_t dummy_src_lv; - lv_t *arg_src_lv = &dummy_src_lv; - uint8 arg_buf[CF_FILENAME_MAX_LEN]; + CF_CFDP_lv_t dummy_src_lv; + CF_CFDP_lv_t *arg_src_lv = &dummy_src_lv; + uint8 arg_buf[CF_FILENAME_MAX_LEN]; // uint32 arg_src_len = Any_uint32_GreaterThan(sizeof(arg_dest_lv->data)); int local_result; @@ -8647,9 +8655,9 @@ void Test_CF_CFDP_CopyDataFromLv_FailsBecause_src_lv_len_IsEqTo_sizeof_src_lv_da void Test_CF_CFDP_CF_CFDP_CopyDataFromLv_Success_src_lv_len_LessThan_sizeof_src_lv_data_Copies_src_lv_data_To_buf(void) { /* Arrange */ - lv_t dummy_src_lv; - lv_t *arg_src_lv = &dummy_src_lv; - uint8 arg_buf[CF_FILENAME_MAX_LEN]; + CF_CFDP_lv_t dummy_src_lv; + CF_CFDP_lv_t *arg_src_lv = &dummy_src_lv; + uint8 arg_buf[CF_FILENAME_MAX_LEN]; // uint32 arg_src_len = Any_uint32_GreaterThan(sizeof(arg_dest_lv->data)); int local_result; diff --git a/unit-test/cf_cmd_tests.c b/unit-test/cf_cmd_tests.c index 9d351c837..5136b783e 100644 --- a/unit-test/cf_cmd_tests.c +++ b/unit-test/cf_cmd_tests.c @@ -79,14 +79,14 @@ void cf_cmd_tests_Teardown(void) ** *******************************************************************************/ -cfdp_class_t Any_cfdp_class_t(void) +CF_CFDP_Class_t Any_cfdp_class_t(void) { - return (cfdp_class_t)AnyCoinFlip(); + return (CF_CFDP_Class_t)AnyCoinFlip(); } -cf_entity_id_t Any_cf_entity_id_t(void) +CF_EntityId_t Any_CF_EntityId_t(void) { - return (cf_entity_id_t)Any_uint8(); + return (CF_EntityId_t)Any_uint8(); } /* uint8 used for Any_cf_channel likely there will never be that many channels */ @@ -113,9 +113,9 @@ uint8 Any_queue_Except_q_pend(void) return (rand() % 2) + 1; /* 0-2, + 1 -> 1-3 */ } -cf_transaction_seq_t Any_cf_transaction_seq_t(void) +CF_TransactionSeq_t Any_CF_TransactionSeq_t(void) { - return (cf_transaction_seq_t)Any_uint32(); + return (CF_TransactionSeq_t)Any_uint32(); } /* end cf_cmd_tests specific Any functions */ @@ -702,7 +702,7 @@ void Test_CF_CmdTxFile_WhenCallTo_CF_CFDP_TxFile_Returns_0_AcceptCommand(void) dummy_msg->keep = Any_uint8(); dummy_msg->chan_num = Any_uint8(); dummy_msg->priority = Any_uint8(); - dummy_msg->dest_id = Any_cf_entity_id_t(); + dummy_msg->dest_id = Any_CF_EntityId_t(); /* Arrange unstubbable: CF_CmdAcc via CF_CmdCond */ uint16 initial_hk_cmd_counter = Any_uint16(); @@ -761,7 +761,7 @@ void Test_CF_CmdTxFile_WhenCAllTo_CF_CFDP_TxFile_Returns_Non0_RejectCommand(void dummy_msg->keep = Any_uint8(); dummy_msg->chan_num = Any_uint8(); dummy_msg->priority = Any_uint8(); - dummy_msg->dest_id = Any_cf_entity_id_t(); + dummy_msg->dest_id = Any_CF_EntityId_t(); /* Arrange unstubbable: CF_CmdAcc via CF_CmdCond */ uint16 initial_hk_err_counter = Any_uint16(); @@ -830,7 +830,7 @@ void Test_CF_CmdPlaybackDir_WhenCAllTo_CF_CFDP_PlaybackDir_Returns_0_AcceptComma dummy_msg->keep = Any_uint8(); dummy_msg->chan_num = Any_uint8(); dummy_msg->priority = Any_uint8(); - dummy_msg->dest_id = Any_cf_entity_id_t(); + dummy_msg->dest_id = Any_CF_EntityId_t(); /* Arrange unstubbable: CF_CmdAcc via CF_CmdCond */ uint16 initial_hk_cmd_counter = Any_uint16(); @@ -890,7 +890,7 @@ void Test_CF_CmdPlaybackDir_WhenCallTo_CF_CmdPlaybackDir_Returns_non0_RejectComm dummy_msg->keep = Any_uint8(); dummy_msg->chan_num = Any_uint8(); dummy_msg->priority = Any_uint8(); - dummy_msg->dest_id = Any_cf_entity_id_t(); + dummy_msg->dest_id = Any_CF_EntityId_t(); /* Arrange unstubbable: CF_CmdAcc via CF_CmdCond */ uint16 initial_hk_err_counter = Any_uint16(); @@ -1297,10 +1297,10 @@ void Test_CF_CmdFThaw_Set_frozen_To_0_AndAcceptCommand(void) void Test_CF_CFDP_FindTransactionBySequenceNumberAllChannels_WhenNoTransactionFoundReturn_NULL(void) { /* Arrange */ - cf_transaction_seq_t arg_ts = Any_cf_transaction_seq_t(); - cf_entity_id_t arg_eid = Any_cf_entity_id_t(); - transaction_t *local_result; - transaction_t *expected_result = NULL; + CF_TransactionSeq_t arg_ts = Any_CF_TransactionSeq_t(); + CF_EntityId_t arg_eid = Any_CF_EntityId_t(); + transaction_t *local_result; + transaction_t *expected_result = NULL; CF_CFDP_FindTransactionBySequenceNumber_context_t context_CF_CFDP_FTBSN; @@ -1330,12 +1330,12 @@ void Test_CF_CFDP_FindTransactionBySequenceNumberAllChannels_WhenNoTransactionFo void Test_CF_CFDP_FindTransactionBySequenceNumberAllChannels_Return_TransactionFound(void) { /* Arrange */ - cf_transaction_seq_t arg_ts = Any_cf_transaction_seq_t(); - cf_entity_id_t arg_eid = Any_cf_entity_id_t(); - uint8 number_transaction_match = Any_uint8_LessThan(CF_NUM_CHANNELS); - transaction_t dummy_return_value; - transaction_t *local_result; - transaction_t *expected_result = &dummy_return_value; + CF_TransactionSeq_t arg_ts = Any_CF_TransactionSeq_t(); + CF_EntityId_t arg_eid = Any_CF_EntityId_t(); + uint8 number_transaction_match = Any_uint8_LessThan(CF_NUM_CHANNELS); + transaction_t dummy_return_value; + transaction_t *local_result; + transaction_t *expected_result = &dummy_return_value; CF_CFDP_FindTransactionBySequenceNumber_context_t contexts_CF_CFDP_FTBSN[CF_NUM_CHANNELS]; @@ -4107,7 +4107,7 @@ void Test_CF_CmdValidateChunkSize_val_GreaterThan_pdu_fd_data_t_FailAndReturn_1( { /* Arrange */ uint8 arg_chan_num = Any_uint8(); /* value labeled as 'ignored' in func def */ - uint32 arg_val = sizeof(pdu_fd_data_t) + 1; + uint32 arg_val = sizeof(CF_CFDP_PduFileDataContent_t) + 1; int local_result; /* Act */ @@ -4122,7 +4122,7 @@ void Test_CF_CmdValidateChunkSize_Any_val_GreaterThan_pdu_fd_data_t_FailAndRetur { /* Arrange */ uint8 arg_chan_num = Any_uint8(); /* value labeled as 'ignored' in func def */ - uint32 arg_val = Any_uint32_GreaterThan(sizeof(pdu_fd_data_t)); + uint32 arg_val = Any_uint32_GreaterThan(sizeof(CF_CFDP_PduFileDataContent_t)); int local_result; /* Act */ @@ -4137,7 +4137,7 @@ void Test_CF_CmdValidateChunkSize_val_SizeOf_pdu_fd_data_t_SuccessAndReturn_0(vo { /* Arrange */ uint8 arg_chan_num = Any_uint8(); /* value labeled as 'ignored' in func def */ - uint32 arg_val = sizeof(pdu_fd_data_t); + uint32 arg_val = sizeof(CF_CFDP_PduFileDataContent_t); int local_result; /* Act */ @@ -4152,7 +4152,7 @@ void Test_CF_CmdValidateChunkSize_val_LessThanOrEqSizeOf_pdu_fd_data_t_SuccessAn { /* Arrange */ uint8 arg_chan_num = Any_uint8(); /* value labeled as 'ignored' in func def */ - uint32 arg_val = Any_uint32_LessThan_or_EqualTo(sizeof(pdu_fd_data_t)); + uint32 arg_val = Any_uint32_LessThan_or_EqualTo(sizeof(CF_CFDP_PduFileDataContent_t)); int local_result; /* Act */ @@ -4448,9 +4448,9 @@ void Test_CF_CmdGetSetParam_When_is_set_Is_1_And_param_id_Is_5_Uses_SPTRFN_SendE cf_config_table_t dummy_config_table; uint8 arg_is_set = 1; uint8 arg_param_id = 5; - uint32 arg_value = Any_uint32_GreaterThan( - sizeof(pdu_fd_data_t)); /* Arrange unstubbable: CF_CmdValidateChunkSize - specific value needed */ - uint8 arg_chan_num = Any_cf_chan_num(); + uint32 arg_value = Any_uint32_GreaterThan(sizeof( + CF_CFDP_PduFileDataContent_t)); /* Arrange unstubbable: CF_CmdValidateChunkSize - specific value needed */ + uint8 arg_chan_num = Any_cf_chan_num(); CF_AppData.config_table = &dummy_config_table; @@ -4487,9 +4487,9 @@ void Test_CF_CmdGetSetParam_When_is_set_Is_1_And_param_id_Is_5_Uses_SPTRFN_ThenC cf_config_table_t dummy_config_table; uint8 arg_is_set = 1; uint8 arg_param_id = 5; - uint32 arg_value = Any_uint32_LessThan_or_EqualTo( - sizeof(pdu_fd_data_t)); /* Arrange unstubbable: CF_CmdValidateChunkSize - specific value needed */ - uint8 arg_chan_num = Any_cf_chan_num(); + uint32 arg_value = Any_uint32_LessThan_or_EqualTo(sizeof( + CF_CFDP_PduFileDataContent_t)); /* Arrange unstubbable: CF_CmdValidateChunkSize - specific value needed */ + uint8 arg_chan_num = Any_cf_chan_num(); CF_AppData.config_table = &dummy_config_table; diff --git a/unit-test/cf_utils_tests.c b/unit-test/cf_utils_tests.c index f9e804fd0..3f7d8469a 100644 --- a/unit-test/cf_utils_tests.c +++ b/unit-test/cf_utils_tests.c @@ -39,10 +39,10 @@ direction_t Any_direction_t(void) return (direction_t)Any_uint8_LessThan(CF_DIR_NUM); } -condition_code_t Any_condition_code_t(void) +CF_CFDP_ConditionCode_t Any_condition_code_t(void) { uint8 codes[13] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 15}; - return (condition_code_t)Any_uint8_FromThese(codes, sizeof(codes) / sizeof(codes[0])); + return (CF_CFDP_ConditionCode_t)Any_uint8_FromThese(codes, sizeof(codes) / sizeof(codes[0])); } void local_handler_OS_close(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) diff --git a/unit-test/stubs/cf_cfdp_helpers_stubs.c b/unit-test/stubs/cf_cfdp_helpers_stubs.c index a51405745..b780e5638 100644 --- a/unit-test/stubs/cf_cfdp_helpers_stubs.c +++ b/unit-test/stubs/cf_cfdp_helpers_stubs.c @@ -71,11 +71,11 @@ int CF_GetVariableHeader(void) * Generated stub function for CF_HeaderSize() * ---------------------------------------------------- */ -int CF_HeaderSize(const pdu_header_t *ph) +int CF_HeaderSize(const CF_CFDP_PduHeader_t *ph) { UT_GenStub_SetupReturnBuffer(CF_HeaderSize, int); - UT_GenStub_AddParam(CF_HeaderSize, const pdu_header_t *, ph); + UT_GenStub_AddParam(CF_HeaderSize, const CF_CFDP_PduHeader_t *, ph); UT_GenStub_Execute(CF_HeaderSize, Basic, NULL); @@ -102,11 +102,11 @@ void CF_MemcpyToBE(uint8 *dst, const uint8 *src, int src_size, int dst_size) * Generated stub function for CF_SetVariableHeader() * ---------------------------------------------------- */ -void CF_SetVariableHeader(cf_entity_id_t src_eid, cf_entity_id_t dst_eid, cf_transaction_seq_t tsn) +void CF_SetVariableHeader(CF_EntityId_t src_eid, CF_EntityId_t dst_eid, CF_TransactionSeq_t tsn) { - UT_GenStub_AddParam(CF_SetVariableHeader, cf_entity_id_t, src_eid); - UT_GenStub_AddParam(CF_SetVariableHeader, cf_entity_id_t, dst_eid); - UT_GenStub_AddParam(CF_SetVariableHeader, cf_transaction_seq_t, tsn); + UT_GenStub_AddParam(CF_SetVariableHeader, CF_EntityId_t, src_eid); + UT_GenStub_AddParam(CF_SetVariableHeader, CF_EntityId_t, dst_eid); + UT_GenStub_AddParam(CF_SetVariableHeader, CF_TransactionSeq_t, tsn); UT_GenStub_Execute(CF_SetVariableHeader, Basic, NULL); } diff --git a/unit-test/stubs/cf_cfdp_r_stubs.c b/unit-test/stubs/cf_cfdp_r_stubs.c index 81b0add49..649f9a092 100644 --- a/unit-test/stubs/cf_cfdp_r_stubs.c +++ b/unit-test/stubs/cf_cfdp_r_stubs.c @@ -34,9 +34,9 @@ typedef struct { - transaction_t *t; - pdu_header_t *pdu; - uint32 gap_counter; + transaction_t *t; + CF_CFDP_PduHeader_t *pdu; + uint32 gap_counter; } gap_compute_args_t; /************************************************************************/ @@ -46,7 +46,7 @@ typedef struct ** t must not be NULL. ** *************************************************************************/ -// static void CF_CFDP_R2_SetCc(transaction_t *t, condition_code_t cc) +// static void CF_CFDP_R2_SetCc(transaction_t *t, CF_CFDP_ConditionCode_t cc) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -164,7 +164,7 @@ typedef struct ** \endreturns ** *************************************************************************/ -// static int CF_CFDP_R_SubstateRecvEof(transaction_t *t, const pdu_header_t *pdu) +// static int CF_CFDP_R_SubstateRecvEof(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -185,7 +185,7 @@ typedef struct ** \endreturns ** *************************************************************************/ -// static void CF_CFDP_R1_SubstateRecvEof(transaction_t *t, const pdu_header_t *pdu) +// static void CF_CFDP_R1_SubstateRecvEof(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -207,7 +207,7 @@ typedef struct ** \endreturns ** *************************************************************************/ -// static void CF_CFDP_R2_SubstateRecvEof(transaction_t *t, const pdu_header_t *pdu) +// static void CF_CFDP_R2_SubstateRecvEof(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -224,7 +224,7 @@ typedef struct ** t must not be NULL. pdu must not be NULL. ** *************************************************************************/ -// static void CF_CFDP_R1_SubstateRecvFileData(transaction_t *t, const pdu_header_t *pdu) +// static void CF_CFDP_R1_SubstateRecvFileData(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -245,7 +245,7 @@ typedef struct ** t must not be NULL. pdu must not be NULL. ** *************************************************************************/ -// static void CF_CFDP_R2_SubstateRecvFileData(transaction_t *t, const pdu_header_t *pdu) +// static void CF_CFDP_R2_SubstateRecvFileData(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -370,7 +370,7 @@ void CF_CFDP_R_Init(transaction_t *t) ** t must not be NULL. pdu must not be NULL. ** *************************************************************************/ -// static void CF_CFDP_R2_Recv_fin_ack(transaction_t *t, const pdu_header_t *pdu) +// static void CF_CFDP_R2_Recv_fin_ack(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -391,7 +391,7 @@ void CF_CFDP_R_Init(transaction_t *t) ** t must not be NULL. pdu must not be NULL. ** *************************************************************************/ -// static void CF_CFDP_R2_RecvMd(transaction_t *t, const pdu_header_t *pdu) +// static void CF_CFDP_R2_RecvMd(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -411,8 +411,8 @@ void CF_CFDP_R_Init(transaction_t *t) ** *************************************************************************/ // static void CF_CFDP_R_DispatchRecv(transaction_t *t, void (*const -// fns[SEND_NUM_STATES][PDU_INVALID_MAX])(transaction_t*, const pdu_header_t*), void (*const fd_fn)(transaction_t*, -// const pdu_header_t*)) +// fns[SEND_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])(transaction_t*, const CF_CFDP_PduHeader_t*), void (*const +// fd_fn)(transaction_t*, const CF_CFDP_PduHeader_t*)) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); diff --git a/unit-test/stubs/cf_cfdp_s_stubs.c b/unit-test/stubs/cf_cfdp_s_stubs.c index 4b7be43e4..f603ddfdb 100644 --- a/unit-test/stubs/cf_cfdp_s_stubs.c +++ b/unit-test/stubs/cf_cfdp_s_stubs.c @@ -226,7 +226,7 @@ ** t must not be NULL. pdu must not be NULL. ** *************************************************************************/ -// static void CF_CFDP_S2_EarlyFin(transaction_t *t, const pdu_header_t *pdu) +// static void CF_CFDP_S2_EarlyFin(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -240,7 +240,7 @@ ** t must not be NULL. pdu must not be NULL. ** *************************************************************************/ -// static void CF_CFDP_S2_Fin(transaction_t *t, const pdu_header_t *pdu) +// static void CF_CFDP_S2_Fin(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -259,7 +259,7 @@ ** t must not be NULL. pdu must not be NULL. ** *************************************************************************/ -// static void CF_CFDP_S2_Nak(transaction_t *t, const pdu_header_t *pdu) +// static void CF_CFDP_S2_Nak(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -273,7 +273,7 @@ ** t must not be NULL. pdu must not be NULL. ** *************************************************************************/ -// static void CF_CFDP_S2_Nak_Arm(transaction_t *t, const pdu_header_t *pdu) +// static void CF_CFDP_S2_Nak_Arm(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -291,7 +291,7 @@ ** t must not be NULL. pdu must not be NULL. ** *************************************************************************/ -// static void CF_CFDP_S2_WaitForEofAck(transaction_t *t, const pdu_header_t *pdu) +// static void CF_CFDP_S2_WaitForEofAck(transaction_t *t, const CF_CFDP_PduHeader_t *pdu) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -311,7 +311,7 @@ ** *************************************************************************/ // static void CF_CFDP_S_DispatchRecv(transaction_t *t, void (*const -// fns[SEND_NUM_STATES][PDU_INVALID_MAX])(transaction_t*, const pdu_header_t*)) +// fns[SEND_NUM_STATES][CF_CFDP_FileDirective_INVALID_MAX])(transaction_t*, const CF_CFDP_PduHeader_t*)) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); diff --git a/unit-test/stubs/cf_cfdp_stubs.c b/unit-test/stubs/cf_cfdp_stubs.c index 99ad793c5..00bdddbf2 100644 --- a/unit-test/stubs/cf_cfdp_stubs.c +++ b/unit-test/stubs/cf_cfdp_stubs.c @@ -44,13 +44,13 @@ const int CF_max_chunks[CF_DIR_NUM][CF_NUM_CHANNELS] = {CF_CHANNEL_NUM_RX_CHUNKS // static void CF_CFDP_RecvIdle(transaction_t*); // static void CF_CFDP_RecvDrop(transaction_t*); -// static void CF_CFDP_TxFile__(transaction_t *t, cfdp_class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority); +// static void CF_CFDP_TxFile__(transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority); typedef struct trans_seq_arg_t { - cf_transaction_seq_t transaction_sequence_number; - cf_entity_id_t src_eid; - transaction_t *t; /* out param */ + CF_TransactionSeq_t transaction_sequence_number; + CF_EntityId_t src_eid; + transaction_t *t; /* out param */ } trans_seq_arg_t; typedef struct CF_CFDP_CycleTx_args_t @@ -93,7 +93,7 @@ void CF_CFDP_ArmAckTimer(transaction_t *t) ** \endreturns ** *************************************************************************/ -// static cfdp_class_t CF_CFDP_GetClass(transaction_t *ti) +// static CF_CFDP_Class_t CF_CFDP_GetClass(transaction_t *ti) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -268,15 +268,15 @@ void CF_CFDP_ResetHistory(channel_t *c, history_t *h) ** \endreturns ** *************************************************************************/ -transaction_t *CF_CFDP_FindTransactionBySequenceNumber(channel_t *c, cf_transaction_seq_t transaction_sequence_number, - cf_entity_id_t src_eid) +transaction_t *CF_CFDP_FindTransactionBySequenceNumber(channel_t *c, CF_TransactionSeq_t transaction_sequence_number, + CF_EntityId_t src_eid) { transaction_t *forced_return; UT_Stub_CopyFromLocal(UT_KEY(CF_CFDP_FindTransactionBySequenceNumber), &c, sizeof(channel_t *)); UT_Stub_CopyFromLocal(UT_KEY(CF_CFDP_FindTransactionBySequenceNumber), &transaction_sequence_number, - sizeof(cf_transaction_seq_t)); - UT_Stub_CopyFromLocal(UT_KEY(CF_CFDP_FindTransactionBySequenceNumber), &src_eid, sizeof(cf_entity_id_t)); + sizeof(CF_TransactionSeq_t)); + UT_Stub_CopyFromLocal(UT_KEY(CF_CFDP_FindTransactionBySequenceNumber), &src_eid, sizeof(CF_EntityId_t)); UT_DEFAULT_IMPL(CF_CFDP_FindTransactionBySequenceNumber); @@ -300,13 +300,13 @@ transaction_t *CF_CFDP_FindTransactionBySequenceNumber(channel_t *c, cf_transact ** t must not be NULL. ** ** \returns -** \retstmt Pointer to a pdu_header_t within a software bus buffer on success. Otherwise NULL. \endcode +** \retstmt Pointer to a CF_CFDP_PduHeader_t within a software bus buffer on success. Otherwise NULL. \endcode ** \endreturns ** *************************************************************************/ -pdu_header_t *CF_CFDP_MsgOutGet(const transaction_t *t, int silent) +CF_CFDP_PduHeader_t *CF_CFDP_MsgOutGet(const transaction_t *t, int silent) { - pdu_header_t *forced_return; + CF_CFDP_PduHeader_t *forced_return; UT_Stub_CopyFromLocal(UT_KEY(CF_CFDP_MsgOutGet), &t, sizeof(t)); UT_Stub_CopyFromLocal(UT_KEY(CF_CFDP_MsgOutGet), &silent, sizeof(silent)); @@ -343,19 +343,19 @@ pdu_header_t *CF_CFDP_MsgOutGet(const transaction_t *t, int silent) void Handler_CF_CFDP_ConstructPduHeader_ForceReturnOnly(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { - UT_Stub_CopyToReturnValue(UT_KEY(CF_CFDP_ConstructPduHeader), UserObj, sizeof(pdu_header_t *)); + UT_Stub_CopyToReturnValue(UT_KEY(CF_CFDP_ConstructPduHeader), UserObj, sizeof(CF_CFDP_PduHeader_t *)); } void Handler_CF_CFDP_ConstructPduHeader_Default(void *UserObj, UT_EntryKey_t FuncKey, const UT_StubContext_t *Context) { const transaction_t *t = UT_Hook_GetArgValueByName(Context, "t", const transaction_t *); uint8 directive_code = UT_Hook_GetArgValueByName(Context, "directive_code", uint8); - cf_entity_id_t src_eid = UT_Hook_GetArgValueByName(Context, "src_eid", cf_entity_id_t); - cf_entity_id_t dst_eid = UT_Hook_GetArgValueByName(Context, "dst_eid", cf_entity_id_t); + CF_EntityId_t src_eid = UT_Hook_GetArgValueByName(Context, "src_eid", CF_EntityId_t); + CF_EntityId_t dst_eid = UT_Hook_GetArgValueByName(Context, "dst_eid", CF_EntityId_t); uint8 towards_sender = UT_Hook_GetArgValueByName(Context, "towards_sender", uint8); - cf_transaction_seq_t tsn = UT_Hook_GetArgValueByName(Context, "tsn", cf_transaction_seq_t); + CF_TransactionSeq_t tsn = UT_Hook_GetArgValueByName(Context, "tsn", CF_TransactionSeq_t); int silent = UT_Hook_GetArgValueByName(Context, "silent", int); - pdu_header_t *forced_return; + CF_CFDP_PduHeader_t *forced_return; UT_Stub_CopyFromLocal(UT_KEY(CF_CFDP_ConstructPduHeader), &t, sizeof(t)); UT_Stub_CopyFromLocal(UT_KEY(CF_CFDP_ConstructPduHeader), &directive_code, sizeof(directive_code)); @@ -370,23 +370,23 @@ void Handler_CF_CFDP_ConstructPduHeader_Default(void *UserObj, UT_EntryKey_t Fun UT_Stub_SetReturnValue(UT_KEY(CF_CFDP_ConstructPduHeader), forced_return); } -pdu_header_t *CF_CFDP_ConstructPduHeader(const transaction_t *t, uint8 directive_code, cf_entity_id_t src_eid, - cf_entity_id_t dst_eid, uint8 towards_sender, cf_transaction_seq_t tsn, - int silent) +CF_CFDP_PduHeader_t *CF_CFDP_ConstructPduHeader(const transaction_t *t, uint8 directive_code, CF_EntityId_t src_eid, + CF_EntityId_t dst_eid, uint8 towards_sender, CF_TransactionSeq_t tsn, + int silent) { - UT_GenStub_SetupReturnBuffer(CF_CFDP_ConstructPduHeader, pdu_header_t *); + UT_GenStub_SetupReturnBuffer(CF_CFDP_ConstructPduHeader, CF_CFDP_PduHeader_t *); UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, const transaction_t *, t); UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, uint8, directive_code); - UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, cf_entity_id_t, src_eid); - UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, cf_entity_id_t, dst_eid); + UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, CF_EntityId_t, src_eid); + UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, CF_EntityId_t, dst_eid); UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, uint8, towards_sender); - UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, cf_transaction_seq_t, tsn); + UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, CF_TransactionSeq_t, tsn); UT_GenStub_AddParam(CF_CFDP_ConstructPduHeader, int, silent); UT_GenStub_Execute(CF_CFDP_ConstructPduHeader, Basic, Handler_CF_CFDP_ConstructPduHeader_Default); - return UT_GenStub_GetReturnValue(CF_CFDP_ConstructPduHeader, pdu_header_t *); + return UT_GenStub_GetReturnValue(CF_CFDP_ConstructPduHeader, CF_CFDP_PduHeader_t *); } /************************************************************************/ @@ -421,7 +421,7 @@ cfdp_send_ret_t CF_CFDP_SendMd(transaction_t *t) ** \endreturns ** *************************************************************************/ -pdu_header_t *CF_CFDP_EarlySendFd(transaction_t *t) +CF_CFDP_PduHeader_t *CF_CFDP_EarlySendFd(transaction_t *t) { UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", __FILE__, __LINE__); exit(-86); @@ -466,7 +466,7 @@ cfdp_send_ret_t CF_CFDP_SendFd(transaction_t *t, uint32 offset, int len) ** \endreturns ** *************************************************************************/ -// static int CF_CFDP_FinishEofAck(pdu_header_t *pdu) +// static int CF_CFDP_FinishEofAck(CF_CFDP_PduHeader_t *pdu) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -512,8 +512,8 @@ cfdp_send_ret_t CF_CFDP_SendEof(transaction_t *t) ** \endreturns ** *************************************************************************/ -cfdp_send_ret_t CF_CFDP_SendAck(transaction_t *t, ack_transaction_status_t ts, file_directive_t dir_code, - condition_code_t cc, cf_entity_id_t peer_eid, cf_transaction_seq_t tsn) +cfdp_send_ret_t CF_CFDP_SendAck(transaction_t *t, 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) { cfdp_send_ret_t forced_return; @@ -544,14 +544,15 @@ cfdp_send_ret_t CF_CFDP_SendAck(transaction_t *t, ack_transaction_status_t ts, f ** \endreturns ** *************************************************************************/ -cfdp_send_ret_t CF_CFDP_SendFin(transaction_t *t, fin_delivery_code_t dc, fin_file_status_t fs, condition_code_t cc) +cfdp_send_ret_t CF_CFDP_SendFin(transaction_t *t, CF_CFDP_FinDeliveryCode_t dc, CF_CFDP_FinFileStatus_t fs, + CF_CFDP_ConditionCode_t cc) { UT_GenStub_SetupReturnBuffer(CF_CFDP_SendFin, int32); UT_GenStub_AddParam(CF_CFDP_SendFin, transaction_t *, t); - UT_GenStub_AddParam(CF_CFDP_SendFin, fin_delivery_code_t, dc); - UT_GenStub_AddParam(CF_CFDP_SendFin, fin_file_status_t, fs); - UT_GenStub_AddParam(CF_CFDP_SendFin, condition_code_t, cc); + 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); UT_GenStub_Execute(CF_CFDP_SendFin, Basic, NULL); @@ -598,7 +599,7 @@ cfdp_send_ret_t CF_CFDP_SendNak(transaction_t *t, int num_segment_requests) ** \endreturns ** *************************************************************************/ -pdu_header_t *CF_CFDP_EarlySendNak(transaction_t *t) +CF_CFDP_PduHeader_t *CF_CFDP_EarlySendNak(transaction_t *t) { UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", __FILE__, __LINE__); exit(-86); @@ -917,7 +918,7 @@ int32 CF_CFDP_InitEngine(void) ** t must not be NULL. ** *************************************************************************/ -// static void CF_CFDP_TxFile__(transaction_t *t, cfdp_class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority) +// static void CF_CFDP_TxFile__(transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -940,8 +941,8 @@ int32 CF_CFDP_InitEngine(void) ** \endreturns ** *************************************************************************/ -// static void CF_CFDP_TxFile_(transaction_t *t, cfdp_class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, -// cf_entity_id_t dest_id) +// static void CF_CFDP_TxFile_(transaction_t *t, CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, +// CF_EntityId_t dest_id) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); @@ -965,7 +966,7 @@ int32 CF_CFDP_InitEngine(void) ** *************************************************************************/ int32 CF_CFDP_TxFile(const char src_filename[CF_FILENAME_MAX_LEN], const char dst_filename[CF_FILENAME_MAX_LEN], - cfdp_class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, cf_entity_id_t dest_id) + CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, CF_EntityId_t dest_id) { UT_Stub_CopyFromLocal(UT_KEY(CF_CFDP_TxFile), src_filename, CF_FILENAME_MAX_LEN); UT_Stub_CopyFromLocal(UT_KEY(CF_CFDP_TxFile), dst_filename, CF_FILENAME_MAX_LEN); @@ -994,7 +995,7 @@ int32 CF_CFDP_TxFile(const char src_filename[CF_FILENAME_MAX_LEN], const char ds ** *************************************************************************/ // static int32 CF_CFDP_PlaybackDir_(playback_t *p, const char src_filename[CF_FILENAME_MAX_LEN], const char -// dst_filename[CF_FILENAME_MAX_LEN], cfdp_class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, cf_entity_id_t +// dst_filename[CF_FILENAME_MAX_LEN], CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, CF_EntityId_t // dest_id) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", @@ -1019,7 +1020,7 @@ int32 CF_CFDP_TxFile(const char src_filename[CF_FILENAME_MAX_LEN], const char ds ** *************************************************************************/ int32 CF_CFDP_PlaybackDir(const char src_filename[CF_FILENAME_MAX_LEN], const char dst_filename[CF_FILENAME_MAX_LEN], - cfdp_class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, uint16 dest_id) + CF_CFDP_Class_t cfdp_class, uint8 keep, uint8 chan, uint8 priority, uint16 dest_id) { UT_Stub_CopyFromLocal(UT_KEY(CF_CFDP_PlaybackDir), src_filename, CF_FILENAME_MAX_LEN); UT_Stub_CopyFromLocal(UT_KEY(CF_CFDP_PlaybackDir), dst_filename, CF_FILENAME_MAX_LEN); @@ -1145,7 +1146,7 @@ void CF_CFDP_ResetTransaction(transaction_t *t, int keep_history) ** \endreturns ** *************************************************************************/ -int CF_CFDP_CopyDataToLv(lv_t *dest_lv, const uint8 *data, uint32 len) +int CF_CFDP_CopyDataToLv(CF_CFDP_lv_t *dest_lv, const uint8 *data, uint32 len) { UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", __FILE__, __LINE__); exit(-86); @@ -1163,7 +1164,7 @@ int CF_CFDP_CopyDataToLv(lv_t *dest_lv, const uint8 *data, uint32 len) ** \endreturns ** *************************************************************************/ -int CF_CFDP_CopyDataFromLv(uint8 buf[CF_FILENAME_MAX_LEN], const lv_t *src_lv) +int CF_CFDP_CopyDataFromLv(uint8 buf[CF_FILENAME_MAX_LEN], const CF_CFDP_lv_t *src_lv) { UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", __FILE__, __LINE__); exit(-86); diff --git a/unit-test/stubs/cf_clist_stubs.c b/unit-test/stubs/cf_clist_stubs.c index aa634e695..9fddb2534 100644 --- a/unit-test/stubs/cf_clist_stubs.c +++ b/unit-test/stubs/cf_clist_stubs.c @@ -183,8 +183,8 @@ void CF_CList_Traverse(clist_node start, clist_fn_t fn, void *context) void *t = (uint8 *)src_eid + 4; /* uint8 - 4 bytes, no packing in struct */ UT_Stub_CopyFromLocal(UT_KEY(CF_CList_Traverse), transaction_sequence_number, - sizeof(cf_transaction_seq_t)); - UT_Stub_CopyFromLocal(UT_KEY(CF_CList_Traverse), src_eid, sizeof(cf_entity_id_t)); + sizeof(CF_TransactionSeq_t)); + UT_Stub_CopyFromLocal(UT_KEY(CF_CList_Traverse), src_eid, sizeof(CF_EntityId_t)); UT_Stub_CopyToLocal(UT_KEY(CF_CList_Traverse), t, sizeof(transaction_t *)); } break; diff --git a/unit-test/stubs/cf_cmd_stubs.c b/unit-test/stubs/cf_cmd_stubs.c index 78a1f5b61..899d4c948 100644 --- a/unit-test/stubs/cf_cmd_stubs.c +++ b/unit-test/stubs/cf_cmd_stubs.c @@ -251,7 +251,7 @@ typedef struct ** \endreturns ** *************************************************************************/ -// static transaction_t *CF_CFDP_FindTransactionBySequenceNumberAllChannels(cf_transaction_seq_t ts, cf_entity_id_t eid) +// static transaction_t *CF_CFDP_FindTransactionBySequenceNumberAllChannels(CF_TransactionSeq_t ts, CF_EntityId_t eid) // { // UtPrintf("NOT YET IMPLEMENTED stub in \n%s:line #%d\n", // __FILE__, __LINE__); diff --git a/unit-test/utilities/cf_test_utils.h b/unit-test/utilities/cf_test_utils.h index 54a89ffd4..90bc9b135 100644 --- a/unit-test/utilities/cf_test_utils.h +++ b/unit-test/utilities/cf_test_utils.h @@ -57,7 +57,7 @@ void Handler_CF_CFDP_ConstructPduHeader_ForceReturnOnly(void *UserObj, UT_EntryK ** ** Buffer allocation types ** -** The "pdu_s_msg_t" and "pdu_r_msg_t" are only minimally-sized types, reflecting +** The "CF_PduSendMsg_t" and "CF_PduRecvMsg_t" are only minimally-sized types, reflecting ** the common parts of all PDUs, without any definition of the optional/extra parts. ** ** In order to call one of the CFDP functions that accept a larger buffer, the @@ -71,25 +71,25 @@ void Handler_CF_CFDP_ConstructPduHeader_ForceReturnOnly(void *UserObj, UT_EntryK /* A combination of all the various CFDP secondary header types */ typedef union { - pdu_file_directive_header_t fdirh; - pdu_file_data_header_t fdatah; - pdu_md_t md; - pdu_eof_t eof; - pdu_ack_t ack; - pdu_fin_t fin; - pdu_nak_t nak; + CF_CFDP_PduFileDirectiveHeader_t fdirh; + CF_CFDP_PduFileDataHeader_t fdatah; + CF_CFDP_PduMd_t md; + CF_CFDP_PduEof_t eof; + CF_CFDP_PduAck_t ack; + CF_CFDP_PduFin_t fin; + CF_CFDP_PduNak_t nak; } pdu_any_sechdr_t; typedef struct { - /* note that technically the pdu_header_t is variably sized, + /* note that technically the CF_CFDP_PduHeader_t is variably sized, but for most UT test cases the extension data is not used, thus the second header follows it immediately */ - pdu_header_t common; - pdu_any_sechdr_t secondary; + CF_CFDP_PduHeader_t common; + pdu_any_sechdr_t secondary; - /* extra space just in case the pdu_header_t is longer than nominal */ - uint8_t pad[CF_MAX_HEADER_SIZE - sizeof(pdu_header_t)]; + /* extra space just in case the CF_CFDP_PduHeader_t is longer than nominal */ + uint8_t pad[CF_MAX_HEADER_SIZE - sizeof(CF_CFDP_PduHeader_t)]; } CF_UT_fullhdr_t; @@ -111,7 +111,7 @@ typedef union { CFE_MSG_Message_t cfe_msg; CFE_SB_Buffer_t cfe_sb_buffer; - pdu_s_msg_t pdu_s_msg; + CF_PduSendMsg_t pdu_s_msg; CF_UT_any_outmsg_t content; /* This ensures the buffer is large enough to store any PDU type, @@ -124,7 +124,7 @@ typedef union { CFE_MSG_Message_t cfe_msg; CFE_SB_Buffer_t cfe_sb_buffer; - pdu_r_msg_t pdu_r_msg; + CF_PduRecvMsg_t pdu_r_msg; CF_UT_any_inmsg_t content; /* This ensures the buffer is large enough to store any PDU type, @@ -154,12 +154,12 @@ typedef struct { const transaction_t *t; uint8 directive_code; - cf_entity_id_t src_eid; - cf_entity_id_t dst_eid; + CF_EntityId_t src_eid; + CF_EntityId_t dst_eid; uint8 towards_sender; - cf_transaction_seq_t tsn; + CF_TransactionSeq_t tsn; int silent; - pdu_header_t *forced_return; + CF_CFDP_PduHeader_t *forced_return; } CF_PACK CF_CFDP_ConstructPduHeader_context_t; typedef struct @@ -225,32 +225,32 @@ typedef struct typedef struct { - const char src_filename[CF_FILENAME_MAX_LEN]; - const char dst_filename[CF_FILENAME_MAX_LEN]; - cfdp_class_t cfdp_class; - uint8 keep; - uint8 chan; - uint8 priority; - cf_entity_id_t dest_id; + const char src_filename[CF_FILENAME_MAX_LEN]; + const char dst_filename[CF_FILENAME_MAX_LEN]; + CF_CFDP_Class_t cfdp_class; + uint8 keep; + uint8 chan; + uint8 priority; + CF_EntityId_t dest_id; } CF_PACK CF_CFDP_TxFile_context_t; typedef struct { - const char src_filename[CF_FILENAME_MAX_LEN]; - const char dst_filename[CF_FILENAME_MAX_LEN]; - cfdp_class_t cfdp_class; - uint8 keep; - uint8 chan; - uint8 priority; - cf_entity_id_t dest_id; + const char src_filename[CF_FILENAME_MAX_LEN]; + const char dst_filename[CF_FILENAME_MAX_LEN]; + CF_CFDP_Class_t cfdp_class; + uint8 keep; + uint8 chan; + uint8 priority; + CF_EntityId_t dest_id; } CF_PACK CF_CFDP_PlaybackDir_context_t; typedef struct { - channel_t *c; - cf_transaction_seq_t transaction_sequence_number; - cf_entity_id_t src_eid; - transaction_t *forced_return; + channel_t *c; + CF_TransactionSeq_t transaction_sequence_number; + CF_EntityId_t src_eid; + transaction_t *forced_return; } CF_PACK CF_CFDP_FindTransactionBySequenceNumber_context_t; typedef struct @@ -315,9 +315,9 @@ typedef struct typedef struct { - transaction_t *t; - int silent; - pdu_header_t *forced_return; + transaction_t *t; + int silent; + CF_CFDP_PduHeader_t *forced_return; } CF_PACK CF_CFDP_MsgOutGet_context_t; typedef struct @@ -353,13 +353,13 @@ typedef struct typedef struct { - transaction_t *t; - ack_transaction_status_t ts; - file_directive_t dir_code; - condition_code_t cc; - cf_entity_id_t peer_eid; - cf_transaction_seq_t tsn; - cfdp_send_ret_t forced_return; + transaction_t *t; + 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; + cfdp_send_ret_t forced_return; } CF_PACK CF_CFDP_SendAck_context_t; typedef struct @@ -416,11 +416,11 @@ typedef struct typedef struct { - clist_node start; - clist_fn_t fn; - cf_transaction_seq_t context_transaction_sequence_number; - cf_entity_id_t context_src_eid; - transaction_t *context_forced_t; /* out param */ + clist_node start; + clist_fn_t fn; + CF_TransactionSeq_t context_transaction_sequence_number; + CF_EntityId_t context_src_eid; + transaction_t *context_forced_t; /* out param */ } CF_PACK CF_CList_Traverse_FIND_T_BY_SEQ_NUM_context_t; typedef struct @@ -476,20 +476,20 @@ typedef struct typedef struct { - transaction_t *t; - pdu_header_t *pdu; + transaction_t *t; + CF_CFDP_PduHeader_t *pdu; } CF_PACK Dummy_fd_fn_context_t; typedef struct { - transaction_t *t; - pdu_header_t *pdu; + transaction_t *t; + CF_CFDP_PduHeader_t *pdu; } CF_PACK Dummy_fns_context_t; typedef struct { - transaction_t *t; - const pdu_header_t *pdu; + transaction_t *t; + const CF_CFDP_PduHeader_t *pdu; } CF_PACK Dummy_fns_CF_CFDP_S_DispatchRecv_context_t; /* bottom */