1 /*
2    Copyright (c) 2005, 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 MGMAPI_INTERNAL_H
26 #define MGMAPI_INTERNAL_H
27 
28 #include <portlib/NdbTCP.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34   /**
35    * Set an integer parameter for a connection
36    *
37    * @param handle the NDB management handle.
38    * @param node1 the node1 id
39    * @param node2 the node2 id
40    * @param param the parameter (e.g. CFG_CONNECTION_SERVER_PORT)
41    * @param value what to set it to
42    * @param reply from ndb_mgmd
43    */
44   int ndb_mgm_set_connection_int_parameter(NdbMgmHandle handle,
45 					   int node1,
46 					   int node2,
47 					   int param,
48 					   int value,
49 					   struct ndb_mgm_reply* reply);
50 
51   /**
52    * Send list of dynamic ports to use when setting up connections
53    * between nodes in the cluster.
54    *
55    * NOTE! Currently only ndbd's set up dynamic listening ports
56    * and all other node types are clients or have static server ports.
57    *
58    * @param handle the NDB management handle.
59    * @param nodeid the node which has openened the ports
60    * @param ports pointer to an array of ndb_mgm_dynamic_port structs
61    * @param num_ports the number of ndb_mgm_dynamic_ports passed
62    * @return 0 on success. < 0 on error.
63    */
64   struct ndb_mgm_dynamic_port {
65    int nodeid; /* The node which should use below port */
66    int port; /* The port to use */
67   };
68   int ndb_mgm_set_dynamic_ports(NdbMgmHandle handle,
69                                 int nodeid,
70                                 struct ndb_mgm_dynamic_port* ports,
71                                 unsigned num_ports);
72 
73   /**
74    * Get an integer parameter for a connection
75    *
76    * @param handle the NDB management handle.
77    * @param node1 the node1 id
78    * @param node2 the node2 id
79    * @param param the parameter (e.g. CFG_CONNECTION_SERVER_PORT)
80    * @param value where to store the retreived value. In the case of
81    * error, value is not changed.
82    * @param reply from ndb_mgmd
83    * @return 0 on success. < 0 on error.
84    */
85   int ndb_mgm_get_connection_int_parameter(NdbMgmHandle handle,
86 					   int node1,
87 					   int node2,
88 					   int param,
89 					   int *value,
90 					   struct ndb_mgm_reply* reply);
91 
92   /**
93    * Convert connection to transporter
94    * @param   handle    NDB management handle.
95    *
96    * @return socket
97    *
98    * @note the socket is now able to be used as a transporter connection
99    */
100   NDB_SOCKET_TYPE ndb_mgm_convert_to_transporter(NdbMgmHandle *handle);
101 
102   int ndb_mgm_disconnect_quiet(NdbMgmHandle handle);
103 
104   /**
105    * Set configuration
106    *
107    * @param   handle    NDB management handle.
108    * @param   config    The new configuration to set
109    */
110   int ndb_mgm_set_configuration(NdbMgmHandle handle,
111                                 struct ndb_mgm_configuration* config);
112 
113 
114   NDB_SOCKET_TYPE _ndb_mgm_get_socket(NdbMgmHandle handle);
115 
116   /**
117    * Get configuration
118    *
119    * @param   handle    NDB management handle.
120    * @param   version   version of this node
121    * @param   nodetype   type of this node
122    */
123   struct ndb_mgm_configuration *
124   ndb_mgm_get_configuration2(NdbMgmHandle handle,
125                              unsigned version,
126                              enum ndb_mgm_node_type nodetype,
127                              int from_node = 0);
128 
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 
135 #endif
136