1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_ADDRESS_SCOPE 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_DEBUGFUNCTION (3) 9 - CURLOPT_STDERR (3) 10Protocol: 11 - All 12--- 13 14# NAME 15 16CURLOPT_ADDRESS_SCOPE - scope id for IPv6 addresses 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ADDRESS_SCOPE, long scope); 24~~~ 25 26# DESCRIPTION 27 28Pass a long specifying the scope id value to use when connecting to IPv6 addresses. 29 30# DEFAULT 31 320 33 34# EXAMPLE 35 36~~~c 37#include <net/if.h> /* for if_nametoindex() */ 38 39int main(void) 40{ 41 CURL *curl = curl_easy_init(); 42 if(curl) { 43 CURLcode ret; 44 long my_scope_id; 45 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 46 my_scope_id = if_nametoindex("eth0"); 47 curl_easy_setopt(curl, CURLOPT_ADDRESS_SCOPE, my_scope_id); 48 ret = curl_easy_perform(curl); 49 curl_easy_cleanup(curl); 50 } 51} 52~~~ 53 54# AVAILABILITY 55 56Added in 7.19.0 57 58# RETURN VALUE 59 60Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 61Returns CURLE_BAD_FUNCTION_ARGUMENT if set to a negative value. 62