wangzhengquan
2020-10-14 09fdbecd7ce09d9988adcd079e886a21941666bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef __NET_MOD_SOCKET_H__
#define __NET_MOD_SOCKET_H__
 
#include "net_mod_socket.h"
 
#ifdef __cplusplus
extern "C" {
#endif
 
struct net_mod_socket_t
{
    NetModSocket *sockt;
};
 
/**
 * 创建
 */
void * net_mod_socket_open();
 
/**
 * 关闭
 */
void net_mod_socket_close(void *_sockt);
 
/**
 * 向node_arr 中的所有网络节点发送请求消息,节点的返回信息汇总并存储在recv_arr中
 * @node_arr 网络节点组, @node_arr_len该数组长度
 * @send_buf 发送的消息,@send_size 该消息体的长度
 * @recv_arr 返回的应答消息组,@recv_arr_size 该数组长度
 * @return 成功发送的节点的个数
 */
int net_mod_socket_sendandrecv(void *_sockt, net_node_t *node_arr, int node_arr_len, void *send_buf, int send_size, 
    net_mod_recv_msg_t ** recv_arr, int *recv_arr_size);
 
/**
 * 销毁sendandrecv方法返回的消息组 
 * @arr 消息组
 * @size 消息组的长度
 */
void  net_mod_socket_free_recv_msg_arr(net_mod_recv_msg_t * arr, int size);
 
 /**
 * 向node_arr 中的所有网络节点发布消息
 * @node_arr 网络节点组, @node_arr_len该数组长度
 * @topic 主题,@topic_size 该主题的长度
 * @content 内容,@content_size 内容长度
 * @return 成功发布的节点的个数
 */
int net_mod_socket_pub(void *_sockt, net_node_t *node_arr, int node_arr_len, char *topic, int topic_size, void *content, int content_size);
 
 
#ifdef __cplusplus
}
#endif
 
#endif