change include for Linkage.hpegasus/src/Pegasus/HandlerService/HandlerTable.h
[tpot/pegasus/.git] / src / Pegasus / Listener / CIMListener.h
1 //%/////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
4 // The Open Group, Tivoli Systems
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 // 
13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
14 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
16 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 //==============================================================================
23 //
24 // Author: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
25 //
26 // Modified By:
27 //
28 //%/////////////////////////////////////////////////////////////////////////////
29
30 #ifndef Pegasus_Listener_h
31 #define Pegasus_Listener_h
32
33 #include <Pegasus/Common/Config.h>
34 #include <Pegasus/Common/Exception.h>
35 #include <Pegasus/Listener/Linkage.h>
36
37 PEGASUS_NAMESPACE_BEGIN
38
39 struct ListenerRep;
40
41 class Monitor;
42 class CIMExportRequestDispatcher;
43 class CIMExportResponseEncoder;
44 class CIMExportRequestDecoder;
45 class HTTPAcceptor;
46
47 class PEGASUS_LISTENER_LINKAGE CIMListener
48 {
49 public:
50
51     enum Protocol { PROPRIETARY, STANDARD };
52
53     /** Constructor - Creates a CIMListener object.
54         The CIM Listener objects establishes a repository object,
55         a dispatcher object, and creates a channnel factory and
56         acceptor for the Listener.
57         @param monitor    monitor object for the server.
58         @param rootPath Directory path to the repository.
59     */
60
61     CIMListener(
62         Monitor* monitor,
63         const String& rootPath,
64         Boolean dynamicReg,
65         Boolean staticConsumers,
66         Boolean persistence);
67
68     ~CIMListener();
69
70     /** bind Binds the port address to the Listener.
71         @param address char* to the port address for TCP.
72         @exception - This function may receive exceptions from
73         Channel specific subfunctions.
74     */
75     void bind(Uint32 port);
76
77     /** runForever Main runloop for the server.
78     */
79     void runForever();
80
81     /** Call to gracefully shutdown the server.  The server connection socket
82         will be closed to disable new connections from clients.
83     */
84     void stopClientConnection(); 
85
86     /** Call to gracefully shutdown the server.  It is called when the server
87         has been stopped and is ready to be shutdown.  Next time runForever() 
88         is called, the server shuts down.
89     */
90     void shutdown();
91
92     /** Return true if the server has shutdown, false otherwise.
93     */
94     Boolean terminated() { return _dieNow; };
95
96     /** Call to resume the sever. 
97     */
98     void resume();
99
100     Uint32 getOutstandingRequestCount();
101
102     CIMExportRequestDispatcher* getDispatcher();
103
104 private:
105
106     Boolean _dieNow;
107
108     String _rootPath;
109     String _repositoryRootPath;
110
111     Boolean _dynamicReg;
112     Boolean _staticConsumers;
113     Boolean _persistence;
114
115     Monitor* _monitor;
116     
117     CIMExportRequestDispatcher* _cimExportRequestDispatcher;
118     CIMExportResponseEncoder* _cimExportResponseEncoder;
119     CIMExportRequestDecoder* _cimExportRequestDecoder;
120
121     HTTPAcceptor*   _acceptor;
122 };
123
124 PEGASUS_NAMESPACE_END
125
126 #endif /* Pegasus_Listener_h */