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
13Added-in: 7.73.0
14---
15
16# NAME
17
18curl_easy_option_next - iterate over easy setopt options
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25const struct curl_easyoption *
26curl_easy_option_next(const struct curl_easyoption *prev);
27~~~
28
29# DESCRIPTION
30
31This function returns a pointer to the first or the next *curl_easyoption*
32struct, providing an ability to iterate over all known options for
33curl_easy_setopt(3) in this instance of libcurl.
34
35Pass a **NULL** argument as **prev** to get the first option returned, or
36pass in the current option to get the next one returned. If there is no more
37option to return, curl_easy_option_next(3) returns NULL.
38
39The options returned by this functions are the ones known to this libcurl and
40information about what argument type they want.
41
42If the **CURLOT_FLAG_ALIAS** bit is set in the flags field, it means the
43name is provided for backwards compatibility as an alias.
44
45# struct
46
47~~~c
48typedef 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 */
62struct 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
75int 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
91A pointer to the *curl_easyoption* struct for the next option or NULL if
92no more options.
93