2
* Drizzle Client & Protocol Library
4
* Copyright (C) 2008 Eric Day (eday@oddments.org)
7
* Use and distribution licensed under the BSD license. See
8
* the COPYING file in this directory for full text.
13
* @brief Connection Declarations for Servers
16
#ifndef __DRIZZLE_CON_SERVER_H
17
#define __DRIZZLE_CON_SERVER_H
24
* @addtogroup drizzle_con_server Connection Declarations for Servers
25
* @ingroup drizzle_server_interface
27
* These functions extend the core connection functions with a set of functions
28
* for server application use. These functions allow you to set raw handshake
29
* information for use with the handshake write functions.
34
* Put a connection into listening mode.
36
* @param[in] con Connection structure previously initialized with
37
* drizzle_con_create(), drizzle_con_clone(), or related functions.
38
* @return Standard drizzle return value.
41
drizzle_return_t drizzle_con_listen(drizzle_con_st *con);
44
* Get connection backlog queue length.
46
* @param[in] con Connection structure previously initialized with
47
* drizzle_con_create(), drizzle_con_clone(), or related functions.
48
* @return Backlog for connection
51
int drizzle_con_backlog(const drizzle_con_st *con);
54
* Set connection backlog queue length.
56
* @param[in] con Connection structure previously initialized with
57
* drizzle_con_create(), drizzle_con_clone(), or related functions.
58
* @param[in] backlog Backlog to use for connection
61
void drizzle_con_set_backlog(drizzle_con_st *con, int backlog);
64
* Set protocol version for a connection.
66
* @param[in] con Connection structure previously initialized with
67
* drizzle_con_create(), drizzle_con_clone(), or related functions.
68
* @param[in] protocol_version Protocol version to use for connection
71
void drizzle_con_set_protocol_version(drizzle_con_st *con,
72
uint8_t protocol_version);
75
* Set server version string for a connection.
77
* @param[in] con Connection structure previously initialized with
78
* drizzle_con_create(), drizzle_con_clone(), or related functions.
79
* @param[in] server_version Server version to use for connection
82
void drizzle_con_set_server_version(drizzle_con_st *con,
83
const char *server_version);
86
* Set thread ID for a connection.
88
* @param[in] con Connection structure previously initialized with
89
* drizzle_con_create(), drizzle_con_clone(), or related functions.
90
* @param[in] thread_id Thread ID to use for connection
93
void drizzle_con_set_thread_id(drizzle_con_st *con, uint32_t thread_id);
96
* Set scramble buffer for a connection.
98
* @param[in] con Connection structure previously initialized with
99
* drizzle_con_create(), drizzle_con_clone(), or related functions.
100
* @param[in] scramble Scramble to use for connection
103
void drizzle_con_set_scramble(drizzle_con_st *con, const uint8_t *scramble);
106
* Set capabilities for a connection.
108
* @param[in] con Connection structure previously initialized with
109
* drizzle_con_create(), drizzle_con_clone(), or related functions.
110
* @param[in] capabilities Capabilities to use for connection
113
void drizzle_con_set_capabilities(drizzle_con_st *con,
114
drizzle_capabilities_t capabilities);
117
* Set charset for a connection.
119
* @param[in] con Connection structure previously initialized with
120
* drizzle_con_create(), drizzle_con_clone(), or related functions.
121
* @param[in] charset Character set to use for connection
124
void drizzle_con_set_charset(drizzle_con_st *con, drizzle_charset_t charset);
127
* Set status for a connection.
129
* @param[in] con Connection structure previously initialized with
130
* drizzle_con_create(), drizzle_con_clone(), or related functions.
131
* @param[in] status Status to use for connection
134
void drizzle_con_set_status(drizzle_con_st *con, drizzle_con_status_t status);
137
* Set max packet size for a connection.
139
* @param[in] con Connection structure previously initialized with
140
* drizzle_con_create(), drizzle_con_clone(), or related functions.
141
* @param[in] max_packet_size Max packet size to use for connection
144
void drizzle_con_set_max_packet_size(drizzle_con_st *con,
145
uint32_t max_packet_size);
148
* Copy all handshake information from one connection into another.
150
* @param[in] con Connection structure previously initialized with
151
* drizzle_con_create(), drizzle_con_clone(), or related functions.
152
* @param[in] from Connection structure to copy from.
155
void drizzle_con_copy_handshake(drizzle_con_st *con, drizzle_con_st *from);
158
* Read command without buffering.
160
* @param[in] con Connection structure previously initialized with
161
* drizzle_con_create(), drizzle_con_clone(), or related functions.
162
* @param[out] command Command that was read.
163
* @param[out] offset Where the data being returned begins in the command data.
164
* @param[out] size The size of the data chunk being returned.
165
* @param[out] total The total size of all command data being read.
166
* @param[out] ret_ptr Standard drizzle return value.
167
* @return On success, a pointer to an internal buffer with the command data.
168
* It will be *size bytes in length.
171
void *drizzle_con_command_read(drizzle_con_st *con,
172
drizzle_command_t *command, size_t *offset,
173
size_t *size, size_t *total,
174
drizzle_return_t *ret_ptr);
177
* Read command and buffer it.
179
* @param[in] con Connection structure previously initialized with
180
* drizzle_con_create(), drizzle_con_clone(), or related functions.
181
* @param[out] command Command that was read.
182
* @param[out] total The total size of all command data being read.
183
* @param[out] ret_ptr Standard drizzle return value.
184
* @return On success, allocated buffer that holds the command data of length
188
void *drizzle_con_command_buffer(drizzle_con_st *con,
189
drizzle_command_t *command, size_t *total,
190
drizzle_return_t *ret_ptr);
198
#endif /* __DRIZZLE_CON_SERVER_H */