| 36 | } |
| 37 | |
| 38 | void 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 | |
| 78 | void Handshake::writePayloadImpl(WriteBuffer & buffer) const |
| 79 | { |
nothing calls this directly
no test coverage detected