Module: Secure Communication Module Package: Secure Sockets
RWPortal RWSecureSocketPortal RWSocketPortalBase
#include <rw/secsock/RWSecureSocketPortal.h>
RWSecureSocketPortal is an access point of a reliable byte stream communication channel that utilizes the SSL/TLS protocols for information security. Multiple RWSecureSocketPortals can access the same communication channel. This often happens when using the copy constructor and assignment operator. Unless you specify otherwise during construction, when the last portal into a channel goes out of scope, the communication channel is closed and all.
RWSecureSocketPortals are lightweight objects. In addition, the copy and assign operations do not copy the underlying communication channel, so these operations are inexpensive. As a result, RWSecureSocketPortals can be returned by value and used as data members in objects.
RWSecureSocketPortal provides a secure socket implementation of a portal, implemented using the RWSecureSocket class. No state is added to RWPortal, so you can assign an RWSecureSocketPortal to an RWPortal without loss of data other than the type.
enum WhoShouldClose { Portal, Application };
Indicates who is responsible for closing the socket.
RWSecureSocketPortal();
Creates a secure socket portal. You must establish a connection using either connect() or the assignment operator before the portal can be used.
RWSecureSocketPortal(const RWSockAddrBase& addr, const RWSecureSocketContext& context);
Creates a secure socket portal connected to the addr, using the context provided.
RWSecureSocketPortal(const RWSockAddrBase& addr, const RWSecureSocketSession& sess, const RWSecureSocketContext& context);
Creates a secure socket portal connected to addr. Uses the context provided and attempts to reuse the session sess. If the session cannot be reused, a new session is established.
RWSecureSocketPortal(const RWSecureSocket& socket, WhoShouldClose=Portal);
Creates a secure socket portal to the communications channel represented by socket. Using this constructor is the only way to create a socket portal that does not close the underlying socket when no remaining portal references it.
void connect(const RWSockAddrBase&, RWSecureSocketContext& context);
Connects self to the address using context.
void connect(const RWSockAddrBase&, const RWSecureSocketSession& sess, const RWSecureSocketContext& context);
Connects self to the address using context, and attempts to reuse the session sess. If the session cannot be reused, a new session is established.
RWSecureSocketSession getSession() const;
Returns the session associated with this RWSecureSocketPortal. Applications should check the returned RWSecureSocketSession for validity using RWSecureSocketSession::isValid(). Returns one of the following:
If an SSL connection is active (connect has been called), getSession() returns the active session.
If no SSL connection is active and this RWSecureSocketPortal has never been connected, getSession() returns an invalid session.
If no SSL connection is active but this RWSecureSocketPortal was connected before, getSession() returns the session used for the previous connection.
RWSecureSocket getSocket() const;
Obtains a reference to the underlying secure socket.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.