GNURLOPT_IOCTLDATA(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ’… GNURLOPT_IOCTLDATA(3) πŸŽ€

okay so bestie, this page is GNURLOPT_IOCTLDATA(3), and it lives in the curl_easy_setopt options manual. It’s giving β€œtiny pointer, big callback energy” ✨. No cap, every detail is staying right here.


🌸 NAME 🌸

CURLOPT_IOCTLDATA β€” custom pointer passed to I/O callback πŸ’–

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IOCTLDATA, void
*pointer);

πŸ¦‹ DESCRIPTION πŸ¦‹

Pass the pointer that will be untouched by libcurl and passed as the 3rd argument in the ioctl callback set with CURLOPT_IOCTLFUNCTION(3). That’s the whole vibe: you hand over a pointer, libcurl leaves it alone, and it shows up as that third argument in the callback. Slay πŸ’….

πŸŽ€ DEFAULT πŸŽ€

By default, the value of this parameter is NULL πŸ«₯. So if you don’t set it, it’s just… null. Iconic minimalism.

🌈 PROTOCOLS 🌈

Used with HTTP β˜•βœ¨.

🧚 EXAMPLE 🧚

Here’s the example, kept exactly as-is because we do not mess with code in this group chat 🫢:

static curlioerr ioctl_callback(CURL *handle, int cmd, void *clientp)
{
  struct data *io = (struct data *)clientp;
  if(cmd == CURLIOCMD_RESTARTREAD) {
    lseek(fd, 0, SEEK_SET);
    current_offset = 0;
    return CURLIOE_OK;
  }
  return CURLIOE_UNKNOWNCMD;
}
{
  struct data ioctl_data;
  curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_callback);
  curl_easy_setopt(curl, CURLOPT_IOCTLDATA, &ioctl_data);
}

⭐ AVAILABILITY ⭐

Added in 7.12.3 ✨.

πŸ’œ RETURN VALUE πŸ’œ

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. So yeah: supported = CURLE_OK, not supported = CURLE_UNKNOWN_OPTION, straightforward bestie behavior πŸ’–.

πŸ”₯ SEE ALSO πŸ”₯

mwah πŸ’‹ β€” page source/version: libcurl 7.37.0; date: 16 Jun 2014; from GNURLOPT_IOCTLDATA(3). Bye bestie, go pass that pointer 🫢✨

πŸ“¦ where this page comes from