xmlrpc_transport.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /* Copyright information is at the end of the file */
  2. #ifndef _XMLRPC_TRANSPORT_H_
  3. #define _XMLRPC_TRANSPORT_H_ 1
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #if defined(HAVE_PTHREADS)
  8. # include "xmlrpc_pthreads.h" /* For threading helpers. */
  9. #endif
  10. struct call_info;
  11. struct clientTransport;
  12. /*=========================================================================
  13. ** Transport function type declarations.
  14. **=========================================================================
  15. */
  16. typedef void (*transport_create)(
  17. xmlrpc_env * const envP,
  18. int const flags,
  19. const char * const appname,
  20. const char * const appversion,
  21. struct clientTransport ** const handlePP);
  22. typedef void (*transport_destroy)(
  23. struct clientTransport * const clientTransportP);
  24. typedef void (*transport_asynch_complete)(
  25. struct call_info * const callInfoP,
  26. xmlrpc_mem_block * const responseXmlP,
  27. xmlrpc_env const env);
  28. typedef void (*transport_send_request)(
  29. xmlrpc_env * const envP,
  30. struct clientTransport * const clientTransportP,
  31. xmlrpc_server_info * const serverP,
  32. xmlrpc_mem_block * const xmlP,
  33. transport_asynch_complete complete,
  34. struct call_info * const callInfoP);
  35. typedef void (*transport_call)(
  36. xmlrpc_env * const envP,
  37. struct clientTransport * const clientTransportP,
  38. xmlrpc_server_info * const serverP,
  39. xmlrpc_mem_block * const xmlP,
  40. struct call_info * const callInfoP,
  41. xmlrpc_mem_block ** const responsePP);
  42. enum timeoutType {timeout_no, timeout_yes};
  43. typedef void (*transport_finish_asynch)(
  44. struct clientTransport * const clientTransportP,
  45. enum timeoutType const timeoutType,
  46. timeout_t const timeout);
  47. struct clientTransportOps {
  48. transport_create create;
  49. transport_destroy destroy;
  50. transport_send_request send_request;
  51. transport_call call;
  52. transport_finish_asynch finish_asynch;
  53. };
  54. /*=========================================================================
  55. ** Transport Helper Functions and declarations.
  56. **=========================================================================
  57. */
  58. #if defined(HAVE_PTHREADS)
  59. typedef struct _running_thread_info
  60. {
  61. struct _running_thread_info * Next;
  62. struct _running_thread_info * Last;
  63. pthread_t _thread;
  64. } running_thread_info;
  65. /* list of running Async callback functions. */
  66. typedef struct _running_thread_list
  67. {
  68. running_thread_info * AsyncThreadHead;
  69. running_thread_info * AsyncThreadTail;
  70. } running_thread_list;
  71. /* MRB-WARNING: Only call when you have successfully
  72. ** acquired the Lock/Unlock mutex! */
  73. void register_asynch_thread (running_thread_list *list, pthread_t *thread);
  74. /* MRB-WARNING: Only call when you have successfully
  75. ** acquired the Lock/Unlock mutex! */
  76. void unregister_asynch_thread (running_thread_list *list, pthread_t *thread);
  77. #endif
  78. #ifdef __cplusplus
  79. }
  80. #endif
  81. /* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
  82. **
  83. ** Redistribution and use in source and binary forms, with or without
  84. ** modification, are permitted provided that the following conditions
  85. ** are met:
  86. ** 1. Redistributions of source code must retain the above copyright
  87. ** notice, this list of conditions and the following disclaimer.
  88. ** 2. Redistributions in binary form must reproduce the above copyright
  89. ** notice, this list of conditions and the following disclaimer in the
  90. ** documentation and/or other materials provided with the distribution.
  91. ** 3. The name of the author may not be used to endorse or promote products
  92. ** derived from this software without specific prior written permission.
  93. **
  94. ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  95. ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  96. ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  97. ** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  98. ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  99. ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  100. ** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  101. ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  102. ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  103. ** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  104. ** SUCH DAMAGE. */
  105. #endif