CURLOPT_PREREQDATA.3 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 2021, Max Dymond, <max.dymond@microsoft.com>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" **************************************************************************
  22. .\"
  23. .TH CURLOPT_PREREQDATA 3 "2 Aug 2021" "libcurl 7.80.0" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_PREREQDATA \- pointer passed to the pre-request callback
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PREREQDATA, void *pointer);
  30. .fi
  31. .SH DESCRIPTION
  32. Pass a \fIpointer\fP that will be untouched by libcurl and passed as the first
  33. argument in the pre-request callback set with
  34. \fICURLOPT_PREREQFUNCTION(3)\fP.
  35. .SH DEFAULT
  36. NULL
  37. .SH PROTOCOLS
  38. All
  39. .SH EXAMPLE
  40. .nf
  41. static int prereq_callback(void *clientp,
  42. char *conn_primary_ip,
  43. char *conn_local_ip,
  44. int conn_primary_port,
  45. int conn_local_port)
  46. {
  47. printf("Connection made to %s:%s\\n", conn_primary_ip, conn_primary_port);
  48. return CURL_PREREQFUNC_OK;
  49. }
  50. {
  51. struct data prereq_data;
  52. curl_easy_setopt(CURL *handle, CURLOPT_PREREQFUNCTION, prereq_callback);
  53. curl_easy_setopt(CURL *handle, CURLOPT_PREREQDATA, &prereq_data);
  54. }
  55. .fi
  56. .SH AVAILABILITY
  57. Added in 7.80.0
  58. .SH RETURN VALUE
  59. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  60. .SH "SEE ALSO"
  61. .BR CURLOPT_PREREQFUNCTION "(3) "