Benny Prijono | 9033e31 | 2005-11-21 02:08:39 +0000 | [diff] [blame] | 1 | /* $Id$ */ |
| 2 | /* |
| 3 | * Copyright (C)2003-2006 Benny Prijono <benny@prijono.org> |
| 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 | |
| 28 | #define THIS_FILE "ioqueue" |
| 29 | |
| 30 | #define PJ_IOQUEUE_IS_READ_OP(op) \ |
| 31 | ((op & PJ_IOQUEUE_OP_READ) || (op & PJ_IOQUEUE_OP_RECV_FROM)) |
| 32 | #define PJ_IOQUEUE_IS_WRITE_OP(op) \ |
| 33 | ((op & PJ_IOQUEUE_OP_WRITE) || (op & PJ_IOQUEUE_OP_SEND_TO)) |
| 34 | |
| 35 | |
| 36 | #if PJ_HAS_TCP |
| 37 | # define PJ_IOQUEUE_IS_ACCEPT_OP(op) (op & PJ_IOQUEUE_OP_ACCEPT) |
| 38 | # define PJ_IOQUEUE_IS_CONNECT_OP(op) (op & PJ_IOQUEUE_OP_CONNECT) |
| 39 | #else |
| 40 | # define PJ_IOQUEUE_IS_ACCEPT_OP(op) 0 |
| 41 | # define PJ_IOQUEUE_IS_CONNECT_OP(op) 0 |
| 42 | #endif |
| 43 | |
| 44 | #if defined(PJ_DEBUG) && PJ_DEBUG != 0 |
| 45 | # define VALIDATE_FD_SET 1 |
| 46 | #else |
| 47 | # define VALIDATE_FD_SET 0 |
| 48 | #endif |
| 49 | |
| 50 | struct pj_ioqueue_key_t |
| 51 | { |
| 52 | PJ_DECL_LIST_MEMBER(struct pj_ioqueue_key_t) |
| 53 | pj_sock_t fd; |
| 54 | pj_ioqueue_operation_e op; |
| 55 | void *user_data; |
| 56 | pj_ioqueue_callback cb; |
| 57 | }; |
| 58 | |
| 59 | struct pj_ioqueue_t |
| 60 | { |
| 61 | }; |
| 62 | |
| 63 | PJ_DEF(pj_ioqueue_t*) pj_ioqueue_create(pj_pool_t *pool, pj_size_t max_fd) |
| 64 | { |
| 65 | return NULL; |
| 66 | } |
| 67 | |
| 68 | PJ_DEF(pj_status_t) pj_ioqueue_destroy(pj_ioqueue_t *ioque) |
| 69 | { |
| 70 | return 0; |
| 71 | } |
| 72 | |
| 73 | PJ_DEF(pj_ioqueue_key_t*) pj_ioqueue_register( pj_pool_t *pool, |
| 74 | pj_ioqueue_t *ioque, |
| 75 | pj_oshandle_t sock, |
| 76 | void *user_data, |
| 77 | const pj_ioqueue_callback *cb) |
| 78 | { |
| 79 | return NULL; |
| 80 | } |
| 81 | |
| 82 | PJ_DEF(pj_status_t) pj_ioqueue_unregister( pj_ioqueue_t *ioque, |
| 83 | pj_ioqueue_key_t *key) |
| 84 | { |
| 85 | return -1; |
| 86 | } |
| 87 | |
| 88 | PJ_DEF(void*) pj_ioqueue_get_user_data( pj_ioqueue_key_t *key ) |
| 89 | { |
| 90 | return NULL; |
| 91 | } |
| 92 | |
| 93 | |
| 94 | PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioque, const pj_time_val *timeout) |
| 95 | { |
| 96 | return -1; |
| 97 | } |
| 98 | |
| 99 | PJ_DEF(int) pj_ioqueue_read( pj_ioqueue_t *ioque, |
| 100 | pj_ioqueue_key_t *key, |
| 101 | void *buffer, |
| 102 | pj_size_t buflen) |
| 103 | { |
| 104 | return -1; |
| 105 | } |
| 106 | |
| 107 | PJ_DEF(int) pj_ioqueue_recvfrom( pj_ioqueue_t *ioque, |
| 108 | pj_ioqueue_key_t *key, |
| 109 | void *buffer, |
| 110 | pj_size_t buflen, |
| 111 | pj_sockaddr_t *addr, |
| 112 | int *addrlen) |
| 113 | { |
| 114 | return -1; |
| 115 | } |
| 116 | |
| 117 | PJ_DEF(int) pj_ioqueue_write( pj_ioqueue_t *ioque, |
| 118 | pj_ioqueue_key_t *key, |
| 119 | const void *data, |
| 120 | pj_size_t datalen) |
| 121 | { |
| 122 | return -1; |
| 123 | } |
| 124 | |
| 125 | PJ_DEF(int) pj_ioqueue_sendto( pj_ioqueue_t *ioque, |
| 126 | pj_ioqueue_key_t *key, |
| 127 | const void *data, |
| 128 | pj_size_t datalen, |
| 129 | const pj_sockaddr_t *addr, |
| 130 | int addrlen) |
| 131 | { |
| 132 | return -1; |
| 133 | } |
| 134 | |
| 135 | #if PJ_HAS_TCP |
| 136 | /* |
| 137 | * Initiate overlapped accept() operation. |
| 138 | */ |
| 139 | PJ_DEF(int) pj_ioqueue_accept( pj_ioqueue_t *ioqueue, |
| 140 | pj_ioqueue_key_t *key, |
| 141 | pj_sock_t *new_sock, |
| 142 | pj_sockaddr_t *local, |
| 143 | pj_sockaddr_t *remote, |
| 144 | int *addrlen) |
| 145 | { |
| 146 | return -1; |
| 147 | } |
| 148 | |
| 149 | /* |
| 150 | * Initiate overlapped connect() operation (well, it's non-blocking actually, |
| 151 | * since there's no overlapped version of connect()). |
| 152 | */ |
| 153 | PJ_DEF(pj_status_t) pj_ioqueue_connect( pj_ioqueue_t *ioqueue, |
| 154 | pj_ioqueue_key_t *key, |
| 155 | const pj_sockaddr_t *addr, |
| 156 | int addrlen ) |
| 157 | { |
| 158 | return -1; |
| 159 | } |
| 160 | #endif /* PJ_HAS_TCP */ |
| 161 | |