ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers baidu_ca_trans_encrypted.h Source File

baidu_ca_trans_encrypted.h

00001 // Copyright 2017 Baidu Inc. All Rights Reserved.
00002 // Author: Su Hao (suhao@baidu.com)
00003 //
00004 // Description: Define the encrypted networks I/O.
00005 
00006 #ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_ENCRYPTED_H
00007 #define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_ENCRYPTED_H
00008 
00009 #include "baidu_ca_transport.h"
00010 
00011 /*
00012  * Connect to the host.
00013  *
00014  * @Param hdlr, in, the context for the transport
00015  * @Param addr, in, the target address infomations
00016  * @Return bca_status_t, the operation result
00017  */
00018 BCA_INT bca_status_t bca_trans_encrypted_connect(bca_trans_ptr trans,
00019                                                  const bca_addr_t* addr);
00020 
00021 /*
00022  * Send data.
00023  *
00024  * @Param hdlr, in, the context for the transport
00025  * @Param data, in, the data will be sent
00026  * @Param size, in, the data size
00027  * @Param addr, in, the target address infomations
00028  * @Return bca_status_t, the operation result
00029  */
00030 BCA_INT bca_status_t bca_trans_encrypted_send(bca_trans_ptr trans,
00031                                               const void* data,
00032                                               bca_size_t size,
00033                                               const bca_addr_t* addr);
00034 
00035 /*
00036  * Set the timeout for receiving data.
00037  *
00038  * @Param hdlr, in, the context for the transport
00039  * @Param timeout, in, the recv data timeout interval
00040  * @Return bca_status_t, the operation result
00041  */
00042 BCA_INT bca_status_t bca_trans_encrypted_set_read_timeout(bca_trans_ptr trans,
00043                                                           bca_u32_t timeout);
00044 
00045 /*
00046  * Receive data.
00047  *
00048  * @Param hdlr, in, the context for the transport
00049  * @Param data, out, the data will be read
00050  * @Param size, in, the data size
00051  * @Param addr, out, the target address infomations
00052  * @Return bca_status_t, the operation result
00053  */
00054 BCA_INT bca_status_t bca_trans_encrypted_recv(bca_trans_ptr trans,
00055                                               void* data,
00056                                               bca_size_t size,
00057                                               bca_addr_t* addr);
00058 
00059 /*
00060  * Disconnect from the remote host.
00061  *
00062  * @Param hdlr, in, the context for the transport
00063  * @Return bca_status_t, the operation result
00064  */
00065 BCA_INT bca_status_t bca_trans_encrypted_close(bca_trans_ptr trans);
00066 
00067 #endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_ENCRYPTED_H