quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

multi_ev.h (3378B)


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