MySQL 8.0.39
Source Code Documentation
named_pipe_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 NAMED_PIPE_CONNECTION_INCLUDED
27#define NAMED_PIPE_CONNECTION_INCLUDED
28
29#include <Windows.h>
30#include <string>
31
32class Channel_info;
33class THD;
34
35/**
36 This class abstracts Named pipe listener that setups a named pipe
37 handle to listen and receive client connections.
38*/
40 std::string m_pipe_name;
41 SECURITY_ATTRIBUTES *mp_sa_pipe_security;
46
47 public:
48 /**
49 Constructor for named pipe listener
50
51 @param pipe_name name for pipe used in CreateNamedPipe function.
52 */
53 Named_pipe_listener(const std::string *pipe_name)
54 : m_pipe_name(*pipe_name),
56 m_pipe_handle(INVALID_HANDLE_VALUE) {}
57
58 /**
59 Set up a listener.
60
61 @retval false listener listener has been setup successfully to listen for
62 connect events true failure in setting up the listener.
63 */
64 bool setup_listener();
65
66 /**
67 The body of the event loop that listen for connection events from clients.
68
69 @retval Channel_info Channel_info object abstracting the connected client
70 details for processing this connection.
71 */
73
74 /**
75 Set the Windows group name whose users have full access to new instances of
76 the named pipe
77
78 @retval false access set successfully.
79 true failed to change access.
80 */
81 bool update_named_pipe_full_access_group(const char *new_group_name);
82
83 /**
84 Spawn admin connection handler thread if separate thread is required to
85 accept admin connections. Currently we do not support named pipe admin
86 connections. Hence this method is noop.
87
88 TODO: Implement when admin connections via named pipe is to be supported.
89
90 @return false as the method is a NOOP.
91 */
93
94 /**
95 Close the listener
96 */
97 void close_listener();
98};
99
100#endif // NAMED_PIPE_CONNECTION_INCLUDED.
This abstract base class represents connection channel information about a new connection.
Definition: channel_info.h:47
This class abstracts Named pipe listener that setups a named pipe handle to listen and receive client...
Definition: named_pipe_connection.h:39
Channel_info * listen_for_connection_event()
The body of the event loop that listen for connection events from clients.
Definition: named_pipe_connection.cc:105
SECURITY_ATTRIBUTES * mp_sa_pipe_security
Definition: named_pipe_connection.h:41
HANDLE m_pipe_handle
Definition: named_pipe_connection.h:42
Named_pipe_listener(const std::string *pipe_name)
Constructor for named pipe listener.
Definition: named_pipe_connection.h:53
char m_pipe_path_name[512]
Definition: named_pipe_connection.h:43
bool setup_listener()
Set up a listener.
Definition: named_pipe_connection.cc:89
bool update_named_pipe_full_access_group(const char *new_group_name)
Set the Windows group name whose users have full access to new instances of the named pipe.
Definition: named_pipe_connection.cc:180
OVERLAPPED m_connect_overlapped
Definition: named_pipe_connection.h:45
std::string m_pipe_name
Definition: named_pipe_connection.h:40
HANDLE h_connected_pipe
Definition: named_pipe_connection.h:44
void close_listener()
Close the listener.
Definition: named_pipe_connection.cc:244
bool check_and_spawn_admin_connection_handler_thread() const
Spawn admin connection handler thread if separate thread is required to accept admin connections.
Definition: named_pipe_connection.h:92
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
#define HANDLE
Definition: violite.h:159