Mistake on this page? Email us
M2MConnectionSecurity Class Reference

Public Types

enum  SecurityMode { NO_SECURITY = 0, TLS, DTLS }
 

Public Member Functions

 M2MConnectionSecurity (SecurityMode mode)
 Default Constructor.
 
 ~M2MConnectionSecurity ()
 Default Destructor.
 
void reset ()
 Resets the socket connection states.
 
int init (const M2MSecurity *security, uint16_t security_instance_id)
 Initiatlizes the socket connection states.
 
int start_connecting_non_blocking (M2MConnectionHandler *connHandler)
 Starts the connection in non-blocking mode. More...
 
int continue_connecting ()
 Continues connectivity logic for a secure connection. More...
 
int connect (M2MConnectionHandler *connHandler)
 Connects the client to the server. More...
 
int send_message (unsigned char *message, int len)
 Sends data to the server. More...
 
int read (unsigned char *buffer, uint16_t len)
 Reads the data received from the server. More...
 
void set_random_number_callback (random_number_cb callback)
 Sets the function callback that is called by mbed Client to fetch a random number from an application to ensure strong entropy. More...
 
void set_entropy_callback (entropy_cb callback)
 Sets the function callback that is called by mbed Client to provide an entropy source from an application to ensure strong entropy. More...
 
void set_socket (void *socket, void *address)
 Set socket information for this secure connection. More...
 
int set_dtls_socket_callback (void(*foo)(void *), void *argument)
 Set socket information for this secure connection. More...
 

Friends

class Test_M2MConnectionSecurity
 

Member Function Documentation

int M2MConnectionSecurity::connect ( M2MConnectionHandler connHandler)

Connects the client to the server.

Parameters
connHandlerThe ConnectionHandler object that maintains the socket.
Returns
Returns the state of the connection. Successful or not.
int M2MConnectionSecurity::continue_connecting ( )

Continues connectivity logic for a secure connection.

Returns
Returns an error code if any while continuing the connection sequence.
int M2MConnectionSecurity::read ( unsigned char *  buffer,
uint16_t  len 
)

Reads the data received from the server.

Parameters
messageThe data to be read.
lenThe length of the data.
Returns
Indicates whether the data is read successfully or not.
int M2MConnectionSecurity::send_message ( unsigned char *  message,
int  len 
)

Sends data to the server.

Parameters
messageThe data to be sent.
lenThe length of the data.
Returns
Indicates whether the data is sent successfully or not.
int M2MConnectionSecurity::set_dtls_socket_callback ( void(*)(void *)  foo,
void *  argument 
)

Set socket information for this secure connection.

Parameters
socketSocket used with this TLS session.
addressPointer to the address of the server.
Returns
Indicates whether the data is read successfully or not.
void M2MConnectionSecurity::set_entropy_callback ( entropy_cb  callback)

Sets the function callback that is called by mbed Client to provide an entropy source from an application to ensure strong entropy.

Parameters
entropy_callbackA function pointer that is called by mbed-client while performing a secure handshake. Function signature, if using mbed-client-mbedtls, should be int (*mbedtls_entropy_f_source_ptr)(void *data, unsigned char *output, size_t len, size_t *olen);
void M2MConnectionSecurity::set_random_number_callback ( random_number_cb  callback)

Sets the function callback that is called by mbed Client to fetch a random number from an application to ensure strong entropy.

Parameters
random_callbackA function pointer that is called by mbed Client while performing a secure handshake. The function signature should be uint32_t (*random_number_callback)(void);
void M2MConnectionSecurity::set_socket ( void *  socket,
void *  address 
)

Set socket information for this secure connection.

Parameters
socketSocket used with this TLS session.
addressPointer to the address of the server.
Returns
Indicates whether the data is read successfully or not.
int M2MConnectionSecurity::start_connecting_non_blocking ( M2MConnectionHandler connHandler)

Starts the connection in non-blocking mode.

Parameters
connHandlerThe ConnectionHandler object that maintains the socket.
Returns
Returns the state of the connection. Successful or not.

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