ioqueue_dummy.c 6.1 KB

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