quickjs-tart

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

CURLOPT_RESOLVER_START_DATA.md (1508B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_RESOLVER_START_DATA
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_PREREQFUNCTION (3)
      9   - CURLOPT_RESOLVER_START_FUNCTION (3)
     10 Protocol:
     11   - All
     12 Added-in: 7.59.0
     13 ---
     14 
     15 # NAME
     16 
     17 CURLOPT_RESOLVER_START_DATA - pointer passed to the resolver start callback
     18 
     19 # SYNOPSIS
     20 
     21 ~~~c
     22 #include <curl/curl.h>
     23 
     24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESOLVER_START_DATA,
     25                           void *pointer);
     26 ~~~
     27 
     28 # DESCRIPTION
     29 
     30 Pass a *pointer* is be untouched by libcurl and passed as the third
     31 argument in the resolver start callback set with
     32 CURLOPT_RESOLVER_START_FUNCTION(3).
     33 
     34 # DEFAULT
     35 
     36 NULL
     37 
     38 # %PROTOCOLS%
     39 
     40 # EXAMPLE
     41 
     42 ~~~c
     43 static int resolver_start_cb(void *resolver_state, void *reserved,
     44                              void *userdata)
     45 {
     46   (void)reserved;
     47   printf("Received resolver_state=%p userdata=%p\n",
     48          resolver_state, userdata);
     49   return 0;
     50 }
     51 
     52 int main(void)
     53 {
     54   CURL *curl = curl_easy_init();
     55   if(curl) {
     56     curl_easy_setopt(curl, CURLOPT_RESOLVER_START_FUNCTION, resolver_start_cb);
     57     curl_easy_setopt(curl, CURLOPT_RESOLVER_START_DATA, curl);
     58     curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
     59     curl_easy_perform(curl);
     60     curl_easy_cleanup(curl);
     61   }
     62 }
     63 ~~~
     64 
     65 # %AVAILABILITY%
     66 
     67 # RETURN VALUE
     68 
     69 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     70 
     71 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     72 libcurl-errors(3).