blob: 89893fc56077cd71370ef0ed7b2b430883923bd0 [file] [log] [blame]
Benny Prijono9033e312005-11-21 02:08:39 +00001/* $Id$ */
2/*
Benny Prijono32177c02008-06-20 22:44:47 +00003 * Copyright (C)2003-2008 Benny Prijono <benny@prijono.org>
Benny Prijono9033e312005-11-21 02:08:39 +00004 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#include <pj/ioqueue.h>
20#include <pj/os.h>
21#include <pj/log.h>
22#include <pj/list.h>
23#include <pj/pool.h>
24#include <pj/string.h>
25#include <pj/assert.h>
26#include <pj/sock.h>
27#include <pj/errno.h>
28
29#define THIS_FILE "ioqueue"
30
31#define PJ_IOQUEUE_IS_READ_OP(op) \
32 ((op & PJ_IOQUEUE_OP_READ) || (op & PJ_IOQUEUE_OP_RECV_FROM))
33#define PJ_IOQUEUE_IS_WRITE_OP(op) \
34 ((op & PJ_IOQUEUE_OP_WRITE) || (op & PJ_IOQUEUE_OP_SEND_TO))
35
36
37#if PJ_HAS_TCP
38# define PJ_IOQUEUE_IS_ACCEPT_OP(op) (op & PJ_IOQUEUE_OP_ACCEPT)
39# define PJ_IOQUEUE_IS_CONNECT_OP(op) (op & PJ_IOQUEUE_OP_CONNECT)
40#else
41# define PJ_IOQUEUE_IS_ACCEPT_OP(op) 0
42# define PJ_IOQUEUE_IS_CONNECT_OP(op) 0
43#endif
44
45#if defined(PJ_DEBUG) && PJ_DEBUG != 0
46# define VALIDATE_FD_SET 1
47#else
48# define VALIDATE_FD_SET 0
49#endif
50
51struct pj_ioqueue_key_t
52{
53 PJ_DECL_LIST_MEMBER(struct pj_ioqueue_key_t)
54 pj_sock_t fd;
55 pj_ioqueue_operation_e op;
56 void *user_data;
57 pj_ioqueue_callback cb;
58};
59
60struct pj_ioqueue_t
61{
62};
63
64PJ_DEF(pj_status_t) pj_ioqueue_create( pj_pool_t *pool,
65 pj_size_t max_fd,
66 int max_threads,
67 pj_ioqueue_t **ptr_ioqueue)
68{
69 return PJ_ENOTSUP;
70}
71
72PJ_DEF(pj_status_t) pj_ioqueue_destroy(pj_ioqueue_t *ioque)
73{
74 return PJ_ENOTSUP;
75}
76
77PJ_DEF(pj_status_t) pj_ioqueue_set_lock( pj_ioqueue_t *ioque,
78 pj_lock_t *lock,
79 pj_bool_t auto_delete )
80{
81 return PJ_ENOTSUP;
82}
83
84PJ_DEF(pj_status_t) pj_ioqueue_register_sock( pj_pool_t *pool,
85 pj_ioqueue_t *ioque,
86 pj_sock_t sock,
87 void *user_data,
88 const pj_ioqueue_callback *cb,
89 pj_ioqueue_key_t **ptr_key)
90{
91 return PJ_ENOTSUP;
92}
93
94PJ_DEF(pj_status_t) pj_ioqueue_unregister( pj_ioqueue_t *ioque,
95 pj_ioqueue_key_t *key)
96{
97 return PJ_ENOTSUP;
98}
99
100PJ_DEF(void*) pj_ioqueue_get_user_data( pj_ioqueue_key_t *key )
101{
102 return NULL;
103}
104
105
106PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioque, const pj_time_val *timeout)
107{
108 return -1;
109}
110
111PJ_DEF(pj_status_t) pj_ioqueue_read( pj_ioqueue_t *ioque,
112 pj_ioqueue_key_t *key,
113 void *buffer,
114 pj_size_t buflen)
115{
116 return -1;
117}
118
119PJ_DEF(pj_status_t) pj_ioqueue_recv( pj_ioqueue_t *ioque,
120 pj_ioqueue_key_t *key,
121 void *buffer,
122 pj_size_t buflen,
123 unsigned flags)
124{
125 return -1;
126}
127
128PJ_DEF(pj_status_t) pj_ioqueue_recvfrom( pj_ioqueue_t *ioque,
129 pj_ioqueue_key_t *key,
130 void *buffer,
131 pj_size_t buflen,
132 unsigned flags,
133 pj_sockaddr_t *addr,
134 int *addrlen)
135{
136 return -1;
137}
138
139PJ_DEF(pj_status_t) pj_ioqueue_write( pj_ioqueue_t *ioque,
140 pj_ioqueue_key_t *key,
141 const void *data,
142 pj_size_t datalen)
143{
144 return -1;
145}
146
147PJ_DEF(pj_status_t) pj_ioqueue_send( pj_ioqueue_t *ioque,
148 pj_ioqueue_key_t *key,
149 const void *data,
150 pj_size_t datalen,
151 unsigned flags)
152{
153 return -1;
154}
155
156PJ_DEF(pj_status_t) pj_ioqueue_sendto( pj_ioqueue_t *ioque,
157 pj_ioqueue_key_t *key,
158 const void *data,
159 pj_size_t datalen,
160 unsigned flags,
161 const pj_sockaddr_t *addr,
162 int addrlen)
163{
164 return -1;
165}
166
167#if PJ_HAS_TCP
168/*
169 * Initiate overlapped accept() operation.
170 */
171PJ_DEF(pj_status_t) pj_ioqueue_accept( pj_ioqueue_t *ioqueue,
172 pj_ioqueue_key_t *key,
173 pj_sock_t *new_sock,
174 pj_sockaddr_t *local,
175 pj_sockaddr_t *remote,
176 int *addrlen)
177{
178 return -1;
179}
180
181/*
182 * Initiate overlapped connect() operation (well, it's non-blocking actually,
183 * since there's no overlapped version of connect()).
184 */
185PJ_DEF(pj_status_t) pj_ioqueue_connect( pj_ioqueue_t *ioqueue,
186 pj_ioqueue_key_t *key,
187 const pj_sockaddr_t *addr,
188 int addrlen )
189{
190 return -1;
191}
192#endif /* PJ_HAS_TCP */
193