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 12Added-in: 7.19.0 13--- 14 15# NAME 16 17CURLOPT_ADDRESS_SCOPE - scope id for IPv6 addresses 18 19# SYNOPSIS 20 21~~~c 22#include <curl/curl.h> 23 24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ADDRESS_SCOPE, long scope); 25~~~ 26 27# DESCRIPTION 28 29Pass a long specifying the scope id value to use when connecting to IPv6 addresses. 30 31# DEFAULT 32 330 34 35# %PROTOCOLS% 36 37# EXAMPLE 38 39~~~c 40#include <net/if.h> /* for if_nametoindex() */ 41 42int main(void) 43{ 44 CURL *curl = curl_easy_init(); 45 if(curl) { 46 CURLcode ret; 47 long my_scope_id; 48 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 49 my_scope_id = if_nametoindex("eth0"); 50 curl_easy_setopt(curl, CURLOPT_ADDRESS_SCOPE, my_scope_id); 51 ret = curl_easy_perform(curl); 52 curl_easy_cleanup(curl); 53 } 54} 55~~~ 56 57# %AVAILABILITY% 58 59# RETURN VALUE 60 61Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 62Returns CURLE_BAD_FUNCTION_ARGUMENT if set to a negative value. 63