MySQL  8.0.27
Source Code Documentation
named_pipe_connection.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2013, 2021, 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 also distributed 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 included with MySQL.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License, version 2.0, for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24 
25 #ifndef NAMED_PIPE_CONNECTION_INCLUDED
26 #define NAMED_PIPE_CONNECTION_INCLUDED
27 
28 #include <Windows.h>
29 #include <string>
30 
31 class Channel_info;
32 class THD;
33 
34 /**
35  This class abstracts Named pipe listener that setups a named pipe
36  handle to listen and receive client connections.
37 */
39  std::string m_pipe_name;
40  SECURITY_ATTRIBUTES *mp_sa_pipe_security;
42  char m_pipe_path_name[512];
45 
46  public:
47  /**
48  Constructor for named pipe listener
49 
50  @param pipe_name name for pipe used in CreateNamedPipe function.
51  */
52  Named_pipe_listener(const std::string *pipe_name)
53  : m_pipe_name(*pipe_name),
54  m_pipe_handle(INVALID_HANDLE_VALUE),
56 
57  /**
58  Set up a listener.
59 
60  @retval false listener listener has been setup successfully to listen for
61  connect events true failure in setting up the listener.
62  */
63  bool setup_listener();
64 
65  /**
66  The body of the event loop that listen for connection events from clients.
67 
68  @retval Channel_info Channel_info object abstracting the connected client
69  details for processing this connection.
70  */
72 
73  /**
74  Set the Windows group name whose users have full access to new instances of
75  the named pipe
76 
77  @retval false access set successfully.
78  true failed to change access.
79  */
80  bool update_named_pipe_full_access_group(const char *new_group_name);
81 
82  /**
83  Spawn admin connection handler thread if separate thread is required to
84  accept admin connections. Currently we do not support named pipe admin
85  connections. Hence this method is noop.
86 
87  TODO: Implement when admin connections via named pipe is to be supported.
88 
89  @return false as the method is a NOOP.
90  */
91  bool check_and_spawn_admin_connection_handler_thread() const { return false; }
92 
93  /**
94  Close the listener
95  */
96  void close_listener();
97 };
98 
99 #endif // NAMED_PIPE_CONNECTION_INCLUDED.
This abstract base class represents connection channel information about a new connection.
Definition: channel_info.h:46
This class abstracts Named pipe listener that setups a named pipe handle to listen and receive client...
Definition: named_pipe_connection.h:38
Channel_info * listen_for_connection_event()
The body of the event loop that listen for connection events from clients.
Definition: named_pipe_connection.cc:104
SECURITY_ATTRIBUTES * mp_sa_pipe_security
Definition: named_pipe_connection.h:40
HANDLE m_pipe_handle
Definition: named_pipe_connection.h:41
Named_pipe_listener(const std::string *pipe_name)
Constructor for named pipe listener.
Definition: named_pipe_connection.h:52
char m_pipe_path_name[512]
Definition: named_pipe_connection.h:42
bool setup_listener()
Set up a listener.
Definition: named_pipe_connection.cc:88
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:179
OVERLAPPED m_connect_overlapped
Definition: named_pipe_connection.h:44
std::string m_pipe_name
Definition: named_pipe_connection.h:39
HANDLE h_connected_pipe
Definition: named_pipe_connection.h:43
void close_listener()
Close the listener.
Definition: named_pipe_connection.cc:243
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:91
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:821
Dialog Client Authentication nullptr
Definition: dialog.cc:352
#define HANDLE
Definition: violite.h:158