(file) Return to CIMListener.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Listener

  1 kumpf 1.1 //%/////////////////////////////////////////////////////////////////////////////
  2           //
  3 kumpf 1.3 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
  4 kumpf 1.1 // 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 kumpf 1.3 // 
 13 kumpf 1.1 // 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: Mike Brasher (mbrasher@bmc.com)
 25           //
 26           // Modified By:
 27           //         Mike Day (mdday@us.ibm.com)s
 28           //         Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
 29           //         Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)
 30           //         Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
 31           //         Jenny Yu, Hewlett-Packard Company (jenny_yu@hp.com)
 32           //
 33           //%/////////////////////////////////////////////////////////////////////////////
 34 kumpf 1.1 
 35           #include <Pegasus/Common/Config.h>
 36           
 37           #include <iostream>
 38           #include <cassert>
 39           #include <cstdio>
 40           #include <cctype>
 41           #include <ctime>
 42           #include <Pegasus/Common/FileSystem.h>
 43           #include <Pegasus/Common/HTTPAcceptor.h>
 44           #include <Pegasus/Common/Tracer.h>
 45 kumpf 1.2 #include <Pegasus/Common/PegasusVersion.h>
 46           
 47 kumpf 1.1 #include <Pegasus/Repository/CIMRepository.h>
 48           #include <Pegasus/ExportServer/CIMExportRequestDispatcher.h>
 49           #include <Pegasus/ExportServer/CIMExportResponseEncoder.h>
 50           #include <Pegasus/ExportServer/CIMExportRequestDecoder.h>
 51           
 52           #include "CIMListener.h"
 53           
 54           #define DDD(X) // X
 55           
 56           PEGASUS_USING_STD;
 57           
 58           PEGASUS_NAMESPACE_BEGIN
 59           
 60           CIMListener::CIMListener(
 61               Monitor* monitor,
 62               const String& rootPath,
 63               Boolean dynamicReg,
 64               Boolean staticConsumers,
 65               Boolean persistence)
 66               : _dieNow(false), _rootPath(rootPath),
 67               _dynamicReg(dynamicReg), 
 68 kumpf 1.1     _staticConsumers(staticConsumers), 
 69               _persistence(persistence)
 70           {
 71 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::CIMListener()");
 72 kumpf 1.1 
 73               // -- Save the monitor or create a new one:
 74           
 75               _monitor = monitor;
 76           
 77               // -- Create a CIMListenerState object:
 78           
 79               _cimExportRequestDispatcher
 80           	= new CIMExportRequestDispatcher(dynamicReg, staticConsumers, persistence);
 81           
 82               _cimExportResponseEncoder
 83           	= new CIMExportResponseEncoder;
 84           
 85               _cimExportRequestDecoder = new CIMExportRequestDecoder(
 86           	_cimExportRequestDispatcher,
 87           	_cimExportResponseEncoder->getQueueId());
 88           
 89               SSLContext * sslcontext = NULL;
 90           
 91               _acceptor = new HTTPAcceptor(_monitor, _cimExportRequestDecoder, sslcontext);
 92           
 93 kumpf 1.4     PEG_METHOD_EXIT();
 94 kumpf 1.1 }
 95           
 96           CIMListener::~CIMListener()
 97           {
 98 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::~CIMListener()");
 99 kumpf 1.1 
100               // Note: do not delete the acceptor because it belongs to the Monitor
101               // which takes care of disposing of it.
102           
103 kumpf 1.4     PEG_METHOD_EXIT();
104 kumpf 1.1 }
105           
106           void CIMListener::bind(Uint32 port)
107           {
108 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::bind()");
109 kumpf 1.1 
110               // not the best place to build the service url, but it works for now
111               // because the address string is accessible  mdday
112           
113               _acceptor->bind(port);
114           
115 kumpf 1.4     PEG_METHOD_EXIT();
116 kumpf 1.1 }
117           
118           void CIMListener::runForever()
119           {
120               //ATTN: Do not add Trace code in this method.
121               if(!_dieNow)
122           	_monitor->run(100);
123           }
124           
125           void CIMListener::stopClientConnection()
126           {
127 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::stopClientConnection()");
128 kumpf 1.1 
129               _acceptor->closeConnectionSocket();
130           
131 kumpf 1.4     PEG_METHOD_EXIT();
132 kumpf 1.1 }
133           
134           void CIMListener::shutdown()
135           {
136 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::shutdown()");
137 kumpf 1.1 
138               _dieNow = true;
139           
140 kumpf 1.4     PEG_METHOD_EXIT();
141 kumpf 1.1 }
142           
143           void CIMListener::resume()
144           {
145 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::resume()");
146 kumpf 1.1 
147               _acceptor->reopenConnectionSocket();
148           
149 kumpf 1.4     PEG_METHOD_EXIT();
150 kumpf 1.1 }
151           
152           CIMExportRequestDispatcher* CIMListener::getDispatcher()
153           {
154 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::getDispatcher()");
155 kumpf 1.1 
156 kumpf 1.4     PEG_METHOD_EXIT();
157 kumpf 1.1 
158               return _cimExportRequestDispatcher;
159           }
160           
161           Uint32 CIMListener::getOutstandingRequestCount()
162           {
163 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::getOutstandingRequestCount()");
164 kumpf 1.1 
165 kumpf 1.4     PEG_METHOD_EXIT();
166 kumpf 1.1 
167               return (_acceptor->getOutstandingRequestCount());
168           }
169           
170           PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2