MySQL 8.0.39
Source Code Documentation
classic_forwarder.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2022, 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25
26#ifndef ROUTING_CLASSIC_FORWARDER_INCLUDED
27#define ROUTING_CLASSIC_FORWARDER_INCLUDED
28
29#include "processor.h"
30
31/**
32 * a generic forwarder for mysql packets.
33 */
34class Forwarder : public Processor {
35 public:
36 using Processor::Processor;
37
38 enum class ForwardResult {
44 };
45};
46
47/**
48 * forward a mysql packet from the client to the server.
49 */
51 public:
52 enum class Stage {
53 Forward,
54 Done,
55 };
56
58 bool flush_before_next_func_optional = true)
59 : Forwarder(conn),
60 flush_before_next_func_optional_(flush_before_next_func_optional) {}
61
63
65 Stage stage() const { return stage_; }
66
67 private:
70
72
74};
75
76/**
77 * forward a mysql packet from the server to the client.
78 */
80 public:
81 enum class Stage {
82 Forward,
83 Done,
84 };
85
87 bool flush_before_next_func_optional = true)
88 : Forwarder(conn),
89 flush_before_next_func_optional_(flush_before_next_func_optional) {}
90
92
94 Stage stage() const { return stage_; }
95
96 private:
99
101
103};
104
105#endif
forward a mysql packet from the client to the server.
Definition: classic_forwarder.h:50
stdx::expected< Result, std::error_code > forward()
Definition: classic_forwarder.cc:308
stdx::expected< ForwardResult, std::error_code > forward_frame_sequence()
Definition: classic_forwarder.cc:354
Stage stage() const
Definition: classic_forwarder.h:65
ClientToServerForwarder(MysqlRoutingClassicConnectionBase *conn, bool flush_before_next_func_optional=true)
Definition: classic_forwarder.h:57
bool flush_before_next_func_optional_
Definition: classic_forwarder.h:71
stdx::expected< Result, std::error_code > process() override
Definition: classic_forwarder.cc:296
Stage stage_
Definition: classic_forwarder.h:73
Stage
Definition: classic_forwarder.h:52
void stage(Stage stage)
Definition: classic_forwarder.h:64
a generic forwarder for mysql packets.
Definition: classic_forwarder.h:34
ForwardResult
Definition: classic_forwarder.h:38
Definition: classic_connection_base.h:221
a processor base class with helper functions.
Definition: processor.h:89
forward a mysql packet from the server to the client.
Definition: classic_forwarder.h:79
stdx::expected< ForwardResult, std::error_code > forward_frame_sequence()
Definition: classic_forwarder.cc:284
void stage(Stage stage)
Definition: classic_forwarder.h:93
stdx::expected< Result, std::error_code > process() override
Definition: classic_forwarder.cc:223
ServerToClientForwarder(MysqlRoutingClassicConnectionBase *conn, bool flush_before_next_func_optional=true)
Definition: classic_forwarder.h:86
Stage stage() const
Definition: classic_forwarder.h:94
stdx::expected< Result, std::error_code > forward()
Definition: classic_forwarder.cc:235
Stage stage_
Definition: classic_forwarder.h:102
Stage
Definition: classic_forwarder.h:81
bool flush_before_next_func_optional_
Definition: classic_forwarder.h:100
Definition: expected.h:944