ARM Shanghai IoT Team (Internal) / newMiniTLS-GPL

Fork of MiniTLS-GPL by Donatien Garnier

Embed: (wiki syntax)

« Back to documentation index

TLSSocket Class Reference

TLSSocket Class Reference

TLS Socket. More...

#include <TLSSocket.h>

Public Member Functions

 TLSSocket (MiniTLS *pMiniTLS)
 Instantiate a TLS socket.
minitls_err_t init ()
 Initialize socket.
minitls_err_t connect (const char *hostname, uint16_t port, int timeout)
 Connect to server.
minitls_err_t read (uint8_t *buf, size_t minLength, size_t maxLength, size_t *readLength, int timeout)
 Read data from server.
minitls_err_t write (uint8_t *buf, size_t length, size_t *writtenLength, int timeout)
 Write data to server.
minitls_err_t flush (int timeout)
 Call to ensure transmission of bytes written using write.
minitls_err_t close ()
 Tear down TLS connection and close socket.

Detailed Description

TLS Socket.

Parameters:
pMiniTLSpointer to MiniTLS instance

Definition at line 41 of file TLSSocket.h.


Constructor & Destructor Documentation

TLSSocket ( MiniTLS pMiniTLS )

Instantiate a TLS socket.

Definition at line 40 of file TLSSocket.cpp.


Member Function Documentation

minitls_err_t close (  )

Tear down TLS connection and close socket.

Returns:
MINITLS_OK on success, MINITLS_ERR_* error code otherwise

Definition at line 183 of file TLSSocket.cpp.

minitls_err_t connect ( const char *  hostname,
uint16_t  port,
int  timeout 
)

Connect to server.

Parameters:
hostnameserver to connect to
portport to connect to
timeouttimeout in ms
Returns:
MINITLS_OK on success, MINITLS_ERR_* error code otherwise

Definition at line 71 of file TLSSocket.cpp.

minitls_err_t flush ( int  timeout )

Call to ensure transmission of bytes written using write.

Parameters:
timeouttimeout in ms
Returns:
MINITLS_OK on success, MINITLS_ERR_* error code otherwise

Definition at line 170 of file TLSSocket.cpp.

minitls_err_t init (  )

Initialize socket.

Returns:
MINITLS_OK on success, MINITLS_ERR_* error code otherwise

Definition at line 53 of file TLSSocket.cpp.

minitls_err_t read ( uint8_t *  buf,
size_t  minLength,
size_t  maxLength,
size_t *  readLength,
int  timeout 
)

Read data from server.

Parameters:
bufbuffer to read bytes to
minLengthminimum number of bytes to read (will block before this number of bytes are read)
maxLengthmaximum number of bytes to read
readLengthwill receive actual number of bytes read
timeouttimeout in ms
Returns:
MINITLS_OK on success, MINITLS_ERR_* error code otherwise

Definition at line 89 of file TLSSocket.cpp.

minitls_err_t write ( uint8_t *  buf,
size_t  length,
size_t *  writtenLength,
int  timeout 
)

Write data to server.

Parameters:
bufbuffer to write bytes from
lengthnumber of bytes to write
writtenLengthwill receive actual number of bytes written
timeouttimeout in ms
Returns:
MINITLS_OK on success, MINITLS_ERR_* error code otherwise

Definition at line 131 of file TLSSocket.cpp.