ADD: added new basic messages and added the parentID as an part of the identifier
This commit is contained in:
@@ -61,15 +61,23 @@ add_library(whisper-com STATIC
|
||||
src/WHISPER/Messages/Leave.cpp
|
||||
|
||||
|
||||
include/WHISPER/Messages/Ping.hpp
|
||||
src/WHISPER/Messages/Ping.cpp
|
||||
|
||||
include/WHISPER/Messages/Pong.hpp
|
||||
src/WHISPER/Messages/Pong.cpp
|
||||
|
||||
|
||||
include/WHISPER/Messages/stringData.hpp
|
||||
src/WHISPER/Messages/stringData.cpp
|
||||
|
||||
include/WHISPER/Messages/Protos/message.pb.cc
|
||||
|
||||
include/WHISPER/Messages/Protos/join.pb.cc
|
||||
|
||||
include/WHISPER/Messages/Protos/leave.pb.cc
|
||||
include/WHISPER/Messages/Protos/ping.pb.cc
|
||||
include/WHISPER/Messages/Protos/pong.pb.cc
|
||||
include/WHISPER/Messages/Protos/stringData.pb.cc
|
||||
|
||||
|
||||
|
||||
)
|
||||
@@ -102,18 +110,18 @@ target_include_directories(whisper-com PUBLIC
|
||||
loguru
|
||||
)
|
||||
|
||||
# add_executable(mainRcv
|
||||
add_executable(mainRcv
|
||||
|
||||
# src/mainRecv.cpp
|
||||
src/mainRecv.cpp
|
||||
|
||||
|
||||
# )
|
||||
# target_link_libraries(mainRcv
|
||||
# loguru
|
||||
# whisper-com
|
||||
)
|
||||
target_link_libraries(mainRcv
|
||||
loguru
|
||||
whisper-com
|
||||
|
||||
|
||||
# )
|
||||
)
|
||||
|
||||
#
|
||||
# Everything TEST related
|
||||
|
||||
@@ -17,9 +17,10 @@ namespace WHISPER {
|
||||
struct localClient{
|
||||
std::uint32_t port;
|
||||
std::string addr;
|
||||
std::uint32_t parentid;
|
||||
std::uint32_t id;
|
||||
zmq::socket_t clientSocket;
|
||||
|
||||
std::time_t lastResponse;
|
||||
};
|
||||
|
||||
|
||||
@@ -74,7 +75,7 @@ namespace WHISPER {
|
||||
|
||||
|
||||
public:
|
||||
InternalUDPService(std::uint32_t id, SourceType owndevicetype,std::uint16_t port, std::string destinationAdress, std::string myAdress);
|
||||
InternalUDPService(std::uint32_t parentid,std::uint32_t id, SourceType owndevicetype,std::uint16_t port, std::string destinationAdress, std::string myAdress);
|
||||
~InternalUDPService();
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace WHISPER {
|
||||
|
||||
Join(std::string receivedMessage);
|
||||
|
||||
Join(std::uint32_t deviceID, SourceType src,std::uint32_t port, std::string addr);
|
||||
Join(std::uint32_t parentID,std::uint32_t deviceID, SourceType src,std::uint32_t port, std::string addr);
|
||||
|
||||
};
|
||||
}
|
||||
@@ -18,7 +18,7 @@ namespace WHISPER {
|
||||
|
||||
Leave(std::string receivedMessage);
|
||||
|
||||
Leave(std::uint32_t deviceID, SourceType src,std::uint32_t port, std::string addr);
|
||||
Leave(std::uint32_t parentID,std::uint32_t deviceID, SourceType src,std::uint32_t port, std::string addr);
|
||||
|
||||
};
|
||||
}
|
||||
@@ -31,7 +31,9 @@ namespace WHISPER {
|
||||
/// raw track message
|
||||
RAW_TRACK,
|
||||
/// simple data
|
||||
SIMPLE
|
||||
SIMPLE,
|
||||
///
|
||||
STRINGDATA
|
||||
}; // enum class EventType
|
||||
|
||||
|
||||
@@ -83,7 +85,7 @@ namespace WHISPER {
|
||||
public:
|
||||
Message()=default;
|
||||
|
||||
Message(std::int32_t deviceId, MsgTopics topic, MsgType Type,SourceType src);
|
||||
Message(std::uint32_t parentId,std::uint32_t deviceId, MsgTopics topic, MsgType Type,SourceType src);
|
||||
Message(std::string msg);
|
||||
|
||||
/**
|
||||
@@ -95,11 +97,13 @@ namespace WHISPER {
|
||||
///topic of the message for pub sub
|
||||
std::uint32_t topic_;
|
||||
/// WHISPER::MsgType ot the payload
|
||||
std::int32_t msgType_;
|
||||
std::uint32_t msgType_;
|
||||
/// WHISPER::SourceType of the sender
|
||||
std::int32_t sourceType_;
|
||||
std::uint32_t sourceType_;
|
||||
/// id of the sender
|
||||
std::int32_t deviceId_;
|
||||
std::uint32_t deviceId_;
|
||||
/// parent id of the sender 0 if its the manager
|
||||
std::uint32_t parentId_;
|
||||
|
||||
/**
|
||||
* @brief returns the serialized message
|
||||
|
||||
23
include/WHISPER/Messages/Ping.hpp
Normal file
23
include/WHISPER/Messages/Ping.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <WHISPER/Messages/Message.hpp>
|
||||
#include <WHISPER/Messages/Protos/ping.pb.h>
|
||||
#include <string>
|
||||
#include <loguru.hpp>
|
||||
|
||||
namespace WHISPER {
|
||||
|
||||
class Ping : public Message
|
||||
{
|
||||
private:
|
||||
messages::ping::Ping pingMessage;
|
||||
public:
|
||||
std::uint32_t port_;
|
||||
|
||||
Ping(std::string receivedMessage);
|
||||
|
||||
Ping(std::uint32_t parentID,std::uint32_t deviceID, SourceType src,std::uint32_t port);
|
||||
|
||||
};
|
||||
}
|
||||
23
include/WHISPER/Messages/Pong.hpp
Normal file
23
include/WHISPER/Messages/Pong.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <WHISPER/Messages/Message.hpp>
|
||||
#include <WHISPER/Messages/Protos/pong.pb.h>
|
||||
#include <string>
|
||||
#include <loguru.hpp>
|
||||
|
||||
namespace WHISPER {
|
||||
|
||||
class Pong : public Message
|
||||
{
|
||||
private:
|
||||
messages::pong::Pong message_;
|
||||
public:
|
||||
std::uint32_t port_;
|
||||
|
||||
Pong(std::string receivedMessage);
|
||||
|
||||
Pong(std::uint32_t parentID,std::uint32_t deviceID, SourceType src,std::uint32_t port);
|
||||
|
||||
};
|
||||
}
|
||||
@@ -26,9 +26,10 @@ PROTOBUF_CONSTEXPR Message::Message(
|
||||
::_pbi::ConstantInitialized): _impl_{
|
||||
/*decltype(_impl_.payload_)*/{}
|
||||
, /*decltype(_impl_.topic_)*/0u
|
||||
, /*decltype(_impl_.msgtype_)*/0
|
||||
, /*decltype(_impl_.sourcetype_)*/0
|
||||
, /*decltype(_impl_.sourceid_)*/0
|
||||
, /*decltype(_impl_.msgtype_)*/0u
|
||||
, /*decltype(_impl_.sourcetype_)*/0u
|
||||
, /*decltype(_impl_.sourceid_)*/0u
|
||||
, /*decltype(_impl_.parentid_)*/0u
|
||||
, /*decltype(_impl_._cached_size_)*/{}} {}
|
||||
struct MessageDefaultTypeInternal {
|
||||
PROTOBUF_CONSTEXPR MessageDefaultTypeInternal()
|
||||
@@ -56,6 +57,7 @@ const uint32_t TableStruct_message_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(
|
||||
PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_.msgtype_),
|
||||
PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_.sourcetype_),
|
||||
PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_.sourceid_),
|
||||
PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_.parentid_),
|
||||
PROTOBUF_FIELD_OFFSET(::messages::header::Message, _impl_.payload_),
|
||||
};
|
||||
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
@@ -68,17 +70,18 @@ static const ::_pb::Message* const file_default_instances[] = {
|
||||
|
||||
const char descriptor_table_protodef_message_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\rmessage.proto\022\017messages.header\032\031google"
|
||||
"/protobuf/any.proto\"v\n\007Message\022\r\n\005topic\030"
|
||||
"\001 \001(\r\022\017\n\007msgType\030\002 \001(\005\022\022\n\nsourceType\030\003 \001"
|
||||
"(\005\022\020\n\010sourceID\030\004 \001(\005\022%\n\007payload\030\005 \003(\0132\024."
|
||||
"google.protobuf.Anyb\006proto3"
|
||||
"/protobuf/any.proto\"\210\001\n\007Message\022\r\n\005topic"
|
||||
"\030\001 \001(\r\022\017\n\007msgType\030\002 \001(\r\022\022\n\nsourceType\030\003 "
|
||||
"\001(\r\022\020\n\010sourceID\030\004 \001(\r\022\020\n\010parentID\030\005 \001(\r\022"
|
||||
"%\n\007payload\030\006 \003(\0132\024.google.protobuf.Anyb\006"
|
||||
"proto3"
|
||||
;
|
||||
static const ::_pbi::DescriptorTable* const descriptor_table_message_2eproto_deps[1] = {
|
||||
&::descriptor_table_google_2fprotobuf_2fany_2eproto,
|
||||
};
|
||||
static ::_pbi::once_flag descriptor_table_message_2eproto_once;
|
||||
const ::_pbi::DescriptorTable descriptor_table_message_2eproto = {
|
||||
false, false, 187, descriptor_table_protodef_message_2eproto,
|
||||
false, false, 206, descriptor_table_protodef_message_2eproto,
|
||||
"message.proto",
|
||||
&descriptor_table_message_2eproto_once, descriptor_table_message_2eproto_deps, 1, 1,
|
||||
schemas, file_default_instances, TableStruct_message_2eproto::offsets,
|
||||
@@ -118,12 +121,13 @@ Message::Message(const Message& from)
|
||||
, decltype(_impl_.msgtype_){}
|
||||
, decltype(_impl_.sourcetype_){}
|
||||
, decltype(_impl_.sourceid_){}
|
||||
, decltype(_impl_.parentid_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
::memcpy(&_impl_.topic_, &from._impl_.topic_,
|
||||
static_cast<size_t>(reinterpret_cast<char*>(&_impl_.sourceid_) -
|
||||
reinterpret_cast<char*>(&_impl_.topic_)) + sizeof(_impl_.sourceid_));
|
||||
static_cast<size_t>(reinterpret_cast<char*>(&_impl_.parentid_) -
|
||||
reinterpret_cast<char*>(&_impl_.topic_)) + sizeof(_impl_.parentid_));
|
||||
// @@protoc_insertion_point(copy_constructor:messages.header.Message)
|
||||
}
|
||||
|
||||
@@ -134,9 +138,10 @@ inline void Message::SharedCtor(
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.payload_){arena}
|
||||
, decltype(_impl_.topic_){0u}
|
||||
, decltype(_impl_.msgtype_){0}
|
||||
, decltype(_impl_.sourcetype_){0}
|
||||
, decltype(_impl_.sourceid_){0}
|
||||
, decltype(_impl_.msgtype_){0u}
|
||||
, decltype(_impl_.sourcetype_){0u}
|
||||
, decltype(_impl_.sourceid_){0u}
|
||||
, decltype(_impl_.parentid_){0u}
|
||||
, /*decltype(_impl_._cached_size_)*/{}
|
||||
};
|
||||
}
|
||||
@@ -167,8 +172,8 @@ void Message::Clear() {
|
||||
|
||||
_impl_.payload_.Clear();
|
||||
::memset(&_impl_.topic_, 0, static_cast<size_t>(
|
||||
reinterpret_cast<char*>(&_impl_.sourceid_) -
|
||||
reinterpret_cast<char*>(&_impl_.topic_)) + sizeof(_impl_.sourceid_));
|
||||
reinterpret_cast<char*>(&_impl_.parentid_) -
|
||||
reinterpret_cast<char*>(&_impl_.topic_)) + sizeof(_impl_.parentid_));
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
@@ -186,7 +191,7 @@ const char* Message::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx)
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// int32 msgType = 2;
|
||||
// uint32 msgType = 2;
|
||||
case 2:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
|
||||
_impl_.msgtype_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
|
||||
@@ -194,7 +199,7 @@ const char* Message::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx)
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// int32 sourceType = 3;
|
||||
// uint32 sourceType = 3;
|
||||
case 3:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
|
||||
_impl_.sourcetype_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
|
||||
@@ -202,7 +207,7 @@ const char* Message::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx)
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// int32 sourceID = 4;
|
||||
// uint32 sourceID = 4;
|
||||
case 4:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
|
||||
_impl_.sourceid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
|
||||
@@ -210,16 +215,24 @@ const char* Message::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx)
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// repeated .google.protobuf.Any payload = 5;
|
||||
// uint32 parentID = 5;
|
||||
case 5:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
|
||||
_impl_.parentid_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
// repeated .google.protobuf.Any payload = 6;
|
||||
case 6:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
|
||||
ptr -= 1;
|
||||
do {
|
||||
ptr += 1;
|
||||
ptr = ctx->ParseMessage(_internal_add_payload(), ptr);
|
||||
CHK_(ptr);
|
||||
if (!ctx->DataAvailable(ptr)) break;
|
||||
} while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<42>(ptr));
|
||||
} while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<50>(ptr));
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
@@ -258,30 +271,36 @@ uint8_t* Message::_InternalSerialize(
|
||||
target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_topic(), target);
|
||||
}
|
||||
|
||||
// int32 msgType = 2;
|
||||
// uint32 msgType = 2;
|
||||
if (this->_internal_msgtype() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteInt32ToArray(2, this->_internal_msgtype(), target);
|
||||
target = ::_pbi::WireFormatLite::WriteUInt32ToArray(2, this->_internal_msgtype(), target);
|
||||
}
|
||||
|
||||
// int32 sourceType = 3;
|
||||
// uint32 sourceType = 3;
|
||||
if (this->_internal_sourcetype() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteInt32ToArray(3, this->_internal_sourcetype(), target);
|
||||
target = ::_pbi::WireFormatLite::WriteUInt32ToArray(3, this->_internal_sourcetype(), target);
|
||||
}
|
||||
|
||||
// int32 sourceID = 4;
|
||||
// uint32 sourceID = 4;
|
||||
if (this->_internal_sourceid() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteInt32ToArray(4, this->_internal_sourceid(), target);
|
||||
target = ::_pbi::WireFormatLite::WriteUInt32ToArray(4, this->_internal_sourceid(), target);
|
||||
}
|
||||
|
||||
// repeated .google.protobuf.Any payload = 5;
|
||||
// uint32 parentID = 5;
|
||||
if (this->_internal_parentid() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteUInt32ToArray(5, this->_internal_parentid(), target);
|
||||
}
|
||||
|
||||
// repeated .google.protobuf.Any payload = 6;
|
||||
for (unsigned i = 0,
|
||||
n = static_cast<unsigned>(this->_internal_payload_size()); i < n; i++) {
|
||||
const auto& repfield = this->_internal_payload(i);
|
||||
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
|
||||
InternalWriteMessage(5, repfield, repfield.GetCachedSize(), target, stream);
|
||||
InternalWriteMessage(6, repfield, repfield.GetCachedSize(), target, stream);
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
@@ -300,7 +319,7 @@ size_t Message::ByteSizeLong() const {
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// repeated .google.protobuf.Any payload = 5;
|
||||
// repeated .google.protobuf.Any payload = 6;
|
||||
total_size += 1UL * this->_internal_payload_size();
|
||||
for (const auto& msg : this->_impl_.payload_) {
|
||||
total_size +=
|
||||
@@ -312,19 +331,24 @@ size_t Message::ByteSizeLong() const {
|
||||
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_topic());
|
||||
}
|
||||
|
||||
// int32 msgType = 2;
|
||||
// uint32 msgType = 2;
|
||||
if (this->_internal_msgtype() != 0) {
|
||||
total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_msgtype());
|
||||
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_msgtype());
|
||||
}
|
||||
|
||||
// int32 sourceType = 3;
|
||||
// uint32 sourceType = 3;
|
||||
if (this->_internal_sourcetype() != 0) {
|
||||
total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_sourcetype());
|
||||
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_sourcetype());
|
||||
}
|
||||
|
||||
// int32 sourceID = 4;
|
||||
// uint32 sourceID = 4;
|
||||
if (this->_internal_sourceid() != 0) {
|
||||
total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_sourceid());
|
||||
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_sourceid());
|
||||
}
|
||||
|
||||
// uint32 parentID = 5;
|
||||
if (this->_internal_parentid() != 0) {
|
||||
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_parentid());
|
||||
}
|
||||
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
|
||||
@@ -358,6 +382,9 @@ void Message::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOB
|
||||
if (from._internal_sourceid() != 0) {
|
||||
_this->_internal_set_sourceid(from._internal_sourceid());
|
||||
}
|
||||
if (from._internal_parentid() != 0) {
|
||||
_this->_internal_set_parentid(from._internal_parentid());
|
||||
}
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
@@ -377,8 +404,8 @@ void Message::InternalSwap(Message* other) {
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
_impl_.payload_.InternalSwap(&other->_impl_.payload_);
|
||||
::PROTOBUF_NAMESPACE_ID::internal::memswap<
|
||||
PROTOBUF_FIELD_OFFSET(Message, _impl_.sourceid_)
|
||||
+ sizeof(Message::_impl_.sourceid_)
|
||||
PROTOBUF_FIELD_OFFSET(Message, _impl_.parentid_)
|
||||
+ sizeof(Message::_impl_.parentid_)
|
||||
- PROTOBUF_FIELD_OFFSET(Message, _impl_.topic_)>(
|
||||
reinterpret_cast<char*>(&_impl_.topic_),
|
||||
reinterpret_cast<char*>(&other->_impl_.topic_));
|
||||
|
||||
@@ -181,13 +181,14 @@ class Message final :
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kPayloadFieldNumber = 5,
|
||||
kPayloadFieldNumber = 6,
|
||||
kTopicFieldNumber = 1,
|
||||
kMsgTypeFieldNumber = 2,
|
||||
kSourceTypeFieldNumber = 3,
|
||||
kSourceIDFieldNumber = 4,
|
||||
kParentIDFieldNumber = 5,
|
||||
};
|
||||
// repeated .google.protobuf.Any payload = 5;
|
||||
// repeated .google.protobuf.Any payload = 6;
|
||||
int payload_size() const;
|
||||
private:
|
||||
int _internal_payload_size() const;
|
||||
@@ -214,31 +215,40 @@ class Message final :
|
||||
void _internal_set_topic(uint32_t value);
|
||||
public:
|
||||
|
||||
// int32 msgType = 2;
|
||||
// uint32 msgType = 2;
|
||||
void clear_msgtype();
|
||||
int32_t msgtype() const;
|
||||
void set_msgtype(int32_t value);
|
||||
uint32_t msgtype() const;
|
||||
void set_msgtype(uint32_t value);
|
||||
private:
|
||||
int32_t _internal_msgtype() const;
|
||||
void _internal_set_msgtype(int32_t value);
|
||||
uint32_t _internal_msgtype() const;
|
||||
void _internal_set_msgtype(uint32_t value);
|
||||
public:
|
||||
|
||||
// int32 sourceType = 3;
|
||||
// uint32 sourceType = 3;
|
||||
void clear_sourcetype();
|
||||
int32_t sourcetype() const;
|
||||
void set_sourcetype(int32_t value);
|
||||
uint32_t sourcetype() const;
|
||||
void set_sourcetype(uint32_t value);
|
||||
private:
|
||||
int32_t _internal_sourcetype() const;
|
||||
void _internal_set_sourcetype(int32_t value);
|
||||
uint32_t _internal_sourcetype() const;
|
||||
void _internal_set_sourcetype(uint32_t value);
|
||||
public:
|
||||
|
||||
// int32 sourceID = 4;
|
||||
// uint32 sourceID = 4;
|
||||
void clear_sourceid();
|
||||
int32_t sourceid() const;
|
||||
void set_sourceid(int32_t value);
|
||||
uint32_t sourceid() const;
|
||||
void set_sourceid(uint32_t value);
|
||||
private:
|
||||
int32_t _internal_sourceid() const;
|
||||
void _internal_set_sourceid(int32_t value);
|
||||
uint32_t _internal_sourceid() const;
|
||||
void _internal_set_sourceid(uint32_t value);
|
||||
public:
|
||||
|
||||
// uint32 parentID = 5;
|
||||
void clear_parentid();
|
||||
uint32_t parentid() const;
|
||||
void set_parentid(uint32_t value);
|
||||
private:
|
||||
uint32_t _internal_parentid() const;
|
||||
void _internal_set_parentid(uint32_t value);
|
||||
public:
|
||||
|
||||
// @@protoc_insertion_point(class_scope:messages.header.Message)
|
||||
@@ -251,9 +261,10 @@ class Message final :
|
||||
struct Impl_ {
|
||||
::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Any > payload_;
|
||||
uint32_t topic_;
|
||||
int32_t msgtype_;
|
||||
int32_t sourcetype_;
|
||||
int32_t sourceid_;
|
||||
uint32_t msgtype_;
|
||||
uint32_t sourcetype_;
|
||||
uint32_t sourceid_;
|
||||
uint32_t parentid_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
@@ -290,67 +301,87 @@ inline void Message::set_topic(uint32_t value) {
|
||||
// @@protoc_insertion_point(field_set:messages.header.Message.topic)
|
||||
}
|
||||
|
||||
// int32 msgType = 2;
|
||||
// uint32 msgType = 2;
|
||||
inline void Message::clear_msgtype() {
|
||||
_impl_.msgtype_ = 0;
|
||||
_impl_.msgtype_ = 0u;
|
||||
}
|
||||
inline int32_t Message::_internal_msgtype() const {
|
||||
inline uint32_t Message::_internal_msgtype() const {
|
||||
return _impl_.msgtype_;
|
||||
}
|
||||
inline int32_t Message::msgtype() const {
|
||||
inline uint32_t Message::msgtype() const {
|
||||
// @@protoc_insertion_point(field_get:messages.header.Message.msgType)
|
||||
return _internal_msgtype();
|
||||
}
|
||||
inline void Message::_internal_set_msgtype(int32_t value) {
|
||||
inline void Message::_internal_set_msgtype(uint32_t value) {
|
||||
|
||||
_impl_.msgtype_ = value;
|
||||
}
|
||||
inline void Message::set_msgtype(int32_t value) {
|
||||
inline void Message::set_msgtype(uint32_t value) {
|
||||
_internal_set_msgtype(value);
|
||||
// @@protoc_insertion_point(field_set:messages.header.Message.msgType)
|
||||
}
|
||||
|
||||
// int32 sourceType = 3;
|
||||
// uint32 sourceType = 3;
|
||||
inline void Message::clear_sourcetype() {
|
||||
_impl_.sourcetype_ = 0;
|
||||
_impl_.sourcetype_ = 0u;
|
||||
}
|
||||
inline int32_t Message::_internal_sourcetype() const {
|
||||
inline uint32_t Message::_internal_sourcetype() const {
|
||||
return _impl_.sourcetype_;
|
||||
}
|
||||
inline int32_t Message::sourcetype() const {
|
||||
inline uint32_t Message::sourcetype() const {
|
||||
// @@protoc_insertion_point(field_get:messages.header.Message.sourceType)
|
||||
return _internal_sourcetype();
|
||||
}
|
||||
inline void Message::_internal_set_sourcetype(int32_t value) {
|
||||
inline void Message::_internal_set_sourcetype(uint32_t value) {
|
||||
|
||||
_impl_.sourcetype_ = value;
|
||||
}
|
||||
inline void Message::set_sourcetype(int32_t value) {
|
||||
inline void Message::set_sourcetype(uint32_t value) {
|
||||
_internal_set_sourcetype(value);
|
||||
// @@protoc_insertion_point(field_set:messages.header.Message.sourceType)
|
||||
}
|
||||
|
||||
// int32 sourceID = 4;
|
||||
// uint32 sourceID = 4;
|
||||
inline void Message::clear_sourceid() {
|
||||
_impl_.sourceid_ = 0;
|
||||
_impl_.sourceid_ = 0u;
|
||||
}
|
||||
inline int32_t Message::_internal_sourceid() const {
|
||||
inline uint32_t Message::_internal_sourceid() const {
|
||||
return _impl_.sourceid_;
|
||||
}
|
||||
inline int32_t Message::sourceid() const {
|
||||
inline uint32_t Message::sourceid() const {
|
||||
// @@protoc_insertion_point(field_get:messages.header.Message.sourceID)
|
||||
return _internal_sourceid();
|
||||
}
|
||||
inline void Message::_internal_set_sourceid(int32_t value) {
|
||||
inline void Message::_internal_set_sourceid(uint32_t value) {
|
||||
|
||||
_impl_.sourceid_ = value;
|
||||
}
|
||||
inline void Message::set_sourceid(int32_t value) {
|
||||
inline void Message::set_sourceid(uint32_t value) {
|
||||
_internal_set_sourceid(value);
|
||||
// @@protoc_insertion_point(field_set:messages.header.Message.sourceID)
|
||||
}
|
||||
|
||||
// repeated .google.protobuf.Any payload = 5;
|
||||
// uint32 parentID = 5;
|
||||
inline void Message::clear_parentid() {
|
||||
_impl_.parentid_ = 0u;
|
||||
}
|
||||
inline uint32_t Message::_internal_parentid() const {
|
||||
return _impl_.parentid_;
|
||||
}
|
||||
inline uint32_t Message::parentid() const {
|
||||
// @@protoc_insertion_point(field_get:messages.header.Message.parentID)
|
||||
return _internal_parentid();
|
||||
}
|
||||
inline void Message::_internal_set_parentid(uint32_t value) {
|
||||
|
||||
_impl_.parentid_ = value;
|
||||
}
|
||||
inline void Message::set_parentid(uint32_t value) {
|
||||
_internal_set_parentid(value);
|
||||
// @@protoc_insertion_point(field_set:messages.header.Message.parentID)
|
||||
}
|
||||
|
||||
// repeated .google.protobuf.Any payload = 6;
|
||||
inline int Message::_internal_payload_size() const {
|
||||
return _impl_.payload_.size();
|
||||
}
|
||||
|
||||
@@ -8,11 +8,12 @@ package messages.header;
|
||||
// [START messages]
|
||||
message Message {
|
||||
uint32 topic = 1;
|
||||
int32 msgType = 2;
|
||||
int32 sourceType = 3;
|
||||
int32 sourceID = 4;
|
||||
uint32 msgType = 2;
|
||||
uint32 sourceType = 3;
|
||||
uint32 sourceID = 4;
|
||||
uint32 parentID = 5;
|
||||
|
||||
repeated google.protobuf.Any payload = 5;
|
||||
repeated google.protobuf.Any payload = 6;
|
||||
|
||||
}
|
||||
|
||||
|
||||
272
include/WHISPER/Messages/Protos/ping.pb.cc
Normal file
272
include/WHISPER/Messages/Protos/ping.pb.cc
Normal file
@@ -0,0 +1,272 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: ping.proto
|
||||
|
||||
#include "ping.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/wire_format_lite.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/reflection_ops.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
|
||||
PROTOBUF_PRAGMA_INIT_SEG
|
||||
|
||||
namespace _pb = ::PROTOBUF_NAMESPACE_ID;
|
||||
namespace _pbi = _pb::internal;
|
||||
|
||||
namespace messages {
|
||||
namespace ping {
|
||||
PROTOBUF_CONSTEXPR Ping::Ping(
|
||||
::_pbi::ConstantInitialized): _impl_{
|
||||
/*decltype(_impl_.port_)*/0u
|
||||
, /*decltype(_impl_._cached_size_)*/{}} {}
|
||||
struct PingDefaultTypeInternal {
|
||||
PROTOBUF_CONSTEXPR PingDefaultTypeInternal()
|
||||
: _instance(::_pbi::ConstantInitialized{}) {}
|
||||
~PingDefaultTypeInternal() {}
|
||||
union {
|
||||
Ping _instance;
|
||||
};
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PingDefaultTypeInternal _Ping_default_instance_;
|
||||
} // namespace ping
|
||||
} // namespace messages
|
||||
static ::_pb::Metadata file_level_metadata_ping_2eproto[1];
|
||||
static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_ping_2eproto = nullptr;
|
||||
static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_ping_2eproto = nullptr;
|
||||
|
||||
const uint32_t TableStruct_ping_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::messages::ping::Ping, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
PROTOBUF_FIELD_OFFSET(::messages::ping::Ping, _impl_.port_),
|
||||
};
|
||||
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{ 0, -1, -1, sizeof(::messages::ping::Ping)},
|
||||
};
|
||||
|
||||
static const ::_pb::Message* const file_default_instances[] = {
|
||||
&::messages::ping::_Ping_default_instance_._instance,
|
||||
};
|
||||
|
||||
const char descriptor_table_protodef_ping_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\nping.proto\022\rmessages.ping\"\024\n\004Ping\022\014\n\004p"
|
||||
"ort\030\002 \001(\rb\006proto3"
|
||||
;
|
||||
static ::_pbi::once_flag descriptor_table_ping_2eproto_once;
|
||||
const ::_pbi::DescriptorTable descriptor_table_ping_2eproto = {
|
||||
false, false, 57, descriptor_table_protodef_ping_2eproto,
|
||||
"ping.proto",
|
||||
&descriptor_table_ping_2eproto_once, nullptr, 0, 1,
|
||||
schemas, file_default_instances, TableStruct_ping_2eproto::offsets,
|
||||
file_level_metadata_ping_2eproto, file_level_enum_descriptors_ping_2eproto,
|
||||
file_level_service_descriptors_ping_2eproto,
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_ping_2eproto_getter() {
|
||||
return &descriptor_table_ping_2eproto;
|
||||
}
|
||||
|
||||
// Force running AddDescriptors() at dynamic initialization time.
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_ping_2eproto(&descriptor_table_ping_2eproto);
|
||||
namespace messages {
|
||||
namespace ping {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class Ping::_Internal {
|
||||
public:
|
||||
};
|
||||
|
||||
Ping::Ping(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
|
||||
SharedCtor(arena, is_message_owned);
|
||||
// @@protoc_insertion_point(arena_constructor:messages.ping.Ping)
|
||||
}
|
||||
Ping::Ping(const Ping& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Ping* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.port_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_impl_.port_ = from._impl_.port_;
|
||||
// @@protoc_insertion_point(copy_constructor:messages.ping.Ping)
|
||||
}
|
||||
|
||||
inline void Ping::SharedCtor(
|
||||
::_pb::Arena* arena, bool is_message_owned) {
|
||||
(void)arena;
|
||||
(void)is_message_owned;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.port_){0u}
|
||||
, /*decltype(_impl_._cached_size_)*/{}
|
||||
};
|
||||
}
|
||||
|
||||
Ping::~Ping() {
|
||||
// @@protoc_insertion_point(destructor:messages.ping.Ping)
|
||||
if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
|
||||
(void)arena;
|
||||
return;
|
||||
}
|
||||
SharedDtor();
|
||||
}
|
||||
|
||||
inline void Ping::SharedDtor() {
|
||||
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
|
||||
}
|
||||
|
||||
void Ping::SetCachedSize(int size) const {
|
||||
_impl_._cached_size_.Set(size);
|
||||
}
|
||||
|
||||
void Ping::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:messages.ping.Ping)
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.port_ = 0u;
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* Ping::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
|
||||
while (!ctx->Done(&ptr)) {
|
||||
uint32_t tag;
|
||||
ptr = ::_pbi::ReadTag(ptr, &tag);
|
||||
switch (tag >> 3) {
|
||||
// uint32 port = 2;
|
||||
case 2:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
|
||||
_impl_.port_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
handle_unusual:
|
||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||
CHK_(ptr);
|
||||
ctx->SetLastTag(tag);
|
||||
goto message_done;
|
||||
}
|
||||
ptr = UnknownFieldParse(
|
||||
tag,
|
||||
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
|
||||
ptr, ctx);
|
||||
CHK_(ptr != nullptr);
|
||||
} // while
|
||||
message_done:
|
||||
return ptr;
|
||||
failure:
|
||||
ptr = nullptr;
|
||||
goto message_done;
|
||||
#undef CHK_
|
||||
}
|
||||
|
||||
uint8_t* Ping::_InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
|
||||
// @@protoc_insertion_point(serialize_to_array_start:messages.ping.Ping)
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
// uint32 port = 2;
|
||||
if (this->_internal_port() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteUInt32ToArray(2, this->_internal_port(), target);
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_to_array_end:messages.ping.Ping)
|
||||
return target;
|
||||
}
|
||||
|
||||
size_t Ping::ByteSizeLong() const {
|
||||
// @@protoc_insertion_point(message_byte_size_start:messages.ping.Ping)
|
||||
size_t total_size = 0;
|
||||
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// uint32 port = 2;
|
||||
if (this->_internal_port() != 0) {
|
||||
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_port());
|
||||
}
|
||||
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
|
||||
}
|
||||
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Ping::_class_data_ = {
|
||||
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
|
||||
Ping::MergeImpl
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Ping::GetClassData() const { return &_class_data_; }
|
||||
|
||||
|
||||
void Ping::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Ping*>(&to_msg);
|
||||
auto& from = static_cast<const Ping&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:messages.ping.Ping)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (from._internal_port() != 0) {
|
||||
_this->_internal_set_port(from._internal_port());
|
||||
}
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Ping::CopyFrom(const Ping& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:messages.ping.Ping)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
bool Ping::IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Ping::InternalSwap(Ping* other) {
|
||||
using std::swap;
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
swap(_impl_.port_, other->_impl_.port_);
|
||||
}
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata Ping::GetMetadata() const {
|
||||
return ::_pbi::AssignDescriptors(
|
||||
&descriptor_table_ping_2eproto_getter, &descriptor_table_ping_2eproto_once,
|
||||
file_level_metadata_ping_2eproto[0]);
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace ping
|
||||
} // namespace messages
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
template<> PROTOBUF_NOINLINE ::messages::ping::Ping*
|
||||
Arena::CreateMaybeMessage< ::messages::ping::Ping >(Arena* arena) {
|
||||
return Arena::CreateMessageInternal< ::messages::ping::Ping >(arena);
|
||||
}
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
251
include/WHISPER/Messages/Protos/ping.pb.h
Normal file
251
include/WHISPER/Messages/Protos/ping.pb.h
Normal file
@@ -0,0 +1,251 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: ping.proto
|
||||
|
||||
#ifndef GOOGLE_PROTOBUF_INCLUDED_ping_2eproto
|
||||
#define GOOGLE_PROTOBUF_INCLUDED_ping_2eproto
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3021000
|
||||
#error This file was generated by a newer version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please update
|
||||
#error your headers.
|
||||
#endif
|
||||
#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#error This file was generated by an older version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please
|
||||
#error regenerate this file with a newer version of protoc.
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <google/protobuf/arenastring.h>
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/metadata_lite.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
|
||||
#include <google/protobuf/extension_set.h> // IWYU pragma: export
|
||||
#include <google/protobuf/unknown_field_set.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#define PROTOBUF_INTERNAL_EXPORT_ping_2eproto
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
namespace internal {
|
||||
class AnyMetadata;
|
||||
} // namespace internal
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// Internal implementation detail -- do not use these members.
|
||||
struct TableStruct_ping_2eproto {
|
||||
static const uint32_t offsets[];
|
||||
};
|
||||
extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_ping_2eproto;
|
||||
namespace messages {
|
||||
namespace ping {
|
||||
class Ping;
|
||||
struct PingDefaultTypeInternal;
|
||||
extern PingDefaultTypeInternal _Ping_default_instance_;
|
||||
} // namespace ping
|
||||
} // namespace messages
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
template<> ::messages::ping::Ping* Arena::CreateMaybeMessage<::messages::ping::Ping>(Arena*);
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
namespace messages {
|
||||
namespace ping {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class Ping final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:messages.ping.Ping) */ {
|
||||
public:
|
||||
inline Ping() : Ping(nullptr) {}
|
||||
~Ping() override;
|
||||
explicit PROTOBUF_CONSTEXPR Ping(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
|
||||
|
||||
Ping(const Ping& from);
|
||||
Ping(Ping&& from) noexcept
|
||||
: Ping() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline Ping& operator=(const Ping& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline Ping& operator=(Ping&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetOwningArena() == from.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetOwningArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
|
||||
return default_instance().GetMetadata().descriptor;
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
|
||||
return default_instance().GetMetadata().reflection;
|
||||
}
|
||||
static const Ping& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
static inline const Ping* internal_default_instance() {
|
||||
return reinterpret_cast<const Ping*>(
|
||||
&_Ping_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
0;
|
||||
|
||||
friend void swap(Ping& a, Ping& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
inline void Swap(Ping* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
|
||||
}
|
||||
}
|
||||
void UnsafeArenaSwap(Ping* other) {
|
||||
if (other == this) return;
|
||||
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
Ping* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<Ping>(arena);
|
||||
}
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Ping& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom( const Ping& from) {
|
||||
Ping::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
||||
size_t ByteSizeLong() const final;
|
||||
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
|
||||
uint8_t* _InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
|
||||
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(Ping* other);
|
||||
|
||||
private:
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "messages.ping.Ping";
|
||||
}
|
||||
protected:
|
||||
explicit Ping(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned = false);
|
||||
public:
|
||||
|
||||
static const ClassData _class_data_;
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kPortFieldNumber = 2,
|
||||
};
|
||||
// uint32 port = 2;
|
||||
void clear_port();
|
||||
uint32_t port() const;
|
||||
void set_port(uint32_t value);
|
||||
private:
|
||||
uint32_t _internal_port() const;
|
||||
void _internal_set_port(uint32_t value);
|
||||
public:
|
||||
|
||||
// @@protoc_insertion_point(class_scope:messages.ping.Ping)
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
typedef void InternalArenaConstructable_;
|
||||
typedef void DestructorSkippable_;
|
||||
struct Impl_ {
|
||||
uint32_t port_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
friend struct ::TableStruct_ping_2eproto;
|
||||
};
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // __GNUC__
|
||||
// Ping
|
||||
|
||||
// uint32 port = 2;
|
||||
inline void Ping::clear_port() {
|
||||
_impl_.port_ = 0u;
|
||||
}
|
||||
inline uint32_t Ping::_internal_port() const {
|
||||
return _impl_.port_;
|
||||
}
|
||||
inline uint32_t Ping::port() const {
|
||||
// @@protoc_insertion_point(field_get:messages.ping.Ping.port)
|
||||
return _internal_port();
|
||||
}
|
||||
inline void Ping::_internal_set_port(uint32_t value) {
|
||||
|
||||
_impl_.port_ = value;
|
||||
}
|
||||
inline void Ping::set_port(uint32_t value) {
|
||||
_internal_set_port(value);
|
||||
// @@protoc_insertion_point(field_set:messages.ping.Ping.port)
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace ping
|
||||
} // namespace messages
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_ping_2eproto
|
||||
14
include/WHISPER/Messages/Protos/ping.proto
Normal file
14
include/WHISPER/Messages/Protos/ping.proto
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
// [START declaration]
|
||||
syntax = "proto3";
|
||||
package messages.ping;
|
||||
|
||||
// import "google/protobuf/timestamp.proto";
|
||||
// [END declaration]
|
||||
|
||||
|
||||
// [START messages]
|
||||
message Ping {
|
||||
uint32 port = 2;
|
||||
}
|
||||
|
||||
272
include/WHISPER/Messages/Protos/pong.pb.cc
Normal file
272
include/WHISPER/Messages/Protos/pong.pb.cc
Normal file
@@ -0,0 +1,272 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: pong.proto
|
||||
|
||||
#include "pong.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/wire_format_lite.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/reflection_ops.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
|
||||
PROTOBUF_PRAGMA_INIT_SEG
|
||||
|
||||
namespace _pb = ::PROTOBUF_NAMESPACE_ID;
|
||||
namespace _pbi = _pb::internal;
|
||||
|
||||
namespace messages {
|
||||
namespace pong {
|
||||
PROTOBUF_CONSTEXPR Pong::Pong(
|
||||
::_pbi::ConstantInitialized): _impl_{
|
||||
/*decltype(_impl_.port_)*/0u
|
||||
, /*decltype(_impl_._cached_size_)*/{}} {}
|
||||
struct PongDefaultTypeInternal {
|
||||
PROTOBUF_CONSTEXPR PongDefaultTypeInternal()
|
||||
: _instance(::_pbi::ConstantInitialized{}) {}
|
||||
~PongDefaultTypeInternal() {}
|
||||
union {
|
||||
Pong _instance;
|
||||
};
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 PongDefaultTypeInternal _Pong_default_instance_;
|
||||
} // namespace pong
|
||||
} // namespace messages
|
||||
static ::_pb::Metadata file_level_metadata_pong_2eproto[1];
|
||||
static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_pong_2eproto = nullptr;
|
||||
static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_pong_2eproto = nullptr;
|
||||
|
||||
const uint32_t TableStruct_pong_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::messages::pong::Pong, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
PROTOBUF_FIELD_OFFSET(::messages::pong::Pong, _impl_.port_),
|
||||
};
|
||||
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{ 0, -1, -1, sizeof(::messages::pong::Pong)},
|
||||
};
|
||||
|
||||
static const ::_pb::Message* const file_default_instances[] = {
|
||||
&::messages::pong::_Pong_default_instance_._instance,
|
||||
};
|
||||
|
||||
const char descriptor_table_protodef_pong_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\npong.proto\022\rmessages.pong\"\024\n\004Pong\022\014\n\004p"
|
||||
"ort\030\001 \001(\rb\006proto3"
|
||||
;
|
||||
static ::_pbi::once_flag descriptor_table_pong_2eproto_once;
|
||||
const ::_pbi::DescriptorTable descriptor_table_pong_2eproto = {
|
||||
false, false, 57, descriptor_table_protodef_pong_2eproto,
|
||||
"pong.proto",
|
||||
&descriptor_table_pong_2eproto_once, nullptr, 0, 1,
|
||||
schemas, file_default_instances, TableStruct_pong_2eproto::offsets,
|
||||
file_level_metadata_pong_2eproto, file_level_enum_descriptors_pong_2eproto,
|
||||
file_level_service_descriptors_pong_2eproto,
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_pong_2eproto_getter() {
|
||||
return &descriptor_table_pong_2eproto;
|
||||
}
|
||||
|
||||
// Force running AddDescriptors() at dynamic initialization time.
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_pong_2eproto(&descriptor_table_pong_2eproto);
|
||||
namespace messages {
|
||||
namespace pong {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class Pong::_Internal {
|
||||
public:
|
||||
};
|
||||
|
||||
Pong::Pong(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
|
||||
SharedCtor(arena, is_message_owned);
|
||||
// @@protoc_insertion_point(arena_constructor:messages.pong.Pong)
|
||||
}
|
||||
Pong::Pong(const Pong& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Pong* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.port_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_this->_impl_.port_ = from._impl_.port_;
|
||||
// @@protoc_insertion_point(copy_constructor:messages.pong.Pong)
|
||||
}
|
||||
|
||||
inline void Pong::SharedCtor(
|
||||
::_pb::Arena* arena, bool is_message_owned) {
|
||||
(void)arena;
|
||||
(void)is_message_owned;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.port_){0u}
|
||||
, /*decltype(_impl_._cached_size_)*/{}
|
||||
};
|
||||
}
|
||||
|
||||
Pong::~Pong() {
|
||||
// @@protoc_insertion_point(destructor:messages.pong.Pong)
|
||||
if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
|
||||
(void)arena;
|
||||
return;
|
||||
}
|
||||
SharedDtor();
|
||||
}
|
||||
|
||||
inline void Pong::SharedDtor() {
|
||||
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
|
||||
}
|
||||
|
||||
void Pong::SetCachedSize(int size) const {
|
||||
_impl_._cached_size_.Set(size);
|
||||
}
|
||||
|
||||
void Pong::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:messages.pong.Pong)
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.port_ = 0u;
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* Pong::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
|
||||
while (!ctx->Done(&ptr)) {
|
||||
uint32_t tag;
|
||||
ptr = ::_pbi::ReadTag(ptr, &tag);
|
||||
switch (tag >> 3) {
|
||||
// uint32 port = 1;
|
||||
case 1:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
|
||||
_impl_.port_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
|
||||
CHK_(ptr);
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
handle_unusual:
|
||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||
CHK_(ptr);
|
||||
ctx->SetLastTag(tag);
|
||||
goto message_done;
|
||||
}
|
||||
ptr = UnknownFieldParse(
|
||||
tag,
|
||||
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
|
||||
ptr, ctx);
|
||||
CHK_(ptr != nullptr);
|
||||
} // while
|
||||
message_done:
|
||||
return ptr;
|
||||
failure:
|
||||
ptr = nullptr;
|
||||
goto message_done;
|
||||
#undef CHK_
|
||||
}
|
||||
|
||||
uint8_t* Pong::_InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
|
||||
// @@protoc_insertion_point(serialize_to_array_start:messages.pong.Pong)
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
// uint32 port = 1;
|
||||
if (this->_internal_port() != 0) {
|
||||
target = stream->EnsureSpace(target);
|
||||
target = ::_pbi::WireFormatLite::WriteUInt32ToArray(1, this->_internal_port(), target);
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_to_array_end:messages.pong.Pong)
|
||||
return target;
|
||||
}
|
||||
|
||||
size_t Pong::ByteSizeLong() const {
|
||||
// @@protoc_insertion_point(message_byte_size_start:messages.pong.Pong)
|
||||
size_t total_size = 0;
|
||||
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// uint32 port = 1;
|
||||
if (this->_internal_port() != 0) {
|
||||
total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_port());
|
||||
}
|
||||
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
|
||||
}
|
||||
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Pong::_class_data_ = {
|
||||
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
|
||||
Pong::MergeImpl
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Pong::GetClassData() const { return &_class_data_; }
|
||||
|
||||
|
||||
void Pong::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Pong*>(&to_msg);
|
||||
auto& from = static_cast<const Pong&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:messages.pong.Pong)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (from._internal_port() != 0) {
|
||||
_this->_internal_set_port(from._internal_port());
|
||||
}
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Pong::CopyFrom(const Pong& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:messages.pong.Pong)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
bool Pong::IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Pong::InternalSwap(Pong* other) {
|
||||
using std::swap;
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
swap(_impl_.port_, other->_impl_.port_);
|
||||
}
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata Pong::GetMetadata() const {
|
||||
return ::_pbi::AssignDescriptors(
|
||||
&descriptor_table_pong_2eproto_getter, &descriptor_table_pong_2eproto_once,
|
||||
file_level_metadata_pong_2eproto[0]);
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace pong
|
||||
} // namespace messages
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
template<> PROTOBUF_NOINLINE ::messages::pong::Pong*
|
||||
Arena::CreateMaybeMessage< ::messages::pong::Pong >(Arena* arena) {
|
||||
return Arena::CreateMessageInternal< ::messages::pong::Pong >(arena);
|
||||
}
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
251
include/WHISPER/Messages/Protos/pong.pb.h
Normal file
251
include/WHISPER/Messages/Protos/pong.pb.h
Normal file
@@ -0,0 +1,251 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: pong.proto
|
||||
|
||||
#ifndef GOOGLE_PROTOBUF_INCLUDED_pong_2eproto
|
||||
#define GOOGLE_PROTOBUF_INCLUDED_pong_2eproto
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3021000
|
||||
#error This file was generated by a newer version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please update
|
||||
#error your headers.
|
||||
#endif
|
||||
#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#error This file was generated by an older version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please
|
||||
#error regenerate this file with a newer version of protoc.
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <google/protobuf/arenastring.h>
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/metadata_lite.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
|
||||
#include <google/protobuf/extension_set.h> // IWYU pragma: export
|
||||
#include <google/protobuf/unknown_field_set.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#define PROTOBUF_INTERNAL_EXPORT_pong_2eproto
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
namespace internal {
|
||||
class AnyMetadata;
|
||||
} // namespace internal
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// Internal implementation detail -- do not use these members.
|
||||
struct TableStruct_pong_2eproto {
|
||||
static const uint32_t offsets[];
|
||||
};
|
||||
extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_pong_2eproto;
|
||||
namespace messages {
|
||||
namespace pong {
|
||||
class Pong;
|
||||
struct PongDefaultTypeInternal;
|
||||
extern PongDefaultTypeInternal _Pong_default_instance_;
|
||||
} // namespace pong
|
||||
} // namespace messages
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
template<> ::messages::pong::Pong* Arena::CreateMaybeMessage<::messages::pong::Pong>(Arena*);
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
namespace messages {
|
||||
namespace pong {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class Pong final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:messages.pong.Pong) */ {
|
||||
public:
|
||||
inline Pong() : Pong(nullptr) {}
|
||||
~Pong() override;
|
||||
explicit PROTOBUF_CONSTEXPR Pong(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
|
||||
|
||||
Pong(const Pong& from);
|
||||
Pong(Pong&& from) noexcept
|
||||
: Pong() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline Pong& operator=(const Pong& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline Pong& operator=(Pong&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetOwningArena() == from.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetOwningArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
|
||||
return default_instance().GetMetadata().descriptor;
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
|
||||
return default_instance().GetMetadata().reflection;
|
||||
}
|
||||
static const Pong& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
static inline const Pong* internal_default_instance() {
|
||||
return reinterpret_cast<const Pong*>(
|
||||
&_Pong_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
0;
|
||||
|
||||
friend void swap(Pong& a, Pong& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
inline void Swap(Pong* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
|
||||
}
|
||||
}
|
||||
void UnsafeArenaSwap(Pong* other) {
|
||||
if (other == this) return;
|
||||
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
Pong* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<Pong>(arena);
|
||||
}
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Pong& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom( const Pong& from) {
|
||||
Pong::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
||||
size_t ByteSizeLong() const final;
|
||||
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
|
||||
uint8_t* _InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
|
||||
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(Pong* other);
|
||||
|
||||
private:
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "messages.pong.Pong";
|
||||
}
|
||||
protected:
|
||||
explicit Pong(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned = false);
|
||||
public:
|
||||
|
||||
static const ClassData _class_data_;
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kPortFieldNumber = 1,
|
||||
};
|
||||
// uint32 port = 1;
|
||||
void clear_port();
|
||||
uint32_t port() const;
|
||||
void set_port(uint32_t value);
|
||||
private:
|
||||
uint32_t _internal_port() const;
|
||||
void _internal_set_port(uint32_t value);
|
||||
public:
|
||||
|
||||
// @@protoc_insertion_point(class_scope:messages.pong.Pong)
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
typedef void InternalArenaConstructable_;
|
||||
typedef void DestructorSkippable_;
|
||||
struct Impl_ {
|
||||
uint32_t port_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
friend struct ::TableStruct_pong_2eproto;
|
||||
};
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // __GNUC__
|
||||
// Pong
|
||||
|
||||
// uint32 port = 1;
|
||||
inline void Pong::clear_port() {
|
||||
_impl_.port_ = 0u;
|
||||
}
|
||||
inline uint32_t Pong::_internal_port() const {
|
||||
return _impl_.port_;
|
||||
}
|
||||
inline uint32_t Pong::port() const {
|
||||
// @@protoc_insertion_point(field_get:messages.pong.Pong.port)
|
||||
return _internal_port();
|
||||
}
|
||||
inline void Pong::_internal_set_port(uint32_t value) {
|
||||
|
||||
_impl_.port_ = value;
|
||||
}
|
||||
inline void Pong::set_port(uint32_t value) {
|
||||
_internal_set_port(value);
|
||||
// @@protoc_insertion_point(field_set:messages.pong.Pong.port)
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace pong
|
||||
} // namespace messages
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_pong_2eproto
|
||||
14
include/WHISPER/Messages/Protos/pong.proto
Normal file
14
include/WHISPER/Messages/Protos/pong.proto
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
// [START declaration]
|
||||
syntax = "proto3";
|
||||
package messages.pong;
|
||||
|
||||
// import "google/protobuf/timestamp.proto";
|
||||
// [END declaration]
|
||||
|
||||
|
||||
// [START messages]
|
||||
message Pong {
|
||||
uint32 port = 1;
|
||||
}
|
||||
|
||||
297
include/WHISPER/Messages/Protos/stringData.pb.cc
Normal file
297
include/WHISPER/Messages/Protos/stringData.pb.cc
Normal file
@@ -0,0 +1,297 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: stringData.proto
|
||||
|
||||
#include "stringData.pb.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/wire_format_lite.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/reflection_ops.h>
|
||||
#include <google/protobuf/wire_format.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
|
||||
PROTOBUF_PRAGMA_INIT_SEG
|
||||
|
||||
namespace _pb = ::PROTOBUF_NAMESPACE_ID;
|
||||
namespace _pbi = _pb::internal;
|
||||
|
||||
namespace messages {
|
||||
namespace stringData {
|
||||
PROTOBUF_CONSTEXPR StringData::StringData(
|
||||
::_pbi::ConstantInitialized): _impl_{
|
||||
/*decltype(_impl_.data_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
|
||||
, /*decltype(_impl_._cached_size_)*/{}} {}
|
||||
struct StringDataDefaultTypeInternal {
|
||||
PROTOBUF_CONSTEXPR StringDataDefaultTypeInternal()
|
||||
: _instance(::_pbi::ConstantInitialized{}) {}
|
||||
~StringDataDefaultTypeInternal() {}
|
||||
union {
|
||||
StringData _instance;
|
||||
};
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 StringDataDefaultTypeInternal _StringData_default_instance_;
|
||||
} // namespace stringData
|
||||
} // namespace messages
|
||||
static ::_pb::Metadata file_level_metadata_stringData_2eproto[1];
|
||||
static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_stringData_2eproto = nullptr;
|
||||
static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_stringData_2eproto = nullptr;
|
||||
|
||||
const uint32_t TableStruct_stringData_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::messages::stringData::StringData, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
PROTOBUF_FIELD_OFFSET(::messages::stringData::StringData, _impl_.data_),
|
||||
};
|
||||
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{ 0, -1, -1, sizeof(::messages::stringData::StringData)},
|
||||
};
|
||||
|
||||
static const ::_pb::Message* const file_default_instances[] = {
|
||||
&::messages::stringData::_StringData_default_instance_._instance,
|
||||
};
|
||||
|
||||
const char descriptor_table_protodef_stringData_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\020stringData.proto\022\023messages.stringData\""
|
||||
"\032\n\nStringData\022\014\n\004data\030\001 \001(\tb\006proto3"
|
||||
;
|
||||
static ::_pbi::once_flag descriptor_table_stringData_2eproto_once;
|
||||
const ::_pbi::DescriptorTable descriptor_table_stringData_2eproto = {
|
||||
false, false, 75, descriptor_table_protodef_stringData_2eproto,
|
||||
"stringData.proto",
|
||||
&descriptor_table_stringData_2eproto_once, nullptr, 0, 1,
|
||||
schemas, file_default_instances, TableStruct_stringData_2eproto::offsets,
|
||||
file_level_metadata_stringData_2eproto, file_level_enum_descriptors_stringData_2eproto,
|
||||
file_level_service_descriptors_stringData_2eproto,
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_stringData_2eproto_getter() {
|
||||
return &descriptor_table_stringData_2eproto;
|
||||
}
|
||||
|
||||
// Force running AddDescriptors() at dynamic initialization time.
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_stringData_2eproto(&descriptor_table_stringData_2eproto);
|
||||
namespace messages {
|
||||
namespace stringData {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class StringData::_Internal {
|
||||
public:
|
||||
};
|
||||
|
||||
StringData::StringData(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
|
||||
SharedCtor(arena, is_message_owned);
|
||||
// @@protoc_insertion_point(arena_constructor:messages.stringData.StringData)
|
||||
}
|
||||
StringData::StringData(const StringData& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
StringData* const _this = this; (void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.data_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_impl_.data_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.data_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_data().empty()) {
|
||||
_this->_impl_.data_.Set(from._internal_data(),
|
||||
_this->GetArenaForAllocation());
|
||||
}
|
||||
// @@protoc_insertion_point(copy_constructor:messages.stringData.StringData)
|
||||
}
|
||||
|
||||
inline void StringData::SharedCtor(
|
||||
::_pb::Arena* arena, bool is_message_owned) {
|
||||
(void)arena;
|
||||
(void)is_message_owned;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.data_){}
|
||||
, /*decltype(_impl_._cached_size_)*/{}
|
||||
};
|
||||
_impl_.data_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.data_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
}
|
||||
|
||||
StringData::~StringData() {
|
||||
// @@protoc_insertion_point(destructor:messages.stringData.StringData)
|
||||
if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
|
||||
(void)arena;
|
||||
return;
|
||||
}
|
||||
SharedDtor();
|
||||
}
|
||||
|
||||
inline void StringData::SharedDtor() {
|
||||
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
|
||||
_impl_.data_.Destroy();
|
||||
}
|
||||
|
||||
void StringData::SetCachedSize(int size) const {
|
||||
_impl_._cached_size_.Set(size);
|
||||
}
|
||||
|
||||
void StringData::Clear() {
|
||||
// @@protoc_insertion_point(message_clear_start:messages.stringData.StringData)
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.data_.ClearToEmpty();
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* StringData::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
|
||||
while (!ctx->Done(&ptr)) {
|
||||
uint32_t tag;
|
||||
ptr = ::_pbi::ReadTag(ptr, &tag);
|
||||
switch (tag >> 3) {
|
||||
// string data = 1;
|
||||
case 1:
|
||||
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
|
||||
auto str = _internal_mutable_data();
|
||||
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
|
||||
CHK_(ptr);
|
||||
CHK_(::_pbi::VerifyUTF8(str, "messages.stringData.StringData.data"));
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
handle_unusual:
|
||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||
CHK_(ptr);
|
||||
ctx->SetLastTag(tag);
|
||||
goto message_done;
|
||||
}
|
||||
ptr = UnknownFieldParse(
|
||||
tag,
|
||||
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
|
||||
ptr, ctx);
|
||||
CHK_(ptr != nullptr);
|
||||
} // while
|
||||
message_done:
|
||||
return ptr;
|
||||
failure:
|
||||
ptr = nullptr;
|
||||
goto message_done;
|
||||
#undef CHK_
|
||||
}
|
||||
|
||||
uint8_t* StringData::_InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
|
||||
// @@protoc_insertion_point(serialize_to_array_start:messages.stringData.StringData)
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
// string data = 1;
|
||||
if (!this->_internal_data().empty()) {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
|
||||
this->_internal_data().data(), static_cast<int>(this->_internal_data().length()),
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
|
||||
"messages.stringData.StringData.data");
|
||||
target = stream->WriteStringMaybeAliased(
|
||||
1, this->_internal_data(), target);
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
|
||||
_internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
|
||||
}
|
||||
// @@protoc_insertion_point(serialize_to_array_end:messages.stringData.StringData)
|
||||
return target;
|
||||
}
|
||||
|
||||
size_t StringData::ByteSizeLong() const {
|
||||
// @@protoc_insertion_point(message_byte_size_start:messages.stringData.StringData)
|
||||
size_t total_size = 0;
|
||||
|
||||
uint32_t cached_has_bits = 0;
|
||||
// Prevent compiler warnings about cached_has_bits being unused
|
||||
(void) cached_has_bits;
|
||||
|
||||
// string data = 1;
|
||||
if (!this->_internal_data().empty()) {
|
||||
total_size += 1 +
|
||||
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
|
||||
this->_internal_data());
|
||||
}
|
||||
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
|
||||
}
|
||||
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData StringData::_class_data_ = {
|
||||
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
|
||||
StringData::MergeImpl
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*StringData::GetClassData() const { return &_class_data_; }
|
||||
|
||||
|
||||
void StringData::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<StringData*>(&to_msg);
|
||||
auto& from = static_cast<const StringData&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:messages.stringData.StringData)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
(void) cached_has_bits;
|
||||
|
||||
if (!from._internal_data().empty()) {
|
||||
_this->_internal_set_data(from._internal_data());
|
||||
}
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void StringData::CopyFrom(const StringData& from) {
|
||||
// @@protoc_insertion_point(class_specific_copy_from_start:messages.stringData.StringData)
|
||||
if (&from == this) return;
|
||||
Clear();
|
||||
MergeFrom(from);
|
||||
}
|
||||
|
||||
bool StringData::IsInitialized() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void StringData::InternalSwap(StringData* other) {
|
||||
using std::swap;
|
||||
auto* lhs_arena = GetArenaForAllocation();
|
||||
auto* rhs_arena = other->GetArenaForAllocation();
|
||||
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
|
||||
&_impl_.data_, lhs_arena,
|
||||
&other->_impl_.data_, rhs_arena
|
||||
);
|
||||
}
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata StringData::GetMetadata() const {
|
||||
return ::_pbi::AssignDescriptors(
|
||||
&descriptor_table_stringData_2eproto_getter, &descriptor_table_stringData_2eproto_once,
|
||||
file_level_metadata_stringData_2eproto[0]);
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace stringData
|
||||
} // namespace messages
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
template<> PROTOBUF_NOINLINE ::messages::stringData::StringData*
|
||||
Arena::CreateMaybeMessage< ::messages::stringData::StringData >(Arena* arena) {
|
||||
return Arena::CreateMessageInternal< ::messages::stringData::StringData >(arena);
|
||||
}
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
286
include/WHISPER/Messages/Protos/stringData.pb.h
Normal file
286
include/WHISPER/Messages/Protos/stringData.pb.h
Normal file
@@ -0,0 +1,286 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: stringData.proto
|
||||
|
||||
#ifndef GOOGLE_PROTOBUF_INCLUDED_stringData_2eproto
|
||||
#define GOOGLE_PROTOBUF_INCLUDED_stringData_2eproto
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#if PROTOBUF_VERSION < 3021000
|
||||
#error This file was generated by a newer version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please update
|
||||
#error your headers.
|
||||
#endif
|
||||
#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
|
||||
#error This file was generated by an older version of protoc which is
|
||||
#error incompatible with your Protocol Buffer headers. Please
|
||||
#error regenerate this file with a newer version of protoc.
|
||||
#endif
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/arena.h>
|
||||
#include <google/protobuf/arenastring.h>
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/metadata_lite.h>
|
||||
#include <google/protobuf/generated_message_reflection.h>
|
||||
#include <google/protobuf/message.h>
|
||||
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
|
||||
#include <google/protobuf/extension_set.h> // IWYU pragma: export
|
||||
#include <google/protobuf/unknown_field_set.h>
|
||||
// @@protoc_insertion_point(includes)
|
||||
#include <google/protobuf/port_def.inc>
|
||||
#define PROTOBUF_INTERNAL_EXPORT_stringData_2eproto
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
namespace internal {
|
||||
class AnyMetadata;
|
||||
} // namespace internal
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
|
||||
// Internal implementation detail -- do not use these members.
|
||||
struct TableStruct_stringData_2eproto {
|
||||
static const uint32_t offsets[];
|
||||
};
|
||||
extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_stringData_2eproto;
|
||||
namespace messages {
|
||||
namespace stringData {
|
||||
class StringData;
|
||||
struct StringDataDefaultTypeInternal;
|
||||
extern StringDataDefaultTypeInternal _StringData_default_instance_;
|
||||
} // namespace stringData
|
||||
} // namespace messages
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
template<> ::messages::stringData::StringData* Arena::CreateMaybeMessage<::messages::stringData::StringData>(Arena*);
|
||||
PROTOBUF_NAMESPACE_CLOSE
|
||||
namespace messages {
|
||||
namespace stringData {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class StringData final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:messages.stringData.StringData) */ {
|
||||
public:
|
||||
inline StringData() : StringData(nullptr) {}
|
||||
~StringData() override;
|
||||
explicit PROTOBUF_CONSTEXPR StringData(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
|
||||
|
||||
StringData(const StringData& from);
|
||||
StringData(StringData&& from) noexcept
|
||||
: StringData() {
|
||||
*this = ::std::move(from);
|
||||
}
|
||||
|
||||
inline StringData& operator=(const StringData& from) {
|
||||
CopyFrom(from);
|
||||
return *this;
|
||||
}
|
||||
inline StringData& operator=(StringData&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetOwningArena() == from.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetOwningArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
CopyFrom(from);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
|
||||
return GetDescriptor();
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
|
||||
return default_instance().GetMetadata().descriptor;
|
||||
}
|
||||
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
|
||||
return default_instance().GetMetadata().reflection;
|
||||
}
|
||||
static const StringData& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
static inline const StringData* internal_default_instance() {
|
||||
return reinterpret_cast<const StringData*>(
|
||||
&_StringData_default_instance_);
|
||||
}
|
||||
static constexpr int kIndexInFileMessages =
|
||||
0;
|
||||
|
||||
friend void swap(StringData& a, StringData& b) {
|
||||
a.Swap(&b);
|
||||
}
|
||||
inline void Swap(StringData* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
|
||||
}
|
||||
}
|
||||
void UnsafeArenaSwap(StringData* other) {
|
||||
if (other == this) return;
|
||||
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
|
||||
InternalSwap(other);
|
||||
}
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
|
||||
StringData* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<StringData>(arena);
|
||||
}
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const StringData& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom( const StringData& from) {
|
||||
StringData::MergeImpl(*this, from);
|
||||
}
|
||||
private:
|
||||
static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg);
|
||||
public:
|
||||
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
|
||||
bool IsInitialized() const final;
|
||||
|
||||
size_t ByteSizeLong() const final;
|
||||
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
|
||||
uint8_t* _InternalSerialize(
|
||||
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
|
||||
int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
|
||||
|
||||
private:
|
||||
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(StringData* other);
|
||||
|
||||
private:
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "messages.stringData.StringData";
|
||||
}
|
||||
protected:
|
||||
explicit StringData(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned = false);
|
||||
public:
|
||||
|
||||
static const ClassData _class_data_;
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
// accessors -------------------------------------------------------
|
||||
|
||||
enum : int {
|
||||
kDataFieldNumber = 1,
|
||||
};
|
||||
// string data = 1;
|
||||
void clear_data();
|
||||
const std::string& data() const;
|
||||
template <typename ArgT0 = const std::string&, typename... ArgT>
|
||||
void set_data(ArgT0&& arg0, ArgT... args);
|
||||
std::string* mutable_data();
|
||||
PROTOBUF_NODISCARD std::string* release_data();
|
||||
void set_allocated_data(std::string* data);
|
||||
private:
|
||||
const std::string& _internal_data() const;
|
||||
inline PROTOBUF_ALWAYS_INLINE void _internal_set_data(const std::string& value);
|
||||
std::string* _internal_mutable_data();
|
||||
public:
|
||||
|
||||
// @@protoc_insertion_point(class_scope:messages.stringData.StringData)
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
typedef void InternalArenaConstructable_;
|
||||
typedef void DestructorSkippable_;
|
||||
struct Impl_ {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr data_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
friend struct ::TableStruct_stringData_2eproto;
|
||||
};
|
||||
// ===================================================================
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // __GNUC__
|
||||
// StringData
|
||||
|
||||
// string data = 1;
|
||||
inline void StringData::clear_data() {
|
||||
_impl_.data_.ClearToEmpty();
|
||||
}
|
||||
inline const std::string& StringData::data() const {
|
||||
// @@protoc_insertion_point(field_get:messages.stringData.StringData.data)
|
||||
return _internal_data();
|
||||
}
|
||||
template <typename ArgT0, typename... ArgT>
|
||||
inline PROTOBUF_ALWAYS_INLINE
|
||||
void StringData::set_data(ArgT0&& arg0, ArgT... args) {
|
||||
|
||||
_impl_.data_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
|
||||
// @@protoc_insertion_point(field_set:messages.stringData.StringData.data)
|
||||
}
|
||||
inline std::string* StringData::mutable_data() {
|
||||
std::string* _s = _internal_mutable_data();
|
||||
// @@protoc_insertion_point(field_mutable:messages.stringData.StringData.data)
|
||||
return _s;
|
||||
}
|
||||
inline const std::string& StringData::_internal_data() const {
|
||||
return _impl_.data_.Get();
|
||||
}
|
||||
inline void StringData::_internal_set_data(const std::string& value) {
|
||||
|
||||
_impl_.data_.Set(value, GetArenaForAllocation());
|
||||
}
|
||||
inline std::string* StringData::_internal_mutable_data() {
|
||||
|
||||
return _impl_.data_.Mutable(GetArenaForAllocation());
|
||||
}
|
||||
inline std::string* StringData::release_data() {
|
||||
// @@protoc_insertion_point(field_release:messages.stringData.StringData.data)
|
||||
return _impl_.data_.Release();
|
||||
}
|
||||
inline void StringData::set_allocated_data(std::string* data) {
|
||||
if (data != nullptr) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
_impl_.data_.SetAllocated(data, GetArenaForAllocation());
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (_impl_.data_.IsDefault()) {
|
||||
_impl_.data_.Set("", GetArenaForAllocation());
|
||||
}
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
// @@protoc_insertion_point(field_set_allocated:messages.stringData.StringData.data)
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
|
||||
} // namespace stringData
|
||||
} // namespace messages
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
||||
|
||||
#include <google/protobuf/port_undef.inc>
|
||||
#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_stringData_2eproto
|
||||
14
include/WHISPER/Messages/Protos/stringData.proto
Normal file
14
include/WHISPER/Messages/Protos/stringData.proto
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
// [START declaration]
|
||||
syntax = "proto3";
|
||||
package messages.stringData;
|
||||
|
||||
// import "google/protobuf/timestamp.proto";
|
||||
// [END declaration]
|
||||
|
||||
|
||||
// [START messages]
|
||||
message StringData {
|
||||
string data = 1;
|
||||
}
|
||||
|
||||
24
include/WHISPER/Messages/stringData.hpp
Normal file
24
include/WHISPER/Messages/stringData.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <WHISPER/Messages/Message.hpp>
|
||||
#include <WHISPER/Messages/Protos/stringData.pb.h>
|
||||
#include <string>
|
||||
#include <loguru.hpp>
|
||||
|
||||
namespace WHISPER {
|
||||
|
||||
class StringData : public Message
|
||||
{
|
||||
private:
|
||||
messages::stringData::StringData message_;
|
||||
public:
|
||||
std::string data_;
|
||||
|
||||
StringData(std::string receivedMessage);
|
||||
|
||||
StringData(std::uint32_t parentID,std::uint32_t deviceID, SourceType src,std::string data);
|
||||
|
||||
};
|
||||
}
|
||||
@@ -37,6 +37,8 @@ namespace WHISPER
|
||||
private:
|
||||
/// device ID
|
||||
std::uint32_t ownID_;
|
||||
/// device ID
|
||||
std::uint32_t parentID_;
|
||||
/// device Type
|
||||
SourceType ownDeviceType_;
|
||||
|
||||
@@ -61,7 +63,7 @@ namespace WHISPER
|
||||
|
||||
|
||||
public:
|
||||
whispercomm(std::uint32_t id, SourceType owndevicetype):ownID_(id),ownDeviceType_(owndevicetype)
|
||||
whispercomm(std::uint32_t parentid,std::uint32_t id, SourceType owndevicetype):parentID_(parentid),ownID_(id),ownDeviceType_(owndevicetype)
|
||||
{};
|
||||
void connect(std::shared_ptr<threadSafeQueue<WHISPER::Message>> receiver);
|
||||
void publish(std::string msg,std::string topic);
|
||||
@@ -70,6 +72,7 @@ namespace WHISPER
|
||||
void unsubscribe(std::string topic);
|
||||
|
||||
std::uint32_t getOwnID();
|
||||
std::uint32_t getParentID();
|
||||
SourceType getOwnDeviceType();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "WHISPER/Messages/Join.hpp"
|
||||
#include "WHISPER/Messages/Leave.hpp"
|
||||
#include "WHISPER/Messages/Message.hpp"
|
||||
#include "WHISPER/Messages/Ping.hpp"
|
||||
#include "WHISPER/Messages/Pong.hpp"
|
||||
#include "WHISPER/whisper.hpp"
|
||||
#include <vector>
|
||||
#include <zmq.hpp>
|
||||
@@ -23,8 +25,8 @@
|
||||
namespace WHISPER {
|
||||
|
||||
|
||||
InternalUDPService::InternalUDPService(std::uint32_t id, SourceType owndevicetype,std::uint16_t port, std::string destinationAdress,std::string myAdress):
|
||||
whispercomm(id, owndevicetype),port_(port),destinationAdress_(destinationAdress),myAdress_(myAdress)
|
||||
InternalUDPService::InternalUDPService(std::uint32_t parentid,std::uint32_t id, SourceType owndevicetype,std::uint16_t port, std::string destinationAdress,std::string myAdress):
|
||||
whispercomm(parentid,id, owndevicetype),port_(port),destinationAdress_(destinationAdress),myAdress_(myAdress)
|
||||
{
|
||||
ctx = zmq::context_t(2);
|
||||
sender = zmq::socket_t(ctx,zmq::socket_type::radio);
|
||||
@@ -76,7 +78,7 @@ namespace WHISPER {
|
||||
|
||||
LOG_S(INFO)<<"own ID: "<< getOwnID();
|
||||
|
||||
WHISPER::Join join(getOwnID(),getOwnDeviceType(),ownReceivingPort_,myAdress_);
|
||||
WHISPER::Join join(getParentID(),getOwnID(),getOwnDeviceType(),ownReceivingPort_,myAdress_);
|
||||
this->publish(join.serialize(),WHISPER::MsgTopicsMap[WHISPER::MsgTopics::MANAGEMENT]);
|
||||
|
||||
|
||||
@@ -85,7 +87,7 @@ namespace WHISPER {
|
||||
|
||||
void InternalUDPService::derivedDisconnect()
|
||||
{
|
||||
WHISPER::Leave Leave(getOwnID(),getOwnDeviceType(),ownReceivingPort_,myAdress_);
|
||||
WHISPER::Leave Leave(getParentID(),getOwnID(),getOwnDeviceType(),ownReceivingPort_,myAdress_);
|
||||
this->publish(Leave.serialize(),WHISPER::MsgTopicsMap[(WHISPER::MsgTopics)Leave.topic_]);
|
||||
unsubscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::MANAGEMENT]);
|
||||
|
||||
@@ -168,6 +170,7 @@ namespace WHISPER {
|
||||
auto client = std::make_shared<localClient>();
|
||||
client->port = join.port;
|
||||
client->id = join.deviceId_;
|
||||
client->parentid = join.parentId_;
|
||||
client->addr = "udp://"+join.sourceAddr+":" + std::to_string(join.port);
|
||||
client->clientSocket = zmq::socket_t(ctx,zmq::socket_type::radio);
|
||||
|
||||
@@ -190,7 +193,7 @@ namespace WHISPER {
|
||||
if (localclients.size() > 0) {
|
||||
for (auto it = localclients.begin(); it != localclients.end();it++)
|
||||
{
|
||||
if (it->get()->port == Leave.port || it->get()->id == Leave.deviceId_) {
|
||||
if (it->get()->port == Leave.port || (it->get()->id == Leave.deviceId_ && it->get()->parentid == Leave.deviceId_)) {
|
||||
it->get()->clientSocket.close();
|
||||
it = localclients.erase(it);
|
||||
LOG_S(INFO)<<"client left";
|
||||
@@ -204,9 +207,24 @@ namespace WHISPER {
|
||||
|
||||
}else if(msgType == WHISPER::PING)
|
||||
{
|
||||
if (receivedMessage.deviceId_ != getOwnID() && receivedMessage.parentId_ != getParentID())
|
||||
{
|
||||
WHISPER::Pong pong(getParentID(),getOwnID(),getOwnDeviceType(),ownReceivingPort_);
|
||||
this->publish(pong.serialize(),WHISPER::MsgTopicsMap[WHISPER::MsgTopics::MANAGEMENT]);
|
||||
}
|
||||
|
||||
}else if(msgType == WHISPER::PONG)
|
||||
{
|
||||
WHISPER::Pong pong(message);
|
||||
|
||||
if (localclients.size() > 0) {
|
||||
for (auto it = localclients.begin(); it != localclients.end();it++)
|
||||
{
|
||||
if (pong.deviceId_ == it->get()->id && pong.parentId_ == it->get()->parentid) {
|
||||
it->get()->lastResponse = std::time(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
@@ -232,6 +250,7 @@ namespace WHISPER {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace WHISPER {
|
||||
msgType_ = msg.msgtype();
|
||||
joinMessage = messages::join::Join();
|
||||
deviceId_ = msg.sourceid();
|
||||
parentId_ = msg.parentid();
|
||||
|
||||
if ( msg.payload_size()) {
|
||||
if (msg.payload().begin()->Is<messages::join::Join>()) {
|
||||
@@ -26,7 +27,6 @@ namespace WHISPER {
|
||||
sourceAddr = joinMessage.srcaddress();
|
||||
|
||||
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
LOG_S(ERROR)<<e.what();
|
||||
}
|
||||
@@ -34,8 +34,8 @@ namespace WHISPER {
|
||||
}
|
||||
|
||||
|
||||
WHISPER::Join::Join(std::uint32_t deviceID, SourceType src,std::uint32_t port, std::string addr):
|
||||
Message(deviceID,WHISPER::MsgTopics::MANAGEMENT,WHISPER::JOIN,src),port(port),sourceAddr(addr)
|
||||
WHISPER::Join::Join(std::uint32_t parentID,std::uint32_t deviceID, SourceType src,std::uint32_t port, std::string addr):
|
||||
Message(parentID,deviceID,WHISPER::MsgTopics::MANAGEMENT,WHISPER::JOIN,src),port(port),sourceAddr(addr)
|
||||
{
|
||||
joinMessage = messages::join::Join();
|
||||
joinMessage.set_port(port);
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace WHISPER {
|
||||
topic_ = msg.topic();
|
||||
sourceType_ = msg.sourcetype();
|
||||
msgType_ = msg.msgtype();
|
||||
parentId_ = msg.parentid();
|
||||
|
||||
leaveMessage = messages::leave::Leave();
|
||||
|
||||
@@ -34,8 +35,8 @@ namespace WHISPER {
|
||||
}
|
||||
|
||||
|
||||
Leave::Leave(std::uint32_t deviceID, SourceType src,std::uint32_t port, std::string addr):
|
||||
Message(deviceID,WHISPER::MsgTopics::MANAGEMENT,WHISPER::LEAVE,src),port(port),sourceAddr(addr)
|
||||
Leave::Leave(std::uint32_t parentID,std::uint32_t deviceID, SourceType src,std::uint32_t port, std::string addr):
|
||||
Message(parentID,deviceID,WHISPER::MsgTopics::MANAGEMENT,WHISPER::LEAVE,src),port(port),sourceAddr(addr)
|
||||
{
|
||||
|
||||
leaveMessage = messages::leave::Leave();
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace WHISPER {
|
||||
topic_ = msg.topic();
|
||||
sourceType_ = msg.sourcetype();
|
||||
msgType_ = msg.msgtype();
|
||||
parentId_ = msg.parentid();
|
||||
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
@@ -27,7 +28,8 @@ namespace WHISPER {
|
||||
}
|
||||
|
||||
|
||||
Message::Message(std::int32_t deviceId, MsgTopics topic, MsgType Type,SourceType src):topic_(topic),sourceType_(src),msgType_(Type){
|
||||
Message::Message(std::uint32_t parentId,std::uint32_t deviceId, MsgTopics topic, MsgType Type,SourceType src):
|
||||
parentId_(parentId),deviceId_(deviceId),topic_(topic),sourceType_(src),msgType_(Type){
|
||||
msg = messages::header::Message();
|
||||
|
||||
if(msg.IsInitialized())
|
||||
@@ -36,11 +38,8 @@ namespace WHISPER {
|
||||
msg.set_topic(topic);
|
||||
msg.set_sourcetype(sourceType_);
|
||||
msg.set_msgtype(msgType_);
|
||||
msg.set_parentid(parentId);
|
||||
}
|
||||
deviceId_ = deviceId;
|
||||
topic_ = topic;
|
||||
sourceType_ = src;
|
||||
msgType_ = Type;
|
||||
|
||||
}
|
||||
|
||||
|
||||
54
src/WHISPER/Messages/Ping.cpp
Normal file
54
src/WHISPER/Messages/Ping.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
#include "WHISPER/Messages/Message.hpp"
|
||||
#include "WHISPER/Messages/Protos/ping.pb.h"
|
||||
#include <WHISPER/Messages/Ping.hpp>
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
||||
|
||||
namespace WHISPER {
|
||||
|
||||
Ping::Ping(std::string receivedMessage){
|
||||
msg = messages::header::Message();
|
||||
try {
|
||||
msg.ParseFromString(receivedMessage);
|
||||
topic_ = msg.topic();
|
||||
sourceType_ = msg.sourcetype();
|
||||
msgType_ = msg.msgtype();
|
||||
pingMessage = messages::ping::Ping();
|
||||
deviceId_ = msg.sourceid();
|
||||
parentId_ = msg.parentid();
|
||||
|
||||
if ( msg.payload_size()) {
|
||||
if (msg.payload().begin()->Is<messages::ping::Ping>()) {
|
||||
msg.payload().begin()->UnpackTo(&pingMessage);
|
||||
}
|
||||
}
|
||||
port_ = pingMessage.port();
|
||||
|
||||
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
LOG_S(ERROR)<<e.what();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
WHISPER::Ping::Ping(std::uint32_t parentID,std::uint32_t deviceID, SourceType src,std::uint32_t port):
|
||||
Message(parentID,deviceID,WHISPER::MsgTopics::MANAGEMENT,WHISPER::PING,src),port_(port)
|
||||
{
|
||||
pingMessage = messages::ping::Ping();
|
||||
pingMessage.set_port(port_);
|
||||
|
||||
auto payloadMessage = std::make_shared<google::protobuf::Any>();
|
||||
payloadMessage->PackFrom(pingMessage);
|
||||
addPayLoad(payloadMessage);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
56
src/WHISPER/Messages/Pong.cpp
Normal file
56
src/WHISPER/Messages/Pong.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "WHISPER/Messages/Message.hpp"
|
||||
#include "WHISPER/Messages/Protos/pong.pb.h"
|
||||
#include <WHISPER/Messages/Pong.hpp>
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
||||
|
||||
namespace WHISPER {
|
||||
|
||||
Pong::Pong(std::string receivedMessage){
|
||||
msg = messages::header::Message();
|
||||
try {
|
||||
msg.ParseFromString(receivedMessage);
|
||||
topic_ = msg.topic();
|
||||
sourceType_ = msg.sourcetype();
|
||||
msgType_ = msg.msgtype();
|
||||
message_ = messages::pong::Pong();
|
||||
deviceId_ = msg.sourceid();
|
||||
parentId_ = msg.parentid();
|
||||
|
||||
if ( msg.payload_size()) {
|
||||
if (msg.payload().begin()->Is<messages::pong::Pong>()) {
|
||||
msg.payload().begin()->UnpackTo(&message_);
|
||||
}
|
||||
}
|
||||
port_ = message_.port();
|
||||
|
||||
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
LOG_S(ERROR)<<e.what();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
WHISPER::Pong::Pong(std::uint32_t parentID,std::uint32_t deviceID, SourceType src,std::uint32_t port):
|
||||
Message(parentID,deviceID,WHISPER::MsgTopics::MANAGEMENT,WHISPER::PING,src),port_(port)
|
||||
{
|
||||
// message_ = messages::pong::Pong();
|
||||
if (message_.IsInitialized()) {
|
||||
message_.set_port(port_);
|
||||
}
|
||||
|
||||
auto payloadMessage = std::make_shared<google::protobuf::Any>();
|
||||
payloadMessage->PackFrom(message_);
|
||||
addPayLoad(payloadMessage);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
54
src/WHISPER/Messages/stringData.cpp
Normal file
54
src/WHISPER/Messages/stringData.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
#include "WHISPER/Messages/Message.hpp"
|
||||
#include "WHISPER/Messages/Protos/stringData.pb.h"
|
||||
#include <WHISPER/Messages/stringData.hpp>
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
||||
|
||||
namespace WHISPER {
|
||||
|
||||
StringData::StringData(std::string receivedMessage){
|
||||
msg = messages::header::Message();
|
||||
try {
|
||||
msg.ParseFromString(receivedMessage);
|
||||
topic_ = msg.topic();
|
||||
sourceType_ = msg.sourcetype();
|
||||
msgType_ = msg.msgtype();
|
||||
message_ = messages::stringData::StringData();
|
||||
deviceId_ = msg.sourceid();
|
||||
parentId_ = msg.parentid();
|
||||
|
||||
if ( msg.payload_size()) {
|
||||
if (msg.payload().begin()->Is<messages::stringData::StringData>()) {
|
||||
msg.payload().begin()->UnpackTo(&message_);
|
||||
}
|
||||
}
|
||||
data_ = message_.data();
|
||||
|
||||
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
LOG_S(ERROR)<<e.what();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
WHISPER::StringData::StringData(std::uint32_t parentID,std::uint32_t deviceID, SourceType src,std::string data):
|
||||
Message(parentID,deviceID,WHISPER::MsgTopics::DATA,WHISPER::STRINGDATA,src),data_(data)
|
||||
{
|
||||
message_ = messages::stringData::StringData();
|
||||
message_.set_data(data);
|
||||
|
||||
auto payloadMessage = std::make_shared<google::protobuf::Any>();
|
||||
payloadMessage->PackFrom(message_);
|
||||
addPayLoad(payloadMessage);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -24,6 +24,10 @@ namespace WHISPER
|
||||
return ownID_;
|
||||
}
|
||||
|
||||
std::uint32_t whispercomm::getParentID()
|
||||
{
|
||||
return parentID_;
|
||||
}
|
||||
|
||||
void whispercomm::connect(std::shared_ptr<threadSafeQueue<WHISPER::Message>> receiver)
|
||||
{
|
||||
|
||||
23
src/main.cpp
23
src/main.cpp
@@ -1,5 +1,6 @@
|
||||
#include "WHISPER/InternalUDPService.hpp"
|
||||
#include "WHISPER/Messages/Message.hpp"
|
||||
#include "WHISPER/Messages/stringData.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <loguru.hpp>
|
||||
@@ -43,14 +44,14 @@ int main()
|
||||
// WHISPER::Join join(1,1,WHISPER::SourceType::SHIP,8000,"192.168.1.178");
|
||||
|
||||
auto receiver = std::make_shared<WHISPER::threadSafeQueue<WHISPER::Message>>();
|
||||
WHISPER::InternalUDPService service(1,WHISPER::SHIP,8000,"192.168.0.255","192.168.1.178");
|
||||
WHISPER::InternalUDPService service(0,1,WHISPER::SHIP,8000,"127.0.0.255","127.0.0.1");
|
||||
service.connect(receiver);
|
||||
|
||||
service.subscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::DATA]);
|
||||
service.subscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::TRACK]);
|
||||
// service.subscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::TRACK]);
|
||||
|
||||
|
||||
// service.publish(join.serialize(), WHISPER::MsgTopicsMap[WHISPER::MsgTopics::MANAGEMENT]);
|
||||
WHISPER::StringData data(0,1,WHISPER::SHIP,"hello world");
|
||||
service.publish(data.serialize(), WHISPER::MsgTopicsMap[WHISPER::MsgTopics::DATA]);
|
||||
|
||||
|
||||
|
||||
@@ -61,18 +62,12 @@ int main()
|
||||
|
||||
// service.publish(RawTrack.serialize(),WHISPER::MsgTopicsMap[WHISPER::MsgTopics::TRACK]);
|
||||
|
||||
// while (running) {
|
||||
// // zmq::message_t msg(string.begin(),string.end());
|
||||
// // msg.set_group("data");
|
||||
// // sock.send(msg,zmq::send_flags::none);
|
||||
while (running) {
|
||||
service.publish(data.serialize(), WHISPER::MsgTopicsMap[WHISPER::MsgTopics::DATA]);
|
||||
|
||||
// // if (size != receiver->size()) {
|
||||
// // LOG_S(INFO)<<"received messages " << size;
|
||||
// // size = receiver->size();
|
||||
// // }
|
||||
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
// }
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
}
|
||||
|
||||
|
||||
service.disconnect();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "WHISPER/Messages/Message.hpp"
|
||||
#include "WHISPER/Messages/stringData.hpp"
|
||||
#include "zmq.hpp"
|
||||
#include <iostream>
|
||||
#include <loguru.hpp>
|
||||
@@ -47,7 +48,7 @@ int main()
|
||||
|
||||
|
||||
auto receiver = std::make_shared<WHISPER::threadSafeQueue<WHISPER::Message>>();
|
||||
WHISPER::InternalUDPService service(2,WHISPER::SHIP,8000,"192.168.0.255","192.168.1.178");
|
||||
WHISPER::InternalUDPService service(0,2,WHISPER::SHIP,8000,"127.0.0.255","127.0.0.1");
|
||||
|
||||
service.subscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::TRACK]);
|
||||
service.subscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::DATA]);
|
||||
@@ -67,14 +68,15 @@ int main()
|
||||
while (running) {
|
||||
if (msgcount != receiver->size()) {
|
||||
LOG_S(INFO)<<"received messages " << receiver->size();
|
||||
|
||||
auto received = receiver.get()->get();
|
||||
auto topic = received.topic_;
|
||||
LOG_S(INFO)<<"message type is: "<<received.msgType_;
|
||||
if (received.msgType_ == WHISPER::RAW_TRACK) {
|
||||
|
||||
|
||||
WHISPER::Message msg;
|
||||
auto received = receiver.get()->get(msg);
|
||||
if (received == true) {
|
||||
if (msg.msgType_ == WHISPER::MsgType::STRINGDATA) {
|
||||
WHISPER::StringData data(msg.serialize());
|
||||
LOG_S(INFO)<<data.data_;
|
||||
}
|
||||
}
|
||||
|
||||
msgcount = receiver->size();
|
||||
|
||||
// service.publish(received.serialize(), WHISPER::MsgTopicsMap[(WHISPER::MsgTopics)topic]);
|
||||
|
||||
@@ -34,7 +34,7 @@ SCENARIO("A test scenario","[keywords]")
|
||||
{
|
||||
GIVEN("Preliminaries")
|
||||
{
|
||||
WHISPER::InternalUDPService service(1,WHISPER::SourceType::SIMCOMTROLER,8000,"127.0.0.255","127.0.0.1");
|
||||
WHISPER::InternalUDPService service(0,1,WHISPER::SourceType::SIMCOMTROLER,8000,"127.0.0.255","127.0.0.1");
|
||||
auto receiver = std::make_shared<WHISPER::threadSafeQueue<WHISPER::Message>>();
|
||||
service.connect(receiver) ;
|
||||
// service.subscribe(WHISPER::MsgTopicsMap[WHISPER::MsgTopics::TRACK]);
|
||||
|
||||
Reference in New Issue
Block a user