QKnxNetIpSecureWrapperProxy Class

The QKnxNetIpSecureWrapperProxy class provides the means to introspect secure wrapper data inside the generic QKnxNetIpFrame class and to create a KNXnet/IP secure wrapper frame from provided data. More...

Header: #include <QKnxNetIpSecureWrapperProxy>
qmake: QT += knx
Since: Qt 5.12

Public Types

class Builder

Public Functions

QKnxNetIpSecureWrapperProxy(const QKnxNetIpFrame &frame)
QKnxByteArray encapsulatedFrame() const
bool isValid() const
QKnxByteArray messageAuthenticationCode() const
quint16 messageTag() const
quint16 secureSessionId() const
quint48 sequenceNumber() const
QKnxByteArray serialNumber() const

Static Public Members

QKnxNetIpSecureWrapperProxy::Builder builder()

Detailed Description

The QKnxNetIpSecureWrapperProxy class provides the means to introspect secure wrapper data inside the generic QKnxNetIpFrame class and to create a KNXnet/IP secure wrapper frame from provided data.

This class is part of the Qt KNX module and currently available as a Technology Preview, and therefore the API and functionality provided by the class may be subject to change at any time without prior notice.

This frame will be sent during secure KNXnet/IP communication and includes a fully encrypted KNXnet/IP frame as well as information needed to decrypt the encapsulated frame and to ensure data integrity and freshness.

Note: When using QKnxNetIpSecureWrapperProxy, care must be taken to ensure that the referenced KNXnet/IP frame outlives the proxy on all code paths, lest the proxy ends up referencing deleted data.

The following code sample illustrates how to read the secure wrapper information:

auto netIpFrame = QKnxNetIpFrame::fromBytes(...);

const QKnxNetIpSecureWrapperProxy proxy(netIpFrame);
if (!proxy.isValid())
    return;

quint16 id = proxy.secureSessionId();
quint48 seqNumber = proxy.sequenceNumber();
QKnxByteArray number = proxy.serialNumber();
quint16 tag = proxy.tag();
QKnxByteArray frame = proxy.encapsulatedFrame();
QKnxByteArray code = proxy.messageAuthenticationCode();

See also builder() and Qt KNXnet/IP Connection Classes.

Member Function Documentation

QKnxNetIpSecureWrapperProxy::QKnxNetIpSecureWrapperProxy(const QKnxNetIpFrame &frame)

Constructs a proxy object to read the secure wrapper information carried by the specified KNXnet/IP frame frame.

[static] QKnxNetIpSecureWrapperProxy::Builder QKnxNetIpSecureWrapperProxy::builder()

Returns a builder object to create a KNXnet/IP secure wrapper frame.

QKnxByteArray QKnxNetIpSecureWrapperProxy::encapsulatedFrame() const

Returns the encrypted encapsulated frame from the generic KNXnet/IP secure wrapper frame.

bool QKnxNetIpSecureWrapperProxy::isValid() const

Returns true if the frame contains initialized values and is in itself valid, otherwise returns false. A valid KNXnet/IP frame consists of at least a valid header and a size in bytes corresponding to the total size of the KNXnet/IP frame header.

Note: KNXnet/IP secure wrapper frames currently have a minimum size of 44 bytes.

See also QKnxNetIpFrameHeader::totalSize().

QKnxByteArray QKnxNetIpSecureWrapperProxy::messageAuthenticationCode() const

Returns the AES128 CCM message authentication code (MAC) from the generic KNXnet/IP secure wrapper frame with a fixed size of 16 bytes.

quint16 QKnxNetIpSecureWrapperProxy::messageTag() const

Returns the message tag from the generic KNXnet/IP secure wrapper frame.

quint16 QKnxNetIpSecureWrapperProxy::secureSessionId() const

Returns the secure session ID from the generic KNXnet/IP secure wrapper frame.

quint48 QKnxNetIpSecureWrapperProxy::sequenceNumber() const

Returns the sequence number from the generic KNXnet/IP secure wrapper frame.

QKnxByteArray QKnxNetIpSecureWrapperProxy::serialNumber() const

Returns the serial number from the generic KNXnet/IP secure wrapper frame.

© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.