xmlrpc_transport.h 4.4 KB

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