/src/mhd2/src/include/microhttpd2_generated_daemon_options.h
Line | Count | Source (jump to first uncovered line) |
1 | | /** |
2 | | * The options (parameters) for MHD daemon |
3 | | */ |
4 | | enum MHD_FIXED_ENUM_APP_SET_ MHD_DaemonOption |
5 | | { /** |
6 | | * Not a real option. |
7 | | * Should not be used directly. |
8 | | * This value indicates the end of the list of the options. |
9 | | */ |
10 | | MHD_D_O_END = 0 |
11 | | , |
12 | | |
13 | | /** |
14 | | * Set MHD work (threading and polling) mode. |
15 | | * Consider use of #MHD_D_OPTION_WM_EXTERNAL_PERIODIC(), #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL(), #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_EDGE(), #MHD_D_OPTION_WM_EXTERNAL_SINGLE_FD_WATCH(), #MHD_D_OPTION_WM_WORKER_THREADS() or #MHD_D_OPTION_WM_THREAD_PER_CONNECTION() instead of direct use of this parameter. |
16 | | */ |
17 | | MHD_D_O_WORK_MODE = 40 |
18 | | , |
19 | | |
20 | | /** |
21 | | * Select a sockets watch system call used for internal polling. |
22 | | */ |
23 | | MHD_D_O_POLL_SYSCALL = 41 |
24 | | , |
25 | | |
26 | | /** |
27 | | * Instruct MHD to register all sockets every processing round. |
28 | | * |
29 | | By default (this options is not enabled) every processing round (every time |
30 | | * when #MHD_daemon_event_update() is called) MHD calls |
31 | | * #MHD_SocketRegistrationUpdateCallback only for the new sockets, for |
32 | | * the removed sockets and for the updated sockets. |
33 | | * Some sockets are registered when #MHD_daemon_start() is called. |
34 | | * |
35 | | If this options is enabled, then #MHD_SocketRegistrationUpdateCallback is |
36 | | * called for every socket each processing round. No sockets are registered when |
37 | | * the daemon is being started. |
38 | | */ |
39 | | MHD_D_O_REREGISTER_ALL = 45 |
40 | | , |
41 | | |
42 | | /** |
43 | | * Set a callback to use for logging |
44 | | */ |
45 | | MHD_D_O_LOG_CALLBACK = 60 |
46 | | , |
47 | | |
48 | | /** |
49 | | * Bind to the given TCP port and address family. |
50 | | * |
51 | | Does not work with #MHD_D_OPTION_BIND_SA() or #MHD_D_OPTION_LISTEN_SOCKET(). |
52 | | * |
53 | | If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does not listen for incoming connection. |
54 | | */ |
55 | | MHD_D_O_BIND_PORT = 80 |
56 | | , |
57 | | |
58 | | /** |
59 | | * Bind to the given socket address. |
60 | | * |
61 | | Does not work with #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_LISTEN_SOCKET(). |
62 | | * |
63 | | If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does not listen for incoming connection. |
64 | | */ |
65 | | MHD_D_O_BIND_SA = 81 |
66 | | , |
67 | | |
68 | | /** |
69 | | * Accept connections from the given socket. Socket |
70 | | * must be a TCP or UNIX domain (SOCK_STREAM) socket. |
71 | | * |
72 | | Does not work with #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA(). |
73 | | * |
74 | | If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does not listen for incoming connection. |
75 | | */ |
76 | | MHD_D_O_LISTEN_SOCKET = 82 |
77 | | , |
78 | | |
79 | | /** |
80 | | * Select mode of reusing address:port listen address. |
81 | | * |
82 | | Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used. |
83 | | */ |
84 | | MHD_D_O_LISTEN_ADDR_REUSE = 100 |
85 | | , |
86 | | |
87 | | /** |
88 | | * Configure TCP_FASTOPEN option, including setting a |
89 | | * custom @a queue_length. |
90 | | * |
91 | | Note that having a larger queue size can cause resource exhaustion |
92 | | * attack as the TCP stack has to now allocate resources for the SYN |
93 | | * packet along with its DATA. |
94 | | * |
95 | | Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used. |
96 | | */ |
97 | | MHD_D_O_TCP_FASTOPEN = 101 |
98 | | , |
99 | | |
100 | | /** |
101 | | * Use the given backlog for the listen() call. |
102 | | * |
103 | | Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used. |
104 | | * Zero parameter treated as MHD/system default. |
105 | | */ |
106 | | MHD_D_O_LISTEN_BACKLOG = 102 |
107 | | , |
108 | | |
109 | | /** |
110 | | * Inform that SIGPIPE is suppressed or handled by application. |
111 | | * If suppressed/handled, MHD uses network functions that could generate SIGPIPE, like `sendfile()`. |
112 | | * Silently ignored when MHD creates internal threads as for them SIGPIPE is suppressed automatically. |
113 | | */ |
114 | | MHD_D_O_SIGPIPE_SUPPRESSED = 103 |
115 | | , |
116 | | |
117 | | /** |
118 | | * Enable TLS (HTTPS) and select TLS backend |
119 | | */ |
120 | | MHD_D_O_TLS = 120 |
121 | | , |
122 | | |
123 | | /** |
124 | | * Provide TLS key and certificate data in-memory. |
125 | | * Works only if TLS mode is enabled. |
126 | | */ |
127 | | MHD_D_O_TLS_CERT_KEY = 121 |
128 | | , |
129 | | |
130 | | /** |
131 | | * Provide the certificate of the certificate authority (CA) to be used by the MHD daemon for client authentication. |
132 | | * Works only if TLS mode is enabled. |
133 | | */ |
134 | | MHD_D_O_TLS_CLIENT_CA = 122 |
135 | | , |
136 | | |
137 | | /** |
138 | | * Configure PSK to use for the TLS key exchange. |
139 | | */ |
140 | | MHD_D_O_TLS_PSK_CALLBACK = 130 |
141 | | , |
142 | | |
143 | | /** |
144 | | * Control ALPN for TLS connection. |
145 | | * Silently ignored for non-TLS. |
146 | | * By default ALPN is automatically used for TLS connections. |
147 | | */ |
148 | | MHD_D_O_NO_ALPN = 140 |
149 | | , |
150 | | |
151 | | /** |
152 | | * Specify inactivity timeout for connection. |
153 | | * When no activity for specified time on connection, it is closed |
154 | | * automatically. |
155 | | * Use zero for no timeout, which is also the (unsafe!) default. |
156 | | * Very large values (years) can be silently truncated to smaller values. |
157 | | */ |
158 | | MHD_D_O_DEFAULT_TIMEOUT = 160 |
159 | | , |
160 | | |
161 | | /** |
162 | | * Maximum number of (concurrent) network connections served by daemon. |
163 | | * @note The real maximum number of network connections could be smaller |
164 | | * than requested due to the system limitations, like FD_SETSIZE when |
165 | | * polling by select() is used. |
166 | | */ |
167 | | MHD_D_O_GLOBAL_CONNECTION_LIMIT = 161 |
168 | | , |
169 | | |
170 | | /** |
171 | | * Limit on the number of (concurrent) network connections made to the server from the same IP address. |
172 | | * Can be used to prevent one IP from taking over all of the allowed connections. If the same IP tries to establish more than the specified number of connections, they will be immediately rejected. |
173 | | */ |
174 | | MHD_D_O_PER_IP_LIMIT = 162 |
175 | | , |
176 | | |
177 | | /** |
178 | | * Set a policy callback that accepts/rejects connections based on the client's IP address. The callbeck function will be called before servicing any new incoming connection. |
179 | | */ |
180 | | MHD_D_O_ACCEPT_POLICY = 163 |
181 | | , |
182 | | |
183 | | /** |
184 | | * Set mode of connection memory buffer zeroing |
185 | | */ |
186 | | MHD_D_O_CONN_BUFF_ZEROING = 164 |
187 | | , |
188 | | |
189 | | /** |
190 | | * Set how strictly MHD will enforce the HTTP protocol. |
191 | | */ |
192 | | MHD_D_O_PROTOCOL_STRICT_LEVEL = 200 |
193 | | , |
194 | | |
195 | | /** |
196 | | * Set a callback to be called first for every request when the request line is received (before any parsing of the header). |
197 | | * This callback is the only way to get raw (unmodified) request URI as URI is parsed and modified by MHD in-place. |
198 | | * Mandatory URI modification may apply before this call, like binary zero replacement, as required by RFCs. |
199 | | */ |
200 | | MHD_D_O_EARLY_URI_LOGGER = 201 |
201 | | , |
202 | | |
203 | | /** |
204 | | * Disable converting plus ('+') character to space in GET parameters (URI part after '?'). |
205 | | * Plus conversion is not required by HTTP RFCs, however it required by HTML specifications, see https://url.spec.whatwg.org/#application/x-www-form-urlencoded for details. |
206 | | * By default plus is converted to space in the query part of URI. |
207 | | */ |
208 | | MHD_D_O_DISABLE_URI_QUERY_PLUS_AS_SPACE = 202 |
209 | | , |
210 | | |
211 | | /** |
212 | | * Suppresse use of 'Date:' header. |
213 | | * According to RFC should be suppressed only if the system has no RTC. |
214 | | * The 'Date:' is not suppressed (the header is enabled) by default. |
215 | | */ |
216 | | MHD_D_O_SUPPRESS_DATE_HEADER = 240 |
217 | | , |
218 | | |
219 | | /** |
220 | | * Use SHOUTcast for responses. |
221 | | * This will cause *all* responses to begin with the SHOUTcast 'ICY' line instead of 'HTTP'. |
222 | | */ |
223 | | MHD_D_O_ENABLE_SHOUTCAST = 241 |
224 | | , |
225 | | |
226 | | /** |
227 | | * Maximum memory size per connection. |
228 | | * Default is 32kb. |
229 | | * Values above 128kb are unlikely to result in much performance benefit, as half of the memory will be typically used for IO, and TCP buffers are unlikely to support window sizes above 64k on most systems. |
230 | | * The size should be large enough to fit all request headers (together with internal parsing information). |
231 | | */ |
232 | | MHD_D_O_CONN_MEMORY_LIMIT = 280 |
233 | | , |
234 | | |
235 | | /** |
236 | | * The size of the shared memory pool for accamulated upload processing. |
237 | | * The same large pool is shared for all connections server by MHD and used when application requests avoiding of incremental upload processing to accamulate complete content upload before giving it to the application. |
238 | | * Default is 8Mb. |
239 | | * Can be set to zero to disable share pool. |
240 | | */ |
241 | | MHD_D_O_LARGE_POOL_SIZE = 281 |
242 | | , |
243 | | |
244 | | /** |
245 | | * Desired size of the stack for the threads started by MHD. |
246 | | * Use 0 for system default, which is also MHD default. |
247 | | * Works only with #MHD_D_OPTION_WM_WORKER_THREADS() or #MHD_D_OPTION_WM_THREAD_PER_CONNECTION(). |
248 | | */ |
249 | | MHD_D_O_STACK_SIZE = 282 |
250 | | , |
251 | | |
252 | | /** |
253 | | * The the maximum FD value. |
254 | | * The limit is applied to all sockets used by MHD. |
255 | | * If listen socket FD is equal or higher that specified value, the daemon fail to start. |
256 | | * If new connection FD is equal or higher that specified value, the connection is rejected. |
257 | | * Useful if application uses select() for polling the sockets, system FD_SETSIZE is good value for this option in such case. |
258 | | * Silently ignored on W32 (WinSock sockets). |
259 | | */ |
260 | | MHD_D_O_FD_NUMBER_LIMIT = 283 |
261 | | , |
262 | | |
263 | | /** |
264 | | * Enable `turbo`. |
265 | | * Disables certain calls to `shutdown()`, enables aggressive non-blocking optimistic reads and other potentially unsafe optimisations. |
266 | | * Most effects only happen with internal threads with epoll. |
267 | | * The 'turbo' mode is not enabled (mode is disabled) by default. |
268 | | */ |
269 | | MHD_D_O_TURBO = 320 |
270 | | , |
271 | | |
272 | | /** |
273 | | * Disable some internal thread safety. |
274 | | * Indicates that MHD daemon will be used by application in single-threaded mode only. When this flag is set then application must call any MHD function only within a single thread. |
275 | | * This flag turns off some internal thread-safety and allows MHD making some of the internal optimisations suitable only for single-threaded environment. |
276 | | * Not compatible with any internal threads modes. |
277 | | * If MHD is compiled with custom configuration for embedded projects without threads support, this option is mandatory. |
278 | | * Thread safety is not disabled (safety is enabled) by default. |
279 | | */ |
280 | | MHD_D_O_DISABLE_THREAD_SAFETY = 321 |
281 | | , |
282 | | |
283 | | /** |
284 | | * You need to set this option if you want to disable use of HTTP Upgrade. |
285 | | * Upgrade may require usage of additional internal resources, which we can avoid providing if they will not be used. |
286 | | * You should only use this option if you do not use upgrade functionality and need a generally minor boost in performance and resources saving. |
287 | | * The upgrade is not disallowed (upgrade is allowed) by default. |
288 | | */ |
289 | | MHD_D_O_DISALLOW_UPGRADE = 322 |
290 | | , |
291 | | |
292 | | /** |
293 | | * Disable #MHD_action_suspend() functionality. |
294 | | * |
295 | | You should only use this function if you do not use suspend functionality and need a generally minor boost in performance. |
296 | | * The suspend is not disallowed (suspend is allowed) by default. |
297 | | */ |
298 | | MHD_D_O_DISALLOW_SUSPEND_RESUME = 323 |
299 | | , |
300 | | |
301 | | /** |
302 | | * Disable cookies parsing. |
303 | | * |
304 | | Disable automatic cookies processing if cookies are not used. |
305 | | * Cookies are automatically parsed by default. |
306 | | */ |
307 | | MHD_D_O_DISABLE_COOKIES = 324 |
308 | | , |
309 | | |
310 | | /** |
311 | | * Set a callback to be called for pre-start finalisation. |
312 | | * |
313 | | The specified callback will be called one time, after network initialisation, TLS pre-initialisation, but before the start of the internal threads (if allowed) |
314 | | */ |
315 | | MHD_D_O_DAEMON_READY_CALLBACK = 360 |
316 | | , |
317 | | |
318 | | /** |
319 | | * Set a function that should be called whenever a connection is started or closed. |
320 | | */ |
321 | | MHD_D_O_NOTIFY_CONNECTION = 361 |
322 | | , |
323 | | |
324 | | /** |
325 | | * Register a function that should be called whenever a stream is started or closed. |
326 | | * For HTTP/1.1 this callback is called one time for every connection. |
327 | | */ |
328 | | MHD_D_O_NOTIFY_STREAM = 362 |
329 | | , |
330 | | |
331 | | /** |
332 | | * Set strong random data to be used by MHD. |
333 | | * Currently the data is only needed for Digest Auth module. |
334 | | * Daemon support for Digest Auth is enabled automatically if this option is used. |
335 | | * The recommended size is between 8 and 32 bytes. Security can be lower for sizes less or equal four. |
336 | | * Sizes larger then 32 (or, probably, larger than 16 - debatable) will not increase the security. |
337 | | */ |
338 | | MHD_D_O_RANDOM_ENTROPY = 400 |
339 | | , |
340 | | |
341 | | /** |
342 | | * Specify the size of the internal hash map array that tracks generated digest nonces usage. |
343 | | * When the size of the map is too small then need to handle concurrent DAuth requests, a lot of stale nonce results will be produced. |
344 | | * By default the size is 1000 entries. |
345 | | */ |
346 | | MHD_D_O_AUTH_DIGEST_MAP_SIZE = 401 |
347 | | , |
348 | | |
349 | | /** |
350 | | * Nonce validity time (in seconds) used for Digest Auth. |
351 | | * If followed by zero value the value is silently ignored. |
352 | | * @see #MHD_digest_auth_check(), MHD_digest_auth_check_digest() |
353 | | */ |
354 | | MHD_D_O_AUTH_DIGEST_NONCE_TIMEOUT = 403 |
355 | | , |
356 | | |
357 | | /** |
358 | | * Default maximum nc (nonce count) value used for Digest Auth. |
359 | | * If followed by zero value the value is silently ignored. |
360 | | * @see #MHD_digest_auth_check(), MHD_digest_auth_check_digest() |
361 | | */ |
362 | | MHD_D_O_AUTH_DIGEST_DEF_MAX_NC = 404 |
363 | | , |
364 | | |
365 | | /** |
366 | | * The sentinel value. |
367 | | * This value enforces specific underlying integer type for the enum. |
368 | | * Do not use. |
369 | | */ |
370 | | MHD_D_O_SENTINEL = 65535 |
371 | | |
372 | | }; |
373 | | |
374 | | /** |
375 | | * Data for #MHD_D_O_LOG_CALLBACK |
376 | | */ |
377 | | struct MHD_DaemonOptionValueLog |
378 | | { |
379 | | /** |
380 | | * the callback to use for logging, |
381 | | * NULL to disable logging. |
382 | | * The logging to stderr is enabled by default. |
383 | | */ |
384 | | MHD_LoggingCallback v_log_cb; |
385 | | |
386 | | /** |
387 | | * the closure for the logging callback |
388 | | */ |
389 | | void *v_log_cb_cls; |
390 | | |
391 | | }; |
392 | | |
393 | | /** |
394 | | * Data for #MHD_D_O_BIND_PORT |
395 | | */ |
396 | | struct MHD_DaemonOptionValueBind |
397 | | { |
398 | | /** |
399 | | * the address family to use, |
400 | | * the #MHD_AF_NONE to disable listen socket (the same effect as if this option is not used) |
401 | | */ |
402 | | enum MHD_AddressFamily v_af; |
403 | | |
404 | | /** |
405 | | * port to use, 0 to let system assign any free port, |
406 | | * ignored if @a af is #MHD_AF_NONE |
407 | | */ |
408 | | uint_least16_t v_port; |
409 | | |
410 | | }; |
411 | | |
412 | | /** |
413 | | * Data for #MHD_D_O_BIND_SA |
414 | | */ |
415 | | struct MHD_DaemonOptionValueSA |
416 | | { |
417 | | /** |
418 | | * the size of the socket address pointed by @a sa. |
419 | | */ |
420 | | size_t v_sa_len; |
421 | | |
422 | | /** |
423 | | * the address to bind to; can be IPv4 (AF_INET), IPv6 (AF_INET6) or even a UNIX domain socket (AF_UNIX) |
424 | | */ |
425 | | /* const */ struct sockaddr *v_sa; |
426 | | |
427 | | /** |
428 | | * When a previous version of the protocol exist (like IPv4 when @a v_sa is IPv6) bind to both protocols (IPv6 and IPv4). |
429 | | */ |
430 | | enum MHD_Bool v_dual; |
431 | | |
432 | | }; |
433 | | |
434 | | /** |
435 | | * Data for #MHD_D_O_TCP_FASTOPEN |
436 | | */ |
437 | | struct MHD_DaemonOptionValueTFO |
438 | | { |
439 | | /** |
440 | | * the type use of of TCP FastOpen |
441 | | */ |
442 | | enum MHD_TCPFastOpenType v_option; |
443 | | |
444 | | /** |
445 | | * the length of the queue, zero to use system or MHD default, |
446 | | * silently ignored on platforms without support for custom queue size |
447 | | */ |
448 | | unsigned int v_queue_length; |
449 | | |
450 | | }; |
451 | | |
452 | | /** |
453 | | * Data for #MHD_D_O_TLS_CERT_KEY |
454 | | */ |
455 | | struct MHD_DaemonOptionValueTlsCert |
456 | | { |
457 | | /** |
458 | | * The X.509 certificates chain in PEM format loaded into memory (not a filename). |
459 | | * The first certificate must be the server certificate, following by the chain of signing |
460 | | * certificates up to (but not including) CA root certificate. |
461 | | */ |
462 | | /* const */ char *v_mem_cert; |
463 | | |
464 | | /** |
465 | | * the private key in PEM format loaded into memory (not a filename) |
466 | | */ |
467 | | const char *v_mem_key; |
468 | | |
469 | | /** |
470 | | * the option passphrase phrase to decrypt the private key, |
471 | | * could be NULL if private key does not need a password |
472 | | */ |
473 | | const char *v_mem_pass; |
474 | | |
475 | | }; |
476 | | |
477 | | /** |
478 | | * Data for #MHD_D_O_TLS_PSK_CALLBACK |
479 | | */ |
480 | | struct MHD_DaemonOptionValueTlsPskCB |
481 | | { |
482 | | /** |
483 | | * the function to call to obtain pre-shared key |
484 | | */ |
485 | | MHD_PskServerCredentialsCallback v_psk_cb; |
486 | | |
487 | | /** |
488 | | * the closure for @a psk_cb |
489 | | */ |
490 | | void *v_psk_cb_cls; |
491 | | |
492 | | }; |
493 | | |
494 | | /** |
495 | | * Data for #MHD_D_O_ACCEPT_POLICY |
496 | | */ |
497 | | struct MHD_DaemonOptionValueAcceptPol |
498 | | { |
499 | | /** |
500 | | * the accept policy callback |
501 | | */ |
502 | | MHD_AcceptPolicyCallback v_apc; |
503 | | |
504 | | /** |
505 | | * the closure for the callback |
506 | | */ |
507 | | void *v_apc_cls; |
508 | | |
509 | | }; |
510 | | |
511 | | /** |
512 | | * Data for #MHD_D_O_PROTOCOL_STRICT_LEVEL |
513 | | */ |
514 | | struct MHD_DaemonOptionValueStrctLvl |
515 | | { |
516 | | /** |
517 | | * the level of strictness |
518 | | */ |
519 | | enum MHD_ProtocolStrictLevel v_sl; |
520 | | |
521 | | /** |
522 | | * the way how to use the requested level |
523 | | */ |
524 | | enum MHD_UseStictLevel v_how; |
525 | | |
526 | | }; |
527 | | |
528 | | /** |
529 | | * Data for #MHD_D_O_EARLY_URI_LOGGER |
530 | | */ |
531 | | struct MHD_DaemonOptionValueUriCB |
532 | | { |
533 | | /** |
534 | | * the early URI callback |
535 | | */ |
536 | | MHD_EarlyUriLogCallback v_cb; |
537 | | |
538 | | /** |
539 | | * the closure for the callback |
540 | | */ |
541 | | void *v_cls; |
542 | | |
543 | | }; |
544 | | |
545 | | /** |
546 | | * Data for #MHD_D_O_DAEMON_READY_CALLBACK |
547 | | */ |
548 | | struct MHD_DaemonOptionValueReadyCB |
549 | | { |
550 | | /** |
551 | | * the pre-start callback |
552 | | */ |
553 | | MHD_DaemonReadyCallback v_cb; |
554 | | |
555 | | /** |
556 | | * the closure for the callback |
557 | | */ |
558 | | void *v_cb_cls; |
559 | | |
560 | | }; |
561 | | |
562 | | /** |
563 | | * Data for #MHD_D_O_NOTIFY_CONNECTION |
564 | | */ |
565 | | struct MHD_DaemonOptionValueNotifConnCB |
566 | | { |
567 | | /** |
568 | | * the callback for notifications |
569 | | */ |
570 | | MHD_NotifyConnectionCallback v_ncc; |
571 | | |
572 | | /** |
573 | | * the closure for the callback |
574 | | */ |
575 | | void *v_cls; |
576 | | |
577 | | }; |
578 | | |
579 | | /** |
580 | | * Data for #MHD_D_O_NOTIFY_STREAM |
581 | | */ |
582 | | struct MHD_DaemonOptionValueNotifStreamCB |
583 | | { |
584 | | /** |
585 | | * the callback for notifications |
586 | | */ |
587 | | MHD_NotifyStreamCallback v_nsc; |
588 | | |
589 | | /** |
590 | | * the closure for the callback |
591 | | */ |
592 | | void *v_cls; |
593 | | |
594 | | }; |
595 | | |
596 | | /** |
597 | | * Data for #MHD_D_O_RANDOM_ENTROPY |
598 | | */ |
599 | | struct MHD_DaemonOptionEntropySeed |
600 | | { |
601 | | /** |
602 | | * the size of the buffer |
603 | | */ |
604 | | size_t v_buf_size; |
605 | | |
606 | | /** |
607 | | * the buffer with strong random data, the content will be copied by MHD |
608 | | */ |
609 | | /* const */ void *v_buf; |
610 | | |
611 | | }; |
612 | | |
613 | | /** |
614 | | * Parameters for MHD daemon options |
615 | | */ |
616 | | union MHD_DaemonOptionValue |
617 | | { |
618 | | /** |
619 | | * Value for #MHD_D_O_WORK_MODE. |
620 | | * the object created by one of the next functions/macros: #MHD_WM_OPTION_EXTERNAL_PERIODIC(), #MHD_WM_OPTION_EXTERNAL_EVENT_LOOP_CB_LEVEL(), #MHD_WM_OPTION_EXTERNAL_EVENT_LOOP_CB_EDGE(), #MHD_WM_OPTION_EXTERNAL_SINGLE_FD_WATCH(), #MHD_WM_OPTION_WORKER_THREADS(), #MHD_WM_OPTION_THREAD_PER_CONNECTION() |
621 | | */ |
622 | | struct MHD_WorkModeWithParam work_mode; |
623 | | |
624 | | /** |
625 | | * Value for #MHD_D_O_POLL_SYSCALL. |
626 | | * FIXME |
627 | | */ |
628 | | enum MHD_SockPollSyscall poll_syscall; |
629 | | |
630 | | /** |
631 | | * Value for #MHD_D_O_REREGISTER_ALL. |
632 | | */ |
633 | | enum MHD_Bool reregister_all; |
634 | | |
635 | | /** |
636 | | * Value for #MHD_D_O_LOG_CALLBACK. |
637 | | * the callback to use for logging, |
638 | | * NULL to disable logging. |
639 | | * The logging to stderr is enabled by default. |
640 | | */ |
641 | | struct MHD_DaemonOptionValueLog log_callback; |
642 | | |
643 | | /** |
644 | | * Value for #MHD_D_O_BIND_PORT. |
645 | | * the address family to use, |
646 | | * the #MHD_AF_NONE to disable listen socket (the same effect as if this option is not used) |
647 | | */ |
648 | | struct MHD_DaemonOptionValueBind bind_port; |
649 | | |
650 | | /** |
651 | | * Value for #MHD_D_O_BIND_SA. |
652 | | * the size of the socket address pointed by @a sa. |
653 | | */ |
654 | | struct MHD_DaemonOptionValueSA bind_sa; |
655 | | |
656 | | /** |
657 | | * Value for #MHD_D_O_LISTEN_SOCKET. |
658 | | * the listen socket to use, ignored if set to #MHD_INVALID_SOCKET |
659 | | */ |
660 | | MHD_Socket listen_socket; |
661 | | |
662 | | /** |
663 | | * Value for #MHD_D_O_LISTEN_ADDR_REUSE. |
664 | | * FIXME |
665 | | */ |
666 | | enum MHD_DaemonOptionBindType listen_addr_reuse; |
667 | | |
668 | | /** |
669 | | * Value for #MHD_D_O_TCP_FASTOPEN. |
670 | | * the type use of of TCP FastOpen |
671 | | */ |
672 | | struct MHD_DaemonOptionValueTFO tcp_fastopen; |
673 | | |
674 | | /** |
675 | | * Value for #MHD_D_O_LISTEN_BACKLOG. |
676 | | * FIXME |
677 | | */ |
678 | | unsigned int listen_backlog; |
679 | | |
680 | | /** |
681 | | * Value for #MHD_D_O_SIGPIPE_SUPPRESSED. |
682 | | */ |
683 | | enum MHD_Bool sigpipe_suppressed; |
684 | | |
685 | | /** |
686 | | * Value for #MHD_D_O_TLS. |
687 | | * the TLS backend to use, |
688 | | * #MHD_TLS_BACKEND_NONE for non-TLS (plain TCP) connections |
689 | | */ |
690 | | enum MHD_TlsBackend tls; |
691 | | |
692 | | /** |
693 | | * Value for #MHD_D_O_TLS_CERT_KEY. |
694 | | * The X.509 certificates chain in PEM format loaded into memory (not a filename). |
695 | | * The first certificate must be the server certificate, following by the chain of signing |
696 | | * certificates up to (but not including) CA root certificate. |
697 | | */ |
698 | | struct MHD_DaemonOptionValueTlsCert tls_cert_key; |
699 | | |
700 | | /** |
701 | | * Value for #MHD_D_O_TLS_CLIENT_CA. |
702 | | * the CA certificate in memory (not a filename) |
703 | | */ |
704 | | const char *tls_client_ca; |
705 | | |
706 | | /** |
707 | | * Value for #MHD_D_O_TLS_PSK_CALLBACK. |
708 | | * the function to call to obtain pre-shared key |
709 | | */ |
710 | | struct MHD_DaemonOptionValueTlsPskCB tls_psk_callback; |
711 | | |
712 | | /** |
713 | | * Value for #MHD_D_O_NO_ALPN. |
714 | | */ |
715 | | enum MHD_Bool no_alpn; |
716 | | |
717 | | /** |
718 | | * Value for #MHD_D_O_DEFAULT_TIMEOUT. |
719 | | * the in seconds, zero for no timeout |
720 | | */ |
721 | | unsigned int default_timeout; |
722 | | |
723 | | /** |
724 | | * Value for #MHD_D_O_GLOBAL_CONNECTION_LIMIT. |
725 | | * FIXME |
726 | | */ |
727 | | unsigned int global_connection_limit; |
728 | | |
729 | | /** |
730 | | * Value for #MHD_D_O_PER_IP_LIMIT. |
731 | | * FIXME |
732 | | */ |
733 | | unsigned int per_ip_limit; |
734 | | |
735 | | /** |
736 | | * Value for #MHD_D_O_ACCEPT_POLICY. |
737 | | * the accept policy callback |
738 | | */ |
739 | | struct MHD_DaemonOptionValueAcceptPol accept_policy; |
740 | | |
741 | | /** |
742 | | * Value for #MHD_D_O_CONN_BUFF_ZEROING. |
743 | | * buffer zeroing mode |
744 | | */ |
745 | | enum MHD_ConnBufferZeroingMode conn_buff_zeroing; |
746 | | |
747 | | /** |
748 | | * Value for #MHD_D_O_PROTOCOL_STRICT_LEVEL. |
749 | | * the level of strictness |
750 | | */ |
751 | | struct MHD_DaemonOptionValueStrctLvl protocol_strict_level; |
752 | | |
753 | | /** |
754 | | * Value for #MHD_D_O_EARLY_URI_LOGGER. |
755 | | * the early URI callback |
756 | | */ |
757 | | struct MHD_DaemonOptionValueUriCB early_uri_logger; |
758 | | |
759 | | /** |
760 | | * Value for #MHD_D_O_DISABLE_URI_QUERY_PLUS_AS_SPACE. |
761 | | */ |
762 | | enum MHD_Bool disable_uri_query_plus_as_space; |
763 | | |
764 | | /** |
765 | | * Value for #MHD_D_O_SUPPRESS_DATE_HEADER. |
766 | | */ |
767 | | enum MHD_Bool suppress_date_header; |
768 | | |
769 | | /** |
770 | | * Value for #MHD_D_O_ENABLE_SHOUTCAST. |
771 | | */ |
772 | | enum MHD_Bool enable_shoutcast; |
773 | | |
774 | | /** |
775 | | * Value for #MHD_D_O_CONN_MEMORY_LIMIT. |
776 | | */ |
777 | | size_t conn_memory_limit; |
778 | | |
779 | | /** |
780 | | * Value for #MHD_D_O_LARGE_POOL_SIZE. |
781 | | */ |
782 | | size_t large_pool_size; |
783 | | |
784 | | /** |
785 | | * Value for #MHD_D_O_STACK_SIZE. |
786 | | */ |
787 | | size_t stack_size; |
788 | | |
789 | | /** |
790 | | * Value for #MHD_D_O_FD_NUMBER_LIMIT. |
791 | | * FIXME |
792 | | */ |
793 | | MHD_Socket fd_number_limit; |
794 | | |
795 | | /** |
796 | | * Value for #MHD_D_O_TURBO. |
797 | | */ |
798 | | enum MHD_Bool turbo; |
799 | | |
800 | | /** |
801 | | * Value for #MHD_D_O_DISABLE_THREAD_SAFETY. |
802 | | */ |
803 | | enum MHD_Bool disable_thread_safety; |
804 | | |
805 | | /** |
806 | | * Value for #MHD_D_O_DISALLOW_UPGRADE. |
807 | | */ |
808 | | enum MHD_Bool disallow_upgrade; |
809 | | |
810 | | /** |
811 | | * Value for #MHD_D_O_DISALLOW_SUSPEND_RESUME. |
812 | | */ |
813 | | enum MHD_Bool disallow_suspend_resume; |
814 | | |
815 | | /** |
816 | | * Value for #MHD_D_O_DISABLE_COOKIES. |
817 | | */ |
818 | | enum MHD_Bool disable_cookies; |
819 | | |
820 | | /** |
821 | | * Value for #MHD_D_O_DAEMON_READY_CALLBACK. |
822 | | * the pre-start callback |
823 | | */ |
824 | | struct MHD_DaemonOptionValueReadyCB daemon_ready_callback; |
825 | | |
826 | | /** |
827 | | * Value for #MHD_D_O_NOTIFY_CONNECTION. |
828 | | * the callback for notifications |
829 | | */ |
830 | | struct MHD_DaemonOptionValueNotifConnCB notify_connection; |
831 | | |
832 | | /** |
833 | | * Value for #MHD_D_O_NOTIFY_STREAM. |
834 | | * the callback for notifications |
835 | | */ |
836 | | struct MHD_DaemonOptionValueNotifStreamCB notify_stream; |
837 | | |
838 | | /** |
839 | | * Value for #MHD_D_O_RANDOM_ENTROPY. |
840 | | * the size of the buffer |
841 | | */ |
842 | | struct MHD_DaemonOptionEntropySeed random_entropy; |
843 | | |
844 | | /** |
845 | | * Value for #MHD_D_O_AUTH_DIGEST_MAP_SIZE. |
846 | | * the size of the map array |
847 | | */ |
848 | | size_t auth_digest_map_size; |
849 | | |
850 | | /** |
851 | | * Value for #MHD_D_O_AUTH_DIGEST_NONCE_TIMEOUT. |
852 | | * FIXME |
853 | | */ |
854 | | unsigned int auth_digest_nonce_timeout; |
855 | | |
856 | | /** |
857 | | * Value for #MHD_D_O_AUTH_DIGEST_DEF_MAX_NC. |
858 | | * FIXME |
859 | | */ |
860 | | uint_fast32_t auth_digest_def_max_nc; |
861 | | |
862 | | }; |
863 | | |
864 | | |
865 | | struct MHD_DaemonOptionAndValue |
866 | | { |
867 | | /** |
868 | | * The daemon configuration option |
869 | | */ |
870 | | enum MHD_DaemonOption opt; |
871 | | |
872 | | /** |
873 | | * The value for the @a opt option |
874 | | */ |
875 | | union MHD_DaemonOptionValue val; |
876 | | }; |
877 | | |
878 | | #if defined(MHD_USE_COMPOUND_LITERALS) && defined(MHD_USE_DESIG_NEST_INIT) |
879 | | /** |
880 | | * Set MHD work (threading and polling) mode. |
881 | | * Consider use of #MHD_D_OPTION_WM_EXTERNAL_PERIODIC(), #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL(), #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_EDGE(), #MHD_D_OPTION_WM_EXTERNAL_SINGLE_FD_WATCH(), #MHD_D_OPTION_WM_WORKER_THREADS() or #MHD_D_OPTION_WM_THREAD_PER_CONNECTION() instead of direct use of this parameter. |
882 | | * @param wmp the object created by one of the next functions/macros: #MHD_WM_OPTION_EXTERNAL_PERIODIC(), #MHD_WM_OPTION_EXTERNAL_EVENT_LOOP_CB_LEVEL(), #MHD_WM_OPTION_EXTERNAL_EVENT_LOOP_CB_EDGE(), #MHD_WM_OPTION_EXTERNAL_SINGLE_FD_WATCH(), #MHD_WM_OPTION_WORKER_THREADS(), #MHD_WM_OPTION_THREAD_PER_CONNECTION() |
883 | | * @return structure with the requested setting |
884 | | */ |
885 | | # define MHD_D_OPTION_WORK_MODE(wmp) \ |
886 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
887 | | (const struct MHD_DaemonOptionAndValue) \ |
888 | | { \ |
889 | | .opt = MHD_D_O_WORK_MODE, \ |
890 | | .val.work_mode = (wmp) \ |
891 | | } \ |
892 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
893 | | /** |
894 | | * Select a sockets watch system call used for internal polling. |
895 | | * @param els FIXME |
896 | | * @return structure with the requested setting |
897 | | */ |
898 | | # define MHD_D_OPTION_POLL_SYSCALL(els) \ |
899 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
900 | | (const struct MHD_DaemonOptionAndValue) \ |
901 | | { \ |
902 | | .opt = MHD_D_O_POLL_SYSCALL, \ |
903 | | .val.poll_syscall = (els) \ |
904 | | } \ |
905 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
906 | | /** |
907 | | * Instruct MHD to register all sockets every processing round. |
908 | | * |
909 | | By default (this options is not enabled) every processing round (every time |
910 | | * when #MHD_daemon_event_update() is called) MHD calls |
911 | | * #MHD_SocketRegistrationUpdateCallback only for the new sockets, for |
912 | | * the removed sockets and for the updated sockets. |
913 | | * Some sockets are registered when #MHD_daemon_start() is called. |
914 | | * |
915 | | If this options is enabled, then #MHD_SocketRegistrationUpdateCallback is |
916 | | * called for every socket each processing round. No sockets are registered when |
917 | | * the daemon is being started. |
918 | | * @param value the value of the parameter * @return structure with the requested setting |
919 | | */ |
920 | | # define MHD_D_OPTION_REREGISTER_ALL(value) \ |
921 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
922 | | (const struct MHD_DaemonOptionAndValue) \ |
923 | | { \ |
924 | | .opt = MHD_D_O_REREGISTER_ALL, \ |
925 | | .val.reregister_all = (value) \ |
926 | | } \ |
927 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
928 | | /** |
929 | | * Set a callback to use for logging |
930 | | * @param log_cb the callback to use for logging, |
931 | | * NULL to disable logging. |
932 | | * The logging to stderr is enabled by default. |
933 | | * @param log_cb_cls the closure for the logging callback |
934 | | * @return structure with the requested setting |
935 | | */ |
936 | | # define MHD_D_OPTION_LOG_CALLBACK(log_cb,log_cb_cls) \ |
937 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
938 | | (const struct MHD_DaemonOptionAndValue) \ |
939 | | { \ |
940 | | .opt = MHD_D_O_LOG_CALLBACK, \ |
941 | | .val.log_callback.v_log_cb = (log_cb), \ |
942 | | .val.log_callback.v_log_cb_cls = (log_cb_cls) \ |
943 | | } \ |
944 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
945 | | /** |
946 | | * Bind to the given TCP port and address family. |
947 | | * |
948 | | Does not work with #MHD_D_OPTION_BIND_SA() or #MHD_D_OPTION_LISTEN_SOCKET(). |
949 | | * |
950 | | If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does not listen for incoming connection. |
951 | | * @param af the address family to use, |
952 | | * the #MHD_AF_NONE to disable listen socket (the same effect as if this option is not used) |
953 | | * @param port port to use, 0 to let system assign any free port, |
954 | | * ignored if @a af is #MHD_AF_NONE |
955 | | * @return structure with the requested setting |
956 | | */ |
957 | | # define MHD_D_OPTION_BIND_PORT(af,port) \ |
958 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
959 | | (const struct MHD_DaemonOptionAndValue) \ |
960 | | { \ |
961 | | .opt = MHD_D_O_BIND_PORT, \ |
962 | | .val.bind_port.v_af = (af), \ |
963 | | .val.bind_port.v_port = (port) \ |
964 | | } \ |
965 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
966 | | /** |
967 | | * Bind to the given socket address. |
968 | | * |
969 | | Does not work with #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_LISTEN_SOCKET(). |
970 | | * |
971 | | If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does not listen for incoming connection. |
972 | | * @param sa_len the size of the socket address pointed by @a sa. |
973 | | * @param sa the address to bind to; can be IPv4 (AF_INET), IPv6 (AF_INET6) or even a UNIX domain socket (AF_UNIX) |
974 | | * @param dual When a previous version of the protocol exist (like IPv4 when @a v_sa is IPv6) bind to both protocols (IPv6 and IPv4). |
975 | | * @return structure with the requested setting |
976 | | */ |
977 | | # define MHD_D_OPTION_BIND_SA(sa_len,sa,dual) \ |
978 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
979 | | (const struct MHD_DaemonOptionAndValue) \ |
980 | | { \ |
981 | | .opt = MHD_D_O_BIND_SA, \ |
982 | | .val.bind_sa.v_sa_len = (sa_len), \ |
983 | | .val.bind_sa.v_sa = (sa), \ |
984 | | .val.bind_sa.v_dual = (dual) \ |
985 | | } \ |
986 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
987 | | /** |
988 | | * Accept connections from the given socket. Socket |
989 | | * must be a TCP or UNIX domain (SOCK_STREAM) socket. |
990 | | * |
991 | | Does not work with #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA(). |
992 | | * |
993 | | If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does not listen for incoming connection. |
994 | | * @param listen_fd the listen socket to use, ignored if set to #MHD_INVALID_SOCKET |
995 | | * @return structure with the requested setting |
996 | | */ |
997 | | # define MHD_D_OPTION_LISTEN_SOCKET(listen_fd) \ |
998 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
999 | | (const struct MHD_DaemonOptionAndValue) \ |
1000 | | { \ |
1001 | | .opt = MHD_D_O_LISTEN_SOCKET, \ |
1002 | | .val.listen_socket = (listen_fd) \ |
1003 | | } \ |
1004 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1005 | | /** |
1006 | | * Select mode of reusing address:port listen address. |
1007 | | * |
1008 | | Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used. |
1009 | | * @param reuse_type FIXME |
1010 | | * @return structure with the requested setting |
1011 | | */ |
1012 | | # define MHD_D_OPTION_LISTEN_ADDR_REUSE(reuse_type) \ |
1013 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1014 | | (const struct MHD_DaemonOptionAndValue) \ |
1015 | | { \ |
1016 | | .opt = MHD_D_O_LISTEN_ADDR_REUSE, \ |
1017 | | .val.listen_addr_reuse = (reuse_type) \ |
1018 | | } \ |
1019 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1020 | | /** |
1021 | | * Configure TCP_FASTOPEN option, including setting a |
1022 | | * custom @a queue_length. |
1023 | | * |
1024 | | Note that having a larger queue size can cause resource exhaustion |
1025 | | * attack as the TCP stack has to now allocate resources for the SYN |
1026 | | * packet along with its DATA. |
1027 | | * |
1028 | | Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used. |
1029 | | * @param option the type use of of TCP FastOpen |
1030 | | * @param queue_length the length of the queue, zero to use system or MHD default, |
1031 | | * silently ignored on platforms without support for custom queue size |
1032 | | * @return structure with the requested setting |
1033 | | */ |
1034 | | # define MHD_D_OPTION_TCP_FASTOPEN(option,queue_length) \ |
1035 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1036 | | (const struct MHD_DaemonOptionAndValue) \ |
1037 | | { \ |
1038 | | .opt = MHD_D_O_TCP_FASTOPEN, \ |
1039 | | .val.tcp_fastopen.v_option = (option), \ |
1040 | | .val.tcp_fastopen.v_queue_length = (queue_length) \ |
1041 | | } \ |
1042 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1043 | | /** |
1044 | | * Use the given backlog for the listen() call. |
1045 | | * |
1046 | | Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used. |
1047 | | * Zero parameter treated as MHD/system default. |
1048 | | * @param backlog_size FIXME |
1049 | | * @return structure with the requested setting |
1050 | | */ |
1051 | | # define MHD_D_OPTION_LISTEN_BACKLOG(backlog_size) \ |
1052 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1053 | | (const struct MHD_DaemonOptionAndValue) \ |
1054 | | { \ |
1055 | | .opt = MHD_D_O_LISTEN_BACKLOG, \ |
1056 | | .val.listen_backlog = (backlog_size) \ |
1057 | | } \ |
1058 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1059 | | /** |
1060 | | * Inform that SIGPIPE is suppressed or handled by application. |
1061 | | * If suppressed/handled, MHD uses network functions that could generate SIGPIPE, like `sendfile()`. |
1062 | | * Silently ignored when MHD creates internal threads as for them SIGPIPE is suppressed automatically. |
1063 | | * @param value the value of the parameter * @return structure with the requested setting |
1064 | | */ |
1065 | | # define MHD_D_OPTION_SIGPIPE_SUPPRESSED(value) \ |
1066 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1067 | | (const struct MHD_DaemonOptionAndValue) \ |
1068 | | { \ |
1069 | | .opt = MHD_D_O_SIGPIPE_SUPPRESSED, \ |
1070 | | .val.sigpipe_suppressed = (value) \ |
1071 | | } \ |
1072 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1073 | | /** |
1074 | | * Enable TLS (HTTPS) and select TLS backend |
1075 | | * @param backend the TLS backend to use, |
1076 | | * #MHD_TLS_BACKEND_NONE for non-TLS (plain TCP) connections |
1077 | | * @return structure with the requested setting |
1078 | | */ |
1079 | | # define MHD_D_OPTION_TLS(backend) \ |
1080 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1081 | | (const struct MHD_DaemonOptionAndValue) \ |
1082 | | { \ |
1083 | | .opt = MHD_D_O_TLS, \ |
1084 | | .val.tls = (backend) \ |
1085 | | } \ |
1086 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1087 | | /** |
1088 | | * Provide TLS key and certificate data in-memory. |
1089 | | * Works only if TLS mode is enabled. |
1090 | | * @param mem_cert The X.509 certificates chain in PEM format loaded into memory (not a filename). |
1091 | | * The first certificate must be the server certificate, following by the chain of signing |
1092 | | * certificates up to (but not including) CA root certificate. |
1093 | | * @param mem_key the private key in PEM format loaded into memory (not a filename) |
1094 | | * @param mem_pass the option passphrase phrase to decrypt the private key, |
1095 | | * could be NULL if private key does not need a password |
1096 | | * @return structure with the requested setting |
1097 | | */ |
1098 | | # define MHD_D_OPTION_TLS_CERT_KEY(mem_cert,mem_key,mem_pass) \ |
1099 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1100 | | (const struct MHD_DaemonOptionAndValue) \ |
1101 | | { \ |
1102 | | .opt = MHD_D_O_TLS_CERT_KEY, \ |
1103 | | .val.tls_cert_key.v_mem_cert = (mem_cert), \ |
1104 | | .val.tls_cert_key.v_mem_key = (mem_key), \ |
1105 | | .val.tls_cert_key.v_mem_pass = (mem_pass) \ |
1106 | | } \ |
1107 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1108 | | /** |
1109 | | * Provide the certificate of the certificate authority (CA) to be used by the MHD daemon for client authentication. |
1110 | | * Works only if TLS mode is enabled. |
1111 | | * @param mem_client_ca the CA certificate in memory (not a filename) |
1112 | | * @return structure with the requested setting |
1113 | | */ |
1114 | | # define MHD_D_OPTION_TLS_CLIENT_CA(mem_client_ca) \ |
1115 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1116 | | (const struct MHD_DaemonOptionAndValue) \ |
1117 | | { \ |
1118 | | .opt = MHD_D_O_TLS_CLIENT_CA, \ |
1119 | | .val.tls_client_ca = (mem_client_ca) \ |
1120 | | } \ |
1121 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1122 | | /** |
1123 | | * Configure PSK to use for the TLS key exchange. |
1124 | | * @param psk_cb the function to call to obtain pre-shared key |
1125 | | * @param psk_cb_cls the closure for @a psk_cb |
1126 | | * @return structure with the requested setting |
1127 | | */ |
1128 | | # define MHD_D_OPTION_TLS_PSK_CALLBACK(psk_cb,psk_cb_cls) \ |
1129 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1130 | | (const struct MHD_DaemonOptionAndValue) \ |
1131 | | { \ |
1132 | | .opt = MHD_D_O_TLS_PSK_CALLBACK, \ |
1133 | | .val.tls_psk_callback.v_psk_cb = (psk_cb), \ |
1134 | | .val.tls_psk_callback.v_psk_cb_cls = (psk_cb_cls) \ |
1135 | | } \ |
1136 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1137 | | /** |
1138 | | * Control ALPN for TLS connection. |
1139 | | * Silently ignored for non-TLS. |
1140 | | * By default ALPN is automatically used for TLS connections. |
1141 | | * @param value the value of the parameter * @return structure with the requested setting |
1142 | | */ |
1143 | | # define MHD_D_OPTION_NO_ALPN(value) \ |
1144 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1145 | | (const struct MHD_DaemonOptionAndValue) \ |
1146 | | { \ |
1147 | | .opt = MHD_D_O_NO_ALPN, \ |
1148 | | .val.no_alpn = (value) \ |
1149 | | } \ |
1150 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1151 | | /** |
1152 | | * Specify inactivity timeout for connection. |
1153 | | * When no activity for specified time on connection, it is closed |
1154 | | * automatically. |
1155 | | * Use zero for no timeout, which is also the (unsafe!) default. |
1156 | | * Very large values (years) can be silently truncated to smaller values. |
1157 | | * @param timeout the in seconds, zero for no timeout |
1158 | | * @return structure with the requested setting |
1159 | | */ |
1160 | | # define MHD_D_OPTION_DEFAULT_TIMEOUT(timeout) \ |
1161 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1162 | | (const struct MHD_DaemonOptionAndValue) \ |
1163 | | { \ |
1164 | | .opt = MHD_D_O_DEFAULT_TIMEOUT, \ |
1165 | | .val.default_timeout = (timeout) \ |
1166 | | } \ |
1167 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1168 | | /** |
1169 | | * Maximum number of (concurrent) network connections served by daemon. |
1170 | | * @note The real maximum number of network connections could be smaller |
1171 | | * than requested due to the system limitations, like FD_SETSIZE when |
1172 | | * polling by select() is used. |
1173 | | * @param glob_limit FIXME |
1174 | | * @return structure with the requested setting |
1175 | | */ |
1176 | | # define MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT(glob_limit) \ |
1177 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1178 | | (const struct MHD_DaemonOptionAndValue) \ |
1179 | | { \ |
1180 | | .opt = MHD_D_O_GLOBAL_CONNECTION_LIMIT, \ |
1181 | | .val.global_connection_limit = (glob_limit) \ |
1182 | | } \ |
1183 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1184 | | /** |
1185 | | * Limit on the number of (concurrent) network connections made to the server from the same IP address. |
1186 | | * Can be used to prevent one IP from taking over all of the allowed connections. If the same IP tries to establish more than the specified number of connections, they will be immediately rejected. |
1187 | | * @param limit FIXME |
1188 | | * @return structure with the requested setting |
1189 | | */ |
1190 | | # define MHD_D_OPTION_PER_IP_LIMIT(limit) \ |
1191 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1192 | | (const struct MHD_DaemonOptionAndValue) \ |
1193 | | { \ |
1194 | | .opt = MHD_D_O_PER_IP_LIMIT, \ |
1195 | | .val.per_ip_limit = (limit) \ |
1196 | | } \ |
1197 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1198 | | /** |
1199 | | * Set a policy callback that accepts/rejects connections based on the client's IP address. The callbeck function will be called before servicing any new incoming connection. |
1200 | | * @param apc the accept policy callback |
1201 | | * @param apc_cls the closure for the callback |
1202 | | * @return structure with the requested setting |
1203 | | */ |
1204 | | # define MHD_D_OPTION_ACCEPT_POLICY(apc,apc_cls) \ |
1205 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1206 | | (const struct MHD_DaemonOptionAndValue) \ |
1207 | | { \ |
1208 | | .opt = MHD_D_O_ACCEPT_POLICY, \ |
1209 | | .val.accept_policy.v_apc = (apc), \ |
1210 | | .val.accept_policy.v_apc_cls = (apc_cls) \ |
1211 | | } \ |
1212 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1213 | | /** |
1214 | | * Set mode of connection memory buffer zeroing |
1215 | | * @param buff_zeroing buffer zeroing mode |
1216 | | * @return structure with the requested setting |
1217 | | */ |
1218 | | # define MHD_D_OPTION_CONN_BUFF_ZEROING(buff_zeroing) \ |
1219 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1220 | | (const struct MHD_DaemonOptionAndValue) \ |
1221 | | { \ |
1222 | | .opt = MHD_D_O_CONN_BUFF_ZEROING, \ |
1223 | | .val.conn_buff_zeroing = (buff_zeroing) \ |
1224 | | } \ |
1225 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1226 | | /** |
1227 | | * Set how strictly MHD will enforce the HTTP protocol. |
1228 | | * @param sl the level of strictness |
1229 | | * @param how the way how to use the requested level |
1230 | | * @return structure with the requested setting |
1231 | | */ |
1232 | | # define MHD_D_OPTION_PROTOCOL_STRICT_LEVEL(sl,how) \ |
1233 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1234 | | (const struct MHD_DaemonOptionAndValue) \ |
1235 | | { \ |
1236 | | .opt = MHD_D_O_PROTOCOL_STRICT_LEVEL, \ |
1237 | | .val.protocol_strict_level.v_sl = (sl), \ |
1238 | | .val.protocol_strict_level.v_how = (how) \ |
1239 | | } \ |
1240 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1241 | | /** |
1242 | | * Set a callback to be called first for every request when the request line is received (before any parsing of the header). |
1243 | | * This callback is the only way to get raw (unmodified) request URI as URI is parsed and modified by MHD in-place. |
1244 | | * Mandatory URI modification may apply before this call, like binary zero replacement, as required by RFCs. |
1245 | | * @param cb the early URI callback |
1246 | | * @param cls the closure for the callback |
1247 | | * @return structure with the requested setting |
1248 | | */ |
1249 | | # define MHD_D_OPTION_EARLY_URI_LOGGER(cb,cls) \ |
1250 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1251 | | (const struct MHD_DaemonOptionAndValue) \ |
1252 | | { \ |
1253 | | .opt = MHD_D_O_EARLY_URI_LOGGER, \ |
1254 | | .val.early_uri_logger.v_cb = (cb), \ |
1255 | | .val.early_uri_logger.v_cls = (cls) \ |
1256 | | } \ |
1257 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1258 | | /** |
1259 | | * Disable converting plus ('+') character to space in GET parameters (URI part after '?'). |
1260 | | * Plus conversion is not required by HTTP RFCs, however it required by HTML specifications, see https://url.spec.whatwg.org/#application/x-www-form-urlencoded for details. |
1261 | | * By default plus is converted to space in the query part of URI. |
1262 | | * @param value the value of the parameter * @return structure with the requested setting |
1263 | | */ |
1264 | | # define MHD_D_OPTION_DISABLE_URI_QUERY_PLUS_AS_SPACE(value) \ |
1265 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1266 | | (const struct MHD_DaemonOptionAndValue) \ |
1267 | | { \ |
1268 | | .opt = MHD_D_O_DISABLE_URI_QUERY_PLUS_AS_SPACE, \ |
1269 | | .val.disable_uri_query_plus_as_space = (value) \ |
1270 | | } \ |
1271 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1272 | | /** |
1273 | | * Suppresse use of 'Date:' header. |
1274 | | * According to RFC should be suppressed only if the system has no RTC. |
1275 | | * The 'Date:' is not suppressed (the header is enabled) by default. |
1276 | | * @param value the value of the parameter * @return structure with the requested setting |
1277 | | */ |
1278 | | # define MHD_D_OPTION_SUPPRESS_DATE_HEADER(value) \ |
1279 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1280 | | (const struct MHD_DaemonOptionAndValue) \ |
1281 | | { \ |
1282 | | .opt = MHD_D_O_SUPPRESS_DATE_HEADER, \ |
1283 | | .val.suppress_date_header = (value) \ |
1284 | | } \ |
1285 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1286 | | /** |
1287 | | * Use SHOUTcast for responses. |
1288 | | * This will cause *all* responses to begin with the SHOUTcast 'ICY' line instead of 'HTTP'. |
1289 | | * @param value the value of the parameter * @return structure with the requested setting |
1290 | | */ |
1291 | | # define MHD_D_OPTION_ENABLE_SHOUTCAST(value) \ |
1292 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1293 | | (const struct MHD_DaemonOptionAndValue) \ |
1294 | | { \ |
1295 | | .opt = MHD_D_O_ENABLE_SHOUTCAST, \ |
1296 | | .val.enable_shoutcast = (value) \ |
1297 | | } \ |
1298 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1299 | | /** |
1300 | | * Maximum memory size per connection. |
1301 | | * Default is 32kb. |
1302 | | * Values above 128kb are unlikely to result in much performance benefit, as half of the memory will be typically used for IO, and TCP buffers are unlikely to support window sizes above 64k on most systems. |
1303 | | * The size should be large enough to fit all request headers (together with internal parsing information). |
1304 | | * @param value the value of the parameter * @return structure with the requested setting |
1305 | | */ |
1306 | | # define MHD_D_OPTION_CONN_MEMORY_LIMIT(value) \ |
1307 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1308 | | (const struct MHD_DaemonOptionAndValue) \ |
1309 | | { \ |
1310 | | .opt = MHD_D_O_CONN_MEMORY_LIMIT, \ |
1311 | | .val.conn_memory_limit = (value) \ |
1312 | | } \ |
1313 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1314 | | /** |
1315 | | * The size of the shared memory pool for accamulated upload processing. |
1316 | | * The same large pool is shared for all connections server by MHD and used when application requests avoiding of incremental upload processing to accamulate complete content upload before giving it to the application. |
1317 | | * Default is 8Mb. |
1318 | | * Can be set to zero to disable share pool. |
1319 | | * @param value the value of the parameter * @return structure with the requested setting |
1320 | | */ |
1321 | | # define MHD_D_OPTION_LARGE_POOL_SIZE(value) \ |
1322 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1323 | | (const struct MHD_DaemonOptionAndValue) \ |
1324 | | { \ |
1325 | | .opt = MHD_D_O_LARGE_POOL_SIZE, \ |
1326 | | .val.large_pool_size = (value) \ |
1327 | | } \ |
1328 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1329 | | /** |
1330 | | * Desired size of the stack for the threads started by MHD. |
1331 | | * Use 0 for system default, which is also MHD default. |
1332 | | * Works only with #MHD_D_OPTION_WM_WORKER_THREADS() or #MHD_D_OPTION_WM_THREAD_PER_CONNECTION(). |
1333 | | * @param value the value of the parameter * @return structure with the requested setting |
1334 | | */ |
1335 | | # define MHD_D_OPTION_STACK_SIZE(value) \ |
1336 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1337 | | (const struct MHD_DaemonOptionAndValue) \ |
1338 | | { \ |
1339 | | .opt = MHD_D_O_STACK_SIZE, \ |
1340 | | .val.stack_size = (value) \ |
1341 | | } \ |
1342 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1343 | | /** |
1344 | | * The the maximum FD value. |
1345 | | * The limit is applied to all sockets used by MHD. |
1346 | | * If listen socket FD is equal or higher that specified value, the daemon fail to start. |
1347 | | * If new connection FD is equal or higher that specified value, the connection is rejected. |
1348 | | * Useful if application uses select() for polling the sockets, system FD_SETSIZE is good value for this option in such case. |
1349 | | * Silently ignored on W32 (WinSock sockets). |
1350 | | * @param max_fd FIXME |
1351 | | * @return structure with the requested setting |
1352 | | */ |
1353 | | # define MHD_D_OPTION_FD_NUMBER_LIMIT(max_fd) \ |
1354 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1355 | | (const struct MHD_DaemonOptionAndValue) \ |
1356 | | { \ |
1357 | | .opt = MHD_D_O_FD_NUMBER_LIMIT, \ |
1358 | | .val.fd_number_limit = (max_fd) \ |
1359 | | } \ |
1360 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1361 | | /** |
1362 | | * Enable `turbo`. |
1363 | | * Disables certain calls to `shutdown()`, enables aggressive non-blocking optimistic reads and other potentially unsafe optimisations. |
1364 | | * Most effects only happen with internal threads with epoll. |
1365 | | * The 'turbo' mode is not enabled (mode is disabled) by default. |
1366 | | * @param value the value of the parameter * @return structure with the requested setting |
1367 | | */ |
1368 | | # define MHD_D_OPTION_TURBO(value) \ |
1369 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1370 | | (const struct MHD_DaemonOptionAndValue) \ |
1371 | | { \ |
1372 | | .opt = MHD_D_O_TURBO, \ |
1373 | | .val.turbo = (value) \ |
1374 | | } \ |
1375 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1376 | | /** |
1377 | | * Disable some internal thread safety. |
1378 | | * Indicates that MHD daemon will be used by application in single-threaded mode only. When this flag is set then application must call any MHD function only within a single thread. |
1379 | | * This flag turns off some internal thread-safety and allows MHD making some of the internal optimisations suitable only for single-threaded environment. |
1380 | | * Not compatible with any internal threads modes. |
1381 | | * If MHD is compiled with custom configuration for embedded projects without threads support, this option is mandatory. |
1382 | | * Thread safety is not disabled (safety is enabled) by default. |
1383 | | * @param value the value of the parameter * @return structure with the requested setting |
1384 | | */ |
1385 | | # define MHD_D_OPTION_DISABLE_THREAD_SAFETY(value) \ |
1386 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1387 | | (const struct MHD_DaemonOptionAndValue) \ |
1388 | | { \ |
1389 | | .opt = MHD_D_O_DISABLE_THREAD_SAFETY, \ |
1390 | | .val.disable_thread_safety = (value) \ |
1391 | | } \ |
1392 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1393 | | /** |
1394 | | * You need to set this option if you want to disable use of HTTP Upgrade. |
1395 | | * Upgrade may require usage of additional internal resources, which we can avoid providing if they will not be used. |
1396 | | * You should only use this option if you do not use upgrade functionality and need a generally minor boost in performance and resources saving. |
1397 | | * The upgrade is not disallowed (upgrade is allowed) by default. |
1398 | | * @param value the value of the parameter * @return structure with the requested setting |
1399 | | */ |
1400 | | # define MHD_D_OPTION_DISALLOW_UPGRADE(value) \ |
1401 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1402 | | (const struct MHD_DaemonOptionAndValue) \ |
1403 | | { \ |
1404 | | .opt = MHD_D_O_DISALLOW_UPGRADE, \ |
1405 | | .val.disallow_upgrade = (value) \ |
1406 | | } \ |
1407 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1408 | | /** |
1409 | | * Disable #MHD_action_suspend() functionality. |
1410 | | * |
1411 | | You should only use this function if you do not use suspend functionality and need a generally minor boost in performance. |
1412 | | * The suspend is not disallowed (suspend is allowed) by default. |
1413 | | * @param value the value of the parameter * @return structure with the requested setting |
1414 | | */ |
1415 | | # define MHD_D_OPTION_DISALLOW_SUSPEND_RESUME(value) \ |
1416 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1417 | | (const struct MHD_DaemonOptionAndValue) \ |
1418 | | { \ |
1419 | | .opt = MHD_D_O_DISALLOW_SUSPEND_RESUME, \ |
1420 | | .val.disallow_suspend_resume = (value) \ |
1421 | | } \ |
1422 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1423 | | /** |
1424 | | * Disable cookies parsing. |
1425 | | * |
1426 | | Disable automatic cookies processing if cookies are not used. |
1427 | | * Cookies are automatically parsed by default. |
1428 | | * @param value the value of the parameter * @return structure with the requested setting |
1429 | | */ |
1430 | | # define MHD_D_OPTION_DISABLE_COOKIES(value) \ |
1431 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1432 | | (const struct MHD_DaemonOptionAndValue) \ |
1433 | | { \ |
1434 | | .opt = MHD_D_O_DISABLE_COOKIES, \ |
1435 | | .val.disable_cookies = (value) \ |
1436 | | } \ |
1437 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1438 | | /** |
1439 | | * Set a callback to be called for pre-start finalisation. |
1440 | | * |
1441 | | The specified callback will be called one time, after network initialisation, TLS pre-initialisation, but before the start of the internal threads (if allowed) |
1442 | | * @param cb the pre-start callback |
1443 | | * @param cb_cls the closure for the callback |
1444 | | * @return structure with the requested setting |
1445 | | */ |
1446 | | # define MHD_D_OPTION_DAEMON_READY_CALLBACK(cb,cb_cls) \ |
1447 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1448 | | (const struct MHD_DaemonOptionAndValue) \ |
1449 | | { \ |
1450 | | .opt = MHD_D_O_DAEMON_READY_CALLBACK, \ |
1451 | | .val.daemon_ready_callback.v_cb = (cb), \ |
1452 | | .val.daemon_ready_callback.v_cb_cls = (cb_cls) \ |
1453 | | } \ |
1454 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1455 | | /** |
1456 | | * Set a function that should be called whenever a connection is started or closed. |
1457 | | * @param ncc the callback for notifications |
1458 | | * @param cls the closure for the callback |
1459 | | * @return structure with the requested setting |
1460 | | */ |
1461 | | # define MHD_D_OPTION_NOTIFY_CONNECTION(ncc,cls) \ |
1462 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1463 | | (const struct MHD_DaemonOptionAndValue) \ |
1464 | | { \ |
1465 | | .opt = MHD_D_O_NOTIFY_CONNECTION, \ |
1466 | | .val.notify_connection.v_ncc = (ncc), \ |
1467 | | .val.notify_connection.v_cls = (cls) \ |
1468 | | } \ |
1469 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1470 | | /** |
1471 | | * Register a function that should be called whenever a stream is started or closed. |
1472 | | * For HTTP/1.1 this callback is called one time for every connection. |
1473 | | * @param nsc the callback for notifications |
1474 | | * @param cls the closure for the callback |
1475 | | * @return structure with the requested setting |
1476 | | */ |
1477 | | # define MHD_D_OPTION_NOTIFY_STREAM(nsc,cls) \ |
1478 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1479 | | (const struct MHD_DaemonOptionAndValue) \ |
1480 | | { \ |
1481 | | .opt = MHD_D_O_NOTIFY_STREAM, \ |
1482 | | .val.notify_stream.v_nsc = (nsc), \ |
1483 | | .val.notify_stream.v_cls = (cls) \ |
1484 | | } \ |
1485 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1486 | | /** |
1487 | | * Set strong random data to be used by MHD. |
1488 | | * Currently the data is only needed for Digest Auth module. |
1489 | | * Daemon support for Digest Auth is enabled automatically if this option is used. |
1490 | | * The recommended size is between 8 and 32 bytes. Security can be lower for sizes less or equal four. |
1491 | | * Sizes larger then 32 (or, probably, larger than 16 - debatable) will not increase the security. |
1492 | | * @param buf_size the size of the buffer |
1493 | | * @param buf the buffer with strong random data, the content will be copied by MHD |
1494 | | * @return structure with the requested setting |
1495 | | */ |
1496 | | # define MHD_D_OPTION_RANDOM_ENTROPY(buf_size,buf) \ |
1497 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1498 | | (const struct MHD_DaemonOptionAndValue) \ |
1499 | | { \ |
1500 | | .opt = MHD_D_O_RANDOM_ENTROPY, \ |
1501 | | .val.random_entropy.v_buf_size = (buf_size), \ |
1502 | | .val.random_entropy.v_buf = (buf) \ |
1503 | | } \ |
1504 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1505 | | /** |
1506 | | * Specify the size of the internal hash map array that tracks generated digest nonces usage. |
1507 | | * When the size of the map is too small then need to handle concurrent DAuth requests, a lot of stale nonce results will be produced. |
1508 | | * By default the size is 1000 entries. |
1509 | | * @param size the size of the map array |
1510 | | * @return structure with the requested setting |
1511 | | */ |
1512 | | # define MHD_D_OPTION_AUTH_DIGEST_MAP_SIZE(size) \ |
1513 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1514 | | (const struct MHD_DaemonOptionAndValue) \ |
1515 | | { \ |
1516 | | .opt = MHD_D_O_AUTH_DIGEST_MAP_SIZE, \ |
1517 | | .val.auth_digest_map_size = (size) \ |
1518 | | } \ |
1519 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1520 | | /** |
1521 | | * Nonce validity time (in seconds) used for Digest Auth. |
1522 | | * If followed by zero value the value is silently ignored. |
1523 | | * @see #MHD_digest_auth_check(), MHD_digest_auth_check_digest() |
1524 | | * @param timeout FIXME |
1525 | | * @return structure with the requested setting |
1526 | | */ |
1527 | | # define MHD_D_OPTION_AUTH_DIGEST_NONCE_TIMEOUT(timeout) \ |
1528 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1529 | | (const struct MHD_DaemonOptionAndValue) \ |
1530 | | { \ |
1531 | | .opt = MHD_D_O_AUTH_DIGEST_NONCE_TIMEOUT, \ |
1532 | | .val.auth_digest_nonce_timeout = (timeout) \ |
1533 | | } \ |
1534 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1535 | | /** |
1536 | | * Default maximum nc (nonce count) value used for Digest Auth. |
1537 | | * If followed by zero value the value is silently ignored. |
1538 | | * @see #MHD_digest_auth_check(), MHD_digest_auth_check_digest() |
1539 | | * @param max_nc FIXME |
1540 | | * @return structure with the requested setting |
1541 | | */ |
1542 | | # define MHD_D_OPTION_AUTH_DIGEST_DEF_MAX_NC(max_nc) \ |
1543 | | MHD_NOWARN_COMPOUND_LITERALS_ MHD_NOWARN_AGGR_DYN_INIT_ \ |
1544 | | (const struct MHD_DaemonOptionAndValue) \ |
1545 | | { \ |
1546 | | .opt = MHD_D_O_AUTH_DIGEST_DEF_MAX_NC, \ |
1547 | | .val.auth_digest_def_max_nc = (max_nc) \ |
1548 | | } \ |
1549 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ MHD_RESTORE_WARN_AGGR_DYN_INIT_ |
1550 | | |
1551 | | /** |
1552 | | * Terminate the list of the options |
1553 | | * @return the terminating object of struct MHD_DaemonOptionAndValue |
1554 | | */ |
1555 | | # define MHD_D_OPTION_TERMINATE() \ |
1556 | | MHD_NOWARN_COMPOUND_LITERALS_ \ |
1557 | | (const struct MHD_DaemonOptionAndValue) \ |
1558 | | { \ |
1559 | | .opt = (MHD_D_O_END) \ |
1560 | | } \ |
1561 | | MHD_RESTORE_WARN_COMPOUND_LITERALS_ |
1562 | | |
1563 | | #else /* !MHD_USE_COMPOUND_LITERALS || !MHD_USE_DESIG_NEST_INIT */ |
1564 | | MHD_NOWARN_UNUSED_FUNC_ |
1565 | | /** |
1566 | | * Set MHD work (threading and polling) mode. |
1567 | | * Consider use of #MHD_D_OPTION_WM_EXTERNAL_PERIODIC(), #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL(), #MHD_D_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_EDGE(), #MHD_D_OPTION_WM_EXTERNAL_SINGLE_FD_WATCH(), #MHD_D_OPTION_WM_WORKER_THREADS() or #MHD_D_OPTION_WM_THREAD_PER_CONNECTION() instead of direct use of this parameter. |
1568 | | * @param wmp the object created by one of the next functions/macros: #MHD_WM_OPTION_EXTERNAL_PERIODIC(), #MHD_WM_OPTION_EXTERNAL_EVENT_LOOP_CB_LEVEL(), #MHD_WM_OPTION_EXTERNAL_EVENT_LOOP_CB_EDGE(), #MHD_WM_OPTION_EXTERNAL_SINGLE_FD_WATCH(), #MHD_WM_OPTION_WORKER_THREADS(), #MHD_WM_OPTION_THREAD_PER_CONNECTION() |
1569 | | * @return structure with the requested setting |
1570 | | */ |
1571 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1572 | | MHD_D_OPTION_WORK_MODE ( |
1573 | | struct MHD_WorkModeWithParam wmp |
1574 | | ) |
1575 | 0 | { |
1576 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1577 | 0 |
|
1578 | 0 | opt_val.opt = MHD_D_O_WORK_MODE; |
1579 | 0 | opt_val.val.work_mode = wmp; |
1580 | 0 |
|
1581 | 0 | return opt_val; |
1582 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_WORK_MODE(MHD_WorkModeWithParam) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_WORK_MODE(MHD_WorkModeWithParam) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_WORK_MODE(MHD_WorkModeWithParam) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_WORK_MODE(MHD_WorkModeWithParam) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_WORK_MODE(MHD_WorkModeWithParam) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_WORK_MODE(MHD_WorkModeWithParam) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_WORK_MODE(MHD_WorkModeWithParam) |
1583 | | |
1584 | | |
1585 | | /** |
1586 | | * Select a sockets watch system call used for internal polling. |
1587 | | * @param els FIXME |
1588 | | * @return structure with the requested setting |
1589 | | */ |
1590 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1591 | | MHD_D_OPTION_POLL_SYSCALL ( |
1592 | | enum MHD_SockPollSyscall els |
1593 | | ) |
1594 | 3.56k | { |
1595 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; |
1596 | | |
1597 | 3.56k | opt_val.opt = MHD_D_O_POLL_SYSCALL; |
1598 | 3.56k | opt_val.val.poll_syscall = els; |
1599 | | |
1600 | 3.56k | return opt_val; |
1601 | 3.56k | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_POLL_SYSCALL(MHD_SockPollSyscall) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_POLL_SYSCALL(MHD_SockPollSyscall) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_POLL_SYSCALL(MHD_SockPollSyscall) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_POLL_SYSCALL(MHD_SockPollSyscall) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_POLL_SYSCALL(MHD_SockPollSyscall) fuzz_mhd2.cpp:MHD_D_OPTION_POLL_SYSCALL(MHD_SockPollSyscall) Line | Count | Source | 1594 | 3.56k | { | 1595 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; | 1596 | | | 1597 | 3.56k | opt_val.opt = MHD_D_O_POLL_SYSCALL; | 1598 | 3.56k | opt_val.val.poll_syscall = els; | 1599 | | | 1600 | 3.56k | return opt_val; | 1601 | 3.56k | } |
Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_POLL_SYSCALL(MHD_SockPollSyscall) |
1602 | | |
1603 | | |
1604 | | /** |
1605 | | * Instruct MHD to register all sockets every processing round. |
1606 | | * |
1607 | | By default (this options is not enabled) every processing round (every time |
1608 | | * when #MHD_daemon_event_update() is called) MHD calls |
1609 | | * #MHD_SocketRegistrationUpdateCallback only for the new sockets, for |
1610 | | * the removed sockets and for the updated sockets. |
1611 | | * Some sockets are registered when #MHD_daemon_start() is called. |
1612 | | * |
1613 | | If this options is enabled, then #MHD_SocketRegistrationUpdateCallback is |
1614 | | * called for every socket each processing round. No sockets are registered when |
1615 | | * the daemon is being started. |
1616 | | * @param value the value of the parameter * @return structure with the requested setting |
1617 | | */ |
1618 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1619 | | MHD_D_OPTION_REREGISTER_ALL ( |
1620 | | enum MHD_Bool value |
1621 | | ) |
1622 | 3.56k | { |
1623 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; |
1624 | | |
1625 | 3.56k | opt_val.opt = MHD_D_O_REREGISTER_ALL; |
1626 | 3.56k | opt_val.val.reregister_all = (value); \ |
1627 | 3.56k | |
1628 | 3.56k | return opt_val; |
1629 | 3.56k | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_REREGISTER_ALL(MHD_Bool) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_REREGISTER_ALL(MHD_Bool) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_REREGISTER_ALL(MHD_Bool) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_REREGISTER_ALL(MHD_Bool) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_REREGISTER_ALL(MHD_Bool) fuzz_mhd2.cpp:MHD_D_OPTION_REREGISTER_ALL(MHD_Bool) Line | Count | Source | 1622 | 3.56k | { | 1623 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; | 1624 | | | 1625 | 3.56k | opt_val.opt = MHD_D_O_REREGISTER_ALL; | 1626 | 3.56k | opt_val.val.reregister_all = (value); \ | 1627 | 3.56k | | 1628 | 3.56k | return opt_val; | 1629 | 3.56k | } |
Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_REREGISTER_ALL(MHD_Bool) |
1630 | | |
1631 | | |
1632 | | /** |
1633 | | * Set a callback to use for logging |
1634 | | * @param log_cb the callback to use for logging, |
1635 | | * NULL to disable logging. |
1636 | | * The logging to stderr is enabled by default. |
1637 | | * @param log_cb_cls the closure for the logging callback |
1638 | | * @return structure with the requested setting |
1639 | | */ |
1640 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1641 | | MHD_D_OPTION_LOG_CALLBACK ( |
1642 | | MHD_LoggingCallback log_cb, |
1643 | | void *log_cb_cls |
1644 | | ) |
1645 | 3.56k | { |
1646 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; |
1647 | | |
1648 | 3.56k | opt_val.opt = MHD_D_O_LOG_CALLBACK; |
1649 | 3.56k | opt_val.val.log_callback.v_log_cb = log_cb; |
1650 | 3.56k | opt_val.val.log_callback.v_log_cb_cls = log_cb_cls; |
1651 | | |
1652 | 3.56k | return opt_val; |
1653 | 3.56k | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_LOG_CALLBACK(void (*)(void*, MHD_StatusCode, char const*, __va_list_tag*), void*) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_LOG_CALLBACK(void (*)(void*, MHD_StatusCode, char const*, __va_list_tag*), void*) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_LOG_CALLBACK(void (*)(void*, MHD_StatusCode, char const*, __va_list_tag*), void*) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_LOG_CALLBACK(void (*)(void*, MHD_StatusCode, char const*, __va_list_tag*), void*) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_LOG_CALLBACK(void (*)(void*, MHD_StatusCode, char const*, __va_list_tag*), void*) fuzz_mhd2.cpp:MHD_D_OPTION_LOG_CALLBACK(void (*)(void*, MHD_StatusCode, char const*, __va_list_tag*), void*) Line | Count | Source | 1645 | 3.56k | { | 1646 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; | 1647 | | | 1648 | 3.56k | opt_val.opt = MHD_D_O_LOG_CALLBACK; | 1649 | 3.56k | opt_val.val.log_callback.v_log_cb = log_cb; | 1650 | 3.56k | opt_val.val.log_callback.v_log_cb_cls = log_cb_cls; | 1651 | | | 1652 | 3.56k | return opt_val; | 1653 | 3.56k | } |
Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_LOG_CALLBACK(void (*)(void*, MHD_StatusCode, char const*, __va_list_tag*), void*) |
1654 | | |
1655 | | |
1656 | | /** |
1657 | | * Bind to the given TCP port and address family. |
1658 | | * |
1659 | | Does not work with #MHD_D_OPTION_BIND_SA() or #MHD_D_OPTION_LISTEN_SOCKET(). |
1660 | | * |
1661 | | If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does not listen for incoming connection. |
1662 | | * @param af the address family to use, |
1663 | | * the #MHD_AF_NONE to disable listen socket (the same effect as if this option is not used) |
1664 | | * @param port port to use, 0 to let system assign any free port, |
1665 | | * ignored if @a af is #MHD_AF_NONE |
1666 | | * @return structure with the requested setting |
1667 | | */ |
1668 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1669 | | MHD_D_OPTION_BIND_PORT ( |
1670 | | enum MHD_AddressFamily af, |
1671 | | uint_least16_t port |
1672 | | ) |
1673 | 3.56k | { |
1674 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; |
1675 | | |
1676 | 3.56k | opt_val.opt = MHD_D_O_BIND_PORT; |
1677 | 3.56k | opt_val.val.bind_port.v_af = af; |
1678 | 3.56k | opt_val.val.bind_port.v_port = port; |
1679 | | |
1680 | 3.56k | return opt_val; |
1681 | 3.56k | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_BIND_PORT(MHD_AddressFamily, unsigned short) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_BIND_PORT(MHD_AddressFamily, unsigned short) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_BIND_PORT(MHD_AddressFamily, unsigned short) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_BIND_PORT(MHD_AddressFamily, unsigned short) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_BIND_PORT(MHD_AddressFamily, unsigned short) fuzz_mhd2.cpp:MHD_D_OPTION_BIND_PORT(MHD_AddressFamily, unsigned short) Line | Count | Source | 1673 | 3.56k | { | 1674 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; | 1675 | | | 1676 | 3.56k | opt_val.opt = MHD_D_O_BIND_PORT; | 1677 | 3.56k | opt_val.val.bind_port.v_af = af; | 1678 | 3.56k | opt_val.val.bind_port.v_port = port; | 1679 | | | 1680 | 3.56k | return opt_val; | 1681 | 3.56k | } |
fuzz_daemon.cpp:MHD_D_OPTION_BIND_PORT(MHD_AddressFamily, unsigned short) Line | Count | Source | 1673 | 1 | { | 1674 | 1 | struct MHD_DaemonOptionAndValue opt_val; | 1675 | | | 1676 | 1 | opt_val.opt = MHD_D_O_BIND_PORT; | 1677 | 1 | opt_val.val.bind_port.v_af = af; | 1678 | 1 | opt_val.val.bind_port.v_port = port; | 1679 | | | 1680 | 1 | return opt_val; | 1681 | 1 | } |
|
1682 | | |
1683 | | |
1684 | | /** |
1685 | | * Bind to the given socket address. |
1686 | | * |
1687 | | Does not work with #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_LISTEN_SOCKET(). |
1688 | | * |
1689 | | If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does not listen for incoming connection. |
1690 | | * @param sa_len the size of the socket address pointed by @a sa. |
1691 | | * @param sa the address to bind to; can be IPv4 (AF_INET), IPv6 (AF_INET6) or even a UNIX domain socket (AF_UNIX) |
1692 | | * @param dual When a previous version of the protocol exist (like IPv4 when @a v_sa is IPv6) bind to both protocols (IPv6 and IPv4). |
1693 | | * @return structure with the requested setting |
1694 | | */ |
1695 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1696 | | MHD_D_OPTION_BIND_SA ( |
1697 | | size_t sa_len, |
1698 | | /* const */ struct sockaddr *sa, |
1699 | | enum MHD_Bool dual |
1700 | | ) |
1701 | 0 | { |
1702 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1703 | 0 |
|
1704 | 0 | opt_val.opt = MHD_D_O_BIND_SA; |
1705 | 0 | opt_val.val.bind_sa.v_sa_len = sa_len; |
1706 | 0 | opt_val.val.bind_sa.v_sa = sa; |
1707 | 0 | opt_val.val.bind_sa.v_dual = dual; |
1708 | 0 |
|
1709 | 0 | return opt_val; |
1710 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_BIND_SA(unsigned long, sockaddr*, MHD_Bool) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_BIND_SA(unsigned long, sockaddr*, MHD_Bool) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_BIND_SA(unsigned long, sockaddr*, MHD_Bool) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_BIND_SA(unsigned long, sockaddr*, MHD_Bool) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_BIND_SA(unsigned long, sockaddr*, MHD_Bool) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_BIND_SA(unsigned long, sockaddr*, MHD_Bool) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_BIND_SA(unsigned long, sockaddr*, MHD_Bool) |
1711 | | |
1712 | | |
1713 | | /** |
1714 | | * Accept connections from the given socket. Socket |
1715 | | * must be a TCP or UNIX domain (SOCK_STREAM) socket. |
1716 | | * |
1717 | | Does not work with #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA(). |
1718 | | * |
1719 | | If no listen socket optins (#MHD_D_OPTION_BIND_PORT(), #MHD_D_OPTION_BIND_SA(), #MHD_D_OPTION_LISTEN_SOCKET()) are used, MHD does not listen for incoming connection. |
1720 | | * @param listen_fd the listen socket to use, ignored if set to #MHD_INVALID_SOCKET |
1721 | | * @return structure with the requested setting |
1722 | | */ |
1723 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1724 | | MHD_D_OPTION_LISTEN_SOCKET ( |
1725 | | MHD_Socket listen_fd |
1726 | | ) |
1727 | 0 | { |
1728 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1729 | 0 |
|
1730 | 0 | opt_val.opt = MHD_D_O_LISTEN_SOCKET; |
1731 | 0 | opt_val.val.listen_socket = listen_fd; |
1732 | 0 |
|
1733 | 0 | return opt_val; |
1734 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_LISTEN_SOCKET(int) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_LISTEN_SOCKET(int) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_LISTEN_SOCKET(int) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_LISTEN_SOCKET(int) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_LISTEN_SOCKET(int) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_LISTEN_SOCKET(int) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_LISTEN_SOCKET(int) |
1735 | | |
1736 | | |
1737 | | /** |
1738 | | * Select mode of reusing address:port listen address. |
1739 | | * |
1740 | | Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used. |
1741 | | * @param reuse_type FIXME |
1742 | | * @return structure with the requested setting |
1743 | | */ |
1744 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1745 | | MHD_D_OPTION_LISTEN_ADDR_REUSE ( |
1746 | | enum MHD_DaemonOptionBindType reuse_type |
1747 | | ) |
1748 | 0 | { |
1749 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1750 | 0 |
|
1751 | 0 | opt_val.opt = MHD_D_O_LISTEN_ADDR_REUSE; |
1752 | 0 | opt_val.val.listen_addr_reuse = reuse_type; |
1753 | 0 |
|
1754 | 0 | return opt_val; |
1755 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_LISTEN_ADDR_REUSE(MHD_DaemonOptionBindType) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_LISTEN_ADDR_REUSE(MHD_DaemonOptionBindType) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_LISTEN_ADDR_REUSE(MHD_DaemonOptionBindType) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_LISTEN_ADDR_REUSE(MHD_DaemonOptionBindType) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_LISTEN_ADDR_REUSE(MHD_DaemonOptionBindType) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_LISTEN_ADDR_REUSE(MHD_DaemonOptionBindType) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_LISTEN_ADDR_REUSE(MHD_DaemonOptionBindType) |
1756 | | |
1757 | | |
1758 | | /** |
1759 | | * Configure TCP_FASTOPEN option, including setting a |
1760 | | * custom @a queue_length. |
1761 | | * |
1762 | | Note that having a larger queue size can cause resource exhaustion |
1763 | | * attack as the TCP stack has to now allocate resources for the SYN |
1764 | | * packet along with its DATA. |
1765 | | * |
1766 | | Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used. |
1767 | | * @param option the type use of of TCP FastOpen |
1768 | | * @param queue_length the length of the queue, zero to use system or MHD default, |
1769 | | * silently ignored on platforms without support for custom queue size |
1770 | | * @return structure with the requested setting |
1771 | | */ |
1772 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1773 | | MHD_D_OPTION_TCP_FASTOPEN ( |
1774 | | enum MHD_TCPFastOpenType option, |
1775 | | unsigned int queue_length |
1776 | | ) |
1777 | 0 | { |
1778 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1779 | 0 |
|
1780 | 0 | opt_val.opt = MHD_D_O_TCP_FASTOPEN; |
1781 | 0 | opt_val.val.tcp_fastopen.v_option = option; |
1782 | 0 | opt_val.val.tcp_fastopen.v_queue_length = queue_length; |
1783 | 0 |
|
1784 | 0 | return opt_val; |
1785 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_TCP_FASTOPEN(MHD_TCPFastOpenType, unsigned int) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_TCP_FASTOPEN(MHD_TCPFastOpenType, unsigned int) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_TCP_FASTOPEN(MHD_TCPFastOpenType, unsigned int) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_TCP_FASTOPEN(MHD_TCPFastOpenType, unsigned int) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_TCP_FASTOPEN(MHD_TCPFastOpenType, unsigned int) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_TCP_FASTOPEN(MHD_TCPFastOpenType, unsigned int) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_TCP_FASTOPEN(MHD_TCPFastOpenType, unsigned int) |
1786 | | |
1787 | | |
1788 | | /** |
1789 | | * Use the given backlog for the listen() call. |
1790 | | * |
1791 | | Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used. |
1792 | | * Zero parameter treated as MHD/system default. |
1793 | | * @param backlog_size FIXME |
1794 | | * @return structure with the requested setting |
1795 | | */ |
1796 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1797 | | MHD_D_OPTION_LISTEN_BACKLOG ( |
1798 | | unsigned int backlog_size |
1799 | | ) |
1800 | 0 | { |
1801 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1802 | 0 |
|
1803 | 0 | opt_val.opt = MHD_D_O_LISTEN_BACKLOG; |
1804 | 0 | opt_val.val.listen_backlog = backlog_size; |
1805 | 0 |
|
1806 | 0 | return opt_val; |
1807 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_LISTEN_BACKLOG(unsigned int) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_LISTEN_BACKLOG(unsigned int) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_LISTEN_BACKLOG(unsigned int) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_LISTEN_BACKLOG(unsigned int) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_LISTEN_BACKLOG(unsigned int) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_LISTEN_BACKLOG(unsigned int) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_LISTEN_BACKLOG(unsigned int) |
1808 | | |
1809 | | |
1810 | | /** |
1811 | | * Inform that SIGPIPE is suppressed or handled by application. |
1812 | | * If suppressed/handled, MHD uses network functions that could generate SIGPIPE, like `sendfile()`. |
1813 | | * Silently ignored when MHD creates internal threads as for them SIGPIPE is suppressed automatically. |
1814 | | * @param value the value of the parameter * @return structure with the requested setting |
1815 | | */ |
1816 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1817 | | MHD_D_OPTION_SIGPIPE_SUPPRESSED ( |
1818 | | enum MHD_Bool value |
1819 | | ) |
1820 | 0 | { |
1821 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1822 | 0 |
|
1823 | 0 | opt_val.opt = MHD_D_O_SIGPIPE_SUPPRESSED; |
1824 | 0 | opt_val.val.sigpipe_suppressed = (value); \ |
1825 | 0 |
|
1826 | 0 | return opt_val; |
1827 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_SIGPIPE_SUPPRESSED(MHD_Bool) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_SIGPIPE_SUPPRESSED(MHD_Bool) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_SIGPIPE_SUPPRESSED(MHD_Bool) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_SIGPIPE_SUPPRESSED(MHD_Bool) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_SIGPIPE_SUPPRESSED(MHD_Bool) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_SIGPIPE_SUPPRESSED(MHD_Bool) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_SIGPIPE_SUPPRESSED(MHD_Bool) |
1828 | | |
1829 | | |
1830 | | /** |
1831 | | * Enable TLS (HTTPS) and select TLS backend |
1832 | | * @param backend the TLS backend to use, |
1833 | | * #MHD_TLS_BACKEND_NONE for non-TLS (plain TCP) connections |
1834 | | * @return structure with the requested setting |
1835 | | */ |
1836 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1837 | | MHD_D_OPTION_TLS ( |
1838 | | enum MHD_TlsBackend backend |
1839 | | ) |
1840 | 0 | { |
1841 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1842 | 0 |
|
1843 | 0 | opt_val.opt = MHD_D_O_TLS; |
1844 | 0 | opt_val.val.tls = backend; |
1845 | 0 |
|
1846 | 0 | return opt_val; |
1847 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_TLS(MHD_TlsBackend) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_TLS(MHD_TlsBackend) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_TLS(MHD_TlsBackend) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_TLS(MHD_TlsBackend) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_TLS(MHD_TlsBackend) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_TLS(MHD_TlsBackend) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_TLS(MHD_TlsBackend) |
1848 | | |
1849 | | |
1850 | | /** |
1851 | | * Provide TLS key and certificate data in-memory. |
1852 | | * Works only if TLS mode is enabled. |
1853 | | * @param mem_cert The X.509 certificates chain in PEM format loaded into memory (not a filename). |
1854 | | * The first certificate must be the server certificate, following by the chain of signing |
1855 | | * certificates up to (but not including) CA root certificate. |
1856 | | * @param mem_key the private key in PEM format loaded into memory (not a filename) |
1857 | | * @param mem_pass the option passphrase phrase to decrypt the private key, |
1858 | | * could be NULL if private key does not need a password |
1859 | | * @return structure with the requested setting |
1860 | | */ |
1861 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1862 | | MHD_D_OPTION_TLS_CERT_KEY ( |
1863 | | /* const */ char *mem_cert, |
1864 | | const char *mem_key, |
1865 | | const char *mem_pass |
1866 | | ) |
1867 | 0 | { |
1868 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1869 | 0 |
|
1870 | 0 | opt_val.opt = MHD_D_O_TLS_CERT_KEY; |
1871 | 0 | opt_val.val.tls_cert_key.v_mem_cert = mem_cert; |
1872 | 0 | opt_val.val.tls_cert_key.v_mem_key = mem_key; |
1873 | 0 | opt_val.val.tls_cert_key.v_mem_pass = mem_pass; |
1874 | 0 |
|
1875 | 0 | return opt_val; |
1876 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_TLS_CERT_KEY(char*, char const*, char const*) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_TLS_CERT_KEY(char*, char const*, char const*) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_TLS_CERT_KEY(char*, char const*, char const*) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_TLS_CERT_KEY(char*, char const*, char const*) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_TLS_CERT_KEY(char*, char const*, char const*) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_TLS_CERT_KEY(char*, char const*, char const*) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_TLS_CERT_KEY(char*, char const*, char const*) |
1877 | | |
1878 | | |
1879 | | /** |
1880 | | * Provide the certificate of the certificate authority (CA) to be used by the MHD daemon for client authentication. |
1881 | | * Works only if TLS mode is enabled. |
1882 | | * @param mem_client_ca the CA certificate in memory (not a filename) |
1883 | | * @return structure with the requested setting |
1884 | | */ |
1885 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1886 | | MHD_D_OPTION_TLS_CLIENT_CA ( |
1887 | | const char *mem_client_ca |
1888 | | ) |
1889 | 0 | { |
1890 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1891 | 0 |
|
1892 | 0 | opt_val.opt = MHD_D_O_TLS_CLIENT_CA; |
1893 | 0 | opt_val.val.tls_client_ca = mem_client_ca; |
1894 | 0 |
|
1895 | 0 | return opt_val; |
1896 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_TLS_CLIENT_CA(char const*) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_TLS_CLIENT_CA(char const*) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_TLS_CLIENT_CA(char const*) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_TLS_CLIENT_CA(char const*) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_TLS_CLIENT_CA(char const*) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_TLS_CLIENT_CA(char const*) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_TLS_CLIENT_CA(char const*) |
1897 | | |
1898 | | |
1899 | | /** |
1900 | | * Configure PSK to use for the TLS key exchange. |
1901 | | * @param psk_cb the function to call to obtain pre-shared key |
1902 | | * @param psk_cb_cls the closure for @a psk_cb |
1903 | | * @return structure with the requested setting |
1904 | | */ |
1905 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1906 | | MHD_D_OPTION_TLS_PSK_CALLBACK ( |
1907 | | MHD_PskServerCredentialsCallback psk_cb, |
1908 | | void *psk_cb_cls |
1909 | | ) |
1910 | 0 | { |
1911 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1912 | 0 |
|
1913 | 0 | opt_val.opt = MHD_D_O_TLS_PSK_CALLBACK; |
1914 | 0 | opt_val.val.tls_psk_callback.v_psk_cb = psk_cb; |
1915 | 0 | opt_val.val.tls_psk_callback.v_psk_cb_cls = psk_cb_cls; |
1916 | 0 |
|
1917 | 0 | return opt_val; |
1918 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_TLS_PSK_CALLBACK(void (*)(void*, MHD_Connection const*, MHD_String const*, MHD_ServerCredentialsContext*), void*) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_TLS_PSK_CALLBACK(void (*)(void*, MHD_Connection const*, MHD_String const*, MHD_ServerCredentialsContext*), void*) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_TLS_PSK_CALLBACK(void (*)(void*, MHD_Connection const*, MHD_String const*, MHD_ServerCredentialsContext*), void*) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_TLS_PSK_CALLBACK(void (*)(void*, MHD_Connection const*, MHD_String const*, MHD_ServerCredentialsContext*), void*) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_TLS_PSK_CALLBACK(void (*)(void*, MHD_Connection const*, MHD_String const*, MHD_ServerCredentialsContext*), void*) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_TLS_PSK_CALLBACK(void (*)(void*, MHD_Connection const*, MHD_String const*, MHD_ServerCredentialsContext*), void*) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_TLS_PSK_CALLBACK(void (*)(void*, MHD_Connection const*, MHD_String const*, MHD_ServerCredentialsContext*), void*) |
1919 | | |
1920 | | |
1921 | | /** |
1922 | | * Control ALPN for TLS connection. |
1923 | | * Silently ignored for non-TLS. |
1924 | | * By default ALPN is automatically used for TLS connections. |
1925 | | * @param value the value of the parameter * @return structure with the requested setting |
1926 | | */ |
1927 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1928 | | MHD_D_OPTION_NO_ALPN ( |
1929 | | enum MHD_Bool value |
1930 | | ) |
1931 | 0 | { |
1932 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1933 | 0 |
|
1934 | 0 | opt_val.opt = MHD_D_O_NO_ALPN; |
1935 | 0 | opt_val.val.no_alpn = (value); \ |
1936 | 0 |
|
1937 | 0 | return opt_val; |
1938 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_NO_ALPN(MHD_Bool) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_NO_ALPN(MHD_Bool) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_NO_ALPN(MHD_Bool) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_NO_ALPN(MHD_Bool) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_NO_ALPN(MHD_Bool) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_NO_ALPN(MHD_Bool) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_NO_ALPN(MHD_Bool) |
1939 | | |
1940 | | |
1941 | | /** |
1942 | | * Specify inactivity timeout for connection. |
1943 | | * When no activity for specified time on connection, it is closed |
1944 | | * automatically. |
1945 | | * Use zero for no timeout, which is also the (unsafe!) default. |
1946 | | * Very large values (years) can be silently truncated to smaller values. |
1947 | | * @param timeout the in seconds, zero for no timeout |
1948 | | * @return structure with the requested setting |
1949 | | */ |
1950 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1951 | | MHD_D_OPTION_DEFAULT_TIMEOUT ( |
1952 | | unsigned int timeout |
1953 | | ) |
1954 | 3.56k | { |
1955 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; |
1956 | | |
1957 | 3.56k | opt_val.opt = MHD_D_O_DEFAULT_TIMEOUT; |
1958 | 3.56k | opt_val.val.default_timeout = timeout; |
1959 | | |
1960 | 3.56k | return opt_val; |
1961 | 3.56k | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_DEFAULT_TIMEOUT(unsigned int) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_DEFAULT_TIMEOUT(unsigned int) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_DEFAULT_TIMEOUT(unsigned int) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_DEFAULT_TIMEOUT(unsigned int) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_DEFAULT_TIMEOUT(unsigned int) fuzz_mhd2.cpp:MHD_D_OPTION_DEFAULT_TIMEOUT(unsigned int) Line | Count | Source | 1954 | 3.56k | { | 1955 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; | 1956 | | | 1957 | 3.56k | opt_val.opt = MHD_D_O_DEFAULT_TIMEOUT; | 1958 | 3.56k | opt_val.val.default_timeout = timeout; | 1959 | | | 1960 | 3.56k | return opt_val; | 1961 | 3.56k | } |
Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_DEFAULT_TIMEOUT(unsigned int) |
1962 | | |
1963 | | |
1964 | | /** |
1965 | | * Maximum number of (concurrent) network connections served by daemon. |
1966 | | * @note The real maximum number of network connections could be smaller |
1967 | | * than requested due to the system limitations, like FD_SETSIZE when |
1968 | | * polling by select() is used. |
1969 | | * @param glob_limit FIXME |
1970 | | * @return structure with the requested setting |
1971 | | */ |
1972 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1973 | | MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT ( |
1974 | | unsigned int glob_limit |
1975 | | ) |
1976 | 0 | { |
1977 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1978 | 0 |
|
1979 | 0 | opt_val.opt = MHD_D_O_GLOBAL_CONNECTION_LIMIT; |
1980 | 0 | opt_val.val.global_connection_limit = glob_limit; |
1981 | 0 |
|
1982 | 0 | return opt_val; |
1983 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT(unsigned int) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT(unsigned int) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT(unsigned int) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT(unsigned int) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT(unsigned int) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT(unsigned int) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_GLOBAL_CONNECTION_LIMIT(unsigned int) |
1984 | | |
1985 | | |
1986 | | /** |
1987 | | * Limit on the number of (concurrent) network connections made to the server from the same IP address. |
1988 | | * Can be used to prevent one IP from taking over all of the allowed connections. If the same IP tries to establish more than the specified number of connections, they will be immediately rejected. |
1989 | | * @param limit FIXME |
1990 | | * @return structure with the requested setting |
1991 | | */ |
1992 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
1993 | | MHD_D_OPTION_PER_IP_LIMIT ( |
1994 | | unsigned int limit |
1995 | | ) |
1996 | 0 | { |
1997 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
1998 | 0 |
|
1999 | 0 | opt_val.opt = MHD_D_O_PER_IP_LIMIT; |
2000 | 0 | opt_val.val.per_ip_limit = limit; |
2001 | 0 |
|
2002 | 0 | return opt_val; |
2003 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_PER_IP_LIMIT(unsigned int) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_PER_IP_LIMIT(unsigned int) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_PER_IP_LIMIT(unsigned int) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_PER_IP_LIMIT(unsigned int) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_PER_IP_LIMIT(unsigned int) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_PER_IP_LIMIT(unsigned int) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_PER_IP_LIMIT(unsigned int) |
2004 | | |
2005 | | |
2006 | | /** |
2007 | | * Set a policy callback that accepts/rejects connections based on the client's IP address. The callbeck function will be called before servicing any new incoming connection. |
2008 | | * @param apc the accept policy callback |
2009 | | * @param apc_cls the closure for the callback |
2010 | | * @return structure with the requested setting |
2011 | | */ |
2012 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2013 | | MHD_D_OPTION_ACCEPT_POLICY ( |
2014 | | MHD_AcceptPolicyCallback apc, |
2015 | | void *apc_cls |
2016 | | ) |
2017 | 0 | { |
2018 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2019 | 0 |
|
2020 | 0 | opt_val.opt = MHD_D_O_ACCEPT_POLICY; |
2021 | 0 | opt_val.val.accept_policy.v_apc = apc; |
2022 | 0 | opt_val.val.accept_policy.v_apc_cls = apc_cls; |
2023 | 0 |
|
2024 | 0 | return opt_val; |
2025 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_ACCEPT_POLICY(MHD_Bool (*)(void*, unsigned long, sockaddr const*), void*) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_ACCEPT_POLICY(MHD_Bool (*)(void*, unsigned long, sockaddr const*), void*) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_ACCEPT_POLICY(MHD_Bool (*)(void*, unsigned long, sockaddr const*), void*) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_ACCEPT_POLICY(MHD_Bool (*)(void*, unsigned long, sockaddr const*), void*) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_ACCEPT_POLICY(MHD_Bool (*)(void*, unsigned long, sockaddr const*), void*) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_ACCEPT_POLICY(MHD_Bool (*)(void*, unsigned long, sockaddr const*), void*) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_ACCEPT_POLICY(MHD_Bool (*)(void*, unsigned long, sockaddr const*), void*) |
2026 | | |
2027 | | |
2028 | | /** |
2029 | | * Set mode of connection memory buffer zeroing |
2030 | | * @param buff_zeroing buffer zeroing mode |
2031 | | * @return structure with the requested setting |
2032 | | */ |
2033 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2034 | | MHD_D_OPTION_CONN_BUFF_ZEROING ( |
2035 | | enum MHD_ConnBufferZeroingMode buff_zeroing |
2036 | | ) |
2037 | 0 | { |
2038 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2039 | 0 |
|
2040 | 0 | opt_val.opt = MHD_D_O_CONN_BUFF_ZEROING; |
2041 | 0 | opt_val.val.conn_buff_zeroing = buff_zeroing; |
2042 | 0 |
|
2043 | 0 | return opt_val; |
2044 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_CONN_BUFF_ZEROING(MHD_ConnBufferZeroingMode) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_CONN_BUFF_ZEROING(MHD_ConnBufferZeroingMode) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_CONN_BUFF_ZEROING(MHD_ConnBufferZeroingMode) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_CONN_BUFF_ZEROING(MHD_ConnBufferZeroingMode) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_CONN_BUFF_ZEROING(MHD_ConnBufferZeroingMode) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_CONN_BUFF_ZEROING(MHD_ConnBufferZeroingMode) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_CONN_BUFF_ZEROING(MHD_ConnBufferZeroingMode) |
2045 | | |
2046 | | |
2047 | | /** |
2048 | | * Set how strictly MHD will enforce the HTTP protocol. |
2049 | | * @param sl the level of strictness |
2050 | | * @param how the way how to use the requested level |
2051 | | * @return structure with the requested setting |
2052 | | */ |
2053 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2054 | | MHD_D_OPTION_PROTOCOL_STRICT_LEVEL ( |
2055 | | enum MHD_ProtocolStrictLevel sl, |
2056 | | enum MHD_UseStictLevel how |
2057 | | ) |
2058 | 0 | { |
2059 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2060 | 0 |
|
2061 | 0 | opt_val.opt = MHD_D_O_PROTOCOL_STRICT_LEVEL; |
2062 | 0 | opt_val.val.protocol_strict_level.v_sl = sl; |
2063 | 0 | opt_val.val.protocol_strict_level.v_how = how; |
2064 | 0 |
|
2065 | 0 | return opt_val; |
2066 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_PROTOCOL_STRICT_LEVEL(MHD_ProtocolStrictLevel, MHD_UseStictLevel) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_PROTOCOL_STRICT_LEVEL(MHD_ProtocolStrictLevel, MHD_UseStictLevel) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_PROTOCOL_STRICT_LEVEL(MHD_ProtocolStrictLevel, MHD_UseStictLevel) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_PROTOCOL_STRICT_LEVEL(MHD_ProtocolStrictLevel, MHD_UseStictLevel) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_PROTOCOL_STRICT_LEVEL(MHD_ProtocolStrictLevel, MHD_UseStictLevel) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_PROTOCOL_STRICT_LEVEL(MHD_ProtocolStrictLevel, MHD_UseStictLevel) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_PROTOCOL_STRICT_LEVEL(MHD_ProtocolStrictLevel, MHD_UseStictLevel) |
2067 | | |
2068 | | |
2069 | | /** |
2070 | | * Set a callback to be called first for every request when the request line is received (before any parsing of the header). |
2071 | | * This callback is the only way to get raw (unmodified) request URI as URI is parsed and modified by MHD in-place. |
2072 | | * Mandatory URI modification may apply before this call, like binary zero replacement, as required by RFCs. |
2073 | | * @param cb the early URI callback |
2074 | | * @param cls the closure for the callback |
2075 | | * @return structure with the requested setting |
2076 | | */ |
2077 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2078 | | MHD_D_OPTION_EARLY_URI_LOGGER ( |
2079 | | MHD_EarlyUriLogCallback cb, |
2080 | | void *cls |
2081 | | ) |
2082 | 0 | { |
2083 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2084 | 0 |
|
2085 | 0 | opt_val.opt = MHD_D_O_EARLY_URI_LOGGER; |
2086 | 0 | opt_val.val.early_uri_logger.v_cb = cb; |
2087 | 0 | opt_val.val.early_uri_logger.v_cls = cls; |
2088 | 0 |
|
2089 | 0 | return opt_val; |
2090 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_EARLY_URI_LOGGER(void (*)(void*, MHD_EarlyUriCbData const*, void**), void*) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_EARLY_URI_LOGGER(void (*)(void*, MHD_EarlyUriCbData const*, void**), void*) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_EARLY_URI_LOGGER(void (*)(void*, MHD_EarlyUriCbData const*, void**), void*) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_EARLY_URI_LOGGER(void (*)(void*, MHD_EarlyUriCbData const*, void**), void*) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_EARLY_URI_LOGGER(void (*)(void*, MHD_EarlyUriCbData const*, void**), void*) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_EARLY_URI_LOGGER(void (*)(void*, MHD_EarlyUriCbData const*, void**), void*) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_EARLY_URI_LOGGER(void (*)(void*, MHD_EarlyUriCbData const*, void**), void*) |
2091 | | |
2092 | | |
2093 | | /** |
2094 | | * Disable converting plus ('+') character to space in GET parameters (URI part after '?'). |
2095 | | * Plus conversion is not required by HTTP RFCs, however it required by HTML specifications, see https://url.spec.whatwg.org/#application/x-www-form-urlencoded for details. |
2096 | | * By default plus is converted to space in the query part of URI. |
2097 | | * @param value the value of the parameter * @return structure with the requested setting |
2098 | | */ |
2099 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2100 | | MHD_D_OPTION_DISABLE_URI_QUERY_PLUS_AS_SPACE ( |
2101 | | enum MHD_Bool value |
2102 | | ) |
2103 | 0 | { |
2104 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2105 | 0 |
|
2106 | 0 | opt_val.opt = MHD_D_O_DISABLE_URI_QUERY_PLUS_AS_SPACE; |
2107 | 0 | opt_val.val.disable_uri_query_plus_as_space = (value); \ |
2108 | 0 |
|
2109 | 0 | return opt_val; |
2110 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_DISABLE_URI_QUERY_PLUS_AS_SPACE(MHD_Bool) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_DISABLE_URI_QUERY_PLUS_AS_SPACE(MHD_Bool) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_DISABLE_URI_QUERY_PLUS_AS_SPACE(MHD_Bool) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_DISABLE_URI_QUERY_PLUS_AS_SPACE(MHD_Bool) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_DISABLE_URI_QUERY_PLUS_AS_SPACE(MHD_Bool) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_DISABLE_URI_QUERY_PLUS_AS_SPACE(MHD_Bool) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_DISABLE_URI_QUERY_PLUS_AS_SPACE(MHD_Bool) |
2111 | | |
2112 | | |
2113 | | /** |
2114 | | * Suppresse use of 'Date:' header. |
2115 | | * According to RFC should be suppressed only if the system has no RTC. |
2116 | | * The 'Date:' is not suppressed (the header is enabled) by default. |
2117 | | * @param value the value of the parameter * @return structure with the requested setting |
2118 | | */ |
2119 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2120 | | MHD_D_OPTION_SUPPRESS_DATE_HEADER ( |
2121 | | enum MHD_Bool value |
2122 | | ) |
2123 | 0 | { |
2124 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2125 | 0 |
|
2126 | 0 | opt_val.opt = MHD_D_O_SUPPRESS_DATE_HEADER; |
2127 | 0 | opt_val.val.suppress_date_header = (value); \ |
2128 | 0 |
|
2129 | 0 | return opt_val; |
2130 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_SUPPRESS_DATE_HEADER(MHD_Bool) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_SUPPRESS_DATE_HEADER(MHD_Bool) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_SUPPRESS_DATE_HEADER(MHD_Bool) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_SUPPRESS_DATE_HEADER(MHD_Bool) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_SUPPRESS_DATE_HEADER(MHD_Bool) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_SUPPRESS_DATE_HEADER(MHD_Bool) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_SUPPRESS_DATE_HEADER(MHD_Bool) |
2131 | | |
2132 | | |
2133 | | /** |
2134 | | * Use SHOUTcast for responses. |
2135 | | * This will cause *all* responses to begin with the SHOUTcast 'ICY' line instead of 'HTTP'. |
2136 | | * @param value the value of the parameter * @return structure with the requested setting |
2137 | | */ |
2138 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2139 | | MHD_D_OPTION_ENABLE_SHOUTCAST ( |
2140 | | enum MHD_Bool value |
2141 | | ) |
2142 | 0 | { |
2143 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2144 | 0 |
|
2145 | 0 | opt_val.opt = MHD_D_O_ENABLE_SHOUTCAST; |
2146 | 0 | opt_val.val.enable_shoutcast = (value); \ |
2147 | 0 |
|
2148 | 0 | return opt_val; |
2149 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_ENABLE_SHOUTCAST(MHD_Bool) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_ENABLE_SHOUTCAST(MHD_Bool) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_ENABLE_SHOUTCAST(MHD_Bool) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_ENABLE_SHOUTCAST(MHD_Bool) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_ENABLE_SHOUTCAST(MHD_Bool) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_ENABLE_SHOUTCAST(MHD_Bool) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_ENABLE_SHOUTCAST(MHD_Bool) |
2150 | | |
2151 | | |
2152 | | /** |
2153 | | * Maximum memory size per connection. |
2154 | | * Default is 32kb. |
2155 | | * Values above 128kb are unlikely to result in much performance benefit, as half of the memory will be typically used for IO, and TCP buffers are unlikely to support window sizes above 64k on most systems. |
2156 | | * The size should be large enough to fit all request headers (together with internal parsing information). |
2157 | | * @param value the value of the parameter * @return structure with the requested setting |
2158 | | */ |
2159 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2160 | | MHD_D_OPTION_CONN_MEMORY_LIMIT ( |
2161 | | size_t value |
2162 | | ) |
2163 | 3.56k | { |
2164 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; |
2165 | | |
2166 | 3.56k | opt_val.opt = MHD_D_O_CONN_MEMORY_LIMIT; |
2167 | 3.56k | opt_val.val.conn_memory_limit = (value); \ |
2168 | 3.56k | |
2169 | 3.56k | return opt_val; |
2170 | 3.56k | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_CONN_MEMORY_LIMIT(unsigned long) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_CONN_MEMORY_LIMIT(unsigned long) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_CONN_MEMORY_LIMIT(unsigned long) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_CONN_MEMORY_LIMIT(unsigned long) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_CONN_MEMORY_LIMIT(unsigned long) fuzz_mhd2.cpp:MHD_D_OPTION_CONN_MEMORY_LIMIT(unsigned long) Line | Count | Source | 2163 | 3.56k | { | 2164 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; | 2165 | | | 2166 | 3.56k | opt_val.opt = MHD_D_O_CONN_MEMORY_LIMIT; | 2167 | 3.56k | opt_val.val.conn_memory_limit = (value); \ | 2168 | 3.56k | | 2169 | 3.56k | return opt_val; | 2170 | 3.56k | } |
Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_CONN_MEMORY_LIMIT(unsigned long) |
2171 | | |
2172 | | |
2173 | | /** |
2174 | | * The size of the shared memory pool for accamulated upload processing. |
2175 | | * The same large pool is shared for all connections server by MHD and used when application requests avoiding of incremental upload processing to accamulate complete content upload before giving it to the application. |
2176 | | * Default is 8Mb. |
2177 | | * Can be set to zero to disable share pool. |
2178 | | * @param value the value of the parameter * @return structure with the requested setting |
2179 | | */ |
2180 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2181 | | MHD_D_OPTION_LARGE_POOL_SIZE ( |
2182 | | size_t value |
2183 | | ) |
2184 | 0 | { |
2185 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2186 | 0 |
|
2187 | 0 | opt_val.opt = MHD_D_O_LARGE_POOL_SIZE; |
2188 | 0 | opt_val.val.large_pool_size = (value); \ |
2189 | 0 |
|
2190 | 0 | return opt_val; |
2191 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_LARGE_POOL_SIZE(unsigned long) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_LARGE_POOL_SIZE(unsigned long) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_LARGE_POOL_SIZE(unsigned long) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_LARGE_POOL_SIZE(unsigned long) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_LARGE_POOL_SIZE(unsigned long) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_LARGE_POOL_SIZE(unsigned long) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_LARGE_POOL_SIZE(unsigned long) |
2192 | | |
2193 | | |
2194 | | /** |
2195 | | * Desired size of the stack for the threads started by MHD. |
2196 | | * Use 0 for system default, which is also MHD default. |
2197 | | * Works only with #MHD_D_OPTION_WM_WORKER_THREADS() or #MHD_D_OPTION_WM_THREAD_PER_CONNECTION(). |
2198 | | * @param value the value of the parameter * @return structure with the requested setting |
2199 | | */ |
2200 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2201 | | MHD_D_OPTION_STACK_SIZE ( |
2202 | | size_t value |
2203 | | ) |
2204 | 0 | { |
2205 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2206 | 0 |
|
2207 | 0 | opt_val.opt = MHD_D_O_STACK_SIZE; |
2208 | 0 | opt_val.val.stack_size = (value); \ |
2209 | 0 |
|
2210 | 0 | return opt_val; |
2211 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_STACK_SIZE(unsigned long) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_STACK_SIZE(unsigned long) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_STACK_SIZE(unsigned long) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_STACK_SIZE(unsigned long) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_STACK_SIZE(unsigned long) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_STACK_SIZE(unsigned long) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_STACK_SIZE(unsigned long) |
2212 | | |
2213 | | |
2214 | | /** |
2215 | | * The the maximum FD value. |
2216 | | * The limit is applied to all sockets used by MHD. |
2217 | | * If listen socket FD is equal or higher that specified value, the daemon fail to start. |
2218 | | * If new connection FD is equal or higher that specified value, the connection is rejected. |
2219 | | * Useful if application uses select() for polling the sockets, system FD_SETSIZE is good value for this option in such case. |
2220 | | * Silently ignored on W32 (WinSock sockets). |
2221 | | * @param max_fd FIXME |
2222 | | * @return structure with the requested setting |
2223 | | */ |
2224 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2225 | | MHD_D_OPTION_FD_NUMBER_LIMIT ( |
2226 | | MHD_Socket max_fd |
2227 | | ) |
2228 | 0 | { |
2229 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2230 | 0 |
|
2231 | 0 | opt_val.opt = MHD_D_O_FD_NUMBER_LIMIT; |
2232 | 0 | opt_val.val.fd_number_limit = max_fd; |
2233 | 0 |
|
2234 | 0 | return opt_val; |
2235 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_FD_NUMBER_LIMIT(int) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_FD_NUMBER_LIMIT(int) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_FD_NUMBER_LIMIT(int) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_FD_NUMBER_LIMIT(int) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_FD_NUMBER_LIMIT(int) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_FD_NUMBER_LIMIT(int) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_FD_NUMBER_LIMIT(int) |
2236 | | |
2237 | | |
2238 | | /** |
2239 | | * Enable `turbo`. |
2240 | | * Disables certain calls to `shutdown()`, enables aggressive non-blocking optimistic reads and other potentially unsafe optimisations. |
2241 | | * Most effects only happen with internal threads with epoll. |
2242 | | * The 'turbo' mode is not enabled (mode is disabled) by default. |
2243 | | * @param value the value of the parameter * @return structure with the requested setting |
2244 | | */ |
2245 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2246 | | MHD_D_OPTION_TURBO ( |
2247 | | enum MHD_Bool value |
2248 | | ) |
2249 | 0 | { |
2250 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2251 | 0 |
|
2252 | 0 | opt_val.opt = MHD_D_O_TURBO; |
2253 | 0 | opt_val.val.turbo = (value); \ |
2254 | 0 |
|
2255 | 0 | return opt_val; |
2256 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_TURBO(MHD_Bool) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_TURBO(MHD_Bool) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_TURBO(MHD_Bool) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_TURBO(MHD_Bool) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_TURBO(MHD_Bool) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_TURBO(MHD_Bool) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_TURBO(MHD_Bool) |
2257 | | |
2258 | | |
2259 | | /** |
2260 | | * Disable some internal thread safety. |
2261 | | * Indicates that MHD daemon will be used by application in single-threaded mode only. When this flag is set then application must call any MHD function only within a single thread. |
2262 | | * This flag turns off some internal thread-safety and allows MHD making some of the internal optimisations suitable only for single-threaded environment. |
2263 | | * Not compatible with any internal threads modes. |
2264 | | * If MHD is compiled with custom configuration for embedded projects without threads support, this option is mandatory. |
2265 | | * Thread safety is not disabled (safety is enabled) by default. |
2266 | | * @param value the value of the parameter * @return structure with the requested setting |
2267 | | */ |
2268 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2269 | | MHD_D_OPTION_DISABLE_THREAD_SAFETY ( |
2270 | | enum MHD_Bool value |
2271 | | ) |
2272 | 0 | { |
2273 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2274 | 0 |
|
2275 | 0 | opt_val.opt = MHD_D_O_DISABLE_THREAD_SAFETY; |
2276 | 0 | opt_val.val.disable_thread_safety = (value); \ |
2277 | 0 |
|
2278 | 0 | return opt_val; |
2279 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_DISABLE_THREAD_SAFETY(MHD_Bool) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_DISABLE_THREAD_SAFETY(MHD_Bool) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_DISABLE_THREAD_SAFETY(MHD_Bool) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_DISABLE_THREAD_SAFETY(MHD_Bool) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_DISABLE_THREAD_SAFETY(MHD_Bool) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_DISABLE_THREAD_SAFETY(MHD_Bool) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_DISABLE_THREAD_SAFETY(MHD_Bool) |
2280 | | |
2281 | | |
2282 | | /** |
2283 | | * You need to set this option if you want to disable use of HTTP Upgrade. |
2284 | | * Upgrade may require usage of additional internal resources, which we can avoid providing if they will not be used. |
2285 | | * You should only use this option if you do not use upgrade functionality and need a generally minor boost in performance and resources saving. |
2286 | | * The upgrade is not disallowed (upgrade is allowed) by default. |
2287 | | * @param value the value of the parameter * @return structure with the requested setting |
2288 | | */ |
2289 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2290 | | MHD_D_OPTION_DISALLOW_UPGRADE ( |
2291 | | enum MHD_Bool value |
2292 | | ) |
2293 | 0 | { |
2294 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2295 | 0 |
|
2296 | 0 | opt_val.opt = MHD_D_O_DISALLOW_UPGRADE; |
2297 | 0 | opt_val.val.disallow_upgrade = (value); \ |
2298 | 0 |
|
2299 | 0 | return opt_val; |
2300 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_DISALLOW_UPGRADE(MHD_Bool) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_DISALLOW_UPGRADE(MHD_Bool) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_DISALLOW_UPGRADE(MHD_Bool) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_DISALLOW_UPGRADE(MHD_Bool) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_DISALLOW_UPGRADE(MHD_Bool) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_DISALLOW_UPGRADE(MHD_Bool) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_DISALLOW_UPGRADE(MHD_Bool) |
2301 | | |
2302 | | |
2303 | | /** |
2304 | | * Disable #MHD_action_suspend() functionality. |
2305 | | * |
2306 | | You should only use this function if you do not use suspend functionality and need a generally minor boost in performance. |
2307 | | * The suspend is not disallowed (suspend is allowed) by default. |
2308 | | * @param value the value of the parameter * @return structure with the requested setting |
2309 | | */ |
2310 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2311 | | MHD_D_OPTION_DISALLOW_SUSPEND_RESUME ( |
2312 | | enum MHD_Bool value |
2313 | | ) |
2314 | 0 | { |
2315 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2316 | 0 |
|
2317 | 0 | opt_val.opt = MHD_D_O_DISALLOW_SUSPEND_RESUME; |
2318 | 0 | opt_val.val.disallow_suspend_resume = (value); \ |
2319 | 0 |
|
2320 | 0 | return opt_val; |
2321 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_DISALLOW_SUSPEND_RESUME(MHD_Bool) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_DISALLOW_SUSPEND_RESUME(MHD_Bool) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_DISALLOW_SUSPEND_RESUME(MHD_Bool) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_DISALLOW_SUSPEND_RESUME(MHD_Bool) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_DISALLOW_SUSPEND_RESUME(MHD_Bool) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_DISALLOW_SUSPEND_RESUME(MHD_Bool) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_DISALLOW_SUSPEND_RESUME(MHD_Bool) |
2322 | | |
2323 | | |
2324 | | /** |
2325 | | * Disable cookies parsing. |
2326 | | * |
2327 | | Disable automatic cookies processing if cookies are not used. |
2328 | | * Cookies are automatically parsed by default. |
2329 | | * @param value the value of the parameter * @return structure with the requested setting |
2330 | | */ |
2331 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2332 | | MHD_D_OPTION_DISABLE_COOKIES ( |
2333 | | enum MHD_Bool value |
2334 | | ) |
2335 | 0 | { |
2336 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2337 | 0 |
|
2338 | 0 | opt_val.opt = MHD_D_O_DISABLE_COOKIES; |
2339 | 0 | opt_val.val.disable_cookies = (value); \ |
2340 | 0 |
|
2341 | 0 | return opt_val; |
2342 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_DISABLE_COOKIES(MHD_Bool) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_DISABLE_COOKIES(MHD_Bool) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_DISABLE_COOKIES(MHD_Bool) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_DISABLE_COOKIES(MHD_Bool) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_DISABLE_COOKIES(MHD_Bool) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_DISABLE_COOKIES(MHD_Bool) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_DISABLE_COOKIES(MHD_Bool) |
2343 | | |
2344 | | |
2345 | | /** |
2346 | | * Set a callback to be called for pre-start finalisation. |
2347 | | * |
2348 | | The specified callback will be called one time, after network initialisation, TLS pre-initialisation, but before the start of the internal threads (if allowed) |
2349 | | * @param cb the pre-start callback |
2350 | | * @param cb_cls the closure for the callback |
2351 | | * @return structure with the requested setting |
2352 | | */ |
2353 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2354 | | MHD_D_OPTION_DAEMON_READY_CALLBACK ( |
2355 | | MHD_DaemonReadyCallback cb, |
2356 | | void *cb_cls |
2357 | | ) |
2358 | 0 | { |
2359 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2360 | 0 |
|
2361 | 0 | opt_val.opt = MHD_D_O_DAEMON_READY_CALLBACK; |
2362 | 0 | opt_val.val.daemon_ready_callback.v_cb = cb; |
2363 | 0 | opt_val.val.daemon_ready_callback.v_cb_cls = cb_cls; |
2364 | 0 |
|
2365 | 0 | return opt_val; |
2366 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_DAEMON_READY_CALLBACK(void (*)(void*), void*) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_DAEMON_READY_CALLBACK(void (*)(void*), void*) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_DAEMON_READY_CALLBACK(void (*)(void*), void*) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_DAEMON_READY_CALLBACK(void (*)(void*), void*) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_DAEMON_READY_CALLBACK(void (*)(void*), void*) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_DAEMON_READY_CALLBACK(void (*)(void*), void*) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_DAEMON_READY_CALLBACK(void (*)(void*), void*) |
2367 | | |
2368 | | |
2369 | | /** |
2370 | | * Set a function that should be called whenever a connection is started or closed. |
2371 | | * @param ncc the callback for notifications |
2372 | | * @param cls the closure for the callback |
2373 | | * @return structure with the requested setting |
2374 | | */ |
2375 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2376 | | MHD_D_OPTION_NOTIFY_CONNECTION ( |
2377 | | MHD_NotifyConnectionCallback ncc, |
2378 | | void *cls |
2379 | | ) |
2380 | 0 | { |
2381 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2382 | 0 |
|
2383 | 0 | opt_val.opt = MHD_D_O_NOTIFY_CONNECTION; |
2384 | 0 | opt_val.val.notify_connection.v_ncc = ncc; |
2385 | 0 | opt_val.val.notify_connection.v_cls = cls; |
2386 | 0 |
|
2387 | 0 | return opt_val; |
2388 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_NOTIFY_CONNECTION(void (*)(void*, MHD_ConnectionNotificationData*), void*) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_NOTIFY_CONNECTION(void (*)(void*, MHD_ConnectionNotificationData*), void*) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_NOTIFY_CONNECTION(void (*)(void*, MHD_ConnectionNotificationData*), void*) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_NOTIFY_CONNECTION(void (*)(void*, MHD_ConnectionNotificationData*), void*) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_NOTIFY_CONNECTION(void (*)(void*, MHD_ConnectionNotificationData*), void*) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_NOTIFY_CONNECTION(void (*)(void*, MHD_ConnectionNotificationData*), void*) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_NOTIFY_CONNECTION(void (*)(void*, MHD_ConnectionNotificationData*), void*) |
2389 | | |
2390 | | |
2391 | | /** |
2392 | | * Register a function that should be called whenever a stream is started or closed. |
2393 | | * For HTTP/1.1 this callback is called one time for every connection. |
2394 | | * @param nsc the callback for notifications |
2395 | | * @param cls the closure for the callback |
2396 | | * @return structure with the requested setting |
2397 | | */ |
2398 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2399 | | MHD_D_OPTION_NOTIFY_STREAM ( |
2400 | | MHD_NotifyStreamCallback nsc, |
2401 | | void *cls |
2402 | | ) |
2403 | 0 | { |
2404 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2405 | 0 |
|
2406 | 0 | opt_val.opt = MHD_D_O_NOTIFY_STREAM; |
2407 | 0 | opt_val.val.notify_stream.v_nsc = nsc; |
2408 | 0 | opt_val.val.notify_stream.v_cls = cls; |
2409 | 0 |
|
2410 | 0 | return opt_val; |
2411 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_NOTIFY_STREAM(void (*)(void*, MHD_StreamNotificationData const*), void*) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_NOTIFY_STREAM(void (*)(void*, MHD_StreamNotificationData const*), void*) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_NOTIFY_STREAM(void (*)(void*, MHD_StreamNotificationData const*), void*) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_NOTIFY_STREAM(void (*)(void*, MHD_StreamNotificationData const*), void*) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_NOTIFY_STREAM(void (*)(void*, MHD_StreamNotificationData const*), void*) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_NOTIFY_STREAM(void (*)(void*, MHD_StreamNotificationData const*), void*) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_NOTIFY_STREAM(void (*)(void*, MHD_StreamNotificationData const*), void*) |
2412 | | |
2413 | | |
2414 | | /** |
2415 | | * Set strong random data to be used by MHD. |
2416 | | * Currently the data is only needed for Digest Auth module. |
2417 | | * Daemon support for Digest Auth is enabled automatically if this option is used. |
2418 | | * The recommended size is between 8 and 32 bytes. Security can be lower for sizes less or equal four. |
2419 | | * Sizes larger then 32 (or, probably, larger than 16 - debatable) will not increase the security. |
2420 | | * @param buf_size the size of the buffer |
2421 | | * @param buf the buffer with strong random data, the content will be copied by MHD |
2422 | | * @return structure with the requested setting |
2423 | | */ |
2424 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2425 | | MHD_D_OPTION_RANDOM_ENTROPY ( |
2426 | | size_t buf_size, |
2427 | | /* const */ void *buf |
2428 | | ) |
2429 | 3.56k | { |
2430 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; |
2431 | | |
2432 | 3.56k | opt_val.opt = MHD_D_O_RANDOM_ENTROPY; |
2433 | 3.56k | opt_val.val.random_entropy.v_buf_size = buf_size; |
2434 | 3.56k | opt_val.val.random_entropy.v_buf = buf; |
2435 | | |
2436 | 3.56k | return opt_val; |
2437 | 3.56k | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_RANDOM_ENTROPY(unsigned long, void*) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_RANDOM_ENTROPY(unsigned long, void*) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_RANDOM_ENTROPY(unsigned long, void*) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_RANDOM_ENTROPY(unsigned long, void*) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_RANDOM_ENTROPY(unsigned long, void*) fuzz_mhd2.cpp:MHD_D_OPTION_RANDOM_ENTROPY(unsigned long, void*) Line | Count | Source | 2429 | 3.56k | { | 2430 | 3.56k | struct MHD_DaemonOptionAndValue opt_val; | 2431 | | | 2432 | 3.56k | opt_val.opt = MHD_D_O_RANDOM_ENTROPY; | 2433 | 3.56k | opt_val.val.random_entropy.v_buf_size = buf_size; | 2434 | 3.56k | opt_val.val.random_entropy.v_buf = buf; | 2435 | | | 2436 | 3.56k | return opt_val; | 2437 | 3.56k | } |
fuzz_daemon.cpp:MHD_D_OPTION_RANDOM_ENTROPY(unsigned long, void*) Line | Count | Source | 2429 | 1 | { | 2430 | 1 | struct MHD_DaemonOptionAndValue opt_val; | 2431 | | | 2432 | 1 | opt_val.opt = MHD_D_O_RANDOM_ENTROPY; | 2433 | 1 | opt_val.val.random_entropy.v_buf_size = buf_size; | 2434 | 1 | opt_val.val.random_entropy.v_buf = buf; | 2435 | | | 2436 | 1 | return opt_val; | 2437 | 1 | } |
|
2438 | | |
2439 | | |
2440 | | /** |
2441 | | * Specify the size of the internal hash map array that tracks generated digest nonces usage. |
2442 | | * When the size of the map is too small then need to handle concurrent DAuth requests, a lot of stale nonce results will be produced. |
2443 | | * By default the size is 1000 entries. |
2444 | | * @param size the size of the map array |
2445 | | * @return structure with the requested setting |
2446 | | */ |
2447 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2448 | | MHD_D_OPTION_AUTH_DIGEST_MAP_SIZE ( |
2449 | | size_t size |
2450 | | ) |
2451 | 0 | { |
2452 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2453 | 0 |
|
2454 | 0 | opt_val.opt = MHD_D_O_AUTH_DIGEST_MAP_SIZE; |
2455 | 0 | opt_val.val.auth_digest_map_size = size; |
2456 | 0 |
|
2457 | 0 | return opt_val; |
2458 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_AUTH_DIGEST_MAP_SIZE(unsigned long) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_AUTH_DIGEST_MAP_SIZE(unsigned long) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_AUTH_DIGEST_MAP_SIZE(unsigned long) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_AUTH_DIGEST_MAP_SIZE(unsigned long) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_AUTH_DIGEST_MAP_SIZE(unsigned long) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_AUTH_DIGEST_MAP_SIZE(unsigned long) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_AUTH_DIGEST_MAP_SIZE(unsigned long) |
2459 | | |
2460 | | |
2461 | | /** |
2462 | | * Nonce validity time (in seconds) used for Digest Auth. |
2463 | | * If followed by zero value the value is silently ignored. |
2464 | | * @see #MHD_digest_auth_check(), MHD_digest_auth_check_digest() |
2465 | | * @param timeout FIXME |
2466 | | * @return structure with the requested setting |
2467 | | */ |
2468 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2469 | | MHD_D_OPTION_AUTH_DIGEST_NONCE_TIMEOUT ( |
2470 | | unsigned int timeout |
2471 | | ) |
2472 | 0 | { |
2473 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2474 | 0 |
|
2475 | 0 | opt_val.opt = MHD_D_O_AUTH_DIGEST_NONCE_TIMEOUT; |
2476 | 0 | opt_val.val.auth_digest_nonce_timeout = timeout; |
2477 | 0 |
|
2478 | 0 | return opt_val; |
2479 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_AUTH_DIGEST_NONCE_TIMEOUT(unsigned int) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_AUTH_DIGEST_NONCE_TIMEOUT(unsigned int) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_AUTH_DIGEST_NONCE_TIMEOUT(unsigned int) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_AUTH_DIGEST_NONCE_TIMEOUT(unsigned int) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_AUTH_DIGEST_NONCE_TIMEOUT(unsigned int) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_AUTH_DIGEST_NONCE_TIMEOUT(unsigned int) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_AUTH_DIGEST_NONCE_TIMEOUT(unsigned int) |
2480 | | |
2481 | | |
2482 | | /** |
2483 | | * Default maximum nc (nonce count) value used for Digest Auth. |
2484 | | * If followed by zero value the value is silently ignored. |
2485 | | * @see #MHD_digest_auth_check(), MHD_digest_auth_check_digest() |
2486 | | * @param max_nc FIXME |
2487 | | * @return structure with the requested setting |
2488 | | */ |
2489 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2490 | | MHD_D_OPTION_AUTH_DIGEST_DEF_MAX_NC ( |
2491 | | uint_fast32_t max_nc |
2492 | | ) |
2493 | 0 | { |
2494 | 0 | struct MHD_DaemonOptionAndValue opt_val; |
2495 | 0 |
|
2496 | 0 | opt_val.opt = MHD_D_O_AUTH_DIGEST_DEF_MAX_NC; |
2497 | 0 | opt_val.val.auth_digest_def_max_nc = max_nc; |
2498 | 0 |
|
2499 | 0 | return opt_val; |
2500 | 0 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_AUTH_DIGEST_DEF_MAX_NC(unsigned long) Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_AUTH_DIGEST_DEF_MAX_NC(unsigned long) Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_AUTH_DIGEST_DEF_MAX_NC(unsigned long) Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_AUTH_DIGEST_DEF_MAX_NC(unsigned long) Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_AUTH_DIGEST_DEF_MAX_NC(unsigned long) Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_AUTH_DIGEST_DEF_MAX_NC(unsigned long) Unexecuted instantiation: fuzz_daemon.cpp:MHD_D_OPTION_AUTH_DIGEST_DEF_MAX_NC(unsigned long) |
2501 | | |
2502 | | |
2503 | | /** |
2504 | | * Terminate the list of the options |
2505 | | * @return the terminating object of struct MHD_DaemonOptionAndValue |
2506 | | */ |
2507 | | static MHD_INLINE struct MHD_DaemonOptionAndValue |
2508 | | MHD_D_OPTION_TERMINATE (void) |
2509 | 1 | { |
2510 | 1 | struct MHD_DaemonOptionAndValue opt_val; |
2511 | | |
2512 | 1 | opt_val.opt = MHD_D_O_END; |
2513 | | |
2514 | 1 | return opt_val; |
2515 | 1 | } Unexecuted instantiation: fuzz_libinfo.cpp:MHD_D_OPTION_TERMINATE() Unexecuted instantiation: fuzz_str.cpp:MHD_D_OPTION_TERMINATE() Unexecuted instantiation: fuzz_connection.cpp:MHD_D_OPTION_TERMINATE() Unexecuted instantiation: fuzz_response.cpp:MHD_D_OPTION_TERMINATE() Unexecuted instantiation: mhd_helper.cpp:MHD_D_OPTION_TERMINATE() Unexecuted instantiation: fuzz_mhd2.cpp:MHD_D_OPTION_TERMINATE() fuzz_daemon.cpp:MHD_D_OPTION_TERMINATE() Line | Count | Source | 2509 | 1 | { | 2510 | 1 | struct MHD_DaemonOptionAndValue opt_val; | 2511 | | | 2512 | 1 | opt_val.opt = MHD_D_O_END; | 2513 | | | 2514 | 1 | return opt_val; | 2515 | 1 | } |
|
2516 | | |
2517 | | |
2518 | | MHD_RESTORE_WARN_UNUSED_FUNC_ |
2519 | | #endif /* !MHD_USE_COMPOUND_LITERALS || !MHD_USE_DESIG_NEST_INIT */ |