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/SUdpServerControlChannel.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/SUdpServerControlChannel.cpp')
-rw-r--r-- | cpp/src/Ice/SUdpServerControlChannel.cpp | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/cpp/src/Ice/SUdpServerControlChannel.cpp b/cpp/src/Ice/SUdpServerControlChannel.cpp new file mode 100644 index 00000000000..fde3b25eccc --- /dev/null +++ b/cpp/src/Ice/SUdpServerControlChannel.cpp @@ -0,0 +1,107 @@ +// ********************************************************************** +// +// Copyright (c) 2002 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/SUdpServerControlChannel.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::ServerControlChannel::clientHello(const ClientChannelPtr& client, + const ByteSeq& MACkey, + const Current&) +{ + IceUtil::Mutex::Lock sync(_mutex); + if (_transceiver != 0) + { + _transceiver->clientHello(client, MACkey); + } +} + +void +IceSecurity::SecureUdp::ServerControlChannel::clientKeyAcknowledge(Long clientID, + Long msgID, + const Current&) +{ + IceUtil::Mutex::Lock sync(_mutex); + if (_transceiver != 0) + { + _transceiver->clientKeyAcknowledge(clientID, msgID); + } +} + +void +IceSecurity::SecureUdp::ServerControlChannel::clientKeyRequest(Long clientID, + const Current&) +{ + IceUtil::Mutex::Lock sync(_mutex); + if (_transceiver != 0) + { + _transceiver->clientKeyRequest(clientID); + } +} + +void +IceSecurity::SecureUdp::ServerControlChannel::clientGoodbye(Long clientID, + const Current&) +{ + IceUtil::Mutex::Lock sync(_mutex); + if (_transceiver != 0) + { + _transceiver->clientGoodbye(clientID); + } +} + +IceSecurity::SecureUdp::ServerControlChannel::ServerControlChannel(const SUdpTransceiverPtr& transceiver, + const InstancePtr& instance, + int port) : + ControlChannel(transceiver, instance), + _port(port) +{ + // Create the Server Channel's name + ostringstream objectName; + objectName << "sudpServer" << dec << _port; + + // This MUST be an SSL endpoint - secure handshake take place over this. + ostringstream endpt; + endpt << "ssl -p " << dec << _port; + + // Create the ObjectAdapter's name + ostringstream objectAdapterName; + objectAdapterName << "sudpServerControl" << dec << _port; + + Ice::CommunicatorPtr communicator = _instance->communicator(); + + // Create our ObjectAdapter + _adapter = communicator->createObjectAdapterWithEndpoints(objectAdapterName.str(), endpt.str()); + + // The server control channel is the implemenation. + ServerChannelPtr serverChannel = this; + + _adapter->add(serverChannel, Ice::stringToIdentity(objectName.str())); + + // Okay, allow the object to begin accepting requests + _adapter->activate(); +} + +IceSecurity::SecureUdp::ServerControlChannel::~ServerControlChannel() +{ + // Make it impossible for the control channel to access the Transceiver + // after transceiver destruction. + unsetTransceiver(); +} + |