MySQL 9.1.0
Source Code Documentation
shared_memory_connection.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 SHARED_MEMORY_CONNECTION_INCLUDED
27#define SHARED_MEMORY_CONNECTION_INCLUDED
28
29#include <Windows.h>
30#include <string>
31
32class Channel_info;
33class THD;
34
35/**
36 This class abstract a shared memory listener to listen for connection
37 events that connect via the shared memory.
38*/
40 std::string m_shared_mem_name;
46 SECURITY_ATTRIBUTES *m_sa_event;
47 SECURITY_ATTRIBUTES *m_sa_mapping;
48 SECURITY_ATTRIBUTES *m_sa_mutex;
52
56 HANDLE m_event_client_read; // for transfer data server <-> client
60
61 void close_shared_mem();
62
63 public:
64 /**
65 Constructor to create shared memory listener.
66
67 @param shared_memory_base_name pointer to shared memory base name.
68 */
88
89 /**
90 Set up a listener.
91
92 @retval false listener listener has been setup successfully to listen for
93 connect events true failure in setting up the listener.
94 */
95 bool setup_listener();
96
97 /**
98 The body of the event loop that listen for connection events from clients.
99
100 @retval Channel_info Channel_info object abstracting the connected client
101 details for processing this connection.
102 */
104
105 /**
106 Spawn admin connection handler thread if separate thread is required to
107 accept admin connections. Currently we do not support
108 shared memory admin connections.
109 Hence this method is noop.
110
111 TODO: Implement for supporting admin connections via shared memory channel.
112
113 @return false as the method is a NOOP.
114 */
116
117 /**
118 Close the listener.
119 */
120 void close_listener();
121};
122
123#endif // SHARED_MEMORY_CONNECTION_INCLUDED
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
This abstract base class represents connection channel information about a new connection.
Definition: channel_info.h:47
This class abstract a shared memory listener to listen for connection events that connect via the sha...
Definition: shared_memory_connection.h:39
HANDLE m_connect_named_mutex
Definition: shared_memory_connection.h:43
std::string m_shared_mem_name
Definition: shared_memory_connection.h:40
SECURITY_ATTRIBUTES * m_sa_mutex
Definition: shared_memory_connection.h:48
HANDLE m_event_conn_closed
Definition: shared_memory_connection.h:59
char * m_temp_buffer
Definition: shared_memory_connection.h:51
int m_connect_number
Definition: shared_memory_connection.h:49
char * m_suffix_pos
Definition: shared_memory_connection.h:50
Channel_info * listen_for_connection_event()
The body of the event loop that listen for connection events from clients.
Definition: shared_memory_connection.cc:219
HANDLE m_handle_client_file_map
Definition: shared_memory_connection.h:53
bool setup_listener()
Set up a listener.
Definition: shared_memory_connection.cc:140
HANDLE m_event_server_read
Definition: shared_memory_connection.h:58
char * m_connect_map
Definition: shared_memory_connection.h:42
HANDLE m_connect_file_map
Definition: shared_memory_connection.h:41
void close_listener()
Close the listener.
Definition: shared_memory_connection.cc:328
SECURITY_ATTRIBUTES * m_sa_mapping
Definition: shared_memory_connection.h:47
bool check_and_spawn_admin_connection_handler_thread() const
Spawn admin connection handler thread if separate thread is required to accept admin connections.
Definition: shared_memory_connection.h:115
HANDLE m_event_connect_request
Definition: shared_memory_connection.h:44
void close_shared_mem()
Definition: shared_memory_connection.cc:127
char * m_handle_client_map
Definition: shared_memory_connection.h:54
HANDLE m_event_client_wrote
Definition: shared_memory_connection.h:55
HANDLE m_event_client_read
Definition: shared_memory_connection.h:56
Shared_mem_listener(const std::string *shared_memory_base_name)
Constructor to create shared memory listener.
Definition: shared_memory_connection.h:69
HANDLE m_event_connect_answer
Definition: shared_memory_connection.h:45
HANDLE m_event_server_wrote
Definition: shared_memory_connection.h:57
SECURITY_ATTRIBUTES * m_sa_event
Definition: shared_memory_connection.h:46
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
static char * shared_memory_base_name
Definition: mysqltest.cc:198
#define HANDLE
Definition: violite.h:159