1
0

multi_ev.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef HEADER_CURL_MULTI_EV_H
  2. #define HEADER_CURL_MULTI_EV_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) Daniel Stenberg, <[email protected]>, 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. * SPDX-License-Identifier: curl
  24. *
  25. ***************************************************************************/
  26. #include "hash.h"
  27. struct Curl_easy;
  28. struct Curl_multi;
  29. struct easy_pollset;
  30. struct uint_bset;
  31. /* meta key for event pollset at easy handle or connection */
  32. #define CURL_META_MEV_POLLSET "meta:mev:ps"
  33. struct curl_multi_ev {
  34. struct Curl_hash sh_entries;
  35. };
  36. /* Setup/teardown of multi event book-keeping. */
  37. void Curl_multi_ev_init(struct Curl_multi *multi, size_t hashsize);
  38. void Curl_multi_ev_cleanup(struct Curl_multi *multi);
  39. /* Assign a 'user_data' to be passed to the socket callback when
  40. * invoked with the given socket. This will fail if this socket
  41. * is not active, e.g. the application has not been told to monitor it. */
  42. CURLMcode Curl_multi_ev_assign(struct Curl_multi *multi, curl_socket_t s,
  43. void *user_data);
  44. /* Assess the transfer by getting its current pollset, compute
  45. * any changes to the last one and inform the application's socket
  46. * callback if things have changed. */
  47. CURLMcode Curl_multi_ev_assess_xfer(struct Curl_multi *multi,
  48. struct Curl_easy *data);
  49. /* Assess all easy handles on the list */
  50. CURLMcode Curl_multi_ev_assess_xfer_bset(struct Curl_multi *multi,
  51. struct uint_bset *set);
  52. /* Assess the connection by getting its current pollset */
  53. CURLMcode Curl_multi_ev_assess_conn(struct Curl_multi *multi,
  54. struct Curl_easy *data,
  55. struct connectdata *conn);
  56. /* Mark all transfers tied to the given socket as dirty */
  57. void Curl_multi_ev_dirty_xfers(struct Curl_multi *multi,
  58. curl_socket_t s,
  59. bool *run_cpool);
  60. /* Socket will be closed, forget anything we know about it. */
  61. void Curl_multi_ev_socket_done(struct Curl_multi *multi,
  62. struct Curl_easy *data, curl_socket_t s);
  63. /* Transfer is removed from the multi */
  64. void Curl_multi_ev_xfer_done(struct Curl_multi *multi,
  65. struct Curl_easy *data);
  66. /* Connection is being destroyed */
  67. void Curl_multi_ev_conn_done(struct Curl_multi *multi,
  68. struct Curl_easy *data,
  69. struct connectdata *conn);
  70. #endif /* HEADER_CURL_MULTI_EV_H */