|
PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
|
Lightweight cursor for parsing a big-endian byte buffer without copies. More...
#include <wire.h>
Collaboration diagram for profinet::wire::Reader:Public Member Functions | |
| Reader (const std::uint8_t *data, std::size_t len) | |
| Construct a reader over a raw pointer/length pair. | |
| Reader (std::span< const std::uint8_t > bytes) | |
| Construct a reader over a byte span. | |
| Reader (const std::vector< std::uint8_t > &v) | |
| Construct a reader over an existing byte vector. | |
| std::size_t | Remaining () const |
| Number of bytes not yet consumed. | |
| std::size_t | Position () const |
| Current read offset from the start of the buffer. | |
| const std::uint8_t * | Cursor () const |
| Pointer to the next unread byte. | |
| void | Need (std::size_t n) const |
Assert that at least n bytes remain. | |
| std::uint8_t | U8 () |
| Read and consume one byte. | |
| std::uint16_t | U16 () |
| Read and consume a big-endian 16-bit value. | |
| std::uint32_t | U32 () |
| Read and consume a big-endian 32-bit value. | |
| std::vector< std::uint8_t > | ReadBytes (std::size_t n) |
| Read and consume a variable-length byte range. | |
| template<std::size_t N> | |
| std::array< std::uint8_t, N > | Fixed () |
| Read and consume a fixed-size byte array. | |
| void | Skip (std::size_t n) |
| Advance the read position without returning the skipped bytes. | |
Private Attributes | |
| const std::uint8_t * | data |
| Pointer to the start of the underlying buffer (not owned). | |
| std::size_t | len |
| Total length of the underlying buffer in bytes. | |
| std::size_t | pos = 0 |
| Current read offset from the start of the buffer. | |
Lightweight cursor for parsing a big-endian byte buffer without copies.
Every read method advances the internal position and throws std::out_of_range if the buffer doesn't have enough remaining bytes.
|
inline |
|
inlineexplicit |
|
inlineexplicit |
|
inline |
|
inline |
Read and consume a fixed-size byte array.
| N | Number of bytes to read. |
Definition at line 169 of file wire.h.
References data, Need(), and pos.
Referenced by profinet::EthernetHeader::Parse(), profinet::EthernetVLANHeader::Parse(), profinet::PNRPCHeader::Parse(), profinet::PNIODHeader::Parse(), profinet::PNARBlockRequest::Parse(), profinet::PNIODReleaseBlock::Parse(), profinet::PNInM0::Parse(), profinet::PNInM1::Parse(), profinet::PNInM2::Parse(), profinet::PNInM3::Parse(), profinet::PNInM4::Parse(), profinet::PNInM5::Parse(), profinet::PNInMReserved< Idx >::Parse(), profinet::PNIOCRBlockRes::Parse(), profinet::PNIOCRBlockReqHeader::Parse(), profinet::PNAlarmCRBlockRes::Parse(), profinet::PNAlarmNotificationPDU::Parse(), and profinet::PNIODWriteRes::Parse().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Assert that at least n bytes remain.
| n | Number of bytes required. |
Throws std::out_of_range if fewer than n bytes remain.
Definition at line 115 of file wire.h.
References Remaining().
Referenced by Fixed(), ReadBytes(), Skip(), U16(), U32(), and U8().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
|
inline |
Read and consume a variable-length byte range.
| n | Number of bytes to read. |
n bytes. Definition at line 157 of file wire.h.
References data, Need(), and pos.
Referenced by profinet::EthernetHeader::Parse(), profinet::EthernetVLANHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::PNDCPBlockRequest::Parse(), profinet::PNDCPBlock::Parse(), profinet::PNRPCHeader::Parse(), profinet::PNNRDData::Parse(), profinet::PNIODHeader::Parse(), profinet::PNARBlockRequest::Parse(), profinet::PNInM0::Parse(), profinet::PNInM1::Parse(), profinet::PNInM2::Parse(), profinet::PNInM3::Parse(), profinet::PNInM5::Parse(), profinet::PNInMReserved< Idx >::Parse(), profinet::PNAlarmNotificationPDU::Parse(), and profinet::PNRTAHeader::Parse().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Number of bytes not yet consumed.
Definition at line 93 of file wire.h.
Referenced by Need(), profinet::EthernetHeader::Parse(), profinet::EthernetVLANHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::PNDCPBlockRequest::Parse(), profinet::PNDCPBlock::Parse(), profinet::PNRPCHeader::Parse(), profinet::PNNRDData::Parse(), profinet::PNIODHeader::Parse(), profinet::PNARBlockRequest::Parse(), profinet::PNInMReserved< Idx >::Parse(), profinet::PNAlarmNotificationPDU::Parse(), profinet::PNRTAHeader::Parse(), profinet::blocks::ParseModuleDiffBlock(), and profinet::blocks::ParseRealIdentificationData().
Here is the caller graph for this function:
|
inline |
Advance the read position without returning the skipped bytes.
| n | Number of bytes to skip. |
Definition at line 180 of file wire.h.
Referenced by profinet::blocks::ParseModuleDiffBlock(), profinet::blocks::ParseMultipleBlockHeader(), and profinet::blocks::ParseWriteMultipleResponse().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Read and consume a big-endian 16-bit value.
Definition at line 133 of file wire.h.
References data, Need(), profinet::OneOctetShift, and pos.
Referenced by profinet::EthernetHeader::Parse(), profinet::EthernetVLANHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::PNDCPBlockRequest::Parse(), profinet::PNDCPBlock::Parse(), profinet::PNRPCHeader::Parse(), profinet::PNIODHeader::Parse(), profinet::PNBlockHeader::Parse(), profinet::PNARBlockRequest::Parse(), profinet::PNIODReleaseBlock::Parse(), profinet::PNInM0::Parse(), profinet::IOCRAPIObject::Parse(), profinet::PNIOCRBlockRes::Parse(), profinet::PNIOCRBlockReqHeader::Parse(), profinet::PNAlarmCRBlockRes::Parse(), profinet::PNAlarmNotificationPDU::Parse(), profinet::PNRTAHeader::Parse(), profinet::PNIODWriteRes::Parse(), profinet::ParseAlarmNotification(), profinet::blocks::ParseBlockHeader(), profinet::blocks::ParseModuleDiffBlock(), profinet::blocks::ParseMultipleBlockHeader(), profinet::blocks::ParsePortStatistics(), profinet::blocks::ParseRealIdentificationData(), and profinet::blocks::ParseWriteMultipleResponse().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Read and consume a big-endian 32-bit value.
Definition at line 143 of file wire.h.
References data, Need(), profinet::OneOctetShift, pos, profinet::ThreeOctetsShift, and profinet::TwoOctetsShift.
Referenced by profinet::PNDCPHeader::Parse(), profinet::PNRPCHeader::Parse(), profinet::PNNRDData::Parse(), profinet::PNIODHeader::Parse(), profinet::PNARBlockRequest::Parse(), profinet::PNIOCRBlockReqHeader::Parse(), profinet::PNAlarmNotificationPDU::Parse(), profinet::PNIODWriteRes::Parse(), profinet::ParseAlarmNotification(), profinet::blocks::ParseModuleDiffBlock(), profinet::blocks::ParseMultipleBlockHeader(), profinet::blocks::ParsePortStatistics(), profinet::blocks::ParseRealIdentificationData(), and profinet::blocks::ParseWriteMultipleResponse().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Read and consume one byte.
Definition at line 125 of file wire.h.
References data, Need(), and pos.
Referenced by profinet::PNDCPHeader::Parse(), profinet::PNDCPBlockRequest::Parse(), profinet::PNDCPBlock::Parse(), profinet::PNRPCHeader::Parse(), profinet::PNBlockHeader::Parse(), profinet::PNInM0::Parse(), profinet::PNRTAHeader::Parse(), and profinet::blocks::ParseBlockHeader().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
|
private |
Total length of the underlying buffer in bytes.
Definition at line 191 of file wire.h.
Referenced by Remaining().
|
private |
Current read offset from the start of the buffer.
Definition at line 194 of file wire.h.
Referenced by Cursor(), Fixed(), Position(), ReadBytes(), Remaining(), Skip(), U16(), U32(), and U8().