~drizzle-trunk/drizzle/development

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
 *
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 Drizzle Declarations for Servers
14
 */
15
16
#ifndef __DRIZZLE_SERVER_H
17
#define __DRIZZLE_SERVER_H
18
19
#include <libdrizzle/drizzle.h>
20
#include <libdrizzle/conn_server.h>
21
#include <libdrizzle/handshake_server.h>
22
#include <libdrizzle/command_server.h>
23
#include <libdrizzle/result_server.h>
24
#include <libdrizzle/column_server.h>
25
#include <libdrizzle/row_server.h>
26
#include <libdrizzle/field_server.h>
27
28
#ifdef __cplusplus
29
extern "C" {
30
#endif
31
32
/**
33
 * @defgroup drizzle_server_interface Drizzle Server Interface
34
 */
35
36
/**
37
 * @addtogroup drizzle_server Drizzle Declarations for Servers
38
 * @ingroup drizzle_server_interface
39
 * @{
40
 */
41
42
/**
43
 * Add TCP (IPv4 or IPv6) connection for listening with common arguments.
44
 *
45
 * @param[in] drizzle Drizzle structure previously initialized with
46
 *  drizzle_create() or drizzle_clone().
47
 * @param[in] con Caller allocated structure, or NULL to allocate one.
48
 * @param[in] host Host to listen on. This may be a hostname to resolve, an
49
 *  IPv4 address, or an IPv6 address. This is passed directly to getaddrinfo().
50
 * @param[in] port Port to connect to.
51
 * @param[in] backlog Number of backlog connections passed to listen().
52
 * @param[in] options Drizzle connection options to add.
53
 * @return Same return as drizzle_con_create().
54
 */
55
DRIZZLE_API
56
drizzle_con_st *drizzle_con_add_tcp_listen(drizzle_st *drizzle,
57
                                           drizzle_con_st *con,
58
                                           const char *host, in_port_t port,
59
                                           int backlog,
60
                                           drizzle_con_options_t options);
61
62
/**
63
 * Add unix domain socket connection for listening with common arguments.
64
 *
65
 * @param[in] drizzle Drizzle structure previously initialized with
66
 *  drizzle_create() or drizzle_clone().
67
 * @param[in] con Caller allocated structure, or NULL to allocate one.
68
 * @param[in] uds Path to unix domain socket to use for listening.
69
 * @param[in] backlog Number of backlog connections passed to listen().
70
 * @param[in] options Drizzle connection options to add.
71
 * @return Same return as drizzle_con_create().
72
 */
73
DRIZZLE_API
74
drizzle_con_st *drizzle_con_add_uds_listen(drizzle_st *drizzle,
75
                                           drizzle_con_st *con,
76
                                           const char *uds, int backlog,
77
                                           drizzle_con_options_t options);
78
79
/**
80
 * Get next connection marked for listening that is ready for I/O.
81
 *
82
 * @param[in] drizzle Drizzle structure previously initialized with
83
 *  drizzle_create() or drizzle_clone().
84
 * @return Connection that is ready to accept, or NULL if there are none.
85
 */
86
DRIZZLE_API
87
drizzle_con_st *drizzle_con_ready_listen(drizzle_st *drizzle);
88
89
/**
90
 * Accept a new connection and initialize the connection structure for it.
91
 *
92
 * @param[in] drizzle Drizzle structure previously initialized with
93
 *  drizzle_create() or drizzle_clone().
94
 * @param[in] con Caller allocated structure, or NULL to allocate one.
95
 * @param[out] ret_ptr Standard drizzle return value.
96
 * @return Same return as drizzle_con_create().
97
 */
98
DRIZZLE_API
99
drizzle_con_st *drizzle_con_accept(drizzle_st *drizzle, drizzle_con_st *con,
100
                                   drizzle_return_t *ret_ptr);
101
102
/** @} */
103
104
#ifdef  __cplusplus
105
}
106
#endif
107
108
#endif /* __DRIZZLE_SERVER_H */