4
4
#include <sys/types.h>
6
7
#include "xmlrpc-c/abyss.h"
11
typedef struct _Tsocket Tsocket;
14
abyss_bool terminationRequested;
15
bool terminationRequested;
15
16
/* User wants this server to terminate as soon as possible,
16
17
in particular before accepting any more connections and without
19
abyss_bool socketBound;
20
/* The listening socket exists and is bound to a local address
21
/* The channel switch exists and is bound to a local address
21
22
(may already be listening as well)
23
TSocket * listenSocketP;
24
/* Meaningful only when 'socketBound' is true: file descriptor of
25
the listening socket ("listening socket" means socket for listening,
26
not a socket that is listening right now).
24
TChanSwitch * chanSwitchP;
25
/* Meaningful only when 'chanSwitchBound' is true: the channel
26
switch which directs connections from clients to this server.
28
abyss_bool weCreatedListenSocket;
29
/* We created the listen socket (whose fd is 'listensock'), as
28
bool weCreatedChanSwitch;
29
/* We created the channel switch 'chanSwitchP', as
30
30
opposed to 1) User supplied it; or 2) there isn't one.
32
32
const char * logfilename;
33
abyss_bool logfileisopen;
34
struct TFile * logfileP;
35
struct abyss_mutex * logmutexP;
37
const char * filespath;
38
abyss_bool serverAcceptsConnections;
37
bool serverAcceptsConnections;
39
38
/* We listen for and accept TCP connections for HTTP transactions.
40
39
(The alternative is the user supplies a TCP-connected socket
41
40
for each transaction)
44
/* Meaningful only when 'socketBound' is false: port number to which
45
we should bind the listening socket
43
/* Meaningful only when 'chanSwitchBound' is false: TCP port
44
number to which we should bind the switch.
47
46
uint32_t keepalivetimeout;
48
47
uint32_t keepalivemaxconn;
50
49
/* Maximum time in seconds the server will wait to read a header
51
or a data chunk from the socket.
50
or a data chunk from the channel.
54
TList defaultfilenames;
55
void * defaulthandler;
58
/* NULL means to use the global MIMEType object */
59
abyss_bool useSigchld;
53
/* Ordered list of HTTP request handlers. For each HTTP request,
54
Server calls each one in order until one reports that it handled
57
Each item in the list of of type 'uriHandler'.
59
URIHandler defaultHandler;
60
/* The handler for HTTP requests that aren't claimed by any handler
61
in the list 'handlers'. This can't be null; if user doesn't
62
supply anything better, it is a built-in basic web server
64
void * defaultHandlerContext;
65
/* This is opaque data to be given to the default handler when it
68
void * builtinHandlerP;
60
71
/* Meaningless if not using forking for threads.
61
72
TRUE means user will call ServerHandleSigchld to indicate that
62
73
a SIGCHLD signal was received, and server shall use that as its
64
75
be aware of SIGCHLD and will instead poll for existence of PIDs
65
76
to determine if a child has died.
78
size_t uriHandlerStackSize;
79
/* The maximum amount of stack any URI handler request handler
80
function will use. Note that this is just the requirement
81
of the function itself, not the stack size for the thread
87
struct TFile * pidfileP;
76
ServerBackgroundProcessComplete(pid_t const pid);