multiif.h 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef HEADER_CURL_MULTIIF_H
  2. #define HEADER_CURL_MULTIIF_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at https://curl.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. ***************************************************************************/
  24. /*
  25. * Prototypes for library-wide functions provided by multi.c
  26. */
  27. CURLcode Curl_updatesocket(struct Curl_easy *data);
  28. void Curl_expire(struct Curl_easy *data, timediff_t milli, expire_id);
  29. void Curl_expire_clear(struct Curl_easy *data);
  30. void Curl_expire_done(struct Curl_easy *data, expire_id id);
  31. CURLMcode Curl_update_timer(struct Curl_multi *multi) WARN_UNUSED_RESULT;
  32. void Curl_attach_connection(struct Curl_easy *data,
  33. struct connectdata *conn);
  34. void Curl_detach_connection(struct Curl_easy *data);
  35. bool Curl_multiplex_wanted(const struct Curl_multi *multi);
  36. void Curl_set_in_callback(struct Curl_easy *data, bool value);
  37. bool Curl_is_in_callback(struct Curl_easy *easy);
  38. CURLcode Curl_preconnect(struct Curl_easy *data);
  39. /* Internal version of curl_multi_init() accepts size parameters for the
  40. socket and connection hashes */
  41. struct Curl_multi *Curl_multi_handle(int hashsize, int chashsize);
  42. /* the write bits start at bit 16 for the *getsock() bitmap */
  43. #define GETSOCK_WRITEBITSTART 16
  44. #define GETSOCK_BLANK 0 /* no bits set */
  45. /* set the bit for the given sock number to make the bitmap for writable */
  46. #define GETSOCK_WRITESOCK(x) (1 << (GETSOCK_WRITEBITSTART + (x)))
  47. /* set the bit for the given sock number to make the bitmap for readable */
  48. #define GETSOCK_READSOCK(x) (1 << (x))
  49. #ifdef DEBUGBUILD
  50. /*
  51. * Curl_multi_dump is not a stable public function, this is only meant to
  52. * allow easier tracking of the internal handle's state and what sockets
  53. * they use. Only for research and development DEBUGBUILD enabled builds.
  54. */
  55. void Curl_multi_dump(struct Curl_multi *multi);
  56. #endif
  57. /* Return the value of the CURLMOPT_MAX_HOST_CONNECTIONS option */
  58. size_t Curl_multi_max_host_connections(struct Curl_multi *multi);
  59. /* Return the value of the CURLMOPT_MAX_TOTAL_CONNECTIONS option */
  60. size_t Curl_multi_max_total_connections(struct Curl_multi *multi);
  61. void Curl_multiuse_state(struct Curl_easy *data,
  62. int bundlestate); /* use BUNDLE_* defines */
  63. /*
  64. * Curl_multi_closed()
  65. *
  66. * Used by the connect code to tell the multi_socket code that one of the
  67. * sockets we were using is about to be closed. This function will then
  68. * remove it from the sockethash for this handle to make the multi_socket API
  69. * behave properly, especially for the case when libcurl will create another
  70. * socket again and it gets the same file descriptor number.
  71. */
  72. void Curl_multi_closed(struct Curl_easy *data, curl_socket_t s);
  73. /*
  74. * Add a handle and move it into PERFORM state at once. For pushed streams.
  75. */
  76. CURLMcode Curl_multi_add_perform(struct Curl_multi *multi,
  77. struct Curl_easy *data,
  78. struct connectdata *conn);
  79. /* Return the value of the CURLMOPT_MAX_CONCURRENT_STREAMS option */
  80. unsigned int Curl_multi_max_concurrent_streams(struct Curl_multi *multi);
  81. #endif /* HEADER_CURL_MULTIIF_H */