MySQL 8.4.2
Source Code Documentation
channel_info.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2013, 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, version 2.0, 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 SQL_CHANNEL_INFO_INCLUDED
27#define SQL_CHANNEL_INFO_INCLUDED
28
29#include <sys/types.h>
30
31#include "my_inttypes.h"
32#include "my_systime.h" // my_micro_time
33#include "violite.h"
34
35class THD;
36
37typedef Vio Vio;
38
39/**
40 This abstract base class represents connection channel information
41 about a new connection. Its subclasses encapsulate differences
42 between different connection channel types.
43
44 Currently we support local and TCP/IP sockets (all platforms),
45 named pipes and shared memory (Windows only).
46*/
49
50 protected:
51 /**
52 Create and initialize a Vio object.
53
54 @returns a pointer to the initialized a vio object.
55 */
56 virtual Vio *create_and_init_vio() const = 0;
57
59
60 public:
61 virtual ~Channel_info() = default;
62
63 /**
64 Instantiate and initialize THD object and vio.
65
66 @returns pointer to initialized THD object.
67 @retval NULL THD object allocation fails.
68 */
69 virtual THD *create_thd();
70
71 /**
72 Send error back to the client and close the channel.
73
74 @param errorcode code indicating type of error.
75 @param error operating system specific error code.
76 @param senderror true if the error need to be sent to
77 client else false.
78 */
79 virtual void send_error_and_close_channel(uint errorcode, int error,
80 bool senderror);
81
84 }
85
88 }
89
90 virtual bool is_admin_connection() const { return false; }
91};
92
93#endif // SQL_CHANNEL_INFO_INCLUDED.
Vio Vio
Definition: channel_info.h:35
This abstract base class represents connection channel information about a new connection.
Definition: channel_info.h:47
virtual THD * create_thd()
Instantiate and initialize THD object and vio.
Definition: channel_info.cc:40
virtual bool is_admin_connection() const
Definition: channel_info.h:90
ulonglong prior_thr_create_utime
Definition: channel_info.h:48
void set_prior_thr_create_utime()
Definition: channel_info.h:86
Channel_info()
Definition: channel_info.h:58
virtual void send_error_and_close_channel(uint errorcode, int error, bool senderror)
Send error back to the client and close the channel.
Definition: channel_info.cc:57
ulonglong get_prior_thr_create_utime() const
Definition: channel_info.h:82
virtual ~Channel_info()=default
virtual Vio * create_and_init_vio() const =0
Create and initialize a Vio object.
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
Defines for getting and processing the current system type programmatically.
unsigned long long int my_micro_time()
Return time in microseconds.
Definition: my_systime.h:182
Definition: violite.h:320
Vio Lite.