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

Classes

class  DCPDeviceDescription
 Parsed PROFINET device information from a DCP response. More...
 
struct  DCPDHCPBlock
 Parsed DHCP block from a DCP response. More...
 
class  DcpWireFormatTest
 Test fixture for DCP request wire-format serialization. More...
 

Typedefs

using BlockKey = DcpBlockKey
 (option, suboption) key identifying a DCP block.
 
using ResponseMap = std::map< MacAddress, std::map< BlockKey, std::vector< std::uint8_t > > >
 Result of ReadResponse(): MAC address -> parsed (option,suboption) -> payload blocks.
 

Functions

std::vector< std::string > DecodeDeviceRole (std::uint8_t roleByte)
 Decode a device role bitmask into a list of role names.
 
std::string DeviceRoleName (DcpDeviceRole role)
 Get the human-readable name of a DCP device role.
 
std::string GetBlockName (std::uint16_t option, std::uint8_t suboption)
 Get the human-readable name for a (option, suboption) DCP block.
 
std::string GetBlockName (DcpOption option, std::uint8_t suboption)
 Get the human-readable name for a (option, suboption) DCP block.
 
std::string GetBlockName (DcpOption option, DcpIpSuboption suboption)
 Get the human-readable name for a (option, suboption) DCP block.
 
std::string GetBlockName (DcpOption option, DcpDeviceSuboption suboption)
 Get the human-readable name for a (option, suboption) DCP block.
 
std::string GetBlockName (DcpOption option, DcpControlSuboption suboption)
 Get the human-readable name for a (option, suboption) DCP block.
 
std::string GetBlockName (DcpOption option, DcpDhcpSuboption suboption)
 Get the human-readable name for a (option, suboption) DCP block.
 
std::string GetBlockName (DcpOption option, DcpDeviceInitiativeSuboption suboption)
 Get the human-readable name for a (option, suboption) DCP block.
 
DcpBlockError ParseSetResponse (const Bytes &data)
 Parses the raw byte response payload received from a SET operation.
 
DcpBlockError RecvSetResponse (IRawEthernetSocket &sock, const MacAddress &srcMac, int timeoutSec)
 Receive and parse a DCP SET response, filtering out unrelated frames.
 
std::string GetDeviceInitiativeName (DcpDeviceInitiative value)
 
std::string GetDcpResponseCodeName (DcpResponseCode value)
 Get the human-readable name for a device-response value.
 
std::string GetResetQualifierName (std::uint16_t qualifier)
 Get the human-readable name for a reset qualifier value.
 
std::string GetResetQualifierName (DcpResetQualifier qualifier)
 Get the human-readable name for a reset qualifier value.
 
std::string GetIPBlockInfoName (DcpIpBlockInfo info)
 Get the human-readable name for an IP block info value.
 
bool HasConflict (DcpIpBlockInfo info)
 Whether an address conflict was detected.
 
bool IsDhcp (DcpIpBlockInfo info)
 Whether the address was assigned via DHCP.
 
std::string GetDcpBlockQualifierDescription (DcpBlockQualifier qualifier)
 Get the human-readable description of a DCP block qualifier.
 
std::string GetDcpBlockErrorDescription (DcpBlockError error)
 Get the human-readable name for a DCP SET block-level error code.
 
constexpr DcpBlockKey MakeBlockKey (std::uint16_t option, std::uint8_t suboption)
 
constexpr DcpBlockKey MakeBlockKey (DcpOption option, std::uint8_t suboption)
 
constexpr DcpBlockKey MakeBlockKey (DcpOption option, DcpIpSuboption suboption)
 
constexpr DcpBlockKey MakeBlockKey (DcpOption option, DcpDeviceSuboption suboption)
 
constexpr DcpBlockKey MakeBlockKey (DcpOption option, DcpControlSuboption suboption)
 
constexpr DcpBlockKey MakeBlockKey (DcpOption option, DcpDhcpSuboption suboption)
 
constexpr DcpBlockKey MakeBlockKey (DcpOption option, DcpDeviceInitiativeSuboption suboption)
 
Bytes BuildSetParamRequest (const MacAddress &dst, const MacAddress &src, const std::string &param, const std::string &value, bool permanent)
 Build a serialized DCP SET request for a named parameter.
 
Bytes BuildDcpSignalRequest (const MacAddress &dst, const MacAddress &src)
 Build a serialized DCP Signal request.
 
const std::map< std::string, BlockKey > & Params ()
 Table of supported parameter names, mapping to their (option, suboption).
 
std::optional< std::vector< std::uint8_t > > GetParam (IRawEthernetSocket &sock, const MacAddress &src, const std::string &target, const std::string &param, int timeoutSec=DEFAULT_TIMEOUT)
 Read a named parameter from a device.
 
bool SetParam (IRawEthernetSocket &sock, const MacAddress &src, const std::string &target, const std::string &param, const std::string &value, int timeoutSec=DEFAULT_TIMEOUT, bool permanent=false, int threadSleepMs=DEFAULT_THREAD_SLEEP_MS)
 Write a named parameter to a device.
 
bool SetIp (IRawEthernetSocket &sock, const MacAddress &src, const std::string &target, const std::string &ip, const std::string &netmask, const std::string &gateway, bool permanent=false, int timeoutSec=DEFAULT_TIMEOUT, int threadSleepMs=DEFAULT_THREAD_SLEEP_MS)
 Set a device's IP configuration via DCP.
 
void SendDiscover (IRawEthernetSocket &sock, const MacAddress &src, std::uint16_t responseDelay=DEFAULT_RESPONSE_DELAY_FACTOR)
 Send a DCP Identify multicast request to discover all devices on the segment.
 
void SendRequest (IRawEthernetSocket &sock, const MacAddress &src, BlockKey blockType, const std::vector< std::uint8_t > &value)
 Send a DCP Identify request filtered to a specific (option, suboption).
 
ResponseMap ReadResponse (IRawEthernetSocket &sock, const MacAddress &myMac, double timeoutSec=DEFAULT_RESPONSE_TIMEOUT, bool once=false, std::optional< std::uint32_t > expectedXid=std::nullopt)
 Read and parse DCP Identify responses.
 
void SendHello (IRawEthernetSocket &sock, const MacAddress &src, const std::string &stationName, const std::string &ip="0.0.0.0", const std::string &netmask="0.0.0.0", const std::string &gateway="0.0.0.0", std::pair< std::uint16_t, std::uint16_t > deviceId={0, 0}, DcpDeviceRole deviceRole=DcpDeviceRole::IoDevice)
 Send a DCP Hello multicast announcement (device self-announce after power-on).
 
std::vector< DCPDeviceDescription > ReceiveHello (IRawEthernetSocket &sock, const MacAddress &myMac, double timeoutSec=DEFAULT_HELLO_TIMEOUT, const std::function< void(const DCPDeviceDescription &)> &callback=nullptr)
 Listen for DCP Hello announcements from other devices.
 
bool SignalDevice (IRawEthernetSocket &sock, const MacAddress &src, const std::string &target, int durationMs=FLASH_DURATION_MS, double timeoutSec=DEFAULT_TIMEOUT)
 Flash a device's identification LEDs.
 
bool ResetToFactory (IRawEthernetSocket &sock, const MacAddress &src, const std::string &target, DcpResetMode mode=DcpResetMode::Communication, double timeoutSec=DEFAULT_TIMEOUT)
 Reset a device to factory defaults.
 
std::string GetSuboptionName (std::uint16_t option, std::uint8_t value)
 
void SendRequest (IRawEthernetSocket &sock, const MacAddress &src, BlockKey blockType, const Bytes &value)
 Send a DCP Identify request filtered to a specific (option, suboption).
 
 TEST (DcpTest, DecodeDeviceRoleUnknown)
 
 TEST (DcpTest, DecodeDeviceRoleIoDevice)
 
 TEST (DcpTest, DecodeDeviceRoleIoController)
 
 TEST (DcpTest, DecodeDeviceRoleIoMultidevice)
 
 TEST (DcpTest, DecodeDeviceRolePnSupervisor)
 
 TEST (DcpTest, DecodeDeviceRoleAllRoles)
 
 TEST (DcpTest, GetBlockNameKnownOptionAndSuboption)
 
 TEST (DcpTest, GetBlockNameKnownDeviceAndDhcpSuboptions)
 
 TEST (DcpTest, GetBlockNameKnownControlAndDeviceInitiativeSuboptions)
 
 TEST (DcpTest, GetBlockNameKnownOptionUnknownSuboption)
 
 TEST (DcpTest, GetBlockNameKnownOptionWithoutSuboptionTable)
 
 TEST (DcpTest, GetBlockNameVendorOption)
 
 TEST (DcpTest, GetBlockNameUnknownOption)
 
 TEST (DcpTest, IpBlockInfoGetNameDefinedValues)
 
 TEST (DcpTest, IpBlockInfoGetNameUnknown)
 
 TEST (DcpTest, IpBlockInfoHasConflict)
 
 TEST (DcpTest, IpBlockInfoIsDhcp)
 
 TEST (DcpTest, BlockQualifierGetNameTemporary)
 
 TEST (DcpTest, BlockQualifierGetNamePermanent)
 
 TEST (DcpTest, BlockQualifierGetNameUnknown)
 
 TEST (DcpTest, ResetQualifierApplicationData)
 
 TEST (DcpTest, ResetQualifierCommunicationParameter)
 
 TEST (DcpTest, ResetQualifierEngineeringParameter)
 
 TEST (DcpTest, ResetQualifierAllStoredData)
 
 TEST (DcpTest, ResetQualifierEngineeringParameterSecondRange)
 
 TEST (DcpTest, ResetQualifierFactory)
 
 TEST (DcpTest, ResetQualifierRestoreData)
 
 TEST (DcpTest, ResetQualifierUnknown)
 
 TEST (DcpTest, DeviceInitiativeNoHello)
 
 TEST (DcpTest, DeviceInitiativeIssueHello)
 
 TEST (DcpTest, DeviceInitiativeUnknown)
 
 TEST (DcpTest, DcpResponseCodeGetNameDefinedValues)
 
 TEST (DcpTest, DcpResponseCodeGetNameUnknown)
 
 TEST (DcpTest, GetDcpBlockErrorNameDefinedValues)
 
 TEST (DcpTest, GetDcpBlockErrorNameUnknown)
 
 TEST (DcpTest, DcpDhcpBlockParseHostname)
 
 TEST (DcpTest, DcpDhcpBlockParseClientId)
 
 TEST (DcpTest, DcpDhcpBlockParseVendorSpecific)
 
 TEST (DcpTest, DcpDhcpBlockParseFqdn)
 
 TEST (DcpTest, DcpDhcpBlockParseUuid)
 
 TEST (DcpTest, DcpDhcpBlockParseUuidTooShort)
 
 TEST (DcpTest, DcpDhcpBlockParseUuidMinimumLength)
 
 TEST (DcpTest, DcpDhcpBlockParseUnknownSuboption)
 
 TEST (DcpTest, DcpDhcpBlockParseUnknownSuboptionEmptyPayload)
 
 TEST (DcpTest, DcpDhcpBlockKnownSuboptionNames)
 
 TEST (DcpTest, ParseSetResponseRejectsTooShortFrame)
 
 TEST (DcpTest, ParseSetResponseRejectsMalformedEthernetHeader)
 
 TEST (DcpTest, ParseSetResponseRejectsShortVlanFrame)
 
 TEST (DcpTest, ParseSetResponseAcceptsVlanFrame)
 
 TEST (DcpTest, ParseSetResponseRejectsUnexpectedVlanInnerEtherType)
 
 TEST (DcpTest, ParseSetResponseRejectsUnexpectedEtherType)
 
 TEST (DcpTest, ParseSetResponseRejectsMalformedDcpHeader)
 
 TEST (DcpTest, ParseSetResponseRejectsUnsupportedService)
 
 TEST (DcpTest, ParseSetResponseRejectsUnexpectedService)
 
 TEST (DcpTest, ParseSetResponseWithoutResponseBlockReturnsSuccess)
 
 TEST (DcpTest, ParseSetResponseExtractsThreeByteBlockError)
 
 TEST (DcpTest, ParseSetResponseExtractsShortBlockError)
 
 TEST (DcpTest, ParseSetResponseEmptyResponseBlockReturnsSuccess)
 
 TEST (DcpTest, ParseSetResponseSkipsNonResponseBlocks)
 
 TEST (DcpTest, ParseSetResponseUsesFirstResponseBlock)
 
 TEST (DcpTest, RecvSetResponseReturnsSuccessfulResponse)
 
 TEST (DcpTest, RecvSetResponseIgnoresEmptyFrame)
 
 TEST (DcpTest, RecvSetResponseIgnoresShortFrame)
 
 TEST (DcpTest, RecvSetResponseIgnoresMalformedEthernetFrame)
 
 TEST (DcpTest, RecvSetResponseIgnoresWrongDestinationMac)
 
 TEST (DcpTest, RecvSetResponseIgnoresShortVlanPayload)
 
 TEST (DcpTest, RecvSetResponseIgnoresWrongVlanInnerEtherType)
 
 TEST (DcpTest, RecvSetResponseIgnoresWrongEtherType)
 
 TEST (DcpTest, RecvSetResponseAcceptsVlanResponse)
 
 TEST (DcpTest, RecvSetResponseIgnoresUnexpectedServiceType)
 
 TEST (DcpTest, RecvSetResponsePropagatesDcpError)
 
 TEST (DcpTest, RecvSetResponseReturnsBlockError)
 
 TEST (DcpTest, RecvSetResponseTimesOut)
 
 TEST (DcpTest, DeviceRoleNameDefinedValues)
 
 TEST (DcpTest, DeviceRoleNameUnknown)
 
 TEST (DcpTest, GetBlockNameUnknownSuboptionForAllTypedOptionGroups)
 
 TEST (DcpTest, GetBlockNameOptionsWithoutSuboptions)
 
 TEST (DcpTest, GetBlockNameUint16OptionOverload)
 
 TEST (DcpTest, GetBlockNameDeviceInitiativeSuboption)
 
 TEST (DcpTest, MakeBlockKeyRawOption)
 
 TEST (DcpTest, MakeBlockKeyGenericSuboption)
 
 TEST (DcpTest, MakeBlockKeyIpSuboption)
 
 TEST (DcpTest, MakeBlockKeyDeviceSuboption)
 
 TEST (DcpTest, MakeBlockKeyControlSuboption)
 
 TEST (DcpTest, MakeBlockKeyDhcpSuboption)
 
 TEST (DcpTest, MakeBlockKeyDeviceInitiativeSuboption)
 
 TEST (DcpTest, DeviceRoleBitwiseOr)
 
 TEST (DcpTest, DeviceRoleBitwiseAndPresent)
 
 TEST (DcpTest, DeviceRoleBitwiseAndAbsent)
 
 TEST (DcpTest, ResetModeBitwiseOr)
 
 TEST (DcpTest, ResetModeBitwiseAndPresent)
 
 TEST (DcpTest, ResetModeBitwiseAndAbsent)
 
 TEST (DcpTest, IpBlockInfoBitHelpersHandleUnknownCombinations)
 
 TEST (DcpTest, ResetQualifierUnknownEnumValue)
 
 TEST (DcpTest, ResetQualifierZeroIsUnknown)
 
 TEST (DcpTest, DcpDhcpBlockParseUnknownEnumValue)
 
 TEST (DcpTest, DcpDhcpBlockParseEmptyHostname)
 
 TEST (DcpTest, DcpDhcpBlockParseEmptyFqdn)
 
 TEST (DCPDeviceDescriptionTest, ToStringIncludesAllPopulatedFields)
 
 TEST (DCPDeviceDescriptionTest, ToStringOmitsUnsetOptionalFields)
 
 TEST (DCPDeviceDescriptionTest, ToStringFormatsDhcpBlockVariants)
 
 TEST (DCPDeviceDescriptionTest, ConstructorDecodesAllSupportedBlocks)
 
 TEST (DCPDeviceDescriptionTest, ConstructorIgnoresIncompleteOptionalBlocks)
 
 TEST (DCPDeviceDescriptionTest, ConstructorHandlesLegacyTwelveByteIpBlock)
 
 TEST (DCPDeviceDescriptionTest, ConstructorUsesLegacyIpLayoutForThirteenByteBlock)
 
 TEST (DcpTest, BuildSetParamRequestBuildsTemporaryOddLengthName)
 
 TEST (DcpTest, BuildSetParamRequestBuildsPermanentEvenLengthName)
 
 TEST (DcpTest, BuildSetParamRequestRejectsIpParameter)
 
 TEST (DcpTest, BuildSetParamRequestRejectsUnknownParameter)
 
 TEST (DcpTest, BuildSetParamRequestRejectsOverlongStationName)
 
 TEST (DcpTest, BuildSetParamRequestAcceptsMaximumStationName)
 
 TEST (DcpTest, BuildDcpSignalRequestBuildsCorrectWireFormat)
 
 TEST (DcpTest, ParamsContainsSupportedParameters)
 
 TEST (DcpTest, GetParamThrowsForUnknownParameter)
 
 TEST (DcpTest, GetParamReturnsMatchingParameter)
 
 TEST (DcpTest, GetParamReturnsNulloptWhenParameterIsMissing)
 
 TEST (DcpTest, GetParamReturnsNulloptOnTimeout)
 
 TEST (DcpTest, SetParamReturnsTrueForSuccessfulResponse)
 
 TEST (DcpTest, SetParamThrowsForDeviceBlockError)
 
 TEST (DcpTest, SetParamReturnsFalseOnTimeout)
 
 TEST (DcpTest, SetParamBuildsTemporaryRequest)
 
 TEST (DcpTest, SetIpReturnsFalseOnTimeout)
 
 TEST (DcpTest, SetIpRejectsInvalidIpAddress)
 
 TEST (DcpTest, SetIpEncodesPermanentQualifier)
 
 TEST (DcpTest, SetIpEncodesTemporaryQualifier)
 
 TEST (DcpTest, SendRequestBuildsIdentifyRequest)
 
 TEST (DcpTest, SetIpBuildsPermanentIpBlock)
 
 TEST (DcpTest, ReadResponseSetsExpectedSocketTimeout)
 
 TEST (DcpTest, ReadResponseReturnsValidResponse)
 
 TEST (DcpTest, ReadResponseAcceptsAnyXidWhenExpectedXidIsNotSpecified)
 
 TEST (DcpTest, ReadResponseIgnoresUnexpectedXid)
 
 TEST (DcpTest, ReadResponseIgnoresEmptyData)
 
 TEST (DcpTest, ReadResponseIgnoresShortEthernetFrame)
 
 TEST (DcpTest, ReadResponseIgnoresMalformedEthernetFrame)
 
 TEST (DcpTest, ReadResponseIgnoresWrongDestination)
 
 TEST (DcpTest, ReadResponseIgnoresShortVlanPayload)
 
 TEST (DcpTest, ReadResponseIgnoresWrongVlanInnerEtherType)
 
 TEST (DcpTest, ReadResponseIgnoresWrongEtherType)
 
 TEST (DcpTest, ReadResponseIgnoresMalformedDcpHeader)
 
 TEST (DcpTest, ReadResponseIgnoresUnsuccessfulServiceType)
 
 TEST (DcpTest, ReadResponseParsesValidVlanResponse)
 
 TEST (DcpTest, ReadResponseUsesEmptyBlockRegionForShortDcpLength)
 
 TEST (DcpTest, ReadResponseLimitsBlockRegionToDcpLength)
 
 TEST (DcpTest, ReadResponseProcessesMultipleResponsesWhenOnceIsFalse)
 
 TEST (DcpTest, ReadResponseStopsAfterFirstValidResponseWhenOnceIsTrue)
 
 TEST (DcpTest, ReadResponseContinuesAfterIgnoredFrames)
 
 TEST (DcpTest, ReadResponseReturnsEmptyMapOnTimeout)
 
 TEST (DcpTest, SendHelloBuildsCompleteHelloFrame)
 
 TEST (DcpTest, SendHelloAddsPaddingForOddLengthStationName)
 
 TEST (DcpTest, SendHelloEncodesCombinedDeviceRole)
 
 TEST (DcpTest, SendHelloEncodesDeviceId)
 
 TEST (DcpTest, SendHelloRejectsInvalidIpAddress)
 
 TEST (DcpTest, SendHelloRejectsInvalidNetmask)
 
 TEST (DcpTest, SendHelloRejectsInvalidGateway)
 
 TEST (DcpTest, ReceiveHelloSetsExpectedSocketTimeout)
 
 TEST (DcpTest, ReceiveHelloReturnsValidDevice)
 
 TEST (DcpTest, ReceiveHelloInvokesCallbackForValidDevice)
 
 TEST (DcpTest, ReceiveHelloDoesNotInvokeEmptyCallback)
 
 TEST (DcpTest, ReceiveHelloParsesValidVlanHello)
 
 TEST (DcpTest, ReceiveHelloIgnoresEmptyData)
 
 TEST (DcpTest, ReceiveHelloIgnoresShortEthernetFrame)
 
 TEST (DcpTest, ReceiveHelloIgnoresMalformedEthernetFrame)
 
 TEST (DcpTest, ReceiveHelloIgnoresShortVlanPayload)
 
 TEST (DcpTest, ReceiveHelloIgnoresWrongVlanInnerEtherType)
 
 TEST (DcpTest, ReceiveHelloIgnoresWrongEtherType)
 
 TEST (DcpTest, ReceiveHelloIgnoresShortPnioPayload)
 
 TEST (DcpTest, ReceiveHelloIgnoresMalformedDcpHeader)
 
 TEST (DcpTest, ReceiveHelloIgnoresNonHelloServiceId)
 
 TEST (DcpTest, ReceiveHelloIgnoresNonRequestServiceType)
 
 TEST (DcpTest, ReceiveHelloContinuesAfterIgnoredFrame)
 
 TEST (DcpTest, ReceiveHelloReturnsMultipleDevices)
 
 TEST (DcpTest, ReceiveHelloReturnsEmptyOnTimeout)
 
 TEST (DcpTest, SignalDeviceReturnsTrueForSuccessfulResponse)
 
 TEST (DcpTest, SignalDeviceThrowsForBlockError)
 
 TEST (DcpTest, SignalDeviceReturnsFalseOnTimeout)
 
 TEST (DcpTest, SignalDeviceRejectsInvalidTargetMac)
 
 TEST (DcpTest, ResetToFactoryReturnsTrueForSuccessfulResponse)
 
 TEST (DcpTest, ResetToFactoryEncodesCombinedResetMode)
 
 TEST (DcpTest, ResetToFactoryReturnsFalseOnTimeout)
 
 TEST (DcpTest, ResetToFactoryThrowsForBlockError)
 
 TEST (DcpTest, ResetToFactoryRejectsInvalidTargetMac)
 
 TEST (DcpTest, GetParamSendsCorrectGetRequest)
 
 TEST_F (DcpWireFormatTest, OddLengthNameIsPaddedAndBlockLengthExcludesPadding)
 
 TEST_F (DcpWireFormatTest, EvenLengthNameIsNotPadded)
 
 TEST_F (DcpWireFormatTest, DefaultQualifierIsTemporary)
 
 TEST_F (DcpWireFormatTest, PermanentQualifierIsSerialized)
 
 TEST_F (DcpWireFormatTest, IpSetOperationIsRejected)
 
 TEST_F (DcpWireFormatTest, IpParameterMatchingIsCaseInsensitive)
 
 TEST_F (DcpWireFormatTest, SignalUsesFlashOnceValue)
 

Variables

const std::string DCP_MULTICAST_MAC = "01:0e:cf:00:00:00"
 DCP Identify/Get/Set multicast destination MAC.
 
const std::string DCP_HELLO_MULTICAST_MAC = "01:0e:cf:00:00:01"
 DCP Hello multicast destination MAC.
 
constexpr std::size_t DCP_MAX_NAME_LENGTH = 240
 Maximum allowed length in bytes for a station name.
 
constexpr std::uint16_t DEFAULT_TIMEOUT = 5
 Default timeout.
 
constexpr std::uint16_t DEFAULT_THREAD_SLEEP_MS = 2000
 
constexpr std::uint16_t DEFAULT_RESPONSE_TIMEOUT = 20
 Default response timeout. How long to keep listening for responses.
 
constexpr std::uint16_t DEFAULT_HELLO_TIMEOUT = 10
 Default HELLO timeout.
 
constexpr std::uint16_t DEFAULT_RESPONSE_DELAY_FACTOR = 0x0080
 Default dcp response delay factor.
 
constexpr std::uint16_t FLASH_DURATION_MS = 3000
 Default flash duration of the leds.
 
constexpr std::uint16_t blockNameVendorRangeMin = 0x80
 Default flash duration of the leds.
 
constexpr std::uint16_t blockNameVendorRangeMax = 0xFF
 Default flash duration of the leds.
 
constexpr std::uint16_t DCP_IP_CONFLICT_BIT = 0x0080
 Bit mask indicating an IP address conflict.
 
constexpr std::uint16_t DCP_IP_DHCP_BIT = 0x0002
 Bit mask indicating DHCP bit is set.
 

Typedef Documentation

◆ BlockKey

(option, suboption) key identifying a DCP block.

Definition at line 229 of file dcp.h.

◆ ResponseMap

using profinet::dcp::ResponseMap = typedef std::map<MacAddress, std::map<BlockKey, std::vector<std::uint8_t> >>

Result of ReadResponse(): MAC address -> parsed (option,suboption) -> payload blocks.

Definition at line 483 of file dcp.h.

Function Documentation

◆ BuildDcpSignalRequest()

Bytes profinet::dcp::BuildDcpSignalRequest ( const MacAddress &  dst,
const MacAddress &  src 
)

Build a serialized DCP Signal request.

Creates the complete Ethernet frame used to request the device's identification LEDs to flash once.

The serialized Control/Signal block contains:

  • BlockQualifier 0x0000.
  • SignalValue 0x0100 (Flash Once).
Parameters
dstDestination device MAC address.
srcSource/controller MAC address.
Returns
Complete serialized Ethernet frame.

Definition at line 937 of file dcp.cpp.

References BuildDcpSignalRequest(), profinet::PNDCPHeader::frameId, profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, profinet::PNDCPHeader::respDelay, profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by BuildDcpSignalRequest(), profinet::dcp::DcpWireFormatTest::BuildSignalRequest(), SignalDevice(), and TEST().

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

◆ BuildSetParamRequest()

Bytes profinet::dcp::BuildSetParamRequest ( const MacAddress &  dst,
const MacAddress &  src,
const std::string &  param,
const std::string &  value,
bool  permanent 
)

Build a serialized DCP SET request for a named parameter.

Creates the complete Ethernet frame containing a DCP SET request.

For the NameOfStation parameter, the generated block contains the BlockQualifier followed by the station name. Odd-length values receive one zero padding byte on the wire while the DCP BlockLength excludes that alignment byte.

IP configuration requires the binary IP suite representation (IP address + subnet mask + gateway). The string-valued SET API intentionally rejects IP configuration and callers must use SetIp().

Parameters
dstDestination device MAC address.
srcSource/controller MAC address.
paramParameter name, such as "name".
valueParameter value.
permanentWhether the requested value should be stored permanently.
Returns
Complete serialized Ethernet frame.
Exceptions
DCPErrorIf the parameter name is unknown.
ValidationErrorIf the parameter value violates DCP constraints.

Definition at line 883 of file dcp.cpp.

References BuildSetParamRequest(), DCP_MAX_NAME_LENGTH, profinet::PNDCPHeader::frameId, profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::DcpBlockKey::option, profinet::PNDCPBlockRequest::option, Params(), profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, profinet::PNDCPHeader::respDelay, profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::DcpBlockKey::suboption, profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), profinet::ToVec(), and profinet::PNDCPHeader::xId.

Referenced by profinet::dcp::DcpWireFormatTest::BuildSetNameRequest(), BuildSetParamRequest(), SetParam(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

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

◆ DecodeDeviceRole()

std::vector< std::string > profinet::dcp::DecodeDeviceRole ( std::uint8_t  roleByte)

Decode a device role bitmask into a list of role names.

Parameters
roleByteRaw device role bitmask byte.
Returns
Human-readable role names (e.g. "IO-Device", "IO-Controller").

Definition at line 97 of file dcp.cpp.

Referenced by profinet::dcp::DCPDeviceDescription::DCPDeviceDescription(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

+ Here is the caller graph for this function:

◆ DeviceRoleName()

std::string profinet::dcp::DeviceRoleName ( DcpDeviceRole  role)

Get the human-readable name of a DCP device role.

Parameters
roleDevice role enumeration.
Returns
Human-readable role name, or "Unknown" for an unsupported value.

Definition at line 118 of file dcp.cpp.

Referenced by TEST(), and TEST().

+ Here is the caller graph for this function:

◆ GetBlockName() [1/7]

std::string profinet::dcp::GetBlockName ( DcpOption  option,
DcpControlSuboption  suboption 
)

Get the human-readable name for a (option, suboption) DCP block.

Parameters
optionDCP option code.
suboptionDCP suboption code.
Returns
A "Option/Suboption" style name, e.g. "IP/MAC".

Definition at line 237 of file dcp.cpp.

References GetBlockName(), option, and suboption.

+ Here is the call graph for this function:

◆ GetBlockName() [2/7]

std::string profinet::dcp::GetBlockName ( DcpOption  option,
DcpDeviceInitiativeSuboption  suboption 
)

Get the human-readable name for a (option, suboption) DCP block.

Parameters
optionDCP option code.
suboptionDCP suboption code.
Returns
A "Option/Suboption" style name, e.g. "IP/MAC".

Definition at line 247 of file dcp.cpp.

References GetBlockName(), option, and suboption.

+ Here is the call graph for this function:

◆ GetBlockName() [3/7]

std::string profinet::dcp::GetBlockName ( DcpOption  option,
DcpDeviceSuboption  suboption 
)

Get the human-readable name for a (option, suboption) DCP block.

Parameters
optionDCP option code.
suboptionDCP suboption code.
Returns
A "Option/Suboption" style name, e.g. "IP/MAC".

Definition at line 232 of file dcp.cpp.

References GetBlockName(), option, and suboption.

+ Here is the call graph for this function:

◆ GetBlockName() [4/7]

std::string profinet::dcp::GetBlockName ( DcpOption  option,
DcpDhcpSuboption  suboption 
)

Get the human-readable name for a (option, suboption) DCP block.

Parameters
optionDCP option code.
suboptionDCP suboption code.
Returns
A "Option/Suboption" style name, e.g. "IP/MAC".

Definition at line 242 of file dcp.cpp.

References GetBlockName(), option, and suboption.

+ Here is the call graph for this function:

◆ GetBlockName() [5/7]

std::string profinet::dcp::GetBlockName ( DcpOption  option,
DcpIpSuboption  suboption 
)

Get the human-readable name for a (option, suboption) DCP block.

Parameters
optionDCP option code.
suboptionDCP suboption code.
Returns
A "Option/Suboption" style name, e.g. "IP/MAC".

Definition at line 227 of file dcp.cpp.

References GetBlockName(), option, and suboption.

+ Here is the call graph for this function:

◆ GetBlockName() [6/7]

std::string profinet::dcp::GetBlockName ( DcpOption  option,
std::uint8_t  suboption 
)

Get the human-readable name for a (option, suboption) DCP block.

Parameters
optionDCP option code.
suboptionDCP suboption code.
Returns
A "Option/Suboption" style name, e.g. "IP/MAC".

Definition at line 222 of file dcp.cpp.

References GetBlockName(), option, and suboption.

+ Here is the call graph for this function:

◆ GetBlockName() [7/7]

std::string profinet::dcp::GetBlockName ( std::uint16_t  option,
std::uint8_t  suboption 
)

Get the human-readable name for a (option, suboption) DCP block.

Parameters
optionDCP option code.
suboptionDCP suboption code.
Returns
A "Option/Suboption" style name, e.g. "IP/MAC".

Definition at line 196 of file dcp.cpp.

References blockNameVendorRangeMax, blockNameVendorRangeMin, GetSuboptionName(), profinet::Hex2(), option, suboption, and profinet::Unknown.

Referenced by GetBlockName(), GetBlockName(), GetBlockName(), GetBlockName(), GetBlockName(), GetBlockName(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and profinet::dcp::DCPDeviceDescription::ToString().

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

◆ GetDcpBlockErrorDescription()

std::string profinet::dcp::GetDcpBlockErrorDescription ( DcpBlockError  error)

Get the human-readable name for a DCP SET block-level error code.

Parameters
errorBlock error code.
Returns
A description of the error.

Definition at line 524 of file dcp.cpp.

References error, GetDcpBlockErrorDescription(), and profinet::Hex2().

Referenced by GetDcpBlockErrorDescription(), ResetToFactory(), SetIp(), SetParam(), SignalDevice(), TEST(), and TEST().

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

◆ GetDcpBlockQualifierDescription()

std::string profinet::dcp::GetDcpBlockQualifierDescription ( DcpBlockQualifier  qualifier)

Get the human-readable description of a DCP block qualifier.

Parameters
qualifierDCP block qualifier.
Returns
Human-readable description, or an "Unknown (0xXXXX)" fallback.

Definition at line 434 of file dcp.cpp.

References GetDcpBlockQualifierDescription(), and profinet::Hex4().

Referenced by GetDcpBlockQualifierDescription(), TEST(), TEST(), and TEST().

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

◆ GetDcpResponseCodeName()

std::string profinet::dcp::GetDcpResponseCodeName ( DcpResponseCode  value)

Get the human-readable name for a device-response value.

Parameters
valueDevice response value.
Returns
A description of the setting.

Definition at line 501 of file dcp.cpp.

References GetDcpResponseCodeName(), and profinet::Hex2().

Referenced by GetDcpResponseCodeName(), TEST(), and TEST().

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

◆ GetDeviceInitiativeName()

std::string profinet::dcp::GetDeviceInitiativeName ( DcpDeviceInitiative  value)

Definition at line 488 of file dcp.cpp.

References GetDeviceInitiativeName(), and profinet::Hex4().

Referenced by GetDeviceInitiativeName(), TEST(), TEST(), TEST(), and profinet::dcp::DCPDeviceDescription::ToString().

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

◆ GetIPBlockInfoName()

std::string profinet::dcp::GetIPBlockInfoName ( DcpIpBlockInfo  info)

Get the human-readable name for an IP block info value.

Parameters
infoRaw IP block info value.
Returns
A description such as "IP set by DHCP".

Definition at line 402 of file dcp.cpp.

References GetIPBlockInfoName(), and profinet::Hex4().

Referenced by GetIPBlockInfoName(), TEST(), TEST(), and profinet::dcp::DCPDeviceDescription::ToString().

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

◆ GetParam()

std::optional< Bytes > profinet::dcp::GetParam ( IRawEthernetSocket &  sock,
const MacAddress &  src,
const std::string &  target,
const std::string &  param,
int  timeoutSec = DEFAULT_TIMEOUT 
)

Read a named parameter from a device.

Parameters
sockBound Ethernet socket to send/receive on.
srcSource MAC address to send from.
targetDestination device's MAC address, as a string.
paramParameter name ("name" or "ip"); see Params().
timeoutSecHow long to wait for a response.
Returns
The raw parameter value, or std::nullopt if no response was received within the timeout.

Throws DCPError for an unknown parameter name.

Definition at line 1005 of file dcp.cpp.

References profinet::PNDCPHeader::frameId, GetParam(), profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::DcpBlockKey::option, profinet::PNDCPBlockRequest::option, Params(), profinet::PNDCPHeader::payload, ReadResponse(), profinet::PNDCPHeader::respDelay, profinet::IRawEthernetSocket::Send(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::String2Mac(), profinet::DcpBlockKey::suboption, profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by GetParam(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().

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

◆ GetResetQualifierName() [1/2]

std::string profinet::dcp::GetResetQualifierName ( DcpResetQualifier  qualifier)

Get the human-readable name for a reset qualifier value.

Parameters
qualifierRaw qualifier value.
Returns
A description such as "Reset to factory values".

Definition at line 457 of file dcp.cpp.

References GetResetQualifierName(), and profinet::Hex4().

+ Here is the call graph for this function:

◆ GetResetQualifierName() [2/2]

std::string profinet::dcp::GetResetQualifierName ( std::uint16_t  qualifier)

Get the human-readable name for a reset qualifier value.

Parameters
qualifierRaw qualifier value.
Returns
A description such as "Reset to factory values".

Definition at line 447 of file dcp.cpp.

References GetResetQualifierName(), and profinet::Hex4().

Referenced by GetResetQualifierName(), GetResetQualifierName(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

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

◆ GetSuboptionName()

std::string profinet::dcp::GetSuboptionName ( std::uint16_t  option,
std::uint8_t  value 
)

Definition at line 125 of file dcp.cpp.

References profinet::All, profinet::Control, profinet::Device, profinet::DeviceInitiative, profinet::Dhcp, profinet::Hex2(), profinet::Ip, profinet::Nme, option, profinet::Reserved, suboption, and profinet::Unknown.

Referenced by GetBlockName().

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

◆ HasConflict()

bool profinet::dcp::HasConflict ( DcpIpBlockInfo  info)

Whether an address conflict was detected.

Parameters
infoIP block info value.
Returns
True if the conflict bit (0x0080) is set.

Definition at line 424 of file dcp.cpp.

References DCP_IP_CONFLICT_BIT, and HasConflict().

Referenced by profinet::dcp::DCPDeviceDescription::DCPDeviceDescription(), HasConflict(), TEST(), and TEST().

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

◆ IsDhcp()

bool profinet::dcp::IsDhcp ( DcpIpBlockInfo  info)

Whether the address was assigned via DHCP.

Parameters
infoIP block info value.
Returns
True if the DHCP bit (0x0002) is set.

Definition at line 429 of file dcp.cpp.

References DCP_IP_DHCP_BIT, and IsDhcp().

Referenced by profinet::dcp::DCPDeviceDescription::DCPDeviceDescription(), IsDhcp(), TEST(), and TEST().

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

◆ MakeBlockKey() [1/7]

constexpr DcpBlockKey profinet::dcp::MakeBlockKey ( DcpOption  option,
DcpControlSuboption  suboption 
)
constexpr

Definition at line 251 of file dcp.h.

References profinet::DcpBlockKey::option, option, and suboption.

◆ MakeBlockKey() [2/7]

constexpr DcpBlockKey profinet::dcp::MakeBlockKey ( DcpOption  option,
DcpDeviceInitiativeSuboption  suboption 
)
constexpr

Definition at line 261 of file dcp.h.

References profinet::DcpBlockKey::option, option, and suboption.

◆ MakeBlockKey() [3/7]

constexpr DcpBlockKey profinet::dcp::MakeBlockKey ( DcpOption  option,
DcpDeviceSuboption  suboption 
)
constexpr

Definition at line 246 of file dcp.h.

References profinet::DcpBlockKey::option, option, and suboption.

◆ MakeBlockKey() [4/7]

constexpr DcpBlockKey profinet::dcp::MakeBlockKey ( DcpOption  option,
DcpDhcpSuboption  suboption 
)
constexpr

Definition at line 256 of file dcp.h.

References profinet::DcpBlockKey::option, option, and suboption.

◆ MakeBlockKey() [5/7]

constexpr DcpBlockKey profinet::dcp::MakeBlockKey ( DcpOption  option,
DcpIpSuboption  suboption 
)
constexpr

Definition at line 241 of file dcp.h.

References profinet::DcpBlockKey::option, option, and suboption.

◆ MakeBlockKey() [6/7]

constexpr DcpBlockKey profinet::dcp::MakeBlockKey ( DcpOption  option,
std::uint8_t  suboption 
)
constexpr

Definition at line 236 of file dcp.h.

References profinet::DcpBlockKey::option, option, and suboption.

◆ MakeBlockKey() [7/7]

constexpr DcpBlockKey profinet::dcp::MakeBlockKey ( std::uint16_t  option,
std::uint8_t  suboption 
)
constexpr

Definition at line 231 of file dcp.h.

References profinet::DcpBlockKey::option, option, and suboption.

Referenced by profinet::dcp::DCPDeviceDescription::DCPDeviceDescription(), profinet::device::ProfinetScannerTest::CreateScanResponses(), profinet::rpc::GetStationInfo(), profinet::rpc::RpcTests::MakeStationBlocks(), Params(), ReadResponse(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

+ Here is the caller graph for this function:

◆ Params()

const std::map< std::string, BlockKey > & profinet::dcp::Params ( )

Table of supported parameter names, mapping to their (option, suboption).

Returns
Reference to the static table, e.g. {"name": {2,2}, "ip": {1,2}}.

Definition at line 590 of file dcp.cpp.

References MakeBlockKey(), and Params().

Referenced by BuildSetParamRequest(), GetParam(), Params(), TEST(), and TEST().

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

◆ ParseSetResponse()

DcpBlockError profinet::dcp::ParseSetResponse ( const Bytes &  data)

Parses the raw byte response payload received from a SET operation.

Parameters
dataReference to the byte container containing the response payload.
Returns
A DcpBlockError representing the parsed status code or result.

Parse a DCP SET response and extract the block error code. Throws DCPError on malformed/unexpected frames.

Definition at line 319 of file dcp.cpp.

References profinet::Control, profinet::Hex2(), profinet::Hex4(), profinet::Ok, option, profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::EthernetHeader::payload, profinet::PNDCPHeader::payload, payload, profinet::PROFINET_ETHERTYPE, profinet::Response, profinet::ResponseSuccess, profinet::ResponseUnsupported, profinet::PNDCPHeader::serviceType, profinet::wire::Reader::Skip(), suboption, profinet::EthernetHeader::type, profinet::wire::Reader::U16(), and profinet::VLAN_ETHERTYPE.

Referenced by RecvSetResponse(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

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

◆ ReadResponse()

ResponseMap profinet::dcp::ReadResponse ( IRawEthernetSocket &  sock,
const MacAddress &  myMac,
double  timeoutSec = DEFAULT_RESPONSE_TIMEOUT,
bool  once = false,
std::optional< std::uint32_t >  expectedXid = std::nullopt 
)

Read and parse DCP Identify responses.

Parameters
sockBound Ethernet socket to receive on.
myMacThis host's MAC address, used to filter responses addressed to us.
timeoutSecHow long to keep listening for responses.
onceIf true, return after the first response.
expectedXidIf set, only accept responses matching this transaction ID.
Returns
Map of responding devices to their parsed blocks.

Definition at line 1218 of file dcp.cpp.

References profinet::EthernetHeader::dst, profinet::PNDCPHeader::length, MakeBlockKey(), option, profinet::EthernetHeader::payload, profinet::PNDCPHeader::payload, payload, profinet::PROFINET_ETHERTYPE, ReadResponse(), profinet::IRawEthernetSocket::Recv(), profinet::PNDCPHeader::serviceType, profinet::IRawEthernetSocket::SetTimeout(), profinet::wire::Reader::Skip(), profinet::EthernetHeader::src, suboption, timer, profinet::EthernetHeader::type, profinet::wire::Reader::U16(), profinet::VLAN_ETHERTYPE, and profinet::PNDCPHeader::xId.

Referenced by profinet::device::ProfinetDevice::Discover(), profinet::device::ProfinetDevice::FromIp(), GetParam(), profinet::rpc::GetStationInfo(), ReadResponse(), profinet::device::DcpScanner::Scan(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST_F(), and TEST_F().

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

◆ ReceiveHello()

std::vector< DCPDeviceDescription > profinet::dcp::ReceiveHello ( IRawEthernetSocket &  sock,
const MacAddress &  myMac,
double  timeoutSec = DEFAULT_HELLO_TIMEOUT,
const std::function< void(const DCPDeviceDescription &)> &  callback = nullptr 
)

Listen for DCP Hello announcements from other devices.

Parameters
sockBound Ethernet socket to receive on.
myMacThis host's MAC address (currently unused for filtering; Hello is multicast).
timeoutSecHow long to keep listening.
callbackOptional callback invoked for each device as it's discovered.
Returns
All devices whose Hello announcements were received.

Definition at line 1424 of file dcp.cpp.

References option, profinet::EthernetHeader::payload, profinet::PNDCPHeader::payload, payload, profinet::PROFINET_ETHERTYPE, ReceiveHello(), profinet::IRawEthernetSocket::Recv(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::IRawEthernetSocket::SetTimeout(), profinet::wire::Reader::Skip(), profinet::EthernetHeader::src, suboption, timer, profinet::EthernetHeader::type, profinet::wire::Reader::U16(), and profinet::VLAN_ETHERTYPE.

Referenced by ReceiveHello(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

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

◆ RecvSetResponse()

DcpBlockError profinet::dcp::RecvSetResponse ( IRawEthernetSocket &  sock,
const MacAddress &  srcMac,
int  timeoutSec 
)

Receive and parse a DCP SET response, filtering out unrelated frames.

Parameters
sockRaw Ethernet socket used to receive frames.
srcMacDestination MAC address expected in the received response.
timeoutSecMaximum time in seconds to wait for a valid response.
Returns
DCP block error code.
Exceptions
DCPTimeoutErrorIf no valid DCP SET response is received before the timeout.
DCPErrorIf a matching frame contains an invalid DCP SET response.

Definition at line 253 of file dcp.cpp.

References profinet::EthernetHeader::dst, profinet::EthernetHeader::Parse(), ParseSetResponse(), profinet::EthernetHeader::payload, payload, profinet::PROFINET_ETHERTYPE, profinet::IRawEthernetSocket::Recv(), profinet::IRawEthernetSocket::SetTimeout(), profinet::wire::Reader::Skip(), timer, profinet::EthernetHeader::type, profinet::wire::Reader::U16(), and profinet::VLAN_ETHERTYPE.

Referenced by ResetToFactory(), SetIp(), SetParam(), SignalDevice(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

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

◆ ResetToFactory()

bool profinet::dcp::ResetToFactory ( IRawEthernetSocket &  sock,
const MacAddress &  src,
const std::string &  target,
DcpResetMode  mode = DcpResetMode::Communication,
double  timeoutSec = DEFAULT_TIMEOUT 
)

Reset a device to factory defaults.

Parameters
sockBound Ethernet socket to send/receive on.
srcSource MAC address to send from.
targetDestination device's MAC address, as a string.
modeReset mode bitmask (see RESET_MODE_* constants).
timeoutSecHow long to wait for a response.
Returns
True on success, false on timeout.

WARNING: destructive. This erases device configuration.

Definition at line 1541 of file dcp.cpp.

References profinet::PNDCPHeader::frameId, GetDcpBlockErrorDescription(), profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, RecvSetResponse(), ResetToFactory(), profinet::PNDCPHeader::respDelay, profinet::IRawEthernetSocket::Send(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::String2Mac(), profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by ResetToFactory().

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

◆ SendDiscover()

void profinet::dcp::SendDiscover ( IRawEthernetSocket &  sock,
const MacAddress &  src,
std::uint16_t  responseDelay = DEFAULT_RESPONSE_DELAY_FACTOR 
)

Send a DCP Identify multicast request to discover all devices on the segment.

Parameters
sockBound Ethernet socket to send on.
srcSource MAC address to send from.
responseDelayResponse delay factor controlling how devices stagger their replies.

Definition at line 1173 of file dcp.cpp.

References DCP_MULTICAST_MAC, profinet::PNDCPHeader::frameId, profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPHeader::respDelay, profinet::IRawEthernetSocket::Send(), SendDiscover(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::String2Mac(), profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by profinet::device::ProfinetDevice::Discover(), profinet::device::ProfinetDevice::FromIp(), profinet::rpc::GetStationInfo(), profinet::device::DcpScanner::Scan(), SendDiscover(), and TEST_F().

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

◆ SendHello()

void profinet::dcp::SendHello ( IRawEthernetSocket &  sock,
const MacAddress &  src,
const std::string &  stationName,
const std::string &  ip = "0.0.0.0",
const std::string &  netmask = "0.0.0.0",
const std::string &  gateway = "0.0.0.0",
std::pair< std::uint16_t, std::uint16_t >  deviceId = {0, 0},
DcpDeviceRole  deviceRole = DcpDeviceRole::IoDevice 
)

Send a DCP Hello multicast announcement (device self-announce after power-on).

Parameters
sockBound Ethernet socket to send on.
srcSource MAC address to send from.
stationNameStation name to announce.
ipIPv4 address to announce.
netmaskIPv4 subnet mask to announce.
gatewayIPv4 default gateway to announce.
deviceId(vendor_id, device_id) pair to announce.
deviceRoleDevice role bitmask to announce.

Definition at line 1342 of file dcp.cpp.

References DCP_HELLO_MULTICAST_MAC, profinet::PNDCPHeader::frameId, profinet::Ip2String(), profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, profinet::PNDCPHeader::respDelay, profinet::IRawEthernetSocket::Send(), SendHello(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::String2Mac(), profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), profinet::ToVec(), and profinet::PNDCPHeader::xId.

Referenced by SendHello(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

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

◆ SendRequest() [1/2]

void profinet::dcp::SendRequest ( IRawEthernetSocket &  sock,
const MacAddress &  src,
BlockKey  blockType,
const std::vector< std::uint8_t > &  value 
)

Send a DCP Identify request filtered to a specific (option, suboption).

Parameters
sockBound Ethernet socket to send on.
srcSource MAC address to send from.
blockType(option, suboption) pair to filter by.
valueFilter value to match.

Definition at line 1195 of file dcp.cpp.

References DCP_MULTICAST_MAC, profinet::PNDCPHeader::frameId, profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::DcpBlockKey::option, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, profinet::PNDCPHeader::respDelay, profinet::IRawEthernetSocket::Send(), SendRequest(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::String2Mac(), profinet::DcpBlockKey::suboption, profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by profinet::rpc::GetStationInfo(), SendRequest(), and TEST().

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

◆ SendRequest() [2/2]

void profinet::dcp::SendRequest ( IRawEthernetSocket &  sock,
const MacAddress &  src,
BlockKey  blockType,
const std::vector< std::uint8_t > &  value 
)

Send a DCP Identify request filtered to a specific (option, suboption).

Parameters
sockBound Ethernet socket to send on.
srcSource MAC address to send from.
blockType(option, suboption) pair to filter by.
valueFilter value to match.

Definition at line 1195 of file dcp.cpp.

References DCP_MULTICAST_MAC, profinet::PNDCPHeader::frameId, profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::DcpBlockKey::option, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, profinet::PNDCPHeader::respDelay, profinet::IRawEthernetSocket::Send(), SendRequest(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::String2Mac(), profinet::DcpBlockKey::suboption, profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by profinet::rpc::GetStationInfo(), SendRequest(), and TEST().

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

◆ SetIp()

bool profinet::dcp::SetIp ( IRawEthernetSocket &  sock,
const MacAddress &  src,
const std::string &  target,
const std::string &  ip,
const std::string &  netmask,
const std::string &  gateway,
bool  permanent = false,
int  timeoutSec = DEFAULT_TIMEOUT,
int  threadSleepMs = DEFAULT_THREAD_SLEEP_MS 
)

Set a device's IP configuration via DCP.

Parameters
sockBound Ethernet socket to send/receive on.
srcSource MAC address to send from.
targetDestination device's MAC address, as a string.
ipNew IPv4 address.
netmaskNew IPv4 subnet mask.
gatewayNew IPv4 default gateway.
permanentWhether the change should persist across power cycles.
timeoutSecHow long to wait for a response.
threadSleepMsThe time the thread should sleep atleast.
Returns
True on success, false on timeout.

Definition at line 1120 of file dcp.cpp.

References profinet::PNDCPHeader::frameId, GetDcpBlockErrorDescription(), profinet::Ip2String(), profinet::PNDCPHeader::length, profinet::PNDCPBlockRequest::length, profinet::macAddressLength, profinet::PNDCPBlockRequest::option, profinet::PNDCPHeader::payload, profinet::PNDCPBlockRequest::payload, RecvSetResponse(), profinet::PNDCPHeader::respDelay, profinet::IRawEthernetSocket::Send(), profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, SetIp(), profinet::String2Mac(), profinet::PNDCPBlockRequest::suboption, profinet::PNDCPBlockRequest::ToBytes(), and profinet::PNDCPHeader::xId.

Referenced by SetIp(), TEST(), TEST(), TEST(), TEST(), and TEST().

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

◆ SetParam()

bool profinet::dcp::SetParam ( IRawEthernetSocket &  sock,
const MacAddress &  src,
const std::string &  target,
const std::string &  param,
const std::string &  value,
int  timeoutSec = DEFAULT_TIMEOUT,
bool  permanent = false,
int  threadSleepMs = DEFAULT_THREAD_SLEEP_MS 
)

Write a named parameter to a device.

Parameters
sockBound Ethernet socket to send/receive on.
srcSource MAC address to send from.
targetDestination device's MAC address, as a string.
paramParameter name ("name" or "ip"); see Params().
valueNew value to write.
timeoutSecHow long to wait for a response.
permanentIf true, request permanent storage (survives power cycle); default writes a temporary value
threadSleepMsThe time the thread should sleep atleast.
Returns
True on success, false on timeout.

Throws DCPError on an unknown parameter, or if the device rejects the value; throws ValidationError if a station name exceeds DCP_MAX_NAME_LENGTH.

Definition at line 1096 of file dcp.cpp.

References BuildSetParamRequest(), frame, GetDcpBlockErrorDescription(), RecvSetResponse(), profinet::IRawEthernetSocket::Send(), SetParam(), and profinet::String2Mac().

Referenced by SetParam(), TEST(), TEST(), TEST(), and TEST().

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

◆ SignalDevice()

bool profinet::dcp::SignalDevice ( IRawEthernetSocket &  sock,
const MacAddress &  src,
const std::string &  target,
int  durationMs = FLASH_DURATION_MS,
double  timeoutSec = DEFAULT_TIMEOUT 
)

Flash a device's identification LEDs.

Parameters
sockBound Ethernet socket to send/receive on.
srcSource MAC address to send from.
targetDestination device's MAC address, as a string.
durationMsHow long the device should flash its LEDs, in milliseconds.
timeoutSecHow long to wait for a response. – Ignored; the spec defines only "flash once" and the device controls the blink pattern. Kept for API compatibility
Returns
True on success, false on timeout.

Definition at line 1519 of file dcp.cpp.

References BuildDcpSignalRequest(), frame, GetDcpBlockErrorDescription(), RecvSetResponse(), profinet::IRawEthernetSocket::Send(), SignalDevice(), and profinet::String2Mac().

Referenced by SignalDevice(), TEST(), TEST(), TEST(), and TEST().

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

◆ TEST() [1/182]

profinet::dcp::TEST ( DCPDeviceDescriptionTest  ,
ConstructorDecodesAllSupportedBlocks   
)
Test:
Verify DCPDeviceDescription decodes all supported DCP blocks into their corresponding fields.

Definition at line 1623 of file test_dcp.cpp.

References profinet::Alias, profinet::dcp::DCPDeviceDescription::aliasName, profinet::Device, profinet::dcp::DCPDeviceDescription::DeviceId(), profinet::DeviceId, profinet::dcp::DCPDeviceDescription::deviceInitiative, profinet::DeviceInitiative, profinet::dcp::DCPDeviceDescription::deviceInstance, profinet::dcp::DCPDeviceDescription::deviceRole, profinet::dcp::DCPDeviceDescription::deviceRoles, profinet::dcp::DCPDeviceDescription::deviceType, profinet::Dhcp, profinet::dcp::DCPDeviceDescription::dhcpBlocks, profinet::dcp::DCPDeviceDescription::gateway, profinet::Hostname, profinet::Initiative, profinet::Instance, profinet::IoController, profinet::IoDevice, profinet::dcp::DCPDeviceDescription::ip, profinet::Ip, profinet::dcp::DCPDeviceDescription::ipBlockInfo, profinet::dcp::DCPDeviceDescription::ipConflict, profinet::IpParameter, profinet::dcp::DCPDeviceDescription::ipSetByDhcp, profinet::IssueHello, profinet::dcp::DCPDeviceDescription::issuesHello, profinet::dcp::DCPDeviceDescription::mac, MakeBlockKey(), profinet::dcp::DCPDeviceDescription::name, profinet::Name, profinet::dcp::DCPDeviceDescription::netmask, profinet::Options, profinet::dcp::DCPDeviceDescription::rawBlocks, profinet::Role, profinet::SetByDhcpConflict, profinet::dcp::DCPDeviceDescription::supportedOptions, profinet::Type, and profinet::dcp::DCPDeviceDescription::VendorId().

+ Here is the call graph for this function:

◆ TEST() [2/182]

profinet::dcp::TEST ( DCPDeviceDescriptionTest  ,
ConstructorHandlesLegacyTwelveByteIpBlock   
)

◆ TEST() [3/182]

◆ TEST() [4/182]

profinet::dcp::TEST ( DCPDeviceDescriptionTest  ,
ConstructorUsesLegacyIpLayoutForThirteenByteBlock   
)
Test:
Verify DCPDeviceDescription uses the legacy IP layout for a 13-byte IP block.

Definition at line 1791 of file test_dcp.cpp.

References profinet::dcp::DCPDeviceDescription::gateway, profinet::dcp::DCPDeviceDescription::ip, profinet::Ip, profinet::dcp::DCPDeviceDescription::ipBlockInfo, profinet::IpParameter, MakeBlockKey(), profinet::dcp::DCPDeviceDescription::netmask, profinet::NotSet, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [5/182]

profinet::dcp::TEST ( DCPDeviceDescriptionTest  ,
ToStringFormatsDhcpBlockVariants   
)
Test:
Verify ToString formats multiple DHCP blocks and selects hostname, FQDN, UUID, and raw-data representations.

Definition at line 1597 of file test_dcp.cpp.

References profinet::Fqdn, profinet::Hostname, profinet::dcp::DCPDeviceDescription::name, profinet::dcp::DCPDHCPBlock::Parse(), profinet::String2Mac(), profinet::Uuid, and profinet::VendorSpec.

+ Here is the call graph for this function:

◆ TEST() [6/182]

profinet::dcp::TEST ( DCPDeviceDescriptionTest  ,
ToStringIncludesAllPopulatedFields   
)
Test:
Verify ToString includes all populated device description fields and formats lists and DHCP blocks correctly.

Definition at line 1527 of file test_dcp.cpp.

References profinet::ClientId, profinet::Dhcp, profinet::Fqdn, profinet::Hostname, profinet::Ip, profinet::IssueHello, profinet::Mac, MakeBlockKey(), profinet::dcp::DCPDeviceDescription::name, profinet::dcp::DCPDHCPBlock::Parse(), profinet::SetByDhcp, profinet::String2Mac(), and profinet::Uuid.

+ Here is the call graph for this function:

◆ TEST() [7/182]

profinet::dcp::TEST ( DCPDeviceDescriptionTest  ,
ToStringOmitsUnsetOptionalFields   
)
Test:
Verify ToString omits optional fields when they are empty or unset.

Definition at line 1577 of file test_dcp.cpp.

References profinet::dcp::DCPDeviceDescription::name, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [8/182]

profinet::dcp::TEST ( DcpTest  ,
BlockQualifierGetNamePermanent   
)
Test:
Verify BlockQualifier::GetName resolves the permanent qualifier.

Definition at line 670 of file test_dcp.cpp.

References GetDcpBlockQualifierDescription(), and profinet::Permanent.

+ Here is the call graph for this function:

◆ TEST() [9/182]

profinet::dcp::TEST ( DcpTest  ,
BlockQualifierGetNameTemporary   
)
Test:
Verify BlockQualifier::GetName resolves the temporary qualifier.

Definition at line 664 of file test_dcp.cpp.

References GetDcpBlockQualifierDescription(), and profinet::Temporary.

+ Here is the call graph for this function:

◆ TEST() [10/182]

profinet::dcp::TEST ( DcpTest  ,
BlockQualifierGetNameUnknown   
)
Test:
Verify BlockQualifier::GetName uses the hexadecimal fallback for an unknown qualifier.

Definition at line 676 of file test_dcp.cpp.

References GetDcpBlockQualifierDescription().

+ Here is the call graph for this function:

◆ TEST() [11/182]

profinet::dcp::TEST ( DcpTest  ,
BuildDcpSignalRequestBuildsCorrectWireFormat   
)
Test:
Verify BuildDcpSignalRequest creates a SET/Signal request with the expected control payload.

Definition at line 1920 of file test_dcp.cpp.

References BuildDcpSignalRequest(), profinet::Control, frame, profinet::GetSet, profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::PROFINET_ETHERTYPE, profinet::Request, profinet::Set, profinet::Signal, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [12/182]

profinet::dcp::TEST ( DcpTest  ,
BuildSetParamRequestAcceptsMaximumStationName   
)
Test:
Verify BuildSetParamRequest accepts a station name exactly at DCP_MAX_NAME_LENGTH.

Definition at line 1908 of file test_dcp.cpp.

References BuildSetParamRequest(), DCP_MAX_NAME_LENGTH, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [13/182]

profinet::dcp::TEST ( DcpTest  ,
BuildSetParamRequestBuildsPermanentEvenLengthName   
)
Test:
Verify BuildSetParamRequest creates a permanent SET request for an even-length station name without extra padding.

Definition at line 1850 of file test_dcp.cpp.

References BuildSetParamRequest(), frame, profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [14/182]

profinet::dcp::TEST ( DcpTest  ,
BuildSetParamRequestBuildsTemporaryOddLengthName   
)
Test:
Verify BuildSetParamRequest creates a temporary SET request for an odd-length station name and adds alignment padding.

Definition at line 1811 of file test_dcp.cpp.

References BuildSetParamRequest(), profinet::Device, frame, profinet::GetSet, profinet::Name, profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::PROFINET_ETHERTYPE, profinet::Request, profinet::Set, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [15/182]

profinet::dcp::TEST ( DcpTest  ,
BuildSetParamRequestRejectsIpParameter   
)
Test:
Verify BuildSetParamRequest rejects IP configuration through the string-valued SET interface.

Definition at line 1873 of file test_dcp.cpp.

References BuildSetParamRequest(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [16/182]

profinet::dcp::TEST ( DcpTest  ,
BuildSetParamRequestRejectsOverlongStationName   
)
Test:
Verify BuildSetParamRequest rejects station names exceeding DCP_MAX_NAME_LENGTH.

Definition at line 1895 of file test_dcp.cpp.

References BuildSetParamRequest(), DCP_MAX_NAME_LENGTH, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [17/182]

profinet::dcp::TEST ( DcpTest  ,
BuildSetParamRequestRejectsUnknownParameter   
)
Test:
Verify BuildSetParamRequest rejects unknown parameter names.

Definition at line 1884 of file test_dcp.cpp.

References BuildSetParamRequest(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [18/182]

profinet::dcp::TEST ( DcpTest  ,
DcpDhcpBlockKnownSuboptionNames   
)
Test:
Verify DCPDHCPBlock::Parse resolves all registered DHCP suboption names that do not have dedicated payload decoding.

Definition at line 911 of file test_dcp.cpp.

References profinet::dcp::DCPDHCPBlock::Parse().

+ Here is the call graph for this function:

◆ TEST() [19/182]

profinet::dcp::TEST ( DcpTest  ,
DcpDhcpBlockParseClientId   
)
Test:
Verify DCPDHCPBlock::Parse stores ClientID data without decoding it.

Definition at line 807 of file test_dcp.cpp.

References profinet::ClientId, and profinet::dcp::DCPDHCPBlock::Parse().

+ Here is the call graph for this function:

◆ TEST() [20/182]

profinet::dcp::TEST ( DcpTest  ,
DcpDhcpBlockParseEmptyFqdn   
)
Test:
Verify DCPDHCPBlock::Parse creates an empty FQDN when the FQDN payload is empty.

Definition at line 1516 of file test_dcp.cpp.

References profinet::Fqdn, and profinet::dcp::DCPDHCPBlock::Parse().

+ Here is the call graph for this function:

◆ TEST() [21/182]

profinet::dcp::TEST ( DcpTest  ,
DcpDhcpBlockParseEmptyHostname   
)
Test:
Verify DCPDHCPBlock::Parse creates an empty hostname when the hostname payload is empty.

Definition at line 1505 of file test_dcp.cpp.

References profinet::Hostname, and profinet::dcp::DCPDHCPBlock::Parse().

+ Here is the call graph for this function:

◆ TEST() [22/182]

profinet::dcp::TEST ( DcpTest  ,
DcpDhcpBlockParseFqdn   
)
Test:
Verify DCPDHCPBlock::Parse decodes an FQDN into an optional string.

Definition at line 837 of file test_dcp.cpp.

References profinet::Fqdn, and profinet::dcp::DCPDHCPBlock::Parse().

+ Here is the call graph for this function:

◆ TEST() [23/182]

profinet::dcp::TEST ( DcpTest  ,
DcpDhcpBlockParseHostname   
)
Test:
Verify DCPDHCPBlock::Parse decodes a Hostname suboption and preserves its raw payload.

Definition at line 791 of file test_dcp.cpp.

References profinet::Hostname, and profinet::dcp::DCPDHCPBlock::Parse().

+ Here is the call graph for this function:

◆ TEST() [24/182]

profinet::dcp::TEST ( DcpTest  ,
DcpDhcpBlockParseUnknownEnumValue   
)
Test:
Verify DCPDHCPBlock::Parse formats the Unknown DHCP suboption and preserves its payload.

Definition at line 1494 of file test_dcp.cpp.

References profinet::dcp::DCPDHCPBlock::Parse(), and profinet::Unknown.

+ Here is the call graph for this function:

◆ TEST() [25/182]

profinet::dcp::TEST ( DcpTest  ,
DcpDhcpBlockParseUnknownSuboption   
)
Test:
Verify DCPDHCPBlock::Parse uses the hexadecimal fallback for an unknown DHCP suboption.

Definition at line 882 of file test_dcp.cpp.

References profinet::dcp::DCPDHCPBlock::Parse().

+ Here is the call graph for this function:

◆ TEST() [26/182]

profinet::dcp::TEST ( DcpTest  ,
DcpDhcpBlockParseUnknownSuboptionEmptyPayload   
)
Test:
Verify DCPDHCPBlock::Parse preserves an empty payload for an unknown suboption.

Definition at line 897 of file test_dcp.cpp.

References profinet::dcp::DCPDHCPBlock::Parse().

+ Here is the call graph for this function:

◆ TEST() [27/182]

profinet::dcp::TEST ( DcpTest  ,
DcpDhcpBlockParseUuid   
)
Test:
Verify DCPDHCPBlock::Parse converts a complete 16-byte UUID into the expected hexadecimal representation.

Definition at line 852 of file test_dcp.cpp.

References profinet::dcp::DCPDHCPBlock::Parse(), and profinet::Uuid.

+ Here is the call graph for this function:

◆ TEST() [28/182]

profinet::dcp::TEST ( DcpTest  ,
DcpDhcpBlockParseUuidMinimumLength   
)
Test:
Verify DCPDHCPBlock::Parse accepts a UUID payload exactly at the minimum required length.

Definition at line 873 of file test_dcp.cpp.

References profinet::dcp::DCPDHCPBlock::Parse(), and profinet::Uuid.

+ Here is the call graph for this function:

◆ TEST() [29/182]

profinet::dcp::TEST ( DcpTest  ,
DcpDhcpBlockParseUuidTooShort   
)
Test:
Verify DCPDHCPBlock::Parse does not decode a UUID when the payload is shorter than 16 bytes.

Definition at line 863 of file test_dcp.cpp.

References profinet::dcp::DCPDHCPBlock::Parse(), and profinet::Uuid.

+ Here is the call graph for this function:

◆ TEST() [30/182]

profinet::dcp::TEST ( DcpTest  ,
DcpDhcpBlockParseVendorSpecific   
)
Test:
Verify DCPDHCPBlock::Parse stores vendor-specific data without decoding it.

Definition at line 822 of file test_dcp.cpp.

References profinet::dcp::DCPDHCPBlock::Parse(), and profinet::VendorSpec.

+ Here is the call graph for this function:

◆ TEST() [31/182]

profinet::dcp::TEST ( DcpTest  ,
DcpResponseCodeGetNameDefinedValues   
)
Test:
Verify DCPResponseCode::GetName resolves all defined response codes.

Definition at line 755 of file test_dcp.cpp.

References GetDcpResponseCodeName(), profinet::InOperationSetNotPossible, profinet::NoError, profinet::OptionNotSupported, profinet::ResourceError, profinet::SetNotPossible, profinet::SuboptionNotSet, and profinet::SuboptionNotSupported.

+ Here is the call graph for this function:

◆ TEST() [32/182]

profinet::dcp::TEST ( DcpTest  ,
DcpResponseCodeGetNameUnknown   
)
Test:
Verify DCPResponseCode::GetName uses the hexadecimal fallback for an unknown response code.

Definition at line 767 of file test_dcp.cpp.

References GetDcpResponseCodeName().

+ Here is the call graph for this function:

◆ TEST() [33/182]

profinet::dcp::TEST ( DcpTest  ,
DecodeDeviceRoleAllRoles   
)
Test:
Verify DecodeDeviceRole decodes all four supported role bits simultaneously.

Definition at line 569 of file test_dcp.cpp.

References DecodeDeviceRole(), profinet::IoController, profinet::IoDevice, profinet::IoMultidevice, and profinet::PnSupervisor.

+ Here is the call graph for this function:

◆ TEST() [34/182]

profinet::dcp::TEST ( DcpTest  ,
DecodeDeviceRoleIoController   
)
Test:
Verify DecodeDeviceRole decodes the IO-Controller role.

Definition at line 545 of file test_dcp.cpp.

References DecodeDeviceRole(), and profinet::IoController.

+ Here is the call graph for this function:

◆ TEST() [35/182]

profinet::dcp::TEST ( DcpTest  ,
DecodeDeviceRoleIoDevice   
)
Test:
Verify DecodeDeviceRole decodes the IO-Device role.

Definition at line 537 of file test_dcp.cpp.

References DecodeDeviceRole(), and profinet::IoDevice.

+ Here is the call graph for this function:

◆ TEST() [36/182]

profinet::dcp::TEST ( DcpTest  ,
DecodeDeviceRoleIoMultidevice   
)
Test:
Verify DecodeDeviceRole decodes the IO-Multidevice role.

Definition at line 553 of file test_dcp.cpp.

References DecodeDeviceRole(), and profinet::IoMultidevice.

+ Here is the call graph for this function:

◆ TEST() [37/182]

profinet::dcp::TEST ( DcpTest  ,
DecodeDeviceRolePnSupervisor   
)
Test:
Verify DecodeDeviceRole decodes the PN-Supervisor role.

Definition at line 561 of file test_dcp.cpp.

References DecodeDeviceRole(), and profinet::PnSupervisor.

+ Here is the call graph for this function:

◆ TEST() [38/182]

profinet::dcp::TEST ( DcpTest  ,
DecodeDeviceRoleUnknown   
)
Test:
Verify DecodeDeviceRole returns Unknown when no role bits are set.

Definition at line 529 of file test_dcp.cpp.

References DecodeDeviceRole().

+ Here is the call graph for this function:

◆ TEST() [39/182]

profinet::dcp::TEST ( DcpTest  ,
DeviceInitiativeIssueHello   
)
Test:
Verify DeviceInitiative::GetName resolves the ISSUE_HELLO value.

Definition at line 743 of file test_dcp.cpp.

References GetDeviceInitiativeName(), and profinet::IssueHello.

+ Here is the call graph for this function:

◆ TEST() [40/182]

profinet::dcp::TEST ( DcpTest  ,
DeviceInitiativeNoHello   
)
Test:
Verify DeviceInitiative::GetName resolves the NO_HELLO value.

Definition at line 737 of file test_dcp.cpp.

References GetDeviceInitiativeName(), and profinet::NoHello.

+ Here is the call graph for this function:

◆ TEST() [41/182]

profinet::dcp::TEST ( DcpTest  ,
DeviceInitiativeUnknown   
)
Test:
Verify DeviceInitiative::GetName uses the hexadecimal fallback for an unknown value.

Definition at line 749 of file test_dcp.cpp.

References GetDeviceInitiativeName().

+ Here is the call graph for this function:

◆ TEST() [42/182]

profinet::dcp::TEST ( DcpTest  ,
DeviceRoleBitwiseAndAbsent   
)
Test:
Verify DcpDeviceRole bitwise AND returns zero for a role flag that is absent.

Definition at line 1429 of file test_dcp.cpp.

References profinet::IoController, profinet::IoDevice, and profinet::PnSupervisor.

◆ TEST() [43/182]

profinet::dcp::TEST ( DcpTest  ,
DeviceRoleBitwiseAndPresent   
)
Test:
Verify DcpDeviceRole bitwise AND detects a role flag that is present.

Definition at line 1420 of file test_dcp.cpp.

References profinet::IoController, and profinet::IoDevice.

◆ TEST() [44/182]

profinet::dcp::TEST ( DcpTest  ,
DeviceRoleBitwiseOr   
)
Test:
Verify DcpDeviceRole bitwise OR combines role flags correctly.

Definition at line 1411 of file test_dcp.cpp.

References profinet::IoController, and profinet::IoDevice.

◆ TEST() [45/182]

profinet::dcp::TEST ( DcpTest  ,
DeviceRoleNameDefinedValues   
)
Test:
Verify DeviceRoleName returns the expected human-readable name for every supported role.

Definition at line 1302 of file test_dcp.cpp.

References DeviceRoleName(), profinet::IoController, profinet::IoDevice, profinet::IoMultidevice, and profinet::PnSupervisor.

+ Here is the call graph for this function:

◆ TEST() [46/182]

profinet::dcp::TEST ( DcpTest  ,
DeviceRoleNameUnknown   
)
Test:
Verify DeviceRoleName returns Unknown for an unsupported role value.

Definition at line 1311 of file test_dcp.cpp.

References DeviceRoleName().

+ Here is the call graph for this function:

◆ TEST() [47/182]

profinet::dcp::TEST ( DcpTest  ,
GetBlockNameDeviceInitiativeSuboption   
)
Test:
Verify GetBlockName resolves the Device Initiative suboption.

Definition at line 1342 of file test_dcp.cpp.

References profinet::DeviceInitiative, GetBlockName(), and profinet::Initiative.

+ Here is the call graph for this function:

◆ TEST() [48/182]

profinet::dcp::TEST ( DcpTest  ,
GetBlockNameKnownControlAndDeviceInitiativeSuboptions   
)
Test:
Verify GetBlockName resolves the known Control and DeviceInitiative suboptions.

Definition at line 593 of file test_dcp.cpp.

References profinet::Control, profinet::DeviceInitiative, GetBlockName(), profinet::Initiative, and profinet::Signal.

+ Here is the call graph for this function:

◆ TEST() [49/182]

profinet::dcp::TEST ( DcpTest  ,
GetBlockNameKnownDeviceAndDhcpSuboptions   
)
Test:
Verify GetBlockName resolves known Device and DHCP suboptions.

Definition at line 586 of file test_dcp.cpp.

References profinet::Device, profinet::Dhcp, GetBlockName(), profinet::Hostname, and profinet::Name.

+ Here is the call graph for this function:

◆ TEST() [50/182]

profinet::dcp::TEST ( DcpTest  ,
GetBlockNameKnownOptionAndSuboption   
)
Test:
Verify GetBlockName resolves a known option and known suboption.

Definition at line 580 of file test_dcp.cpp.

References GetBlockName(), profinet::Ip, and profinet::Mac.

+ Here is the call graph for this function:

◆ TEST() [51/182]

profinet::dcp::TEST ( DcpTest  ,
GetBlockNameKnownOptionUnknownSuboption   
)
Test:
Verify GetBlockName falls back to hexadecimal naming for an unknown suboption of a known option.

Definition at line 600 of file test_dcp.cpp.

References GetBlockName(), and profinet::Ip.

+ Here is the call graph for this function:

◆ TEST() [52/182]

profinet::dcp::TEST ( DcpTest  ,
GetBlockNameKnownOptionWithoutSuboptionTable   
)
Test:
Verify GetBlockName falls back to hexadecimal naming when the option has no suboption table.

Definition at line 606 of file test_dcp.cpp.

References GetBlockName(), and profinet::Reserved.

+ Here is the call graph for this function:

◆ TEST() [53/182]

profinet::dcp::TEST ( DcpTest  ,
GetBlockNameOptionsWithoutSuboptions   
)
Test:
Verify GetBlockName falls back correctly for DCP options without defined suboptions.

Definition at line 1327 of file test_dcp.cpp.

References profinet::All, GetBlockName(), profinet::Nme, profinet::Reserved, and profinet::Unknown.

+ Here is the call graph for this function:

◆ TEST() [54/182]

profinet::dcp::TEST ( DcpTest  ,
GetBlockNameUint16OptionOverload   
)
Test:
Verify the raw uint16_t option overload of GetBlockName supports vendor-specific options.

Definition at line 1336 of file test_dcp.cpp.

References GetBlockName().

+ Here is the call graph for this function:

◆ TEST() [55/182]

profinet::dcp::TEST ( DcpTest  ,
GetBlockNameUnknownOption   
)
Test:
Verify GetBlockName formats unknown non-vendor options using the Opt-XX fallback.

Definition at line 619 of file test_dcp.cpp.

References GetBlockName().

+ Here is the call graph for this function:

◆ TEST() [56/182]

profinet::dcp::TEST ( DcpTest  ,
GetBlockNameUnknownSuboptionForAllTypedOptionGroups   
)
Test:
Verify GetBlockName falls back to hexadecimal names for unsupported suboptions of every option family.

Definition at line 1317 of file test_dcp.cpp.

References profinet::Control, profinet::Device, profinet::DeviceInitiative, profinet::Dhcp, GetBlockName(), and profinet::Ip.

+ Here is the call graph for this function:

◆ TEST() [57/182]

profinet::dcp::TEST ( DcpTest  ,
GetBlockNameVendorOption   
)
Test:
Verify GetBlockName formats vendor-specific options from 0x80 through 0xFE as Vendor-XX.

Definition at line 612 of file test_dcp.cpp.

References GetBlockName().

+ Here is the call graph for this function:

◆ TEST() [58/182]

profinet::dcp::TEST ( DcpTest  ,
GetDcpBlockErrorNameDefinedValues   
)
Test:
Verify GetDcpBlockErrorName resolves all defined block error codes.

Definition at line 773 of file test_dcp.cpp.

References GetDcpBlockErrorDescription(), profinet::InOperation, profinet::Ok, profinet::OptionUnsupported, profinet::Resource, profinet::SetNotPossible, profinet::SuboptionNotSet, and profinet::SuboptionUnsupported.

+ Here is the call graph for this function:

◆ TEST() [59/182]

profinet::dcp::TEST ( DcpTest  ,
GetDcpBlockErrorNameUnknown   
)
Test:
Verify GetDcpBlockErrorName uses the hexadecimal fallback for an unknown block error.

Definition at line 785 of file test_dcp.cpp.

References GetDcpBlockErrorDescription().

+ Here is the call graph for this function:

◆ TEST() [60/182]

profinet::dcp::TEST ( DcpTest  ,
GetParamReturnsMatchingParameter   
)
Test:
GetParam returns the payload from the matching response block.

Definition at line 1982 of file test_dcp.cpp.

References GetParam(), profinet::Mac2String(), profinet::DcpBlockKey::option, Params(), profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::EthernetHeader::payload, profinet::String2Mac(), profinet::DcpBlockKey::suboption, and profinet::PNDCPHeader::xId.

+ Here is the call graph for this function:

◆ TEST() [61/182]

profinet::dcp::TEST ( DcpTest  ,
GetParamReturnsNulloptOnTimeout   
)
Test:
GetParam returns no value when ReadResponse receives no response.

Definition at line 2071 of file test_dcp.cpp.

References GetParam(), profinet::Mac2String(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [62/182]

profinet::dcp::TEST ( DcpTest  ,
GetParamReturnsNulloptWhenParameterIsMissing   
)
Test:
GetParam returns no value when the response does not contain the requested block.

Definition at line 2028 of file test_dcp.cpp.

References profinet::Device, GetParam(), profinet::Mac2String(), profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::EthernetHeader::payload, profinet::String2Mac(), profinet::Type, and profinet::PNDCPHeader::xId.

+ Here is the call graph for this function:

◆ TEST() [63/182]

profinet::dcp::TEST ( DcpTest  ,
GetParamSendsCorrectGetRequest   
)

◆ TEST() [64/182]

profinet::dcp::TEST ( DcpTest  ,
GetParamThrowsForUnknownParameter   
)
Test:
GetParam throws when the requested parameter does not exist.

Definition at line 1971 of file test_dcp.cpp.

References GetParam(), profinet::Mac2String(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [65/182]

profinet::dcp::TEST ( DcpTest  ,
IpBlockInfoBitHelpersHandleUnknownCombinations   
)
Test:
Verify IP block status bit helpers correctly handle combined status bits.

Definition at line 1463 of file test_dcp.cpp.

References HasConflict(), and IsDhcp().

+ Here is the call graph for this function:

◆ TEST() [66/182]

profinet::dcp::TEST ( DcpTest  ,
IpBlockInfoGetNameDefinedValues   
)
Test:
Verify IPBlockInfo::GetName resolves every defined IP status.

Definition at line 626 of file test_dcp.cpp.

References GetIPBlockInfoName(), profinet::NotSet, profinet::NotSetConflict, profinet::Set, profinet::SetByDhcp, profinet::SetByDhcpConflict, and profinet::SetConflict.

+ Here is the call graph for this function:

◆ TEST() [67/182]

profinet::dcp::TEST ( DcpTest  ,
IpBlockInfoGetNameUnknown   
)
Test:
Verify IPBlockInfo::GetName uses the hexadecimal fallback for an unknown status.

Definition at line 637 of file test_dcp.cpp.

References GetIPBlockInfoName().

+ Here is the call graph for this function:

◆ TEST() [68/182]

profinet::dcp::TEST ( DcpTest  ,
IpBlockInfoHasConflict   
)
Test:
Verify IPBlockInfo::HasConflict distinguishes conflicting and non-conflicting status values.

Definition at line 643 of file test_dcp.cpp.

References HasConflict(), profinet::NotSet, profinet::NotSetConflict, profinet::Set, profinet::SetByDhcpConflict, and profinet::SetConflict.

+ Here is the call graph for this function:

◆ TEST() [69/182]

profinet::dcp::TEST ( DcpTest  ,
IpBlockInfoIsDhcp   
)
Test:
Verify IPBlockInfo::IsDhcp distinguishes DHCP and non-DHCP status values.

Definition at line 653 of file test_dcp.cpp.

References IsDhcp(), profinet::NotSet, profinet::NotSetConflict, profinet::Set, profinet::SetByDhcp, profinet::SetByDhcpConflict, and profinet::SetConflict.

+ Here is the call graph for this function:

◆ TEST() [70/182]

profinet::dcp::TEST ( DcpTest  ,
MakeBlockKeyControlSuboption   
)
Test:
Verify MakeBlockKey supports DCP Control suboptions.

Definition at line 1384 of file test_dcp.cpp.

References profinet::Control, MakeBlockKey(), and profinet::Signal.

+ Here is the call graph for this function:

◆ TEST() [71/182]

profinet::dcp::TEST ( DcpTest  ,
MakeBlockKeyDeviceInitiativeSuboption   
)
Test:
Verify MakeBlockKey supports DCP Device Initiative suboptions.

Definition at line 1402 of file test_dcp.cpp.

References profinet::DeviceInitiative, profinet::Initiative, and MakeBlockKey().

+ Here is the call graph for this function:

◆ TEST() [72/182]

profinet::dcp::TEST ( DcpTest  ,
MakeBlockKeyDeviceSuboption   
)
Test:
Verify MakeBlockKey supports DCP Device suboptions.

Definition at line 1375 of file test_dcp.cpp.

References profinet::Device, MakeBlockKey(), and profinet::Role.

+ Here is the call graph for this function:

◆ TEST() [73/182]

profinet::dcp::TEST ( DcpTest  ,
MakeBlockKeyDhcpSuboption   
)
Test:
Verify MakeBlockKey supports DCP DHCP suboptions.

Definition at line 1393 of file test_dcp.cpp.

References profinet::Dhcp, profinet::Hostname, and MakeBlockKey().

+ Here is the call graph for this function:

◆ TEST() [74/182]

profinet::dcp::TEST ( DcpTest  ,
MakeBlockKeyGenericSuboption   
)
Test:
Verify MakeBlockKey supports the generic DcpOption/uint8_t overload.

Definition at line 1357 of file test_dcp.cpp.

References profinet::Device, MakeBlockKey(), and profinet::Name.

+ Here is the call graph for this function:

◆ TEST() [75/182]

profinet::dcp::TEST ( DcpTest  ,
MakeBlockKeyIpSuboption   
)
Test:
Verify MakeBlockKey supports DCP IP suboptions.

Definition at line 1366 of file test_dcp.cpp.

References profinet::Ip, profinet::Mac, and MakeBlockKey().

+ Here is the call graph for this function:

◆ TEST() [76/182]

profinet::dcp::TEST ( DcpTest  ,
MakeBlockKeyRawOption   
)
Test:
Verify MakeBlockKey supports the raw uint16_t option overload.

Definition at line 1348 of file test_dcp.cpp.

References profinet::Device, MakeBlockKey(), and profinet::Name.

+ Here is the call graph for this function:

◆ TEST() [77/182]

profinet::dcp::TEST ( DcpTest  ,
ParamsContainsSupportedParameters   
)
Test:
Verify Params contains the supported name and IP parameter mappings.

Definition at line 1956 of file test_dcp.cpp.

References profinet::Device, profinet::Ip, profinet::IpParameter, profinet::Name, and Params().

+ Here is the call graph for this function:

◆ TEST() [78/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseAcceptsVlanFrame   
)
Test:
Verify ParseSetResponse accepts a VLAN-tagged PROFINET response.

Definition at line 943 of file test_dcp.cpp.

References profinet::Ok, ParseSetResponse(), and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [79/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseEmptyResponseBlockReturnsSuccess   
)
Test:
Verify ParseSetResponse keeps success when a Control/Response block has an empty payload.

Definition at line 1035 of file test_dcp.cpp.

References profinet::Control, profinet::Ok, ParseSetResponse(), profinet::Response, and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [80/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseExtractsShortBlockError   
)
Test:
Verify ParseSetResponse extracts a block error from a one-byte Control/Response payload.

Definition at line 1021 of file test_dcp.cpp.

References profinet::Control, ParseSetResponse(), profinet::Response, profinet::ResponseSuccess, and profinet::SetNotPossible.

+ Here is the call graph for this function:

◆ TEST() [81/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseExtractsThreeByteBlockError   
)
Test:
Verify ParseSetResponse extracts a block error from a Control/Response block with a three-byte payload.

Definition at line 1005 of file test_dcp.cpp.

References profinet::Control, ParseSetResponse(), profinet::Resource, profinet::Response, and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [82/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseRejectsMalformedDcpHeader   
)
Test:
Verify ParseSetResponse reports malformed DCP headers.

Definition at line 973 of file test_dcp.cpp.

References ParseSetResponse(), profinet::PROFINET_ETHERTYPE, and profinet::wire::PutBigEndian().

+ Here is the call graph for this function:

◆ TEST() [83/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseRejectsMalformedEthernetHeader   
)
Test:
Verify ParseSetResponse reports malformed Ethernet headers.

Definition at line 925 of file test_dcp.cpp.

References ParseSetResponse().

+ Here is the call graph for this function:

◆ TEST() [84/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseRejectsShortVlanFrame   
)
Test:
Verify ParseSetResponse rejects VLAN frames without a complete VLAN header.

Definition at line 932 of file test_dcp.cpp.

References ParseSetResponse(), profinet::wire::PutBigEndian(), and profinet::VLAN_ETHERTYPE.

+ Here is the call graph for this function:

◆ TEST() [85/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseRejectsTooShortFrame   
)
Test:
Verify ParseSetResponse rejects frames shorter than the minimum Ethernet/DCP response size.

Definition at line 919 of file test_dcp.cpp.

References ParseSetResponse().

+ Here is the call graph for this function:

◆ TEST() [86/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseRejectsUnexpectedEtherType   
)
Test:
Verify ParseSetResponse rejects non-PROFINET Ethernet frames.

Definition at line 963 of file test_dcp.cpp.

References ParseSetResponse().

+ Here is the call graph for this function:

◆ TEST() [87/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseRejectsUnexpectedService   
)
Test:
Verify ParseSetResponse rejects an unexpected DCP response service type.

Definition at line 991 of file test_dcp.cpp.

References ParseSetResponse(), and payload.

+ Here is the call graph for this function:

◆ TEST() [88/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseRejectsUnexpectedVlanInnerEtherType   
)
Test:
Verify ParseSetResponse rejects VLAN frames with an unexpected inner EtherType.

Definition at line 949 of file test_dcp.cpp.

References ParseSetResponse(), profinet::wire::PutBigEndian(), and profinet::VLAN_ETHERTYPE.

+ Here is the call graph for this function:

◆ TEST() [89/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseRejectsUnsupportedService   
)
Test:
Verify ParseSetResponse rejects the DCP service-not-supported response.

Definition at line 984 of file test_dcp.cpp.

References ParseSetResponse(), payload, and profinet::ResponseUnsupported.

+ Here is the call graph for this function:

◆ TEST() [90/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseSkipsNonResponseBlocks   
)
Test:
Verify ParseSetResponse ignores blocks preceding the Control/Response block.

Definition at line 1044 of file test_dcp.cpp.

References profinet::Control, profinet::Device, profinet::InOperation, profinet::Name, ParseSetResponse(), profinet::Response, and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [91/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseUsesFirstResponseBlock   
)
Test:
Verify ParseSetResponse uses only the first Control/Response block.

Definition at line 1068 of file test_dcp.cpp.

References profinet::Control, profinet::Ok, ParseSetResponse(), profinet::Resource, profinet::Response, and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [92/182]

profinet::dcp::TEST ( DcpTest  ,
ParseSetResponseWithoutResponseBlockReturnsSuccess   
)
Test:
Verify ParseSetResponse returns success when no Control/Response block is present.

Definition at line 998 of file test_dcp.cpp.

References profinet::Ok, ParseSetResponse(), and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [93/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseAcceptsAnyXidWhenExpectedXidIsNotSpecified   
)
Test:
ReadResponse accepts a response without an expected XID filter.

Definition at line 2465 of file test_dcp.cpp.

References profinet::Device, frame, profinet::Name, profinet::DcpBlockKey::option, ReadResponse(), profinet::ResponseSuccess, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [94/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseContinuesAfterIgnoredFrames   
)
Test:
ReadResponse ignores a DCP request frame and continues until a valid response arrives.

Definition at line 2952 of file test_dcp.cpp.

References profinet::Device, profinet::Get, profinet::GetSet, profinet::Name, profinet::DcpBlockKey::option, ReadResponse(), profinet::Request, profinet::ResponseSuccess, profinet::ResponseUnsupported, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [95/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseIgnoresEmptyData   
)
Test:
ReadResponse ignores empty Ethernet data.

Definition at line 2532 of file test_dcp.cpp.

References ReadResponse(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [96/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseIgnoresMalformedDcpHeader   
)
Test:
ReadResponse ignores frames for which DCP header parsing fails.

Definition at line 2693 of file test_dcp.cpp.

References profinet::EthernetHeader::dst, frame, profinet::EthernetHeader::payload, profinet::PROFINET_ETHERTYPE, ReadResponse(), profinet::EthernetHeader::src, profinet::String2Mac(), profinet::EthernetHeader::ToBytes(), and profinet::EthernetHeader::type.

+ Here is the call graph for this function:

◆ TEST() [97/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseIgnoresMalformedEthernetFrame   
)
Test:
ReadResponse ignores frames for which EthernetHeader parsing fails.

Definition at line 2567 of file test_dcp.cpp.

References ReadResponse(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [98/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseIgnoresShortEthernetFrame   
)
Test:
ReadResponse ignores Ethernet frames shorter than the minimum Ethernet header.

Definition at line 2549 of file test_dcp.cpp.

References ReadResponse(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [99/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseIgnoresShortVlanPayload   
)
Test:
ReadResponse ignores VLAN frames without a complete VLAN header.

Definition at line 2612 of file test_dcp.cpp.

References profinet::EthernetHeader::dst, frame, profinet::EthernetHeader::payload, ReadResponse(), profinet::EthernetHeader::src, profinet::String2Mac(), profinet::EthernetHeader::ToBytes(), profinet::EthernetHeader::type, and profinet::VLAN_ETHERTYPE.

+ Here is the call graph for this function:

◆ TEST() [100/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseIgnoresUnexpectedXid   
)
Test:
ReadResponse ignores a valid response when its XID does not match.

Definition at line 2499 of file test_dcp.cpp.

References profinet::Device, frame, profinet::Name, profinet::DcpBlockKey::option, ReadResponse(), profinet::ResponseSuccess, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [101/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseIgnoresUnsuccessfulServiceType   
)
Test:
ReadResponse ignores DCP responses that are not successful.

Definition at line 2720 of file test_dcp.cpp.

References frame, ReadResponse(), profinet::ResponseUnsupported, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [102/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseIgnoresWrongDestination   
)
Test:
ReadResponse ignores frames addressed to a different destination MAC.

Definition at line 2585 of file test_dcp.cpp.

References frame, ReadResponse(), profinet::ResponseSuccess, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [103/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseIgnoresWrongEtherType   
)
Test:
ReadResponse ignores untagged Ethernet frames with a non-PROFINET EtherType.

Definition at line 2666 of file test_dcp.cpp.

References profinet::EthernetHeader::dst, frame, profinet::EthernetHeader::payload, ReadResponse(), profinet::EthernetHeader::src, profinet::String2Mac(), profinet::EthernetHeader::ToBytes(), and profinet::EthernetHeader::type.

+ Here is the call graph for this function:

◆ TEST() [104/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseIgnoresWrongVlanInnerEtherType   
)
Test:
ReadResponse ignores VLAN frames whose inner EtherType is not PROFINET.

Definition at line 2639 of file test_dcp.cpp.

References frame, ReadResponse(), profinet::ResponseSuccess, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [105/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseLimitsBlockRegionToDcpLength   
)
Test:
ReadResponse uses only the number of bytes declared by DCP length.

Definition at line 2820 of file test_dcp.cpp.

References profinet::Device, frame, profinet::Name, profinet::DcpBlockKey::option, payload, ReadResponse(), profinet::ResponseSuccess, profinet::String2Mac(), and profinet::Type.

+ Here is the call graph for this function:

◆ TEST() [106/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseParsesValidVlanResponse   
)
Test:
ReadResponse parses a VLAN-tagged PROFINET response.

Definition at line 2746 of file test_dcp.cpp.

References profinet::Device, frame, profinet::Name, profinet::DcpBlockKey::option, ReadResponse(), profinet::ResponseSuccess, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [107/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseProcessesMultipleResponsesWhenOnceIsFalse   
)
Test:
ReadResponse processes multiple responses when once is false.

Definition at line 2870 of file test_dcp.cpp.

References profinet::Device, profinet::Name, profinet::DcpBlockKey::option, ReadResponse(), profinet::ResponseSuccess, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [108/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseReturnsEmptyMapOnTimeout   
)
Test:
ReadResponse returns an empty map when the timeout expires without a valid response.

Definition at line 3018 of file test_dcp.cpp.

References ReadResponse(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [109/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseReturnsValidResponse   
)
Test:
ReadResponse parses a valid response and returns its blocks indexed by source MAC.

Definition at line 2422 of file test_dcp.cpp.

References profinet::Device, frame, profinet::Name, profinet::DcpBlockKey::option, ReadResponse(), profinet::ResponseSuccess, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [110/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseSetsExpectedSocketTimeout   
)
Test:
ReadResponse sets the socket timeout before receiving responses.

Definition at line 2409 of file test_dcp.cpp.

References ReadResponse(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [111/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseStopsAfterFirstValidResponseWhenOnceIsTrue   
)
Test:
ReadResponse stops after the first valid response when once is true.

Definition at line 2918 of file test_dcp.cpp.

References profinet::Device, frame, profinet::Name, profinet::DcpBlockKey::option, ReadResponse(), profinet::ResponseSuccess, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [112/182]

profinet::dcp::TEST ( DcpTest  ,
ReadResponseUsesEmptyBlockRegionForShortDcpLength   
)
Test:
ReadResponse ignores the block list when the DCP length is six bytes or less.

Definition at line 2781 of file test_dcp.cpp.

References profinet::Device, frame, profinet::Name, profinet::DcpBlockKey::option, ReadResponse(), profinet::ResponseSuccess, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [113/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloContinuesAfterIgnoredFrame   
)
Test:
ReceiveHello continues receiving after an ignored frame.

Definition at line 3772 of file test_dcp.cpp.

References profinet::Device, profinet::Get, profinet::Hello, profinet::Name, ReceiveHello(), profinet::Request, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [114/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloDoesNotInvokeEmptyCallback   
)
Test:
ReceiveHello does not invoke an empty callback.

Definition at line 3466 of file test_dcp.cpp.

References profinet::Device, frame, profinet::Hello, profinet::Name, payload, ReceiveHello(), profinet::Request, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [115/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloIgnoresEmptyData   
)
Test:
ReceiveHello ignores empty data.

Definition at line 3526 of file test_dcp.cpp.

References ReceiveHello(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [116/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloIgnoresMalformedDcpHeader   
)
Test:
ReceiveHello ignores frames whose DCP header cannot be parsed.

Definition at line 3687 of file test_dcp.cpp.

References profinet::EthernetHeader::dst, frame, profinet::EthernetHeader::payload, profinet::PROFINET_ETHERTYPE, ReceiveHello(), profinet::EthernetHeader::src, profinet::String2Mac(), profinet::EthernetHeader::ToBytes(), and profinet::EthernetHeader::type.

+ Here is the call graph for this function:

◆ TEST() [117/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloIgnoresMalformedEthernetFrame   
)
Test:
ReceiveHello ignores frames that cannot be parsed as Ethernet frames.

Definition at line 3562 of file test_dcp.cpp.

References ReceiveHello(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [118/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloIgnoresNonHelloServiceId   
)
Test:
ReceiveHello ignores DCP messages that are not Hello messages.

Definition at line 3714 of file test_dcp.cpp.

References profinet::Device, frame, profinet::Get, profinet::Name, payload, ReceiveHello(), profinet::Request, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [119/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloIgnoresNonRequestServiceType   
)
Test:
ReceiveHello ignores Hello messages that are not requests.

Definition at line 3743 of file test_dcp.cpp.

References profinet::Device, frame, profinet::Hello, profinet::Name, payload, ReceiveHello(), profinet::ResponseSuccess, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [120/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloIgnoresShortEthernetFrame   
)
Test:
ReceiveHello ignores Ethernet frames shorter than the minimum Ethernet header.

Definition at line 3544 of file test_dcp.cpp.

References ReceiveHello(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [121/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloIgnoresShortPnioPayload   
)
Test:
ReceiveHello ignores frames whose PROFINET payload is too short for a DCP header.

Definition at line 3660 of file test_dcp.cpp.

References profinet::EthernetHeader::dst, frame, profinet::EthernetHeader::payload, profinet::PROFINET_ETHERTYPE, ReceiveHello(), profinet::EthernetHeader::src, profinet::String2Mac(), profinet::EthernetHeader::ToBytes(), and profinet::EthernetHeader::type.

+ Here is the call graph for this function:

◆ TEST() [122/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloIgnoresShortVlanPayload   
)
Test:
ReceiveHello ignores VLAN frames with an incomplete VLAN header.

Definition at line 3580 of file test_dcp.cpp.

References profinet::EthernetHeader::dst, frame, profinet::EthernetHeader::payload, ReceiveHello(), profinet::EthernetHeader::src, profinet::String2Mac(), profinet::EthernetHeader::ToBytes(), profinet::EthernetHeader::type, and profinet::VLAN_ETHERTYPE.

+ Here is the call graph for this function:

◆ TEST() [123/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloIgnoresWrongEtherType   
)
Test:
ReceiveHello ignores untagged frames with a non-PROFINET EtherType.

Definition at line 3633 of file test_dcp.cpp.

References profinet::EthernetHeader::dst, frame, profinet::EthernetHeader::payload, ReceiveHello(), profinet::EthernetHeader::src, profinet::String2Mac(), profinet::EthernetHeader::ToBytes(), and profinet::EthernetHeader::type.

+ Here is the call graph for this function:

◆ TEST() [124/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloIgnoresWrongVlanInnerEtherType   
)
Test:
ReceiveHello ignores VLAN frames whose inner EtherType is not PROFINET.

Definition at line 3607 of file test_dcp.cpp.

References frame, profinet::Hello, ReceiveHello(), profinet::Request, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [125/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloInvokesCallbackForValidDevice   
)
Test:
ReceiveHello invokes the callback for every valid Hello response.

Definition at line 3425 of file test_dcp.cpp.

References profinet::Device, frame, profinet::Hello, profinet::dcp::DCPDeviceDescription::mac, profinet::Mac2String(), profinet::dcp::DCPDeviceDescription::name, profinet::Name, payload, ReceiveHello(), profinet::Request, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [126/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloParsesValidVlanHello   
)
Test:
ReceiveHello accepts a VLAN-tagged PROFINET Hello frame.

Definition at line 3495 of file test_dcp.cpp.

References profinet::Device, frame, profinet::Hello, profinet::Mac2String(), profinet::Name, payload, ReceiveHello(), profinet::Request, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [127/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloReturnsEmptyOnTimeout   
)
Test:
ReceiveHello returns no devices when the timeout expires.

Definition at line 3856 of file test_dcp.cpp.

References ReceiveHello(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [128/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloReturnsMultipleDevices   
)
Test:
ReceiveHello returns all valid devices received before the timeout.

Definition at line 3809 of file test_dcp.cpp.

References profinet::Device, profinet::Hello, profinet::Mac2String(), profinet::Name, ReceiveHello(), profinet::Request, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [129/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloReturnsValidDevice   
)
Test:
ReceiveHello parses a valid Hello request into a device description.

Definition at line 3361 of file test_dcp.cpp.

References profinet::Device, profinet::DeviceId, frame, profinet::Hello, profinet::IoDevice, profinet::Ip, profinet::IpParameter, profinet::Mac2String(), profinet::Name, payload, ReceiveHello(), profinet::Request, profinet::Role, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [130/182]

profinet::dcp::TEST ( DcpTest  ,
ReceiveHelloSetsExpectedSocketTimeout   
)
Test:
ReceiveHello sets the socket timeout before receiving Hello frames.

Definition at line 3347 of file test_dcp.cpp.

References ReceiveHello(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [131/182]

profinet::dcp::TEST ( DcpTest  ,
RecvSetResponseAcceptsVlanResponse   
)
Test:
Verify RecvSetResponse accepts a VLAN-tagged PROFINET SET response.

Definition at line 1224 of file test_dcp.cpp.

References profinet::Ok, RecvSetResponse(), and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [132/182]

profinet::dcp::TEST ( DcpTest  ,
RecvSetResponseIgnoresEmptyFrame   
)
Test:
Verify RecvSetResponse ignores empty received frames.

Definition at line 1104 of file test_dcp.cpp.

References profinet::Ok, RecvSetResponse(), and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [133/182]

profinet::dcp::TEST ( DcpTest  ,
RecvSetResponseIgnoresMalformedEthernetFrame   
)
Test:
Verify RecvSetResponse ignores frames with malformed Ethernet headers.

Definition at line 1134 of file test_dcp.cpp.

References profinet::Ok, RecvSetResponse(), and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [134/182]

profinet::dcp::TEST ( DcpTest  ,
RecvSetResponseIgnoresShortFrame   
)
Test:
Verify RecvSetResponse ignores frames shorter than an Ethernet header.

Definition at line 1119 of file test_dcp.cpp.

References profinet::Ok, RecvSetResponse(), and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [135/182]

profinet::dcp::TEST ( DcpTest  ,
RecvSetResponseIgnoresShortVlanPayload   
)
Test:
Verify RecvSetResponse ignores VLAN frames that do not contain a complete VLAN header.

Definition at line 1167 of file test_dcp.cpp.

References profinet::Ok, profinet::wire::PutBigEndian(), profinet::wire::PutFixed(), RecvSetResponse(), profinet::ResponseSuccess, and profinet::VLAN_ETHERTYPE.

+ Here is the call graph for this function:

◆ TEST() [136/182]

profinet::dcp::TEST ( DcpTest  ,
RecvSetResponseIgnoresUnexpectedServiceType   
)
Test:
Verify RecvSetResponse ignores valid DCP responses with an unexpected service type.

Definition at line 1239 of file test_dcp.cpp.

References profinet::Ok, RecvSetResponse(), and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [137/182]

profinet::dcp::TEST ( DcpTest  ,
RecvSetResponseIgnoresWrongDestinationMac   
)
Test:
Verify RecvSetResponse ignores frames addressed to a different destination MAC.

Definition at line 1150 of file test_dcp.cpp.

References profinet::Ok, RecvSetResponse(), and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [138/182]

profinet::dcp::TEST ( DcpTest  ,
RecvSetResponseIgnoresWrongEtherType   
)
Test:
Verify RecvSetResponse ignores frames with an unexpected Ethernet EtherType.

Definition at line 1206 of file test_dcp.cpp.

References profinet::Ok, RecvSetResponse(), and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [139/182]

profinet::dcp::TEST ( DcpTest  ,
RecvSetResponseIgnoresWrongVlanInnerEtherType   
)
Test:
Verify RecvSetResponse ignores VLAN frames with an unexpected inner EtherType.

Definition at line 1188 of file test_dcp.cpp.

References profinet::Ok, RecvSetResponse(), and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [140/182]

profinet::dcp::TEST ( DcpTest  ,
RecvSetResponsePropagatesDcpError   
)
Test:
Verify RecvSetResponse propagates DCP errors other than an unexpected service type.

Definition at line 1255 of file test_dcp.cpp.

References RecvSetResponse(), and profinet::ResponseUnsupported.

+ Here is the call graph for this function:

◆ TEST() [141/182]

profinet::dcp::TEST ( DcpTest  ,
RecvSetResponseReturnsBlockError   
)
Test:
Verify RecvSetResponse returns the block error from a valid SET response.

Definition at line 1268 of file test_dcp.cpp.

References profinet::Control, profinet::InOperation, RecvSetResponse(), profinet::Response, and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [142/182]

profinet::dcp::TEST ( DcpTest  ,
RecvSetResponseReturnsSuccessfulResponse   
)
Test:
Verify RecvSetResponse configures the socket timeout and returns a successful SET response.

Definition at line 1091 of file test_dcp.cpp.

References profinet::Ok, RecvSetResponse(), and profinet::ResponseSuccess.

+ Here is the call graph for this function:

◆ TEST() [143/182]

profinet::dcp::TEST ( DcpTest  ,
RecvSetResponseTimesOut   
)
Test:
Verify RecvSetResponse throws DCPTimeoutError when no usable response is received before timeout.

Definition at line 1290 of file test_dcp.cpp.

References RecvSetResponse().

+ Here is the call graph for this function:

◆ TEST() [144/182]

profinet::dcp::TEST ( DcpTest  ,
ResetModeBitwiseAndAbsent   
)
Test:
Verify DcpResetMode bitwise AND returns zero for a reset mode flag that is absent.

Definition at line 1455 of file test_dcp.cpp.

References profinet::Application, profinet::Communication, and profinet::Factory.

◆ TEST() [145/182]

profinet::dcp::TEST ( DcpTest  ,
ResetModeBitwiseAndPresent   
)
Test:
Verify DcpResetMode bitwise AND detects a reset mode flag that is present.

Definition at line 1447 of file test_dcp.cpp.

References profinet::Application, and profinet::Communication.

◆ TEST() [146/182]

profinet::dcp::TEST ( DcpTest  ,
ResetModeBitwiseOr   
)
Test:
Verify DcpResetMode bitwise OR combines reset mode flags correctly.

Definition at line 1438 of file test_dcp.cpp.

References profinet::Application, and profinet::Communication.

◆ TEST() [147/182]

profinet::dcp::TEST ( DcpTest  ,
ResetQualifierAllStoredData   
)
Test:
Verify ResetQualifier::GetName resolves both all-stored-data reset values.

Definition at line 703 of file test_dcp.cpp.

References GetResetQualifierName().

+ Here is the call graph for this function:

◆ TEST() [148/182]

profinet::dcp::TEST ( DcpTest  ,
ResetQualifierApplicationData   
)
Test:
Verify ResetQualifier::GetName resolves both application-data reset values.

Definition at line 682 of file test_dcp.cpp.

References GetResetQualifierName().

+ Here is the call graph for this function:

◆ TEST() [149/182]

profinet::dcp::TEST ( DcpTest  ,
ResetQualifierCommunicationParameter   
)
Test:
Verify ResetQualifier::GetName resolves both communication-parameter reset values.

Definition at line 689 of file test_dcp.cpp.

References GetResetQualifierName().

+ Here is the call graph for this function:

◆ TEST() [150/182]

profinet::dcp::TEST ( DcpTest  ,
ResetQualifierEngineeringParameter   
)
Test:
Verify ResetQualifier::GetName resolves both engineering-parameter reset values.

Definition at line 696 of file test_dcp.cpp.

References GetResetQualifierName().

+ Here is the call graph for this function:

◆ TEST() [151/182]

profinet::dcp::TEST ( DcpTest  ,
ResetQualifierEngineeringParameterSecondRange   
)
Test:
Verify ResetQualifier::GetName resolves both engineering-parameter values in the second qualifier range.

Definition at line 710 of file test_dcp.cpp.

References GetResetQualifierName().

+ Here is the call graph for this function:

◆ TEST() [152/182]

profinet::dcp::TEST ( DcpTest  ,
ResetQualifierFactory   
)
Test:
Verify ResetQualifier::GetName resolves both factory-reset values.

Definition at line 717 of file test_dcp.cpp.

References GetResetQualifierName().

+ Here is the call graph for this function:

◆ TEST() [153/182]

profinet::dcp::TEST ( DcpTest  ,
ResetQualifierRestoreData   
)
Test:
Verify ResetQualifier::GetName resolves both reset-and-restore values.

Definition at line 724 of file test_dcp.cpp.

References GetResetQualifierName().

+ Here is the call graph for this function:

◆ TEST() [154/182]

profinet::dcp::TEST ( DcpTest  ,
ResetQualifierUnknown   
)
Test:
Verify ResetQualifier::GetName uses the hexadecimal fallback for an unknown qualifier.

Definition at line 731 of file test_dcp.cpp.

References GetResetQualifierName().

+ Here is the call graph for this function:

◆ TEST() [155/182]

profinet::dcp::TEST ( DcpTest  ,
ResetQualifierUnknownEnumValue   
)
Test:
Verify GetResetQualifierName handles an unknown typed enum value.

Definition at line 1482 of file test_dcp.cpp.

References GetResetQualifierName().

+ Here is the call graph for this function:

◆ TEST() [156/182]

profinet::dcp::TEST ( DcpTest  ,
ResetQualifierZeroIsUnknown   
)
Test:
Verify GetResetQualifierName handles the zero qualifier as unknown.

Definition at line 1488 of file test_dcp.cpp.

References GetResetQualifierName().

+ Here is the call graph for this function:

◆ TEST() [157/182]

profinet::dcp::TEST ( DcpTest  ,
ResetToFactoryEncodesCombinedResetMode   
)
Test:
ResetToFactory correctly encodes a combined reset mode.

Definition at line 4027 of file test_dcp.cpp.

References profinet::Application, profinet::Communication, profinet::Engineering, profinet::Mac2String(), profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::EthernetHeader::payload, profinet::PNDCPHeader::payload, profinet::ResetToFactory, profinet::wire::Reader::SkipTo(), profinet::String2Mac(), and profinet::wire::Reader::U16().

+ Here is the call graph for this function:

◆ TEST() [158/182]

profinet::dcp::TEST ( DcpTest  ,
ResetToFactoryRejectsInvalidTargetMac   
)
Test:
ResetToFactory propagates an invalid target MAC address without sending.

Definition at line 4113 of file test_dcp.cpp.

References profinet::Communication, profinet::ResetToFactory, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [159/182]

profinet::dcp::TEST ( DcpTest  ,
ResetToFactoryReturnsFalseOnTimeout   
)
Test:
ResetToFactory returns false when the device does not respond.

Definition at line 4068 of file test_dcp.cpp.

References profinet::Communication, profinet::EthernetHeader::dst, profinet::Mac2String(), profinet::EthernetHeader::Parse(), profinet::PROFINET_ETHERTYPE, profinet::ResetToFactory, profinet::EthernetHeader::src, profinet::String2Mac(), and profinet::EthernetHeader::type.

+ Here is the call graph for this function:

◆ TEST() [160/182]

profinet::dcp::TEST ( DcpTest  ,
ResetToFactoryReturnsTrueForSuccessfulResponse   
)

◆ TEST() [161/182]

profinet::dcp::TEST ( DcpTest  ,
ResetToFactoryThrowsForBlockError   
)
Test:
ResetToFactory throws when the device reports a reset failure.

Definition at line 4094 of file test_dcp.cpp.

References profinet::Communication, profinet::Mac2String(), profinet::ResetToFactory, profinet::SetNotPossible, and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [162/182]

profinet::dcp::TEST ( DcpTest  ,
SendHelloAddsPaddingForOddLengthStationName   
)
Test:
SendHello adds padding after an odd-length station name.

Definition at line 3146 of file test_dcp.cpp.

References profinet::Device, profinet::IoDevice, profinet::Ip, profinet::Name, profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::EthernetHeader::payload, profinet::PNDCPHeader::payload, SendHello(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [163/182]

◆ TEST() [164/182]

profinet::dcp::TEST ( DcpTest  ,
SendHelloEncodesCombinedDeviceRole   
)
Test:
SendHello correctly encodes a combined device role bit mask.

Definition at line 3191 of file test_dcp.cpp.

References profinet::Device, profinet::IoController, profinet::IoDevice, profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::EthernetHeader::payload, profinet::PNDCPHeader::payload, profinet::Role, SendHello(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [165/182]

profinet::dcp::TEST ( DcpTest  ,
SendHelloEncodesDeviceId   
)
Test:
SendHello encodes the device ID in network byte order.

Definition at line 3238 of file test_dcp.cpp.

References profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::EthernetHeader::payload, profinet::PNDCPHeader::payload, profinet::PnSupervisor, SendHello(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [166/182]

profinet::dcp::TEST ( DcpTest  ,
SendHelloRejectsInvalidGateway   
)
Test:
SendHello propagates an invalid gateway without sending a frame.

Definition at line 3326 of file test_dcp.cpp.

References profinet::IoDevice, SendHello(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [167/182]

profinet::dcp::TEST ( DcpTest  ,
SendHelloRejectsInvalidIpAddress   
)
Test:
SendHello propagates an invalid station IP address without sending a frame.

Definition at line 3284 of file test_dcp.cpp.

References profinet::IoDevice, SendHello(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [168/182]

profinet::dcp::TEST ( DcpTest  ,
SendHelloRejectsInvalidNetmask   
)
Test:
SendHello propagates an invalid netmask without sending a frame.

Definition at line 3305 of file test_dcp.cpp.

References profinet::IoDevice, SendHello(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [169/182]

◆ TEST() [170/182]

profinet::dcp::TEST ( DcpTest  ,
SetIpBuildsPermanentIpBlock   
)

◆ TEST() [171/182]

profinet::dcp::TEST ( DcpTest  ,
SetIpEncodesPermanentQualifier   
)

◆ TEST() [172/182]

profinet::dcp::TEST ( DcpTest  ,
SetIpEncodesTemporaryQualifier   
)
Test:
SetIp encodes the temporary block qualifier into the IP parameter block.

Definition at line 2279 of file test_dcp.cpp.

References profinet::Mac2String(), profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::EthernetHeader::payload, profinet::PNDCPHeader::payload, SetIp(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [173/182]

profinet::dcp::TEST ( DcpTest  ,
SetIpRejectsInvalidIpAddress   
)
Test:
SetIp rejects an invalid IPv4 address before sending a frame.

Definition at line 2195 of file test_dcp.cpp.

References profinet::Mac2String(), SetIp(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [174/182]

profinet::dcp::TEST ( DcpTest  ,
SetIpReturnsFalseOnTimeout   
)
Test:
SetIp returns false when the device does not respond.

Definition at line 2171 of file test_dcp.cpp.

References profinet::Mac2String(), SetIp(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [175/182]

profinet::dcp::TEST ( DcpTest  ,
SetParamBuildsTemporaryRequest   
)
Test:
SetParam accepts temporary parameter storage.

Definition at line 2147 of file test_dcp.cpp.

References profinet::Mac2String(), SetParam(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [176/182]

profinet::dcp::TEST ( DcpTest  ,
SetParamReturnsFalseOnTimeout   
)
Test:
SetParam returns false when no SET response is received.

Definition at line 2132 of file test_dcp.cpp.

References profinet::Mac2String(), SetParam(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [177/182]

profinet::dcp::TEST ( DcpTest  ,
SetParamReturnsTrueForSuccessfulResponse   
)
Test:
SetParam sends a valid SET request and returns true for a successful response.

Definition at line 2086 of file test_dcp.cpp.

References profinet::Mac2String(), profinet::Ok, SetParam(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [178/182]

profinet::dcp::TEST ( DcpTest  ,
SetParamThrowsForDeviceBlockError   
)
Test:
SetParam throws when the device reports a DCP block error.

Definition at line 2113 of file test_dcp.cpp.

References profinet::Mac2String(), profinet::SetNotPossible, SetParam(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [179/182]

profinet::dcp::TEST ( DcpTest  ,
SignalDeviceRejectsInvalidTargetMac   
)
Test:
SignalDevice propagates an invalid target MAC address without sending a frame.

Definition at line 3952 of file test_dcp.cpp.

References SignalDevice(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST() [180/182]

profinet::dcp::TEST ( DcpTest  ,
SignalDeviceReturnsFalseOnTimeout   
)
Test:
SignalDevice returns false when the device does not respond before the timeout.

Definition at line 3926 of file test_dcp.cpp.

References profinet::EthernetHeader::dst, profinet::Mac2String(), profinet::EthernetHeader::Parse(), profinet::PROFINET_ETHERTYPE, SignalDevice(), profinet::EthernetHeader::src, profinet::String2Mac(), and profinet::EthernetHeader::type.

+ Here is the call graph for this function:

◆ TEST() [181/182]

profinet::dcp::TEST ( DcpTest  ,
SignalDeviceReturnsTrueForSuccessfulResponse   
)
Test:
SignalDevice sends a DCP signal request and returns true on a successful response.

Definition at line 3870 of file test_dcp.cpp.

References profinet::EthernetHeader::dst, profinet::PNDCPHeader::frameId, profinet::GetSet, profinet::Mac2String(), profinet::Ok, profinet::EthernetHeader::Parse(), profinet::PNDCPHeader::Parse(), profinet::EthernetHeader::payload, profinet::PROFINET_ETHERTYPE, profinet::Request, profinet::PNDCPHeader::serviceId, profinet::PNDCPHeader::serviceType, profinet::Set, SignalDevice(), profinet::EthernetHeader::src, profinet::String2Mac(), and profinet::EthernetHeader::type.

+ Here is the call graph for this function:

◆ TEST() [182/182]

profinet::dcp::TEST ( DcpTest  ,
SignalDeviceThrowsForBlockError   
)
Test:
SignalDevice throws DCPError when the device reports a signal error.

Definition at line 3907 of file test_dcp.cpp.

References profinet::Mac2String(), profinet::SetNotPossible, SignalDevice(), and profinet::String2Mac().

+ Here is the call graph for this function:

◆ TEST_F() [1/7]

profinet::dcp::TEST_F ( DcpWireFormatTest  ,
DefaultQualifierIsTemporary   
)
Test:
Verify that the default DCP SET qualifier is temporary.

Definition at line 206 of file test_dcpWireFormat.cpp.

References frame, payload, and profinet::Temporary.

◆ TEST_F() [2/7]

profinet::dcp::TEST_F ( DcpWireFormatTest  ,
EvenLengthNameIsNotPadded   
)
Test:
Verify that an even-length station name is serialized without padding.

An even-length station name already produces an aligned DCP block, so no additional padding byte is required.

Definition at line 184 of file test_dcpWireFormat.cpp.

References frame, profinet::PNDCPBlock::NAME_OF_STATION, payload, and profinet::Temporary.

◆ TEST_F() [3/7]

profinet::dcp::TEST_F ( DcpWireFormatTest  ,
IpParameterMatchingIsCaseInsensitive   
)
Test:
Verify that IP parameter matching is case-insensitive.

The legacy string-based IP SET operation must be rejected regardless of the capitalization used for the parameter name.

Definition at line 248 of file test_dcpWireFormat.cpp.

References BuildSetParamRequest().

+ Here is the call graph for this function:

◆ TEST_F() [4/7]

profinet::dcp::TEST_F ( DcpWireFormatTest  ,
IpSetOperationIsRejected   
)
Test:
Verify that the legacy string-based IP SET operation is rejected.

IP configuration requires binary IPv4 address, subnet mask, and gateway values and must therefore be performed through SetIp() rather than the string-valued SetParam() API. The request builder must reject the operation before constructing or transmitting a DCP frame.

Definition at line 233 of file test_dcpWireFormat.cpp.

References BuildSetParamRequest().

+ Here is the call graph for this function:

◆ TEST_F() [5/7]

profinet::dcp::TEST_F ( DcpWireFormatTest  ,
OddLengthNameIsPaddedAndBlockLengthExcludesPadding   
)
Test:
Verify that an odd-length station name is padded on the wire.

The logical DCP block contains a four-byte block header, a two-byte BlockQualifier, and the three-byte station name. Therefore BlockLength is five bytes, while one additional zero padding byte is present on the wire to maintain two-byte alignment.

Definition at line 158 of file test_dcpWireFormat.cpp.

References frame, profinet::PNDCPBlock::NAME_OF_STATION, payload, and profinet::Temporary.

◆ TEST_F() [6/7]

profinet::dcp::TEST_F ( DcpWireFormatTest  ,
PermanentQualifierIsSerialized   
)
Test:
Verify that a permanent DCP SET qualifier is serialized correctly.

Definition at line 216 of file test_dcpWireFormat.cpp.

References frame, payload, and profinet::Permanent.

◆ TEST_F() [7/7]

profinet::dcp::TEST_F ( DcpWireFormatTest  ,
SignalUsesFlashOnceValue   
)
Test:
Verify that DCP Signal serializes the Flash-Once command.

The Control/Signal block contains a zero BlockQualifier followed by the SignalValue 0x0100, which represents the Flash-Once command.

The resulting DCP block is eight bytes:

  • Option: 1 byte.
  • Suboption: 1 byte.
  • BlockLength: 2 bytes.
  • BlockQualifier: 2 bytes.
  • SignalValue: 2 bytes.

Definition at line 284 of file test_dcpWireFormat.cpp.

References profinet::Control, frame, payload, and profinet::Signal.

Variable Documentation

◆ blockNameVendorRangeMax

constexpr std::uint16_t profinet::dcp::blockNameVendorRangeMax = 0xFF
inlineconstexpr

Default flash duration of the leds.

Definition at line 77 of file dcp.h.

Referenced by GetBlockName().

◆ blockNameVendorRangeMin

constexpr std::uint16_t profinet::dcp::blockNameVendorRangeMin = 0x80
inlineconstexpr

Default flash duration of the leds.

Definition at line 75 of file dcp.h.

Referenced by GetBlockName().

◆ DCP_HELLO_MULTICAST_MAC

const std::string profinet::dcp::DCP_HELLO_MULTICAST_MAC = "01:0e:cf:00:00:01"
inline

DCP Hello multicast destination MAC.

Definition at line 57 of file dcp.h.

Referenced by SendHello(), and TEST().

◆ DCP_IP_CONFLICT_BIT

constexpr std::uint16_t profinet::dcp::DCP_IP_CONFLICT_BIT = 0x0080
inlineconstexpr

Bit mask indicating an IP address conflict.

Definition at line 80 of file dcp.h.

Referenced by HasConflict().

◆ DCP_IP_DHCP_BIT

constexpr std::uint16_t profinet::dcp::DCP_IP_DHCP_BIT = 0x0002
inlineconstexpr

Bit mask indicating DHCP bit is set.

Definition at line 82 of file dcp.h.

Referenced by IsDhcp().

◆ DCP_MAX_NAME_LENGTH

constexpr std::size_t profinet::dcp::DCP_MAX_NAME_LENGTH = 240
inlineconstexpr

Maximum allowed length in bytes for a station name.

Definition at line 60 of file dcp.h.

Referenced by BuildSetParamRequest(), TEST(), and TEST().

◆ DCP_MULTICAST_MAC

const std::string profinet::dcp::DCP_MULTICAST_MAC = "01:0e:cf:00:00:00"
inline

DCP Identify/Get/Set multicast destination MAC.

Definition at line 55 of file dcp.h.

Referenced by SendDiscover(), SendRequest(), TEST(), and profinet::rpc::TEST_F().

◆ DEFAULT_HELLO_TIMEOUT

constexpr std::uint16_t profinet::dcp::DEFAULT_HELLO_TIMEOUT = 10
inlineconstexpr

Default HELLO timeout.

Definition at line 68 of file dcp.h.

◆ DEFAULT_RESPONSE_DELAY_FACTOR

constexpr std::uint16_t profinet::dcp::DEFAULT_RESPONSE_DELAY_FACTOR = 0x0080
inlineconstexpr

Default dcp response delay factor.

Definition at line 70 of file dcp.h.

Referenced by TEST_F().

◆ DEFAULT_RESPONSE_TIMEOUT

constexpr std::uint16_t profinet::dcp::DEFAULT_RESPONSE_TIMEOUT = 20
inlineconstexpr

Default response timeout. How long to keep listening for responses.

Definition at line 66 of file dcp.h.

◆ DEFAULT_THREAD_SLEEP_MS

constexpr std::uint16_t profinet::dcp::DEFAULT_THREAD_SLEEP_MS = 2000
inlineconstexpr

Definition at line 64 of file dcp.h.

◆ DEFAULT_TIMEOUT

constexpr std::uint16_t profinet::dcp::DEFAULT_TIMEOUT = 5
inlineconstexpr

Default timeout.

Definition at line 63 of file dcp.h.

◆ FLASH_DURATION_MS

constexpr std::uint16_t profinet::dcp::FLASH_DURATION_MS = 3000
inlineconstexpr

Default flash duration of the leds.

Definition at line 72 of file dcp.h.