|
Google Cloud IoT device SDK for embedded C
1.0.2
|
Go to the source code of this file.
Data Structures | |
| struct | iotc_bsp_tls_init_params_s |
Typedefs | |
| typedef enum iotc_bsp_tls_state_e | iotc_bsp_tls_state_t |
| typedef struct iotc_bsp_tls_init_params_s | iotc_bsp_tls_init_params_t |
| typedef void | iotc_bsp_tls_context_t |
Enumerations | |
| enum | iotc_bsp_tls_state_e { IOTC_BSP_TLS_STATE_OK = 0, IOTC_BSP_TLS_STATE_INIT_ERROR = 1, IOTC_BSP_TLS_STATE_CERT_ERROR = 2, IOTC_BSP_TLS_STATE_CONNECT_ERROR = 3, IOTC_BSP_TLS_STATE_WANT_READ = 4, IOTC_BSP_TLS_STATE_WANT_WRITE = 5, IOTC_BSP_TLS_STATE_READ_ERROR = 6, IOTC_BSP_TLS_STATE_WRITE_ERROR = 7 } |
Functions | |
| iotc_bsp_tls_state_t | iotc_bsp_tls_init (iotc_bsp_tls_context_t **tls_context, iotc_bsp_tls_init_params_t *init_params) |
| iotc_bsp_tls_state_t | iotc_bsp_tls_cleanup (iotc_bsp_tls_context_t **tls_context) |
| iotc_bsp_tls_state_t | iotc_bsp_tls_connect (iotc_bsp_tls_context_t *tls_context) |
| iotc_bsp_tls_state_t | iotc_bsp_tls_read (iotc_bsp_tls_context_t *tls_context, uint8_t *data_ptr, size_t data_size, int *bytes_read) |
| int | iotc_bsp_tls_pending (iotc_bsp_tls_context_t *tls_context) |
| iotc_bsp_tls_state_t | iotc_bsp_tls_write (iotc_bsp_tls_context_t *tls_context, uint8_t *data_ptr, size_t data_size, int *bytes_written) |
| iotc_bsp_tls_state_t | iotc_bsp_tls_recv_callback (char *buf, int sz, void *context, int *bytes_sent) |
| iotc_bsp_tls_state_t | iotc_bsp_tls_send_callback (char *buf, int sz, void *context, int *bytes_sent) |
Implements Transport Layer Security (TLS).
All TLS functions are non-blocking.
Definition in file iotc_bsp_tls.h.
The TLS context.
Definition at line 96 of file iotc_bsp_tls.h.
The TLS context parameters.
| typedef enum iotc_bsp_tls_state_e iotc_bsp_tls_state_t |
| enum iotc_bsp_tls_state_e |
Definition at line 36 of file iotc_bsp_tls.h.
| iotc_bsp_tls_state_t iotc_bsp_tls_cleanup | ( | iotc_bsp_tls_context_t ** | tls_context | ) |
Frees a TLS context from memory and deletes any associated data.
| [out] | tls_context | A pointer to the TLS context. |
| IOTC_BSP_TLS_STATE_OK | TLS context successfully freed. |
| iotc_bsp_tls_state_t iotc_bsp_tls_connect | ( | iotc_bsp_tls_context_t * | tls_context | ) |
Starts a TLS handshake.
| [out] | tls_context | A pointer to the TLS context. |
| iotc_bsp_tls_state_t iotc_bsp_tls_init | ( | iotc_bsp_tls_context_t ** | tls_context, |
| iotc_bsp_tls_init_params_t * | init_params | ||
| ) |
Initializes a TLS library and creates a TLS context.
The SDK calls the function and then deletes init_params, so store persistant data outside the function scope.
| [out] | tls_context | A pointer to the TLS context. |
| [in] | init_params | The TLS context parameters. |
| int iotc_bsp_tls_pending | ( | iotc_bsp_tls_context_t * | tls_context | ) |
Gets the pending readable bytes.
| [out] | tls_context | A pointer to the TLS context. |
| iotc_bsp_tls_state_t iotc_bsp_tls_read | ( | iotc_bsp_tls_context_t * | tls_context, |
| uint8_t * | data_ptr, | ||
| size_t | data_size, | ||
| int * | bytes_read | ||
| ) |
Reads data on a socket.
| [out] | tls_context | A pointer to the TLS context. |
| [in] | data_ptr | A pointer to a buffer to store data that is read. |
| [in] | data_size | The size, in bytes, of the buffer to which data_ptr points. |
| [out] | bytes_read | The number of bytes read. |
| iotc_bsp_tls_state_t iotc_bsp_tls_recv_callback | ( | char * | buf, |
| int | sz, | ||
| void * | context, | ||
| int * | bytes_sent | ||
| ) |
Notifies the client application to read data on a socket. Implemented in the SDK; don't modify this function.
| iotc_bsp_tls_state_t iotc_bsp_tls_send_callback | ( | char * | buf, |
| int | sz, | ||
| void * | context, | ||
| int * | bytes_sent | ||
| ) |
Notifies the client application to write data to a socket. Implemented in the SDK; don't modify this function.
| iotc_bsp_tls_state_t iotc_bsp_tls_write | ( | iotc_bsp_tls_context_t * | tls_context, |
| uint8_t * | data_ptr, | ||
| size_t | data_size, | ||
| int * | bytes_written | ||
| ) |
Write data to a socket.
| [out] | tls_context | A pointer to the TLS context. |
| [in] | data_ptr | A pointer to a buffer with the data to be sent. |
| [in] | data_size | The size, in bytes, of the buffer to which data_ptr |
| [out] | bytes_written | The number of bytes written. |