Michael Ansolis / TLS_cyassl

Dependencies:   cyassl-lib

Fork of TLS_cyassl by Francois Berder

Embed: (wiki syntax)

« Back to documentation index

TLSConnection Class Reference

TLSConnection Class Reference

This class provides a user-friendly interface for the axTLS library. More...

#include <TLSConnection.h>

Public Member Functions

bool connect (const char *host)
 This function tries to establish a TLS connection with the given host.
bool is_connected (void)
 Indicates whether a connection is established or not.
int send_all (char *data, int length)
 Sends some data to the host.
int receive (char *data, int length)
 Receive some data from the host.
bool close (bool shutdown=true)
 Close the connection.

Detailed Description

This class provides a user-friendly interface for the axTLS library.

Definition at line 14 of file TLSConnection.h.


Member Function Documentation

bool close ( bool  shutdown = true )

Close the connection.

Parameters:
shutdown
Returns:
True if the connection was closed with success, false otherwise. If no connection was established, returns true immediately.

Definition at line 116 of file TLSConnection.cpp.

bool connect ( const char *  host )

This function tries to establish a TLS connection with the given host.

It will first try to establish a TCP connection on port 443 with the host. Then, it runs the TLS handshake protocol.

Parameters:
hostA valid hostname (e.g. "mbed.org")
Returns:
True if it managed to establish a connection with the host. False otherwise.

Definition at line 45 of file TLSConnection.cpp.

bool is_connected ( void   )

Indicates whether a connection is established or not.

Returns:
true if a connection is established, otherwise returns false.

Definition at line 95 of file TLSConnection.cpp.

int receive ( char *  data,
int  length 
)

Receive some data from the host.

Parameters:
data
lengthMaximum number of bytes to receive
Returns:
Number of bytes read in range 0..length, or -1 if an error occured.

Definition at line 108 of file TLSConnection.cpp.

int send_all ( char *  data,
int  length 
)

Sends some data to the host.

This method does not return until length bytes have been sent.

Parameters:
dataA pointer to some data
lengthNumber of bytes to send
Returns:
Number of bytes sent, or -1 if an error occured.

Definition at line 100 of file TLSConnection.cpp.