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