Sdk secure socket api documentation

Secure socket functions.

Namespace: dmSSLSocket
Include: #include <dmsdk/dlib/sslsocket.h>
TYPES
Socket Socket type definition
CONSTANTS
dmSSLSocket::INVALID_SOCKET_HANDLE SSLSocket socket handle
ENUMS
dmSSLSocket::Result result enumeration
FUNCTIONS
 dmSocket::SetReceiveTimeout(dmSocket::Socket socket, uint64_t timeout) Set socket receive timeout
 dmSSLSocket::Delete(dmSSLSocket::Socket socket) delete a secure socket
 dmSSLSocket::New(dmSocket::Socket socket, const char* host, uint64_t timeout, dmSSLSocket::Socket* sslsocket) create a secure socket
 dmSSLSocket::Receive(dmSSLSocket::Socket socket,  buffer,  length,  received_bytes) receive data on a secure socket
 dmSSLSocket::Send(dmSSLSocket::Socket socket,  buffer,  length,  sent_bytes) send a message on a secure socket

Functions

dmSocket::SetReceiveTimeout

 dmSocket::SetReceiveTimeout(dmSocket::Socket socket, uint64_t timeout)

Set socket receive timeout

PARAMETERS

dmSocket::Socket socket socket
uint64_t timeout timeout in microseconds

RETURNS

on success

dmSSLSocket::Delete

 dmSSLSocket::Delete(dmSSLSocket::Socket socket)

Delete a secure socket. Does not close the underlying socket

PARAMETERS

dmSSLSocket::Socket socket Secure socket to close

RETURNS

on success

EXAMPLES

dmSSLSocket::Delete(sslsocket);

dmSSLSocket::New

 dmSSLSocket::New(dmSocket::Socket socket, const char* host, uint64_t timeout, dmSSLSocket::Socket* sslsocket)

Create a new secure socket

PARAMETERS

dmSocket::Socket socket The socket to wrap
const char* host The name of the host (e.g. "httpbin.org")
uint64_t timeout The timeout for the handshake procedure. (microseconds)
dmSSLSocket::Socket* sslsocket Pointer to a secure socket

RETURNS

on succcess

EXAMPLES

dmSSLSocket::Result result;
dmSSLSocket::Socket sslsocket;
result = dmSSLSocket::New(socket, "httpbin.org", 500*1000, &sslsocket);
if (dmSSLSocket::RESULT_OK == result)
{
    // ...
} else {
    // ...
}

dmSSLSocket::Receive

 dmSSLSocket::Receive(dmSSLSocket::Socket socket,  buffer,  length,  received_bytes)

Receive data on a secure socket

PARAMETERS

dmSSLSocket::Socket socket Socket to receive data on
buffer Buffer to receive to
length Receive buffer length
received_bytes Number of received bytes (result)

RETURNS

on success

dmSSLSocket::Send

 dmSSLSocket::Send(dmSSLSocket::Socket socket,  buffer,  length,  sent_bytes)

Send a message on a secure socket

PARAMETERS

dmSSLSocket::Socket socket SSL socket to send a message on
buffer Buffer to send
length Length of buffer to send
sent_bytes Number of bytes sent (result)

RETURNS

on success

Constants

dmSSLSocket::INVALID_SOCKET_HANDLE

SSLSocket socket handle


Types

Socket

Socket type definition


Enums

dmSSLSocket::Result

Result enumeration.

dmSSLSocket::RESULT_OK (0)
dmSSLSocket::RESULT_SSL_INIT_FAILED (-2000)
dmSSLSocket::RESULT_HANDSHAKE_FAILED (-2001)
dmSSLSocket::RESULT_WOULDBLOCK (-2002)
dmSSLSocket::RESULT_CONNREFUSED (-2003)