diff options
author | Anthony Neal <aneal@zeroc.com> | 2002-01-11 20:17:10 +0000 |
---|---|---|
committer | Anthony Neal <aneal@zeroc.com> | 2002-01-11 20:17:10 +0000 |
commit | 506feb75899cde565ba6be78418de5a12393d514 (patch) | |
tree | d5ad04e1dc0dc83269d9631a00921aa73eb3cbca /cpp/src/Ice/SUdpClientControlChannel.cpp | |
parent | move all types from module._internal.nameType to _internal.module.nameType (diff) | |
download | ice-506feb75899cde565ba6be78418de5a12393d514.tar.bz2 ice-506feb75899cde565ba6be78418de5a12393d514.tar.xz ice-506feb75899cde565ba6be78418de5a12393d514.zip |
Initial coding for Secure UDP.
Diffstat (limited to 'cpp/src/Ice/SUdpClientControlChannel.cpp')
-rw-r--r-- | cpp/src/Ice/SUdpClientControlChannel.cpp | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/cpp/src/Ice/SUdpClientControlChannel.cpp b/cpp/src/Ice/SUdpClientControlChannel.cpp new file mode 100644 index 00000000000..869bba92c0e --- /dev/null +++ b/cpp/src/Ice/SUdpClientControlChannel.cpp @@ -0,0 +1,92 @@ +// ********************************************************************** +// +// Copyright (c) 2002 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/SUdpClientControlChannel.h> +#include <Ice/Instance.h> +#include <Ice/Communicator.h> +#include <Ice/ObjectAdapter.h> +#include <Ice/IdentityUtil.h> +#include <Ice/SUdpTransceiver.h> +#include <sstream> + +using namespace std; +using namespace Ice; +using namespace IceSecurity::SecureUdp; + +void +IceSecurity::SecureUdp::ClientControlChannel::serverHello(Long clientID, const ByteSeq& key, const Current&) +{ + IceUtil::Mutex::Lock sync(_mutex); + if (_transceiver != 0) + { + _transceiver->serverHello(clientID, key); + } +} + +void +IceSecurity::SecureUdp::ClientControlChannel::serverKeyChange(const ByteSeq& key, const Current&) +{ + IceUtil::Mutex::Lock sync(_mutex); + if (_transceiver != 0) + { + _transceiver->serverKeyChange(key); + } +} + +void +IceSecurity::SecureUdp::ClientControlChannel::serverGoodbye(const Current&) +{ + IceUtil::Mutex::Lock sync(_mutex); + if (_transceiver != 0) + { + _transceiver->serverGoodbye(); + } +} + +IceSecurity::SecureUdp::ClientControlChannel::ClientControlChannel(const SUdpTransceiverPtr& transceiver, + const InstancePtr& instance, + const std::string& host, + int port) : + ControlChannel(transceiver, instance), + _host(host), + _port(port) +{ + // Create the Client Channel's name + ostringstream objectName; + objectName << "sudpClient" << hex << (void *) this; + + // This MUST be an SSL endpoint - secure handshake takes place over this. + ostringstream endpt; + endpt << "ssl"; + + // Create the ObjectAdapter's name + ostringstream objectAdapterName; + objectAdapterName << "sudpClientControl" << hex << (void *) this; + + Ice::CommunicatorPtr communicator = _instance->communicator(); + + // Create our ObjectAdapter + _adapter = communicator->createObjectAdapterWithEndpoints(objectAdapterName.str(), endpt.str()); + + // The client control channel is the implementaion. + ClientChannelPtr clientChannel = this; + + _adapter->add(clientChannel, Ice::stringToIdentity(objectName.str())); + + // Okay, allow the object to begin accepting requests + _adapter->activate(); +} + +IceSecurity::SecureUdp::ClientControlChannel::~ClientControlChannel() +{ + // Make it impossible for the control channel to access the Transceiver + // after transceiver destruction. + unsetTransceiver(); +} |