activemq-cpp-3.6.0
|
#include <src/main/decaf/net/ssl/SSLSocket.h>
Public Member Functions | |
SSLSocket () | |
SSLSocket (const InetAddress *address, int port) | |
Creates a new SSLSocket instance and connects it to the given address and port. | |
SSLSocket (const InetAddress *address, int port, const InetAddress *localAddress, int localPort) | |
Creates a new SSLSocket instance and connects it to the given address and port. | |
SSLSocket (const std::string &host, int port) | |
Creates a new SSLSocket instance and connects it to the given host and port. | |
SSLSocket (const std::string &host, int port, const InetAddress *localAddress, int localPort) | |
Creates a new SSLSocket instance and connects it to the given host and port. | |
virtual | ~SSLSocket () |
virtual std::vector< std::string > | getSupportedCipherSuites () const =0 |
Gets a vector containing the names of all the cipher suites that are supported by this SSLSocket. | |
virtual std::vector< std::string > | getSupportedProtocols () const =0 |
Gets a vector containing the names of all the protocols that could be enabled for this SSLSocket instance. | |
virtual std::vector< std::string > | getEnabledCipherSuites () const =0 |
Returns a vector containing the names of all the currently enabled Cipher Suites for this SSL Socket. | |
virtual void | setEnabledCipherSuites (const std::vector< std::string > &suites)=0 |
Sets the Cipher Suites that are to be enabled on the SSL Socket connection. | |
virtual std::vector< std::string > | getEnabledProtocols () const =0 |
Returns a vector containing the names of all the currently enabled Protocols for this SSL Socket. | |
virtual void | setEnabledProtocols (const std::vector< std::string > &protocols)=0 |
Sets the Protocols that are to be enabled on the SSL Socket connection. | |
virtual SSLParameters | getSSLParameters () const |
Returns an SSLParameters object for this SSLSocket instance. | |
virtual void | setSSLParameters (const SSLParameters &value) |
Sets the SSLParameters for this SSLSocket using the supplied SSLParameters instance. | |
virtual void | startHandshake ()=0 |
Initiates a handshake for this SSL Connection, this can be necessary for several reasons such as using new encryption keys, or starting a new session. | |
virtual void | setUseClientMode (bool value)=0 |
Determines the mode that the socket uses when a handshake is initiated, client or server. | |
virtual bool | getUseClientMode () const =0 |
Gets whether this Socket is in Client or Server mode, true indicates that the mode is set to Client. | |
virtual void | setNeedClientAuth (bool value)=0 |
Sets the Socket to require that a client authenticate itself by sending a valid Certificate that is trusted by this Server mode socket. | |
virtual bool | getNeedClientAuth () const =0 |
Returns if this socket is configured to require client authentication, true means that is has and that clients that failed to authenticate will be rejected. | |
virtual void | setWantClientAuth (bool value)=0 |
Sets the Socket to request that a client authenticate itself by sending a valid Certificate that is trusted by this Server mode socket. | |
virtual bool | getWantClientAuth () const =0 |
Returns if this socket is configured to request client authentication, true means that is has and that clients that failed to authenticate will be rejected but that cleints that do not send a certificate are not considered to have failed authentication. | |
![]() | |
Socket () | |
Creates an unconnected Socket using the set SocketImplFactory or if non is set than the default SockImpl type is created. | |
Socket (SocketImpl *impl) | |
Creates a Socket wrapping the provided SocketImpl instance, this Socket is considered unconnected. | |
Socket (const InetAddress *address, int port) | |
Creates a new Socket instance and connects it to the given address and port. | |
Socket (const InetAddress *address, int port, const InetAddress *localAddress, int localPort) | |
Creates a new Socket instance and connects it to the given address and port. | |
Socket (const std::string &host, int port) | |
Creates a new Socket instance and connects it to the given host and port. | |
Socket (const std::string &host, int port, const InetAddress *localAddress, int localPort) | |
Creates a new Socket instance and connects it to the given host and port. | |
virtual | ~Socket () |
virtual void | bind (const std::string &ipaddress, int port) |
Binds this Socket to the given local address and port. | |
virtual void | close () |
Closes the Socket. | |
virtual void | connect (const std::string &host, int port) |
Connects to the specified destination. | |
virtual void | connect (const std::string &host, int port, int timeout) |
Connects to the specified destination, with a specified timeout value. | |
bool | isConnected () const |
Indicates whether or not this socket is connected to am end point. | |
bool | isClosed () const |
bool | isBound () const |
bool | isInputShutdown () const |
bool | isOutputShutdown () const |
virtual decaf::io::InputStream * | getInputStream () |
Gets the InputStream for this socket if its connected. | |
virtual decaf::io::OutputStream * | getOutputStream () |
Gets the OutputStream for this socket if it is connected. | |
int | getPort () const |
Gets the on the remote host this Socket is connected to. | |
int | getLocalPort () const |
Gets the local port the socket is bound to. | |
std::string | getInetAddress () const |
Returns the address to which the socket is connected. | |
std::string | getLocalAddress () const |
Gets the local address to which the socket is bound. | |
virtual void | shutdownInput () |
Shuts down the InputStream for this socket essentially marking it as EOF. | |
virtual void | shutdownOutput () |
Shuts down the OutputStream for this socket, any data already written to the socket will be sent, any further calls to OuputStream::write will throw an IOException. | |
virtual int | getSoLinger () const |
Gets the linger time for the socket, SO_LINGER. | |
virtual void | setSoLinger (bool state, int timeout) |
Sets the linger time (SO_LINGER) using a specified time value, this limits of this value are platform specific. | |
virtual bool | getKeepAlive () const |
Gets the keep alive flag for this socket, SO_KEEPALIVE. | |
virtual void | setKeepAlive (bool keepAlive) |
Enables/disables the keep alive flag for this socket, SO_KEEPALIVE. | |
virtual int | getReceiveBufferSize () const |
Gets the receive buffer size for this socket, SO_RCVBUF. | |
virtual void | setReceiveBufferSize (int size) |
Sets the receive buffer size for this socket, SO_RCVBUF. | |
virtual bool | getReuseAddress () const |
Gets the reuse address flag, SO_REUSEADDR. | |
virtual void | setReuseAddress (bool reuse) |
Sets the reuse address flag, SO_REUSEADDR. | |
virtual int | getSendBufferSize () const |
Gets the send buffer size for this socket, SO_SNDBUF, this value is used by the platform socket to buffer data written to the socket. | |
virtual void | setSendBufferSize (int size) |
Gets the send buffer size for this socket, SO_SNDBUF, this value is used by the platform socket to buffer data written to the socket. | |
virtual int | getSoTimeout () const |
Gets the timeout for socket operations, SO_TIMEOUT. | |
virtual void | setSoTimeout (int timeout) |
Sets the timeout for socket operations, SO_TIMEOUT. | |
virtual bool | getTcpNoDelay () const |
Gets the Status of the TCP_NODELAY setting for this socket. | |
virtual void | setTcpNoDelay (bool value) |
Sets the Status of the TCP_NODELAY param for this socket., this setting is used to disable or enable Nagle's algorithm on the Socket. | |
virtual int | getTrafficClass () const |
Gets the Traffic Class setting for this Socket, sometimes referred to as Type of Service setting. | |
virtual void | setTrafficClass (int value) |
Gets the Traffic Class setting for this Socket, sometimes referred to as Type of Service setting. | |
virtual bool | getOOBInline () const |
Gets the value of the OOBINLINE for this socket. | |
virtual void | setOOBInline (bool value) |
Sets the value of the OOBINLINE for this socket, by default this option is disabled. | |
virtual void | sendUrgentData (int data) |
Sends on byte of urgent data to the Socket. | |
virtual std::string | toString () const |
![]() | |
virtual | ~Closeable () |
Additional Inherited Members | |
![]() | |
static void | setSocketImplFactory (SocketImplFactory *factory) |
Sets the instance of a SocketImplFactory that the Socket class should use when new instances of this class are created. | |
![]() | |
void | accepted () |
void | initSocketImpl (const std::string &address, int port, const InetAddress *localAddress, int localPort) |
void | checkClosed () const |
void | ensureCreated () const |
![]() | |
SocketImpl * | impl |
decaf::net::ssl::SSLSocket::SSLSocket | ( | ) |
decaf::net::ssl::SSLSocket::SSLSocket | ( | const InetAddress * | address, |
int | port | ||
) |
Creates a new SSLSocket instance and connects it to the given address and port.
If the host parameter is empty then the loop back address is used.
address | The address to connect to. |
port | The port number to connect to [0...65535] |
UnknownHostException | if the host cannot be resolved. |
IOException | if an I/O error occurs while connecting the Socket. |
NullPointerException | if the InetAddress instance in NULL. |
IllegalArgumentException | if the port if not in range [0...65535] |
decaf::net::ssl::SSLSocket::SSLSocket | ( | const InetAddress * | address, |
int | port, | ||
const InetAddress * | localAddress, | ||
int | localPort | ||
) |
Creates a new SSLSocket instance and connects it to the given address and port.
The Socket will also bind to the local address and port specified.
address | The address to connect to. |
port | The port number to connect to [0...65535] |
localAddress | The IP address on the local machine to bind to. |
localPort | The port on the local machine to bind to. |
UnknownHostException | if the host cannot be resolved. |
IOException | if an I/O error occurs while connecting the Socket. |
NullPointerException | if the InetAddress instance in NULL. |
IllegalArgumentException | if the port if not in range [0...65535] |
decaf::net::ssl::SSLSocket::SSLSocket | ( | const std::string & | host, |
int | port | ||
) |
Creates a new SSLSocket instance and connects it to the given host and port.
If the host parameter is empty then the loop back address is used.
host | The host name or IP address to connect to, empty string means loopback. |
port | The port number to connect to [0...65535] |
UnknownHostException | if the host cannot be resolved. |
IOException | if an I/O error occurs while connecting the Socket. |
IllegalArgumentException | if the port if not in range [0...65535] |
decaf::net::ssl::SSLSocket::SSLSocket | ( | const std::string & | host, |
int | port, | ||
const InetAddress * | localAddress, | ||
int | localPort | ||
) |
Creates a new SSLSocket instance and connects it to the given host and port.
If the host parameter is empty then the loop back address is used.
host | The host name or IP address to connect to, empty string means loopback. |
port | The port number to connect to [0...65535] |
localAddress | The IP address on the local machine to bind to. |
localPort | The port on the local machine to bind to. |
UnknownHostException | if the host cannot be resolved. |
IOException | if an I/O error occurs while connecting the Socket. |
IllegalArgumentException | if the port if not in range [0...65535] |
|
virtual |
|
pure virtual |
Returns a vector containing the names of all the currently enabled Cipher Suites for this SSL Socket.
Implemented in decaf::internal::net::ssl::openssl::OpenSSLSocket.
|
pure virtual |
Returns a vector containing the names of all the currently enabled Protocols for this SSL Socket.
Implemented in decaf::internal::net::ssl::openssl::OpenSSLSocket.
|
pure virtual |
Returns if this socket is configured to require client authentication, true means that is has and that clients that failed to authenticate will be rejected.
This option is only useful when the socket is operating in server mode.
Implemented in decaf::internal::net::ssl::openssl::OpenSSLSocket.
|
virtual |
Returns an SSLParameters object for this SSLSocket instance.
The cipherSuites and protocols vectors in the returned SSLParameters reference will never be empty.
|
pure virtual |
Gets a vector containing the names of all the cipher suites that are supported by this SSLSocket.
Normally not all of these cipher suites will be enabled on the Socket.
Implemented in decaf::internal::net::ssl::openssl::OpenSSLSocket.
|
pure virtual |
Gets a vector containing the names of all the protocols that could be enabled for this SSLSocket instance.
Implemented in decaf::internal::net::ssl::openssl::OpenSSLSocket.
|
pure virtual |
Gets whether this Socket is in Client or Server mode, true indicates that the mode is set to Client.
Implemented in decaf::internal::net::ssl::openssl::OpenSSLSocket.
|
pure virtual |
Returns if this socket is configured to request client authentication, true means that is has and that clients that failed to authenticate will be rejected but that cleints that do not send a certificate are not considered to have failed authentication.
This option is only useful when the socket is operating in server mode.
Implemented in decaf::internal::net::ssl::openssl::OpenSSLSocket.
|
pure virtual |
Sets the Cipher Suites that are to be enabled on the SSL Socket connection.
Each of the named Cipher Suites must appear in the list of supported cipher suites for this connection or an exception will be thrown.
suites | An Vector of names for all the Cipher Suites that are to be enabled. |
IllegalArgumentException | if the vector is empty or one of the names is invalid. |
Implemented in decaf::internal::net::ssl::openssl::OpenSSLSocket.
|
pure virtual |
Sets the Protocols that are to be enabled on the SSL Socket connection.
Each of the named Protocols must appear in the list of supported protocols suites for this connection or an exception will be thrown.
protocols | An Vector of names for all the Protocols that are to be enabled. |
IllegalArgumentException | if the vector is empty or one of the names is invalid. |
Implemented in decaf::internal::net::ssl::openssl::OpenSSLSocket.
|
pure virtual |
Sets the Socket to require that a client authenticate itself by sending a valid Certificate that is trusted by this Server mode socket.
This option only applies to sockets in the Server mode.
If the option is enabled an the client does not provide a certificate then the handshake is considered failed and the connection is refused. Calling this method resets any previous value for this option as well as clears any value set in the setWantClientAuth method.
value | The value indicating if a client is required to authenticate itself or not. |
Implemented in decaf::internal::net::ssl::openssl::OpenSSLSocket.
|
virtual |
Sets the SSLParameters for this SSLSocket using the supplied SSLParameters instance.
If the cipherSutes vector in the SSLParameters instance is not empty them the setEnabledCipherSuites method is called with that vector, if the protocols vector in the SSLParameters instance is not empty then the setEnabledProtocols method is called with that vector. If the needClientAuth value or the wantClientAuth value is true then the setNeedClientAuth and setWantClientAuth methods are called respectively with a value of true, otherwise the setWantClientAuth method is called with a value of false.
value | The SSLParameters instance that is used to update this SSLSocket's settings. |
IllegalArgumentException | if an error occurs while calling setEnabledCipherSuites or setEnabledProtocols. |
|
pure virtual |
Determines the mode that the socket uses when a handshake is initiated, client or server.
This method must be called prior to any handshake attempts on this Socket, once a handshake has be initiated this socket remains the the set mode; client or server, for the life of this object.
value | The mode setting, true for client or false for server. |
IllegalArguementException | if the handshake process has begun and mode is lcoked. |
Implemented in decaf::internal::net::ssl::openssl::OpenSSLSocket.
|
pure virtual |
Sets the Socket to request that a client authenticate itself by sending a valid Certificate that is trusted by this Server mode socket.
This option only applies to sockets in the Server mode.
If the option is enabled an the client does not provide a certificate then the handshake is considered to have succeeded, if it does send a certificate and that certificate is invalid the the handshake will fail. Calling this method resets any previous value for this option as well as clears any value set in the setNeedClientAuth method.
value | The value indicating if a client is requested to authenticate itself or not. |
Implemented in decaf::internal::net::ssl::openssl::OpenSSLSocket.
|
pure virtual |
Initiates a handshake for this SSL Connection, this can be necessary for several reasons such as using new encryption keys, or starting a new session.
When called for the first time after the socket connects this method blocks until the handshake is completed. The provider is not require to support multiple handshakes and can throw an IOException to indicate an error.
IOException | if an I/O error occurs while performing the Handshake |
Implemented in decaf::internal::net::ssl::openssl::OpenSSLSocket.