CURLOPT_IOCTLDATA.3 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. .\" generated by cd2nroff 0.1 from CURLOPT_IOCTLDATA.md
  2. .TH CURLOPT_IOCTLDATA 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_IOCTLDATA \- pointer passed to I/O callback
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IOCTLDATA, void *pointer);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass the \fIpointer\fP that is untouched by libcurl and passed as the 3rd
  12. argument in the ioctl callback set with \fICURLOPT_IOCTLFUNCTION(3)\fP.
  13. .SH DEFAULT
  14. NULL
  15. .SH PROTOCOLS
  16. This functionality affects all supported protocols
  17. .SH EXAMPLE
  18. .nf
  19. #include <unistd.h> /* for lseek */
  20. struct data {
  21. int fd; /* our file descriptor */
  22. };
  23. static curlioerr ioctl_callback(CURL *handle, int cmd, void *clientp)
  24. {
  25. struct data *io = (struct data *)clientp;
  26. if(cmd == CURLIOCMD_RESTARTREAD) {
  27. lseek(io->fd, 0, SEEK_SET);
  28. return CURLIOE_OK;
  29. }
  30. return CURLIOE_UNKNOWNCMD;
  31. }
  32. int main(void)
  33. {
  34. struct data ioctl_data;
  35. CURL *curl = curl_easy_init();
  36. if(curl) {
  37. curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_callback);
  38. curl_easy_setopt(curl, CURLOPT_IOCTLDATA, &ioctl_data);
  39. }
  40. }
  41. .fi
  42. .SH DEPRECATED
  43. Deprecated since 7.18.0.
  44. .SH AVAILABILITY
  45. Added in curl 7.12.3
  46. .SH RETURN VALUE
  47. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  48. .SH SEE ALSO
  49. .BR CURLOPT_IOCTLFUNCTION (3),
  50. .BR CURLOPT_SEEKFUNCTION (3)