Masking: Use common constants

- Response related constants moved from ComPacket to ComResponse
- Constants defined using defines from .../maxscale/protocol/mysql.h
This commit is contained in:
Johan Wikman
2017-01-19 10:32:11 +02:00
parent 6499994af8
commit c9a61fec6d
2 changed files with 15 additions and 14 deletions

View File

@ -126,9 +126,9 @@ void MaskingFilterSession::handle_response(GWBUF* pPacket)
switch (response.type())
{
case ComPacket::OK_PACKET: // OK
case ComResponse::OK_PACKET:
// 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::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);

View File

@ -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: