~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/conn_server.h

Removed/replaced DBUG symbols and TRUE/FALSE

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Drizzle Client & Protocol Library
3
 
 *
4
 
 * Copyright (C) 2008 Eric Day (eday@oddments.org)
5
 
 * All rights reserved.
6
 
 *
7
 
 * Use and distribution licensed under the BSD license.  See
8
 
 * the COPYING file in this directory for full text.
9
 
 */
10
 
 
11
 
/**
12
 
 * @file
13
 
 * @brief Connection Declarations for Servers
14
 
 */
15
 
 
16
 
#ifndef __DRIZZLE_CON_SERVER_H
17
 
#define __DRIZZLE_CON_SERVER_H
18
 
 
19
 
#ifdef __cplusplus
20
 
extern "C" {
21
 
#endif
22
 
 
23
 
/**
24
 
 * @addtogroup drizzle_con_server Connection Declarations for Servers
25
 
 * @ingroup drizzle_server_interface
26
 
 *
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.
30
 
 * @{
31
 
 */
32
 
 
33
 
/**
34
 
 * Put a connection into listening mode.
35
 
 *
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.
39
 
 */
40
 
DRIZZLE_API
41
 
drizzle_return_t drizzle_con_listen(drizzle_con_st *con);
42
 
 
43
 
/**
44
 
 * Get connection backlog queue length.
45
 
 *
46
 
 * @param[in] con Connection structure previously initialized with
47
 
 *  drizzle_con_create(), drizzle_con_clone(), or related functions.
48
 
 * @return Backlog for connection
49
 
 */
50
 
DRIZZLE_API
51
 
int drizzle_con_backlog(const drizzle_con_st *con);
52
 
 
53
 
/**
54
 
 * Set connection backlog queue length.
55
 
 *
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
59
 
 */
60
 
DRIZZLE_API
61
 
void drizzle_con_set_backlog(drizzle_con_st *con, int backlog);
62
 
 
63
 
/**
64
 
 * Set protocol version for a connection.
65
 
 *
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
69
 
 */
70
 
DRIZZLE_API
71
 
void drizzle_con_set_protocol_version(drizzle_con_st *con,
72
 
                                      uint8_t protocol_version);
73
 
 
74
 
/**
75
 
 * Set server version string for a connection.
76
 
 *
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
80
 
 */
81
 
DRIZZLE_API
82
 
void drizzle_con_set_server_version(drizzle_con_st *con,
83
 
                                    const char *server_version);
84
 
 
85
 
/**
86
 
 * Set thread ID for a connection.
87
 
 *
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
91
 
 */
92
 
DRIZZLE_API
93
 
void drizzle_con_set_thread_id(drizzle_con_st *con, uint32_t thread_id);
94
 
 
95
 
/**
96
 
 * Set scramble buffer for a connection.
97
 
 *
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
101
 
 */
102
 
DRIZZLE_API
103
 
void drizzle_con_set_scramble(drizzle_con_st *con, const uint8_t *scramble);
104
 
 
105
 
/**
106
 
 * Set capabilities for a connection.
107
 
 *
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
111
 
 */
112
 
DRIZZLE_API
113
 
void drizzle_con_set_capabilities(drizzle_con_st *con,
114
 
                                  drizzle_capabilities_t capabilities);
115
 
 
116
 
/**
117
 
 * Set charset for a connection.
118
 
 *
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
122
 
 */
123
 
DRIZZLE_API
124
 
void drizzle_con_set_charset(drizzle_con_st *con, drizzle_charset_t charset);
125
 
 
126
 
/**
127
 
 * Set status for a connection.
128
 
 *
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
132
 
 */
133
 
DRIZZLE_API
134
 
void drizzle_con_set_status(drizzle_con_st *con, drizzle_con_status_t status);
135
 
 
136
 
/**
137
 
 * Set max packet size for a connection.
138
 
 *
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
142
 
 */
143
 
DRIZZLE_API
144
 
void drizzle_con_set_max_packet_size(drizzle_con_st *con,
145
 
                                     uint32_t max_packet_size);
146
 
 
147
 
/**
148
 
 * Copy all handshake information from one connection into another.
149
 
 *
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.
153
 
 */
154
 
DRIZZLE_API
155
 
void drizzle_con_copy_handshake(drizzle_con_st *con, drizzle_con_st *from);
156
 
 
157
 
/**
158
 
 * Read command without buffering.
159
 
 *
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.
169
 
 */
170
 
DRIZZLE_API
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);
175
 
 
176
 
/**
177
 
 * Read command and buffer it.
178
 
 *
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
185
 
 *  *total.
186
 
 */
187
 
DRIZZLE_API
188
 
void *drizzle_con_command_buffer(drizzle_con_st *con,
189
 
                                 drizzle_command_t *command, size_t *total,
190
 
                                 drizzle_return_t *ret_ptr);
191
 
 
192
 
/** @} */
193
 
 
194
 
#ifdef __cplusplus
195
 
}
196
 
#endif
197
 
 
198
 
#endif /* __DRIZZLE_CON_SERVER_H */