1
/* $Id: ioqueue_dummy.c 3553 2011-05-05 06:14:19Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
#include <pj/ioqueue.h>
25
#include <pj/string.h>
26
#include <pj/assert.h>
30
#define THIS_FILE "ioqueue"
32
#define PJ_IOQUEUE_IS_READ_OP(op) \
33
((op & PJ_IOQUEUE_OP_READ) || (op & PJ_IOQUEUE_OP_RECV_FROM))
34
#define PJ_IOQUEUE_IS_WRITE_OP(op) \
35
((op & PJ_IOQUEUE_OP_WRITE) || (op & PJ_IOQUEUE_OP_SEND_TO))
39
# define PJ_IOQUEUE_IS_ACCEPT_OP(op) (op & PJ_IOQUEUE_OP_ACCEPT)
40
# define PJ_IOQUEUE_IS_CONNECT_OP(op) (op & PJ_IOQUEUE_OP_CONNECT)
42
# define PJ_IOQUEUE_IS_ACCEPT_OP(op) 0
43
# define PJ_IOQUEUE_IS_CONNECT_OP(op) 0
46
#if defined(PJ_DEBUG) && PJ_DEBUG != 0
47
# define VALIDATE_FD_SET 1
49
# define VALIDATE_FD_SET 0
52
struct pj_ioqueue_key_t
54
PJ_DECL_LIST_MEMBER(struct pj_ioqueue_key_t)
56
pj_ioqueue_operation_e op;
58
pj_ioqueue_callback cb;
65
PJ_DEF(pj_status_t) pj_ioqueue_create( pj_pool_t *pool,
68
pj_ioqueue_t **ptr_ioqueue)
73
PJ_DEF(pj_status_t) pj_ioqueue_destroy(pj_ioqueue_t *ioque)
78
PJ_DEF(pj_status_t) pj_ioqueue_set_lock( pj_ioqueue_t *ioque,
80
pj_bool_t auto_delete )
85
PJ_DEF(pj_status_t) pj_ioqueue_register_sock( pj_pool_t *pool,
89
const pj_ioqueue_callback *cb,
90
pj_ioqueue_key_t **ptr_key)
95
PJ_DEF(pj_status_t) pj_ioqueue_unregister( pj_ioqueue_t *ioque,
96
pj_ioqueue_key_t *key)
101
PJ_DEF(void*) pj_ioqueue_get_user_data( pj_ioqueue_key_t *key )
107
PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioque, const pj_time_val *timeout)
112
PJ_DEF(pj_status_t) pj_ioqueue_read( pj_ioqueue_t *ioque,
113
pj_ioqueue_key_t *key,
120
PJ_DEF(pj_status_t) pj_ioqueue_recv( pj_ioqueue_t *ioque,
121
pj_ioqueue_key_t *key,
129
PJ_DEF(pj_status_t) pj_ioqueue_recvfrom( pj_ioqueue_t *ioque,
130
pj_ioqueue_key_t *key,
140
PJ_DEF(pj_status_t) pj_ioqueue_write( pj_ioqueue_t *ioque,
141
pj_ioqueue_key_t *key,
148
PJ_DEF(pj_status_t) pj_ioqueue_send( pj_ioqueue_t *ioque,
149
pj_ioqueue_key_t *key,
157
PJ_DEF(pj_status_t) pj_ioqueue_sendto( pj_ioqueue_t *ioque,
158
pj_ioqueue_key_t *key,
162
const pj_sockaddr_t *addr,
170
* Initiate overlapped accept() operation.
172
PJ_DEF(pj_status_t) pj_ioqueue_accept( pj_ioqueue_t *ioqueue,
173
pj_ioqueue_key_t *key,
175
pj_sockaddr_t *local,
176
pj_sockaddr_t *remote,
183
* Initiate overlapped connect() operation (well, it's non-blocking actually,
184
* since there's no overlapped version of connect()).
186
PJ_DEF(pj_status_t) pj_ioqueue_connect( pj_ioqueue_t *ioqueue,
187
pj_ioqueue_key_t *key,
188
const pj_sockaddr_t *addr,
193
#endif /* PJ_HAS_TCP */