COMMS
Template library intended to help with implementation of communication protocols.
|
Namespace that contains definition of layers that can be used to wrap message data with transport data. More...
Namespace that contains definition of layers that can be used to wrap message data with transport data.
Namespaces | |
namespace | checksum |
Namespace that contains definition of checksum calculator classes which can be used with comms::protocol::ChecksumLayer transport layer class. | |
Classes | |
class | ChecksumLayer |
Protocol layer that is responsible to calculate checksum on the data written by all the wrapped internal layers and append it to the end of the written data. When reading, this layer is responsible to verify the checksum reported at the end of the read data. More... | |
class | ChecksumPrefixLayer |
Protocol layer that is responsible to calculate checksum on the data written by all the wrapped internal layers and prepend it before the written data. When reading, this layer is responsible to verify the checksum reported at the beginning of the read data. More... | |
class | MsgDataLayer |
Message data layer. More... | |
class | MsgIdLayer |
Protocol layer that uses uses message ID field as a prefix to all the subsequent data written by other (next) layers. More... | |
class | MsgSizeLayer |
Protocol layer that uses size field as a prefix to all the subsequent data written by other (next) layers. More... | |
class | ProtocolLayerBase |
Base class for all the middle (non MsgDataLayer) protocol transport layers. More... | |
class | SyncPrefixLayer |
Protocol layer that uses "sync" field as a prefix to all the subsequent data written by other (next) layers. More... | |
class | TransportValueLayer |
Protocol layer that reads a value from transport wrapping and reassigns it to appropriate "extra transport" data member of the created message object. More... | |
Functions | |
details::MissingSizeRetriever | missingSize (std::size_t &val) |
Add "missing size" output parameter to protocol stack's (frame's) "read" operation. | |
template<typename TId > | |
details::MsgIdRetriever< TId > | msgId (TId &val) |
Add "message ID" output parameter to protocol stack's (frame's) "read" operation. | |
details::MsgIndexRetriever | msgIndex (std::size_t &val) |
Add "message index" output parameter to protocol stack's (frame's) "read" operation. | |
template<typename TIter > | |
details::MsgPayloadRetriever< TIter > | msgPayload (TIter &iter, std::size_t &len) |
Add "payload start" and "payload size" output parameters to protocol stack's (frame's) "read" operation. | |
template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions> | |
constexpr const ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions... > & | toProtocolLayerBase (const ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions... > &layer) |
Upcast protocol layer in order to have access to its internal types. | |
template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions> | |
ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions... > & | toProtocolLayerBase (ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions... > &layer) |
Upcast protocol layer in order to have access to its internal types. | |
details::MissingSizeRetriever comms::protocol::missingSize | ( | std::size_t & | val | ) |
Add "missing size" output parameter to protocol stack's (frame's) "read" operation.
Can be passed as variadic parameters to "read" functions of protocol stack (see comms::protocol::ProtocolLayerBase::read() and comms::protocol::ProtocolLayerBase::readFieldsCached()). It can be used to retrieve missing length information in case "read" of protocol stack operation returns comms::ErrorStatus::NotEnoughData.
[out] | val | Missing size value to be returned. |
details::MsgIdRetriever< TId > comms::protocol::msgId | ( | TId & | val | ) |
Add "message ID" output parameter to protocol stack's (frame's) "read" operation.
Can be passed as variadic parameters to "read" functions of protocol stack (see comms::protocol::ProtocolLayerBase::read() and comms::protocol::ProtocolLayerBase::readFieldsCached()). It can be used to retrieve numeric message ID value.
[out] | val | Numeric message ID value to be returned. |
details::MsgIndexRetriever comms::protocol::msgIndex | ( | std::size_t & | val | ) |
Add "message index" output parameter to protocol stack's (frame's) "read" operation.
In case the expected input message types tuple contains multiple different message classes but having the same numeric ID, it may be beneficial to know the reletive index (starting from the first message type having the same ID) of the detected message. This function can be used to retrieve such information. Can be passed as variadic parameters to "read" functions of protocol stack (see comms::protocol::ProtocolLayerBase::read() and comms::protocol::ProtocolLayerBase::readFieldsCached()).
[out] | val | Message index value to be returned. |
details::MsgPayloadRetriever< TIter > comms::protocol::msgPayload | ( | TIter & | iter, |
std::size_t & | len | ||
) |
Add "payload start" and "payload size" output parameters to protocol stack's (frame's) "read" operation.
Can be passed as variadic parameters to "read" functions of protocol stack (see comms::protocol::ProtocolLayerBase::read() and comms::protocol::ProtocolLayerBase::readFieldsCached()). It can be used to retrieve information on payload start location as well as its size.
[out] | iter | Iterator pointing to the begining of the message payload in the input buffer. |
[out] | len | Number of bytes in the detected payload. |