| | |
| | | }_input; |
| | | |
| | | ::bhome_msg::ProcInfo input; |
| | | if(!input.ParseFromArray(proc_info, proc_info_len)) { |
| | | if ((!input.ParseFromArray(proc_info, proc_info_len)) || (reply == NULL) || (reply_len == NULL)) { |
| | | rv = EBUS_INVALID_PARA; |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | |
| | | _input.proc_id = input.proc_id().c_str(); |
| | |
| | | _input.private_info = input.private_info().c_str(); |
| | | |
| | | #else |
| | | if ((proc_info == NULL) || (proc_info_len == 0)) { |
| | | if ((proc_info == NULL) || (proc_info_len == 0) || (reply == NULL) || (reply_len == NULL)) { |
| | | rv = EBUS_INVALID_PARA; |
| | | |
| | | memset(errString, 0x90, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | #endif |
| | | |
| | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | |
| | | |
| | | } |
| | | |
| | | exit_entry: |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | ::bhome_msg::MsgCommonReply mcr; |
| | | mcr.mutable_errmsg()->set_errcode(::bhome_msg::ErrorCode(rv)); |
| | |
| | | |
| | | ::bhome_msg::ProcInfo input; |
| | | |
| | | if(!input.ParseFromArray(proc_info, proc_info_len)) { |
| | | if(!input.ParseFromArray(proc_info, proc_info_len) || (reply == NULL) || (reply_len == NULL)) { |
| | | |
| | | rv = EBUS_INVALID_PARA; |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | |
| | | _input.proc_id = input.proc_id().c_str(); |
| | | _input.name = input.name().c_str(); |
| | | _input.public_info = input.public_info().c_str(); |
| | | _input.private_info = input.private_info().c_str(); |
| | | #else |
| | | if ((reply == NULL) || (reply_len == NULL)) { |
| | | rv = EBUS_INVALID_PARA; |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | return false; |
| | | } |
| | | #endif |
| | | |
| | | if (gRun_stat == 0) { |
| | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | } |
| | | |
| | | exit_entry: |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | ::bhome_msg::MsgCommonReply mcr; |
| | | mcr.mutable_errmsg()->set_errcode(::bhome_msg::ErrorCode(rv)); |
| | |
| | | }_input; |
| | | |
| | | ::bhome_msg::MsgTopicList input; |
| | | if(!input.ParseFromArray(topics, topics_len)) { |
| | | if(!input.ParseFromArray(topics, topics_len) || (reply == NULL) || (reply_len == NULL)) { |
| | | |
| | | rv = EBUS_INVALID_PARA; |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | |
| | | _input.amount = input.topic_list_size(); |
| | |
| | | total += strlen(_input.topics[i]) + 1; |
| | | } |
| | | #else |
| | | if ((topics == NULL) || (topics_len == 0)) { |
| | | if ((topics == NULL) || (topics_len == 0) || (reply == NULL) || (reply_len == NULL)) { |
| | | |
| | | rv = EBUS_INVALID_PARA; |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | |
| | | total = topics_len; |
| | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | memset(topics_buf, 0x00, total); |
| | | |
| | |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | } |
| | | |
| | | exit_entry: |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | ::bhome_msg::MsgCommonReply mcr; |
| | | mcr.mutable_errmsg()->set_errcode(::bhome_msg::ErrorCode(rv)); |
| | |
| | | |
| | | ::bhome_msg::BHAddress input0; |
| | | ::bhome_msg::MsgQueryTopic input1; |
| | | if (!input0.ParseFromArray(remote, remote_len) || !input1.ParseFromArray(topic, topic_len)) { |
| | | if (!input0.ParseFromArray(remote, remote_len) || !input1.ParseFromArray(topic, topic_len) || (reply == NULL) || (reply_len == NULL)) { |
| | | rv = EBUS_INVALID_PARA; |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | |
| | | _input0.mq_id = input0.mq_id(); |
| | |
| | | _input1 = input1.topic().c_str(); |
| | | |
| | | #else |
| | | if ((topic == NULL) || (topic_len == 0)) { |
| | | if ((topic == NULL) || (topic_len == 0) || (reply == NULL) || (reply_len == NULL)) { |
| | | rv = EBUS_INVALID_PARA; |
| | | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | #endif |
| | | |
| | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | } |
| | | |
| | | exit_entry: |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | |
| | | struct _MsgQueryTopicReply |
| | |
| | | |
| | | ::bhome_msg::BHAddress input0; |
| | | ::bhome_msg::MsgQueryProc input1; |
| | | if (!input0.ParseFromArray(remote, remote_len) || !input1.ParseFromArray(query, query_len)) { |
| | | if (!input0.ParseFromArray(remote, remote_len) || !input1.ParseFromArray(query, query_len) || (reply == NULL) || (reply_len == NULL)) { |
| | | |
| | | rv = EBUS_INVALID_PARA; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | |
| | | _input0.mq_id = input0.mq_id(); |
| | |
| | | _input0.ip = input0.ip().c_str(); |
| | | _input0.port = input0.port(); |
| | | _input1 = input1.proc_id().c_str(); |
| | | #else |
| | | if ((reply == NULL) || (reply_len == NULL)) { |
| | | rv = EBUS_INVALID_PARA; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | return false; |
| | | } |
| | | #endif |
| | | |
| | | if (gRun_stat == 0) { |
| | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | } |
| | | |
| | | exit_entry: |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | struct _MsgQueryProcReply |
| | | { |
| | |
| | | }_input; |
| | | |
| | | ::bhome_msg::MsgTopicList input; |
| | | if(!input.ParseFromArray(topics, topics_len)) { |
| | | if(!input.ParseFromArray(topics, topics_len) || (reply == NULL) || (reply_len == NULL)) { |
| | | |
| | | rv = EBUS_INVALID_PARA; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | |
| | | _input.amount = input.topic_list_size(); |
| | |
| | | } |
| | | |
| | | #else |
| | | if ((topics == NULL) || (topics_len == 0)) { |
| | | if ((topics == NULL) || (topics_len == 0) || (reply == NULL) || (reply_len == NULL)) { |
| | | rv = EBUS_INVALID_PARA; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | #endif |
| | | |
| | |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | |
| | | rv = pthread_mutex_trylock(&mutex); |
| | |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | | |
| | | goto exit_entry; |
| | | return false; |
| | | } |
| | | memset(topics_buf, 0x00, total); |
| | | |
| | |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | } |
| | | |
| | | exit_entry: |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | ::bhome_msg::MsgCommonReply mcr; |
| | | mcr.mutable_errmsg()->set_errcode(::bhome_msg::ErrorCode(rv)); |
| | |
| | | return false; |
| | | } |
| | | |
| | | if ((msgpub == NULL) || (msgpub_len == NULL)) { |
| | | rv = EBUS_INVALID_PARA; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | if (timeout_ms > 0) { |
| | | sec = timeout_ms / 1000; |
| | | nsec = (timeout_ms - sec * 1000) * 1000 * 1000; |
| | |
| | | memset(topics_buf, 0x00, sizeof(topics_buf)); |
| | | sprintf(topics_buf, "%d", key); |
| | | |
| | | if ((proc_id != NULL) && (proc_id_len != NULL)) { |
| | | rsr.proc_id = topics_buf; |
| | | *proc_id_len = rsr.proc_id.size(); |
| | | *proc_id = malloc(*proc_id_len); |
| | | memcpy(*proc_id, rsr.proc_id.data(), *proc_id_len); |
| | | } |
| | | |
| | | ::bhome_msg::MsgPublish Mp; |
| | | Mp.set_topic(rsr.topic); |
| | |
| | | *msgpub = ptr; |
| | | *msgpub_len = len; |
| | | |
| | | if ((proc_id != NULL) && (proc_id_len != NULL)) { |
| | | memset(topics_buf, 0x00, sizeof(topics_buf)); |
| | | sprintf(topics_buf, "%d", key); |
| | | |
| | | *proc_id_len = strlen(topics_buf); |
| | | *proc_id = malloc(*proc_id_len); |
| | | memcpy(*proc_id, topics_buf, *proc_id_len); |
| | | } |
| | | |
| | | #endif |
| | | |
| | |
| | | } |
| | | |
| | | if (rv == 0) { |
| | | memset(topics_buf, 0x00, sizeof(topics_buf)); |
| | | sprintf(topics_buf, "%d", val); |
| | | MsgID = topics_buf; |
| | | |
| | | memset(buf_temp, 0x00, sizeof(buf_temp)); |
| | | sprintf(buf_temp, "%d", val); |
| | | MsgID = buf_temp; |
| | | |
| | | *msg_id_len = MsgID.size(); |
| | | *msg_id = malloc(*msg_id_len); |
| | |
| | | |
| | | ::bhome_msg::BHAddress input0; |
| | | ::bhome_msg::MsgRequestTopic input1; |
| | | if (!input0.ParseFromArray(remote, remote_len) || !input1.ParseFromArray(request, request_len)) { |
| | | if (!input0.ParseFromArray(remote, remote_len) || !input1.ParseFromArray(request, request_len) || (reply == NULL) || (reply_len == NULL)) { |
| | | |
| | | rv = EBUS_INVALID_PARA; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | |
| | | _input1.data = input1.data().c_str(); |
| | | |
| | | #else |
| | | if ((request == NULL) || (request_len == 0)) { |
| | | if ((request == NULL) || (request_len == 0) || (reply == NULL) || (reply_len == NULL)) { |
| | | |
| | | rv = EBUS_INVALID_PARA; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | |
| | | |
| | | size = recv_arr[0].content_length; |
| | | buf = (char *)malloc(size); |
| | | memset(buf, 0x00, size); |
| | | if (buf == NULL) { |
| | | printf("Out of memory\n"); |
| | | |
| | | exit(0); |
| | | } |
| | | memset((char *)buf, 0x00, size); |
| | | |
| | | strncpy((char *)buf, (char *)recv_arr[0].content, size); |
| | | #if !defined(PRO_DE_SERIALIZE) |
| | | *reply = buf; |
| | | *reply_len = size; |
| | | #endif |
| | | |
| | | } |
| | | |
| | | net_mod_socket_free_recv_msg_arr(recv_arr, recv_arr_size); |
| | |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | if (rv == 0) { |
| | | if ((proc_id != NULL) && (proc_id_len != NULL)) { |
| | | memset(buf_temp, 0x00, sizeof(buf_temp)); |
| | | sprintf(buf_temp, "%d", node.key); |
| | | |
| | | rr.proc_id = buf_temp; |
| | | *proc_id_len = rr.proc_id.size(); |
| | | *proc_id = malloc(*proc_id_len); |
| | | memcpy(*proc_id, rr.proc_id.data(), *proc_id_len); |
| | | memcpy(*proc_id, rr.proc_id.c_str(), *proc_id_len); |
| | | } |
| | | |
| | | memset(buf_temp, 0x00, sizeof(buf_temp)); |
| | | memcpy(buf_temp, buf, size); |
| | | rr.data = buf_temp; |
| | | |
| | | free(buf); |
| | | |
| | | printf("BHRequest finished_7\n"); |
| | | } |
| | | |
| | | pthread_mutex_unlock(&mutex); |
| | |
| | | return false; |
| | | } |
| | | |
| | | if ((request == NULL) || (request_len == 0) || (src == NULL)) { |
| | | rv = EBUS_INVALID_PARA; |
| | | memset(errString, 0x00, sizeof(errString)); |
| | | strncpy(errString, bus_strerror(rv), sizeof(errString)); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | if (timeout_ms > 0) { |
| | | |
| | | sec = timeout_ms / 1000; |
| | |
| | | void *src; |
| | | } rrr; |
| | | |
| | | if ((proc_id != NULL) && (proc_id_len != NULL)) { |
| | | sprintf(buf_temp, "%d", key); |
| | | rrr.proc_id = buf_temp; |
| | | |
| | | *proc_id_len = rrr.proc_id.size(); |
| | | *proc_id = malloc(*proc_id_len); |
| | | memcpy(*proc_id, rrr.proc_id.data(), *proc_id_len); |
| | | } |
| | | |
| | | topics_buf = (char *)malloc(size + MIN_STR_LEN); |
| | | if (topics_buf == NULL) { |
| | |
| | | |
| | | #if defined(PRO_DE_SERIALIZE) |
| | | ::bhome_msg::MsgRequestTopicReply input; |
| | | if (!input.ParseFromArray(reply, reply_len)) { |
| | | if (!input.ParseFromArray(reply, reply_len) || (src == NULL)) { |
| | | |
| | | rv = EBUS_INVALID_PARA; |
| | | memset(errString, 0x00, sizeof(errString)); |