MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / readPayloadImpl

Method readPayloadImpl

src/Core/MySQL/PacketsConnection.cpp:38–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38void Handshake::readPayloadImpl(ReadBuffer & payload)
39{
40 payload.readStrict(reinterpret_cast<char *>(&protocol_version), 1);
41 readNullTerminated(server_version, payload);
42 payload.readStrict(reinterpret_cast<char *>(&connection_id), 4);
43
44 auth_plugin_data.resize(AUTH_PLUGIN_DATA_PART_1_LENGTH);
45 payload.readStrict(auth_plugin_data.data(), AUTH_PLUGIN_DATA_PART_1_LENGTH);
46
47 payload.ignore(1);
48 payload.readStrict(reinterpret_cast<char *>(&capability_flags), 2);
49 payload.readStrict(reinterpret_cast<char *>(&character_set), 1);
50 payload.readStrict(reinterpret_cast<char *>(&status_flags), 2);
51 payload.readStrict((reinterpret_cast<char *>(&capability_flags)) + 2, 2);
52
53 UInt8 auth_plugin_data_length = 0;
54 if (capability_flags & Capability::CLIENT_PLUGIN_AUTH)
55 {
56 payload.readStrict(reinterpret_cast<char *>(&auth_plugin_data_length), 1);
57 }
58 else
59 {
60 payload.ignore(1);
61 }
62
63 payload.ignore(10);
64 if (capability_flags & Capability::CLIENT_SECURE_CONNECTION)
65 {
66 UInt8 part2_length = (SCRAMBLE_LENGTH - AUTH_PLUGIN_DATA_PART_1_LENGTH);
67 auth_plugin_data.resize(SCRAMBLE_LENGTH);
68 payload.readStrict(auth_plugin_data.data() + AUTH_PLUGIN_DATA_PART_1_LENGTH, part2_length);
69 payload.ignore(1);
70 }
71
72 if (capability_flags & Capability::CLIENT_PLUGIN_AUTH)
73 {
74 readNullTerminated(auth_plugin_name, payload);
75 }
76}
77
78void Handshake::writePayloadImpl(WriteBuffer & buffer) const
79{

Callers

nothing calls this directly

Calls 8

readLengthEncodedStringFunction · 0.85
readStringUntilEOFFunction · 0.85
readNullTerminatedFunction · 0.50
readBinaryFunction · 0.50
readStrictMethod · 0.45
resizeMethod · 0.45
dataMethod · 0.45
ignoreMethod · 0.45

Tested by

no test coverage detected