Debian Codegraph @

Xpjproject/pjlib/src/pj/ioqueue_dummy.c

raw symbols SCIP
1 /*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <[email protected]>
4 *
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
30 /* Only build when the backend is using dummy/none. */
31 #if PJ_IOQUEUE_IMP == PJ_IOQUEUE_IMP_NONE
32
33
34 #define THIS_FILE "ioqueue"
35
36 #define PJ_IOQUEUE_IS_READ_OP(op) \
37 ((op & PJ_IOQUEUE_OP_READ) || (op & PJ_IOQUEUE_OP_RECV_FROM))
38 #define PJ_IOQUEUE_IS_WRITE_OP(op) \
39 ((op & PJ_IOQUEUE_OP_WRITE) || (op & PJ_IOQUEUE_OP_SEND_TO))
40
41
42 #if PJ_HAS_TCP
43 # define PJ_IOQUEUE_IS_ACCEPT_OP(op) (op & PJ_IOQUEUE_OP_ACCEPT)
44 # define PJ_IOQUEUE_IS_CONNECT_OP(op) (op & PJ_IOQUEUE_OP_CONNECT)
45 #else
46 # define PJ_IOQUEUE_IS_ACCEPT_OP(op) 0
47 # define PJ_IOQUEUE_IS_CONNECT_OP(op) 0
48 #endif
49
50 #if defined(PJ_DEBUG) && PJ_DEBUG != 0
51 # define VALIDATE_FD_SET 1
52 #else
53 # define VALIDATE_FD_SET 0
54 #endif
55
56 struct pj_ioqueue_key_t
57 {
58 PJ_DECL_LIST_MEMBER(struct pj_ioqueue_key_t)
59 pj_sock_t fd;
60 pj_ioqueue_operation_e op;
61 void *user_data;
62 pj_ioqueue_callback cb;
63 };
64
65 struct pj_ioqueue_t
66 {
67 };
68
69 PJ_DEF(pj_status_t) pj_ioqueue_create( pj_pool_t *pool,
70 pj_size_t max_fd,
71 int max_threads,
72 pj_ioqueue_t **ptr_ioqueue)
73 {
74 return PJ_ENOTSUP;
75 }
76
77 PJ_DEF(pj_status_t) pj_ioqueue_destroy(pj_ioqueue_t *ioque)
78 {
79 return PJ_ENOTSUP;
80 }
81
82 PJ_DEF(pj_status_t) pj_ioqueue_set_lock( pj_ioqueue_t *ioque,
83 pj_lock_t *lock,
84 pj_bool_t auto_delete )
85 {
86 return PJ_ENOTSUP;
87 }
88
89 PJ_DEF(pj_status_t) pj_ioqueue_register_sock( pj_pool_t *pool,
90 pj_ioqueue_t *ioque,
91 pj_sock_t sock,
92 void *user_data,
93 const pj_ioqueue_callback *cb,
94 pj_ioqueue_key_t **ptr_key)
95 {
96 return PJ_ENOTSUP;
97 }
98
99 PJ_DEF(pj_status_t) pj_ioqueue_unregister( pj_ioqueue_t *ioque,
100 pj_ioqueue_key_t *key)
101 {
102 return PJ_ENOTSUP;
103 }
104
105 PJ_DEF(void*) pj_ioqueue_get_user_data( pj_ioqueue_key_t *key )
106 {
107 return NULL;
108 }
109
110
111 PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioque, const pj_time_val *timeout)
112 {
113 return -1;
114 }
115
116 PJ_DEF(pj_status_t) pj_ioqueue_read( pj_ioqueue_t *ioque,
117 pj_ioqueue_key_t *key,
118 void *buffer,
119 pj_size_t buflen)
120 {
121 return -1;
122 }
123
124 PJ_DEF(pj_status_t) pj_ioqueue_recv( pj_ioqueue_t *ioque,
125 pj_ioqueue_key_t *key,
126 void *buffer,
127 pj_size_t buflen,
128 unsigned flags)
129 {
130 return -1;
131 }
132
133 PJ_DEF(pj_status_t) pj_ioqueue_recvfrom( pj_ioqueue_t *ioque,
134 pj_ioqueue_key_t *key,
135 void *buffer,
136 pj_size_t buflen,
137 unsigned flags,
138 pj_sockaddr_t *addr,
139 int *addrlen)
140 {
141 return -1;
142 }
143
144 PJ_DEF(pj_status_t) pj_ioqueue_write( pj_ioqueue_t *ioque,
145 pj_ioqueue_key_t *key,
146 const void *data,
147 pj_size_t datalen)
148 {
149 return -1;
150 }
151
152 PJ_DEF(pj_status_t) pj_ioqueue_send( pj_ioqueue_t *ioque,
153 pj_ioqueue_key_t *key,
154 const void *data,
155 pj_size_t datalen,
156 unsigned flags)
157 {
158 return -1;
159 }
160
161 PJ_DEF(pj_status_t) pj_ioqueue_sendto( pj_ioqueue_t *ioque,
162 pj_ioqueue_key_t *key,
163 const void *data,
164 pj_size_t datalen,
165 unsigned flags,
166 const pj_sockaddr_t *addr,
167 int addrlen)
168 {
169 return -1;
170 }
171
172 #if PJ_HAS_TCP
173 /*
174 * Initiate overlapped accept() operation.
175 */
176 PJ_DEF(pj_status_t) pj_ioqueue_accept( pj_ioqueue_t *ioqueue,
177 pj_ioqueue_key_t *key,
178 pj_sock_t *new_sock,
179 pj_sockaddr_t *local,
180 pj_sockaddr_t *remote,
181 int *addrlen)
182 {
183 return -1;
184 }
185
186 /*
187 * Initiate overlapped connect() operation (well, it's non-blocking actually,
188 * since there's no overlapped version of connect()).
189 */
190 PJ_DEF(pj_status_t) pj_ioqueue_connect( pj_ioqueue_t *ioqueue,
191 pj_ioqueue_key_t *key,
192 const pj_sockaddr_t *addr,
193 int addrlen )
194 {
195 return -1;
196 }
197 #endif /* PJ_HAS_TCP */
198
199 PJ_DEF(pj_oshandle_t) pj_ioqueue_get_os_handle( pj_ioqueue_t *ioqueue )
200 {
201 PJ_UNUSED_ARG(ioqueue);
202 return NULL;
203 }
204
205 #endif /* PJ_IOQUEUE_IMP == PJ_IOQUEUE_IMP_NONE */