(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 <cstdio>
 39           #include <cctype>
 40           #include <ctime>
 41           #include <Pegasus/Common/FileSystem.h>
 42           #include <Pegasus/Common/HTTPAcceptor.h>
 43           #include <Pegasus/Common/Tracer.h>
 44 kumpf 1.2 #include <Pegasus/Common/PegasusVersion.h>
 45           
 46 kumpf 1.1 #include <Pegasus/Repository/CIMRepository.h>
 47           #include <Pegasus/ExportServer/CIMExportRequestDispatcher.h>
 48           #include <Pegasus/ExportServer/CIMExportResponseEncoder.h>
 49           #include <Pegasus/ExportServer/CIMExportRequestDecoder.h>
 50           
 51           #include "CIMListener.h"
 52           
 53           #define DDD(X) // X
 54           
 55           PEGASUS_USING_STD;
 56           
 57           PEGASUS_NAMESPACE_BEGIN
 58           
 59           CIMListener::CIMListener(
 60               Monitor* monitor,
 61               const String& rootPath,
 62               Boolean dynamicReg,
 63               Boolean staticConsumers,
 64 kumpf 1.7     Boolean persistence,
 65               Uint32 portNumber)
 66 kumpf 1.1     : _dieNow(false), _rootPath(rootPath),
 67               _dynamicReg(dynamicReg), 
 68               _staticConsumers(staticConsumers), 
 69 kumpf 1.7     _persistence(persistence),
 70               _portNumber(portNumber)
 71 kumpf 1.1 {
 72 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::CIMListener()");
 73 kumpf 1.1 
 74               // -- Save the monitor or create a new one:
 75           
 76               _monitor = monitor;
 77           
 78               // -- Create a CIMListenerState object:
 79           
 80               _cimExportRequestDispatcher
 81           	= new CIMExportRequestDispatcher(dynamicReg, staticConsumers, persistence);
 82           
 83               _cimExportResponseEncoder
 84           	= new CIMExportResponseEncoder;
 85           
 86               _cimExportRequestDecoder = new CIMExportRequestDecoder(
 87           	_cimExportRequestDispatcher,
 88           	_cimExportResponseEncoder->getQueueId());
 89           
 90               SSLContext * sslcontext = NULL;
 91           
 92 kumpf 1.7     _acceptor = new HTTPAcceptor(_monitor, _cimExportRequestDecoder, false, portNumber, sslcontext);
 93 kumpf 1.1 
 94 kumpf 1.4     PEG_METHOD_EXIT();
 95 kumpf 1.1 }
 96           
 97           CIMListener::~CIMListener()
 98           {
 99 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::~CIMListener()");
100 kumpf 1.1 
101               // Note: do not delete the acceptor because it belongs to the Monitor
102               // which takes care of disposing of it.
103           
104 kumpf 1.4     PEG_METHOD_EXIT();
105 kumpf 1.1 }
106           
107 kumpf 1.7 void CIMListener::bind()
108 kumpf 1.1 {
109 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::bind()");
110 kumpf 1.1 
111 kumpf 1.7     _acceptor->bind();
112 kumpf 1.1 
113 kumpf 1.4     PEG_METHOD_EXIT();
114 kumpf 1.1 }
115           
116           void CIMListener::runForever()
117           {
118               //ATTN: Do not add Trace code in this method.
119               if(!_dieNow)
120           	_monitor->run(100);
121           }
122           
123           void CIMListener::stopClientConnection()
124           {
125 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::stopClientConnection()");
126 kumpf 1.1 
127               _acceptor->closeConnectionSocket();
128           
129 kumpf 1.4     PEG_METHOD_EXIT();
130 kumpf 1.1 }
131           
132           void CIMListener::shutdown()
133           {
134 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::shutdown()");
135 kumpf 1.1 
136               _dieNow = true;
137           
138 kumpf 1.4     PEG_METHOD_EXIT();
139 kumpf 1.1 }
140           
141           void CIMListener::resume()
142           {
143 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::resume()");
144 kumpf 1.1 
145               _acceptor->reopenConnectionSocket();
146           
147 kumpf 1.4     PEG_METHOD_EXIT();
148 kumpf 1.1 }
149           
150           Uint32 CIMListener::getOutstandingRequestCount()
151           {
152 kumpf 1.4     PEG_METHOD_ENTER(TRC_SERVER, "CIMListener::getOutstandingRequestCount()");
153 kumpf 1.1 
154 kumpf 1.4     PEG_METHOD_EXIT();
155 kumpf 1.1 
156               return (_acceptor->getOutstandingRequestCount());
157           }
158           
159           PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2