http_config.inc 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194
  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. Declarations from other files centered here
  18. }
  19. const
  20. (* Hook orderings *)
  21. (** run this hook first, before ANYTHING *)
  22. APR_HOOK_REALLY_FIRST = -10;
  23. (** run this hook first *)
  24. APR_HOOK_FIRST = 0;
  25. (** run this hook somewhere *)
  26. APR_HOOK_MIDDLE = 10;
  27. (** run this hook after every other hook which is defined*)
  28. APR_HOOK_LAST = 20;
  29. (** run this hook last, after EVERYTHING *)
  30. APR_HOOK_REALLY_LAST = 30;
  31. {
  32. * @file http_config.h
  33. * @brief Apache Configuration
  34. *
  35. * @defgroup APACHE_CORE_CONFIG Configuration
  36. * @ingroup APACHE_CORE
  37. }
  38. //#include "apr_hooks.h"
  39. {.$include util_cfgtree.inc}
  40. {
  41. * @defgroup ConfigDirectives Allowed locations for configuration directives.
  42. *
  43. * The allowed locations for a configuration directive are the union of
  44. * those indicated by each set bit in the req_override mask.
  45. }
  46. const
  47. OR_NONE = 0; {< *.conf is not available anywhere in this override }
  48. OR_LIMIT = 1; {< *.conf inside <Directory> or <Location>
  49. and .htaccess when AllowOverride Limit }
  50. OR_OPTIONS = 2; {< *.conf anywhere
  51. and .htaccess when AllowOverride Options }
  52. OR_FILEINFO = 4; {< *.conf anywhere
  53. and .htaccess when AllowOverride FileInfo }
  54. OR_AUTHCFG = 8; {< *.conf inside <Directory> or <Location>
  55. and .htaccess when AllowOverride AuthConfig }
  56. OR_INDEXES = 16; {< *.conf anywhere
  57. and .htaccess when AllowOverride Indexes }
  58. OR_UNSET = 32; {< unset a directive (in Allow) }
  59. ACCESS_CONF = 64; {< *.conf inside <Directory> or <Location> }
  60. RSRC_CONF = 128; {< *.conf outside <Directory> or <Location> }
  61. EXEC_ON_READ = 256; {< force directive to execute a command
  62. which would modify the configuration (like including another
  63. file, or IFModule }
  64. { this directive can be placed anywhere }
  65. OR_ALL = (OR_LIMIT or OR_OPTIONS or OR_FILEINFO or OR_AUTHCFG or OR_INDEXES);
  66. {
  67. * This can be returned by a function if they don't wish to handle
  68. * a command. Make it something not likely someone will actually use
  69. * as an error code.
  70. }
  71. const
  72. DECLINE_CMD = '\a\b';
  73. {
  74. * The central data structures around here...
  75. }
  76. { Command dispatch structures... }
  77. {
  78. * How the directives arguments should be parsed.
  79. * @remark Note that for all of these except RAW_ARGS, the config routine is
  80. * passed a freshly allocated string which can be modified or stored
  81. * or whatever...
  82. }
  83. type
  84. cmd_how = (
  85. RAW_ARGS, {< cmd_func parses command line itself }
  86. TAKE1, {< one argument only }
  87. TAKE2, {< two arguments only }
  88. ITERATE, {< one argument, occuring multiple times
  89. * (e.g., IndexIgnore)
  90. }
  91. ITERATE2, {< two arguments, 2nd occurs multiple times
  92. * (e.g., AddIcon)
  93. }
  94. FLAG, {< One of 'On' or 'Off' }
  95. NO_ARGS, {< No args at all, e.g. </Directory> }
  96. TAKE12, {< one or two arguments }
  97. TAKE3, {< three arguments only }
  98. TAKE23, {< two or three arguments }
  99. TAKE123, {< one, two or three arguments }
  100. TAKE13, {< one or three arguments }
  101. TAKE_ARGV {< an argc and argv are passed }
  102. );
  103. {
  104. * This structure is passed to a command which is being invoked,
  105. * to carry a large variety of miscellaneous data which is all of
  106. * use to *somebody*...
  107. }
  108. Pcmd_parms = ^cmd_parms_struct;
  109. //#if defined(AP_HAVE_DESIGNATED_INITIALIZER) || defined(DOXYGEN)
  110. {
  111. * All the types of functions that can be used in directives
  112. * @internal
  113. }
  114. cmd_func = function(cmd: Pcmd_parms; mconfig: Pointer): PChar; cdecl;
  115. Pcmd_func = ^cmd_func;
  116. { function to call for a no-args }
  117. no_args_t = function (parms: Pcmd_parms; mconfig: Pointer): PChar;
  118. { function to call for a raw-args }
  119. raw_args_t = function (parms: Pcmd_parms; mconfig: Pointer; const args: PChar): PChar;
  120. { function to call for a argv/argc }
  121. take_argv_t = function (parms: Pcmd_parms; mconfig: Pointer; argc: cint; argv: array of PChar): PChar;
  122. { function to call for a take1 }
  123. take1_t = function (parms: Pcmd_parms; mconfig: Pointer; const w: PChar): PChar;
  124. { function to call for a take2 }
  125. take2_t = function (parms: Pcmd_parms; mconfig: Pointer; const w, w2: PChar): PChar;
  126. { function to call for a take3 }
  127. take3_t = function (parms: Pcmd_parms; mconfig: Pointer; const w, w2, w3: PChar): PChar;
  128. { function to call for a flag }
  129. flag_t = function (parms: Pcmd_parms; mconfig: Pointer; on_: Integer): PChar;
  130. //const
  131. { This configuration directive does not take any arguments }
  132. // AP_NO_ARGS = func.no_args;
  133. { This configuration directive will handle it's own parsing of arguments}
  134. // AP_RAW_ARGS = func.raw_args;
  135. { This configuration directive will handle it's own parsing of arguments}
  136. //# define AP_TAKE_ARGV func.take_argv
  137. { This configuration directive takes 1 argument}
  138. // AP_TAKE1 = func.take1;
  139. { This configuration directive takes 2 arguments }
  140. // AP_TAKE2 = func.take2;
  141. { This configuration directive takes 3 arguments }
  142. // AP_TAKE3 = func.take3;
  143. { This configuration directive takes a flag (on/off) as a argument}
  144. // AP_FLAG = func.flag;
  145. { method of declaring a directive with no arguments }
  146. //# define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
  147. // directive, { .no_args=func }, mconfig, where, RAW_ARGS, help }
  148. { method of declaring a directive with raw argument parsing }
  149. //# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
  150. // directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help }
  151. { method of declaring a directive with raw argument parsing }
  152. //# define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
  153. // { directive, { .take_argv=func }, mconfig, where, TAKE_ARGV, help }
  154. { method of declaring a directive which takes 1 argument }
  155. //# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
  156. // directive, { .take1=func }, mconfig, where, TAKE1, help }
  157. { method of declaring a directive which takes multiple arguments }
  158. //# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
  159. // directive, { .take1=func }, mconfig, where, ITERATE, help }
  160. { method of declaring a directive which takes 2 arguments }
  161. //# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
  162. // directive, { .take2=func }, mconfig, where, TAKE2, help }
  163. { method of declaring a directive which takes 1 or 2 arguments }
  164. //# define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
  165. // directive, { .take2=func }, mconfig, where, TAKE12, help }
  166. { method of declaring a directive which takes multiple 2 arguments }
  167. //# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
  168. // directive, { .take2=func }, mconfig, where, ITERATE2, help }
  169. { method of declaring a directive which takes 1 or 3 arguments }
  170. //# define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
  171. // directive, { .take3=func }, mconfig, where, TAKE13, help }
  172. { method of declaring a directive which takes 2 or 3 arguments }
  173. //# define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
  174. // directive, { .take3=func }, mconfig, where, TAKE23, help }
  175. { method of declaring a directive which takes 1 to 3 arguments }
  176. //# define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
  177. // directive, { .take3=func }, mconfig, where, TAKE123, help }
  178. { method of declaring a directive which takes 3 arguments }
  179. //# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
  180. // directive, { .take3=func }, mconfig, where, TAKE3, help }
  181. { method of declaring a directive which takes a flag (on/off) as a argument}
  182. //# define AP_INIT_FLAG(directive, func, mconfig, where, help) \
  183. // directive, { .flag=func }, mconfig, where, FLAG, help }
  184. //#else { AP_HAVE_DESIGNATED_INITIALIZER }
  185. //typedef const char *( *cmd_func) ();
  186. //# define AP_NO_ARGS func
  187. //# define AP_RAW_ARGS func
  188. //# define AP_TAKE_ARGV func
  189. //# define AP_TAKE1 func
  190. //# define AP_TAKE2 func
  191. //# define AP_TAKE3 func
  192. //# define AP_FLAG func
  193. //# define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
  194. { directive, func, mconfig, where, RAW_ARGS, help }
  195. //# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
  196. { directive, func, mconfig, where, RAW_ARGS, help }
  197. //# define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
  198. { directive, func, mconfig, where, TAKE_ARGV, help }
  199. //# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
  200. { directive, func, mconfig, where, TAKE1, help }
  201. //# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
  202. { directive, func, mconfig, where, ITERATE, help }
  203. //# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
  204. { directive, func, mconfig, where, TAKE2, help }
  205. //# define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
  206. { directive, func, mconfig, where, TAKE12, help }
  207. //# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
  208. { directive, func, mconfig, where, ITERATE2, help }
  209. //# define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
  210. { directive, func, mconfig, where, TAKE13, help }
  211. //# define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
  212. { directive, func, mconfig, where, TAKE23, help }
  213. //# define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
  214. { directive, func, mconfig, where, TAKE123, help }
  215. //# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
  216. { directive, func, mconfig, where, TAKE3, help }
  217. //# define AP_INIT_FLAG(directive, func, mconfig, where, help) \
  218. { directive, func, mconfig, where, FLAG, help }
  219. //#endif { AP_HAVE_DESIGNATED_INITIALIZER }
  220. {
  221. * The command record structure. Each modules can define a table of these
  222. * to define the directives it will implement.
  223. }
  224. command_struct = record
  225. { Name of this command }
  226. name: PChar;
  227. { The function to be called when this directive is parsed }
  228. func: cmd_func;
  229. { Extra data, for functions which implement multiple commands... }
  230. cmd_data: Pointer;
  231. { What overrides need to be allowed to enable this command. }
  232. req_override: Integer;
  233. { What the command expects as arguments
  234. * @defvar cmd_how args_how}
  235. args_how: cmd_how;
  236. { 'usage' message, in case of syntax errors }
  237. errmsg: PChar;
  238. end;
  239. command_rec = command_struct;
  240. Pcommand_rec = ^command_rec;
  241. { Constants here were moved up }
  242. { Common structure for reading of config files / passwd files etc. }
  243. getch_t = function (param: Pointer): Integer;
  244. getstr_t = function (buf: Pointer; bufsiz: size_t; param: Pointer): Pointer;
  245. close_t = function (param: Pointer): Integer;
  246. ap_configfile_t = record
  247. getch: getch_t; {< a getc()-like function }
  248. getstr: getstr_t; {< a fgets()-like function }
  249. close: close_t; {< a close handler function }
  250. param: Pointer; {< the argument passed to getch/getstr/close }
  251. name: PChar; {< the filename / description }
  252. line_number: cuint;{< current line number, starting at 1 }
  253. end;
  254. Pap_configfile_t = ^ap_configfile_t;
  255. PPap_configfile_t = ^Pap_configfile_t;
  256. {
  257. * This structure is passed to a command which is being invoked,
  258. * to carry a large variety of miscellaneous data which is all of
  259. * use to *somebody*...
  260. }
  261. cmd_parms_struct = record
  262. { Argument to command from cmd_table }
  263. info: Pointer;
  264. { Which allow-override bits are set }
  265. override_: Integer;
  266. { Which methods are <Limit>ed }
  267. limited: apr_int64_t;
  268. { methods which are limited }
  269. limited_xmethods: Papr_array_header_t;
  270. { methods which are xlimited }
  271. xlimited: Pap_method_list_t;
  272. { Config file structure. }
  273. config_file: Pap_configfile_t;
  274. { the directive specifying this command }
  275. directive: Pap_directive_t;
  276. { Pool to allocate new storage in }
  277. pool: Papr_pool_t;
  278. { Pool for scratch memory; persists during configuration, but
  279. * wiped before the first request is served... }
  280. temp_pool: Papr_pool_t;
  281. { Server_rec being configured for }
  282. server: Pserver_rec;
  283. { If configuring for a directory, pathname of that directory.
  284. * NOPE! That's what it meant previous to the existance of <Files>,
  285. * <Location> and regex matching. Now the only usefulness that can be
  286. * derived from this field is whether a command is being called in a
  287. * server context (path == NULL) or being called in a dir context
  288. * (path != NULL). }
  289. path: PChar;
  290. { configuration command }
  291. cmd: Pcommand_rec;
  292. { per_dir_config vector passed to handle_command }
  293. context: Pap_conf_vector_t;
  294. { directive with syntax error }
  295. err_directive: Pap_directive_t;
  296. { Which allow-override-opts bits are set }
  297. override_opts: cint;
  298. end;
  299. cmd_parms = cmd_parms_struct;
  300. {
  301. * Module structures. Just about everything is dispatched through
  302. * these, directly or indirectly (through the command and handler
  303. * tables).
  304. }
  305. type
  306. Pmodule_struct = ^module_struct;
  307. module_struct = record
  308. { API version, *not* module version; check that module is
  309. * compatible with this version of the server.
  310. }
  311. version: Integer;
  312. { API minor version. Provides API feature milestones. Not checked
  313. * during module init }
  314. minor_version: Integer;
  315. { Index to this modules structures in config vectors. }
  316. module_index: Integer;
  317. { The name of the module's C file }
  318. name: PChar;
  319. { The handle for the DSO. Internal use only }
  320. dynamic_load_handle: Pointer;
  321. { A pointer to the next module in the list
  322. * @defvar module_struct *next }
  323. next: Pmodule_struct;
  324. { Magic Cookie to identify a module structure; It's mainly
  325. * important for the DSO facility (see also mod_so). }
  326. magic: Cardinal;
  327. { Function to allow MPMs to re-write command line arguments. This
  328. * hook is only available to MPMs.
  329. * @param The process that the server is running in.
  330. }
  331. rewrite_args: procedure(process: Pprocess_rec); cdecl;
  332. { Function to allow all modules to create per directory configuration
  333. * structures.
  334. * @param p The pool to use for all allocations.
  335. * @param dir The directory currently being processed.
  336. * @return The per-directory structure created
  337. }
  338. create_dir_config: function(p: Papr_pool_t; dir: PChar): Pointer; cdecl;
  339. { Function to allow all modules to merge the per directory configuration
  340. * structures for two directories.
  341. * @param p The pool to use for all allocations.
  342. * @param base_conf The directory structure created for the parent directory.
  343. * @param new_conf The directory structure currently being processed.
  344. * @return The new per-directory structure created
  345. }
  346. merge_dir_config: function(p: Papr_pool_t; base_conf: Pointer;
  347. new_conf: Pointer): Pointer; cdecl;
  348. { Function to allow all modules to create per server configuration
  349. * structures.
  350. * @param p The pool to use for all allocations.
  351. * @param s The server currently being processed.
  352. * @return The per-server structure created
  353. }
  354. create_server_config: function(p: Papr_pool_t; s: Pserver_rec): Pointer; cdecl;
  355. { Function to allow all modules to merge the per server configuration
  356. * structures for two servers.
  357. * @param p The pool to use for all allocations.
  358. * @param base_conf The directory structure created for the parent directory.
  359. * @param new_conf The directory structure currently being processed.
  360. * @return The new per-directory structure created
  361. }
  362. merge_server_config: function(p: Papr_pool_t; base_conf: Pointer;
  363. new_conf: Pointer): Pointer; cdecl;
  364. { A command_rec table that describes all of the directives this module
  365. * defines. }
  366. cmds: Pcommand_rec;
  367. { A hook to allow modules to hook other points in the request processing.
  368. * In this function, modules should call the ap_hook_*() functions to
  369. * register an interest in a specific step in processing the current
  370. * request.
  371. * @param p the pool to use for all allocations
  372. }
  373. register_hooks: procedure(p: Papr_pool_t); cdecl;
  374. end;
  375. module = module_struct;
  376. Pmodule = ^module;
  377. PPmodule = ^Pmodule;
  378. {
  379. * @defgroup ModuleInit Module structure initializers
  380. *
  381. * Initializer for the first few module slots, which are only
  382. * really set up once we start running. Note that the first two slots
  383. * provide a version check; this should allow us to deal with changes to
  384. * the API. The major number should reflect changes to the API handler table
  385. * itself or removal of functionality. The minor number should reflect
  386. * additions of functionality to the existing API. (the server can detect
  387. * an old-format module, and either handle it back-compatibly, or at least
  388. * signal an error). See src/include/ap_mmn.h for MMN version history.
  389. }
  390. { The one used in Apache 1.3, which will deliberately cause an error }
  391. //#define STANDARD_MODULE_STUFF this_module_needs_to_be_ported_to_apache_2_0
  392. { Use this in all standard modules }
  393. procedure STANDARD20_MODULE_STUFF(var mod_: module);
  394. { Use this only in MPMs }
  395. procedure MPM20_MODULE_STUFF(var mod_: module);
  396. { CONFIGURATION VECTOR FUNCTIONS }
  397. { configuration vector structure - Moved to httpd.pas}
  398. {
  399. ap_get_module_config, ap_set_module_config are both commented out because even thought
  400. they are on the headers, they are not present on the libhttpd.dll library.
  401. }
  402. {
  403. * Generic accessors for other modules to get at their own module-specific
  404. * data
  405. * @param conf_vector The vector in which the modules configuration is stored.
  406. * usually r->per_dir_config or s->module_config
  407. * @param m The module to get the data for.
  408. * @return The module-specific data
  409. }
  410. {
  411. Function not found on the dll
  412. }
  413. //function ap_get_module_config(const cv: Pap_conf_vector_t; const m: Pmodule): Pointer;
  414. // {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  415. // external LibHTTPD name LibNamePrefix + 'ap_get_module_config' + LibSuff8;
  416. {
  417. * Generic accessors for other modules to set at their own module-specific
  418. * data
  419. * @param conf_vector The vector in which the modules configuration is stored.
  420. * usually r->per_dir_config or s->module_config
  421. * @param m The module to set the data for.
  422. * @param val The module-specific data to set
  423. }
  424. //procedure ap_set_module_config(const cv: Pap_conf_vector_t; const m: Pmodule;
  425. // val: Pointer);
  426. // {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  427. // external LibHTTPD name LibNamePrefix + 'ap_set_module_config' + LibSuff12;
  428. {$ifndef AP_DEBUG}
  429. function ap_get_module_config(v: Pap_conf_vector_t; m: Pmodule): Pap_conf_vector_t;
  430. procedure ap_set_module_config(v: Pap_conf_vector_t; m: Pmodule; val: Pap_conf_vector_t);
  431. {$endif} { AP_DEBUG }
  432. {
  433. * Generic command handling function for strings
  434. * @param cmd The command parameters for this directive
  435. * @param struct_ptr pointer into a given type
  436. * @param arg The argument to the directive
  437. * @return An error string or NULL on success
  438. }
  439. function ap_set_string_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
  440. cdecl; external LibHTTPD name 'ap_set_string_slot';
  441. {
  442. * Generic command handling function for integers
  443. * @param cmd The command parameters for this directive
  444. * @param struct_ptr pointer into a given type
  445. * @param arg The argument to the directive
  446. * @return An error string or NULL on success
  447. }
  448. function ap_set_int_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
  449. cdecl; external LibHTTPD name 'ap_set_int_slot';
  450. {
  451. * Return true if the specified method is limited by being listed in
  452. * a <Limit> container, or by *not* being listed in a <LimiteExcept>
  453. * container.
  454. *
  455. * @param method Pointer to a string specifying the method to check.
  456. * @param cmd Pointer to the cmd_parms structure passed to the
  457. * directive handler.
  458. * @return 0 if the method is not limited in the current scope
  459. }
  460. function ap_method_is_limited(cmd: Pcmd_parms; const method: PChar): Integer;
  461. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  462. external LibHTTPD name LibNamePrefix + 'ap_method_is_limited' + LibSuff8;
  463. {
  464. * Generic command handling function for strings, always sets the value
  465. * to a lowercase string
  466. * @param cmd The command parameters for this directive
  467. * @param struct_ptr pointer into a given type
  468. * @param arg The argument to the directive
  469. * @return An error string or NULL on success
  470. }
  471. function ap_set_string_slot_lower(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
  472. cdecl; external LibHTTPD name 'ap_set_string_slot_lower';
  473. {
  474. * Generic command handling function for flags
  475. * @param cmd The command parameters for this directive
  476. * @param struct_ptr pointer into a given type
  477. * @param arg The argument to the directive (either 1 or 0)
  478. * @return An error string or NULL on success
  479. }
  480. function ap_set_flag_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
  481. cdecl; external LibHTTPD name 'ap_set_flag_slot';
  482. {
  483. * Generic command handling function for files
  484. * @param cmd The command parameters for this directive
  485. * @param struct_ptr pointer into a given type
  486. * @param arg The argument to the directive
  487. * @return An error string or NULL on success
  488. }
  489. function ap_set_file_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
  490. cdecl; external LibHTTPD name 'ap_set_file_slot';
  491. {
  492. * Generic command handling function to respond with cmd->help as an error
  493. * @param cmd The command parameters for this directive
  494. * @param struct_ptr pointer into a given type
  495. * @param arg The argument to the directive
  496. * @return The cmd->help value as the error string
  497. * @tip This allows simple declarations such as;
  498. * <pre>
  499. * AP_INIT_RAW_ARGS("Foo", ap_set_deprecated, NULL, OR_ALL,
  500. * "The Foo directive is no longer supported, use Bar"),
  501. * </pre>
  502. }
  503. function ap_set_deprecated(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
  504. cdecl; external LibHTTPD name 'ap_set_deprecated';
  505. {
  506. * For modules which need to read config files, open logs, etc. this returns
  507. * the canonical form of fname made absolute to ap_server_root.
  508. * @param p pool to allocate data from
  509. * @param fname The file name
  510. }
  511. function ap_server_root_relative(p: Papr_pool_t; const fname: PChar): PChar;
  512. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  513. external LibHTTPD name LibNamePrefix + 'ap_server_root_relative' + LibSuff8;
  514. { Finally, the hook for dynamically loading modules in... }
  515. {
  516. * Add a module to the server
  517. * @param m The module structure of the module to add
  518. * @param p The pool of the same lifetime as the module
  519. }
  520. function ap_add_module(m: Pmodule; p: Papr_pool_t): PChar;
  521. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  522. external LibHTTPD name LibNamePrefix + 'ap_add_module' + LibSuff8;
  523. {
  524. * Remove a module from the server. There are some caveats:
  525. * when the module is removed, its slot is lost so all the current
  526. * per-dir and per-server configurations are invalid. So we should
  527. * only ever call this function when you are invalidating almost
  528. * all our current data. I.e. when doing a restart.
  529. * @param m the module structure of the module to remove
  530. }
  531. procedure ap_remove_module(m: Pmodule);
  532. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  533. external LibHTTPD name LibNamePrefix + 'ap_remove_module' + LibSuff4;
  534. {
  535. * Add a module to the chained modules list and the list of loaded modules
  536. * @param m The module structure of the module to add
  537. * @param p The pool with the same lifetime as the module
  538. }
  539. procedure ap_add_loaded_module(mod_: Pmodule; p: Papr_pool_t);
  540. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  541. external LibHTTPD name LibNamePrefix + 'ap_add_loaded_module' + LibSuff8;
  542. {
  543. * Remove a module fromthe chained modules list and the list of loaded modules
  544. * @param m the module structure of the module to remove
  545. }
  546. procedure ap_remove_loaded_module(m: Pmodule);
  547. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  548. external LibHTTPD name LibNamePrefix + 'ap_remove_loaded_module' + LibSuff4;
  549. {
  550. * Find the name of the specified module
  551. * @param m The module to get the name for
  552. * @return the name of the module
  553. }
  554. function ap_find_module_name(m: Pmodule): PChar;
  555. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  556. external LibHTTPD name LibNamePrefix + 'ap_find_module_name' + LibSuff4;
  557. {
  558. * Find a module based on the name of the module
  559. * @param name the name of the module
  560. * @return the module structure if found, NULL otherwise
  561. }
  562. function ap_find_linked_module(const name: PChar): Pmodule;
  563. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  564. external LibHTTPD name LibNamePrefix + 'ap_find_linked_module' + LibSuff4;
  565. {
  566. * Open a ap_configfile_t as apr_file_t
  567. * @param ret_cfg open ap_configfile_t struct pointer
  568. * @param p The pool to allocate the structure from
  569. * @param name the name of the file to open
  570. }
  571. function ap_pcfg_openfile(ret_cfg: PPap_configfile_t;
  572. p: Papr_pool_t; const name: PChar): apr_status_t;
  573. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  574. external LibHTTPD name LibNamePrefix + 'ap_pcfg_openfile' + LibSuff12;
  575. {
  576. * Allocate a ap_configfile_t handle with user defined functions and params
  577. * @param p The pool to allocate from
  578. * @param descr The name of the file
  579. * @param param The argument passed to getch/getstr/close
  580. * @param getc_func The getch function
  581. * @param gets_func The getstr function
  582. * @param close_func The close function
  583. }
  584. type
  585. getc_func_t = function (param: Pointer): Integer;
  586. gets_func_t = function (buf: Pointer; bufsiz: size_t; param: Pointer): Pointer;
  587. close_func_t = function (param: Pointer): Integer;
  588. function ap_pcfg_open_custom(p: Papr_pool_t;
  589. const descr: PChar; param: Pointer;
  590. getc_func: getc_func_t; gets_func: gets_func_t;
  591. close_func: close_func_t): Pap_configfile_t;
  592. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  593. external LibHTTPD name LibNamePrefix + 'ap_pcfg_open_custom' + LibSuff24;
  594. {
  595. * Read one line from open ap_configfile_t, strip LF, increase line number
  596. * @param buf place to store the line read
  597. * @param bufsize size of the buffer
  598. * @param cfp File to read from
  599. * @return 1 on success, 0 on failure
  600. }
  601. function ap_cfg_getline(bug: PChar;
  602. bufsize: size_t; cfp: Pap_configfile_t): Integer;
  603. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  604. external LibHTTPD name LibNamePrefix + 'ap_cfg_getline' + LibSuff12;
  605. {
  606. * Read one char from open configfile_t, increase line number upon LF
  607. * @param cfp The file to read from
  608. * @return the character read
  609. }
  610. function ap_cfg_getc(cfp: Pap_configfile_t): Integer;
  611. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  612. external LibHTTPD name LibNamePrefix + 'ap_cfg_getc' + LibSuff4;
  613. {
  614. * Detach from open ap_configfile_t, calling the close handler
  615. * @param cfp The file to close
  616. * @return 1 on sucess, 0 on failure
  617. }
  618. function ap_cfg_closefile(cfp: Pap_configfile_t): Integer;
  619. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  620. external LibHTTPD name LibNamePrefix + 'ap_cfg_closefile' + LibSuff4;
  621. {
  622. * Read all data between the current <foo> and the matching </foo>. All
  623. * of this data is forgotten immediately.
  624. * @param cmd The cmd_parms to pass to the directives inside the container
  625. * @param directive The directive name to read until
  626. * @return Error string on failure, NULL on success
  627. }
  628. function ap_soak_end_container(cmd: Pcmd_parms; directive: PChar): PChar;
  629. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  630. external LibHTTPD name LibNamePrefix + 'ap_soak_end_container' + LibSuff8;
  631. {
  632. * Read all data between the current <foo> and the matching </foo> and build
  633. * a config tree from it
  634. * @param p pool to allocate from
  635. * @param temp_pool Temporary pool to allocate from
  636. * @param parms The cmd_parms to pass to all directives read
  637. * @param current The current node in the tree
  638. * @param curr_parent The current parent node
  639. * @param orig_directive The directive to read until hit.
  640. * @return Error string on failure, NULL on success
  641. }
  642. function ap_build_cont_config(p, temp_pool: Papr_pool_t;
  643. parms: Pcmd_parms; current, curr_parent: PPap_directive_t;
  644. orig_directive: PChar): PChar;
  645. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  646. external LibHTTPD name LibNamePrefix + 'ap_build_cont_config' + LibSuff24;
  647. {
  648. * Build a config tree from a config file
  649. * @param parms The cmd_parms to pass to all of the directives in the file
  650. * @param conf_pool The pconf pool
  651. * @param temp_pool The temporary pool
  652. * @param conftree Place to store the root node of the config tree
  653. * @return Error string on erro, NULL otherwise
  654. }
  655. function ap_build_config(parms: Pcmd_parms;
  656. conf_pool, temp_pool: Papr_pool_t; conftree: PPap_directive_t): PChar;
  657. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  658. external LibHTTPD name LibNamePrefix + 'ap_build_config' + LibSuff16;
  659. {
  660. * Walk a config tree and setup the server's internal structures
  661. * @param conftree The config tree to walk
  662. * @param parms The cmd_parms to pass to all functions
  663. * @param section_vector The per-section config vector.
  664. * @return Error string on error, NULL otherwise
  665. }
  666. function ap_walk_config(conftree: Pap_directive_t;
  667. parms: Pcmd_parms; section_vector: Pap_conf_vector_t): PChar;
  668. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  669. external LibHTTPD name LibNamePrefix + 'ap_walk_config' + LibSuff12;
  670. {
  671. * @defgroup ap_check_cmd_context Check command context
  672. }
  673. {
  674. * Check the context a command is used in.
  675. * @param cmd The command to check
  676. * @param forbidden Where the command is forbidden.
  677. * @return Error string on error, NULL on success
  678. }
  679. function ap_check_cmd_context(cmd: Pcmd_parms;
  680. forbidden: cuint): PChar;
  681. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  682. external LibHTTPD name LibNamePrefix + 'ap_check_cmd_context' + LibSuff8;
  683. const
  684. NOT_IN_VIRTUALHOST = $01; {< Forbidden in <Virtualhost> }
  685. NOT_IN_LIMIT = $02; {< Forbidden in <Limit> }
  686. NOT_IN_DIRECTORY = $04; {< Forbidden in <Directory> }
  687. NOT_IN_LOCATION = $08; {< Forbidden in <Location> }
  688. NOT_IN_FILES = $10; {< Forbidden in <Files> }
  689. { Forbidden in <Directory>/<Location>/<Files>}
  690. NOT_IN_DIR_LOC_FILE = (NOT_IN_DIRECTORY or NOT_IN_LOCATION or NOT_IN_FILES);
  691. { Forbidden in <VirtualHost>/<Limit>/<Directory>/<Location>/<Files> }
  692. GLOBAL_ONLY = (NOT_IN_VIRTUALHOST or NOT_IN_LIMIT or NOT_IN_DIR_LOC_FILE);
  693. //#ifdef CORE_PRIVATE
  694. {
  695. * @brief This structure is used to assign symbol names to module pointers
  696. }
  697. type
  698. ap_module_symbol_t = record
  699. name: PChar;
  700. modp: Pmodule;
  701. end;
  702. {
  703. * The topmost module in the list
  704. * @defvar module *ap_top_module
  705. }
  706. //AP_DECLARE_DATA extern module *ap_top_module;
  707. {
  708. * Array of all statically linked modules
  709. * @defvar module *ap_prelinked_modules[]
  710. }
  711. //AP_DECLARE_DATA extern module *ap_prelinked_modules[];
  712. {
  713. * Array of all statically linked modulenames (symbols)
  714. * @defvar ap_module_symbol_t ap_prelinked_modulenames[]
  715. }
  716. //AP_DECLARE_DATA extern ap_module_symbol_t ap_prelinked_module_symbols[];
  717. {
  718. * Array of all preloaded modules
  719. * @defvar module *ap_preloaded_modules[]
  720. }
  721. //AP_DECLARE_DATA extern module *ap_preloaded_modules[];
  722. {
  723. * Array of all loaded modules
  724. * @defvar module **ap_loaded_modules
  725. }
  726. //AP_DECLARE_DATA extern module **ap_loaded_modules;
  727. { For mod_so.c... }
  728. { Run a single module's two create_config hooks
  729. * @param p the pool to allocate from
  730. * @param s The server to configure for.
  731. * @param m The module to configure
  732. }
  733. procedure ap_single_module_configure(p: Papr_pool_t;
  734. s: Pserver_rec; m: Pmodule);
  735. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  736. external LibHTTPD name LibNamePrefix + 'ap_single_module_configure' + LibSuff12;
  737. { For http_main.c... }
  738. {
  739. * Add all of the prelinked modules into the loaded module list
  740. * @param process The process that is currently running the server
  741. }
  742. function ap_setup_prelinked_modules(process: Pprocess_rec): PChar;
  743. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  744. external LibHTTPD name LibNamePrefix + 'ap_setup_prelinked_modules' + LibSuff4;
  745. {
  746. * Show the preloaded configuration directives, the help string explaining
  747. * the directive arguments, in what module they are handled, and in
  748. * what parts of the configuration they are allowed. Used for httpd -h.
  749. }
  750. procedure ap_show_directives;
  751. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  752. external LibHTTPD name LibNamePrefix + 'ap_show_directives' + LibSuff0;
  753. {
  754. * Show the preloaded module names. Used for httpd -l.
  755. }
  756. procedure ap_show_modules;
  757. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  758. external LibHTTPD name LibNamePrefix + 'ap_show_modules' + LibSuff0;
  759. {
  760. * Show the MPM name. Used in reporting modules such as mod_info to
  761. * provide extra information to the user
  762. }
  763. function ap_show_mpm: PChar;
  764. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  765. external LibHTTPD name LibNamePrefix + 'ap_show_mpm' + LibSuff0;
  766. {
  767. * Read all config files and setup the server
  768. * @param process The process running the server
  769. * @param temp_pool A pool to allocate temporary data from.
  770. * @param config_name The name of the config file
  771. * @param conftree Place to store the root of the config tree
  772. * @return The setup server_rec list.
  773. }
  774. function ap_read_config(process: Pprocess_rec;
  775. temp_pool: Papr_pool_t; const config_name: PChar;
  776. conftree: PPap_directive_t): Pserver_rec;
  777. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  778. external LibHTTPD name LibNamePrefix + 'ap_read_config' + LibSuff16;
  779. {
  780. * Run all rewrite args hooks for loaded modules
  781. * @param process The process currently running the server
  782. }
  783. procedure ap_run_rewrite_args(process: Pprocess_rec);
  784. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  785. external LibHTTPD name LibNamePrefix + 'ap_run_rewrite_args' + LibSuff4;
  786. {
  787. * Run the register hooks function for a specified module
  788. * @param m The module to run the register hooks function fo
  789. * @param p The pool valid for the lifetime of the module
  790. }
  791. procedure ap_register_hooks(m: Pmodule; p: Papr_pool_t);
  792. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  793. external LibHTTPD name LibNamePrefix + 'ap_register_hooks' + LibSuff8;
  794. {
  795. * Setup all virtual hosts
  796. * @param p The pool to allocate from
  797. * @param main_server The head of the server_rec list
  798. }
  799. procedure ap_fixup_virtual_hosts(p: Papr_pool_t; main_server: Pserver_rec);
  800. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  801. external LibHTTPD name LibNamePrefix + 'ap_fixup_virtual_hosts' + LibSuff8;
  802. { For http_request.c... }
  803. {
  804. * Setup the config vector for a request_rec
  805. * @param p The pool to allocate the config vector from
  806. * @return The config vector
  807. }
  808. function ap_create_request_config(p: Papr_pool_t): Pap_conf_vector_t;
  809. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  810. external LibHTTPD name LibNamePrefix + 'ap_create_request_config' + LibSuff4;
  811. {
  812. * Setup the config vector for per dir module configs
  813. * @param p The pool to allocate the config vector from
  814. * @return The config vector
  815. }
  816. function ap_create_per_dir_config(p: Papr_pool_t): Pap_conf_vector_t;
  817. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  818. external LibHTTPD name LibNamePrefix + 'ap_create_per_dir_config' + LibSuff4;
  819. {
  820. * Run all of the modules merge per dir config functions
  821. * @param p The pool to pass to the merge functions
  822. * @param base The base directory config structure
  823. * @param new_conf The new directory config structure
  824. }
  825. function ap_merge_per_dir_configs(p: Papr_pool_t;
  826. base, new_conf: Pap_conf_vector_t): Pap_conf_vector_t;
  827. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  828. external LibHTTPD name LibNamePrefix + 'ap_merge_per_dir_configs' + LibSuff12;
  829. { For http_connection.c... }
  830. {
  831. * Setup the config vector for a connection_rec
  832. * @param p The pool to allocate the config vector from
  833. * @return The config vector
  834. }
  835. function ap_create_conn_config(p: Papr_pool_t): Pap_conf_vector_t;
  836. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  837. external LibHTTPD name LibNamePrefix + 'ap_create_conn_config' + LibSuff4;
  838. { For http_core.c... (<Directory> command and virtual hosts) }
  839. {
  840. * parse an htaccess file
  841. * @param resulting htaccess_result
  842. * @param r The request currently being served
  843. * @param override Which overrides are active
  844. * @param path The path to the htaccess file
  845. * @param access_name The list of possible names for .htaccess files
  846. * int The status of the current request
  847. }
  848. function ap_parse_htaccess(result: PPap_conf_vector_t;
  849. r: Prequest_rec; override_: Integer; override_opts: cint;
  850. const path, access_name: PChar): Integer;
  851. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  852. external LibHTTPD name LibNamePrefix + 'ap_parse_htaccess' + LibSuff24;
  853. {
  854. * Setup a virtual host
  855. * @param p The pool to allocate all memory from
  856. * @param hostname The hostname of the virtual hsot
  857. * @param main_server The main server for this Apache configuration
  858. * @param ps Place to store the new server_rec
  859. * return Error string on error, NULL on success
  860. }
  861. function ap_init_virtual_host(p: Papr_pool_t;
  862. const hostname: PChar; main_server: Pserver_rec;
  863. ps: PPserver_rec): PChar;
  864. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  865. external LibHTTPD name LibNamePrefix + 'ap_init_virtual_host' + LibSuff16;
  866. {
  867. * Process the config file for Apache
  868. * @param s The server rec to use for the command parms
  869. * @param fname The name of the config file
  870. * @param conftree The root node of the created config tree
  871. * @param p Pool for general allocation
  872. * @param ptem Pool for temporary allocation
  873. }
  874. function ap_process_resource_config(s: Pserver_rec;
  875. const fname: PChar; conftree: PPap_directive_t;
  876. p, ptemp: Papr_pool_t): PChar;
  877. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  878. external LibHTTPD name LibNamePrefix + 'ap_process_resource_config' + LibSuff20;
  879. {
  880. * Process all directives in the config tree
  881. * @param s The server rec to use in the command parms
  882. * @param conftree The config tree to process
  883. * @param p The pool for general allocation
  884. * @param ptemp The pool for temporary allocations
  885. }
  886. function ap_process_config_tree(s: Pserver_rec;
  887. conftree: Pap_directive_t; p, ptemp: Papr_pool_t): cint;
  888. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  889. external LibHTTPD name LibNamePrefix + 'ap_process_config_tree' + LibSuff16;
  890. { Module-method dispatchers, also for http_request.c }
  891. {
  892. * Run the handler phase of each module until a module accepts the
  893. * responsibility of serving the request
  894. * @param r The current request
  895. * @return The status of the current request
  896. }
  897. function ap_invoke_handler(r: Prequest_rec): Integer;
  898. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  899. external LibHTTPD name LibNamePrefix + 'ap_invoke_handler' + LibSuff4;
  900. { for mod_perl }
  901. {
  902. * Find a given directive in a command_rec table
  903. * @param name The directive to search for
  904. * @param cmds The table to search
  905. * @return The directive definition of the specified directive
  906. }
  907. function ap_find_command(const name: PChar;
  908. const cmds: Pcommand_rec): Pcommand_rec;
  909. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  910. external LibHTTPD name LibNamePrefix + 'ap_find_command' + LibSuff8;
  911. {
  912. * Find a given directive in a list module
  913. * @param cmd_name The directive to search for
  914. * @param mod The module list to search
  915. * @return The directive definition of the specified directive
  916. }
  917. function ap_find_command_in_modules(const cmd_name: PChar;
  918. mod_: PPmodule): Pcommand_rec;
  919. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  920. external LibHTTPD name LibNamePrefix + 'ap_find_command_in_modules' + LibSuff8;
  921. {
  922. * Ask a module to create per-server and per-section (dir/loc/file) configs
  923. * (if it hasn't happened already). The results are stored in the server's
  924. * config, and the specified per-section config vector.
  925. * @param server The server to operate upon.
  926. * @param section_vector The per-section config vector.
  927. * @param section Which section to create a config for.
  928. * @param mod The module which is defining the config data.
  929. * @param pconf A pool for all configuration allocations.
  930. * @return The (new) per-section config data.
  931. }
  932. function ap_set_config_vectors(server: Pserver_rec;
  933. ection_vector: Pap_conf_vector_t; const section: PChar;
  934. mod_: Pmodule; pconf: Papr_pool_t): Pointer;
  935. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  936. external LibHTTPD name LibNamePrefix + 'ap_set_config_vectors' + LibSuff20;
  937. {#endif}
  938. { Hooks }
  939. {
  940. * Run the header parser functions for each module
  941. * @param r The current request
  942. * @return OK or DECLINED
  943. }
  944. type
  945. ap_HOOK_header_parser_t = function(r: Prequest_rec): Integer; cdecl;
  946. procedure ap_hook_header_parser(pf: ap_HOOK_header_parser_t;
  947. const aszPre: PPChar; const aszSucc:
  948. PPChar; nOrder: Integer);
  949. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  950. external LibHTTPD name LibNamePrefix + 'ap_hook_header_parser' + LibSuff16;
  951. {
  952. * Run the pre_config function for each module
  953. * @param pconf The config pool
  954. * @param plog The logging streams pool
  955. * @param ptemp The temporary pool
  956. * @return OK or DECLINED on success anything else is a error
  957. }
  958. type
  959. ap_HOOK_pre_config_t = function(pconf: Papr_pool_t; plog: Papr_pool_t;
  960. ptemp: Papr_pool_t): Integer; cdecl;
  961. procedure ap_hook_pre_config(pf: ap_HOOK_pre_config_t; const aszPre: PPChar;
  962. const aszSucc: PPChar; nOrder: Integer);
  963. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  964. external LibHTTPD name LibNamePrefix + 'ap_hook_pre_config' + LibSuff16;
  965. {
  966. * Run the test_config function for each module; this hook is run
  967. * only if the server was invoked to test the configuration syntax.
  968. * @param pconf The config pool
  969. * @param s The list of server_recs
  970. }
  971. type
  972. ap_HOOK_test_config_t = procedure (pconf: Papr_pool_t; s: Pserver_rec); cdecl;
  973. procedure ap_hook_test_config(pf: ap_HOOK_test_config_t; const aszPre: PPChar;
  974. const aszSucc: PPChar; nOrder: Integer);
  975. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  976. external LibHTTPD name LibNamePrefix + 'ap_hook_test_config' + LibSuff16;
  977. {
  978. * Run the post_config function for each module
  979. * @param pconf The config pool
  980. * @param plog The logging streams pool
  981. * @param ptemp The temporary pool
  982. * @param s The list of server_recs
  983. * @return OK or DECLINED on success anything else is a error
  984. }
  985. type
  986. ap_HOOK_post_config_t = function(pconf, plog, ptemp: Papr_pool_t; s: Pserver_rec): Integer; cdecl;
  987. procedure ap_hook_post_config(pf: ap_HOOK_post_config_t; const aszPre: PPChar;
  988. const aszSucc: PPChar; nOrder: Integer);
  989. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  990. external LibHTTPD name LibNamePrefix + 'ap_hook_post_config' + LibSuff16;
  991. {
  992. * Run the open_logs functions for each module
  993. * @param pconf The config pool
  994. * @param plog The logging streams pool
  995. * @param ptemp The temporary pool
  996. * @param s The list of server_recs
  997. * @return OK or DECLINED on success anything else is a error
  998. }
  999. type
  1000. ap_HOOK_open_logs_t = function(pconf: Papr_pool_t; plog: Papr_pool_t;
  1001. ptemp: Papr_pool_t; s: Pserver_rec): Integer; cdecl;
  1002. procedure ap_hook_open_logs(pf: ap_HOOK_open_logs_t; const aszPre: PPChar;
  1003. const aszSucc: PPChar; nOrder: Integer);
  1004. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1005. external LibHTTPD name LibNamePrefix + 'ap_hook_open_logs' + LibSuff16;
  1006. {
  1007. * Run the child_init functions for each module
  1008. * @param pchild The child pool
  1009. * @param s The list of server_recs in this server
  1010. }
  1011. type
  1012. ap_HOOK_child_init_t = procedure(pchild: Papr_pool_t; s: Pserver_rec); cdecl;
  1013. procedure ap_hook_child_init(pf: ap_HOOK_child_init_t; const aszPre: PPChar;
  1014. const aszSucc: PPChar; nOrder: Integer);
  1015. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1016. external LibHTTPD name LibNamePrefix + 'ap_hook_child_init' + LibSuff16;
  1017. {
  1018. * Run the handler functions for each module
  1019. * @param r The request_rec
  1020. * @remark non-wildcard handlers should HOOK_MIDDLE, wildcard HOOK_LAST
  1021. }
  1022. type
  1023. ap_HOOK_handler_t = function(r: Prequest_rec): Integer; cdecl;
  1024. procedure ap_hook_handler(pf: ap_HOOK_handler_t; const aszPre: PPChar;
  1025. const aszSucc: PPChar; nOrder: Integer);
  1026. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1027. external LibHTTPD name LibNamePrefix + 'ap_hook_handler' + LibSuff16;
  1028. {
  1029. * Run the quick handler functions for each module. The quick_handler
  1030. * is run before any other requests hooks are called (location_walk,
  1031. * directory_walk, access checking, et. al.). This hook was added
  1032. * to provide a quick way to serve content from a URI keyed cache.
  1033. *
  1034. * @param r The request_rec
  1035. * @param lookup_uri Controls whether the caller actually wants content or not.
  1036. * lookup is set when the quick_handler is called out of
  1037. * ap_sub_req_lookup_uri()
  1038. }
  1039. type
  1040. ap_HOOK_quick_handler_t = function(r: Prequest_rec;
  1041. lookup_uri: Integer): Integer; cdecl;
  1042. procedure ap_hook_quick_handler(pf: ap_HOOK_quick_handler_t;
  1043. const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
  1044. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1045. external LibHTTPD name LibNamePrefix + 'ap_hook_quick_handler' + LibSuff16;
  1046. {
  1047. * Retrieve the optional functions for each module.
  1048. * This is run immediately before the server starts. Optional functions should
  1049. * be registered during the hook registration phase.
  1050. }
  1051. type
  1052. ap_HOOK_optional_fn_retrieve_t = procedure; cdecl;
  1053. procedure ap_hook_optional_fn_retrieve(pf: ap_HOOK_optional_fn_retrieve_t;
  1054. const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
  1055. {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
  1056. external LibHTTPD name LibNamePrefix + 'ap_hook_optional_fn_retrieve' + LibSuff16;