d_options.rec 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. # *-* mode: rec -*-
  2. #
  3. # MHD option registry
  4. #
  5. %rec: D_Options
  6. # recutils supports only signed 32 bit values
  7. %typedef: enum_value range 1 0x7FFFFFFF
  8. %key: Name
  9. %singular: Value
  10. %type: Value enum_value
  11. %auto: Value
  12. %mandatory: Value
  13. %mandatory: Comment
  14. %allowed: Type Argument1 Description1 Member1 Argument2 Description2 Member2 Argument3 Description3 Member3
  15. %type: Name,Type,Argument1,Member1,Argument2,Member2,Argument3,Member3 line
  16. %unique: Type Value Argument1 Description1 Member1 Argument2 Description2 Member2 Argument3 Description3 Member3
  17. # MHD behaviour
  18. Name: WORK_MODE
  19. Value: 40
  20. Comment: Set MHD work (threading and polling) mode.
  21. + 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.
  22. Argument1: struct MHD_WorkModeWithParam wmp
  23. Description1: 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()
  24. Name: poll_syscall
  25. Value: 41
  26. Comment: Select a sockets watch system call used for internal polling.
  27. Argument1: enum MHD_SockPollSyscall els
  28. Name: log_callback
  29. Value: 60
  30. Comment: Set a callback to use for logging
  31. Type: struct MHD_DaemonOptionValueLog
  32. Argument1: MHD_LoggingCallback log_cb
  33. Description1: the callback to use for logging,
  34. + NULL to disable logging
  35. Argument2: void *lob_cb_cls
  36. Description2: the closure for the logging callback
  37. # Listen socket
  38. Name: bind_port
  39. Value: 80
  40. Type: struct MHD_DaemonOptionValueBind
  41. Comment: Bind to the given TCP port and address family.
  42. +
  43. + Does not work with #MHD_D_OPTION_BIND_SA() or #MHD_D_OPTION_LISTEN_SOCKET().
  44. +
  45. + 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.
  46. Argument1: enum MHD_AddressFamily af
  47. Description1: the address family to use,
  48. + the #MHD_AF_NONE to disable listen socket (the same effect as if this option is not used)
  49. Argument2: uint_fast16_t port
  50. Description2: port to use, 0 to let system assign any free port,
  51. + ignored if @a af is #MHD_AF_NONE
  52. Name: bind_sa
  53. Value: 81
  54. Type: struct MHD_DaemonOptionValueSA
  55. Comment: Bind to the given socket address.
  56. +
  57. + Does not work with #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_LISTEN_SOCKET().
  58. +
  59. + 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.
  60. Argument1: size_t sa_len
  61. Description1: the size of the socket address pointed by @a sa.
  62. Argument2: const struct sockaddr *sa
  63. Description2: the address to bind to; can be IPv4 (AF_INET), IPv6 (AF_INET6) or even a UNIX domain socket (AF_UNIX)
  64. Name: listen_socket
  65. Value: 82
  66. Comment: Accept connections from the given socket. Socket
  67. + must be a TCP or UNIX domain (SOCK_STREAM) socket.
  68. +
  69. + Does not work with #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA().
  70. +
  71. + 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.
  72. Argument1: MHD_socket listen_fd
  73. Description1: the listen socket to use, ignored if set to #MHD_INVALID_SOCKET
  74. Name: listen addr reuse
  75. Value: 100
  76. Comment: Select mode of reusing address:port listen address.
  77. +
  78. + Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used.
  79. Argument1: enum MHD_DaemonOptionBindType reuse_type
  80. Name: tcp_fastopen
  81. Value: 101
  82. Type: struct MHD_DaemonOptionValueTFO
  83. Comment: Configure TCP_FASTOPEN option, including setting a
  84. + custom @a queue_length.
  85. +
  86. + Note that having a larger queue size can cause resource exhaustion
  87. + attack as the TCP stack has to now allocate resources for the SYN
  88. + packet along with its DATA.
  89. +
  90. + Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used.
  91. Argument1: enum MHD_TCPFastOpenType option
  92. Description1: the type use of of TCP FastOpen
  93. Argument2: unsigned int queue_length
  94. Description2: the length of the queue, zero to use system or MHD default,
  95. + silently ignored on platforms without support for custom queue size
  96. Name: LISTEN_BACKLOG
  97. Value: 102
  98. Comment: Use the given backlog for the listen() call.
  99. +
  100. + Works only when #MHD_D_OPTION_BIND_PORT() or #MHD_D_OPTION_BIND_SA() are used.
  101. Argument1: unsigned int backlog_size
  102. Name: sigpipe suppressed
  103. Value: 103
  104. Type: enum MHD_Bool
  105. Comment: Inform that SIGPIPE is suppressed or handled by application.
  106. + If suppressed/handled, MHD uses network functions that could generate SIGPIPE, like `sendfile()`.
  107. + Silently ignored when MHD creates internal threads as for them SIGPIPE is suppressed automatically.
  108. # TLS settings
  109. Name: TLS
  110. Value: 120
  111. Comment: Enable TLS (HTTPS) and select TLS backend
  112. Argument1: enum MHD_TlsBackend backend
  113. Description1: the TLS backend to use,
  114. + #MHD_TLS_BACKEND_NONE for non-TLS (plain TCP) connections
  115. Name: tls_key_cert
  116. Value: 121
  117. Comment: Provide TLS key and certificate data in-memory.
  118. + Works only if TLS mode is enabled.
  119. Type: struct MHD_DaemonOptionValueTlsCert
  120. Argument1: const char *mem_key
  121. Description1: the private key loaded into memory (not a filename)
  122. Argument2: const char *mem_cert
  123. Description2: the certificate loaded into memory (not a filename)
  124. Argument3: const char *mem_pass
  125. Description3: the option passphrase phrase to decrypt the private key,
  126. + could be NULL is private does not need a password
  127. Name: tls_client_ca
  128. Value: 122
  129. Comment: Provide the certificate of the certificate authority (CA) to be used by the MHD daemon for client authentication.
  130. + Works only if TLS mode is enabled.
  131. Argument1: const char *mem_client_ca
  132. Description1: the CA certificate in memory (not a filename)
  133. Name: tls_psk_callback
  134. Value: 130
  135. Type: struct MHD_DaemonOptionValueTlsPskCB
  136. Comment: Configure PSK to use for the TLS key exchange.
  137. Argument1: MHD_PskServerCredentialsCallback psk_cb
  138. Description1: the function to call to obtain pre-shared key
  139. Argument2: void *psk_cb_cls
  140. Description2: the closure for @a psk_cb
  141. Name: no alpn
  142. Value: 140
  143. Type: enum MHD_Bool
  144. Comment: Control ALPN for TLS connection.
  145. + Silently ignored for non-TLS.
  146. + By default ALPN is automatically used for TLS connections.
  147. # Connection handling
  148. Name: DEFAULT_TIMEOUT
  149. Value: 160
  150. Comment: Specify inactivity timeout for connection.
  151. + When no activity for specified time on connection, it is closed automatically.
  152. + Use zero for no timeout, which is also the (unsafe!) default.
  153. Argument1: unsigned int timeout
  154. Description1: the in seconds, zero for no timeout
  155. Name: GLOBAL_CONNECTION_LIMIT
  156. Value: 161
  157. Comment: Maximum number of (concurrent) network connections served by daemon
  158. Argument1: unsigned int glob_limit
  159. Name: PER_IP_LIMIT
  160. Value: 162
  161. Comment: Limit on the number of (concurrent) network connections made to the server from the same IP address.
  162. + 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.
  163. Argument1: unsigned int per_ip_limit
  164. Name: accept_policy
  165. Value: 163
  166. Type: struct MHD_DaemonOptionValueAcceptPol
  167. Comment: 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.
  168. Argument1: MHD_AcceptPolicyCallback apc
  169. Description1: the accept policy callback
  170. Argument2: void *apc_cls
  171. Description2: the closure for the callback
  172. # Requests processing
  173. Name: protocol_strict_level
  174. Value: 200
  175. Type: struct MHD_DaemonOptionValueStrctLvl
  176. Comment: Set how strictly MHD will enforce the HTTP protocol.
  177. Argument1: enum MHD_ProtocolStrictLevel sl
  178. Description1: the level of strictness
  179. Argument2: enum MHD_UseStictLevel how
  180. Description2: the way how to use the requested level
  181. Name: early_uri_logger
  182. Value: 201
  183. Type: struct MHD_DaemonOptionValueUriCB
  184. Comment: Set a callback to be called first for every request when the request line is received (before any parsing of the header).
  185. + This callback is the only way to get raw (unmodified) request URI as URI is parsed and modified by MHD in-place.
  186. + Mandatory URI modification may apply before this call, like binary zero replacement, as required by RFCs.
  187. Argument1: MHD_EarlyUriLogCallback cb
  188. Description1: the early URI callback
  189. Argument2: void *cls
  190. Description2: the closure for the callback
  191. Name: DISABLE_URI_QUERY_PLUS_AS_SPACE
  192. Value: 202
  193. Type: enum MHD_Bool
  194. Comment: Disable converting plus ('+') character to space in GET parameters (URI part after '?').
  195. + 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.
  196. + By default plus is converted to space in the query part of URI.
  197. # Responses processing
  198. Name: SUPPRESS_DATE_HEADER
  199. Value: 240
  200. Type: enum MHD_Bool
  201. Comment: Suppresse use of "Date:" header.
  202. + According to RFC should be suppressed only if the system has no RTC.
  203. + The "Date:" is not suppressed (the header is enabled) by default.
  204. Name: ENABLE_SHOUTCAST
  205. Value: 241
  206. Type: enum MHD_Bool
  207. Comment: Use SHOUTcast for responses.
  208. + This will cause *all* responses to begin with the SHOUTcast "ICY" line instead of "HTTP".
  209. # MHD limits
  210. Name: conn memory limit
  211. Value: 280
  212. Type: size_t
  213. Comment: Maximum memory size per connection.
  214. + Default is 32kb.
  215. + 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.
  216. + The size should be large enough to fit all request headers (together with internal parsing information).
  217. Name: large pool size
  218. Value: 281
  219. Type: size_t
  220. Comment: The size of the shared memory pool for accamulated upload processing.
  221. + 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.
  222. + Default is 8Mb.
  223. + Can be set to zero to disable share pool.
  224. Name: stack size
  225. Value: 282
  226. Type: size_t
  227. Comment: Desired size of the stack for the threads started by MHD.
  228. + Use 0 for system default, which is also MHD default.
  229. + Works only with #MHD_D_OPTION_WM_WORKER_THREADS() or #MHD_D_OPTION_WM_THREAD_PER_CONNECTION().
  230. Name: fd_number_limit
  231. Value: 283
  232. Comment: The the maximum FD value.
  233. + The limit is applied to all sockets used by MHD.
  234. + If listen socket FD is equal or higher that specified value, the daemon fail to start.
  235. + If new connection FD is equal or higher that specified value, the connection is rejected.
  236. + Useful if application uses select() for polling the sockets, system FD_SETSIZE is good value for this option in such case.
  237. + Does not work with #MHD_D_OPTION_WM_WORKER_THREADS() or #MHD_D_OPTION_WM_THREAD_PER_CONNECTION().
  238. + Does not work on W32 (WinSock sockets).
  239. Argument1: MHD_socket max_fd
  240. # MHD optimisations
  241. Name: TURBO
  242. Value: 320
  243. Type: enum MHD_Bool
  244. Comment: Enable `turbo`.
  245. + Disables certain calls to `shutdown()`, enables aggressive non-blocking optimistic reads and other potentially unsafe optimisations.
  246. + Most effects only happen with internal threads with epoll.
  247. + The 'turbo' mode is not enabled (mode is disabled) by default.
  248. Name: DISABLE_THREAD_SAFETY
  249. Value: 321
  250. Type: enum MHD_Bool
  251. Comment: Disable some internal thread safety.
  252. + 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.
  253. + This flag turns off some internal thread-safety and allows MHD making some of the internal optimisations suitable only for single-threaded environment.
  254. + Not compatible with any internal threads modes.
  255. + If MHD is compiled with custom configuration for embedded projects without threads support, this option is mandatory.
  256. + Thread safety is not disabled (safety is enabled) by default.
  257. Name: DISALLOW_UPGRADE
  258. Value: 322
  259. Type: enum MHD_Bool
  260. Comment: You need to set this option if you want to disable use of HTTP "Upgrade".
  261. + "Upgrade" may require usage of additional internal resources, which we can avoid providing if they will not be used.
  262. + You should only use this option if you do not use "Upgrade" functionality and need a generally minor boost in performance and resources saving.
  263. + The "Upgrade" is not disallowed ("upgrade" is allowed) by default.
  264. Name: DISALLOW_SUSPEND_RESUME
  265. Value: 323
  266. Type: enum MHD_Bool
  267. Comment: Disable #MHD_action_suspend() functionality.
  268. +
  269. + You should only use this function if you do not use suspend functionality and need a generally minor boost in performance.
  270. + The suspend is not disallowed (suspend is allowed) by default.
  271. # Notification callbacks
  272. Name: daemon_ready_callback
  273. Value: 360
  274. Type: struct MHD_DaemonOptionValueReadyCB
  275. Comment: Set a callback to be called for pre-start finalisation.
  276. +
  277. + The specified callback will be called one time, after network initialisation, TLS pre-initialisation, but before the start of the internal threads (if allowed)
  278. Argument1: MHD_DaemonReadyCallback cb
  279. Description1: the pre-start callback
  280. Argument2: void *cb_cls
  281. Description2: the closure for the callback
  282. Name: notify_connection
  283. Value: 361
  284. Type: struct MHD_DaemonOptionValueNotifConnCB
  285. Comment: Set a function that should be called whenever a connection is started or closed.
  286. Argument1: MHD_NotifyConnectionCallback ncc
  287. Description1: the callback for notifications
  288. Argument2: void *cls
  289. Description2: the closure for the callback
  290. Name: notify_stream
  291. Value: 362
  292. Type: struct MHD_DaemonOptionValueNotifStreamCB
  293. Comment: Register a function that should be called whenever a stream is started or closed.
  294. + For HTTP/1.1 this callback is called one time for every connection.
  295. Argument1: MHD_NotifyStreamCallback nsc
  296. Description1: the callback for notifications
  297. Argument2: void *cls
  298. Description2: the closure for the callback
  299. # Digest Auth settings
  300. Name: random entropy
  301. Value: 400
  302. Type: struct MHD_DaemonOptionValueRand
  303. Comment: Set strong random data to be used by MHD.
  304. + Currently the data is only needed for Digest Auth module.
  305. + The recommended size is between 8 and 32 bytes. Security can be lower for sizes less or equal four.
  306. + Sizes larger then 32 (or, probably, larger than 16 - debatable) will not increase the security.
  307. Argument1: size_t buf_size
  308. Description1: the size of the buffer
  309. Argument2: const void *buf
  310. Description2: the buffer with strong random data, the content will be copied by MHD
  311. Name: dauth_map_size
  312. Value: 401
  313. Comment: Specify the size of the internal hash map array that tracks generated digest nonces usage.
  314. + 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.
  315. + By default the size is 8 bytes (very small).
  316. Argument1: size_t size
  317. Description1: the size of the map array
  318. Name: dauth_nonce_bind_type
  319. Value: 402
  320. Type: enum MHD_DaemonOptionValueDAuthBindNonce
  321. Comment: Control the scope of validity of MHD-generated nonces.
  322. + This regulates how "nonces" are generated and how "nonces" are checked by #MHD_digest_auth_check() and similar functions.
  323. + This option allows bitwise OR combination of #MHD_DaemonOptionValueDAuthBindNonce values.
  324. + When this option is not used then default value is #MHD_D_OPTION_VALUE_DAUTH_BIND_NONCE_NONE.
  325. Argument1: bind_type
  326. Name: dauth_def_nonce_timeout
  327. Value: 403
  328. Comment: Default nonce timeout value (in seconds) used for Digest Auth.
  329. + Silently ignored if followed by zero value.
  330. + @see #MHD_digest_auth_check(), MHD_digest_auth_check_digest()
  331. Argument1: unsigned int timeout
  332. Name: dauth_def_max_nc
  333. Value: 404
  334. Comment: Default maximum nc (nonce count) value used for Digest Auth.
  335. + Silently ignored if followed by zero value.
  336. + @see #MHD_digest_auth_check(), MHD_digest_auth_check_digest()
  337. Argument1: uint_fast32_t max_nc