http_config.inc 44 KB

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