** More...
Typedefs | |
typedef void * | mtls_t |
mxchip TLS handler type More... | |
Enumerations |
Functions | |
int32_t | MX_WIFI_TLS_set_ver (MX_WIFIObject_t *Obj, mtls_ver_t version) |
set the TLS protocol version. More... | |
int32_t | MX_WIFI_TLS_set_clientCertificate (MX_WIFIObject_t *Obj, uint8_t *client_cert, uint16_t cert_len) |
TLS set client certificate. More... | |
int32_t | MX_WIFI_TLS_set_clientPrivateKey (MX_WIFIObject_t *Obj, uint8_t *client_private_key, uint16_t key_len) |
TLS set client private key. More... | |
int32_t | MX_WIFI_TLS_connect (MX_WIFIObject_t *Obj, int32_t domain, int32_t type, int32_t protocol, const struct sockaddr *addr, int32_t addrlen, char *ca, int32_t calen) |
TLS client create a TLS connection. More... | |
int32_t | MX_WIFI_TLS_connect_sni (MX_WIFIObject_t *Obj, const char *sni_servername, int32_t sni_servername_len, const struct sockaddr *addr, int32_t addrlen, char *ca, int32_t calen) |
TLS client create a TLS connection with SNI. More... | |
int32_t | MX_WIFI_TLS_send (MX_WIFIObject_t *Obj, mtls_t tls, void *data, int32_t len) |
TLS send data. More... | |
int32_t | MX_WIFI_TLS_recv (MX_WIFIObject_t *Obj, mtls_t tls, void *buf, int32_t len) |
TLS redeive data. More... | |
int32_t | MX_WIFI_TLS_close (MX_WIFIObject_t *Obj, mtls_t tls) |
Close the TLS session, release resource. More... | |
int32_t | MX_WIFI_TLS_set_nonblock (MX_WIFIObject_t *Obj, mtls_t tls, int32_t nonblock) |
Set TLS nonblock mode. More... | |
**
TLS related API **
anonymous enum |
int32_t MX_WIFI_TLS_close | ( | MX_WIFIObject_t * | Obj, |
mtls_t | tls | ||
) |
Close the TLS session, release resource.
Obj | pointer to module handle |
tls | Point to the TLS context. |
Operation | Status. |
int32_t MX_WIFI_TLS_connect | ( | MX_WIFIObject_t * | Obj, |
int32_t | domain, | ||
int32_t | type, | ||
int32_t | protocol, | ||
const struct sockaddr * | addr, | ||
int32_t | addrlen, | ||
char * | ca, | ||
int32_t | calen | ||
) |
TLS client create a TLS connection.
Obj | pointer to module handle |
This function is called on the client side and initiates an TLS/TLS handshake with a server. When this function is called, the underlying communication channel has already been set up. This function is called after TCP 3-way handshak finished.
domain | Specifies a communication domain |
type | Specifies the communication semantics. |
protocol | specifies a particular protocol to be used with the socket. |
addr | Point to the target address to be connected |
addrlen | containing the size of the buffer pointed to by addr |
ca | pointer to the CA certificate string, used to verify server's certificate. |
calen | the string length of ca. 0=do not verify server's certificate. |
return | the TLS context pointer on success or NULL for fail. |
int32_t MX_WIFI_TLS_connect_sni | ( | MX_WIFIObject_t * | Obj, |
const char * | sni_servername, | ||
int32_t | sni_servername_len, | ||
const struct sockaddr * | addr, | ||
int32_t | addrlen, | ||
char * | ca, | ||
int32_t | calen | ||
) |
TLS client create a TLS connection with SNI.
Obj | pointer to module handle |
This function is called on the client side and initiates an TLS/TLS handshake with a server. When this function is called, the underlying communication channel has already been set up. This function is called after TCP 3-way handshak finished.
sni_servername | Specifies the SNI servername |
sni_servername_len | Specifies the SNI servername length, max size MX_TLS_SNI_SERVERNAME_SIZE |
addr | Point to the target address to be connected |
addrlen | containing the size of the buffer pointed to by addr |
ca | pointer to the CA certificate string, used to verify server's certificate. |
calen | the string length of ca. 0=do not verify server's certificate. |
return | the TLS context pointer on success or NULL for fail. |
int32_t MX_WIFI_TLS_recv | ( | MX_WIFIObject_t * | Obj, |
mtls_t | tls, | ||
void * | buf, | ||
int32_t | len | ||
) |
TLS redeive data.
Obj | pointer to module handle |
tls | Point to the TLS context. |
data | Point to buffer to receive TLS data. |
len | max receive buffer length. |
On | success, return the number of bytes received. On error, error code (< 0) is returned. |
int32_t MX_WIFI_TLS_send | ( | MX_WIFIObject_t * | Obj, |
mtls_t | tls, | ||
void * | data, | ||
int32_t | len | ||
) |
TLS send data.
Obj | pointer to module handle |
tls | Point to the TLS context. |
data | Point to data to send. |
len | data length. |
On | success, return the number of bytes sent. On error, error code (< 0) is returned. |
int32_t MX_WIFI_TLS_set_clientCertificate | ( | MX_WIFIObject_t * | Obj, |
uint8_t * | client_cert, | ||
uint16_t | cert_len | ||
) |
TLS set client certificate.
Obj | pointer to module handle |
client_cert | Point to buffer of client cert. |
cert_len | length of the client cert. |
Operation | Status. |
int32_t MX_WIFI_TLS_set_clientPrivateKey | ( | MX_WIFIObject_t * | Obj, |
uint8_t * | client_private_key, | ||
uint16_t | key_len | ||
) |
TLS set client private key.
Obj | pointer to module handle |
client_private_key | Point to buffer of client private key. |
key_len | length of the client cert. |
Operation | Status. |
int32_t MX_WIFI_TLS_set_nonblock | ( | MX_WIFIObject_t * | Obj, |
mtls_t | tls, | ||
int32_t | nonblock | ||
) |
Set TLS nonblock mode.
Obj | pointer to module handle |
tls | Point to the TLS context. |
nonblock | true - nonblock, flase - block |
Operation | Status. |
int32_t MX_WIFI_TLS_set_ver | ( | MX_WIFIObject_t * | Obj, |
mtls_ver_t | version | ||
) |
set the TLS protocol version.
Obj | pointer to module handle |
version | TLS protocol version |
Operation | Status. |