52using Bytes = std::vector<std::uint8_t>;
81 const int expectedEthernetHeaderSize = 14;
82 if (data.size() < expectedEthernetHeaderSize)
84 throw std::runtime_error(
"EthernetHeader: insufficient data");
134 const int expectedEthernetVLANHeaderSize = 14;
136 if (data.size() < expectedEthernetVLANHeaderSize)
138 throw std::runtime_error(
"EthernetVLANHeader: insufficient data");
174 static constexpr std::uint8_t
GET = 3;
177 static constexpr std::uint8_t
SET = 4;
183 static constexpr std::uint8_t
HELLO = 6;
226 throw std::runtime_error(
"PNDCPHeader: insufficient data");
294 throw std::runtime_error(
"PNDCPBlockRequest: insufficient data");
323 const int defaultIPConfigurationBlockLength = 12;
324 if (
payload.size() < defaultIPConfigurationBlockLength)
326 throw std::runtime_error(
"PNDCPBlockRequest: short IP payload");
328 const int ipAddressIndex = 0;
329 const int netmaskIndex = 4;
330 const int gatewayIndex = 8;
360 static constexpr std::pair<std::uint8_t, std::uint8_t>
IP_MAC{1, 1};
363 static constexpr std::pair<std::uint8_t, std::uint8_t>
IP_ADDRESS{1, 2};
369 static constexpr std::pair<std::uint8_t, std::uint8_t>
DEVICE_TYPE{2, 1};
375 static constexpr std::pair<std::uint8_t, std::uint8_t>
DEVICE_ID{2, 3};
378 static constexpr std::pair<std::uint8_t, std::uint8_t>
DEVICE_ROLE{2, 4};
384 static constexpr std::pair<std::uint8_t, std::uint8_t>
DEVICE_ALIAS{2, 6};
393 static constexpr std::pair<std::uint8_t, std::uint8_t>
ALL{0xFF, 0xFF};
406 throw std::runtime_error(
"PNDCPBlock: insufficient data");
416 std::size_t plSize = b.
length >= 2 ?
static_cast<std::size_t
>(b.
length - 2) : 0;
440 const int defaultIPConfigurationBlockLength = 12;
441 if (
payload.size() < defaultIPConfigurationBlockLength)
443 throw std::runtime_error(
"PNDCPBlock: short IP payload");
445 const int ipAddressIndex = 0;
446 const int netmaskIndex = 4;
447 const int gatewayIndex = 8;
461 0x6C, 0x97, 0x11, 0xD1, 0x82, 0x71, 0x00, 0xA0, 0x24, 0x42, 0xDF, 0x7D};
471 static constexpr std::uint8_t
PING = 0x01;
477 static constexpr std::uint8_t
FAULT = 0x03;
483 static constexpr std::uint8_t
PONG = 0x05;
486 static constexpr std::uint8_t
REJECT = 0x06;
489 static constexpr std::uint8_t
ACK = 0x07;
492 static constexpr std::uint8_t
CANCEL = 0x08;
501 static constexpr std::uint16_t
CONNECT = 0x00;
504 static constexpr std::uint16_t
RELEASE = 0x01;
507 static constexpr std::uint16_t
READ = 0x02;
510 static constexpr std::uint16_t
WRITE = 0x03;
513 static constexpr std::uint16_t
CONTROL = 0x04;
618 throw std::runtime_error(
"PNRPCHeader: insufficient data");
678 static std::array<std::uint8_t, uuidLenght>
PrefixedUuid(std::uint8_t b2, std::uint8_t b3)
680 std::array<std::uint8_t, uuidLenght> u{};
724 throw std::runtime_error(
"PNNRDData: insufficient data");
766 std::array<std::uint8_t, uuidLenght>
arUuid{};
805 throw std::runtime_error(
"PNIODHeader: insufficient data");
856 static constexpr std::uint16_t
InM0 = 0x0020;
884 static constexpr std::size_t
kSize = 6;
891 if (data.size() <
kSize)
893 throw std::runtime_error(
"PNBlockHeader: insufficient data");
927 std::array<std::uint8_t, uuidLenght>
arUuid{};
966 throw std::runtime_error(
"PNARBlockRequest: insufficient data");
1016 std::array<std::uint8_t, uuidLenght>
arUuid{};
1031 static constexpr std::size_t
kSize = 32;
1038 if (data.size() <
kSize)
1040 throw std::runtime_error(
"PNIODReleaseBlock: insufficient data");
1079 static constexpr std::uint16_t
IDX = 0xAFF0;
1128 static constexpr std::size_t
kSize = 60;
1142 if (data.size() <
kSize)
1144 throw std::runtime_error(
"PNInM0: insufficient data");
1181 static constexpr std::uint16_t
IDX = 0xAFF1;
1194 static constexpr std::size_t
kSize = 60;
1201 if (data.size() <
kSize)
1203 throw std::runtime_error(
"PNInM1: insufficient data");
1225 static constexpr std::uint16_t
IDX = 0xAFF2;
1235 static constexpr std::size_t
kSize = 22;
1242 if (data.size() <
kSize)
1244 throw std::runtime_error(
"PNInM2: insufficient data");
1266 static constexpr std::uint16_t
IDX = 0xAFF3;
1276 static constexpr std::size_t
kSize = 60;
1283 if (data.size() <
kSize)
1285 throw std::runtime_error(
"PNInM3: insufficient data");
1306 static constexpr std::uint16_t
IDX = 0xAFF4;
1316 static constexpr std::size_t
kSize = 60;
1323 if (data.size() <
kSize)
1325 throw std::runtime_error(
"PNInM4: insufficient data");
1346 static constexpr std::uint16_t
IDX = 0xAFF5;
1356 static constexpr std::size_t
kSize = 70;
1363 if (data.size() <
kSize)
1365 throw std::runtime_error(
"PNInM5: insufficient data");
1385template <std::u
int16_t Idx>
1390 static constexpr std::uint16_t
IDX = Idx;
1404 if (data.size() < 6)
1406 throw std::runtime_error(
"PNInMReserved: insufficient data");
1468 if (data.size() <
kSize)
1470 throw std::runtime_error(
"IOCRAPIObject: insufficient data");
1513 static constexpr std::size_t
kSize = 12;
1520 if (data.size() <
kSize)
1522 throw std::runtime_error(
"PNIOCRBlockRes: insufficient data");
1596 static constexpr std::size_t
kSize = 46;
1604 if (data.size() <
kSize)
1606 throw std::runtime_error(
1607 "IOCRBlockReq too short, insufficient data: " +
1608 std::to_string(data.size()) +
1609 " bytes, expected at least " +
1610 std::to_string(
kSize));
1721 static constexpr std::size_t
kSize = 26;
1763 static constexpr std::size_t
kSize = 12;
1770 if (data.size() <
kSize)
1772 throw std::runtime_error(
"PNAlarmCRBlockRes: insufficient data");
1842 throw std::runtime_error(
"PNAlarmNotificationPDU: insufficient data");
1884 static constexpr std::size_t
kSize = 22;
1966 throw std::runtime_error(
"PNRTAHeader: insufficient data");
2052 std::array<std::uint8_t, uuidLenght>
arUuid{};
2116 std::array<std::uint8_t, uuidLenght>
arUuid{};
2149 static constexpr std::size_t
kSize = 64;
2156 if (data.size() <
kSize)
2158 throw std::runtime_error(
"PNIODWriteRes: insufficient data");
Lightweight cursor for parsing a big-endian byte buffer without copies.
std::uint8_t U8()
Read and consume one byte.
std::uint32_t U32()
Read and consume a big-endian 32-bit value.
std::size_t Remaining() const
Number of bytes not yet consumed.
std::array< std::uint8_t, N > Fixed()
Read and consume a fixed-size byte array.
std::vector< std::uint8_t > ReadBytes(std::size_t n)
Read and consume a variable-length byte range.
std::uint16_t U16()
Read and consume a big-endian 16-bit value.
PROFINET record-data indices, block types, and protocol enumerations.
void PutU16(std::vector< std::uint8_t > &out, std::uint16_t v)
Append a 16-bit value to a buffer in big-endian order.
void PutU8(std::vector< std::uint8_t > &out, std::uint8_t v)
Append a single byte to a buffer.
void PutU32(std::vector< std::uint8_t > &out, std::uint32_t v)
Append a 32-bit value to a buffer in big-endian order.
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.
BlockType
PROFINET block types.
@ IoCrRequest
IOCR block request.
@ Unknown
Unknown / Initialize value.
@ AlarmCrRequest
AlarmCR block request.
@ IoDataReadRequest
IOD read request block.
constexpr int uuidLenght
Constant lenght of a UUID.
std::string String2Ip(std::span< const std::uint8_t > ipBytes)
Format raw IPv4 address bytes as a dotted string.
std::array< std::uint8_t, macAddressLength > MacAddress
A 6-byte Ethernet MAC address.
AlarmType
PROFINET Alarm Types used in AlarmNotification blocks.
ControlCommand
PROFINET IOD control command values.
@ Unknown
Unknown / Initialize value.
static constexpr int OneOctetShift
The bit-shift distance required to move data across a single octet.
constexpr int macAddressLength
Constant lenght of a mac address.
constexpr std::uint16_t PROFINET_ETHERTYPE
EtherType value identifying PROFINET frames (0x8892).
std::vector< std::uint8_t > Bytes
Generic byte buffer alias used throughout the library for raw wire data.
constexpr int blockHeaderLenght
Constant lenght of a blockHeader.
constexpr std::array< std::uint8_t, 12 > kPnUuidSuffix
PROFINET UUID suffix, shared by all interface/object UUIDs.
std::string DecodeBytes(const std::uint8_t *data, std::size_t len)
Decode bytes to a UTF-8 string, stripping trailing NUL bytes.
One slot/subslot's placement within an IOCR's cyclic data frame.
std::uint16_t frameOffset
Byte offset of this object's data within the cyclic frame.
std::uint16_t subslotNumber
Subslot number.
static constexpr std::size_t kSize
Size in bytes of this object.
Bytes ToBytes() const
Serialize this object back to raw bytes.
std::uint16_t slotNumber
Slot number.
static IOCRAPIObject Parse(const Bytes &data)
Parse an IOCR API object from raw bytes.
Decoded IPv4 address/netmask/gateway triple.
std::string gateway
IPv4 default gateway.
std::string netmask
IPv4 subnet mask, e.g. "255.255.255.0".
std::string address
IPv4 address, e.g. "192.168.1.1".
ARBlockReq: establishes an Application Relationship (sent in the CONNECT request).
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
static PNARBlockRequest Parse(const Bytes &data)
Parse an ARBlockReq from raw bytes.
std::uint32_t arProperties
AR property flags (supervisor takeover, device access, etc.).
std::uint16_t cmInitiatorActivityTimeoutFactor
Activity timeout factor for the initiator.
MacAddress cmInitiatorMacAddress
MAC address of the initiating controller.
std::uint16_t sessionKey
Session key chosen by the initiator.
std::array< std::uint8_t, uuidLenght > arUuid
Unique AR UUID chosen by the initiator (controller).
Bytes cmInitiatorStationName
Station name of the initiating controller (variable length).
Bytes ToBytes() const
Serialize this block back to raw bytes.
Bytes payload
Additional blocks following this one (IOCR/AlarmCR/ExpectedSubmodule).
std::uint16_t arType
AR type (e.g. IOCARSingle, IOSAR).
std::uint16_t initiatorUdpRtport
UDP port the initiator uses for real-time data.
static constexpr std::size_t kFixedSize
Size in bytes of the fixed portion of this block.
std::array< std::uint8_t, uuidLenght > cmInitiatorObjectUuid
Object UUID of the initiating controller.
std::uint16_t stationNameLength
Length in bytes of CmInitiatorStationName.
AlarmAck-PDU: acknowledges receipt of an AlarmNotification-PDU.
std::uint16_t alarmSpecifier
Alarm specifier flags echoed from the notification.
AlarmType alarmType
Alarm type being acknowledged.
std::uint16_t slotNumber
Slot number being acknowledged.
std::uint32_t statusPNIO
PNIO status code (0 = acknowledged OK).
std::uint16_t subslotNumber
Subslot number being acknowledged.
static constexpr std::size_t kSize
Size in bytes of this PDU.
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
std::uint32_t api
API number.
Bytes ToBytes() const
Serialize this PDU back to raw bytes.
AlarmCRBlockReq: requests establishment of the alarm connection (part of the CONNECT request).
static constexpr std::uint16_t DEFAULT_MAX_ALARM_DATA_LENGTH
Default maximum alarm data length in bytes.
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
static constexpr std::uint16_t DEFAULT_TAG_HEADER_LOW
Default low word of the alarm VLAN tag header.
static constexpr BlockType BLOCK_TYPE
Block type identifier for AlarmCRBlockReq.
Bytes ToBytes() const
Serialize this block back to raw bytes.
static constexpr std::uint16_t DEFAULT_TAG_HEADER_HIGH
Default high word of the alarm VLAN tag header.
std::uint16_t alarmCrType
Alarm CR type (always 1: Alarm).
std::uint16_t etherTypeLT
EtherType used for alarm frames (0x8892).
std::uint32_t alarmCrProperties
Alarm CR property flags (transport, priority).
static constexpr std::size_t kSize
Size in bytes of this block.
static constexpr std::uint16_t DEFAULT_RTA_RETRIES
Default number of RTA retries.
std::uint16_t localAlarmReference
Local alarm reference chosen by the controller.
std::uint16_t alarmCrTagHeaderHigh
High word of the alarm VLAN tag header.
std::uint16_t maxAlarmDataLength
Maximum alarm data length in bytes.
std::uint16_t alarmCrTagHeaderLow
Low word of the alarm VLAN tag header.
std::uint16_t rtaRetries
Number of RTA retransmission attempts.
std::uint16_t rtaTimeoutFactor
RTA (real-time acyclic) retransmission timeout factor.
static constexpr std::uint16_t DEFAULT_RTA_TIMEOUT_FACTOR
Default RTA timeout factor.
AlarmCRBlockRes: device's response confirming the alarm connection (part of the CONNECT response).
std::uint16_t alarmCrType
Alarm CR type (always 1: Alarm).
static constexpr std::uint16_t BLOCK_TYPE
Block type identifier for AlarmCRBlockRes.
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
std::uint16_t maxAlarmDataLength
Maximum alarm data length in bytes accepted by the device.
static constexpr std::size_t kSize
Size in bytes of this block.
std::uint16_t localAlarmReference
Local alarm reference assigned by the device.
static PNAlarmCRBlockRes Parse(const Bytes &data)
Parse an AlarmCRBlockRes from raw bytes.
AlarmNotification-PDU: carries a diagnosis/process/pull/plug/... alarm event.
std::uint16_t slotNumber
Slot number where the alarm originated.
std::uint32_t moduleIdentNumber
Module ident number of the affected module.
static constexpr std::uint16_t BLOCK_ALARM_HIGH
Block type: high-priority alarm notification.
static constexpr std::size_t kFixedSize
Size in bytes of the fixed portion of this PDU.
static constexpr std::uint16_t BLOCK_ALARM_ACK_LOW
Block type: low-priority alarm acknowledgement.
static constexpr std::uint16_t BLOCK_ALARM_ACK_HIGH
Block type: high-priority alarm acknowledgement.
static PNAlarmNotificationPDU Parse(const Bytes &data)
Parse an AlarmNotification-PDU from raw bytes.
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
std::uint32_t api
API number.
std::uint32_t submoduleIdentNumber
Submodule ident number of the affected submodule.
std::uint16_t subslotNumber
Subslot number where the alarm originated.
std::uint16_t alarmSpecifier
Alarm specifier flags (sequence number, channel diagnosis presence, etc.).
static constexpr std::uint16_t BLOCK_ALARM_LOW
Block type: low-priority alarm notification.
Bytes payload
Alarm item data (USI-dispatched; see alarms.h).
std::uint16_t alarmType
Alarm type (Diagnosis/Process/Pull/Plug/...).
DCP request block: Option(1) + SubOption(1) + Length(2) + payload(Length).
std::uint16_t length
Length in bytes of Payload.
IPConfiguration ParseIp() const
Interpret this block's payload as an IP configuration triple.
std::uint8_t suboption
DCP suboption code.
Bytes payload
Block payload.
std::uint8_t option
DCP option code.
Bytes ToBytes() const
Serialize this block back to raw bytes.
static constexpr std::size_t kFixedSize
Size in bytes of the fixed portion of this block.
static PNDCPBlockRequest Parse(const Bytes &data)
Parse a DCP request block from raw bytes.
DCP response block: Option(1) + SubOption(1) + Length(2) + Status(2) + payload.
static constexpr std::pair< std::uint8_t, std::uint8_t > DEVICE_ROLE
Block option/suboption: device role bitmask.
std::uint16_t status
Per-block status/error code.
std::uint8_t suboption
DCP suboption code.
static constexpr std::pair< std::uint8_t, std::uint8_t > DEVICE_ID
Block option/suboption: vendor/device ID.
static constexpr std::pair< std::uint8_t, std::uint8_t > IP_ADDRESS
Block option/suboption: IP address/netmask/gateway.
static constexpr std::pair< std::uint8_t, std::uint8_t > NAME_OF_STATION
Block option/suboption: station name.
static PNDCPBlock Parse(const Bytes &data)
Parse a DCP response block from raw bytes.
static constexpr std::size_t kFixedSize
Size in bytes of the fixed portion of this block.
std::uint8_t option
DCP option code.
std::uint16_t length
Length in bytes of Status plus Payload (see class.
static constexpr std::pair< std::uint8_t, std::uint8_t > DEVICE_OEM_ID
Block option/suboption: OEM vendor/device ID.
IPConfiguration ParseIp() const
Interpret this block's payload as an IP configuration triple.
static constexpr std::pair< std::uint8_t, std::uint8_t > DEVICE_OPTIONS
Block option/suboption: supported option list.
static constexpr std::pair< std::uint8_t, std::uint8_t > IP_FULL_SUITE
Block option/suboption: full IP suite.
static constexpr std::pair< std::uint8_t, std::uint8_t > ALL
Block option/suboption wildcard: all blocks.
static constexpr std::pair< std::uint8_t, std::uint8_t > DEVICE_ALIAS
Block option/suboption: device alias name.
static constexpr std::pair< std::uint8_t, std::uint8_t > DEVICE_INSTANCE
Block option/suboption: device instance.
Bytes payload
Block payload (excludes Status).
Bytes ToBytes() const
Serialize this block back to raw bytes.
static constexpr std::pair< std::uint8_t, std::uint8_t > IP_MAC
Block option/suboption: IP/MAC address.
static constexpr std::pair< std::uint8_t, std::uint8_t > DEVICE_TYPE
Block option/suboption: device type string.
Describes one direction (input or output) of a submodule's cyclic data.
std::uint16_t dataDescription
Data direction: 1 = Input, 2 = Output.
Bytes ToBytes() const
Serialize this description back to raw bytes.
std::uint8_t lengthIops
Length in bytes of the IOPS (provider status) trailer.
std::uint16_t submoduleDataLength
Length in bytes of this direction's cyclic data.
static constexpr std::size_t kSize
Size in bytes of this description.
std::uint8_t lengthIocs
Length in bytes of the IOCS (consumer status) trailer.
IOCRBlockRes: device's response confirming an IOCR (part of the CONNECT response).
static PNIOCRBlockRes Parse(const Bytes &data)
Parse an IOCRBlockRes from raw bytes.
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
std::uint16_t iocrReference
IOCR reference assigned by the controller.
static constexpr std::uint16_t BLOCK_TYPE
Block type identifier for IOCRBlockRes.
std::uint16_t frameId
Frame ID assigned by the device for this IOCR.
std::uint16_t iocrType
IOCR type (Input/Output/MulticastProvider/MulticastConsumer).
static constexpr std::size_t kSize
Size in bytes of this block.
Control block used for Release/PrmBegin/PrmEnd/ApplicationReady/RTClass3 requests.
std::array< std::uint8_t, uuidLenght > arUuid
AR UUID this control operation applies to.
std::uint16_t controlBlockProperties
Control block property flags.
static constexpr std::size_t kSize
Size in bytes of this block.
std::uint16_t padding1
Reserved/padding.
static PNIODReleaseBlock Parse(const Bytes &data)
Parse a control block from raw bytes.
std::uint16_t sessionKey
Session key matching the AR.
ControlCommand controlCommand
Control command bitmask (PrmEnd/AppReady/Release/Done/...).
std::uint16_t padding2
Reserved/padding.
Bytes ToBytes() const
Serialize this block back to raw bytes.
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
IODWriteReqHeader: request header for writing a data record.
static constexpr std::uint16_t BLOCK_TYPE
Block type identifier for IODWriteReqHeader.
std::uint16_t seqNum
Sequence number for tracking retries.
std::uint16_t index
Record data index being written.
Bytes payload
Record data to write.
std::array< std::uint8_t, uuidLenght > arUuid
AR UUID this record belongs to.
std::array< std::uint8_t, 24 > rwPadding
Reserved/padding.
static constexpr std::size_t kFixedSize
Size in bytes of the fixed portion of this block.
std::uint32_t recordDataLength
Length in bytes of Payload.
std::uint16_t subslot
Subslot number.
std::uint16_t slot
Slot number.
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
std::uint32_t api
API number.
Bytes ToBytes() const
Serialize this block back to raw bytes.
std::uint16_t padding
Reserved/padding.
IODWriteResHeader: response header confirming (or rejecting) a data record write.
std::uint32_t recordDataLength
Length in bytes accepted by the device.
static constexpr std::uint16_t BLOCK_TYPE
Block type identifier for IODWriteResHeader.
std::uint16_t padding
Reserved/padding.
std::uint16_t slot
Slot number.
std::uint16_t seqNum
Sequence number echoed from the request.
std::uint16_t additionalValue1
Additional status value 1 (device-specific).
std::array< std::uint8_t, uuidLenght > arUuid
AR UUID this record belongs to.
std::uint16_t index
Record data index written.
static PNIODWriteRes Parse(const Bytes &data)
Parse an IODWriteResHeader from raw bytes.
std::uint32_t status
PNIO status code (0 = success).
std::uint16_t subslot
Subslot number.
static constexpr std::size_t kSize
Size in bytes of this block.
std::uint16_t additionalValue2
Additional status value 2 (device-specific).
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
std::array< std::uint8_t, 16 > rwPadding
Reserved/padding.
std::uint32_t api
API number.
I&M0: mandatory identification data (vendor, order ID, serial number, revisions).
std::uint16_t imProfileId
I&M profile ID.
std::uint16_t imHardwareRevision
Hardware revision number.
static constexpr std::size_t kSize
Size in bytes of this record.
std::uint8_t vendorIdHigh
High byte of the PROFINET vendor ID.
std::uint16_t imProfileSpecificType
I&M profile-specific type.
std::string imSerialNumber
Device serial number (16 chars).
std::uint16_t imSupported
Bitmask of which I&M1-I&M15 records this device supports.
std::uint8_t imSwRevisionBugFix
Bug fix revision digit.
static PNInM0 Parse(const Bytes &data)
Parse an I&M0 record from raw bytes.
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
std::uint16_t imVersion
I&M data structure version.
std::uint8_t swRevisionPrefix
Software revision prefix character (e.g. 'V', 'R', 'P', 'U', 'T').
std::uint16_t imRevisionCounter
Monotonically increasing revision counter.
std::uint8_t imSwRevisionFunctionalEnhancement
Functional enhancement revision digit.
std::uint16_t VendorId() const
Combine VendorIdHigh/VendorIdLow into a 16-bit vendor ID.
std::uint8_t imSwRevisionInternalChange
Internal change revision digit.
std::string orderId
Manufacturer-specific order/part number (20 chars).
static constexpr std::uint16_t IDX
Record data index for I&M0.
std::uint8_t vendorIdLow
Low byte of the PROFINET vendor ID.
bool operator==(const PNInM0 &) const =default
Compares two PNInM0 for equality.
I&M1: user-assigned tag function and location strings.
std::string imTagLocation
User-assigned installation location (22 chars).
static PNInM1 Parse(const Bytes &data)
Parse an I&M1 record from raw bytes.
bool operator==(const PNInM1 &) const =default
Compares two PNInM1 for equality.
static constexpr std::uint16_t IDX
Record data index for I&M1.
std::string imTagFunction
User-assigned function description (32 chars).
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
static constexpr std::size_t kSize
Size in bytes of this record.
static PNInM2 Parse(const Bytes &data)
Parse an I&M2 record from raw bytes.
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
std::string imDate
Installation date, "YYYY-MM-DD HH:MM" (16 chars).
bool operator==(const PNInM2 &) const =default
Compares two PNInM2 for equality.
static constexpr std::uint16_t IDX
Record data index for I&M2.
static constexpr std::size_t kSize
Size in bytes of this record.
I&M3: free-text descriptor.
static constexpr std::uint16_t IDX
Record data index for I&M3.
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
std::string imDescriptor
Free-text descriptor (54 chars).
static PNInM3 Parse(const Bytes &data)
Parse an I&M3 record from raw bytes.
bool operator==(const PNInM3 &) const =default
Compares two PNInM3 for equality.
static constexpr std::size_t kSize
Size in bytes of this record.
I&M4: PROFIsafe signature (binary, not text).
bool operator==(const PNInM4 &) const =default
Compares two PNInM4 for equality.
std::array< std::uint8_t, 54 > imSignature
PROFIsafe signature bytes.
static PNInM4 Parse(const Bytes &data)
Parse an I&M4 record from raw bytes.
static constexpr std::uint16_t IDX
Record data index for I&M4.
static constexpr std::size_t kSize
Size in bytes of this record.
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
I&M5: free-text annotation.
static PNInM5 Parse(const Bytes &data)
Parse an I&M5 record from raw bytes.
static constexpr std::uint16_t IDX
Record data index for I&M5.
std::string imAnnotation
Free-text annotation (64 chars).
bool operator==(const PNInM5 &) const =default
Compares two PNInM5 for equality.
static constexpr std::size_t kSize
Size in bytes of this record.
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
I&M6-I&M15: reserved for future use per IEC 61158-6-10.
Bytes payload
Opaque remaining payload.
bool operator==(const PNInMReserved &) const =default
Compares two PNInMReserved for equality.
std::array< std::uint8_t, blockHeaderLenght > blockHeader
Nested 6-byte block header.
static constexpr std::uint16_t IDX
Record data index for this reserved I&M slot.
static PNInMReserved Parse(const Bytes &data)
Parse a reserved I&M record from raw bytes.
NRD (Network Representation Data) wrapper carrying the actual IOD payload.
Bytes payload
The wrapped IOD data.
static PNNRDData Parse(const Bytes &data)
Parse an NRD wrapper and payload from raw bytes.
Bytes ToBytes() const
Serialize this wrapper and payload back to raw bytes.
std::uint32_t argsLength
Length in bytes of the arguments (usually equals ActualCount).
std::uint32_t offset
Byte offset into the logical result (0 unless fragmented).
std::uint32_t argsMaximumStatus
Maximum status/argument buffer size accepted by the caller.
static constexpr std::size_t kFixedSize
Size in bytes of the fixed portion of this wrapper.
std::uint32_t maximumCount
Maximum number of bytes the caller can accept.
std::uint32_t actualCount
Actual length in bytes of Payload.
Declares Linux Ethernet, addressing, timing, and utility helpers used by the PROFINET stack.
Small helpers for reading/writing big-endian ("network order") integers to/from byte buffers....