| | |
| | | #include "google/protobuf/dynamic_message.h" |
| | | #include "google/protobuf/compiler/importer.h" |
| | | |
| | | #include "3dparty/yyjson/yyjson.h" |
| | | #include "3rdparty/yyjson/yyjson.h" |
| | | |
| | | #include "bhome_msg_api.pb.h" |
| | | using namespace bhome_msg; |
| | |
| | | char* entry = NULL; |
| | | size_t entry_size = 0; |
| | | json2str(sv, &entry, &entry_size); |
| | | arr[i] = ptrT<char>(entry_size+1); |
| | | memcpy(arr[i], entry, entry_size); |
| | | arr[i] = entry; |
| | | } |
| | | return make_tuple(arr, count); |
| | | }; |
| | |
| | | tie(msg->procid, msg->procidl) = copymemory(pid, pids); |
| | | |
| | | MsgRequestTopic msgRT; |
| | | if (!msgRT.ParseFromArray(data, size)) return NULL; |
| | | if (!msgRT.ParseFromArray(data, size)) { |
| | | free(msg->procid); |
| | | free(msg); |
| | | return NULL; |
| | | } |
| | | tie(msg->msg, msg->msgl) = copymemory(msgRT.data()); |
| | | |
| | | return msg; |
| | |
| | | msgRT.set_topic(topic, topicl); |
| | | msgRT.set_data(data, datal); |
| | | |
| | | auto pbstr = msgRT.SerializeAsString(); |
| | | const auto& pbstr = msgRT.SerializeAsString(); |
| | | tie(msg->msg, msg->msgl) = copymemory(pbstr); |
| | | |
| | | return msg; |
| | |
| | | yyjson_mut_doc_free(doc); |
| | | return cstr_ref(json, jsonl); |
| | | } |
| | | |
| | | void free_query_procs(struct cqueryprocs* procs, const size_t count){ |
| | | for(size_t i = 0; i < count; i++){ |
| | | free(procs[i].id); |
| | | } |
| | | free(procs); |
| | | } |