GCC Code Coverage Report


Directory: ./
File: Svc/Ccsds/CfdpManager/Types/EofPdu.hpp
Date: 2026-09-03 22:12:29
Exec Total Coverage
Lines: 0 6 0.0%
Functions: 0 6 0.0%
Branches: 0 1 0.0%

Line Branch Exec Source
1 // ======================================================================
2 // \title EofPdu.hpp
3 // \author Brian Campuzano
4 // \brief hpp file for CFDP EOF PDU
5 // ======================================================================
6
7 #ifndef Svc_Ccsds_Cfdp_EofPdu_HPP
8 #define Svc_Ccsds_Cfdp_EofPdu_HPP
9
10 #include <Svc/Ccsds/CfdpManager/Types/PduBase.hpp>
11 #include <Svc/Ccsds/CfdpManager/Types/Tlv.hpp>
12 #include <Svc/Ccsds/CfdpManager/Types/Types.hpp>
13
14 namespace Svc {
15 namespace Ccsds {
16 namespace Cfdp {
17
18 //! The type of an EOF PDU
19 class EofPdu : public PduBase {
20 private:
21 //! Condition code
22 ConditionCode m_conditionCode;
23
24 //! File checksum
25 U32 m_checksum;
26
27 //! File size
28 FileSize m_fileSize;
29
30 //! TLV list (optional)
31 TlvList m_tlvList;
32
33 public:
34 //! Constructor
35 EofPdu() : m_conditionCode(ConditionCode::CONDITION_CODE_NO_ERROR), m_checksum(0), m_fileSize(0) {}
36
37 //! Initialize an EOF PDU
38 void initialize(PduDirection direction,
39 Cfdp::Class::T txmMode,
40 EntityId sourceEid,
41 TransactionSeq transactionSeq,
42 EntityId destEid,
43 ConditionCode conditionCode,
44 U32 checksum,
45 FileSize fileSize);
46
47 //! Compute the buffer size needed
48 U32 getBufferSize() const override;
49
50 //! Fw::Serializable interface - serialize to buffer
51 Fw::SerializeStatus serializeTo(Fw::SerialBufferBase& buffer,
52 Fw::Endianness mode = Fw::Endianness::BIG) const override;
53
54 //! Fw::Serializable interface - deserialize from buffer
55 Fw::SerializeStatus deserializeFrom(Fw::SerialBufferBase& buffer,
56 Fw::Endianness mode = Fw::Endianness::BIG) override;
57
58 //! Get this as a Header
59 const PduHeader& asHeader() const { return this->m_header; }
60
61 //! Get condition code
62 ConditionCode getConditionCode() const { return this->m_conditionCode; }
63
64 //! Get checksum
65 U32 getChecksum() const { return this->m_checksum; }
66
67 //! Get file size
68 FileSize getFileSize() const { return this->m_fileSize; }
69
70 //! Get directive code
71 FileDirective getDirectiveCode() const { return FileDirective::FILE_DIRECTIVE_END_OF_FILE; }
72
73 //! Add a TLV to this EOF PDU
74 //! @return true if added successfully, false if list is full
75 bool appendTlv(const Tlv& tlv) { return this->m_tlvList.appendTlv(tlv); }
76
77 //! Get TLV list
78 const TlvList& getTlvList() const { return this->m_tlvList; }
79
80 //! Get number of TLVs
81 U8 getNumTlv() const { return this->m_tlvList.getNumTlv(); }
82
83 private:
84 //! Initialize this EofPdu from a SerialBuffer
85 Fw::SerializeStatus fromSerialBuffer(Fw::SerialBufferBase& serialBuffer);
86
87 //! Write this EofPdu to a SerialBuffer
88 Fw::SerializeStatus toSerialBuffer(Fw::SerialBufferBase& serialBuffer) const;
89 };
90
91 } // namespace Cfdp
92 } // namespace Ccsds
93 } // namespace Svc
94
95 #endif // Svc_Ccsds_Cfdp_EofPdu_HPP
96