| | |
| | | * 如果建立连接的节点没有接受到消息等待timeout的时间后返回 |
| | | * @timeout 等待时间,单位是千分之一秒 |
| | | */ |
| | | int net_mod_socket_sendandrecv_timout(void *_socket, net_node_t *node_arr, int arrlen, void *send_buf, int send_size, |
| | | net_mod_recv_msg_t ** recv_arr, int *recv_arr_size, int timeout){ |
| | | int net_mod_socket_sendandrecv_timeout(void *_socket, net_node_t *node_arr, int arrlen, void *send_buf, int send_size, |
| | | net_mod_recv_msg_t ** recv_arr, int *recv_arr_size, int timeout){ |
| | | net_mod_socket_t *sockt = (net_mod_socket_t *)_socket; |
| | | return sockt->sockt->sendandrecv_timout(node_arr, arrlen, send_buf, send_size, recv_arr, recv_arr_size, timeout); |
| | | return sockt->sockt->sendandrecv_timeout(node_arr, arrlen, send_buf, send_size, recv_arr, recv_arr_size, timeout); |
| | | } |
| | | |
| | | int net_mod_socket_sendandrecv_nowait(void *_socket, net_node_t *node_arr, int arrlen, void *send_buf, int send_size, |
| | |
| | | net_mod_socket_t *sockt = (net_mod_socket_t *)_socket; |
| | | return sockt->sockt->pub(node_arr, node_arr_len, topic, topic_size, content, content_size); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 启动bus |
| | | * |
| | | * @return 0 成功, 其他值 失败的错误码 |
| | | */ |
| | | int net_mod_socket_start_bus(void * _socket) { |
| | | int net_mod_socket_pub_timeout(void *_socket, net_node_t *node_arr, int node_arr_len, char *topic, int topic_size, void *content, int content_size, int msec){ |
| | | net_mod_socket_t *sockt = (net_mod_socket_t *)_socket; |
| | | return sockt->sockt->start_bus(); |
| | | return sockt->sockt->pub_timeout(node_arr, node_arr_len, topic, topic_size, content, content_size, msec); |
| | | } |
| | | int net_mod_socket_pub_nowait(void *_socket, net_node_t *node_arr, int node_arr_len, char *topic, int topic_size, void *content, int content_size){ |
| | | net_mod_socket_t *sockt = (net_mod_socket_t *)_socket; |
| | | return sockt->sockt->pub_nowait(node_arr, node_arr_len, topic, topic_size, content, content_size); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 订阅指定主题 |
| | |
| | | * @size 主题长度 |
| | | * @port 总线端口 |
| | | */ |
| | | int net_mod_socket_sub(void * _socket, void *topic, int size, int port) { |
| | | int net_mod_socket_sub(void * _socket, void *topic, int size) { |
| | | net_mod_socket_t *sockt = (net_mod_socket_t *)_socket; |
| | | return sockt->sockt->sub((char *)topic, size, port); |
| | | return sockt->sockt->sub((char *)topic, size, BUS_KEY); |
| | | } |
| | | // 超时返回。 @sec 秒 , @nsec 纳秒 |
| | | int net_mod_socket_sub_timeout(void * _socket, void *topic, int size, int port, int sec, int nsec){ |
| | | int net_mod_socket_sub_timeout(void * _socket, void *topic, int size, int sec, int nsec){ |
| | | net_mod_socket_t *sockt = (net_mod_socket_t *)_socket; |
| | | return sockt->sockt->sub_timeout((char *)topic, size, port, sec, nsec); |
| | | return sockt->sockt->sub_timeout((char *)topic, size, BUS_KEY, sec, nsec); |
| | | } |
| | | int net_mod_socket_sub_nowait(void * _socket, void *topic, int size, int port){ |
| | | int net_mod_socket_sub_nowait(void * _socket, void *topic, int size){ |
| | | net_mod_socket_t *sockt = (net_mod_socket_t *)_socket; |
| | | return sockt->sockt->sub_nowait((char *)topic, size, port); |
| | | return sockt->sockt->sub_nowait((char *)topic, size, BUS_KEY); |
| | | } |
| | | |
| | | |
| | |
| | | * @size 主题长度 |
| | | * @port 总线端口 |
| | | */ |
| | | int net_mod_socket_desub(void * _socket, void *topic, int size, int port) { |
| | | int net_mod_socket_desub(void * _socket, void *topic, int size) { |
| | | net_mod_socket_t *sockt = (net_mod_socket_t *)_socket; |
| | | return sockt->sockt->desub((char *)topic, size, port); |
| | | return sockt->sockt->desub((char *)topic, size, BUS_KEY); |
| | | } |
| | | // 超时返回。 @sec 秒 , @nsec 纳秒 |
| | | int net_mod_socket_desub_timeout(void * _socket, void *topic, int size, int port, int sec, int nsec) { |
| | | int net_mod_socket_desub_timeout(void * _socket, void *topic, int size, int sec, int nsec) { |
| | | net_mod_socket_t *sockt = (net_mod_socket_t *)_socket; |
| | | return sockt->sockt->desub_timeout((char *)topic, size, port, sec, nsec); |
| | | return sockt->sockt->desub_timeout((char *)topic, size, BUS_KEY, sec, nsec); |
| | | } |
| | | int net_mod_socket_desub_nowait(void * _socket, void *topic, int size, int port){ |
| | | int net_mod_socket_desub_nowait(void * _socket, void *topic, int size){ |
| | | net_mod_socket_t *sockt = (net_mod_socket_t *)_socket; |
| | | return sockt->sockt->desub_nowait((char *)topic, size, port); |
| | | return sockt->sockt->desub_nowait((char *)topic, size, BUS_KEY); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | return NetModSocket::free_recv_msg_arr(arr, len); |
| | | } |
| | | |
| | | |
| | | |
| | | int shm_mod_socket_remove_keys(int keys[], int length){ |
| | | return ShmModSocket::remove_keys(keys, length); |
| | | } |
| | | |
| | | int shm_mod_socket_remove_key(int key){ |
| | | int keys[] = {key}; |
| | | return ShmModSocket::remove_keys(keys, 1); |
| | | } |