| | |
| | | gNetmod_socket = net_mod_socket_open(); |
| | | hashtable_t *hashtable = mm_get_hashtable(); |
| | | key = hashtable_alloc_key(hashtable); |
| | | count = hashtable_alloc_key(hashtable); |
| | | rv = hashtable_alloc_key(hashtable); |
| | | net_mod_socket_int_set(gNetmod_socket, count); |
| | | net_mod_socket_svr_set(gNetmod_socket, rv); |
| | | sprintf(pData.int_info, "%d", count); |
| | | sprintf(pData.svr_info, "%d", rv); |
| | | net_mod_socket_bind(gNetmod_socket, key); |
| | | |
| | | rv = net_mod_socket_reg(gNetmod_socket, &pData, sizeof(ProcInfo), NULL, 0, timeout_ms, PROC_REG); |
| | |
| | | ::bhome_msg::MsgCommonReply mcr; |
| | | mcr.mutable_errmsg()->set_errcode(::bhome_msg::ErrorCode(rv)); |
| | | mcr.mutable_errmsg()->set_errstring(errString); |
| | | *reply_len=mcr.ByteSizeLong(); |
| | | *reply=malloc(*reply_len); |
| | | *reply_len = mcr.ByteSizeLong(); |
| | | *reply = malloc(*reply_len); |
| | | mcr.SerializePartialToArray(*reply,*reply_len); |
| | | #endif |
| | | |
| | |
| | | int val; |
| | | int len; |
| | | int min; |
| | | int data; |
| | | int sec, nsec; |
| | | std::string MsgID; |
| | | int timeout_ms = 3000; |
| | |
| | | strncpy(topics_buf + strlen(buf_temp) + 1, _input1.data, strlen(_input1.data)); |
| | | #endif |
| | | |
| | | data = net_mod_socket_svr_get(gNetmod_socket); |
| | | if (timeout_ms > 0) { |
| | | |
| | | sec = timeout_ms / 1000; |
| | | nsec = (timeout_ms - sec * 1000) * 1000 * 1000; |
| | | |
| | | rv = net_mod_socket_sendto_timeout(gNetmod_socket, topics_buf, len, val, sec, nsec); |
| | | rv = net_mod_socket_sendto_timeout(gNetmod_socket, topics_buf, len, val, sec, nsec, SVR_STR, data); |
| | | |
| | | } else if (timeout_ms == 0) { |
| | | |
| | | rv = net_mod_socket_sendto_nowait(gNetmod_socket, topics_buf, len, val); |
| | | rv = net_mod_socket_sendto_nowait(gNetmod_socket, topics_buf, len, val, SVR_STR, data); |
| | | |
| | | } else { |
| | | |
| | | rv = net_mod_socket_sendto(gNetmod_socket, topics_buf, len, val); |
| | | rv = net_mod_socket_sendto(gNetmod_socket, topics_buf, len, val, SVR_STR, data); |
| | | } |
| | | |
| | | free(topics_buf); |
| | |
| | | int size; |
| | | int val; |
| | | int min, len; |
| | | int data; |
| | | net_node_t node; |
| | | int node_size; |
| | | int recv_arr_size; |
| | |
| | | len += strlen(_input1.data); |
| | | #endif |
| | | |
| | | data = net_mod_socket_svr_get(gNetmod_socket); |
| | | topics_buf = (char *)malloc(len); |
| | | if (topics_buf == NULL) { |
| | | |
| | |
| | | int key; |
| | | int size; |
| | | int len; |
| | | int data; |
| | | int sec, nsec; |
| | | char buf_temp[MAX_STR_LEN] = { 0x00 }; |
| | | char *topics_buf = NULL; |
| | |
| | | return false; |
| | | } |
| | | |
| | | data = net_mod_socket_svr_get(gNetmod_socket); |
| | | if (timeout_ms > 0) { |
| | | |
| | | sec = timeout_ms / 1000; |
| | | nsec = (timeout_ms - sec * 1000) * 1000 * 1000; |
| | | |
| | | rv = net_mod_socket_recvfrom_timeout(gNetmod_socket, &buf, &size, &key, sec, nsec); |
| | | rv = net_mod_socket_recvfrom_timeout(gNetmod_socket, &buf, &size, &key, sec, nsec, SVR_STR, data); |
| | | |
| | | } else if (timeout_ms == 0) { |
| | | |
| | | rv = net_mod_socket_recvfrom_nowait(gNetmod_socket, &buf, &size, &key); |
| | | rv = net_mod_socket_recvfrom_nowait(gNetmod_socket, &buf, &size, &key, SVR_STR, data); |
| | | |
| | | } else { |
| | | |
| | | rv = net_mod_socket_recvfrom(gNetmod_socket, &buf, &size, &key); |
| | | rv = net_mod_socket_recvfrom(gNetmod_socket, &buf, &size, &key, SVR_STR, data); |
| | | } |
| | | |
| | | if (rv == 0) { |
| | |
| | | int BHSendReply(void *src, const void *reply, const int reply_len) |
| | | { |
| | | int rv; |
| | | int data; |
| | | const char *_input; |
| | | |
| | | #if defined(PRO_DE_SERIALIZE) |
| | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | | if (rv == 0) { |
| | | |
| | | rv = net_mod_socket_sendto(gNetmod_socket, _input, strlen(_input), *(int *)src); |
| | | data = net_mod_socket_svr_get(gNetmod_socket); |
| | | rv = net_mod_socket_sendto(gNetmod_socket, _input, strlen(_input), *(int *)src, SVR_STR, data); |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |