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