From c9a61fec6d274be81df50d851896a017ba081af6 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 19 Jan 2017 10:32:11 +0200 Subject: [PATCH] Masking: Use common constants - Response related constants moved from ComPacket to ComResponse - Constants defined using defines from .../maxscale/protocol/mysql.h --- .../filter/masking/maskingfiltersession.cc | 8 +++---- server/modules/filter/masking/mysql.hh | 21 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/server/modules/filter/masking/maskingfiltersession.cc b/server/modules/filter/masking/maskingfiltersession.cc index 8f9ad1682..63ac26eff 100644 --- a/server/modules/filter/masking/maskingfiltersession.cc +++ b/server/modules/filter/masking/maskingfiltersession.cc @@ -126,9 +126,9 @@ void MaskingFilterSession::handle_response(GWBUF* pPacket) switch (response.type()) { - case ComPacket::OK_PACKET: // OK - // We'll end up here also in the case of a multi-result. - case 0xfb: // GET_MORE_CLIENT_DATA/SEND_MORE_CLIENT_DATA + case ComResponse::OK_PACKET: + // We'll end up here also in the case of a multi-result. + case ComResponse::LOCAL_INFILE_PACKET: // GET_MORE_CLIENT_DATA/SEND_MORE_CLIENT_DATA m_state = EXPECTING_NOTHING; break; @@ -219,7 +219,7 @@ void MaskingFilterSession::handle_row(GWBUF* pPacket) ComPacket response(pPacket); if ((response.payload_len() == ComEOF::PAYLOAD_LEN) && - (ComResponse(response).type() == ComPacket::EOF_PACKET)) + (ComResponse(response).type() == ComResponse::EOF_PACKET)) { // EOF after last row. ComEOF eof(response); diff --git a/server/modules/filter/masking/mysql.hh b/server/modules/filter/masking/mysql.hh index d54227094..2e950501e 100644 --- a/server/modules/filter/masking/mysql.hh +++ b/server/modules/filter/masking/mysql.hh @@ -481,13 +481,6 @@ inline LEncString::iterator operator - (const LEncString::iterator& it, ptrdiff_ class ComPacket { public: - enum - { - OK_PACKET = 0x00, - EOF_PACKET = 0xfe, - ERR_PACKET = 0xff, - }; - enum { MAX_PAYLOAD_LEN = 0xffffff @@ -544,6 +537,14 @@ private: class ComResponse : public ComPacket { public: + enum + { + OK_PACKET = MYSQL_REPLY_OK, // 0x00 + EOF_PACKET = MYSQL_REPLY_EOF, // 0xfe + ERR_PACKET = MYSQL_REPLY_ERR, // 0xff + LOCAL_INFILE_PACKET = MYSQL_REPLY_LOCAL_INFILE // 0xfb + }; + ComResponse(GWBUF* pPacket) : ComPacket(pPacket) , m_type(*m_pData) @@ -574,17 +575,17 @@ public: bool is_ok() const { - return m_type == ComPacket::OK_PACKET; + return m_type == ComResponse::OK_PACKET; } bool is_eof() const { - return m_type == ComPacket::EOF_PACKET; + return m_type == ComResponse::EOF_PACKET; } bool is_err() const { - return m_type == ComPacket::ERR_PACKET; + return m_type == ComResponse::ERR_PACKET; } protected: