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