~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle/drizzle_server.h

Merge Joe, plus I updated the tests.

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