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_wrapper.h Source File

baidu_ca_trans_wrapper.h

00001 // Copyright 2017 Baidu Inc. All Rights Reserved.
00002 // Author: Su Hao (suhao@baidu.com)
00003 //
00004 // Description: The wrapper for user's transport.
00005 
00006 #ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_WRAPPER_H
00007 #define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_WRAPPER_H
00008 
00009 #include "baidu_ca_transport.h"
00010 
00011 /*
00012  * Create the socket context.
00013  *
00014  * @Param hdlr, in, the context for the transport
00015  * @Return bca_status_t, the operation result
00016  */
00017 BCA_INT bca_status_t bca_trans_wrapper_create(bca_trans_ptr trans);
00018 
00019 /*
00020  * Connect to the host.
00021  *
00022  * @Param hdlr, in, the context for the transport
00023  * @Param addr, in, the target address infomations
00024  * @Return bca_status_t, the operation result
00025  */
00026 BCA_INT bca_status_t bca_trans_wrapper_connect(bca_trans_ptr trans,
00027                                                const bca_addr_t* addr);
00028 
00029 /*
00030  * Send data.
00031  *
00032  * @Param hdlr, in, the context for the transport
00033  * @Param data, in, the data will be sent
00034  * @Param size, in, the data size
00035  * @Param addr, in, the target address infomations
00036  * @Return bca_status_t, the operation result
00037  */
00038 BCA_INT bca_status_t bca_trans_wrapper_send(bca_trans_ptr trans,
00039                                             const void* data,
00040                                             bca_size_t size,
00041                                             const bca_addr_t* addr);
00042 
00043 /*
00044  * Receive data.
00045  *
00046  * @Param hdlr, in, the context for the transport
00047  * @Param data, out, the data will be read
00048  * @Param size, in, the data size
00049  * @Param addr, out, the target address infomations
00050  * @Return bca_status_t, the operation result
00051  */
00052 BCA_INT bca_status_t bca_trans_wrapper_recv(bca_trans_ptr trans,
00053                                             void* data,
00054                                             bca_size_t size,
00055                                             bca_addr_t* addr);
00056 
00057 /*
00058  * Receive data.
00059  *
00060  * @Param hdlr, in, the context for the transport
00061  * @Param data, out, the data will be read
00062  * @Param size, in, the data size
00063  * @Param timeout, in, the receive timeout
00064  * @Param addr, out, the target address infomations
00065  * @Return bca_status_t, the operation result
00066  */
00067 BCA_INT bca_status_t bca_trans_wrapper_recv_timeout(bca_trans_ptr trans,
00068                                                     void* data,
00069                                                     bca_size_t size,
00070                                                     bca_u32_t timeout,
00071                                                     bca_addr_t* addr);
00072 
00073 /*
00074  * Disconnect from the remote host.
00075  *
00076  * @Param hdlr, in, the context for the transport
00077  * @Return bca_status_t, the operation result
00078  */
00079 BCA_INT bca_status_t bca_trans_wrapper_close(bca_trans_ptr trans);
00080 
00081 /*
00082  * Destroy the socket context.
00083  *
00084  * @Param hdlr, in, the context for the transport
00085  * @Return bca_status_t, the operation result
00086  */
00087 BCA_INT bca_status_t bca_trans_wrapper_destroy(bca_trans_ptr trans);
00088 
00089 #endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_WRAPPER_H