initial load of upstream version 1.06.32
[xmlrpc-c] / lib / abyss / src / server.h
1 #ifndef SERVER_H_INCLUDED
2 #define SERVER_H_INCLUDED
3
4 #include <sys/types.h>
5
6 #include "xmlrpc-c/abyss.h"
7
8 #include "file.h"
9 #include "data.h"
10
11 typedef struct _Tsocket Tsocket;
12
13 struct _TServer {
14     abyss_bool terminationRequested;
15         /* User wants this server to terminate as soon as possible,
16            in particular before accepting any more connections and without
17            waiting for any.
18         */
19     abyss_bool socketBound;
20         /* The listening socket exists and is bound to a local address
21            (may already be listening as well)
22         */
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).
27         */
28     abyss_bool weCreatedListenSocket;
29         /* We created the listen socket (whose fd is 'listensock'), as
30            opposed to 1) User supplied it; or 2) there isn't one.
31         */
32     const char * logfilename;
33     abyss_bool logfileisopen;
34     TFile logfile;
35     TMutex logmutex;
36     const char * name;
37     const char * filespath;
38     abyss_bool serverAcceptsConnections;
39         /* We listen for and accept TCP connections for HTTP transactions.
40            (The alternative is the user supplies a TCP-connected socket
41            for each transaction)
42         */
43     uint16_t port;
44         /* Meaningful only when 'socketBound' is false: port number to which
45            we should bind the listening socket
46         */
47     uint32_t keepalivetimeout;
48     uint32_t keepalivemaxconn;
49     uint32_t timeout;
50         /* Maximum time in seconds the server will wait to read a header
51            or a data chunk from the socket.
52         */
53     TList handlers;
54     TList defaultfilenames;
55     void * defaulthandler;
56     abyss_bool advertise;
57     MIMEType * mimeTypeP;
58         /* NULL means to use the global MIMEType object */
59     abyss_bool useSigchld;
60         /* Meaningless if not using forking for threads.
61            TRUE means user will call ServerHandleSigchld to indicate that
62            a SIGCHLD signal was received, and server shall use that as its
63            indication that a child has died.  FALSE means server will not
64            be aware of SIGCHLD and will instead poll for existence of PIDs
65            to determine if a child has died.
66         */
67 #ifndef WIN32
68     uid_t uid;
69     gid_t gid;
70     TFile pidfile;
71 #endif
72 };
73
74
75 void
76 ServerBackgroundProcessComplete(pid_t const pid);
77
78 #endif