CURLOPT_ADDRESS_SCOPE.3 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. .\" generated by cd2nroff 0.1 from CURLOPT_ADDRESS_SCOPE.md
  2. .TH CURLOPT_ADDRESS_SCOPE 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_ADDRESS_SCOPE \- scope id for IPv6 addresses
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ADDRESS_SCOPE, long scope);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a long specifying the scope id value to use when connecting to IPv6 addresses.
  12. .SH DEFAULT
  13. 0
  14. .SH PROTOCOLS
  15. This functionality affects all supported protocols
  16. .SH EXAMPLE
  17. .nf
  18. #include <net/if.h> /* for if_nametoindex() */
  19. int main(void)
  20. {
  21. CURL *curl = curl_easy_init();
  22. if(curl) {
  23. CURLcode ret;
  24. long my_scope_id;
  25. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  26. my_scope_id = if_nametoindex("eth0");
  27. curl_easy_setopt(curl, CURLOPT_ADDRESS_SCOPE, my_scope_id);
  28. ret = curl_easy_perform(curl);
  29. curl_easy_cleanup(curl);
  30. }
  31. }
  32. .fi
  33. .SH AVAILABILITY
  34. Added in curl 7.19.0
  35. .SH RETURN VALUE
  36. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  37. Returns CURLE_BAD_FUNCTION_ARGUMENT if set to a negative value.
  38. .SH SEE ALSO
  39. .BR CURLOPT_DEBUGFUNCTION (3),
  40. .BR CURLOPT_STDERR (3)