Removed Apache bindings from Lazarus CCR because they were moved to Free Pascal Subversion under the folder fpc/packages/base/httpd

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@38 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2006-11-18 11:38:49 +00:00
parent b5ff30595d
commit f361493ed0
134 changed files with 443 additions and 47898 deletions

View File

@ -33,6 +33,8 @@ unit dbus;
{$minenumsize 4}
{$packrecord c}
{ FPC 2.0.2 compatibility code }
{$ifdef win32}
{$define windows}

View File

@ -21,88 +21,82 @@
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<Units Count="14">
<Units Count="15">
<Unit0>
<Filename Value="busexample.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="busexample"/>
<CursorPos X="1" Y="32"/>
<TopLine Value="1"/>
<CursorPos X="17" Y="271"/>
<TopLine Value="258"/>
<EditorIndex Value="0"/>
<UsageCount Value="22"/>
<UsageCount Value="29"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="../dbus-connection.inc"/>
<CursorPos X="71" Y="103"/>
<TopLine Value="82"/>
<EditorIndex Value="5"/>
<UsageCount Value="11"/>
<CursorPos X="10" Y="104"/>
<TopLine Value="88"/>
<EditorIndex Value="8"/>
<UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit1>
<Unit2>
<Filename Value="../dbus-bus.inc"/>
<CursorPos X="1" Y="41"/>
<TopLine Value="19"/>
<EditorIndex Value="6"/>
<TopLine Value="1"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="../dbus-errors.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<EditorIndex Value="7"/>
<CursorPos X="3" Y="34"/>
<TopLine Value="18"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="../dbus-memory.inc"/>
<CursorPos X="50" Y="40"/>
<TopLine Value="6"/>
<EditorIndex Value="8"/>
<TopLine Value="1"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
<Filename Value="../dbus-message.inc"/>
<CursorPos X="1" Y="166"/>
<TopLine Value="131"/>
<EditorIndex Value="9"/>
<CursorPos X="3" Y="35"/>
<TopLine Value="34"/>
<EditorIndex Value="1"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="../dbus.pas"/>
<UnitName Value="dbus"/>
<CursorPos X="7" Y="20"/>
<TopLine Value="10"/>
<EditorIndex Value="1"/>
<UsageCount Value="11"/>
<CursorPos X="15" Y="37"/>
<TopLine Value="24"/>
<EditorIndex Value="4"/>
<UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit6>
<Unit7>
<Filename Value="../dbus-pending-call.inc"/>
<CursorPos X="87" Y="29"/>
<TopLine Value="8"/>
<EditorIndex Value="4"/>
<UsageCount Value="11"/>
<EditorIndex Value="7"/>
<UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit7>
<Unit8>
<Filename Value="../dbus-protocol.inc"/>
<CursorPos X="12" Y="241"/>
<TopLine Value="216"/>
<EditorIndex Value="3"/>
<UsageCount Value="11"/>
<CursorPos X="3" Y="67"/>
<TopLine Value="50"/>
<EditorIndex Value="6"/>
<UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit8>
<Unit9>
<Filename Value="../dbus-server.inc"/>
<CursorPos X="83" Y="37"/>
<TopLine Value="18"/>
<EditorIndex Value="2"/>
<UsageCount Value="11"/>
<CursorPos X="1" Y="60"/>
<TopLine Value="28"/>
<EditorIndex Value="5"/>
<UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit9>
<Unit10>
@ -113,9 +107,11 @@
</Unit10>
<Unit11>
<Filename Value="../dbus-threads.inc"/>
<CursorPos X="15" Y="74"/>
<TopLine Value="60"/>
<CursorPos X="17" Y="92"/>
<TopLine Value="62"/>
<EditorIndex Value="2"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit11>
<Unit12>
<Filename Value="../../lazarus/debugger/cmdlinedebugger.pp"/>
@ -131,32 +127,121 @@
<UsageCount Value="10"/>
<SyntaxHighlighter Value="C++"/>
</Unit13>
<Unit14>
<Filename Value="../c_sources/dbus-message.h"/>
<CursorPos X="75" Y="176"/>
<TopLine Value="155"/>
<EditorIndex Value="3"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
<SyntaxHighlighter Value="C++"/>
</Unit14>
</Units>
<JumpHistory Count="6" HistoryIndex="5">
<JumpHistory Count="26" HistoryIndex="25">
<Position1>
<Filename Value="busexample.lpr"/>
<Caret Line="45" Column="16" TopLine="17"/>
<Caret Line="206" Column="1" TopLine="201"/>
</Position1>
<Position2>
<Filename Value="busexample.lpr"/>
<Caret Line="51" Column="1" TopLine="20"/>
<Caret Line="276" Column="11" TopLine="264"/>
</Position2>
<Position3>
<Filename Value="busexample.lpr"/>
<Caret Line="35" Column="16" TopLine="20"/>
<Caret Line="41" Column="21" TopLine="23"/>
</Position3>
<Position4>
<Filename Value="busexample.lpr"/>
<Caret Line="16" Column="1" TopLine="10"/>
<Caret Line="302" Column="1" TopLine="285"/>
</Position4>
<Position5>
<Filename Value="busexample.lpr"/>
<Caret Line="78" Column="1" TopLine="46"/>
<Caret Line="96" Column="17" TopLine="80"/>
</Position5>
<Position6>
<Filename Value="busexample.lpr"/>
<Caret Line="76" Column="3" TopLine="46"/>
<Caret Line="344" Column="20" TopLine="327"/>
</Position6>
<Position7>
<Filename Value="busexample.lpr"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position7>
<Position8>
<Filename Value="busexample.lpr"/>
<Caret Line="16" Column="59" TopLine="1"/>
</Position8>
<Position9>
<Filename Value="busexample.lpr"/>
<Caret Line="78" Column="10" TopLine="63"/>
</Position9>
<Position10>
<Filename Value="busexample.lpr"/>
<Caret Line="79" Column="10" TopLine="63"/>
</Position10>
<Position11>
<Filename Value="busexample.lpr"/>
<Caret Line="77" Column="18" TopLine="71"/>
</Position11>
<Position12>
<Filename Value="busexample.lpr"/>
<Caret Line="85" Column="10" TopLine="71"/>
</Position12>
<Position13>
<Filename Value="busexample.lpr"/>
<Caret Line="97" Column="35" TopLine="80"/>
</Position13>
<Position14>
<Filename Value="busexample.lpr"/>
<Caret Line="351" Column="44" TopLine="327"/>
</Position14>
<Position15>
<Filename Value="busexample.lpr"/>
<Caret Line="204" Column="16" TopLine="188"/>
</Position15>
<Position16>
<Filename Value="busexample.lpr"/>
<Caret Line="351" Column="42" TopLine="327"/>
</Position16>
<Position17>
<Filename Value="busexample.lpr"/>
<Caret Line="203" Column="25" TopLine="184"/>
</Position17>
<Position18>
<Filename Value="busexample.lpr"/>
<Caret Line="352" Column="44" TopLine="327"/>
</Position18>
<Position19>
<Filename Value="busexample.lpr"/>
<Caret Line="270" Column="14" TopLine="254"/>
</Position19>
<Position20>
<Filename Value="busexample.lpr"/>
<Caret Line="278" Column="15" TopLine="254"/>
</Position20>
<Position21>
<Filename Value="busexample.lpr"/>
<Caret Line="259" Column="17" TopLine="247"/>
</Position21>
<Position22>
<Filename Value="busexample.lpr"/>
<Caret Line="284" Column="18" TopLine="268"/>
</Position22>
<Position23>
<Filename Value="busexample.lpr"/>
<Caret Line="261" Column="3" TopLine="245"/>
</Position23>
<Position24>
<Filename Value="busexample.lpr"/>
<Caret Line="274" Column="20" TopLine="259"/>
</Position24>
<Position25>
<Filename Value="busexample.lpr"/>
<Caret Line="271" Column="17" TopLine="258"/>
</Position25>
<Position26>
<Filename Value="../dbus-message.inc"/>
<Caret Line="146" Column="50" TopLine="130"/>
</Position26>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>

View File

@ -12,32 +12,320 @@ uses
ctypes,
dbus;
procedure BusSend;
begin
end;
procedure BusReceive;
begin
end;
procedure BusListen;
begin
end;
procedure BusQuery;
begin
end;
const
SINTAX_TEXT = 'Syntax: dbus-example [send|receive|listen|query] [<param>]';
var
err: DBusError;
conn: PDBusConnection;
ret: cint;
{
* Send a broadcast signal
}
procedure BusSend(sigvalue: PChar);
var
msg: PDBusMessage;
args: DBusMessageIter;
serial: dbus_uint32_t = 0;
begin
WriteLn('Sending signal with value ', string(sigvalue));
{ Request the name of the bus }
ret := dbus_bus_request_name(conn, 'test.signal.source', DBUS_NAME_FLAG_REPLACE_EXISTING, @err);
if dbus_error_is_set(@err) <> 0 then
begin
WriteLn('Name Error: ' + err.message);
dbus_error_free(@err);
end;
if ret <> DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER then Exit;
// create a signal & check for errors
msg := dbus_message_new_signal('/test/signal/Object', // object name of the signal
'test.signal.Type', // interface name of the signal
'Test'); // name of the signal
if (msg = nil) then
begin
WriteLn('Message Null');
Exit;
end;
// append arguments onto signal
dbus_message_iter_init_append(msg, @args);
if (dbus_message_iter_append_basic(@args, DBUS_TYPE_STRING, @sigvalue) = 0) then
begin
WriteLn('Out Of Memory!');
Exit;
end;
// send the message and flush the connection
if (dbus_connection_send(conn, msg, @serial) = 0) then
begin
WriteLn('Out Of Memory!');
Exit;
end;
dbus_connection_flush(conn);
WriteLn('Signal Sent');
// free the message and close the connection
dbus_message_unref(msg);
end;
{
* Listens for signals on the bus
}
procedure BusReceive;
var
msg: PDBusMessage;
args: DBusMessageIter;
sigvalue: PChar;
begin
WriteLn('Listening for signals');
{ Request the name of the bus }
ret := dbus_bus_request_name(conn, 'test.signal.sink', DBUS_NAME_FLAG_REPLACE_EXISTING, @err);
if dbus_error_is_set(@err) <> 0 then
begin
WriteLn('Name Error: ' + err.message);
dbus_error_free(@err);
end;
// add a rule for which messages we want to see
dbus_bus_add_match(conn, 'type=''signal'',interface=''test.signal.Type''', @err); // see signals from the given interface
dbus_connection_flush(conn);
if (dbus_error_is_set(@err) <> 0) then
begin
WriteLn('Match Error (', err.message, ')');
Exit;
end;
WriteLn('Match rule sent');
// loop listening for signals being emmitted
while (true) do
begin
// non blocking read of the next available message
dbus_connection_read_write(conn, 0);
msg := dbus_connection_pop_message(conn);
// loop again if we haven't read a message
if (msg = nil) then
begin
sleep(1);
Continue;
end;
// check if the message is a signal from the correct interface and with the correct name
if (dbus_message_is_signal(msg, 'test.signal.Type', 'Test') <> 0) then
begin
// read the parameters
if (dbus_message_iter_init(msg, @args) = 0) then
WriteLn('Message Has No Parameters')
else if (DBUS_TYPE_STRING <> dbus_message_iter_get_arg_type(@args)) then
WriteLn('Argument is not string!')
else
dbus_message_iter_get_basic(@args, @sigvalue);
WriteLn('Got Signal with value ', sigvalue);
end;
// free the message
dbus_message_unref(msg);
end;
end;
procedure reply_to_method_call(msg: PDBusMessage; conn: PDBusConnection);
var
reply: PDBusMessage;
args: DBusMessageIter;
stat: Boolean = true;
level: dbus_uint32_t = 21614;
serial: dbus_uint32_t = 0;
param: PChar = '';
begin
// read the arguments
if (dbus_message_iter_init(msg, @args) = 0) then
WriteLn('Message has no arguments!')
else if (DBUS_TYPE_STRING <> dbus_message_iter_get_arg_type(@args)) then
WriteLn('Argument is not string!')
else
dbus_message_iter_get_basic(@args, @param);
WriteLn('Method called with ', param);
// create a reply from the message
reply := dbus_message_new_method_return(msg);
// add the arguments to the reply
dbus_message_iter_init_append(reply, @args);
if (dbus_message_iter_append_basic(@args, DBUS_TYPE_BOOLEAN, @stat) <> 0) then
begin
WriteLn('Out Of Memory!');
Exit;
end;
if (dbus_message_iter_append_basic(@args, DBUS_TYPE_UINT32, @level) <> 0) then
begin
WriteLn('Out Of Memory!');
Exit;
end;
// send the reply && flush the connection
if (dbus_connection_send(conn, reply, @serial) = 0) then
begin
WriteLn('Out Of Memory!');
Exit;
end;
dbus_connection_flush(conn);
// free the reply
dbus_message_unref(reply);
end;
{
* Server that exposes a method call and waits for it to be called
}
procedure BusListen;
var
msg, reply: PDBusMessage;
args: DBusMessageIter;
param: PChar;
begin
WriteLn('Listening for method calls');
{ Request the name of the bus }
ret := dbus_bus_request_name(conn, 'test.method.server', DBUS_NAME_FLAG_REPLACE_EXISTING, @err);
if dbus_error_is_set(@err) <> 0 then
begin
WriteLn('Name Error: ' + err.message);
dbus_error_free(@err);
end;
if ret <> DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER then Exit;
// loop, testing for new messages
while (true) do
begin
// non blocking read of the next available message
dbus_connection_read_write(conn, 0);
msg := dbus_connection_pop_message(conn);
// loop again if we haven't got a message
if (msg = nil) then
begin
sleep(1);
Continue;
end;
// check this is a method call for the right interface & method
if (dbus_message_is_method_call(msg, 'test.method.Type', 'Method') <> 0) then
reply_to_method_call(msg, conn);
// free the message
dbus_message_unref(msg);
end;
end;
{
* Call a method on a remote object
}
procedure BusCall(param: PChar);
var
msg: PDBusMessage;
args: PDBusMessageIter;
pending: PDBusPendingCall;
stat: Boolean;
level: dbus_uint32_t;
begin
WriteLn('Calling remote method with ', param);
{ Request the name of the bus }
ret := dbus_bus_request_name(conn, 'test.method.caller', DBUS_NAME_FLAG_REPLACE_EXISTING, @err);
if dbus_error_is_set(@err) <> 0 then
begin
WriteLn('Name Error: ' + err.message);
dbus_error_free(@err);
end;
if ret <> DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER then Exit;
// create a new method call and check for errors
msg := dbus_message_new_method_call('test.method.server', // target for the method call
'/test/method/Object', // object to call on
'test.method.Type', // interface to call on
'Method'); // method name
if (msg = nil) then
begin
WriteLn('Message Null');
Exit;
end;
// append arguments
dbus_message_iter_init_append(msg, @args);
if (dbus_message_iter_append_basic(@args, DBUS_TYPE_STRING, @param) = 0) then
begin
WriteLn('Out Of Memory!');
Exit;
end;
// send message and get a handle for a reply
if (dbus_connection_send_with_reply (conn, msg, @pending, -1) = 0) then // -1 is default timeout
begin
WriteLn('Out Of Memory!');
Exit;
end;
if (pending = nil) then
begin
WriteLn('Pending Call Null');
Exit;
end;
dbus_connection_flush(conn);
WriteLn('Request Sent');
// free message
dbus_message_unref(msg);
// block until we recieve a reply
dbus_pending_call_block(pending);
// get the reply message
msg := dbus_pending_call_steal_reply(pending);
if (msg = nil) then
begin
WriteLn('Reply Null');
Exit;
end;
// free the pending message handle
dbus_pending_call_unref(pending);
// read the parameters
if (dbus_message_iter_init(msg, @args) = 0) then
WriteLn('Message has no arguments!')
else if (DBUS_TYPE_BOOLEAN <> dbus_message_iter_get_arg_type(@args)) then
WriteLn('Argument is not boolean!')
else
dbus_message_iter_get_basic(@args, @stat);
if (dbus_message_iter_next(@args) = 0) then
WriteLn('Message has too few arguments!')
else if (DBUS_TYPE_UINT32 <> dbus_message_iter_get_arg_type(@args)) then
WriteLn('Argument is not int!')
else
dbus_message_iter_get_basic(@args, @level);
WriteLn('Got Reply: ', stat, ', ', level);
// free reply
dbus_message_unref(msg);
end;
begin
{ Initializes the errors }
dbus_error_init(@err);
@ -53,26 +341,15 @@ begin
if conn = nil then Exit;
{ Request the name of the bus }
ret := dbus_bus_request_name(conn, 'test.method.server', DBUS_NAME_FLAG_REPLACE_EXISTING, @err);
if dbus_error_is_set(@err) <> 0 then
begin
WriteLn('Name Error: ' + err.message);
dbus_error_free(@err);
end;
if ret <> DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER then Exit;
{ Parses parameters }
if (ParamCount <> 1) and (ParamCount <> 2) then WriteLn(SINTAX_TEXT)
else
begin
if ParamStr(1) = 'send' then BusSend
else if ParamStr(1) = 'receive' then BusReceive
else if ParamStr(1) = 'listen' then BusListen
else if ParamStr(1) = 'query' then BusQuery
if ParamStr(1) = 'send' then BusSend(PChar(ParamStr(2)))
else if ParamStr(1) = 'receive' then BusReceive()
else if ParamStr(1) = 'listen' then BusListen()
else if ParamStr(1) = 'call' then BusCall(PChar(ParamStr(2)))
else WriteLn(SINTAX_TEXT);
end;

View File

@ -1,3 +0,0 @@
[SECTION .data]
global test_module
test_module dd 0

View File

@ -1,95 +0,0 @@
#!/bin/sh
#
# This script generates packages for the Apache headers for Pascal
#
##################################
# Constants
##################################
PRODUCT="Apache Headers"
VERSION="0.3"
TARGET_DIR="./httpd-$VERSION/"
TARGET_TAR="httpd-$VERSION.tar"
TARGET_ZIP="httpd-$VERSION.zip"
##################################
# Cleans a directory
##################################
CleanDirectory ()
{
rm -rf ${1}*.o
rm -rf ${1}*.ppu
rm -rf ${1}*.bak
rm -rf ${1}*.sh~
}
##################################
# Creates a source package
##################################
SourcePackage ()
{
# Goes to the root directory of the magnifier
cd ..
# Clean up
CleanDirectory ./
CleanDirectory ./build/
CleanDirectory ./httpd_1_3/
CleanDirectory ./httpd_2_0
CleanDirectory ./httpd_2_0/apr/
CleanDirectory ./httpd_2_0/aprutil/
CleanDirectory ./httpd_2_0/apriconv/
CleanDirectory ./httpd_2_2
CleanDirectory ./httpd_2_2/apr/
CleanDirectory ./httpd_2_2/aprutil/
CleanDirectory ./httpd_2_2/apriconv/
# The Subversion directories will be copied
# copies all files to a new temporary directory
cp -r ./ ../httpd-$VERSION/
# Creates the package
cd ..
zip -r $TARGET_ZIP httpd-$VERSION/
# Clean up
rm -rf httpd-$VERSION/
return
}
##################################
# Main section
##################################
echo "========================================================"
echo " Apache headers for Pascal build script"
echo "========================================================"
echo ""
echo " Please select which package you would like to build:"
echo ""
echo " 1 > Source .zip package"
echo " 0 > Exit"
read command
case $command in
1) SourcePackage;;
0) exit 0;;
*) echo "Invalid command"
exit 0;;
esac

View File

@ -1,3 +0,0 @@
[SECTION .data]
global example_module
example_module dd 0

View File

@ -1,175 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* The ap_vsnprintf/ap_snprintf functions are based on, and used with the
* permission of, the SIO stdio-replacement strx_* functions by Panos
* Tsirigotis <panos@alumni.cs.colorado.edu> for xinetd.
}
function ap_cpystrn(param1: PChar; const param2: PChar; param3: size_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{int ap_slack(int, int);
int ap_execle(const char *, const char *, ...);
int ap_execve(const char *, char * const argv[], char * const envp[]); }
//function ap_getpass(const prompt: PChar; pwbuf: PChar; bufsiz: size_t): cint;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
//{$ifndef ap_strtol}
//function ap_strtol(const nptr: PChar; endptr: PPChar; base: cint): clong;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
//{$endif}
{ small utility macros to make things easier to read }
{.$ifdef WIN32
#define ap_killpg(x, y)
#else
#ifdef NO_KILLPG
#define ap_killpg(x, y) (kill (-(x), (y)))
#else
#define ap_killpg(x, y) (killpg ((x), (y)))
#endif
#endif} { WIN32 }
{ ap_vformatter() is a generic printf-style formatting routine
* with some extensions. The extensions are:
*
* %pA takes a struct in_addr *, and prints it as a.b.c.d
* %pI takes a struct sockaddr_in * and prints it as a.b.c.d:port
* %pp takes a void * and outputs it in hex
*
* The %p hacks are to force gcc's printf warning code to skip
* over a pointer argument without complaining. This does
* mean that the ANSI-style %p (output a void * in hex format) won't
* work as expected at all, but that seems to be a fair trade-off
* for the increased robustness of having printf-warnings work.
*
* Additionally, ap_vformatter allows for arbitrary output methods
* using the ap_vformatter_buff and flush_func.
*
* The ap_vformatter_buff has two elements curpos and endpos.
* curpos is where ap_vformatter will write the next byte of output.
* It proceeds writing output to curpos, and updating curpos, until
* either the end of output is reached, or curpos == endpos (i.e. the
* buffer is full).
*
* If the end of output is reached, ap_vformatter returns the
* number of bytes written.
*
* When the buffer is full, the flush_func is called. The flush_func
* can return -1 to indicate that no further output should be attempted,
* and ap_vformatter will return immediately with -1. Otherwise
* the flush_func should flush the buffer in whatever manner is
* appropriate, re-initialize curpos and endpos, and return 0.
*
* Note that flush_func is only invoked as a result of attempting to
* write another byte at curpos when curpos >= endpos. So for
* example, it's possible when the output exactly matches the buffer
* space available that curpos == endpos will be true when
* ap_vformatter returns.
*
* ap_vformatter does not call out to any other code, it is entirely
* self-contained. This allows the callers to do things which are
* otherwise "unsafe". For example, ap_psprintf uses the "scratch"
* space at the unallocated end of a block, and doesn't actually
* complete the allocation until ap_vformatter returns. ap_psprintf
* would be completely broken if ap_vformatter were to call anything
* that used a pool. Similarly http_bprintf() uses the "scratch"
* space at the end of its output buffer, and doesn't actually note
* that the space is in use until it either has to flush the buffer
* or until ap_vformatter returns.
}
type
ap_vformatter_buff = record
curpos: PChar;
endpos: PChar;
end;
Pap_vformatter_buff = ^ap_vformatter_buff;
flush_func_t = function (param: Pap_vformatter_buff): cint;
function ap_vformatter(flush_func: flush_func_t;
param2: Pap_vformatter_buff; const fmt: PChar; ap: va_list): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ These are snprintf implementations based on ap_vformatter().
*
* Note that various standards and implementations disagree on the return
* value of snprintf, and side-effects due to %n in the formatting string.
* ap_snprintf behaves as follows:
*
* Process the format string until the entire string is exhausted, or
* the buffer fills. If the buffer fills then stop processing immediately
* (so no further %n arguments are processed), and return the buffer
* length. In all cases the buffer is NUL terminated. The return value
* is the number of characters placed in the buffer, excluding the
* terminating NUL. All this implies that, at most, (len-1) characters
* will be copied over; if the return value is >= len, then truncation
* occured.
*
* In no event does ap_snprintf return a negative number.
}
function ap_snprintf(buf: PChar; len: size_t; const format: PChar;
others: array of const): cint; cdecl; external LibHTTPD;
// __attribute__((format(printf,3,4)));
function ap_vsnprintf(buf: PChar; len: size_t; const format: PChar; ap: va_list): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Simple BASE64 encode/decode functions.
*
* As we might encode binary strings, hence we require the length of
* the incoming plain source. And return the length of what we decoded.
*
* The decoding function takes any non valid char (i.e. whitespace, \0
* or anything non A-Z,0-9 etc as terminal.
*
* plain strings/binary sequences are not assumed '\0' terminated. Encoded
* strings are neither. But propably should.
*
}
function ap_base64encode_len(len: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_base64encode(coded_dst: PChar; const plain_src: PChar; len_plain_src: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_base64encode_binary(coded_dst: PChar; const plain_src: PChar; len_plain_src: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_base64decode_len(const coded_src: PChar): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_base64decode(plain_dst: PChar; const coded_src: PChar): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_base64decode_binary(plain_dst: PChar; const coded_src: PChar): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Password validation, as used in AuthType Basic which is able to cope
* (based on the prefix) with the SHA1, Apache's internal MD5 and (depending
* on your platform either plain or crypt(3) passwords.
}
function ap_validate_password(const passwd, hash: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;

View File

@ -1,451 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* Resource allocation routines...
*
* designed so that we don't have to keep track of EVERYTHING so that
* it can be explicitly freed later (a fundamentally unsound strategy ---
* particularly in the presence of die()).
*
* Instead, we maintain pools, and allocate items (both memory and I/O
* handlers) from the pools --- currently there are two, one for per
* transaction info, and one for config info. When a transaction is over,
* we can delete everything in the per-transaction pool without fear, and
* without thinking too hard about it either.
*
* rst
}
{ Arenas for configuration info and transaction info
* --- actual layout of the pool structure is private to
* alloc.c.
}
{ Need declaration of DIR on Win32 }
{$ifdef WIN32}
//#include "readdir.h"
{$endif}
type
pool = record end;
Ppool = ^pool;
ap_pool = pool;
Pap_pool = ^ap_pool;
function ap_init_alloc: PPool; { Set up everything }
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
//procedure ap_cleanup_alloc;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_make_sub_pool(param: PPool): PPool; { All pools are subpools of permanent_pool }
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_destroy_pool(param: PPool);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ pools have nested lifetimes -- sub_pools are destroyed when the
* parent pool is cleared. We allow certain liberties with operations
* on things such as tables (and on other structures in a more general
* sense) where we allow the caller to insert values into a table which
* were not allocated from the table's pool. The table's data will
* remain valid as long as all the pools from which its values are
* allocated remain valid.
*
* For example, if B is a sub pool of A, and you build a table T in
* pool B, then it's safe to insert data allocated in A or B into T
* (because B lives at most as long as A does, and T is destroyed when
* B is cleared/destroyed). On the other hand, if S is a table in
* pool A, it is safe to insert data allocated in A into S, but it
* is *not safe* to insert data allocated from B into S... because
* B can be cleared/destroyed before A is (which would leave dangling
* pointers in T's data structures).
*
* In general we say that it is safe to insert data into a table T
* if the data is allocated in any ancestor of T's pool. This is the
* basis on which the POOL_DEBUG code works -- it tests these ancestor
* relationships for all data inserted into tables. POOL_DEBUG also
* provides tools (ap_find_pool, and ap_pool_is_ancestor) for other
* folks to implement similar restrictions for their own data
* structures.
*
* However, sometimes this ancestor requirement is inconvenient --
* sometimes we're forced to create a sub pool (such as through
* ap_sub_req_lookup_uri), and the sub pool is guaranteed to have
* the same lifetime as the parent pool. This is a guarantee implemented
* by the *caller*, not by the pool code. That is, the caller guarantees
* they won't destroy the sub pool individually prior to destroying the
* parent pool.
*
* In this case the caller must call ap_pool_join() to indicate this
* guarantee to the POOL_DEBUG code. There are a few examples spread
* through the standard modules.
}
{$ifndef POOL_DEBUG}
//#define ap_pool_join(a,b)
{$else}
//API_EXPORT(void) ap_pool_join(pool *p, pool *sub);
//API_EXPORT(pool *) ap_find_pool(const void *ts);
//API_EXPORT(int) ap_pool_is_ancestor(pool *a, pool *b);
{$endif}
{ Clearing out EVERYTHING in an pool... destroys any sub-pools }
procedure ap_clear_pool(param1: Ppool);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Preparing for exec() --- close files, etc., but *don't* flush I/O
* buffers, *don't* wait for subprocesses, and *don't* free any memory.
}
procedure ap_cleanup_for_exec;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ routines to allocate memory from an pool... }
function ap_palloc(p: PPool; nbytes: cint): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_pcalloc(p: PPool; nbytes: cint): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_pstrdup(p: PPool; const s: Char): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ make a nul terminated copy of the n characters starting with s }
function ap_pstrndup(p: PPool; const s: PChar; n: cint): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
//API_EXPORT_NONSTD(char *) ap_pstrcat(struct pool *,...); { all '...' must be char* }
//API_EXPORT_NONSTD(char *) ap_psprintf(struct pool *, const char *fmt, ...)
// __attribute__((format(printf,2,3)));
//API_EXPORT(char *) ap_pvsprintf(struct pool *, const char *fmt, va_list);
{ array and alist management... keeping lists of things.
* Common enough to want common support code ...
}
type
Parray_header = ^array_header;
array_header = record
pool: Pap_pool;
elt_size: cint;
nelts: cint;
nalloc: cint;
elts: PChar;
end;
//API_EXPORT(array_header *) ap_make_array(pool *p, int nelts, int elt_size);
//API_EXPORT(void *) ap_push_array(array_header *);
//API_EXPORT(void) ap_array_cat(array_header *dst, const array_header *src);
//API_EXPORT(array_header *) ap_append_arrays(pool *, const array_header *,
// const array_header *);
{ ap_array_pstrcat generates a new string from the pool containing
* the concatenated sequence of substrings referenced as elements within
* the array. The string will be empty if all substrings are empty or null,
* or if there are no elements in the array.
* If sep is non-NUL, it will be inserted between elements as a separator.
}
function ap_array_pstrcat(p: PPool; const arr: Parray_header; const sep: Char): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ copy_array copies the *entire* array. copy_array_hdr just copies
* the header, and arranges for the elements to be copied if (and only
* if) the code subsequently does a push or arraycat.
}
//API_EXPORT(array_header *) ap_copy_array(pool *p, const array_header *src);
//API_EXPORT(array_header *) ap_copy_array_hdr(pool *p, const array_header *src);
{ Tables. Implemented alist style, for now, though we try to keep
* it so that imposing a hash table structure on top in the future
* wouldn't be *too* hard...
*
* Note that key comparisons for these are case-insensitive, largely
* because that's what's appropriate and convenient everywhere they're
* currently being used...
}
type
table = record end;
Ptable = ^table;
table_entry = record
key: PChar; { maybe NULL in future;
* check when iterating thru table_elts
}
val: PChar;
end;
table_entry_t = table_entry;
function ap_make_table(p: Ppool; nelts: cuint): Ptable;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_copy_table(p: Ppool; p1: Ptable): Ptable;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_clear_table(p1: Ptable);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_table_get(const p1: Ptable; const p2: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_table_set(p1: Ptable; const name, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_table_setn(p1: Ptable; const name, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_table_merge(p1: Ptable; const name, more_val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_table_mergen(p1: Ptable; const name, more_val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_table_unset(p1: Ptable; const key: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_table_add(p1: Ptable; const name, more_val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_table_addn(p1: Ptable; const name, more_val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{API_EXPORT_NONSTD(void) ap_table_do(int ( *comp) (void *, const char *, const char *),
void *rec, const table *t,...);
API_EXPORT(table * ) ap_overlay_tables(pool *p, const table *overlay, const table *base);
}
{ Conceptually, ap_overlap_tables does this:
array_header *barr = ap_table_elts(b);
table_entry *belt = (table_entry *)barr->elts;
int i;
for (i = 0; i < barr->nelts; ++i) begin
if (flags & AP_OVERLAP_TABLES_MERGE) begin
ap_table_mergen(a, belt[i].key, belt[i].val);
end
else begin
ap_table_setn(a, belt[i].key, belt[i].val);
end;
end;
Except that it is more efficient (less space and cpu-time) especially
when b has many elements.
Notice the assumptions on the keys and values in b -- they must be
in an ancestor of a's pool. In practice b and a are usually from
the same pool.
}
const
AP_OVERLAP_TABLES_SET = (0);
AP_OVERLAP_TABLES_MERGE = (1);
procedure ap_overlap_tables(a: Ptable; const b: Ptable; flags: cuint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ XXX: these know about the definition of struct table in alloc.c. That
* definition is not here because it is supposed to be private, and by not
* placing it here we are able to get compile-time diagnostics from modules
* written which assume that a table is the same as an array_header. -djg
}
//#define ap_table_elts(t) ((array_header *)(t))
//#define ap_is_empty_table(t) (((t) == NULL)||(((array_header *)(t))->nelts == 0))
{ routines to remember allocation of other sorts of things...
* generic interface first. Note that we want to have two separate
* cleanup functions in the general case, one for exec() preparation,
* to keep CGI scripts and the like from inheriting access to things
* they shouldn't be able to touch, and one for actually cleaning up,
* when the actual server process wants to get rid of the thing,
* whatever it is.
*
* kill_cleanup disarms a cleanup, presumably because the resource in
* question has been closed, freed, or whatever, and it's scarce
* enough to want to reclaim (e.g., descriptors). It arranges for the
* resource not to be cleaned up a second time (it might have been
* reallocated). run_cleanup does the same, but runs it first.
*
* Cleanups are identified for purposes of finding & running them off by the
* plain_cleanup and data, which should presumably be unique.
*
* NB any code which invokes register_cleanup or kill_cleanup directly
* is a critical section which should be guarded by block_alarms() and
* unblock_alarms() below...
*
* ap_register_cleanup_ex provided to allow for an optional "cleanup"
* to be run at call-time for things like setting CLOSEXEC flags
* on fd's or whatever else may make sense.
}
//API_EXPORT(void) ap_register_cleanup(pool *p, void *data,
// void (*plain_cleanup) (void *),
// void (*child_cleanup) (void *));
//API_EXPORT(void) ap_register_cleanup_ex(pool *p, void *data,
// void (*plain_cleanup) (void *),
// void (*child_cleanup) (void *),
// int (*magic_cleanup) (void *));
//API_EXPORT(void) ap_kill_cleanup(pool *p, void *data, void (*plain_cleanup) (void *));
//API_EXPORT(void) ap_run_cleanup(pool *p, void *data, void (*cleanup) (void *));
{ A "do-nothing" cleanup, for register_cleanup; it's faster to do
* things this way than to test for NULL. }
//API_EXPORT_NONSTD(void) ap_null_cleanup(void *data);
{ The time between when a resource is actually allocated, and when it
* its cleanup is registered is a critical section, during which the
* resource could leak if we got interrupted or timed out. So, anything
* which registers cleanups should bracket resource allocation and the
* cleanup registry with these. (This is done internally by run_cleanup).
*
* NB they are actually implemented in http_main.c, since they are bound
* up with timeout handling in general...
}
procedure ap_block_alarms;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_unblock_alarms;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Common cases which want utility support..
* the note_cleanups_for_foo routines are for
}
{API_EXPORT(FILE *) ap_pfopen(struct pool *, const char *name, const char *fmode);
API_EXPORT(FILE *) ap_pfdopen(struct pool *, int fd, const char *fmode);}
function ap_popenf(p1: Ppool; const name: PChar; flg, mode: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_popenf_ex(p1: Ppool; const name: PChar; flg, mode, domagic: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{API_EXPORT(void) ap_note_cleanups_for_file(pool *, FILE *);
API_EXPORT(void) ap_note_cleanups_for_file_ex(pool *, FILE *, int);}
procedure ap_note_cleanups_for_fd(p1: Ppool; p2: cint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_note_cleanups_for_fd_ex(p1: Ppool; p2, p3: cint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{$ifdef WIN32}
//API_EXPORT(void) ap_note_cleanups_for_h(pool *, HANDLE);
{$endif}
procedure ap_kill_cleanups_for_fd(p: Ppool; fd: cint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_note_cleanups_for_socket(p1: Ppool; p2: cint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_note_cleanups_for_socket_ex(p1: Ppool; p2, p3: cint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_kill_cleanups_for_socket(p: Ppool; sock: cint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_psocket(p: Ppool; p2, p3, p4: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_psocket_ex(p: Ppool; p2, p3, p4, p5: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_pclosesocket(a: Ppool; sock: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_pregcomp(p: Ppool; const pattern: PChar; cflags: cint): Pregex_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_pregfree(p: Ppool; reg: Pregex_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ routines to note closes... file descriptors are constrained enough
* on some systems that we want to support this.
}
//API_EXPORT(int) ap_pfclose(struct pool *, FILE *);
function ap_pclosef(p1: Ppool; fd: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{$ifdef WIN32}
//API_EXPORT(int) ap_pcloseh(struct pool *, HANDLE hDevice);
{$endif}
{ routines to deal with directories }
function ap_popendir(p: Ppool; const name: PChar): PDIR;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_pclosedir(p: Ppool; d: PDIR);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ ... even child processes (which we may want to wait for,
* or to kill outright, on unexpected termination).
*
* ap_spawn_child is a utility routine which handles an awful lot of
* the rigamarole associated with spawning a child --- it arranges
* for pipes to the child's stdin and stdout, if desired (if not,
* set the associated args to NULL). It takes as args a function
* to call in the child, and an argument to be passed to the function.
}
type
kill_conditions = (
kill_never, { process is never sent any signals }
kill_always, { process is sent SIGKILL on pool cleanup }
kill_after_timeout, { SIGTERM, wait 3 seconds, SIGKILL }
just_wait, { wait forever for the process to complete }
kill_only_once { send SIGTERM and then wait }
);
procedure ap_note_subprocess(a: Ppool; pid: pid_t; how: kill_conditions);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{API_EXPORT(int) ap_spawn_child(pool *, int (*)(void *, child_info *),
void *, enum kill_conditions,
FILE **pipe_in, FILE **pipe_out,
FILE **pipe_err);
int ap_close_fd_on_exec(int fd);}
{ magic numbers --- min free bytes to consider a free pool block useable,
* and the min amount to allocate if we have to go to malloc() }
const
BLOCK_MINFREE = 4096;
BLOCK_MINALLOC = 8192;
{ Finally, some accounting }
function ap_bytes_in_pool(p: PPool): culong;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_bytes_in_free_blocks: culong;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;

File diff suppressed because it is too large Load Diff

View File

@ -1,237 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* MODULE_MAGIC_NUMBER_MAJOR
* Major API changes that could cause compatibility problems for older modules
* such as structure size changes. No binary compatibility is possible across
* a change in the major version.
*
* MODULE_MAGIC_NUMBER_MINOR
* Minor API changes that do not cause binary compatibility problems.
* Should be reset to 0 when upgrading MODULE_MAGIC_NUMBER_MAJOR.
*
* See the MODULE_MAGIC_AT_LEAST macro below for an example.
}
{
* 19950525 - original value
* 19960512 (1.1b2) - updated, 1.1, version.
* 19960526 (1.1b3) - get_token(), table_unset(), pstrndup()
* functions added
* 19960725 (1.2-dev) - HTTP/1.1 compliance
* (new version of read_client_block)
* 19960806 (1.2-dev) - scan_script_header_err() added
* 19961007 (1.2-dev) - replace read_client_block() with get_client_block()
* 19961125 (1.2b1) - change setup_client_block() to Roy's version
* 19961211 (1.2b3) - rwrite() added
* 19970103 (1.2b5-dev) - header parse API
* 19970427 (1.2b9-dev) - port references made unsigned
* 19970526 (1.2) - correct vhost walk for multiple requests on a single
* connect
* 19970623 (1.3-dev) - NT changes
* 19970628 (1.3-dev) - ap_slack (fd fixes) added
* 19970717 (1.3-dev) - child_init API hook added
* 19970719 (1.3-dev) - discard_request_body() added (to clear the decks
* as needed)
* 19970728 (1.3a2-dev) - child_exit API hook added
* 19970818 (1.3a2-dev) - post read-request phase added
* 19970825 (1.3a2-dev) - r->mtime cell added
* 19970831 (1.3a2-dev) - error logging changed to use aplog_error()
* 19970902 (1.3a2-dev) - MD5 routines and structures renamed to ap_*
* 19970912 (1.3b1-dev) - set_last_modified split into set_last_modified,
* set_etag and meets_conditions
* register_other_child API
* piped_log API
* short_score split into parent and child pieces
* os_is_absolute_path
* 19971026 (1.3b3-dev) - custom config hooks in place
* 19980126 (1.3b4-dev) - ap_cpystrn(), table_addn(), table_setn(),
* table_mergen()
* 19980201 (1.3b4-dev) - construct_url()
* prototype server_rec * -> request_rec *
* add get_server_name() and get_server_port()
* 19980207 (1.3b4-dev) - add dynamic_load_handle to module structure as part
* of the STANDARD_MODULE_STUFF header
* 19980304 (1.3b6-dev) - abstraction of SERVER_BUILT and SERVER_VERSION
* 19980305 (1.3b6-dev) - ap_config.h added for use by external modules
* 19980312 (1.3b6-dev) - parse_uri_components() and its ilk
* remove r->hostlen, add r->unparsed_uri
* set_string_slot_lower()
* clarification: non-RAW_ARGS cmd handlers do not
* need to pstrdup() their arguments
* clarification: request_rec members content_type,
* handler, content_encoding, content_language,
* content_languages MUST all be lowercase strings,
* and MAY NOT be modified in place -- modifications
* require pstrdup().
* 19980317 (1.3b6-dev) - CORE_EXPORTs for win32 and <Perl>
* API export basic_http_header, send_header_field,
* set_keepalive, srm_command_loop, check_cmd_context,
* tm2sec
* spacetoplus(), plustospace(), client_to_stdout()
* removed
* 19980324 (1.3b6-dev) - API_EXPORT(index_of_response)
* 19980413 (1.3b6-dev) - The BIG SYMBOL RENAMING: general ap_ prefix
* (see src/include/compat.h for more details)
* ap_vformatter() API, see src/include/ap.h
* 19980507 (1.3b7-dev) - addition of ap_add_version_component() and
* discontinuation of -DSERVER_SUBVERSION support
* 19980519 (1.3b7-dev) - add child_info * to spawn function (as passed to
* ap_spawn_child_err_buff) and to ap_call_exec to make
* children work correctly on Win32.
* 19980527 (1.3b8-dev) - renamed some more functions to ap_ prefix which were
* missed at the big renaming (they are defines):
* is_default_port, default_port and http_method.
* A new communication method for modules was added:
* they can create customized error messages under the
* "error-notes" key in the request_rec->notes table.
* This string will be printed in place of the canned
* error responses, and will be propagated to
* ErrorDocuments or cgi scripts in the
* (REDIRECT_)ERROR_NOTES variable.
* 19980627 (1.3.1-dev) - More renaming that we forgot/bypassed. In particular:
* table_elts --> ap_table_elts
* is_table_empty --> ap_is_table_empty
* 19980708 (1.3.1-dev) - ap_isalnum(), ap_isalpha(), ... "8-bit safe" ctype
* macros and apctype.h added
* 19980713 (1.3.1-dev) - renaming of C header files:
* 1. conf.h -> ap_config.h
* 2. conf_auto.h -> ap_config_auto.h - now merged
* 3. ap_config.h -> ap_config_auto.h - now merged
* 4. compat.h -> ap_compat.h
* 5. apctype.h -> ap_ctype.h
* 19980806 (1.3.2-dev) - add ap_log_rerror()
* - add ap_scan_script_header_err_core()
* - add ap_uuencode()
* - add ap_custom_response()
* 19980811 (1.3.2-dev) - added limit_req_line, limit_req_fieldsize, and
* limit_req_fields to server_rec.
* added limit_req_body to core_dir_config and
* ap_get_limit_req_body() to get its value.
* 19980812 (1.3.2-dev) - split off MODULE_MAGIC_NUMBER
* 19980812.2 - add ap_overlap_tables()
* 19980816 (1.3.2-dev) - change proxy to use tables for headers, change
* struct cache_req to typedef cache_req.
* Delete ap_proxy_get_header(), ap_proxy_add_header(),
* ap_proxy_del_header(). Change interface of
* ap_proxy_send_fb() and ap_proxy_cache_error().
* Add ap_proxy_send_hdr_line() and ap_proxy_bputs2().
* 19980825 (1.3.2-dev) - renamed is_HTTP_xxx() macros to ap_is_HTTP_xxx()
* 19980825.1 - mod_proxy only (minor change): modified interface of
* ap_proxy_read_headers() and rdcache() to use a
* request_rec* instead of pool*
* (for implementing better error reporting).
* 19980906 (1.3.2-dev) - added ap_md5_binary()
* 19980917 (1.3.2-dev) - bs2000: changed os_set_authfile() to os_set_account()
* 19981108 (1.3.4-dev) - added ap_method_number_of()
* - changed value of M_INVALID and added WebDAV methods
* 19981108.1 - ap_exists_config_define() is now public (minor bump)
* 19981204 - scoreboard changes -- added generation, changed
* exit_generation to running_generation. Somewhere
* earlier vhostrec was added, but it's only safe to use
* as of this rev. See scoreboard.h for documentation.
* 19981211 - DSO changes -- added ap_single_module_configure()
* -- added ap_single_module_init()
* 19981229 - mod_negotiation overhaul -- added ap_make_etag()
* and added vlist_validator to request_rec.
* 19990101 - renamed macro escape_uri() to ap_escape_uri()
* - added MODULE_MAGIC_COOKIE to identify module structs
* 19990103 (1.3.4-dev) - added ap_array_pstrcat()
* 19990105 (1.3.4-dev) - added ap_os_is_filename_valid()
* 19990106 (1.3.4-dev) - Move MODULE_MAGIC_COOKIE to the end of the
* STANDARD_MODULE_STUFF macro so the version
* numbers and file name remain at invariant offsets
* 19990108 (1.3.4-dev) - status_drops_connection -> ap_status_drops_connection
* scan_script_header -> ap_scan_script_header_err
* - reordered entries in request_rec that were waiting
* for a non-binary-compatible release.
* (1.3.5-dev)
* 19990108.1 - add ap_MD5Encode() for MD5 password handling.
* 19990108.2 - add ap_validate_password() and change ap_MD5Encode()
* to use a stronger algorithm.
* 19990108.4 - add ap_size_list_item(), ap_get_list_item(), and
* ap_find_list_item()
* 19990108.5 - added ap_sub_req_method_uri() and added const to the
* definition of method in request_rec.
* 19990108.6 - SIGPIPE is now ignored by the core server.
* 19990108.7 - ap_isxdigit added
* 19990320 - METHODS and M_INVALID symbol values modified
* 19990320.1 - add ap_vrprintf()
* 19990320.2 - add cmd_parms.context, ap_set_config_vectors,
* export ap_add_file_conf
* 19990320.3 - add ap_regexec() and ap_regerror()
* 19990320.4 - add ap_field_noparam()
* 19990320.5 - add local_ip/host to conn_rec for mass-vhost
* 19990320.6 - add ap_SHA1Final(), ap_SHA1Init(),
* ap_SHA1Update_binary(), ap_SHA1Update(),
* ap_base64encode(), ap_base64encode_binary(),
* ap_base64encode_len(), ap_base64decode(),
* ap_base64decode_binary(), ap_base64decode_len(),
* ap_pbase64decode(), ap_pbase64encode()
* 19990320.7 - add ap_strcasestr()
* 19990320.8 - add request_rec.case_preserved_filename
* 19990320.9 - renamed alloc.h to ap_alloc.h
* 19990320.10 - add ap_is_rdirectory() and ap_stripprefix()
* 19990320.11 - Add a couple of fields, callback_data and
* filter_callback to the end of buff.h
* 19990320.11 - Add some fields to the end of the core_dir_config
* structure
* 19990320.12 - add ap_getline(), ap_get_chunk_size()
* 19990320.13 - add ap_strtol()
* 19990320.14 - add ap_register_cleanup_ex(),
* ap_note_cleanups_for_fd_ex(),
* ap_note_cleanups_for_socket_ex(),
* ap_note_cleanups_for_file_ex(),
* ap_popenf_ex() and ap_psocket_ex().
* 19990320.15 - ap_is_recursion_limit_exceeded()
* 19990320.16 - ap_escape_errorlog_item()
* 19990320.17 - ap_auth_nonce() and ap_auth_nonce added
* in core_dir_config.
* 19990320.18 - trace_enable member added to core server_config
}
const
MODULE_MAGIC_COOKIE = $41503133; { "AP13" }
MODULE_MAGIC_NUMBER_MAJOR = 19990320;
MODULE_MAGIC_NUMBER_MINOR = 18; { 0...n }
{ Useful for testing for features. }
{#define AP_MODULE_MAGIC_AT_LEAST(major,minor) \
((major) < MODULE_MAGIC_NUMBER_MAJOR \
|| ((major) == MODULE_MAGIC_NUMBER_MAJOR \
&& (minor) <= MODULE_MAGIC_NUMBER_MINOR))}
{
* For example, suppose you wish to use the ap_overlap_tables
* function. You can do this:
*
* #if AP_MODULE_MAGIC_AT_LEAST(19980812,2)
* ... use ap_overlap_tables()
* #else
* ... alternative code which doesn't use ap_overlap_tables()
* #endif
*
}
{ deprecated. present for backwards compatibility }
MODULE_MAGIC_NUMBER = MODULE_MAGIC_NUMBER_MAJOR;
//#define MODULE_MAGIC_AT_LEAST old_broken_macro_we_hope_you_are_not_using

View File

@ -1,234 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{$ifdef B_SFIO}
#include "sfio.h"
{$endif}
//#include <stdarg.h>
const
{ Reading is buffered }
B_RD = (1);
{ Writing is buffered }
B_WR = (2);
B_RDWR = (3);
{ At end of file, or closed stream; no further input allowed }
B_EOF = (4);
{ No further output possible }
B_EOUT = (8);
{ A read error has occurred }
B_RDERR =(16);
{ A write error has occurred }
B_WRERR =(32);
//#ifdef B_ERROR { in SVR4: sometimes defined in /usr/include/sys/buf.h }
//#undef B_ERROR
//#endif
B_ERROR =(48);
{ Use chunked writing }
B_CHUNK =(64);
{ bflush() if a read would block }
B_SAFEREAD =(128);
{ buffer is a socket }
B_SOCKET =(256);
{$ifdef CHARSET_EBCDIC}
B_ASCII2EBCDIC = $40000000; { Enable conversion for this buffer }
B_EBCDIC2ASCII = $80000000; { Enable conversion for this buffer }
{$endif} {CHARSET_EBCDIC}
type
Pbuff_struct = ^buff_struct;
PBUFF = Pbuff_struct;
PPBUFF = ^PBUFF;
error_t = procedure (fb: PBUFF; op: cint; data: Pointer);
filter_callback_t = procedure (param1: PBUFF; const param2: Pointer; param3: cint);
buff_struct = record
flags: cint; { flags }
inptr: PChar; { pointer to next location to read }
incnt: cint; { number of bytes left to read from input buffer;
* always 0 if had a read error }
outchunk: cint; { location of chunk header when chunking }
outcnt: cint; { number of byte put in output buffer }
inbase: PChar;
outbase: PChar;
bufsiz: cint;
error: error_t;
error_data: PChar;
bytes_sent: clong; { number of bytes actually written }
pool: Pap_pool;
{ could also put pointers to the basic I/O routines here }
fd: cint; { the file descriptor }
fd_in: cint; { input file descriptor, if different }
{$ifdef WIN32}
hFH: HANDLE; { Windows filehandle }
{$endif}
{ transport handle, for RPC binding handle or some such }
t_handle: PChar;
{$ifdef B_SFIO}
sf_in: PSfio_t;
sf_out: PSfio_t;
{$endif}
callback_data: Pointer;
filter_callback: filter_callback_t;
end;
{$ifdef B_SFIO}
apache_sfio = record
disc: Sfdisc_t;
buff: PBUFF;
end;
extern Sfdisc_t *bsfio_new(pool *p, BUFF *b);
{$endif}
{ Options to bset/getopt }
const
BO_BYTECT = (1);
{ Stream creation and modification }
function ap_bcreate(p: PPool; flags: cint): PBUFF;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_bpushfd(fb: PBUFF; fd_in, fd_out: cint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{$ifdef WIN32}
procedure ap_bpushh(fb: PBUFF; hFH: HANDLE);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{$endif}
function ap_bsetopt(fb: PBUFF; optname: cint; const optval: Pointer): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_bgetopt(fb: PBUFF; optname: cint; optval: Pointer): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_bsetflag(fb: PBUFF; flag, value: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_bclose(fb: PBUFF): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
//#define ap_bgetflag(fb, flag) ((fb)->flags & (flag))
{ Error handling }
procedure ap_bonerror(fb: PBUFF; error: error_t; data: Pointer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ I/O }
function ap_bread(fb: PBUFF; buf: Pointer; nbyte: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{API_EXPORT(int) ap_bgets(char *s, int n, BUFF *fb);
API_EXPORT(int) ap_blookc(char *buff, BUFF *fb);
API_EXPORT(int) ap_bskiplf(BUFF *fb);
API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte);
API_EXPORT(int) ap_bflush(BUFF *fb);
API_EXPORT(int) ap_bputs(const char *x, BUFF *fb);
API_EXPORT_NONSTD(int) ap_bvputs(BUFF *fb,...);
API_EXPORT_NONSTD(int) ap_bprintf(BUFF *fb, const char *fmt,...)
__attribute__((format(printf,2,3)));
API_EXPORT(int) ap_vbprintf(BUFF *fb, const char *fmt, va_list vlist);
}
{ Internal routines }
{API_EXPORT(int) ap_bflsbuf(int c, BUFF *fb);
API_EXPORT(int) ap_bfilbuf(BUFF *fb);
#ifndef CHARSET_EBCDIC
#define ap_bgetc(fb) ( ((fb)->incnt == 0) ? ap_bfilbuf(fb) : \
((fb)->incnt--, *((fb)->inptr++)) )
#define ap_bputc(c, fb) ((((fb)->flags & (B_EOUT|B_WRERR|B_WR)) != B_WR || \
(fb)->outcnt == (fb)->bufsiz) ? ap_bflsbuf(c, (fb)) : \
((fb)->outbase[(fb)->outcnt++] = (c), 0))
#else} {CHARSET_EBCDIC}
{
#define ap_bgetc(fb) ( ((fb)->incnt == 0) ? ap_bfilbuf(fb) : \
((fb)->incnt--, (fb->flags & B_ASCII2EBCDIC)\
?os_toebcdic[(unsigned char)*((fb)->inptr++)]:*((fb)->inptr++)) )
#define ap_bputc(c, fb) ((((fb)->flags & (B_EOUT|B_WRERR|B_WR)) != B_WR || \
(fb)->outcnt == (fb)->bufsiz) ? ap_bflsbuf(c, (fb)) : \
((fb)->outbase[(fb)->outcnt++] = (fb->flags & B_EBCDIC2ASCII)\
?os_toascii[(unsigned char)c]:(c), 0))
#endif} {CHARSET_EBCDIC}
type
child_info = record
{$ifdef WIN32}
{
* These handles are used by ap_call_exec to call
* create process with pipe handles.
}
hPipeInputRead: HANDLE;
hPipeOutputWrite: HANDLE;
hPipeErrorWrite: HANDLE;
{$else}
{
* We need to put a dummy member in here to avoid compilation
* errors under certain Unix compilers, like SGI's and HPUX's,
* which fail to compile a zero-sized struct. Of course
* it would be much nicer if there was actually a use for this
* structure under Unix. Aah the joys of x-platform code.
}
dummy: cint;
{$endif}
end;
Pchild_info = ^child_info;
func_t = function (param1: Pointer; param2: Pchild_info): cint;
function ap_bspawn_child(p: PPool;
func: func_t; data: Pointer; kill_how: kill_conditions; pipe_in, pipe_out, pipe_err: PPBUFF): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ enable non-blocking operations }
function ap_bnonblock(fb: PBUFF; direction: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ and get an fd to select() on }
function ap_bfileno(fb: PBUFF; direction: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ bflush() if a read now would block, but don't actually read anything }
procedure ap_bhalfduplex(fb: PBUFF);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{$if defined(WIN32) or defined(NETWARE) or defined(CYGWIN_WINSOCK)}
{ ap_recvwithtimeout/ap_sendwithtimeout socket primitives for WinSock }
//API_EXPORT(int) ap_sendwithtimeout(int sock, const char *buf, int len, int flags);
//API_EXPORT(int) ap_recvwithtimeout(int sock, char *buf, int len, int flags);
{$endif}

View File

@ -1,97 +0,0 @@
{ DON'T EVEN THINK ABOUT EDITING THIS, go see regex/Makefile,
* search for mkh }
{ ========= begin header generated by ./mkh ========= }
{ === regex2.h === }
{#ifndef API_EXPORT
#ifdef WIN32
#define API_EXPORT(type) __declspec(dllexport) type __stdcall
#else
#define API_EXPORT(type) type
#endif
#endif}
{#if defined(MAC_OS) || defined(MAC_OS_X_SERVER) || (defined(DARWIN) && defined(__DYNAMIC__))
#define ap_private_extern __private_extern__
#else
#define ap_private_extern
#endif}
type
regoff_t = Integer;
// off_t = regoff_t;
Pregex_t = ^regex_t;
Pre_guts = Pointer;
regex_t = record
re_magic: cint;
re_nsub: size_t; { number of parenthesized subexpressions }
re_endp: PChar; { end pointer for REG_PEND }
re_g: Pre_guts; { none of your business :-) }
end;
regmatch_t = record
rm_so: regoff_t; { start of match }
rm_eo: regoff_t; { end of match }
end;
{ === regcomp.c === }
//API_EXPORT(int) regcomp(regex_t *, const char *, int);
const
REG_BASIC = 0000;
REG_EXTENDED = 0001;
REG_ICASE = 0002;
REG_NOSUB = 0004;
REG_NEWLINE = 0010;
REG_NOSPEC = 0020;
REG_PEND = 0040;
REG_DUMP = 0200;
{ === regerror.c === }
REG_NOMATCH = 1;
REG_BADPAT = 2;
REG_ECOLLATE = 3;
REG_ECTYPE = 4;
REG_EESCAPE = 5;
REG_ESUBREG = 6;
REG_EBRACK = 7;
REG_EPAREN = 8;
REG_EBRACE = 9;
REG_BADBR =10;
REG_ERANGE =11;
REG_ESPACE =12;
REG_BADRPT =13;
REG_EMPTY =14;
REG_ASSERT =15;
REG_INVARG =16;
REG_ATOI =255; { convert name to number (!) }
REG_ITOA =0400; { convert number to name (!) }
//API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
{ === regexec.c === }
//API_EXPORT(int) regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
const
REG_NOTBOL = 00001;
REG_NOTEOL = 00002;
REG_STARTEND = 00004;
REG_TRACE = 00400; { tracing of execution }
REG_LARGE = 01000; { force large representation }
REG_BACKR = 02000; { force use of backref code }
{ === regfree.c === }
//API_EXPORT(void) regfree(regex_t *);
{ ========= end header generated by ./mkh ========= }

View File

@ -1,402 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* The central data structures around here...
}
{ Command dispatch structures... }
{ Note that for all of these except RAW_ARGS, the config routine is
* passed a freshly allocated string which can be modified or stored
* or whatever... it's only necessary to do pstrdup() stuff with
* RAW_ARGS.
}
type
cmd_how = (
RAW_ARGS, { cmd_func parses command line itself }
TAKE1, { one argument only }
TAKE2, { two arguments only }
ITERATE, { one argument, occuring multiple times
* (e.g., IndexIgnore)
}
ITERATE2, { two arguments, 2nd occurs multiple times
* (e.g., AddIcon)
}
FLAG, { One of 'On' or 'Off' }
NO_ARGS, { No args at all, e.g. </Directory> }
TAKE12, { one or two arguments }
TAKE3, { three arguments only }
TAKE23, { two or three arguments }
TAKE123, { one, two or three arguments }
TAKE13 { one or three arguments }
);
cs_func_t = function (): PChar;
command_struct = record
name: PChar; { Name of this command }
func: cs_func_t; { Function invoked }
cmd_data: Pointer; { Extra data, for functions which
* implement multiple commands...
}
req_override: cint; { What overrides need to be allowed to
* enable this command.
}
args_how: cmd_how; { What the command expects as arguments }
errmsg: PChar; { 'usage' message, in case of syntax errors }
end;
command_rec = command_struct;
Pcommand_rec = ^command_rec;
{ The allowed locations for a configuration directive are the union of
* those indicated by each set bit in the req_override mask.
*
* (req_override & RSRC_CONF) => *.conf outside <Directory> or <Location>
* (req_override & ACCESS_CONF) => *.conf inside <Directory> or <Location>
* (req_override & OR_AUTHCFG) => *.conf inside <Directory> or <Location>
* and .htaccess when AllowOverride AuthConfig
* (req_override & OR_LIMIT) => *.conf inside <Directory> or <Location>
* and .htaccess when AllowOverride Limit
* (req_override & OR_OPTIONS) => *.conf anywhere
* and .htaccess when AllowOverride Options
* (req_override & OR_FILEINFO) => *.conf anywhere
* and .htaccess when AllowOverride FileInfo
* (req_override & OR_INDEXES) => *.conf anywhere
* and .htaccess when AllowOverride Indexes
}
const
OR_NONE = 0;
OR_LIMIT = 1;
OR_OPTIONS = 2;
OR_FILEINFO = 4;
OR_AUTHCFG = 8;
OR_INDEXES = 16;
OR_UNSET = 32;
ACCESS_CONF = 64;
RSRC_CONF = 128;
OR_ALL = (OR_LIMIT or OR_OPTIONS or OR_FILEINFO or OR_AUTHCFG or OR_INDEXES);
{ This can be returned by a function if they don't wish to handle
* a command. Make it something not likely someone will actually use
* as an error code.
}
DECLINE_CMD = '\a\b';
{
* This structure is passed to a command which is being invoked,
* to carry a large variety of miscellaneous data which is all of
* use to *somebody*...
}
type
cmd_parms = record
info: Pointer; { Argument to command from cmd_table }
override: cint; { Which allow-override bits are set }
limited: cint; { Which methods are <Limit>ed }
config_file: Pconfigfile_t; { Config file structure from pcfg_openfile() }
pool: Pap_pool; { Pool to allocate new storage in }
temp_pool: Ppool; { Pool for scratch memory; persists during
* configuration, but wiped before the first
* request is served...
}
server: Pserver_rec; { Server_rec being configured for }
path: PChar; { If configuring for a directory,
* pathname of that directory.
* NOPE! That's what it meant previous to the
* existance of <Files>, <Location> and regex
* matching. Now the only usefulness that can
* be derived from this field is whether a command
* is being called in a server context (path == NULL)
* or being called in a dir context (path != NULL).
}
cmd: Pcommand_rec; { configuration command }
end_token: PChar; { end token required to end a nested section }
context: Pointer; { per_dir_config vector passed
* to handle_command }
end;
{ This structure records the existence of handlers in a module... }
handler_t = function (param1: Prequest_rec): Integer; cdecl;
Phandler_rec = ^handler_rec;
handler_rec = record
content_type: PChar; { MUST be all lower case }
handler: handler_t;
end;
{
* Module structures. Just about everything is dispatched through
* these, directly or indirectly (through the command and handler
* tables).
}
Pmodule_struct = ^module_struct;
{$ifdef ULTRIX_BRAIN_DEATH}
init_t = procedure (); cdecl;
create_dir_config_t = function (): Pointer; cdecl;
merge_dir_config_t = function (): Pointer; cdecl;
create_server_config_t = function (): Pointer; cdecl;
merge_server_config_t = function (): Pointer; cdecl;
{$else}
init_t = procedure (param1: Pserver_rec; param2: Ppool); cdecl;
create_dir_config_t = function (p: Ppool; dir: PChar): Pointer; cdecl;
merge_dir_config_t = function (p: PPool; base_conf, new_conf: Pointer): Pointer; cdecl;
create_server_config_t = function (p: Ppool; s: Pserver_rec): Pointer; cdecl;
merge_server_config_t = function (p: Ppool; base_conf, new_conf: Pointer): Pointer; cdecl;
{$endif}
hook_t = function (param1: Prequest_rec): cint; cdecl;
{$ifdef ULTRIX_BRAIN_DEATH}
child_init_t = procedure ();
child_exit_t = procedure ();
{$else}
child_init_t = procedure (param1: Pserver_rec; param2: Ppool); cdecl;
child_exit_t = procedure (param1: Pserver_rec; param2: Ppool); cdecl;
{$endif}
module_struct = record
version: cint; { API version, *not* module version;
* check that module is compatible with this
* version of the server.
}
minor_version: cint; { API minor version. Provides API feature
* milestones. Not checked during module init
}
module_index: cint; { Index to this modules structures in
* config vectors.
}
name: PChar;
dynamic_load_handle: Pointer;
next: Pmodule_struct;
magic: culong; { Magic Cookie to identify a module structure;
* It's mainly important for the DSO facility
* (see also mod_so).
}
{ init() occurs after config parsing, but before any children are
* forked.
* Modules should not rely on the order in which create_server_config
* and create_dir_config are called.
}
init: init_t;
create_dir_config: create_dir_config_t;
merge_dir_config: merge_dir_config_t;
create_server_config: create_server_config_t;
merge_server_config: merge_server_config_t;
cmds: Pcommand_rec;
handlers: Phandler_rec;
{ Hooks for getting into the middle of server ops...
* translate_handler --- translate URI to filename
* access_checker --- check access by host address, etc. All of these
* run; if all decline, that's still OK.
* check_user_id --- get and validate user id from the HTTP request
* auth_checker --- see if the user (from check_user_id) is OK *here*.
* If all of *these* decline, the request is rejected
* (as a SERVER_ERROR, since the module which was
* supposed to handle this was configured wrong).
* type_checker --- Determine MIME type of the requested entity;
* sets content_type, _encoding and _language fields.
* logger --- log a transaction.
* post_read_request --- run right after read_request or internal_redirect,
* and not run during any subrequests.
}
translate_handler: hook_t;
ap_check_user_id: hook_t;
auth_checker: hook_t;
access_checker: hook_t;
type_checker: hook_t;
fixer_upper: hook_t;
logger: hook_t;
header_parser: hook_t;
{ Regardless of the model the server uses for managing "units of
* execution", i.e. multi-process, multi-threaded, hybrids of those,
* there is the concept of a "heavy weight process". That is, a
* process with its own memory space, file spaces, etc. This method,
* child_init, is called once for each heavy-weight process before
* any requests are served. Note that no provision is made yet for
* initialization per light-weight process (i.e. thread). The
* parameters passed here are the same as those passed to the global
* init method above.
}
child_init: child_init_t;
child_exit: child_exit_t;
post_read_request: hook_t;
end;
module = module_struct;
Pmodule = ^module;
{ Initializer for the first few module slots, which are only
* really set up once we start running. Note that the first two slots
* provide a version check; this should allow us to deal with changes to
* the API. The major number should reflect changes to the API handler table
* itself or removal of functionality. The minor number should reflect
* additions of functionality to the existing API. (the server can detect
* an old-format module, and either handle it back-compatibly, or at least
* signal an error). See src/include/ap_mmn.h for MMN version history.
}
procedure STANDARD_MODULE_STUFF(var mod_: module);
{ Generic accessors for other modules to get at their own module-specific
* data
}
{API_EXPORT(void *) ap_get_module_config(void *conf_vector, module *m);
API_EXPORT(void) ap_set_module_config(void *conf_vector, module *m, void *val);
#define ap_get_module_config(v,m) \
(((void **)(v))[(m)->module_index])
#define ap_set_module_config(v,m,val) \
((((void **)(v))[(m)->module_index]) = (val))}
{ Generic command handling function... }
{API_EXPORT_NONSTD(const char *) ap_set_string_slot(cmd_parms *, char *, char *);
API_EXPORT_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *, char *, char *);
API_EXPORT_NONSTD(const char *) ap_set_flag_slot(cmd_parms *, char *, int);
API_EXPORT_NONSTD(const char *) ap_set_file_slot(cmd_parms *, char *, char *);}
{ For modules which need to read config files, open logs, etc. ...
* this returns the fname argument if it begins with '/'; otherwise
* it relativizes it wrt server_root.
}
//API_EXPORT(char *) ap_server_root_relative(pool *p, char *fname);
{ Finally, the hook for dynamically loading modules in... }
procedure ap_add_module(m: Pmodule);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_remove_module(m: Pmodule);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_add_loaded_module(m: Pmodule);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_add_named_module(const name: PChar): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_clear_module_list();
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_find_module_name(m: Pmodule): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_find_linked_module(const name: PChar): Pmodule;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ for implementing subconfigs and customized config files }
{API_EXPORT(const char *) ap_srm_command_loop(cmd_parms *parms, void *config);
#ifdef CORE_PRIVATE
extern API_VAR_EXPORT module *top_module;
extern module *ap_prelinked_modules[];
extern module *ap_preloaded_modules[];
extern API_VAR_EXPORT module **ap_loaded_modules;}
{ For mod_so.c... }
//API_EXPORT(void) ap_single_module_configure(pool *p, server_rec *s, module *m);
{ For http_main.c... }
{API_EXPORT(server_rec *) ap_read_config(pool *conf_pool, pool *temp_pool, char *config_name);
API_EXPORT(void) ap_init_modules(pool *p, server_rec *s);
API_EXPORT(void) ap_child_init_modules(pool *p, server_rec *s);
API_EXPORT(void) ap_child_exit_modules(pool *p, server_rec *s);
API_EXPORT(void) ap_setup_prelinked_modules(void);
API_EXPORT(void) ap_show_directives(void);
API_EXPORT(void) ap_show_modules(void);
void ap_cleanup_method_ptrs(void);}
{ For http_request.c... }
{CORE_EXPORT(void *) ap_create_request_config(pool *p);
CORE_EXPORT(void *) ap_create_per_dir_config(pool *p);
CORE_EXPORT(void *) ap_merge_per_dir_configs(pool *p, void *base, void *new);}
{ For http_core.c... (<Directory> command and virtual hosts) }
{CORE_EXPORT(int) ap_parse_htaccess(void **result, request_rec *r, int override,
const char *path, const char *access_name);
CORE_EXPORT(const char *) ap_init_virtual_host(pool *p, const char *hostname,
server_rec *main_server, server_rec **);
CORE_EXPORT(void) ap_process_resource_config(server_rec *s, char *fname, pool *p, pool *ptemp);
}
{ ap_check_cmd_context() definitions: }
//API_EXPORT(const char *) ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden);
{ ap_check_cmd_context(): Forbidden in: }
const
NOT_IN_VIRTUALHOST = $01; { <Virtualhost> }
NOT_IN_LIMIT = $02; { <Limit> }
NOT_IN_DIRECTORY = $04; { <Directory> }
NOT_IN_LOCATION = $08; { <Location> }
NOT_IN_FILES = $10; { <Files> }
NOT_IN_DIR_LOC_FILE = (NOT_IN_DIRECTORY or NOT_IN_LOCATION or NOT_IN_FILES); { <Directory>/<Location>/<Files>}
GLOBAL_ONLY = (NOT_IN_VIRTUALHOST or NOT_IN_LIMIT or NOT_IN_DIR_LOC_FILE);
{ Module-method dispatchers, also for http_request.c }
//API_EXPORT(int) ap_translate_name(request_rec *);
//API_EXPORT(int) ap_check_access(request_rec *); { check access on non-auth basis }
//API_EXPORT(int) ap_check_user_id(request_rec *); { obtain valid username from client auth }
//API_EXPORT(int) ap_check_auth(request_rec *); { check (validated) user is authorized here }
//API_EXPORT(int) ap_find_types(request_rec *); { identify MIME type }
//API_EXPORT(int) ap_run_fixups(request_rec *); { poke around for other metainfo, etc.... }
//API_EXPORT(int) ap_invoke_handler(request_rec *);
//API_EXPORT(int) ap_log_transaction(request_rec *r);
//API_EXPORT(int) ap_header_parse(request_rec *);
//API_EXPORT(int) ap_run_post_read_request(request_rec *);
{ for mod_perl }
//CORE_EXPORT(const command_rec *) ap_find_command(const char *name, const command_rec *cmds);
//CORE_EXPORT(const command_rec *) ap_find_command_in_modules(const char *cmd_name, module **mod);
//CORE_EXPORT(void *) ap_set_config_vectors(cmd_parms *parms, void *config, module *mod);
//CORE_EXPORT(const char *) ap_handle_command(cmd_parms *parms, void *config, const char *l);
//#endif

View File

@ -1,422 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{****************************************************************
*
* The most basic server code is encapsulated in a single module
* known as the core, which is just *barely* functional enough to
* serve documents, though not terribly well.
*
* Largely for NCSA back-compatibility reasons, the core needs to
* make pieces of its config structures available to other modules.
* The accessors are declared here, along with the interpretation
* of one of them (allow_options).
}
const
OPT_NONE = 0;
OPT_INDEXES = 1;
OPT_INCLUDES = 2;
OPT_SYM_LINKS = 4;
OPT_EXECCGI = 8;
OPT_UNSET = 16;
OPT_INCNOEXEC = 32;
OPT_SYM_OWNER = 64;
OPT_MULTI = 128;
OPT_ALL = (OPT_INDEXES or OPT_INCLUDES or OPT_SYM_LINKS or OPT_EXECCGI);
{ options for get_remote_host() }
{ REMOTE_HOST returns the hostname, or NULL if the hostname
* lookup fails. It will force a DNS lookup according to the
* HostnameLookups setting.
}
REMOTE_HOST = (0);
{ REMOTE_NAME returns the hostname, or the dotted quad if the
* hostname lookup fails. It will force a DNS lookup according
* to the HostnameLookups setting.
}
REMOTE_NAME = (1);
{ REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
* never forced.
}
REMOTE_NOLOOKUP = (2);
{ REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
* a double reverse lookup, regardless of the HostnameLookups
* setting. The result is the (double reverse checked) hostname,
* or NULL if any of the lookups fail.
}
REMOTE_DOUBLE_REV = (3);
SATISFY_ALL = 0;
SATISFY_ANY = 1;
SATISFY_NOSPEC = 2;
{ default maximum of internal redirects }
AP_DEFAULT_MAX_INTERNAL_REDIRECTS = 20;
{ default maximum subrequest nesting level }
AP_DEFAULT_MAX_SUBREQ_DEPTH = 20;
function ap_allow_options(r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_allow_overrides(r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_default_type(r: Prequest_rec): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_document_root(r: Prequest_rec): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Don't use this! If your request went
* through a Userdir, or something like
* that, it'll screw you. But it's
* back-compatible...
}
function ap_get_remote_host(conn: Pconn_rec; dir_config: Pointer; type_: cint): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_get_remote_logname(r: Prequest_rec): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Used for constructing self-referencing URLs, and things like SERVER_PORT,
* and SERVER_NAME.
}
function ap_construct_url(p: Ppool; const uri: PChar; r: Prequest_rec): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_get_server_name(r: Prequest_rec): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_get_server_port(const r: Prequest_rec): cuint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_get_limit_req_body(const r: Prequest_rec): culong;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_custom_response(r: Prequest_rec; status: cint; string_: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_exists_config_define(name: PChar): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Check if the current request is beyond the configured max. number of redirects or subrequests
* @param r The current request
* @return true (is exceeded) or false
}
function ap_is_recursion_limit_exceeded(const r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Authentication stuff. This is one of the places where compatibility
* with the old config files *really* hurts; they don't discriminate at
* all between different authentication schemes, meaning that we need
* to maintain common state for all of them in the core, and make it
* available to the other modules through interfaces.
}
type
require_line = record
method_mask: cint;
requirement: PChar;
end;
{API_EXPORT(const char *) ap_auth_type (request_rec *);
API_EXPORT(const char *) ap_auth_name (request_rec *);
API_EXPORT(const char *) ap_auth_nonce (request_rec *);
API_EXPORT(int) ap_satisfies (request_rec *r);
API_EXPORT(const array_header *) ap_requires (request_rec *); }
{$ifdef WIN32}
{
* CGI Script stuff for Win32...
}
type
file_type_e = ( eFileTypeUNKNOWN, eFileTypeBIN, eFileTypeEXE16, eFileTypeEXE32,
eFileTypeSCRIPT, eCommandShell16, eCommandShell32 );
interpreter_source_e = ( INTERPRETER_SOURCE_UNSET, INTERPRETER_SOURCE_REGISTRY,
INTERPRETER_SOURCE_SHEBANG );
function ap_get_win32_interpreter(const param1: Prequest_rec; param2: PPChar): file_type_e;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{$endif}
{.$ifdef CORE_PRIVATE}
{
* Core is also unlike other modules in being implemented in more than
* one file... so, data structures are declared here, even though most of
* the code that cares really is in http_core.c. Also, another accessor.
}
//API_EXPORT(char *) ap_response_code_string (request_rec *r, int error_index);
//extern API_VAR_EXPORT module core_module;
{ Per-directory configuration }
type
allow_options_t = Char;
overrides_t = Char
;
{
* Bits of info that go into making an ETag for a file
* document. Why a long? Because char historically
* proved too short for Options, and int can be different
* sizes on different platforms.
}
etag_components_t = culong;
const
ETAG_UNSET = 0;
ETAG_NONE = (1 shl 0);
ETAG_MTIME = (1 shl 1);
ETAG_INODE = (1 shl 2);
ETAG_SIZE = (1 shl 3);
ETAG_BACKWARD = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
ETAG_ALL = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
{ Things moved up }
HOSTNAME_LOOKUP_OFF = 0;
HOSTNAME_LOOKUP_ON = 1;
HOSTNAME_LOOKUP_DOUBLE= 2;
HOSTNAME_LOOKUP_UNSET = 3;
USE_CANONICAL_NAME_OFF = (0);
USE_CANONICAL_NAME_ON = (1);
USE_CANONICAL_NAME_DNS = (2);
USE_CANONICAL_NAME_UNSET= (3);
ADD_DEFAULT_CHARSET_OFF = (0);
ADD_DEFAULT_CHARSET_ON = (1);
ADD_DEFAULT_CHARSET_UNSET = (2);
{$ifdef CHARSET_EBCDIC}
{ Configurable EBCDIC Conversion stuff }
{ Direction specific conversion: }
dir_Out = 0; { 0utput (returned contents in a GET or POST) }
dir_In = 1; { 1nput (uploaded contents in a PUT / POST) }
{ Conversion Enabled/Disabled: }
conv_Unset = '?'; { Conversion unconfigured }
conv_Off = '0'; { BINARY or ASCII file (no conversion) }
conv_On = '1'; { TEXT file (EBCDIC->ASCII for dir_Out; ASCII->EBCDIC for dir_In) }
LEGACY_KLUDGE = 1; { After a couple of versions this legacy kludge should be set to 0 }
ASCIITEXT_MAGIC_TYPE_PREFIX = 'text/x-ascii-'; { Text files whose content-type starts with this are passed thru unconverted }
{$endif}
type
ap_flag_e = (
AP_FLAG_UNSET = 0,
AP_FLAG_ON = 1,
AP_FLAG_OFF = 2
);
server_signature_t = ( srv_sig_unset, srv_sig_off, srv_sig_on,
srv_sig_withmail);
core_dir_config = record
{ path of the directory/regex/etc. see also d_is_fnmatch below }
d: PChar;
{ the number of slashes in d }
d_components: cuint;
{ If (opts & OPT_UNSET) then no absolute assignment to options has
* been made.
* invariant: (opts_add & opts_remove) == 0
* Which said another way means that the last relative (options + or -)
* assignment made to each bit is recorded in exactly one of opts_add
* or opts_remove.
}
opts: allow_options_t;
opts_add: allow_options_t;
opts_remove: allow_options_t;
override_: overrides_t;
{ MIME typing --- the core doesn't do anything at all with this,
* but it does know what to slap on a request for a document which
* goes untyped by other mechanisms before it slips out the door...
}
ap_default_type: PChar;
{ Authentication stuff. Groan... }
satisfy: cint;
ap_auth_type: PChar;
ap_auth_name: PChar;
ap_requires: Parray_header;
{ Custom response config. These can contain text or a URL to redirect to.
* if response_code_strings is NULL then there are none in the config,
* if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES.
* This lets us do quick merges in merge_core_dir_configs().
}
response_code_strings: PPChar; { from ErrorDocument, not from
* ap_custom_response()
}
{ Hostname resolution etc }
{ Moved Up }
// unsigned int hostname_lookups : 4;
// signed int do_rfc1413 : 2; { See if client is advertising a username? }
// signed int content_md5 : 2; { calculate Content-MD5? }
{ Moved Up }
// unsigned use_canonical_name : 2;
{ since is_fnmatch(conf->d) was being called so frequently in
* directory_walk() and its relatives, this field was created and
* is set to the result of that call.
}
// unsigned d_is_fnmatch : 1;
{ should we force a charset on any outgoing parameterless content-type?
* if so, which charset?
}
{ Moved up }
// unsigned add_default_charset : 2;
add_default_charset_name: PChar;
{ System Resource Control }
{$ifdef RLIMIT_CPU}
limit_cpu: Prlimit;
{$endif}
{$if defined(RLIMIT_DATA) or defined(RLIMIT_VMEM) or defined(RLIMIT_AS)}
limit_mem: Prlimit;
{$endif}
{$ifdef RLIMIT_NPROC}
limit_nproc: Prlimit;
{$endif}
limit_req_body: culong; { limit on bytes in request msg body }
{ logging options }
server_signature: server_signature_t;
loglevel: cint;
{ Access control }
sec: Parray_header;
r: Pregex_t;
{$ifdef WIN32}
{ Where to find interpreter to run scripts }
script_interpreter_source: interpreter_source_e;
{$endif}
{$ifdef CHARSET_EBCDIC}
{ Moved up }
{ The configuration args {On|Off}[={In|Out|InOut}] are currently stored
* as character strings ("0" = conv_Off, "1" = conv_On)
}
ebcdicconversion_by_ext_in: Ptable;
ebcdicconversion_by_ext_out: Ptable;
ebcdicconversion_by_type_in: Ptable;
ebcdicconversion_by_type_out: Ptable;
{ Moved up }
x_ascii_magic_kludge: cint; { whether to handle the text/x-ascii- kludge }
{$ifdef ADD_EBCDICCONVERT_DEBUG_HEADER}
ebcdicconversion_debug_header: cint; { whether to add an X-EBCDIC-Debug-{In,Out} header to the response }
{$endif}
{$endif} { CHARSET_EBCDIC }
{
* What attributes/data should be included in ETag generation?
}
etag_bits: etag_components_t;
etag_add: etag_components_t;
etag_remove: etag_components_t;
{
* Do we allow ISINDEX CGI scripts to pass their query argument as
* direct command line parameters or argv elements?
}
cgi_command_args: ap_flag_e;
{ Digest auth. }
ap_auth_nonce: PChar;
end;
{ Per-server core configuration }
type
core_server_config = record
{$ifdef GPROF}
gprof_dir: PChar;
{$endif}
{ Name translations --- we want the core to be able to do *something*
* so it's at least a minimally functional web server on its own (and
* can be tested that way). But let's keep it to the bare minimum:
}
ap_document_root: PChar;
{ Access control }
access_name: PChar;
sec: Parray_header;
sec_url: Parray_header;
{ recursion backstopper }
recursion_limit_set: cint; { boolean }
redirect_limit: cint; { maximum number of internal redirects }
subreq_limit: cint; { maximum nesting level of subrequests }
{ TRACE control }
trace_enable: cint; { see AP_TRACE_ below }
end;
{ trace_enable options }
const
AP_TRACE_UNSET =-1;
AP_TRACE_DISABLE = 0;
AP_TRACE_ENABLE = 1;
AP_TRACE_EXTENDED = 2;
{ for http_config.c }
//CORE_EXPORT(void) ap_core_reorder_directories(pool *, server_rec *);
{ for mod_perl }
//CORE_EXPORT(void) ap_add_per_dir_conf (server_rec *s, void *dir_config);
//CORE_EXPORT(void) ap_add_per_url_conf (server_rec *s, void *url_config);
//CORE_EXPORT(void) ap_add_file_conf(core_dir_config *conf, void *url_config);
//CORE_EXPORT_NONSTD(const char *) ap_limit_section (cmd_parms *cmd, void *dummy, const char *arg);
{.$endif}

View File

@ -1,126 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{$ifdef HAVE_SYSLOG}
//#include <syslog.h>
APLOG_EMERG = LOG_EMERG; { system is unusable }
APLOG_ALERT = LOG_ALERT; { action must be taken immediately }
APLOG_CRIT = LOG_CRIT; { critical conditions }
APLOG_ERR = LOG_ERR; { error conditions }
APLOG_WARNING = LOG_WARNING; { warning conditions }
APLOG_NOTICE = LOG_NOTICE; { normal but significant condition }
APLOG_INFO = LOG_INFO; { informational }
APLOG_DEBUG = LOG_DEBUG; { debug-level messages }
APLOG_LEVELMASK= LOG_PRIMASK; { mask off the level value }
{$else}
APLOG_EMERG = 0; { system is unusable }
APLOG_ALERT = 1; { action must be taken immediately }
APLOG_CRIT = 2; { critical conditions }
APLOG_ERR = 3; { error conditions }
APLOG_WARNING = 4; { warning conditions }
APLOG_NOTICE = 5; { normal but significant condition }
APLOG_INFO = 6; { informational }
APLOG_DEBUG = 7; { debug-level messages }
APLOG_LEVELMASK= 7; { mask off the level value }
{$endif}
APLOG_NOERRNO = (APLOG_LEVELMASK + 1);
{$ifdef WIN32}
{ Set to indicate that error msg should come from Win32's GetLastError(),
* not errno. }
APLOG_WIN32ERROR = ((APLOG_LEVELMASK + 1) * 2);
{$endif}
DEFAULT_LOGLEVEL = APLOG_WARNING;
//#define APLOG_MARK __FILE__,__LINE__
procedure ap_open_logs(s: Pserver_rec; p: PPool);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ The two primary logging functions, ap_log_error and ap_log_rerror,
* use a printf style format string to build the log message. It is
* VERY IMPORTANT that you not include any raw data from the network,
* such as the request-URI or request header fields, within the format
* string. Doing so makes the server vulnerable to a denial-of-service
* attack and other messy behavior. Instead, use a simple format string
* like "%s", followed by the string containing the untrusted data.
}
procedure ap_log_error(
const file_: PChar; line, level: Integer;
const s: Pserver_rec; const fmt: PChar; others: array of const);
cdecl; external LibHTTPD;
// __attribute__((format(printf,5,6)));
procedure ap_log_rerror(
const file_: PChar; line, level: Integer;
const s: Prequest_rec; const fmt: PChar; others: array of const);
cdecl; external LibHTTPD;
// __attribute__((format(printf,5,6)));
procedure ap_error_log2stderr(s: Pserver_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_log_pid(p: PPool; fname: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ These are for legacy code, new code should use ap_log_error,
* or ap_log_rerror.
}
{API_EXPORT(void) ap_log_error_old(const char *err, server_rec *s);
API_EXPORT(void) ap_log_unixerr(const char *routine, const char *file,
const char *msg, server_rec *s);
API_EXPORT_NONSTD(void) ap_log_printf(const server_rec *s, const char *fmt, ...)
__attribute__((format(printf,2,3)));
API_EXPORT(void) ap_log_reason(const char *reason, const char *fname,
request_rec *r);}
type
piped_log = record
p: PPool;
//#if !defined(NO_RELIABLE_PIPED_LOGS) || defined(TPF)
program_: PChar;
pid: cint;
fds: array[1..2] of cint;
//#else
// FILE *write_f;
//#endif
end;
Ppiped_log = ^piped_log;
procedure ap_open_piped_log(p: PPool; const program_: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_close_piped_log(p: Ppiped_log): Ppiped_log;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{#if !defined(NO_RELIABLE_PIPED_LOGS) || defined(TPF)
#define ap_piped_log_read_fd(pl) ((pl)->fds[0])
#define ap_piped_log_write_fd(pl) ((pl)->fds[1])
#else}
//#define ap_piped_log_read_fd(pl) (-1)
//#define ap_piped_log_write_fd(pl) (fileno((pl)->write_f))
//#endif

View File

@ -1,160 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* Routines in http_main.c which other code --- in particular modules ---
* may want to call. Right now, that's limited to timeout handling.
* There are two functions which modules can call to trigger a timeout
* (with the per-virtual-server timeout duration); these are hard_timeout
* and soft_timeout.
*
* The difference between the two is what happens when the timeout
* expires (or earlier than that, if the client connection aborts) ---
* a soft_timeout just puts the connection to the client in an
* "aborted" state, which will cause http_protocol.c to stop trying to
* talk to the client, but otherwise allows the code to continue normally.
* hard_timeout(), by contrast, logs the request, and then aborts it
* completely --- longjmp()ing out to the accept() loop in http_main.
* Any resources tied into the request's resource pool will be cleaned up;
* everything that isn't will leak.
*
* soft_timeout() is recommended as a general rule, because it gives your
* code a chance to clean up. However, hard_timeout() may be the most
* convenient way of dealing with timeouts waiting for some external
* resource other than the client, if you can live with the restrictions.
*
* (When a hard timeout is in scope, critical sections can be guarded
* with block_alarms() and unblock_alarms() --- these are declared in
* alloc.c because they are most often used in conjunction with
* routines to allocate something or other, to make sure that the
* cleanup does get registered before any alarm is allowed to happen
* which might require it to be cleaned up; they * are, however,
* implemented in http_main.c).
*
* NOTE! It's not "fair" for a hard_timeout to be in scope through calls
* across modules. Your module code really has no idea what other modules may
* be present in the server, and they may not take too kindly to having a
* longjmp() happen -- it could result in corrupted state. Heck they may not
* even take to kindly to a soft_timeout()... because it can cause EINTR to
* happen on pretty much any syscall, and unless all the libraries and modules
* in use are known to deal well with EINTR it could cause corruption as well.
* But things are likely to do much better with a soft_timeout in scope than a
* hard_timeout.
*
* A module MAY NOT use a hard_timeout() across * sub_req_lookup_xxx()
* functions, or across run_sub_request() functions. A module SHOULD NOT use a
* soft_timeout() in either of these cases, but sometimes there's just no
* choice.
*
* kill_timeout() will disarm either variety of timeout.
*
* reset_timeout() resets the timeout in progress.
}
procedure ap_start_shutdown();
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_start_restart(param: cint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_hard_timeout(p: PChar; r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_keepalive_timeout(p: PChar; r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_soft_timeout(p: PChar; r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_kill_timeout(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_reset_timeout(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
//procedure ap_child_terminate(r: Prequest_rec);
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_sync_scoreboard_image();
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_update_child_status(child_num, status: cint; r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ void ap_time_process_request(int child_num, int status); }
type
fn_t = procedure (param: cint);
function ap_set_callback_and_alarm(fn: fn_t; x: cint): cuint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_check_alarm(): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ void setup_signal_names(char *prefix);}
{ functions for determination and setting of accept() mutexing }
{char *ap_default_mutex_method(void);
char *ap_init_mutex_method(char *t);}
{$ifndef NO_OTHER_CHILD}
{
* register an other_child -- a child which the main loop keeps track of
* and knows it is different than the rest of the scoreboard.
*
* pid is the pid of the child.
*
* maintenance is a function that is invoked with a reason, the data
* pointer passed here, and when appropriate a status result from waitpid().
*
* write_fd is an fd that is probed for writing by select() if it is ever
* unwritable, then maintenance is invoked with reason OC_REASON_UNWRITABLE.
* This is useful for log pipe children, to know when they've blocked. To
* disable this feature, use -1 for write_fd.
}
type
maintenance_t = procedure (reason: cint; data: Pointer; status: ap_wait_t);
procedure ap_register_other_child(pid: cint;
maintenance: maintenance_t; data: Pointer; write_fd: cint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
const
OC_REASON_DEATH = 0; { child has died, caller must call
* unregister still }
OC_REASON_UNWRITABLE = 1; { write_fd is unwritable }
OC_REASON_RESTART = 2; { a restart is occuring, perform
* any necessary cleanup (including
* sending a special signal to child)
}
OC_REASON_UNREGISTER = 3; { unregister has been called, do
* whatever is necessary (including
* kill the child) }
OC_REASON_LOST = 4; { somehow the child exited without
* us knowing ... buggy os? }
{
* unregister an other_child. Note that the data pointer is used here, and
* is assumed to be unique' per other_child. This is because the pid and
* write_fd are possibly killed off separately.
}
procedure ap_unregister_other_child(data: Pointer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{$endif}

View File

@ -1,239 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* Prototypes for routines which either talk directly back to the user,
* or control the ones that eventually do.
}
{ Read a request and fill in the fields. }
function ap_read_request(c: Pconn_rec): Prequest_rec;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Send a single HTTP header field }
function ap_send_header_field(r: Prequest_rec; const fieldname, fieldval: PChar): cint;
cdecl; external LibHTTPD;
{ Send the minimal part of an HTTP response header... but modules should be
* very careful about using this, and should prefer ap_send_http_header().
* Much of the HTTP/1.1 implementation correctness depends on code in
* ap_send_http_header().
}
procedure ap_basic_http_header(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Send the Status-Line and header fields for HTTP response }
procedure ap_send_http_header(l: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Send the response to special method requests }
function ap_send_http_trace(r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_send_http_options(r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Finish up stuff after a request }
procedure ap_finalize_request_protocol(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Send error back to client... last arg indicates error status in case
* we get an error in the process of trying to deal with an ErrorDocument
* to handle some other error. In that case, we print the default report
* for the first thing that went wrong, and more briefly report on the
* problem with the ErrorDocument.
}
procedure ap_send_error_response(r: Prequest_rec; recursive_error: cint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Set last modified header line from the lastmod date of the associated file.
* Also, set content length.
*
* May return an error status, typically USE_LOCAL_COPY (that when the
* permit_cache argument is set to one).
}
function ap_set_content_length(r: Prequest_rec; length: clong): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_set_keepalive(r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_rationalize_mtime(r: Prequest_rec; mtime: time_t): time_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_make_etag(r: Prequest_rec; force_weak: cint): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_set_etag(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_set_last_modified(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_meets_conditions(r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Other ways to send stuff at the client. All of these keep track
* of bytes_sent automatically. This indirection is intended to make
* it a little more painless to slide things like HTTP-NG packetization
* underneath the main body of the code later. In the meantime, it lets
* us centralize a bit of accounting (bytes_sent).
*
* These also return the number of bytes written by the call.
* They should only be called with a timeout registered, for obvious reaasons.
* (Ditto the send_header stuff).
}
//function ap_send_fd(f: PFILE; r: Prequest_rec): clong;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
//function ap_send_fd_length(f: PFILE; r: Prequest_rec; length: clong): clong;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_send_fb(f: PBUFF; r: Prequest_rec): clong;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_send_fb_length(f: PBUFF; r: Prequest_rec): clong;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_send_mmap(mm: Pointer; r: Prequest_rec; offset, length: size_t): size_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Hmmm... could macrofy these for now, and maybe forever, though the
* definitions of the macros would get a whole lot hairier.
}
function ap_rputc(c: cint; r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_rputs(const str: PChar; r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_rwrite(const buf: Pointer; nbyte: cint; r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_rvputs(r: Prequest_rec; others: array of const): cint;
cdecl; external LibHTTPD;
function ap_vrprintf(r: Prequest_rec; const fmt: PChar; vlist: va_list): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_rprintf(r: Prequest_rec; const fmt: PChar; others: array of const): cint;
cdecl; external LibHTTPD;
{ __attribute__((format(printf,2,3)));}
function ap_rflush(r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{
* Index used in custom_responses array for a specific error code
* (only use outside protocol.c is in getting them configured).
}
function ap_index_of_response(status: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Reading a block of data from the client connection (e.g., POST arg) }
function ap_setup_client_block(r: Prequest_rec; read_policy: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_should_client_block(r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_get_client_block(r: Prequest_rec; buffer: PChar; bufsiz: cint): clong;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_discard_request_body(r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Sending a byterange }
function ap_set_byterange(r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_each_byterange(r: Prequest_rec; offset, length: Pclong): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ Support for the Basic authentication protocol. Note that there's
* nothing that prevents these from being in mod_auth.c, except that other
* modules which wanted to provide their own variants on finding users and
* passwords for Basic auth (a fairly common request) would then require
* mod_auth to be loaded or they wouldn't work.
*
* get_basic_auth_pw returns 0 (OK) if it set the 'pw' argument (and assured
* a correct value in r->connection->user); otherwise it returns an error
* code, either SERVER_ERROR if things are really confused, AUTH_REQUIRED
* if no authentication at all seemed to be in use, or DECLINED if there
* was authentication but it wasn't Basic (in which case, the caller should
* presumably decline as well).
*
* note_basic_auth_failure arranges for the right stuff to be scribbled on
* the HTTP return so that the client knows how to authenticate itself the
* next time. As does note_digest_auth_failure for Digest auth.
*
* note_auth_failure does the same thing, but will call the correct one
* based on the authentication type in use.
*
}
procedure ap_note_auth_failure(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_note_basic_auth_failure(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_note_digest_auth_failure(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_get_basic_auth_pw(r: Prequest_rec; const pw: PPChar): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{
* Setting up the protocol fields for subsidiary requests...
* Also, a wrapup function to keep the internal accounting straight.
}
procedure ap_set_sub_req_protocol(rnew, r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_finalize_sub_req_protocol(sub_r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ This is also useful for putting sub_reqs and internal_redirects together }
//CORE_EXPORT(void) ap_parse_uri(request_rec *r, const char *uri);
{ Get the method number associated with the given string, assumed to
* contain an HTTP method. Returns M_INVALID if not recognized.
}
function ap_method_number_of(const method: PChar): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_getline(s: PChar; n: cint; in_: PBUFF; fold: cint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_get_chunk_size(b: PChar): clong;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;

View File

@ -1,82 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{ http_request.c is the code which handles the main line of request
* processing, once a request has been read in (finding the right per-
* directory configuration, building it if necessary, and calling all
* the module dispatch functions in the right order).
*
* The pieces here which are public to the modules, allow them to learn
* how the server would handle some other file or URI, or perhaps even
* direct the server to serve that other file instead of the one the
* client requested directly.
*
* There are two ways to do that. The first is the sub_request mechanism,
* which handles looking up files and URIs as adjuncts to some other
* request (e.g., directory entries for multiviews and directory listings);
* the lookup functions stop short of actually running the request, but
* (e.g., for includes), a module may call for the request to be run
* by calling run_sub_req. The space allocated to create sub_reqs can be
* reclaimed by calling destroy_sub_req --- be sure to copy anything you care
* about which was allocated in its pool elsewhere before doing this.
}
function ap_sub_req_lookup_uri(const new_file: PChar;
const r: Prequest_rec): Prequest_rec;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_sub_req_lookup_file(const new_file: PChar;
const r: Prequest_rec): Prequest_rec;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_sub_req_method_uri(const method, new_file: PChar;
const r: Prequest_rec): Prequest_rec;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_run_sub_req(r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_destroy_sub_req(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{
* Then there's the case that you want some other request to be served
* as the top-level request INSTEAD of what the client requested directly.
* If so, call this from a handler, and then immediately return OK.
}
procedure ap_internal_redirect(const new_uri: PChar; param2: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
procedure ap_internal_redirect_handler(const new_uri: PChar; param2: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_some_auth_required(r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_is_initial_req(r: Prequest_rec): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
function ap_update_mtime(r: Prequest_rec; dependency_mtime: time_t): time_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{$ifdef CORE_PRIVATE}
{ Function called by main.c to handle first-level request }
API_EXPORT(void) ap_process_request(request_rec *);
API_EXPORT(void) ap_die(int type, request_rec *r);
{$endif}

View File

@ -1,49 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{ called before any config is read }
procedure ap_init_vhost_config(p: PPool);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ called after the config has been read }
procedure ap_fini_vhost_config(p: PPool; main_server: Pserver_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ handle addresses in <VirtualHost> statement }
function ap_parse_vhost_addrs(p: PPool; const hostname: PChar; s: Pserver_rec): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ handle NameVirtualHost directive }
//function ap_set_name_virtual_host(cmd: Pcmd_parms; dummy: Pointer; arg: PChar): PChar;
// cdecl; external LibHTTPD;
{ given an ip address only, give our best guess as to what vhost it is }
procedure ap_update_vhost_given_ip(conn: Pconn_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ The above is never enough, and this is always called after the headers
* have been read. It may change r->server.
}
procedure ap_update_vhost_from_headers(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;
{ return 1 if the host:port matches any of the aliases of r->server
* return 0 otherwise
}
function ap_matches_request_vhost(r: Prequest_rec; const host: PChar;
port: cuint): cint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD;

File diff suppressed because it is too large Load Diff

View File

@ -1,174 +0,0 @@
{
httpd.pas
Copyright (C) 2006 Felipe Monteiro de Carvalho
This unit is a pascal binding for the Apache 1.3.37 headers.
The headers were released under the following copyright:
}
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
unit httpd;
{$ifdef fpc}
{$mode delphi}{$H+}
{$endif}
{$IFNDEF FPC}
{$DEFINE WINDOWS}
{$ENDIF}
{$IFDEF WIN32}
{$DEFINE WINDOWS}
{$ENDIF}
{$ifdef Unix}
{$PACKRECORDS C}
{$endif}
{$define Apache1_3}
interface
uses
{$ifdef WINDOWS}
Windows,
{$ELSE}
UnixType,
{$ENDIF}
ctypes;
const
{$ifndef fpc}
LineEnding = #13#10;
{$endif}
{$IFDEF WINDOWS}
LibHTTPD = 'ApacheCore.dll';
{$ELSE}
LibHTTPD = '';
{$ENDIF}
{ Declarations moved here to be on top of all declarations }
{ Various types}
type
time_t = LongInt;
size_t = Integer;
{ configuration vector structure }
type
ap_conf_vector_t = record end;
Pap_conf_vector_t = ^ap_conf_vector_t;
PPap_conf_vector_t = ^Pap_conf_vector_t;
{
Main httpd header files
Note: There are more include files other then these, because some include files
include more files.
}
{.$include ap_provider.inc}
{.$include util_cfgtree.inc}
{$include httpd.inc}
{$include http_config.inc}
{$include http_core.inc}
{$include http_log.inc}
{$include http_main.inc}
{$include http_protocol.inc}
{$include http_request.inc}
{$include http_vhost.inc}
{.$include util_script.inc}
{.$include util_time.inc}
{.$include util_md5.inc}
{.$include ap_mpm.inc}
implementation
{
Macros transformed into functions in the translation
}
{ from httpd.inc }
{ Internal representation for a HTTP protocol number, e.g., HTTP/1.1 }
function HTTP_VERSION(major, minor: Integer): Integer;
begin
Result := (1000*(major)+(minor));
end;
{ Major part of HTTP protocol }
function HTTP_VERSION_MAJOR(number: Integer): Integer;
begin
Result := number div 1000;
end;
{ Minor part of HTTP protocol }
function HTTP_VERSION_MINOR(number: Integer): Integer;
begin
Result := number mod 1000;
end;
{function ap_escape_uri(p: Papr_pool_t; const path: PChar): PChar;
begin
Result := ap_os_escape_path(p, path, 1);
end;}
{ from http_config.inc }
{ Use this in all standard modules }
procedure STANDARD_MODULE_STUFF(var mod_: module);
begin
mod_.version := MODULE_MAGIC_NUMBER_MAJOR;
mod_.minor_version := MODULE_MAGIC_NUMBER_MINOR;
mod_.module_index := -1;
// mod_.name: PChar;
mod_.dynamic_load_handle := nil;
mod_.next := nil;
mod_.magic := MODULE_MAGIC_COOKIE;
end;
{ Use this only in MPMs }
//procedure MPM20_MODULE_STUFF(var mod_: module);
//begin
// mod_.version := MODULE_MAGIC_NUMBER_MAJOR;
// mod_.minor_version := MODULE_MAGIC_NUMBER_MINOR;
// mod_.module_index := -1;
// mod_.name: PChar;
// mod_.dynamic_load_handle := nil;
// mod_.next := nil;
// mod_.magic := MODULE_MAGIC_COOKIE;
//end;
function ap_get_module_config(v: Pap_conf_vector_t; m: Pmodule): Pap_conf_vector_t;
begin
Result := Pointer(Integer(v) + m^.module_index);
end;
procedure ap_set_module_config(v: Pap_conf_vector_t; m: Pmodule; val: Pap_conf_vector_t);
var
P: PPointer;
begin
P := PPointer(Integer(v) + m^.module_index);
P^ := val;
end;
end.

View File

@ -1,84 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* util_uri.h: External Interface of util_uri.c
}
type
schemes_t = record
name: PChar;
default_port: cushort;
end;
const
DEFAULT_FTP_DATA_PORT = 20;
DEFAULT_FTP_PORT = 21;
DEFAULT_GOPHER_PORT = 70;
DEFAULT_NNTP_PORT = 119;
DEFAULT_WAIS_PORT = 210;
DEFAULT_SNEWS_PORT = 563;
DEFAULT_PROSPERO_PORT = 1525; { WARNING: conflict w/Oracle }
DEFAULT_URI_SCHEME = 'http';
{ Flags passed to unparse_uri_components(): }
UNP_OMITSITEPART = (1 shl 0); { suppress "scheme://user@site:port" }
UNP_OMITUSER = (1 shl 1); { Just omit user }
UNP_OMITPASSWORD = (1 shl 2); { Just omit password }
UNP_OMITUSERINFO = (UNP_OMITUSER or UNP_OMITPASSWORD); { omit "user:password@" part }
UNP_REVEALPASSWORD = (1 shl 3); { Show plain text password (default: show XXXXXXXX) }
UNP_OMITPATHINFO = (1 shl 4); { Show "scheme://user@site:port" only }
UNP_OMITQUERY = (1 shl 5); { Omit the "?queryarg" from the path }
type
hostent = record end;
Phostent = ^hostent;
uri_components = record
scheme: PChar; { scheme ("http"/"ftp"/...) }
hostinfo: PChar; { combined [user[:password]@]host[:port] }
user: PChar; { user name, as in http://user:passwd@host:port/ }
password: PChar; { password, as in http://user:passwd@host:port/ }
hostname: PChar; { hostname from URI (or from Host: header) }
port_str: PChar; { port string (integer representation is in "port") }
path: PChar; { the request path (or "/" if only scheme://host was given) }
query: PChar; { Everything after a '?' in the path, if present }
fragment: PChar; { Trailing "#fragment" string, if present }
hostent: Phostent;
port: cushort; { The port number, numeric, valid only if port_str != NULL }
// unsigned is_initialized:1;
// unsigned dns_looked_up:1;
// unsigned dns_resolved:1;
end;
{ util_uri.c }
{API_EXPORT(unsigned short) ap_default_port_for_scheme(const char *scheme_str);
API_EXPORT(unsigned short) ap_default_port_for_request(const request_rec *r);
API_EXPORT(struct hostent *) ap_pduphostent(pool *p, const struct hostent *hp);
API_EXPORT(struct hostent *) ap_pgethostbyname(pool *p, const char *hostname);
API_EXPORT(char *) ap_unparse_uri_components(pool *p, const uri_components *uptr,
unsigned flags);
API_EXPORT(int) ap_parse_uri_components(pool *p, const char *uri, uri_components *uptr);
API_EXPORT(int) ap_parse_hostinfo_components(pool *p, const char *hostinfo, uri_components *uptr);}
{ called by the core in main() }
//extern void ap_util_uri_init(void);

View File

@ -1,191 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{$ifdef WIN32}
{
* Compile the server including all the Windows NT 4.0 header files by
* default. We still want the server to run on Win95/98 so use
* runtime checks before calling NT specific functions to verify we are
* really running on an NT system.
}
const
_WIN32_WINNT = $0400;
{ If it isn't too late, prevent windows.h from including the original
* winsock.h header, so that we can still include winsock2.h
}
{#if !defined(_WINSOCKAPI_) || !defined(_WINDOWS_)
#define _WINSOCKAPI_
#include <windows.h>
#include <winsock2.h>
#include <mswsock.h>
#else
#include <windows.h>
#endif
#include <process.h>
#include <malloc.h>
#include <io.h>
#include <fcntl.h>}
PLATFORM = 'Win32';
{
* This file in included in all Apache source code. It contains definitions
* of facilities available on _this_ operating system (HAVE_* macros),
* and prototypes of OS specific functions defined in os.c
}
{ temporarily replace crypt }
{ char *crypt(const char *pw, const char *salt); }
//#define crypt(buf,salt) (buf)
{ Although DIR_TYPE is dirent (see nt/readdir.h) we need direct.h for
chdir() }
//#include <direct.h>
{$define STATUS}
{$define STRICT}
{$define CASE_BLIND_FILESYSTEM}
{$define NO_WRITEV}
{$define NO_SETSID}
{$define NO_USE_SIGACTION}
{$define NO_TIMES}
{$define NO_GETTIMEOFDAY}
{$define USE_LONGJMP}
{$define HAVE_MMAP}
{$define USE_MMAP_SCOREBOARD}
{$define MULTITHREAD}
{$define HAVE_CANONICAL_FILENAME}
{$define HAVE_DRIVE_LETTERS}
{$define HAVE_UNC_PATHS}
type
uid_t = cint;
gid_t = cint;
pid_t = cint;
Ppid_t = ^pid_t;
tid_t = cint;
{$ifdef _MSC_VER}
{ modified to match declaration in sys/stat.h }
mode_t = cushort;
{$endif}
caddr_t = PChar;
{
Define export types. API_EXPORT_NONSTD is a nasty hack to avoid having to declare
every configuration function as __stdcall.
}
{#ifdef SHARED_MODULE
#define API_VAR_EXPORT __declspec(dllimport)
#define API_EXPORT(type) __declspec(dllimport) type __stdcall
#define API_EXPORT_NONSTD(type) __declspec(dllimport) type __cdecl
#else
#define API_VAR_EXPORT __declspec(dllexport)
#define API_EXPORT(type) __declspec(dllexport) type __stdcall
#define API_EXPORT_NONSTD(type) __declspec(dllexport) type __cdecl
#endif
#define MODULE_VAR_EXPORT __declspec(dllexport)
#define strcasecmp(s1, s2) stricmp(s1, s2)
#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
#define lstat(x, y) stat(x, y)
#ifndef S_ISLNK
#define S_ISLNK(m) (0)
#endif
#ifndef S_ISREG
#define S_ISREG(m) ((m & _S_IFREG) == _S_IFREG)
#endif
#ifndef S_ISDIR
#define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR)
#endif
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#define JMP_BUF jmp_buf
#define sleep(t) Sleep(t*1000)
#ifndef O_CREAT
#define O_CREAT _O_CREAT
#endif
#ifndef O_RDWR
#define O_RDWR _O_RDWR
#endif
#define SIGPIPE 17}
{ Seems Windows is not a subgenius }
{$define NO_SLACK}
//#include <stddef.h>
{ MSVC asserts that strtol "errno is set to ERANGE
* if overflow or underflow occurs"
* Ergo we can use the library strtol safely.
}
//#define ap_strtol strtol
{$define NO_OTHER_CHILD}
{$define NO_RELIABLE_PIPED_LOGS}
//__inline int ap_os_is_path_absolute(const char *file)
{
For now, just do the same check that http_request.c and mod_alias.c
* do.
return file && (file[0] == '/' || (file[1] == ':' && file[2] == '/'));
}
{#define stat(f,ps) os_stat(f,ps)
API_EXPORT(int) os_stat(const char *szPath,struct stat *pStat);
API_EXPORT(int) os_strftime(char *s, size_t max, const char *format, const struct tm *tm);
#define _spawnv(mode,cmdname,argv) os_spawnv(mode,cmdname,argv)
#define spawnv(mode,cmdname,argv) os_spawnv(mode,cmdname,argv)
API_EXPORT(int) os_spawnv(int mode,const char *cmdname,const char *const *argv);
#define _spawnve(mode,cmdname,argv,envp) os_spawnve(mode,cmdname,argv,envp)
#define spawnve(mode,cmdname,argv,envp) os_spawnve(mode,cmdname,argv,envp)
API_EXPORT(int) os_spawnve(int mode,const char *cmdname,const char *const *argv,const char *const *envp);
#define _spawnle os_spawnle
#define spawnle os_spawnle
API_EXPORT_NONSTD(int) os_spawnle(int mode,const char *cmdname,...);}
{ OS-dependent filename routines in util_win32.c }
//API_EXPORT(int) ap_os_is_filename_valid(const char *file);
{ Abstractions for dealing with shared object files (DLLs on Win32).
* These are used by mod_so.c
}
{#define ap_os_dso_handle_t HINSTANCE
#define ap_os_dso_init()
#define ap_os_dso_unload(l) FreeLibrary(l)
#define ap_os_dso_sym(h,s) GetProcAddress(h,s)
API_EXPORT(ap_os_dso_handle_t) ap_os_dso_load(const char *);
API_EXPORT(const char *) ap_os_dso_error(void);}
{ Other ap_os_ routines not used by this platform }
//#define ap_os_kill(pid, sig) kill(pid, sig)
{ Some Win32isms }
{$define HAVE_ISNAN}
//#define isnan(n) _isnan(n)
{$define HAVE_ISINF}
//#define isinf(n) (!_finite(n))
//#define gettid() ((tid_t)GetCurrentThreadId())
{$endif} { WIN32 }

View File

@ -1,248 +0,0 @@
{ Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{#include "apr.h"
#include "apr_hooks.h"
#include "apr_optional_hooks.h"}
{
* @file ap_config.h
* @brief Symbol export macros and hook functions
}
{ Although this file doesn't declare any hooks, declare the hook group here }
{ @defgroup hooks Apache Hooks }
{$ifdef DOXYGEN}
{ define these just so doxygen documents them }
{
* AP_DECLARE_STATIC is defined when including Apache's Core headers,
* to provide static linkage when the dynamic library may be unavailable.
*
* @see AP_DECLARE_EXPORT
*
* AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when
* including Apache's Core headers, to import and link the symbols from the
* dynamic Apache Core library and assure appropriate indirection and calling
* conventions at compile time.
}
{$define AP_DECLARE_STATIC}
{
* AP_DECLARE_EXPORT is defined when building the Apache Core dynamic
* library, so that all public symbols are exported.
*
* @see AP_DECLARE_STATIC
}
{$define AP_DECLARE_EXPORT}
{$endif} { def DOXYGEN }
//#if !defined(WIN32)
{
* Apache Core dso functions are declared with AP_DECLARE(), so they may
* use the most appropriate calling convention. Hook functions and other
* Core functions with variable arguments must use AP_DECLARE_NONSTD().
* @code
* AP_DECLARE(rettype) ap_func(args)
* @endcode
}
//#define AP_DECLARE(type) type
{
* Apache Core dso variable argument and hook functions are declared with
* AP_DECLARE_NONSTD(), as they must use the C language calling convention.
* @see AP_DECLARE
* @code
* AP_DECLARE_NONSTD(rettype) ap_func(args [...])
* @endcode
}
//#define AP_DECLARE_NONSTD(type) type
{
* Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA.
* This assures the appropriate indirection is invoked at compile time.
*
* @note AP_DECLARE_DATA extern type apr_variable; syntax is required for
* declarations within headers to properly import the variable.
* @code
* AP_DECLARE_DATA type apr_variable
* @endcode
}
{#define AP_DECLARE_DATA
#elif defined(AP_DECLARE_STATIC)
#define AP_DECLARE(type) type __stdcall
#define AP_DECLARE_NONSTD(type) type
#define AP_DECLARE_DATA
#elif defined(AP_DECLARE_EXPORT)
#define AP_DECLARE(type) __declspec(dllexport) type __stdcall
#define AP_DECLARE_NONSTD(type) __declspec(dllexport) type
#define AP_DECLARE_DATA __declspec(dllexport)
#else
#define AP_DECLARE(type) __declspec(dllimport) type __stdcall
#define AP_DECLARE_NONSTD(type) __declspec(dllimport) type
#define AP_DECLARE_DATA __declspec(dllimport)
#endif
#if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC)}
{
* Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA.
*
* Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols
* declared with AP_MODULE_DECLARE_DATA are always exported.
* @code
* module AP_MODULE_DECLARE_DATA mod_tag
* @endcode
}
{#if defined(WIN32)
#define AP_MODULE_DECLARE(type) type __stdcall
#else
#define AP_MODULE_DECLARE(type) type
#endif
#define AP_MODULE_DECLARE_NONSTD(type) type
#define AP_MODULE_DECLARE_DATA
#else}
{
* AP_MODULE_DECLARE_EXPORT is a no-op. Unless contradicted by the
* AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined.
*
* The old SHARED_MODULE compile-time symbol is now the default behavior,
* so it is no longer referenced anywhere with Apache 2.0.
}
{#define AP_MODULE_DECLARE_EXPORT
#define AP_MODULE_DECLARE(type) __declspec(dllexport) type __stdcall
#define AP_MODULE_DECLARE_NONSTD(type) __declspec(dllexport) type
#define AP_MODULE_DECLARE_DATA __declspec(dllexport)
#endif}
{
* Declare a hook function
* @param ret The return type of the hook
* @param name The hook's name (as a literal)
* @param args The arguments the hook function takes, in brackets.
}
{#define AP_DECLARE_HOOK(ret,name,args) \
APR_DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args)
}
{ @internal }
{#define AP_IMPLEMENT_HOOK_BASE(name) \
APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ap,AP,name)
}
{
* Implement an Apache core hook that has no return code, and
* therefore runs all of the registered functions. The implementation
* is called ap_run_<i>name</i>.
*
* @param name The name of the hook
* @param args_decl The declaration of the arguments for the hook, for example
* "(int x,void *y)"
* @param args_use The arguments for the hook as used in a call, for example
* "(x,y)"
* @note If IMPLEMENTing a hook that is not linked into the Apache core,
* (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_VOID.
}
{#define AP_IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \
APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ap,AP,name,args_decl,args_use)
}
{
* Implement an Apache core hook that runs until one of the functions
* returns something other than ok or decline. That return value is
* then returned from the hook runner. If the hooks run to completion,
* then ok is returned. Note that if no hook runs it would probably be
* more correct to return decline, but this currently does not do
* so. The implementation is called ap_run_<i>name</i>.
*
* @param ret The return type of the hook (and the hook runner)
* @param name The name of the hook
* @param args_decl The declaration of the arguments for the hook, for example
* "(int x,void *y)"
* @param args_use The arguments for the hook as used in a call, for example
* "(x,y)"
* @param ok The "ok" return value
* @param decline The "decline" return value
* @return ok, decline or an error.
* @note If IMPLEMENTing a hook that is not linked into the Apache core,
* (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL.
}
{#define AP_IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \
APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
args_use,ok,decline)
}
{
* Implement a hook that runs until a function returns something other than
* decline. If all functions return decline, the hook runner returns decline.
* The implementation is called ap_run_<i>name</i>.
*
* @param ret The return type of the hook (and the hook runner)
* @param name The name of the hook
* @param args_decl The declaration of the arguments for the hook, for example
* "(int x,void *y)"
* @param args_use The arguments for the hook as used in a call, for example
* "(x,y)"
* @param decline The "decline" return value
* @return decline or an error.
* @note If IMPLEMENTing a hook that is not linked into the Apache core
* (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST.
}
{#define AP_IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \
APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap,AP,ret,name,args_decl, \
args_use,decline)
}
{ Note that the other optional hook implementations are straightforward but
* have not yet been needed
}
{
* Implement an optional hook. This is exactly the same as a standard hook
* implementation, except the hook is optional.
* @see AP_IMPLEMENT_HOOK_RUN_ALL
}
{#define AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok, \
decline) \
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
args_use,ok,decline)
}
{
* Hook an optional hook. Unlike static hooks, this uses a macro instead of a
* function.
}
{#define AP_OPTIONAL_HOOK(name,fn,pre,succ,order) \
APR_OPTIONAL_HOOK(ap,name,fn,pre,succ,order)
#include "os.h"
#if !defined(WIN32) && !defined(NETWARE)
#include "ap_config_auto.h"
#include "ap_config_layout.h"
#endif
#if defined(NETWARE)
#define AP_NONBLOCK_WHEN_MULTI_LISTEN 1
#endif}
{ TODO - We need to put OS detection back to make all the following work }
{$if defined(SUNOS) or defined(IRIX) or defined(NEXT) or defined(AUX)
or defined (UW) or defined(LYNXOS) or defined(TPF)}
{ These systems don't do well with any lingering close code; I don't know
* why -- manoj }
{$define NO_LINGCLOSE}
{$endif}
{ If APR has OTHER_CHILD logic, use reliable piped logs. }
{$ifdef APR_HAS_OTHER_CHILD}
{$define AP_HAVE_RELIABLE_PIPED_LOGS}
{$endif}

View File

@ -1,121 +0,0 @@
{ Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @package Module Magic Number
}
{
* MODULE_MAGIC_NUMBER_MAJOR
* Major API changes that could cause compatibility problems for older modules
* such as structure size changes. No binary compatibility is possible across
* a change in the major version.
*
* MODULE_MAGIC_NUMBER_MINOR
* Minor API changes that do not cause binary compatibility problems.
* Should be reset to 0 when upgrading MODULE_MAGIC_NUMBER_MAJOR.
*
* See the MODULE_MAGIC_AT_LEAST macro below for an example.
}
{
* 20010224 (2.0.13-dev) MODULE_MAGIC_COOKIE reset to "AP20"
* 20010523 (2.0.19-dev) bump for scoreboard structure reordering
* 20010627 (2.0.19-dev) more API changes than I can count
* 20010726 (2.0.22-dev) more big API changes
* 20010808 (2.0.23-dev) dir d_is_absolute bit introduced, bucket changes, etc
* 20010825 (2.0.25-dev) removed d_is_absolute, introduced map_to_storage hook
* 20011002 (2.0.26-dev) removed 1.3-depreciated request_rec.content_language
* 20011127 (2.0.29-dev) bump for postconfig hook change, and removal of socket
* from connection record
* 20011212 (2.0.30-dev) bump for new used_path_info member of request_rec
* 20011218 (2.0.30-dev) bump for new sbh member of conn_rec, different
* declarations for scoreboard, new parameter to
* create_connection hook
* 20020102 (2.0.30-dev) bump for changed type of limit_req_body in
* core_dir_config
* 20020109 (2.0.31-dev) bump for changed shm and scoreboard declarations
* 20020111 (2.0.31-dev) bump for ETag fields added at end of cor_dir_config
* 20020114 (2.0.31-dev) mod_dav changed how it asks its provider to fulfill
* a GET request
* 20020118 (2.0.31-dev) Input filtering split of blocking and mode
* 20020127 (2.0.31-dev) bump for pre_mpm hook change
* 20020128 (2.0.31-dev) bump for pre_config hook change
* 20020218 (2.0.33-dev) bump for AddOutputFilterByType directive
* 20020220 (2.0.33-dev) bump for scoreboard.h structure change
* 20020302 (2.0.33-dev) bump for protocol_filter additions.
* 20020306 (2.0.34-dev) bump for filter type renames.
* 20020318 (2.0.34-dev) mod_dav's API for REPORT generation changed
* 20020319 (2.0.34-dev) M_INVALID changed, plus new M_* methods for RFC 3253
* 20020327 (2.0.35-dev) Add parameter to quick_handler hook
* 20020329 (2.0.35-dev) bump for addition of freelists to bucket API
* 20020329.1 (2.0.36) minor bump for new arg to opt fn ap_cgi_build_command
* 20020506 (2.0.37-dev) Removed r->boundary in request_rec.
* 20020529 (2.0.37-dev) Standardized the names of some apr_pool_*_set funcs
* 20020602 (2.0.37-dev) Bucket API change (metadata buckets)
* 20020612 (2.0.38-dev) Changed server_rec->[keep_alive_]timeout to apr time
* 20020625 (2.0.40-dev) Changed conn_rec->keepalive to an enumeration
* 20020628 (2.0.40-dev) Added filter_init to filter registration functions
* 20020903 (2.0.41-dev) APR's error constants changed
* 20020903.2 (2.0.46-dev) add ap_escape_logitem
* 20020903.3 (2.0.46-dev) allow_encoded_slashes added to core_dir_config
* 20020903.4 (2.0.47-dev) add ap_is_recursion_limit_exceeded()
* 20020903.5 (2.0.49-dev) add ap_escape_errorlog_item()
* 20020903.6 (2.0.49-dev) add insert_error_filter hook
* 20020903.7 (2.0.49-dev) added XHTML Doctypes
* 20020903.8 (2.0.50-dev) export ap_set_sub_req_protocol and
* ap_finalize_sub_req_protocol on Win32 and NetWare
* 20020903.9 (2.0.51-dev) create pcommands and initialize arrays before
* calling ap_setup_prelinked_modules
* 20020903.10 (2.0.55-dev) add ap_log_cerror()
* 20020903.11 (2.0.55-dev) added trace_enable to core_server_config
* 20020903.12 (2.0.56-dev) added ap_get_server_revision / ap_version_t
}
const
MODULE_MAGIC_COOKIE = $41503230; { "AP20" }
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { For 2.0.58 Also works for 2.0.54}
MODULE_MAGIC_NUMBER_MINOR = 12; // 0...n
{
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
* specified value.
* <pre>
* Useful for testing for features.
* For example, suppose you wish to use the apr_table_overlap
* function. You can do this:
*
* #if AP_MODULE_MAGIC_AT_LEAST(19980812,2)
* ... use apr_table_overlap()
* #else
* ... alternative code which doesn't use apr_table_overlap()
* #endif
* </pre>
* @param major The major module magic number
* @param minor The minor module magic number
* @deffunc AP_MODULE_MAGIC_AT_LEAST(int major, int minor)
}
{#define AP_MODULE_MAGIC_AT_LEAST(major,minor) \
((major) < MODULE_MAGIC_NUMBER_MAJOR \
|| ((major) == MODULE_MAGIC_NUMBER_MAJOR \
&& (minor) <= MODULE_MAGIC_NUMBER_MINOR))}
{ @deprecated present for backwards compatibility }
MODULE_MAGIC_NUMBER = MODULE_MAGIC_NUMBER_MAJOR;
//#define MODULE_MAGIC_AT_LEAST old_broken_macro_we_hope_you_are_not_using

View File

@ -1,179 +0,0 @@
{ Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
//#include "apr_thread_proc.h"
{
* @package Multi-Processing Module library
}
{
The MPM, "multi-processing model" provides an abstraction of the
interface with the OS for distributing incoming connections to
threads/process for processing. http_main invokes the MPM, and
the MPM runs until a shutdown/restart has been indicated.
The MPM calls out to the apache core via the ap_process_connection
function when a connection arrives.
The MPM may or may not be multithreaded. In the event that it is
multithreaded, at any instant it guarantees a 1:1 mapping of threads
ap_process_connection invocations.
Note: In the future it will be possible for ap_process_connection
to return to the MPM prior to finishing the entire connection; and
the MPM will proceed with asynchronous handling for the connection;
in the future the MPM may call ap_process_connection again -- but
does not guarantee it will occur on the same thread as the first call.
The MPM further guarantees that no asynchronous behaviour such as
longjmps and signals will interfere with the user code that is
invoked through ap_process_connection. The MPM may reserve some
signals for its use (i.e. SIGUSR1), but guarantees that these signals
are ignored when executing outside the MPM code itself. (This
allows broken user code that does not handle EINTR to function
properly.)
The suggested server restart and stop behaviour will be "graceful".
However the MPM may choose to terminate processes when the user
requests a non-graceful restart/stop. When this occurs, the MPM kills
all threads with extreme prejudice, and destroys the pchild pool.
User cleanups registered in the pchild apr_pool_t will be invoked at
this point. (This can pose some complications, the user cleanups
are asynchronous behaviour not unlike longjmp/signal... but if the
admin is asking for a non-graceful shutdown, how much effort should
we put into doing it in a nice way?)
unix/posix notes:
- The MPM does not set a SIGALRM handler, user code may use SIGALRM.
But the preferred method of handling timeouts is to use the
timeouts provided by the BUFF abstraction.
- The proper setting for SIGPIPE is SIG_IGN, if user code changes it
for any of their own processing, it must be restored to SIG_IGN
prior to executing or returning to any apache code.
TODO: add SIGPIPE debugging check somewhere to make sure it's SIG_IGN
}
{
* This is the function that MPMs must create. This function is responsible
* for controlling the parent and child processes. It will run until a
* restart/shutdown is indicated.
* @param pconf the configuration pool, reset before the config file is read
* @param plog the log pool, reset after the config file is read
* @param server_conf the global server config.
* @return 1 for shutdown 0 otherwise.
* @deffunc int ap_mpm_run(apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf)
}
function ap_mpm_run(pconf, plog: Papr_pool_t; server_conf: Pserver_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_mpm_run' + LibSuff12;
{
* predicate indicating if a graceful stop has been requested ...
* used by the connection loop
* @return 1 if a graceful stop has been requested, 0 otherwise
* @deffunc int ap_graceful_stop_signalled(*void)
}
function ap_graceful_stop_signalled: Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_graceful_stop_signalled' + LibSuff0;
{
* Spawn a process with privileges that another module has requested
* @param r The request_rec of the current request
* @param newproc The resulting process handle.
* @param progname The program to run
* @param const_args the arguments to pass to the new program. The first
* one should be the program name.
* @param env The new environment apr_table_t for the new process. This
* should be a list of NULL-terminated strings.
* @param attr the procattr we should use to determine how to create the new
* process
* @param p The pool to use.
}
function ap_os_create_privileged_process(
const r: Prequest_rec;
newproc: Papr_proc_t;
const progname, args, env: PChar;
attr: Papr_procattr_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_os_create_privileged_process' + LibSuff28;
const
{ Subtypes/Values for AP_MPMQ_IS_THREADED and AP_MPMQ_IS_FORKED }
AP_MPMQ_NOT_SUPPORTED = 0; { This value specifies whether }
{ an MPM is capable of }
{ threading or forking. }
AP_MPMQ_STATIC = 1; { This value specifies whether }
{ an MPM is using a static # }
{ threads or daemons. }
AP_MPMQ_DYNAMIC = 2; { This value specifies whether }
{ an MPM is using a dynamic # }
{ threads or daemons. }
{ Values returned for AP_MPMQ_MPM_STATE }
AP_MPMQ_STARTING = 0;
AP_MPMQ_RUNNING = 1;
AP_MPMQ_STOPPING = 2;
AP_MPMQ_MAX_DAEMON_USED = 1; { Max # of daemons used so far }
AP_MPMQ_IS_THREADED = 2; { MPM can do threading }
AP_MPMQ_IS_FORKED = 3; { MPM can do forking }
AP_MPMQ_HARD_LIMIT_DAEMONS = 4; { The compiled max # daemons }
AP_MPMQ_HARD_LIMIT_THREADS = 5; { The compiled max # threads }
AP_MPMQ_MAX_THREADS = 6; { # of threads/child by config }
AP_MPMQ_MIN_SPARE_DAEMONS = 7; { Min # of spare daemons }
AP_MPMQ_MIN_SPARE_THREADS = 8; { Min # of spare threads }
AP_MPMQ_MAX_SPARE_DAEMONS = 9; { Max # of spare daemons }
AP_MPMQ_MAX_SPARE_THREADS = 10; { Max # of spare threads }
AP_MPMQ_MAX_REQUESTS_DAEMON = 11; { Max # of requests per daemon }
AP_MPMQ_MAX_DAEMONS = 12; { Max # of daemons by config }
AP_MPMQ_MPM_STATE = 13; { starting, running, stopping }
{
* Query a property of the current MPM.
* @param query_code One of APM_MPMQ_*
* @param result A location to place the result of the query
* @return APR_SUCCESS or APR_ENOTIMPL
* @deffunc int ap_mpm_query(int query_code, int *result)
}
function ap_mpm_query(query_code: Integer; result: PInteger): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_mpm_query' + LibSuff8;
{ Defining GPROF when compiling uses the moncontrol() function to
* disable gprof profiling in the parent, and enable it only for
* request processing in children (or in one_process mode). It's
* absolutely required to get useful gprof results under linux
* because the profile itimers and such are disabled across a
* fork(). It's probably useful elsewhere as well.
}
{#ifdef GPROF
extern void moncontrol(int);
#define AP_MONCONTROL(x) moncontrol(x)
#else
#define AP_MONCONTROL(x)
#endif}
{$ifdef AP_ENABLE_EXCEPTION_HOOK}
type
ap_exception_info_t = record
sig: Integer;
pid: pid_t;
end;
AP_DECLARE_HOOK(int,fatal_exception,(ap_exception_info_t *ei))
{$endif} {AP_ENABLE_EXCEPTION_HOOK}

View File

@ -1,50 +0,0 @@
{ Copyright 2002-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
//#include "ap_config.h"
{
* @package Provider API
}
{
* This function is used to register a provider with the global
* provider pool.
* @param pool The pool to create any storage from
* @param provider_group The group to store the provider in
* @param provider_name The name for this provider
* @param provider_version The version for this provider
* @param provider Opaque structure for this provider
* @return APR_SUCCESS if all went well
}
function ap_register_provider(pool: Papr_pool_t;
const provider_group, provider_name, provider_version: PChar;
const provider: Pointer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_register_provider' + LibSuff20;
{
* This function is used to retrieve a provider from the global
* provider pool.
* @param provider_group The group to look for this provider in
* @param provider_name The name for the provider
* @param provider_version The version for the provider
* @return provider pointer to provider if found, NULL otherwise
}
function ap_lookup_provider(provider_group, provider_name, provider_version: PChar): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_lookup_provider' + LibSuff12;

View File

@ -1,53 +0,0 @@
{ Copyright 2001-2005 The Apache Software Foundation or its licensors, as applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
//#include "apr_general.h" /* stringify */
const
AP_SERVER_COPYRIGHT =
'Copyright 2001-2006 The Apache Software Foundation' +
' or its licensors, as applicable.';
{
* The below defines the base string of the Server: header. Additional
* tokens can be added via the ap_add_version_component() API call.
*
* The tokens are listed in order of their significance for identifying the
* application.
*
* "Product tokens should be short and to the point -- use of them for
* advertizing or other non-essential information is explicitly forbidden."
*
* Example: "Apache/1.1.0 MrWidget/0.1-alpha"
}
AP_SERVER_BASEVENDOR = 'Apache Software Foundation';
AP_SERVER_BASEPRODUCT = 'Apache';
AP_SERVER_MAJORVERSION_NUMBER = 2;
AP_SERVER_MINORVERSION_NUMBER = 0;
AP_SERVER_PATCHLEVEL_NUMBER = 58;
AP_SERVER_ADD_STRING = '';
{ keep old macros as well }
{#define AP_SERVER_MAJORVERSION APR_STRINGIFY(AP_SERVER_MAJORVERSION_NUMBER)
#define AP_SERVER_MINORVERSION APR_STRINGIFY(AP_SERVER_MINORVERSION_NUMBER)
#define AP_SERVER_PATCHLEVEL APR_STRINGIFY(AP_SERVER_PATCHLEVEL_NUMBER) \
AP_SERVER_ADD_STRING
#define AP_SERVER_MINORREVISION AP_SERVER_MAJORVERSION "." AP_SERVER_MINORVERSION
#define AP_SERVER_BASEREVISION AP_SERVER_MINORREVISION "." AP_SERVER_PATCHLEVEL
#define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION
#define AP_SERVER_VERSION AP_SERVER_BASEVERSION}

View File

@ -1,246 +0,0 @@
{
apr.pas
Copyright (C) 2006 Felipe Monteiro de Carvalho
This unit is a pascal binding for the Apache 2.0.58 headers.
The headers were released under the following copyright:
}
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
unit apr;
interface
{$ifdef fpc}
{$mode delphi}{$H+}
{$endif}
{$IFNDEF FPC}
{$DEFINE WINDOWS}
{$ENDIF}
{$IFDEF WIN32}
{$DEFINE WINDOWS}
{$ENDIF}
{$ifdef Unix}
{$PACKRECORDS C}
{$endif}
{$define Apache2_0}
uses
{$ifdef WINDOWS}
Windows, winsock,
{$ELSE}
UnixType,
{$ENDIF}
SysUtils, ctypes;
const
{$IFDEF WINDOWS}
LibAPR = 'libapr.dll';
{$ELSE}
LibAPR = '';
{$ENDIF}
{$IFDEF WINDOWS}
LibNamePrefix = '_';
LibSuff0 = '@0';
LibSuff4 = '@4';
LibSuff8 = '@8';
LibSuff12 = '@12';
LibSuff16 = '@16';
LibSuff20 = '@20';
LibSuff24 = '@24';
LibSuff28 = '@28';
LibSuff32 = '@32';
{$ELSE}
LibNamePrefix = '';
LibSuff0 = '';
LibSuff4 = '';
LibSuff8 = '';
LibSuff12 = '';
LibSuff16 = '';
LibSuff20 = '';
LibSuff24 = '';
LibSuff28 = '';
LibSuff32 = '';
{$ENDIF}
type
uid_t = Integer;
gid_t = Integer;
time_t = LongInt;
size_t = Integer;
pid_t = Integer;
Ppid_t = ^pid_t;
apr_uint16_t = Word;
apr_uint32_t = Cardinal;
apr_int64_t = Int64;
apr_uint64_t = Int64;
apr_socklen_t = Integer;
apr_uint32_tso_handle_t = cuint;
type
{$IFDEF WINDOWS}
apr_off_t = Int64;
{$ENDIF}
{$IFDEF UNIX}
apr_off_t = Integer;
{$ENDIF}
apr_int32_t = Integer;
Papr_int32_t = ^Integer;
apr_size_t = size_t;
Papr_size_t = ^apr_size_t;
apr_int16_t = SmallInt;
Papr_int16_t = ^SmallInt;
// Network structures
sockaddr = record
sa_family: cushort; // address family, AF_xxx
sa_data: array [1..14] of Char; // (NBO) 14 bytes of protocol address
end;
{$ifndef windows}
va_list = Pointer;
in_addr = record
s_addr: culong; // load with inet_aton()
end;
sockaddr_in = record
sin_family: cshort; // e.g. AF_INET
sin_port: cushort; // e.g. htons(3490)
sin_addr: in_addr; // see struct in_addr, below
sin_zero: array [1..8] of Char; // zero this if you want to
end;
{$endif}
in6_addr = record
Case Integer of
1: (u6_addr8: array [1..16] of Byte);
2: (u6_addr16: array [1..8] of Word);
3: (u6_addr32: array [1..4] of Cardinal);
end;
//#define s6_addr in6_u.u6_addr8
//#define s6_addr16 in6_u.u6_addr16
//#define s6_addr32 in6_u.u6_addr32
sockaddr_in6 = record
sin6_family: cushort;
sin6_port: Word;
sin6_flowinfo: Cardinal;
sin6_addr: in6_addr;
sin6_scope_id: Cardinal;
end;
// TEMPORARY
Papr_xml_ns_scope = Pointer;
Pap_method_list_t = Pointer;
Pcore_output_filter_ctx_t = Pointer;
Pap_directive_t = Pointer;
Pap_filter_t = Pointer;
Papr_file_t = Pointer;
Papr_off_t = Pointer;
iovec = record
/// byte count to read/write
iov_len: culong;
/// data to be read/written
iov_base: PChar;
end;
Piovec = ^iovec;
{$include apr_errno.inc}
{$include apr_pools.inc}
{$include apr_general.inc}
{$include apr_dso.inc}
{$include apr_user.inc}
{$include apr_time.inc}
{$include apr_tables.inc}
{$include apr_file_info.inc}
{$include apr_file_io.inc}
{$include apr_strings.inc}
{$include apr_lib.inc}
{$include apr_signal.inc}
{$include apr_network_io.inc}
{.$include apr_portable.inc}
{.$include ../aprutils/apr_uri.inc}
{$include apr_thread_proc.inc}
{$include apr_version.inc}
{$include apr_poll.inc}
implementation
{
Macros transformed into functions in the translation
}
{ apr_pools.inc }
{$ifndef DOXYGEN}
function apr_pool_create(newpool: PPapr_pool_t; parent: Papr_pool_t): apr_status_t;
begin
Result := apr_pool_create_ex(newpool, parent, nil, nil);
end;
{$endif}
function apr_pool_sub_make(newpool: PPapr_pool_t; parent: Papr_pool_t;
abort_fn: apr_abortfunc_t): apr_status_t;
begin
Result := apr_pool_create_ex(newpool, parent, abort_fn, nil);
end;
{ apr_lib.inc }
function apr_tolower(c: Char): Char;
var
buf: array[0..1] of Char;
begin
buf[0] := c;
buf[1] := #0;
buf := StrLower(@buf[0]);
Result := buf[0];
end;
function apr_toupper(c: Char): Char;
var
buf: array[0..1] of Char;
begin
buf[0] := c;
buf[1] := #0;
buf := StrUpper(@buf[0]);
Result := buf[0];
end;
end.

View File

@ -1,174 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_allocator.h
* @brief APR Internal Memory Allocation
}
{#include "apr.h"
#include "apr_errno.h"
#define APR_WANT_MEMFUNC < For no good reason?
#include "apr_want.h"}
{
* @defgroup apr_allocator Internal Memory Allocation
* @ingroup APR
}
type
{ the allocator structure }
apr_allocator_t = record end;
Papr_allocator_t = ^apr_allocator_t;
PPapr_allocator_t = ^Papr_allocator_t;
{ the structure which holds information about the allocation }
Papr_memnode_t = ^apr_memnode_t;
PPapr_memnode_t = ^Papr_memnode_t;
{ basic memory node structure }
apr_memnode_t = record
next: Papr_memnode_t; {< next memnode }
ref: PPapr_memnode_t; {< reference to self }
index: apr_uint32_t; {< size }
free_index: apr_uint32_t; {< how much free }
first_avail: PChar; {< pointer to first free memory }
endp: PChar; {< pointer to end of free memory }
end;
{ The base size of a memory node - aligned. }
//#define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(apr_memnode_t))
{ Symbolic constants }
const
APR_ALLOCATOR_MAX_FREE_UNLIMITED = 0;
{
* Create a new allocator
* @param allocator The allocator we have just created.
*
}
function apr_allocator_create(allocator: PPapr_allocator_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_create' + LibSuff4;
{
* Destroy an allocator
* @param allocator The allocator to be destroyed
* @remark Any memnodes not given back to the allocator prior to destroying
* will _not_ be free()d.
}
procedure apr_allocator_destroy(allocator: Papr_allocator_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_destroy' + LibSuff4;
{
* Allocate a block of mem from the allocator
* @param allocator The allocator to allocate from
* @param size The size of the mem to allocate (excluding the
* memnode structure)
}
function apr_allocator_alloc(allocator: Papr_allocator_t;
size: apr_size_t): Papr_memnode_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_alloc' + LibSuff8;
{
* Free a block of mem, giving it back to the allocator
* @param allocator The allocator to give the mem back to
* @param memnode The memory node to return
}
procedure apr_allocator_free(allocator: Papr_allocator_t; memnode: Papr_memnode_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_free' + LibSuff8;
//#include "apr_pools.h"
{
* Set the owner of the allocator
* @param allocator The allocator to set the owner for
* @param pool The pool that is to own the allocator
* @remark Typically pool is the highest level pool using the allocator
}
{
* XXX: see if we can come up with something a bit better. Currently
* you can make a pool an owner, but if the pool doesn't use the allocator
* the allocator will never be destroyed.
}
procedure apr_allocator_owner_set(allocator: Papr_allocator_t; pool: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_owner_set' + LibSuff8;
{ @deprecated @see apr_allocator_owner_set }
{APR_DECLARE(void) apr_allocator_set_owner(apr_allocator_t *allocator,
apr_pool_t *pool);
}
{
* Get the current owner of the allocator
* @param allocator The allocator to get the owner from
}
function apr_allocator_owner_get(allocator: Papr_allocator_t): Papr_pool_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_owner_get' + LibSuff4;
{ @deprecated @see apr_allocator_owner_get }
{APR_DECLARE(apr_pool_t *) apr_allocator_get_owner(
apr_allocator_t *allocator);
}
{
* Set the current threshold at which the allocator should start
* giving blocks back to the system.
* @param allocator The allocator the set the threshold on
* @param size The threshold. 0 == unlimited.
}
procedure apr_allocator_max_free_set(allocator: Papr_allocator_t; size: apr_size_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_max_free_set' + LibSuff8;
{ @deprecated @see apr_allocator_max_free_set }
{APR_DECLARE(void) apr_allocator_set_max_free(apr_allocator_t *allocator,
apr_size_t size);
#include "apr_thread_mutex.h"}
{$ifdef APR_HAS_THREADS}
{
* Set a mutex for the allocator to use
* @param allocator The allocator to set the mutex for
* @param mutex The mutex
}
APR_DECLARE(void) apr_allocator_mutex_set(apr_allocator_t *allocator,
apr_thread_mutex_t *mutex);
{ @deprecated @see apr_allocator_mutex_set }
APR_DECLARE(void) apr_allocator_set_mutex(apr_allocator_t *allocator,
apr_thread_mutex_t *mutex);
{
* Get the mutex currently set for the allocator
* @param allocator The allocator
}
APR_DECLARE(apr_thread_mutex_t *) apr_allocator_mutex_get(
apr_allocator_t *allocator);
{ @deprecated @see apr_allocator_mutex_get }
APR_DECLARE(apr_thread_mutex_t *) apr_allocator_get_mutex(
apr_allocator_t *allocator);
{$endif} { APR_HAS_THREADS }

File diff suppressed because it is too large Load Diff

View File

@ -1,95 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_dso.h
* @brief APR Dynamic Object Handling Routines
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_errno.h"}
{
* @defgroup apr_dso Dynamic Object Handling
* @ingroup APR
}
{$define APR_HAS_DSO}
{$if defined(APR_HAS_DSO) or defined(DOXYGEN)}
{
* Structure for referencing dynamic objects
}
type
apr_dso_handle_t = record
end;
Papr_dso_handle_t = ^apr_dso_handle_t;
PPapr_dso_handle_t = ^Papr_dso_handle_t;
{
* Structure for referencing symbols from dynamic objects
}
apr_dso_handle_sym_t = Pointer;
Papr_dso_handle_sym_t = ^apr_dso_handle_sym_t;
PPapr_dso_handle_sym_t = ^Papr_dso_handle_sym_t;
{
* Load a DSO library.
* @param res_handle Location to store new handle for the DSO.
* @param path Path to the DSO library
* @param ctx Pool to use.
* @bug We aught to provide an alternative to RTLD_GLOBAL, which
* is the only supported method of loading DSOs today.
}
function apr_dso_load(res_handle: PPapr_dso_handle_t; const path: PChar;
ctx: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dso_load' + LibSuff12;
{
* Close a DSO library.
* @param handle handle to close.
}
function apr_dso_unload(handle: Papr_dso_handle_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dso_unload' + LibSuff4;
{
* Load a symbol from a DSO handle.
* @param ressym Location to store the loaded symbol
* @param handle handle to load the symbol from.
* @param symname Name of the symbol to load.
}
function apr_dso_sym(ressym: Papr_dso_handle_t; handle: Papr_dso_handle_t;
const symname: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dso_sym' + LibSuff12;
{
* Report more information when a DSO function fails.
* @param dso The dso handle that has been opened
* @param buf Location to store the dso error
* @param bufsize The size of the provided buffer
}
function apr_dso_error(dso: Papr_dso_handle_t; buf: PChar;
bufsize: apr_size_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dso_error' + LibSuff12;
{$endif}

File diff suppressed because it is too large Load Diff

View File

@ -1,434 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_file_info.h
* @brief APR File Information
}
{#include "apr.h"
#include "apr_user.h"
#include "apr_pools.h"
#include "apr_tables.h"
#include "apr_time.h"
#include "apr_errno.h"
#if APR_HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif}
{
* @defgroup apr_file_info File Information
* @ingroup APR
}
{ Many applications use the type member to determine the
* existance of a file or initialization of the file info,
* so the APR_NOFILE value must be distinct from APR_UNKFILE.
}
{ apr_filetype_e values for the filetype member of the
* apr_file_info_t structure
* @warning: Not all of the filetypes below can be determined.
* For example, a given platform might not correctly report
* a socket descriptor as APR_SOCK if that type isn't
* well-identified on that platform. In such cases where
* a filetype exists but cannot be described by the recognized
* flags below, the filetype will be APR_UNKFILE. If the
* filetype member is not determined, the type will be APR_NOFILE.
}
type
apr_filetype_e = (
APR_NOFILE = 0, {< no file type determined }
APR_REG, {< a regular file }
APR_DIR, {< a directory }
APR_CHR, {< a character device }
APR_BLK, {< a block device }
APR_PIPE, {< a FIFO / pipe }
APR_LNK, {< a symbolic link }
APR_SOCK, {< a [unix domain] socket }
APR_UNKFILE = 127 {< a file of some other unknown type }
);
{
* @defgroup apr_file_permissions File Permissions flags
* @
}
const
APR_USETID = $8000; {< Set user id }
APR_UREAD = $0400; {< Read by user }
APR_UWRITE = $0200; {< Write by user }
APR_UEXECUTE = $0100; {< Execute by user }
APR_GSETID = $4000; {< Set group id }
APR_GREAD = $0040; {< Read by group }
APR_GWRITE = $0020; {< Write by group }
APR_GEXECUTE = $0010; {< Execute by group }
APR_WSTICKY = $2000; {< Sticky bit }
APR_WREAD = $0004; {< Read by others }
APR_WWRITE = $0002; {< Write by others }
APR_WEXECUTE = $0001; {< Execute by others }
APR_OS_DEFAULT = $0FFF; {< use OS's default permissions }
{ additional permission flags for apr_file_copy and apr_file_append }
APR_FILE_SOURCE_PERMS = $1000; {< Copy source file's permissions }
{
* Structure for referencing directories.
}
type
apr_dir_t = record end;
Papr_dir_t = ^apr_dir_t;
PPapr_dir_t = ^Papr_dir_t;
{
* Structure for determining file permissions.
}
apr_fileperms_t = apr_int32_t;
{$if defined(WIN32) or defined(NETWARE)}
{
* Structure for determining the inode of the file.
}
apr_ino_t = apr_uint64_t;
{
* Structure for determining the device the file is on.
}
apr_dev_t = apr_uint32_t;
{$else}
{ The inode of the file. }
apr_ino_t = ino_t;
{
* Structure for determining the device the file is on.
}
apr_dev_t = dev_t;
{$endif}
{
* @defgroup apr_file_stat Stat Functions
* @
}
const
APR_FINFO_LINK = $00000001; {< Stat the link not the file itself if it is a link }
APR_FINFO_MTIME = $00000010; {< Modification Time }
APR_FINFO_CTIME = $00000020; {< Creation Time }
APR_FINFO_ATIME = $00000040; {< Access Time }
APR_FINFO_SIZE = $00000100; {< Size of the file }
APR_FINFO_CSIZE = $00000200; {< Storage size consumed by the file }
APR_FINFO_DEV = $00001000; {< Device }
APR_FINFO_INODE = $00002000; {< Inode }
APR_FINFO_NLINK = $00004000; {< Number of links }
APR_FINFO_TYPE = $00008000; {< Type }
APR_FINFO_USER = $00010000; {< User }
APR_FINFO_GROUP = $00020000; {< Group }
APR_FINFO_UPROT = $00100000; {< User protection bits }
APR_FINFO_GPROT = $00200000; {< Group protection bits }
APR_FINFO_WPROT = $00400000; {< World protection bits }
APR_FINFO_ICASE = $01000000; {< if dev is case insensitive }
APR_FINFO_NAME = $02000000; {< ->name in proper case }
APR_FINFO_MIN = $00008170; {< type, mtime, ctime, atime, size }
APR_FINFO_IDENT = $00003000; {< dev and inode }
APR_FINFO_OWNER = $00030000; {< user and group }
APR_FINFO_PROT = $00700000; {< all protections }
APR_FINFO_NORM = $0073b170; {< an atomic unix apr_stat() }
APR_FINFO_DIRENT = $02000000; {< an atomic unix apr_dir_read() }
{
* The file information structure. This is analogous to the POSIX
* stat structure.
}
type
apr_finfo_t = record
{ Allocates memory and closes lingering handles in the specified pool }
pool: Papr_pool_t;
{ The bitmask describing valid fields of this apr_finfo_t structure
* including all available 'wanted' fields and potentially more }
valid: apr_int32_t;
{ The access permissions of the file. Mimics Unix access rights. }
protection: apr_fileperms_t;
{ The type of file. One of APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE,
* APR_LNK or APR_SOCK. If the type is undetermined, the value is APR_NOFILE.
* If the type cannot be determined, the value is APR_UNKFILE.
}
filetype: apr_filetype_e;
{ The user id that owns the file }
user: apr_uid_t;
{ The group id that owns the file }
group: apr_gid_t;
{ The inode of the file. }
inode: apr_ino_t;
{ The id of the device the file is on. }
device: apr_dev_t;
{ The number of hard links to the file. }
nlink: apr_int32_t;
{ The size of the file }
size: apr_off_t;
{ The storage size consumed by the file }
csize: apr_off_t;
{ The time the file was last accessed }
atime: apr_time_t;
{ The time the file was last modified }
mtime: apr_time_t;
{ The time the file was last changed }
ctime: apr_time_t;
{ The pathname of the file (possibly unrooted) }
fname: PChar;
{ The file's name (no path) in filesystem case }
name: PChar;
{ The file's handle, if accessed (can be submitted to apr_duphandle) }
filehand: Papr_file_t;
end;
Papr_finfo_t = ^apr_finfo_t;
{
* get the specified file's stats. The file is specified by filename,
* instead of using a pre-opened file.
* @param finfo Where to store the information about the file, which is
* never touched if the call fails.
* @param fname The name of the file to stat.
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
values
* @param cont the pool to use to allocate the new file.
*
* @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
* not be filled in, and you need to check the @c finfo->valid bitmask
* to verify that what you're looking for is there.
}
function apr_stat(finfo: Papr_finfo_t; const fname: PChar;
wanted: apr_int32_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_stat' + LibSuff16;
{
* get the specified file's stats. The file is specified by filename,
* instead of using a pre-opened file. If the file is a symlink, this function
* will get the stats for the symlink not the file the symlink refers to.
* @param finfo Where to store the information about the file, which is
* never touched if the call fails.
* @param fname The name of the file to stat.
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
* @param cont the pool to use to allocate the new file.
* @deprecated This function is deprecated, it's equivalent to calling apr_stat with
* the wanted flag value APR_FINFO_LINK
}
function apr_lstat(finfo: Papr_finfo_t; const fname: PChar;
wanted: apr_int32_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_lstat' + LibSuff16;
{
* @defgroup apr_dir Directory Manipulation Functions
}
{
* Open the specified directory.
* @param new_dir The opened directory descriptor.
* @param dirname The full path to the directory (use / on all systems)
* @param cont The pool to use.
}
function apr_dir_open(new_dir: PPapr_dir_t; const dirname: PChar;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_open' + LibSuff12;
{
* close the specified directory.
* @param thedir the directory descriptor to close.
}
function apr_dir_close(thedir: Papr_dir_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_close' + LibSuff4;
{
* Read the next entry from the specified directory.
* @param finfo the file info structure and filled in by apr_dir_read
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
values
* @param thedir the directory descriptor returned from apr_dir_open
* @remark No ordering is guaranteed for the entries read.
*
* @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
* not be filled in, and you need to check the @c finfo->valid bitmask
* to verify that what you're looking for is there.
}
function apr_dir_read(finfo: Papr_finfo_t; wanted: apr_int32_t;
thedir: Papr_dir_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_read' + LibSuff12;
{
* Rewind the directory to the first entry.
* @param thedir the directory descriptor to rewind.
}
function apr_dir_rewind(thedir: Papr_dir_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_rewind' + LibSuff4;
{
* @defgroup apr_filepath Filepath Manipulation Functions
}
const
{ Cause apr_filepath_merge to fail if addpath is above rootpath }
APR_FILEPATH_NOTABOVEROOT = $01;
{ internal: Only meaningful with APR_FILEPATH_NOTABOVEROOT }
APR_FILEPATH_SECUREROOTTEST =$02;
{ Cause apr_filepath_merge to fail if addpath is above rootpath,
* even given a rootpath /foo/bar and an addpath ../bar/bash
}
APR_FILEPATH_SECUREROOT = $03;
{ Fail apr_filepath_merge if the merged path is relative }
APR_FILEPATH_NOTRELATIVE = $04;
{ Fail apr_filepath_merge if the merged path is absolute }
APR_FILEPATH_NOTABSOLUTE = $08;
{ Return the file system's native path format (e.g. path delimiters
* of ':' on MacOS9, '\' on Win32, etc.) }
APR_FILEPATH_NATIVE = $10;
{ Resolve the true case of existing directories and file elements
* of addpath, (resolving any aliases on Win32) and append a proper
* trailing slash if a directory
}
APR_FILEPATH_TRUENAME = $20;
{
* Extract the rootpath from the given filepath
* @param rootpath the root file path returned with APR_SUCCESS or APR_EINCOMPLETE
* @param filepath the pathname to parse for its root component
* @param flags the desired rules to apply, from
* <PRE>
* APR_FILEPATH_NATIVE Use native path seperators (e.g. '\' on Win32)
* APR_FILEPATH_TRUENAME Tests that the root exists, and makes it proper
* </PRE>
* @param p the pool to allocate the new path string from
* @remark on return, filepath points to the first non-root character in the
* given filepath. In the simplest example, given a filepath of "/foo",
* returns the rootpath of "/" and filepath points at "foo". This is far
* more complex on other platforms, which will canonicalize the root form
* to a consistant format, given the APR_FILEPATH_TRUENAME flag, and also
* test for the validity of that root (e.g., that a drive d:/ or network
* share //machine/foovol/).
* The function returns APR_ERELATIVE if filepath isn't rooted (an
* error), APR_EINCOMPLETE if the root path is ambigious (but potentially
* legitimate, e.g. "/" on Windows is incomplete because it doesn't specify
* the drive letter), or APR_EBADPATH if the root is simply invalid.
* APR_SUCCESS is returned if filepath is an absolute path.
}
function apr_filepath_root(const rootpath, filepath: PPChar;
flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_root' + LibSuff16;
{
* Merge additional file path onto the previously processed rootpath
* @param newpath the merged paths returned
* @param rootpath the root file path (NULL uses the current working path)
* @param addpath the path to add to the root path
* @param flags the desired APR_FILEPATH_ rules to apply when merging
* @param p the pool to allocate the new path string from
* @remark if the flag APR_FILEPATH_TRUENAME is given, and the addpath
* contains wildcard characters ('*', '?') on platforms that don't support
* such characters within filenames, the paths will be merged, but the
* result code will be APR_EPATHWILD, and all further segments will not
* reflect the true filenames including the wildcard and following segments.
}
function apr_filepath_merge(newpath: PPChar; const rootpath, addpath: PPChar;
flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_merge' + LibSuff20;
{
* Split a search path into separate components
* @param pathelts the returned components of the search path
* @param liststr the search path (e.g., <tt>getenv("PATH")</tt>)
* @param p the pool to allocate the array and path components from
* @remark empty path componenta do not become part of @a pathelts.
* @remark the path separator in @a liststr is system specific;
* e.g., ':' on Unix, ';' on Windows, etc.
}
function apr_filepath_list_split(pathelts: PPapr_array_header_t;
const liststr: PChar; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_list_split' + LibSuff12;
{
* Merge a list of search path components into a single search path
* @param liststr the returned search path; may be NULL if @a pathelts is empty
* @param pathelts the components of the search path
* @param p the pool to allocate the search path from
* @remark emtpy strings in the source array are ignored.
* @remark the path separator in @a liststr is system specific;
* e.g., ':' on Unix, ';' on Windows, etc.
}
function apr_filepath_list_merge(liststr: PPChar;
pathelts: Papr_array_header_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_list_merge' + LibSuff12;
{
* Return the default file path (for relative file names)
* @param path the default path string returned
* @param flags optional flag APR_FILEPATH_NATIVE to retrieve the
* default file path in os-native format.
* @param p the pool to allocate the default path string from
}
function apr_filepath_get(path: PPChar; flags: apr_int32_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_get' + LibSuff12;
{
* Set the default file path (for relative file names)
* @param path the default path returned
* @param p the pool to allocate any working storage
}
function apr_filepath_set(const path: PChar; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_set' + LibSuff8;
const
{ The FilePath character encoding is unknown }
APR_FILEPATH_ENCODING_UNKNOWN = 0;
{ The FilePath character encoding is locale-dependent }
APR_FILEPATH_ENCODING_LOCALE = 1;
{ The FilePath character encoding is UTF-8 }
APR_FILEPATH_ENCODING_UTF8 = 2;
{
* Determine the encoding used internally by the FilePath functions
* @param style points to a variable which receives the encoding style flag
* @param p the pool to allocate any working storage
* @remark Use @c apr_os_locale_encoding and/or @c apr_os_default_encoding
* to get the name of the path encoding if it's not UTF-8.
}
function apr_filepath_encoding(style: PInteger; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_encoding' + LibSuff8;

View File

@ -1,807 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_file_io.h
* @brief APR File I/O Handling
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_time.h"
#include "apr_errno.h"}
{.$include apr_file_info.inc}
{#include "apr_inherit.h"}
//#define APR_WANT_STDIO {< for SEEK_* }
//#define APR_WANT_IOVEC {< for apr_file_writev }
//#include "apr_want.h"
{
* @defgroup apr_file_io File I/O Handling Functions
* @ingroup APR
}
{
* @defgroup apr_file_open_flags File Open Flags/Routines
}
{ Note to implementors: Values in the range 0x00100000--0x80000000
are reserved for platform-specific values. }
const
APR_READ = $00001; {< Open the file for reading }
APR_WRITE = $00002; {< Open the file for writing }
APR_CREATE = $00004; {< Create the file if not there }
APR_APPEND = $00008; {< Append to the end of the file }
APR_TRUNCATE = $00010; {< Open the file and truncate to 0 length }
APR_BINARY = $00020; {< Open the file in binary mode }
APR_EXCL = $00040; {< Open should fail if APR_CREATE and file
exists. }
APR_BUFFERED = $00080; {< Open the file for buffered I/O }
APR_DELONCLOSE =$00100; {< Delete the file after close }
APR_XTHREAD = $00200; {< Platform dependent tag to open the file
for use across multiple threads }
APR_SHARELOCK = $00400; {< Platform dependent support for higher
level locked read/write access to support
writes across process/machines }
APR_FILE_NOCLEANUP =$00800; {< Do not register a cleanup when the file
is opened }
APR_SENDFILE_ENABLED =$01000; {< Advisory flag that this file should
support apr_sendfile operation }
APR_LARGEFILE = $04000; {< Platform dependent flag to enable large file
support; WARNING see below. }
{ @warning The APR_LARGEFILE flag only has effect on some platforms
* where sizeof(apr_off_t) == 4. Where implemented, it allows opening
* and writing to a file which exceeds the size which can be
* represented by apr_off_t (2 gigabytes). When a file's size does
* exceed 2Gb, apr_file_info_get() will fail with an error on the
* descriptor, likewise apr_stat()/apr_lstat() will fail on the
* filename. apr_dir_read() will fail with APR_INCOMPLETE on a
* directory entry for a large file depending on the particular
* APR_FINFO_* flags. Generally, it is not recommended to use this
* flag. }
{
* @defgroup apr_file_seek_flags File Seek Flags
}
{
* @defgroup apr_file_attrs_set_flags File Attribute Flags
}
{ flags for apr_file_attrs_set }
APR_FILE_ATTR_READONLY = $01; {< File is read-only }
APR_FILE_ATTR_EXECUTABLE =$02; {< File is executable }
APR_FILE_ATTR_HIDDEN = $04; {< File is hidden }
{ File attributes }
type
apr_fileattrs_t = apr_uint32_t;
{ should be same as whence type in lseek, POSIX defines this as int }
apr_seek_where_t = Integer;
{
* Structure for referencing files.
}
apr_file_t = record end;
// Papr_file_t = ^apr_file_t;
PPapr_file_t = ^Papr_file_t;
{ File lock types/flags }
{
* @defgroup apr_file_lock_types File Lock Types
}
const
APR_FLOCK_SHARED = 1; {< Shared lock. More than one process
or thread can hold a shared lock
at any given time. Essentially,
this is a "read lock", preventing
writers from establishing an
exclusive lock. }
APR_FLOCK_EXCLUSIVE = 2; {< Exclusive lock. Only one process
may hold an exclusive lock at any
given time. This is analogous to
a "write lock". }
APR_FLOCK_TYPEMASK = $000F; {< mask to extract lock type }
APR_FLOCK_NONBLOCK = $0010; {< do not block while acquiring the
file lock }
{
* Open the specified file.
* @param newf The opened file descriptor.
* @param fname The full path to the file (using / on all systems)
* @param flag Or'ed value of:
* <PRE>
* APR_READ open for reading
* APR_WRITE open for writing
* APR_CREATE create the file if not there
* APR_APPEND file ptr is set to end prior to all writes
* APR_TRUNCATE set length to zero if file exists
* APR_BINARY not a text file (This flag is ignored on
* UNIX because it has no meaning)
* APR_BUFFERED buffer the data. Default is non-buffered
* APR_EXCL return error if APR_CREATE and file exists
* APR_DELONCLOSE delete the file after closing.
* APR_XTHREAD Platform dependent tag to open the file
* for use across multiple threads
* APR_SHARELOCK Platform dependent support for higher
* level locked read/write access to support
* writes across process/machines
* APR_FILE_NOCLEANUP Do not register a cleanup with the pool
* passed in on the <EM>cont</EM> argument (see below).
* The apr_os_file_t handle in apr_file_t will not
* be closed when the pool is destroyed.
* APR_SENDFILE_ENABLED Open with appropriate platform semantics
* for sendfile operations. Advisory only,
* apr_sendfile does not check this flag.
* </PRE>
* @param perm Access permissions for file.
* @param pool The pool to use.
* @remark If perm is APR_OS_DEFAULT and the file is being created, appropriate
* default permissions will be used. *arg1 must point to a valid file_t,
* or NULL (in which case it will be allocated)
}
function apr_file_open(newf: PPapr_file_t; const fname: PChar;
flag: apr_int32_t; perm: apr_fileperms_t;
pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_open' + LibSuff20;
{
* Close the specified file.
* @param file The file descriptor to close.
}
function apr_file_close(file_: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_close' + LibSuff4;
{
* delete the specified file.
* @param path The full path to the file (using / on all systems)
* @param cont The pool to use.
* @remark If the file is open, it won't be removed until all instances are closed.
}
function apr_file_remove(const path: PChar; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_remove' + LibSuff8;
{
* rename the specified file.
* @param from_path The full path to the original file (using / on all systems)
* @param to_path The full path to the new file (using / on all systems)
* @param pool The pool to use.
* @warning If a file exists at the new location, then it will be overwritten.
* Moving files or directories across devices may not be possible.
}
function apr_file_rename(const from_path, to_path: PChar; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_rename' + LibSuff12;
{
* copy the specified file to another file.
* @param from_path The full path to the original file (using / on all systems)
* @param to_path The full path to the new file (using / on all systems)
* @param perms Access permissions for the new file if it is created.
* In place of the usual or'd combination of file permissions, the
* value APR_FILE_SOURCE_PERMS may be given, in which case the source
* file's permissions are copied.
* @param pool The pool to use.
* @remark The new file does not need to exist, it will be created if required.
* @warning If the new file already exists, its contents will be overwritten.
}
function apr_file_copy(const from_path, to_path: PChar;
perms: apr_fileperms_t; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_copy' + LibSuff16;
{
* append the specified file to another file.
* @param from_path The full path to the source file (using / on all systems)
* @param to_path The full path to the destination file (using / on all systems)
* @param perms Access permissions for the destination file if it is created.
* In place of the usual or'd combination of file permissions, the
* value APR_FILE_SOURCE_PERMS may be given, in which case the source
* file's permissions are copied.
* @param pool The pool to use.
* @remark The new file does not need to exist, it will be created if required.
}
function apr_file_append(const from_path, to_path: PChar;
perms: apr_fileperms_t; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_append' + LibSuff16;
{
* Are we at the end of the file
* @param fptr The apr file we are testing.
* @remark Returns APR_EOF if we are at the end of file, APR_SUCCESS otherwise.
}
function apr_file_eof(fptr: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_eof' + LibSuff4;
{
* open standard error as an apr file pointer.
* @param thefile The apr file to use as stderr.
* @param cont The pool to allocate the file out of.
*
* @remark The only reason that the apr_file_open_std* functions exist
* is that you may not always have a stderr/out/in on Windows. This
* is generally a problem with newer versions of Windows and services.
*
* The other problem is that the C library functions generally work
* differently on Windows and Unix. So, by using apr_file_open_std*
* functions, you can get a handle to an APR struct that works with
* the APR functions which are supposed to work identically on all
* platforms.
}
function apr_file_open_stderr(thefile: PPapr_file_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_open_stderr' + LibSuff8;
{
* open standard output as an apr file pointer.
* @param thefile The apr file to use as stdout.
* @param cont The pool to allocate the file out of.
*
* @remark The only reason that the apr_file_open_std* functions exist
* is that you may not always have a stderr/out/in on Windows. This
* is generally a problem with newer versions of Windows and services.
*
* The other problem is that the C library functions generally work
* differently on Windows and Unix. So, by using apr_file_open_std*
* functions, you can get a handle to an APR struct that works with
* the APR functions which are supposed to work identically on all
* platforms.
}
function apr_file_open_stdout(thefile: PPapr_file_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_open_stdout' + LibSuff8;
{
* open standard input as an apr file pointer.
* @param thefile The apr file to use as stdin.
* @param cont The pool to allocate the file out of.
*
* @remark The only reason that the apr_file_open_std* functions exist
* is that you may not always have a stderr/out/in on Windows. This
* is generally a problem with newer versions of Windows and services.
*
* The other problem is that the C library functions generally work
* differently on Windows and Unix. So, by using apr_file_open_std*
* functions, you can get a handle to an APR struct that works with
* the APR functions which are supposed to work identically on all
* platforms.
}
function apr_file_open_stdin(thefile: PPapr_file_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_open_stdin' + LibSuff8;
{
* Read data from the specified file.
* @param thefile The file descriptor to read from.
* @param buf The buffer to store the data to.
* @param nbytes On entry, the number of bytes to read; on exit, the number of bytes read.
* @remark apr_file_read will read up to the specified number of bytes, but
* never more. If there isn't enough data to fill that number of
* bytes, all of the available data is read. The third argument is
* modified to reflect the number of bytes read. If a char was put
* back into the stream via ungetc, it will be the first character
* returned.
*
* It is not possible for both bytes to be read and an APR_EOF or other
* error to be returned.
*
* APR_EINTR is never returned.
}
function apr_file_read(thefile: Papr_file_t; buf: Pointer;
nbytes: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_read' + LibSuff12;
{
* Write data to the specified file.
* @param thefile The file descriptor to write to.
* @param buf The buffer which contains the data.
* @param nbytes On entry, the number of bytes to write; on exit, the number
* of bytes written.
* @remark apr_file_write will write up to the specified number of bytes, but never
* more. If the OS cannot write that many bytes, it will write as many
* as it can. The third argument is modified to reflect the * number
* of bytes written.
*
* It is possible for both bytes to be written and an error to be returned.
*
* APR_EINTR is never returned.
}
function apr_file_write(thefile: Papr_file_t; buf: Pointer;
nbytes: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_write' + LibSuff12;
{
* Write data from iovec array to the specified file.
* @param thefile The file descriptor to write to.
* @param vec The array from which to get the data to write to the file.
* @param nvec The number of elements in the struct iovec array. This must
* be smaller than APR_MAX_IOVEC_SIZE. If it isn't, the function
* will fail with APR_EINVAL.
* @param nbytes The number of bytes written.
* @remark It is possible for both bytes to be written and an error to be returned.
* APR_EINTR is never returned.
*
* apr_file_writev is available even if the underlying operating system
*
* doesn't provide writev().
}
function apr_file_writev(thefile: Papr_file_t; const vec: Piovec;
nvec: apr_size_t; nbytes: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_writev' + LibSuff16;
{
* Read data from the specified file, ensuring that the buffer is filled
* before returning.
* @param thefile The file descriptor to read from.
* @param buf The buffer to store the data to.
* @param nbytes The number of bytes to read.
* @param bytes_read If non-NULL, this will contain the number of bytes read.
* @remark apr_file_read will read up to the specified number of bytes, but never
* more. If there isn't enough data to fill that number of bytes,
* then the process/thread will block until it is available or EOF
* is reached. If a char was put back into the stream via ungetc,
* it will be the first character returned.
*
* It is possible for both bytes to be read and an error to be
* returned. And if *bytes_read is less than nbytes, an
* accompanying error is _always_ returned.
*
* APR_EINTR is never returned.
}
function apr_file_read_full(thefile: Papr_file_t; buf: Pointer;
nbytes: apr_size_t; bytes_read: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_read_full' + LibSuff16;
{
* Write data to the specified file, ensuring that all of the data is
* written before returning.
* @param thefile The file descriptor to write to.
* @param buf The buffer which contains the data.
* @param nbytes The number of bytes to write.
* @param bytes_written If non-NULL, this will contain the number of bytes written.
* @remark apr_file_write will write up to the specified number of bytes, but never
* more. If the OS cannot write that many bytes, the process/thread
* will block until they can be written. Exceptional error such as
* "out of space" or "pipe closed" will terminate with an error.
*
* It is possible for both bytes to be written and an error to be
* returned. And if *bytes_written is less than nbytes, an
* accompanying error is _always_ returned.
*
* APR_EINTR is never returned.
}
function apr_file_write_full(thefile: Papr_file_t; buf: Pointer;
nbytes: apr_size_t; bytes_written: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_write_full' + LibSuff16;
{
* put a character into the specified file.
* @param ch The character to write.
* @param thefile The file descriptor to write to
}
function apr_file_putc(ch: Char; thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_putc' + LibSuff8;
{
* get a character from the specified file.
* @param ch The character to read into
* @param thefile The file descriptor to read from
}
function apr_file_getc(ch: PChar; thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_getc' + LibSuff8;
{
* put a character back onto a specified stream.
* @param ch The character to write.
* @param thefile The file descriptor to write to
}
function apr_file_ungetc(ch: Char; thefile: PPapr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_ungetc' + LibSuff8;
{
* Get a string from a specified file.
* @param str The buffer to store the string in.
* @param len The length of the string
* @param thefile The file descriptor to read from
* @remark The buffer will be '\0'-terminated if any characters are stored.
}
function apr_file_gets(str: PChar; len: Integer;
thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_gets' + LibSuff12;
{
* Put the string into a specified file.
* @param str The string to write.
* @param thefile The file descriptor to write to
}
function apr_file_puts(const str: PChar; thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_puts' + LibSuff8;
{
* Flush the file's buffer.
* @param thefile The file descriptor to flush
}
function apr_file_flush(thefile: PPapr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_flush' + LibSuff4;
{
* duplicate the specified file descriptor.
* @param new_file The structure to duplicate into.
* @param old_file The file to duplicate.
* @param p The pool to use for the new file.
* @remark *new_file must point to a valid apr_file_t, or point to NULL
}
function apr_file_dup(new_file: PPapr_file_t; old_file: PPapr_file_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_dup' + LibSuff12;
{
* duplicate the specified file descriptor and close the original
* @param new_file The old file that is to be closed and reused
* @param old_file The file to duplicate
* @param p The pool to use for the new file
*
* @remark new_file MUST point at a valid apr_file_t. It cannot be NULL
}
function apr_file_dup2(new_file: PPapr_file_t; old_file: PPapr_file_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_dup2' + LibSuff12;
{
* move the specified file descriptor to a new pool
* @param new_file Pointer in which to return the new apr_file_t
* @param old_file The file to move
* @param p The pool to which the descriptor is to be moved
* @remark Unlike apr_file_dup2(), this function doesn't do an
* OS dup() operation on the underlying descriptor; it just
* moves the descriptor's apr_file_t wrapper to a new pool.
* @remark The new pool need not be an ancestor of old_file's pool.
* @remark After calling this function, old_file may not be used
}
function apr_file_setaside(new_file: PPapr_file_t; old_file: PPapr_file_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_setaside' + LibSuff12;
{
* Move the read/write file offset to a specified byte within a file.
* @param thefile The file descriptor
* @param where How to move the pointer, one of:
* <PRE>
* APR_SET -- set the offset to offset
* APR_CUR -- add the offset to the current position
* APR_END -- add the offset to the current file size
* </PRE>
* @param offset The offset to move the pointer to.
* @remark The third argument is modified to be the offset the pointer
was actually moved to.
}
function apr_file_seek(thefile: Papr_file_t;
where: apr_seek_where_t; offset: Papr_off_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_seek' + LibSuff12;
{
* Create an anonymous pipe.
* @param in The file descriptor to use as input to the pipe.
* @param out The file descriptor to use as output from the pipe.
* @param cont The pool to operate on.
}
function apr_file_pipe_create(in_: PPapr_file_t; out_: PPapr_file_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_pipe_create' + LibSuff12;
{
* Create a named pipe.
* @param filename The filename of the named pipe
* @param perm The permissions for the newly created pipe.
* @param cont The pool to operate on.
}
function apr_file_namedpipe_create(const filename: PChar;
perm: apr_fileperms_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_namedpipe_create' + LibSuff12;
{
* Get the timeout value for a pipe or manipulate the blocking state.
* @param thepipe The pipe we are getting a timeout for.
* @param timeout The current timeout value in microseconds.
}
function apr_file_pipe_timeout_get(thepipe: Papr_file_t;
timeout: Papr_interval_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_pipe_timeout_get' + LibSuff8;
{
* Set the timeout value for a pipe or manipulate the blocking state.
* @param thepipe The pipe we are setting a timeout on.
* @param timeout The timeout value in microseconds. Values < 0 mean wait
* forever, 0 means do not wait at all.
}
function apr_file_pipe_timeout_set(thepipe: Papr_file_t;
timeout: apr_interval_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_pipe_timeout_set' + LibSuff12;
{ file (un)locking functions. }
{
* Establish a lock on the specified, open file. The lock may be advisory
* or mandatory, at the discretion of the platform. The lock applies to
* the file as a whole, rather than a specific range. Locks are established
* on a per-thread/process basis; a second lock by the same thread will not
* block.
* @param thefile The file to lock.
* @param type The type of lock to establish on the file.
}
function apr_file_lock(thefile: Papr_file_t; type_: Integer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_lock' + LibSuff8;
{
* Remove any outstanding locks on the file.
* @param thefile The file to unlock.
}
function apr_file_unlock(thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_unlock' + LibSuff4;
{accessor and general file_io functions. }
{
* return the file name of the current file.
* @param new_path The path of the file.
* @param thefile The currently open file.
}
function apr_file_name_get(const newpath: PPChar; thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_name_get' + LibSuff8;
{
* Return the data associated with the current file.
* @param data The user data associated with the file.
* @param key The key to use for retreiving data associated with this file.
* @param file The currently open file.
}
function apr_file_data_get(data: PPointer; const key: PChar;
file_: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_data_get' + LibSuff12;
{
* Set the data associated with the current file.
* @param file The currently open file.
* @param data The user data to associate with the file.
* @param key The key to use for assocaiteing data with the file.
* @param cleanup The cleanup routine to use when the file is destroyed.
}
//function apr_file_data_set(ch: Char; thefile: PPapr_file_t): apr_status_t;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_file_data_set' + LibSuff4;
//APR_DECLARE(apr_status_t) (apr_file_t *file, void *data,
// const char *key,
// apr_status_t (*cleanup)(void *));
{
* Write a string to a file using a printf format.
* @param fptr The file to write to.
* @param format The format string
* @param ... The values to substitute in the format string
* @return The number of bytes written
}
function apr_file_printf(fptr: Papr_file_t; const format: PChar;
othres: array of const): Integer;
cdecl; external LibAPR name 'apr_file_printf';
{
* set the specified file's permission bits.
* @param fname The file (name) to apply the permissions to.
* @param perms The permission bits to apply to the file.
* @warning Some platforms may not be able to apply all of the available
* permission bits; APR_INCOMPLETE will be returned if some permissions
* are specified which could not be set.
*
* Platforms which do not implement this feature will return APR_ENOTIMPL.
}
function apr_file_perms_set(const fname: PChar;
perms: apr_fileperms_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_perms_set' + LibSuff8;
{
* Set attributes of the specified file.
* @param fname The full path to the file (using / on all systems)
* @param attributes Or'd combination of
* <PRE>
* APR_FILE_ATTR_READONLY - make the file readonly
* APR_FILE_ATTR_EXECUTABLE - make the file executable
* APR_FILE_ATTR_HIDDEN - make the file hidden
* </PRE>
* @param attr_mask Mask of valid bits in attributes.
* @param cont the pool to use.
* @remark This function should be used in preference to explict manipulation
* of the file permissions, because the operations to provide these
* attributes are platform specific and may involve more than simply
* setting permission bits.
* @warning Platforms which do not implement this feature will return
* APR_ENOTIMPL.
}
function apr_file_attrs_set(const fname: PChar;
attributes, attr_mask: apr_fileattrs_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_attrs_set' + LibSuff16;
{
* Set the mtime of the specified file.
* @param fname The full path to the file (using / on all systems)
* @param mtime The mtime to apply to the file.
* @param pool The pool to use.
* @warning Platforms which do not implement this feature will return
* APR_ENOTIMPL.
}
function apr_file_mtime_set(const fname: PChar;
mtime: apr_time_t; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_mtime_set' + LibSuff16;
{
* Create a new directory on the file system.
* @param path the path for the directory to be created. (use / on all systems)
* @param perm Permissions for the new direcoty.
* @param cont the pool to use.
}
function apr_dir_make(const path: PChar; perm: apr_fileperms_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_make' + LibSuff12;
{ Creates a new directory on the file system, but behaves like
* 'mkdir -p'. Creates intermediate directories as required. No error
* will be reported if PATH already exists.
* @param path the path for the directory to be created. (use / on all systems)
* @param perm Permissions for the new direcoty.
* @param pool the pool to use.
}
function apr_dir_make_recursive(const path: PChar;
perm: apr_fileperms_t; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_make_recursive' + LibSuff12;
{
* Remove directory from the file system.
* @param path the path for the directory to be removed. (use / on all systems)
* @param cont the pool to use.
}
function apr_dir_remove(const path: PChar; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_remove' + LibSuff8;
{
* get the specified file's stats.
* @param finfo Where to store the information about the file.
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
* @param thefile The file to get information about.
}
function apr_file_info_get(finfo: Papr_finfo_t;
wanted: apr_int32_t; thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_info_get' + LibSuff12;
{
* Truncate the file's length to the specified offset
* @param fp The file to truncate
* @param offset The offset to truncate to.
}
function apr_file_trunc(fp: Papr_file_t; offset: apr_off_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_trunc' + LibSuff12;
{
* Retrieve the flags that were passed into apr_file_open()
* when the file was opened.
* @return apr_int32_t the flags
}
function apr_file_flags_get(f: Papr_file_t): apr_int32_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_flags_get' + LibSuff4;
{
* Get the pool used by the file.
}
{APR_POOL_DECLARE_ACCESSOR(file);
}
{
* Set a file to be inherited by child processes.
*
}
{APR_DECLARE_INHERIT_SET(file);
}
{ @deprecated @see apr_file_inherit_set }
{APR_DECLARE(void) apr_file_set_inherit(apr_file_t *file);
}
{
* Unset a file from being inherited by child processes.
}
{APR_DECLARE_INHERIT_UNSET(file);
}
{ @deprecated @see apr_file_inherit_unset }
{APR_DECLARE(void) apr_file_unset_inherit(apr_file_t *file);
}
{
* Open a temporary file
* @param fp The apr file to use as a temporary file.
* @param templ The template to use when creating a temp file.
* @param flags The flags to open the file with. If this is zero,
* the file is opened with
* APR_CREATE | APR_READ | APR_WRITE | APR_EXCL | APR_DELONCLOSE
* @param p The pool to allocate the file out of.
* @remark
* This function generates a unique temporary file name from template.
* The last six characters of template must be XXXXXX and these are replaced
* with a string that makes the filename unique. Since it will be modified,
* template must not be a string constant, but should be declared as a character
* array.
*
}
function apr_file_mktemp(fp: PPapr_file_t; templ: PChar;
flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_mktemp' + LibSuff16;
{
* Find an existing directory suitable as a temporary storage location.
* @param temp_dir The temp directory.
* @param p The pool to use for any necessary allocations.
* @remark
* This function uses an algorithm to search for a directory that an
* an application can use for temporary storage. Once such a
* directory is found, that location is cached by the library. Thus,
* callers only pay the cost of this algorithm once if that one time
* is successful.
*
}
function apr_temp_dir_get(const temp_dir: PPChar; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_temp_dir_get' + LibSuff8;

View File

@ -1,228 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_general.h
* This is collection of oddballs that didn't fit anywhere else,
* and might move to more appropriate headers with the release
* of APR 1.0.
* @brief APR Miscellaneous library routines
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_errno.h"
#if APR_HAVE_SIGNAL_H
#include <signal.h>
#endif}
{
* @defgroup apr_general Miscellaneous library routines
* @ingroup APR
* This is collection of oddballs that didn't fit anywhere else,
* and might move to more appropriate headers with the release
* of APR 1.0.
}
const
{ a space }
APR_ASCII_BLANK = #040;
{ a carrige return }
APR_ASCII_CR = #015;
{ a line feed }
APR_ASCII_LF = #012;
{ a tab }
APR_ASCII_TAB = #011;
{ signal numbers typedef }
type
apr_signum_t = Integer;
{
* Finding offsets of elements within structures.
* Taken from the X code... they've sweated portability of this stuff
* so we don't have to. Sigh...
* @param p_type pointer type name
* @param field data field within the structure pointed to
* @return offset
}
{#if defined(CRAY) || (defined(__arm) && !defined(LINUX))
#ifdef __STDC__
#define APR_OFFSET(p_type,field) _Offsetof(p_type,field)
#else
#ifdef CRAY2
#define APR_OFFSET(p_type,field) \
(sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
#else} { !CRAY2 }
{#define APR_OFFSET(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
#endif} { !CRAY2 }
//#endif { __STDC__ }
//#else { ! (CRAY || __arm) }
//#define APR_OFFSET(p_type,field) \
// ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
//#endif { !CRAY }
{
* Finding offsets of elements within structures.
* @param s_type structure type name
* @param field data field within the structure
* @return offset
}
{#if defined(offsetof) && !defined(__cplusplus)
#define APR_OFFSETOF(s_type,field) offsetof(s_type,field)
#else
#define APR_OFFSETOF(s_type,field) APR_OFFSET(s_type*,field)
#endif}
{ @deprecated @see APR_OFFSET }
//#define APR_XtOffset APR_OFFSET
{ @deprecated @see APR_OFFSETOF }
//#define APR_XtOffsetOf APR_OFFSETOF
{$ifndef DOXYGEN}
{ A couple of prototypes for functions in case some platform doesn't
* have it
}
{#if (!APR_HAVE_STRCASECMP) && (APR_HAVE_STRICMP)
#define strcasecmp(s1, s2) stricmp(s1, s2)
#elif (!APR_HAVE_STRCASECMP)
int strcasecmp(const char *a, const char *b);
#endif
#if (!APR_HAVE_STRNCASECMP) && (APR_HAVE_STRNICMP)
#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
#elif (!APR_HAVE_STRNCASECMP)
int strncasecmp(const char *a, const char *b, size_t n);
#endif}
{$endif}
{
* Alignment macros
}
{ APR_ALIGN() is only to be used to align on a power of 2 boundary }
{#define APR_ALIGN(size, boundary) \
(((size) + ((boundary) - 1)) & ~((boundary) - 1))}
{ Default alignment }
//#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
{
* String and memory functions
}
{ Properly quote a value as a string in the C preprocessor }
//#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
{ Helper macro for APR_STRINGIFY }
{#define APR_STRINGIFY_HELPER(n) #n
#if (!APR_HAVE_MEMMOVE)
#define memmove(a,b,c) bcopy(b,a,c)
#endif
#if (!APR_HAVE_MEMCHR)
void *memchr(const void *s, int c, size_t n);
#endif}
{
* @defgroup apr_library Library initialization and termination
}
{
* Setup any APR internal data structures. This MUST be the first function
* called for any APR library.
* @remark See apr_app_initialize if this is an application, rather than
* a library consumer of apr.
}
function apr_initialize: apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_initialize' + LibSuff0;
{
* Set up an application with normalized argc, argv (and optionally env) in
* order to deal with platform-specific oddities, such as Win32 services,
* code pages and signals. This must be the first function called for any
* APR program.
* @param argc Pointer to the argc that may be corrected
* @param argv Pointer to the argv that may be corrected
* @param env Pointer to the env that may be corrected, may be NULL
* @remark See apr_initialize if this is a library consumer of apr.
* Otherwise, this call is identical to apr_initialize, and must be closed
* with a call to apr_terminate at the end of program execution.
}
function apr_app_initialize(argc: PInteger; argv, env: PPChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_app_initialize' + LibSuff12;
{
* Tear down any APR internal data structures which aren't torn down
* automatically.
* @remark An APR program must call this function at termination once it
* has stopped using APR services. The APR developers suggest using
* atexit to ensure this is called. When using APR from a language
* other than C that has problems with the calling convention, use
* apr_terminate2() instead.
}
procedure apr_terminate;
cdecl; external LibAPR name 'apr_terminate';
{
* Tear down any APR internal data structures which aren't torn down
* automatically, same as apr_terminate
* @remark An APR program must call either the apr_terminate or apr_terminate2
* function once it it has finished using APR services. The APR
* developers suggest using atexit(apr_terminate) to ensure this is done.
* apr_terminate2 exists to allow non-c language apps to tear down apr,
* while apr_terminate is recommended from c language applications.
}
procedure apr_terminate2;
cdecl; external LibAPR name LibNamePrefix + 'apr_terminate2' + LibSuff0;
{
* @defgroup apr_random Random Functions
}
{$if defined(APR_HAS_RANDOM) or defined(DOXYGEN)}
{ TODO: I'm not sure this is the best place to put this prototype...}
{
* Generate random bytes.
* @param buf Buffer to fill with random bytes
* @param length Length of buffer in bytes (becomes apr_size_t in APR 1.0)
}
{$ifdef APR_ENABLE_FOR_1_0}
function apr_generate_random_bytes(buf: PChar; length: apr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_generate_random_bytes' + LibSuff8;
{$else}
function apr_generate_random_bytes(buf: PChar; length: Integer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_generate_random_bytes' + LibSuff8;
{$endif}
{$endif}

View File

@ -1,206 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_hash.h
* @brief APR Hash Tables
}
//#include "apr_pools.h"
{
* @defgroup apr_hash Hash Tables
* @ingroup APR
* @
}
{
* When passing a key to apr_hash_set or apr_hash_get, this value can be
* passed to indicate a string-valued key, and have apr_hash compute the
* length automatically.
*
* @remark apr_hash will use strlen(key) for the length. The null-terminator
* is not included in the hash value (why throw a constant in?).
* Since the hash table merely references the provided key (rather
* than copying it), apr_hash_this() will return the null-term'd key.
}
const
APR_HASH_KEY_STRING = -1;
{
* Abstract type for hash tables.
}
type
apr_hash_t = record end;
Papr_hash_t = ^apr_hash_t;
{
* Abstract type for scanning hash tables.
}
apr_hash_index_t = record end;
Papr_hash_index_t = ^apr_hash_index_t;
{
* Create a hash table.
* @param pool The pool to allocate the hash table out of
* @return The hash table just created
}
function apr_hash_make(pool: Papr_pool_t): Papr_hash_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_make' + LibSuff4;
{
* Make a copy of a hash table
* @param pool The pool from which to allocate the new hash table
* @param h The hash table to clone
* @return The hash table just created
* @remark Makes a shallow copy
}
function apr_hash_copy(pool: Papr_pool_t; const h: Papr_hash_t): Papr_hash_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_copy' + LibSuff8;
{
* Associate a value with a key in a hash table.
* @param ht The hash table
* @param key Pointer to the key
* @param klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.
* @param val Value to associate with the key
* @remark If the value is NULL the hash entry is deleted.
}
procedure apr_hash_set(ht: Papr_hash_t; const key: Pointer;
klen: apr_size_t; const val: Pointer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_set' + LibSuff16;
{
* Look up the value associated with a key in a hash table.
* @param ht The hash table
* @param key Pointer to the key
* @param klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.
* @return Returns NULL if the key is not present.
}
function apr_hash_get(ht: Papr_hash_t; const key: Pointer;
klen: apr_size_t): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_get' + LibSuff12;
{
* Start iterating over the entries in a hash table.
* @param p The pool to allocate the apr_hash_index_t iterator. If this
* pool is NULL, then an internal, non-thread-safe iterator is used.
* @param ht The hash table
* @remark There is no restriction on adding or deleting hash entries during
* an iteration (although the results may be unpredictable unless all you do
* is delete the current entry) and multiple iterations can be in
* progress at the same time.
* @example
}
{
* <PRE>
*
* int sum_values(apr_pool_t *p, apr_hash_t *ht)
* (
* apr_hash_index_t *hi;
* void *val;
* int sum = 0;
* for (hi = apr_hash_first(p, ht); hi; hi = apr_hash_next(hi)) (
* apr_hash_this(hi, NULL, NULL, &val);
* sum += *(int * )val;
* )
* return sum;
* )
* </PRE>
}
function apr_hash_first(p: Papr_pool_t; ht: Papr_hash_t): Papr_hash_index_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_first' + LibSuff8;
{
* Continue iterating over the entries in a hash table.
* @param hi The iteration state
* @return a pointer to the updated iteration state. NULL if there are no more
* entries.
}
function apr_hash_next(hi: Papr_hash_index_t): Papr_hash_index_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_next' + LibSuff4;
{
* Get the current entry's details from the iteration state.
* @param hi The iteration state
* @param key Return pointer for the pointer to the key.
* @param klen Return pointer for the key length.
* @param val Return pointer for the associated value.
* @remark The return pointers should point to a variable that will be set to the
* corresponding data, or they may be NULL if the data isn't interesting.
}
procedure apr_hash_this(hi: Papr_hash_index_t; const key: PPointer;
klen: Papr_size_t; val: PPointer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_this' + LibSuff16;
{
* Get the number of key/value pairs in the hash table.
* @param ht The hash table
* @return The number of key/value pairs in the hash table.
}
function apr_hash_count(ht: Papr_hash_t): cuint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_count' + LibSuff4;
{
* Merge two hash tables into one new hash table. The values of the overlay
* hash override the values of the base if both have the same key.
* @param p The pool to use for the new hash table
* @param overlay The table to add to the initial table
* @param base The table that represents the initial values of the new table
* @return A new hash table containing all of the data from the two passed in
}
function apr_hash_overlay(p: Papr_pool_t;
const overlay, base: Papr_hash_t): Papr_hash_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_overlay' + LibSuff12;
{
* Merge two hash tables into one new hash table. If the same key
* is present in both tables, call the supplied merge function to
* produce a merged value for the key in the new table.
* @param p The pool to use for the new hash table
* @param h1 The first of the tables to merge
* @param h2 The second of the tables to merge
* @param merger A callback function to merge values, or NULL to
* make values from h1 override values from h2 (same semantics as
* apr_hash_overlay())
* @param data Client data to pass to the merger function
* @return A new hash table containing all of the data from the two passed in
}
type
apr_hash_merge_t = function (p: Papr_pool_t; const key: Pointer; klen: apr_size_t;
const h1_val, h2_val, data: Pointer): Pointer; cdecl;
function apr_hash_merge(p: Papr_pool_t;
const h1, h2: Papr_hash_t;
merger: apr_hash_merge_t; const data: Pointer): Papr_hash_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_merge' + LibSuff20;
{
* Get a pointer to the pool which the hash table was created in
}
//APR_POOL_DECLARE_ACCESSOR(hash);

View File

@ -1,221 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_lib.h
* This is collection of oddballs that didn't fit anywhere else,
* and might move to more appropriate headers with the release
* of APR 1.0.
* @brief APR general purpose library routines
}
{#include "apr.h"
#include "apr_errno.h"
#if APR_HAVE_CTYPE_H
#include <ctype.h>
#endif
#if APR_HAVE_STDARG_H
#include <stdarg.h>
#endif}
{
* @defgroup apr_lib General Purpose Library Routines
* @ingroup APR
* This is collection of oddballs that didn't fit anywhere else,
* and might move to more appropriate headers with the release
* of APR 1.0.
}
{ A constant representing a 'large' string. }
const HUGE_STRING_LEN = 8192;
{
* Define the structures used by the APR general-purpose library.
}
{ @see apr_vformatter_buff_t }
type
Papr_vformatter_buff_t = ^apr_vformatter_buff_t;
{
* Structure used by the variable-formatter routines.
}
apr_vformatter_buff_t = record
{ The current position }
curpos: PChar;
{ The end position of the format string }
endpos: PChar;
end;
{
* return the final element of the pathname
* @param pathname The path to get the final element of
* @return the final element of the path
* @remark
* <PRE>
* For example:
* "/foo/bar/gum" -> "gum"
* "/foo/bar/gum/" -> ""
* "gum" -> "gum"
* "bs\\path\\stuff" -> "stuff"
* </PRE>
}
function apr_filepath_name_get(const pathname: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_name_get' + LibSuff4;
{ @deprecated @see apr_filepath_name_get }
function apr_filename_of_pathname(const pathname: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filename_of_pathname' + LibSuff4;
{
* apr_killpg
* Small utility macros to make things easier to read. Not usually a
* goal, to be sure..
}
//#ifdef WIN32
//#define apr_killpg(x, y)
//#else { WIN32 }
//#ifdef NO_KILLPG
//#define apr_killpg(x, y) (kill (-(x), (y)))
//#else { NO_KILLPG }
//#define apr_killpg(x, y) (killpg ((x), (y)))
//#endif { NO_KILLPG }
//#endif { WIN32 }
{
* apr_vformatter() is a generic printf-style formatting routine
* with some extensions.
* @param flush_func The function to call when the buffer is full
* @param c The buffer to write to
* @param fmt The format string
* @param ap The arguments to use to fill out the format string.
*
* @remark
* <PRE>
* The extensions are:
*
* %%pA takes a struct in_addr *, and prints it as a.b.c.d
* %%pI takes an apr_sockaddr_t * and prints it as a.b.c.d:port or
* [ipv6-address]:port
* %%pT takes an apr_os_thread_t * and prints it in decimal
* ('0' is printed if !APR_HAS_THREADS)
* %%pp takes a void * and outputs it in hex
*
* The %%p hacks are to force gcc's printf warning code to skip
* over a pointer argument without complaining. This does
* mean that the ANSI-style %%p (output a void * in hex format) won't
* work as expected at all, but that seems to be a fair trade-off
* for the increased robustness of having printf-warnings work.
*
* Additionally, apr_vformatter allows for arbitrary output methods
* using the apr_vformatter_buff and flush_func.
*
* The apr_vformatter_buff has two elements curpos and endpos.
* curpos is where apr_vformatter will write the next byte of output.
* It proceeds writing output to curpos, and updating curpos, until
* either the end of output is reached, or curpos == endpos (i.e. the
* buffer is full).
*
* If the end of output is reached, apr_vformatter returns the
* number of bytes written.
*
* When the buffer is full, the flush_func is called. The flush_func
* can return -1 to indicate that no further output should be attempted,
* and apr_vformatter will return immediately with -1. Otherwise
* the flush_func should flush the buffer in whatever manner is
* appropriate, re apr_pool_t nitialize curpos and endpos, and return 0.
*
* Note that flush_func is only invoked as a result of attempting to
* write another byte at curpos when curpos >= endpos. So for
* example, it's possible when the output exactly matches the buffer
* space available that curpos == endpos will be true when
* apr_vformatter returns.
*
* apr_vformatter does not call out to any other code, it is entirely
* self-contained. This allows the callers to do things which are
* otherwise "unsafe". For example, apr_psprintf uses the "scratch"
* space at the unallocated end of a block, and doesn't actually
* complete the allocation until apr_vformatter returns. apr_psprintf
* would be completely broken if apr_vformatter were to call anything
* that used this same pool. Similarly http_bprintf() uses the "scratch"
* space at the end of its output buffer, and doesn't actually note
* that the space is in use until it either has to flush the buffer
* or until apr_vformatter returns.
* </PRE>
}
type
flush_func_t = function (b: Papr_vformatter_buff_t): Integer;
function apr_vformatter(flush_func: flush_func_t;
c: Papr_vformatter_buff_t; const fmt: PChar; ap: va_list): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_vformatter' + LibSuff16;
{
* Display a prompt and read in the password from stdin.
* @param prompt The prompt to display
* @param pwbuf Buffer to store the password
* @param bufsize The length of the password buffer.
}
function apr_password_get(const prompt: PChar;
pwbuf: PChar; bufsize: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_password_get' + LibSuff12;
{
* @defgroup apr_ctype ctype functions
* These macros allow correct support of 8-bit characters on systems which
* support 8-bit characters. Pretty dumb how the cast is required, but
* that's legacy libc for ya. These new macros do not support EOF like
* the standard macros do. Tough.
}
{ @see isalnum }
//#define apr_isalnum(c) (isalnum(((unsigned char)(c))))
{ @see isalpha }
//#define apr_isalpha(c) (isalpha(((unsigned char)(c))))
{ @see iscntrl }
//#define apr_iscntrl(c) (iscntrl(((unsigned char)(c))))
{ @see isdigit }
//#define apr_isdigit(c) (isdigit(((unsigned char)(c))))
{ @see isgraph }
//#define apr_isgraph(c) (isgraph(((unsigned char)(c))))
{ @see islower}
//#define apr_islower(c) (islower(((unsigned char)(c))))
{ @see isascii }
{#ifdef isascii
#define apr_isascii(c) (isascii(((unsigned char)(c))))
#else
#define apr_isascii(c) (((c) & ~0x7f)==0)
#endif}
{ @see isprint }
//#define apr_isprint(c) (isprint(((unsigned char)(c))))
{ @see ispunct }
//#define apr_ispunct(c) (ispunct(((unsigned char)(c))))
{ @see isspace }
//#define apr_isspace(c) (isspace(((unsigned char)(c))))
{ @see isupper }
//#define apr_isupper(c) (isupper(((unsigned char)(c))))
{ @see isxdigit }
//#define apr_isxdigit(c) (isxdigit(((unsigned char)(c))))
{ @see tolower }
function apr_tolower(c: Char): Char;
{ @see toupper }
function apr_toupper(c: Char): Char;

View File

@ -1,884 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_network_io.h
* @brief APR Network library
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_file_io.h"
#include "apr_errno.h"
#include "apr_inherit.h"
#if APR_HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif}
{
* @defgroup apr_network_io Network Routines
* @ingroup APR
}
const
{ Maximum seconds to linger }
APR_MAX_SECS_TO_LINGER = 30;
{ @deprecated @see APR_MAX_SECS_TO_LINGER }
MAX_SECS_TO_LINGER = APR_MAX_SECS_TO_LINGER;
{ Maximum hostname length }
APRMAXHOSTLEN = 256;
{ Default 'any' address }
APR_ANYADDR = '0.0.0.0';
{
* @defgroup apr_sockopt Socket option definitions
}
APR_SO_LINGER = 1; {< Linger }
APR_SO_KEEPALIVE = 2; {< Keepalive }
APR_SO_DEBUG = 4; {< Debug }
APR_SO_NONBLOCK = 8; {< Non-blocking IO }
APR_SO_REUSEADDR = 16; {< Reuse addresses }
APR_SO_TIMEOUT = 32; {< Timeout }
APR_SO_SNDBUF = 64; {< Send buffer }
APR_SO_RCVBUF = 128; {< Receive buffer }
APR_SO_DISCONNECTED = 256; {< Disconnected }
APR_TCP_NODELAY = 512; {< For SCTP sockets, this is mapped
* to STCP_NODELAY internally.
}
APR_TCP_NOPUSH = 1024; {< No push }
APR_RESET_NODELAY = 2048; {< This flag is ONLY set internally
* when we set APR_TCP_NOPUSH with
* APR_TCP_NODELAY set to tell us that
* APR_TCP_NODELAY should be turned on
* again when NOPUSH is turned off
}
APR_INCOMPLETE_READ = 4096; {< Set on non-blocking sockets
* (timeout != 0) on which the
* previous read() did not fill a buffer
* completely. the next apr_socket_recv()
* will first call select()/poll() rather than
* going straight into read(). (Can also
* be set by an application to force a
* select()/poll() call before the next
* read, in cases where the app expects
* that an immediate read would fail.)
}
APR_INCOMPLETE_WRITE = 8192; {< like APR_INCOMPLETE_READ, but for write
* @see APR_INCOMPLETE_READ
}
APR_IPV6_V6ONLY = 16384; {< Don't accept IPv4 connections on an
* IPv6 listening socket.
}
{ Define what type of socket shutdown should occur. }
type
apr_shutdown_how_e = (
APR_SHUTDOWN_READ, {< no longer allow read request }
APR_SHUTDOWN_WRITE, {< no longer allow write requests }
APR_SHUTDOWN_READWRITE {< no longer allow read or write requests }
);
const
APR_IPV4_ADDR_OK = $01; {< @see apr_sockaddr_info_get() }
APR_IPV6_ADDR_OK = $02; {< @see apr_sockaddr_info_get() }
{$ifndef APR_HAVE_IN_ADDR}
{
* We need to make sure we always have an in_addr type, so APR will just
* define it ourselves, if the platform doesn't provide it.
}
{type
in_addr = record
s_addr: apr_uint32_t; < storage to hold the IP#
end;}
{$endif}
const
{
* @def APR_INET
* Not all platforms have these defined, so we'll define them here
* The default values come from FreeBSD 4.1.1
}
//#define APR_INET AF_INET
{ @def APR_UNSPEC
* Let the system decide which address family to use
}
{#ifdef AF_UNSPEC
#define APR_UNSPEC AF_UNSPEC
#else
#define APR_UNSPEC 0
#endif
#if APR_HAVE_IPV6
#define APR_INET6 AF_INET6
#endif}
{
* @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
}
APR_PROTO_TCP = 6; {< TCP }
APR_PROTO_UDP = 17; {< UDP }
APR_PROTO_SCTP = 132; {< SCTP }
{
* Enum to tell us if we're interested in remote or local socket
}
type
apr_interface_e = (
APR_LOCAL,
APR_REMOTE
);
{
* The specific declaration of inet_addr's ... some platforms fall back
* inet_network (this is not good, but necessary)
}
{$ifdef APR_HAVE_INET_ADDR}
apr_inet_addr = inet_addr;
{$else}
{$ifdef APR_HAVE_INET_NETWORK} { only DGUX, as far as I know }
{
* @warning
* not generally safe... inet_network() and inet_addr() perform
* different functions }
apr_inet_addr = inet_network;
{$endif}
{$endif}
{ A structure to represent sockets }
apr_socket_t = record
end;
Papr_socket_t = ^apr_socket_t;
PPapr_socket_t = ^Papr_socket_t;
{
* A structure to encapsulate headers and trailers for apr_socket_sendfile
}
Papr_hdtr_t = ^apr_hdtr_t;
{ A structure to represent in_addr }
apr_in_addr_t = record
end;
{ A structure to represent an IP subnet }
apr_ipsubnet_t = record
end;
Papr_ipsubnet_t = ^apr_ipsubnet_t;
PPapr_ipsubnet_t = ^Papr_ipsubnet_t;
{ @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... }
apr_port_t = apr_uint16_t;
Papr_port_t = ^apr_port_t;
{ @remark It's defined here as I think it should all be platform safe...
* @see apr_sockaddr_t
}
Papr_sockaddr_t = ^apr_sockaddr_t;
PPapr_sockaddr_t = ^Papr_sockaddr_t;
sa_t = record
case Integer of
{ IPv4 sockaddr structure }
0: (sin: sockaddr_in);
{$ifdef APR_HAVE_IPV6}
{ IPv6 sockaddr structure }
1: (sin6: sockaddr_in6);
{$endif}
end;
{
* APRs socket address type, used to ensure protocol independence
}
apr_sockaddr_t = record
{ The pool to use... }
pool: Papr_pool_t;
{ The hostname }
hostname: PChar;
{ Either a string of the port number or the service name for the port }
servname: PChar;
{ The numeric port }
port: apr_port_t;
{ The family }
family: apr_int32_t;
{ Union of either IPv4 or IPv6 sockaddr. }
sa: sa_t;
{ How big is the sockaddr we're using? }
salen: apr_socklen_t;
{ How big is the ip address structure we're using? }
ipaddr_len: cint;
{ How big should the address buffer be? 16 for v4 or 46 for v6
* used in inet_ntop... }
addr_str_len: cint;
{ This points to the IP address structure within the appropriate
* sockaddr structure. }
ipaddr_ptr: Pointer;
{ If multiple addresses were found by apr_sockaddr_info_get(), this
* points to a representation of the next address. }
next: Papr_sockaddr_t;
end;
{$ifdef APR_HAS_SENDFILE}
{
* Support reusing the socket on platforms which support it (from disconnect,
* specifically Win32.
* @remark Optional flag passed into apr_socket_sendfile()
}
APR_SENDFILE_DISCONNECT_SOCKET = 1;
{$endif}
{ A structure to encapsulate headers and trailers for apr_socket_sendfile }
apr_hdtr_t = record
{ An iovec to store the headers sent before the file. }
headers: Piovec;
{ number of headers in the iovec }
numheaders: cint;
{ An iovec to store the trailers sent after the file. }
trailers: Piovec;
{ number of trailers in the iovec }
numtrailers: Integer;
end;
{ function definitions }
{
* Create a socket.
* @remark With APR 1.0, this function follows the prototype
* of apr_socket_create_ex.
* @param new_sock The new socket that has been set up.
* @param family The address family of the socket (e.g., APR_INET).
* @param type The type of the socket (e.g., SOCK_STREAM).
* @param cont The pool to use
}
function apr_socket_create(new_sock: PPapr_socket_t;
family, type_: Integer; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_create' + LibSuff16;
{
* Create a socket.
* @remark With APR 1.0, this function is deprecated and apr_socket_create
* follows this prototype.
* @param new_sock The new socket that has been set up.
* @param family The address family of the socket (e.g., APR_INET).
* @param type The type of the socket (e.g., SOCK_STREAM).
* @param protocol The protocol of the socket (e.g., APR_PROTO_TCP).
* @param cont The pool to use
}
function apr_socket_create_ex(new_sock: PPapr_socket_t;
family, type_, protocol: Integer; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_create_ex' + LibSuff20;
{
* Shutdown either reading, writing, or both sides of a socket.
* @param thesocket The socket to close
* @param how How to shutdown the socket. One of:
* <PRE>
* APR_SHUTDOWN_READ no longer allow read requests
* APR_SHUTDOWN_WRITE no longer allow write requests
* APR_SHUTDOWN_READWRITE no longer allow read or write requests
* </PRE>
* @see apr_shutdown_how_e
* @remark This does not actually close the socket descriptor, it just
* controls which calls are still valid on the socket.
}
function apr_socket_shutdown(thesocket: Papr_socket_t;
how: apr_shutdown_how_e): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_shutdown' + LibSuff8;
{ @deprecated @see apr_socket_shutdown }
function apr_shutdown(thesocket: Papr_socket_t;
how: apr_shutdown_how_e): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_shutdown' + LibSuff8;
{
* Close a socket.
* @param thesocket The socket to close
}
function apr_socket_close(thesocket: Papr_socket_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_close' + LibSuff4;
{
* Bind the socket to its associated port
* @param sock The socket to bind
* @param sa The socket address to bind to
* @remark This may be where we will find out if there is any other process
* using the selected port.
}
function apr_socket_bind(sock: Papr_socket_t;
sa: Papr_sockaddr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_bind' + LibSuff8;
{ @deprecated @see apr_socket_bind }
function apr_bind(sock: Papr_socket_t;
sa: Papr_sockaddr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_bind' + LibSuff8;
{
* Listen to a bound socket for connections.
* @param sock The socket to listen on
* @param backlog The number of outstanding connections allowed in the sockets
* listen queue. If this value is less than zero, the listen
* queue size is set to zero.
}
function apr_socket_listen(sock: Papr_socket_t;
backlog: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_listen' + LibSuff8;
{ @deprecated @see apr_socket_listen }
function apr_listen(sock: Papr_socket_t;
backlog: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_listen' + LibSuff8;
{
* Accept a new connection request
* @param new_sock A copy of the socket that is connected to the socket that
* made the connection request. This is the socket which should
* be used for all future communication.
* @param sock The socket we are listening on.
* @param connection_pool The pool for the new socket.
}
function apr_socket_accept(new_sock: PPapr_socket_t;
sock: Papr_socket_t; connection_pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_accept' + LibSuff12;
{ @deprecated @see apr_socket_accept }
{APR_DECLARE(apr_status_t) apr_accept(apr_socket_t **new_sock,
apr_socket_t *sock,
apr_pool_t *connection_pool);}
{
* Issue a connection request to a socket either on the same machine
* or a different one.
* @param sock The socket we wish to use for our side of the connection
* @param sa The address of the machine we wish to connect to. If NULL,
* APR assumes that the sockaddr_in in the apr_socket is
* completely filled out.
}
function apr_socket_connect(sock: Papr_socket_t; sa: Papr_sockaddr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_connect' + LibSuff8;
{ @deprecated @see apr_socket_connect }
//APR_DECLARE(apr_status_t) apr_connect(apr_socket_t *sock, apr_sockaddr_t *sa);
{
* Create apr_sockaddr_t from hostname, address family, and port.
* @param sa The new apr_sockaddr_t.
* @param hostname The hostname or numeric address string to resolve/parse, or
* NULL to build an address that corresponds to 0.0.0.0 or ::
* @param family The address family to use, or APR_UNSPEC if the system should
* decide.
* @param port The port number.
* @param flags Special processing flags:
* <PRE>
* APR_IPV4_ADDR_OK first query for IPv4 addresses; only look
* for IPv6 addresses if the first query failed;
* only valid if family is APR_UNSPEC and hostname
* isn't NULL; mutually exclusive with
* APR_IPV6_ADDR_OK
* APR_IPV6_ADDR_OK first query for IPv6 addresses; only look
* for IPv4 addresses if the first query failed;
* only valid if family is APR_UNSPEC and hostname
* isn't NULL and APR_HAVE_IPV6; mutually exclusive
* with APR_IPV4_ADDR_OK
* </PRE>
* @param p The pool for the apr_sockaddr_t and associated storage.
}
function apr_sockaddr_info_get(sa: PPapr_socket_t;
const hostname: PChar; family: apr_int32_t;
port: apr_port_t; flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_sockaddr_info_get' + LibSuff24;
{
* Look up the host name from an apr_sockaddr_t.
* @param hostname The hostname.
* @param sa The apr_sockaddr_t.
* @param flags Special processing flags.
}
function apr_getnameinfo(hostname: PPChar; sa: Papr_socket_t; flags: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_getnameinfo' + LibSuff12;
{
* Parse hostname/IP address with scope id and port.
*
* Any of the following strings are accepted:
* 8080 (just the port number)
* www.apache.org (just the hostname)
* www.apache.org:8080 (hostname and port number)
* [fe80::1]:80 (IPv6 numeric address string only)
* [fe80::1%eth0] (IPv6 numeric address string and scope id)
*
* Invalid strings:
* (empty string)
* [abc] (not valid IPv6 numeric address string)
* abc:65536 (invalid port number)
*
* @param addr The new buffer containing just the hostname. On output, *addr
* will be NULL if no hostname/IP address was specfied.
* @param scope_id The new buffer containing just the scope id. On output,
* *scope_id will be NULL if no scope id was specified.
* @param port The port number. On output, *port will be 0 if no port was
* specified.
* ### FIXME: 0 is a legal port (per RFC 1700). this should
* ### return something besides zero if the port is missing.
* @param str The input string to be parsed.
* @param p The pool from which *addr and *scope_id are allocated.
* @remark If scope id shouldn't be allowed, check for scope_id != NULL in
* addition to checking the return code. If addr/hostname should be
* required, check for addr == NULL in addition to checking the
* return code.
}
function apr_parse_addr_port(addr, scope_id: PPChar; port: Papr_port_t;
const str: PChar; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_parse_addr_port' + LibSuff20;
{
* Get name of the current machine
* @param buf A buffer to store the hostname in.
* @param len The maximum length of the hostname that can be stored in the
* buffer provided. The suggested length is APRMAXHOSTLEN + 1.
* @param cont The pool to use.
* @remark If the buffer was not large enough, an error will be returned.
}
function apr_gethostname(buf: PChar; len: Integer; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_gethostname' + LibSuff12;
{
* Return the data associated with the current socket
* @param data The user data associated with the socket.
* @param key The key to associate with the user data.
* @param sock The currently open socket.
}
function apr_socket_data_get(data: PPointer; const key: PChar;
sock: Papr_sockaddr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_data_get' + LibSuff12;
{
* Set the data associated with the current socket.
* @param sock The currently open socket.
* @param data The user data to associate with the socket.
* @param key The key to associate with the data.
* @param cleanup The cleanup to call when the socket is destroyed.
}
type
cleanup_t = function (param: Pointer): apr_status_t;
function apr_socket_data_set(sock: Papr_socket_t; data: Pointer;
const key: PChar; cleanup: cleanup_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_data_set' + LibSuff16;
{
* Send data over a network.
* @param sock The socket to send the data over.
* @param buf The buffer which contains the data to be sent.
* @param len On entry, the number of bytes to send; on exit, the number
* of bytes sent.
* @remark
* <PRE>
* This functions acts like a blocking write by default. To change
* this behavior, use apr_socket_timeout_set().
*
* It is possible for both bytes to be sent and an error to be returned.
*
* APR_EINTR is never returned.
* </PRE>
}
function apr_socket_send(sock: Papr_socket_t; const buf: PChar;
len: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_send' + LibSuff12;
{ @deprecated @see apr_socket_send }
{APR_DECLARE(apr_status_t) apr_send(apr_socket_t *sock, const char *buf,
apr_size_t *len);}
{
* Send multiple packets of data over a network.
* @param sock The socket to send the data over.
* @param vec The array of iovec structs containing the data to send
* @param nvec The number of iovec structs in the array
* @param len Receives the number of bytes actually written
* @remark
* <PRE>
* This functions acts like a blocking write by default. To change
* this behavior, use apr_socket_timeout_set().
* The number of bytes actually sent is stored in argument 3.
*
* It is possible for both bytes to be sent and an error to be returned.
*
* APR_EINTR is never returned.
* </PRE>
}
function apr_socket_sendv(sock: Papr_socket_t; const vec: Piovec;
nvec: apr_int32_t; len: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_sendv' + LibSuff16;
{ @deprecated @see apr_socket_sendv }
{APR_DECLARE(apr_status_t) apr_sendv(apr_socket_t *sock,
const struct iovec *vec,
apr_int32_t nvec, apr_size_t *len);}
{
* @param sock The socket to send from
* @param where The apr_sockaddr_t describing where to send the data
* @param flags The flags to use
* @param buf The data to send
* @param len The length of the data to send
}
function apr_socket_sendto(sock: Papr_socket_t; where: Papr_sockaddr_t;
flags: apr_int32_t; const buf: PChar; len: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_sendto' + LibSuff20;
{ @deprecated @see apr_socket_sendto }
{APR_DECLARE(apr_status_t) apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where,
apr_int32_t flags, const char *buf,
apr_size_t *len);}
{
* @param from The apr_sockaddr_t to fill in the recipient info
* @param sock The socket to use
* @param flags The flags to use
* @param buf The buffer to use
* @param len The length of the available buffer
}
function apr_socket_recvfrom(from: Papr_sockaddr_t; sock: Papr_socket_t;
flags: apr_int32_t; buf: PChar; len: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_recvfrom' + LibSuff20;
{ @deprecated @see apr_socket_recvfrom }
{APR_DECLARE(apr_status_t) apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock,
apr_int32_t flags, char *buf,
apr_size_t *len);}
{$if defined(APR_HAS_SENDFILE) or defined(DOXYGEN)}
{
* Send a file from an open file descriptor to a socket, along with
* optional headers and trailers
* @param sock The socket to which we're writing
* @param file The open file from which to read
* @param hdtr A structure containing the headers and trailers to send
* @param offset Offset into the file where we should begin writing
* @param len (input) - Number of bytes to send from the file
* (output) - Number of bytes actually sent,
* including headers, file, and trailers
* @param flags APR flags that are mapped to OS specific flags
* @remark This functions acts like a blocking write by default. To change
* this behavior, use apr_socket_timeout_set().
* The number of bytes actually sent is stored in argument 5.
}
function apr_socket_sendfile(sock: Papr_socket_t; file_: Papr_file_t;
hdtr: Papr_hdtr_t; offset: Papr_off_t; len: Papr_size_t;
flags: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_sendfile' + LibSuff24;
{ @deprecated @see apr_socket_sendfile }
{APR_DECLARE(apr_status_t) apr_sendfile(apr_socket_t *sock, apr_file_t *file,
apr_hdtr_t *hdtr, apr_off_t *offset,
apr_size_t *len, apr_int32_t flags);}
{$endif} { APR_HAS_SENDFILE }
{
* Read data from a network.
* @param sock The socket to read the data from.
* @param buf The buffer to store the data in.
* @param len On entry, the number of bytes to receive; on exit, the number
* of bytes received.
* @remark
* <PRE>
* This functions acts like a blocking read by default. To change
* this behavior, use apr_socket_timeout_set().
* The number of bytes actually sent is stored in argument 3.
*
* It is possible for both bytes to be received and an APR_EOF or
* other error to be returned.
*
* APR_EINTR is never returned.
* </PRE>
}
function apr_socket_recv(sock: Papr_socket_t; buf: PChar; len: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_recv' + LibSuff12;
{ @deprecated @see apr_socket_recv }
{APR_DECLARE(apr_status_t) apr_recv(apr_socket_t *sock,
char *buf, apr_size_t *len);}
{
* Setup socket options for the specified socket
* @param sock The socket to set up.
* @param opt The option we would like to configure. One of:
* <PRE>
* APR_SO_DEBUG -- turn on debugging information
* APR_SO_KEEPALIVE -- keep connections active
* APR_SO_LINGER -- lingers on close if data is present
* APR_SO_NONBLOCK -- Turns blocking on/off for socket
* APR_SO_REUSEADDR -- The rules used in validating addresses
* supplied to bind should allow reuse
* of local addresses.
* APR_SO_SNDBUF -- Set the SendBufferSize
* APR_SO_RCVBUF -- Set the ReceiveBufferSize
* </PRE>
* @param on Value for the option.
}
function apr_socket_opt_set(sock: Papr_socket_t; opt, on_: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_opt_set' + LibSuff12;
{ @deprecated @see apr_socket_opt_set }
{APR_DECLARE(apr_status_t) apr_setsocketopt(apr_socket_t *sock,
apr_int32_t opt, apr_int32_t on);}
{
* Setup socket timeout for the specified socket
* @param sock The socket to set up.
* @param t Value for the timeout.
* <PRE>
* t > 0 -- read and write calls return APR_TIMEUP if specified time
* elapsess with no data read or written
* t == 0 -- read and write calls never block
* t < 0 -- read and write calls block
* </PRE>
}
function apr_socket_timeout_set(sock: Papr_socket_t; t: apr_interval_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_timeout_set' + LibSuff12;
{
* Query socket options for the specified socket
* @param sock The socket to query
* @param opt The option we would like to query. One of:
* <PRE>
* APR_SO_DEBUG -- turn on debugging information
* APR_SO_KEEPALIVE -- keep connections active
* APR_SO_LINGER -- lingers on close if data is present
* APR_SO_NONBLOCK -- Turns blocking on/off for socket
* APR_SO_REUSEADDR -- The rules used in validating addresses
* supplied to bind should allow reuse
* of local addresses.
* APR_SO_SNDBUF -- Set the SendBufferSize
* APR_SO_RCVBUF -- Set the ReceiveBufferSize
* APR_SO_DISCONNECTED -- Query the disconnected state of the socket.
* (Currently only used on Windows)
* </PRE>
* @param on Socket option returned on the call.
}
function apr_socket_opt_get(sock: Papr_socket_t; opt, on_: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_opt_get' + LibSuff12;
{ @deprecated @see apr_socket_opt_set }
{APR_DECLARE(apr_status_t) apr_getsocketopt(apr_socket_t *sock,
apr_int32_t opt, apr_int32_t *on);}
{
* Query socket timeout for the specified socket
* @param sock The socket to query
* @param t Socket timeout returned from the query.
}
function apr_socket_timeout_get(sock: Papr_socket_t; t: Papr_interval_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_timeout_get' + LibSuff8;
{
* Query the specified socket if at the OOB/Urgent data mark
* @param sock The socket to query
* @param atmark Is set to true if socket is at the OOB/urgent mark,
* otherwise is set to false.
}
function apr_socket_atmark(sock: Papr_socket_t; atmark: PInteger): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_atmark' + LibSuff8;
{
* Return an apr_sockaddr_t from an apr_socket_t
* @param sa The returned apr_sockaddr_t.
* @param which Which interface do we want the apr_sockaddr_t for?
* @param sock The socket to use
}
function apr_socket_addr_get(sa: PPapr_sockaddr_t;
which: apr_interface_e; sock: Papr_socket_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_addr_get' + LibSuff12;
{
* Set the port in an APR socket address.
* @param sockaddr The socket address to set.
* @param port The port to be stored in the socket address.
* @deprecated @see apr_sockaddr_info_get
}
function apr_sockaddr_port_set(sockaddr: Papr_sockaddr_t; port: apr_port_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_sockaddr_port_set' + LibSuff8;
{
* Return the port in an APR socket address.
* @param port The port from the socket address.
* @param sockaddr The socket address to reference.
* @deprecated Access port field directly.
}
function apr_sockaddr_port_get(port: Papr_port_t; sockaddr: Papr_sockaddr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_sockaddr_port_get' + LibSuff8;
{
* Set the IP address in an APR socket address.
* @param sockaddr The socket address to use
* @param addr The IP address to attach to the socket.
* Use APR_ANYADDR to use any IP addr on the machine.
* @deprecated @see apr_sockaddr_info_get
}
function apr_sockaddr_ip_set(sockaddr: Papr_sockaddr_t; const addr: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_sockaddr_ip_set' + LibSuff8;
{
* Return the IP address (in numeric address string format) in
* an APR socket address. APR will allocate storage for the IP address
* string from the pool of the apr_sockaddr_t.
* @param addr The IP address.
* @param sockaddr The socket address to reference.
}
function apr_sockaddr_ip_get(addr: PPChar; sockaddr: Papr_sockaddr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_sockaddr_ip_get' + LibSuff8;
{
* See if the IP addresses in two APR socket addresses are
* equivalent. Appropriate logic is present for comparing
* IPv4-mapped IPv6 addresses with IPv4 addresses.
*
* @param addr1 One of the APR socket addresses.
* @param addr2 The other APR socket address.
* @remark The return value will be non-zero if the addresses
* are equivalent.
}
function apr_sockaddr_equal(const addr1, addr2: Papr_sockaddr_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_sockaddr_equal' + LibSuff8;
{$if defined(APR_FILES_AS_SOCKETS) or defined(DOXYGEN)}
{
* Convert a File type to a socket so that it can be used in a poll operation.
* @param newsock the newly created socket which represents a file.
* @param file the file to mask as a socket.
* @warning This is not available on all platforms. Platforms that have the
* ability to poll files for data to be read/written/exceptions will
* have the APR_FILES_AS_SOCKETS macro defined as true.
* @deprecated This function has been deprecated, because of the new poll
* implementation.
}
function apr_socket_from_file(newsock: Papr_socket_t; file_: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_connect' + LibSuff8;
{$endif} { APR_FILES_AS_SOCKETS }
{
* Given an apr_sockaddr_t and a service name, set the port for the service
* @param sockaddr The apr_sockaddr_t that will have its port set
* @param servname The name of the service you wish to use
}
function apr_getservbyname(sockaddr: Papr_sockaddr_t; const servname: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_getservbyname' + LibSuff8;
{
* Build an ip-subnet representation from an IP address and optional netmask or
* number-of-bits.
* @param ipsub The new ip-subnet representation
* @param ipstr The input IP address string
* @param mask_or_numbits The input netmask or number-of-bits string, or NULL
* @param p The pool to allocate from
}
function apr_ipsubnet_create(ipsub: PPapr_ipsubnet_t;
const ipstr, mask_or_numbits: PChar; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_ipsubnet_create' + LibSuff16;
{
* Test the IP address in an apr_sockaddr_t against a pre-built ip-subnet
* representation.
* @param ipsub The ip-subnet representation
* @param sa The socket address to test
* @return non-zero if the socket address is within the subnet, 0 otherwise
}
function apr_ipsubnet_test(ipsub: Papr_ipsubnet_t; sa: Papr_sockaddr_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_ipsubnet_test' + LibSuff8;
{$if defined(APR_HAS_SO_ACCEPTFILTER) or defined(DOXYGEN)}
{
* Set an OS level accept filter.
* @param sock The socket to put the accept filter on.
* @param name The accept filter
* @param args Any extra args to the accept filter. Passing NULL here removes
* the accept filter.
}
function apr_socket_accept_filter(sock: Papr_socket_t; name, args: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_accept_filter' + LibSuff12;
{$endif}
{
* Return the protocol of the socket.
* @param sock The socket to query.
* @param protocol The returned protocol (e.g., APR_PROTO_TCP).
}
function apr_socket_protocol_get(sock: Papr_socket_t; protocol: PInteger): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_protocol_get' + LibSuff8;
{
* Set a socket to be inherited by child processes.
}
//APR_DECLARE_INHERIT_SET(socket);
{ @deprecated @see apr_socket_inherit_set }
{APR_DECLARE(void) apr_socket_set_inherit(apr_socket_t *skt);}
{
* Unset a socket from being inherited by child processes.
}
//APR_DECLARE_INHERIT_UNSET(socket);
{ @deprecated @see apr_socket_inherit_unset }
{APR_DECLARE(void) apr_socket_unset_inherit(apr_socket_t *skt);}

View File

@ -1,259 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_poll.h
* @brief APR Poll interface
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_errno.h"
#include "apr_inherit.h"
#include "apr_file_io.h"
#include "apr_network_io.h"
#if APR_HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif}
{
* @defgroup apr_poll Poll Routines
* @ingroup APR
}
{
* @defgroup apr_poll_opt Poll options
}
const
APR_POLLIN = $001; {< Can read without blocking }
APR_POLLPRI = $002; {< Priority data available }
APR_POLLOUT = $004; {< Can write without blocking }
APR_POLLERR = $010; {< Pending error }
APR_POLLHUP = $020; {< Hangup occurred }
APR_POLLNVAL = $040; {< Descriptior invalid }
{ Used in apr_pollfd_t to determine what the apr_descriptor is }
type
apr_datatype_e = (
APR_NO_DESC, {< nothing here }
APR_POLL_SOCKET, {< descriptor refers to a socket }
APR_POLL_FILE, {< descriptor refers to a file }
APR_POLL_LASTDESC {< descriptor is the last one in the list }
);
{ Union of either an APR file or socket. }
apr_descriptor = record
case Integer of
1: (f: Papr_file_t); {< file }
2: (s: Papr_socket_t); {< socket }
end;
{ @see apr_pollfd_t }
Papr_pollfd_t = ^apr_pollfd_t;
PPapr_pollfd_t = ^Papr_pollfd_t;
{ Poll descriptor set. }
apr_pollfd_t = record
p: Papr_pool_t; {< associated pool }
desc_type: apr_datatype_e; {< descriptor type }
reqevents: apr_int16_t; {< requested events }
rtnevents: apr_int16_t; {< returned events }
desc: apr_descriptor; {< @see apr_descriptor }
client_data: Pointer; {< allows app to associate context }
end;
{
* Setup the memory required for poll to operate properly
* @param new_poll The poll structure to be used.
* @param num The number of socket descriptors to be polled.
* @param cont The pool to operate on.
* @deprecated This function is deprecated, APR applications should control the pollset memory themselves.
}
function apr_poll_setup(new_poll: PPapr_pollfd_t; num: apr_int32_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_poll_setup' + LibSuff12;
{
* Poll the sockets in the poll structure
* @param aprset The poll structure we will be using.
* @param numsock The number of sockets we are polling
* @param nsds The number of sockets signalled.
* @param timeout The amount of time in microseconds to wait. This is
* a maximum, not a minimum. If a socket is signalled, we
* will wake up before this time. A negative number means
* wait until a socket is signalled.
* @remark
* <PRE>
* The number of sockets signalled is returned in the second argument.
*
* This is a blocking call, and it will not return until either a
* socket has been signalled, or the timeout has expired.
* </PRE>
}
function apr_poll(aprset: Papr_pollfd_t; numsock: apr_int32_t;
nsds: Papr_int32_t; timeout: apr_interval_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_poll' + LibSuff20;
{
* Add a socket to the poll structure.
* @param aprset The poll structure we will be using.
* @param sock The socket to add to the current poll structure.
* @param event The events to look for when we do the poll. One of:
* <PRE>
* APR_POLLIN signal if read will not block
* APR_POLLPRI signal if prioirty data is availble to be read
* APR_POLLOUT signal if write will not block
* </PRE>
* @deprecated This function is deprecated, APR applications should control the pollset memory themselves.
}
function apr_poll_socket_add(aprset: Papr_pollfd_t; sock: Papr_socket_t;
event: apr_int16_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_poll_socket_add' + LibSuff12;
{
* Modify a socket in the poll structure with mask.
* @param aprset The poll structure we will be using.
* @param sock The socket to modify in poll structure.
* @param events The events to stop looking for during the poll. One of:
* <PRE>
* APR_POLLIN signal if read will not block
* APR_POLLPRI signal if priority data is available to be read
* APR_POLLOUT signal if write will not block
* </PRE>
* @deprecated This function is deprecated, APR applications should control the pollset memory themselves.
}
function apr_poll_socket_mask(aprset: Papr_pollfd_t; sock: Papr_socket_t;
events: apr_int16_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_poll_socket_mask' + LibSuff12;
{
* Remove a socket from the poll structure.
* @param aprset The poll structure we will be using.
* @param sock The socket to remove from the current poll structure.
* @deprecated This function is deprecated, APR applications should control the pollset memory themselves.
}
function apr_poll_socket_remove(aprset: Papr_pollfd_t; sock: Papr_socket_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_poll_socket_remove' + LibSuff8;
{
* Clear all events in the poll structure.
* @param aprset The poll structure we will be using.
* @param events The events to clear from all sockets. One of:
* <PRE>
* APR_POLLIN signal if read will not block
* APR_POLLPRI signal if priority data is available to be read
* APR_POLLOUT signal if write will not block
* </PRE>
* @deprecated This function is deprecated, APR applications should control the pollset memory themselves.
}
function apr_poll_socket_clear(aprset: Papr_pollfd_t;
events: apr_int16_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_poll_socket_clear' + LibSuff8;
{
* Get the return events for the specified socket.
* @param event The returned events for the socket. One of:
* <PRE>
* APR_POLLIN Data is available to be read
* APR_POLLPRI Priority data is availble to be read
* APR_POLLOUT Write will succeed
* APR_POLLERR An error occurred on the socket
* APR_POLLHUP The connection has been terminated
* APR_POLLNVAL This is an invalid socket to poll on.
* Socket not open.
* </PRE>
* @param sock The socket we wish to get information about.
* @param aprset The poll structure we will be using.
* @deprecated This function is deprecated, APR applications should control the pollset memory themselves.
}
function apr_poll_revents_get(event: Papr_int16_t; sock: Papr_socket_t;
aprset: Papr_pollfd_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_poll_revents_get' + LibSuff12;
{ General-purpose poll API for arbitrarily large numbers of
* file descriptors
}
{ Opaque structure used for pollset API }
type
apr_pollset_t = record end;
Papr_pollset_t = ^apr_pollset_t;
PPapr_pollset_t = ^Papr_pollset_t;
{
* Setup a pollset object
* @param pollset The pointer in which to return the newly created object
* @param size The maximum number of descriptors that this pollset can hold
* @param p The pool from which to allocate the pollset
* @param flags Optional flags to modify the operation of the pollset
* (reserved for future expansion)
}
function apr_pollset_create(pollset: PPapr_pollset_t; size: apr_uint32_tso_handle_t;
p: Papr_pool_t; flags: apr_uint32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pollset_create' + LibSuff16;
{
* Destroy a pollset object
* @param pollset The pollset to destroy
}
function apr_pollset_destroy(pollset: Papr_pollset_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pollset_destroy' + LibSuff4;
{
* Add a socket or file descriptor to a pollset
* @param pollset The pollset to which to add the descriptor
* @param descriptor The descriptor to add
* @remark If you set client_data in the descriptor, that value
* will be returned in the client_data field whenever this
* descriptor is signalled in apr_pollset_poll().
}
function apr_pollset_add(pollset: Papr_pollset_t;
const descriptor: Papr_pollfd_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pollset_add' + LibSuff8;
{
* Remove a descriptor from a pollset
* @param pollset The pollset from which to remove the descriptor
* @param descriptor The descriptor to remove
}
function apr_pollset_remove(pollset: Papr_pollset_t;
const descriptor: Papr_pollfd_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pollset_remove' + LibSuff8;
{
* Block for activity on the descriptor(s) in a pollset
* @param pollset The pollset to use
* @param timeout Timeout in microseconds
* @param num Number of signalled descriptors (output parameter)
* @param descriptors Array of signalled descriptors (output parameter)
}
function apr_pollset_poll(pollset: Papr_pollset_t; timeout: apr_interval_time_t;
num: Papr_int32_t; const descriptors: PPapr_pollfd_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pollset_poll' + LibSuff20;

View File

@ -1,707 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_pools.h
* @brief APR memory allocation
*
* Resource allocation routines...
*
* designed so that we don't have to keep track of EVERYTHING so that
* it can be explicitly freed later (a fundamentally unsound strategy ---
* particularly in the presence of die()).
*
* Instead, we maintain pools, and allocate items (both memory and I/O
* handlers) from the pools --- currently there are two, one for per
* transaction info, and one for config info. When a transaction is over,
* we can delete everything in the per-transaction apr_pool_t without fear,
* and without thinking too hard about it either.
}
{#include "apr.h"
#include "apr_errno.h"
#include "apr_general.h"{ { for APR_STRINGIFY }
//#include "apr_want.h"
{
* @defgroup apr_pools Memory Pool Functions
* @ingroup APR
* @
}
{ The fundamental pool type }
type
apr_pool_t = record end;
Papr_pool_t = ^apr_pool_t;
PPapr_pool_t = ^Papr_pool_t;
{
* Declaration helper macro to construct apr_foo_pool_get()s.
*
* This standardized macro is used by opaque (APR) data types to return
* the apr_pool_t that is associated with the data type.
*
* APR_POOL_DECLARE_ACCESSOR() is used in a header file to declare the
* accessor function. A typical usage and result would be:
* <pre>
* APR_POOL_DECLARE_ACCESSOR(file);
* becomes:
* APR_DECLARE(apr_pool_t *) apr_file_pool_get(apr_file_t *ob);
* </pre>
* @remark Doxygen unwraps this macro (via doxygen.conf) to provide
* actual help for each specific occurance of apr_foo_pool_get.
* @remark the linkage is specified for APR. It would be possible to expand
* the macros to support other linkages.
}
{#define APR_POOL_DECLARE_ACCESSOR(type) \
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
(const apr_##type##_t *the##type)
}
{
* Implementation helper macro to provide apr_foo_pool_get()s.
*
* In the implementation, the APR_POOL_IMPLEMENT_ACCESSOR() is used to
* actually define the function. It assumes the field is named "pool".
}
{#define APR_POOL_IMPLEMENT_ACCESSOR(type) \
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
(const apr_##type##_t *the##type) \}
{ return the##type->pool; }
{
* Pool debug levels
*
* <pre>
* | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
* ---------------------------------
* | | | | | | | | x | General debug code enabled (usefull in
* combination with --with-efence).
*
* | | | | | | | x | | Verbose output on stderr (report
* CREATE, CLEAR, DESTROY).
*
* | | | | x | | | | | Verbose output on stderr (report
* PALLOC, PCALLOC).
*
* | | | | | | x | | | Lifetime checking. On each use of a
* pool, check its lifetime. If the pool
* is out of scope, abort().
* In combination with the verbose flag
* above, it will output LIFE in such an
* event prior to aborting.
*
* | | | | | x | | | | Pool owner checking. On each use of a
* pool, check if the current thread is the
* pools owner. If not, abort(). In
* combination with the verbose flag above,
* it will output OWNER in such an event
* prior to aborting. Use the debug
* function apr_pool_owner_set() to switch
* a pools ownership.
*
* When no debug level was specified, assume general debug mode.
* If level 0 was specified, debugging is switched off
* </pre>
}
{#if defined(APR_POOL_DEBUG)
#if (APR_POOL_DEBUG != 0) && (APR_POOL_DEBUG - 0 == 0)
#undef APR_POOL_DEBUG
#define APR_POOL_DEBUG 1
#endif
#else
#define APR_POOL_DEBUG 0
#endif
}
{ the place in the code where the particular function was called }
//#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
{ A function that is called when allocation fails. }
type
apr_abortfunc_t = function (retcode: Integer): Integer;
{
* APR memory structure manipulators (pools, tables, and arrays).
}
{
* Initialization
}
{
* Setup all of the internal structures required to use pools
* @remark Programs do NOT need to call this directly. APR will call this
* automatically from apr_initialize.
* @internal
}
function apr_pool_initialize: apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_initialize' + LibSuff0;
{
* Tear down all of the internal structures required to use pools
* @remark Programs do NOT need to call this directly. APR will call this
* automatically from apr_terminate.
* @internal
}
procedure apr_pool_terminate;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_terminate' + LibSuff0;
{
* Pool creation/destruction
}
{$include apr_allocator.inc}
{
* Create a new pool.
* @param newpool The pool we have just created.
* @param parent The parent pool. If this is NULL, the new pool is a root
* pool. If it is non-NULL, the new pool will inherit all
* of its parent pool's attributes, except the apr_pool_t will
* be a sub-pool.
* @param abort_fn A function to use if the pool cannot allocate more memory.
* @param allocator The allocator to use with the new pool. If NULL the
* allocator of the parent pool will be used.
}
function apr_pool_create_ex(newpool: PPapr_pool_t;
parent: Papr_pool_t; abort_fn: apr_abortfunc_t;
allocator: Papr_allocator_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_create_ex' + LibSuff16;
{
* Debug version of apr_pool_create_ex.
* @param newpool @see apr_pool_create.
* @param parent @see apr_pool_create.
* @param abort_fn @see apr_pool_create.
* @param allocator @see apr_pool_create.
* @param file_line Where the function is called from.
* This is usually APR_POOL__FILE_LINE__.
* @remark Only available when APR_POOL_DEBUG is defined.
* Call this directly if you have you apr_pool_create_ex
* calls in a wrapper function and wish to override
* the file_line argument to reflect the caller of
* your wrapper function. If you do not have
* apr_pool_create_ex in a wrapper, trust the macro
* and don't call apr_pool_create_ex_debug directly.
}
function apr_pool_create_ex_debug(newpool: PPapr_pool_t;
parent: Papr_pool_t; abort_fn: apr_abortfunc_t;
allocator: Papr_allocator_t; const file_line: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_create_ex_debug' + LibSuff20;
{#if APR_POOL_DEBUG
#define apr_pool_create_ex(newpool, parent, abort_fn, allocator) \
apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \
APR_POOL__FILE_LINE__)
#endif
}
{
* Create a new pool.
* @param newpool The pool we have just created.
* @param parent The parent pool. If this is NULL, the new pool is a root
* pool. If it is non-NULL, the new pool will inherit all
* of its parent pool's attributes, except the apr_pool_t will
* be a sub-pool.
}
{$ifdef DOXYGEN}
function apr_pool_create(newpool: PPapr_pool_t;
parent: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_create' + LibSuff8;
{$else}
{.$ifdef APR_POOL_DEBUG}
{#define apr_pool_create(newpool, parent) \
apr_pool_create_ex_debug(newpool, parent, NULL, NULL, \
APR_POOL__FILE_LINE__)}
{.$else}
function apr_pool_create(newpool: PPapr_pool_t; parent: Papr_pool_t): apr_status_t;
{.$endif}
{$endif}
{ @deprecated @see apr_pool_create_ex }
{#if APR_POOL_DEBUG
#define apr_pool_sub_make(newpool, parent, abort_fn) \
(void)apr_pool_create_ex_debug(newpool, parent, abort_fn, \
NULL, \
APR_POOL__FILE_LINE__)
#else}
function apr_pool_sub_make(newpool: PPapr_pool_t; parent: Papr_pool_t;
abort_fn: apr_abortfunc_t): apr_status_t;
//#endif
{
* Find the pools allocator
* @param pool The pool to get the allocator from.
}
function apr_pool_allocator_get(pool: Papr_pool_t): Papr_allocator_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_allocator_get' + LibSuff4;
{
* Clear all memory in the pool and run all the cleanups. This also destroys all
* subpools.
* @param p The pool to clear
* @remark This does not actually free the memory, it just allows the pool
* to re-use this memory for the next allocation.
* @see apr_pool_destroy()
}
procedure apr_pool_clear(p: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_clear' + LibSuff4;
{
* Debug version of apr_pool_clear.
* @param p See: apr_pool_clear.
* @param file_line Where the function is called from.
* This is usually APR_POOL__FILE_LINE__.
* @remark Only available when APR_POOL_DEBUG is defined.
* Call this directly if you have you apr_pool_clear
* calls in a wrapper function and wish to override
* the file_line argument to reflect the caller of
* your wrapper function. If you do not have
* apr_pool_clear in a wrapper, trust the macro
* and don't call apr_pool_destroy_clear directly.
}
procedure apr_pool_clear_debug(p: Papr_pool_t; const file_line: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_clear_debug' + LibSuff8;
{#if APR_POOL_DEBUG
#define apr_pool_clear(p) \
apr_pool_clear_debug(p, APR_POOL__FILE_LINE__)
#endif}
{
* Destroy the pool. This takes similar action as apr_pool_clear() and then
* frees all the memory.
* @param p The pool to destroy
* @remark This will actually free the memory
}
procedure apr_pool_destroy(p: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_destroy' + LibSuff4;
{
* Debug version of apr_pool_destroy.
* @param p See: apr_pool_destroy.
* @param file_line Where the function is called from.
* This is usually APR_POOL__FILE_LINE__.
* @remark Only available when APR_POOL_DEBUG is defined.
* Call this directly if you have you apr_pool_destroy
* calls in a wrapper function and wish to override
* the file_line argument to reflect the caller of
* your wrapper function. If you do not have
* apr_pool_destroy in a wrapper, trust the macro
* and don't call apr_pool_destroy_debug directly.
}
procedure apr_pool_destroy_debug(p: Papr_pool_t; const file_line: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_destroy_debug' + LibSuff8;
{#if APR_POOL_DEBUG
#define apr_pool_destroy(p) \
apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
#endif}
{
* Memory allocation
}
{
* Allocate a block of memory from a pool
* @param p The pool to allocate from
* @param size The amount of memory to allocate
* @return The allocated memory
}
function apr_palloc(p: Papr_pool_t; size: apr_size_t): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_palloc' + LibSuff8;
{
* Debug version of apr_palloc
* @param p See: apr_palloc
* @param size See: apr_palloc
* @param file_line Where the function is called from.
* This is usually APR_POOL__FILE_LINE__.
* @return See: apr_palloc
}
function apr_palloc_debug(p: Papr_pool_t; size: apr_size_t;
const file_line: PChar): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_palloc_debug' + LibSuff12;
{#if APR_POOL_DEBUG
#define apr_palloc(p, size) \
apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
#endif
}
{
* Allocate a block of memory from a pool and set all of the memory to 0
* @param p The pool to allocate from
* @param size The amount of memory to allocate
* @return The allocated memory
}
{#if defined(DOXYGEN)}
function apr_pcalloc(p: Papr_pool_t; size: apr_size_t): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pcalloc' + LibSuff8;
{#elif !APR_POOL_DEBUG
#define apr_pcalloc(p, size) memset(apr_palloc(p, size), 0, size)
#endif
}
{
* Debug version of apr_pcalloc
* @param p See: apr_pcalloc
* @param size See: apr_pcalloc
* @param file_line Where the function is called from.
* This is usually APR_POOL__FILE_LINE__.
* @return See: apr_pcalloc
}
{APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *p, apr_size_t size,
const char *file_line);
#if APR_POOL_DEBUG
#define apr_pcalloc(p, size) \
apr_pcalloc_debug(p, size, APR_POOL__FILE_LINE__)
#endif
}
{
* Pool Properties
}
{
* Set the function to be called when an allocation failure occurs.
* @remark If the program wants APR to exit on a memory allocation error,
* then this function can be called to set the callback to use (for
* performing cleanup and then exiting). If this function is not called,
* then APR will return an error and expect the calling program to
* deal with the error accordingly.
}
procedure apr_pool_abort_set(abortfunc: apr_abortfunc_t; pool: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_abort_set' + LibSuff8;
{ @deprecated @see apr_pool_abort_set }
{APR_DECLARE(void) apr_pool_set_abort(apr_abortfunc_t abortfunc,
apr_pool_t *pool);
}
{
* Get the abort function associated with the specified pool.
* @param pool The pool for retrieving the abort function.
* @return The abort function for the given pool.
}
function apr_pool_abort_get(pool: Papr_pool_t): apr_abortfunc_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_abort_get' + LibSuff4;
{ @deprecated @see apr_pool_abort_get }
//APR_DECLARE(apr_abortfunc_t) apr_pool_get_abort(apr_pool_t *pool);
{
* Get the parent pool of the specified pool.
* @param pool The pool for retrieving the parent pool.
* @return The parent of the given pool.
}
function apr_pool_parent_get(pool: Papr_pool_t): Papr_pool_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_parent_get' + LibSuff4;
{ @deprecated @see apr_pool_parent_get }
//APR_DECLARE(apr_pool_t *) apr_pool_get_parent(apr_pool_t *pool);
{
* Determine if pool a is an ancestor of pool b
* @param a The pool to search
* @param b The pool to search for
* @return True if a is an ancestor of b, NULL is considered an ancestor
* of all pools.
}
function apr_pool_is_ancestor(a, b: Papr_pool_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_is_ancestor' + LibSuff8;
{
* Tag a pool (give it a name)
* @param pool The pool to tag
* @param tag The tag
}
procedure apr_pool_tag(pool: Papr_pool_t; tag: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_tag' + LibSuff8;
{
* User data management
}
{
* Set the data associated with the current pool
* @param data The user data associated with the pool.
* @param key The key to use for association
* @param cleanup The cleanup program to use to cleanup the data (NULL if none)
* @param pool The current pool
* @warning The data to be attached to the pool should have a life span
* at least as long as the pool it is being attached to.
*
* Users of APR must take EXTREME care when choosing a key to
* use for their data. It is possible to accidentally overwrite
* data by choosing a key that another part of the program is using.
* Therefore it is advised that steps are taken to ensure that unique
* keys are used for all of the userdata objects in a particular pool
* (the same key in two different pools or a pool and one of its
* subpools is okay) at all times. Careful namespace prefixing of
* key names is a typical way to help ensure this uniqueness.
}
//function apr_pool_userdata_set(
// const data: Pointer; const key: PChar;
// cleanup: function(param: Pointer): apr_status_t,
// pool: Papr_pool_t): apr_status_t;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_pool_userdata_set' + LibSuff20;
{
* Set the data associated with the current pool
* @param data The user data associated with the pool.
* @param key The key to use for association
* @param cleanup The cleanup program to use to cleanup the data (NULL if none)
* @param pool The current pool
* @note same as apr_pool_userdata_set(), except that this version doesn't
* make a copy of the key (this function is useful, for example, when
* the key is a string literal)
* @warning This should NOT be used if the key could change addresses by
* any means between the apr_pool_userdata_setn() call and a
* subsequent apr_pool_userdata_get() on that key, such as if a
* static string is used as a userdata key in a DSO and the DSO could
* be unloaded and reloaded between the _setn() and the _get(). You
* MUST use apr_pool_userdata_set() in such cases.
* @warning More generally, the key and the data to be attached to the
* pool should have a life span at least as long as the pool itself.
*
}
//function apr_pool_userdata_setn(
// const data: Pointer; const key: PChar;
// cleanup: function(param: Pointer): apr_status_t,
// pool: Papr_pool_t): apr_status_t;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_pool_userdata_setn' + LibSuff20;
{
* Return the data associated with the current pool.
* @param data The user data associated with the pool.
* @param key The key for the data to retrieve
* @param pool The current pool.
}
function apr_pool_userdata_get(data: PPointer; const key: PChar;
pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_userdata_get' + LibSuff12;
{
* Cleanup
*
* Cleanups are performed in the reverse order they were registered. That is:
* Last In, First Out.
}
{
* Register a function to be called when a pool is cleared or destroyed
* @param p The pool register the cleanup with
* @param data The data to pass to the cleanup function.
* @param plain_cleanup The function to call when the pool is cleared
* or destroyed
* @param child_cleanup The function to call when a child process is being
* shutdown - this function is called in the child, obviously!
}
type
plain_cleanup_t = function(param: Pointer): apr_status_t; cdecl;
child_cleanup_t = function(param: Pointer): apr_status_t; cdecl;
procedure apr_pool_cleanup_register(p: Papr_pool_t;
const data: Pointer;
plain_cleanup: plain_cleanup_t;
child_cleanup: child_cleanup_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_cleanup_register' + LibSuff16;
{
* Remove a previously registered cleanup function
* @param p The pool remove the cleanup from
* @param data The data to remove from cleanup
* @param cleanup The function to remove from cleanup
* @remarks For some strange reason only the plain_cleanup is handled by this
* function
}
//procedure apr_pool_cleanup_for_exec;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_pool_cleanup_for_exec' + LibSuff0;
//APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data,
// apr_status_t cleanup)(void );
{
* Replace the child cleanup of a previously registered cleanup
* @param p The pool of the registered cleanup
* @param data The data of the registered cleanup
* @param plain_cleanup The plain cleanup function of the registered cleanup
* @param child_cleanup The function to register as the child cleanup
}
//procedure apr_pool_cleanup_for_exec;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_pool_cleanup_for_exec' + LibSuff0;
{APR_DECLARE(void) apr_pool_child_cleanup_set(
apr_pool_t *p,
const void *data,
apr_status_t plain_cleanup)(void ,
apr_status_t child_cleanup)(void );
}
{
* Run the specified cleanup function immediately and unregister it. Use
* @a data instead of the data that was registered with the cleanup.
* @param p The pool remove the cleanup from
* @param data The data to remove from cleanup
* @param cleanup The function to remove from cleanup
}
//procedure apr_pool_cleanup_for_exec;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_pool_cleanup_for_exec' + LibSuff0;
{APR_DECLARE(apr_status_t) apr_pool_cleanup_run(
apr_pool_t *p,
void *data,
apr_status_t cleanup)(void );}
{
* An empty cleanup function
* @param data The data to cleanup
}
//APR_DECLARE_NONSTD(apr_status_t) apr_pool_cleanup_null(void *data);
{ Preparing for exec() --- close files, etc., but *don't* flush I/O
* buffers, *don't* wait for subprocesses, and *don't* free any memory.
}
{
* Run all of the child_cleanups, so that any unnecessary files are
* closed because we are about to exec a new program
}
procedure apr_pool_cleanup_for_exec;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_cleanup_for_exec' + LibSuff0;
{
* @defgroup PoolDebug Pool Debugging functions.
*
* pools have nested lifetimes -- sub_pools are destroyed when the
* parent pool is cleared. We allow certain liberties with operations
* on things such as tables (and on other structures in a more general
* sense) where we allow the caller to insert values into a table which
* were not allocated from the table's pool. The table's data will
* remain valid as long as all the pools from which its values are
* allocated remain valid.
*
* For example, if B is a sub pool of A, and you build a table T in
* pool B, then it's safe to insert data allocated in A or B into T
* (because B lives at most as long as A does, and T is destroyed when
* B is cleared/destroyed). On the other hand, if S is a table in
* pool A, it is safe to insert data allocated in A into S, but it
* is *not safe* to insert data allocated from B into S... because
* B can be cleared/destroyed before A is (which would leave dangling
* pointers in T's data structures).
*
* In general we say that it is safe to insert data into a table T
* if the data is allocated in any ancestor of T's pool. This is the
* basis on which the APR_POOL_DEBUG code works -- it tests these ancestor
* relationships for all data inserted into tables. APR_POOL_DEBUG also
* provides tools (apr_pool_find, and apr_pool_is_ancestor) for other
* folks to implement similar restrictions for their own data
* structures.
*
* However, sometimes this ancestor requirement is inconvenient --
* sometimes we're forced to create a sub pool (such as through
* apr_sub_req_lookup_uri), and the sub pool is guaranteed to have
* the same lifetime as the parent pool. This is a guarantee implemented
* by the *caller*, not by the pool code. That is, the caller guarantees
* they won't destroy the sub pool individually prior to destroying the
* parent pool.
*
* In this case the caller must call apr_pool_join() to indicate this
* guarantee to the APR_POOL_DEBUG code. There are a few examples spread
* through the standard modules.
*
* These functions are only implemented when #APR_POOL_DEBUG is set.
*
}
{$if defined(APR_POOL_DEBUG) or defined(DOXYGEN)}
{
* Guarantee that a subpool has the same lifetime as the parent.
* @param p The parent pool
* @param sub The subpool
}
procedure apr_pool_join(p, sub: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_join' + LibSuff8;
{
* Find a pool from something allocated in it.
* @param mem The thing allocated in the pool
* @return The pool it is allocated in
}
function apr_pool_find(const mem: Pointer): Papr_pool_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_find' + LibSuff4;
{
* Report the number of bytes currently in the pool
* @param p The pool to inspect
* @param recurse Recurse/include the subpools' sizes
* @return The number of bytes
}
function apr_pool_num_bytes(p: Papr_pool_t; recurse: Integer): apr_size_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_num_bytes' + LibSuff8;
{
* Lock a pool
* @param pool The pool to lock
* @param flag The flag
}
procedure apr_pool_lock(pool: Papr_pool_t; flag: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_lock' + LibSuff8;
{$else} { APR_POOL_DEBUG or DOXYGEN }
{#ifdef apr_pool_join
#undef apr_pool_join
#endif
#define apr_pool_join(a,b)
#ifdef apr_pool_lock
#undef apr_pool_lock
#endif
#define apr_pool_lock(pool, lock)}
{$endif} { APR_POOL_DEBUG or DOXYGEN }

View File

@ -1,540 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{ This header file is where you should put ANY platform specific information.
* This should be the only header file that programs need to include that
* actually has platform dependant code which refers to the .
}
{
* @file apr_portable.h
* @brief APR Portability Routines
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_thread_proc.h"
#include "apr_file_io.h"
#include "apr_network_io.h"
#include "apr_errno.h"
#include "apr_global_mutex.h"
#include "apr_proc_mutex.h"
#include "apr_time.h"
#include "apr_dso.h"
#include "apr_shm.h"
#if APR_HAVE_DIRENT_H
#include <dirent.h>
#endif
#if APR_HAVE_FCNTL_H
#include <fcntl.h>
#endif
#if APR_HAVE_PTHREAD_H
#include <pthread.h>
#endif}
{
* @defgroup apr_portabile Portability Routines
* @ingroup APR
}
type
{$ifdef WINDOWS}
{ The primitives for Windows types }
apr_os_file_t = THandle;
apr_os_dir_t = THandle;
apr_os_sock_t = TSocket;
apr_os_proc_mutex_t = THandle;
apr_os_thread_t = THandle;
apr_os_proc_t = THandle;
apr_os_threadkey_t = Cardinal;
apr_os_imp_time_t = TFILETIME;
apr_os_exp_time_t = TSYSTEMTIME;
apr_os_dso_handle_t = THandle;
apr_os_shm_t = THandle;
{$else}
{$ifdef OS2}
HFILE apr_os_file_t;
HDIR apr_os_dir_t;
int apr_os_sock_t;
HMTX apr_os_proc_mutex_t;
TID apr_os_thread_t;
PID apr_os_proc_t;
PULONG apr_os_threadkey_t;
struct timeval apr_os_imp_time_t;
struct tm apr_os_exp_time_t;
HMODULE apr_os_dso_handle_t;
apr_os_shm_t: Pointer;
{$else}
{$ifdef BEOS}
#include <kernel/OS.h>
#include <kernel/image.h>
apr_os_proc_mutex_t = record
sem_id sem;
int32 ben;
end;
apr_os_file_t: cint;
DIR apr_os_dir_t;
apr_os_sock_t: cint;
struct apr_os_proc_mutex_t apr_os_proc_mutex_t;
thread_id apr_os_thread_t;
thread_id apr_os_proc_t;
apr_os_threadkey_t: cint;
struct timeval apr_os_imp_time_t;
struct tm apr_os_exp_time_t;
image_id apr_os_dso_handle_t;
apr_os_shm_t: Pointer;
{$else}
{$ifdef NETWARE}
apr_os_file_t: cint;
DIR apr_os_dir_t;
apr_os_sock_t: cint;
NXMutex_t apr_os_proc_mutex_t;
NXThreadId_t apr_os_thread_t;
long apr_os_proc_t;
NXKey_t apr_os_threadkey_t;
struct timeval apr_os_imp_time_t;
struct tm apr_os_exp_time_t;
apr_os_dso_handle_t: Pointer;
apr_os_shm_t: Pointer;
{$else}
{ Any other OS should go above this one. This is the lowest common
* denominator typedefs for all UNIX-like systems. :)
}
{ Basic OS process mutex structure. }
apr_os_proc_mutex_t = record
{$if defined(APR_HAS_SYSVSEM_SERIALIZE) or defined(APR_HAS_FCNTL_SERIALIZE) or defined(APR_HAS_FLOCK_SERIALIZE)}
crossproc: Integer;
{$endif}
{$ifdef APR_HAS_PROC_PTHREAD_SERIALIZE}
pthread_mutex_t *pthread_interproc;
{$endif}
{$ifdef APR_HAS_THREADS}
{ If no threads, no need for thread locks }
{$if APR_USE_PTHREAD_SERIALIZE}
pthread_mutex_t *intraproc;
{$endif}
{$endif}
end;
apr_os_file_t: Integer; {< native file }
typedef DIR apr_os_dir_t; {< native dir }
apr_os_sock_t: Integer; {< native dir }
typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t; {< native proces
* mutex
}
{$if defined(APR_HAS_THREADS) and defined(APR_HAVE_PTHREAD_H)}
typedef pthread_t apr_os_thread_t; {< native thread }
typedef pthread_key_t apr_os_threadkey_t; {< native thread address
* space }
{$endif}
typedef pid_t apr_os_proc_t; {< native pid }
typedef struct timeval apr_os_imp_time_t; {< native timeval }
typedef struct tm apr_os_exp_time_t; {< native tm }
{ @var apr_os_dso_handle_t
* native dso types
}
{$ifdef HPUX}
#include <dl.h>
typedef shl_t apr_os_dso_handle_t;
{$else}
{$ifdef DARWIN}
#include <mach-o/dyld.h>
typedef NSModule apr_os_dso_handle_t;
{$else}
typedef void * apr_os_dso_handle_t;
{$endif}
{$endif}
typedef void* apr_os_shm_t; {< native SHM }
{$endif}
{$endif}
{$endif}
{$endif}
Papr_os_sock_t = ^apr_os_sock_t;
{
* @typedef apr_os_sock_info_t
* @brief alias for local OS socket
}
{
* everything APR needs to know about an active socket to construct
* an APR socket from it; currently, this is platform-independent
}
apr_os_sock_info_t = record
os_sock: Papr_os_sock_t; {< always required }
local: Psockaddr; {< NULL if not yet bound }
remote: Psockaddr; {< NULL if not connected }
family: Integer; {< always required (APR_INET, APR_INET6, etc.) }
type_: Integer; {< always required (SOCK_STREAM, SOCK_DGRAM, etc.) }
{$ifdef APR_ENABLE_FOR_1_0} {< enable with APR 1.0 }
protocol: Integer; {< 0 or actual protocol (APR_PROTO_SCTP, APR_PROTO_TCP, etc.) }
{$endif}
end;
Papr_os_sock_info_t = ^apr_os_sock_info_t;
{$if defined(APR_PROC_MUTEX_IS_GLOBAL) or defined(DOXYGEN)}
{ Opaque global mutex type }
#define apr_os_global_mutex_t apr_os_proc_mutex_t
{ @return apr_os_global_mutex }
#define apr_os_global_mutex_get apr_os_proc_mutex_get
{$else}
{ Thread and process mutex for those platforms where process mutexes
* are not held in threads.
}
apr_os_global_mutex_t = record
pool: Papr_pool_t;
proc_mutex: Papr_proc_mutex_t;
#if APR_HAS_THREADS
thread_mutex: Papr_proc_mutex_t;
#endif { APR_HAS_THREADS }
end;
Papr_os_global_mutex_t = ^apr_os_global_mutex_t;
APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmutex,
apr_global_mutex_t *pmutex);
{$endif}
{
* convert the file from apr type to os specific type.
* @param thefile The os specific file we are converting to
* @param file The apr file to convert.
* @remark On Unix, it is only possible to get a file descriptor from
* an apr file type.
}
function apr_os_file_get(thefile, file_: Papr_os_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_file_get' + LibSuff8;
{
* convert the dir from apr type to os specific type.
* @param thedir The os specific dir we are converting to
* @param dir The apr dir to convert.
}
function apr_os_dir_get(thedir: PPapr_os_dir_t; dir: Papr_dir_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_dir_get' + LibSuff8;
{
* Convert the socket from an apr type to an OS specific socket
* @param thesock The socket to convert.
* @param sock The os specifc equivelant of the apr socket..
}
function apr_os_sock_get(thesock, sock: Papr_os_sock_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_sock_get' + LibSuff8;
{
* Convert the proc mutex from os specific type to apr type
* @param ospmutex The os specific proc mutex we are converting to.
* @param pmutex The apr proc mutex to convert.
}
function apr_os_proc_mutex_get(ospmutex: Papr_os_proc_mutex_t;
pmutex: Papr_proc_mutex_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_proc_mutex_get' + LibSuff8;
{
* Get the exploded time in the platforms native format.
* @param ostime the native time format
* @param aprtime the time to convert
}
function apr_os_exp_time_get(ostime: PPapr_os_exp_time_t;
aprtime: Papr_time_exp_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_exp_time_get' + LibSuff8;
{
* Get the imploded time in the platforms native format.
* @param ostime the native time format
* @param aprtime the time to convert
}
function apr_os_imp_time_get(ostime: PPapr_os_imp_time_t;
aprtime: Papr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_imp_time_get' + LibSuff8;
{
* convert the shm from apr type to os specific type.
* @param osshm The os specific shm representation
* @param shm The apr shm to convert.
}
function apr_os_shm_get(osshm: Papr_os_shm_t; shm: Papr_shm_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_shm_get' + LibSuff8;
{$if defined(APR_HAS_THREADS) or defined(DOXYGEN)}
{
* @defgroup apr_os_thread Thread portability Routines
}
{
* convert the thread to os specific type from apr type.
* @param thethd The apr thread to convert
* @param thd The os specific thread we are converting to
}
function apr_os_thread_get(thethd: PPapr_os_thread_t;
thd: Papr_thread_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_thread_get' + LibSuff8;
{
* convert the thread private memory key to os specific type from an apr type.
* @param thekey The apr handle we are converting from.
* @param key The os specific handle we are converting to.
}
function apr_os_threadkey_get(thekey: Papr_os_threadkey_t;
key: Papr_threadkey_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_threadkey_get' + LibSuff8;
{
* convert the thread from os specific type to apr type.
* @param thd The apr thread we are converting to.
* @param thethd The os specific thread to convert
* @param cont The pool to use if it is needed.
}
function apr_os_thread_put(thd: PPapr_thread_t;
thethd: Papr_os_thread_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_thread_put' + LibSuff12;
{
* convert the thread private memory key from os specific type to apr type.
* @param key The apr handle we are converting to.
* @param thekey The os specific handle to convert
* @param cont The pool to use if it is needed.
}
function apr_os_threadkey_put(key: PPapr_threadkey_t;
thekey: Papr_os_threadkey_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_threadkey_put' + LibSuff12;
{
* Get the thread ID
}
function apr_os_thread_current: apr_os_thread_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_thread_current' + LibSuff0;
{
* Compare two thread id's
* @param tid1 1st Thread ID to compare
* @param tid2 2nd Thread ID to compare
}
function apr_os_thread_equal(tid1, tid2: apr_os_thread_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_thread_equal' + LibSuff8;
{$endif} { APR_HAS_THREADS }
{
* convert the file from os specific type to apr type.
* @param file The apr file we are converting to.
* @param thefile The os specific file to convert
* @param flags The flags that were used to open this file.
* @param cont The pool to use if it is needed.
* @remark On Unix, it is only possible to put a file descriptor into
* an apr file type.
}
function apr_os_file_put(file_: PPapr_file_t;
pthefilemutex: Papr_os_file_t; flags: apr_int32_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_file_put' + LibSuff16;
{
* convert the file from os specific type to apr type.
* @param file The apr file we are converting to.
* @param thefile The os specific pipe to convert
* @param cont The pool to use if it is needed.
* @remark On Unix, it is only possible to put a file descriptor into
* an apr file type.
}
function apr_os_pipe_put(file_: PPapr_file_t;
thefile: Papr_os_file_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_pipe_put' + LibSuff12;
{
* convert the file from os specific type to apr type.
* @param file The apr file we are converting to.
* @param thefile The os specific pipe to convert
* @param register_cleanup A cleanup will be registered on the apr_file_t
* to issue apr_file_close().
* @param cont The pool to use if it is needed.
* @remark On Unix, it is only possible to put a file descriptor into
* an apr file type.
}
function apr_os_pipe_put_ex(file_: PPapr_file_t;
thefile: Papr_os_file_t; register_cleanup: Integer;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_pipe_put_ex' + LibSuff16;
{
* convert the dir from os specific type to apr type.
* @param dir The apr dir we are converting to.
* @param thedir The os specific dir to convert
* @param cont The pool to use when creating to apr directory.
}
function apr_os_dir_put(dir: PPapr_dir_t; thedir: Papr_os_dir_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_dir_put' + LibSuff12;
{
* Convert a socket from the os specific type to the apr type
* @param sock The pool to use.
* @param thesock The socket to convert to.
* @param cont The socket we are converting to an apr type.
* @remark If it is a true socket, it is best to call apr_os_sock_make()
* and provide APR with more information about the socket.
}
function apr_os_sock_put(sock: PPapr_socket_t; thesock: Papr_socket_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_sock_put' + LibSuff8;
{
* Create a socket from an existing descriptor and local and remote
* socket addresses.
* @param apr_sock The new socket that has been set up
* @param os_sock_info The os representation of the socket handle and
* other characteristics of the socket
* @param cont The pool to use
* @remark If you only know the descriptor/handle or if it isn't really
* a true socket, use apr_os_sock_put() instead.
}
function apr_os_sock_make(apr_sock: PPapr_socket_t;
os_sock_info: Papr_os_sock_info_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_sock_make' + LibSuff12;
{
* Convert the proc mutex from os specific type to apr type
* @param pmutex The apr proc mutex we are converting to.
* @param ospmutex The os specific proc mutex to convert.
* @param cont The pool to use if it is needed.
}
function apr_os_proc_mutex_put(pmutex: PPapr_proc_mutex_t;
ospmutex: Papr_os_proc_mutex_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_proc_mutex_put' + LibSuff12;
{
* Put the imploded time in the APR format.
* @param aprtime the APR time format
* @param ostime the time to convert
* @param cont the pool to use if necessary
}
function apr_os_imp_time_put(aprtime: Papr_time_t;
ostime: PPapr_os_imp_time_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_imp_time_put' + LibSuff12;
{
* Put the exploded time in the APR format.
* @param aprtime the APR time format
* @param ostime the time to convert
* @param cont the pool to use if necessary
}
function apr_os_exp_time_put(aprtime: Papr_time_exp_t;
ostime: PPapr_os_exp_time_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_exp_time_put' + LibSuff12;
{
* convert the shared memory from os specific type to apr type.
* @param shm The apr shm representation of osshm
* @param osshm The os specific shm identity
* @param cont The pool to use if it is needed.
* @remark On fork()ed architectures, this is typically nothing more than
* the memory block mapped. On non-fork architectures, this is typically
* some internal handle to pass the mapping from process to process.
}
function apr_os_shm_put(shm: PPapr_shm_t; osshm: Papr_os_shm_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_shm_put' + LibSuff8;
{$if defined(APR_HAS_DSO) or defined(DOXYGEN)}
{
* @defgroup apr_os_dso DSO (Dynamic Loading) Portabiliity Routines
}
{
* convert the dso handle from os specific to apr
* @param dso The apr handle we are converting to
* @param thedso the os specific handle to convert
* @param pool the pool to use if it is needed
}
function apr_os_dso_handle_put(dso: PPapr_dso_handle_t;
thedso: apr_os_dso_handle_t; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_dso_handle_put' + LibSuff12;
{
* convert the apr dso handle into an os specific one
* @param aprdso The apr dso handle to convert
* @param dso The os specific dso to return
}
function apr_os_dso_handle_get(dso: Papr_os_dso_handle_t;
aprdso: Papr_dso_handle_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_dso_handle_get' + LibSuff8;
{$ifdef APR_HAS_OS_UUID}
{
* Private: apr-util's apr_uuid module when supported by the platform
}
function apr_os_uuid_get(uuid_data: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_uuid_get' + LibSuff8;
{$endif}
{$endif} { APR_HAS_DSO }
{
* Get the name of the system default characer set.
* @param pool the pool to allocate the name from, if needed
}
function apr_os_default_encoding(pool: Papr_pool_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_default_encoding' + LibSuff4;
{
* Get the name of the current locale character set.
* @param pool the pool to allocate the name from, if needed
* @remark Defers to apr_os_default_encoding if the current locale's
* data can't be retreved on this system.
}
function apr_os_locale_encoding(pool: Papr_pool_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_locale_encoding' + LibSuff4;

View File

@ -1,90 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_signal.h
* @brief APR Signal Handling
}
{#include "apr.h"
#include "apr_pools.h"
#if APR_HAVE_SIGNAL_H
#include <signal.h>
#endif}
{
* @defgroup apr_signal Handling
* @ingroup APR
}
{$if defined(APR_HAVE_SIGACTION) or defined(DOXYGEN)}
{$ifdef DARWIN}
{ work around Darwin header file bugs
* http://www.opensource.apple.com/bugs/X/BSD%20Kernel/2657228.html
}
#undef SIG_DFL
#undef SIG_IGN
#undef SIG_ERR
#define SIG_DFL (void ( *)(int))0
#define SIG_IGN (void ( *)(int))1
#define SIG_ERR (void ( *)(int))-1
{$endif}
{ Function prototype for signal handlers }
type apr_sigfunc_t = procedure(para: cint);
{
* Set the signal handler function for a given signal
* @param signo The signal (eg... SIGWINCH)
* @param func the function to get called
}
function apr_signal(signo: Integer; func: apr_sigfunc_t): Papr_sigfunc_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_signal' + LibSuff8;
{if defined(SIG_IGN) && !defined(SIG_ERR)
#define SIG_ERR ((apr_sigfunc_t *) -1)
#endif
#else} { !APR_HAVE_SIGACTION }
{#define apr_signal(a, b) signal(a, b)
#endif}
{
* Get the description for a specific signal number
* @param signum The signal number
* @return The description of the signal
}
function apr_signal_description_get(signo: Integer): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_signal_description_get' + LibSuff4;
{ @deprecated @see apr_signal_description_get }
function apr_signal_get_description(signo: Integer): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_signal_get_description' + LibSuff4;
{
* APR-private function for initializing the signal package
* @internal
* @param pglobal The internal, global pool
}
//void apr_signal_init(apr_pool_t *pglobal);
{$endif}

View File

@ -1,358 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{ Portions of this file are covered by }
{ -*- mode: c; c-file-style: "k&r" -*-
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
}
{
* @file apr_strings.h
* @brief APR Strings library
}
{#include "apr.h"
#include "apr_errno.h"
#include "apr_pools.h"
#define APR_WANT_IOVEC
#include "apr_want.h"
#if APR_HAVE_STDARG_H
#include <stdarg.h>
#endif}
{
* @defgroup apr_strings String routines
* @ingroup APR
}
{
* Do a natural order comparison of two strings.
* @param a The first string to compare
* @param b The second string to compare
* @return Either <0, 0, or >0. If the first string is less than the second
* this returns <0, if they are equivalent it returns 0, and if the
* first string is greater than second string it retuns >0.
}
function apr_strnatcmp(a, b: PChar): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_strnatcmp' + LibSuff8;
{
* Do a natural order comparison of two strings ignoring the case of the
* strings.
* @param a The first string to compare
* @param b The second string to compare
* @return Either <0, 0, or >0. If the first string is less than the second
* this returns <0, if they are equivalent it returns 0, and if the
* first string is greater than second string it retuns >0.
}
function apr_strnatcasecmp(a, b: PChar): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_strnatcasecmp' + LibSuff8;
{
* duplicate a string into memory allocated out of a pool
* @param p The pool to allocate out of
* @param s The string to duplicate
* @return The new string
}
function apr_pstrdup(p: Papr_pool_t; s: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pstrdup' + LibSuff8;
{
* Create a null-terminated string by making a copy of a sequence
* of characters and appending a null byte
* @param p The pool to allocate out of
* @param s The block of characters to duplicate
* @param n The number of characters to duplicate
* @return The new string
* @remark This is a faster alternative to apr_pstrndup, for use
* when you know that the string being duplicated really
* has 'n' or more characters. If the string might contain
* fewer characters, use apr_pstrndup.
}
function apr_pstrmemdup(p: Papr_pool_t; s: PChar; n: apr_size_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pstrmemdup' + LibSuff12;
{
* duplicate the first n characters of a string into memory allocated
* out of a pool; the new string will be null-terminated
* @param p The pool to allocate out of
* @param s The string to duplicate
* @param n The number of characters to duplicate
* @return The new string
}
function apr_pstrndup(p: Papr_pool_t; s: PChar; n: apr_size_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pstrndup' + LibSuff12;
{
* Duplicate a block of memory.
*
* @param p The pool to allocate from
* @param m The memory to duplicate
* @param n The number of bytes to duplicate
* @return The new block of memory
}
function apr_pmemdup(p: Papr_pool_t; m: Pointer; n: apr_size_t): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pmemdup' + LibSuff12;
{
* Concatenate multiple strings, allocating memory out a pool
* @param p The pool to allocate out of
* @param ... The strings to concatenate. The final string must be NULL
* @return The new string
}
function apr_pstrcat(p: Papr_pool_t; others: array of const): PChar;
cdecl; external LibAPR name 'apr_pstrcat';
{
* Concatenate multiple strings specified in a writev-style vector
* @param p The pool from which to allocate
* @param vec The strings to concatenate
* @param nvec The number of strings to concatenate
* @param nbytes (output) strlen of new string (pass in NULL to omit)
* @return The new string
}
function apr_pstrcatv(p: Papr_pool_t; const vec: Piovec;
nvec: apr_size_t; nbytes: Papr_size_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pstrcatv' + LibSuff16;
{
* printf-style style printing routine. The data is output to a string
* allocated from a pool
* @param p The pool to allocate out of
* @param fmt The format of the string
* @param ap The arguments to use while printing the data
* @return The new string
}
function apr_pvsprintf(p: Papr_pool_t; const fmt: PChar; ap: va_list): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pvsprintf' + LibSuff12;
{
* printf-style style printing routine. The data is output to a string
* allocated from a pool
* @param p The pool to allocate out of
* @param fmt The format of the string
* @param ... The arguments to use while printing the data
* @return The new string
}
function apr_psprintf(p: Papr_pool_t; const fmt: PChar; others: array of const): PChar;
cdecl; external LibAPR name 'apr_psprintf';
{
* copy n characters from src to dst
* @param dst The destination string
* @param src The source string
* @param dst_size The space available in dst; dst always receives
* null-termination, so if src is longer than
* dst_size, the actual number of characters copied is
* dst_size - 1.
* @remark
* <PRE>
* We re-implement this function to implement these specific changes:
* 1) strncpy() doesn't always null terminate and we want it to.
* 2) strncpy() null fills, which is bogus, esp. when copy 8byte strings
* into 8k blocks.
* 3) Instead of returning the pointer to the beginning of the
* destination string, we return a pointer to the terminating null
* to allow us to check for truncation.
* </PRE>
}
function apr_cpystrn(dst: PChar; const src: PChar;
dst_size: apr_size_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_cpystrn' + LibSuff12;
{
* Strip spaces from a string
* @param dest The destination string. It is okay to modify the string
* in place. Namely dest == src
* @param src The string to rid the spaces from.
}
function apr_collapse_spaces(dst: PChar; const src: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_collapse_spaces' + LibSuff8;
{
* Convert the arguments to a program from one string to an array of
* strings terminated by a NULL pointer
* @param arg_str The arguments to convert
* @param argv_out Output location. This is a pointer to an array of strings.
* @param token_context Pool to use.
}
function apr_tokenize_to_argv(const arg_str: PChar;
var argv_out: PPChar; token_context: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_tokenize_to_argv' + LibSuff12;
{
* Split a string into separate null-terminated tokens. The tokens are
* delimited in the string by one or more characters from the sep
* argument.
* @param str The string to separate; this should be specified on the
* first call to apr_strtok() for a given string, and NULL
* on subsequent calls.
* @param sep The set of delimiters
* @param last Internal state saved by apr_strtok() between calls.
* @return The next token from the string
}
function apr_strtok(str: PChar;
const sep: PChar; last: PPChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_strtok' + LibSuff12;
{
* @defgroup APR_Strings_Snprintf snprintf implementations
* @warning
* These are snprintf implementations based on apr_vformatter().
*
* Note that various standards and implementations disagree on the return
* value of snprintf, and side-effects due to %n in the formatting string.
* apr_snprintf (and apr_vsnprintf) behaves as follows:
*
* Process the format string until the entire string is exhausted, or
* the buffer fills. If the buffer fills then stop processing immediately
* (so no further %n arguments are processed), and return the buffer
* length. In all cases the buffer is NUL terminated. It will return the
* number of characters inserted into the buffer, not including the
* terminating NUL. As a special case, if len is 0, apr_snprintf will
* return the number of characters that would have been inserted if
* the buffer had been infinite (in this case, *buffer can be NULL)
*
* In no event does apr_snprintf return a negative number.
* @{
}
{
* snprintf routine based on apr_vformatter. This means it understands the
* same extensions.
* @param buf The buffer to write to
* @param len The size of the buffer
* @param format The format string
* @param ... The arguments to use to fill out the format string.
}
function apr_snprintf(buf: PChar; len: apr_size_t;
const format: PChar; others: array of const): PChar;
cdecl; external LibAPR name 'apr_snprintf';
{
* vsnprintf routine based on apr_vformatter. This means it understands the
* same extensions.
* @param buf The buffer to write to
* @param len The size of the buffer
* @param format The format string
* @param ap The arguments to use to fill out the format string.
}
function apr_vsnprintf(buf: PChar; len: apr_size_t;
const format: PChar; ap: va_list): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_vsnprintf' + LibSuff16;
{
* create a string representation of an int, allocated from a pool
* @param p The pool from which to allocate
* @param n The number to format
* @return The string representation of the number
}
function apr_itoa(p: Papr_pool_t; n: Integer): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_itoa' + LibSuff8;
{
* create a string representation of a long, allocated from a pool
* @param p The pool from which to allocate
* @param n The number to format
* @return The string representation of the number
}
function apr_ltoa(p: Papr_pool_t; n: Integer): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_ltoa' + LibSuff8;
{
* create a string representation of an apr_off_t, allocated from a pool
* @param p The pool from which to allocate
* @param n The number to format
* @return The string representation of the number
}
function apr_off_t_toa(p: Papr_pool_t; n: apr_off_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_off_t_toa' + LibSuff12;
{
* parse a numeric string into a 64-bit numeric value
* @param buf The string to parse. It may contain optional whitespace,
* followed by an optional '+' (positive, default) or '-' (negative)
* character, followed by an optional '0x' prefix if base is 0 or 16,
* followed by numeric digits appropriate for base.
* @param end A pointer to the end of the valid character in buf. If
* not nil, it is set to the first invalid character in buf.
* @param base A numeric base in the range between 2 and 36 inclusive,
* or 0. If base is zero, buf will be treated as base ten unless its
* digits are prefixed with '0x', in which case it will be treated as
* base 16.
* @return The numeric value of the string.
}
function apr_strtoi64(const buf: PChar; end_: PPChar; base: Integer): apr_int64_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_strtoi64' + LibSuff12;
{
* parse a base-10 numeric string into a 64-bit numeric value.
* Equivalent to apr_strtoi64(buf, (char**)NULL, 10).
* @param buf The string to parse
* @return The numeric value of the string
}
function apr_atoi64(const buf: PChar): apr_int64_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_atoi64' + LibSuff4;
{
* Format a binary size (magnitiudes are 2^10 rather than 10^3) from an apr_off_t,
* as bytes, K, M, T, etc, to a four character compacted human readable string.
* @param size The size to format
* @param buf The 5 byte text buffer (counting the trailing null)
* @return The buf passed to apr_strfsize()
* @remark All negative sizes report ' - ', apr_strfsize only formats positive values.
}
function apr_strfsize(size: apr_off_t; buf: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_strfsize' + LibSuff12;

View File

@ -1,447 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_tables.h
* @brief APR Table library
}
{
* @defgroup apr_tables Table and Array Functions
* @ingroup APR
* Tables are used to store entirely opaque structures
* for applications, while Arrays are usually used to
* deal with string lists.
}
{ the table abstract data type }
type
apr_table_t = record end;
Papr_table_t = ^apr_table_t;
{ An opaque array type }
apr_array_header_t = record
{ The pool the array is allocated out of }
pool: Papr_pool_t;
{ The amount of memory allocated for each element of the array }
elt_size: Integer;
{ The number of active elements in the array }
nelts: Integer;
{ The number of elements allocated in the array }
nalloc: Integer;
{ The elements in the array }
elts: PChar;
end;
Papr_array_header_t = ^apr_array_header_t;
PPapr_array_header_t = ^Papr_array_header_t;
{
* The (opaque) structure for string-content tables.
}
{ The type for each entry in a string-content table }
apr_table_entry_t = record
{ The key for the current table entry }
key: PChar; { maybe NULL in future;
* check when iterating thru table_elts
}
{ The value for the current table entry }
val: PChar;
{ A checksum for the key, for use by the apr_table internals }
key_checksum: apr_uint32_t;
end;
{
* Get the elements from a table
* @param t The table
* @return An array containing the contents of the table
}
function apr_table_elts(const t: Papr_table_t): Papr_array_header_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_elts' + LibSuff4;
{
* Determine if the table is empty
* @param t The table to check
* @return True if empty, False otherwise
}
function apr_is_empty_table(const t: Papr_table_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_is_empty_table' + LibSuff4;
{
* Determine if the array is empty
* @param a The array to check
* @return True if empty, False otherwise
}
function apr_is_empty_array(const a: Papr_array_header_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_is_empty_array' + LibSuff4;
{
* Create an array
* @param p The pool to allocate the memory out of
* @param nelts the number of elements in the initial array
* @param elt_size The size of each element in the array.
* @return The new array
}
function apr_array_make(p: Papr_pool_t;
nelts, elt_size: Integer): Papr_array_header_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_make' + LibSuff12;
{
* Add a new element to an array
* @param arr The array to add an element to.
* @return Location for the new element in the array.
* @remark If there are no free spots in the array, then this function will
* allocate new space for the new element.
}
function apr_array_push(arr: Papr_array_header_t): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_push' + LibSuff4;
{
* Remove an element from an array
* @param arr The array to remove an element from.
* @return Location of the element in the array.
* @remark If there are no elements in the array, NULL is returned.
}
function apr_array_pop(arr: Papr_array_header_t): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_pop' + LibSuff4;
{
* Concatenate two arrays together
* @param dst The destination array, and the one to go first in the combined
* array
* @param src The source array to add to the destination array
}
procedure apr_array_cat(dst: Papr_array_header_t;
const src: Papr_array_header_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_cat' + LibSuff8;
{
* Copy the entire array
* @param p The pool to allocate the copy of the array out of
* @param arr The array to copy
* @return An exact copy of the array passed in
* @remark The alternate apr_array_copy_hdr copies only the header, and arranges
* for the elements to be copied if (and only if) the code subsequently
* does a push or arraycat.
}
function apr_array_copy(p: Papr_pool_t;
const arr: Papr_array_header_t): Papr_array_header_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_copy' + LibSuff8;
{
* Copy the headers of the array, and arrange for the elements to be copied if
* and only if the code subsequently does a push or arraycat.
* @param p The pool to allocate the copy of the array out of
* @param arr The array to copy
* @return An exact copy of the array passed in
* @remark The alternate apr_array_copy copies the *entire* array.
}
function apr_array_copy_hdr(p: Papr_pool_t;
const arr: Papr_array_header_t): Papr_array_header_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_copy_hdr' + LibSuff8;
{
* Append one array to the end of another, creating a new array in the process.
* @param p The pool to allocate the new array out of
* @param first The array to put first in the new array.
* @param second The array to put second in the new array.
* @return A new array containing the data from the two arrays passed in.
}
function apr_array_append(p: Papr_pool_t;
const first, second: Papr_array_header_t): Papr_array_header_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_append' + LibSuff12;
{
* Generates a new string from the apr_pool_t containing the concatenated
* sequence of substrings referenced as elements within the array. The string
* will be empty if all substrings are empty or null, or if there are no
* elements in the array. If sep is non-NUL, it will be inserted between
* elements as a separator.
* @param p The pool to allocate the string out of
* @param arr The array to generate the string from
* @param sep The separator to use
* @return A string containing all of the data in the array.
}
function apr_array_pstrcat(p: Papr_pool_t;
const arr: Papr_array_header_t; sep: Char): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_pstrcat' + LibSuff12;
{
* Make a new table
* @param p The pool to allocate the pool out of
* @param nelts The number of elements in the initial table.
* @return The new table.
* @warning This table can only store text data
}
function apr_table_make(p: Papr_pool_t; nelts: Integer): Papr_table_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_make' + LibSuff8;
{
* Create a new table and copy another table into it
* @param p The pool to allocate the new table out of
* @param t The table to copy
* @return A copy of the table passed in
}
function apr_table_copy(p: Papr_pool_t; const t: Papr_table_t): Papr_table_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_copy' + LibSuff8;
{
* Delete all of the elements from a table
* @param t The table to clear
}
procedure apr_table_clear(t: Papr_table_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_clear' + LibSuff4;
{
* Get the value associated with a given key from the table. After this call,
* The data is still in the table
* @param t The table to search for the key
* @param key The key to search for
* @return The value associated with the key
}
function apr_table_get(t: Papr_table_t; key: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_get' + LibSuff8;
{
* Add a key/value pair to a table, if another element already exists with the
* same key, this will over-write the old data.
* @param t The table to add the data to.
* @param key The key fo use
* @param val The value to add
* @remark When adding data, this function makes a copy of both the key and the
* value.
}
procedure apr_table_set(t: Papr_table_t; const key, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_set' + LibSuff12;
{
* Add a key/value pair to a table, if another element already exists with the
* same key, this will over-write the old data.
* @param t The table to add the data to.
* @param key The key to use
* @param val The value to add
* @warning When adding data, this function does not make a copy of the key or
* the value, so care should be taken to ensure that the values will
* not change after they have been added..
}
procedure apr_table_setn(t: Papr_table_t; const key, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_setn' + LibSuff12;
{
* Remove data from the table
* @param t The table to remove data from
* @param key The key of the data being removed
}
procedure apr_table_unset(t: Papr_table_t; const key: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_unset' + LibSuff8;
{
* Add data to a table by merging the value with data that has already been
* stored
* @param t The table to search for the data
* @param key The key to merge data for
* @param val The data to add
* @remark If the key is not found, then this function acts like apr_table_add
}
procedure apr_table_merge(t: Papr_table_t; const key, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_merge' + LibSuff12;
{
* Add data to a table by merging the value with data that has already been
* stored
* @param t The table to search for the data
* @param key The key to merge data for
* @param val The data to add
* @remark If the key is not found, then this function acts like apr_table_addn
}
procedure apr_table_mergen(t: Papr_table_t; const key, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_mergen' + LibSuff12;
{
* Add data to a table, regardless of whether there is another element with the
* same key.
* @param t The table to add to
* @param key The key to use
* @param val The value to add.
* @remark When adding data, this function makes a copy of both the key and the
* value.
}
procedure apr_table_add(t: Papr_table_t; const key, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_add' + LibSuff12;
{
* Add data to a table, regardless of whether there is another element with the
* same key.
* @param t The table to add to
* @param key The key to use
* @param val The value to add.
* @remark When adding data, this function does not make a copy of the key or the
* value, so care should be taken to ensure that the values will not
* change after they have been added..
}
procedure apr_table_addn(t: Papr_table_t; const key, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_addn' + LibSuff12;
{
* Merge two tables into one new table
* @param p The pool to use for the new table
* @param overlay The first table to put in the new table
* @param base The table to add at the end of the new table
* @return A new table containing all of the data from the two passed in
}
function apr_table_overlay(t: Papr_table_t;
const overlay, base: Papr_table_t): Papr_table_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_overlay' + LibSuff12;
{
* Declaration prototype for the iterator callback function of apr_table_do()
* and apr_table_vdo().
* @param rec The data passed as the first argument to apr_table_[v]do()
* @param key The key from this iteration of the table
* @param value The value from this iteration of the table
* @remark Iteration continues while this callback function returns non-zero.
* To export the callback function for apr_table_[v]do() it must be declared
* in the _NONSTD convention.
}
type
apr_table_do_callback_fn_t = function (rec: Pointer;
const key, value: PChar): Integer;
Papr_table_do_callback_fn_t = ^apr_table_do_callback_fn_t;
{
* Iterate over a table running the provided function once for every
* element in the table. If there is data passed in as a vararg, then the
* function is only run on those elements whose key matches something in
* the vararg. If the vararg is NULL, then every element is run through the
* function. Iteration continues while the function returns non-zero.
* @param comp The function to run
* @param rec The data to pass as the first argument to the function
* @param t The table to iterate over
* @param ... The vararg. If this is NULL, then all elements in the table are
* run through the function, otherwise only those whose key matches
* are run.
* @return FALSE if one of the comp() iterations returned zero; TRUE if all
* iterations returned non-zero
* @see apr_table_do_callback_fn_t
}
{APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp,
void *rec, const apr_table_t *t, ...);
}
{
* Iterate over a table running the provided function once for every
* element in the table. If there is data passed in as a vararg, then the
* function is only run on those element's whose key matches something in
* the vararg. If the vararg is NULL, then every element is run through the
* function. Iteration continues while the function returns non-zero.
* @param comp The function to run
* @param rec The data to pass as the first argument to the function
* @param t The table to iterate over
* @param vp The vararg table. If this is NULL, then all elements in the
* table are run through the function, otherwise only those
* whose key matches are run.
* @return FALSE if one of the comp() iterations returned zero; TRUE if all
* iterations returned non-zero
* @see apr_table_do_callback_fn_t
}
function apr_table_vdo(comp: Papr_table_do_callback_fn_t;
rec: Pointer; const t: Papr_table_t; vp: va_list): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_vdo' + LibSuff16;
const
{ flag for overlap to use apr_table_setn }
APR_OVERLAP_TABLES_SET = 0;
{ flag for overlap to use apr_table_mergen }
APR_OVERLAP_TABLES_MERGE = 1;
{
* For each element in table b, either use setn or mergen to add the data
* to table a. Which method is used is determined by the flags passed in.
* @param a The table to add the data to.
* @param b The table to iterate over, adding its data to table a
* @param flags How to add the table to table a. One of:
* APR_OVERLAP_TABLES_SET Use apr_table_setn
* APR_OVERLAP_TABLES_MERGE Use apr_table_mergen
* @remark This function is highly optimized, and uses less memory and CPU cycles
* than a function that just loops through table b calling other functions.
}
{
*<PRE>
* Conceptually, apr_table_overlap does this:
*
* apr_array_header_t *barr = apr_table_elts(b);
* apr_table_entry_t *belt = (apr_table_entry_t *)barr->elts;
* int i;
*
* for (i = 0; i < barr->nelts; ++i) (
* if (flags & APR_OVERLAP_TABLES_MERGE) (
* apr_table_mergen(a, belt[i].key, belt[i].val);
* )
* else (
* apr_table_setn(a, belt[i].key, belt[i].val);
* )
* )
*
* Except that it is more efficient (less space and cpu-time) especially
* when b has many elements.
*
* Notice the assumptions on the keys and values in b -- they must be
* in an ancestor of a's pool. In practice b and a are usually from
* the same pool.
* </PRE>
}
procedure apr_table_overlap(a: Papr_table_t;
const b: Papr_table_t; flags: cuint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_overlap' + LibSuff12;
{
* Eliminate redunandant entries in a table by either overwriting
* or merging duplicates
*
* @param t Table.
* @param flags APR_OVERLAP_TABLES_MERGE to merge, or
* APR_OVERLAP_TABLES_SET to overwrite
}
procedure apr_table_compress(t: Papr_table_t; flags: cuint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_compress' + LibSuff8;

View File

@ -1,845 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_thread_proc.h
* @brief APR Thread and Process Library
}
{#include "apr.h"
#include "apr_file_io.h"
#include "apr_pools.h"
#include "apr_errno.h"
#if APR_HAVE_STRUCT_RLIMIT
#include <sys/time.h>
#include <sys/resource.h>
#endif}
{
* @defgroup apr_thread_proc Threads and Process Functions
* @ingroup APR
}
type
apr_cmdtype_e = (
APR_SHELLCMD, {< use the shell to invoke the program }
APR_PROGRAM, {< invoke the program directly, no copied env }
APR_PROGRAM_ENV, {< invoke the program, replicating our environment }
APR_PROGRAM_PATH, {< find program on PATH, use our environment }
APR_SHELLCMD_ENV {< use the shell to invoke the program,
* replicating our environment }
);
apr_wait_how_e = (
APR_WAIT, {< wait for the specified process to finish }
APR_NOWAIT {< do not wait -- just see if it has finished }
);
{ I am specifically calling out the values so that the macros below make
* more sense. Yes, I know I don't need to, but I am hoping this makes what
* I am doing more clear. If you want to add more reasons to exit, continue
* to use bitmasks.
}
apr_exit_why_e = (
APR_PROC_EXIT = 1, {< process exited normally }
APR_PROC_SIGNAL = 2, {< process exited due to a signal }
APR_PROC_SIGNAL_CORE = 4 {< process exited and dumped a core file }
);
Papr_exit_why_e = ^apr_exit_why_e;
{ did we exit the process }
//#define APR_PROC_CHECK_EXIT(x) (x & APR_PROC_EXIT)
{ did we get a signal }
//#define APR_PROC_CHECK_SIGNALED(x) (x & APR_PROC_SIGNAL)
{ did we get core }
//#define APR_PROC_CHECK_CORE_DUMP(x) (x & APR_PROC_SIGNAL_CORE)
const
{ @see apr_procattr_io_set }
APR_NO_PIPE = 0;
{ @see apr_procattr_io_set }
APR_FULL_BLOCK = 1;
{ @see apr_procattr_io_set }
APR_FULL_NONBLOCK = 2;
{ @see apr_procattr_io_set }
APR_PARENT_BLOCK = 3;
{ @see apr_procattr_io_set }
APR_CHILD_BLOCK = 4;
{ @see apr_procattr_limit_set }
APR_LIMIT_CPU = 0;
{ @see apr_procattr_limit_set }
APR_LIMIT_MEM = 1;
{ @see apr_procattr_limit_set }
APR_LIMIT_NPROC = 2;
{ @see apr_procattr_limit_set }
APR_LIMIT_NOFILE = 3;
{
* @defgroup APR_OC Other Child Flags
}
APR_OC_REASON_DEATH = 0; {< child has died, caller must call
* unregister still }
APR_OC_REASON_UNWRITABLE = 1; {< write_fd is unwritable }
APR_OC_REASON_RESTART = 2; {< a restart is occuring, perform
* any necessary cleanup (including
* sending a special signal to child)
}
APR_OC_REASON_UNREGISTER = 3; {< unregister has been called, do
* whatever is necessary (including
* kill the child) }
APR_OC_REASON_LOST = 4; {< somehow the child exited without
* us knowing ... buggy os? }
APR_OC_REASON_RUNNING = 5; {< a health check is occuring,
* for most maintainence functions
* this is a no-op.
}
{ The APR process type }
type
apr_proc_t = record
{ The process ID }
pid: pid_t;
{ Parent's side of pipe to child's stdin }
in_: Papr_file_t;
{ Parent's side of pipe to child's stdout }
out_: Papr_file_t;
{ Parent's side of pipe to child's stdouterr }
err: Papr_file_t;
{$if defined(APR_HAS_PROC_INVOKED) or defined(DOXYGEN)}
{ Diagnositics/debugging string of the command invoked for
* this process [only present if APR_HAS_PROC_INVOKED is true]
* @remark Only enabled on Win32 by default.
* @bug This should either always or never be present in release
* builds - since it breaks binary compatibility. We may enable
* it always in APR 1.0 yet leave it undefined in most cases.
}
invoked: PChar;
{$endif}
{$if defined(WIN32) or defined(DOXYGEN)}
{ (Win32 only) Creator's handle granting access to the process
* @remark This handle is closed and reset to NULL in every case
* corresponding to a waitpid() on Unix which returns the exit status.
* Therefore Win32 correspond's to Unix's zombie reaping characteristics
* and avoids potential handle leaks.
}
hproc: HANDLE;
{$endif}
end;
Papr_proc_t = ^apr_proc_t;
{
* The prototype for APR child errfn functions. (See the description
* of apr_procattr_child_errfn_set() for more information.)
* It is passed the following parameters:
* @param pool Pool associated with the apr_proc_t. If your child
* error function needs user data, associate it with this
* pool.
* @param err APR error code describing the error
* @param description Text description of type of processing which failed
}
apr_child_errfn_t = procedure (proc: Papr_pool_t;
err: apr_status_t; const description: PChar);
{ Opaque Thread structure. }
apr_thread_t = record end;
Papr_thread_t = ^apr_thread_t;
PPapr_thread_t = ^Papr_thread_t;
{ Opaque Thread attributes structure. }
apr_threadattr_t = record end;
Papr_threadattr_t = ^apr_threadattr_t;
PPapr_threadattr_t = ^Papr_threadattr_t;
{ Opaque Process attributes structure. }
apr_procattr_t = record end;
Papr_procattr_t = ^apr_procattr_t;
PPapr_procattr_t = ^Papr_procattr_t;
{ Opaque control variable for one-time atomic variables. }
apr_thread_once_t = record end;
Papr_thread_once_t = ^apr_thread_once_t;
PPapr_thread_once_t = ^Papr_thread_once_t;
{ Opaque thread private address space. }
apr_threadkey_t = record end;
Papr_threadkey_t = ^apr_threadkey_t;
PPapr_threadkey_t = ^Papr_threadkey_t;
{ Opaque record of child process. }
apr_other_child_rec_t = record end;
Papr_other_child_rec_t = ^apr_other_child_rec_t;
PPapr_other_child_rec_t = ^Papr_other_child_rec_t;
{
* The prototype for any APR thread worker functions.
}
apr_thread_start_t = function(param: Papr_thread_t; param2: Pointer): Pointer;
apr_kill_conditions_e = (
APR_KILL_NEVER, {< process is never sent any signals }
APR_KILL_ALWAYS, {< process is sent SIGKILL on apr_pool_t cleanup }
APR_KILL_AFTER_TIMEOUT, {< SIGTERM, wait 3 seconds, SIGKILL }
APR_JUST_WAIT, {< wait forever for the process to complete }
APR_KILL_ONLY_ONCE {< send SIGTERM and then wait }
);
{ Thread Function definitions }
//{$if APR_HAS_THREADS}
{
* Create and initialize a new threadattr variable
* @param new_attr The newly created threadattr.
* @param cont The pool to use
}
function apr_threadattr_create(new_attr: PPapr_threadattr_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadattr_create' + LibSuff8;
{
* Set if newly created threads should be created in detached state.
* @param attr The threadattr to affect
* @param on Thread detach state on or off
}
function apr_threadattr_detach_set(attr: Papr_threadattr_t; on_: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadattr_detach_set' + LibSuff8;
{
* Get the detach state for this threadattr.
* @param attr The threadattr to reference
}
function apr_threadattr_detach_get(attr: PPapr_threadattr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadattr_detach_get' + LibSuff4;
{
* Set the stack size of newly created threads.
* @param attr The threadattr to affect
* @param stacksize The stack size in bytes
}
function apr_threadattr_stacksize_set(new_attr: PPapr_threadattr_t; stacksize: apr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadattr_stacksize_set' + LibSuff8;
{
* Create a new thread of execution
* @param new_thread The newly created thread handle.
* @param attr The threadattr to use to determine how to create the thread
* @param func The function to start the new thread in
* @param data Any data to be passed to the starting function
* @param cont The pool to use
}
function apr_thread_create(new_thread: PPapr_thread_t;
attr: Papr_threadattr_t; func: apr_thread_start_t;
data: Pointer; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_create' + LibSuff20;
{
* stop the current thread
* @param thd The thread to stop
* @param retval The return value to pass back to any thread that cares
}
function apr_thread_exit(thd: Papr_thread_t; retval: apr_status_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_exit' + LibSuff8;
{
* block until the desired thread stops executing.
* @param retval The return value from the dead thread.
* @param thd The thread to join
}
function apr_thread_join(retval: Papr_status_t; thd: Papr_thread_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_join' + LibSuff8;
{
* force the current thread to yield the processor
}
procedure apr_thread_yield;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_yield' + LibSuff0;
{
* Initialize the control variable for apr_thread_once. If this isn't
* called, apr_initialize won't work.
* @param control The control variable to initialize
* @param p The pool to allocate data from.
}
function apr_thread_once_init(control: PPapr_thread_once_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_once_init' + LibSuff8;
{
* Run the specified function one time, regardless of how many threads
* call it.
* @param control The control variable. The same variable should
* be passed in each time the function is tried to be
* called. This is how the underlying functions determine
* if the function has ever been called before.
* @param func The function to call.
}
type
func_t = procedure;
function apr_thread_once(control: Papr_thread_once_t; func: func_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_once' + LibSuff8;
{
* detach a thread
* @param thd The thread to detach
}
function apr_thread_detach(thd: Papr_thread_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_detach' + LibSuff4;
{
* Return the pool associated with the current thread.
* @param data The user data associated with the thread.
* @param key The key to associate with the data
* @param thread The currently open thread.
}
function apr_thread_data_get(data: PPointer; const key: PChar;
thread: Papr_thread_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_data_get' + LibSuff12;
{
* Return the pool associated with the current thread.
* @param data The user data to associate with the thread.
* @param key The key to use for associating the data with the thread
* @param cleanup The cleanup routine to use when the thread is destroyed.
* @param thread The currently open thread.
}
function apr_thread_data_set(data: Pointer; const key: PChar;
cleanup: cleanup_t; thread: Papr_thread_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_data_set' + LibSuff16;
{
* Create and initialize a new thread private address space
* @param key The thread private handle.
* @param dest The destructor to use when freeing the private memory.
* @param cont The pool to use
}
type
dest_t = procedure (param: Pointer);
function apr_threadkey_private_create(key: PPapr_threadkey_t;
dest: dest_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadkey_private_create' + LibSuff12;
{
* Get a pointer to the thread private memory
* @param new_mem The data stored in private memory
* @param key The handle for the desired thread private memory
}
function apr_threadkey_private_get(new_mem: PPointer; key: Papr_threadkey_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadkey_private_get' + LibSuff8;
{
* Set the data to be stored in thread private memory
* @param priv The data to be stored in private memory
* @param key The handle for the desired thread private memory
}
function apr_threadkey_private_set(priv: Pointer; key: Papr_threadkey_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadkey_private_set' + LibSuff8;
{
* Free the thread private memory
* @param key The handle for the desired thread private memory
}
function apr_threadkey_private_delete(key: Papr_threadkey_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadkey_private_delete' + LibSuff4;
{
* Return the pool associated with the current threadkey.
* @param data The user data associated with the threadkey.
* @param key The key associated with the data
* @param threadkey The currently open threadkey.
}
function apr_threadkey_data_get(data: PPointer; const key: PChar;
threadkey: Papr_threadkey_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadkey_data_get' + LibSuff12;
{
* Return the pool associated with the current threadkey.
* @param data The data to set.
* @param key The key to associate with the data.
* @param cleanup The cleanup routine to use when the file is destroyed.
* @param threadkey The currently open threadkey.
}
function apr_threadkey_data_set(data: Pointer; const key: PChar;
cleanup: cleanup_t; threadkey: Papr_threadkey_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadkey_data_set' + LibSuff16;
{.$endif}
{
* Create and initialize a new procattr variable
* @param new_attr The newly created procattr.
* @param cont The pool to use
}
function apr_procattr_create(new_attr: PPapr_procattr_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_create' + LibSuff8;
{
* Determine if any of stdin, stdout, or stderr should be linked to pipes
* when starting a child process.
* @param attr The procattr we care about.
* @param in Should stdin be a pipe back to the parent?
* @param out Should stdout be a pipe back to the parent?
* @param err Should stderr be a pipe back to the parent?
}
function apr_procattr_io_set(attr: Papr_procattr_t;
in_, out_, err: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_io_set' + LibSuff16;
{
* Set the child_in and/or parent_in values to existing apr_file_t values.
* @param attr The procattr we care about.
* @param child_in apr_file_t value to use as child_in. Must be a valid file.
* @param parent_in apr_file_t value to use as parent_in. Must be a valid file.
* @remark This is NOT a required initializer function. This is
* useful if you have already opened a pipe (or multiple files)
* that you wish to use, perhaps persistently across multiple
* process invocations - such as a log file. You can save some
* extra function calls by not creating your own pipe since this
* creates one in the process space for you.
}
function apr_procattr_child_in_set(attr: Papr_procattr_t;
child_in, parent_in: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_child_in_set' + LibSuff12;
{
* Set the child_out and parent_out values to existing apr_file_t values.
* @param attr The procattr we care about.
* @param child_out apr_file_t value to use as child_out. Must be a valid file.
* @param parent_out apr_file_t value to use as parent_out. Must be a valid file.
* @remark This is NOT a required initializer function. This is
* useful if you have already opened a pipe (or multiple files)
* that you wish to use, perhaps persistently across multiple
* process invocations - such as a log file.
}
function apr_procattr_child_out_set(attr: Papr_procattr_t;
child_out, parent_out: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_child_out_set' + LibSuff12;
{
* Set the child_err and parent_err values to existing apr_file_t values.
* @param attr The procattr we care about.
* @param child_err apr_file_t value to use as child_err. Must be a valid file.
* @param parent_err apr_file_t value to use as parent_err. Must be a valid file.
* @remark This is NOT a required initializer function. This is
* useful if you have already opened a pipe (or multiple files)
* that you wish to use, perhaps persistently across multiple
* process invocations - such as a log file.
}
function apr_procattr_child_err_set(attr: Papr_procattr_t;
child_err, parent_err: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_child_err_set' + LibSuff12;
{
* Set which directory the child process should start executing in.
* @param attr The procattr we care about.
* @param dir Which dir to start in. By default, this is the same dir as
* the parent currently resides in, when the createprocess call
* is made.
}
function apr_procattr_dir_set(attr: Papr_procattr_t; const dir: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_dir_set' + LibSuff8;
{
* Set what type of command the child process will call.
* @param attr The procattr we care about.
* @param cmd The type of command. One of:
* <PRE>
* APR_SHELLCMD -- Anything that the shell can handle
* APR_PROGRAM -- Executable program (default)
* APR_PROGRAM_ENV -- Executable program, copy environment
* APR_PROGRAM_PATH -- Executable program on PATH, copy env
* </PRE>
}
function apr_procattr_cmdtype_set(attr: Papr_procattr_t; cmd: apr_cmdtype_e): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_cmdtype_set' + LibSuff8;
{
* Determine if the child should start in detached state.
* @param attr The procattr we care about.
* @param detach Should the child start in detached state? Default is no.
}
function apr_procattr_detach_set(attr: Papr_procattr_t; detach: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_detach_set' + LibSuff8;
{$ifdef APR_HAVE_STRUCT_RLIMIT}
{
* Set the Resource Utilization limits when starting a new process.
* @param attr The procattr we care about.
* @param what Which limit to set, one of:
* <PRE>
* APR_LIMIT_CPU
* APR_LIMIT_MEM
* APR_LIMIT_NPROC
* APR_LIMIT_NOFILE
* </PRE>
* @param limit Value to set the limit to.
}
function apr_procattr_limit_set(attr: Papr_procattr_t; what: apr_int32_t;
limit: Pointer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_limit_set' + LibSuff12;
{$endif}
{
* Specify an error function to be called in the child process if APR
* encounters an error in the child prior to running the specified program.
* @param attr The procattr describing the child process to be created.
* @param errfn The function to call in the child process.
* @remark At the present time, it will only be called from apr_proc_create()
* on platforms where fork() is used. It will never be called on other
* platforms, on those platforms apr_proc_create() will return the error
* in the parent process rather than invoke the callback in the now-forked
* child process.
}
function apr_procattr_child_errfn_set(attr: Papr_procattr_t; errfn: apr_child_errfn_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_child_errfn_set' + LibSuff8;
{
* Specify that apr_proc_create() should do whatever it can to report
* failures to the caller of apr_proc_create(), rather than find out in
* the child.
* @param attr The procattr describing the child process to be created.
* @param chk Flag to indicate whether or not extra work should be done
* to try to report failures to the caller.
* @remark This flag only affects apr_proc_create() on platforms where
* fork() is used. This leads to extra overhead in the calling
* process, but that may help the application handle such
* errors more gracefully.
}
function apr_procattr_error_check_set(attr: Papr_procattr_t; chk: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_error_check_set' + LibSuff8;
{
* Determine if the child should start in its own address space or using the
* current one from its parent
* @param attr The procattr we care about.
* @param addrspace Should the child start in its own address space? Default
* is no on NetWare and yes on other platforms.
}
function apr_procattr_addrspace_set(attr: Papr_procattr_t; addrspace: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_addrspace_set' + LibSuff8;
{$ifdef APR_HAS_FORK}
{
* This is currently the only non-portable call in APR. This executes
* a standard unix fork.
* @param proc The resulting process handle.
* @param cont The pool to use.
}
function apr_proc_fork(proc: Papr_proc_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_fork' + LibSuff8;
{$endif}
{
* Create a new process and execute a new program within that process.
* @param new_proc The resulting process handle.
* @param progname The program to run
* @param args the arguments to pass to the new program. The first
* one should be the program name.
* @param env The new environment table for the new process. This
* should be a list of NULL-terminated strings. This argument
* is ignored for APR_PROGRAM_ENV, APR_PROGRAM_PATH, and
* APR_SHELLCMD_ENV types of commands.
* @param attr the procattr we should use to determine how to create the new
* process
* @param cont The pool to use.
}
function apr_proc_create(new_proc: Papr_proc_t;
const progname: PChar; args, arnv: PPChar;
attr: Papr_procattr_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_create' + LibSuff24;
{
* Wait for a child process to die
* @param proc The process handle that corresponds to the desired child process
* @param exitcode The returned exit status of the child, if a child process
* dies, or the signal that caused the child to die.
* On platforms that don't support obtaining this information,
* the status parameter will be returned as APR_ENOTIMPL.
* @param exitwhy Why the child died, the bitwise or of:
* <PRE>
* APR_PROC_EXIT -- process terminated normally
* APR_PROC_SIGNAL -- process was killed by a signal
* APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
* generated a core dump.
* </PRE>
* @param waithow How should we wait. One of:
* <PRE>
* APR_WAIT -- block until the child process dies.
* APR_NOWAIT -- return immediately regardless of if the
* child is dead or not.
* </PRE>
* @remark The childs status is in the return code to this process. It is one of:
* <PRE>
* APR_CHILD_DONE -- child is no longer running.
* APR_CHILD_NOTDONE -- child is still running.
* </PRE>
}
function apr_proc_wait(proc: Papr_proc_t; exitcode: PInteger;
exitwhy: Papr_exit_why_e; waithow: apr_wait_how_e): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_wait' + LibSuff16;
{
* Wait for any current child process to die and return information
* about that child.
* @param proc Pointer to NULL on entry, will be filled out with child's
* information
* @param exitcode The returned exit status of the child, if a child process
* dies, or the signal that caused the child to die.
* On platforms that don't support obtaining this information,
* the status parameter will be returned as APR_ENOTIMPL.
* @param exitwhy Why the child died, the bitwise or of:
* <PRE>
* APR_PROC_EXIT -- process terminated normally
* APR_PROC_SIGNAL -- process was killed by a signal
* APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
* generated a core dump.
* </PRE>
* @param waithow How should we wait. One of:
* <PRE>
* APR_WAIT -- block until the child process dies.
* APR_NOWAIT -- return immediately regardless of if the
* child is dead or not.
* </PRE>
* @param p Pool to allocate child information out of.
* @bug Passing proc as a *proc rather than **proc was an odd choice
* for some platforms... this should be revisited in 1.0
}
function apr_proc_wait_all_procs(proc: Papr_proc_t; exitcode: PInteger;
exitwhy: Papr_exit_why_e; waithow: apr_wait_how_e;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_wait_all_procs' + LibSuff20;
const
APR_PROC_DETACH_FOREGROUND = 0; {< Do not detach }
APR_PROC_DETACH_DAEMONIZE = 1; {< Detach }
{
* Detach the process from the controlling terminal.
* @param daemonize set to non-zero if the process should daemonize
* and become a background process, else it will
* stay in the foreground.
}
{ Not present on the dll }
//function apr_proc_detach(daemonize: Integer): apr_status_t;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_proc_detach' + LibSuff4;
{
* Register an other_child -- a child associated to its registered
* maintence callback. This callback is invoked when the process
* dies, is disconnected or disappears.
* @param proc The child process to register.
* @param maintenance maintenance is a function that is invoked with a
* reason and the data pointer passed here.
* @param data Opaque context data passed to the maintenance function.
* @param write_fd An fd that is probed for writing. If it is ever unwritable
* then the maintenance is invoked with reason
* OC_REASON_UNWRITABLE.
* @param p The pool to use for allocating memory.
* @bug write_fd duplicates the proc->out stream, it's really redundant
* and should be replaced in the APR 1.0 API with a bitflag of which
* proc->in/out/err handles should be health checked.
* @bug no platform currently tests the pipes health.
}
type
maintenance_t = procedure (reason: Integer; param: Pointer; status: Integer);
procedure apr_proc_other_child_register(proc: Papr_proc_t;
maintenance: maintenance_t; data: Pointer; write_fd: Papr_file_t;
p: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_other_child_register' + LibSuff20;
{
* Stop watching the specified other child.
* @param data The data to pass to the maintenance function. This is
* used to find the process to unregister.
* @warning Since this can be called by a maintenance function while we're
* scanning the other_children list, all scanners should protect
* themself by loading ocr->next before calling any maintenance
* function.
}
procedure apr_proc_other_child_unregister(data: Pointer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_other_child_unregister' + LibSuff4;
{
* Notify the maintenance callback of a registered other child process
* that application has detected an event, such as death.
* @param proc The process to check
* @param reason The reason code to pass to the maintenance function
* @param status The status to pass to the maintenance function
* @remark An example of code using this behavior;
* <pre>
* rv = apr_proc_wait_all_procs(&proc, &exitcode, &status, APR_WAIT, p);
* if (APR_STATUS_IS_CHILD_DONE(rv)) (
* #if APR_HAS_OTHER_CHILD
* if (apr_proc_other_child_alert(&proc, APR_OC_REASON_DEATH, status)
* == APR_SUCCESS) (
* ; (already handled)
* )
* else
* #endif
* [... handling non-otherchild processes death ...]
* </pre>
}
function apr_proc_other_child_alert(proc: Papr_proc_t;
reason, status: Integer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_other_child_alert' + LibSuff12;
{
* Test one specific other child processes and invoke the maintenance callback
* with the appropriate reason code, if still running, or the appropriate reason
* code if the process is no longer healthy.
* @param ocr The registered other child
* @param reason The reason code (e.g. APR_OC_REASON_RESTART) if still running
}
procedure apr_proc_other_child_refresh(ocr: Papr_other_child_rec_t; reason: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_other_child_refresh' + LibSuff8;
{
* Test all registered other child processes and invoke the maintenance callback
* with the appropriate reason code, if still running, or the appropriate reason
* code if the process is no longer healthy.
* @param reason The reason code (e.g. APR_OC_REASON_RESTART) to running processes
}
procedure apr_proc_other_child_refresh_all(reason: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_other_child_refresh_all' + LibSuff4;
{ @deprecated @see apr_proc_other_child_refresh_all
* @remark Call apr_proc_other_child_refresh_all(APR_OC_REASON_RESTART)
* or apr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING) instead.
* @bug The differing implementations of this function on Win32 (_RUNNING checks)
* and Unix (used only for _RESTART) are the reason it will be dropped with APR 1.0.
}
procedure apr_proc_other_child_check;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_other_child_check' + LibSuff0;
{ @deprecated @see apr_proc_other_child_alert
* @bug This function's name had nothing to do with it's purpose
}
function apr_proc_other_child_read(proc: Papr_proc_t; status: Integer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_other_child_read' + LibSuff8;
{
* Terminate a process.
* @param proc The process to terminate.
* @param sig How to kill the process.
}
function apr_proc_kill(proc: Papr_proc_t; sig: Integer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_kill' + LibSuff8;
{
* Register a process to be killed when a pool dies.
* @param a The pool to use to define the processes lifetime
* @param proc The process to register
* @param how How to kill the process, one of:
* <PRE>
* APR_KILL_NEVER -- process is never sent any signals
* APR_KILL_ALWAYS -- process is sent SIGKILL on apr_pool_t cleanup
* APR_KILL_AFTER_TIMEOUT -- SIGTERM, wait 3 seconds, SIGKILL
* APR_JUST_WAIT -- wait forever for the process to complete
* APR_KILL_ONLY_ONCE -- send SIGTERM and then wait
* </PRE>
}
procedure apr_pool_note_subprocess(a: Papr_pool_t;
proc: Papr_proc_t; how: apr_kill_conditions_e);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_note_subprocess' + LibSuff12;
{.$ifdef APR_HAS_THREADS}
{$if (defined(APR_HAVE_SIGWAIT) or defined(APR_HAVE_SIGSUSPEND)) and not defined(OS2)}
{
* Setup the process for a single thread to be used for all signal handling.
* @warning This must be called before any threads are created
}
function apr_setup_signal_thread: apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_setup_signal_thread' + LibSuff0;
{
* Make the current thread listen for signals. This thread will loop
* forever, calling a provided function whenever it receives a signal. That
* functions should return 1 if the signal has been handled, 0 otherwise.
* @param signal_handler The function to call when a signal is received
* apr_status_t apr_signal_thread((int)( *signal_handler)(int signum))
}
type
signal_handler_t = function (signum: Integer): Integer;
function apr_signal_thread(signal_handler: signal_handler_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_signal_thread' + LibSuff8;
{$endif} { (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2) }
{
* Get the child-pool used by the thread from the thread info.
* @return apr_pool_t the pool
}
//APR_POOL_DECLARE_ACCESSOR(thread);
//#endif { APR_HAS_THREADS }

View File

@ -1,262 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_time.h
* @brief APR Time Library
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_errno.h"}
{
* @defgroup apr_time Time Routines
* @ingroup APR
}
{ month names }
//APR_DECLARE_DATA extern const char apr_month_snames[12][4];
{ day names }
//APR_DECLARE_DATA extern const char apr_day_snames[7][4];
{ number of microseconds since 00:00:00 january 1, 1970 UTC }
type
apr_time_t = apr_int64_t;
Papr_time_t = ^apr_time_t;
{ mechanism to properly type apr_time_t literals }
//#define APR_TIME_C(val) APR_INT64_C(val)
{ mechanism to properly print apr_time_t values }
// APR_TIME_T_FMT = APR_INT64_T_FMT;
{ intervals for I/O timeouts, in microseconds }
apr_interval_time_t = apr_int64_t;
Papr_interval_time_t = ^apr_interval_time_t;
{ short interval for I/O timeouts, in microseconds }
apr_short_interval_time_t = apr_int32_t;
{ number of microseconds per second }
// APR_USEC_PER_SEC APR_TIME_C(1000000)
{ @return apr_time_t as a second }
//#define apr_time_sec(time) ((time) / APR_USEC_PER_SEC)
{ @return apr_time_t as a usec }
//#define apr_time_usec(time) ((time) % APR_USEC_PER_SEC)
{ @return apr_time_t as a msec }
//#define apr_time_msec(time) (((time) / 1000) % 1000)
{ @return apr_time_t as a msec }
//#define apr_time_as_msec(time) ((time) / 1000)
{ @return a second as an apr_time_t }
//#define apr_time_from_sec(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC)
{ @return a second and usec combination as an apr_time_t }
//#define apr_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \
// + (apr_time_t)(usec))
{
* @return the current time
}
function apr_time_now: apr_time_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_now' + LibSuff0;
{ @see apr_time_exp_t }
type
Papr_time_exp_t = ^apr_time_exp_t;
{
* a structure similar to ANSI struct tm with the following differences:
* - tm_usec isn't an ANSI field
* - tm_gmtoff isn't an ANSI field (it's a bsdism)
}
apr_time_exp_t = record
{ microseconds past tm_sec }
tm_usec: apr_int32_t;
{ (0-61) seconds past tm_min }
tm_sec: apr_int32_t;
{ (0-59) minutes past tm_hour }
tm_min: apr_int32_t;
{ (0-23) hours past midnight }
tm_hour: apr_int32_t;
{ (1-31) day of the month }
tm_mday: apr_int32_t;
{ (0-11) month of the year }
tm_mon: apr_int32_t;
{ year since 1900 }
tm_year: apr_int32_t;
{ (0-6) days since sunday }
tm_wday: apr_int32_t;
{ (0-365) days since jan 1 }
tm_yday: apr_int32_t;
{ daylight saving time }
tm_isdst: apr_int32_t;
{ seconds east of UTC }
tm_gmtoff: apr_int32_t;
end;
{
* convert an ansi time_t to an apr_time_t
* @param result the resulting apr_time_t
* @param input the time_t to convert
}
function apr_time_ansi_put(result: Papr_time_t;
input: time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_ansi_put' + LibSuff8;
{
* convert a time to its human readable components using an offset
* from GMT
* @param result the exploded time
* @param input the time to explode
* @param offs the number of seconds offset to apply
}
function apr_time_exp_tz(result: Papr_time_exp_t;
input: apr_time_t; offs: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_exp_tz' + LibSuff16;
{ @deprecated @see apr_time_exp_tz }
function apr_explode_time(result: Papr_time_exp_t;
input: apr_time_t; offs: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_explode_time' + LibSuff16;
{
* convert a time to its human readable components in GMT timezone
* @param result the exploded time
* @param input the time to explode
}
function apr_time_exp_gmt(result: Papr_time_exp_t;
input: apr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_exp_gmt' + LibSuff12;
{
* convert a time to its human readable components in local timezone
* @param result the exploded time
* @param input the time to explode
}
function apr_time_exp_lt(result: Papr_time_exp_t;
input: apr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_exp_lt' + LibSuff12;
{ @deprecated @see apr_time_exp_lt }
function apr_explode_localtime(result: Papr_time_exp_t;
input: apr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_explode_localtime' + LibSuff12;
{
* Convert time value from human readable format to a numeric apr_time_t
* e.g. elapsed usec since epoch
* @param result the resulting imploded time
* @param input the input exploded time
}
function apr_time_exp_get(result: Papr_time_t;
input: Papr_time_exp_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_exp_get' + LibSuff8;
{
* Convert time value from human readable format to a numeric apr_time_t that
* always represents GMT
* @param result the resulting imploded time
* @param input the input exploded time
}
function apr_time_exp_gmt_get(result: Papr_time_t;
input: Papr_time_exp_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_exp_gmt_get' + LibSuff8;
{ @deprecated @see apr_time_exp_gmt_get }
function apr_implode_gmt(result: Papr_time_t;
input: Papr_time_exp_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_implode_gmt' + LibSuff8;
{
* Sleep for the specified number of micro-seconds.
* @param t desired amount of time to sleep.
* @warning May sleep for longer than the specified time.
}
procedure apr_sleep(t: apr_interval_time_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_sleep' + LibSuff8;
{ length of a RFC822 Date }
const APR_RFC822_DATE_LEN = (30);
{
* apr_rfc822_date formats dates in the RFC822
* format in an efficient manner. It is a fixed length
* format which requires the indicated amount of storage,
* including the trailing null byte.
* @param date_str String to write to.
* @param t the time to convert
}
function apr_rfc822_date(date_str: PChar; t: apr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_rfc822_date' + LibSuff12;
{ length of a CTIME date }
const APR_CTIME_LEN = (25);
{
* apr_ctime formats dates in the ctime() format
* in an efficient manner. it is a fixed length format
* and requires the indicated amount of storage including
* the trailing null byte.
* Unlike ANSI/ISO C ctime(), apr_ctime() does not include
* a \n at the end of the string.
* @param date_str String to write to.
* @param t the time to convert
}
function apr_ctime(date_str: PChar; t: apr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_ctime' + LibSuff12;
{
* formats the exploded time according to the format specified
* @param s string to write to
* @param retsize The length of the returned string
* @param max The maximum length of the string
* @param format The format for the time string
* @param tm The time to convert
}
function apr_strftime(s: PChar; retsize: apr_size_t;
max: apr_size_t; const format: PChar;
tm: Papr_time_exp_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_strftime' + LibSuff20;
{
* Improve the clock resolution for the lifetime of the given pool.
* Generally this is only desireable on benchmarking and other very
* time-sensitive applications, and has no impact on most platforms.
* @param p The pool to associate the finer clock resolution
}
procedure apr_time_clock_hires(p: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_clock_hires' + LibSuff4;

View File

@ -1,197 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_user.h
* @brief APR User ID Services
}
{#include "apr.h"
#include "apr_errno.h"
#include "apr_pools.h"}
{
* @defgroup apr_user User and Group ID Services
* @ingroup APR
}
{
* Structure for determining user ownership.
}
type
{$ifdef WIN32}
apr_uid_t = PSID;
{$else}
apr_uid_t = uid_t;
{$endif}
Papr_uid_t = ^apr_uid_t;
{
* Structure for determining group ownership.
}
{$ifdef WIN32}
apr_gid_t = PSID;
{$else}
apr_gid_t = gid_t;
{$endif}
Papr_gid_t = ^apr_gid_t;
{$define APR_HAS_USER}
{$ifdef APR_HAS_USER}
{
* Get the userid (and groupid) of the calling process
* @param userid Returns the user id
* @param groupid Returns the user's group id
* @param p The pool from which to allocate working space
* @remark This function is available only if APR_HAS_USER is defined.
}
function apr_uid_current(userid: Papr_uid_t; groupid: Papr_gid_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_uid_current' + LibSuff12;
{ @deprecated @see apr_uid_current }
{APR_DECLARE(apr_status_t) apr_current_userid(apr_uid_t *userid,
apr_gid_t *groupid,
apr_pool_t *p);}
{
* Get the user name for a specified userid
* @param username Pointer to new string containing user name (on output)
* @param userid The userid
* @param p The pool from which to allocate the string
* @remark This function is available only if APR_HAS_USER is defined.
}
function apr_uid_name_get(username: PPChar; userid: apr_uid_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_uid_name_get' + LibSuff12;
{ @deprecated @see apr_uid_name_get }
{APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid,
apr_pool_t *p);}
{
* Get the userid (and groupid) for the specified username
* @param userid Returns the user id
* @param groupid Returns the user's group id
* @param username The username to lookup
* @param p The pool from which to allocate working space
* @remark This function is available only if APR_HAS_USER is defined.
}
function apr_uid_get(userid: Papr_uid_t; groupid: Papr_gid_t;
const username: PChar; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_uid_get' + LibSuff16;
{ @deprecated @see apr_uid_get }
{APR_DECLARE(apr_status_t) apr_get_userid(apr_uid_t *userid, apr_gid_t *groupid,
const char *username, apr_pool_t *p);}
{
* Get the home directory for the named user
* @param dirname Pointer to new string containing directory name (on output)
* @param username The named user
* @param p The pool from which to allocate the string
* @remark This function is available only if APR_HAS_USER is defined.
}
function apr_uid_homepath_get(dirname: PPChar; const username: PChar;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_uid_homepath_get' + LibSuff12;
{ @deprecated @see apr_uid_homepath_get }
{APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname,
const char *username,
apr_pool_t *p);}
{
* Compare two user identifiers for equality.
* @param left One uid to test
* @param right Another uid to test
* @return APR_SUCCESS if the apr_uid_t strutures identify the same user,
* APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid.
* @remark This function is available only if APR_HAS_USER is defined.
}
{$ifdef WIN32}
//APR_DECLARE(apr_status_t) apr_uid_compare(apr_uid_t left, apr_uid_t right);
{ @deprecated @see apr_uid_compare }
//APR_DECLARE(apr_status_t) apr_compare_users(apr_uid_t left, apr_uid_t right);
{$else}
//#define apr_uid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
{ @deprecated @see apr_uid_compare }
//#define apr_compare_users(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
{$endif}
{
* Get the group name for a specified groupid
* @param groupname Pointer to new string containing group name (on output)
* @param groupid The groupid
* @param p The pool from which to allocate the string
* @remark This function is available only if APR_HAS_USER is defined.
}
function apr_gid_name_get(groupname: PPChar; groupid: apr_gid_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_gid_name_get' + LibSuff12;
{ @deprecated @see apr_gid_name_get }
{APR_DECLARE(apr_status_t) apr_group_name_get(char **groupname,
apr_gid_t groupid, apr_pool_t *p);}
{ @deprecated @see apr_gid_name_get }
{APR_DECLARE(apr_status_t) apr_get_groupname(char **groupname,
apr_gid_t groupid, apr_pool_t *p);}
{
* Get the groupid for a specified group name
* @param groupid Pointer to the group id (on output)
* @param groupname The group name to look up
* @param p The pool from which to allocate the string
* @remark This function is available only if APR_HAS_USER is defined.
}
function apr_gid_get(groupid: Papr_gid_t; const groupname: PChar;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_gid_get' + LibSuff12;
{ @deprecated @see apr_gid_get }
{APR_DECLARE(apr_status_t) apr_get_groupid(apr_gid_t *groupid,
const char *groupname, apr_pool_t *p);}
{
* Compare two group identifiers for equality.
* @param left One gid to test
* @param right Another gid to test
* @return APR_SUCCESS if the apr_gid_t strutures identify the same group,
* APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid.
* @remark This function is available only if APR_HAS_USER is defined.
}
{$ifdef WIN32}
//APR_DECLARE(apr_status_t) apr_gid_compare(apr_gid_t left, apr_gid_t right);
{ @deprecated @see apr_gid_compare }
//APR_DECLARE(apr_status_t) apr_compare_groups(apr_gid_t left, apr_gid_t right);
{$else}
//#define apr_gid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
{ @deprecated @see apr_gid_compare }
//#define apr_compare_groups(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
{$endif}
{$endif} { ! APR_HAS_USER }

View File

@ -1,112 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
//#include "apr.h"
{
* @file apr_version.h
* @brief APR Versioning Interface
*
* APR's Version
*
* There are several different mechanisms for accessing the version. There
* is a string form, and a set of numbers; in addition, there are constants
* which can be compiled into your application, and you can query the library
* being used for its actual version.
*
* Note that it is possible for an application to detect that it has been
* compiled against a different version of APR by use of the compile-time
* constants and the use of the run-time query function.
*
* APR version numbering follows the guidelines specified in:
*
* http://apr.apache.org/versioning.html
}
{ The numeric compile-time version constants. These constants are the
* authoritative version numbers for APR.
}
{ major version
* Major API changes that could cause compatibility problems for older
* programs such as structure size changes. No binary compatibility is
* possible across a change in the major version.
}
const
APR_MAJOR_VERSION = 0;
{
* Minor API changes that do not cause binary compatibility problems.
* Should be reset to 0 when upgrading APR_MAJOR_VERSION
}
APR_MINOR_VERSION = 9;
{ patch level }
APR_PATCH_VERSION = 12;
{
* This symbol is defined for internal, "development" copies of APR. This
* symbol will be #undef'd for releases.
}
{.$undef APR_IS_DEV_VERSION}
{ The formatted string of APR's version }
{#define APR_VERSION_STRING \
APR_STRINGIFY(APR_MAJOR_VERSION) "." \
APR_STRINGIFY(APR_MINOR_VERSION) "." \
APR_STRINGIFY(APR_PATCH_VERSION) \
APR_IS_DEV_STRING}
{
* The numeric version information is broken out into fields within this
* structure.
}
type
apr_version_t = record
major: Integer; {< major number }
minor: Integer; {< minor number }
patch: Integer; {< patch number }
is_dev: Integer; {< is development (1 or 0) }
end;
Papr_version_t = ^apr_version_t;
{
* Return APR's version information information in a numeric form.
*
* @param pvsn Pointer to a version structure for returning the version
* information.
}
procedure apr_version(pvsn: Papr_version_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_version' + LibSuff4;
{ Return APR's version information as a string. }
function apr_version_string: PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_version_string' + LibSuff0;
{ Internal: string form of the "is dev" flag }
{#ifdef APR_IS_DEV_VERSION
#define APR_IS_DEV_STRING "-dev"
#else}
const
APR_IS_DEV_STRING = '';
//#endif

View File

@ -1,99 +0,0 @@
{ Copyright 2000-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{#include "apr.h"
#include "apr_version.h"
#include "apr_iconv.h"}
{
* @file api_version.h
* @brief
*
* APR-iconv's Version
*
* There are several different mechanisms for accessing the version. There
* is a string form, and a set of numbers; in addition, there are constants
* which can be compiled into your application, and you can query the library
* being used for its actual version.
*
* Note that it is possible for an application to detect that it has been
* compiled against a different version of API by use of the compile-time
* constants and the use of the run-time query function.
*
* API version numbering follows the guidelines specified in:
*
* http://apr.apache.org/versioning.html
}
{ The numeric compile-time version constants. These constants are the
* authoritative version numbers for API.
}
{ major version
* Major API changes that could cause compatibility problems for older
* programs such as structure size changes. No binary compatibility is
* possible across a change in the major version.
}
const
API_MAJOR_VERSION = 0;
{
* Minor API changes that do not cause binary compatibility problems.
* Should be reset to 0 when upgrading API_MAJOR_VERSION
}
API_MINOR_VERSION = 9;
{ patch level }
API_PATCH_VERSION = 7;
{
* This symbol is defined for internal, "development" copies of API. This
* symbol will be #undef'd for releases.
}
{ #define API_IS_DEV_VERSION }
{ The formatted string of API's version }
{#define API_VERSION_STRING \
APR_STRINGIFY(API_MAJOR_VERSION) "." \
APR_STRINGIFY(API_MINOR_VERSION) "." \
APR_STRINGIFY(API_PATCH_VERSION) \
API_IS_DEV_STRING}
{
* Return APR-util's version information information in a numeric form.
*
* @param pvsn Pointer to a version structure for returning the version
* information.
}
//procedure api_version(pvsn: Papr_version_t);
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPRIconv name LibNamePrefix + 'api_version' + LibSuff4;
{ Return API's version information as a string. }
//function api_version_string: PChar;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPRIconv name LibNamePrefix + 'api_version_string' + LibSuff0;
{ Internal: string form of the "is dev" flag }
const
{$ifdef API_IS_DEV_VERSION}
API_IS_DEV_STRING = '-dev';
{$else}
API_IS_DEV_STRING = '';
{$endif}

View File

@ -1,113 +0,0 @@
{-
* Copyright (c) 1999,2000
* Konstantin Chuguev. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Konstantin Chuguev
* and its contributors.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
}
{#include "apr.h"
#include "apr_pools.h"
#include <stddef.h>}
{
* API_DECLARE_EXPORT is defined when building the libapriconv dynamic
* library, so that all public symbols are exported.
*
* API_DECLARE_STATIC is defined when including the apriconv public headers,
* to provide static linkage when the dynamic library may be unavailable.
*
* API_DECLARE_STATIC and API_DECLARE_EXPORT are left undefined when
* including the apr-iconv public headers, to import and link the symbols
* from the dynamic libapriconv library and assure appropriate indirection
* and calling conventions at compile time.
}
//#if !defined(WIN32)
{
* The public apr-iconv functions are declared with API_DECLARE(), so they
* use the most portable calling convention. Public apr-iconv functions
* with variable arguments must use API_DECLARE_NONSTD().
*
* @deffunc API_DECLARE(rettype) apr_func(args);
}
//#define API_DECLARE(type) type
{
* The private apr-iconv functions are declared with API_DECLARE_NONSTD(),
* so they use the most optimal C language calling conventions.
*
* @deffunc API_DECLARE(rettype) apr_func(args);
}
//#define API_DECLARE_NONSTD(type) type
{
* All exported apr-iconv variables are declared with API_DECLARE_DATA
* This assures the appropriate indirection is invoked at compile time.
*
* @deffunc API_DECLARE_DATA type apr_variable;
* @tip extern API_DECLARE_DATA type apr_variable; syntax is required for
* declarations within headers to properly import the variable.
}
{#define API_DECLARE_DATA
#elif defined(API_DECLARE_STATIC)
#define API_DECLARE(type) type __stdcall
#define API_DECLARE_NONSTD(type) type
#define API_DECLARE_DATA
#elif defined(API_DECLARE_EXPORT)
#define API_DECLARE(type) __declspec(dllexport) type __stdcall
#define API_DECLARE_NONSTD(type) __declspec(dllexport) type
#define API_DECLARE_DATA __declspec(dllexport)
#else
#define API_DECLARE(type) __declspec(dllimport) type __stdcall
#define API_DECLARE_NONSTD(type) __declspec(dllimport) type
#define API_DECLARE_DATA __declspec(dllimport)
#endif}
{
* apr_iconv_t: charset conversion descriptor type
}
type
apr_iconv_t = Pointer;
Papr_iconv_t = ^apr_iconv_t;
{ __BEGIN_DECLS }
function apr_iconv_open(const param1, param2: PChar;
param3: Papr_pool_t; param4: Papr_iconv_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRIconv name LibNamePrefix + 'apr_iconv_open' + LibSuff16;
function apr_iconv(param1: apr_iconv_t; const param2: PPChar;
param3: Papr_pool_t; param4: PPchar;
param5, param6: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRIconv name LibNamePrefix + 'apr_iconv' + LibSuff24;
function apr_iconv_close(param1: apr_iconv_t; param2: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRIconv name LibNamePrefix + 'apr_iconv_close' + LibSuff8;
{ __END_DECLS }

View File

@ -1,59 +0,0 @@
{
apriconv.pas
Copyright (C) 2006 Felipe Monteiro de Carvalho
This unit is a pascal binding for the Apache 2.0.58 headers.
The headers were released under the following copyright:
}
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
unit apriconv;
interface
{$ifdef fpc}
{$mode delphi}{$H+}
{$endif}
{$IFNDEF FPC}
{$DEFINE WINDOWS}
{$ENDIF}
{$IFDEF WIN32}
{$DEFINE WINDOWS}
{$ENDIF}
{$ifdef Unix}
{$PACKRECORDS C}
{$endif}
uses apr;
const
{$IFDEF WINDOWS}
LibAPRIconv = 'libapriconv.dll';
{$ELSE}
LibAPRIconv = '';
{$ENDIF}
{$include apr_iconv.inc}
{$include api_version.inc}
implementation
end.

View File

@ -1,158 +0,0 @@
{
* This is work is derived from material Copyright RSA Data Security, Inc.
*
* The RSA copyright statement and Licence for that original material is
* included below. This is followed by the Apache copyright statement and
* licence for the modifications made to that material.
}
{ Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
}
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{#include "apu.h"}
{$include apr_xlate.inc}
{
* @file apr_md5.h
* @brief APR MD5 Routines
}
{
* @defgroup APR_MD5 MD5 Routines
* @ingroup APR
}
const
{ The MD5 digest size }
APR_MD5_DIGESTSIZE = 16;
MD5_DIGESTSIZE = APR_MD5_DIGESTSIZE; {< @deprecated }
{ @see apr_md5_ctx_t }
type
TDigestArray = array [0..APR_MD5_DIGESTSIZE] of Char;
Papr_md5_ctx_t = ^apr_md5_ctx_t;
{ MD5 context. }
apr_md5_ctx_t = record
{ state (ABCD) }
state: array [1..4] of apr_uint32_t;
{ number of bits, modulo 2^64 (lsb first) }
count: array [1..2] of apr_uint32_t;
{ input buffer }
buffer: array [1..64] of Char;
{ translation handle
* ignored if xlate is unsupported
}
xlate: Papr_xlate_t;
end;
{
* MD5 Initialize. Begins an MD5 operation, writing a new context.
* @param context The MD5 context to initialize.
}
function apr_md5_init(context: Papr_md5_ctx_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_md5_init' + LibSuff4;
{
* MD5 translation setup. Provides the APR translation handle to be used
* for translating the content before calculating the digest.
* @param context The MD5 content to set the translation for.
* @param xlate The translation handle to use for this MD5 context
}
function apr_md5_set_xlate(context: Papr_md5_ctx_t;
xlate: Papr_xlate_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_md5_set_xlate' + LibSuff8;
{
* MD5 block update operation. Continue an MD5 message-digest operation,
* processing another message block, and updating the context.
* @param context The MD5 content to update.
* @param input next message block to update
* @param inputLen The length of the next message block
}
function apr_md5_update(context: Papr_md5_ctx_t;
input: Pointer; inputLen: apr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_md5_update' + LibSuff12;
{
* MD5 finalization. Ends an MD5 message-digest operation, writing the
* message digest and zeroing the context
* @param digest The final MD5 digest
* @param context The MD5 content we are finalizing.
}
function apr_md5_final(digest: TDigestArray;
context: Papr_md5_ctx_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_md5_final' + LibSuff8;
{
* MD5 in one step
* @param digest The final MD5 digest
* @param input The message block to use
* @param inputLen The length of the message block
}
function apr_md5(digest: TDigestArray;
input: Pointer; inputLen: apr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_md5' + LibSuff12;
{
* Encode a password using an MD5 algorithm
* @param password The password to encode
* @param salt The salt to use for the encoding
* @param result The string to store the encoded password in
* @param nbytes The length of the string
}
function apr_md5_encode(const password, salt: PChar;
result: PChar; nbytes: apr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_md5_encode' + LibSuff16;
{
* Validate any password encypted with any algorithm that APR understands
* @param passwd The password to validate
* @param hash The password to validate against
}
function apr_password_validate(const passwd, hash: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_password_validate' + LibSuff8;

View File

@ -1,175 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* apr_uri.h: External Interface of apr_uri.c
}
{
* @file apr_uri.h
* @brief APR-UTIL URI Routines
}
{#include "apu.h"
#include "apr_network_io.h"}
{
* @defgroup APR_Util_URI URI
* @ingroup APR_Util
}
const
APR_URI_FTP_DEFAULT_PORT = 21; {< default FTP port }
APR_URI_SSH_DEFAULT_PORT = 22; {< default SSH port }
APR_URI_TELNET_DEFAULT_PORT = 23; {< default telnet port }
APR_URI_GOPHER_DEFAULT_PORT = 70; {< default Gopher port }
APR_URI_HTTP_DEFAULT_PORT = 80; {< default HTTP port }
APR_URI_POP_DEFAULT_PORT = 110; {< default POP port }
APR_URI_NNTP_DEFAULT_PORT = 119; {< default NNTP port }
APR_URI_IMAP_DEFAULT_PORT = 143; {< default IMAP port }
APR_URI_PROSPERO_DEFAULT_PORT = 191; {< default Prospero port }
APR_URI_WAIS_DEFAULT_PORT = 210; {< default WAIS port }
APR_URI_LDAP_DEFAULT_PORT = 389; {< default LDAP port }
APR_URI_HTTPS_DEFAULT_PORT = 443; {< default HTTPS port }
APR_URI_RTSP_DEFAULT_PORT = 554; {< default RTSP port }
APR_URI_SNEWS_DEFAULT_PORT = 563; {< default SNEWS port }
APR_URI_ACAP_DEFAULT_PORT = 674; {< default ACAP port }
APR_URI_NFS_DEFAULT_PORT = 2049; {< default NFS port }
APR_URI_TIP_DEFAULT_PORT = 3372; {< default TIP port }
APR_URI_SIP_DEFAULT_PORT = 5060; {< default SIP port }
{ Flags passed to unparse_uri_components(): }
{ suppress "scheme://user\@site:port" }
APR_URI_UNP_OMITSITEPART = (1 shl 0);
{ Just omit user }
APR_URI_UNP_OMITUSER = (1 shl 1);
{ Just omit password }
APR_URI_UNP_OMITPASSWORD = (1 shl 2);
{ omit "user:password\@" part }
APR_URI_UNP_OMITUSERINFO = (APR_URI_UNP_OMITUSER or APR_URI_UNP_OMITPASSWORD);
{ Show plain text password (default: show XXXXXXXX) }
APR_URI_UNP_REVEALPASSWORD = (1 shl 3);
{ Show "scheme://user\@site:port" only }
APR_URI_UNP_OMITPATHINFO = (1 shl 4);
{ Omit the "?queryarg" from the path }
APR_URI_UNP_OMITQUERY = (1 shl 5);
type
{ @see apr_uri_t }
Papr_uri_t = ^apr_uri_t;
{
* A structure to encompass all of the fields in a uri
}
apr_uri_t = record
{ scheme ("http"/"ftp"/...) }
scheme: PChar;
{ combined [user[:password]\@]host[:port] }
hostinfo: PChar;
{ user name, as in http://user:passwd\@host:port/ }
user: PChar;
{ password, as in http://user:passwd\@host:port/ }
password: PChar;
{ hostname from URI (or from Host: header) }
hostname: PChar;
{ port string (integer representation is in "port") }
port_str: PChar;
{ the request path (or "/" if only scheme://host was given) }
path: PChar;
{ Everything after a '?' in the path, if present }
query: PChar;
{ Trailing "#fragment" string, if present }
fragment: PChar;
{ structure returned from gethostbyname() }
hostent: Pointer;
{ The port number, numeric, valid only if port_str != NULL }
port: apr_port_t;
{ has the structure been initialized }
// unsigned is_initialized:1;
{ has the DNS been looked up yet }
// unsigned dns_looked_up:1;
{ has the dns been resolved yet }
// unsigned dns_resolved:1;
end;
{ apr_uri.c }
{
* Return the default port for a given scheme. The schemes recognized are
* http, ftp, https, gopher, wais, nntp, snews, and prospero
* @param scheme_str The string that contains the current scheme
* @return The default port for this scheme
}
function apr_uri_port_of_scheme(const scheme_str: PChar): apr_port_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_uri_port_of_scheme' + LibSuff4;
{ @deprecated @see apr_uri_port_of_scheme }
function apr_uri_default_port_for_scheme(const scheme_str: PChar): apr_port_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_uri_default_port_for_scheme' + LibSuff4;
{
* Unparse a apr_uri_t structure to an URI string. Optionally
* suppress the password for security reasons.
* @param p The pool to allocate out of
* @param uptr All of the parts of the uri
* @param flags How to unparse the uri. One of:
* <PRE>
* APR_URI_UNP_OMITSITEPART Suppress "scheme://user\@site:port"
* APR_URI_UNP_OMITUSER Just omit user
* APR_URI_UNP_OMITPASSWORD Just omit password
* APR_URI_UNP_OMITUSERINFO Omit "user:password\@" part
* APR_URI_UNP_REVEALPASSWORD Show plain text password (default: show XXXXXXXX)
* APR_URI_UNP_OMITPATHINFO Show "scheme://user\@site:port" only
* APR_URI_UNP_OMITQUERY Omit "?queryarg" or "#fragment"
* </PRE>
* @return The uri as a string
}
function apr_uri_unparse(p: Papr_pool_t; const uptr: Papr_uri_t;
flags: cuint): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_uri_unparse' + LibSuff12;
{
* Parse a given URI, fill in all supplied fields of a apr_uri_t
* structure. This eliminates the necessity of extracting host, port,
* path, query info repeatedly in the modules.
* @param p The pool to allocate out of
* @param uri The uri to parse
* @param uptr The apr_uri_t to fill out
* @return APR_SUCCESS for success or error code
}
function apr_uri_parse(p: Papr_pool_t; const uri: PChar;
uptr: Papr_uri_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_uri_parse' + LibSuff12;
{
* Special case for CONNECT parsing: it comes with the hostinfo part only
* @param p The pool to allocate out of
* @param hostinfo The hostinfo string to parse
* @param uptr The apr_uri_t to fill out
* @return APR_SUCCESS for success or error code
}
function apr_uri_parse_hostinfo(p: Papr_pool_t;
const hostinfo: PChar; uptr: Papr_uri_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_uri_parse_hostinfo' + LibSuff12;

View File

@ -1,152 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{#include "apu.h"
#include "apr_pools.h"
#include "apr_errno.h"}
{
* @file apr_xlate.h
* @brief APR I18N translation library
}
{
* @defgroup APR_XLATE I18N translation library
* @ingroup APR
}
{ Opaque translation buffer }
type
Papr_xlate_t = Pointer;
PPapr_xlate_t = ^Papr_xlate_t;
{
* Set up for converting text from one charset to another.
* @param convset The handle to be filled in by this function
* @param topage The name of the target charset
* @param frompage The name of the source charset
* @param pool The pool to use
* @remark
* Specify APR_DEFAULT_CHARSET for one of the charset
* names to indicate the charset of the source code at
* compile time. This is useful if there are literal
* strings in the source code which must be translated
* according to the charset of the source code.
* APR_DEFAULT_CHARSET is not useful if the source code
* of the caller was not encoded in the same charset as
* APR at compile time.
*
* @remark
* Specify APR_LOCALE_CHARSET for one of the charset
* names to indicate the charset of the current locale.
*
* @remark
* Return APR_EINVAL if unable to procure a convset, or APR_ENOTIMPL
* if charset transcoding is not available in this instance of
* apr-util at all (i.e., APR_HAS_XLATE is undefined).
}
function apr_xlate_open(convset: PPapr_xlate_t;
const topage, frompage: PChar; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xlate_open' + LibSuff16;
{
* This is to indicate the charset of the sourcecode at compile time
* names to indicate the charset of the source code at
* compile time. This is useful if there are literal
* strings in the source code which must be translated
* according to the charset of the source code.
}
//#define APR_DEFAULT_CHARSET (const char *)0
{
* To indicate charset names of the current locale
}
//#define APR_LOCALE_CHARSET (const char *)1
{
* Find out whether or not the specified conversion is single-byte-only.
* @param convset The handle allocated by apr_xlate_open, specifying the
* parameters of conversion
* @param onoff Output: whether or not the conversion is single-byte-only
* @remark
* Return APR_ENOTIMPL if charset transcoding is not available
* in this instance of apr-util (i.e., APR_HAS_XLATE is undefined).
}
function apr_xlate_sb_get(convset: Papr_xlate_t; onoff: PInteger): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xlate_sb_get' + LibSuff8;
{ @deprecated @see apr_xlate_sb_get }
function apr_xlate_get_sb(convset: Papr_xlate_t; onoff: PInteger): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xlate_get_sb' + LibSuff8;
{
* Convert a buffer of text from one codepage to another.
* @param convset The handle allocated by apr_xlate_open, specifying
* the parameters of conversion
* @param inbuf The address of the source buffer
* @param inbytes_left Input: the amount of input data to be translated
* Output: the amount of input data not yet translated
* @param outbuf The address of the destination buffer
* @param outbytes_left Input: the size of the output buffer
* Output: the amount of the output buffer not yet used
* @remark
* Return APR_ENOTIMPL if charset transcoding is not available
* in this instance of apr-util (i.e., APR_HAS_XLATE is undefined).
}
function apr_xlate_conv_buffer(convset: Papr_xlate_t; const inbuf: PChar;
inbytes_left: Papr_size_t; outbuf: PChar; outbytes_left: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xlate_conv_buffer' + LibSuff20;
{ @see apr_file_io.h the comment in apr_file_io.h about this hack }
{$ifdef APR_NOT_DONE_YET}
{
* The purpose of apr_xlate_conv_char is to translate one character
* at a time. This needs to be written carefully so that it works
* with double-byte character sets.
* @param convset The handle allocated by apr_xlate_open, specifying the
* parameters of conversion
* @param inchar The character to convert
* @param outchar The converted character
}
APU_DECLARE(apr_status_t) apr_xlate_conv_char(apr_xlate_t *convset,
char inchar, char outchar);
{$endif}
{
* Convert a single-byte character from one charset to another.
* @param convset The handle allocated by apr_xlate_open, specifying the
* parameters of conversion
* @param inchar The single-byte character to convert.
* @warning This only works when converting between single-byte character sets.
* -1 will be returned if the conversion can't be performed.
}
function apr_xlate_conv_byte(convset: Papr_xlate_t; inchar: Char): apr_int32_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xlate_conv_byte' + LibSuff8;
{
* Close a codepage translation handle.
* @param convset The codepage translation handle to close
* @remark
* Return APR_ENOTIMPL if charset transcoding is not available
* in this instance of apr-util (i.e., APR_HAS_XLATE is undefined).
}
function apr_xlate_close(convset: Papr_xlate_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xlate_close' + LibSuff4;

View File

@ -1,349 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_xml.h
* @brief APR-UTIL XML Library
}
{
* @defgroup APR_Util_XML XML
* @ingroup APR_Util
}
{#include "apr_pools.h"
#include "apr_tables.h"
#include "apr_file_io.h"
#include "apu.h"}
{
* @package Apache XML library
}
{ -------------------------------------------------------------------- }
{ ### these will need to move at some point to a more logical spot }
{ @see apr_text }
type
Papr_text = ^apr_text;
{ Structure to keep a linked list of pieces of text }
apr_text = record
{ The current piece of text }
text: PChar;
{ a pointer to the next piece of text }
next: Papr_text;
end;
{ @see apr_text_header }
Papr_text_header = ^apr_text_header;
{ A list of pieces of text }
apr_text_header = record
{ The first piece of text in the list }
first: Papr_text;
{ The last piece of text in the list }
last: Papr_text;
end;
{
* Append a piece of text to the end of a list
* @param p The pool to allocate out of
* @param hdr The text header to append to
* @param text The new text to append
}
procedure apr_text_append(p: Papr_pool_t; hdr: Papr_text_header;
const text: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_text_append' + LibSuff12;
{ --------------------------------------------------------------------
**
** XML PARSING
}
{
** Qualified namespace values
**
** APR_XML_NS_DAV_ID
** We always insert the "DAV:" namespace URI at the head of the
** namespace array. This means that it will always be at ID==0,
** making it much easier to test for.
**
** APR_XML_NS_NONE
** This special ID is used for two situations:
**
** 1) The namespace prefix begins with "xml" (and we do not know
** what it means). Namespace prefixes with "xml" (any case) as
** their first three characters are reserved by the XML Namespaces
** specification for future use. mod_dav will pass these through
** unchanged. When this identifier is used, the prefix is LEFT in
** the element/attribute name. Downstream processing should not
** prepend another prefix.
**
** 2) The element/attribute does not have a namespace.
**
** a) No prefix was used, and a default namespace has not been
** defined.
** b) No prefix was used, and the default namespace was specified
** to mean "no namespace". This is done with a namespace
** declaration of: xmlns=""
** (this declaration is typically used to override a previous
** specification for the default namespace)
**
** In these cases, we need to record that the elem/attr has no
** namespace so that we will not attempt to prepend a prefix.
** All namespaces that are used will have a prefix assigned to
** them -- mod_dav will never set or use the default namespace
** when generating XML. This means that "no prefix" will always
** mean "no namespace".
**
** In both cases, the XML generation will avoid prepending a prefix.
** For the first case, this means the original prefix/name will be
** inserted into the output stream. For the latter case, it means
** the name will have no prefix, and since we never define a default
** namespace, this means it will have no namespace.
**
** Note: currently, mod_dav understands the "xmlns" prefix and the
** "xml:lang" attribute. These are handled specially (they aren't
** left within the XML tree), so the APR_XML_NS_NONE value won't ever
** really apply to these values.
}
const
APR_XML_NS_DAV_ID = 0; {< namespace ID for "DAV:" }
APR_XML_NS_NONE = -10; {< no namespace for this elem/attr }
APR_XML_NS_ERROR_BASE = -100; {< used only during processing }
{ Is this namespace an error? }
// APR_XML_NS_IS_ERROR(e) ((e) <= APR_XML_NS_ERROR_BASE)
type
{ @see apr_xml_attr }
Papr_xml_attr = ^apr_xml_attr;
{ @see apr_xml_elem }
Papr_xml_elem = ^apr_xml_elem;
{ @see apr_xml_doc }
Papr_xml_doc = ^apr_xml_doc;
PPapr_xml_doc = ^Papr_xml_doc;
{ apr_xml_attr: holds a parsed XML attribute }
apr_xml_attr = record
{ attribute name }
name: PChar;
{ index into namespace array }
ns: Integer;
{ attribute value }
value: PChar;
{ next attribute }
next: Papr_xml_attr;
end;
{ apr_xml_elem: holds a parsed XML element }
apr_xml_elem = record
{ element name }
name: PChar;
{ index into namespace array }
ns: Integer;
{ xml:lang for attrs/contents }
lang: PChar;
{ cdata right after start tag }
first_cdata: apr_text_header;
{ cdata after MY end tag }
following_cdata: apr_text_header;
{ parent element }
parent: Papr_xml_elem;
{ next (sibling) element }
next: Papr_xml_elem;
{ first child element }
first_child: Papr_xml_elem;
{ first attribute }
attr: Papr_xml_attr;
{ used only during parsing }
{ last child element }
last_child: Papr_xml_elem;
{ namespaces scoped by this elem }
ns_scope: Papr_xml_ns_scope;
{ used by modules during request processing }
{ Place for modules to store private data }
priv: Pointer;
end;
{ Is this XML element empty? }
//#define APR_XML_ELEM_IS_EMPTY(e) ((e)->first_child == NULL && \
// (e)->first_cdata.first == NULL)
{ apr_xml_doc: holds a parsed XML document }
apr_xml_doc = record
{ root element }
root: Papr_xml_elem;
{ array of namespaces used }
namespaces: Papr_array_header_t;
end;
{ Opaque XML parser structure }
apr_xml_parser = record end;
Papr_xml_parser = ^apr_xml_parser;
PPapr_xml_parser = ^Papr_xml_parser;
{
* Create an XML parser
* @param pool The pool for allocating the parser and the parse results.
* @return The new parser.
}
function apr_xml_parser_create(pool: Papr_pool_t): Papr_xml_parser;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xml_parser_create' + LibSuff4;
{
* Parse a File, producing a xml_doc
* @param p The pool for allocating the parse results.
* @param parser A pointer to *parser (needed so calling function can get
* errors), will be set to NULL on successfull completion.
* @param ppdoc A pointer to *apr_xml_doc (which has the parsed results in it)
* @param xmlfd A file to read from.
* @param buffer_length Buffer length which would be suitable
* @return Any errors found during parsing.
}
function apr_xml_parse_file(p: Papr_pool_t;
parser: PPapr_xml_parser; ppdoc: PPapr_xml_doc;
xmlfd: Papr_file_t; buffer_length: apr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xml_parse_file' + LibSuff20;
{
* Feed input into the parser
* @param parser The XML parser for parsing this data.
* @param data The data to parse.
* @param len The length of the data.
* @return Any errors found during parsing.
* @remark Use apr_xml_parser_geterror() to get more error information.
}
function apr_xml_parser_feed(parser: Papr_xml_parser;
const data: PChar; len: apr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xml_parser_feed' + LibSuff12;
{
* Terminate the parsing and return the result
* @param parser The XML parser for parsing this data.
* @param pdoc The resulting parse information. May be NULL to simply
* terminate the parsing without fetching the info.
* @return Any errors found during the final stage of parsing.
* @remark Use apr_xml_parser_geterror() to get more error information.
}
function apr_xml_parser_done(parser: Papr_xml_parser;
pdoc: PPapr_xml_doc): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xml_parser_done' + LibSuff8;
{
* Fetch additional error information from the parser.
* @param parser The XML parser to query for errors.
* @param errbuf A buffer for storing error text.
* @param errbufsize The length of the error text buffer.
* @return The error buffer
}
function apr_xml_parser_geterror(parser: Papr_xml_parser;
errbuf: PChar; errbufsize: apr_size_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xml_parser_geterror' + LibSuff12;
{
* Converts an XML element tree to flat text
* @param p The pool to allocate out of
* @param elem The XML element to convert
* @param style How to covert the XML. One of:
* <PRE>
* APR_XML_X2T_FULL start tag, contents, end tag
* APR_XML_X2T_INNER contents only
* APR_XML_X2T_LANG_INNER xml:lang + inner contents
* APR_XML_X2T_FULL_NS_LANG FULL + ns defns + xml:lang
* </PRE>
* @param namespaces The namespace of the current XML element
* @param ns_map Namespace mapping
* @param pbuf Buffer to put the converted text into
* @param psize Size of the converted text
}
procedure apr_xml_to_text(p: Papr_pool_t; const elem: Papr_xml_elem;
style: Integer; namespaces: Papr_array_header_t;
ns_map: PInteger; const pbuf: PPChar; psize: Papr_size_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xml_to_text' + LibSuff28;
{ style argument values: }
const
APR_XML_X2T_FULL = 0; {< start tag, contents, end tag }
APR_XML_X2T_INNER = 1; {< contents only }
APR_XML_X2T_LANG_INNER = 2; {< xml:lang + inner contents }
APR_XML_X2T_FULL_NS_LANG = 3; {< FULL + ns defns + xml:lang }
{
* empty XML element
* @param p The pool to allocate out of
* @param elem The XML element to empty
* @return the string that was stored in the XML element
}
function apr_xml_empty_elem(p: Papr_pool_t; const elem: Papr_xml_elem): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xml_empty_elem' + LibSuff8;
{
* quote an XML string
* Replace '<', '>', and '&' with '&lt;', '&gt;', and '&amp;'.
* @param p The pool to allocate out of
* @param s The string to quote
* @param quotes If quotes is true, then replace '"' with '&quot;'.
* @return The quoted string
* @note If the string does not contain special characters, it is not
* duplicated into the pool and the original string is returned.
}
function apr_xml_quote_string(p: Papr_pool_t; const s: PChar;
quotes: Integer): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xml_quote_string' + LibSuff12;
{
* Quote an XML element
* @param p The pool to allocate out of
* @param elem The element to quote
}
procedure apr_xml_quote_elem(p: Papr_pool_t; elem: Papr_xml_elem);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xml_quote_elem' + LibSuff8;
{ manage an array of unique URIs: apr_xml_insert_uri() and APR_XML_URI_ITEM() }
{
* return the URI's (existing) index, or insert it and return a new index
* @param uri_array array to insert into
* @param uri The uri to insert
* @return int The uri's index
}
function apr_xml_insert_uri(uri_array: Papr_array_header_t;
const uri: PChar): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPRUtil name LibNamePrefix + 'apr_xml_insert_uri' + LibSuff8;
{ Get the URI item for this XML element }
//#define APR_XML_GET_URI_ITEM(ary, i) (((const char * const *)(ary)->elts)[i])

View File

@ -1,64 +0,0 @@
{
aprutil.pas
Copyright (C) 2006 Felipe Monteiro de Carvalho
This unit is a pascal binding for the Apache 2.0.58 headers.
The headers were released under the following copyright:
}
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
unit aprutil;
interface
{$ifdef fpc}
{$mode delphi}{$H+}
{$endif}
{$IFNDEF FPC}
{$DEFINE WINDOWS}
{$ENDIF}
{$IFDEF WIN32}
{$DEFINE WINDOWS}
{$ENDIF}
{$ifdef Unix}
{$PACKRECORDS C}
{$endif}
uses
{$ifdef WINDOWS}
Windows,
{$ENDIF}
apr, ctypes;
const
{$IFDEF WINDOWS}
LibAPRUtil = 'libaprutil.dll';
{$ELSE}
LibAPRUtil = '';
{$ENDIF}
{$include apr_xml.inc}
{$include apr_uri.inc}
{$include apr_md5.inc}
implementation
end.

File diff suppressed because it is too large Load Diff

View File

@ -1,157 +0,0 @@
{ Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{#include "apr_hooks.h"
#include "apr_network_io.h"
#include "apr_buckets.h"}
{
* @package Apache connection library
}
//#ifdef CORE_PRIVATE
{
* This is the protocol module driver. This calls all of the
* pre-connection and connection hooks for all protocol modules.
* @param c The connection on which the request is read
* @param csd The mechanism on which this connection is to be read.
* Most times this will be a socket, but it is up to the module
* that accepts the request to determine the exact type.
* @deffunc void ap_process_connection(conn_rec *c, void *csd)
}
procedure ap_process_connection(c: Pconn_rec; csd: Pointer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_process_connection' + LibSuff8;
procedure ap_flush_conn(c: Pconn_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_flush_conn' + LibSuff4;
{
* This function is responsible for the following cases:
* <pre>
* we now proceed to read from the client until we get EOF, or until
* MAX_SECS_TO_LINGER has passed. the reasons for doing this are
* documented in a draft:
*
* http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt
*
* in a nutshell -- if we don't make this effort we risk causing
* TCP RST packets to be sent which can tear down a connection before
* all the response data has been sent to the client.
* </pre>
* @param c The connection we are closing
}
procedure ap_lingering_close(c: Pconn_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_lingering_close' + LibSuff4;
//#endif COREPRIVATE
{ Hooks }
{
* create_connection is a RUN_FIRST hook which allows modules to create
* connections. In general, you should not install filters with the
* create_connection hook. If you require vhost configuration information
* to make filter installation decisions, you must use the pre_connection
* or install_network_transport hook. This hook should close the connection
* if it encounters a fatal error condition.
*
* @param p The pool from which to allocate the connection record
* @param csd The socket that has been accepted
* @param conn_id A unique identifier for this connection. The ID only
* needs to be unique at that time, not forever.
* @param sbh A handle to scoreboard information for this connection.
* @return An allocated connection record or NULL.
}
type
ap_HOOK_create_connection_t = function (p: Papr_pool_t; server: Pserver_rec;
csd: Papr_socket_t; conn_id: cLong; sbh: Pointer;
alloc: Papr_bucket_alloc_t): Pconn_rec; cdecl;
procedure ap_hook_create_connection(pf: ap_HOOK_create_connection_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_create_connection' + LibSuff16;
{
* This hook gives protocol modules an opportunity to set everything up
* before calling the protocol handler. All pre-connection hooks are
* run until one returns something other than ok or decline
* @param c The connection on which the request has been received.
* @param csd The mechanism on which this connection is to be read.
* Most times this will be a socket, but it is up to the module
* that accepts the request to determine the exact type.
* @return OK or DECLINED
* @deffunc int ap_run_pre_connection(conn_rec *c, void *csd)
}
type
ap_HOOK_pre_connection_t = function (c: Pconn_rec; csd: Pointer): Integer; cdecl;
procedure ap_hook_pre_connection(pf: ap_HOOK_pre_connection_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_pre_connection' + LibSuff16;
{
* This hook implements different protocols. After a connection has been
* established, the protocol module must read and serve the request. This
* function does that for each protocol module. The first protocol module
* to handle the request is the last module run.
* @param c The connection on which the request has been received.
* @return OK or DECLINED
* @deffunc int ap_run_process_connection(conn_rec *c)
}
type
ap_HOOK_process_connection_t = function (c: Pconn_rec): Integer; cdecl;
procedure ap_hook_process_connection(pf: ap_HOOK_process_connection_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_process_connection' + LibSuff16;
{ End Of Connection (EOC) bucket }
//AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_eoc;
{
* Determine if a bucket is an End Of Connection (EOC) bucket
* @param e The bucket to inspect
* @return true or false
}
//#define AP_BUCKET_IS_EOC(e) (e->type == &ap_bucket_type_eoc)
{
* Make the bucket passed in an End Of Connection (EOC) bucket
* @param b The bucket to make into an EOC bucket
* @return The new bucket, or NULL if allocation failed
* @deffunc apr_bucket *ap_bucket_eoc_make(apr_bucket *b)
}
function ap_bucket_eoc_make(b: Papr_bucket): Papr_bucket;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_bucket_eoc_make' + LibSuff4;
{
* Create a bucket referring to an End Of Connection (EOC). This indicates
* that the connection will be closed.
* @param list The freelist from which this bucket should be allocated
* @return The new bucket, or NULL if allocation failed
* @deffunc apr_bucket *ap_bucket_eoc_create(apr_bucket_alloc_t *list)
}
function ap_bucket_eoc_create(list: Papr_bucket_alloc_t): Papr_bucket;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_bucket_eoc_create' + LibSuff4;

View File

@ -1,702 +0,0 @@
{ Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
//#include "apr.h"
{$include apr/apr_hash.inc}
{#include "apr_optional.h"}
{$include util_filter.inc}
{#if APR_HAVE_STRUCT_RLIMIT
#include <sys/time.h>
#include <sys/resource.h>
#endif}
{
* @package CORE HTTP Daemon
}
{ ****************************************************************
*
* The most basic server code is encapsulated in a single module
* known as the core, which is just *barely* functional enough to
* serve documents, though not terribly well.
*
* Largely for NCSA back-compatibility reasons, the core needs to
* make pieces of its config structures available to other modules.
* The accessors are declared here, along with the interpretation
* of one of them (allow_options).
}
const
OPT_NONE = 0;
OPT_INDEXES = 1;
OPT_INCLUDES = 2;
OPT_SYM_LINKS = 4;
OPT_EXECCGI = 8;
OPT_UNSET = 16;
OPT_INCNOEXEC = 32;
OPT_SYM_OWNER = 64;
OPT_MULTI = 128;
OPT_ALL = (OPT_INDEXES or OPT_INCLUDES or OPT_SYM_LINKS or OPT_EXECCGI);
{ options for get_remote_host() }
{ REMOTE_HOST returns the hostname, or NULL if the hostname
* lookup fails. It will force a DNS lookup according to the
* HostnameLookups setting.
}
REMOTE_HOST = (0);
{ REMOTE_NAME returns the hostname, or the dotted quad if the
* hostname lookup fails. It will force a DNS lookup according
* to the HostnameLookups setting.
}
REMOTE_NAME = (1);
{ REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
* never forced.
}
REMOTE_NOLOOKUP = (2);
{ REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
* a double reverse lookup, regardless of the HostnameLookups
* setting. The result is the (double reverse checked) hostname,
* or NULL if any of the lookups fail.
}
REMOTE_DOUBLE_REV = (3);
SATISFY_ALL = 0;
SATISFY_ANY = 1;
SATISFY_NOSPEC = 2;
{ Make sure we don't write less than 8000 bytes at any one time.
}
AP_MIN_BYTES_TO_WRITE = 8000;
{ default maximum of internal redirects }
AP_DEFAULT_MAX_INTERNAL_REDIRECTS = 10;
{ default maximum subrequest nesting level }
AP_DEFAULT_MAX_SUBREQ_DEPTH = 10;
{
* Retrieve the value of Options for this request
* @param r The current request
* @return the Options bitmask
* @deffunc int ap_allow_options(request_rec *r)
}
function ap_allow_options(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_allow_options' + LibSuff4;
{
* Retrieve the value of the AllowOverride for this request
* @param r The current request
* @return the overrides bitmask
* @deffunc int ap_allow_overrides(request_rec *r)
}
function ap_allow_overrides(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_allow_overrides' + LibSuff4;
{
* Retrieve the value of the DefaultType directive, or text/plain if not set
* @param r The current request
* @return The default type
* @deffunc const char *ap_default_type(request_rec *r)
}
function ap_default_type(r: Prequest_rec): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_default_type' + LibSuff4;
{
* Retrieve the document root for this server
* @param r The current request
* @warning Don't use this! If your request went through a Userdir, or
* something like that, it'll screw you. But it's back-compatible...
* @return The document root
* @deffunc const char *ap_document_root(request_rec *r)
}
function ap_document_root(r: Prequest_rec): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_document_root' + LibSuff4;
{
* Lookup the remote client's DNS name or IP address
* @param conn The current connection
* @param dir_config The directory config vector from the request
* @param type The type of lookup to perform. One of:
* <pre>
* REMOTE_HOST returns the hostname, or NULL if the hostname
* lookup fails. It will force a DNS lookup according to the
* HostnameLookups setting.
* REMOTE_NAME returns the hostname, or the dotted quad if the
* hostname lookup fails. It will force a DNS lookup according
* to the HostnameLookups setting.
* REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
* never forced.
* REMOTE_DOUBLE_REV will always force a DNS lookup, and also force
* a double reverse lookup, regardless of the HostnameLookups
* setting. The result is the (double reverse checked)
* hostname, or NULL if any of the lookups fail.
* </pre>
* @param str_is_ip unless NULL is passed, this will be set to non-zero on output when an IP address
* string is returned
* @return The remote hostname
* @deffunc const char *ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip)
}
function ap_get_remote_host(conn: Pconn_rec; dir_config: Pointer;
_type: Integer; str_is_ip: PInteger): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_remote_host' + LibSuff16;
{
* Retrieve the login name of the remote user. Undef if it could not be
* determined
* @param r The current request
* @return The user logged in to the client machine
* @deffunc const char *ap_get_remote_logname(request_rec *r)
}
function ap_get_remote_logname(r: Prequest_rec): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_remote_logname' + LibSuff4;
{ Used for constructing self-referencing URLs, and things like SERVER_PORT,
* and SERVER_NAME.
}
{
* build a fully qualified URL from the uri and information in the request rec
* @param p The pool to allocate the URL from
* @param uri The path to the requested file
* @param r The current request
* @return A fully qualified URL
* @deffunc char *ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r)
}
function ap_construct_url(p: Papr_pool_t; const uri: PChar; r: Prequest_rec): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_construct_url' + LibSuff12;
{
* Get the current server name from the request
* @param r The current request
* @return the server name
* @deffunc const char *ap_get_server_name(request_rec *r)
}
function ap_get_server_name(r: Prequest_rec): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_server_name' + LibSuff4;
{
* Get the current server port
* @param The current request
* @return The server's port
* @deffunc apr_port_t ap_get_server_port(const request_rec *r)
}
function ap_get_server_port(r: Prequest_rec): apr_port_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_server_port' + LibSuff4;
{
* Return the limit on bytes in request msg body
* @param r The current request
* @return the maximum number of bytes in the request msg body
* @deffunc apr_off_t ap_get_limit_req_body(const request_rec *r)
}
function ap_get_limit_req_body(r: Prequest_rec): apr_off_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_limit_req_body' + LibSuff4;
{
* Return the limit on bytes in XML request msg body
* @param r The current request
* @return the maximum number of bytes in XML request msg body
* @deffunc size_t ap_get_limit_xml_body(const request_rec *r)
}
function ap_get_limit_xml_body(r: Prequest_rec): size_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_limit_xml_body' + LibSuff4;
{
* Install a custom response handler for a given status
* @param r The current request
* @param status The status for which the custom response should be used
* @param string The custom response. This can be a static string, a file
* or a URL
}
procedure ap_custom_response(r: Prequest_rec; status: Integer; const str: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_custom_response' + LibSuff12;
{
* Check if the current request is beyond the configured max. number of redirects or subrequests
* @param r The current request
* @return true (is exceeded) or false
* @deffunc int ap_is_recursion_limit_exceeded(const request_rec *r)
}
function ap_is_recursion_limit_exceeded(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_is_recursion_limit_exceeded' + LibSuff4;
{
* Check for a definition from the server command line
* @param name The define to check for
* @return 1 if defined, 0 otherwise
* @deffunc int ap_exists_config_define(const char *name)
}
function ap_exists_config_define(name: PChar): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_exists_config_define' + LibSuff4;
{ FIXME! See STATUS about how }
function ap_core_translate(r: Prequest_rec): Integer;
cdecl; external LibHTTPD name 'ap_core_translate';
{ Authentication stuff. This is one of the places where compatibility
* with the old config files *really* hurts; they don't discriminate at
* all between different authentication schemes, meaning that we need
* to maintain common state for all of them in the core, and make it
* available to the other modules through interfaces.
}
{ A structure to keep track of authorization requirements }
type
require_line = record
{ Where the require line is in the config file. }
method_mask: apr_int64_t;
{ The complete string from the command line }
requirement: PChar;
end;
{
* Return the type of authorization required for this request
* @param r The current request
* @return The authorization required
* @deffunc const char *ap_auth_type(request_rec *r)
}
function ap_auth_type(r: Prequest_rec): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_auth_type' + LibSuff4;
{
* Return the current Authorization realm
* @param r The current request
* @return The current authorization realm
* @deffunc const char *ap_auth_name(request_rec *r)
}
function ap_auth_name(r: Prequest_rec): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_auth_name' + LibSuff4;
{
* How the requires lines must be met.
* @param r The current request
* @return How the requirements must be met. One of:
* <pre>
* SATISFY_ANY -- any of the requirements must be met.
* SATISFY_ALL -- all of the requirements must be met.
* SATISFY_NOSPEC -- There are no applicable satisfy lines
* </pre>
* @deffunc int ap_satisfies(request_rec *r)
}
function ap_satisfies(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_satisfies' + LibSuff4;
{
* Retrieve information about all of the requires directives for this request
* @param r The current request
* @return An array of all requires directives for this request
* @deffunc const apr_array_header_t *ap_requires(request_rec *r)
}
function ap_requires(p: Papr_array_header_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_requires' + LibSuff4;
//#ifdef CORE_PRIVATE
{
* Core is also unlike other modules in being implemented in more than
* one file... so, data structures are declared here, even though most of
* the code that cares really is in http_core.c. Also, another accessor.
}
//AP_DECLARE_DATA extern module core_module;
{ Per-request configuration }
type
core_request_config = record
{ bucket brigade used by getline for look-ahead and
* ap_get_client_block for holding left-over request body }
bb: Papr_bucket_brigade;
{ an array of per-request working data elements, accessed
* by ID using ap_get_request_note()
* (Use ap_register_request_note() during initialization
* to add elements)
}
notes: PPointer;
{ There is a script processor installed on the output filter chain,
* so it needs the default_handler to deliver a (script) file into
* the chain so it can process it. Normally, default_handler only
* serves files on a GET request (assuming the file is actual content),
* since other methods are not content-retrieval. This flag overrides
* that behavior, stating that the "content" is actually a script and
* won't actually be delivered as the response for the non-GET method.
}
deliver_script: Integer;
{ Custom response strings registered via ap_custom_response(),
* or NULL; check per-dir config if nothing found here
}
response_code_strings: PPChar; { from ap_custom_response(), not from
* ErrorDocument
}
{ Should addition of charset= be suppressed for this request?
}
suppress_charset: Integer;
end;
{ Standard entries that are guaranteed to be accessible via
* ap_get_request_note() for each request (additional entries
* can be added with ap_register_request_note())
}
const
AP_NOTE_DIRECTORY_WALK = 0;
AP_NOTE_LOCATION_WALK = 1;
AP_NOTE_FILE_WALK = 2;
AP_NUM_STD_NOTES = 3;
{
* Reserve an element in the core_request_config->notes array
* for some application-specific data
* @return An integer key that can be passed to ap_get_request_note()
* during request processing to access this element for the
* current request.
}
function ap_register_request_note: apr_size_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_register_request_note' + LibSuff0;
{
* Retrieve a pointer to an element in the core_request_config->notes array
* @param r The request
* @param note_num A key for the element: either a value obtained from
* ap_register_request_note() or one of the predefined AP_NOTE_*
* values.
* @return NULL if the note_num is invalid, otherwise a pointer to the
* requested note element.
* @remark At the start of a request, each note element is NULL. The
* handle provided by ap_get_request_note() is a pointer-to-pointer
* so that the caller can point the element to some app-specific
* data structure. The caller should guarantee that any such
* structure will last as long as the request itself.
}
function ap_get_request_note(r: Prequest_rec; note_num: apr_size_t): PPointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_request_note' + LibSuff8;
{ Per-directory configuration }
type
allow_options_t = cuchar;
overrides_t = cuchar;
{
* Bits of info that go into making an ETag for a file
* document. Why a long? Because char historically
* proved too short for Options, and int can be different
* sizes on different platforms.
}
etag_components_t = culong;
const
ETAG_UNSET = 0;
ETAG_NONE = (1 shl 0);
ETAG_MTIME = (1 shl 1);
ETAG_INODE = (1 shl 2);
ETAG_SIZE = (1 shl 3);
ETAG_BACKWARD = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
ETAG_ALL = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
{ Hostname resolution etc }
HOSTNAME_LOOKUP_OFF = 0;
HOSTNAME_LOOKUP_ON = 1;
HOSTNAME_LOOKUP_DOUBLE = 2;
OSTNAME_LOOKUP_UNSET = 3;
{ Hostname resolution etc }
USE_CANONICAL_NAME_OFF = (0);
USE_CANONICAL_NAME_ON = (1);
USE_CANONICAL_NAME_DNS = (2);
USE_CANONICAL_NAME_UNSET = (3);
{ should we force a charset on any outgoing parameterless content-type?
* if so, which charset?
}
ADD_DEFAULT_CHARSET_OFF = (0);
ADD_DEFAULT_CHARSET_ON = (1);
ADD_DEFAULT_CHARSET_UNSET = (2);
{
* Run-time performance tuning
}
ENABLE_MMAP_OFF = (0);
ENABLE_MMAP_ON = (1);
ENABLE_MMAP_UNSET = (2);
ENABLE_SENDFILE_OFF = (0);
ENABLE_SENDFILE_ON = (1);
ENABLE_SENDFILE_UNSET = (2);
type
server_signature_e = (
srv_sig_unset,
srv_sig_off,
srv_sig_on,
srv_sig_withmail
);
core_dir_config = record
{ path of the directory/regex/etc. see also d_is_fnmatch/absolute below }
d: PChar;
{ the number of slashes in d }
d_components: Cardinal;
{ If (opts & OPT_UNSET) then no absolute assignment to options has
* been made.
* invariant: (opts_add & opts_remove) == 0
* Which said another way means that the last relative (options + or -)
* assignment made to each bit is recorded in exactly one of opts_add
* or opts_remove.
}
opts: allow_options_t;
opts_add: allow_options_t;
opts_remove: allow_options_t;
override_: overrides_t;
{ MIME typing --- the core doesn't do anything at all with this,
* but it does know what to slap on a request for a document which
* goes untyped by other mechanisms before it slips out the door...
}
ap_default_type: PChar;
{ Authentication stuff. Groan... }
satisfy: PInteger; { for every method one }
ap_auth_type: PChar;
ap_auth_name: PChar;
ap_requires: Papr_array_header_t;
{ Custom response config. These can contain text or a URL to redirect to.
* if response_code_strings is NULL then there are none in the config,
* if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES.
* This lets us do quick merges in merge_core_dir_configs().
}
response_code_strings: PPChar; { from ErrorDocument, not from
* ap_custom_response() }
{ Hostname resolution etc }
{ unsigned int hostname_lookups : 4; }
{ signed int do_rfc1413 : 2; }{ See if client is advertising a username? }
{ signed int content_md5 : 2; }{ calculate Content-MD5? }
{ unsigned use_canonical_name : 2; }
{ since is_fnmatch(conf->d) was being called so frequently in
* directory_walk() and its relatives, this field was created and
* is set to the result of that call.
}
{ unsigned d_is_fnmatch : 1; }
{ should we force a charset on any outgoing parameterless content-type?
* if so, which charset?
}
{ unsigned add_default_charset : 2; }
add_default_charset_name: PChar;
{ System Resource Control }
{$ifdef RLIMIT_CPU}
limit_cpu: Prlimit;
{$endif}
{$if defined(RLIMIT_DATA) or defined (RLIMIT_VMEM) or defined(RLIMIT_AS)}
limit_mem: Prlimit;
{$endif}
{$ifdef RLIMIT_NPROC}
limit_nproc: Prlimit;
{$endif}
limit_req_body: apr_off_t; { limit on bytes in request msg body }
limit_xml_body: cLong; { limit on bytes in XML request msg body }
{ logging options }
server_signature: server_signature_e;
loglevel: Integer;
{ Access control }
sec_file: Papr_array_header_t;
r: Pregex_t;
mime_type: PChar; { forced with ForceType }
handler: PChar; { forced with SetHandler }
output_filters: PChar; { forced with SetOutputFilters }
input_filters: PChar; { forced with SetInputFilters }
accept_path_info: Integer; { forced with AcceptPathInfo }
ct_output_filters: Papr_hash_t; { added with AddOutputFilterByType }
{
* What attributes/data should be included in ETag generation?
}
etag_bits: etag_components_t;
etag_add: etag_components_t;
etag_remove: etag_components_t;
{
* Run-time performance tuning
}
{ unsigned int enable_mmap : 2; }{ whether files in this dir can be mmap'ed }
{ unsigned int enable_sendfile : 2; }{ files in this dir can be mmap'ed }
{ unsigned int allow_encoded_slashes : 1; }{ URLs may contain %2f w/o being
* pitched indiscriminately }
end;
{ Per-server core configuration }
const
{ TRACE control }
AP_TRACE_UNSET = -1;
AP_TRACE_DISABLE = 0;
AP_TRACE_ENABLE = 1;
AP_TRACE_EXTENDED = 2;
type
core_server_config = record
{$ifdef GPROF}
gprof_dir: PChar;
{$endif}
{ Name translations --- we want the core to be able to do *something*
* so it's at least a minimally functional web server on its own (and
* can be tested that way). But let's keep it to the bare minimum:
}
ap_document_root: PChar;
{ Access control }
access_name: PChar;
sec_dir: Papr_array_header_t;
sec_url: Papr_array_header_t;
{ recursion backstopper }
redirect_limit: Integer; { maximum number of internal redirects }
subreq_limit: Integer; { maximum nesting level of subrequests }
{ TRACE control }
trace_enable: Integer;
end;
{ for AddOutputFiltersByType in core.c }
//void ap_add_output_filters_by_type(request_rec *r);
{ for http_config.c }
//void ap_core_reorder_directories(apr_pool_t *, server_rec *);
{ for mod_perl }
{AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config);
AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config);
AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config);
AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg);}
//#endif COREPRIVATE
{ ----------------------------------------------------------------------
*
* Runtime status/management
}
type
ap_mgmt_type_e = (
ap_mgmt_type_string,
ap_mgmt_type_long,
ap_mgmt_type_hash
);
ap_mgmt_value = record
case Integer of
0: (s_value: PChar);
1: (i_value: cLong);
2: (h_value: Papr_hash_t);
end;
ap_mgmt_item_t = record
description: PChar;
name: PChar;
vtype: ap_mgmt_type_e;
v: ap_mgmt_value;
end;
{ Handles for core filters }
{extern AP_DECLARE_DATA ap_filter_rec_t *ap_subreq_core_filter_handle;
extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_output_filter_handle;
extern AP_DECLARE_DATA ap_filter_rec_t *ap_content_length_filter_handle;
extern AP_DECLARE_DATA ap_filter_rec_t *ap_net_time_filter_handle;
extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_input_filter_handle;}
{
* This hook provdes a way for modules to provide metrics/statistics about
* their operational status.
*
* @param p A pool to use to create entries in the hash table
* @param val The name of the parameter(s) that is wanted. This is
* tree-structured would be in the form ('*' is all the tree,
* 'module.*' all of the module , 'module.foo.*', or
* 'module.foo.bar' )
* @param ht The hash table to store the results. Keys are item names, and
* the values point to ap_mgmt_item_t structures.
* @ingroup hooks
}
type
ap_HOOK_get_mgmt_items_t = function(p: Papr_pool_t; const val: PChar;
ht: Papr_hash_t): Integer; cdecl;
procedure ap_hook_get_mgmt_items(pf: ap_HOOK_get_mgmt_items_t;
const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_get_mgmt_items' + LibSuff16;
{ ---------------------------------------------------------------------- }
{ ----------------------------------------------------------------------
*
* I/O logging with mod_logio
}
{APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out,
(conn_rec *c, apr_off_t bytes));}

View File

@ -1,337 +0,0 @@
{ Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
//#include "apr_thread_proc.h"
{
* @package Apache logging library
}
{#ifdef HAVE_SYSLOG
#include <syslog.h>}
const
LOG_PRIMASK = 7;
APLOG_EMERG = 0; { system is unusable }
APLOG_ALERT = 1; { action must be taken immediately }
APLOG_CRIT = 2; { critical conditions }
APLOG_ERR = 3; { error conditions }
APLOG_WARNING = 4; { warning conditions }
APLOG_NOTICE = 5; { normal but significant condition }
APLOG_INFO = 6; { informational }
APLOG_DEBUG = 7; { debug-level messages }
APLOG_LEVELMASK = 7; { mask off the level value }
{ APLOG_NOERRNO is ignored and should not be used. It will be
* removed in a future release of Apache.
}
APLOG_NOERRNO = (APLOG_LEVELMASK + 1);
{ Use APLOG_TOCLIENT on ap_log_rerror() to give content
* handlers the option of including the error text in the
* ErrorDocument sent back to the client. Setting APLOG_TOCLIENT
* will cause the error text to be saved in the request_rec->notes
* table, keyed to the string "error-notes", if and only if:
* - the severity level of the message is APLOG_WARNING or greater
* - there are no other "error-notes" set in request_rec->notes
* Once error-notes is set, it is up to the content handler to
* determine whether this text should be sent back to the client.
* Note: Client generated text streams sent back to the client MUST
* be escaped to prevent CSS attacks.
}
APLOG_TOCLIENT = ((APLOG_LEVELMASK + 1) * 2);
{ normal but significant condition on startup, usually printed to stderr }
APLOG_STARTUP = ((APLOG_LEVELMASK + 1) * 4);
DEFAULT_LOGLEVEL = APLOG_WARNING;
//extern int AP_DECLARE_DATA ap_default_loglevel;
// APLOG_MARK = __FILE__,__LINE__;
{
* Set up for logging to stderr.
* @param p The pool to allocate out of
}
procedure ap_open_stderr_log(p: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_open_stderr_log' + LibSuff4;
{
* Replace logging to stderr with logging to the given file.
* @param p The pool to allocate out of
* @param file Name of the file to log stderr output
}
function ap_replace_stderr_log(p: Papr_pool_t;
file_: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_replace_stderr_log' + LibSuff8;
{
* Open the error log and replace stderr with it.
* @param pconf Not used
* @param plog The pool to allocate the logs from
* @param ptemp Pool used for temporary allocations
* @param s_main The main server
* @tip ap_open_logs isn't expected to be used by modules, it is
* an internal core function
}
{int ap_open_logs(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s_main);}
//#ifdef CORE_PRIVATE
{
* Perform special processing for piped loggers in MPM child
* processes.
* @param p Not used
* @param s Not used
* @tip ap_logs_child_init is not for use by modules; it is an
* internal core function
}
//void ap_logs_child_init(apr_pool_t *p, server_rec *s);
//#endif { CORE_PRIVATE }
{
* The primary logging functions, ap_log_error, ap_log_rerror, ap_log_cerror,
* and ap_log_perror use a printf style format string to build the log message.
* It is VERY IMPORTANT that you not include any raw data from the network,
* such as the request-URI or request header fields, within the format
* string. Doing so makes the server vulnerable to a denial-of-service
* attack and other messy behavior. Instead, use a simple format string
* like "%s", followed by the string containing the untrusted data.
}
{
* ap_log_error() - log messages which are not related to a particular
* request or connection. This uses a printf-like format to log messages
* to the error_log.
* @param file The file in which this function is called
* @param line The line number on which this function is called
* @param level The level of this error message
* @param status The status code from the previous command
* @param s The server on which we are logging
* @param fmt The format string
* @param ... The arguments to use to fill out fmt.
* @tip Use APLOG_MARK to fill out file and line
* @tip If a request_rec is available, use that with ap_log_rerror()
* in preference to calling this function. Otherwise, if a conn_rec is
* available, use that with ap_log_cerror() in preference to calling
* this function.
* @warning It is VERY IMPORTANT that you not include any raw data from
* the network, such as the request-URI or request header fields, within
* the format string. Doing so makes the server vulnerable to a
* denial-of-service attack and other messy behavior. Instead, use a
* simple format string like "%s", followed by the string containing the
* untrusted data.
* @deffunc void ap_log_error(const char *file, int line, int level, apr_status_t status, const server_rec *s, const char *fmt, ...)
}
procedure ap_log_error(
const file_: PChar; line, level: Integer;
status: apr_status_t; const s: Pserver_rec;
const fmt: PChar; others: array of const);
cdecl; external LibHTTPD name 'ap_log_error';
// __attribute__((format(printf,6,7)));
{
* ap_log_perror() - log messages which are not related to a particular
* request, connection, or virtual server. This uses a printf-like
* format to log messages to the error_log.
* @param file The file in which this function is called
* @param line The line number on which this function is called
* @param level The level of this error message
* @param status The status code from the previous command
* @param p The pool which we are logging for
* @param fmt The format string
* @param ... The arguments to use to fill out fmt.
* @tip Use APLOG_MARK to fill out file and line
* @warning It is VERY IMPORTANT that you not include any raw data from
* the network, such as the request-URI or request header fields, within
* the format string. Doing so makes the server vulnerable to a
* denial-of-service attack and other messy behavior. Instead, use a
* simple format string like "%s", followed by the string containing the
* untrusted data.
* @deffunc void ap_log_perror(const char *file, int line, int level, apr_status_t status, apr_pool_t *p, const char *fmt, ...)
}
procedure ap_log_perror(
const file_: PChar; line, level: Integer;
status: apr_status_t; p: Papr_pool_t;
const fmt: PChar; others: array of const);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name 'ap_log_perror';
{ __attribute__((format(printf,6,7)));}
{
* ap_log_rerror() - log messages which are related to a particular
* request. This uses a a printf-like format to log messages to the
* error_log.
* @param file The file in which this function is called
* @param line The line number on which this function is called
* @param level The level of this error message
* @param status The status code from the previous command
* @param r The request which we are logging for
* @param fmt The format string
* @param ... The arguments to use to fill out fmt.
* @tip Use APLOG_MARK to fill out file and line
* @warning It is VERY IMPORTANT that you not include any raw data from
* the network, such as the request-URI or request header fields, within
* the format string. Doing so makes the server vulnerable to a
* denial-of-service attack and other messy behavior. Instead, use a
* simple format string like "%s", followed by the string containing the
* untrusted data.
* @deffunc void ap_log_rerror(const char *file, int line, int level, apr_status_t status, const request_rec *r, const char *fmt, ...)
}
procedure ap_log_rerror(
const file_: PChar; line, level: Integer;
status: apr_status_t; const r: Prequest_rec;
const fmt: PChar; others: array of const);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name 'ap_log_rerror';
{ __attribute__((format(printf,6,7)));}
{
* ap_log_cerror() - log messages which are related to a particular
* connection. This uses a a printf-like format to log messages to the
* error_log.
* @param file The file in which this function is called
* @param line The line number on which this function is called
* @param level The level of this error message
* @param status The status code from the previous command
* @param c The connection which we are logging for
* @param fmt The format string
* @param ... The arguments to use to fill out fmt.
* @tip Use APLOG_MARK to fill out file and line
* @tip If a request_rec is available, use that with ap_log_rerror()
* in preference to calling this function.
* @warning It is VERY IMPORTANT that you not include any raw data from
* the network, such as the request-URI or request header fields, within
* the format string. Doing so makes the server vulnerable to a
* denial-of-service attack and other messy behavior. Instead, use a
* simple format string like "%s", followed by the string containing the
* untrusted data.
* @note ap_log_cerror() is available starting with Apache 2.0.55.
* @deffunc void ap_log_cerror(const char *file, int line, int level, apr_status_t status, const conn_rec *c, const char *fmt, ...)
}
procedure ap_log_cerror(
const file_: PChar; line, level: Integer;
status: apr_status_t; const c: Pconn_rec;
const fmt: PChar; others: array of const);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name 'ap_log_cerror';
{ __attribute__((format(printf,6,7)));}
{
* Convert stderr to the error log
* @param s The current server
* @deffunc void ap_error_log2stderr(server_rec *s)
}
procedure ap_error_log2stderr(s: Pserver_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_error_log2stderr' + LibSuff4;
{
* Log the current pid of the parent process
* @param p The pool to use for logging
* @param fname The name of the file to log to
}
procedure ap_log_pid(p: Papr_pool_t; const fname: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_log_pid' + LibSuff8;
{
* Retrieve the pid from a pidfile.
* @param p The pool to use for logging
* @param filename The name of the file containing the pid
* @param mypid Pointer to pid_t (valid only if return APR_SUCCESS)
}
function ap_read_pid(p: Papr_pool_t; const filename: PChar; mypid: Ppid_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_read_pid' + LibSuff12;
{
* The piped logging structure. Piped logs are used to move functionality
* out of the main server. For example, log rotation is done with piped logs.
}
type
piped_log = record
{ The pool to use for the piped log }
p: Papr_pool_t;
{ The pipe between the server and the logging process }
fds: array[0..2] of Papr_file_t;
{ XXX - an #ifdef that needs to be eliminated from public view. Shouldn't
* be hard }
{$ifdef AP_HAVE_RELIABLE_PIPED_LOGS}
{ The name of the program the logging process is running }
program: PChar;
{ The pid of the logging process }
pid: Papr_proc_t;
{$endif}
end;
Ppiped_log = ^piped_log;
{
* Open the piped log process
* @param p The pool to allocate out of
* @param program The program to run in the logging process
* @return The piped log structure
* @deffunc piped_log *ap_open_piped_log(apr_pool_t *p, const char *program)
}
function ap_open_piped_log(p: Papr_pool_t; const program_: PChar): Ppiped_log;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_open_piped_log' + LibSuff8;
{
* Close the piped log and kill the logging process
* @param pl The piped log structure
* @deffunc void ap_close_piped_log(piped_log *pl)
}
procedure ap_close_piped_log(pl: Ppiped_log);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_close_piped_log' + LibSuff4;
{
* A macro to access the read side of the piped log pipe
* @param pl The piped log structure
* @return The native file descriptor
* @deffunc ap_piped_log_read_fd(pl)
}
//#define ap_piped_log_read_fd(pl) ((pl)->fds[0])
{
* A macro to access the write side of the piped log pipe
* @param pl The piped log structure
* @return The native file descriptor
* @deffunc ap_piped_log_read_fd(pl)
}
//#define ap_piped_log_write_fd(pl) ((pl)->fds[1])
type
ap_HOOK_error_log_t = procedure(const _file: PChar; line: Integer;
level: Integer; status: apr_status_t; const s: Pserver_rec;
const r: Prequest_rec; p: Papr_pool_t; const errstr: PChar); cdecl;
procedure ap_hook_error_log(pf: ap_HOOK_error_log_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_error_log' + LibSuff16;

View File

@ -1,47 +0,0 @@
{ Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
//#include "apr_optional.h"
{ AP_SERVER_BASEARGS is the command argument list parsed by http_main.c
* in apr_getopt() format. Use this for default'ing args that the MPM
* can safely ignore and pass on from its rewrite_args() handler.
}
const
AP_SERVER_BASEARGS = 'C:c:D:d:E:e:f:vVlLtSh?X';
{
* @package Command line options
}
{ The name of the Apache executable }
//AP_DECLARE_DATA extern const char *ap_server_argv0;
{ The global server's ServerRoot }
//AP_DECLARE_DATA extern const char *ap_server_root;
{ for -C, -c and -D switches }
{ An array of all -C directives. These are processed before the server's
* config file }
//AP_DECLARE_DATA extern apr_array_header_t *ap_server_pre_read_config;
{ An array of all -c directives. These are processed after the server's
* config file }
//AP_DECLARE_DATA extern apr_array_header_t *ap_server_post_read_config;
{ An array of all -D defines on the command line. This allows people to
* effect the server based on command line options }
//AP_DECLARE_DATA extern apr_array_header_t *ap_server_config_defines;
//APR_DECLARE_OPTIONAL_FN(int, ap_signal_server, (int *, apr_pool_t *));

View File

@ -1,829 +0,0 @@
{ Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{#include "httpd.h"
#include "apr_hooks.h"
#include "apr_portable.h"
#include "apr_mmap.h"
#include "apr_buckets.h"
#include "util_filter.h"}
{
* @package HTTP protocol handling
}
{
* This hook allows modules to insert filters for the current error response
* @param r the current request
* @ingroup hooks
}
type
ap_HOOK_insert_error_filter_t = procedure(r: Prequest_rec); cdecl;
procedure ap_hook_insert_error_filter(pf: ap_HOOK_insert_error_filter_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_insert_error_filter' + LibSuff16;
{ This is an optimization. We keep a record of the filter_rec that
* stores the old_write filter, so that we can avoid strcmp's later.
}
//AP_DECLARE_DATA extern ap_filter_rec_t *ap_old_write_func;
{
* Prototypes for routines which either talk directly back to the user,
* or control the ones that eventually do.
}
{
* Read a request and fill in the fields.
* @param c The current connection
* @return The new request_rec
}
//request_rec *ap_read_request(conn_rec *c);
{
* Read the mime-encoded headers.
* @param r The current request
}
procedure ap_get_mime_headers(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_mime_headers' + LibSuff4;
{
* Optimized version of ap_get_mime_headers() that requires a
* temporary brigade to work with
* @param r The current request
* @param bb temp brigade
}
procedure ap_get_mime_headers_core(r: Prequest_rec; bb: Papr_bucket_brigade);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_mime_headers_core' + LibSuff8;
{ Finish up stuff after a request }
{
* Called at completion of sending the response. It sends the terminating
* protocol information.
* @param r The current request
* @deffunc void ap_finalize_request_protocol(request_rec *r)
}
procedure ap_finalize_request_protocol(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_finalize_request_protocol' + LibSuff4;
{
* Send error back to client.
* @param r The current request
* @param recursive_error last arg indicates error status in case we get
* an error in the process of trying to deal with an ErrorDocument
* to handle some other error. In that case, we print the default
* report for the first thing that went wrong, and more briefly report
* on the problem with the ErrorDocument.
* @deffunc void ap_send_error_response(request_rec *r, int recursive_error)
}
procedure ap_send_error_response(r: Prequest_rec; recursive_error: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_send_error_response' + LibSuff8;
{ Set last modified header line from the lastmod date of the associated file.
* Also, set content length.
*
* May return an error status, typically HTTP_NOT_MODIFIED (that when the
* permit_cache argument is set to one).
}
{
* Set the content length for this request
* @param r The current request
* @param length The new content length
* @deffunc void ap_set_content_length(request_rec *r, apr_off_t length)
}
procedure ap_set_content_length(r: Prequest_rec; length: apr_off_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_set_content_length' + LibSuff12;
{
* Set the keepalive status for this request
* @param r The current request
* @return 1 if keepalive can be set, 0 otherwise
* @deffunc int ap_set_keepalive(request_rec *r)
}
function ap_set_keepalive(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_set_keepalive' + LibSuff4;
{
* Return the latest rational time from a request/mtime pair. Mtime is
* returned unless it's in the future, in which case we return the current time.
* @param r The current request
* @param mtime The last modified time
* @return the latest rational time.
* @deffunc apr_time_t ap_rationalize_mtime(request_rec *r, apr_time_t mtime)
}
function ap_rationalize_mtime(r: Prequest_rec; mtime: apr_time_t): apr_time_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_rationalize_mtime' + LibSuff12;
{
* Build the content-type that should be sent to the client from the
* content-type specified. The following rules are followed:
* - if type is NULL, type is set to ap_default_type(r)
* - if charset adding is disabled, stop processing and return type.
* - then, if there are no parameters on type, add the default charset
* - return type
* @param r The current request
* @return The content-type
* @deffunc const char *ap_make_content_type(request_rec *r, const char *type);
}
function ap_make_content_type(r: Prequest_rec; type_: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_make_content_type' + LibSuff8;
//#ifdef CORE_PRIVATE
{
* Precompile metadata structures used by ap_make_content_type()
* @param r The pool to use for allocations
* @deffunc void ap_setup_make_content_type(apr_pool_t *pool)
}
procedure ap_setup_make_content_type(pool: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_setup_make_content_type' + LibSuff4;
//#endif { CORE_PRIVATE }
{
* Construct an entity tag from the resource information. If it's a real
* file, build in some of the file characteristics.
* @param r The current request
* @param force_weak Force the entity tag to be weak - it could be modified
* again in as short an interval.
* @return The entity tag
* @deffunc char *ap_make_etag(request_rec *r, int force_weak)
}
function ap_make_etag(r: Prequest_rec; force_weak: Integer): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_make_etag' + LibSuff8;
{
* Set the E-tag outgoing header
* @param The current request
* @deffunc void ap_set_etag(request_rec *r)
}
procedure ap_set_etag(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_set_etag' + LibSuff4;
{
* Set the last modified time for the file being sent
* @param r The current request
* @deffunc void ap_set_last_modified(request_rec *r)
}
procedure ap_set_last_modified(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_set_last_modified' + LibSuff4;
{
* Implements condition GET rules for HTTP/1.1 specification. This function
* inspects the client headers and determines if the response fulfills
* the requirements specified.
* @param r The current request
* @return OK if the response fulfills the condition GET rules, some
* other status code otherwise
* @deffunc int ap_meets_conditions(request_rec *r)
}
function ap_meets_conditions(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_meets_conditions' + LibSuff4;
{ Other ways to send stuff at the client. All of these keep track
* of bytes_sent automatically. This indirection is intended to make
* it a little more painless to slide things like HTTP-NG packetization
* underneath the main body of the code later. In the meantime, it lets
* us centralize a bit of accounting (bytes_sent).
*
* These also return the number of bytes written by the call.
* They should only be called with a timeout registered, for obvious reaasons.
* (Ditto the send_header stuff).
}
{
* Send an entire file to the client, using sendfile if supported by the
* current platform
* @param fd The file to send.
* @param r The current request
* @param offset Offset into the file to start sending.
* @param length Amount of data to send
* @param nbytes Amount of data actually sent
* @deffunc apr_status_t ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t offset, apr_size_t length, apr_size_t *nbytes);
}
function ap_send_fd(fd: Papr_file_t; r: Prequest_rec; offset: apr_off_t;
length: apr_size_t; nbytes: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_send_fd' + LibSuff24;
{$ifdef APR_HAS_MMAP}
{
* Send an MMAP'ed file to the client
* @param mm The MMAP'ed file to send
* @param r The current request
* @param offset The offset into the MMAP to start sending
* @param length The amount of data to send
* @return The number of bytes sent
* @deffunc size_t ap_send_mmap(apr_mmap_t *mm, request_rec *r, size_t offset, size_t length)
}
function ap_send_mmap(mm: Papr_mmap_t; r: Prequest_rec; offset, length: size_t): size_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_send_mmap' + LibSuff20;
{$endif}
{
* Register a new request method, and return the offset that will be
* associated with that method.
*
* @param p The pool to create registered method numbers from.
* @param methname The name of the new method to register.
* @return Ab int value representing an offset into a bitmask.
}
function ap_method_register(p: Papr_pool_t; methname: PChar): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_method_register' + LibSuff8;
{
* Initialize the method_registry and allocate memory for it.
*
* @param p Pool to allocate memory for the registry from.
}
procedure ap_method_registry_init(p: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_method_registry_init' + LibSuff4;
{
* This is a convenience macro to ease with checking a mask
* against a method name.
}
{#define AP_METHOD_CHECK_ALLOWED(mask, methname) \
((mask) & (AP_METHOD_BIT << ap_method_number_of((methname))))}
{
* Create a new method list with the specified number of preallocated
* slots for extension methods.
*
* @param p Pointer to a pool in which the structure should be
* allocated.
* @param nelts Number of preallocated extension slots
* @return Pointer to the newly created structure.
* @deffunc ap_method_list_t ap_make_method_list(apr_pool_t *p, int nelts)
}
function ap_make_method_list(p: Papr_pool_t; nelts: Integer): Pap_method_list_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_make_method_list' + LibSuff8;
procedure ap_copy_method_list(dest, src: Pap_method_list_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_copy_method_list' + LibSuff8;
type
comp_t = procedure (urec: Pointer; const mname: PChar; mnum: Integer);
procedure ap_method_list_do(
comp: comp_t; rec: Pointer; ml: Pap_method_list_t; others: array of const);
cdecl; external LibHTTPD name 'ap_method_list_do';
type
ap_method_list_vdo_t = function (urec: Pointer; const mname: PChar;
mnum: Integer): Integer; cdecl;
procedure ap_method_list_vdo(comp: ap_method_list_vdo_t;
rec: Pointer; const ml: Pap_method_list_t; cp: va_list);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_method_list_vdo' + LibSuff16;
{
* Search for an HTTP method name in an ap_method_list_t structure, and
* return true if found.
*
* @param method String containing the name of the method to check.
* @param l Pointer to a method list, such as cmd->methods_limited.
* @return 1 if method is in the list, otherwise 0
* @deffunc int ap_method_in_list(const char *method, ap_method_list_t *l)
}
function ap_method_in_list(l: Pap_method_list_t; const method: PChar): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_method_in_list' + LibSuff8;
{
* Add an HTTP method name to an ap_method_list_t structure if it isn't
* already listed.
*
* @param method String containing the name of the method to check.
* @param l Pointer to a method list, such as cmd->methods_limited.
* @return None.
* @deffunc void ap_method_in_list(ap_method_list_t *l, const char *method)
}
procedure ap_method_list_add(l: Pap_method_list_t; const method: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_method_list_add' + LibSuff8;
{
* Remove an HTTP method name from an ap_method_list_t structure.
*
* @param l Pointer to a method list, such as cmd->methods_limited.
* @param method String containing the name of the method to remove.
* @return None.
* @deffunc void ap_method_list_remove(ap_method_list_t *l, const char *method)
}
procedure ap_method_list_remove(l: Pap_method_list_t; const method: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_method_list_remove' + LibSuff8;
{
* Reset a method list to be completely empty.
*
* @param l Pointer to a method list, such as cmd->methods_limited.
* @return None.
* @deffunc void ap_clear_method_list(ap_method_list_t *l)
}
procedure ap_clear_method_list(l: Pap_method_list_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_clear_method_list' + LibSuff4;
{
* Set the content type for this request (r->content_type).
* @param r The current request
* @param ct The new content type
* @deffunc void ap_set_content_type(request_rec *r, const char* ct)
* @warning This function must be called to set r->content_type in order
* for the AddOutputFilterByType directive to work correctly.
}
procedure ap_set_content_type(r: Prequest_rec; const ct: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_set_content_type' + LibSuff8;
{ Hmmm... could macrofy these for now, and maybe forever, though the
* definitions of the macros would get a whole lot hairier.
}
{
* Output one character for this request
* @param c the character to output
* @param r the current request
* @return The number of bytes sent
* @deffunc int ap_rputc(int c, request_rec *r)
}
function ap_rputc(c: Integer; r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_rputc' + LibSuff8;
{
* Output a string for the current request
* @param str The string to output
* @param r The current request
* @return The number of bytes sent
* @deffunc int ap_rputs(const char *str, request_rec *r)
}
function ap_rputs(const str: PChar; r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_rputs' + LibSuff8;
{
* Write a buffer for the current request
* @param buf The buffer to write
* @param nbyte The number of bytes to send from the buffer
* @param r The current request
* @return The number of bytes sent
* @deffunc int ap_rwrite(const void *buf, int nbyte, request_rec *r)
}
function ap_rwrite(const buf: Pointer; nbyte: Integer; r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_rwrite' + LibSuff12;
{
* Write an unspecified number of strings to the request
* @param r The current request
* @param ... The strings to write
* @return The number of bytes sent
* @deffunc int ap_rvputs(request_rec *r, ...)
}
function ap_rvputs(r: Prequest_rec; others: array of const): Integer;
cdecl; external LibHTTPD name 'ap_rvputs';
//AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r,...);
{
* Output data to the client in a printf format
* @param r The current request
* @param fmt The format string
* @param vlist The arguments to use to fill out the format string
* @return The number of bytes sent
* @deffunc int ap_vrprintf(request_rec *r, const char *fmt, va_list vlist)
}
function ap_vrprintf(r: Prequest_rec; const fmt: PChar; vlist: va_list): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_vrprintf' + LibSuff12;
{
* Output data to the client in a printf format
* @param r The current request
* @param fmt The format string
* @param ... The arguments to use to fill out the format string
* @return The number of bytes sent
* @deffunc int ap_rprintf(request_rec *r, const char *fmt, ...)
}
function ap_rprintf(r: Prequest_rec; const fmt: PChar; others: array of const): Integer;
cdecl; external LibHTTPD name 'ap_rprintf';
//AP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...)
// __attribute__((format(printf,2,3)));
{
* Flush all of the data for the current request to the client
* @param r The current request
* @return The number of bytes sent
* @deffunc int ap_rflush(request_rec *r)
}
function ap_rflush(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_rflush' + LibSuff4;
{
* Index used in custom_responses array for a specific error code
* (only use outside protocol.c is in getting them configured).
* @param status HTTP status code
* @return The index of the response
* @deffunc int ap_index_of_response(int status)
}
function ap_index_of_response(status: Integer): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_index_of_response' + LibSuff4;
{
* Return the Status-Line for a given status code (excluding the
* HTTP-Version field). If an invalid or unknown status code is
* passed, "500 Internal Server Error" will be returned.
* @param status The HTTP status code
* @return The Status-Line
* @deffunc const char *ap_get_status_line(int status)
}
function ap_get_status_line(status: Integer): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_status_line' + LibSuff4;
{ Reading a block of data from the client connection (e.g., POST arg) }
{
* Setup the client to allow Apache to read the request body.
* @param r The current request
* @param read_policy How the server should interpret a chunked
* transfer-encoding. One of: <pre>
* REQUEST_NO_BODY Send 413 error if message has any body
* REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length
* REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me.
* </pre>
* @return either OK or an error code
* @deffunc int ap_setup_client_block(request_rec *r, int read_policy)
}
function ap_setup_client_block(r: Prequest_rec; read_policy: Integer): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_setup_client_block' + LibSuff8;
{
* Determine if the client has sent any data. This also sends a
* 100 Continue response to HTTP/1.1 clients, so modules should not be called
* until the module is ready to read content.
* @warning Never call this function more than once.
* @param r The current request
* @return 0 if there is no message to read, 1 otherwise
* @deffunc int ap_should_client_block(request_rec *r)
}
function ap_should_client_block(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_should_client_block' + LibSuff4;
{
* Call this in a loop. It will put data into a buffer and return the length
* of the input block
* @param r The current request
* @param buffer The buffer in which to store the data
* @param bufsiz The size of the buffer
* @return Number of bytes inserted into the buffer. When done reading, 0
* if EOF, or -1 if there was an error
* @deffunc long ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz)
}
function ap_get_client_block(r: Prequest_rec; buffer: PChar; bufsiz: apr_size_t): cLong;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_client_block' + LibSuff12;
{
* In HTTP/1.1, any method can have a body. However, most GET handlers
* wouldn't know what to do with a request body if they received one.
* This helper routine tests for and reads any message body in the request,
* simply discarding whatever it receives. We need to do this because
* failing to read the request body would cause it to be interpreted
* as the next request on a persistent connection.
* @param r The current request
* @return error status if request is malformed, OK otherwise
* @deffunc int ap_discard_request_body(request_rec *r)
}
function ap_discard_request_body(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_discard_request_body' + LibSuff4;
{
* Setup the output headers so that the client knows how to authenticate
* itself the next time, if an authentication request failed. This function
* works for both basic and digest authentication
* @param r The current request
* @deffunc void ap_note_auth_failure(request_rec *r)
}
procedure ap_note_auth_failure(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_note_auth_failure' + LibSuff4;
{
* Setup the output headers so that the client knows how to authenticate
* itself the next time, if an authentication request failed. This function
* works only for basic authentication
* @param r The current request
* @deffunc void ap_note_basic_auth_failure(request_rec *r)
}
procedure ap_note_basic_auth_failure(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_note_basic_auth_failure' + LibSuff4;
{
* Setup the output headers so that the client knows how to authenticate
* itself the next time, if an authentication request failed. This function
* works only for digest authentication
* @param r The current request
* @deffunc void ap_note_digest_auth_failure(request_rec *r)
}
procedure ap_note_digest_auth_failure(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_note_digest_auth_failure' + LibSuff4;
{
* Get the password from the request headers
* @param r The current request
* @param pw The password as set in the headers
* @return 0 (OK) if it set the 'pw' argument (and assured
* a correct value in r->user); otherwise it returns
* an error code, either HTTP_INTERNAL_SERVER_ERROR if things are
* really confused, HTTP_UNAUTHORIZED if no authentication at all
* seemed to be in use, or DECLINED if there was authentication but
* it wasn't Basic (in which case, the caller should presumably
* decline as well).
* @deffunc int ap_get_basic_auth_pw(request_rec *r, const char **pw)
}
function ap_get_basic_auth_pw(r: Prequest_rec; pw: PPChar): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_basic_auth_pw' + LibSuff8;
{
* parse_uri: break apart the uri
* @warning Side Effects: <pre>
* - sets r->args to rest after '?' (or NULL if no '?')
* - sets r->uri to request uri (without r->args part)
* - sets r->hostname (if not set already) from request (scheme://host:port)
* </pre>
* @param r The current request
* @param uri The uri to break apart
* @deffunc void ap_parse_uri(request_rec *r, const char *uri)
}
procedure ap_parse_uri(r: Prequest_rec; const uri: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_parse_uri' + LibSuff8;
{
* Get the next line of input for the request
* @param s The buffer into which to read the line
* @param n The size of the buffer
* @param r The request
* @param fold Whether to merge continuation lines
* @return The length of the line, if successful
* n, if the line is too big to fit in the buffer
* -1 for miscellaneous errors
* @deffunc int ap_method_number_of(const char *method)
}
function ap_getline(s: PChar; n: Integer; r: Prequest_rec; fold: Integer): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_getline' + LibSuff16;
{
* Get the next line of input for the request
*
* Note: on ASCII boxes, ap_rgetline is a macro which simply calls
* ap_rgetline_core to get the line of input.
*
* on EBCDIC boxes, ap_rgetline is a wrapper function which
* translates ASCII protocol lines to the local EBCDIC code page
* after getting the line of input.
*
* @param s Pointer to the pointer to the buffer into which the line
* should be read; if *s==NULL, a buffer of the necessary size
* to hold the data will be allocated from the request pool
* @param n The size of the buffer
* @param read The length of the line.
* @param r The request
* @param fold Whether to merge continuation lines
* @param bb Working brigade to use when reading buckets
* @return APR_SUCCESS, if successful
* APR_ENOSPC, if the line is too big to fit in the buffer
* Other errors where appropriate
}
{#if APR_CHARSET_EBCDIC
AP_DECLARE(apr_status_t) ap_rgetline(char **s, apr_size_t n,
apr_size_t *read,
request_rec *r, int fold,
apr_bucket_brigade *bb);
#else }{ ASCII box }
{#define ap_rgetline(s, n, read, r, fold, bb) \
ap_rgetline_core((s), (n), (read), (r), (fold), (bb))
#endif}
{AP_DECLARE(apr_status_t) ap_rgetline_core(char **s, apr_size_t n,
apr_size_t *read,
request_rec *r, int fold,
apr_bucket_brigade *bb);}
{
* Get the method number associated with the given string, assumed to
* contain an HTTP method. Returns M_INVALID if not recognized.
* @param method A string containing a valid HTTP method
* @return The method number
}
function ap_method_number_of(const method: PChar): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_method_number_of' + LibSuff4;
{
* Get the method name associated with the given internal method
* number. Returns NULL if not recognized.
* @param p A pool to use for temporary allocations.
* @param methnum An integer value corresponding to an internal method number
* @return The name corresponding to the method number
}
function ap_method_name_of(p: Papr_pool_t; methnum: Integer): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_method_name_of' + LibSuff8;
{ Hooks }
{
* post_read_request --- run right after read_request or internal_redirect,
* and not run during any subrequests.
}
{
* This hook allows modules to affect the request immediately after the request
* has been read, and before any other phases have been processes. This allows
* modules to make decisions based upon the input header fields
* @param r The current request
* @return OK or DECLINED
* @deffunc ap_run_post_read_request(request_rec *r)
}
type
ap_HOOK_post_read_request_t = function(r: Prequest_rec): Integer; cdecl;
procedure ap_hook_post_read_request(pf: ap_HOOK_post_read_request_t;
const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_post_read_request' + LibSuff16;
{
* This hook allows modules to perform any module-specific logging activities
* over and above the normal server things.
* @param r The current request
* @return OK, DECLINED, or HTTP_...
* @deffunc int ap_run_log_transaction(request_rec *r)
}
type
ap_HOOK_log_transaction_t = function(r: Prequest_rec): Integer; cdecl;
procedure ap_hook_log_transaction(pf: ap_HOOK_log_transaction_t;
const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_log_transaction' + LibSuff16;
{
* This hook allows modules to retrieve the http method from a request. This
* allows Apache modules to easily extend the methods that Apache understands
* @param r The current request
* @return The http method from the request
* @deffunc const char *ap_run_http_method(const request_rec *r)
}
type
ap_HOOK_http_method_t = function(const r: Prequest_rec): PChar; cdecl;
procedure ap_hook_http_method(pf: ap_HOOK_http_method_t;
const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_http_method' + LibSuff16;
{
* Return the default port from the current request
* @param r The current request
* @return The current port
* @deffunc apr_port_t ap_run_default_port(const request_rec *r)
}
type
ap_HOOK_default_port_t = function(const r: Prequest_rec): apr_port_t; cdecl;
procedure ap_hook_default_port(pf: ap_HOOK_default_port_t;
const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_default_port' + LibSuff16;
{
* A bucket referring to an HTTP error
* This bucket can be passed down the filter stack to indicate that an
* HTTP error occurred while running a filter. In order for this bucket
* to be used successfully, it MUST be sent as the first bucket in the
* first brigade to be sent from a given filter.
}
type
ap_bucket_error = record
{ Number of buckets using this memory }
refcount: apr_bucket_refcount;
{ The error code }
status: Integer;
{ The error string }
data: PChar;
end;
Pap_bucket_error = ^ap_bucket_error;
//AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_error;
{
* Determine if a bucket is an error bucket
* @param e The bucket to inspect
* @return true or false
}
//#define AP_BUCKET_IS_ERROR(e) (e->type == &ap_bucket_type_error)
{
* Make the bucket passed in an error bucket
* @param b The bucket to make into an error bucket
* @param error The HTTP error code to put in the bucket.
* @param buf An optional error string to put in the bucket.
* @param p A pool to allocate out of.
* @return The new bucket, or NULL if allocation failed
* @deffunc apr_bucket *ap_bucket_error_make(apr_bucket *b, int error, const char *buf, apr_pool_t *p)
}
function ap_bucket_error_make(b: Papr_bucket; error: Integer;
const buf: PChar; p: Papr_pool_t): Papr_bucket;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_bucket_error_make' + LibSuff16;
{
* Create a bucket referring to an HTTP error.
* @param error The HTTP error code to put in the bucket.
* @param buf An optional error string to put in the bucket.
* @param p A pool to allocate the error string out of.
* @param list The bucket allocator from which to allocate the bucket
* @return The new bucket, or NULL if allocation failed
* @deffunc apr_bucket *ap_bucket_error_create(int error, const char *buf, apr_pool_t *p, apr_bucket_alloc_t *list)
}
function ap_bucket_error_create(error: Integer; const buf: PChar;
p: Papr_pool_t; list: Papr_bucket_alloc_t): Papr_bucket;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_bucket_error_create' + LibSuff16;
function ap_byterange_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t;
cdecl; external LibHTTPD name 'ap_byterange_filter';
function ap_http_header_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t;
cdecl; external LibHTTPD name 'ap_http_header_filter';
function ap_content_length_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t;
cdecl; external LibHTTPD name 'ap_content_length_filter';
function ap_old_write_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t;
cdecl; external LibHTTPD name 'ap_old_write_filter';
{
* Setting up the protocol fields for subsidiary requests...
* Also, a wrapup function to keep the internal accounting straight.
}
procedure ap_set_sub_req_protocol(rnew: Prequest_rec; const r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_set_sub_req_protocol' + LibSuff8;
procedure ap_finalize_sub_req_protocol(sub_r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_finalize_sub_req_protocol' + LibSuff4;

View File

@ -1,460 +0,0 @@
{ Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{#include "apr_hooks.h"
#include "util_filter.h"}
const
AP_SUBREQ_NO_ARGS = 0;
AP_SUBREQ_MERGE_ARGS = 1;
{
* @file http_request.h
* @brief Apache Request library
}
{ http_request.c is the code which handles the main line of request
* processing, once a request has been read in (finding the right per-
* directory configuration, building it if necessary, and calling all
* the module dispatch functions in the right order).
*
* The pieces here which are public to the modules, allow them to learn
* how the server would handle some other file or URI, or perhaps even
* direct the server to serve that other file instead of the one the
* client requested directly.
*
* There are two ways to do that. The first is the sub_request mechanism,
* which handles looking up files and URIs as adjuncts to some other
* request (e.g., directory entries for multiviews and directory listings);
* the lookup functions stop short of actually running the request, but
* (e.g., for includes), a module may call for the request to be run
* by calling run_sub_req. The space allocated to create sub_reqs can be
* reclaimed by calling destroy_sub_req --- be sure to copy anything you care
* about which was allocated in its apr_pool_t elsewhere before doing this.
}
{
* An internal handler used by the ap_process_request, all subrequest mechanisms
* and the redirect mechanism.
* @param r The request, subrequest or internal redirect to pre-process
* @return The return code for the request
}
function ap_process_request_internal(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_process_request_internal' + LibSuff4;
{
* Create a subrequest from the given URI. This subrequest can be
* inspected to find information about the requested URI
* @param new_uri The URI to lookup
* @param r The current request
* @param next_filter The first filter the sub_request should use. If this is
* NULL, it defaults to the first filter for the main request
* @return The new request record
* @deffunc request_rec * ap_sub_req_lookup_uri(const char *new_uri, const request_rec *r)
}
function ap_sub_req_lookup_uri(const new_uri: PChar;
const r: Prequest_rec; next_filter: Pap_filter_t): Prequest_rec;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_sub_req_lookup_uri' + LibSuff12;
{
* Create a subrequest for the given file. This subrequest can be
* inspected to find information about the requested file
* @param new_file The file to lookup
* @param r The current request
* @param next_filter The first filter the sub_request should use. If this is
* NULL, it defaults to the first filter for the main request
* @return The new request record
* @deffunc request_rec * ap_sub_req_lookup_file(const char *new_file, const request_rec *r)
}
function ap_sub_req_lookup_file(const new_file: PChar;
const r: Prequest_rec; next_filter: Pap_filter_t): Prequest_rec;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_sub_req_lookup_file' + LibSuff12;
{
* Create a subrequest for the given apr_dir_read result. This subrequest
* can be inspected to find information about the requested file
* @param finfo The apr_dir_read result to lookup
* @param r The current request
* @param subtype What type of subrequest to perform, one of;
* <PRE>
* AP_SUBREQ_NO_ARGS ignore r->args and r->path_info
* AP_SUBREQ_MERGE_ARGS merge r->args and r->path_info
* </PRE>
* @param next_filter The first filter the sub_request should use. If this is
* NULL, it defaults to the first filter for the main request
* @return The new request record
* @deffunc request_rec * ap_sub_req_lookup_dirent(apr_finfo_t *finfo, int subtype, const request_rec *r)
* @tip The apr_dir_read flags value APR_FINFO_MIN|APR_FINFO_NAME flag is the
* minimum recommended query if the results will be passed to apr_dir_read.
* The file info passed must include the name, and must have the same relative
* directory as the current request.
}
function ap_sub_req_lookup_dirent(const finfo: Papr_finfo_t;
const r: Prequest_rec; subtype: Integer; next_filter: Pap_filter_t): Prequest_rec;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_sub_req_lookup_dirent' + LibSuff16;
{
* Create a subrequest for the given URI using a specific method. This
* subrequest can be inspected to find information about the requested URI
* @param method The method to use in the new subrequest
* @param new_uri The URI to lookup
* @param r The current request
* @param next_filter The first filter the sub_request should use. If this is
* NULL, it defaults to the first filter for the main request
* @return The new request record
* @deffunc request_rec * ap_sub_req_method_uri(const char *method, const char *new_uri, const request_rec *r)
}
function ap_sub_req_method_uri(const method, new_uri: PChar;
const r: Prequest_rec; next_filter: Pap_filter_t): Prequest_rec;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_sub_req_method_uri' + LibSuff16;
{
* An output filter to strip EOS buckets from sub-requests. This always
* has to be inserted at the end of a sub-requests filter stack.
* @param f The current filter
* @param bb The brigade to filter
* @deffunc apr_status_t ap_sub_req_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
}
function ap_sub_req_output_filter(f: Pap_filter_t;
bb: Papr_bucket_brigade): apr_status_t;
cdecl; external LibHTTPD name 'ap_sub_req_output_filter';
{
* Run the handler for the subrequest
* @param r The subrequest to run
* @return The return code for the subrequest
* @deffunc int ap_run_sub_req(request_rec *r)
}
function ap_run_sub_req(r: Prequest_rec): Prequest_rec;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_run_sub_req' + LibSuff4;
{
* Free the memory associated with a subrequest
* @param r The subrequest to finish
* @deffunc void ap_destroy_sub_req(request_rec *r)
}
procedure ap_destroy_sub_req(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_destroy_sub_req' + LibSuff4;
{
* Then there's the case that you want some other request to be served
* as the top-level request INSTEAD of what the client requested directly.
* If so, call this from a handler, and then immediately return OK.
}
{
* Redirect the current request to some other uri
* @param new_uri The URI to replace the current request with
* @param r The current request
* @deffunc void ap_internal_redirect(const char *new_uri, request_rec *r)
}
procedure ap_internal_redirect(const new_uri: PChar; r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_internal_redirect' + LibSuff8;
{
* This function is designed for things like actions or CGI scripts, when
* using AddHandler, and you want to preserve the content type across
* an internal redirect.
* @param new_uri The URI to replace the current request with.
* @param r The current request
* @deffunc void ap_internal_redirect_handler(const char *new_uri, request_rec *r)
}
procedure ap_internal_redirect_handler(const new_uri: PChar; r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_internal_redirect_handler' + LibSuff8;
{
* Redirect the current request to a sub_req, merging the pools
* @param sub_req A subrequest created from this request
* @param r The current request
* @deffunc void ap_internal_fast_redirect(request_rec *sub_req, request_rec *r)
* @tip the sub_req's pool will be merged into r's pool, be very careful
* not to destroy this subrequest, it will be destroyed with the main request!
}
procedure ap_internal_fast_redirect(sub_req, r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_internal_fast_redirect' + LibSuff8;
{
* Can be used within any handler to determine if any authentication
* is required for the current request
* @param r The current request
* @return 1 if authentication is required, 0 otherwise
* @deffunc int ap_some_auth_required(request_rec *r)
}
function ap_some_auth_required(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_some_auth_required' + LibSuff4;
{
* Determine if the current request is the main request or a subrequest
* @param r The current request
* @return 1 if this is the main request, 0 otherwise
* @deffunc int ap_is_initial_req(request_rec *r)
}
function ap_is_initial_req(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_is_initial_req' + LibSuff4;
{
* Function to set the r->mtime field to the specified value if it's later
* than what's already there.
* @param r The current request
* @param dependency_time Time to set the mtime to
* @deffunc void ap_update_mtime(request_rec *r, apr_time_t dependency_mtime)
}
procedure ap_update_mtime(r: Prequest_rec; dependency_mtime: apr_time_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_update_mtime' + LibSuff12;
{
* Add one or more methods to the list permitted to access the resource.
* Usually executed by the content handler before the response header is
* sent, but sometimes invoked at an earlier phase if a module knows it
* can set the list authoritatively. Note that the methods are ADDED
* to any already permitted unless the reset flag is non-zero. The
* list is used to generate the Allow response header field when it
* is needed.
* @param r The pointer to the request identifying the resource.
* @param reset Boolean flag indicating whether this list should
* completely replace any current settings.
* @param ... A NULL-terminated list of strings, each identifying a
* method name to add.
* @return None.
* @deffunc void ap_allow_methods(request_rec *r, int reset, ...)
}
procedure ap_allow_methods(r: Prequest_rec; reset: Integer; others: array of const);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name 'ap_allow_methods';
//AP_DECLARE(void) (request_rec *r, int reset, ...);
{
* Add one or more methods to the list permitted to access the resource.
* Usually executed by the content handler before the response header is
* sent, but sometimes invoked at an earlier phase if a module knows it
* can set the list authoritatively. Note that the methods are ADDED
* to any already permitted unless the reset flag is non-zero. The
* list is used to generate the Allow response header field when it
* is needed.
* @param r The pointer to the request identifying the resource.
* @param reset Boolean flag indicating whether this list should
* completely replace any current settings.
* @param ... A list of method identifiers, from the "M_" series
* defined in httpd.h, terminated with a value of -1
* (e.g., "M_GET, M_POST, M_OPTIONS, -1")
* @return None.
* @deffunc void ap_allow_standard_methods(request_rec *r, int reset, ...)
}
procedure ap_allow_standard_methods(r: Prequest_rec; reset: Integer; others: array of const);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name 'ap_allow_standard_methods';
//AP_DECLARE(void) (request_rec *r, int reset, ...);
const
MERGE_ALLOW = 0;
REPLACE_ALLOW = 1;
//#ifdef CORE_PRIVATE
{ Function called by main.c to handle first-level request }
//void ap_process_request(request_rec *);
{
* Kill the current request
* @param type Why the request is dieing
* @param r The current request
* @deffunc void ap_die(int type, request_rec *r)
}
procedure ap_die(type_: Integer; r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_die' + LibSuff8;
//#endif COREPRIVATE
{ Hooks }
{
* Gives modules a chance to create their request_config entry when the
* request is created.
* @param r The current request
* @ingroup hooks
}
type
ap_HOOK_create_request_t = function (r: Prequest_rec): Integer; cdecl;
procedure ap_hook_create_request(pf: ap_HOOK_create_request_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_create_request' + LibSuff16;
{
* This hook allow modules an opportunity to translate the URI into an
* actual filename. If no modules do anything special, the server's default
* rules will be followed.
* @param r The current request
* @return OK, DECLINED, or HTTP_...
* @ingroup hooks
}
type
ap_HOOK_translate_name_t = function (r: Prequest_rec): Integer; cdecl;
procedure ap_hook_translate_name(pf: ap_HOOK_translate_name_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_translate_name' + LibSuff16;
{
* This hook allow modules to set the per_dir_config based on their own
* context (such as <Proxy > sections) and responds to contextless requests
* such as TRACE that need no security or filesystem mapping.
* based on the filesystem.
* @param r The current request
* @return DONE (or HTTP_) if this contextless request was just fulfilled
* (such as TRACE), OK if this is not a file, and DECLINED if this is a file.
* The core map_to_storage (HOOK_RUN_REALLY_LAST) will directory_walk
* and file_walk the r->filename.
*
* @ingroup hooks
}
type
ap_HOOK_map_to_storage_t = function (r: Prequest_rec): Integer; cdecl;
procedure ap_hook_map_to_storage(pf: ap_HOOK_map_to_storage_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_map_to_storage' + LibSuff16;
{
* This hook is used to analyze the request headers, authenticate the user,
* and set the user information in the request record (r->user and
* r->ap_auth_type). This hook is only run when Apache determines that
* authentication/authorization is required for this resource (as determined
* by the 'Require' directive). It runs after the access_checker hook, and
* before the auth_checker hook.
*
* @param r The current request
* @return OK, DECLINED, or HTTP_...
* @ingroup hooks
}
type
ap_HOOK_check_user_id_t = function (r: Prequest_rec): Integer; cdecl;
procedure ap_hook_check_user_id(pf: ap_HOOK_check_user_id_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_check_user_id' + LibSuff16;
{
* Allows modules to perform module-specific fixing of header fields. This
* is invoked just before any content-handler
* @param r The current request
* @return OK, DECLINED, or HTTP_...
* @ingroup hooks
}
type
ap_HOOK_fixups_t = function (r: Prequest_rec): Integer; cdecl;
procedure ap_hook_fixups(pf: ap_HOOK_fixups_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_fixups' + LibSuff16;
{
* This routine is called to determine and/or set the various document type
* information bits, like Content-type (via r->content_type), language, et
* cetera.
* @param r the current request
* @return OK, DECLINED, or HTTP_...
* @ingroup hooks
}
type
ap_HOOK_type_checker_t = function (r: Prequest_rec): Integer; cdecl;
procedure ap_hook_type_checker(pf: ap_HOOK_type_checker_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_type_checker' + LibSuff16;
{
* This hook is used to apply additional access control to this resource.
* It runs *before* a user is authenticated, so this hook is really to
* apply additional restrictions independent of a user. It also runs
* independent of 'Require' directive usage.
*
* @param r the current request
* @return OK, DECLINED, or HTTP_...
* @ingroup hooks
}
type
ap_HOOK_access_checker_t = function (r: Prequest_rec): Integer; cdecl;
procedure ap_hook_access_checker(pf: ap_HOOK_access_checker_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_access_checker' + LibSuff16;
{
* This hook is used to check to see if the resource being requested
* is available for the authenticated user (r->user and r->ap_auth_type).
* It runs after the access_checker and check_user_id hooks. Note that
* it will *only* be called if Apache determines that access control has
* been applied to this resource (through a 'Require' directive).
*
* @param r the current request
* @return OK, DECLINED, or HTTP_...
* @ingroup hooks
}
type
ap_HOOK_auth_checker_t = function (r: Prequest_rec): Integer; cdecl;
procedure ap_hook_auth_checker(pf: ap_HOOK_auth_checker_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_auth_checker' + LibSuff16;
{
* This hook allows modules to insert filters for the current request
* @param r the current request
* @ingroup hooks
}
type
ap_HOOK_insert_filter_t = procedure (r: Prequest_rec); cdecl;
procedure ap_hook_insert_filter(pf: ap_HOOK_insert_filter_t; const aszPre: PPChar;
const aszSucc: PPChar; nOrder: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_hook_insert_filter' + LibSuff16;
function ap_location_walk(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_location_walk' + LibSuff4;
function ap_directory_walk(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_directory_walk' + LibSuff4;
function ap_file_walk(r: Prequest_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_file_walk' + LibSuff4;

View File

@ -1,83 +0,0 @@
{ Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @package Virtual Host package
}
{
* called before any config is read
* @param p Pool to allocate out of
}
procedure ap_init_vhost_config(p: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_init_vhost_config' + LibSuff4;
{
* called after the config has been read to compile the tables needed to do
* the run-time vhost lookups
* @param p The pool to allocate out of
* @param main_server The start of the virtual host list
* @deffunc ap_fini_vhost_config(apr_pool_t *p, server_rec *main_server)
}
procedure ap_fini_vhost_config(p: Papr_pool_t; main_server: Pserver_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_fini_vhost_config' + LibSuff8;
{
* handle addresses in <VirtualHost> statement
* @param p The pool to allocate out of
* @param hostname The hostname in the VirtualHost statement
* @param s The list of Virtual Hosts.
}
//const char *ap_parse_vhost_addrs(apr_pool_t *p, const char *hostname, server_rec *s);
{ handle NameVirtualHost directive }
//const char *ap_set_name_virtual_host (cmd_parms *cmd, void *dummy,
// const char *arg);
{
* given an ip address only, give our best guess as to what vhost it is
* @param conn The current connection
}
procedure ap_update_vhost_given_ip(conn: Pconn_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_update_vhost_given_ip' + LibSuff4;
{
* ap_update_vhost_given_ip is never enough, and this is always called after
* the headers have been read. It may change r->server.
* @param r The current request
}
procedure ap_update_vhost_from_headers(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_update_vhost_from_headers' + LibSuff4;
{
* Match the host in the header with the hostname of the server for this
* request.
* @param r The current request
* @param host The hostname in the headers
* @param port The port from the headers
* @return return 1 if the host:port matches any of the aliases of r->server,
* return 0 otherwise
* @deffunc int ap_matches_request_vhost(request_rec *r, const char *host, apr_port_t port)
}
function ap_matches_request_vhost(r: Prequest_rec; const host: PChar;
port: apr_port_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_matches_request_vhost' + LibSuff12;

File diff suppressed because it is too large Load Diff

View File

@ -1,170 +0,0 @@
{
httpd.pas
Copyright (C) 2006 Felipe Monteiro de Carvalho
This unit is a pascal binding for the Apache 2.0.58 headers.
The headers were released under the following copyright:
}
{ Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
unit httpd;
{$ifdef fpc}
{$mode delphi}{$H+}
{$endif}
{$IFNDEF FPC}
{$DEFINE WINDOWS}
{$ENDIF}
{$IFDEF WIN32}
{$DEFINE WINDOWS}
{$ENDIF}
{$ifdef Unix}
{$PACKRECORDS C}
{$endif}
{$define Apache2_0}
interface
uses
{$ifdef WINDOWS}
Windows,
{$ELSE}
UnixType,
{$ENDIF}
apr, aprutil, ctypes;
const
{$ifndef fpc}
LineEnding = #13#10;
{$endif}
{$IFDEF WINDOWS}
LibHTTPD = 'libhttpd.dll';
{$ELSE}
LibHTTPD = '';
{$ENDIF}
{ Declarations moved here to be on top of all declarations }
{ configuration vector structure }
type
ap_conf_vector_t = record end;
Pap_conf_vector_t = ^ap_conf_vector_t;
PPap_conf_vector_t = ^Pap_conf_vector_t;
{
Main httpd header files
Note: There are more include files other then these, because some include files
include more files.
}
{$include ap_provider.inc}
{$include util_cfgtree.inc}
{$include httpd.inc}
{$include http_config.inc}
{$include http_core.inc}
{$include http_log.inc}
{$include http_main.inc}
{$include http_protocol.inc}
{$include http_request.inc}
{$include http_connection.inc}
{$include http_vhost.inc}
{$include util_script.inc}
{$include util_time.inc}
{$include util_md5.inc}
{$include ap_mpm.inc}
implementation
{
Macros transformed into functions in the translation
}
{ from httpd.inc }
{ Internal representation for a HTTP protocol number, e.g., HTTP/1.1 }
function HTTP_VERSION(major, minor: Integer): Integer;
begin
Result := (1000*(major)+(minor));
end;
{ Major part of HTTP protocol }
function HTTP_VERSION_MAJOR(number: Integer): Integer;
begin
Result := number div 1000;
end;
{ Minor part of HTTP protocol }
function HTTP_VERSION_MINOR(number: Integer): Integer;
begin
Result := number mod 1000;
end;
function ap_escape_uri(p: Papr_pool_t; const path: PChar): PChar;
begin
Result := ap_os_escape_path(p, path, 1);
end;
{ from http_config.inc }
{ Use this in all standard modules }
procedure STANDARD20_MODULE_STUFF(var mod_: module);
begin
mod_.version := MODULE_MAGIC_NUMBER_MAJOR;
mod_.minor_version := MODULE_MAGIC_NUMBER_MINOR;
mod_.module_index := -1;
// mod_.name: PChar;
mod_.dynamic_load_handle := nil;
mod_.next := nil;
mod_.magic := MODULE_MAGIC_COOKIE;
mod_.rewrite_args := nil;
end;
{ Use this only in MPMs }
procedure MPM20_MODULE_STUFF(var mod_: module);
begin
mod_.version := MODULE_MAGIC_NUMBER_MAJOR;
mod_.minor_version := MODULE_MAGIC_NUMBER_MINOR;
mod_.module_index := -1;
// mod_.name: PChar;
mod_.dynamic_load_handle := nil;
mod_.next := nil;
mod_.magic := MODULE_MAGIC_COOKIE;
end;
function ap_get_module_config(v: Pap_conf_vector_t; m: Pmodule): Pap_conf_vector_t;
begin
Result := Pointer(Integer(v) + m^.module_index);
end;
procedure ap_set_module_config(v: Pap_conf_vector_t; m: Pmodule; val: Pap_conf_vector_t);
var
P: PPointer;
begin
P := PPointer(Integer(v) + m^.module_index);
P^ := val;
end;
end.

View File

@ -1,85 +0,0 @@
{*************************************************
* Perl-Compatible Regular Expressions *
*************************************************}
{ Copyright (c) 1997-2000 University of Cambridge }
{
* @file include/pcreposix.h
* @brief PCRE definitions
}
{ This is the header for the POSIX wrapper interface to the PCRE Perl-
Compatible Regular Expression library. It defines the things POSIX says should
be there. I hope. }
{ Have to include stdlib.h in order to ensure that size_t is defined. }
{ Options defined by POSIX. }
const
{ Ignore case }
REG_ICASE = $01;
{ Don't match newlines with wildcards }
REG_NEWLINE = $02;
{ Don't match BOL }
REG_NOTBOL = $04;
{ Don't match EOL }
REG_NOTEOL = $08;
{ These are not used by PCRE, but by defining them we make it easier
to slot PCRE into existing programs that make POSIX calls. }
{ UNUSED! }
REG_EXTENDED = 0;
{ UNUSED! }
REG_NOSUB = 0;
{ Error values. Not all these are relevant or used by the wrapper. }
type
pc_error = (
REG_ASSERT = 1, { internal error ? }
REG_BADBR, { invalid repeat counts in } {}
REG_BADPAT, { pattern error }
REG_BADRPT, { ? * + invalid }
REG_EBRACE, { unbalanced } {}
REG_EBRACK, { unbalanced [] }
REG_ECOLLATE, { collation error - not relevant }
REG_ECTYPE, { bad class }
REG_EESCAPE, { bad escape sequence }
REG_EMPTY, { empty expression }
REG_EPAREN, { unbalanced () }
REG_ERANGE, { bad range inside [] }
REG_ESIZE, { expression too big }
REG_ESPACE, { failed to get memory }
REG_ESUBREG, { bad back reference }
REG_INVARG, { bad argument }
REG_NOMATCH { match failed }
);
{ The structure representing a compiled regular expression. }
regex_t = record
re_pcre: Pointer;
re_nsub, re_erroffset: size_t;
end;
Pregex_t = ^regex_t;
{ The structure in which a captured offset is returned. }
regoff_t = Integer;
regmatch_t = record
rm_so, rm_eo: regoff_t;
end;
{ The functions }
{extern int regcomp(regex_t *, const char *, int);
extern int regexec(regex_t *, const char *, size_t, regmatch_t *, int);
extern size_t regerror(int, const regex_t *, char *, size_t);
extern void regfree(regex_t *);}

View File

@ -1,77 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
//#include "ap_config.h"
{
* @package Config Tree Package
}
type
Pap_directive_t = ^ap_directive_t;
PPap_directive_t = ^Pap_directive_t;
{
* Structure used to build the config tree. The config tree only stores
* the directives that will be active in the running server. Directives
* that contain other directions, such as <Directory ...> cause a sub-level
* to be created, where the included directives are stored. The closing
* directive (</Directory>) is not stored in the tree.
}
ap_directive_t = record
{ The current directive }
directive: PChar;
{ The arguments for the current directive, stored as a space
* separated list }
args: PChar;
{ The next directive node in the tree
* @defvar ap_directive_t *next }
next: Pap_directive_t;
{ The first child node of this directive
* @defvar ap_directive_t *first_child }
first_child: Pap_directive_t;
{ The parent node of this directive
* @defvar ap_directive_t *parent }
parent: Pap_directive_t;
{ directive's module can store add'l data here }
data: Pointer;
{ ### these may go away in the future, but are needed for now }
{ The name of the file this directive was found in }
filename: PChar;
{ The line number the directive was on }
line_num: Integer;
end;
{
* The root of the configuration tree
* @defvar ap_directive_t *conftree
}
//AP_DECLARE_DATA extern ap_directive_t *ap_conftree;
{
* Add a node to the configuration tree.
* @param parent The current parent node. If the added node is a first_child,
then this is changed to the current node
* @param current The current node
* @param toadd The node to add to the tree
* @param child Is the node to add a child node
* @return the added node
}
//ap_directive_t *ap_add_node(ap_directive_t **parent, ap_directive_t *current,
// ap_directive_t *toadd, int child);

View File

@ -1,523 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{#include "apr.h"
#include "apr_buckets.h"
#include "httpd.h"
#if APR_HAVE_STDARG_H
#include <stdarg.h>
#endif}
{
* @file util_filter.h
* @brief Apache filter library
}
const
{ Returned by the bottom-most filter if no data was written.
* @see ap_pass_brigade(). }
AP_NOBODY_WROTE = -1;
{ Returned by the bottom-most filter if no data was read.
* @see ap_get_brigade(). }
AP_NOBODY_READ = -2;
{ Returned when?? @bug find out when! }
AP_FILTER_ERROR = -3;
{
* input filtering modes
}
type
ap_input_mode_t = (
{ The filter should return at most readbytes data. }
AP_MODE_READBYTES,
{ The filter should return at most one line of CRLF data.
* (If a potential line is too long or no CRLF is found, the
* filter may return partial data).
}
AP_MODE_GETLINE,
{ The filter should implicitly eat any CRLF pairs that it sees. }
AP_MODE_EATCRLF,
{ The filter read should be treated as speculative and any returned
* data should be stored for later retrieval in another mode. }
AP_MODE_SPECULATIVE,
{ The filter read should be exhaustive and read until it can not
* read any more.
* Use this mode with extreme caution.
}
AP_MODE_EXHAUSTIVE,
{ The filter should initialize the connection if needed,
* NNTP or FTP over SSL for example.
}
AP_MODE_INIT
);
{
* @defgroup filter FILTER CHAIN
*
* Filters operate using a "chaining" mechanism. The filters are chained
* together into a sequence. When output is generated, it is passed through
* each of the filters on this chain, until it reaches the end (or "bottom")
* and is placed onto the network.
*
* The top of the chain, the code generating the output, is typically called
* a "content generator." The content generator's output is fed into the
* filter chain using the standard Apache output mechanisms: ap_rputs(),
* ap_rprintf(), ap_rwrite(), etc.
*
* Each filter is defined by a callback. This callback takes the output from
* the previous filter (or the content generator if there is no previous
* filter), operates on it, and passes the result to the next filter in the
* chain. This pass-off is performed using the ap_fc_* functions, such as
* ap_fc_puts(), ap_fc_printf(), ap_fc_write(), etc.
*
* When content generation is complete, the system will pass an "end of
* stream" marker into the filter chain. The filters will use this to flush
* out any internal state and to detect incomplete syntax (for example, an
* unterminated SSI directive).
}
{ forward declare the filter type }
Pap_filter_t = ^ap_filter_t;
{
* @name Filter callbacks
*
* This function type is used for filter callbacks. It will be passed a
* pointer to "this" filter, and a "bucket" containing the content to be
* filtered.
*
* In filter->ctx, the callback will find its context. This context is
* provided here, so that a filter may be installed multiple times, each
* receiving its own per-install context pointer.
*
* Callbacks are associated with a filter definition, which is specified
* by name. See ap_register_input_filter() and ap_register_output_filter()
* for setting the association between a name for a filter and its
* associated callback (and other information).
*
* If the initialization function argument passed to the registration
* functions is non-NULL, it will be called iff the filter is in the input
* or output filter chains and before any data is generated to allow the
* filter to prepare for processing.
*
* The *bucket structure (and all those referenced by ->next and ->prev)
* should be considered "const". The filter is allowed to modify the
* next/prev to insert/remove/replace elements in the bucket list, but
* the types and values of the individual buckets should not be altered.
*
* For the input and output filters, the return value of a filter should be
* an APR status value. For the init function, the return value should
* be an HTTP error code or OK if it was successful.
*
* @ingroup filter
}
ap_out_filter_func = function (f: Pap_filter_t;
b: Papr_bucket_brigade): apr_status_t;
ap_in_filter_func = function (f: Pap_filter_t;
b: Papr_bucket_brigade; mode: ap_input_mode_t;
block: apr_read_type_e; readbytes: apr_off_t): apr_status_t;
ap_init_filter_func = function (f: Pap_filter_t): Integer;
ap_filter_func = record
Case Integer of
0: (out_func: ap_out_filter_func);
1: (in_func: ap_in_filter_func);
end;
{
* Filters have different types/classifications. These are used to group
* and sort the filters to properly sequence their operation.
*
* The types have a particular sort order, which allows us to insert them
* into the filter chain in a determistic order. Within a particular grouping,
* the ordering is equivalent to the order of calls to ap_add_*_filter().
}
ap_filter_type = (
{ These filters are used to alter the content that is passed through
* them. Examples are SSI or PHP. }
AP_FTYPE_RESOURCE = 10,
{ These filters are used to alter the content as a whole, but after all
* AP_FTYPE_RESOURCE filters are executed. These filters should not
* change the content-type. An example is deflate. }
AP_FTYPE_CONTENT_SET = 20,
{ These filters are used to handle the protocol between server and
* client. Examples are HTTP and POP. }
AP_FTYPE_PROTOCOL = 30,
{ These filters implement transport encodings (e.g., chunking). }
AP_FTYPE_TRANSCODE = 40,
{ These filters will alter the content, but in ways that are
* more strongly associated with the connection. Examples are
* splitting an HTTP connection into multiple requests and
* buffering HTTP responses across multiple requests.
*
* It is important to note that these types of filters are not
* allowed in a sub-request. A sub-request's output can certainly
* be filtered by ::AP_FTYPE_RESOURCE filters, but all of the "final
* processing" is determined by the main request. }
AP_FTYPE_CONNECTION = 50,
{ These filters don't alter the content. They are responsible for
* sending/receiving data to/from the client. }
AP_FTYPE_NETWORK = 60
);
{
* This is the request-time context structure for an installed filter (in
* the output filter chain). It provides the callback to use for filtering,
* the request this filter is associated with (which is important when
* an output chain also includes sub-request filters), the context for this
* installed filter, and the filter ordering/chaining fields.
*
* Filter callbacks are free to use ->ctx as they please, to store context
* during the filter process. Generally, this is superior over associating
* the state directly with the request. A callback should not change any of
* the other fields.
}
Pap_filter_rec_t = ^ap_filter_rec_t;
{
* This structure is used for recording information about the
* registered filters. It associates a name with the filter's callback
* and filter type.
*
* At the moment, these are simply linked in a chain, so a ->next pointer
* is available.
}
ap_filter_rec_t = record
{ The registered name for this filter }
name: PChar;
{ The function to call when this filter is invoked. }
filter_func: ap_filter_func;
{ The function to call before the handlers are invoked. Notice
* that this function is called only for filters participating in
* the http protocol. Filters for other protocols are to be
* initiliazed by the protocols themselves. }
filter_init_func: ap_init_filter_func;
{ The type of filter, either AP_FTYPE_CONTENT or AP_FTYPE_CONNECTION.
* An AP_FTYPE_CONTENT filter modifies the data based on information
* found in the content. An AP_FTYPE_CONNECTION filter modifies the
* data based on the type of connection.
}
ftype: ap_filter_type;
{ The next filter_rec in the list }
next: Pap_filter_rec_t;
end;
{
* The representation of a filter chain. Each request has a list
* of these structures which are called in turn to filter the data. Sub
* requests get an exact copy of the main requests filter chain.
}
ap_filter_t = record
{ The internal representation of this filter. This includes
* the filter's name, type, and the actual function pointer.
}
frec: Pap_filter_rec_t;
{ A place to store any data associated with the current filter }
ctx: Pointer;
{ The next filter in the chain }
next: Pap_filter_t;
{ The request_rec associated with the current filter. If a sub-request
* adds filters, then the sub-request is the request associated with the
* filter.
}
r: Prequest_rec;
{ The conn_rec associated with the current filter. This is analogous
* to the request_rec, except that it is used for input filtering.
}
c: Pconn_rec;
end;
{
* Get the current bucket brigade from the next filter on the filter
* stack. The filter returns an apr_status_t value. If the bottom-most
* filter doesn't read from the network, then ::AP_NOBODY_READ is returned.
* The bucket brigade will be empty when there is nothing left to get.
* @param filter The next filter in the chain
* @param bucket The current bucket brigade. The original brigade passed
* to ap_get_brigade() must be empty.
* @param mode The way in which the data should be read
* @param block How the operations should be performed
* ::APR_BLOCK_READ, ::APR_NONBLOCK_READ
* @param readbytes How many bytes to read from the next filter.
}
function ap_get_brigade(filter: Pap_filter_t;
bucket: Papr_bucket_brigade; mode: ap_input_mode_t;
block: apr_read_type_e; readbytes: apr_off_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_brigade' + LibSuff24;
{
* Pass the current bucket brigade down to the next filter on the filter
* stack. The filter returns an apr_status_t value. If the bottom-most
* filter doesn't write to the network, then ::AP_NOBODY_WROTE is returned.
* The caller relinquishes ownership of the brigade.
* @param filter The next filter in the chain
* @param bucket The current bucket brigade
}
function ap_pass_brigade(filter: Pap_filter_t;
bucket: Papr_bucket_brigade): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_pass_brigade' + LibSuff8;
{
* This function is used to register an input filter with the system.
* After this registration is performed, then a filter may be added
* into the filter chain by using ap_add_input_filter() and simply
* specifying the name.
*
* @param name The name to attach to the filter function
* @param filter_func The filter function to name
* @param filter_init The function to call before the filter handlers
are invoked
* @param ftype The type of filter function, either ::AP_FTYPE_CONTENT or
* ::AP_FTYPE_CONNECTION
* @see add_input_filter()
}
function ap_register_input_filter(const name: PChar;
filter_func: ap_in_filter_func; filter_init: ap_init_filter_func;
ftype: ap_filter_type): Pap_filter_rec_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_register_input_filter' + LibSuff16;
{
* This function is used to register an output filter with the system.
* After this registration is performed, then a filter may be added
* into the filter chain by using ap_add_output_filter() and simply
* specifying the name.
*
* @param name The name to attach to the filter function
* @param filter_func The filter function to name
* @param filter_init The function to call before the filter handlers
* are invoked
* @param ftype The type of filter function, either ::AP_FTYPE_CONTENT or
* ::AP_FTYPE_CONNECTION
* @see ap_add_output_filter()
}
function ap_register_output_filter(const name: PChar;
filter_func: ap_out_filter_func; filter_init: ap_init_filter_func;
ftype: ap_filter_type): Pap_filter_rec_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_register_output_filter' + LibSuff16;
{
* Adds a named filter into the filter chain on the specified request record.
* The filter will be installed with the specified context pointer.
*
* Filters added in this way will always be placed at the end of the filters
* that have the same type (thus, the filters have the same order as the
* calls to ap_add_filter). If the current filter chain contains filters
* from another request, then this filter will be added before those other
* filters.
*
* To re-iterate that last comment. This function is building a FIFO
* list of filters. Take note of that when adding your filter to the chain.
*
* @param name The name of the filter to add
* @param ctx Context data to provide to the filter
* @param r The request to add this filter for (or NULL if it isn't associated with a request)
* @param c The connection to add the fillter for
}
function ap_add_input_filter(const name: PChar; ctx: Pointer;
r: Prequest_rec; c: Pconn_rec): Pap_filter_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_add_input_filter' + LibSuff16;
{
* Variant of ap_add_input_filter() that accepts a registered filter handle
* (as returned by ap_register_input_filter()) rather than a filter name
*
* @param f The filter handle to add
* @param ctx Context data to provide to the filter
* @param r The request to add this filter for (or NULL if it isn't associated with a request)
* @param c The connection to add the fillter for
}
function ap_add_input_filter_handle(f: Pap_filter_t;
ctx: Pointer; r: Prequest_rec; c: Pconn_rec): Pap_filter_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_add_input_filter_handle' + LibSuff16;
{
* Returns the filter handle for use with ap_add_input_filter_handle.
*
* @param name The filter name to look up
}
function ap_get_input_filter_handle(const name: PChar): Pap_filter_rec_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_input_filter_handle' + LibSuff4;
{
* Add a filter to the current request. Filters are added in a FIFO manner.
* The first filter added will be the first filter called.
* @param name The name of the filter to add
* @param ctx Context data to set in the filter
* @param r The request to add this filter for (or NULL if it isn't associated with a request)
* @param c The connection to add this filter for
}
function ap_add_output_filter(const name: PChar; ctx: Pointer;
r: Prequest_rec; c: Pconn_rec): Pap_filter_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_add_output_filter' + LibSuff16;
{
* Variant of ap_add_output_filter() that accepts a registered filter handle
* (as returned by ap_register_output_filter()) rather than a filter name
*
* @param f The filter handle to add
* @param r The request to add this filter for (or NULL if it isn't associated with a request)
* @param c The connection to add the fillter for
}
function ap_add_output_filter_handle(f: Pap_filter_rec_t;
ctx: Pointer; r: Prequest_rec; c: Pconn_rec): Pap_filter_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_add_output_filter_handle' + LibSuff16;
{
* Returns the filter handle for use with ap_add_output_filter_handle.
*
* @param name The filter name to look up
}
function ap_get_output_filter_handle(const name: PChar): Pap_filter_rec_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_get_output_filter_handle' + LibSuff4;
{
* Remove an input filter from either the request or connection stack
* it is associated with.
* @param f The filter to remove
}
procedure ap_remove_input_filter(f: Pap_filter_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_remove_input_filter' + LibSuff4;
{
* Remove an output filter from either the request or connection stack
* it is associated with.
* @param f The filter to remove
}
procedure ap_remove_output_filter(f: Pap_filter_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_remove_output_filter' + LibSuff4;
{ The next two filters are for abstraction purposes only. They could be
* done away with, but that would require that we break modules if we ever
* want to change our filter registration method. The basic idea, is that
* all filters have a place to store data, the ctx pointer. These functions
* fill out that pointer with a bucket brigade, and retrieve that data on
* the next call. The nice thing about these functions, is that they
* automatically concatenate the bucket brigades together for you. This means
* that if you have already stored a brigade in the filters ctx pointer, then
* when you add more it will be tacked onto the end of that brigade. When
* you retrieve data, if you pass in a bucket brigade to the get function,
* it will append the current brigade onto the one that you are retrieving.
}
{
* prepare a bucket brigade to be setaside. If a different brigade was
* set-aside earlier, then the two brigades are concatenated together.
* @param f The current filter
* @param save_to The brigade that was previously set-aside. Regardless, the
* new bucket brigade is returned in this location.
* @param b The bucket brigade to save aside. This brigade is always empty
* on return
* @param p Ensure that all data in the brigade lives as long as this pool
}
function ap_save_brigade(f: Pap_filter_t;
save_to, b: PPapr_bucket_brigade; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_save_brigade' + LibSuff16;
{
* Flush function for apr_brigade_* calls. This calls ap_pass_brigade
* to flush the brigade if the brigade buffer overflows.
* @param bb The brigade to flush
* @param ctx The filter to pass the brigade to
* @note this function has nothing to do with FLUSH buckets. It is simply
* a way to flush content out of a brigade and down a filter stack.
}
{AP_DECLARE_NONSTD(apr_status_t) ap_filter_flush(apr_bucket_brigade *bb,
void *ctx);}
{
* Flush the current brigade down the filter stack.
* @param f The current filter
* @param bb The brigade to flush
}
function ap_fflush(f: Pap_filter_t; bb: Papr_bucket_brigade): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_fflush' + LibSuff8;
{
* Write a buffer for the current filter, buffering if possible.
* @param f the filter doing the writing
* @param bb The brigade to buffer into
* @param data The data to write
* @param nbyte The number of bytes in the data
}
{#define ap_fwrite(f, bb, data, nbyte) \
apr_brigade_write(bb, ap_filter_flush, f, data, nbyte)}
{
* Write a buffer for the current filter, buffering if possible.
* @param f the filter doing the writing
* @param bb The brigade to buffer into
* @param str The string to write
}
{#define ap_fputs(f, bb, str) \
apr_brigade_puts(bb, ap_filter_flush, f, str)}
{
* Write a character for the current filter, buffering if possible.
* @param f the filter doing the writing
* @param bb The brigade to buffer into
* @param c The character to write
}
{#define ap_fputc(f, bb, c) \
apr_brigade_putc(bb, ap_filter_flush, f, c)}
{
* Write an unspecified number of strings to the current filter
* @param f the filter doing the writing
* @param bb The brigade to buffer into
* @param ... The strings to write
}
function ap_fputstrs(f: Pap_filter_t; bb: Papr_bucket_brigade;
others: array of const): apr_status_t;
cdecl; external LibHTTPD name 'ap_fputstrs';
{
* Output data to the filter in printf format
* @param f the filter doing the writing
* @param bb The brigade to buffer into
* @param fmt The format string
* @param ... The argumets to use to fill out the format string
}
function ap_fprintf(f: Pap_filter_t; bb: Papr_bucket_brigade;
const fmt: PChar; others: array of const): apr_status_t;
cdecl; external LibHTTPD name 'ap_fputstrs';
{ __attribute__((format(printf,3,4)));}

View File

@ -1,66 +0,0 @@
{ Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @package Apache MD5 library
}
//#include "apr_md5.h"
{
* Create an MD5 checksum of a given string
* @param a Pool to allocate out of
* @param string String to get the checksum of
* @return The checksum
* @deffunc char *ap_md5(apr_pool_t *a, const unsigned char *string)
}
function ap_md5(p: Papr_pool_t; const string_: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_md5' + LibSuff8;
{
* Create an MD5 checksum of a string of binary data
* @param a Pool to allocate out of
* @param buf Buffer to generate checksum for
* @param len The length of the buffer
* @return The checksum
* @deffunc char *ap_md5_binary(apr_pool_t *a, const unsigned char *buf, int len)
}
function ap_md5_binary(a: Papr_pool_t; const buf: PChar; len: Integer): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_md5_binary' + LibSuff12;
{
* Convert an MD5 checksum into a base64 encoding
* @param p The pool to allocate out of
* @param context The context to convert
* @return The converted encoding
* @deffunc char *ap_md5contextTo64(apr_pool_t *p, apr_md5_ctx_t *context)
}
function ap_md5contextTo64(a: Papr_pool_t; context: Papr_md5_ctx_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_md5contextTo64' + LibSuff8;
{
* Create an MD5 Digest for a given file
* @param p The pool to allocate out of
* @param infile The file to create the digest for
* @deffunc char *ap_md5digest(apr_pool_t *p, apr_file_t *infile)
}
function ap_md5digest(p: Papr_pool_t; infile: Papr_file_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_md5digest' + LibSuff8;

View File

@ -1,140 +0,0 @@
{ Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
//#include "apr_buckets.h"
{
* @package Apache script tools
}
const
APACHE_ARG_MAX = 512;
{
* Create an environment variable out of an Apache table of key-value pairs
* @param p pool to allocate out of
* @param t Apache table of key-value pairs
* @return An array containing the same key-value pairs suitable for
* use with an exec call.
* @deffunc char **ap_create_environment(apr_pool_t *p, apr_table_t *t)
}
function ap_create_environment(p: Papr_pool_t; t: Papr_table_t): PPChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_create_environment' + LibSuff8;
{
* This "cute" little function comes about because the path info on
* filenames and URLs aren't always the same. So we take the two,
* and find as much of the two that match as possible.
* @param uri The uri we are currently parsing
* @param path_info The current path info
* @return The length of the path info
* @deffunc int ap_find_path_info(const char *uri, const char *path_info)
}
function ap_find_path_info(const uri, path_info: PChar): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_find_path_info' + LibSuff8;
{
* Add CGI environment variables required by HTTP/1.1 to the request's
* environment table
* @param r the current request
* @deffunc void ap_add_cgi_vars(request_rec *r)
}
procedure ap_add_cgi_vars(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_add_cgi_vars' + LibSuff4;
{
* Add common CGI environment variables to the requests environment table
* @param r The current request
* @deffunc void ap_add_common_vars(request_rec *r)
}
procedure ap_add_common_vars(r: Prequest_rec);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_add_common_vars' + LibSuff4;
{
* Read headers output from a script, ensuring that the output is valid. If
* the output is valid, then the headers are added to the headers out of the
* current request
* @param r The current request
* @param f The file to read from
* @param buffer Empty when calling the function. On output, if there was an
* error, the string that cause the error is stored here.
* @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
* @deffunc int ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer)
}
function ap_scan_script_header_err(r: Prequest_rec;
f: Papr_file_t; buffer: PChar): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_scan_script_header_err' + LibSuff12;
{
* Read headers output from a script, ensuring that the output is valid. If
* the output is valid, then the headers are added to the headers out of the
* current request
* @param r The current request
* @param bb The brigade from which to read
* @param buffer Empty when calling the function. On output, if there was an
* error, the string that cause the error is stored here.
* @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
* @deffunc int ap_scan_script_header_err_brigade(request_rec *r, apr_bucket_brigade *bb, char *buffer)
}
function ap_scan_script_header_err_brigade(r: Prequest_rec;
bb: Papr_bucket_brigade; buffer: PChar): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_scan_script_header_err_brigade' + LibSuff12;
{
* Read headers strings from a script, ensuring that the output is valid. If
* the output is valid, then the headers are added to the headers out of the
* current request
* @param r The current request
* @param buffer Empty when calling the function. On output, if there was an
* error, the string that cause the error is stored here.
* @param termch Pointer to the last character parsed.
* @param termarg Pointer to an int to capture the last argument parsed.
* @param args String arguments to parse consecutively for headers,
* a NULL argument terminates the list.
* @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
* @deffunc int ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc)(char *, int, void *), void *getsfunc_data)
}
function ap_scan_script_header_err_strs(buffer: PChar;
termch: PPChar; termarg: PInteger; others: array of const): Integer;
cdecl; external LibHTTPD name 'ap_scan_script_header_err_strs';
{
* Read headers output from a script, ensuring that the output is valid. If
* the output is valid, then the headers are added to the headers out of the
* current request
* @param r The current request
* @param buffer Empty when calling the function. On output, if there was an
* error, the string that cause the error is stored here.
* @param getsfunc Function to read the headers from. This function should
act like gets()
* @param getsfunc_data The place to read from
* @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
* @deffunc int ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc)(char *, int, void *), void *getsfunc_data)
}
type
getsfunc_t = function(p1: PChar; p2: Integer; p3: Pointer): Integer;
function ap_scan_script_header_err_core(r: Prequest_rec;
buffer: PChar; getsfunc: getsfunc_t; getsfunc_data: Pointer): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_scan_script_header_err_core' + LibSuff16;

View File

@ -1,78 +0,0 @@
{ Copyright 2001-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{#include "apr.h"
#include "apr_time.h"
#include "httpd.h"}
{
* @package Apache date-time handling functions
}
{ Maximum delta from the current time, in seconds, for a past time
* to qualify as "recent" for use in the ap_explode_recent_*() functions:
* (Must be a power of two minus one!)
}
const AP_TIME_RECENT_THRESHOLD = 15;
{
* convert a recent time to its human readable components in local timezone
* @param tm the exploded time
* @param t the time to explode: MUST be within the last
* AP_TIME_RECENT_THRESHOLD seconds
* @note This is a faster alternative to apr_explode_localtime that uses
* a cache of pre-exploded time structures. It is useful for things
* that need to explode the current time multiple times per second,
* like loggers.
* @return APR_SUCCESS iff successful
}
function ap_explode_recent_localtime(tm: Papr_time_exp_t; t: apr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_explode_recent_localtime' + LibSuff12;
{
* convert a recent time to its human readable components in GMT timezone
* @param tm the exploded time
* @param t the time to explode: MUST be within the last
* AP_TIME_RECENT_THRESHOLD seconds
* @note This is a faster alternative to apr_time_exp_gmt that uses
* a cache of pre-exploded time structures. It is useful for things
* that need to explode the current time multiple times per second,
* like loggers.
* @return APR_SUCCESS iff successful
}
function ap_explode_recent_gmt(tm: Papr_time_exp_t; t: apr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_explode_recent_gmt' + LibSuff12;
{
* format a recent timestamp in the ctime() format.
* @param date_str String to write to.
* @param t the time to convert
}
function ap_recent_ctime(date_str: PChar; t: apr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_recent_ctime' + LibSuff12;
{
* format a recent timestamp in the RFC822 format
* @param date_str String to write to (must have length >= APR_RFC822_DATE_LEN)
* @param t the time to convert
}
function ap_recent_rfc822_date(date_str: PChar; t: apr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_recent_rfc822_date' + LibSuff12;

View File

@ -1,255 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{#include "apr.h"
#include "apr_hooks.h"
#include "apr_optional_hooks.h"}
{
* @file ap_config.h
* @brief Symbol export macros and hook functions
}
{ Although this file doesn't declare any hooks, declare the hook group here }
{ @defgroup hooks Apache Hooks }
{$ifdef DOXYGEN}
{ define these just so doxygen documents them }
{
* AP_DECLARE_STATIC is defined when including Apache's Core headers,
* to provide static linkage when the dynamic library may be unavailable.
*
* @see AP_DECLARE_EXPORT
*
* AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when
* including Apache's Core headers, to import and link the symbols from the
* dynamic Apache Core library and assure appropriate indirection and calling
* conventions at compile time.
}
{$define AP_DECLARE_STATIC}
{
* AP_DECLARE_EXPORT is defined when building the Apache Core dynamic
* library, so that all public symbols are exported.
*
* @see AP_DECLARE_STATIC
}
{$define AP_DECLARE_EXPORT}
{$endif} { def DOXYGEN }
//#if !defined(WIN32)
{
* Apache Core dso functions are declared with AP_DECLARE(), so they may
* use the most appropriate calling convention. Hook functions and other
* Core functions with variable arguments must use AP_DECLARE_NONSTD().
* @code
* AP_DECLARE(rettype) ap_func(args)
* @endcode
}
//#define AP_DECLARE(type) type
{
* Apache Core dso variable argument and hook functions are declared with
* AP_DECLARE_NONSTD(), as they must use the C language calling convention.
* @see AP_DECLARE
* @code
* AP_DECLARE_NONSTD(rettype) ap_func(args [...])
* @endcode
}
//#define AP_DECLARE_NONSTD(type) type
{
* Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA.
* This assures the appropriate indirection is invoked at compile time.
*
* @note AP_DECLARE_DATA extern type apr_variable; syntax is required for
* declarations within headers to properly import the variable.
* @code
* AP_DECLARE_DATA type apr_variable
* @endcode
}
{#define AP_DECLARE_DATA
#elif defined(AP_DECLARE_STATIC)
#define AP_DECLARE(type) type __stdcall
#define AP_DECLARE_NONSTD(type) type
#define AP_DECLARE_DATA
#elif defined(AP_DECLARE_EXPORT)
#define AP_DECLARE(type) __declspec(dllexport) type __stdcall
#define AP_DECLARE_NONSTD(type) __declspec(dllexport) type
#define AP_DECLARE_DATA __declspec(dllexport)
#else
#define AP_DECLARE(type) __declspec(dllimport) type __stdcall
#define AP_DECLARE_NONSTD(type) __declspec(dllimport) type
#define AP_DECLARE_DATA __declspec(dllimport)
#endif
#if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC)}
{
* Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA.
*
* Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols
* declared with AP_MODULE_DECLARE_DATA are always exported.
* @code
* module AP_MODULE_DECLARE_DATA mod_tag
* @endcode
}
{#if defined(WIN32)
#define AP_MODULE_DECLARE(type) type __stdcall
#else
#define AP_MODULE_DECLARE(type) type
#endif
#define AP_MODULE_DECLARE_NONSTD(type) type
#define AP_MODULE_DECLARE_DATA
#else}
{
* AP_MODULE_DECLARE_EXPORT is a no-op. Unless contradicted by the
* AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined.
*
* The old SHARED_MODULE compile-time symbol is now the default behavior,
* so it is no longer referenced anywhere with Apache 2.0.
}
{#define AP_MODULE_DECLARE_EXPORT
#define AP_MODULE_DECLARE(type) __declspec(dllexport) type __stdcall
#define AP_MODULE_DECLARE_NONSTD(type) __declspec(dllexport) type
#define AP_MODULE_DECLARE_DATA __declspec(dllexport)
#endif}
{
* Declare a hook function
* @param ret The return type of the hook
* @param name The hook's name (as a literal)
* @param args The arguments the hook function takes, in brackets.
}
{#define AP_DECLARE_HOOK(ret,name,args) \
APR_DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args)
}
{ @internal }
{#define AP_IMPLEMENT_HOOK_BASE(name) \
APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ap,AP,name)
}
{
* Implement an Apache core hook that has no return code, and
* therefore runs all of the registered functions. The implementation
* is called ap_run_<i>name</i>.
*
* @param name The name of the hook
* @param args_decl The declaration of the arguments for the hook, for example
* "(int x,void *y)"
* @param args_use The arguments for the hook as used in a call, for example
* "(x,y)"
* @note If IMPLEMENTing a hook that is not linked into the Apache core,
* (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_VOID.
}
{#define AP_IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \
APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ap,AP,name,args_decl,args_use)
}
{
* Implement an Apache core hook that runs until one of the functions
* returns something other than ok or decline. That return value is
* then returned from the hook runner. If the hooks run to completion,
* then ok is returned. Note that if no hook runs it would probably be
* more correct to return decline, but this currently does not do
* so. The implementation is called ap_run_<i>name</i>.
*
* @param ret The return type of the hook (and the hook runner)
* @param name The name of the hook
* @param args_decl The declaration of the arguments for the hook, for example
* "(int x,void *y)"
* @param args_use The arguments for the hook as used in a call, for example
* "(x,y)"
* @param ok The "ok" return value
* @param decline The "decline" return value
* @return ok, decline or an error.
* @note If IMPLEMENTing a hook that is not linked into the Apache core,
* (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL.
}
{#define AP_IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \
APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
args_use,ok,decline)
}
{
* Implement a hook that runs until a function returns something other than
* decline. If all functions return decline, the hook runner returns decline.
* The implementation is called ap_run_<i>name</i>.
*
* @param ret The return type of the hook (and the hook runner)
* @param name The name of the hook
* @param args_decl The declaration of the arguments for the hook, for example
* "(int x,void *y)"
* @param args_use The arguments for the hook as used in a call, for example
* "(x,y)"
* @param decline The "decline" return value
* @return decline or an error.
* @note If IMPLEMENTing a hook that is not linked into the Apache core
* (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST.
}
{#define AP_IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \
APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap,AP,ret,name,args_decl, \
args_use,decline)
}
{ Note that the other optional hook implementations are straightforward but
* have not yet been needed
}
{
* Implement an optional hook. This is exactly the same as a standard hook
* implementation, except the hook is optional.
* @see AP_IMPLEMENT_HOOK_RUN_ALL
}
{#define AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok, \
decline) \
APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \
args_use,ok,decline)
}
{
* Hook an optional hook. Unlike static hooks, this uses a macro instead of a
* function.
}
{#define AP_OPTIONAL_HOOK(name,fn,pre,succ,order) \
APR_OPTIONAL_HOOK(ap,name,fn,pre,succ,order)
#include "os.h"
#if !defined(WIN32) && !defined(NETWARE)
#include "ap_config_auto.h"
#include "ap_config_layout.h"
#endif
#if defined(NETWARE)
#define AP_NONBLOCK_WHEN_MULTI_LISTEN 1
#endif}
{ TODO - We need to put OS detection back to make all the following work }
{$if defined(SUNOS) or defined(IRIX) or defined(NEXT) or defined(AUX)
or defined (UW) or defined(LYNXOS) or defined(TPF)}
{ These systems don't do well with any lingering close code; I don't know
* why -- manoj }
{$define NO_LINGCLOSE}
{$endif}
{ If APR has OTHER_CHILD logic, use reliable piped logs. }
{$ifdef APR_HAS_OTHER_CHILD}
{$define AP_HAVE_RELIABLE_PIPED_LOGS}
{$endif}
{ Presume that the compiler supports C99-style designated
* initializers if using GCC (but not G++), or for any other compiler
* which claims C99 support. }
//#if (defined(__GNUC__) && !defined(__cplusplus)) \
// || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
//#define AP_HAVE_DESIGNATED_INITIALIZER
{.$endif}

View File

@ -1,141 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @package Module Magic Number
}
{
* MODULE_MAGIC_NUMBER_MAJOR
* Major API changes that could cause compatibility problems for older modules
* such as structure size changes. No binary compatibility is possible across
* a change in the major version.
*
* MODULE_MAGIC_NUMBER_MINOR
* Minor API changes that do not cause binary compatibility problems.
* Should be reset to 0 when upgrading MODULE_MAGIC_NUMBER_MAJOR.
*
* See the MODULE_MAGIC_AT_LEAST macro below for an example.
}
{
* 20010224 (2.0.13-dev) MODULE_MAGIC_COOKIE reset to "AP20"
* 20010523 (2.0.19-dev) bump for scoreboard structure reordering
* 20010627 (2.0.19-dev) more API changes than I can count
* 20010726 (2.0.22-dev) more big API changes
* 20010808 (2.0.23-dev) dir d_is_absolute bit introduced, bucket changes, etc
* 20010825 (2.0.25-dev) removed d_is_absolute, introduced map_to_storage hook
* 20011002 (2.0.26-dev) removed 1.3-depreciated request_rec.content_language
* 20011127 (2.0.29-dev) bump for postconfig hook change, and removal of socket
* from connection record
* 20011212 (2.0.30-dev) bump for new used_path_info member of request_rec
* 20011218 (2.0.30-dev) bump for new sbh member of conn_rec, different
* declarations for scoreboard, new parameter to
* create_connection hook
* 20020102 (2.0.30-dev) bump for changed type of limit_req_body in
* core_dir_config
* 20020109 (2.0.31-dev) bump for changed shm and scoreboard declarations
* 20020111 (2.0.31-dev) bump for ETag fields added at end of cor_dir_config
* 20020114 (2.0.31-dev) mod_dav changed how it asks its provider to fulfill
* a GET request
* 20020118 (2.0.31-dev) Input filtering split of blocking and mode
* 20020127 (2.0.31-dev) bump for pre_mpm hook change
* 20020128 (2.0.31-dev) bump for pre_config hook change
* 20020218 (2.0.33-dev) bump for AddOutputFilterByType directive
* 20020220 (2.0.33-dev) bump for scoreboard.h structure change
* 20020302 (2.0.33-dev) bump for protocol_filter additions.
* 20020306 (2.0.34-dev) bump for filter type renames.
* 20020318 (2.0.34-dev) mod_dav's API for REPORT generation changed
* 20020319 (2.0.34-dev) M_INVALID changed, plus new M_* methods for RFC 3253
* 20020327 (2.0.35-dev) Add parameter to quick_handler hook
* 20020329 (2.0.35-dev) bump for addition of freelists to bucket API
* 20020329.1 (2.0.36) minor bump for new arg to opt fn ap_cgi_build_command
* 20020506 (2.0.37-dev) Removed r->boundary in request_rec.
* 20020529 (2.0.37-dev) Standardized the names of some apr_pool_*_set funcs
* 20020602 (2.0.37-dev) Bucket API change (metadata buckets)
* 20020612 (2.0.38-dev) Changed server_rec->[keep_alive_]timeout to apr time
* 20020625 (2.0.40-dev) Changed conn_rec->keepalive to an enumeration
* 20020628 (2.0.40-dev) Added filter_init to filter registration functions
* 20020903 (2.0.41-dev) APR's error constants changed
* 20020903.1 (2.1.0-dev) allow_encoded_slashes added to core_dir_config
* 20020903.2 (2.0.46-dev) add ap_escape_logitem
* 20030213.1 (2.1.0-dev) changed log_writer optional fn's to return previous
* handler
* 20030821 (2.1.0-dev) bumped mod_include's entire API
* 20030821.1 (2.1.0-dev) added XHTML doctypes
* 20030821.2 (2.1.0-dev) added ap_escape_errorlog_item
* 20030821.3 (2.1.0-dev) added ap_get_server_revision / ap_version_t
* 20040425 (2.1.0-dev) removed ap_add_named_module API
* changed ap_add_module, ap_add_loaded_module,
* ap_setup_prelinked_modules, ap_process_resource_config
* 20040425.1 (2.1.0-dev) Added ap_module_symbol_t and ap_prelinked_module_symbols
* 20050101.0 (2.1.2-dev) Axed misnamed http_method for http_scheme (which it was!)
* 20050127.0 (2.1.3-dev) renamed regex_t->ap_regex_t, regmatch_t->ap_regmatch_t,
* REG_*->AP_REG_*, removed reg* in place of ap_reg*;
* added ap_regex.h
* 20050217.0 (2.1.3-dev) Axed find_child_by_pid, mpm_*_completion_context (winnt mpm)
* symbols from the public sector, and decorated real_exit_code
* with ap_ in the win32 os.h.
* 20050305.0 (2.1.4-dev) added pid and generation fields to worker_score
* 20050305.1 (2.1.5-dev) added ap_vhost_iterate_given_conn.
* 20050305.2 (2.1.5-dev) added AP_INIT_TAKE_ARGV.
* 20050305.3 (2.1.5-dev) added Protocol Framework.
* 20050701.0 (2.1.7-dev) Bump MODULE_MAGIC_COOKIE to "AP21"!
* 20050701.1 (2.1.7-dev) trace_enable member added to core server_config
* 20050708.0 (2.1.7-dev) Bump MODULE_MAGIC_COOKIE to "AP22"!
* 20050708.1 (2.1.7-dev) add proxy request_status hook (minor)
* 20051006.0 (2.1.8-dev) NET_TIME filter eliminated
* 20051115.0 (2.1.10-dev/2.2.0) add use_canonical_phys_port to core_dir_config
* 20051115.1 (2.2.1) flush_packets and flush_wait members added to
* proxy_server (minor)
* 20051115.2 (2.2.2) added inreslist member to proxy_conn_rec (minor)
* 20051115.3 (2.2.3) Added server_scheme member to server_rec (minor)
}
const
MODULE_MAGIC_COOKIE = $41503232; { "AP22" }
MODULE_MAGIC_NUMBER_MAJOR = 20051115; { For 2.2.3 }
MODULE_MAGIC_NUMBER_MINOR = 3; // 0...n
{
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
* specified value.
* <pre>
* Useful for testing for features.
* For example, suppose you wish to use the apr_table_overlap
* function. You can do this:
*
* #if AP_MODULE_MAGIC_AT_LEAST(19980812,2)
* ... use apr_table_overlap()
* #else
* ... alternative code which doesn't use apr_table_overlap()
* #endif
* </pre>
* @param major The major module magic number
* @param minor The minor module magic number
* @deffunc AP_MODULE_MAGIC_AT_LEAST(int major, int minor)
}
{#define AP_MODULE_MAGIC_AT_LEAST(major,minor) \
((major) < MODULE_MAGIC_NUMBER_MAJOR \
|| ((major) == MODULE_MAGIC_NUMBER_MAJOR \
&& (minor) <= MODULE_MAGIC_NUMBER_MINOR))}
{ @deprecated present for backwards compatibility }
MODULE_MAGIC_NUMBER = MODULE_MAGIC_NUMBER_MAJOR;
//#define MODULE_MAGIC_AT_LEAST old_broken_macro_we_hope_you_are_not_using

View File

@ -1,180 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
//#include "apr_thread_proc.h"
{
* @package Multi-Processing Module library
}
{
The MPM, "multi-processing model" provides an abstraction of the
interface with the OS for distributing incoming connections to
threads/process for processing. http_main invokes the MPM, and
the MPM runs until a shutdown/restart has been indicated.
The MPM calls out to the apache core via the ap_process_connection
function when a connection arrives.
The MPM may or may not be multithreaded. In the event that it is
multithreaded, at any instant it guarantees a 1:1 mapping of threads
ap_process_connection invocations.
Note: In the future it will be possible for ap_process_connection
to return to the MPM prior to finishing the entire connection; and
the MPM will proceed with asynchronous handling for the connection;
in the future the MPM may call ap_process_connection again -- but
does not guarantee it will occur on the same thread as the first call.
The MPM further guarantees that no asynchronous behaviour such as
longjmps and signals will interfere with the user code that is
invoked through ap_process_connection. The MPM may reserve some
signals for its use (i.e. SIGUSR1), but guarantees that these signals
are ignored when executing outside the MPM code itself. (This
allows broken user code that does not handle EINTR to function
properly.)
The suggested server restart and stop behaviour will be "graceful".
However the MPM may choose to terminate processes when the user
requests a non-graceful restart/stop. When this occurs, the MPM kills
all threads with extreme prejudice, and destroys the pchild pool.
User cleanups registered in the pchild apr_pool_t will be invoked at
this point. (This can pose some complications, the user cleanups
are asynchronous behaviour not unlike longjmp/signal... but if the
admin is asking for a non-graceful shutdown, how much effort should
we put into doing it in a nice way?)
unix/posix notes:
- The MPM does not set a SIGALRM handler, user code may use SIGALRM.
But the preferred method of handling timeouts is to use the
timeouts provided by the BUFF abstraction.
- The proper setting for SIGPIPE is SIG_IGN, if user code changes it
for any of their own processing, it must be restored to SIG_IGN
prior to executing or returning to any apache code.
TODO: add SIGPIPE debugging check somewhere to make sure it's SIG_IGN
}
{
* This is the function that MPMs must create. This function is responsible
* for controlling the parent and child processes. It will run until a
* restart/shutdown is indicated.
* @param pconf the configuration pool, reset before the config file is read
* @param plog the log pool, reset after the config file is read
* @param server_conf the global server config.
* @return 1 for shutdown 0 otherwise.
* @deffunc int ap_mpm_run(apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf)
}
function ap_mpm_run(pconf, plog: Papr_pool_t; server_conf: Pserver_rec): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_mpm_run' + LibSuff12;
{
* predicate indicating if a graceful stop has been requested ...
* used by the connection loop
* @return 1 if a graceful stop has been requested, 0 otherwise
* @deffunc int ap_graceful_stop_signalled(*void)
}
function ap_graceful_stop_signalled: Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_graceful_stop_signalled' + LibSuff0;
{
* Spawn a process with privileges that another module has requested
* @param r The request_rec of the current request
* @param newproc The resulting process handle.
* @param progname The program to run
* @param const_args the arguments to pass to the new program. The first
* one should be the program name.
* @param env The new environment apr_table_t for the new process. This
* should be a list of NULL-terminated strings.
* @param attr the procattr we should use to determine how to create the new
* process
* @param p The pool to use.
}
function ap_os_create_privileged_process(
const r: Prequest_rec;
newproc: Papr_proc_t;
const progname, args, env: PChar;
attr: Papr_procattr_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_os_create_privileged_process' + LibSuff28;
const
{ Subtypes/Values for AP_MPMQ_IS_THREADED and AP_MPMQ_IS_FORKED }
AP_MPMQ_NOT_SUPPORTED = 0; { This value specifies whether }
{ an MPM is capable of }
{ threading or forking. }
AP_MPMQ_STATIC = 1; { This value specifies whether }
{ an MPM is using a static # }
{ threads or daemons. }
AP_MPMQ_DYNAMIC = 2; { This value specifies whether }
{ an MPM is using a dynamic # }
{ threads or daemons. }
{ Values returned for AP_MPMQ_MPM_STATE }
AP_MPMQ_STARTING = 0;
AP_MPMQ_RUNNING = 1;
AP_MPMQ_STOPPING = 2;
AP_MPMQ_MAX_DAEMON_USED = 1; { Max # of daemons used so far }
AP_MPMQ_IS_THREADED = 2; { MPM can do threading }
AP_MPMQ_IS_FORKED = 3; { MPM can do forking }
AP_MPMQ_HARD_LIMIT_DAEMONS = 4; { The compiled max # daemons }
AP_MPMQ_HARD_LIMIT_THREADS = 5; { The compiled max # threads }
AP_MPMQ_MAX_THREADS = 6; { # of threads/child by config }
AP_MPMQ_MIN_SPARE_DAEMONS = 7; { Min # of spare daemons }
AP_MPMQ_MIN_SPARE_THREADS = 8; { Min # of spare threads }
AP_MPMQ_MAX_SPARE_DAEMONS = 9; { Max # of spare daemons }
AP_MPMQ_MAX_SPARE_THREADS = 10; { Max # of spare threads }
AP_MPMQ_MAX_REQUESTS_DAEMON = 11; { Max # of requests per daemon }
AP_MPMQ_MAX_DAEMONS = 12; { Max # of daemons by config }
AP_MPMQ_MPM_STATE = 13; { starting, running, stopping }
AP_MPMQ_IS_ASYNC = 14; { MPM can process async connections }
{
* Query a property of the current MPM.
* @param query_code One of APM_MPMQ_*
* @param result A location to place the result of the query
* @return APR_SUCCESS or APR_ENOTIMPL
* @deffunc int ap_mpm_query(int query_code, int *result)
}
function ap_mpm_query(query_code: Integer; result: PInteger): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_mpm_query' + LibSuff8;
{ Defining GPROF when compiling uses the moncontrol() function to
* disable gprof profiling in the parent, and enable it only for
* request processing in children (or in one_process mode). It's
* absolutely required to get useful gprof results under linux
* because the profile itimers and such are disabled across a
* fork(). It's probably useful elsewhere as well.
}
{#ifdef GPROF
extern void moncontrol(int);
#define AP_MONCONTROL(x) moncontrol(x)
#else
#define AP_MONCONTROL(x)
#endif}
{$ifdef AP_ENABLE_EXCEPTION_HOOK}
type
ap_exception_info_t = record
sig: Integer;
pid: pid_t;
end;
AP_DECLARE_HOOK(int,fatal_exception,(ap_exception_info_t *ei))
{$endif} {AP_ENABLE_EXCEPTION_HOOK}

View File

@ -1,68 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @package Provider API
}
//#include "ap_config.h"
type
ap_list_provider_names_t = record
provider_name: PChar;
end;
{
* This function is used to register a provider with the global
* provider pool.
* @param pool The pool to create any storage from
* @param provider_group The group to store the provider in
* @param provider_name The name for this provider
* @param provider_version The version for this provider
* @param provider Opaque structure for this provider
* @return APR_SUCCESS if all went well
}
function ap_register_provider(pool: Papr_pool_t;
const provider_group, provider_name, provider_version: PChar;
const provider: Pointer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_register_provider' + LibSuff20;
{
* This function is used to retrieve a provider from the global
* provider pool.
* @param provider_group The group to look for this provider in
* @param provider_name The name for the provider
* @param provider_version The version for the provider
* @return provider pointer to provider if found, NULL otherwise
}
function ap_lookup_provider(provider_group, provider_name, provider_version: PChar): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_lookup_provider' + LibSuff12;
{
* This function is used to retrieve a list (array) of provider
* names from the specified group with the specified version.
* @param pool The pool to create any storage from
* @param provider_group The group to look for this provider in
* @param provider_version The version for the provider
* @return pointer to array of ap_list_provider_names_t of provider names (could be empty)
}
function ap_list_provider_names(pool: Papr_pool_t;
const provider_group, provider_version: PChar): Papr_array_header_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_list_provider_names' + LibSuff12;

View File

@ -1,138 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{ Derived from PCRE's pcreposix.h.
Copyright (c) 1997-2004 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the University of Cambridge nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------
}
{
* @file ap_regex.h
* @brief Apache Regex defines
}
//#include "apr.h"
{ Options for ap_regexec: }
const
AP_REG_ICASE = $01; { use a case-insensitive match }
AP_REG_NEWLINE = $02; { don't match newlines against '.' etc }
AP_REG_NOTBOL = $04; { ^ will not match against start-of-string }
AP_REG_NOTEOL = $08; { $ will not match against end-of-string }
AP_REG_EXTENDED = (0); { unused }
AP_REG_NOSUB = (0); { unused }
{ Error values: }
AP_REG_ASSERT = 1; { internal error ? }
AP_REG_ESPACE = 2; { failed to get memory }
AP_REG_INVARG = 3; { invalid argument }
AP_REG_NOMATCH = 4; { match failed }
{ The structure representing a compiled regular expression. }
type
Pap_regex_t = ^ap_regex_t;
ap_regex_t = record
re_pcre: Pointer;
re_nsub: apr_size_t;
re_erroffset: apr_size_t;
end;
{ The structure in which a captured offset is returned. }
Pap_regmatch_t = ^ap_regmatch_t;
ap_regmatch_t = record
rm_so: Integer;
rm_eo: Integer;
end;
{ The functions }
{
* Compile a regular expression.
* @param preg Returned compiled regex
* @param regex The regular expression string
* @param cflags Must be zero (currently).
* @return Zero on success or non-zero on error
}
function ap_regcomp(preg: Pap_regex_t; const regex: PChar; cflags: Integer): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_regcomp' + LibSuff12;
{
* Match a NUL-terminated string against a pre-compiled regex.
* @param preg The pre-compiled regex
* @param string The string to match
* @param nmatch Provide information regarding the location of any matches
* @param pmatch Provide information regarding the location of any matches
* @param eflags Bitwise OR of any of AP_REG_* flags
* @return 0 for successful match, #REG_NOMATCH otherwise
}
function ap_regexec(const preg: Pap_regex_t; const string_: PChar;
nmatch: apr_size_t; pmatch: Pap_regmatch_t; eflags: Integer): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_regexec' + LibSuff20;
{
* Return the error code returned by regcomp or regexec into error messages
* @param errcode the error code returned by regexec or regcomp
* @param preg The precompiled regex
* @param errbuf A buffer to store the error in
* @param errbuf_size The size of the buffer
}
function ap_regerror(errcord: Integer; const preg: Pap_regex_t;
errbuf: PChar; errbuf_size: apr_size_t): apr_size_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_regerror' + LibSuff16;
{ Destroy a pre-compiled regex.
* @param preg The pre-compiled regex to free.
}
procedure ap_regfree(preg: Pap_regex_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibHTTPD name LibNamePrefix + 'ap_regfree' + LibSuff4;

View File

@ -1,66 +0,0 @@
{ Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
//#include "apr_general.h" /* stringify */
const
AP_SERVER_COPYRIGHT =
'Copyright 2006 The Apache Software Foundation.';
{
* The below defines the base string of the Server: header. Additional
* tokens can be added via the ap_add_version_component() API call.
*
* The tokens are listed in order of their significance for identifying the
* application.
*
* "Product tokens should be short and to the point -- use of them for
* advertizing or other non-essential information is explicitly forbidden."
*
* Example: "Apache/1.1.0 MrWidget/0.1-alpha"
}
AP_SERVER_BASEVENDOR = 'Apache Software Foundation';
AP_SERVER_BASEPROJECT = 'Apache HTTP Server';
AP_SERVER_BASEPRODUCT = 'Apache';
AP_SERVER_MAJORVERSION_NUMBER = 2;
AP_SERVER_MINORVERSION_NUMBER = 2;
AP_SERVER_PATCHLEVEL_NUMBER = 3;
AP_SERVER_DEVBUILD_BOOLEAN = 0;
{$ifdef AP_SERVER_DEVBUILD_BOOLEAN}
AP_SERVER_ADD_STRING = '-dev';
{$else}
AP_SERVER_ADD_STRING = '';
{$endif}
{ keep old macros as well }
{#define AP_SERVER_MAJORVERSION APR_STRINGIFY(AP_SERVER_MAJORVERSION_NUMBER)
#define AP_SERVER_MINORVERSION APR_STRINGIFY(AP_SERVER_MINORVERSION_NUMBER)
#define AP_SERVER_PATCHLEVEL APR_STRINGIFY(AP_SERVER_PATCHLEVEL_NUMBER) \
AP_SERVER_ADD_STRING
#define AP_SERVER_MINORREVISION AP_SERVER_MAJORVERSION "." AP_SERVER_MINORVERSION
#define AP_SERVER_BASEREVISION AP_SERVER_MINORREVISION "." AP_SERVER_PATCHLEVEL
#define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION
#define AP_SERVER_VERSION AP_SERVER_BASEVERSION
/* macro for Win32 .rc files using numeric csv representation */
#define AP_SERVER_PATCHLEVEL_CSV AP_SERVER_MAJORVERSION_NUMBER ##, \
##AP_SERVER_MINORVERSION_NUMBER ##, \
##AP_SERVER_PATCHLEVEL_NUMBER
}

View File

@ -1,245 +0,0 @@
{
apr.pas
Copyright (C) 2006 Felipe Monteiro de Carvalho
This unit is a pascal binding for the Apache 2.0.58 headers.
The headers were released under the following copyright:
}
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
unit apr;
interface
{$ifdef fpc}
{$mode delphi}{$H+}
{$endif}
{$IFNDEF FPC}
{$DEFINE WINDOWS}
{$ENDIF}
{$IFDEF WIN32}
{$DEFINE WINDOWS}
{$ENDIF}
{$ifdef Unix}
{$PACKRECORDS C}
{$endif}
uses
{$ifdef WINDOWS}
Windows, winsock,
{$ELSE}
UnixType,
{$ENDIF}
SysUtils, ctypes;
const
{$IFDEF WINDOWS}
LibAPR = 'libapr-1.dll';
{$ELSE}
LibAPR = '';
{$ENDIF}
{$IFDEF WINDOWS}
LibNamePrefix = '_';
LibSuff0 = '@0';
LibSuff4 = '@4';
LibSuff8 = '@8';
LibSuff12 = '@12';
LibSuff16 = '@16';
LibSuff20 = '@20';
LibSuff24 = '@24';
LibSuff28 = '@28';
LibSuff32 = '@32';
{$ELSE}
LibNamePrefix = '';
LibSuff0 = '';
LibSuff4 = '';
LibSuff8 = '';
LibSuff12 = '';
LibSuff16 = '';
LibSuff20 = '';
LibSuff24 = '';
LibSuff28 = '';
LibSuff32 = '';
{$ENDIF}
type
uid_t = Integer;
gid_t = Integer;
time_t = LongInt;
size_t = Integer;
pid_t = Integer;
Ppid_t = ^pid_t;
apr_uint16_t = Word;
apr_uint32_t = Cardinal;
apr_int64_t = Int64;
apr_uint64_t = Int64;
apr_socklen_t = Integer;
apr_byte_t = Byte;
apr_uint32_tso_handle_t = cuint;
type
{$IFDEF WINDOWS}
apr_off_t = Int64;
{$ENDIF}
{$IFDEF UNIX}
apr_off_t = Integer;
{$ENDIF}
apr_int32_t = Integer;
Papr_int32_t = ^Integer;
apr_size_t = size_t;
Papr_size_t = ^apr_size_t;
apr_int16_t = SmallInt;
Papr_int16_t = ^SmallInt;
// Network structures
sockaddr = record
sa_family: cushort; // address family, AF_xxx
sa_data: array [1..14] of Char; // (NBO) 14 bytes of protocol address
end;
in_addr = record
s_addr: culong; // load with inet_aton()
end;
{$ifndef windows}
va_list = Pointer;
sockaddr_in = record
sin_family: cshort; // e.g. AF_INET
sin_port: cushort; // e.g. htons(3490)
sin_addr: in_addr; // see struct in_addr, below
sin_zero: array [1..8] of Char; // zero this if you want to
end;
{$endif}
in6_addr = record
Case Integer of
1: (u6_addr8: array [1..16] of Byte);
2: (u6_addr16: array [1..8] of Word);
3: (u6_addr32: array [1..4] of Cardinal);
end;
//#define s6_addr in6_u.u6_addr8
//#define s6_addr16 in6_u.u6_addr16
//#define s6_addr32 in6_u.u6_addr32
sockaddr_in6 = record
sin6_family: cushort;
sin6_port: Word;
sin6_flowinfo: Cardinal;
sin6_addr: in6_addr;
sin6_scope_id: Cardinal;
end;
// TEMPORARY
Papr_xml_ns_scope = Pointer;
Pap_method_list_t = Pointer;
Pcore_output_filter_ctx_t = Pointer;
Pap_directive_t = Pointer;
Pap_filter_t = Pointer;
Papr_file_t = Pointer;
Papr_off_t = Pointer;
iovec = record
/// byte count to read/write
iov_len: culong;
/// data to be read/written
iov_base: PChar;
end;
Piovec = ^iovec;
{$include apr_errno.inc}
{$include apr_pools.inc}
{$include apr_general.inc}
{$include apr_dso.inc}
{$include apr_user.inc}
{$include apr_time.inc}
{$include apr_tables.inc}
{$include apr_file_info.inc}
{$include apr_file_io.inc}
{$include apr_strings.inc}
{$include apr_lib.inc}
{$include apr_signal.inc}
{$include apr_network_io.inc}
{.$include apr_portable.inc}
{.$include ../aprutils/apr_uri.inc}
{$include apr_thread_proc.inc}
{$include apr_version.inc}
{$include apr_poll.inc}
implementation
{
Macros transformed into functions in the translation
}
{ apr_pools.inc }
{$ifndef DOXYGEN}
function apr_pool_create(newpool: PPapr_pool_t; parent: Papr_pool_t): apr_status_t;
begin
Result := apr_pool_create_ex(newpool, parent, nil, nil);
end;
{$endif}
function apr_pool_sub_make(newpool: PPapr_pool_t; parent: Papr_pool_t;
abort_fn: apr_abortfunc_t): apr_status_t;
begin
Result := apr_pool_create_ex(newpool, parent, abort_fn, nil);
end;
{ apr_lib.inc }
function apr_tolower(c: Char): Char;
var
buf: array[0..1] of Char;
begin
buf[0] := c;
buf[1] := #0;
buf := StrLower(@buf[0]);
Result := buf[0];
end;
function apr_toupper(c: Char): Char;
var
buf: array[0..1] of Char;
begin
buf[0] := c;
buf[1] := #0;
buf := StrUpper(@buf[0]);
Result := buf[0];
end;
end.

View File

@ -1,165 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_allocator.h
* @brief APR Internal Memory Allocation
}
{#include "apr.h"
#include "apr_errno.h"
#define APR_WANT_MEMFUNC < For no good reason?
#include "apr_want.h"}
{
* @defgroup apr_allocator Internal Memory Allocation
* @ingroup APR
}
type
{ the allocator structure }
apr_allocator_t = record end;
Papr_allocator_t = ^apr_allocator_t;
PPapr_allocator_t = ^Papr_allocator_t;
{ the structure which holds information about the allocation }
Papr_memnode_t = ^apr_memnode_t;
PPapr_memnode_t = ^Papr_memnode_t;
{ basic memory node structure
* @note The next, ref and first_avail fields are available for use by the
* caller of apr_allocator_alloc(), the remaining fields are read-only.
* The next field has to be used with caution and sensibly set when the
* memnode is passed back to apr_allocator_free(). See apr_allocator_free()
* for details.
* The ref and first_avail fields will be properly restored by
* apr_allocator_free().
}
apr_memnode_t = record
next: Papr_memnode_t; {< next memnode }
ref: PPapr_memnode_t; {< reference to self }
index: apr_uint32_t; {< size }
free_index: apr_uint32_t; {< how much free }
first_avail: PChar; {< pointer to first free memory }
endp: PChar; {< pointer to end of free memory }
end;
{ The base size of a memory node - aligned. }
//#define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(apr_memnode_t))
{ Symbolic constants }
const
APR_ALLOCATOR_MAX_FREE_UNLIMITED = 0;
{
* Create a new allocator
* @param allocator The allocator we have just created.
*
}
function apr_allocator_create(allocator: PPapr_allocator_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_create' + LibSuff4;
{
* Destroy an allocator
* @param allocator The allocator to be destroyed
* @remark Any memnodes not given back to the allocator prior to destroying
* will _not_ be free()d.
}
procedure apr_allocator_destroy(allocator: Papr_allocator_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_destroy' + LibSuff4;
{
* Allocate a block of mem from the allocator
* @param allocator The allocator to allocate from
* @param size The size of the mem to allocate (excluding the
* memnode structure)
}
function apr_allocator_alloc(allocator: Papr_allocator_t;
size: apr_size_t): Papr_memnode_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_alloc' + LibSuff8;
{
* Free a list of blocks of mem, giving them back to the allocator.
* The list is typically terminated by a memnode with its next field
* set to NULL.
* @param allocator The allocator to give the mem back to
* @param memnode The memory node to return
}
procedure apr_allocator_free(allocator: Papr_allocator_t; memnode: Papr_memnode_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_free' + LibSuff8;
//#include "apr_pools.h"
{
* Set the owner of the allocator
* @param allocator The allocator to set the owner for
* @param pool The pool that is to own the allocator
* @remark Typically pool is the highest level pool using the allocator
}
{
* XXX: see if we can come up with something a bit better. Currently
* you can make a pool an owner, but if the pool doesn't use the allocator
* the allocator will never be destroyed.
}
procedure apr_allocator_owner_set(allocator: Papr_allocator_t; pool: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_owner_set' + LibSuff8;
{
* Get the current owner of the allocator
* @param allocator The allocator to get the owner from
}
function apr_allocator_owner_get(allocator: Papr_allocator_t): Papr_pool_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_owner_get' + LibSuff4;
{
* Set the current threshold at which the allocator should start
* giving blocks back to the system.
* @param allocator The allocator the set the threshold on
* @param size The threshold. 0 == unlimited.
}
procedure apr_allocator_max_free_set(allocator: Papr_allocator_t; size: apr_size_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_allocator_max_free_set' + LibSuff8;
{#include "apr_thread_mutex.h"}
{$ifdef APR_HAS_THREADS}
{
* Set a mutex for the allocator to use
* @param allocator The allocator to set the mutex for
* @param mutex The mutex
}
APR_DECLARE(void) apr_allocator_mutex_set(apr_allocator_t *allocator,
apr_thread_mutex_t *mutex);
{
* Get the mutex currently set for the allocator
* @param allocator The allocator
}
APR_DECLARE(apr_thread_mutex_t *) apr_allocator_mutex_get(
apr_allocator_t *allocator);
{$endif} { APR_HAS_THREADS }

File diff suppressed because it is too large Load Diff

View File

@ -1,95 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_dso.h
* @brief APR Dynamic Object Handling Routines
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_errno.h"}
{
* @defgroup apr_dso Dynamic Object Handling
* @ingroup APR
}
{$define APR_HAS_DSO}
{$if defined(APR_HAS_DSO) or defined(DOXYGEN)}
{
* Structure for referencing dynamic objects
}
type
apr_dso_handle_t = record
end;
Papr_dso_handle_t = ^apr_dso_handle_t;
PPapr_dso_handle_t = ^Papr_dso_handle_t;
{
* Structure for referencing symbols from dynamic objects
}
apr_dso_handle_sym_t = Pointer;
Papr_dso_handle_sym_t = ^apr_dso_handle_sym_t;
PPapr_dso_handle_sym_t = ^Papr_dso_handle_sym_t;
{
* Load a DSO library.
* @param res_handle Location to store new handle for the DSO.
* @param path Path to the DSO library
* @param ctx Pool to use.
* @bug We aught to provide an alternative to RTLD_GLOBAL, which
* is the only supported method of loading DSOs today.
}
function apr_dso_load(res_handle: PPapr_dso_handle_t; const path: PChar;
ctx: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dso_load' + LibSuff12;
{
* Close a DSO library.
* @param handle handle to close.
}
function apr_dso_unload(handle: Papr_dso_handle_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dso_unload' + LibSuff4;
{
* Load a symbol from a DSO handle.
* @param ressym Location to store the loaded symbol
* @param handle handle to load the symbol from.
* @param symname Name of the symbol to load.
}
function apr_dso_sym(ressym: Papr_dso_handle_t; handle: Papr_dso_handle_t;
const symname: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dso_sym' + LibSuff12;
{
* Report more information when a DSO function fails.
* @param dso The dso handle that has been opened
* @param buf Location to store the dso error
* @param bufsize The size of the provided buffer
}
function apr_dso_error(dso: Papr_dso_handle_t; buf: PChar;
bufsize: apr_size_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dso_error' + LibSuff12;
{$endif}

File diff suppressed because it is too large Load Diff

View File

@ -1,433 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_file_info.h
* @brief APR File Information
}
{#include "apr.h"
#include "apr_user.h"
#include "apr_pools.h"
#include "apr_tables.h"
#include "apr_time.h"
#include "apr_errno.h"
#if APR_HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif}
{
* @defgroup apr_file_info File Information
* @ingroup APR
}
{ Many applications use the type member to determine the
* existance of a file or initialization of the file info,
* so the APR_NOFILE value must be distinct from APR_UNKFILE.
}
{ apr_filetype_e values for the filetype member of the
* apr_file_info_t structure
* @warning: Not all of the filetypes below can be determined.
* For example, a given platform might not correctly report
* a socket descriptor as APR_SOCK if that type isn't
* well-identified on that platform. In such cases where
* a filetype exists but cannot be described by the recognized
* flags below, the filetype will be APR_UNKFILE. If the
* filetype member is not determined, the type will be APR_NOFILE.
}
type
apr_filetype_e = (
APR_NOFILE = 0, {< no file type determined }
APR_REG, {< a regular file }
APR_DIR, {< a directory }
APR_CHR, {< a character device }
APR_BLK, {< a block device }
APR_PIPE, {< a FIFO / pipe }
APR_LNK, {< a symbolic link }
APR_SOCK, {< a [unix domain] socket }
APR_UNKFILE = 127 {< a file of some other unknown type }
);
{
* @defgroup apr_file_permissions File Permissions flags
* @
}
const
APR_FPROT_USETID = $8000; {< Set user id }
APR_FPROT_UREAD = $0400; {< Read by user }
APR_FPROT_UWRITE = $0200; {< Write by user }
APR_FPROT_UEXECUTE = $0100; {< Execute by user }
APR_FPROT_GSETID = $4000; {< Set group id }
APR_FPROT_GREAD = $0040; {< Read by group }
APR_FPROT_GWRITE = $0020; {< Write by group }
APR_FPROT_GEXECUTE = $0010; {< Execute by group }
APR_FPROT_WSTICKY = $2000; {< Sticky bit }
APR_FPROT_WREAD = $0004; {< Read by others }
APR_FPROT_WWRITE = $0002; {< Write by others }
APR_FPROT_WEXECUTE = $0001; {< Execute by others }
APR_FPROT_OS_DEFAULT = $0FFF; {< use OS's default permissions }
{ additional permission flags for apr_file_copy and apr_file_append }
APR_FPROT_FILE_SOURCE_PERMS = $1000; {< Copy source file's permissions }
{ backcompat }
APR_USETID = APR_FPROT_USETID; {< @deprecated @see APR_FPROT_USETID }
APR_UREAD = APR_FPROT_UREAD; {< @deprecated @see APR_FPROT_UREAD }
APR_UWRITE = APR_FPROT_UWRITE; {< @deprecated @see APR_FPROT_UWRITE }
APR_UEXECUTE = APR_FPROT_UEXECUTE; {< @deprecated @see APR_FPROT_UEXECUTE }
APR_GSETID = APR_FPROT_GSETID; {< @deprecated @see APR_FPROT_GSETID }
APR_GREAD = APR_FPROT_GREAD; {< @deprecated @see APR_FPROT_GREAD }
APR_GWRITE = APR_FPROT_GWRITE; {< @deprecated @see APR_FPROT_GWRITE }
APR_GEXECUTE = APR_FPROT_GEXECUTE; {< @deprecated @see APR_FPROT_GEXECUTE }
APR_WSTICKY = APR_FPROT_WSTICKY; {< @deprecated @see APR_FPROT_WSTICKY }
APR_WREAD = APR_FPROT_WREAD; {< @deprecated @see APR_FPROT_WREAD }
APR_WWRITE = APR_FPROT_WWRITE; {< @deprecated @see APR_FPROT_WWRITE }
APR_WEXECUTE = APR_FPROT_WEXECUTE; {< @deprecated @see APR_FPROT_WEXECUTE }
APR_OS_DEFAULT= APR_FPROT_OS_DEFAULT; {< @deprecated @see APR_FPROT_OS_DEFAULT }
APR_FILE_SOURCE_PERMS = APR_FPROT_FILE_SOURCE_PERMS; {< @deprecated @see APR_FPROT_FILE_SOURCE_PERMS }
{
* Structure for referencing directories.
}
type
apr_dir_t = record end;
Papr_dir_t = ^apr_dir_t;
PPapr_dir_t = ^Papr_dir_t;
{
* Structure for determining file permissions.
}
apr_fileperms_t = apr_int32_t;
{$if defined(WIN32) or defined(NETWARE)}
{
* Structure for determining the inode of the file.
}
apr_ino_t = apr_uint64_t;
{
* Structure for determining the device the file is on.
}
apr_dev_t = apr_uint32_t;
{$else}
{ The inode of the file. }
apr_ino_t = ino_t;
{
* Structure for determining the device the file is on.
}
apr_dev_t = dev_t;
{$endif}
{
* @defgroup apr_file_stat Stat Functions
* @
}
const
APR_FINFO_LINK = $00000001; {< Stat the link not the file itself if it is a link }
APR_FINFO_MTIME = $00000010; {< Modification Time }
APR_FINFO_CTIME = $00000020; {< Creation Time }
APR_FINFO_ATIME = $00000040; {< Access Time }
APR_FINFO_SIZE = $00000100; {< Size of the file }
APR_FINFO_CSIZE = $00000200; {< Storage size consumed by the file }
APR_FINFO_DEV = $00001000; {< Device }
APR_FINFO_INODE = $00002000; {< Inode }
APR_FINFO_NLINK = $00004000; {< Number of links }
APR_FINFO_TYPE = $00008000; {< Type }
APR_FINFO_USER = $00010000; {< User }
APR_FINFO_GROUP = $00020000; {< Group }
APR_FINFO_UPROT = $00100000; {< User protection bits }
APR_FINFO_GPROT = $00200000; {< Group protection bits }
APR_FINFO_WPROT = $00400000; {< World protection bits }
APR_FINFO_ICASE = $01000000; {< if dev is case insensitive }
APR_FINFO_NAME = $02000000; {< ->name in proper case }
APR_FINFO_MIN = $00008170; {< type, mtime, ctime, atime, size }
APR_FINFO_IDENT = $00003000; {< dev and inode }
APR_FINFO_OWNER = $00030000; {< user and group }
APR_FINFO_PROT = $00700000; {< all protections }
APR_FINFO_NORM = $0073b170; {< an atomic unix apr_stat() }
APR_FINFO_DIRENT = $02000000; {< an atomic unix apr_dir_read() }
{
* The file information structure. This is analogous to the POSIX
* stat structure.
}
type
apr_finfo_t = record
{ Allocates memory and closes lingering handles in the specified pool }
pool: Papr_pool_t;
{ The bitmask describing valid fields of this apr_finfo_t structure
* including all available 'wanted' fields and potentially more }
valid: apr_int32_t;
{ The access permissions of the file. Mimics Unix access rights. }
protection: apr_fileperms_t;
{ The type of file. One of APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE,
* APR_LNK or APR_SOCK. If the type is undetermined, the value is APR_NOFILE.
* If the type cannot be determined, the value is APR_UNKFILE.
}
filetype: apr_filetype_e;
{ The user id that owns the file }
user: apr_uid_t;
{ The group id that owns the file }
group: apr_gid_t;
{ The inode of the file. }
inode: apr_ino_t;
{ The id of the device the file is on. }
device: apr_dev_t;
{ The number of hard links to the file. }
nlink: apr_int32_t;
{ The size of the file }
size: apr_off_t;
{ The storage size consumed by the file }
csize: apr_off_t;
{ The time the file was last accessed }
atime: apr_time_t;
{ The time the file was last modified }
mtime: apr_time_t;
{ The time the file was last changed }
ctime: apr_time_t;
{ The pathname of the file (possibly unrooted) }
fname: PChar;
{ The file's name (no path) in filesystem case }
name: PChar;
{ The file's handle, if accessed (can be submitted to apr_duphandle) }
filehand: Papr_file_t;
end;
Papr_finfo_t = ^apr_finfo_t;
{
* get the specified file's stats. The file is specified by filename,
* instead of using a pre-opened file.
* @param finfo Where to store the information about the file, which is
* never touched if the call fails.
* @param fname The name of the file to stat.
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
values
* @param pool the pool to use to allocate the new file.
*
* @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
* not be filled in, and you need to check the @c finfo->valid bitmask
* to verify that what you're looking for is there.
}
function apr_stat(finfo: Papr_finfo_t; const fname: PChar;
wanted: apr_int32_t; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_stat' + LibSuff16;
{
* @defgroup apr_dir Directory Manipulation Functions
}
{
* Open the specified directory.
* @param new_dir The opened directory descriptor.
* @param dirname The full path to the directory (use / on all systems)
* @param pool The pool to use.
}
function apr_dir_open(new_dir: PPapr_dir_t; const dirname: PChar;
pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_open' + LibSuff12;
{
* close the specified directory.
* @param thedir the directory descriptor to close.
}
function apr_dir_close(thedir: Papr_dir_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_close' + LibSuff4;
{
* Read the next entry from the specified directory.
* @param finfo the file info structure and filled in by apr_dir_read
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
values
* @param thedir the directory descriptor returned from apr_dir_open
* @remark No ordering is guaranteed for the entries read.
*
* @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
* not be filled in, and you need to check the @c finfo->valid bitmask
* to verify that what you're looking for is there.
}
function apr_dir_read(finfo: Papr_finfo_t; wanted: apr_int32_t;
thedir: Papr_dir_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_read' + LibSuff12;
{
* Rewind the directory to the first entry.
* @param thedir the directory descriptor to rewind.
}
function apr_dir_rewind(thedir: Papr_dir_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_rewind' + LibSuff4;
{
* @defgroup apr_filepath Filepath Manipulation Functions
}
const
{ Cause apr_filepath_merge to fail if addpath is above rootpath }
APR_FILEPATH_NOTABOVEROOT = $01;
{ internal: Only meaningful with APR_FILEPATH_NOTABOVEROOT }
APR_FILEPATH_SECUREROOTTEST =$02;
{ Cause apr_filepath_merge to fail if addpath is above rootpath,
* even given a rootpath /foo/bar and an addpath ../bar/bash
}
APR_FILEPATH_SECUREROOT = $03;
{ Fail apr_filepath_merge if the merged path is relative }
APR_FILEPATH_NOTRELATIVE = $04;
{ Fail apr_filepath_merge if the merged path is absolute }
APR_FILEPATH_NOTABSOLUTE = $08;
{ Return the file system's native path format (e.g. path delimiters
* of ':' on MacOS9, '\' on Win32, etc.) }
APR_FILEPATH_NATIVE = $10;
{ Resolve the true case of existing directories and file elements
* of addpath, (resolving any aliases on Win32) and append a proper
* trailing slash if a directory
}
APR_FILEPATH_TRUENAME = $20;
{
* Extract the rootpath from the given filepath
* @param rootpath the root file path returned with APR_SUCCESS or APR_EINCOMPLETE
* @param filepath the pathname to parse for its root component
* @param flags the desired rules to apply, from
* <PRE>
* APR_FILEPATH_NATIVE Use native path seperators (e.g. '\' on Win32)
* APR_FILEPATH_TRUENAME Tests that the root exists, and makes it proper
* </PRE>
* @param p the pool to allocate the new path string from
* @remark on return, filepath points to the first non-root character in the
* given filepath. In the simplest example, given a filepath of "/foo",
* returns the rootpath of "/" and filepath points at "foo". This is far
* more complex on other platforms, which will canonicalize the root form
* to a consistant format, given the APR_FILEPATH_TRUENAME flag, and also
* test for the validity of that root (e.g., that a drive d:/ or network
* share //machine/foovol/).
* The function returns APR_ERELATIVE if filepath isn't rooted (an
* error), APR_EINCOMPLETE if the root path is ambigious (but potentially
* legitimate, e.g. "/" on Windows is incomplete because it doesn't specify
* the drive letter), or APR_EBADPATH if the root is simply invalid.
* APR_SUCCESS is returned if filepath is an absolute path.
}
function apr_filepath_root(const rootpath, filepath: PPChar;
flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_root' + LibSuff16;
{
* Merge additional file path onto the previously processed rootpath
* @param newpath the merged paths returned
* @param rootpath the root file path (NULL uses the current working path)
* @param addpath the path to add to the root path
* @param flags the desired APR_FILEPATH_ rules to apply when merging
* @param p the pool to allocate the new path string from
* @remark if the flag APR_FILEPATH_TRUENAME is given, and the addpath
* contains wildcard characters ('*', '?') on platforms that don't support
* such characters within filenames, the paths will be merged, but the
* result code will be APR_EPATHWILD, and all further segments will not
* reflect the true filenames including the wildcard and following segments.
}
function apr_filepath_merge(newpath: PPChar; const rootpath, addpath: PPChar;
flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_merge' + LibSuff20;
{
* Split a search path into separate components
* @param pathelts the returned components of the search path
* @param liststr the search path (e.g., <tt>getenv("PATH")</tt>)
* @param p the pool to allocate the array and path components from
* @remark empty path componenta do not become part of @a pathelts.
* @remark the path separator in @a liststr is system specific;
* e.g., ':' on Unix, ';' on Windows, etc.
}
function apr_filepath_list_split(pathelts: PPapr_array_header_t;
const liststr: PChar; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_list_split' + LibSuff12;
{
* Merge a list of search path components into a single search path
* @param liststr the returned search path; may be NULL if @a pathelts is empty
* @param pathelts the components of the search path
* @param p the pool to allocate the search path from
* @remark emtpy strings in the source array are ignored.
* @remark the path separator in @a liststr is system specific;
* e.g., ':' on Unix, ';' on Windows, etc.
}
function apr_filepath_list_merge(liststr: PPChar;
pathelts: Papr_array_header_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_list_merge' + LibSuff12;
{
* Return the default file path (for relative file names)
* @param path the default path string returned
* @param flags optional flag APR_FILEPATH_NATIVE to retrieve the
* default file path in os-native format.
* @param p the pool to allocate the default path string from
}
function apr_filepath_get(path: PPChar; flags: apr_int32_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_get' + LibSuff12;
{
* Set the default file path (for relative file names)
* @param path the default path returned
* @param p the pool to allocate any working storage
}
function apr_filepath_set(const path: PChar; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_set' + LibSuff8;
const
{ The FilePath character encoding is unknown }
APR_FILEPATH_ENCODING_UNKNOWN = 0;
{ The FilePath character encoding is locale-dependent }
APR_FILEPATH_ENCODING_LOCALE = 1;
{ The FilePath character encoding is UTF-8 }
APR_FILEPATH_ENCODING_UTF8 = 2;
{
* Determine the encoding used internally by the FilePath functions
* @param style points to a variable which receives the encoding style flag
* @param p the pool to allocate any working storage
* @remark Use @c apr_os_locale_encoding and/or @c apr_os_default_encoding
* to get the name of the path encoding if it's not UTF-8.
}
function apr_filepath_encoding(style: PInteger; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_encoding' + LibSuff8;

View File

@ -1,842 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_file_io.h
* @brief APR File I/O Handling
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_time.h"
#include "apr_errno.h"}
{.$include apr_file_info.inc}
{#include "apr_inherit.h"}
//#define APR_WANT_STDIO {< for SEEK_* }
//#define APR_WANT_IOVEC {< for apr_file_writev }
//#include "apr_want.h"
{
* @defgroup apr_file_io File I/O Handling Functions
* @ingroup APR
}
{
* @defgroup apr_file_open_flags File Open Flags/Routines
}
{ Note to implementors: Values in the range 0x00100000--0x80000000
are reserved for platform-specific values. }
const
APR_FOPEN_READ = $00001; {< Open the file for reading }
APR_FOPEN_WRITE = $00002; {< Open the file for writing }
APR_FOPEN_CREATE = $00004; {< Create the file if not there }
APR_FOPEN_APPEND = $00008; {< Append to the end of the file }
APR_FOPEN_TRUNCATE = $00010; {< Open the file and truncate
to 0 length }
APR_FOPEN_BINARY = $00020; {< Open the file in binary mode }
APR_FOPEN_EXCL = $00040; {< Open should fail if APR_CREATE
and file exists. }
APR_FOPEN_BUFFERED = $00080; {< Open the file for buffered I/O }
APR_FOPEN_DELONCLOSE= $00100; {< Delete the file after close }
APR_FOPEN_XTHREAD = $00200; {< Platform dependent tag to open
the file for use across multiple
threads }
APR_FOPEN_SHARELOCK = $00400; {< Platform dependent support for
higher level locked read/write
access to support writes across
process/machines }
APR_FOPEN_NOCLEANUP = $00800; {< Do not register a cleanup
when the file is opened }
APR_FOPEN_SENDFILE_ENABLED = $01000; {< Advisory flag that this
file should support
apr_socket_sendfile operation }
APR_FOPEN_LARGEFILE = $04000; {< Platform dependent flag to enable
large file support; WARNING see
below. }
{ backcompat }
APR_READ = APR_FOPEN_READ; {< @deprecated @see APR_FOPEN_READ }
APR_WRITE = APR_FOPEN_WRITE; {< @deprecated @see APR_FOPEN_WRITE }
APR_CREATE = APR_FOPEN_CREATE; {< @deprecated @see APR_FOPEN_CREATE }
APR_APPEND = APR_FOPEN_APPEND; {< @deprecated @see APR_FOPEN_APPEND }
APR_TRUNCATE = APR_FOPEN_TRUNCATE; {< @deprecated @see APR_FOPEN_TRUNCATE }
APR_BINARY = APR_FOPEN_BINARY; {< @deprecated @see APR_FOPEN_BINARY }
APR_EXCL = APR_FOPEN_EXCL; {< @deprecated @see APR_FOPEN_EXCL }
APR_BUFFERED = APR_FOPEN_BUFFERED; {< @deprecated @see APR_FOPEN_BUFFERED }
APR_DELONCLOSE = APR_FOPEN_DELONCLOSE; {< @deprecated @see APR_FOPEN_DELONCLOSE }
APR_XTHREAD = APR_FOPEN_XTHREAD; {< @deprecated @see APR_FOPEN_XTHREAD }
APR_SHARELOCK = APR_FOPEN_SHARELOCK; {< @deprecated @see APR_FOPEN_SHARELOCK }
APR_FILE_NOCLEANUP = APR_FOPEN_NOCLEANUP; {< @deprecated @see APR_FOPEN_NOCLEANUP }
APR_SENDFILE_ENABLED= APR_FOPEN_SENDFILE_ENABLED; {< @deprecated @see APR_FOPEN_SENDFILE_ENABLED }
APR_LARGEFILE = APR_FOPEN_LARGEFILE; {< @deprecated @see APR_FOPEN_LARGEFILE }
{ @warning The APR_LARGEFILE flag only has effect on some platforms
* where sizeof(apr_off_t) == 4. Where implemented, it allows opening
* and writing to a file which exceeds the size which can be
* represented by apr_off_t (2 gigabytes). When a file's size does
* exceed 2Gb, apr_file_info_get() will fail with an error on the
* descriptor, likewise apr_stat()/apr_lstat() will fail on the
* filename. apr_dir_read() will fail with APR_INCOMPLETE on a
* directory entry for a large file depending on the particular
* APR_FINFO_* flags. Generally, it is not recommended to use this
* flag. }
{
* @defgroup apr_file_seek_flags File Seek Flags
}
{
* @defgroup apr_file_attrs_set_flags File Attribute Flags
}
{ flags for apr_file_attrs_set }
APR_FILE_ATTR_READONLY = $01; {< File is read-only }
APR_FILE_ATTR_EXECUTABLE =$02; {< File is executable }
APR_FILE_ATTR_HIDDEN = $04; {< File is hidden }
{
* @defgroup apr_file_writev(_full) max iovec size
}
{$ifdef DOXYGEN}
APR_MAX_IOVEC_SIZE = 1024; {< System dependent maximum
size of an iovec array }
{#elif defined(IOV_MAX)
#define APR_MAX_IOVEC_SIZE IOV_MAX
#elif defined(MAX_IOVEC)
#define APR_MAX_IOVEC_SIZE MAX_IOVEC}
{$else}
APR_MAX_IOVEC_SIZE = 1024;
{$endif}
{ File attributes }
type
apr_fileattrs_t = apr_uint32_t;
{ Type to pass as whence argument to apr_file_seek. }
apr_seek_where_t = Integer;
{
* Structure for referencing files.
}
apr_file_t = record end;
// Papr_file_t = ^apr_file_t;
PPapr_file_t = ^Papr_file_t;
{ File lock types/flags }
{
* @defgroup apr_file_lock_types File Lock Types
}
const
APR_FLOCK_SHARED = 1; {< Shared lock. More than one process
or thread can hold a shared lock
at any given time. Essentially,
this is a "read lock", preventing
writers from establishing an
exclusive lock. }
APR_FLOCK_EXCLUSIVE = 2; {< Exclusive lock. Only one process
may hold an exclusive lock at any
given time. This is analogous to
a "write lock". }
APR_FLOCK_TYPEMASK = $000F; {< mask to extract lock type }
APR_FLOCK_NONBLOCK = $0010; {< do not block while acquiring the
file lock }
{
* Open the specified file.
* @param newf The opened file descriptor.
* @param fname The full path to the file (using / on all systems)
* @param flag Or'ed value of:
* <PRE>
* APR_READ open for reading
* APR_WRITE open for writing
* APR_CREATE create the file if not there
* APR_APPEND file ptr is set to end prior to all writes
* APR_TRUNCATE set length to zero if file exists
* APR_BINARY not a text file (This flag is ignored on
* UNIX because it has no meaning)
* APR_BUFFERED buffer the data. Default is non-buffered
* APR_EXCL return error if APR_CREATE and file exists
* APR_DELONCLOSE delete the file after closing.
* APR_XTHREAD Platform dependent tag to open the file
* for use across multiple threads
* APR_SHARELOCK Platform dependent support for higher
* level locked read/write access to support
* writes across process/machines
* APR_FILE_NOCLEANUP Do not register a cleanup with the pool
* passed in on the <EM>pool</EM> argument (see below).
* The apr_os_file_t handle in apr_file_t will not
* be closed when the pool is destroyed.
* APR_SENDFILE_ENABLED Open with appropriate platform semantics
* for sendfile operations. Advisory only,
* apr_socket_sendfile does not check this flag.
* </PRE>
* @param perm Access permissions for file.
* @param pool The pool to use.
* @remark If perm is APR_OS_DEFAULT and the file is being created, appropriate
* default permissions will be used. *arg1 must point to a valid file_t,
* or NULL (in which case it will be allocated)
}
function apr_file_open(newf: PPapr_file_t; const fname: PChar;
flag: apr_int32_t; perm: apr_fileperms_t;
pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_open' + LibSuff20;
{
* Close the specified file.
* @param file The file descriptor to close.
}
function apr_file_close(file_: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_close' + LibSuff4;
{
* delete the specified file.
* @param path The full path to the file (using / on all systems)
* @param pool The pool to use.
* @remark If the file is open, it won't be removed until all instances are closed.
}
function apr_file_remove(const path: PChar; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_remove' + LibSuff8;
{
* rename the specified file.
* @param from_path The full path to the original file (using / on all systems)
* @param to_path The full path to the new file (using / on all systems)
* @param pool The pool to use.
* @warning If a file exists at the new location, then it will be overwritten.
* Moving files or directories across devices may not be possible.
}
function apr_file_rename(const from_path, to_path: PChar; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_rename' + LibSuff12;
{
* copy the specified file to another file.
* @param from_path The full path to the original file (using / on all systems)
* @param to_path The full path to the new file (using / on all systems)
* @param perms Access permissions for the new file if it is created.
* In place of the usual or'd combination of file permissions, the
* value APR_FILE_SOURCE_PERMS may be given, in which case the source
* file's permissions are copied.
* @param pool The pool to use.
* @remark The new file does not need to exist, it will be created if required.
* @warning If the new file already exists, its contents will be overwritten.
}
function apr_file_copy(const from_path, to_path: PChar;
perms: apr_fileperms_t; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_copy' + LibSuff16;
{
* append the specified file to another file.
* @param from_path The full path to the source file (using / on all systems)
* @param to_path The full path to the destination file (using / on all systems)
* @param perms Access permissions for the destination file if it is created.
* In place of the usual or'd combination of file permissions, the
* value APR_FILE_SOURCE_PERMS may be given, in which case the source
* file's permissions are copied.
* @param pool The pool to use.
* @remark The new file does not need to exist, it will be created if required.
}
function apr_file_append(const from_path, to_path: PChar;
perms: apr_fileperms_t; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_append' + LibSuff16;
{
* Are we at the end of the file
* @param fptr The apr file we are testing.
* @remark Returns APR_EOF if we are at the end of file, APR_SUCCESS otherwise.
}
function apr_file_eof(fptr: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_eof' + LibSuff4;
{
* open standard error as an apr file pointer.
* @param thefile The apr file to use as stderr.
* @param pool The pool to allocate the file out of.
*
* @remark The only reason that the apr_file_open_std* functions exist
* is that you may not always have a stderr/out/in on Windows. This
* is generally a problem with newer versions of Windows and services.
*
* The other problem is that the C library functions generally work
* differently on Windows and Unix. So, by using apr_file_open_std*
* functions, you can get a handle to an APR struct that works with
* the APR functions which are supposed to work identically on all
* platforms.
}
function apr_file_open_stderr(thefile: PPapr_file_t;
pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_open_stderr' + LibSuff8;
{
* open standard output as an apr file pointer.
* @param thefile The apr file to use as stdout.
* @param pool The pool to allocate the file out of.
*
* @remark See remarks for apr_file_open_stdout.
}
function apr_file_open_stdout(thefile: PPapr_file_t;
pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_open_stdout' + LibSuff8;
{
* open standard input as an apr file pointer.
* @param thefile The apr file to use as stdin.
* @param pool The pool to allocate the file out of.
*
* @remark See remarks for apr_file_open_stdout.
}
function apr_file_open_stdin(thefile: PPapr_file_t;
pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_open_stdin' + LibSuff8;
{
* Read data from the specified file.
* @param thefile The file descriptor to read from.
* @param buf The buffer to store the data to.
* @param nbytes On entry, the number of bytes to read; on exit, the number
* of bytes read.
*
* @remark apr_file_read will read up to the specified number of
* bytes, but never more. If there isn't enough data to fill that
* number of bytes, all of the available data is read. The third
* argument is modified to reflect the number of bytes read. If a
* char was put back into the stream via ungetc, it will be the first
* character returned.
*
* @remark It is not possible for both bytes to be read and an APR_EOF
* or other error to be returned. APR_EINTR is never returned.
}
function apr_file_read(thefile: Papr_file_t; buf: Pointer;
nbytes: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_read' + LibSuff12;
{
* Write data to the specified file.
* @param thefile The file descriptor to write to.
* @param buf The buffer which contains the data.
* @param nbytes On entry, the number of bytes to write; on exit, the number
* of bytes written.
*
* @remark apr_file_write will write up to the specified number of
* bytes, but never more. If the OS cannot write that many bytes, it
* will write as many as it can. The third argument is modified to
* reflect the * number of bytes written.
*
* @remark It is possible for both bytes to be written and an error to
* be returned. APR_EINTR is never returned.
}
function apr_file_write(thefile: Papr_file_t; buf: Pointer;
nbytes: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_write' + LibSuff12;
{
* Write data from iovec array to the specified file.
* @param thefile The file descriptor to write to.
* @param vec The array from which to get the data to write to the file.
* @param nvec The number of elements in the struct iovec array. This must
* be smaller than APR_MAX_IOVEC_SIZE. If it isn't, the function
* will fail with APR_EINVAL.
* @param nbytes The number of bytes written.
*
* @remark It is possible for both bytes to be written and an error to
* be returned. APR_EINTR is never returned.
*
* @remark apr_file_writev is available even if the underlying
* operating system doesn't provide writev().
}
function apr_file_writev(thefile: Papr_file_t; const vec: Piovec;
nvec: apr_size_t; nbytes: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_writev' + LibSuff16;
{
* Read data from the specified file, ensuring that the buffer is filled
* before returning.
* @param thefile The file descriptor to read from.
* @param buf The buffer to store the data to.
* @param nbytes The number of bytes to read.
* @param bytes_read If non-NULL, this will contain the number of bytes read.
*
* @remark apr_file_read will read up to the specified number of
* bytes, but never more. If there isn't enough data to fill that
* number of bytes, then the process/thread will block until it is
* available or EOF is reached. If a char was put back into the
* stream via ungetc, it will be the first character returned.
*
* @remark It is possible for both bytes to be read and an error to be
* returned. And if *bytes_read is less than nbytes, an accompanying
* error is _always_ returned.
*
* @remark APR_EINTR is never returned.
}
function apr_file_read_full(thefile: Papr_file_t; buf: Pointer;
nbytes: apr_size_t; bytes_read: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_read_full' + LibSuff16;
{
* Write data to the specified file, ensuring that all of the data is
* written before returning.
* @param thefile The file descriptor to write to.
* @param buf The buffer which contains the data.
* @param nbytes The number of bytes to write.
* @param bytes_written If non-NULL, set to the number of bytes written.
*
* @remark apr_file_write will write up to the specified number of
* bytes, but never more. If the OS cannot write that many bytes, the
* process/thread will block until they can be written. Exceptional
* error such as "out of space" or "pipe closed" will terminate with
* an error.
*
* @remark It is possible for both bytes to be written and an error to
* be returned. And if *bytes_written is less than nbytes, an
* accompanying error is _always_ returned.
*
* @remark APR_EINTR is never returned.
}
function apr_file_write_full(thefile: Papr_file_t; buf: Pointer;
nbytes: apr_size_t; bytes_written: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_write_full' + LibSuff16;
{
* Write data from iovec array to the specified file, ensuring that all of the
* data is written before returning.
* @param thefile The file descriptor to write to.
* @param vec The array from which to get the data to write to the file.
* @param nvec The number of elements in the struct iovec array. This must
* be smaller than APR_MAX_IOVEC_SIZE. If it isn't, the function
* will fail with APR_EINVAL.
* @param nbytes The number of bytes written.
*
* @remark apr_file_writev_full is available even if the underlying
* operating system doesn't provide writev().
}
function apr_file_writev_full(thefile: Papr_file_t; const vec: Piovec;
nvec: apr_size_t; nbytes: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_writev_full' + LibSuff16;
{
* Write a character into the specified file.
* @param ch The character to write.
* @param thefile The file descriptor to write to
}
function apr_file_putc(ch: Char; thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_putc' + LibSuff8;
{
* get a character from the specified file.
* @param ch The character to read into
* @param thefile The file descriptor to read from
}
function apr_file_getc(ch: PChar; thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_getc' + LibSuff8;
{
* put a character back onto a specified stream.
* @param ch The character to write.
* @param thefile The file descriptor to write to
}
function apr_file_ungetc(ch: Char; thefile: PPapr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_ungetc' + LibSuff8;
{
* Get a string from a specified file.
* @param str The buffer to store the string in.
* @param len The length of the string
* @param thefile The file descriptor to read from
* @remark The buffer will be '\0'-terminated if any characters are stored.
}
function apr_file_gets(str: PChar; len: Integer;
thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_gets' + LibSuff12;
{
* Put the string into a specified file.
* @param str The string to write.
* @param thefile The file descriptor to write to
}
function apr_file_puts(const str: PChar; thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_puts' + LibSuff8;
{
* Flush the file's buffer.
* @param thefile The file descriptor to flush
}
function apr_file_flush(thefile: PPapr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_flush' + LibSuff4;
{
* duplicate the specified file descriptor.
* @param new_file The structure to duplicate into.
* @param old_file The file to duplicate.
* @param p The pool to use for the new file.
* @remark *new_file must point to a valid apr_file_t, or point to NULL
}
function apr_file_dup(new_file: PPapr_file_t; old_file: PPapr_file_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_dup' + LibSuff12;
{
* duplicate the specified file descriptor and close the original
* @param new_file The old file that is to be closed and reused
* @param old_file The file to duplicate
* @param p The pool to use for the new file
*
* @remark new_file MUST point at a valid apr_file_t. It cannot be NULL
}
function apr_file_dup2(new_file: PPapr_file_t; old_file: PPapr_file_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_dup2' + LibSuff12;
{
* move the specified file descriptor to a new pool
* @param new_file Pointer in which to return the new apr_file_t
* @param old_file The file to move
* @param p The pool to which the descriptor is to be moved
* @remark Unlike apr_file_dup2(), this function doesn't do an
* OS dup() operation on the underlying descriptor; it just
* moves the descriptor's apr_file_t wrapper to a new pool.
* @remark The new pool need not be an ancestor of old_file's pool.
* @remark After calling this function, old_file may not be used
}
function apr_file_setaside(new_file: PPapr_file_t; old_file: PPapr_file_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_setaside' + LibSuff12;
{
* Move the read/write file offset to a specified byte within a file.
* @param thefile The file descriptor
* @param where How to move the pointer, one of:
* <PRE>
* APR_SET -- set the offset to offset
* APR_CUR -- add the offset to the current position
* APR_END -- add the offset to the current file size
* </PRE>
* @param offset The offset to move the pointer to.
* @remark The third argument is modified to be the offset the pointer
was actually moved to.
}
function apr_file_seek(thefile: Papr_file_t;
where: apr_seek_where_t; offset: Papr_off_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_seek' + LibSuff12;
{
* Create an anonymous pipe.
* @param in The file descriptor to use as input to the pipe.
* @param out The file descriptor to use as output from the pipe.
* @param pool The pool to operate on.
}
function apr_file_pipe_create(in_: PPapr_file_t; out_: PPapr_file_t;
pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_pipe_create' + LibSuff12;
{
* Create a named pipe.
* @param filename The filename of the named pipe
* @param perm The permissions for the newly created pipe.
* @param pool The pool to operate on.
}
function apr_file_namedpipe_create(const filename: PChar;
perm: apr_fileperms_t; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_namedpipe_create' + LibSuff12;
{
* Get the timeout value for a pipe or manipulate the blocking state.
* @param thepipe The pipe we are getting a timeout for.
* @param timeout The current timeout value in microseconds.
}
function apr_file_pipe_timeout_get(thepipe: Papr_file_t;
timeout: Papr_interval_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_pipe_timeout_get' + LibSuff8;
{
* Set the timeout value for a pipe or manipulate the blocking state.
* @param thepipe The pipe we are setting a timeout on.
* @param timeout The timeout value in microseconds. Values < 0 mean wait
* forever, 0 means do not wait at all.
}
function apr_file_pipe_timeout_set(thepipe: Papr_file_t;
timeout: apr_interval_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_pipe_timeout_set' + LibSuff12;
{ file (un)locking functions. }
{
* Establish a lock on the specified, open file. The lock may be advisory
* or mandatory, at the discretion of the platform. The lock applies to
* the file as a whole, rather than a specific range. Locks are established
* on a per-thread/process basis; a second lock by the same thread will not
* block.
* @param thefile The file to lock.
* @param type The type of lock to establish on the file.
}
function apr_file_lock(thefile: Papr_file_t; type_: Integer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_lock' + LibSuff8;
{
* Remove any outstanding locks on the file.
* @param thefile The file to unlock.
}
function apr_file_unlock(thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_unlock' + LibSuff4;
{accessor and general file_io functions. }
{
* return the file name of the current file.
* @param new_path The path of the file.
* @param thefile The currently open file.
}
function apr_file_name_get(const newpath: PPChar; thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_name_get' + LibSuff8;
{
* Return the data associated with the current file.
* @param data The user data associated with the file.
* @param key The key to use for retreiving data associated with this file.
* @param file The currently open file.
}
function apr_file_data_get(data: PPointer; const key: PChar;
file_: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_data_get' + LibSuff12;
{
* Set the data associated with the current file.
* @param file The currently open file.
* @param data The user data to associate with the file.
* @param key The key to use for assocaiteing data with the file.
* @param cleanup The cleanup routine to use when the file is destroyed.
}
//function apr_file_data_set(ch: Char; thefile: PPapr_file_t): apr_status_t;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_file_data_set' + LibSuff4;
//APR_DECLARE(apr_status_t) (apr_file_t *file, void *data,
// const char *key,
// apr_status_t (*cleanup)(void *));
{
* Write a string to a file using a printf format.
* @param fptr The file to write to.
* @param format The format string
* @param ... The values to substitute in the format string
* @return The number of bytes written
}
function apr_file_printf(fptr: Papr_file_t; const format: PChar;
othres: array of const): Integer;
cdecl; external LibAPR name 'apr_file_printf';
{
* set the specified file's permission bits.
* @param fname The file (name) to apply the permissions to.
* @param perms The permission bits to apply to the file.
* @warning Some platforms may not be able to apply all of the available
* permission bits; APR_INCOMPLETE will be returned if some permissions
* are specified which could not be set.
*
* Platforms which do not implement this feature will return APR_ENOTIMPL.
}
function apr_file_perms_set(const fname: PChar;
perms: apr_fileperms_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_perms_set' + LibSuff8;
{
* Set attributes of the specified file.
* @param fname The full path to the file (using / on all systems)
* @param attributes Or'd combination of
* <PRE>
* APR_FILE_ATTR_READONLY - make the file readonly
* APR_FILE_ATTR_EXECUTABLE - make the file executable
* APR_FILE_ATTR_HIDDEN - make the file hidden
* </PRE>
* @param attr_mask Mask of valid bits in attributes.
* @param pool the pool to use.
* @remark This function should be used in preference to explict manipulation
* of the file permissions, because the operations to provide these
* attributes are platform specific and may involve more than simply
* setting permission bits.
* @warning Platforms which do not implement this feature will return
* APR_ENOTIMPL.
}
function apr_file_attrs_set(const fname: PChar;
attributes, attr_mask: apr_fileattrs_t;
pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_attrs_set' + LibSuff16;
{
* Set the mtime of the specified file.
* @param fname The full path to the file (using / on all systems)
* @param mtime The mtime to apply to the file.
* @param pool The pool to use.
* @warning Platforms which do not implement this feature will return
* APR_ENOTIMPL.
}
function apr_file_mtime_set(const fname: PChar;
mtime: apr_time_t; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_mtime_set' + LibSuff16;
{
* Create a new directory on the file system.
* @param path the path for the directory to be created. (use / on all systems)
* @param perm Permissions for the new direcoty.
* @param pool the pool to use.
}
function apr_dir_make(const path: PChar; perm: apr_fileperms_t;
pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_make' + LibSuff12;
{ Creates a new directory on the file system, but behaves like
* 'mkdir -p'. Creates intermediate directories as required. No error
* will be reported if PATH already exists.
* @param path the path for the directory to be created. (use / on all systems)
* @param perm Permissions for the new direcoty.
* @param pool the pool to use.
}
function apr_dir_make_recursive(const path: PChar;
perm: apr_fileperms_t; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_make_recursive' + LibSuff12;
{
* Remove directory from the file system.
* @param path the path for the directory to be removed. (use / on all systems)
* @param pool the pool to use.
}
function apr_dir_remove(const path: PChar; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_dir_remove' + LibSuff8;
{
* get the specified file's stats.
* @param finfo Where to store the information about the file.
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
* @param thefile The file to get information about.
}
function apr_file_info_get(finfo: Papr_finfo_t;
wanted: apr_int32_t; thefile: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_info_get' + LibSuff12;
{
* Truncate the file's length to the specified offset
* @param fp The file to truncate
* @param offset The offset to truncate to.
}
function apr_file_trunc(fp: Papr_file_t; offset: apr_off_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_trunc' + LibSuff12;
{
* Retrieve the flags that were passed into apr_file_open()
* when the file was opened.
* @return apr_int32_t the flags
}
function apr_file_flags_get(f: Papr_file_t): apr_int32_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_flags_get' + LibSuff4;
{
* Get the pool used by the file.
}
{APR_POOL_DECLARE_ACCESSOR(file);
}
{
* Set a file to be inherited by child processes.
*
}
{APR_DECLARE_INHERIT_SET(file);
}
{
* Unset a file from being inherited by child processes.
}
{APR_DECLARE_INHERIT_UNSET(file);
}
{
* Open a temporary file
* @param fp The apr file to use as a temporary file.
* @param templ The template to use when creating a temp file.
* @param flags The flags to open the file with. If this is zero,
* the file is opened with
* APR_CREATE | APR_READ | APR_WRITE | APR_EXCL | APR_DELONCLOSE
* @param p The pool to allocate the file out of.
* @remark
* This function generates a unique temporary file name from template.
* The last six characters of template must be XXXXXX and these are replaced
* with a string that makes the filename unique. Since it will be modified,
* template must not be a string constant, but should be declared as a character
* array.
*
}
function apr_file_mktemp(fp: PPapr_file_t; templ: PChar;
flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_file_mktemp' + LibSuff16;
{
* Find an existing directory suitable as a temporary storage location.
* @param temp_dir The temp directory.
* @param p The pool to use for any necessary allocations.
* @remark
* This function uses an algorithm to search for a directory that an
* an application can use for temporary storage. Once such a
* directory is found, that location is cached by the library. Thus,
* callers only pay the cost of this algorithm once if that one time
* is successful.
*
}
function apr_temp_dir_get(const temp_dir: PPChar; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_temp_dir_get' + LibSuff8;

View File

@ -1,219 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_general.h
* This is collection of oddballs that didn't fit anywhere else,
* and might move to more appropriate headers with the release
* of APR 1.0.
* @brief APR Miscellaneous library routines
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_errno.h"
#if APR_HAVE_SIGNAL_H
#include <signal.h>
#endif}
{
* @defgroup apr_general Miscellaneous library routines
* @ingroup APR
* This is collection of oddballs that didn't fit anywhere else,
* and might move to more appropriate headers with the release
* of APR 1.0.
}
const
{ a space }
APR_ASCII_BLANK = #040;
{ a carrige return }
APR_ASCII_CR = #015;
{ a line feed }
APR_ASCII_LF = #012;
{ a tab }
APR_ASCII_TAB = #011;
{ signal numbers typedef }
type
apr_signum_t = Integer;
{
* Finding offsets of elements within structures.
* Taken from the X code... they've sweated portability of this stuff
* so we don't have to. Sigh...
* @param p_type pointer type name
* @param field data field within the structure pointed to
* @return offset
}
{#if defined(CRAY) || (defined(__arm) && !defined(LINUX))
#ifdef __STDC__
#define APR_OFFSET(p_type,field) _Offsetof(p_type,field)
#else
#ifdef CRAY2
#define APR_OFFSET(p_type,field) \
(sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
#else} { !CRAY2 }
{#define APR_OFFSET(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
#endif} { !CRAY2 }
//#endif { __STDC__ }
//#else { ! (CRAY || __arm) }
//#define APR_OFFSET(p_type,field) \
// ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
//#endif { !CRAY }
{
* Finding offsets of elements within structures.
* @param s_type structure type name
* @param field data field within the structure
* @return offset
}
{#if defined(offsetof) && !defined(__cplusplus)
#define APR_OFFSETOF(s_type,field) offsetof(s_type,field)
#else
#define APR_OFFSETOF(s_type,field) APR_OFFSET(s_type*,field)
#endif}
{$ifndef DOXYGEN}
{ A couple of prototypes for functions in case some platform doesn't
* have it
}
{#if (!APR_HAVE_STRCASECMP) && (APR_HAVE_STRICMP)
#define strcasecmp(s1, s2) stricmp(s1, s2)
#elif (!APR_HAVE_STRCASECMP)
int strcasecmp(const char *a, const char *b);
#endif
#if (!APR_HAVE_STRNCASECMP) && (APR_HAVE_STRNICMP)
#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
#elif (!APR_HAVE_STRNCASECMP)
int strncasecmp(const char *a, const char *b, size_t n);
#endif}
{$endif}
{
* Alignment macros
}
{ APR_ALIGN() is only to be used to align on a power of 2 boundary }
{#define APR_ALIGN(size, boundary) \
(((size) + ((boundary) - 1)) & ~((boundary) - 1))}
{ Default alignment }
//#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
{
* String and memory functions
}
{ APR_STRINGIFY is defined here, and also in apr_release.h, so wrap it }
{$ifndef APR_STRINGIFY}
{ Properly quote a value as a string in the C preprocessor }
//#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
{ Helper macro for APR_STRINGIFY }
{#define APR_STRINGIFY_HELPER(n) #n}
{$endif}
{#if (!APR_HAVE_MEMMOVE)
#define memmove(a,b,c) bcopy(b,a,c)
#endif
#if (!APR_HAVE_MEMCHR)
void *memchr(const void *s, int c, size_t n);
#endif}
{
* @defgroup apr_library Library initialization and termination
}
{
* Setup any APR internal data structures. This MUST be the first function
* called for any APR library.
* @remark See apr_app_initialize if this is an application, rather than
* a library consumer of apr.
}
function apr_initialize: apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_initialize' + LibSuff0;
{
* Set up an application with normalized argc, argv (and optionally env) in
* order to deal with platform-specific oddities, such as Win32 services,
* code pages and signals. This must be the first function called for any
* APR program.
* @param argc Pointer to the argc that may be corrected
* @param argv Pointer to the argv that may be corrected
* @param env Pointer to the env that may be corrected, may be NULL
* @remark See apr_initialize if this is a library consumer of apr.
* Otherwise, this call is identical to apr_initialize, and must be closed
* with a call to apr_terminate at the end of program execution.
}
function apr_app_initialize(argc: PInteger; argv, env: PPChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_app_initialize' + LibSuff12;
{
* Tear down any APR internal data structures which aren't torn down
* automatically.
* @remark An APR program must call this function at termination once it
* has stopped using APR services. The APR developers suggest using
* atexit to ensure this is called. When using APR from a language
* other than C that has problems with the calling convention, use
* apr_terminate2() instead.
}
procedure apr_terminate;
cdecl; external LibAPR name 'apr_terminate';
{
* Tear down any APR internal data structures which aren't torn down
* automatically, same as apr_terminate
* @remark An APR program must call either the apr_terminate or apr_terminate2
* function once it it has finished using APR services. The APR
* developers suggest using atexit(apr_terminate) to ensure this is done.
* apr_terminate2 exists to allow non-c language apps to tear down apr,
* while apr_terminate is recommended from c language applications.
}
procedure apr_terminate2;
cdecl; external LibAPR name LibNamePrefix + 'apr_terminate2' + LibSuff0;
{
* @defgroup apr_random Random Functions
}
{$if defined(APR_HAS_RANDOM) or defined(DOXYGEN)}
{ TODO: I'm not sure this is the best place to put this prototype...}
{
* Generate random bytes.
* @param buf Buffer to fill with random bytes
* @param length Length of buffer in bytes (becomes apr_size_t in APR 1.0)
}
function apr_generate_random_bytes(buf: PChar; length: Integer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_generate_random_bytes' + LibSuff8;
{$endif}

View File

@ -1,232 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_hash.h
* @brief APR Hash Tables
}
//#include "apr_pools.h"
{
* @defgroup apr_hash Hash Tables
* @ingroup APR
* @
}
{
* When passing a key to apr_hash_set or apr_hash_get, this value can be
* passed to indicate a string-valued key, and have apr_hash compute the
* length automatically.
*
* @remark apr_hash will use strlen(key) for the length. The null-terminator
* is not included in the hash value (why throw a constant in?).
* Since the hash table merely references the provided key (rather
* than copying it), apr_hash_this() will return the null-term'd key.
}
const
APR_HASH_KEY_STRING = -1;
{
* Abstract type for hash tables.
}
type
apr_hash_t = record end;
Papr_hash_t = ^apr_hash_t;
{
* Abstract type for scanning hash tables.
}
apr_hash_index_t = record end;
Papr_hash_index_t = ^apr_hash_index_t;
{
* Callback functions for calculating hash values.
* @param key The key.
* @param klen The length of the key, or APR_HASH_KEY_STRING to use the string
* length. If APR_HASH_KEY_STRING then returns the actual key length.
}
apr_hashfunc_t = function (const key: PChar; klen: Papr_size_t): cuint;
{
* The default hash function.
}
function apr_hashfunc_default(const key: PChar; klen: Papr_size_t): cuint;
cdecl; external LibAPR name 'apr_hashfunc_default';
{
* Create a hash table.
* @param pool The pool to allocate the hash table out of
* @return The hash table just created
}
function apr_hash_make(pool: Papr_pool_t): Papr_hash_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_make' + LibSuff4;
{
* Create a hash table with a custom hash function
* @param pool The pool to allocate the hash table out of
* @param hash_func A custom hash function.
* @return The hash table just created
}
function apr_hash_make_custom(pool: Papr_pool_t; hash_func: apr_hashfunc_t): Papr_hash_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_make_custom' + LibSuff8;
{
* Make a copy of a hash table
* @param pool The pool from which to allocate the new hash table
* @param h The hash table to clone
* @return The hash table just created
* @remark Makes a shallow copy
}
function apr_hash_copy(pool: Papr_pool_t; const h: Papr_hash_t): Papr_hash_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_copy' + LibSuff8;
{
* Associate a value with a key in a hash table.
* @param ht The hash table
* @param key Pointer to the key
* @param klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.
* @param val Value to associate with the key
* @remark If the value is NULL the hash entry is deleted.
}
procedure apr_hash_set(ht: Papr_hash_t; const key: Pointer;
klen: apr_size_t; const val: Pointer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_set' + LibSuff16;
{
* Look up the value associated with a key in a hash table.
* @param ht The hash table
* @param key Pointer to the key
* @param klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.
* @return Returns NULL if the key is not present.
}
function apr_hash_get(ht: Papr_hash_t; const key: Pointer;
klen: apr_size_t): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_get' + LibSuff12;
{
* Start iterating over the entries in a hash table.
* @param p The pool to allocate the apr_hash_index_t iterator. If this
* pool is NULL, then an internal, non-thread-safe iterator is used.
* @param ht The hash table
* @remark There is no restriction on adding or deleting hash entries during
* an iteration (although the results may be unpredictable unless all you do
* is delete the current entry) and multiple iterations can be in
* progress at the same time.
* @example
}
{
* <PRE>
*
* int sum_values(apr_pool_t *p, apr_hash_t *ht)
* (
* apr_hash_index_t *hi;
* void *val;
* int sum = 0;
* for (hi = apr_hash_first(p, ht); hi; hi = apr_hash_next(hi)) (
* apr_hash_this(hi, NULL, NULL, &val);
* sum += *(int * )val;
* )
* return sum;
* )
* </PRE>
}
function apr_hash_first(p: Papr_pool_t; ht: Papr_hash_t): Papr_hash_index_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_first' + LibSuff8;
{
* Continue iterating over the entries in a hash table.
* @param hi The iteration state
* @return a pointer to the updated iteration state. NULL if there are no more
* entries.
}
function apr_hash_next(hi: Papr_hash_index_t): Papr_hash_index_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_next' + LibSuff4;
{
* Get the current entry's details from the iteration state.
* @param hi The iteration state
* @param key Return pointer for the pointer to the key.
* @param klen Return pointer for the key length.
* @param val Return pointer for the associated value.
* @remark The return pointers should point to a variable that will be set to the
* corresponding data, or they may be NULL if the data isn't interesting.
}
procedure apr_hash_this(hi: Papr_hash_index_t; const key: PPointer;
klen: Papr_size_t; val: PPointer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_this' + LibSuff16;
{
* Get the number of key/value pairs in the hash table.
* @param ht The hash table
* @return The number of key/value pairs in the hash table.
}
function apr_hash_count(ht: Papr_hash_t): cuint;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_count' + LibSuff4;
{
* Merge two hash tables into one new hash table. The values of the overlay
* hash override the values of the base if both have the same key. Both
* hash tables must use the same hash function.
* @param p The pool to use for the new hash table
* @param overlay The table to add to the initial table
* @param base The table that represents the initial values of the new table
* @return A new hash table containing all of the data from the two passed in
}
function apr_hash_overlay(p: Papr_pool_t;
const overlay, base: Papr_hash_t): Papr_hash_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_overlay' + LibSuff12;
{
* Merge two hash tables into one new hash table. If the same key
* is present in both tables, call the supplied merge function to
* produce a merged value for the key in the new table. Both
* hash tables must use the same hash function.
* @param p The pool to use for the new hash table
* @param h1 The first of the tables to merge
* @param h2 The second of the tables to merge
* @param merger A callback function to merge values, or NULL to
* make values from h1 override values from h2 (same semantics as
* apr_hash_overlay())
* @param data Client data to pass to the merger function
* @return A new hash table containing all of the data from the two passed in
}
type
apr_hash_merge_t = function (p: Papr_pool_t; const key: Pointer; klen: apr_size_t;
const h1_val, h2_val, data: Pointer): Pointer; cdecl;
function apr_hash_merge(p: Papr_pool_t;
const h1, h2: Papr_hash_t;
merger: apr_hash_merge_t; const data: Pointer): Papr_hash_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_hash_merge' + LibSuff20;
{
* Get a pointer to the pool which the hash table was created in
}
//APR_POOL_DECLARE_ACCESSOR(hash);

View File

@ -1,223 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_lib.h
* This is collection of oddballs that didn't fit anywhere else,
* and might move to more appropriate headers with the release
* of APR 1.0.
* @brief APR general purpose library routines
}
{#include "apr.h"
#include "apr_errno.h"
#if APR_HAVE_CTYPE_H
#include <ctype.h>
#endif
#if APR_HAVE_STDARG_H
#include <stdarg.h>
#endif}
{
* @defgroup apr_lib General Purpose Library Routines
* @ingroup APR
* This is collection of oddballs that didn't fit anywhere else,
* and might move to more appropriate headers with the release
* of APR 1.0.
}
{ A constant representing a 'large' string. }
const HUGE_STRING_LEN = 8192;
{
* Define the structures used by the APR general-purpose library.
}
{ @see apr_vformatter_buff_t }
type
Papr_vformatter_buff_t = ^apr_vformatter_buff_t;
{
* Structure used by the variable-formatter routines.
}
apr_vformatter_buff_t = record
{ The current position }
curpos: PChar;
{ The end position of the format string }
endpos: PChar;
end;
{
* return the final element of the pathname
* @param pathname The path to get the final element of
* @return the final element of the path
* @remark
* <PRE>
* For example:
* "/foo/bar/gum" -> "gum"
* "/foo/bar/gum/" -> ""
* "gum" -> "gum"
* "bs\\path\\stuff" -> "stuff"
* </PRE>
}
function apr_filepath_name_get(const pathname: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_filepath_name_get' + LibSuff4;
{
* apr_killpg
* Small utility macros to make things easier to read. Not usually a
* goal, to be sure..
}
//#ifdef WIN32
//#define apr_killpg(x, y)
//#else { WIN32 }
//#ifdef NO_KILLPG
//#define apr_killpg(x, y) (kill (-(x), (y)))
//#else { NO_KILLPG }
//#define apr_killpg(x, y) (killpg ((x), (y)))
//#endif { NO_KILLPG }
//#endif { WIN32 }
{
* apr_vformatter() is a generic printf-style formatting routine
* with some extensions.
* @param flush_func The function to call when the buffer is full
* @param c The buffer to write to
* @param fmt The format string
* @param ap The arguments to use to fill out the format string.
*
* @remark
* <PRE>
* The extensions are:
*
* %%pA takes a struct in_addr *, and prints it as a.b.c.d
* %%pI takes an apr_sockaddr_t * and prints it as a.b.c.d:port or
* [ipv6-address]:port
* %%pT takes an apr_os_thread_t * and prints it in decimal
* ('0' is printed if !APR_HAS_THREADS)
* %%pt takes an apr_os_thread_t * and prints it in hexadecimal
* ('0' is printed if !APR_HAS_THREADS)
* %%pp takes a void * and outputs it in hex
*
* The %%p hacks are to force gcc's printf warning code to skip
* over a pointer argument without complaining. This does
* mean that the ANSI-style %%p (output a void * in hex format) won't
* work as expected at all, but that seems to be a fair trade-off
* for the increased robustness of having printf-warnings work.
*
* Additionally, apr_vformatter allows for arbitrary output methods
* using the apr_vformatter_buff and flush_func.
*
* The apr_vformatter_buff has two elements curpos and endpos.
* curpos is where apr_vformatter will write the next byte of output.
* It proceeds writing output to curpos, and updating curpos, until
* either the end of output is reached, or curpos == endpos (i.e. the
* buffer is full).
*
* If the end of output is reached, apr_vformatter returns the
* number of bytes written.
*
* When the buffer is full, the flush_func is called. The flush_func
* can return -1 to indicate that no further output should be attempted,
* and apr_vformatter will return immediately with -1. Otherwise
* the flush_func should flush the buffer in whatever manner is
* appropriate, re apr_pool_t nitialize curpos and endpos, and return 0.
*
* Note that flush_func is only invoked as a result of attempting to
* write another byte at curpos when curpos >= endpos. So for
* example, it's possible when the output exactly matches the buffer
* space available that curpos == endpos will be true when
* apr_vformatter returns.
*
* apr_vformatter does not call out to any other code, it is entirely
* self-contained. This allows the callers to do things which are
* otherwise "unsafe". For example, apr_psprintf uses the "scratch"
* space at the unallocated end of a block, and doesn't actually
* complete the allocation until apr_vformatter returns. apr_psprintf
* would be completely broken if apr_vformatter were to call anything
* that used this same pool. Similarly http_bprintf() uses the "scratch"
* space at the end of its output buffer, and doesn't actually note
* that the space is in use until it either has to flush the buffer
* or until apr_vformatter returns.
* </PRE>
}
type
flush_func_t = function (b: Papr_vformatter_buff_t): Integer;
function apr_vformatter(flush_func: flush_func_t;
c: Papr_vformatter_buff_t; const fmt: PChar; ap: va_list): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_vformatter' + LibSuff16;
{
* Display a prompt and read in the password from stdin.
* @param prompt The prompt to display
* @param pwbuf Buffer to store the password
* @param bufsize The length of the password buffer.
* @remark If the password entered must be truncated to fit in
* the provided buffer, APR_ENAMETOOLONG will be returned.
* Note that the bufsize paramater is passed by reference for no
* reason; its value will never be modified by the apr_password_get()
* function.
}
function apr_password_get(const prompt: PChar;
pwbuf: PChar; bufsize: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_password_get' + LibSuff12;
{
* @defgroup apr_ctype ctype functions
* These macros allow correct support of 8-bit characters on systems which
* support 8-bit characters. Pretty dumb how the cast is required, but
* that's legacy libc for ya. These new macros do not support EOF like
* the standard macros do. Tough.
}
{ @see isalnum }
//#define apr_isalnum(c) (isalnum(((unsigned char)(c))))
{ @see isalpha }
//#define apr_isalpha(c) (isalpha(((unsigned char)(c))))
{ @see iscntrl }
//#define apr_iscntrl(c) (iscntrl(((unsigned char)(c))))
{ @see isdigit }
//#define apr_isdigit(c) (isdigit(((unsigned char)(c))))
{ @see isgraph }
//#define apr_isgraph(c) (isgraph(((unsigned char)(c))))
{ @see islower}
//#define apr_islower(c) (islower(((unsigned char)(c))))
{ @see isascii }
{#ifdef isascii
#define apr_isascii(c) (isascii(((unsigned char)(c))))
#else
#define apr_isascii(c) (((c) & ~0x7f)==0)
#endif}
{ @see isprint }
//#define apr_isprint(c) (isprint(((unsigned char)(c))))
{ @see ispunct }
//#define apr_ispunct(c) (ispunct(((unsigned char)(c))))
{ @see isspace }
//#define apr_isspace(c) (isspace(((unsigned char)(c))))
{ @see isupper }
//#define apr_isupper(c) (isupper(((unsigned char)(c))))
{ @see isxdigit }
//#define apr_isxdigit(c) (isxdigit(((unsigned char)(c))))
{ @see tolower }
function apr_tolower(c: Char): Char;
{ @see toupper }
function apr_toupper(c: Char): Char;

View File

@ -1,851 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_network_io.h
* @brief APR Network library
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_file_io.h"
#include "apr_errno.h"
#include "apr_inherit.h"
#if APR_HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif}
{
* @defgroup apr_network_io Network Routines
* @ingroup APR
}
const
{ Maximum seconds to linger }
APR_MAX_SECS_TO_LINGER = 30;
{ Maximum hostname length }
APRMAXHOSTLEN = 256;
{ Default 'any' address }
APR_ANYADDR = '0.0.0.0';
{
* @defgroup apr_sockopt Socket option definitions
}
APR_SO_LINGER = 1; {< Linger }
APR_SO_KEEPALIVE = 2; {< Keepalive }
APR_SO_DEBUG = 4; {< Debug }
APR_SO_NONBLOCK = 8; {< Non-blocking IO }
APR_SO_REUSEADDR = 16; {< Reuse addresses }
APR_SO_SNDBUF = 64; {< Send buffer }
APR_SO_RCVBUF = 128; {< Receive buffer }
APR_SO_DISCONNECTED = 256; {< Disconnected }
APR_TCP_NODELAY = 512; {< For SCTP sockets, this is mapped
* to STCP_NODELAY internally.
}
APR_TCP_NOPUSH = 1024; {< No push }
APR_RESET_NODELAY = 2048; {< This flag is ONLY set internally
* when we set APR_TCP_NOPUSH with
* APR_TCP_NODELAY set to tell us that
* APR_TCP_NODELAY should be turned on
* again when NOPUSH is turned off
}
APR_INCOMPLETE_READ = 4096; {< Set on non-blocking sockets
* (timeout != 0) on which the
* previous read() did not fill a buffer
* completely. the next apr_socket_recv()
* will first call select()/poll() rather than
* going straight into read(). (Can also
* be set by an application to force a
* select()/poll() call before the next
* read, in cases where the app expects
* that an immediate read would fail.)
}
APR_INCOMPLETE_WRITE = 8192;{< like APR_INCOMPLETE_READ, but for write
* @see APR_INCOMPLETE_READ
}
APR_IPV6_V6ONLY = 16384; {< Don't accept IPv4 connections on an
* IPv6 listening socket.
}
APR_TCP_DEFER_ACCEPT = 32768;{< Delay accepting of new connections
* until data is available.
* @see apr_socket_accept_filter
}
{ Define what type of socket shutdown should occur. }
type
apr_shutdown_how_e = (
APR_SHUTDOWN_READ, {< no longer allow read request }
APR_SHUTDOWN_WRITE, {< no longer allow write requests }
APR_SHUTDOWN_READWRITE {< no longer allow read or write requests }
);
const
APR_IPV4_ADDR_OK = $01; {< @see apr_sockaddr_info_get() }
APR_IPV6_ADDR_OK = $02; {< @see apr_sockaddr_info_get() }
{$ifndef APR_HAVE_IN_ADDR}
{
* We need to make sure we always have an in_addr type, so APR will just
* define it ourselves, if the platform doesn't provide it.
}
{type
in_addr = record
s_addr: apr_uint32_t; < storage to hold the IP#
end;}
{$endif}
{ @def APR_INADDR_NONE
* Not all platforms have a real INADDR_NONE. This macro replaces
* INADDR_NONE on all platforms.
}
{$ifdef INADDR_NONE}
APR_INADDR_NONE = INADDR_NONE;
{$else}
APR_INADDR_NONE = $ffffffff;
{$endif}
const
{
* @def APR_INET
* Not all platforms have these defined, so we'll define them here
* The default values come from FreeBSD 4.1.1
}
//#define APR_INET AF_INET
{ @def APR_UNSPEC
* Let the system decide which address family to use
}
{#ifdef AF_UNSPEC
#define APR_UNSPEC AF_UNSPEC
#else
#define APR_UNSPEC 0
#endif
#if APR_HAVE_IPV6
/** @def APR_INET6
* IPv6 Address Family. Not all platforms may have this defined.
*/
#define APR_INET6 AF_INET6
#endif}
{
* @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
}
APR_PROTO_TCP = 6; {< TCP }
APR_PROTO_UDP = 17; {< UDP }
APR_PROTO_SCTP = 132; {< SCTP }
{
* Enum to tell us if we're interested in remote or local socket
}
type
apr_interface_e = (
APR_LOCAL,
APR_REMOTE
);
{
* The specific declaration of inet_addr's ... some platforms fall back
* inet_network (this is not good, but necessary)
}
{$ifdef APR_HAVE_INET_ADDR}
apr_inet_addr = inet_addr;
{$else}
{$ifdef APR_HAVE_INET_NETWORK} { only DGUX, as far as I know }
{
* @warning
* not generally safe... inet_network() and inet_addr() perform
* different functions }
apr_inet_addr = inet_network;
{$endif}
{$endif}
{ A structure to represent sockets }
apr_socket_t = record
end;
Papr_socket_t = ^apr_socket_t;
PPapr_socket_t = ^Papr_socket_t;
{
* A structure to encapsulate headers and trailers for apr_socket_sendfile
}
Papr_hdtr_t = ^apr_hdtr_t;
{ A structure to represent in_addr }
apr_in_addr_t = record
end;
{ A structure to represent an IP subnet }
apr_ipsubnet_t = record
end;
Papr_ipsubnet_t = ^apr_ipsubnet_t;
PPapr_ipsubnet_t = ^Papr_ipsubnet_t;
{ @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... }
apr_port_t = apr_uint16_t;
Papr_port_t = ^apr_port_t;
{ @remark It's defined here as I think it should all be platform safe...
* @see apr_sockaddr_t
}
Papr_sockaddr_t = ^apr_sockaddr_t;
PPapr_sockaddr_t = ^Papr_sockaddr_t;
sa_t = record
case Integer of
{ IPv4 sockaddr structure }
0: (sin: sockaddr_in);
{$ifdef APR_HAVE_IPV6}
{ IPv6 sockaddr structure }
1: (sin6: sockaddr_in6);
{$endif}
{$ifdef APR_HAVE_SA_STORAGE}
{ Placeholder to ensure that the size of this union is not
* dependent on whether APR_HAVE_IPV6 is defined. }
2: (sas: sockaddr_storage);
{$endif}
end;
{
* APRs socket address type, used to ensure protocol independence
}
apr_sockaddr_t = record
{ The pool to use... }
pool: Papr_pool_t;
{ The hostname }
hostname: PChar;
{ Either a string of the port number or the service name for the port }
servname: PChar;
{ The numeric port }
port: apr_port_t;
{ The family }
family: apr_int32_t;
{ How big is the sockaddr we're using? }
salen: apr_socklen_t;
{ How big is the ip address structure we're using? }
ipaddr_len: cint;
{ How big should the address buffer be? 16 for v4 or 46 for v6
* used in inet_ntop... }
addr_str_len: cint;
{ This points to the IP address structure within the appropriate
* sockaddr structure. }
ipaddr_ptr: Pointer;
{ If multiple addresses were found by apr_sockaddr_info_get(), this
* points to a representation of the next address. }
next: Papr_sockaddr_t;
{ Union of either IPv4 or IPv6 sockaddr. }
sa: sa_t;
end;
{$ifdef APR_HAS_SENDFILE}
{
* Support reusing the socket on platforms which support it (from disconnect,
* specifically Win32.
* @remark Optional flag passed into apr_socket_sendfile()
}
APR_SENDFILE_DISCONNECT_SOCKET = 1;
{$endif}
{ A structure to encapsulate headers and trailers for apr_socket_sendfile }
apr_hdtr_t = record
{ An iovec to store the headers sent before the file. }
headers: Piovec;
{ number of headers in the iovec }
numheaders: cint;
{ An iovec to store the trailers sent after the file. }
trailers: Piovec;
{ number of trailers in the iovec }
numtrailers: Integer;
end;
{ function definitions }
{
* Create a socket.
* @param new_sock The new socket that has been set up.
* @param family The address family of the socket (e.g., APR_INET).
* @param type The type of the socket (e.g., SOCK_STREAM).
* @param cont The pool to use
}
function apr_socket_create(new_sock: PPapr_socket_t;
family, type_, protocol: Integer; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_create' + LibSuff20;
{
* Shutdown either reading, writing, or both sides of a socket.
* @param thesocket The socket to close
* @param how How to shutdown the socket. One of:
* <PRE>
* APR_SHUTDOWN_READ no longer allow read requests
* APR_SHUTDOWN_WRITE no longer allow write requests
* APR_SHUTDOWN_READWRITE no longer allow read or write requests
* </PRE>
* @see apr_shutdown_how_e
* @remark This does not actually close the socket descriptor, it just
* controls which calls are still valid on the socket.
}
function apr_socket_shutdown(thesocket: Papr_socket_t;
how: apr_shutdown_how_e): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_shutdown' + LibSuff8;
{
* Close a socket.
* @param thesocket The socket to close
}
function apr_socket_close(thesocket: Papr_socket_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_close' + LibSuff4;
{
* Bind the socket to its associated port
* @param sock The socket to bind
* @param sa The socket address to bind to
* @remark This may be where we will find out if there is any other process
* using the selected port.
}
function apr_socket_bind(sock: Papr_socket_t;
sa: Papr_sockaddr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_bind' + LibSuff8;
{
* Listen to a bound socket for connections.
* @param sock The socket to listen on
* @param backlog The number of outstanding connections allowed in the sockets
* listen queue. If this value is less than zero, the listen
* queue size is set to zero.
}
function apr_socket_listen(sock: Papr_socket_t;
backlog: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_listen' + LibSuff8;
{
* Accept a new connection request
* @param new_sock A copy of the socket that is connected to the socket that
* made the connection request. This is the socket which should
* be used for all future communication.
* @param sock The socket we are listening on.
* @param connection_pool The pool for the new socket.
}
function apr_socket_accept(new_sock: PPapr_socket_t;
sock: Papr_socket_t; connection_pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_accept' + LibSuff12;
{
* Issue a connection request to a socket either on the same machine
* or a different one.
* @param sock The socket we wish to use for our side of the connection
* @param sa The address of the machine we wish to connect to. If NULL,
* APR assumes that the sockaddr_in in the apr_socket is
* completely filled out.
}
function apr_socket_connect(sock: Papr_socket_t; sa: Papr_sockaddr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_connect' + LibSuff8;
{
* Create apr_sockaddr_t from hostname, address family, and port.
* @param sa The new apr_sockaddr_t.
* @param hostname The hostname or numeric address string to resolve/parse, or
* NULL to build an address that corresponds to 0.0.0.0 or ::
* @param family The address family to use, or APR_UNSPEC if the system should
* decide.
* @param port The port number.
* @param flags Special processing flags:
* <PRE>
* APR_IPV4_ADDR_OK first query for IPv4 addresses; only look
* for IPv6 addresses if the first query failed;
* only valid if family is APR_UNSPEC and hostname
* isn't NULL; mutually exclusive with
* APR_IPV6_ADDR_OK
* APR_IPV6_ADDR_OK first query for IPv6 addresses; only look
* for IPv4 addresses if the first query failed;
* only valid if family is APR_UNSPEC and hostname
* isn't NULL and APR_HAVE_IPV6; mutually exclusive
* with APR_IPV4_ADDR_OK
* </PRE>
* @param p The pool for the apr_sockaddr_t and associated storage.
}
function apr_sockaddr_info_get(sa: PPapr_socket_t;
const hostname: PChar; family: apr_int32_t;
port: apr_port_t; flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_sockaddr_info_get' + LibSuff24;
{
* Look up the host name from an apr_sockaddr_t.
* @param hostname The hostname.
* @param sa The apr_sockaddr_t.
* @param flags Special processing flags.
}
function apr_getnameinfo(hostname: PPChar; sa: Papr_socket_t; flags: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_getnameinfo' + LibSuff12;
{
* Parse hostname/IP address with scope id and port.
*
* Any of the following strings are accepted:
* 8080 (just the port number)
* www.apache.org (just the hostname)
* www.apache.org:8080 (hostname and port number)
* [fe80::1]:80 (IPv6 numeric address string only)
* [fe80::1%eth0] (IPv6 numeric address string and scope id)
*
* Invalid strings:
* (empty string)
* [abc] (not valid IPv6 numeric address string)
* abc:65536 (invalid port number)
*
* @param addr The new buffer containing just the hostname. On output, *addr
* will be NULL if no hostname/IP address was specfied.
* @param scope_id The new buffer containing just the scope id. On output,
* *scope_id will be NULL if no scope id was specified.
* @param port The port number. On output, *port will be 0 if no port was
* specified.
* ### FIXME: 0 is a legal port (per RFC 1700). this should
* ### return something besides zero if the port is missing.
* @param str The input string to be parsed.
* @param p The pool from which *addr and *scope_id are allocated.
* @remark If scope id shouldn't be allowed, check for scope_id != NULL in
* addition to checking the return code. If addr/hostname should be
* required, check for addr == NULL in addition to checking the
* return code.
}
function apr_parse_addr_port(addr, scope_id: PPChar; port: Papr_port_t;
const str: PChar; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_parse_addr_port' + LibSuff20;
{
* Get name of the current machine
* @param buf A buffer to store the hostname in.
* @param len The maximum length of the hostname that can be stored in the
* buffer provided. The suggested length is APRMAXHOSTLEN + 1.
* @param cont The pool to use.
* @remark If the buffer was not large enough, an error will be returned.
}
function apr_gethostname(buf: PChar; len: Integer; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_gethostname' + LibSuff12;
{
* Return the data associated with the current socket
* @param data The user data associated with the socket.
* @param key The key to associate with the user data.
* @param sock The currently open socket.
}
function apr_socket_data_get(data: PPointer; const key: PChar;
sock: Papr_sockaddr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_data_get' + LibSuff12;
{
* Set the data associated with the current socket.
* @param sock The currently open socket.
* @param data The user data to associate with the socket.
* @param key The key to associate with the data.
* @param cleanup The cleanup to call when the socket is destroyed.
}
type
cleanup_t = function (param: Pointer): apr_status_t;
function apr_socket_data_set(sock: Papr_socket_t; data: Pointer;
const key: PChar; cleanup: cleanup_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_data_set' + LibSuff16;
{
* Send data over a network.
* @param sock The socket to send the data over.
* @param buf The buffer which contains the data to be sent.
* @param len On entry, the number of bytes to send; on exit, the number
* of bytes sent.
* @remark
* <PRE>
* This functions acts like a blocking write by default. To change
* this behavior, use apr_socket_timeout_set().
*
* It is possible for both bytes to be sent and an error to be returned.
*
* APR_EINTR is never returned.
* </PRE>
}
function apr_socket_send(sock: Papr_socket_t; const buf: PChar;
len: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_send' + LibSuff12;
{
* Send multiple packets of data over a network.
* @param sock The socket to send the data over.
* @param vec The array of iovec structs containing the data to send
* @param nvec The number of iovec structs in the array
* @param len Receives the number of bytes actually written
* @remark
* <PRE>
* This functions acts like a blocking write by default. To change
* this behavior, use apr_socket_timeout_set().
* The number of bytes actually sent is stored in argument 3.
*
* It is possible for both bytes to be sent and an error to be returned.
*
* APR_EINTR is never returned.
* </PRE>
}
function apr_socket_sendv(sock: Papr_socket_t; const vec: Piovec;
nvec: apr_int32_t; len: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_sendv' + LibSuff16;
{
* @param sock The socket to send from
* @param where The apr_sockaddr_t describing where to send the data
* @param flags The flags to use
* @param buf The data to send
* @param len The length of the data to send
}
function apr_socket_sendto(sock: Papr_socket_t; where: Papr_sockaddr_t;
flags: apr_int32_t; const buf: PChar; len: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_sendto' + LibSuff20;
{
* @param from The apr_sockaddr_t to fill in the recipient info
* @param sock The socket to use
* @param flags The flags to use
* @param buf The buffer to use
* @param len The length of the available buffer
}
function apr_socket_recvfrom(from: Papr_sockaddr_t; sock: Papr_socket_t;
flags: apr_int32_t; buf: PChar; len: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_recvfrom' + LibSuff20;
{$if defined(APR_HAS_SENDFILE) or defined(DOXYGEN)}
{
* Send a file from an open file descriptor to a socket, along with
* optional headers and trailers
* @param sock The socket to which we're writing
* @param file The open file from which to read
* @param hdtr A structure containing the headers and trailers to send
* @param offset Offset into the file where we should begin writing
* @param len (input) - Number of bytes to send from the file
* (output) - Number of bytes actually sent,
* including headers, file, and trailers
* @param flags APR flags that are mapped to OS specific flags
* @remark This functions acts like a blocking write by default. To change
* this behavior, use apr_socket_timeout_set().
* The number of bytes actually sent is stored in argument 5.
}
function apr_socket_sendfile(sock: Papr_socket_t; file_: Papr_file_t;
hdtr: Papr_hdtr_t; offset: Papr_off_t; len: Papr_size_t;
flags: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_sendfile' + LibSuff24;
{$endif} { APR_HAS_SENDFILE }
{
* Read data from a network.
* @param sock The socket to read the data from.
* @param buf The buffer to store the data in.
* @param len On entry, the number of bytes to receive; on exit, the number
* of bytes received.
* @remark
* <PRE>
* This functions acts like a blocking read by default. To change
* this behavior, use apr_socket_timeout_set().
* The number of bytes actually sent is stored in argument 3.
*
* It is possible for both bytes to be received and an APR_EOF or
* other error to be returned.
*
* APR_EINTR is never returned.
* </PRE>
}
function apr_socket_recv(sock: Papr_socket_t; buf: PChar; len: Papr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_recv' + LibSuff12;
{
* Setup socket options for the specified socket
* @param sock The socket to set up.
* @param opt The option we would like to configure. One of:
* <PRE>
* APR_SO_DEBUG -- turn on debugging information
* APR_SO_KEEPALIVE -- keep connections active
* APR_SO_LINGER -- lingers on close if data is present
* APR_SO_NONBLOCK -- Turns blocking on/off for socket
* When this option is enabled, use
* the APR_STATUS_IS_EAGAIN() macro to
* see if a send or receive function
* could not transfer data without
* blocking.
* APR_SO_REUSEADDR -- The rules used in validating addresses
* supplied to bind should allow reuse
* of local addresses.
* APR_SO_SNDBUF -- Set the SendBufferSize
* APR_SO_RCVBUF -- Set the ReceiveBufferSize
* </PRE>
* @param on Value for the option.
}
function apr_socket_opt_set(sock: Papr_socket_t; opt, on_: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_opt_set' + LibSuff12;
{
* Setup socket timeout for the specified socket
* @param sock The socket to set up.
* @param t Value for the timeout.
* <PRE>
* t > 0 -- read and write calls return APR_TIMEUP if specified time
* elapsess with no data read or written
* t == 0 -- read and write calls never block
* t < 0 -- read and write calls block
* </PRE>
}
function apr_socket_timeout_set(sock: Papr_socket_t; t: apr_interval_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_timeout_set' + LibSuff12;
{
* Query socket options for the specified socket
* @param sock The socket to query
* @param opt The option we would like to query. One of:
* <PRE>
* APR_SO_DEBUG -- turn on debugging information
* APR_SO_KEEPALIVE -- keep connections active
* APR_SO_LINGER -- lingers on close if data is present
* APR_SO_NONBLOCK -- Turns blocking on/off for socket
* APR_SO_REUSEADDR -- The rules used in validating addresses
* supplied to bind should allow reuse
* of local addresses.
* APR_SO_SNDBUF -- Set the SendBufferSize
* APR_SO_RCVBUF -- Set the ReceiveBufferSize
* APR_SO_DISCONNECTED -- Query the disconnected state of the socket.
* (Currently only used on Windows)
* </PRE>
* @param on Socket option returned on the call.
}
function apr_socket_opt_get(sock: Papr_socket_t; opt, on_: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_opt_get' + LibSuff12;
{
* Query socket timeout for the specified socket
* @param sock The socket to query
* @param t Socket timeout returned from the query.
}
function apr_socket_timeout_get(sock: Papr_socket_t; t: Papr_interval_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_timeout_get' + LibSuff8;
{
* Query the specified socket if at the OOB/Urgent data mark
* @param sock The socket to query
* @param atmark Is set to true if socket is at the OOB/urgent mark,
* otherwise is set to false.
}
function apr_socket_atmark(sock: Papr_socket_t; atmark: PInteger): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_atmark' + LibSuff8;
{
* Return an apr_sockaddr_t from an apr_socket_t
* @param sa The returned apr_sockaddr_t.
* @param which Which interface do we want the apr_sockaddr_t for?
* @param sock The socket to use
}
function apr_socket_addr_get(sa: PPapr_sockaddr_t;
which: apr_interface_e; sock: Papr_socket_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_addr_get' + LibSuff12;
{
* Return the IP address (in numeric address string format) in
* an APR socket address. APR will allocate storage for the IP address
* string from the pool of the apr_sockaddr_t.
* @param addr The IP address.
* @param sockaddr The socket address to reference.
}
function apr_sockaddr_ip_get(addr: PPChar; sockaddr: Papr_sockaddr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_sockaddr_ip_get' + LibSuff8;
{
* See if the IP addresses in two APR socket addresses are
* equivalent. Appropriate logic is present for comparing
* IPv4-mapped IPv6 addresses with IPv4 addresses.
*
* @param addr1 One of the APR socket addresses.
* @param addr2 The other APR socket address.
* @remark The return value will be non-zero if the addresses
* are equivalent.
}
function apr_sockaddr_equal(const addr1, addr2: Papr_sockaddr_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_sockaddr_equal' + LibSuff8;
{
* Return the type of the socket.
* @param sock The socket to query.
* @param type The returned type (e.g., SOCK_STREAM).
}
function apr_socket_type_get(sock: Papr_socket_t; type_: PInteger): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_type_get' + LibSuff8;
{
* Given an apr_sockaddr_t and a service name, set the port for the service
* @param sockaddr The apr_sockaddr_t that will have its port set
* @param servname The name of the service you wish to use
}
function apr_getservbyname(sockaddr: Papr_sockaddr_t; const servname: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_getservbyname' + LibSuff8;
{
* Build an ip-subnet representation from an IP address and optional netmask or
* number-of-bits.
* @param ipsub The new ip-subnet representation
* @param ipstr The input IP address string
* @param mask_or_numbits The input netmask or number-of-bits string, or NULL
* @param p The pool to allocate from
}
function apr_ipsubnet_create(ipsub: PPapr_ipsubnet_t;
const ipstr, mask_or_numbits: PChar; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_ipsubnet_create' + LibSuff16;
{
* Test the IP address in an apr_sockaddr_t against a pre-built ip-subnet
* representation.
* @param ipsub The ip-subnet representation
* @param sa The socket address to test
* @return non-zero if the socket address is within the subnet, 0 otherwise
}
function apr_ipsubnet_test(ipsub: Papr_ipsubnet_t; sa: Papr_sockaddr_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_ipsubnet_test' + LibSuff8;
{$if defined(APR_HAS_SO_ACCEPTFILTER) or defined(DOXYGEN)}
{
* Set an OS level accept filter.
* @param sock The socket to put the accept filter on.
* @param name The accept filter
* @param args Any extra args to the accept filter. Passing NULL here removes
* the accept filter.
}
function apr_socket_accept_filter(sock: Papr_socket_t; name, args: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_accept_filter' + LibSuff12;
{$endif}
{
* Return the protocol of the socket.
* @param sock The socket to query.
* @param protocol The returned protocol (e.g., APR_PROTO_TCP).
}
function apr_socket_protocol_get(sock: Papr_socket_t; protocol: PInteger): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_socket_protocol_get' + LibSuff8;
{
* Get the pool used by the socket.
}
//APR_POOL_DECLARE_ACCESSOR(socket);
{
* Set a socket to be inherited by child processes.
}
//APR_DECLARE_INHERIT_SET(socket);
{
* Unset a socket from being inherited by child processes.
}
//APR_DECLARE_INHERIT_UNSET(socket);
{
* @defgroup apr_mcast IP Multicast
}
{
* Join a Multicast Group
* @param sock The socket to join a multicast group
* @param join The address of the multicast group to join
* @param iface Address of the interface to use. If NULL is passed, the
* default multicast interface will be used. (OS Dependent)
* @param source Source Address to accept transmissions from (non-NULL
* implies Source-Specific Multicast)
}
function apr_mcast_join(sock: Papr_socket_t;
join, iface, source: Papr_sockaddr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_mcast_join' + LibSuff16;
{
* Leave a Multicast Group. All arguments must be the same as
* apr_mcast_join.
* @param sock The socket to leave a multicast group
* @param addr The address of the multicast group to leave
* @param iface Address of the interface to use. If NULL is passed, the
* default multicast interface will be used. (OS Dependent)
* @param source Source Address to accept transmissions from (non-NULL
* implies Source-Specific Multicast)
}
function apr_mcast_leave(sock: Papr_socket_t;
addr, iface, source: Papr_sockaddr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_mcast_leave' + LibSuff16;
{
* Set the Multicast Time to Live (ttl) for a multicast transmission.
* @param sock The socket to set the multicast ttl
* @param ttl Time to live to Assign. 0-255, default=1
* @remark If the TTL is 0, packets will only be seen by sockets on
* the local machine, and only when multicast loopback is enabled.
}
function apr_mcast_hops(sock: Papr_socket_t; ttl: apr_byte_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_mcast_hops' + LibSuff8;
{
* Toggle IP Multicast Loopback
* @param sock The socket to set multicast loopback
* @param opt 0=disable, 1=enable
}
function apr_mcast_loopback(sock: Papr_socket_t; opt: apr_byte_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_mcast_loopback' + LibSuff8;
{
* Set the Interface to be used for outgoing Multicast Transmissions.
* @param sock The socket to set the multicast interface on
* @param iface Address of the interface to use for Multicast
}
function apr_mcast_interface(sock: Papr_socket_t; iface: Papr_sockaddr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_mcast_interface' + LibSuff8;

View File

@ -1,193 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_poll.h
* @brief APR Poll interface
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_errno.h"
#include "apr_inherit.h"
#include "apr_file_io.h"
#include "apr_network_io.h"
#if APR_HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif}
{
* @defgroup apr_poll Poll Routines
* @ingroup APR
}
{
* Poll options
}
const
APR_POLLIN = $001; {< Can read without blocking }
APR_POLLPRI = $002; {< Priority data available }
APR_POLLOUT = $004; {< Can write without blocking }
APR_POLLERR = $010; {< Pending error }
APR_POLLHUP = $020; {< Hangup occurred }
APR_POLLNVAL = $040; {< Descriptior invalid }
{
* Pollset Flags
}
APR_POLLSET_THREADSAFE = $001; {< Adding or Removing a Descriptor is thread safe }
{ Used in apr_pollfd_t to determine what the apr_descriptor is }
type
apr_datatype_e = (
APR_NO_DESC, {< nothing here }
APR_POLL_SOCKET, {< descriptor refers to a socket }
APR_POLL_FILE, {< descriptor refers to a file }
APR_POLL_LASTDESC {< descriptor is the last one in the list }
);
{ Union of either an APR file or socket. }
apr_descriptor = record
case Integer of
1: (f: Papr_file_t); {< file }
2: (s: Papr_socket_t); {< socket }
end;
{ @see apr_pollfd_t }
Papr_pollfd_t = ^apr_pollfd_t;
PPapr_pollfd_t = ^Papr_pollfd_t;
{ Poll descriptor set. }
apr_pollfd_t = record
p: Papr_pool_t; {< associated pool }
desc_type: apr_datatype_e; {< descriptor type }
reqevents: apr_int16_t; {< requested events }
rtnevents: apr_int16_t; {< returned events }
desc: apr_descriptor; {< @see apr_descriptor }
client_data: Pointer; {< allows app to associate context }
end;
{ General-purpose poll API for arbitrarily large numbers of
* file descriptors
}
{ Opaque structure used for pollset API }
type
apr_pollset_t = record end;
Papr_pollset_t = ^apr_pollset_t;
PPapr_pollset_t = ^Papr_pollset_t;
{
* Setup a pollset object
* @param pollset The pointer in which to return the newly created object
* @param size The maximum number of descriptors that this pollset can hold
* @param p The pool from which to allocate the pollset
* @param flags Optional flags to modify the operation of the pollset.
*
* @remark If flags equals APR_POLLSET_THREADSAFE, then a pollset is
* created on which it is safe to make concurrent calls to
* apr_pollset_add(), apr_pollset_remove() and apr_pollset_poll() from
* separate threads. This feature is only supported on some
* platforms; the apr_pollset_create() call will fail with
* APR_ENOTIMPL on platforms where it is not supported.
}
function apr_pollset_create(pollset: PPapr_pollset_t; size: apr_uint32_tso_handle_t;
p: Papr_pool_t; flags: apr_uint32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pollset_create' + LibSuff16;
{
* Destroy a pollset object
* @param pollset The pollset to destroy
}
function apr_pollset_destroy(pollset: Papr_pollset_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pollset_destroy' + LibSuff4;
{
* Add a socket or file descriptor to a pollset
* @param pollset The pollset to which to add the descriptor
* @param descriptor The descriptor to add
* @remark If you set client_data in the descriptor, that value
* will be returned in the client_data field whenever this
* descriptor is signalled in apr_pollset_poll().
* @remark If the pollset has been created with APR_POLLSET_THREADSAFE
* and thread T1 is blocked in a call to apr_pollset_poll() for
* this same pollset that is being modified via apr_pollset_add()
* in thread T2, the currently executing apr_pollset_poll() call in
* T1 will either: (1) automatically include the newly added descriptor
* in the set of descriptors it is watching or (2) return immediately
* with APR_EINTR. Option (1) is recommended, but option (2) is
* allowed for implementations where option (1) is impossible
* or impractical.
}
function apr_pollset_add(pollset: Papr_pollset_t;
const descriptor: Papr_pollfd_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pollset_add' + LibSuff8;
{
* Remove a descriptor from a pollset
* @param pollset The pollset from which to remove the descriptor
* @param descriptor The descriptor to remove
* @remark If the pollset has been created with APR_POLLSET_THREADSAFE
* and thread T1 is blocked in a call to apr_pollset_poll() for
* this same pollset that is being modified via apr_pollset_remove()
* in thread T2, the currently executing apr_pollset_poll() call in
* T1 will either: (1) automatically exclude the newly added descriptor
* in the set of descriptors it is watching or (2) return immediately
* with APR_EINTR. Option (1) is recommended, but option (2) is
* allowed for implementations where option (1) is impossible
* or impractical.
}
function apr_pollset_remove(pollset: Papr_pollset_t;
const descriptor: Papr_pollfd_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pollset_remove' + LibSuff8;
{
* Block for activity on the descriptor(s) in a pollset
* @param pollset The pollset to use
* @param timeout Timeout in microseconds
* @param num Number of signalled descriptors (output parameter)
* @param descriptors Array of signalled descriptors (output parameter)
}
function apr_pollset_poll(pollset: Papr_pollset_t; timeout: apr_interval_time_t;
num: Papr_int32_t; const descriptors: PPapr_pollfd_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pollset_poll' + LibSuff20;
{
* Poll the descriptors in the poll structure
* @param aprset The poll structure we will be using.
* @param numsock The number of descriptors we are polling
* @param nsds The number of descriptors signalled.
* @param timeout The amount of time in microseconds to wait. This is
* a maximum, not a minimum. If a descriptor is signalled, we
* will wake up before this time. A negative number means
* wait until a descriptor is signalled.
* @remark The number of descriptors signalled is returned in the third argument.
* This is a blocking call, and it will not return until either a
* descriptor has been signalled, or the timeout has expired.
* @remark The rtnevents field in the apr_pollfd_t array will only be filled-
* in if the return value is APR_SUCCESS.
}
function apr_poll(aprset: Papr_pollfd_t; numsock: apr_int32_t;
nsds: Papr_int32_t; timeout: apr_interval_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_poll' + LibSuff20;

View File

@ -1,702 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_pools.h
* @brief APR memory allocation
*
* Resource allocation routines...
*
* designed so that we don't have to keep track of EVERYTHING so that
* it can be explicitly freed later (a fundamentally unsound strategy ---
* particularly in the presence of die()).
*
* Instead, we maintain pools, and allocate items (both memory and I/O
* handlers) from the pools --- currently there are two, one for per
* transaction info, and one for config info. When a transaction is over,
* we can delete everything in the per-transaction apr_pool_t without fear,
* and without thinking too hard about it either.
}
{#include "apr.h"
#include "apr_errno.h"
#include "apr_general.h" for APR_STRINGIFY }
//#include "apr_want.h"
{
* @defgroup apr_pools Memory Pool Functions
* @ingroup APR
* @
}
{ The fundamental pool type }
type
apr_pool_t = record end;
Papr_pool_t = ^apr_pool_t;
PPapr_pool_t = ^Papr_pool_t;
{
* Declaration helper macro to construct apr_foo_pool_get()s.
*
* This standardized macro is used by opaque (APR) data types to return
* the apr_pool_t that is associated with the data type.
*
* APR_POOL_DECLARE_ACCESSOR() is used in a header file to declare the
* accessor function. A typical usage and result would be:
* <pre>
* APR_POOL_DECLARE_ACCESSOR(file);
* becomes:
* APR_DECLARE(apr_pool_t *) apr_file_pool_get(apr_file_t *ob);
* </pre>
* @remark Doxygen unwraps this macro (via doxygen.conf) to provide
* actual help for each specific occurance of apr_foo_pool_get.
* @remark the linkage is specified for APR. It would be possible to expand
* the macros to support other linkages.
}
{#define APR_POOL_DECLARE_ACCESSOR(type) \
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
(const apr_##type##_t *the##type)
}
{
* Implementation helper macro to provide apr_foo_pool_get()s.
*
* In the implementation, the APR_POOL_IMPLEMENT_ACCESSOR() is used to
* actually define the function. It assumes the field is named "pool".
}
{#define APR_POOL_IMPLEMENT_ACCESSOR(type) \
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
(const apr_##type##_t *the##type) \}
{ return the##type->pool; }
{
* Pool debug levels
*
* <pre>
* | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
* ---------------------------------
* | | | | | | | | x | General debug code enabled (useful in
* combination with --with-efence).
*
* | | | | | | | x | | Verbose output on stderr (report
* CREATE, CLEAR, DESTROY).
*
* | | | | x | | | | | Verbose output on stderr (report
* PALLOC, PCALLOC).
*
* | | | | | | x | | | Lifetime checking. On each use of a
* pool, check its lifetime. If the pool
* is out of scope, abort().
* In combination with the verbose flag
* above, it will output LIFE in such an
* event prior to aborting.
*
* | | | | | x | | | | Pool owner checking. On each use of a
* pool, check if the current thread is the
* pools owner. If not, abort(). In
* combination with the verbose flag above,
* it will output OWNER in such an event
* prior to aborting. Use the debug
* function apr_pool_owner_set() to switch
* a pools ownership.
*
* When no debug level was specified, assume general debug mode.
* If level 0 was specified, debugging is switched off
* </pre>
}
{$ifdef APR_POOL_DEBUG}
{/* If APR_POOL_DEBUG is blank, we get 1; if it is a number, we get -1. */
#if (APR_POOL_DEBUG - APR_POOL_DEBUG -1 == 1)
#undef APR_POOL_DEBUG
#define APR_POOL_DEBUG 1
#endif}
{$else}
const
APR_POOL_DEBUG = 0;
{$endif}
{ the place in the code where the particular function was called }
//#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
{ A function that is called when allocation fails. }
type
apr_abortfunc_t = function (retcode: Integer): Integer;
{
* APR memory structure manipulators (pools, tables, and arrays).
}
{
* Initialization
}
{
* Setup all of the internal structures required to use pools
* @remark Programs do NOT need to call this directly. APR will call this
* automatically from apr_initialize.
* @internal
}
function apr_pool_initialize: apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_initialize' + LibSuff0;
{
* Tear down all of the internal structures required to use pools
* @remark Programs do NOT need to call this directly. APR will call this
* automatically from apr_terminate.
* @internal
}
procedure apr_pool_terminate;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_terminate' + LibSuff0;
{
* Pool creation/destruction
}
{$include apr_allocator.inc}
{
* Create a new pool.
* @param newpool The pool we have just created.
* @param parent The parent pool. If this is NULL, the new pool is a root
* pool. If it is non-NULL, the new pool will inherit all
* of its parent pool's attributes, except the apr_pool_t will
* be a sub-pool.
* @param abort_fn A function to use if the pool cannot allocate more memory.
* @param allocator The allocator to use with the new pool. If NULL the
* allocator of the parent pool will be used.
}
function apr_pool_create_ex(newpool: PPapr_pool_t;
parent: Papr_pool_t; abort_fn: apr_abortfunc_t;
allocator: Papr_allocator_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_create_ex' + LibSuff16;
{
* Debug version of apr_pool_create_ex.
* @param newpool @see apr_pool_create.
* @param parent @see apr_pool_create.
* @param abort_fn @see apr_pool_create.
* @param allocator @see apr_pool_create.
* @param file_line Where the function is called from.
* This is usually APR_POOL__FILE_LINE__.
* @remark Only available when APR_POOL_DEBUG is defined.
* Call this directly if you have you apr_pool_create_ex
* calls in a wrapper function and wish to override
* the file_line argument to reflect the caller of
* your wrapper function. If you do not have
* apr_pool_create_ex in a wrapper, trust the macro
* and don't call apr_pool_create_ex_debug directly.
}
function apr_pool_create_ex_debug(newpool: PPapr_pool_t;
parent: Papr_pool_t; abort_fn: apr_abortfunc_t;
allocator: Papr_allocator_t; const file_line: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_create_ex_debug' + LibSuff20;
{#if APR_POOL_DEBUG
#define apr_pool_create_ex(newpool, parent, abort_fn, allocator) \
apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \
APR_POOL__FILE_LINE__)
#endif
}
{
* Create a new pool.
* @param newpool The pool we have just created.
* @param parent The parent pool. If this is NULL, the new pool is a root
* pool. If it is non-NULL, the new pool will inherit all
* of its parent pool's attributes, except the apr_pool_t will
* be a sub-pool.
}
{$ifdef DOXYGEN}
function apr_pool_create(newpool: PPapr_pool_t;
parent: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_create' + LibSuff8;
{$else}
{.$ifdef APR_POOL_DEBUG}
{#define apr_pool_create(newpool, parent) \
apr_pool_create_ex_debug(newpool, parent, NULL, NULL, \
APR_POOL__FILE_LINE__)}
{.$else}
function apr_pool_create(newpool: PPapr_pool_t; parent: Papr_pool_t): apr_status_t;
{.$endif}
{$endif}
{
* Find the pools allocator
* @param pool The pool to get the allocator from.
}
function apr_pool_allocator_get(pool: Papr_pool_t): Papr_allocator_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_allocator_get' + LibSuff4;
{
* Clear all memory in the pool and run all the cleanups. This also destroys all
* subpools.
* @param p The pool to clear
* @remark This does not actually free the memory, it just allows the pool
* to re-use this memory for the next allocation.
* @see apr_pool_destroy()
}
procedure apr_pool_clear(p: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_clear' + LibSuff4;
{
* Debug version of apr_pool_clear.
* @param p See: apr_pool_clear.
* @param file_line Where the function is called from.
* This is usually APR_POOL__FILE_LINE__.
* @remark Only available when APR_POOL_DEBUG is defined.
* Call this directly if you have you apr_pool_clear
* calls in a wrapper function and wish to override
* the file_line argument to reflect the caller of
* your wrapper function. If you do not have
* apr_pool_clear in a wrapper, trust the macro
* and don't call apr_pool_destroy_clear directly.
}
procedure apr_pool_clear_debug(p: Papr_pool_t; const file_line: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_clear_debug' + LibSuff8;
{#if APR_POOL_DEBUG
#define apr_pool_clear(p) \
apr_pool_clear_debug(p, APR_POOL__FILE_LINE__)
#endif}
{
* Destroy the pool. This takes similar action as apr_pool_clear() and then
* frees all the memory.
* @param p The pool to destroy
* @remark This will actually free the memory
}
procedure apr_pool_destroy(p: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_destroy' + LibSuff4;
{
* Debug version of apr_pool_destroy.
* @param p See: apr_pool_destroy.
* @param file_line Where the function is called from.
* This is usually APR_POOL__FILE_LINE__.
* @remark Only available when APR_POOL_DEBUG is defined.
* Call this directly if you have you apr_pool_destroy
* calls in a wrapper function and wish to override
* the file_line argument to reflect the caller of
* your wrapper function. If you do not have
* apr_pool_destroy in a wrapper, trust the macro
* and don't call apr_pool_destroy_debug directly.
}
procedure apr_pool_destroy_debug(p: Papr_pool_t; const file_line: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_destroy_debug' + LibSuff8;
{#if APR_POOL_DEBUG
#define apr_pool_destroy(p) \
apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
#endif}
{
* Memory allocation
}
{
* Allocate a block of memory from a pool
* @param p The pool to allocate from
* @param size The amount of memory to allocate
* @return The allocated memory
}
function apr_palloc(p: Papr_pool_t; size: apr_size_t): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_palloc' + LibSuff8;
{
* Debug version of apr_palloc
* @param p See: apr_palloc
* @param size See: apr_palloc
* @param file_line Where the function is called from.
* This is usually APR_POOL__FILE_LINE__.
* @return See: apr_palloc
}
function apr_palloc_debug(p: Papr_pool_t; size: apr_size_t;
const file_line: PChar): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_palloc_debug' + LibSuff12;
{#if APR_POOL_DEBUG
#define apr_palloc(p, size) \
apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
#endif
}
{
* Allocate a block of memory from a pool and set all of the memory to 0
* @param p The pool to allocate from
* @param size The amount of memory to allocate
* @return The allocated memory
}
{#if defined(DOXYGEN)}
function apr_pcalloc(p: Papr_pool_t; size: apr_size_t): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pcalloc' + LibSuff8;
{#elif !APR_POOL_DEBUG
#define apr_pcalloc(p, size) memset(apr_palloc(p, size), 0, size)
#endif
}
{
* Debug version of apr_pcalloc
* @param p See: apr_pcalloc
* @param size See: apr_pcalloc
* @param file_line Where the function is called from.
* This is usually APR_POOL__FILE_LINE__.
* @return See: apr_pcalloc
}
{APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *p, apr_size_t size,
const char *file_line);
#if APR_POOL_DEBUG
#define apr_pcalloc(p, size) \
apr_pcalloc_debug(p, size, APR_POOL__FILE_LINE__)
#endif
}
{
* Pool Properties
}
{
* Set the function to be called when an allocation failure occurs.
* @remark If the program wants APR to exit on a memory allocation error,
* then this function can be called to set the callback to use (for
* performing cleanup and then exiting). If this function is not called,
* then APR will return an error and expect the calling program to
* deal with the error accordingly.
}
procedure apr_pool_abort_set(abortfunc: apr_abortfunc_t; pool: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_abort_set' + LibSuff8;
{
* Get the abort function associated with the specified pool.
* @param pool The pool for retrieving the abort function.
* @return The abort function for the given pool.
}
function apr_pool_abort_get(pool: Papr_pool_t): apr_abortfunc_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_abort_get' + LibSuff4;
{
* Get the parent pool of the specified pool.
* @param pool The pool for retrieving the parent pool.
* @return The parent of the given pool.
}
function apr_pool_parent_get(pool: Papr_pool_t): Papr_pool_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_parent_get' + LibSuff4;
{
* Determine if pool a is an ancestor of pool b.
* @param a The pool to search
* @param b The pool to search for
* @return True if a is an ancestor of b, NULL is considered an ancestor
* of all pools.
* @remark if compiled with APR_POOL_DEBUG, this function will also
* return true if A is a pool which has been guaranteed by the caller
* (using apr_pool_join) to have a lifetime at least as long as some
* ancestor of pool B.
}
function apr_pool_is_ancestor(a, b: Papr_pool_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_is_ancestor' + LibSuff8;
{
* Tag a pool (give it a name)
* @param pool The pool to tag
* @param tag The tag
}
procedure apr_pool_tag(pool: Papr_pool_t; tag: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_tag' + LibSuff8;
{
* User data management
}
{
* Set the data associated with the current pool
* @param data The user data associated with the pool.
* @param key The key to use for association
* @param cleanup The cleanup program to use to cleanup the data (NULL if none)
* @param pool The current pool
* @warning The data to be attached to the pool should have a life span
* at least as long as the pool it is being attached to.
*
* Users of APR must take EXTREME care when choosing a key to
* use for their data. It is possible to accidentally overwrite
* data by choosing a key that another part of the program is using.
* Therefore it is advised that steps are taken to ensure that unique
* keys are used for all of the userdata objects in a particular pool
* (the same key in two different pools or a pool and one of its
* subpools is okay) at all times. Careful namespace prefixing of
* key names is a typical way to help ensure this uniqueness.
}
//function apr_pool_userdata_set(
// const data: Pointer; const key: PChar;
// cleanup: function(param: Pointer): apr_status_t,
// pool: Papr_pool_t): apr_status_t;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_pool_userdata_set' + LibSuff20;
{
* Set the data associated with the current pool
* @param data The user data associated with the pool.
* @param key The key to use for association
* @param cleanup The cleanup program to use to cleanup the data (NULL if none)
* @param pool The current pool
* @note same as apr_pool_userdata_set(), except that this version doesn't
* make a copy of the key (this function is useful, for example, when
* the key is a string literal)
* @warning This should NOT be used if the key could change addresses by
* any means between the apr_pool_userdata_setn() call and a
* subsequent apr_pool_userdata_get() on that key, such as if a
* static string is used as a userdata key in a DSO and the DSO could
* be unloaded and reloaded between the _setn() and the _get(). You
* MUST use apr_pool_userdata_set() in such cases.
* @warning More generally, the key and the data to be attached to the
* pool should have a life span at least as long as the pool itself.
*
}
//function apr_pool_userdata_setn(
// const data: Pointer; const key: PChar;
// cleanup: function(param: Pointer): apr_status_t,
// pool: Papr_pool_t): apr_status_t;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_pool_userdata_setn' + LibSuff20;
{
* Return the data associated with the current pool.
* @param data The user data associated with the pool.
* @param key The key for the data to retrieve
* @param pool The current pool.
}
function apr_pool_userdata_get(data: PPointer; const key: PChar;
pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_userdata_get' + LibSuff12;
{
* @defgroup PoolCleanup Pool Cleanup Functions
*
* Cleanups are performed in the reverse order they were registered. That is:
* Last In, First Out. A cleanup function can safely allocate memory from
* the pool that is being cleaned up. It can also safely register additional
* cleanups which will be run LIFO, directly after the current cleanup
* terminates. Cleanups have to take caution in calling functions that
* create subpools. Subpools, created during cleanup will NOT automatically
* be cleaned up. In other words, cleanups are to clean up after themselves.
*
}
{
* Register a function to be called when a pool is cleared or destroyed
* @param p The pool register the cleanup with
* @param data The data to pass to the cleanup function.
* @param plain_cleanup The function to call when the pool is cleared
* or destroyed
* @param child_cleanup The function to call when a child process is about
* to exec - this function is called in the child, obviously!
}
type
plain_cleanup_t = function(param: Pointer): apr_status_t; cdecl;
child_cleanup_t = function(param: Pointer): apr_status_t; cdecl;
procedure apr_pool_cleanup_register(p: Papr_pool_t;
const data: Pointer;
plain_cleanup: plain_cleanup_t;
child_cleanup: child_cleanup_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_cleanup_register' + LibSuff16;
{
* Remove a previously registered cleanup function
* @param p The pool remove the cleanup from
* @param data The data to remove from cleanup
* @param cleanup The function to remove from cleanup
* @remarks For some strange reason only the plain_cleanup is handled by this
* function
}
//procedure apr_pool_cleanup_for_exec;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_pool_cleanup_for_exec' + LibSuff0;
//APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data,
// apr_status_t cleanup)(void );
{
* Replace the child cleanup of a previously registered cleanup
* @param p The pool of the registered cleanup
* @param data The data of the registered cleanup
* @param plain_cleanup The plain cleanup function of the registered cleanup
* @param child_cleanup The function to register as the child cleanup
}
//procedure apr_pool_cleanup_for_exec;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_pool_cleanup_for_exec' + LibSuff0;
{APR_DECLARE(void) apr_pool_child_cleanup_set(
apr_pool_t *p,
const void *data,
apr_status_t plain_cleanup)(void ,
apr_status_t child_cleanup)(void );
}
{
* Run the specified cleanup function immediately and unregister it.
*
* The cleanup most recently registered with @a p having the same values of
* @a data and @a cleanup will be removed and @a cleanup will be called
* with @a data as the argument.
*
* @param p The pool to remove the cleanup from
* @param data The data to remove from cleanup
* @param cleanup The function to remove from cleanup
}
//procedure apr_pool_cleanup_for_exec;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_pool_cleanup_for_exec' + LibSuff0;
{APR_DECLARE(apr_status_t) apr_pool_cleanup_run(
apr_pool_t *p,
void *data,
apr_status_t cleanup)(void );}
{
* An empty cleanup function.
*
* Passed to apr_pool_cleanup_register() when no cleanup is required.
*
* @param data The data to cleanup, will not be used by this function.
}
//APR_DECLARE_NONSTD(apr_status_t) apr_pool_cleanup_null(void *data);
{
* Run all registered child cleanups, in preparation for an exec()
* call in a forked child -- close files, etc., but *don't* flush I/O
* buffers, *don't* wait for subprocesses, and *don't* free any
* memory.
}
procedure apr_pool_cleanup_for_exec;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_cleanup_for_exec' + LibSuff0;
{
* @defgroup PoolDebug Pool Debugging functions.
*
* pools have nested lifetimes -- sub_pools are destroyed when the
* parent pool is cleared. We allow certain liberties with operations
* on things such as tables (and on other structures in a more general
* sense) where we allow the caller to insert values into a table which
* were not allocated from the table's pool. The table's data will
* remain valid as long as all the pools from which its values are
* allocated remain valid.
*
* For example, if B is a sub pool of A, and you build a table T in
* pool B, then it's safe to insert data allocated in A or B into T
* (because B lives at most as long as A does, and T is destroyed when
* B is cleared/destroyed). On the other hand, if S is a table in
* pool A, it is safe to insert data allocated in A into S, but it
* is *not safe* to insert data allocated from B into S... because
* B can be cleared/destroyed before A is (which would leave dangling
* pointers in T's data structures).
*
* In general we say that it is safe to insert data into a table T
* if the data is allocated in any ancestor of T's pool. This is the
* basis on which the APR_POOL_DEBUG code works -- it tests these ancestor
* relationships for all data inserted into tables. APR_POOL_DEBUG also
* provides tools (apr_pool_find, and apr_pool_is_ancestor) for other
* folks to implement similar restrictions for their own data
* structures.
*
* However, sometimes this ancestor requirement is inconvenient --
* sometimes it's necessary to create a sub pool where the sub pool is
* guaranteed to have the same lifetime as the parent pool. This is a
* guarantee implemented by the *caller*, not by the pool code. That
* is, the caller guarantees they won't destroy the sub pool
* individually prior to destroying the parent pool.
*
* In this case the caller must call apr_pool_join() to indicate this
* guarantee to the APR_POOL_DEBUG code.
*
* These functions are only implemented when #APR_POOL_DEBUG is set.
*
}
{$if defined(APR_POOL_DEBUG) or defined(DOXYGEN)}
{
* Guarantee that a subpool has the same lifetime as the parent.
* @param p The parent pool
* @param sub The subpool
}
procedure apr_pool_join(p, sub: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_join' + LibSuff8;
{
* Find a pool from something allocated in it.
* @param mem The thing allocated in the pool
* @return The pool it is allocated in
}
function apr_pool_find(const mem: Pointer): Papr_pool_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_find' + LibSuff4;
{
* Report the number of bytes currently in the pool
* @param p The pool to inspect
* @param recurse Recurse/include the subpools' sizes
* @return The number of bytes
}
function apr_pool_num_bytes(p: Papr_pool_t; recurse: Integer): apr_size_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_num_bytes' + LibSuff8;
{
* Lock a pool
* @param pool The pool to lock
* @param flag The flag
}
procedure apr_pool_lock(pool: Papr_pool_t; flag: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_lock' + LibSuff8;
{$else} { APR_POOL_DEBUG or DOXYGEN }
{#ifdef apr_pool_join
#undef apr_pool_join
#endif
#define apr_pool_join(a,b)
#ifdef apr_pool_lock
#undef apr_pool_lock
#endif
#define apr_pool_lock(pool, lock)}
{$endif} { APR_POOL_DEBUG or DOXYGEN }

View File

@ -1,538 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{ This header file is where you should put ANY platform specific information.
* This should be the only header file that programs need to include that
* actually has platform dependant code which refers to the .
}
{
* @file apr_portable.h
* @brief APR Portability Routines
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_thread_proc.h"
#include "apr_file_io.h"
#include "apr_network_io.h"
#include "apr_errno.h"
#include "apr_global_mutex.h"
#include "apr_proc_mutex.h"
#include "apr_time.h"
#include "apr_dso.h"
#include "apr_shm.h"
#if APR_HAVE_DIRENT_H
#include <dirent.h>
#endif
#if APR_HAVE_FCNTL_H
#include <fcntl.h>
#endif
#if APR_HAVE_PTHREAD_H
#include <pthread.h>
#endif}
{
* @defgroup apr_portabile Portability Routines
* @ingroup APR
}
type
{$ifdef WINDOWS}
{ The primitives for Windows types }
apr_os_file_t = THandle;
apr_os_dir_t = THandle;
apr_os_sock_t = TSocket;
apr_os_proc_mutex_t = THandle;
apr_os_thread_t = THandle;
apr_os_proc_t = THandle;
apr_os_threadkey_t = Cardinal;
apr_os_imp_time_t = TFILETIME;
apr_os_exp_time_t = TSYSTEMTIME;
apr_os_dso_handle_t = THandle;
apr_os_shm_t = THandle;
{$else}
{$ifdef OS2}
HFILE apr_os_file_t;
HDIR apr_os_dir_t;
int apr_os_sock_t;
HMTX apr_os_proc_mutex_t;
TID apr_os_thread_t;
PID apr_os_proc_t;
PULONG apr_os_threadkey_t;
struct timeval apr_os_imp_time_t;
struct tm apr_os_exp_time_t;
HMODULE apr_os_dso_handle_t;
apr_os_shm_t: Pointer;
{$else}
{$ifdef BEOS}
#include <kernel/OS.h>
#include <kernel/image.h>
apr_os_proc_mutex_t = record
sem_id sem;
int32 ben;
end;
apr_os_file_t: cint;
DIR apr_os_dir_t;
apr_os_sock_t: cint;
struct apr_os_proc_mutex_t apr_os_proc_mutex_t;
thread_id apr_os_thread_t;
thread_id apr_os_proc_t;
apr_os_threadkey_t: cint;
struct timeval apr_os_imp_time_t;
struct tm apr_os_exp_time_t;
image_id apr_os_dso_handle_t;
apr_os_shm_t: Pointer;
{$else}
{$ifdef NETWARE}
apr_os_file_t: cint;
DIR apr_os_dir_t;
apr_os_sock_t: cint;
NXMutex_t apr_os_proc_mutex_t;
NXThreadId_t apr_os_thread_t;
long apr_os_proc_t;
NXKey_t apr_os_threadkey_t;
struct timeval apr_os_imp_time_t;
struct tm apr_os_exp_time_t;
apr_os_dso_handle_t: Pointer;
apr_os_shm_t: Pointer;
{$else}
{ Any other OS should go above this one. This is the lowest common
* denominator typedefs for all UNIX-like systems. :)
}
{ Basic OS process mutex structure. }
apr_os_proc_mutex_t = record
{$if defined(APR_HAS_SYSVSEM_SERIALIZE) or defined(APR_HAS_FCNTL_SERIALIZE) or defined(APR_HAS_FLOCK_SERIALIZE)}
crossproc: Integer;
{$endif}
{$ifdef APR_HAS_PROC_PTHREAD_SERIALIZE}
pthread_mutex_t *pthread_interproc;
{$endif}
{$ifdef APR_HAS_THREADS}
{ If no threads, no need for thread locks }
{$if APR_USE_PTHREAD_SERIALIZE}
pthread_mutex_t *intraproc;
{$endif}
{$endif}
end;
apr_os_file_t: Integer; {< native file }
typedef DIR apr_os_dir_t; {< native dir }
apr_os_sock_t: Integer; {< native dir }
typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t; {< native proces
* mutex
}
{$if defined(APR_HAS_THREADS) and defined(APR_HAVE_PTHREAD_H)}
typedef pthread_t apr_os_thread_t; {< native thread }
typedef pthread_key_t apr_os_threadkey_t; {< native thread address
* space }
{$endif}
typedef pid_t apr_os_proc_t; {< native pid }
typedef struct timeval apr_os_imp_time_t; {< native timeval }
typedef struct tm apr_os_exp_time_t; {< native tm }
{ @var apr_os_dso_handle_t
* native dso types
}
{$ifdef HPUX}
#include <dl.h>
typedef shl_t apr_os_dso_handle_t;
{$else}
{$ifdef DARWIN}
#include <mach-o/dyld.h>
typedef NSModule apr_os_dso_handle_t;
{$else}
typedef void * apr_os_dso_handle_t;
{$endif}
{$endif}
typedef void* apr_os_shm_t; {< native SHM }
{$endif}
{$endif}
{$endif}
{$endif}
Papr_os_sock_t = ^apr_os_sock_t;
{
* @typedef apr_os_sock_info_t
* @brief alias for local OS socket
}
{
* everything APR needs to know about an active socket to construct
* an APR socket from it; currently, this is platform-independent
}
apr_os_sock_info_t = record
os_sock: Papr_os_sock_t; {< always required }
local: Psockaddr; {< NULL if not yet bound }
remote: Psockaddr; {< NULL if not connected }
family: Integer; {< always required (APR_INET, APR_INET6, etc.) }
type_: Integer; {< always required (SOCK_STREAM, SOCK_DGRAM, etc.) }
protocol: Integer; {< 0 or actual protocol (APR_PROTO_SCTP, APR_PROTO_TCP, etc.) }
end;
Papr_os_sock_info_t = ^apr_os_sock_info_t;
{$if defined(APR_PROC_MUTEX_IS_GLOBAL) or defined(DOXYGEN)}
{ Opaque global mutex type }
#define apr_os_global_mutex_t apr_os_proc_mutex_t
{ @return apr_os_global_mutex }
#define apr_os_global_mutex_get apr_os_proc_mutex_get
{$else}
{ Thread and process mutex for those platforms where process mutexes
* are not held in threads.
}
apr_os_global_mutex_t = record
pool: Papr_pool_t;
proc_mutex: Papr_proc_mutex_t;
#if APR_HAS_THREADS
thread_mutex: Papr_proc_mutex_t;
#endif { APR_HAS_THREADS }
end;
Papr_os_global_mutex_t = ^apr_os_global_mutex_t;
APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmutex,
apr_global_mutex_t *pmutex);
{$endif}
{
* convert the file from apr type to os specific type.
* @param thefile The os specific file we are converting to
* @param file The apr file to convert.
* @remark On Unix, it is only possible to get a file descriptor from
* an apr file type.
}
function apr_os_file_get(thefile, file_: Papr_os_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_file_get' + LibSuff8;
{
* convert the dir from apr type to os specific type.
* @param thedir The os specific dir we are converting to
* @param dir The apr dir to convert.
}
function apr_os_dir_get(thedir: PPapr_os_dir_t; dir: Papr_dir_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_dir_get' + LibSuff8;
{
* Convert the socket from an apr type to an OS specific socket
* @param thesock The socket to convert.
* @param sock The os specifc equivelant of the apr socket..
}
function apr_os_sock_get(thesock, sock: Papr_os_sock_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_sock_get' + LibSuff8;
{
* Convert the proc mutex from os specific type to apr type
* @param ospmutex The os specific proc mutex we are converting to.
* @param pmutex The apr proc mutex to convert.
}
function apr_os_proc_mutex_get(ospmutex: Papr_os_proc_mutex_t;
pmutex: Papr_proc_mutex_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_proc_mutex_get' + LibSuff8;
{
* Get the exploded time in the platforms native format.
* @param ostime the native time format
* @param aprtime the time to convert
}
function apr_os_exp_time_get(ostime: PPapr_os_exp_time_t;
aprtime: Papr_time_exp_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_exp_time_get' + LibSuff8;
{
* Get the imploded time in the platforms native format.
* @param ostime the native time format
* @param aprtime the time to convert
}
function apr_os_imp_time_get(ostime: PPapr_os_imp_time_t;
aprtime: Papr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_imp_time_get' + LibSuff8;
{
* convert the shm from apr type to os specific type.
* @param osshm The os specific shm representation
* @param shm The apr shm to convert.
}
function apr_os_shm_get(osshm: Papr_os_shm_t; shm: Papr_shm_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_shm_get' + LibSuff8;
{$if defined(APR_HAS_THREADS) or defined(DOXYGEN)}
{
* @defgroup apr_os_thread Thread portability Routines
}
{
* convert the thread to os specific type from apr type.
* @param thethd The apr thread to convert
* @param thd The os specific thread we are converting to
}
function apr_os_thread_get(thethd: PPapr_os_thread_t;
thd: Papr_thread_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_thread_get' + LibSuff8;
{
* convert the thread private memory key to os specific type from an apr type.
* @param thekey The apr handle we are converting from.
* @param key The os specific handle we are converting to.
}
function apr_os_threadkey_get(thekey: Papr_os_threadkey_t;
key: Papr_threadkey_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_threadkey_get' + LibSuff8;
{
* convert the thread from os specific type to apr type.
* @param thd The apr thread we are converting to.
* @param thethd The os specific thread to convert
* @param cont The pool to use if it is needed.
}
function apr_os_thread_put(thd: PPapr_thread_t;
thethd: Papr_os_thread_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_thread_put' + LibSuff12;
{
* convert the thread private memory key from os specific type to apr type.
* @param key The apr handle we are converting to.
* @param thekey The os specific handle to convert
* @param cont The pool to use if it is needed.
}
function apr_os_threadkey_put(key: PPapr_threadkey_t;
thekey: Papr_os_threadkey_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_threadkey_put' + LibSuff12;
{
* Get the thread ID
}
function apr_os_thread_current: apr_os_thread_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_thread_current' + LibSuff0;
{
* Compare two thread id's
* @param tid1 1st Thread ID to compare
* @param tid2 2nd Thread ID to compare
}
function apr_os_thread_equal(tid1, tid2: apr_os_thread_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_thread_equal' + LibSuff8;
{$endif} { APR_HAS_THREADS }
{
* convert the file from os specific type to apr type.
* @param file The apr file we are converting to.
* @param thefile The os specific file to convert
* @param flags The flags that were used to open this file.
* @param cont The pool to use if it is needed.
* @remark On Unix, it is only possible to put a file descriptor into
* an apr file type.
}
function apr_os_file_put(file_: PPapr_file_t;
pthefilemutex: Papr_os_file_t; flags: apr_int32_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_file_put' + LibSuff16;
{
* convert the file from os specific type to apr type.
* @param file The apr file we are converting to.
* @param thefile The os specific pipe to convert
* @param cont The pool to use if it is needed.
* @remark On Unix, it is only possible to put a file descriptor into
* an apr file type.
}
function apr_os_pipe_put(file_: PPapr_file_t;
thefile: Papr_os_file_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_pipe_put' + LibSuff12;
{
* convert the file from os specific type to apr type.
* @param file The apr file we are converting to.
* @param thefile The os specific pipe to convert
* @param register_cleanup A cleanup will be registered on the apr_file_t
* to issue apr_file_close().
* @param cont The pool to use if it is needed.
* @remark On Unix, it is only possible to put a file descriptor into
* an apr file type.
}
function apr_os_pipe_put_ex(file_: PPapr_file_t;
thefile: Papr_os_file_t; register_cleanup: Integer;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_pipe_put_ex' + LibSuff16;
{
* convert the dir from os specific type to apr type.
* @param dir The apr dir we are converting to.
* @param thedir The os specific dir to convert
* @param cont The pool to use when creating to apr directory.
}
function apr_os_dir_put(dir: PPapr_dir_t; thedir: Papr_os_dir_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_dir_put' + LibSuff12;
{
* Convert a socket from the os specific type to the apr type
* @param sock The pool to use.
* @param thesock The socket to convert to.
* @param cont The socket we are converting to an apr type.
* @remark If it is a true socket, it is best to call apr_os_sock_make()
* and provide APR with more information about the socket.
}
function apr_os_sock_put(sock: PPapr_socket_t; thesock: Papr_socket_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_sock_put' + LibSuff8;
{
* Create a socket from an existing descriptor and local and remote
* socket addresses.
* @param apr_sock The new socket that has been set up
* @param os_sock_info The os representation of the socket handle and
* other characteristics of the socket
* @param cont The pool to use
* @remark If you only know the descriptor/handle or if it isn't really
* a true socket, use apr_os_sock_put() instead.
}
function apr_os_sock_make(apr_sock: PPapr_socket_t;
os_sock_info: Papr_os_sock_info_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_sock_make' + LibSuff12;
{
* Convert the proc mutex from os specific type to apr type
* @param pmutex The apr proc mutex we are converting to.
* @param ospmutex The os specific proc mutex to convert.
* @param cont The pool to use if it is needed.
}
function apr_os_proc_mutex_put(pmutex: PPapr_proc_mutex_t;
ospmutex: Papr_os_proc_mutex_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_proc_mutex_put' + LibSuff12;
{
* Put the imploded time in the APR format.
* @param aprtime the APR time format
* @param ostime the time to convert
* @param cont the pool to use if necessary
}
function apr_os_imp_time_put(aprtime: Papr_time_t;
ostime: PPapr_os_imp_time_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_imp_time_put' + LibSuff12;
{
* Put the exploded time in the APR format.
* @param aprtime the APR time format
* @param ostime the time to convert
* @param cont the pool to use if necessary
}
function apr_os_exp_time_put(aprtime: Papr_time_exp_t;
ostime: PPapr_os_exp_time_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_exp_time_put' + LibSuff12;
{
* convert the shared memory from os specific type to apr type.
* @param shm The apr shm representation of osshm
* @param osshm The os specific shm identity
* @param cont The pool to use if it is needed.
* @remark On fork()ed architectures, this is typically nothing more than
* the memory block mapped. On non-fork architectures, this is typically
* some internal handle to pass the mapping from process to process.
}
function apr_os_shm_put(shm: PPapr_shm_t; osshm: Papr_os_shm_t;
cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_shm_put' + LibSuff8;
{$if defined(APR_HAS_DSO) or defined(DOXYGEN)}
{
* @defgroup apr_os_dso DSO (Dynamic Loading) Portabiliity Routines
}
{
* convert the dso handle from os specific to apr
* @param dso The apr handle we are converting to
* @param thedso the os specific handle to convert
* @param pool the pool to use if it is needed
}
function apr_os_dso_handle_put(dso: PPapr_dso_handle_t;
thedso: apr_os_dso_handle_t; pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_dso_handle_put' + LibSuff12;
{
* convert the apr dso handle into an os specific one
* @param aprdso The apr dso handle to convert
* @param dso The os specific dso to return
}
function apr_os_dso_handle_get(dso: Papr_os_dso_handle_t;
aprdso: Papr_dso_handle_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_dso_handle_get' + LibSuff8;
{$ifdef APR_HAS_OS_UUID}
{
* Private: apr-util's apr_uuid module when supported by the platform
}
function apr_os_uuid_get(uuid_data: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_uuid_get' + LibSuff8;
{$endif}
{$endif} { APR_HAS_DSO }
{
* Get the name of the system default characer set.
* @param pool the pool to allocate the name from, if needed
}
function apr_os_default_encoding(pool: Papr_pool_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_default_encoding' + LibSuff4;
{
* Get the name of the current locale character set.
* @param pool the pool to allocate the name from, if needed
* @remark Defers to apr_os_default_encoding if the current locale's
* data can't be retreved on this system.
}
function apr_os_locale_encoding(pool: Papr_pool_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_os_locale_encoding' + LibSuff4;

View File

@ -1,103 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_signal.h
* @brief APR Signal Handling
}
{#include "apr.h"
#include "apr_pools.h"
#if APR_HAVE_SIGNAL_H
#include <signal.h>
#endif}
{
* @defgroup apr_signal Handling
* @ingroup APR
}
{$if defined(APR_HAVE_SIGACTION) or defined(DOXYGEN)}
{$ifdef DARWIN}
{ work around Darwin header file bugs
* http://www.opensource.apple.com/bugs/X/BSD%20Kernel/2657228.html
}
#undef SIG_DFL
#undef SIG_IGN
#undef SIG_ERR
#define SIG_DFL (void ( *)(int))0
#define SIG_IGN (void ( *)(int))1
#define SIG_ERR (void ( *)(int))-1
{$endif}
{ Function prototype for signal handlers }
type apr_sigfunc_t = procedure(para: cint);
{
* Set the signal handler function for a given signal
* @param signo The signal (eg... SIGWINCH)
* @param func the function to get called
}
function apr_signal(signo: Integer; func: apr_sigfunc_t): Papr_sigfunc_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_signal' + LibSuff8;
{if defined(SIG_IGN) && !defined(SIG_ERR)
#define SIG_ERR ((apr_sigfunc_t *) -1)
#endif
#else} { !APR_HAVE_SIGACTION }
{#define apr_signal(a, b) signal(a, b)
#endif}
{
* Get the description for a specific signal number
* @param signum The signal number
* @return The description of the signal
}
function apr_signal_description_get(signo: Integer): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_signal_description_get' + LibSuff4;
{
* APR-private function for initializing the signal package
* @internal
* @param pglobal The internal, global pool
}
//void apr_signal_init(apr_pool_t *pglobal);
{
* Block the delivery of a particular signal
* @param signum The signal number
* @return status
}
function apr_signal_block(signum: Integer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_signal_block' + LibSuff4;
{
* Enable the delivery of a particular signal
* @param signum The signal number
* @return status
}
function apr_signal_unblock(signum: Integer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_signal_unblock' + LibSuff4;
{$endif}

View File

@ -1,379 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{ Portions of this file are covered by }
{ -*- mode: c; c-file-style: "k&r" -*-
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
}
{
* @file apr_strings.h
* @brief APR Strings library
}
{#include "apr.h"
#include "apr_errno.h"
#include "apr_pools.h"
#define APR_WANT_IOVEC
#include "apr_want.h"
#if APR_HAVE_STDARG_H
#include <stdarg.h>
#endif}
{
* @defgroup apr_strings String routines
* @ingroup APR
}
{
* Do a natural order comparison of two strings.
* @param a The first string to compare
* @param b The second string to compare
* @return Either <0, 0, or >0. If the first string is less than the second
* this returns <0, if they are equivalent it returns 0, and if the
* first string is greater than second string it retuns >0.
}
function apr_strnatcmp(a, b: PChar): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_strnatcmp' + LibSuff8;
{
* Do a natural order comparison of two strings ignoring the case of the
* strings.
* @param a The first string to compare
* @param b The second string to compare
* @return Either <0, 0, or >0. If the first string is less than the second
* this returns <0, if they are equivalent it returns 0, and if the
* first string is greater than second string it retuns >0.
}
function apr_strnatcasecmp(a, b: PChar): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_strnatcasecmp' + LibSuff8;
{
* duplicate a string into memory allocated out of a pool
* @param p The pool to allocate out of
* @param s The string to duplicate
* @return The new string
}
function apr_pstrdup(p: Papr_pool_t; s: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pstrdup' + LibSuff8;
{
* Create a null-terminated string by making a copy of a sequence
* of characters and appending a null byte
* @param p The pool to allocate out of
* @param s The block of characters to duplicate
* @param n The number of characters to duplicate
* @return The new string
* @remark This is a faster alternative to apr_pstrndup, for use
* when you know that the string being duplicated really
* has 'n' or more characters. If the string might contain
* fewer characters, use apr_pstrndup.
}
function apr_pstrmemdup(p: Papr_pool_t; s: PChar; n: apr_size_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pstrmemdup' + LibSuff12;
{
* duplicate the first n characters of a string into memory allocated
* out of a pool; the new string will be null-terminated
* @param p The pool to allocate out of
* @param s The string to duplicate
* @param n The number of characters to duplicate
* @return The new string
}
function apr_pstrndup(p: Papr_pool_t; s: PChar; n: apr_size_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pstrndup' + LibSuff12;
{
* Duplicate a block of memory.
*
* @param p The pool to allocate from
* @param m The memory to duplicate
* @param n The number of bytes to duplicate
* @return The new block of memory
}
function apr_pmemdup(p: Papr_pool_t; m: Pointer; n: apr_size_t): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pmemdup' + LibSuff12;
{
* Concatenate multiple strings, allocating memory out a pool
* @param p The pool to allocate out of
* @param ... The strings to concatenate. The final string must be NULL
* @return The new string
}
function apr_pstrcat(p: Papr_pool_t; others: array of const): PChar;
cdecl; external LibAPR name 'apr_pstrcat';
{
* Concatenate multiple strings specified in a writev-style vector
* @param p The pool from which to allocate
* @param vec The strings to concatenate
* @param nvec The number of strings to concatenate
* @param nbytes (output) strlen of new string (pass in NULL to omit)
* @return The new string
}
function apr_pstrcatv(p: Papr_pool_t; const vec: Piovec;
nvec: apr_size_t; nbytes: Papr_size_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pstrcatv' + LibSuff16;
{
* printf-style style printing routine. The data is output to a string
* allocated from a pool
* @param p The pool to allocate out of
* @param fmt The format of the string
* @param ap The arguments to use while printing the data
* @return The new string
}
function apr_pvsprintf(p: Papr_pool_t; const fmt: PChar; ap: va_list): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pvsprintf' + LibSuff12;
{
* printf-style style printing routine. The data is output to a string
* allocated from a pool
* @param p The pool to allocate out of
* @param fmt The format of the string
* @param ... The arguments to use while printing the data
* @return The new string
}
function apr_psprintf(p: Papr_pool_t; const fmt: PChar; others: array of const): PChar;
cdecl; external LibAPR name 'apr_psprintf';
{
* Copy up to dst_size characters from src to dst; does not copy
* past a NUL terminator in src, but always terminates dst with a NUL
* regardless.
* @param dst The destination string
* @param src The source string
* @param dst_size The space available in dst; dst always receives
* NUL termination, so if src is longer than
* dst_size, the actual number of characters copied is
* dst_size - 1.
* @return Pointer to the NUL terminator of the destination string, dst
* @remark
* <PRE>
* Note the differences between this function and strncpy():
* 1) strncpy() doesn't always NUL terminate; apr_cpystrn() does.
* 2) strncpy() pads the destination string with NULs, which is often
* unnecessary; apr_cpystrn() does not.
* 3) strncpy() returns a pointer to the beginning of the dst string;
* apr_cpystrn() returns a pointer to the NUL terminator of dst,
* to allow a check for truncation.
* </PRE>
}
function apr_cpystrn(dst: PChar; const src: PChar;
dst_size: apr_size_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_cpystrn' + LibSuff12;
{
* Strip spaces from a string
* @param dest The destination string. It is okay to modify the string
* in place. Namely dest == src
* @param src The string to rid the spaces from.
}
function apr_collapse_spaces(dst: PChar; const src: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_collapse_spaces' + LibSuff8;
{
* Convert the arguments to a program from one string to an array of
* strings terminated by a NULL pointer
* @param arg_str The arguments to convert
* @param argv_out Output location. This is a pointer to an array of strings.
* @param token_context Pool to use.
}
function apr_tokenize_to_argv(const arg_str: PChar;
var argv_out: PPChar; token_context: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_tokenize_to_argv' + LibSuff12;
{
* Split a string into separate null-terminated tokens. The tokens are
* delimited in the string by one or more characters from the sep
* argument.
* @param str The string to separate; this should be specified on the
* first call to apr_strtok() for a given string, and NULL
* on subsequent calls.
* @param sep The set of delimiters
* @param last Internal state saved by apr_strtok() between calls.
* @return The next token from the string
}
function apr_strtok(str: PChar;
const sep: PChar; last: PPChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_strtok' + LibSuff12;
{
* @defgroup APR_Strings_Snprintf snprintf implementations
* @warning
* These are snprintf implementations based on apr_vformatter().
*
* Note that various standards and implementations disagree on the return
* value of snprintf, and side-effects due to %n in the formatting string.
* apr_snprintf (and apr_vsnprintf) behaves as follows:
*
* Process the format string until the entire string is exhausted, or
* the buffer fills. If the buffer fills then stop processing immediately
* (so no further %n arguments are processed), and return the buffer
* length. In all cases the buffer is NUL terminated. It will return the
* number of characters inserted into the buffer, not including the
* terminating NUL. As a special case, if len is 0, apr_snprintf will
* return the number of characters that would have been inserted if
* the buffer had been infinite (in this case, *buffer can be NULL)
*
* In no event does apr_snprintf return a negative number.
}
{
* snprintf routine based on apr_vformatter. This means it understands the
* same extensions.
* @param buf The buffer to write to
* @param len The size of the buffer
* @param format The format string
* @param ... The arguments to use to fill out the format string.
}
function apr_snprintf(buf: PChar; len: apr_size_t;
const format: PChar; others: array of const): PChar;
cdecl; external LibAPR name 'apr_snprintf';
{
* vsnprintf routine based on apr_vformatter. This means it understands the
* same extensions.
* @param buf The buffer to write to
* @param len The size of the buffer
* @param format The format string
* @param ap The arguments to use to fill out the format string.
}
function apr_vsnprintf(buf: PChar; len: apr_size_t;
const format: PChar; ap: va_list): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_vsnprintf' + LibSuff16;
{
* create a string representation of an int, allocated from a pool
* @param p The pool from which to allocate
* @param n The number to format
* @return The string representation of the number
}
function apr_itoa(p: Papr_pool_t; n: Integer): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_itoa' + LibSuff8;
{
* create a string representation of a long, allocated from a pool
* @param p The pool from which to allocate
* @param n The number to format
* @return The string representation of the number
}
function apr_ltoa(p: Papr_pool_t; n: Integer): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_ltoa' + LibSuff8;
{
* create a string representation of an apr_off_t, allocated from a pool
* @param p The pool from which to allocate
* @param n The number to format
* @return The string representation of the number
}
function apr_off_t_toa(p: Papr_pool_t; n: apr_off_t): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_off_t_toa' + LibSuff12;
{
* Convert a numeric string into an apr_off_t numeric value.
* @param offset The value of the parsed string.
* @param buf The string to parse. It may contain optional whitespace,
* followed by an optional '+' (positive, default) or '-' (negative)
* character, followed by an optional '0x' prefix if base is 0 or 16,
* followed by numeric digits appropriate for base.
* @param end A pointer to the end of the valid character in buf. If
* not NULL, it is set to the first invalid character in buf.
* @param base A numeric base in the range between 2 and 36 inclusive,
* or 0. If base is zero, buf will be treated as base ten unless its
* digits are prefixed with '0x', in which case it will be treated as
* base 16.
}
function apr_strtoff(offset: Papr_off_t;
const buf: PChar; end_: PPChar; base: cint): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_strtoff' + LibSuff16;
{
* parse a numeric string into a 64-bit numeric value
* @param buf The string to parse. It may contain optional whitespace,
* followed by an optional '+' (positive, default) or '-' (negative)
* character, followed by an optional '0x' prefix if base is 0 or 16,
* followed by numeric digits appropriate for base.
* @param end A pointer to the end of the valid character in buf. If
* not nil, it is set to the first invalid character in buf.
* @param base A numeric base in the range between 2 and 36 inclusive,
* or 0. If base is zero, buf will be treated as base ten unless its
* digits are prefixed with '0x', in which case it will be treated as
* base 16.
* @return The numeric value of the string.
}
function apr_strtoi64(const buf: PChar; end_: PPChar; base: Integer): apr_int64_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_strtoi64' + LibSuff12;
{
* parse a base-10 numeric string into a 64-bit numeric value.
* Equivalent to apr_strtoi64(buf, (char**)NULL, 10).
* @param buf The string to parse
* @return The numeric value of the string
}
function apr_atoi64(const buf: PChar): apr_int64_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_atoi64' + LibSuff4;
{
* Format a binary size (magnitiudes are 2^10 rather than 10^3) from an apr_off_t,
* as bytes, K, M, T, etc, to a four character compacted human readable string.
* @param size The size to format
* @param buf The 5 byte text buffer (counting the trailing null)
* @return The buf passed to apr_strfsize()
* @remark All negative sizes report ' - ', apr_strfsize only formats positive values.
}
function apr_strfsize(size: apr_off_t; buf: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_strfsize' + LibSuff12;

View File

@ -1,447 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_tables.h
* @brief APR Table library
}
{
* @defgroup apr_tables Table and Array Functions
* @ingroup APR
* Tables are used to store entirely opaque structures
* for applications, while Arrays are usually used to
* deal with string lists.
}
{ the table abstract data type }
type
apr_table_t = record end;
Papr_table_t = ^apr_table_t;
{ An opaque array type }
apr_array_header_t = record
{ The pool the array is allocated out of }
pool: Papr_pool_t;
{ The amount of memory allocated for each element of the array }
elt_size: Integer;
{ The number of active elements in the array }
nelts: Integer;
{ The number of elements allocated in the array }
nalloc: Integer;
{ The elements in the array }
elts: PChar;
end;
Papr_array_header_t = ^apr_array_header_t;
PPapr_array_header_t = ^Papr_array_header_t;
{
* The (opaque) structure for string-content tables.
}
{ The type for each entry in a string-content table }
apr_table_entry_t = record
{ The key for the current table entry }
key: PChar; { maybe NULL in future;
* check when iterating thru table_elts
}
{ The value for the current table entry }
val: PChar;
{ A checksum for the key, for use by the apr_table internals }
key_checksum: apr_uint32_t;
end;
{
* Get the elements from a table
* @param t The table
* @return An array containing the contents of the table
}
function apr_table_elts(const t: Papr_table_t): Papr_array_header_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_elts' + LibSuff4;
{
* Determine if the table is empty
* @param t The table to check
* @return True if empty, False otherwise
}
function apr_is_empty_table(const t: Papr_table_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_is_empty_table' + LibSuff4;
{
* Determine if the array is empty
* @param a The array to check
* @return True if empty, False otherwise
}
function apr_is_empty_array(const a: Papr_array_header_t): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_is_empty_array' + LibSuff4;
{
* Create an array
* @param p The pool to allocate the memory out of
* @param nelts the number of elements in the initial array
* @param elt_size The size of each element in the array.
* @return The new array
}
function apr_array_make(p: Papr_pool_t;
nelts, elt_size: Integer): Papr_array_header_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_make' + LibSuff12;
{
* Add a new element to an array (as a first-in, last-out stack)
* @param arr The array to add an element to.
* @return Location for the new element in the array.
* @remark If there are no free spots in the array, then this function will
* allocate new space for the new element.
}
function apr_array_push(arr: Papr_array_header_t): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_push' + LibSuff4;
{
* Remove an element from an array (as a first-in, last-out stack)
* @param arr The array to remove an element from.
* @return Location of the element in the array.
* @remark If there are no elements in the array, NULL is returned.
}
function apr_array_pop(arr: Papr_array_header_t): Pointer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_pop' + LibSuff4;
{
* Concatenate two arrays together
* @param dst The destination array, and the one to go first in the combined
* array
* @param src The source array to add to the destination array
}
procedure apr_array_cat(dst: Papr_array_header_t;
const src: Papr_array_header_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_cat' + LibSuff8;
{
* Copy the entire array
* @param p The pool to allocate the copy of the array out of
* @param arr The array to copy
* @return An exact copy of the array passed in
* @remark The alternate apr_array_copy_hdr copies only the header, and arranges
* for the elements to be copied if (and only if) the code subsequently
* does a push or arraycat.
}
function apr_array_copy(p: Papr_pool_t;
const arr: Papr_array_header_t): Papr_array_header_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_copy' + LibSuff8;
{
* Copy the headers of the array, and arrange for the elements to be copied if
* and only if the code subsequently does a push or arraycat.
* @param p The pool to allocate the copy of the array out of
* @param arr The array to copy
* @return An exact copy of the array passed in
* @remark The alternate apr_array_copy copies the *entire* array.
}
function apr_array_copy_hdr(p: Papr_pool_t;
const arr: Papr_array_header_t): Papr_array_header_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_copy_hdr' + LibSuff8;
{
* Append one array to the end of another, creating a new array in the process.
* @param p The pool to allocate the new array out of
* @param first The array to put first in the new array.
* @param second The array to put second in the new array.
* @return A new array containing the data from the two arrays passed in.
}
function apr_array_append(p: Papr_pool_t;
const first, second: Papr_array_header_t): Papr_array_header_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_append' + LibSuff12;
{
* Generates a new string from the apr_pool_t containing the concatenated
* sequence of substrings referenced as elements within the array. The string
* will be empty if all substrings are empty or null, or if there are no
* elements in the array. If sep is non-NUL, it will be inserted between
* elements as a separator.
* @param p The pool to allocate the string out of
* @param arr The array to generate the string from
* @param sep The separator to use
* @return A string containing all of the data in the array.
}
function apr_array_pstrcat(p: Papr_pool_t;
const arr: Papr_array_header_t; sep: Char): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_array_pstrcat' + LibSuff12;
{
* Make a new table
* @param p The pool to allocate the pool out of
* @param nelts The number of elements in the initial table.
* @return The new table.
* @warning This table can only store text data
}
function apr_table_make(p: Papr_pool_t; nelts: Integer): Papr_table_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_make' + LibSuff8;
{
* Create a new table and copy another table into it
* @param p The pool to allocate the new table out of
* @param t The table to copy
* @return A copy of the table passed in
}
function apr_table_copy(p: Papr_pool_t; const t: Papr_table_t): Papr_table_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_copy' + LibSuff8;
{
* Delete all of the elements from a table
* @param t The table to clear
}
procedure apr_table_clear(t: Papr_table_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_clear' + LibSuff4;
{
* Get the value associated with a given key from the table. After this call,
* The data is still in the table
* @param t The table to search for the key
* @param key The key to search for
* @return The value associated with the key, or NULL if the key does not exist.
}
function apr_table_get(t: Papr_table_t; key: PChar): PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_get' + LibSuff8;
{
* Add a key/value pair to a table, if another element already exists with the
* same key, this will over-write the old data.
* @param t The table to add the data to.
* @param key The key fo use
* @param val The value to add
* @remark When adding data, this function makes a copy of both the key and the
* value.
}
procedure apr_table_set(t: Papr_table_t; const key, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_set' + LibSuff12;
{
* Add a key/value pair to a table, if another element already exists with the
* same key, this will over-write the old data.
* @param t The table to add the data to.
* @param key The key to use
* @param val The value to add
* @warning When adding data, this function does not make a copy of the key or
* the value, so care should be taken to ensure that the values will
* not change after they have been added..
}
procedure apr_table_setn(t: Papr_table_t; const key, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_setn' + LibSuff12;
{
* Remove data from the table
* @param t The table to remove data from
* @param key The key of the data being removed
}
procedure apr_table_unset(t: Papr_table_t; const key: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_unset' + LibSuff8;
{
* Add data to a table by merging the value with data that has already been
* stored
* @param t The table to search for the data
* @param key The key to merge data for
* @param val The data to add
* @remark If the key is not found, then this function acts like apr_table_add
}
procedure apr_table_merge(t: Papr_table_t; const key, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_merge' + LibSuff12;
{
* Add data to a table by merging the value with data that has already been
* stored
* @param t The table to search for the data
* @param key The key to merge data for
* @param val The data to add
* @remark If the key is not found, then this function acts like apr_table_addn
}
procedure apr_table_mergen(t: Papr_table_t; const key, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_mergen' + LibSuff12;
{
* Add data to a table, regardless of whether there is another element with the
* same key.
* @param t The table to add to
* @param key The key to use
* @param val The value to add.
* @remark When adding data, this function makes a copy of both the key and the
* value.
}
procedure apr_table_add(t: Papr_table_t; const key, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_add' + LibSuff12;
{
* Add data to a table, regardless of whether there is another element with the
* same key.
* @param t The table to add to
* @param key The key to use
* @param val The value to add.
* @remark When adding data, this function does not make a copy of the key or the
* value, so care should be taken to ensure that the values will not
* change after they have been added..
}
procedure apr_table_addn(t: Papr_table_t; const key, val: PChar);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_addn' + LibSuff12;
{
* Merge two tables into one new table
* @param p The pool to use for the new table
* @param overlay The first table to put in the new table
* @param base The table to add at the end of the new table
* @return A new table containing all of the data from the two passed in
}
function apr_table_overlay(t: Papr_table_t;
const overlay, base: Papr_table_t): Papr_table_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_overlay' + LibSuff12;
{
* Declaration prototype for the iterator callback function of apr_table_do()
* and apr_table_vdo().
* @param rec The data passed as the first argument to apr_table_[v]do()
* @param key The key from this iteration of the table
* @param value The value from this iteration of the table
* @remark Iteration continues while this callback function returns non-zero.
* To export the callback function for apr_table_[v]do() it must be declared
* in the _NONSTD convention.
}
type
apr_table_do_callback_fn_t = function (rec: Pointer;
const key, value: PChar): Integer;
Papr_table_do_callback_fn_t = ^apr_table_do_callback_fn_t;
{
* Iterate over a table running the provided function once for every
* element in the table. If there is data passed in as a vararg, then the
* function is only run on those elements whose key matches something in
* the vararg. If the vararg is NULL, then every element is run through the
* function. Iteration continues while the function returns non-zero.
* @param comp The function to run
* @param rec The data to pass as the first argument to the function
* @param t The table to iterate over
* @param ... The vararg. If this is NULL, then all elements in the table are
* run through the function, otherwise only those whose key matches
* are run.
* @return FALSE if one of the comp() iterations returned zero; TRUE if all
* iterations returned non-zero
* @see apr_table_do_callback_fn_t
}
{APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp,
void *rec, const apr_table_t *t, ...);
}
{
* Iterate over a table running the provided function once for every
* element in the table. If there is data passed in as a vararg, then the
* function is only run on those element's whose key matches something in
* the vararg. If the vararg is NULL, then every element is run through the
* function. Iteration continues while the function returns non-zero.
* @param comp The function to run
* @param rec The data to pass as the first argument to the function
* @param t The table to iterate over
* @param vp The vararg table. If this is NULL, then all elements in the
* table are run through the function, otherwise only those
* whose key matches are run.
* @return FALSE if one of the comp() iterations returned zero; TRUE if all
* iterations returned non-zero
* @see apr_table_do_callback_fn_t
}
function apr_table_vdo(comp: Papr_table_do_callback_fn_t;
rec: Pointer; const t: Papr_table_t; vp: va_list): Integer;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_vdo' + LibSuff16;
const
{ flag for overlap to use apr_table_setn }
APR_OVERLAP_TABLES_SET = 0;
{ flag for overlap to use apr_table_mergen }
APR_OVERLAP_TABLES_MERGE = 1;
{
* For each element in table b, either use setn or mergen to add the data
* to table a. Which method is used is determined by the flags passed in.
* @param a The table to add the data to.
* @param b The table to iterate over, adding its data to table a
* @param flags How to add the table to table a. One of:
* APR_OVERLAP_TABLES_SET Use apr_table_setn
* APR_OVERLAP_TABLES_MERGE Use apr_table_mergen
* @remark This function is highly optimized, and uses less memory and CPU cycles
* than a function that just loops through table b calling other functions.
}
{
*<PRE>
* Conceptually, apr_table_overlap does this:
*
* apr_array_header_t *barr = apr_table_elts(b);
* apr_table_entry_t *belt = (apr_table_entry_t *)barr->elts;
* int i;
*
* for (i = 0; i < barr->nelts; ++i) (
* if (flags & APR_OVERLAP_TABLES_MERGE) (
* apr_table_mergen(a, belt[i].key, belt[i].val);
* )
* else (
* apr_table_setn(a, belt[i].key, belt[i].val);
* )
* )
*
* Except that it is more efficient (less space and cpu-time) especially
* when b has many elements.
*
* Notice the assumptions on the keys and values in b -- they must be
* in an ancestor of a's pool. In practice b and a are usually from
* the same pool.
* </PRE>
}
procedure apr_table_overlap(a: Papr_table_t;
const b: Papr_table_t; flags: cuint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_overlap' + LibSuff12;
{
* Eliminate redundant entries in a table by either overwriting
* or merging duplicates
*
* @param t Table.
* @param flags APR_OVERLAP_TABLES_MERGE to merge, or
* APR_OVERLAP_TABLES_SET to overwrite
}
procedure apr_table_compress(t: Papr_table_t; flags: cuint);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_table_compress' + LibSuff8;

View File

@ -1,865 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_thread_proc.h
* @brief APR Thread and Process Library
}
{#include "apr.h"
#include "apr_file_io.h"
#include "apr_pools.h"
#include "apr_errno.h"
#if APR_HAVE_STRUCT_RLIMIT
#include <sys/time.h>
#include <sys/resource.h>
#endif}
{
* @defgroup apr_thread_proc Threads and Process Functions
* @ingroup APR
}
type
apr_cmdtype_e = (
APR_SHELLCMD, {< use the shell to invoke the program }
APR_PROGRAM, {< invoke the program directly, no copied env }
APR_PROGRAM_ENV, {< invoke the program, replicating our environment }
APR_PROGRAM_PATH, {< find program on PATH, use our environment }
APR_SHELLCMD_ENV {< use the shell to invoke the program,
* replicating our environment }
);
apr_wait_how_e = (
APR_WAIT, {< wait for the specified process to finish }
APR_NOWAIT {< do not wait -- just see if it has finished }
);
{ I am specifically calling out the values so that the macros below make
* more sense. Yes, I know I don't need to, but I am hoping this makes what
* I am doing more clear. If you want to add more reasons to exit, continue
* to use bitmasks.
}
apr_exit_why_e = (
APR_PROC_EXIT = 1, {< process exited normally }
APR_PROC_SIGNAL = 2, {< process exited due to a signal }
APR_PROC_SIGNAL_CORE = 4 {< process exited and dumped a core file }
);
Papr_exit_why_e = ^apr_exit_why_e;
{ did we exit the process }
//#define APR_PROC_CHECK_EXIT(x) (x & APR_PROC_EXIT)
{ did we get a signal }
//#define APR_PROC_CHECK_SIGNALED(x) (x & APR_PROC_SIGNAL)
{ did we get core }
//#define APR_PROC_CHECK_CORE_DUMP(x) (x & APR_PROC_SIGNAL_CORE)
const
{ @see apr_procattr_io_set }
APR_NO_PIPE = 0;
{ @see apr_procattr_io_set }
APR_FULL_BLOCK = 1;
{ @see apr_procattr_io_set }
APR_FULL_NONBLOCK = 2;
{ @see apr_procattr_io_set }
APR_PARENT_BLOCK = 3;
{ @see apr_procattr_io_set }
APR_CHILD_BLOCK = 4;
{ @see apr_procattr_limit_set }
APR_LIMIT_CPU = 0;
{ @see apr_procattr_limit_set }
APR_LIMIT_MEM = 1;
{ @see apr_procattr_limit_set }
APR_LIMIT_NPROC = 2;
{ @see apr_procattr_limit_set }
APR_LIMIT_NOFILE = 3;
{
* @defgroup APR_OC Other Child Flags
}
APR_OC_REASON_DEATH = 0; {< child has died, caller must call
* unregister still }
APR_OC_REASON_UNWRITABLE = 1; {< write_fd is unwritable }
APR_OC_REASON_RESTART = 2; {< a restart is occuring, perform
* any necessary cleanup (including
* sending a special signal to child)
}
APR_OC_REASON_UNREGISTER = 3; {< unregister has been called, do
* whatever is necessary (including
* kill the child) }
APR_OC_REASON_LOST = 4; {< somehow the child exited without
* us knowing ... buggy os? }
APR_OC_REASON_RUNNING = 5; {< a health check is occuring,
* for most maintainence functions
* this is a no-op.
}
{ The APR process type }
type
apr_proc_t = record
{ The process ID }
pid: pid_t;
{ Parent's side of pipe to child's stdin }
in_: Papr_file_t;
{ Parent's side of pipe to child's stdout }
out_: Papr_file_t;
{ Parent's side of pipe to child's stdouterr }
err: Papr_file_t;
{$if defined(APR_HAS_PROC_INVOKED) or defined(DOXYGEN)}
{ Diagnositics/debugging string of the command invoked for
* this process [only present if APR_HAS_PROC_INVOKED is true]
* @remark Only enabled on Win32 by default.
* @bug This should either always or never be present in release
* builds - since it breaks binary compatibility. We may enable
* it always in APR 1.0 yet leave it undefined in most cases.
}
invoked: PChar;
{$endif}
{$if defined(WIN32) or defined(DOXYGEN)}
{ (Win32 only) Creator's handle granting access to the process
* @remark This handle is closed and reset to NULL in every case
* corresponding to a waitpid() on Unix which returns the exit status.
* Therefore Win32 correspond's to Unix's zombie reaping characteristics
* and avoids potential handle leaks.
}
hproc: HANDLE;
{$endif}
end;
Papr_proc_t = ^apr_proc_t;
{
* The prototype for APR child errfn functions. (See the description
* of apr_procattr_child_errfn_set() for more information.)
* It is passed the following parameters:
* @param pool Pool associated with the apr_proc_t. If your child
* error function needs user data, associate it with this
* pool.
* @param err APR error code describing the error
* @param description Text description of type of processing which failed
}
apr_child_errfn_t = procedure (proc: Papr_pool_t;
err: apr_status_t; const description: PChar);
{ Opaque Thread structure. }
apr_thread_t = record end;
Papr_thread_t = ^apr_thread_t;
PPapr_thread_t = ^Papr_thread_t;
{ Opaque Thread attributes structure. }
apr_threadattr_t = record end;
Papr_threadattr_t = ^apr_threadattr_t;
PPapr_threadattr_t = ^Papr_threadattr_t;
{ Opaque Process attributes structure. }
apr_procattr_t = record end;
Papr_procattr_t = ^apr_procattr_t;
PPapr_procattr_t = ^Papr_procattr_t;
{ Opaque control variable for one-time atomic variables. }
apr_thread_once_t = record end;
Papr_thread_once_t = ^apr_thread_once_t;
PPapr_thread_once_t = ^Papr_thread_once_t;
{ Opaque thread private address space. }
apr_threadkey_t = record end;
Papr_threadkey_t = ^apr_threadkey_t;
PPapr_threadkey_t = ^Papr_threadkey_t;
{ Opaque record of child process. }
apr_other_child_rec_t = record end;
Papr_other_child_rec_t = ^apr_other_child_rec_t;
PPapr_other_child_rec_t = ^Papr_other_child_rec_t;
{
* The prototype for any APR thread worker functions.
}
apr_thread_start_t = function(param: Papr_thread_t; param2: Pointer): Pointer;
apr_kill_conditions_e = (
APR_KILL_NEVER, {< process is never sent any signals }
APR_KILL_ALWAYS, {< process is sent SIGKILL on apr_pool_t cleanup }
APR_KILL_AFTER_TIMEOUT, {< SIGTERM, wait 3 seconds, SIGKILL }
APR_JUST_WAIT, {< wait forever for the process to complete }
APR_KILL_ONLY_ONCE {< send SIGTERM and then wait }
);
{ Thread Function definitions }
//{$if APR_HAS_THREADS}
{
* Create and initialize a new threadattr variable
* @param new_attr The newly created threadattr.
* @param cont The pool to use
}
function apr_threadattr_create(new_attr: PPapr_threadattr_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadattr_create' + LibSuff8;
{
* Set if newly created threads should be created in detached state.
* @param attr The threadattr to affect
* @param on Thread detach state on or off
}
function apr_threadattr_detach_set(attr: Papr_threadattr_t; on_: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadattr_detach_set' + LibSuff8;
{
* Get the detach state for this threadattr.
* @param attr The threadattr to reference
}
function apr_threadattr_detach_get(attr: PPapr_threadattr_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadattr_detach_get' + LibSuff4;
{
* Set the stack size of newly created threads.
* @param attr The threadattr to affect
* @param stacksize The stack size in bytes
}
function apr_threadattr_stacksize_set(new_attr: PPapr_threadattr_t; stacksize: apr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadattr_stacksize_set' + LibSuff8;
{
* Set the stack guard area size of newly created threads.
* @param attr The threadattr to affect
* @param guardsize The stack guard area size in bytes
* @note Thread library implementations commonly use a "guard area"
* after each thread's stack which is not readable or writable such that
* stack overflows cause a segfault; this consumes e.g. 4K of memory
* and increases memory management overhead. Setting the guard area
* size to zero hence trades off reliable behaviour on stack overflow
* for performance. }
function apr_threadattr_guardsize_set(attr: Papr_threadattr_t; guardsize: apr_size_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadattr_guardsize_set' + LibSuff8;
{
* Create a new thread of execution
* @param new_thread The newly created thread handle.
* @param attr The threadattr to use to determine how to create the thread
* @param func The function to start the new thread in
* @param data Any data to be passed to the starting function
* @param cont The pool to use
}
function apr_thread_create(new_thread: PPapr_thread_t;
attr: Papr_threadattr_t; func: apr_thread_start_t;
data: Pointer; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_create' + LibSuff20;
{
* stop the current thread
* @param thd The thread to stop
* @param retval The return value to pass back to any thread that cares
}
function apr_thread_exit(thd: Papr_thread_t; retval: apr_status_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_exit' + LibSuff8;
{
* block until the desired thread stops executing.
* @param retval The return value from the dead thread.
* @param thd The thread to join
}
function apr_thread_join(retval: Papr_status_t; thd: Papr_thread_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_join' + LibSuff8;
{
* force the current thread to yield the processor
}
procedure apr_thread_yield;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_yield' + LibSuff0;
{
* Initialize the control variable for apr_thread_once. If this isn't
* called, apr_initialize won't work.
* @param control The control variable to initialize
* @param p The pool to allocate data from.
}
function apr_thread_once_init(control: PPapr_thread_once_t; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_once_init' + LibSuff8;
{
* Run the specified function one time, regardless of how many threads
* call it.
* @param control The control variable. The same variable should
* be passed in each time the function is tried to be
* called. This is how the underlying functions determine
* if the function has ever been called before.
* @param func The function to call.
}
type
func_t = procedure;
function apr_thread_once(control: Papr_thread_once_t; func: func_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_once' + LibSuff8;
{
* detach a thread
* @param thd The thread to detach
}
function apr_thread_detach(thd: Papr_thread_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_detach' + LibSuff4;
{
* Return the pool associated with the current thread.
* @param data The user data associated with the thread.
* @param key The key to associate with the data
* @param thread The currently open thread.
}
function apr_thread_data_get(data: PPointer; const key: PChar;
thread: Papr_thread_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_data_get' + LibSuff12;
{
* Return the pool associated with the current thread.
* @param data The user data to associate with the thread.
* @param key The key to use for associating the data with the thread
* @param cleanup The cleanup routine to use when the thread is destroyed.
* @param thread The currently open thread.
}
function apr_thread_data_set(data: Pointer; const key: PChar;
cleanup: cleanup_t; thread: Papr_thread_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_thread_data_set' + LibSuff16;
{
* Create and initialize a new thread private address space
* @param key The thread private handle.
* @param dest The destructor to use when freeing the private memory.
* @param cont The pool to use
}
type
dest_t = procedure (param: Pointer);
function apr_threadkey_private_create(key: PPapr_threadkey_t;
dest: dest_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadkey_private_create' + LibSuff12;
{
* Get a pointer to the thread private memory
* @param new_mem The data stored in private memory
* @param key The handle for the desired thread private memory
}
function apr_threadkey_private_get(new_mem: PPointer; key: Papr_threadkey_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadkey_private_get' + LibSuff8;
{
* Set the data to be stored in thread private memory
* @param priv The data to be stored in private memory
* @param key The handle for the desired thread private memory
}
function apr_threadkey_private_set(priv: Pointer; key: Papr_threadkey_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadkey_private_set' + LibSuff8;
{
* Free the thread private memory
* @param key The handle for the desired thread private memory
}
function apr_threadkey_private_delete(key: Papr_threadkey_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadkey_private_delete' + LibSuff4;
{
* Return the pool associated with the current threadkey.
* @param data The user data associated with the threadkey.
* @param key The key associated with the data
* @param threadkey The currently open threadkey.
}
function apr_threadkey_data_get(data: PPointer; const key: PChar;
threadkey: Papr_threadkey_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadkey_data_get' + LibSuff12;
{
* Return the pool associated with the current threadkey.
* @param data The data to set.
* @param key The key to associate with the data.
* @param cleanup The cleanup routine to use when the file is destroyed.
* @param threadkey The currently open threadkey.
}
function apr_threadkey_data_set(data: Pointer; const key: PChar;
cleanup: cleanup_t; threadkey: Papr_threadkey_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_threadkey_data_set' + LibSuff16;
{.$endif}
{
* Create and initialize a new procattr variable
* @param new_attr The newly created procattr.
* @param cont The pool to use
}
function apr_procattr_create(new_attr: PPapr_procattr_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_create' + LibSuff8;
{
* Determine if any of stdin, stdout, or stderr should be linked to pipes
* when starting a child process.
* @param attr The procattr we care about.
* @param in Should stdin be a pipe back to the parent?
* @param out Should stdout be a pipe back to the parent?
* @param err Should stderr be a pipe back to the parent?
}
function apr_procattr_io_set(attr: Papr_procattr_t;
in_, out_, err: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_io_set' + LibSuff16;
{
* Set the child_in and/or parent_in values to existing apr_file_t values.
* @param attr The procattr we care about.
* @param child_in apr_file_t value to use as child_in. Must be a valid file.
* @param parent_in apr_file_t value to use as parent_in. Must be a valid file.
* @remark This is NOT a required initializer function. This is
* useful if you have already opened a pipe (or multiple files)
* that you wish to use, perhaps persistently across multiple
* process invocations - such as a log file. You can save some
* extra function calls by not creating your own pipe since this
* creates one in the process space for you.
}
function apr_procattr_child_in_set(attr: Papr_procattr_t;
child_in, parent_in: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_child_in_set' + LibSuff12;
{
* Set the child_out and parent_out values to existing apr_file_t values.
* @param attr The procattr we care about.
* @param child_out apr_file_t value to use as child_out. Must be a valid file.
* @param parent_out apr_file_t value to use as parent_out. Must be a valid file.
* @remark This is NOT a required initializer function. This is
* useful if you have already opened a pipe (or multiple files)
* that you wish to use, perhaps persistently across multiple
* process invocations - such as a log file.
}
function apr_procattr_child_out_set(attr: Papr_procattr_t;
child_out, parent_out: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_child_out_set' + LibSuff12;
{
* Set the child_err and parent_err values to existing apr_file_t values.
* @param attr The procattr we care about.
* @param child_err apr_file_t value to use as child_err. Must be a valid file.
* @param parent_err apr_file_t value to use as parent_err. Must be a valid file.
* @remark This is NOT a required initializer function. This is
* useful if you have already opened a pipe (or multiple files)
* that you wish to use, perhaps persistently across multiple
* process invocations - such as a log file.
}
function apr_procattr_child_err_set(attr: Papr_procattr_t;
child_err, parent_err: Papr_file_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_child_err_set' + LibSuff12;
{
* Set which directory the child process should start executing in.
* @param attr The procattr we care about.
* @param dir Which dir to start in. By default, this is the same dir as
* the parent currently resides in, when the createprocess call
* is made.
}
function apr_procattr_dir_set(attr: Papr_procattr_t; const dir: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_dir_set' + LibSuff8;
{
* Set what type of command the child process will call.
* @param attr The procattr we care about.
* @param cmd The type of command. One of:
* <PRE>
* APR_SHELLCMD -- Anything that the shell can handle
* APR_PROGRAM -- Executable program (default)
* APR_PROGRAM_ENV -- Executable program, copy environment
* APR_PROGRAM_PATH -- Executable program on PATH, copy env
* </PRE>
}
function apr_procattr_cmdtype_set(attr: Papr_procattr_t; cmd: apr_cmdtype_e): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_cmdtype_set' + LibSuff8;
{
* Determine if the child should start in detached state.
* @param attr The procattr we care about.
* @param detach Should the child start in detached state? Default is no.
}
function apr_procattr_detach_set(attr: Papr_procattr_t; detach: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_detach_set' + LibSuff8;
{$ifdef APR_HAVE_STRUCT_RLIMIT}
{
* Set the Resource Utilization limits when starting a new process.
* @param attr The procattr we care about.
* @param what Which limit to set, one of:
* <PRE>
* APR_LIMIT_CPU
* APR_LIMIT_MEM
* APR_LIMIT_NPROC
* APR_LIMIT_NOFILE
* </PRE>
* @param limit Value to set the limit to.
}
function apr_procattr_limit_set(attr: Papr_procattr_t; what: apr_int32_t;
limit: Pointer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_limit_set' + LibSuff12;
{$endif}
{
* Specify an error function to be called in the child process if APR
* encounters an error in the child prior to running the specified program.
* @param attr The procattr describing the child process to be created.
* @param errfn The function to call in the child process.
* @remark At the present time, it will only be called from apr_proc_create()
* on platforms where fork() is used. It will never be called on other
* platforms, on those platforms apr_proc_create() will return the error
* in the parent process rather than invoke the callback in the now-forked
* child process.
}
function apr_procattr_child_errfn_set(attr: Papr_procattr_t; errfn: apr_child_errfn_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_child_errfn_set' + LibSuff8;
{
* Specify that apr_proc_create() should do whatever it can to report
* failures to the caller of apr_proc_create(), rather than find out in
* the child.
* @param attr The procattr describing the child process to be created.
* @param chk Flag to indicate whether or not extra work should be done
* to try to report failures to the caller.
* @remark This flag only affects apr_proc_create() on platforms where
* fork() is used. This leads to extra overhead in the calling
* process, but that may help the application handle such
* errors more gracefully.
}
function apr_procattr_error_check_set(attr: Papr_procattr_t; chk: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_error_check_set' + LibSuff8;
{
* Determine if the child should start in its own address space or using the
* current one from its parent
* @param attr The procattr we care about.
* @param addrspace Should the child start in its own address space? Default
* is no on NetWare and yes on other platforms.
}
function apr_procattr_addrspace_set(attr: Papr_procattr_t; addrspace: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_addrspace_set' + LibSuff8;
{
* Set the username used for running process
* @param attr The procattr we care about.
* @param username The username used
* @param password User password if needed. Password is needed on WIN32
* or any other platform having
* APR_PROCATTR_USER_SET_REQUIRES_PASSWORD set.
}
function apr_procattr_user_set(attr: Papr_procattr_t;
const username, password: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_user_set' + LibSuff12;
{
* Set the group used for running process
* @param attr The procattr we care about.
* @param groupname The group name used
}
function apr_procattr_group_set(attr: Papr_procattr_t;
const groupname: PChar): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_procattr_group_set' + LibSuff8;
{$ifdef APR_HAS_FORK}
{
* This is currently the only non-portable call in APR. This executes
* a standard unix fork.
* @param proc The resulting process handle.
* @param cont The pool to use.
}
function apr_proc_fork(proc: Papr_proc_t; cont: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_fork' + LibSuff8;
{$endif}
{
* Create a new process and execute a new program within that process.
* @param new_proc The resulting process handle.
* @param progname The program to run
* @param args the arguments to pass to the new program. The first
* one should be the program name.
* @param env The new environment table for the new process. This
* should be a list of NULL-terminated strings. This argument
* is ignored for APR_PROGRAM_ENV, APR_PROGRAM_PATH, and
* APR_SHELLCMD_ENV types of commands.
* @param attr the procattr we should use to determine how to create the new
* process
* @param pool The pool to use.
}
function apr_proc_create(new_proc: Papr_proc_t;
const progname: PChar; args, arnv: PPChar;
attr: Papr_procattr_t;
pool: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_create' + LibSuff24;
{
* Wait for a child process to die
* @param proc The process handle that corresponds to the desired child process
* @param exitcode The returned exit status of the child, if a child process
* dies, or the signal that caused the child to die.
* On platforms that don't support obtaining this information,
* the status parameter will be returned as APR_ENOTIMPL.
* @param exitwhy Why the child died, the bitwise or of:
* <PRE>
* APR_PROC_EXIT -- process terminated normally
* APR_PROC_SIGNAL -- process was killed by a signal
* APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
* generated a core dump.
* </PRE>
* @param waithow How should we wait. One of:
* <PRE>
* APR_WAIT -- block until the child process dies.
* APR_NOWAIT -- return immediately regardless of if the
* child is dead or not.
* </PRE>
* @remark The childs status is in the return code to this process. It is one of:
* <PRE>
* APR_CHILD_DONE -- child is no longer running.
* APR_CHILD_NOTDONE -- child is still running.
* </PRE>
}
function apr_proc_wait(proc: Papr_proc_t; exitcode: PInteger;
exitwhy: Papr_exit_why_e; waithow: apr_wait_how_e): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_wait' + LibSuff16;
{
* Wait for any current child process to die and return information
* about that child.
* @param proc Pointer to NULL on entry, will be filled out with child's
* information
* @param exitcode The returned exit status of the child, if a child process
* dies, or the signal that caused the child to die.
* On platforms that don't support obtaining this information,
* the status parameter will be returned as APR_ENOTIMPL.
* @param exitwhy Why the child died, the bitwise or of:
* <PRE>
* APR_PROC_EXIT -- process terminated normally
* APR_PROC_SIGNAL -- process was killed by a signal
* APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
* generated a core dump.
* </PRE>
* @param waithow How should we wait. One of:
* <PRE>
* APR_WAIT -- block until the child process dies.
* APR_NOWAIT -- return immediately regardless of if the
* child is dead or not.
* </PRE>
* @param p Pool to allocate child information out of.
* @bug Passing proc as a *proc rather than **proc was an odd choice
* for some platforms... this should be revisited in 1.0
}
function apr_proc_wait_all_procs(proc: Papr_proc_t; exitcode: PInteger;
exitwhy: Papr_exit_why_e; waithow: apr_wait_how_e;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_wait_all_procs' + LibSuff20;
const
APR_PROC_DETACH_FOREGROUND = 0; {< Do not detach }
APR_PROC_DETACH_DAEMONIZE = 1; {< Detach }
{
* Detach the process from the controlling terminal.
* @param daemonize set to non-zero if the process should daemonize
* and become a background process, else it will
* stay in the foreground.
}
{ Not present on the dll }
//function apr_proc_detach(daemonize: Integer): apr_status_t;
// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
// external LibAPR name LibNamePrefix + 'apr_proc_detach' + LibSuff4;
{
* Register an other_child -- a child associated to its registered
* maintence callback. This callback is invoked when the process
* dies, is disconnected or disappears.
* @param proc The child process to register.
* @param maintenance maintenance is a function that is invoked with a
* reason and the data pointer passed here.
* @param data Opaque context data passed to the maintenance function.
* @param write_fd An fd that is probed for writing. If it is ever unwritable
* then the maintenance is invoked with reason
* OC_REASON_UNWRITABLE.
* @param p The pool to use for allocating memory.
* @bug write_fd duplicates the proc->out stream, it's really redundant
* and should be replaced in the APR 1.0 API with a bitflag of which
* proc->in/out/err handles should be health checked.
* @bug no platform currently tests the pipes health.
}
type
maintenance_t = procedure (reason: Integer; param: Pointer; status: Integer);
procedure apr_proc_other_child_register(proc: Papr_proc_t;
maintenance: maintenance_t; data: Pointer; write_fd: Papr_file_t;
p: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_other_child_register' + LibSuff20;
{
* Stop watching the specified other child.
* @param data The data to pass to the maintenance function. This is
* used to find the process to unregister.
* @warning Since this can be called by a maintenance function while we're
* scanning the other_children list, all scanners should protect
* themself by loading ocr->next before calling any maintenance
* function.
}
procedure apr_proc_other_child_unregister(data: Pointer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_other_child_unregister' + LibSuff4;
{
* Notify the maintenance callback of a registered other child process
* that application has detected an event, such as death.
* @param proc The process to check
* @param reason The reason code to pass to the maintenance function
* @param status The status to pass to the maintenance function
* @remark An example of code using this behavior;
* <pre>
* rv = apr_proc_wait_all_procs(&proc, &exitcode, &status, APR_WAIT, p);
* if (APR_STATUS_IS_CHILD_DONE(rv)) (
* #if APR_HAS_OTHER_CHILD
* if (apr_proc_other_child_alert(&proc, APR_OC_REASON_DEATH, status)
* == APR_SUCCESS) (
* ; (already handled)
* )
* else
* #endif
* [... handling non-otherchild processes death ...]
* </pre>
}
function apr_proc_other_child_alert(proc: Papr_proc_t;
reason, status: Integer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_other_child_alert' + LibSuff12;
{
* Test one specific other child processes and invoke the maintenance callback
* with the appropriate reason code, if still running, or the appropriate reason
* code if the process is no longer healthy.
* @param ocr The registered other child
* @param reason The reason code (e.g. APR_OC_REASON_RESTART) if still running
}
procedure apr_proc_other_child_refresh(ocr: Papr_other_child_rec_t; reason: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_other_child_refresh' + LibSuff8;
{
* Test all registered other child processes and invoke the maintenance callback
* with the appropriate reason code, if still running, or the appropriate reason
* code if the process is no longer healthy.
* @param reason The reason code (e.g. APR_OC_REASON_RESTART) to running processes
}
procedure apr_proc_other_child_refresh_all(reason: Integer);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_other_child_refresh_all' + LibSuff4;
{
* Terminate a process.
* @param proc The process to terminate.
* @param sig How to kill the process.
}
function apr_proc_kill(proc: Papr_proc_t; sig: Integer): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_proc_kill' + LibSuff8;
{
* Register a process to be killed when a pool dies.
* @param a The pool to use to define the processes lifetime
* @param proc The process to register
* @param how How to kill the process, one of:
* <PRE>
* APR_KILL_NEVER -- process is never sent any signals
* APR_KILL_ALWAYS -- process is sent SIGKILL on apr_pool_t cleanup
* APR_KILL_AFTER_TIMEOUT -- SIGTERM, wait 3 seconds, SIGKILL
* APR_JUST_WAIT -- wait forever for the process to complete
* APR_KILL_ONLY_ONCE -- send SIGTERM and then wait
* </PRE>
}
procedure apr_pool_note_subprocess(a: Papr_pool_t;
proc: Papr_proc_t; how: apr_kill_conditions_e);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_pool_note_subprocess' + LibSuff12;
{.$ifdef APR_HAS_THREADS}
{$if (defined(APR_HAVE_SIGWAIT) or defined(APR_HAVE_SIGSUSPEND)) and not defined(OS2)}
{
* Setup the process for a single thread to be used for all signal handling.
* @warning This must be called before any threads are created
}
function apr_setup_signal_thread: apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_setup_signal_thread' + LibSuff0;
{
* Make the current thread listen for signals. This thread will loop
* forever, calling a provided function whenever it receives a signal. That
* functions should return 1 if the signal has been handled, 0 otherwise.
* @param signal_handler The function to call when a signal is received
* apr_status_t apr_signal_thread((int)( *signal_handler)(int signum))
}
type
signal_handler_t = function (signum: Integer): Integer;
function apr_signal_thread(signal_handler: signal_handler_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_signal_thread' + LibSuff8;
{$endif} { (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2) }
{
* Get the child-pool used by the thread from the thread info.
* @return apr_pool_t the pool
}
//APR_POOL_DECLARE_ACCESSOR(thread);
//#endif { APR_HAS_THREADS }

View File

@ -1,244 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_time.h
* @brief APR Time Library
}
{#include "apr.h"
#include "apr_pools.h"
#include "apr_errno.h"}
{
* @defgroup apr_time Time Routines
* @ingroup APR
}
{ month names }
//APR_DECLARE_DATA extern const char apr_month_snames[12][4];
{ day names }
//APR_DECLARE_DATA extern const char apr_day_snames[7][4];
{ number of microseconds since 00:00:00 january 1, 1970 UTC }
type
apr_time_t = apr_int64_t;
Papr_time_t = ^apr_time_t;
{ mechanism to properly type apr_time_t literals }
//#define APR_TIME_C(val) APR_INT64_C(val)
{ mechanism to properly print apr_time_t values }
// APR_TIME_T_FMT = APR_INT64_T_FMT;
{ intervals for I/O timeouts, in microseconds }
apr_interval_time_t = apr_int64_t;
Papr_interval_time_t = ^apr_interval_time_t;
{ short interval for I/O timeouts, in microseconds }
apr_short_interval_time_t = apr_int32_t;
{ number of microseconds per second }
// APR_USEC_PER_SEC APR_TIME_C(1000000)
{ @return apr_time_t as a second }
//#define apr_time_sec(time) ((time) / APR_USEC_PER_SEC)
{ @return apr_time_t as a usec }
//#define apr_time_usec(time) ((time) % APR_USEC_PER_SEC)
{ @return apr_time_t as a msec }
//#define apr_time_msec(time) (((time) / 1000) % 1000)
{ @return apr_time_t as a msec }
//#define apr_time_as_msec(time) ((time) / 1000)
{ @return a second as an apr_time_t }
//#define apr_time_from_sec(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC)
{ @return a second and usec combination as an apr_time_t }
//#define apr_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \
// + (apr_time_t)(usec))
{
* @return the current time
}
function apr_time_now: apr_time_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_now' + LibSuff0;
{ @see apr_time_exp_t }
type
Papr_time_exp_t = ^apr_time_exp_t;
{
* a structure similar to ANSI struct tm with the following differences:
* - tm_usec isn't an ANSI field
* - tm_gmtoff isn't an ANSI field (it's a bsdism)
}
apr_time_exp_t = record
{ microseconds past tm_sec }
tm_usec: apr_int32_t;
{ (0-61) seconds past tm_min }
tm_sec: apr_int32_t;
{ (0-59) minutes past tm_hour }
tm_min: apr_int32_t;
{ (0-23) hours past midnight }
tm_hour: apr_int32_t;
{ (1-31) day of the month }
tm_mday: apr_int32_t;
{ (0-11) month of the year }
tm_mon: apr_int32_t;
{ year since 1900 }
tm_year: apr_int32_t;
{ (0-6) days since sunday }
tm_wday: apr_int32_t;
{ (0-365) days since jan 1 }
tm_yday: apr_int32_t;
{ daylight saving time }
tm_isdst: apr_int32_t;
{ seconds east of UTC }
tm_gmtoff: apr_int32_t;
end;
{
* convert an ansi time_t to an apr_time_t
* @param result the resulting apr_time_t
* @param input the time_t to convert
}
function apr_time_ansi_put(result: Papr_time_t;
input: time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_ansi_put' + LibSuff8;
{
* convert a time to its human readable components using an offset
* from GMT
* @param result the exploded time
* @param input the time to explode
* @param offs the number of seconds offset to apply
}
function apr_time_exp_tz(result: Papr_time_exp_t;
input: apr_time_t; offs: apr_int32_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_exp_tz' + LibSuff16;
{
* convert a time to its human readable components in GMT timezone
* @param result the exploded time
* @param input the time to explode
}
function apr_time_exp_gmt(result: Papr_time_exp_t;
input: apr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_exp_gmt' + LibSuff12;
{
* convert a time to its human readable components in local timezone
* @param result the exploded time
* @param input the time to explode
}
function apr_time_exp_lt(result: Papr_time_exp_t;
input: apr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_exp_lt' + LibSuff12;
{
* Convert time value from human readable format to a numeric apr_time_t
* e.g. elapsed usec since epoch
* @param result the resulting imploded time
* @param input the input exploded time
}
function apr_time_exp_get(result: Papr_time_t;
input: Papr_time_exp_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_exp_get' + LibSuff8;
{
* Convert time value from human readable format to a numeric apr_time_t that
* always represents GMT
* @param result the resulting imploded time
* @param input the input exploded time
}
function apr_time_exp_gmt_get(result: Papr_time_t;
input: Papr_time_exp_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_exp_gmt_get' + LibSuff8;
{
* Sleep for the specified number of micro-seconds.
* @param t desired amount of time to sleep.
* @warning May sleep for longer than the specified time.
}
procedure apr_sleep(t: apr_interval_time_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_sleep' + LibSuff8;
{ length of a RFC822 Date }
const APR_RFC822_DATE_LEN = (30);
{
* apr_rfc822_date formats dates in the RFC822
* format in an efficient manner. It is a fixed length
* format which requires the indicated amount of storage,
* including the trailing null byte.
* @param date_str String to write to.
* @param t the time to convert
}
function apr_rfc822_date(date_str: PChar; t: apr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_rfc822_date' + LibSuff12;
{ length of a CTIME date }
const APR_CTIME_LEN = (25);
{
* apr_ctime formats dates in the ctime() format
* in an efficient manner. it is a fixed length format
* and requires the indicated amount of storage including
* the trailing null byte.
* Unlike ANSI/ISO C ctime(), apr_ctime() does not include
* a \n at the end of the string.
* @param date_str String to write to.
* @param t the time to convert
}
function apr_ctime(date_str: PChar; t: apr_time_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_ctime' + LibSuff12;
{
* formats the exploded time according to the format specified
* @param s string to write to
* @param retsize The length of the returned string
* @param max The maximum length of the string
* @param format The format for the time string
* @param tm The time to convert
}
function apr_strftime(s: PChar; retsize: apr_size_t;
max: apr_size_t; const format: PChar;
tm: Papr_time_exp_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_strftime' + LibSuff20;
{
* Improve the clock resolution for the lifetime of the given pool.
* Generally this is only desireable on benchmarking and other very
* time-sensitive applications, and has no impact on most platforms.
* @param p The pool to associate the finer clock resolution
}
procedure apr_time_clock_hires(p: Papr_pool_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_time_clock_hires' + LibSuff4;

View File

@ -1,161 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
{
* @file apr_user.h
* @brief APR User ID Services
}
{#include "apr.h"
#include "apr_errno.h"
#include "apr_pools.h"}
{
* @defgroup apr_user User and Group ID Services
* @ingroup APR
}
{
* Structure for determining user ownership.
}
type
{$ifdef WIN32}
apr_uid_t = PSID;
{$else}
apr_uid_t = uid_t;
{$endif}
Papr_uid_t = ^apr_uid_t;
{
* Structure for determining group ownership.
}
{$ifdef WIN32}
apr_gid_t = PSID;
{$else}
apr_gid_t = gid_t;
{$endif}
Papr_gid_t = ^apr_gid_t;
{$define APR_HAS_USER}
{$ifdef APR_HAS_USER}
{
* Get the userid (and groupid) of the calling process
* @param userid Returns the user id
* @param groupid Returns the user's group id
* @param p The pool from which to allocate working space
* @remark This function is available only if APR_HAS_USER is defined.
}
function apr_uid_current(userid: Papr_uid_t; groupid: Papr_gid_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_uid_current' + LibSuff12;
{
* Get the user name for a specified userid
* @param username Pointer to new string containing user name (on output)
* @param userid The userid
* @param p The pool from which to allocate the string
* @remark This function is available only if APR_HAS_USER is defined.
}
function apr_uid_name_get(username: PPChar; userid: apr_uid_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_uid_name_get' + LibSuff12;
{
* Get the userid (and groupid) for the specified username
* @param userid Returns the user id
* @param groupid Returns the user's group id
* @param username The username to lookup
* @param p The pool from which to allocate working space
* @remark This function is available only if APR_HAS_USER is defined.
}
function apr_uid_get(userid: Papr_uid_t; groupid: Papr_gid_t;
const username: PChar; p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_uid_get' + LibSuff16;
{
* Get the home directory for the named user
* @param dirname Pointer to new string containing directory name (on output)
* @param username The named user
* @param p The pool from which to allocate the string
* @remark This function is available only if APR_HAS_USER is defined.
}
function apr_uid_homepath_get(dirname: PPChar; const username: PChar;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_uid_homepath_get' + LibSuff12;
{
* Compare two user identifiers for equality.
* @param left One uid to test
* @param right Another uid to test
* @return APR_SUCCESS if the apr_uid_t strutures identify the same user,
* APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid.
* @remark This function is available only if APR_HAS_USER is defined.
}
{$ifdef WIN32}
//APR_DECLARE(apr_status_t) apr_uid_compare(apr_uid_t left, apr_uid_t right);
{$else}
//#define apr_uid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
{$endif}
{
* Get the group name for a specified groupid
* @param groupname Pointer to new string containing group name (on output)
* @param groupid The groupid
* @param p The pool from which to allocate the string
* @remark This function is available only if APR_HAS_USER is defined.
}
function apr_gid_name_get(groupname: PPChar; groupid: apr_gid_t;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_gid_name_get' + LibSuff12;
{
* Get the groupid for a specified group name
* @param groupid Pointer to the group id (on output)
* @param groupname The group name to look up
* @param p The pool from which to allocate the string
* @remark This function is available only if APR_HAS_USER is defined.
}
function apr_gid_get(groupid: Papr_gid_t; const groupname: PChar;
p: Papr_pool_t): apr_status_t;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_gid_get' + LibSuff12;
{
* Compare two group identifiers for equality.
* @param left One gid to test
* @param right Another gid to test
* @return APR_SUCCESS if the apr_gid_t strutures identify the same group,
* APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid.
* @remark This function is available only if APR_HAS_USER is defined.
}
{$ifdef WIN32}
//APR_DECLARE(apr_status_t) apr_gid_compare(apr_gid_t left, apr_gid_t right);
{$else}
//#define apr_gid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
{$endif}
{$endif} { ! APR_HAS_USER }

View File

@ -1,141 +0,0 @@
{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}
//#include "apr.h"
{
* @file apr_version.h
* @brief APR Versioning Interface
*
* APR's Version
*
* There are several different mechanisms for accessing the version. There
* is a string form, and a set of numbers; in addition, there are constants
* which can be compiled into your application, and you can query the library
* being used for its actual version.
*
* Note that it is possible for an application to detect that it has been
* compiled against a different version of APR by use of the compile-time
* constants and the use of the run-time query function.
*
* APR version numbering follows the guidelines specified in:
*
* http://apr.apache.org/versioning.html
}
{ The numeric compile-time version constants. These constants are the
* authoritative version numbers for APR.
}
const
{ major version
* Major API changes that could cause compatibility problems for older
* programs such as structure size changes. No binary compatibility is
* possible across a change in the major version.
}
APR_MAJOR_VERSION = 1;
{ minor version
* Minor API changes that do not cause binary compatibility problems.
* Reset to 0 when upgrading APR_MAJOR_VERSION
}
APR_MINOR_VERSION = 2;
{ patch level
* The Patch Level never includes API changes, simply bug fixes.
* Reset to 0 when upgrading APR_MINOR_VERSION
}
APR_PATCH_VERSION = 7;
{$if defined(APR_IS_DEV_VERSION) or defined(DOXYGEN)}
{ Internal: string form of the "is dev" flag }
APR_IS_DEV_STRING = '-dev';
{$else}
APR_IS_DEV_STRING = '';
{$endif}
{ APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it }
{#ifndef APR_STRINGIFY
/** Properly quote a value as a string in the C preprocessor */
#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
/** Helper macro for APR_STRINGIFY */
#define APR_STRINGIFY_HELPER(n) #n
#endif}
{
* The symbol APR_IS_DEV_VERSION is only defined for internal,
* "development" copies of APR. It is undefined for released versions
* of APR.
}
{$undef APR_IS_DEV_VERSION}
{ The formatted string of APR's version }
{#define APR_VERSION_STRING \
APR_STRINGIFY(APR_MAJOR_VERSION) "." \
APR_STRINGIFY(APR_MINOR_VERSION) "." \
APR_STRINGIFY(APR_PATCH_VERSION) \
APR_IS_DEV_STRING}
{ An alternative formatted string of APR's version }
{ macro for Win32 .rc files using numeric csv representation }
{#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
##APR_MINOR_VERSION ##, \
##APR_PATCH_VERSION}
//#ifndef APR_VERSION_ONLY
{ The C language API to access the version at run time,
* as opposed to compile time. APR_VERSION_ONLY may be defined
* externally when preprocessing apr_version.h to obtain strictly
* the C Preprocessor macro declarations.
}
//#include "apr.h"
{
* The numeric version information is broken out into fields within this
* structure.
}
type
apr_version_t = record
major: Integer; {< major number }
minor: Integer; {< minor number }
patch: Integer; {< patch number }
is_dev: Integer; {< is development (1 or 0) }
end;
Papr_version_t = ^apr_version_t;
{
* Return APR's version information information in a numeric form.
*
* @param pvsn Pointer to a version structure for returning the version
* information.
}
procedure apr_version(pvsn: Papr_version_t);
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_version' + LibSuff4;
{ Return APR's version information as a string. }
function apr_version_string: PChar;
{$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
external LibAPR name LibNamePrefix + 'apr_version_string' + LibSuff0;
//#endif

Some files were not shown because too many files have changed in this diff Show More