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