-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split Deframer into FrameAccumulator Deframer and Router #3250
base: devel
Are you sure you want to change the base?
Conversation
// Component construction and destruction | ||
// ---------------------------------------------------------------------- | ||
|
||
FprimeDeframer ::FprimeDeframer(const char* const compName) : FprimeDeframerComponentBase(compName) {} |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
// Handler implementations for user-defined typed input ports | ||
// ---------------------------------------------------------------------- | ||
|
||
void FprimeDeframer ::framedIn_handler(FwIndexType portNum, Fw::Buffer& data, Fw::Buffer& context) { |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
// ---------------------------------------------------------------------- | ||
// Component construction and destruction | ||
// ---------------------------------------------------------------------- | ||
|
Check notice
Code scanning / CodeQL
Use of basic integral type Note
this->m_memory = nullptr; | ||
} | ||
} | ||
|
Check notice
Code scanning / CodeQL
Use of basic integral type Note
} | ||
|
||
void FrameAccumulator ::configure(const FrameDetector& detector, NATIVE_UINT_TYPE allocationId, | ||
Fw::MemAllocator& allocator, |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
namespace Svc { | ||
namespace FrameDetectors { | ||
|
||
FrameDetector::Status FprimeFrameDetector::detect(const Types::CircularBuffer& data, FwSizeType& size_out) const { |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
// Component construction and destruction | ||
// ---------------------------------------------------------------------- | ||
|
||
Router ::Router(const char* const compName) : RouterComponentBase(compName) {} |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
// Handler implementations for user-defined typed input ports | ||
// ---------------------------------------------------------------------- | ||
|
||
void Router ::dataIn_handler(NATIVE_INT_TYPE portNum, Fw::Buffer& packetBuffer, Fw::Buffer& contextBuffer) { |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
} | ||
|
||
// Whether to deallocate the packet buffer | ||
bool deallocate = true; |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
} | ||
} | ||
|
||
void Router ::cmdResponseIn_handler(NATIVE_INT_TYPE portNum, |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
// Component construction and destruction | ||
// ---------------------------------------------------------------------- | ||
|
||
FprimeDeframer ::FprimeDeframer(const char* const compName) : FprimeDeframerComponentBase(compName) {} |
Check notice
Code scanning / CodeQL
More than one statement per line Note
|
||
FprimeDeframer ::FprimeDeframer(const char* const compName) : FprimeDeframerComponentBase(compName) {} | ||
|
||
FprimeDeframer ::~FprimeDeframer() {} |
Check notice
Code scanning / CodeQL
More than one statement per line Note
// Component construction and destruction | ||
// ---------------------------------------------------------------------- | ||
|
||
FrameAccumulator ::FrameAccumulator(const char* const compName) : FrameAccumulatorComponentBase(compName), |
Check notice
Code scanning / CodeQL
More than one statement per line Note
this->m_memory = nullptr; | ||
} | ||
} | ||
|
Check notice
Code scanning / CodeQL
Long function without assertion Note
} | ||
// Deallocate the buffer | ||
this->bufferDeallocate_out(0, buffer); | ||
} |
Check notice
Code scanning / CodeQL
Long function without assertion Note
namespace Svc { | ||
namespace FrameDetectors { | ||
|
||
FrameDetector::Status FprimeFrameDetector::detect(const Types::CircularBuffer& data, FwSizeType& size_out) const { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
// Component construction and destruction | ||
// ---------------------------------------------------------------------- | ||
|
||
Router ::Router(const char* const compName) : RouterComponentBase(compName) {} |
Check notice
Code scanning / CodeQL
More than one statement per line Note
|
||
Router ::Router(const char* const compName) : RouterComponentBase(compName) {} | ||
|
||
Router ::~Router() {} |
Check notice
Code scanning / CodeQL
More than one statement per line Note
// Handler implementations for user-defined typed input ports | ||
// ---------------------------------------------------------------------- | ||
|
||
void Router ::dataIn_handler(NATIVE_INT_TYPE portNum, Fw::Buffer& packetBuffer, Fw::Buffer& contextBuffer) { |
Check notice
Code scanning / CodeQL
Function too long Note
// Handler implementations for user-defined typed input ports | ||
// ---------------------------------------------------------------------- | ||
|
||
void Router ::dataIn_handler(NATIVE_INT_TYPE portNum, Fw::Buffer& packetBuffer, Fw::Buffer& contextBuffer) { |
Check notice
Code scanning / CodeQL
Long function without assertion Note
data.setData(data.getData() + FprimeProtocol::FrameHeader::SERIALIZED_SIZE); | ||
data.setSize(data.getSize() - FprimeProtocol::FrameHeader::SERIALIZED_SIZE - FprimeProtocol::FrameTrailer::SERIALIZED_SIZE); | ||
|
||
this->deframedOut_out(0, data, context); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
bool recoverable = false; | ||
FW_ASSERT(std::numeric_limits<NATIVE_INT_TYPE>::max() >= store_size, static_cast<FwAssertArgType>(store_size)); | ||
NATIVE_UINT_TYPE store_size_int = static_cast<NATIVE_UINT_TYPE>(store_size); | ||
void* data_void = allocator.allocate(allocationId, store_size_int, recoverable); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
bool recoverable = false; | ||
FW_ASSERT(std::numeric_limits<NATIVE_INT_TYPE>::max() >= store_size, static_cast<FwAssertArgType>(store_size)); | ||
NATIVE_UINT_TYPE store_size_int = static_cast<NATIVE_UINT_TYPE>(store_size); | ||
void* data_void = allocator.allocate(allocationId, store_size_int, recoverable); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
U8* data = new(data_void) U8[store_size_int]; | ||
FW_ASSERT(data != nullptr); | ||
FW_ASSERT(store_size_int >= store_size); | ||
m_inRing.setup(data, store_size_int); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
// Check whether there is data to process | ||
if (status.e == Drv::RecvStatus::RECV_OK) { | ||
// There is: process the data | ||
this->processBuffer(buffer); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
} | ||
// If the deserialized length token can not fit in current allocated size -> MORE_DATA_NEEDED | ||
if (data.get_allocated_size() < FprimeProtocol::FrameHeader::SERIALIZED_SIZE + header.getlength() + FprimeProtocol::FrameTrailer::SERIALIZED_SIZE) { | ||
size_out = header.getlength() + FprimeProtocol::FrameHeader::SERIALIZED_SIZE + FprimeProtocol::FrameTrailer::SERIALIZED_SIZE; |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
size_out = header.getlength() + FprimeProtocol::FrameHeader::SERIALIZED_SIZE + FprimeProtocol::FrameTrailer::SERIALIZED_SIZE; | ||
return Status::FRAME_DETECTED; | ||
|
||
} |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
FwPacketDescriptorType packetType = Fw::ComPacket::FW_PACKET_UNKNOWN; | ||
Fw::SerializeStatus status = Fw::FW_SERIALIZE_OK; | ||
{ | ||
Fw::SerializeBufferBase& serial = packetBuffer.getSerializeRepr(); |
Check warning
Code scanning / CodeQL
Unchecked function argument Warning
Utils::HashBuffer hashBuffer; | ||
|
||
// Compute CRC over the transmitted data (header + body) | ||
FwSizeType hash_field_size = header.getlength() + FprimeProtocol::FrameHeader::SERIALIZED_SIZE; |
Check notice
Code scanning / CodeQL
Use of basic integral type Note
Change Description
(GitHub doesn't let me re-open #2900 for some reason..., so re-opening here)
Implements #2763
Split up Deframer into 3 components:
Rationale
Better reusability and chaining of deframers, preliminary work for CCSDS integrations
TODO
!!! UPDATE
fprime-util new --deployment
To discuss