wangzhengquan
2020-09-25 00dba6082e245d917cb7d6eed3c627211ff41cd7
src/socket/dgram_mod_socket.c
@@ -6,6 +6,15 @@
  
} dgram_mod_socket_t;
int dgram_mod_remove_keys(int keys[], int length){
   return DModSocket::remove_keys(keys, length);
}
int dgram_mod_remove_key(int key){
   int keys[] = {key};
   return DModSocket::remove_keys(keys, 1);
}
/**
 * 创建socket
 * @return socket地址
@@ -128,17 +137,40 @@
 */
int  dgram_mod_sub(void * _socket, void *topic, int size, int port){
   dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
   return socket->m_socket->sub(topic,  size,  port);
   return socket->m_socket->sub((char *)topic,  size,  port);
}
// 超时返回。 @sec 秒 , @nsec 纳秒
int  dgram_mod_sub_timeout(void * _socket, void *topic, int size, int port, int sec, int nsec){
   dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
   struct timespec timeout = {sec, nsec};
   return socket->m_socket->sub_timeout(topic,  size,  port, &timeout);
   return socket->m_socket->sub_timeout((char *)topic,  size,  port, &timeout);
}
int  dgram_mod_sub_nowait(void * _socket, void *topic, int size, int port){
   dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
   return socket->m_socket->sub_nowait(topic,  size,  port);
   return socket->m_socket->sub_nowait((char *)topic,  size,  port);
}
/**
 * 取消订阅指定主题
 * @topic 主题
 * @size 主题长度
 * @port 总线端口
 */
int  dgram_mod_desub(void * _socket, void *topic, int size, int port){
   dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
   return socket->m_socket->desub((char *)topic,  size,  port);
}
// 超时返回。 @sec 秒 , @nsec 纳秒
int  dgram_mod_desub_timeout(void * _socket, void *topic, int size, int port, int sec, int nsec){
   dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
   struct timespec timeout = {sec, nsec};
   return socket->m_socket->desub_timeout((char *)topic,  size,  port, &timeout);
}
int  dgram_mod_desub_nowait(void * _socket, void *topic, int size, int port){
   dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
   return socket->m_socket->desub_nowait((char *)topic,  size,  port);
}
@@ -151,17 +183,17 @@
 */
int  dgram_mod_pub(void * _socket, void *topic, int topic_size, void *content, int content_size, int port){
   dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
   return socket->m_socket->pub(topic, topic_size, content, content_size, port);
   return socket->m_socket->pub((char *)topic, topic_size, content, content_size, port);
}
//  超时返回。 @sec 秒 , @nsec 纳秒
int  dgram_mod_pub_timeout(void * _socket, void *topic, int topic_size, void *content, int content_size, int port, int sec, int nsec){
   dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
   struct timespec timeout = {sec, nsec};
   return socket->m_socket->pub_timeout(topic, topic_size, content, content_size, port, &timeout);
   return socket->m_socket->pub_timeout((char *)topic, topic_size, content, content_size, port, &timeout);
}
int  dgram_mod_pub_nowait(void * _socket, void *topic, int topic_size, void *content, int content_size, int port){
   dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
   return socket->m_socket->pub_nowait(topic, topic_size, content, content_size, port);
   return socket->m_socket->pub_nowait((char *)topic, topic_size, content, content_size, port);
}