initial load of upstream version 1.06.32
[xmlrpc-c] / include / xmlrpc-c / server_abyss.hpp
1 #ifndef SERVER_ABYSS_HPP_INCLUDED
2 #define SERVER_ABYSS_HPP_INCLUDED
3
4 #include "xmlrpc-c/base.hpp"
5 #include "abyss.h"
6
7 namespace xmlrpc_c {
8
9 class serverAbyss {
10     
11 public:
12     class constrOpt {
13     public:
14         constrOpt();
15
16         constrOpt & registryPtr       (xmlrpc_c::registryPtr      const& arg);
17         constrOpt & registryP         (const xmlrpc_c::registry * const& arg);
18         constrOpt & socketFd          (xmlrpc_socket  const& arg);
19         constrOpt & portNumber        (uint           const& arg);
20         constrOpt & logFileName       (std::string    const& arg);
21         constrOpt & keepaliveTimeout  (uint           const& arg);
22         constrOpt & keepaliveMaxConn  (uint           const& arg);
23         constrOpt & timeout           (uint           const& arg);
24         constrOpt & dontAdvertise     (bool           const& arg);
25         constrOpt & uriPath           (std::string    const& arg);
26         constrOpt & chunkResponse     (bool           const& arg);
27
28         struct value {
29             xmlrpc_c::registryPtr      registryPtr;
30             const xmlrpc_c::registry * registryP;
31             xmlrpc_socket  socketFd;
32             uint           portNumber;
33             std::string    logFileName;
34             uint           keepaliveTimeout;
35             uint           keepaliveMaxConn;
36             uint           timeout;
37             bool           dontAdvertise;
38             std::string    uriPath;
39             bool           chunkResponse;
40         } value;
41         struct {
42             bool registryPtr;
43             bool registryP;
44             bool socketFd;
45             bool portNumber;
46             bool logFileName;
47             bool keepaliveTimeout;
48             bool keepaliveMaxConn;
49             bool timeout;
50             bool dontAdvertise;
51             bool uriPath;
52             bool chunkResponse;
53         } present;
54     };
55
56     serverAbyss(constrOpt const& opt);
57
58     serverAbyss(
59         xmlrpc_c::registry const& registry,
60         unsigned int       const  portNumber = 8080,
61         std::string        const& logFileName = "",
62         unsigned int       const  keepaliveTimeout = 0,
63         unsigned int       const  keepaliveMaxConn = 0,
64         unsigned int       const  timeout = 0,
65         bool               const  dontAdvertise = false,
66         bool               const  socketBound = false,
67         xmlrpc_socket      const  socketFd = 0
68         );
69     ~serverAbyss();
70     
71     void
72     run();
73
74     void
75     runOnce();
76
77     void
78     runConn(int const socketFd);
79     
80 private:
81     // The user has the choice of supplying the registry by plain pointer
82     // (and managing the object's existence himself) or by autoObjectPtr
83     // (with automatic management).  'registryPtr' exists here only to
84     // maintain a reference count in the case that the user supplied an
85     // autoObjectPtr.  The object doesn't reference the C++ registry
86     // object except during construction, because the C registry is the
87     // real registry.
88     xmlrpc_c::registryPtr registryPtr;
89
90     TServer cServer;
91
92     void
93     setAdditionalServerParms(constrOpt const& opt);
94
95     void
96     initialize(constrOpt const& opt);
97 };
98
99
100 void
101 server_abyss_set_handlers(TServer *          const  srvP,
102                           xmlrpc_c::registry const& registry,
103                           std::string        const& uriPath = "/RPC2");
104
105 void
106 server_abyss_set_handlers(TServer *                  const  srvP,
107                           const xmlrpc_c::registry * const  registryP,
108                           std::string                const& uriPath = "/RPC2");
109
110 void
111 server_abyss_set_handlers(TServer *             const srvP,
112                           xmlrpc_c::registryPtr const registryPtr,
113                           std::string           const& uriPath = "/RPC2");
114
115 } // namespace
116
117 #endif