version 1.10, 2008/12/16 18:56:42
|
version 1.10.8.3, 2013/09/14 23:08:20
|
|
|
// | // |
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// |
// | // |
// Author: Heather Sterling (hsterl@us.ibm.com) |
|
// |
|
// Modified By: |
|
// |
|
//%//////////////////////////////////////////////////////////////////////////// | //%//////////////////////////////////////////////////////////////////////////// |
| |
#include "DynamicListener.h" | #include "DynamicListener.h" |
|
|
| |
#include <Pegasus/Common/HashTable.h> | #include <Pegasus/Common/HashTable.h> |
#include <Pegasus/Common/FileSystem.h> | #include <Pegasus/Common/FileSystem.h> |
|
#include <Pegasus/General/SSLContextManager.h> |
|
#include <Pegasus/Config/ConfigManager.h> |
| |
#include <Pegasus/ExportServer/CIMExportResponseEncoder.h> | #include <Pegasus/ExportServer/CIMExportResponseEncoder.h> |
#include <Pegasus/ExportServer/CIMExportRequestDecoder.h> | #include <Pegasus/ExportServer/CIMExportRequestDecoder.h> |
|
|
const String& consumerDir, | const String& consumerDir, |
const String& consumerConfigDir, | const String& consumerConfigDir, |
SSLContext* sslContext, | SSLContext* sslContext, |
|
ReadWriteSem* _sslContextObjectLock, |
Boolean enableConsumerUnload, | Boolean enableConsumerUnload, |
Uint32 consumerIdleTimeout, | Uint32 consumerIdleTimeout, |
Uint32 shutdownTimeout); | Uint32 shutdownTimeout); |
| |
|
DynamicListenerRep( |
|
Uint32 portNumber, |
|
const String& consumerDir, |
|
const String& consumerConfigDir, |
|
Boolean useSSL, |
|
const String& keyPath, |
|
const String& certPath, |
|
Boolean enableConsumerUnload, |
|
Uint32 consumerIdleTimeout, |
|
Uint32 shutdownTimeout, |
|
const String & sslCipherSuite="DEFAULT", |
|
const Boolean& sslCompatibility = false); |
|
|
~DynamicListenerRep(); | ~DynamicListenerRep(); |
| |
void start(); | void start(); |
|
|
// config properties -- do we want to separate these out???? | // config properties -- do we want to separate these out???? |
Uint32 _port; | Uint32 _port; |
SSLContext* _sslContext; | SSLContext* _sslContext; |
|
ReadWriteSem* _sslContextObjectLock; |
|
SSLContextManager *_sslContextMgr; |
}; | }; |
| |
DynamicListenerRep::DynamicListenerRep( | DynamicListenerRep::DynamicListenerRep( |
|
|
const String& consumerDir, //consumer mgr | const String& consumerDir, //consumer mgr |
const String& consumerConfigDir, //consumer mgr | const String& consumerConfigDir, //consumer mgr |
SSLContext* sslContext, //listener svc | SSLContext* sslContext, //listener svc |
|
ReadWriteSem* sslContextObjectLock, // lock for accessing the ssl context |
Boolean enableConsumerUnload, //consumer mgr | Boolean enableConsumerUnload, //consumer mgr |
Uint32 consumerIdleTimeout, //consumer mgr | Uint32 consumerIdleTimeout, //consumer mgr |
Uint32 shutdownTimeout) : _port(portNumber), _sslContext(sslContext) |
Uint32 shutdownTimeout) : |
|
_port(portNumber), |
|
_sslContext(sslContext), |
|
_sslContextObjectLock(sslContextObjectLock), |
|
_sslContextMgr(0) |
|
{ |
|
PEG_METHOD_ENTER(TRC_LISTENER, "DynamicListenerRep::DynamicListenerRep"); |
|
|
|
_consumerManager = new ConsumerManager( |
|
consumerDir, |
|
consumerConfigDir, |
|
enableConsumerUnload, |
|
consumerIdleTimeout); |
|
|
|
_listenerService = new ListenerService(_consumerManager); |
|
|
|
PEG_METHOD_EXIT(); |
|
} |
|
|
|
DynamicListenerRep::DynamicListenerRep( |
|
Uint32 portNumber, |
|
const String& consumerDir, |
|
const String& consumerConfigDir, |
|
Boolean useSSL, |
|
const String& keyPath, |
|
const String& certPath, |
|
Boolean enableConsumerUnload, |
|
Uint32 consumerIdleTimeout, |
|
Uint32 shutdownTimeout, |
|
const String & sslCipherSuite, |
|
const Boolean& sslCompatibility) : |
|
_port(portNumber), |
|
_sslContext(0), |
|
_sslContextObjectLock(0), |
|
_sslContextMgr(0) |
{ | { |
PEG_METHOD_ENTER(TRC_LISTENER, "DynamicListenerRep::DynamicListenerRep"); | PEG_METHOD_ENTER(TRC_LISTENER, "DynamicListenerRep::DynamicListenerRep"); |
| |
|
#ifdef PEGASUS_HAS_SSL |
|
if (useSSL) |
|
{ |
|
_sslContextMgr = new SSLContextManager(); |
|
|
|
_sslContextMgr->createSSLContext( |
|
String(), |
|
certPath, |
|
keyPath, |
|
String(), |
|
true, |
|
String(), |
|
sslCipherSuite, |
|
sslCompatibility); |
|
_sslContext = _sslContextMgr->getSSLContext(); |
|
_sslContextObjectLock = _sslContextMgr->getSSLContextObjectLock(); |
|
} |
|
#endif |
|
|
_consumerManager = new ConsumerManager( | _consumerManager = new ConsumerManager( |
consumerDir, | consumerDir, |
consumerConfigDir, | consumerConfigDir, |
|
|
| |
delete _listenerService; | delete _listenerService; |
| |
|
delete _sslContextMgr; |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
|
|
| |
if (_sslContext) | if (_sslContext) |
{ | { |
_listenerService->initializeListener(_port, true, _sslContext); |
_listenerService->initializeListener( |
|
_port, |
|
true, |
|
_sslContext, |
|
_sslContextObjectLock); |
| |
} else |
} |
|
else |
{ | { |
_listenerService->initializeListener(_port, false, 0); |
_listenerService->initializeListener(_port, false, 0, 0); |
} | } |
| |
_listenerService->runListener(); | _listenerService->runListener(); |
|
|
consumerDir, | consumerDir, |
consumerConfigDir, | consumerConfigDir, |
0, | 0, |
|
0, |
enableConsumerUnload, | enableConsumerUnload, |
consumerIdleTimeout, | consumerIdleTimeout, |
shutdownTimeout); | shutdownTimeout); |
|
|
const String& certPath, | const String& certPath, |
Boolean enableConsumerUnload, | Boolean enableConsumerUnload, |
Uint32 consumerIdleTimeout, | Uint32 consumerIdleTimeout, |
Uint32 shutdownTimeout) //ONLY IF PEGASUS_HAS_SSL |
Uint32 shutdownTimeout, |
|
const String & sslCipherSuite, |
|
const Boolean& sslCompatibility) |
|
//ONLY IF PEGASUS_HAS_SSL |
{ | { |
SSLContext* sslContext = 0; |
|
if (useSSL) |
|
{ |
|
sslContext = new SSLContext( |
|
String::EMPTY, |
|
certPath, |
|
keyPath, |
|
0, |
|
String::EMPTY); //randFile); |
|
} |
|
| |
_rep = new DynamicListenerRep(portNumber, |
_rep = new DynamicListenerRep( |
|
portNumber, |
consumerDir, | consumerDir, |
consumerConfigDir, | consumerConfigDir, |
sslContext, |
useSSL, |
|
keyPath, |
|
certPath, |
enableConsumerUnload, | enableConsumerUnload, |
consumerIdleTimeout, | consumerIdleTimeout, |
shutdownTimeout); |
shutdownTimeout, |
|
sslCipherSuite, |
|
sslCompatibility); |
} | } |
| |
DynamicListener::DynamicListener( | DynamicListener::DynamicListener( |
|
|
const String& consumerConfigDir, | const String& consumerConfigDir, |
Boolean useSSL, | Boolean useSSL, |
SSLContext* sslContext, | SSLContext* sslContext, |
|
ReadWriteSem* sslContextObjectLock, |
Boolean enableConsumerUnload, | Boolean enableConsumerUnload, |
Uint32 consumerIdleTimeout, | Uint32 consumerIdleTimeout, |
Uint32 shutdownTimeout) //ONLY IF PEGASUS_HAS_SSL | Uint32 shutdownTimeout) //ONLY IF PEGASUS_HAS_SSL |
|
|
consumerDir, | consumerDir, |
consumerConfigDir, | consumerConfigDir, |
sslContext, | sslContext, |
|
sslContextObjectLock, |
enableConsumerUnload, | enableConsumerUnload, |
consumerIdleTimeout, | consumerIdleTimeout, |
shutdownTimeout); | shutdownTimeout); |