diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2018-09-12 12:41:48 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2018-09-13 08:19:24 +0000 |
commit | 55151bac3ead26f1b3d5bd0e6aa029ce1966e9ec (patch) | |
tree | 4e6dd54ebb9068ef5ff6ae68764b51a4a7d385ad | |
parent | d5cb428bfc9fa1d19cf4771c5b5fe22cd0832f23 (diff) |
Fix wrong field size inside the session authenticate frame
Change-Id: I70cb4f4eafcae8ddecfbcf765a9509ffcd656f26
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
-rw-r--r-- | src/knx/netip/qknxnetipsessionauthenticate.cpp | 10 | ||||
-rw-r--r-- | src/knx/netip/qknxnetipsessionauthenticate.h | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/knx/netip/qknxnetipsessionauthenticate.cpp b/src/knx/netip/qknxnetipsessionauthenticate.cpp index e0c04fb..af6c368 100644 --- a/src/knx/netip/qknxnetipsessionauthenticate.cpp +++ b/src/knx/netip/qknxnetipsessionauthenticate.cpp @@ -104,7 +104,7 @@ QKnxNetIpSessionAuthenticateProxy::QKnxNetIpSessionAuthenticateProxy(const QKnxN at least a valid header and a size in bytes corresponding to the total size of the KNXnet/IP frame header. - \note A userId() with the value \c 0x00 or a value above \c 0x80 + \note A userId() with the value \c 0x0000 or a value above \c 0x0080 is considered invalid according to the KNX application note AN159. \note KNXnet/IP session authentication frames currently have a fixed size @@ -169,7 +169,7 @@ QKnxNetIpSessionAuthenticateProxy::Builder QKnxNetIpSessionAuthenticateProxy::bu The common way to create a session authentication frame is: \code - quint8 mgmtLevelAccess = 0x01; + quint16 mgmtLevelAccess = 0x0001; auto auth = ... // create the full 128 bit CCM-MAC auto netIpFrame = QKnxNetIpSessionAuthenticateProxy::builder() @@ -185,11 +185,11 @@ QKnxNetIpSessionAuthenticateProxy::Builder QKnxNetIpSessionAuthenticateProxy::bu Sets the user ID of the KNXnet/IP session authentication frame to \a userId and returns a reference to the builder. - \note A userId() with the value \c 0x00 or a value above \c 0x80 + \note A userId() with the value \c 0x0000 or a value above \c 0x0080 is considered invalid according to the KNX application note AN159. */ QKnxNetIpSessionAuthenticateProxy::Builder & - QKnxNetIpSessionAuthenticateProxy::Builder::setUserId(quint8 userId) + QKnxNetIpSessionAuthenticateProxy::Builder::setUserId(quint16 userId) { m_id = userId; return *this; @@ -220,7 +220,7 @@ QKnxNetIpFrame QKnxNetIpSessionAuthenticateProxy::Builder::create() const if (m_id == 0 || m_id >= 0x80 || m_authCode.size() != 16) return { QKnxNetIp::ServiceType::SessionAuthenticate }; - return { QKnxNetIp::ServiceType::SessionAuthenticate, QKnxUtils::QUint16::bytes(quint16(m_id)) + return { QKnxNetIp::ServiceType::SessionAuthenticate, QKnxUtils::QUint16::bytes(m_id) + m_authCode }; } diff --git a/src/knx/netip/qknxnetipsessionauthenticate.h b/src/knx/netip/qknxnetipsessionauthenticate.h index 8f52c16..35c5a93 100644 --- a/src/knx/netip/qknxnetipsessionauthenticate.h +++ b/src/knx/netip/qknxnetipsessionauthenticate.h @@ -52,13 +52,13 @@ public: class Q_KNX_EXPORT Builder final { public: - Builder &setUserId(quint8 userId); + Builder &setUserId(quint16 userId); Builder &setMessageAuthenticationCode(const QKnxByteArray &data); QKnxNetIpFrame create() const; private: - quint8 m_id { 0 }; + quint16 m_id { 0 }; QKnxByteArray m_authCode; }; static QKnxNetIpSessionAuthenticateProxy::Builder builder(); |