tool_setopt.h
Go to the documentation of this file.
1 #ifndef HEADER_CURL_TOOL_SETOPT_H
2 #define HEADER_CURL_TOOL_SETOPT_H
3 /***************************************************************************
4  * _ _ ____ _
5  * Project ___| | | | _ \| |
6  * / __| | | | |_) | |
7  * | (__| |_| | _ <| |___
8  * \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
11  *
12  * This software is licensed as described in the file COPYING, which
13  * you should have received as part of this distribution. The terms
14  * are also available at https://curl.haxx.se/docs/copyright.html.
15  *
16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17  * copies of the Software, and permit persons to whom the Software is
18  * furnished to do so, under the terms of the COPYING file.
19  *
20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21  * KIND, either express or implied.
22  *
23  ***************************************************************************/
24 #include "tool_setup.h"
25 
26 /*
27  * Macros used in operate()
28  */
29 
30 #define SETOPT_CHECK(v) do { \
31  result = (v); \
32  if(result) \
33  goto show_error; \
34 } WHILE_FALSE
35 
36 #ifndef CURL_DISABLE_LIBCURL_OPTION
37 
38 /* Associate symbolic names with option values */
39 typedef struct {
40  const char *name;
41  long value;
42 } NameValue;
43 
44 typedef struct {
45  const char *name;
46  unsigned long value;
48 
49 extern const NameValue setopt_nv_CURLPROXY[];
53 extern const NameValue setopt_nv_CURL_TIMECOND[];
54 extern const NameValue setopt_nv_CURLFTPSSL_CCC[];
55 extern const NameValue setopt_nv_CURLUSESSL[];
57 extern const NameValue setopt_nv_CURL_NETRC[];
58 extern const NameValue setopt_nv_CURLPROTO[];
60 
61 /* Map options to NameValue sets */
62 #define setopt_nv_CURLOPT_HTTP_VERSION setopt_nv_CURL_HTTP_VERSION
63 #define setopt_nv_CURLOPT_HTTPAUTH setopt_nv_CURLAUTH
64 #define setopt_nv_CURLOPT_SSLVERSION setopt_nv_CURL_SSLVERSION
65 #define setopt_nv_CURLOPT_PROXY_SSLVERSION setopt_nv_CURL_SSLVERSION
66 #define setopt_nv_CURLOPT_TIMECONDITION setopt_nv_CURL_TIMECOND
67 #define setopt_nv_CURLOPT_FTP_SSL_CCC setopt_nv_CURLFTPSSL_CCC
68 #define setopt_nv_CURLOPT_USE_SSL setopt_nv_CURLUSESSL
69 #define setopt_nv_CURLOPT_SSL_OPTIONS setopt_nv_CURLSSLOPT
70 #define setopt_nv_CURLOPT_NETRC setopt_nv_CURL_NETRC
71 #define setopt_nv_CURLOPT_PROTOCOLS setopt_nv_CURLPROTO
72 #define setopt_nv_CURLOPT_REDIR_PROTOCOLS setopt_nv_CURLPROTO
73 #define setopt_nv_CURLOPT_PROXYTYPE setopt_nv_CURLPROXY
74 #define setopt_nv_CURLOPT_PROXYAUTH setopt_nv_CURLAUTH
75 #define setopt_nv_CURLOPT_SOCKS5_AUTH setopt_nv_CURLAUTH
76 
77 /* Intercept setopt calls for --libcurl */
78 
80  const char *name, CURLoption tag,
81  const NameValue *nv, long lval);
83  const char *name, CURLoption tag,
84  const NameValue *nv, long lval);
86  const char *name, CURLoption tag,
87  const NameValueUnsigned *nv, long lval);
89  const char *name, CURLoption tag,
90  curl_mime *mimepost);
92  const char *name, CURLoption tag,
93  struct curl_slist *list);
95  const char *name, CURLoption tag, ...);
96 
97 #define my_setopt(x,y,z) \
98  SETOPT_CHECK(tool_setopt(x, FALSE, global, #y, y, z))
99 
100 #define my_setopt_str(x,y,z) \
101  SETOPT_CHECK(tool_setopt(x, TRUE, global, #y, y, z))
102 
103 #define my_setopt_enum(x,y,z) \
104  SETOPT_CHECK(tool_setopt_enum(x, global, #y, y, setopt_nv_ ## y, z))
105 
106 #define my_setopt_flags(x,y,z) \
107  SETOPT_CHECK(tool_setopt_flags(x, global, #y, y, setopt_nv_ ## y, z))
108 
109 #define my_setopt_bitmask(x,y,z) \
110  SETOPT_CHECK(tool_setopt_bitmask(x, global, #y, y, setopt_nv_ ## y, z))
111 
112 #define my_setopt_mimepost(x,y,z) \
113  SETOPT_CHECK(tool_setopt_mimepost(x, global, #y, y, z))
114 
115 #define my_setopt_slist(x,y,z) \
116  SETOPT_CHECK(tool_setopt_slist(x, global, #y, y, z))
117 
118 #define res_setopt(x,y,z) tool_setopt(x, FALSE, global, #y, y, z)
119 
120 #define res_setopt_str(x,y,z) tool_setopt(x, TRUE, global, #y, y, z)
121 
122 #else /* CURL_DISABLE_LIBCURL_OPTION */
123 
124 /* No --libcurl, so pass options directly to library */
125 
126 #define my_setopt(x,y,z) \
127  SETOPT_CHECK(curl_easy_setopt(x, y, z))
128 
129 #define my_setopt_str(x,y,z) \
130  SETOPT_CHECK(curl_easy_setopt(x, y, z))
131 
132 #define my_setopt_enum(x,y,z) \
133  SETOPT_CHECK(curl_easy_setopt(x, y, z))
134 
135 #define my_setopt_flags(x,y,z) \
136  SETOPT_CHECK(curl_easy_setopt(x, y, z))
137 
138 #define my_setopt_bitmask(x,y,z) \
139  SETOPT_CHECK(curl_easy_setopt(x, y, z))
140 
141 #define my_setopt_mimepost(x,y,z) \
142  SETOPT_CHECK(curl_easy_setopt(x, y, z))
143 
144 #define my_setopt_slist(x,y,z) \
145  SETOPT_CHECK(curl_easy_setopt(x, y, z))
146 
147 #define res_setopt(x,y,z) curl_easy_setopt(x,y,z)
148 
149 #define res_setopt_str(x,y,z) curl_easy_setopt(x,y,z)
150 
151 #endif /* CURL_DISABLE_LIBCURL_OPTION */
152 
153 #endif /* HEADER_CURL_TOOL_SETOPT_H */
const char * name
Definition: tool_setopt.h:45
CURLcode tool_setopt_bitmask(CURL *curl, struct GlobalConfig *config, const char *name, CURLoption tag, const NameValueUnsigned *nv, long lval)
Definition: tool_setopt.c:340
const NameValue setopt_nv_CURLUSESSL[]
Definition: tool_setopt.c:116
const NameValue setopt_nv_CURL_TIMECOND[]
Definition: tool_setopt.c:101
Definition: ws_ssl.c:25
CURLcode tool_setopt_flags(CURL *curl, struct GlobalConfig *config, const char *name, CURLoption tag, const NameValue *nv, long lval)
Definition: tool_setopt.c:298
const NameValue setopt_nv_CURLPROXY[]
Definition: tool_setopt.c:47
CURLcode
Definition: curl.h:454
const NameValue setopt_nv_CURLFTPSSL_CCC[]
Definition: tool_setopt.c:109
CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *config, const char *name, CURLoption tag,...)
Definition: tool_setopt.c:606
const char * name
Definition: tool_setopt.h:40
const NameValue setopt_nv_CURL_HTTP_VERSION[]
Definition: tool_setopt.c:80
const char * str
Definition: unit1398.c:33
const NameValue setopt_nv_CURLPROTO[]
Definition: tool_setopt.c:139
unsigned long value
Definition: tool_setopt.h:46
CURLcode tool_setopt_slist(CURL *curl, struct GlobalConfig *config, const char *name, CURLoption tag, struct curl_slist *list)
Definition: tool_setopt.c:584
long value
Definition: tool_setopt.h:41
CURLcode tool_setopt_enum(CURL *curl, struct GlobalConfig *config, const char *name, CURLoption tag, const NameValue *nv, long lval)
Definition: tool_setopt.c:265
const NameValue setopt_nv_CURL_NETRC[]
Definition: tool_setopt.c:130
const NameValue setopt_nv_CURL_SSLVERSION[]
Definition: tool_setopt.c:89
CURLoption
Definition: curl.h:910
CURLcode tool_setopt_mimepost(CURL *curl, struct GlobalConfig *config, const char *name, CURLoption tag, curl_mime *mimepost)
Definition: tool_setopt.c:562
const NameValueUnsigned setopt_nv_CURLAUTH[]
Definition: tool_setopt.c:66
const NameValue setopt_nv_CURL_SOCKS_PROXY[]
Definition: tool_setopt.c:58
void CURL
Definition: curl.h:102
const NameValueUnsigned setopt_nv_CURLSSLOPT[]
Definition: tool_setopt.c:124
const char * name
Definition: curl_sasl.c:54
static CURL * curl
Definition: sessioninfo.c:35


rc_tagdetect_client
Author(s): Monika Florek-Jasinska , Raphael Schaller
autogenerated on Sat Feb 13 2021 03:42:16