1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
1 |
/*
|
2 |
* Drizzle Client & Protocol Library
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Eric Day (eday@oddments.org)
|
|
5 |
* All rights reserved.
|
|
6 |
*
|
|
1971.2.1
by kalebral at gmail
update files that did not have license or had incorrect license structure |
7 |
* Redistribution and use in source and binary forms, with or without
|
8 |
* modification, are permitted provided that the following conditions are
|
|
9 |
* met:
|
|
10 |
*
|
|
11 |
* * Redistributions of source code must retain the above copyright
|
|
12 |
* notice, this list of conditions and the following disclaimer.
|
|
13 |
*
|
|
14 |
* * Redistributions in binary form must reproduce the above
|
|
15 |
* copyright notice, this list of conditions and the following disclaimer
|
|
16 |
* in the documentation and/or other materials provided with the
|
|
17 |
* distribution.
|
|
18 |
*
|
|
19 |
* * The names of its contributors may not be used to endorse or
|
|
20 |
* promote products derived from this software without specific prior
|
|
21 |
* written permission.
|
|
22 |
*
|
|
23 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
24 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
25 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
26 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
27 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
28 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
29 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
30 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
31 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
32 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34 |
*
|
|
1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
35 |
*/
|
36 |
||
37 |
/**
|
|
38 |
* @file
|
|
39 |
* @brief Connection Declarations for Servers
|
|
40 |
*/
|
|
41 |
||
42 |
#ifndef __DRIZZLE_CON_SERVER_H
|
|
43 |
#define __DRIZZLE_CON_SERVER_H
|
|
44 |
||
45 |
#ifdef __cplusplus
|
|
46 |
extern "C" { |
|
47 |
#endif
|
|
48 |
||
49 |
/**
|
|
50 |
* @addtogroup drizzle_con_server Connection Declarations for Servers
|
|
51 |
* @ingroup drizzle_server_interface
|
|
52 |
*
|
|
53 |
* These functions extend the core connection functions with a set of functions
|
|
54 |
* for server application use. These functions allow you to set raw handshake
|
|
55 |
* information for use with the handshake write functions.
|
|
56 |
* @{
|
|
57 |
*/
|
|
58 |
||
59 |
/**
|
|
60 |
* Put a connection into listening mode.
|
|
61 |
*
|
|
62 |
* @param[in] con Connection structure previously initialized with
|
|
63 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
64 |
* @return Standard drizzle return value.
|
|
65 |
*/
|
|
66 |
DRIZZLE_API
|
|
67 |
drizzle_return_t drizzle_con_listen(drizzle_con_st *con); |
|
68 |
||
69 |
/**
|
|
70 |
* Get connection backlog queue length.
|
|
71 |
*
|
|
72 |
* @param[in] con Connection structure previously initialized with
|
|
73 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
74 |
* @return Backlog for connection
|
|
75 |
*/
|
|
76 |
DRIZZLE_API
|
|
77 |
int drizzle_con_backlog(const drizzle_con_st *con); |
|
78 |
||
79 |
/**
|
|
80 |
* Set connection backlog queue length.
|
|
81 |
*
|
|
82 |
* @param[in] con Connection structure previously initialized with
|
|
83 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
84 |
* @param[in] backlog Backlog to use for connection
|
|
85 |
*/
|
|
86 |
DRIZZLE_API
|
|
87 |
void drizzle_con_set_backlog(drizzle_con_st *con, int backlog); |
|
88 |
||
89 |
/**
|
|
90 |
* Set protocol version for a connection.
|
|
91 |
*
|
|
92 |
* @param[in] con Connection structure previously initialized with
|
|
93 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
94 |
* @param[in] protocol_version Protocol version to use for connection
|
|
95 |
*/
|
|
96 |
DRIZZLE_API
|
|
97 |
void drizzle_con_set_protocol_version(drizzle_con_st *con, |
|
98 |
uint8_t protocol_version); |
|
99 |
||
100 |
/**
|
|
101 |
* Set server version string for a connection.
|
|
102 |
*
|
|
103 |
* @param[in] con Connection structure previously initialized with
|
|
104 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
105 |
* @param[in] server_version Server version to use for connection
|
|
106 |
*/
|
|
107 |
DRIZZLE_API
|
|
108 |
void drizzle_con_set_server_version(drizzle_con_st *con, |
|
109 |
const char *server_version); |
|
110 |
||
111 |
/**
|
|
112 |
* Set thread ID for a connection.
|
|
113 |
*
|
|
114 |
* @param[in] con Connection structure previously initialized with
|
|
115 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
116 |
* @param[in] thread_id Thread ID to use for connection
|
|
117 |
*/
|
|
118 |
DRIZZLE_API
|
|
119 |
void drizzle_con_set_thread_id(drizzle_con_st *con, uint32_t thread_id); |
|
120 |
||
121 |
/**
|
|
122 |
* Set scramble buffer for a connection.
|
|
123 |
*
|
|
124 |
* @param[in] con Connection structure previously initialized with
|
|
125 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
126 |
* @param[in] scramble Scramble to use for connection
|
|
127 |
*/
|
|
128 |
DRIZZLE_API
|
|
129 |
void drizzle_con_set_scramble(drizzle_con_st *con, const uint8_t *scramble); |
|
130 |
||
131 |
/**
|
|
132 |
* Set capabilities for a connection.
|
|
133 |
*
|
|
134 |
* @param[in] con Connection structure previously initialized with
|
|
135 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
136 |
* @param[in] capabilities Capabilities to use for connection
|
|
137 |
*/
|
|
138 |
DRIZZLE_API
|
|
139 |
void drizzle_con_set_capabilities(drizzle_con_st *con, |
|
1992.6.7
by Monty Taylor
Revert -Wc++-compat change. |
140 |
drizzle_capabilities_t capabilities); |
1712.1.1
by Monty Taylor
Merged libdrizzle directly into tree. |
141 |
|
142 |
/**
|
|
143 |
* Set charset for a connection.
|
|
144 |
*
|
|
145 |
* @param[in] con Connection structure previously initialized with
|
|
146 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
147 |
* @param[in] charset Character set to use for connection
|
|
148 |
*/
|
|
149 |
DRIZZLE_API
|
|
150 |
void drizzle_con_set_charset(drizzle_con_st *con, drizzle_charset_t charset); |
|
151 |
||
152 |
/**
|
|
153 |
* Set status for a connection.
|
|
154 |
*
|
|
155 |
* @param[in] con Connection structure previously initialized with
|
|
156 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
157 |
* @param[in] status Status to use for connection
|
|
158 |
*/
|
|
159 |
DRIZZLE_API
|
|
160 |
void drizzle_con_set_status(drizzle_con_st *con, drizzle_con_status_t status); |
|
161 |
||
162 |
/**
|
|
163 |
* Set max packet size for a connection.
|
|
164 |
*
|
|
165 |
* @param[in] con Connection structure previously initialized with
|
|
166 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
167 |
* @param[in] max_packet_size Max packet size to use for connection
|
|
168 |
*/
|
|
169 |
DRIZZLE_API
|
|
170 |
void drizzle_con_set_max_packet_size(drizzle_con_st *con, |
|
171 |
uint32_t max_packet_size); |
|
172 |
||
173 |
/**
|
|
174 |
* Copy all handshake information from one connection into another.
|
|
175 |
*
|
|
176 |
* @param[in] con Connection structure previously initialized with
|
|
177 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
178 |
* @param[in] from Connection structure to copy from.
|
|
179 |
*/
|
|
180 |
DRIZZLE_API
|
|
181 |
void drizzle_con_copy_handshake(drizzle_con_st *con, drizzle_con_st *from); |
|
182 |
||
183 |
/**
|
|
184 |
* Read command without buffering.
|
|
185 |
*
|
|
186 |
* @param[in] con Connection structure previously initialized with
|
|
187 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
188 |
* @param[out] command Command that was read.
|
|
189 |
* @param[out] offset Where the data being returned begins in the command data.
|
|
190 |
* @param[out] size The size of the data chunk being returned.
|
|
191 |
* @param[out] total The total size of all command data being read.
|
|
192 |
* @param[out] ret_ptr Standard drizzle return value.
|
|
193 |
* @return On success, a pointer to an internal buffer with the command data.
|
|
194 |
* It will be *size bytes in length.
|
|
195 |
*/
|
|
196 |
DRIZZLE_API
|
|
197 |
void *drizzle_con_command_read(drizzle_con_st *con, |
|
198 |
drizzle_command_t *command, size_t *offset, |
|
199 |
size_t *size, size_t *total, |
|
200 |
drizzle_return_t *ret_ptr); |
|
201 |
||
202 |
/**
|
|
203 |
* Read command and buffer it.
|
|
204 |
*
|
|
205 |
* @param[in] con Connection structure previously initialized with
|
|
206 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
207 |
* @param[out] command Command that was read.
|
|
208 |
* @param[out] total The total size of all command data being read.
|
|
209 |
* @param[out] ret_ptr Standard drizzle return value.
|
|
210 |
* @return On success, allocated buffer that holds the command data of length
|
|
211 |
* *total.
|
|
212 |
*/
|
|
213 |
DRIZZLE_API
|
|
214 |
void *drizzle_con_command_buffer(drizzle_con_st *con, |
|
215 |
drizzle_command_t *command, size_t *total, |
|
216 |
drizzle_return_t *ret_ptr); |
|
217 |
||
218 |
/** @} */
|
|
219 |
||
220 |
#ifdef __cplusplus
|
|
221 |
}
|
|
222 |
#endif
|
|
223 |
||
224 |
#endif /* __DRIZZLE_CON_SERVER_H */ |