~ubuntu-branches/ubuntu/natty/xmlrpc-c/natty

« back to all changes in this revision

Viewing changes to lib/abyss/src/server.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2011-01-06 18:56:02 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20110106185602-09og2x3suqlzbf6s
Tags: 1.16.32-0ubuntu1
* New upstream version (stable release). LP: #659591.
  - No unresolved symbols in the shared libraries. LP: #690779.
  - Builds with --no-add-needed and --as-needed.
* Rename shared library packages.
* Add symbols files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
#include <sys/types.h>
5
5
 
 
6
#include "bool.h"
6
7
#include "xmlrpc-c/abyss.h"
7
8
 
8
 
#include "file.h"
9
9
#include "data.h"
10
10
 
11
 
typedef struct _Tsocket Tsocket;
 
11
struct TFile;
 
12
struct abyss_mutex;
12
13
 
13
14
struct _TServer {
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
17
18
           waiting for any.
18
19
        */
19
 
    abyss_bool socketBound;
20
 
        /* The listening socket exists and is bound to a local address
 
20
    bool chanSwitchBound;
 
21
        /* The channel switch exists and is bound to a local address
21
22
           (may already be listening as well)
22
23
        */
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.
27
27
        */
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.
31
31
        */
32
32
    const char * logfilename;
33
 
    abyss_bool logfileisopen;
34
 
    TFile logfile;
35
 
    TMutex logmutex;
 
33
    bool logfileisopen;
 
34
    struct TFile * logfileP;
 
35
    struct abyss_mutex * logmutexP;
36
36
    const char * name;
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)
42
41
        */
43
42
    uint16_t port;
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.
46
45
        */
47
46
    uint32_t keepalivetimeout;
48
47
    uint32_t keepalivemaxconn;
49
48
    uint32_t timeout;
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.
52
51
        */
53
52
    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;
 
53
        /* Ordered list of HTTP request handlers.  For each HTTP request,
 
54
           Server calls each one in order until one reports that it handled
 
55
           it.
 
56
 
 
57
           Each item in the list of of type 'uriHandler'.
 
58
        */
 
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
 
63
           handler.  */
 
64
    void * defaultHandlerContext;
 
65
        /* This is opaque data to be given to the default handler when it
 
66
           requests it.
 
67
        */
 
68
    void * builtinHandlerP;
 
69
    bool advertise;
 
70
    bool useSigchld;
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.
66
77
        */
 
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
 
82
           that runs it.
 
83
        */
67
84
#ifndef WIN32
68
85
    uid_t uid;
69
86
    gid_t gid;
70
 
    TFile pidfile;
 
87
    struct TFile * pidfileP;
71
88
#endif
72
89
};
73
90
 
74
 
 
75
 
void
76
 
ServerBackgroundProcessComplete(pid_t const pid);
77
 
 
78
91
#endif