1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
#pragma once
#include <Core/MySQL/IMySQLReadPacket.h>
#include <Core/MySQL/IMySQLWritePacket.h>
namespace DB
{
namespace MySQLProtocol
{
namespace ConnectionPhase
{
class Handshake : public IMySQLWritePacket, public IMySQLReadPacket
{
public:
int protocol_version = 0xa;
String server_version;
uint32_t connection_id;
uint32_t capability_flags;
uint8_t character_set;
uint32_t status_flags;
String auth_plugin_name;
String auth_plugin_data;
protected:
size_t getPayloadSize() const override;
void readPayloadImpl(ReadBuffer & payload) override;
void writePayloadImpl(WriteBuffer & buffer) const override;
public:
Handshake();
Handshake(
uint32_t capability_flags_, uint32_t connection_id_,
String server_version_, String auth_plugin_name_, String auth_plugin_data_, uint8_t charset_);
};
class HandshakeResponse : public IMySQLWritePacket, public IMySQLReadPacket
{
public:
uint32_t capability_flags;
uint32_t max_packet_size;
uint8_t character_set;
String username;
String database;
String auth_response;
String auth_plugin_name;
protected:
size_t getPayloadSize() const override;
void readPayloadImpl(ReadBuffer & payload) override;
void writePayloadImpl(WriteBuffer & buffer) const override;
public:
HandshakeResponse();
HandshakeResponse(
UInt32 capability_flags_, UInt32 max_packet_size_, UInt8 character_set_,
const String & username_, const String & database_, const String & auth_response_, const String & auth_plugin_name_);
};
class AuthSwitchRequest : public IMySQLWritePacket
{
public:
String plugin_name;
String auth_plugin_data;
protected:
size_t getPayloadSize() const override;
void writePayloadImpl(WriteBuffer & buffer) const override;
public:
AuthSwitchRequest(String plugin_name_, String auth_plugin_data_);
};
class AuthSwitchResponse : public LimitedReadPacket
{
public:
String value;
protected:
void readPayloadImpl(ReadBuffer & payload) override;
};
class AuthMoreData : public IMySQLWritePacket
{
public:
String data;
protected:
size_t getPayloadSize() const override;
void writePayloadImpl(WriteBuffer & buffer) const override;
public:
explicit AuthMoreData(String data_): data(std::move(data_)) {}
};
}
}
}
|