http_core.inc 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122
  1. {* Licensed to the Apache Software Foundation (ASF) under one or more
  2. * contributor license agreements. See the NOTICE file distributed with
  3. * this work for additional information regarding copyright ownership.
  4. * The ASF licenses this file to You under the Apache License, Version 2.0
  5. * (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *}
  16. (**
  17. * @file http_core.h
  18. * @brief CORE HTTP Daemon
  19. *
  20. * @defgroup APACHE_CORE_HTTPD Core HTTP Daemon
  21. * @ingroup APACHE_CORE
  22. * @{
  23. *)
  24. //#ifndef APACHE_HTTP_CORE_H
  25. //#define APACHE_HTTP_CORE_H
  26. //#include "apr.h"
  27. //#include "apr_hash.h"
  28. //#include "apr_optional.h"
  29. {$include util_filter.inc}
  30. {$include ap_expr.inc}
  31. //#include "apr_tables.h"
  32. //#include "http_config.h"
  33. //#if APR_HAVE_STRUCT_RLIMIT
  34. //#include <sys/time.h>
  35. //#include <sys/resource.h>
  36. //#endif
  37. {* ****************************************************************
  38. *
  39. * The most basic server code is encapsulated in a single module
  40. * known as the core, which is just *barely* functional enough to
  41. * serve documents, though not terribly well.
  42. *
  43. * Largely for NCSA back-compatibility reasons, the core needs to
  44. * make pieces of its config structures available to other modules.
  45. * The accessors are declared here, along with the interpretation
  46. * of one of them (allow_options).
  47. *}
  48. (**
  49. * @defgroup APACHE_CORE_HTTPD_ACESSORS Acessors
  50. *
  51. * @brief File/Directory Accessor directives
  52. *
  53. * @{
  54. *)
  55. const
  56. //** No directives */
  57. OPT_NONE = 0;
  58. //** Indexes directive */
  59. OPT_INDEXES = 1;
  60. //** SSI is enabled without exec= permission */
  61. OPT_INCLUDES = 2;
  62. //** FollowSymLinks directive */
  63. OPT_SYM_LINKS = 4;
  64. //** ExecCGI directive */
  65. OPT_EXECCGI = 8;
  66. //** directive unset */
  67. OPT_UNSET = 16;
  68. //** SSI exec= permission is permitted, iff OPT_INCLUDES is also set */
  69. OPT_INC_WITH_EXEC = 32;
  70. //** SymLinksIfOwnerMatch directive */
  71. OPT_SYM_OWNER = 64;
  72. //** MultiViews directive */
  73. OPT_MULTI = 128;
  74. //** All directives */
  75. OPT_ALL = (OPT_INDEXES or OPT_INCLUDES or OPT_INC_WITH_EXEC or OPT_SYM_LINKS or OPT_EXECCGI);
  76. (** @} *)
  77. (**
  78. * @defgroup get_remote_host Remote Host Resolution
  79. * @ingroup APACHE_CORE_HTTPD
  80. * @{
  81. *)
  82. {** REMOTE_HOST returns the hostname, or NULL if the hostname
  83. * lookup fails. It will force a DNS lookup according to the
  84. * HostnameLookups setting.
  85. *}
  86. REMOTE_HOST = 0;
  87. {** REMOTE_NAME returns the hostname, or the dotted quad if the
  88. * hostname lookup fails. It will force a DNS lookup according
  89. * to the HostnameLookups setting.
  90. *}
  91. REMOTE_NAME = 1;
  92. {** REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
  93. * never forced.
  94. *}
  95. REMOTE_NOLOOKUP = 2;
  96. {** REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
  97. * a double reverse lookup, regardless of the HostnameLookups
  98. * setting. The result is the (double reverse checked) hostname,
  99. * or NULL if any of the lookups fail.
  100. *}
  101. REMOTE_DOUBLE_REV = 3;
  102. (** @} // get_remote_host *)
  103. //** all of the requirements must be met */
  104. SATISFY_ALL = 0;
  105. //** any of the requirements must be met */
  106. SATISFY_ANY = 1;
  107. //** There are no applicable satisfy lines */
  108. SATISFY_NOSPEC = 2;
  109. {** Make sure we don't write less than 8000 bytes at any one time.
  110. *}
  111. AP_MIN_BYTES_TO_WRITE = 8000;
  112. //** default maximum of internal redirects */
  113. AP_DEFAULT_MAX_INTERNAL_REDIRECTS = 10;
  114. //** default maximum subrequest nesting level */
  115. AP_DEFAULT_MAX_SUBREQ_DEPTH = 10;
  116. (**
  117. * Retrieve the value of Options for this request
  118. * @param r The current request
  119. * @return the Options bitmask
  120. *)
  121. //AP_DECLARE(int) ap_allow_options(request_rec *r);
  122. function ap_allow_options(r: Prequest_rec): Integer;
  123. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  124. external LibHTTPD name LibNamePrefix + 'ap_allow_options' + LibSuff4;
  125. {**
  126. * Retrieve the value of the AllowOverride for this request
  127. * @param r The current request
  128. * @return the overrides bitmask
  129. *}
  130. //AP_DECLARE(int) ap_allow_overrides(request_rec *r);
  131. function ap_allow_overrides(r: Prequest_rec): Integer;
  132. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  133. external LibHTTPD name LibNamePrefix + 'ap_allow_overrides' + LibSuff4;
  134. {**
  135. * Retrieve the document root for this server
  136. * @param r The current request
  137. * @warning Don't use this! If your request went through a Userdir, or
  138. * something like that, it'll screw you. But it's back-compatible...
  139. * @return The document root
  140. *}
  141. //AP_DECLARE(const char *) ap_document_root(request_rec *r);
  142. function ap_document_root(r: Prequest_rec): PChar;
  143. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  144. external LibHTTPD name LibNamePrefix + 'ap_document_root' + LibSuff4;
  145. {**
  146. * Lookup the remote client's DNS name or IP address
  147. * @ingroup get_remote_host
  148. * @param conn The current connection
  149. * @param dir_config The directory config vector from the request
  150. * @param type The type of lookup to perform. One of:
  151. * <pre>
  152. * REMOTE_HOST returns the hostname, or NULL if the hostname
  153. * lookup fails. It will force a DNS lookup according to the
  154. * HostnameLookups setting.
  155. * REMOTE_NAME returns the hostname, or the dotted quad if the
  156. * hostname lookup fails. It will force a DNS lookup according
  157. * to the HostnameLookups setting.
  158. * REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
  159. * never forced.
  160. * REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
  161. * a double reverse lookup, regardless of the HostnameLookups
  162. * setting. The result is the (double reverse checked)
  163. * hostname, or NULL if any of the lookups fail.
  164. * </pre>
  165. * @param str_is_ip unless NULL is passed, this will be set to non-zero on output when an IP address
  166. * string is returned
  167. * @return The remote hostname
  168. *}
  169. //AP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip);
  170. function ap_get_remote_host(conn: Pconn_rec; dir_config: Pointer; _type: Integer; str_is_ip: PInteger): PChar;
  171. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  172. external LibHTTPD name LibNamePrefix + 'ap_get_remote_host' + LibSuff16;
  173. {**
  174. * Retrieve the login name of the remote user. Undef if it could not be
  175. * determined
  176. * @param r The current request
  177. * @return The user logged in to the client machine
  178. *}
  179. //AP_DECLARE(const char *) ap_get_remote_logname(request_rec *r);
  180. function ap_get_remote_logname(r: Prequest_rec): PChar;
  181. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  182. external LibHTTPD name LibNamePrefix + 'ap_get_remote_logname' + LibSuff4;
  183. {* Used for constructing self-referencing URLs, and things like SERVER_PORT,
  184. * and SERVER_NAME.
  185. *}
  186. {**
  187. * build a fully qualified URL from the uri and information in the request rec
  188. * @param p The pool to allocate the URL from
  189. * @param uri The path to the requested file
  190. * @param r The current request
  191. * @return A fully qualified URL
  192. *}
  193. //AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r);
  194. function ap_construct_url(p: Papr_pool_t; const uri: PChar; r: Prequest_rec): PChar;
  195. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  196. external LibHTTPD name LibNamePrefix + 'ap_construct_url' + LibSuff12;
  197. {**
  198. * Get the current server name from the request
  199. * @param r The current request
  200. * @return the server name
  201. *}
  202. //AP_DECLARE(const char *) ap_get_server_name(request_rec *r);
  203. function ap_get_server_name(r: Prequest_rec): PChar;
  204. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  205. external LibHTTPD name LibNamePrefix + 'ap_get_server_name' + LibSuff4;
  206. {**
  207. * Get the current server name from the request for the purposes
  208. * of using in a URL. If the server name is an IPv6 literal
  209. * address, it will be returned in URL format (e.g., "[fe80::1]").
  210. * @param r The current request
  211. * @return the server name
  212. *}
  213. //AP_DECLARE(const char *) ap_get_server_name_for_url(request_rec *r);
  214. function ap_get_server_name_for_url(r: Prequest_rec): PChar;
  215. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  216. external LibHTTPD name LibNamePrefix + 'ap_get_server_name_for_url' + LibSuff4;
  217. {**
  218. * Get the current server port
  219. * @param r The current request
  220. * @return The server's port
  221. *}
  222. //AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r);
  223. function ap_get_server_port(r: Prequest_rec): apr_port_t;
  224. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  225. external LibHTTPD name LibNamePrefix + 'ap_get_server_port' + LibSuff4;
  226. {**
  227. * Return the limit on bytes in request msg body
  228. * @param r The current request
  229. * @return the maximum number of bytes in the request msg body
  230. *}
  231. //AP_DECLARE(apr_off_t) ap_get_limit_req_body(const request_rec *r);
  232. function ap_get_limit_req_body(r: Prequest_rec): apr_off_t;
  233. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  234. external LibHTTPD name LibNamePrefix + 'ap_get_limit_req_body' + LibSuff4;
  235. {**
  236. * Return the limit on bytes in XML request msg body
  237. * @param r The current request
  238. * @return the maximum number of bytes in XML request msg body
  239. *}
  240. //AP_DECLARE(apr_size_t) ap_get_limit_xml_body(const request_rec *r);
  241. function ap_get_limit_xml_body(r: Prequest_rec): apr_size_t;
  242. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  243. external LibHTTPD name LibNamePrefix + 'ap_get_limit_xml_body' + LibSuff4;
  244. {**
  245. * Install a custom response handler for a given status
  246. * @param r The current request
  247. * @param status The status for which the custom response should be used
  248. * @param string The custom response. This can be a static string, a file
  249. * or a URL
  250. *}
  251. //AP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string);
  252. procedure ap_custom_response(r: Prequest_rec; status: Integer; const string_: PChar);
  253. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  254. external LibHTTPD name LibNamePrefix + 'ap_custom_response' + LibSuff12;
  255. {**
  256. * Check if the current request is beyond the configured max. number of redirects or subrequests
  257. * @param r The current request
  258. * @return true (is exceeded) or false
  259. *}
  260. //AP_DECLARE(int) ap_is_recursion_limit_exceeded(const request_rec *r);
  261. function ap_is_recursion_limit_exceeded(const r: Prequest_rec): Integer;
  262. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  263. external LibHTTPD name LibNamePrefix + 'ap_is_recursion_limit_exceeded' + LibSuff4;
  264. {**
  265. * Check for a definition from the server command line
  266. * @param name The define to check for
  267. * @return 1 if defined, 0 otherwise
  268. *}
  269. //AP_DECLARE(int) ap_exists_config_define(const char *name);
  270. function ap_exists_config_define(const name: PChar): Integer;
  271. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  272. external LibHTTPD name LibNamePrefix + 'ap_exists_config_define' + LibSuff4;
  273. //* FIXME! See STATUS about how */
  274. //AP_DECLARE_NONSTD(int) ap_core_translate(request_rec *r);
  275. function ap_core_translate(r: Prequest_rec): Integer; cdecl;
  276. external LibHTTPD name 'ap_core_translate';
  277. {* Authentication stuff. This is one of the places where compatibility
  278. * with the old config files *really* hurts; they don't discriminate at
  279. * all between different authentication schemes, meaning that we need
  280. * to maintain common state for all of them in the core, and make it
  281. * available to the other modules through interfaces.
  282. *}
  283. //** @see require_line */
  284. //typedef struct require_line require_line;
  285. type
  286. Prequire_line = ^require_line;
  287. {**
  288. * @brief A structure to keep track of authorization requirements
  289. *}
  290. require_line = record
  291. //** Where the require line is in the config file. */
  292. method_mask: apr_int64_t;
  293. //** The complete string from the command line */
  294. requirement: PChar;
  295. end;
  296. {**
  297. * Return the type of authorization required for this request
  298. * @param r The current request
  299. * @return The authorization required
  300. *}
  301. //AP_DECLARE(const char *) ap_auth_type(request_rec *r);
  302. function ap_auth_type(r: Prequest_rec): PChar;
  303. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  304. external LibHTTPD name LibNamePrefix + 'ap_auth_type' + LibSuff4;
  305. {**
  306. * Return the current Authorization realm
  307. * @param r The current request
  308. * @return The current authorization realm
  309. *}
  310. //AP_DECLARE(const char *) ap_auth_name(request_rec *r);
  311. function ap_auth_name(r: Prequest_rec): PChar;
  312. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  313. external LibHTTPD name LibNamePrefix + 'ap_auth_name' + LibSuff4;
  314. {**
  315. * How the requires lines must be met.
  316. * @param r The current request
  317. * @return How the requirements must be met. One of:
  318. * <pre>
  319. * SATISFY_ANY -- any of the requirements must be met.
  320. * SATISFY_ALL -- all of the requirements must be met.
  321. * SATISFY_NOSPEC -- There are no applicable satisfy lines
  322. * </pre>
  323. *}
  324. //AP_DECLARE(int) ap_satisfies(request_rec *r);
  325. function ap_satisfies(r: Prequest_rec): Integer;
  326. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  327. external LibHTTPD name LibNamePrefix + 'ap_satisfies' + LibSuff4;
  328. {**
  329. * Core is also unlike other modules in being implemented in more than
  330. * one file... so, data structures are declared here, even though most of
  331. * the code that cares really is in http_core.c. Also, another accessor.
  332. *}
  333. //AP_DECLARE_DATA extern module core_module;
  334. {**
  335. * Accessor for core_module's specific data. Equivalent to
  336. * ap_get_module_config(cv, &core_module) but more efficient.
  337. * @param cv The vector in which the modules configuration is stored.
  338. * usually r->per_dir_config or s->module_config
  339. * @return The module-specific data
  340. *}
  341. //AP_DECLARE(void *) ap_get_core_module_config(const ap_conf_vector_t *cv);
  342. {not found in httpd binary libraries, ignored}
  343. {**
  344. * Accessor to set core_module's specific data. Equivalent to
  345. * ap_set_module_config(cv, &core_module, val) but more efficient.
  346. * @param cv The vector in which the modules configuration is stored.
  347. * usually r->per_dir_config or s->module_config
  348. * @param val The module-specific data to set
  349. *}
  350. //AP_DECLARE(void) ap_set_core_module_config(ap_conf_vector_t *cv, void *val);
  351. {not found in httpd binary libraries, ignored}
  352. {** Get the socket from the core network filter. This should be used instead of
  353. * accessing the core connection config directly.
  354. * @param c The connection record
  355. * @return The socket
  356. *}
  357. //AP_DECLARE(apr_socket_t *) ap_get_conn_socket(conn_rec *c);
  358. function ap_get_conn_socket(c: Pconn_rec): Integer;
  359. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  360. external LibHTTPD name LibNamePrefix + 'ap_get_conn_socket' + LibSuff4;
  361. //#ifndef AP_DEBUG
  362. //#define AP_CORE_MODULE_INDEX 0
  363. //#define ap_get_core_module_config(v) \
  364. // (((void **)(v))[AP_CORE_MODULE_INDEX])
  365. //#define ap_set_core_module_config(v, val) \
  366. // ((((void **)(v))[AP_CORE_MODULE_INDEX]) = (val))
  367. //#else
  368. //#define AP_CORE_MODULE_INDEX (AP_DEBUG_ASSERT(core_module.module_index == 0), 0)
  369. //#endif
  370. {**
  371. * @brief Per-request configuration
  372. *}
  373. type
  374. core_request_config = record
  375. {** bucket brigade used by getline for look-ahead and
  376. * ap_get_client_block for holding left-over request body *}
  377. bb: Papr_bucket_brigade;
  378. {** an array of per-request working data elements, accessed
  379. * by ID using ap_get_request_note()
  380. * (Use ap_register_request_note() during initialization
  381. * to add elements)
  382. *}
  383. notes: PPointer;
  384. {** Custom response strings registered via ap_custom_response(),
  385. * or NULL; check per-dir config if nothing found here
  386. *}
  387. response_code_strings: PPChar; {* from ap_custom_response(), not from
  388. * ErrorDocument
  389. *}
  390. {** per-request document root of the server. This allows mass vhosting
  391. * modules better compatibility with some scripts. Normally the
  392. * context_* info should be used instead *}
  393. document_root: PChar;
  394. {*
  395. * more fine-grained context information which is set by modules like
  396. * mod_alias and mod_userdir
  397. *}
  398. {** the context root directory on disk for the current resource,
  399. * without trailing slash
  400. *}
  401. context_document_root: PChar;
  402. {** the URI prefix that corresponds to the context_document_root directory,
  403. * without trailing slash
  404. *}
  405. context_prefix: PChar;
  406. {** There is a script processor installed on the output filter chain,
  407. * so it needs the default_handler to deliver a (script) file into
  408. * the chain so it can process it. Normally, default_handler only
  409. * serves files on a GET request (assuming the file is actual content),
  410. * since other methods are not content-retrieval. This flag overrides
  411. * that behavior, stating that the "content" is actually a script and
  412. * won't actually be delivered as the response for the non-GET method.
  413. *}
  414. deliver_script: Integer;
  415. {** Should addition of charset= be suppressed for this request?
  416. *}
  417. suppress_charset: Integer;
  418. end;
  419. {* Standard entries that are guaranteed to be accessible via
  420. * ap_get_request_note() for each request (additional entries
  421. * can be added with ap_register_request_note())
  422. *}
  423. const
  424. AP_NOTE_DIRECTORY_WALK = 0;
  425. AP_NOTE_LOCATION_WALK = 1;
  426. AP_NOTE_FILE_WALK = 2;
  427. AP_NOTE_IF_WALK = 3;
  428. AP_NUM_STD_NOTES = 4;
  429. {**
  430. * Reserve an element in the core_request_config->notes array
  431. * for some application-specific data
  432. * @return An integer key that can be passed to ap_get_request_note()
  433. * during request processing to access this element for the
  434. * current request.
  435. *}
  436. //AP_DECLARE(apr_size_t) ap_register_request_note(void);
  437. function ap_register_request_note: apr_size_t;
  438. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  439. external LibHTTPD name LibNamePrefix + 'ap_register_request_note' + LibSuff0;
  440. {**
  441. * Retrieve a pointer to an element in the core_request_config->notes array
  442. * @param r The request
  443. * @param note_num A key for the element: either a value obtained from
  444. * ap_register_request_note() or one of the predefined AP_NOTE_*
  445. * values.
  446. * @return NULL if the note_num is invalid, otherwise a pointer to the
  447. * requested note element.
  448. * @remark At the start of a request, each note element is NULL. The
  449. * handle provided by ap_get_request_note() is a pointer-to-pointer
  450. * so that the caller can point the element to some app-specific
  451. * data structure. The caller should guarantee that any such
  452. * structure will last as long as the request itself.
  453. *}
  454. //AP_DECLARE(void **) ap_get_request_note(request_rec *r, apr_size_t note_num);
  455. function ap_get_request_note(r: Prequest_rec; note_num: apr_size_t): PPointer;
  456. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  457. external LibHTTPD name LibNamePrefix + 'ap_get_request_note' + LibSuff8;
  458. type
  459. //typedef unsigned char allow_options_t;
  460. allow_options_t = cuchar;
  461. //typedef unsigned int overrides_t;
  462. overrides_t = cuchar;
  463. {*
  464. * Bits of info that go into making an ETag for a file
  465. * document. Why a long? Because char historically
  466. * proved too short for Options, and int can be different
  467. * sizes on different platforms.
  468. *}
  469. //typedef unsigned long etag_components_t;
  470. etag_components_t = culong;
  471. const
  472. ETAG_UNSET = 0;
  473. ETAG_NONE = (1 shl 0);
  474. ETAG_MTIME = (1 shl 1);
  475. ETAG_INODE = (1 shl 2);
  476. ETAG_SIZE = (1 shl 3);
  477. ETAG_ALL = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
  478. //* This is the default value used */
  479. ETAG_BACKWARD = (ETAG_MTIME or ETAG_SIZE);
  480. //* Hostname resolution etc */
  481. HOSTNAME_LOOKUP_OFF = 0;
  482. HOSTNAME_LOOKUP_ON = 1;
  483. HOSTNAME_LOOKUP_DOUBLE = 2;
  484. HOSTNAME_LOOKUP_UNSET = 3;
  485. USE_CANONICAL_NAME_OFF = 0;
  486. USE_CANONICAL_NAME_ON = 1;
  487. USE_CANONICAL_NAME_DNS = 2;
  488. USE_CANONICAL_NAME_UNSET = 3;
  489. ADD_DEFAULT_CHARSET_OFF = 0;
  490. ADD_DEFAULT_CHARSET_ON = 1;
  491. ADD_DEFAULT_CHARSET_UNSET = 2;
  492. ENABLE_MMAP_OFF = 0;
  493. ENABLE_MMAP_ON = 1;
  494. ENABLE_MMAP_UNSET = 2;
  495. ENABLE_SENDFILE_OFF = 0;
  496. ENABLE_SENDFILE_ON = 1;
  497. ENABLE_SENDFILE_UNSET = 2;
  498. USE_CANONICAL_PHYS_PORT_OFF = 0;
  499. USE_CANONICAL_PHYS_PORT_ON = 1;
  500. USE_CANONICAL_PHYS_PORT_UNSET = 2;
  501. AP_CONDITION_IF = 1;
  502. AP_CONDITION_ELSE = 2;
  503. AP_CONDITION_ELSEIF = (AP_CONDITION_ELSE or AP_CONDITION_IF);
  504. AP_MAXRANGES_UNSET = -1;
  505. AP_MAXRANGES_DEFAULT = -2;
  506. AP_MAXRANGES_UNLIMITED = -3;
  507. AP_MAXRANGES_NORANGES = 0;
  508. {**
  509. * @brief Server Signature Enumeration
  510. *}
  511. type
  512. server_signature_e = (
  513. srv_sig_unset,
  514. srv_sig_off,
  515. srv_sig_on,
  516. srv_sig_withmail
  517. );
  518. {**
  519. * @brief Per-directory configuration
  520. *}
  521. core_dir_config = record
  522. //** path of the directory/regex/etc. see also d_is_fnmatch/absolute below */
  523. d: PChar;
  524. //** the number of slashes in d */
  525. d_components: Cardinal;
  526. {** If (opts & OPT_UNSET) then no absolute assignment to options has
  527. * been made.
  528. * invariant: (opts_add & opts_remove) == 0
  529. * Which said another way means that the last relative (options + or -)
  530. * assignment made to each bit is recorded in exactly one of opts_add
  531. * or opts_remove.
  532. *}
  533. opts: allow_options_t;
  534. opts_add: allow_options_t;
  535. opts_remove: allow_options_t;
  536. override_: overrides_t;
  537. override_opts: allow_options_t;
  538. {* Custom response config. These can contain text or a URL to redirect to.
  539. * if response_code_strings is NULL then there are none in the config,
  540. * if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES.
  541. * This lets us do quick merges in merge_core_dir_configs().
  542. *}
  543. response_code_strings: PPChar;{* from ErrorDocument, not from
  544. * ap_custom_response() *}
  545. //* Hostname resolution etc */ {fpc -> consts are moved up}
  546. //#define HOSTNAME_LOOKUP_OFF 0
  547. //#define HOSTNAME_LOOKUP_ON 1
  548. //#define HOSTNAME_LOOKUP_DOUBLE 2
  549. //#define HOSTNAME_LOOKUP_UNSET 3
  550. flags : cardinal; // takes care of hostname_lookups, content_md5, use_canonical_name d_is_fnmatch and add_default_charset
  551. // unsigned int hostname_lookups : 4;
  552. // unsigned int content_md5 : 2; //* calculate Content-MD5? */
  553. //#define USE_CANONICAL_NAME_OFF (0) {fpc -> consts are moved up}
  554. //#define USE_CANONICAL_NAME_ON (1)
  555. //#define USE_CANONICAL_NAME_DNS (2)
  556. //#define USE_CANONICAL_NAME_UNSET (3)
  557. // unsigned use_canonical_name : 2;
  558. {* since is_fnmatch(conf->d) was being called so frequently in
  559. * directory_walk() and its relatives, this field was created and
  560. * is set to the result of that call.
  561. *}
  562. // unsigned d_is_fnmatch : 1;
  563. {* should we force a charset on any outgoing parameterless content-type?
  564. * if so, which charset?
  565. *}
  566. //#define ADD_DEFAULT_CHARSET_OFF (0) {fpc -> consts are moved up}
  567. //#define ADD_DEFAULT_CHARSET_ON (1)
  568. //#define ADD_DEFAULT_CHARSET_UNSET (2)
  569. // unsigned add_default_charset : 2;
  570. add_default_charset_name: PChar;
  571. //* System Resource Control */
  572. {$ifdef RLIMIT_CPU}
  573. limit_cpu: Prlimit;
  574. {$endif}
  575. {$if defined(RLIMIT_DATA) or defined (RLIMIT_VMEM) or defined(RLIMIT_AS)}
  576. limit_mem: Prlimit;
  577. {$endif}
  578. {$ifdef RLIMIT_NPROC}
  579. limit_nproc: Prlimit;
  580. {$endif}
  581. limit_req_body: apr_off_t; //* limit on bytes in request msg body */
  582. limit_xml_body: cLong; //* limit on bytes in XML request msg body */
  583. //* logging options */
  584. server_signature: server_signature_e;
  585. //* Access control */
  586. sec_file: Papr_array_header_t;
  587. sec_if: Papr_array_header_t;
  588. r: Pap_regex_t;
  589. mime_type, //* forced with ForceType */
  590. handler, //* forced with SetHandler */
  591. output_filters, //* forced with SetOutputFilters */
  592. input_filters: PChar; //* forced with SetInputFilters */
  593. accept_path_info: Integer; //* forced with AcceptPathInfo */
  594. {*
  595. * What attributes/data should be included in ETag generation?
  596. *}
  597. etag_bits: etag_components_t;
  598. etag_add: etag_components_t;
  599. etag_remove: etag_components_t;
  600. {*
  601. * Run-time performance tuning
  602. *}
  603. //#define ENABLE_MMAP_OFF (0) {fpc -> consts are moved up}
  604. //#define ENABLE_MMAP_ON (1)
  605. //#define ENABLE_MMAP_UNSET (2)
  606. flags2 : cardinal; // Takes care of enable_mmap, enable_sendfile, use_canonical_phys_port,
  607. // allow_encoded_slashes, decode_encoded_slashes and condition_ifelse
  608. // unsigned int enable_mmap : 2; //* whether files in this dir can be mmap'ed */
  609. //#define ENABLE_SENDFILE_OFF (0) {fpc -> consts are moved up}
  610. //#define ENABLE_SENDFILE_ON (1)
  611. //#define ENABLE_SENDFILE_UNSET (2)
  612. // unsigned int enable_sendfile : 2; //* files in this dir can be sendfile'ed */
  613. //#define USE_CANONICAL_PHYS_PORT_OFF (0) {fpc -> consts are moved up}
  614. //#define USE_CANONICAL_PHYS_PORT_ON (1)
  615. //#define USE_CANONICAL_PHYS_PORT_UNSET (2)
  616. // unsigned int use_canonical_phys_port : 2;
  617. // unsigned int allow_encoded_slashes : 1; {* URLs may contain %2f w/o being
  618. //* pitched indiscriminately *}
  619. // unsigned int decode_encoded_slashes : 1; //* whether to decode encoded slashes in URLs */
  620. //#define AP_CONDITION_IF 1 {fpc -> consts are moved up}
  621. //#define AP_CONDITION_ELSE 2
  622. //#define AP_CONDITION_ELSEIF (AP_CONDITION_ELSE|AP_CONDITION_IF)
  623. // unsigned int condition_ifelse : 2; //* is this an <If>, <ElseIf>, or <Else> */
  624. condition: Pap_expr_info_t; //* Conditionally merge <If> sections */
  625. //** per-dir log config */
  626. log: Pap_logconf;
  627. //** Table of directives allowed per AllowOverrideList */
  628. override_list: Papr_table_t;
  629. //#define AP_MAXRANGES_UNSET -1 {fpc -> consts are moved up}
  630. //#define AP_MAXRANGES_DEFAULT -2
  631. //#define AP_MAXRANGES_UNLIMITED -3
  632. //#define AP_MAXRANGES_NORANGES 0
  633. //** Number of Ranges before returning HTTP_OK. **/
  634. max_ranges: Integer;
  635. //** Max number of Range overlaps (merges) allowed **/
  636. max_overlaps: Integer;
  637. //** Max number of Range reversals (eg: 200-300, 100-125) allowed **/
  638. max_reversals: Integer;
  639. end; {core_dir_config}
  640. //* macro to implement off by default behaviour */
  641. //#define AP_SENDFILE_ENABLED(x) \
  642. // ((x) == ENABLE_SENDFILE_ON ? APR_SENDFILE_ENABLED : 0)
  643. //* Per-server core configuration */
  644. const
  645. //* TRACE control */
  646. AP_TRACE_UNSET = -1;
  647. AP_TRACE_DISABLE = 0;
  648. AP_TRACE_ENABLE = 1;
  649. AP_TRACE_EXTENDED = 2;
  650. type
  651. core_server_config = record
  652. gprof_dir: PChar;
  653. {* Name translations --- we want the core to be able to do *something*
  654. * so it's at least a minimally functional web server on its own (and
  655. * can be tested that way). But let's keep it to the bare minimum:
  656. *}
  657. ap_document_root: PChar;
  658. //* Access control */
  659. access_name: PChar;
  660. sec_dir: Papr_array_header_t;
  661. sec_url: Papr_array_header_t;
  662. //* recursion backstopper */
  663. redirect_limit, //* maximum number of internal redirects */
  664. subreq_limit: Integer; //* maximum nesting level of subrequests */
  665. protocol: PChar;
  666. accf_map: Papr_table_t;
  667. //* array of ap_errorlog_format_item for error log format string */
  668. error_log_format: Papr_array_header_t;
  669. {*
  670. * two arrays of arrays of ap_errorlog_format_item for additional information
  671. * logged to the error log once per connection/request
  672. *}
  673. error_log_conn,
  674. error_log_req: Papr_array_header_t;
  675. //* TRACE control */
  676. //#define AP_TRACE_UNSET -1 {fpc -> consts are moved up}
  677. //#define AP_TRACE_DISABLE 0
  678. //#define AP_TRACE_ENABLE 1
  679. //#define AP_TRACE_EXTENDED 2
  680. trace_enable: Integer;
  681. end; {core_server_config}
  682. //* for AddOutputFiltersByType in core.c */
  683. //void ap_add_output_filters_by_type(request_rec *r);
  684. //* for http_config.c */
  685. //void ap_core_reorder_directories(apr_pool_t *, server_rec *);
  686. //* for mod_perl */
  687. //AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config);
  688. //AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config);
  689. //AP_CORE_DECLARE(void) ap_add_file_conf(apr_pool_t *p, core_dir_config *conf, void *url_config);
  690. //AP_CORE_DECLARE(const char *) ap_add_if_conf(apr_pool_t *p, core_dir_config *conf, void *url_config);
  691. //AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg);
  692. //* Core filters; not exported. */
  693. //apr_status_t ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
  694. // ap_input_mode_t mode, apr_read_type_e block,
  695. // apr_off_t readbytes);
  696. //apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *b);
  697. //AP_DECLARE(const char*) ap_get_server_protocol(server_rec* s);
  698. //AP_DECLARE(void) ap_set_server_protocol(server_rec* s, const char* proto);
  699. //typedef struct core_output_filter_ctx core_output_filter_ctx_t;
  700. type
  701. Pcore_output_filter_ctx_t = ^core_output_filter_ctx_t;
  702. core_output_filter_ctx_t = record end;
  703. //typedef struct core_filter_ctx core_ctx_t;
  704. Pcore_filter_ctx_t = ^core_filter_ctx_t;
  705. core_filter_ctx_t = record end;
  706. core_ctx_t = core_filter_ctx_t;
  707. Pcore_ctx_t = ^core_ctx_t;
  708. core_net_rec = record
  709. //** Connection to the client */
  710. client_socket: Papr_socket_t;
  711. //** connection record */
  712. c: Pconn_rec;
  713. out_ctx: Pcore_output_filter_ctx_t;
  714. in_ctx: Pcore_ctx_t;
  715. end; {core_net_rec}
  716. {**
  717. * Insert the network bucket into the core input filter's input brigade.
  718. * This hook is intended for MPMs or protocol modules that need to do special
  719. * socket setup.
  720. * @param c The connection
  721. * @param bb The brigade to insert the bucket into
  722. * @param socket The socket to put into a bucket
  723. * @return AP_DECLINED if the current function does not handle this connection,
  724. * APR_SUCCESS or an error otherwise.
  725. *}
  726. //AP_DECLARE_HOOK(apr_status_t, insert_network_bucket,
  727. // (conn_rec *c, apr_bucket_brigade *bb, apr_socket_t *socket))
  728. type
  729. ap_HOOK_insert_network_bucket_t = function(c: Pconn_rec; bb: Papr_bucket_brigade; socket: Papr_socket_t): apr_status_t; cdecl;
  730. procedure ap_hook_insert_network_bucket(pf: ap_HOOK_insert_network_bucket_t;
  731. const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
  732. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  733. external LibHTTPD name LibNamePrefix + 'ap_hook_insert_network_bucket' + LibSuff16;
  734. {* ----------------------------------------------------------------------
  735. *
  736. * Runtime status/management
  737. *}
  738. type
  739. ap_mgmt_type_e = (
  740. ap_mgmt_type_string,
  741. ap_mgmt_type_long,
  742. ap_mgmt_type_hash
  743. );
  744. ap_mgmt_value = record
  745. case Integer of
  746. 0: (s_value: PChar);
  747. 1: (i_value: cLong);
  748. 2: (h_value: Papr_hash_t);
  749. end;
  750. ap_mgmt_item_t = record
  751. description: PChar;
  752. name: PChar;
  753. vtype: ap_mgmt_type_e;
  754. v: ap_mgmt_value;
  755. end;
  756. ///* Handles for core filters */
  757. //extern AP_DECLARE_DATA ap_filter_rec_t *ap_subreq_core_filter_handle;
  758. //extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_output_filter_handle;
  759. //extern AP_DECLARE_DATA ap_filter_rec_t *ap_content_length_filter_handle;
  760. //extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_input_filter_handle;
  761. {**
  762. * This hook provdes a way for modules to provide metrics/statistics about
  763. * their operational status.
  764. *
  765. * @param p A pool to use to create entries in the hash table
  766. * @param val The name of the parameter(s) that is wanted. This is
  767. * tree-structured would be in the form ('*' is all the tree,
  768. * 'module.*' all of the module , 'module.foo.*', or
  769. * 'module.foo.bar' )
  770. * @param ht The hash table to store the results. Keys are item names, and
  771. * the values point to ap_mgmt_item_t structures.
  772. * @ingroup hooks
  773. *}
  774. //AP_DECLARE_HOOK(int, get_mgmt_items,
  775. // (apr_pool_t *p, const char * val, apr_hash_t *ht))
  776. type
  777. ap_HOOK_get_mgmt_items_t = function(p: Papr_pool_t; const val: PChar; ht: Papr_hash_t): Integer; cdecl;
  778. procedure ap_hook_get_mgmt_items(pf: ap_HOOK_get_mgmt_items_t;
  779. const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
  780. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  781. external LibHTTPD name LibNamePrefix + 'ap_hook_get_mgmt_items' + LibSuff16;
  782. //* ---------------------------------------------------------------------- */
  783. {* ----------------------------------------------------------------------
  784. *
  785. * I/O logging with mod_logio
  786. *}
  787. //APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out,
  788. // (conn_rec *c, apr_off_t bytes));
  789. //APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_in,
  790. // (conn_rec *c, apr_off_t bytes));
  791. //APR_DECLARE_OPTIONAL_FN(apr_off_t, ap_logio_get_last_bytes, (conn_rec *c));
  792. {* ----------------------------------------------------------------------
  793. *
  794. * Error log formats
  795. *}
  796. {**
  797. * The info structure passed to callback functions of errorlog handlers.
  798. * Not all information is available in all contexts. In particular, all
  799. * pointers may be NULL.
  800. *}
  801. type
  802. Pap_errorlog_info = ^ap_errorlog_info;
  803. ap_errorlog_info = record
  804. {** current server_rec.
  805. * Should be preferred over c->base_server and r->server
  806. *}
  807. s: Pserver_rec;
  808. {** current conn_rec.
  809. * Should be preferred over r->connecction
  810. *}
  811. c: Pconn_rec;
  812. //** current request_rec. */
  813. r :Prequest_rec;
  814. //** r->main if r is a subrequest, otherwise equal to r */
  815. rmain :Prequest_rec;
  816. //** pool passed to ap_log_perror, NULL otherwise */
  817. pool: Papr_pool_t;
  818. //** name of source file where the log message was produced, NULL if N/A. */
  819. file_: PChar;
  820. //** line number in the source file, 0 if N/A */
  821. line: Integer;
  822. //** module index of module that produced the log message, APLOG_NO_MODULE if N/A. */
  823. module_index: Integer;
  824. //** log level of error message (flags like APLOG_STARTUP have been removed), -1 if N/A */
  825. level: Integer;
  826. //** apr error status related to the log message, 0 if no error */
  827. status: apr_status_t;
  828. //** 1 if logging to syslog, 0 otherwise */
  829. using_syslog: Integer;
  830. //** 1 if APLOG_STARTUP was set for the log message, 0 otherwise */
  831. startup: Integer;
  832. //** message format */
  833. format: PChar;
  834. end; {ap_errorlog_info}
  835. {**
  836. * callback function prototype for a external errorlog handler
  837. * @note To avoid unbounded memory usage, these functions must not allocate
  838. * memory from the server, connection, or request pools. If an errorlog
  839. * handler absolutely needs a pool to pass to other functions, it must create
  840. * and destroy a sub-pool.
  841. *}
  842. //typedef int ap_errorlog_handler_fn_t(const ap_errorlog_info *info,
  843. // const char *arg, char *buf, int buflen);
  844. type
  845. ap_errorlog_handler_fn_t = function(const info: Pap_errorlog_info;
  846. const arg: PChar; buf: PChar; buflen: Integer):Integer; cdecl;
  847. {**
  848. * Register external errorlog handler
  849. * @param p config pool to use
  850. * @param tag the new format specifier (i.e. the letter after the %)
  851. * @param handler the handler function
  852. * @param flags flags (reserved, set to 0)
  853. *}
  854. //AP_DECLARE(void) ap_register_errorlog_handler(apr_pool_t *p, char *tag,
  855. // ap_errorlog_handler_fn_t *handler,
  856. // int flags);
  857. procedure ap_register_errorlog_handler(p: Papr_pool_t; tag: PChar;
  858. handler: ap_errorlog_handler_fn_t;
  859. flags: Integer);
  860. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  861. external LibHTTPD name LibNamePrefix + 'ap_register_errorlog_handler' + LibSuff16;
  862. type
  863. ap_errorlog_handler = record
  864. func: ap_errorlog_handler_fn_t;
  865. flags: Integer; //* for future extensions */
  866. end; {ap_errorlog_handler}
  867. const
  868. //** item starts a new field */
  869. AP_ERRORLOG_FLAG_FIELD_SEP = 1;
  870. //** item is the actual error message */
  871. AP_ERRORLOG_FLAG_MESSAGE = 2;
  872. //** skip whole line if item is zero-length */
  873. AP_ERRORLOG_FLAG_REQUIRED = 4;
  874. //** log zero-length item as '-' */
  875. AP_ERRORLOG_FLAG_NULL_AS_HYPHEN = 8;
  876. type
  877. ap_errorlog_format_item = record
  878. //** ap_errorlog_handler function */
  879. func: ap_errorlog_handler_fn_t;
  880. //** argument passed to item in {} */
  881. arg: PChar;
  882. //** a combination of the AP_ERRORLOG_* flags */
  883. flags: cuint;
  884. //** only log item if the message's log level is higher than this */
  885. min_loglevel: cuint;
  886. end; {ap_errorlog_format_item}
  887. {**
  888. * hook method to log error messages
  889. * @ingroup hooks
  890. * @param info pointer to ap_errorlog_info struct which contains all
  891. * the details
  892. * @param errstr the (unformatted) message to log
  893. * @warning Allocating from the usual pools (pool, info->c->pool, info->p->pool)
  894. * must be avoided because it can cause memory leaks.
  895. * Use a subpool if necessary.
  896. *}
  897. //AP_DECLARE_HOOK(void, error_log, (const ap_errorlog_info *info,
  898. // const char *errstr))
  899. //AP_CORE_DECLARE(void) ap_register_log_hooks(apr_pool_t *p);
  900. //AP_CORE_DECLARE(void) ap_register_config_hooks(apr_pool_t *p);
  901. {* ----------------------------------------------------------------------
  902. *
  903. * ident lookups with mod_ident
  904. *}
  905. //APR_DECLARE_OPTIONAL_FN(const char *, ap_ident_lookup,
  906. // (request_rec *r));
  907. {* ----------------------------------------------------------------------
  908. *
  909. * authorization values with mod_authz_core
  910. *}
  911. //APR_DECLARE_OPTIONAL_FN(int, authz_some_auth_required, (request_rec *r));
  912. //APR_DECLARE_OPTIONAL_FN(const char *, authn_ap_auth_type, (request_rec *r));
  913. //APR_DECLARE_OPTIONAL_FN(const char *, authn_ap_auth_name, (request_rec *r));
  914. {* ----------------------------------------------------------------------
  915. *
  916. * authorization values with mod_access_compat
  917. *}
  918. //APR_DECLARE_OPTIONAL_FN(int, access_compat_ap_satisfies, (request_rec *r));
  919. //* ---------------------------------------------------------------------- */
  920. {** Query the server for some state information
  921. * @param query_code Which information is requested
  922. * @return the requested state information
  923. *}
  924. //AP_DECLARE(int) ap_state_query(int query_code);
  925. function ap_state_query(query_code: Integer): Integer;
  926. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  927. external LibHTTPD name LibNamePrefix + 'ap_state_query' + LibSuff4;
  928. {*
  929. * possible values for query_code in ap_state_query()
  930. *}
  931. const
  932. //** current status of the server */
  933. AP_SQ_MAIN_STATE = 0;
  934. //** are we going to serve requests or are we just testing/dumping config */
  935. AP_SQ_RUN_MODE = 1;
  936. //** generation of the top-level apache parent */
  937. AP_SQ_CONFIG_GEN = 2;
  938. {*
  939. * return values for ap_state_query()
  940. *}
  941. //** return value for unknown query_code */
  942. AP_SQ_NOT_SUPPORTED = -1;
  943. //* values returned for AP_SQ_MAIN_STATE */
  944. //** before the config preflight */
  945. AP_SQ_MS_INITIAL_STARTUP = 1;
  946. //** initial configuration run for setting up log config, etc. */
  947. AP_SQ_MS_CREATE_PRE_CONFIG = 2;
  948. //** tearing down configuration */
  949. AP_SQ_MS_DESTROY_CONFIG = 3;
  950. //** normal configuration run */
  951. AP_SQ_MS_CREATE_CONFIG = 4;
  952. //** running the MPM */
  953. AP_SQ_MS_RUN_MPM = 5;
  954. //** cleaning up for exit */
  955. AP_SQ_MS_EXITING = 6;
  956. //* values returned for AP_SQ_RUN_MODE */
  957. //** command line not yet parsed */
  958. AP_SQ_RM_UNKNOWN = 1;
  959. //** normal operation (server requests or signal server) */
  960. AP_SQ_RM_NORMAL = 2;
  961. //** config test only */
  962. AP_SQ_RM_CONFIG_TEST = 3;
  963. //** only dump some parts of the config */
  964. AP_SQ_RM_CONFIG_DUMP = 4;
  965. //#endif /* !APACHE_HTTP_CORE_H */
  966. (** @} *)