You.i Engine
CYITCPSecureSocket Class Reference

Detailed Description

Implements a secure (SSL/TLS) TCP socket.

The CYITCPSecureSocket class provides methods to send and receive data over a TCP/IP connection in a secure manner by using the SSL protocol. Modern SSL v3.1 has been renamed to TLS v1.1 and the version used is determined by the server but CYITCPSecureSocket is restricted to TLS v1.1 and higher. The default connection timeout (the length of time the secure socket Connect() operation will wait for a connection) is 10 seconds(10000 ms).

#include <network/YiTCPSecureSocket.h>

Inheritance diagram for CYITCPSecureSocket:

Public Member Functions

virtual ~CYITCPSecureSocket ()
 
virtual bool Connect () override
 
virtual bool Disconnect () override
 
virtual bool IsConnected () const override
 
virtual IYISocket::SOCKET_RESULT Send (const char *pBuffer, size_t uLength) override
 
virtual IYISocket::SOCKET_RESULT Send (const char *pBuffer, size_t uLength, size_t &uSent) override
 
virtual IYISocket::SOCKET_RESULT Receive (char *pBuffer, size_t uLength, size_t &uReceived) override
 
virtual uint64_t GetTotalBytesSent () const override
 
virtual uint64_t GetTotalBytesReceived () const override
 
virtual void SetConnectionTimeoutMs (uint32_t uTimeoutMs) override
 
virtual uint32_t GetConnectionTimeoutMs () const override
 
virtual bool SetSocketBlockingEnabled (bool bBlocking) override
 
- Public Member Functions inherited from IYISocket
virtual ~IYISocket ()
 

Static Public Member Functions

static std::unique_ptr< CYITCPSecureSocketCreate (const CYIString &host, uint16_t uPort)
 
- Static Public Member Functions inherited from IYISocket
static bool SOCKET_OPERATION_SUCCEEDED (SOCKET_RESULT eResult)
 

Protected Member Functions

 CYITCPSecureSocket (const CYIString &host, uint16_t uPort)
 

Additional Inherited Members

- Public Types inherited from IYISocket
enum  SOCKET_RESULT {
  YI_SOCKET_SUCCESS,
  YI_SOCKET_ERROR,
  YI_SOCKET_NOT_CONNECTED,
  YI_SOCKET_CLOSE,
  YI_SOCKET_WOULD_BLOCK
}
 Possible return values from socket operations. More...
 

Constructor & Destructor Documentation

virtual CYITCPSecureSocket::~CYITCPSecureSocket ( )
virtual
CYITCPSecureSocket::CYITCPSecureSocket ( const CYIString host,
uint16_t  uPort 
)
protected

Member Function Documentation

virtual bool CYITCPSecureSocket::Connect ( )
overridevirtual

Initiates a connection based on the socket's address and configuration. Returns true if successful.

Implements IYISocket.

static std::unique_ptr<CYITCPSecureSocket> CYITCPSecureSocket::Create ( const CYIString host,
uint16_t  uPort 
)
static

Factory method to create a secure socket based on the host and uPort passed in. Returns the created CYITCPSecureSocket.

virtual bool CYITCPSecureSocket::Disconnect ( )
overridevirtual

Closes the connection on the socket. Returns true if successful.

Implements IYISocket.

virtual uint32_t CYITCPSecureSocket::GetConnectionTimeoutMs ( ) const
overridevirtual

Returns the timeout length in milliseconds.

Implements IYISocket.

virtual uint64_t CYITCPSecureSocket::GetTotalBytesReceived ( ) const
overridevirtual

Returns the total number of bytes received during the lifetime of the socket.

Implements IYISocket.

virtual uint64_t CYITCPSecureSocket::GetTotalBytesSent ( ) const
overridevirtual

Returns the total number of bytes sent during the lifetime of the socket.

Implements IYISocket.

virtual bool CYITCPSecureSocket::IsConnected ( ) const
overridevirtual

Returns true if the socket is connected.

Implements IYISocket.

virtual IYISocket::SOCKET_RESULT CYITCPSecureSocket::Receive ( char *  pBuffer,
size_t  uLength,
size_t uReceived 
)
overridevirtual

Receives a character buffer, pBuffer from a socket, passing in the length,nLength, of the buffer. nReceived is an output parameter representing the number of bytes successfully received. Returns SOCKET_RESULT to indicate socket operation result.

Implements IYISocket.

virtual IYISocket::SOCKET_RESULT CYITCPSecureSocket::Send ( const char *  pBuffer,
size_t  uLength 
)
overridevirtual

Sends a character buffer, pBuffer along with the buffer length, nLength, to the socket. Returns SOCKET_RESULT to indicate socket operation result.

Implements IYISocket.

virtual IYISocket::SOCKET_RESULT CYITCPSecureSocket::Send ( const char *  pBuffer,
size_t  uLength,
size_t uSent 
)
overridevirtual

Sends a character buffer, pBuffer along with the buffer length, nLength, to the socket. nSent is an output parameter representing the number of bytes that were successfully sent. Returns SOCKET_RESULT to indicate socket operation result.

Implements IYISocket.

virtual void CYITCPSecureSocket::SetConnectionTimeoutMs ( uint32_t  uTimeoutMs)
overridevirtual

Sets the length of time in milliseconds uTimeoutMs that the socket will wait for a connection before aborting the Connect() operation. The default timeout is set to 10 seconds (10000 ms).

Note
Socket timeouts are not supported on Tizen-NaCl. The timeout will not be applied on this platform.

Implements IYISocket.

virtual bool CYITCPSecureSocket::SetSocketBlockingEnabled ( bool  bBlocking)
overridevirtual

Utility method modifying the socket's internal flags base on bBlocking. When bBlocking is true, further calls to Send(), Receive(), Connect() and Accept() on the socket will block until a response is received. The default state when a socket is created is blocking. Returns true if the call succeeded.

Implements IYISocket.


The documentation for this class was generated from the following file: