Skip to content

Commit

Permalink
Fix nasa#19, Clarify PDU size limits
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Mar 13, 2024
1 parent 27dcaf5 commit 7e8d891
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
6 changes: 3 additions & 3 deletions config/default_cf_tblstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ typedef struct CF_ConfigTable

CF_ChannelConfig_t chan[CF_NUM_CHANNELS]; /**< \brief Channel configuration */

uint16 outgoing_file_chunk_size; /**< maximum size of outgoing file data PDUs - must be
* smaller than file data character array */
char tmp_dir[CF_FILENAME_MAX_PATH]; /**< directory to put temp files */
uint16 outgoing_file_chunk_size; /**< \brief maximum size of outgoing file data chunk in a PDU.
* Limited by CF_MAX_PDU_SIZE minus the PDU header(s) */
char tmp_dir[CF_FILENAME_MAX_PATH]; /**< \brief directory to put temp files */
} CF_ConfigTable_t;

#endif
10 changes: 6 additions & 4 deletions fsw/src/cf_cfdp_pdu.h
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,13 @@ typedef struct CF_CFDP_PduFileDataHeader
} CF_CFDP_PduFileDataHeader_t;

/**
* @brief PDU file data content
* @brief
* PDU file data content typedef for limit checking outgoing_file_chunk_size
* table value and set parameter command.
*
* To serve as a sanity check, this should accommodate the largest data block possible.
* In that light, it should be sized based on the minimum encoded header size, rather than
* the maximum, as that case leaves the most space for data.
* This definition allows for the largest data block possible, as CF_MAX_PDU_SIZE -
* the minimum possible header size. In practice the outgoing file chunk size is limited by
* whichever is smaller; the remaining data, remaining space in the packet, and outgoing_file_chunk_size.
*/
typedef struct CF_CFDP_PduFileDataContent
{
Expand Down
24 changes: 6 additions & 18 deletions fsw/src/cf_cfdp_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,24 +410,16 @@ typedef struct CF_Channel
uint8 tick_type;
} CF_Channel_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 */

/**
* @brief CF engine output state
*
* Keeps the state of the current output PDU in the CF engine
*/
typedef struct CF_Output
{
CFE_SB_Buffer_t * msg; /**< \brief Binary message to be sent to underlying transport */
CF_EncoderState_t encode; /**< \brief Encoding state (while building message) */

/**
* \brief Temporary R/W buffer for holding output PDUs while working with them
*/
CF_Logical_PduBuffer_t tx_pdudata;
CFE_SB_Buffer_t *msg; /**< \brief Binary message to be sent to underlying transport */
CF_EncoderState_t encode; /**< \brief Encoding state (while building message) */
CF_Logical_PduBuffer_t tx_pdudata; /**< \brief Tx PDU logical values */
} CF_Output_t;

/**
Expand All @@ -437,13 +429,9 @@ typedef struct CF_Output
*/
typedef struct CF_Input
{
CFE_SB_Buffer_t * msg; /**< \brief Binary message received from underlying transport */
CF_DecoderState_t decode; /**< \brief Decoding state (while interpreting message) */

/**
* \brief Temporary R/W buffer for holding input PDUs while working with them
*/
CF_Logical_PduBuffer_t rx_pdudata;
CFE_SB_Buffer_t *msg; /**< \brief Binary message received from underlying transport */
CF_DecoderState_t decode; /**< \brief Decoding state (while interpreting message) */
CF_Logical_PduBuffer_t rx_pdudata; /**< \brief Rx PDU logical values */
} CF_Input_t;

/**
Expand Down

0 comments on commit 7e8d891

Please sign in to comment.