2244.1.1
by Monty Taylor
Split libdrizzle into 1.0 and 2.0. Applied the C++ changes to 2.0 branch. |
1 |
/*
|
2 |
* Drizzle Client & Protocol Library
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Eric Day (eday@oddments.org)
|
|
5 |
* All rights reserved.
|
|
6 |
*
|
|
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 |
*
|
|
35 |
*/
|
|
36 |
||
2449.1.4
by Brian Aker
Complete update of libdrizzle |
37 |
#pragma once
|
38 |
||
2244.1.1
by Monty Taylor
Split libdrizzle into 1.0 and 2.0. Applied the C++ changes to 2.0 branch. |
39 |
/**
|
40 |
* @file
|
|
41 |
* @brief Connection Declarations for Servers
|
|
42 |
*/
|
|
43 |
||
44 |
#ifdef __cplusplus
|
|
45 |
extern "C" { |
|
46 |
#endif
|
|
47 |
||
48 |
/**
|
|
49 |
* @addtogroup drizzle_con_server Connection Declarations for Servers
|
|
50 |
* @ingroup drizzle_server_interface
|
|
51 |
*
|
|
52 |
* These functions extend the core connection functions with a set of functions
|
|
53 |
* for server application use. These functions allow you to set raw handshake
|
|
54 |
* information for use with the handshake write functions.
|
|
55 |
* @{
|
|
56 |
*/
|
|
57 |
||
58 |
/**
|
|
59 |
* Put a connection into listening mode.
|
|
60 |
*
|
|
61 |
* @param[in] con Connection structure previously initialized with
|
|
62 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
63 |
* @return Standard drizzle return value.
|
|
64 |
*/
|
|
65 |
DRIZZLE_API
|
|
66 |
drizzle_return_t drizzle_con_listen(drizzle_con_st *con); |
|
67 |
||
68 |
/**
|
|
69 |
* Get connection backlog queue length.
|
|
70 |
*
|
|
71 |
* @param[in] con Connection structure previously initialized with
|
|
72 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
73 |
* @return Backlog for connection
|
|
74 |
*/
|
|
75 |
DRIZZLE_API
|
|
76 |
int drizzle_con_backlog(const drizzle_con_st *con); |
|
77 |
||
78 |
/**
|
|
79 |
* Set connection backlog queue length.
|
|
80 |
*
|
|
81 |
* @param[in] con Connection structure previously initialized with
|
|
82 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
83 |
* @param[in] backlog Backlog to use for connection
|
|
84 |
*/
|
|
85 |
DRIZZLE_API
|
|
86 |
void drizzle_con_set_backlog(drizzle_con_st *con, int backlog); |
|
87 |
||
88 |
/**
|
|
89 |
* Set protocol version for a connection.
|
|
90 |
*
|
|
91 |
* @param[in] con Connection structure previously initialized with
|
|
92 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
93 |
* @param[in] protocol_version Protocol version to use for connection
|
|
94 |
*/
|
|
95 |
DRIZZLE_API
|
|
96 |
void drizzle_con_set_protocol_version(drizzle_con_st *con, |
|
97 |
uint8_t protocol_version); |
|
98 |
||
99 |
/**
|
|
100 |
* Set server version string for a connection.
|
|
101 |
*
|
|
102 |
* @param[in] con Connection structure previously initialized with
|
|
103 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
104 |
* @param[in] server_version Server version to use for connection
|
|
105 |
*/
|
|
106 |
DRIZZLE_API
|
|
107 |
void drizzle_con_set_server_version(drizzle_con_st *con, |
|
108 |
const char *server_version); |
|
109 |
||
110 |
/**
|
|
111 |
* Set thread ID for a connection.
|
|
112 |
*
|
|
113 |
* @param[in] con Connection structure previously initialized with
|
|
114 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
115 |
* @param[in] thread_id Thread ID to use for connection
|
|
116 |
*/
|
|
117 |
DRIZZLE_API
|
|
118 |
void drizzle_con_set_thread_id(drizzle_con_st *con, uint32_t thread_id); |
|
119 |
||
120 |
/**
|
|
121 |
* Set scramble buffer for a connection.
|
|
122 |
*
|
|
123 |
* @param[in] con Connection structure previously initialized with
|
|
124 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
125 |
* @param[in] scramble Scramble to use for connection
|
|
126 |
*/
|
|
127 |
DRIZZLE_API
|
|
128 |
void drizzle_con_set_scramble(drizzle_con_st *con, const uint8_t *scramble); |
|
129 |
||
130 |
/**
|
|
131 |
* Set capabilities for a connection.
|
|
132 |
*
|
|
133 |
* @param[in] con Connection structure previously initialized with
|
|
134 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
135 |
* @param[in] capabilities Capabilities to use for connection
|
|
136 |
*/
|
|
137 |
DRIZZLE_API
|
|
138 |
void drizzle_con_set_capabilities(drizzle_con_st *con, |
|
139 |
int capabilities); |
|
140 |
||
141 |
/**
|
|
142 |
* Set charset for a connection.
|
|
143 |
*
|
|
144 |
* @param[in] con Connection structure previously initialized with
|
|
145 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
146 |
* @param[in] charset Character set to use for connection
|
|
147 |
*/
|
|
148 |
DRIZZLE_API
|
|
149 |
void drizzle_con_set_charset(drizzle_con_st *con, drizzle_charset_t charset); |
|
150 |
||
151 |
/**
|
|
152 |
* Set status for a connection.
|
|
153 |
*
|
|
154 |
* @param[in] con Connection structure previously initialized with
|
|
155 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
156 |
* @param[in] status Status to use for connection
|
|
157 |
*/
|
|
158 |
DRIZZLE_API
|
|
159 |
void drizzle_con_set_status(drizzle_con_st *con, drizzle_con_status_t status); |
|
160 |
||
161 |
/**
|
|
162 |
* Set max packet size for a connection.
|
|
163 |
*
|
|
164 |
* @param[in] con Connection structure previously initialized with
|
|
165 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
166 |
* @param[in] max_packet_size Max packet size to use for connection
|
|
167 |
*/
|
|
168 |
DRIZZLE_API
|
|
169 |
void drizzle_con_set_max_packet_size(drizzle_con_st *con, |
|
170 |
uint32_t max_packet_size); |
|
171 |
||
172 |
/**
|
|
173 |
* Copy all handshake information from one connection into another.
|
|
174 |
*
|
|
175 |
* @param[in] con Connection structure previously initialized with
|
|
176 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
177 |
* @param[in] from Connection structure to copy from.
|
|
178 |
*/
|
|
179 |
DRIZZLE_API
|
|
180 |
void drizzle_con_copy_handshake(drizzle_con_st *con, drizzle_con_st *from); |
|
181 |
||
182 |
/**
|
|
183 |
* Read command without buffering.
|
|
184 |
*
|
|
185 |
* @param[in] con Connection structure previously initialized with
|
|
186 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
187 |
* @param[out] command Command that was read.
|
|
188 |
* @param[out] offset Where the data being returned begins in the command data.
|
|
189 |
* @param[out] size The size of the data chunk being returned.
|
|
190 |
* @param[out] total The total size of all command data being read.
|
|
191 |
* @param[out] ret_ptr Standard drizzle return value.
|
|
192 |
* @return On success, a pointer to an internal buffer with the command data.
|
|
193 |
* It will be *size bytes in length.
|
|
194 |
*/
|
|
195 |
DRIZZLE_API
|
|
196 |
void *drizzle_con_command_read(drizzle_con_st *con, |
|
197 |
drizzle_command_t *command, size_t *offset, |
|
198 |
size_t *size, size_t *total, |
|
199 |
drizzle_return_t *ret_ptr); |
|
200 |
||
201 |
/**
|
|
202 |
* Read command and buffer it.
|
|
203 |
*
|
|
204 |
* @param[in] con Connection structure previously initialized with
|
|
205 |
* drizzle_con_create(), drizzle_con_clone(), or related functions.
|
|
206 |
* @param[out] command Command that was read.
|
|
207 |
* @param[out] total The total size of all command data being read.
|
|
208 |
* @param[out] ret_ptr Standard drizzle return value.
|
|
209 |
* @return On success, allocated buffer that holds the command data of length
|
|
210 |
* *total.
|
|
211 |
*/
|
|
212 |
DRIZZLE_API
|
|
213 |
void *drizzle_con_command_buffer(drizzle_con_st *con, |
|
214 |
drizzle_command_t *command, size_t *total, |
|
215 |
drizzle_return_t *ret_ptr); |
|
216 |
||
217 |
DRIZZLE_API
|
|
218 |
void drizzle_con_command_buffer_free(uint8_t *command_buffer); |
|
219 |
||
220 |
/** @} */
|
|
221 |
||
222 |
#ifdef __cplusplus
|
|
223 |
}
|
|
224 |
#endif
|