blob: e34bb6dafbf48da47a20ea0c6cfeca5f30d9c7d1 [file] [log] [blame]
Benny Prijono9033e312005-11-21 02:08:39 +00001/* $Id$ */
2/*
Benny Prijono844653c2008-12-23 17:27:53 +00003 * Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
4 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
Benny Prijono9033e312005-11-21 02:08:39 +00005 *
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.
10 *
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.
15 *
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
19 */
20#include <pj/ioqueue.h>
21#include <pj/os.h>
22#include <pj/log.h>
23#include <pj/list.h>
24#include <pj/pool.h>
25#include <pj/string.h>
26#include <pj/assert.h>
27#include <pj/sock.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_ioqueue_t*) pj_ioqueue_create(pj_pool_t *pool, pj_size_t max_fd)
65{
66 return NULL;
67}
68
69PJ_DEF(pj_status_t) pj_ioqueue_destroy(pj_ioqueue_t *ioque)
70{
71 return 0;
72}
73
74PJ_DEF(pj_ioqueue_key_t*) pj_ioqueue_register( pj_pool_t *pool,
75 pj_ioqueue_t *ioque,
76 pj_oshandle_t sock,
77 void *user_data,
78 const pj_ioqueue_callback *cb)
79{
80 return NULL;
81}
82
83PJ_DEF(pj_status_t) pj_ioqueue_unregister( pj_ioqueue_t *ioque,
84 pj_ioqueue_key_t *key)
85{
86 return -1;
87}
88
89PJ_DEF(void*) pj_ioqueue_get_user_data( pj_ioqueue_key_t *key )
90{
91 return NULL;
92}
93
94
95PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioque, const pj_time_val *timeout)
96{
97 return -1;
98}
99
100PJ_DEF(int) pj_ioqueue_read( pj_ioqueue_t *ioque,
101 pj_ioqueue_key_t *key,
102 void *buffer,
103 pj_size_t buflen)
104{
105 return -1;
106}
107
108PJ_DEF(int) pj_ioqueue_recvfrom( pj_ioqueue_t *ioque,
109 pj_ioqueue_key_t *key,
110 void *buffer,
111 pj_size_t buflen,
112 pj_sockaddr_t *addr,
113 int *addrlen)
114{
115 return -1;
116}
117
118PJ_DEF(int) pj_ioqueue_write( pj_ioqueue_t *ioque,
119 pj_ioqueue_key_t *key,
120 const void *data,
121 pj_size_t datalen)
122{
123 return -1;
124}
125
126PJ_DEF(int) pj_ioqueue_sendto( pj_ioqueue_t *ioque,
127 pj_ioqueue_key_t *key,
128 const void *data,
129 pj_size_t datalen,
130 const pj_sockaddr_t *addr,
131 int addrlen)
132{
133 return -1;
134}
135
136#if PJ_HAS_TCP
137/*
138 * Initiate overlapped accept() operation.
139 */
140PJ_DEF(int) pj_ioqueue_accept( pj_ioqueue_t *ioqueue,
141 pj_ioqueue_key_t *key,
142 pj_sock_t *new_sock,
143 pj_sockaddr_t *local,
144 pj_sockaddr_t *remote,
145 int *addrlen)
146{
147 return -1;
148}
149
150/*
151 * Initiate overlapped connect() operation (well, it's non-blocking actually,
152 * since there's no overlapped version of connect()).
153 */
154PJ_DEF(pj_status_t) pj_ioqueue_connect( pj_ioqueue_t *ioqueue,
155 pj_ioqueue_key_t *key,
156 const pj_sockaddr_t *addr,
157 int addrlen )
158{
159 return -1;
160}
161#endif /* PJ_HAS_TCP */
162