1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_DEBUGDATA 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_DEBUGFUNCTION (3) 9 - CURLOPT_STDERR (3) 10Protocol: 11 - All 12--- 13 14# NAME 15 16CURLOPT_DEBUGDATA - pointer passed to the debug callback 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEBUGDATA, void *pointer); 24~~~ 25 26# DESCRIPTION 27 28Pass a *pointer* to whatever you want passed in to your 29CURLOPT_DEBUGFUNCTION(3) in the last void * argument. This pointer is 30not used by libcurl, it is only passed to the callback. 31 32# DEFAULT 33 34NULL 35 36# EXAMPLE 37 38~~~c 39struct data { 40 void *custom; 41}; 42 43static int my_trace(CURL *handle, curl_infotype type, 44 char *data, size_t size, 45 void *clientp) 46{ 47 struct data *mine = clientp; 48 printf("our ptr: %p\n", mine->custom); 49 50 /* output debug info */ 51} 52 53int main(void) 54{ 55 CURL *curl; 56 CURLcode res; 57 struct data my_tracedata; 58 59 curl = curl_easy_init(); 60 if(curl) { 61 curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace); 62 63 curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &my_tracedata); 64 65 /* the DEBUGFUNCTION has no effect until we enable VERBOSE */ 66 curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); 67 68 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 69 res = curl_easy_perform(curl); 70 71 /* always cleanup */ 72 curl_easy_cleanup(curl); 73 } 74 return 0; 75} 76~~~ 77 78# AVAILABILITY 79 80Always 81 82# RETURN VALUE 83 84Returns CURLE_OK 85