1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: curl_easy_option_next 5Section: 3 6Source: libcurl 7See-also: 8 - curl_easy_option_by_id (3) 9 - curl_easy_option_by_name (3) 10 - curl_easy_setopt (3) 11Protocol: 12 - All 13--- 14 15# NAME 16 17curl_easy_option_next - iterate over easy setopt options 18 19# SYNOPSIS 20 21~~~c 22#include <curl/curl.h> 23 24const struct curl_easyoption * 25curl_easy_option_next(const struct curl_easyoption *prev); 26~~~ 27 28# DESCRIPTION 29 30This function returns a pointer to the first or the next *curl_easyoption* 31struct, providing an ability to iterate over all known options for 32curl_easy_setopt(3) in this instance of libcurl. 33 34Pass a **NULL** argument as **prev** to get the first option returned, or 35pass in the current option to get the next one returned. If there is no more 36option to return, curl_easy_option_next(3) returns NULL. 37 38The options returned by this functions are the ones known to this libcurl and 39information about what argument type they want. 40 41If the **CURLOT_FLAG_ALIAS** bit is set in the flags field, it means the 42name is provided for backwards compatibility as an alias. 43 44# struct 45 46~~~c 47typedef enum { 48 CURLOT_LONG, /* long (a range of values) */ 49 CURLOT_VALUES, /* (a defined set or bitmask) */ 50 CURLOT_OFF_T, /* curl_off_t (a range of values) */ 51 CURLOT_OBJECT, /* pointer (void *) */ 52 CURLOT_STRING, /* (char * to null-terminated buffer) */ 53 CURLOT_SLIST, /* (struct curl_slist *) */ 54 CURLOT_CBPTR, /* (void * passed as-is to a callback) */ 55 CURLOT_BLOB, /* blob (struct curl_blob *) */ 56 CURLOT_FUNCTION /* function pointer */ 57} curl_easytype; 58 59/* The CURLOPTTYPE_* id ranges can still be used to figure out what type/size 60 to use for curl_easy_setopt() for the given id */ 61struct curl_easyoption { 62 const char *name; 63 CURLoption id; 64 curl_easytype type; 65 unsigned int flags; 66}; 67~~~ 68 69# EXAMPLE 70 71~~~c 72int main(void) 73{ 74 /* iterate over all available options */ 75 const struct curl_easyoption *opt; 76 opt = curl_easy_option_next(NULL); 77 while(opt) { 78 printf("Name: %s\n", opt->name); 79 opt = curl_easy_option_next(opt); 80 } 81} 82~~~ 83 84# AVAILABILITY 85 86This function was added in libcurl 7.73.0 87 88# RETURN VALUE 89 90A pointer to the *curl_easyoption* struct for the next option or NULL if 91no more options. 92