zhangmeng
2020-07-28 b70473ad3084fe968bbfaa50eb54cc248b79e02a
libcsoftbus_func.h
@@ -146,6 +146,72 @@
 */
typedef int(*tfn_socket_port) (void*);
//////////////////////////////////////////////
// dgram socket
/**
 * 创建socket
 * @return socket地址
*/
typedef void*(*tfn_dgram_socket_open) ();
/**
 * 关闭socket
 * @return 0 成功, 其他值 失败的错误码
*/
typedef int(*tfn_dgram_socket_close) (void*);
/**
 * 绑定端口到socket, 如果不绑定则系统自动分配一个
 * @return 0 成功, 其他值 失败的错误码
*/
typedef int(*tfn_dgram_socket_bind) (void*, int);
typedef tfn_dgram_socket_bind tfn_dgram_socket_force_bind;
/**
 * 发送信息
 * @port 发送给谁
 * @return 0 成功, 其他值 失败的错误码
 */
typedef int(*tfn_dgram_socket_sendto) (void*, const void*, const int, const int);
/**
 * 接收信息
 * @port 从谁哪里收到的信息
 * @return 0 成功, 其他值 失败的错误码
*/
typedef int(*tfn_dgram_socket_recvfrom) (void*, void**, int*, int*);
/**
 * 发送请求信息并等待接收应答
 * @port 发送给谁
 * @return 0 成功, 其他值 失败的错误码
*/
typedef int(*tfn_dgram_socket_sendandrecv) (void*, const void*, const int, const int, void**, int*);
/**
 * 启动bus
 *
 * @return 0 成功, 其他值 失败的错误码
*/
typedef int(*tfn_dgram_socket_start_bus) (void*);
/**
 * 订阅指定主题
 * @topic 主题
 * @size 主题长度
 * @port 总线端口
 */
typedef int(*tfn_dgram_socket_sub) (void*, void*, int, int);
/**
 * 发布主题
 * @topic 主题
 * @content 主题内容
 * @port 总线端口
 */
typedef int(*tfn_dgram_socket_pub) (void*, void*, int, void*, int, int);
/**
 * 获取soket端口号
 */
typedef int(*tfn_dgram_socket_port) (void*);
/**
 * 释放存储接收信息的buf
 */
typedef void(*tfn_dgram_socket_free) (void*);
#ifdef __cplusplus
}
#endif