PROFINET IO Controller Stack 1.0.0
Modern C++ implementation of a PROFINET IO Controller stack
Loading...
Searching...
No Matches
profinet::wire Namespace Reference

Classes

class  Reader
 Lightweight cursor for parsing a big-endian byte buffer without copies. More...
 

Functions

template<typename T >
requires std::is_integral_v<T> && std::is_unsigned_v<T>
void PutBigEndian (std::vector< std::uint8_t > &out, T value)
 Append an unsigned integral value to a buffer in big-endian order.
 
template<typename T >
requires std::is_integral_v<T> && std::is_unsigned_v<T>
void PutLittleEndian (std::vector< std::uint8_t > &out, T value)
 Append an unsigned integral value to a buffer in little-endian order.
 
template<typename T >
requires std::is_integral_v<T> && std::is_unsigned_v<T>
void PutLittleEndian (std::uint8_t *out, T value)
 Writes an unsigned integer in little-endian byte order.
 
void PutU8 (std::vector< std::uint8_t > &out, std::uint8_t value)
 Append a single byte to a buffer.
 
void PutU16 (std::vector< std::uint8_t > &out, std::uint16_t value)
 Append a 16-bit value to a buffer in big-endian order.
 
void PutU32 (std::vector< std::uint8_t > &out, std::uint32_t value)
 Append a 32-bit value to a buffer in big-endian order.
 
void PutBytes (std::vector< std::uint8_t > &out, const std::uint8_t *data, std::size_t len)
 Append a raw byte range to a buffer.
 
template<std::size_t N>
void PutFixed (std::vector< std::uint8_t > &out, const std::array< std::uint8_t, N > &data)
 Append a fixed-size byte array to a buffer.
 
void PutFixed (std::vector< std::uint8_t > &out, const std::vector< std::uint8_t > &data)
 Append a byte vector to a buffer.
 
void PutFixed (std::vector< std::uint8_t > &out, const std::string &data)
 Append a string to a buffer.
 
template<typename T >
requires std::is_integral_v<T> && std::is_unsigned_v<T>
constexpr T ReadBigEndian (const std::uint8_t *data)
 Decode an unsigned integral value from big-endian bytes.
 
template<typename T >
requires std::is_integral_v<T> && std::is_unsigned_v<T>
constexpr T ReadLittleEndian (const std::uint8_t *data)
 Decode an unsigned integral value from little-endian bytes.
 
 TEST (WireWriterTest, PutBigEndianU8)
 
 TEST (WireWriterTest, PutBigEndianU16)
 
 TEST (WireWriterTest, PutBigEndianU32)
 
 TEST (WireWriterTest, PutBigEndianU64)
 
 TEST (WireWriterTest, PutBigEndianZero)
 
 TEST (WireWriterTest, PutBigEndianMaximumU32)
 
 TEST (WireWriterTest, PutBigEndianAppends)
 
 TEST (WireWriterTest, PutLittleEndianU8)
 
 TEST (WireWriterTest, PutLittleEndianU16)
 
 TEST (WireWriterTest, PutLittleEndianU32)
 
 TEST (WireWriterTest, PutLittleEndianU64)
 
 TEST (WireWriterTest, PutLittleEndianZero)
 
 TEST (WireWriterTest, PutLittleEndianMaximumU32)
 
 TEST (WireWriterTest, PutLittleEndianAppends)
 
 TEST (WireWriterTest, PutLittleEndianPointerU16)
 
 TEST (WireWriterTest, PutLittleEndianPointerU32)
 
 TEST (WireWriterTest, PutU8)
 
 TEST (WireWriterTest, PutU16)
 
 TEST (WireWriterTest, PutU32)
 
 TEST (WireWriterTest, PutBytes)
 
 TEST (WireWriterTest, PutBytesZeroLength)
 
 TEST (WireWriterTest, PutFixedArray)
 
 TEST (WireWriterTest, PutFixedEmptyArray)
 
 TEST (WireWriterTest, PutFixedVector)
 
 TEST (WireWriterTest, PutFixedEmptyVector)
 
 TEST (WireWriterTest, PutFixedString)
 
 TEST (WireWriterTest, PutFixedEmptyString)
 
 TEST (WireReaderTest, ReadBigEndianU8)
 
 TEST (WireReaderTest, ReadBigEndianU16)
 
 TEST (WireReaderTest, ReadBigEndianU32)
 
 TEST (WireReaderTest, ReadBigEndianU64)
 
 TEST (WireReaderTest, ReadBigEndianZero)
 
 TEST (WireReaderTest, ReadBigEndianMaximumU32)
 
 TEST (WireReaderTest, ReadLittleEndianU8)
 
 TEST (WireReaderTest, ReadLittleEndianU16)
 
 TEST (WireReaderTest, ReadLittleEndianU32)
 
 TEST (WireReaderTest, ReadLittleEndianU64)
 
 TEST (WireReaderTest, ReadLittleEndianZero)
 
 TEST (WireReaderTest, ReadLittleEndianMaximumU32)
 
 TEST (WireReaderTest, ReaderReadsU8)
 
 TEST (WireReaderTest, ReaderRejectsU8PastEnd)
 
 TEST (WireReaderTest, ReaderReadsBigEndianU16)
 
 TEST (WireReaderTest, ReaderReadsBigEndianU32)
 
 TEST (WireReaderTest, ReaderReadsLittleEndianU16)
 
 TEST (WireReaderTest, ReaderReadsLittleEndianU32)
 
 TEST (WireReaderTest, ReaderReadsConsecutiveLittleEndianValues)
 
 TEST (WireReaderTest, ReaderMixesEndianReads)
 
 TEST (WireReaderTest, ReaderRejectsLittleEndianU16PastEnd)
 
 TEST (WireReaderTest, ReaderRejectsLittleEndianU32PastEnd)
 
 TEST (WireReaderTest, ReaderRejectsU16PastEnd)
 
 TEST (WireReaderTest, ReaderRejectsU32PastEnd)
 
 TEST (WireReaderTest, ReaderReadBytes)
 
 TEST (WireReaderTest, ReaderReadBytesZeroLength)
 
 TEST (WireReaderTest, ReaderRejectsReadBytesPastEnd)
 
 TEST (WireReaderTest, ReaderFixedArray)
 
 TEST (WireReaderTest, ReaderFixedEmptyArray)
 
 TEST (WireReaderTest, ReaderRejectsFixedArrayPastEnd)
 
 TEST (WireReaderTest, ReaderSkip)
 
 TEST (WireReaderTest, ReaderSkipZero)
 
 TEST (WireReaderTest, ReaderRejectsSkipPastEnd)
 
 TEST (WireReaderTest, ReaderSkipTo)
 
 TEST (WireReaderTest, ReaderSkipToMovesBackwards)
 
 TEST (WireReaderTest, ReaderRejectsSkipToPastEnd)
 
 TEST (WireReaderTest, ReaderAllowsSkipToEnd)
 
 TEST (WireReaderTest, ReaderNeedExactRemaining)
 
 TEST (WireReaderTest, ReaderNeedZero)
 
 TEST (WireReaderTest, ReaderCursorPointsToCurrentPosition)
 
 TEST (WireReaderTest, ReaderRemainingTracksPosition)
 
 TEST (WireReaderTest, ReaderRawPointerConstructor)
 
 TEST (WireReaderTest, ReaderSpanConstructor)
 
 TEST (WireReaderTest, ReaderEmptyVector)
 

Variables

constexpr unsigned kBitsPerByte = 8U
 

Function Documentation

◆ PutBigEndian()

template<typename T >
requires std::is_integral_v<T> && std::is_unsigned_v<T>
void profinet::wire::PutBigEndian ( std::vector< std::uint8_t > &  out,
T  value 
)
inline

Append an unsigned integral value to a buffer in big-endian order.

Template Parameters
TUnsigned integral value type.
Parameters
outBuffer to append to.
valueValue to append.

Definition at line 45 of file wire.h.

References kBitsPerByte.

Referenced by profinet::rt::BuildEthernetFrame(), profinet::rpc::RpcTests::MakeCompleteEpmTower(), profinet::rpc::RpcTests::MakeRawRpcHeader(), PutU16(), PutU32(), profinet::AlarmListener::SendRtaFrame(), profinet::rpc::StringToUuidBytes(), profinet::dcp::TEST(), profinet::dcp::TEST(), profinet::dcp::TEST(), profinet::dcp::TEST(), and profinet::rt::RTFrame::ToBytes().

+ Here is the caller graph for this function:

◆ PutBytes()

void profinet::wire::PutBytes ( std::vector< std::uint8_t > &  out,
const std::uint8_t *  data,
std::size_t  len 
)
inline

Append a raw byte range to a buffer.

Parameters
outBuffer to append to.
dataPointer to the first byte to copy.
lenNumber of bytes to copy.

Definition at line 114 of file wire.h.

Referenced by TEST(), and TEST().

+ Here is the caller graph for this function:

◆ PutFixed() [1/3]

◆ PutFixed() [2/3]

void profinet::wire::PutFixed ( std::vector< std::uint8_t > &  out,
const std::string &  data 
)
inline

Append a string to a buffer.

Parameters
outBuffer to append to.
dataString to copy.

Definition at line 139 of file wire.h.

◆ PutFixed() [3/3]

void profinet::wire::PutFixed ( std::vector< std::uint8_t > &  out,
const std::vector< std::uint8_t > &  data 
)
inline

Append a byte vector to a buffer.

Parameters
outBuffer to append to.
dataByte vector to copy.

Definition at line 131 of file wire.h.

◆ PutLittleEndian() [1/2]

template<typename T >
requires std::is_integral_v<T> && std::is_unsigned_v<T>
void profinet::wire::PutLittleEndian ( std::uint8_t *  out,
T  value 
)
inline

Writes an unsigned integer in little-endian byte order.

Template Parameters
TUnsigned integer type to serialize.
Parameters
outDestination address for the serialized value.
valueValue to serialize.

Definition at line 78 of file wire.h.

References kBitsPerByte.

◆ PutLittleEndian() [2/2]

template<typename T >
requires std::is_integral_v<T> && std::is_unsigned_v<T>
void profinet::wire::PutLittleEndian ( std::vector< std::uint8_t > &  out,
T  value 
)
inline

Append an unsigned integral value to a buffer in little-endian order.

Template Parameters
TUnsigned integral value type.
Parameters
outBuffer to append to.
valueValue to append.

The least-significant byte is written first, independently of the host machine's native byte order.

Definition at line 64 of file wire.h.

References kBitsPerByte.

Referenced by profinet::rpc::RPCCon::ApplicationReady(), profinet::rpc::RPCCon::EpmLookup(), profinet::rpc::RpcTests::MakeApplicationReadyNrd(), profinet::rpc::RpcTests::MakeEpmLookupBody(), profinet::rpc::RpcTests::MakeEpmResponse(), profinet::rpc::RpcTests::MakeEpmTower(), profinet::rpc::RpcTests::MakeEpmTowerFloor(), profinet::rpc::RpcTests::MakeInterfaceTowerLhs(), profinet::rpc::RpcTests::MakeInterfaceTowerRhs(), profinet::rpc::RpcTests::MakeRawRpcHeader(), and profinet::rpc::StringToUuidBytes().

+ Here is the caller graph for this function:

◆ PutU16()

void profinet::wire::PutU16 ( std::vector< std::uint8_t > &  out,
std::uint16_t  value 
)
inline

Append a 16-bit value to a buffer in big-endian order.

Parameters
outBuffer to append to.
valueValue to append.

Definition at line 97 of file wire.h.

References PutBigEndian().

Referenced by profinet::rpc::RPCCon::ApplicationReady(), profinet::sim::VirtualAumaValve::BuildAlarmNotificationBlock(), profinet::blocks::IODWriteMultipleBuilder::BuildHeader(), profinet::rpc::RPCCon::BuildIocrBlock(), profinet::sim::VirtualAumaValve::BuildRtaErrorFrame(), profinet::blocks::IODWriteMultipleBuilder::BuildWriteBlock(), profinet::sim::VirtualAumaValve::EmitScenarioAlarms(), profinet::device::ProfinetDeviceDiagnosisTests::MakeBlockHeader(), profinet::rpc::RpcTests::MakeDiagnosisPayload(), profinet::sim::VirtualProfinetRpcDevice::MakeIocrResponse(), profinet::rpc::RpcTests::MakeIocrResponseBlock(), profinet::device::ProfinetDeviceDiagnosisTests::MakeModuleDiffBlock(), profinet::rpc::RpcTests::MakeModuleDiffPayload(), profinet::rpc::RpcTests::MakeRealIdentificationPayload(), profinet::rpc::RpcTests::MakeWriteMultipleResponsePayload(), profinet::StubRpcTransport::SendReceive(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), profinet::rpc::TEST_F(), profinet::blocks::ExpectedSubmoduleDataDescription::ToBytes(), profinet::blocks::ExpectedSubmodule::ToBytes(), profinet::blocks::ExpectedSubmoduleSlot::ToBytes(), profinet::blocks::ExpectedSubmoduleBlockReq::ToBytes(), profinet::EthernetHeader::ToBytes(), profinet::EthernetVLANHeader::ToBytes(), profinet::PNDCPHeader::ToBytes(), profinet::PNDCPBlockRequest::ToBytes(), profinet::PNDCPBlock::ToBytes(), profinet::PNRPCHeader::ToBytes(), profinet::PNIODHeader::ToBytes(), profinet::PNBlockHeader::ToBytes(), profinet::PNARBlockRequest::ToBytes(), profinet::PNIODReleaseBlock::ToBytes(), profinet::IOCRAPIObject::ToBytes(), profinet::PNIOCRBlockReqHeader::ToBytes(), profinet::PNAlarmCRBlockReq::ToBytes(), profinet::PNAlarmCRBlockRes::ToBytes(), profinet::PNAlarmAckPDU::ToBytes(), profinet::PNRTAHeader::ToBytes(), profinet::PNExpectedSubmoduleDataDescription::ToBytes(), and profinet::PNIODWriteReq::ToBytes().

+ Here is the call graph for this function:

◆ PutU32()

void profinet::wire::PutU32 ( std::vector< std::uint8_t > &  out,
std::uint32_t  value 
)
inline

Append a 32-bit value to a buffer in big-endian order.

Parameters
outBuffer to append to.
valueValue to append.

Definition at line 105 of file wire.h.

References PutBigEndian().

Referenced by profinet::rpc::RPCCon::ApplicationReady(), profinet::sim::VirtualAumaValve::BuildAlarmNotificationBlock(), profinet::blocks::IODWriteMultipleBuilder::BuildHeader(), profinet::rpc::RPCCon::BuildIocrBlock(), profinet::blocks::IODWriteMultipleBuilder::BuildWriteBlock(), profinet::rpc::RpcTests::MakeApplicationReadyNrd(), profinet::device::ProfinetDeviceDiagnosisTests::MakeModuleDiffBlock(), profinet::rpc::RpcTests::MakeModuleDiffPayload(), profinet::rpc::RpcTests::MakeRealIdentificationPayload(), profinet::rpc::RpcTests::MakeWriteMultipleResponsePayload(), TEST(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), profinet::blocks::ExpectedSubmodule::ToBytes(), profinet::blocks::ExpectedSubmoduleSlot::ToBytes(), profinet::PNDCPHeader::ToBytes(), profinet::PNRPCHeader::ToBytes(), profinet::PNNRDData::ToBytes(), profinet::PNIODHeader::ToBytes(), profinet::PNARBlockRequest::ToBytes(), profinet::PNIOCRBlockReqHeader::ToBytes(), profinet::PNAlarmCRBlockReq::ToBytes(), profinet::PNAlarmAckPDU::ToBytes(), and profinet::PNIODWriteReq::ToBytes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PutU8()

◆ ReadBigEndian()

template<typename T >
requires std::is_integral_v<T> && std::is_unsigned_v<T>
constexpr T profinet::wire::ReadBigEndian ( const std::uint8_t *  data)
constexpr

Decode an unsigned integral value from big-endian bytes.

Template Parameters
TUnsigned integral value type.
Parameters
dataPointer to the first byte.
Returns
The decoded value.

Reads exactly sizeof(T) bytes in network byte order. The caller must ensure that the supplied buffer contains enough bytes.

Definition at line 155 of file wire.h.

◆ ReadLittleEndian()

template<typename T >
requires std::is_integral_v<T> && std::is_unsigned_v<T>
constexpr T profinet::wire::ReadLittleEndian ( const std::uint8_t *  data)
constexpr

Decode an unsigned integral value from little-endian bytes.

Template Parameters
TUnsigned integral value type.
Parameters
dataPointer to the first byte.
Returns
The decoded value.

Definition at line 174 of file wire.h.

References kBitsPerByte.

◆ TEST() [1/71]

profinet::wire::TEST ( WireReaderTest  ,
ReadBigEndianMaximumU32   
)
Test:
Verifies direct big-endian decoding of the maximum 32-bit value.

Definition at line 540 of file test_wire.cpp.

◆ TEST() [2/71]

profinet::wire::TEST ( WireReaderTest  ,
ReadBigEndianU16   
)
Test:
Verifies direct big-endian decoding of a 16-bit value.

Definition at line 484 of file test_wire.cpp.

◆ TEST() [3/71]

profinet::wire::TEST ( WireReaderTest  ,
ReadBigEndianU32   
)
Test:
Verifies direct big-endian decoding of a 32-bit value.

Definition at line 495 of file test_wire.cpp.

◆ TEST() [4/71]

profinet::wire::TEST ( WireReaderTest  ,
ReadBigEndianU64   
)
Test:
Verifies direct big-endian decoding of a 64-bit value.

Definition at line 508 of file test_wire.cpp.

◆ TEST() [5/71]

profinet::wire::TEST ( WireReaderTest  ,
ReadBigEndianU8   
)
Test:
Verifies direct big-endian decoding of an 8-bit value.

Definition at line 476 of file test_wire.cpp.

◆ TEST() [6/71]

profinet::wire::TEST ( WireReaderTest  ,
ReadBigEndianZero   
)
Test:
Verifies direct big-endian decoding of zero.

Definition at line 527 of file test_wire.cpp.

◆ TEST() [7/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderAllowsSkipToEnd   
)
Test:
Reader allows moving exactly to the end of the buffer.

Definition at line 1058 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::SkipTo().

+ Here is the call graph for this function:

◆ TEST() [8/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderCursorPointsToCurrentPosition   
)
Test:
Reader exposes the current unread byte through Cursor.

Definition at line 1100 of file test_wire.cpp.

References profinet::wire::Reader::Cursor(), and profinet::wire::Reader::SkipTo().

+ Here is the call graph for this function:

◆ TEST() [9/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderEmptyVector   
)
Test:
Reader constructed from an empty vector starts with no remaining bytes.

Definition at line 1181 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::U8().

+ Here is the call graph for this function:

◆ TEST() [10/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderFixedArray   
)
Test:
Reader returns a fixed-size byte array and advances its position.

Definition at line 887 of file test_wire.cpp.

References profinet::wire::Reader::Fixed(), profinet::wire::Reader::Position(), and profinet::wire::Reader::Remaining().

+ Here is the call graph for this function:

◆ TEST() [11/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderFixedEmptyArray   
)
Test:
Reader supports a zero-length Fixed extraction without moving the cursor.

Definition at line 913 of file test_wire.cpp.

References profinet::wire::Reader::Fixed(), profinet::wire::Reader::Position(), and profinet::wire::Reader::Remaining().

+ Here is the call graph for this function:

◆ TEST() [12/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderMixesEndianReads   
)
Test:
Reader supports mixing big-endian and little-endian reads while maintaining one cursor.

Definition at line 748 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::U16(), and profinet::wire::Reader::U16LittleEndian().

+ Here is the call graph for this function:

◆ TEST() [13/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderNeedExactRemaining   
)
Test:
Reader Need succeeds when exactly the requested number of bytes remain.

Definition at line 1076 of file test_wire.cpp.

References profinet::wire::Reader::Need(), and profinet::wire::Reader::Position().

+ Here is the call graph for this function:

◆ TEST() [14/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderNeedZero   
)
Test:
Reader Need succeeds for a zero-byte requirement.

Definition at line 1090 of file test_wire.cpp.

References profinet::wire::Reader::Need().

+ Here is the call graph for this function:

◆ TEST() [15/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderRawPointerConstructor   
)
Test:
Reader constructed from a raw pointer and length reads the supplied byte range.

Definition at line 1148 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::U16(), and profinet::wire::Reader::U8().

+ Here is the call graph for this function:

◆ TEST() [16/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderReadBytes   
)
Test:
Reader returns the requested number of bytes and advances its position.

Definition at line 833 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::ReadBytes(), and profinet::wire::Reader::Remaining().

+ Here is the call graph for this function:

◆ TEST() [17/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderReadBytesZeroLength   
)
Test:
Reader supports a zero-length ReadBytes call without moving the cursor.

Definition at line 853 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::ReadBytes(), and profinet::wire::Reader::Remaining().

+ Here is the call graph for this function:

◆ TEST() [18/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderReadsBigEndianU16   
)
Test:
Reader decodes a 16-bit value in big-endian order and advances exactly two bytes.

Definition at line 655 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::U16().

+ Here is the call graph for this function:

◆ TEST() [19/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderReadsBigEndianU32   
)
Test:
Reader decodes a 32-bit value in big-endian order and advances exactly four bytes.

Definition at line 672 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::U32().

+ Here is the call graph for this function:

◆ TEST() [20/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderReadsConsecutiveLittleEndianValues   
)
Test:
Reader supports consecutive little-endian reads without requiring explicit repositioning.

Definition at line 727 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), profinet::wire::Reader::U16LittleEndian(), and profinet::wire::Reader::U32LittleEndian().

+ Here is the call graph for this function:

◆ TEST() [21/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderReadsLittleEndianU16   
)
Test:
Reader decodes a 16-bit value in little-endian order and advances exactly two bytes.

Definition at line 691 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::U16LittleEndian().

+ Here is the call graph for this function:

◆ TEST() [22/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderReadsLittleEndianU32   
)
Test:
Reader decodes a 32-bit value in little-endian order and advances exactly four bytes.

Definition at line 708 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::U32LittleEndian().

+ Here is the call graph for this function:

◆ TEST() [23/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderReadsU8   
)
Test:
Reader reads a single byte and advances its position.

Definition at line 630 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::U8().

+ Here is the call graph for this function:

◆ TEST() [24/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderRejectsFixedArrayPastEnd   
)
Test:
Reader rejects a fixed-size extraction when fewer bytes remain and leaves its position unchanged.

Definition at line 931 of file test_wire.cpp.

References profinet::wire::Reader::Fixed(), profinet::wire::Reader::Position(), and profinet::wire::Reader::Remaining().

+ Here is the call graph for this function:

◆ TEST() [25/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderRejectsLittleEndianU16PastEnd   
)
Test:
Reader rejects a 16-bit little-endian read when fewer than two bytes remain and leaves its position unchanged.

Definition at line 769 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::U16LittleEndian().

+ Here is the call graph for this function:

◆ TEST() [26/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderRejectsLittleEndianU32PastEnd   
)
Test:
Reader rejects a 32-bit little-endian read when fewer than four bytes remain and leaves its position unchanged.

Definition at line 784 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::U32LittleEndian().

+ Here is the call graph for this function:

◆ TEST() [27/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderRejectsReadBytesPastEnd   
)
Test:
Reader rejects a byte-range read when the requested range exceeds the remaining data.

Definition at line 871 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::ReadBytes(), and profinet::wire::Reader::Remaining().

+ Here is the call graph for this function:

◆ TEST() [28/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderRejectsSkipPastEnd   
)
Test:
Reader rejects a skip operation when the requested distance exceeds the remaining data.

Definition at line 988 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::Skip().

+ Here is the call graph for this function:

◆ TEST() [29/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderRejectsSkipToPastEnd   
)
Test:
Reader rejects an absolute offset beyond the end of the buffer.

Definition at line 1043 of file test_wire.cpp.

References profinet::wire::Reader::Position(), and profinet::wire::Reader::SkipTo().

+ Here is the call graph for this function:

◆ TEST() [30/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderRejectsU16PastEnd   
)
Test:
Reader rejects a 16-bit big-endian read when fewer than two bytes remain and leaves its position unchanged.

Definition at line 801 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::U16().

+ Here is the call graph for this function:

◆ TEST() [31/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderRejectsU32PastEnd   
)
Test:
Reader rejects a 32-bit big-endian read when fewer than four bytes remain and leaves its position unchanged.

Definition at line 816 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::U32().

+ Here is the call graph for this function:

◆ TEST() [32/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderRejectsU8PastEnd   
)
Test:
Reader rejects an 8-bit read when no bytes remain.

Definition at line 642 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::U8().

+ Here is the call graph for this function:

◆ TEST() [33/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderRemainingTracksPosition   
)
Test:
Reader reports the correct remaining byte count after mixed cursor operations.

Definition at line 1119 of file test_wire.cpp.

References profinet::wire::Reader::Remaining(), profinet::wire::Reader::Skip(), profinet::wire::Reader::SkipTo(), and profinet::wire::Reader::U8().

+ Here is the call graph for this function:

◆ TEST() [34/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderSkip   
)
Test:
Reader skips a prefix so parsing can start at a specific byte index.

Definition at line 946 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), profinet::wire::Reader::Skip(), profinet::wire::Reader::U16(), and profinet::wire::Reader::U8().

+ Here is the call graph for this function:

◆ TEST() [35/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderSkipTo   
)
Test:
Reader moves to an absolute byte offset before reading.

Definition at line 1004 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::SkipTo(), and profinet::wire::Reader::U16().

+ Here is the call graph for this function:

◆ TEST() [36/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderSkipToMovesBackwards   
)
Test:
Reader can move backwards with SkipTo because the offset is absolute.

Definition at line 1024 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Skip(), profinet::wire::Reader::SkipTo(), and profinet::wire::Reader::U16().

+ Here is the call graph for this function:

◆ TEST() [37/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderSkipZero   
)
Test:
Reader supports a zero-distance Skip without moving the cursor.

Definition at line 971 of file test_wire.cpp.

References profinet::wire::Reader::Position(), profinet::wire::Reader::Remaining(), and profinet::wire::Reader::Skip().

+ Here is the call graph for this function:

◆ TEST() [38/71]

profinet::wire::TEST ( WireReaderTest  ,
ReaderSpanConstructor   
)
Test:
Reader constructed from a span reads the supplied bytes.

Definition at line 1164 of file test_wire.cpp.

References profinet::wire::Reader::Position(), and profinet::wire::Reader::U16().

+ Here is the call graph for this function:

◆ TEST() [39/71]

profinet::wire::TEST ( WireReaderTest  ,
ReadLittleEndianMaximumU32   
)
Test:
Verifies direct little-endian decoding of the maximum 32-bit value.

Definition at line 617 of file test_wire.cpp.

◆ TEST() [40/71]

profinet::wire::TEST ( WireReaderTest  ,
ReadLittleEndianU16   
)
Test:
Verifies direct little-endian decoding of a 16-bit value.

Definition at line 561 of file test_wire.cpp.

◆ TEST() [41/71]

profinet::wire::TEST ( WireReaderTest  ,
ReadLittleEndianU32   
)
Test:
Verifies direct little-endian decoding of a 32-bit value.

Definition at line 572 of file test_wire.cpp.

◆ TEST() [42/71]

profinet::wire::TEST ( WireReaderTest  ,
ReadLittleEndianU64   
)
Test:
Verifies direct little-endian decoding of a 64-bit value.

Definition at line 585 of file test_wire.cpp.

◆ TEST() [43/71]

profinet::wire::TEST ( WireReaderTest  ,
ReadLittleEndianU8   
)
Test:
Verifies direct little-endian decoding of an 8-bit value.

Definition at line 553 of file test_wire.cpp.

◆ TEST() [44/71]

profinet::wire::TEST ( WireReaderTest  ,
ReadLittleEndianZero   
)
Test:
Verifies direct little-endian decoding of zero.

Definition at line 604 of file test_wire.cpp.

◆ TEST() [45/71]

profinet::wire::TEST ( WireWriterTest  ,
PutBigEndianAppends   
)
Test:
Verifies that PutBigEndian appends to existing data without modifying the prefix.

Definition at line 122 of file test_wire.cpp.

◆ TEST() [46/71]

profinet::wire::TEST ( WireWriterTest  ,
PutBigEndianMaximumU32   
)
Test:
Verifies that PutBigEndian serializes the maximum 32-bit value.

Definition at line 104 of file test_wire.cpp.

◆ TEST() [47/71]

profinet::wire::TEST ( WireWriterTest  ,
PutBigEndianU16   
)
Test:
Verifies that PutBigEndian serializes a 16-bit value most-significant byte first.

Definition at line 37 of file test_wire.cpp.

◆ TEST() [48/71]

profinet::wire::TEST ( WireWriterTest  ,
PutBigEndianU32   
)
Test:
Verifies that PutBigEndian serializes a 32-bit value most-significant byte first.

Definition at line 48 of file test_wire.cpp.

◆ TEST() [49/71]

profinet::wire::TEST ( WireWriterTest  ,
PutBigEndianU64   
)
Test:
Verifies that PutBigEndian serializes a 64-bit value most-significant byte first.

Definition at line 66 of file test_wire.cpp.

◆ TEST() [50/71]

profinet::wire::TEST ( WireWriterTest  ,
PutBigEndianU8   
)
Test:
Verifies that PutBigEndian appends an 8-bit value unchanged.

Definition at line 26 of file test_wire.cpp.

◆ TEST() [51/71]

profinet::wire::TEST ( WireWriterTest  ,
PutBigEndianZero   
)
Test:
Verifies that PutBigEndian serializes zero as all zero bytes.

Definition at line 87 of file test_wire.cpp.

◆ TEST() [52/71]

profinet::wire::TEST ( WireWriterTest  ,
PutBytes   
)
Test:
Verifies that PutBytes appends an arbitrary byte range.

Definition at line 347 of file test_wire.cpp.

References PutBytes().

+ Here is the call graph for this function:

◆ TEST() [53/71]

profinet::wire::TEST ( WireWriterTest  ,
PutBytesZeroLength   
)
Test:
Verifies that PutBytes with a zero length leaves the destination unchanged.

Definition at line 370 of file test_wire.cpp.

References PutBytes().

+ Here is the call graph for this function:

◆ TEST() [54/71]

profinet::wire::TEST ( WireWriterTest  ,
PutFixedArray   
)
Test:
Verifies that PutFixed copies a non-empty fixed-size array.

Definition at line 381 of file test_wire.cpp.

References PutFixed().

+ Here is the call graph for this function:

◆ TEST() [55/71]

profinet::wire::TEST ( WireWriterTest  ,
PutFixedEmptyArray   
)
Test:
Verifies that PutFixed supports an empty fixed-size array.

Definition at line 403 of file test_wire.cpp.

References PutFixed().

+ Here is the call graph for this function:

◆ TEST() [56/71]

profinet::wire::TEST ( WireWriterTest  ,
PutFixedEmptyString   
)
Test:
Verifies that PutFixed supports an empty string without adding data.

Definition at line 465 of file test_wire.cpp.

References PutFixed().

+ Here is the call graph for this function:

◆ TEST() [57/71]

profinet::wire::TEST ( WireWriterTest  ,
PutFixedEmptyVector   
)
Test:
Verifies that PutFixed supports an empty byte vector.

Definition at line 436 of file test_wire.cpp.

References PutFixed().

+ Here is the call graph for this function:

◆ TEST() [58/71]

profinet::wire::TEST ( WireWriterTest  ,
PutFixedString   
)
Test:
Verifies that PutFixed copies string bytes without adding a terminating null byte.

Definition at line 448 of file test_wire.cpp.

References PutFixed().

+ Here is the call graph for this function:

◆ TEST() [59/71]

profinet::wire::TEST ( WireWriterTest  ,
PutFixedVector   
)
Test:
Verifies that PutFixed copies a non-empty byte vector.

Definition at line 414 of file test_wire.cpp.

References PutFixed().

+ Here is the call graph for this function:

◆ TEST() [60/71]

profinet::wire::TEST ( WireWriterTest  ,
PutLittleEndianAppends   
)
Test:
Verifies that PutLittleEndian appends to existing data without modifying the prefix.

Definition at line 238 of file test_wire.cpp.

◆ TEST() [61/71]

profinet::wire::TEST ( WireWriterTest  ,
PutLittleEndianMaximumU32   
)
Test:
Verifies that PutLittleEndian serializes the maximum 32-bit value.

Definition at line 220 of file test_wire.cpp.

◆ TEST() [62/71]

profinet::wire::TEST ( WireWriterTest  ,
PutLittleEndianPointerU16   
)
Test:
Verifies that the pointer overload of PutLittleEndian writes a 16-bit value into an existing buffer.

Definition at line 259 of file test_wire.cpp.

◆ TEST() [63/71]

profinet::wire::TEST ( WireWriterTest  ,
PutLittleEndianPointerU32   
)
Test:
Verifies that the pointer overload of PutLittleEndian writes a 32-bit value without modifying bytes outside the destination range.

Definition at line 282 of file test_wire.cpp.

◆ TEST() [64/71]

profinet::wire::TEST ( WireWriterTest  ,
PutLittleEndianU16   
)
Test:
Verifies that PutLittleEndian serializes a 16-bit value least-significant byte first.

Definition at line 153 of file test_wire.cpp.

◆ TEST() [65/71]

profinet::wire::TEST ( WireWriterTest  ,
PutLittleEndianU32   
)
Test:
Verifies that PutLittleEndian serializes a 32-bit value least-significant byte first.

Definition at line 164 of file test_wire.cpp.

◆ TEST() [66/71]

profinet::wire::TEST ( WireWriterTest  ,
PutLittleEndianU64   
)
Test:
Verifies that PutLittleEndian serializes a 64-bit value least-significant byte first.

Definition at line 182 of file test_wire.cpp.

◆ TEST() [67/71]

profinet::wire::TEST ( WireWriterTest  ,
PutLittleEndianU8   
)
Test:
Verifies that PutLittleEndian appends an 8-bit value unchanged.

Definition at line 142 of file test_wire.cpp.

◆ TEST() [68/71]

profinet::wire::TEST ( WireWriterTest  ,
PutLittleEndianZero   
)
Test:
Verifies that PutLittleEndian serializes zero as all zero bytes.

Definition at line 203 of file test_wire.cpp.

◆ TEST() [69/71]

profinet::wire::TEST ( WireWriterTest  ,
PutU16   
)
Test:
Verifies that PutU16 is equivalent to big-endian 16-bit serialization.

Definition at line 319 of file test_wire.cpp.

References PutU16().

+ Here is the call graph for this function:

◆ TEST() [70/71]

profinet::wire::TEST ( WireWriterTest  ,
PutU32   
)
Test:
Verifies that PutU32 is equivalent to big-endian 32-bit serialization.

Definition at line 330 of file test_wire.cpp.

References PutU32().

+ Here is the call graph for this function:

◆ TEST() [71/71]

profinet::wire::TEST ( WireWriterTest  ,
PutU8   
)
Test:
Verifies that PutU8 appends exactly one byte.

Definition at line 308 of file test_wire.cpp.

References PutU8().

+ Here is the call graph for this function:

Variable Documentation

◆ kBitsPerByte

constexpr unsigned profinet::wire::kBitsPerByte = 8U
inlineconstexpr

Definition at line 36 of file wire.h.

Referenced by PutBigEndian(), PutLittleEndian(), PutLittleEndian(), and ReadLittleEndian().