working commit
This commit is contained in:
@@ -89,8 +89,9 @@ NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
sbin_PROGRAMS = helmetd$(EXEEXT)
|
||||
noinst_PROGRAMS = udpclient_test$(EXEEXT) service_test$(EXEEXT) \
|
||||
tunclient_test$(EXEEXT) message_test$(EXEEXT)
|
||||
noinst_PROGRAMS = tcpclient_test$(EXEEXT) udpclient_test$(EXEEXT) \
|
||||
service_test$(EXEEXT) tunclient_test$(EXEEXT) \
|
||||
message_test$(EXEEXT)
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
@@ -108,7 +109,8 @@ am__installdirs = "$(DESTDIR)$(sbindir)"
|
||||
PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS)
|
||||
am_helmetd_OBJECTS = helmetd.$(OBJEXT) tunclient.$(OBJEXT) \
|
||||
service.$(OBJEXT) interface.$(OBJEXT) hello.pb.$(OBJEXT) \
|
||||
udpclient.$(OBJEXT) resolver.$(OBJEXT) iprouter.$(OBJEXT)
|
||||
udpclient.$(OBJEXT) resolver.$(OBJEXT) iprouter.$(OBJEXT) \
|
||||
tcpclient.$(OBJEXT) rpcclient.$(OBJEXT)
|
||||
helmetd_OBJECTS = $(am_helmetd_OBJECTS)
|
||||
helmetd_LDADD = $(LDADD)
|
||||
am_message_test_OBJECTS = message_test.$(OBJEXT) hello.pb.$(OBJEXT)
|
||||
@@ -118,6 +120,10 @@ am_service_test_OBJECTS = service_test.$(OBJEXT) tunclient.$(OBJEXT) \
|
||||
service.$(OBJEXT) interface.$(OBJEXT)
|
||||
service_test_OBJECTS = $(am_service_test_OBJECTS)
|
||||
service_test_LDADD = $(LDADD)
|
||||
am_tcpclient_test_OBJECTS = resolver.$(OBJEXT) tcpclient.$(OBJEXT) \
|
||||
tcpclient_test.$(OBJEXT)
|
||||
tcpclient_test_OBJECTS = $(am_tcpclient_test_OBJECTS)
|
||||
tcpclient_test_LDADD = $(LDADD)
|
||||
am_tunclient_test_OBJECTS = tunclient_test.$(OBJEXT) \
|
||||
tunclient.$(OBJEXT) service.$(OBJEXT) interface.$(OBJEXT)
|
||||
tunclient_test_OBJECTS = $(am_tunclient_test_OBJECTS)
|
||||
@@ -167,11 +173,11 @@ am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(helmetd_SOURCES) $(message_test_SOURCES) \
|
||||
$(service_test_SOURCES) $(tunclient_test_SOURCES) \
|
||||
$(udpclient_test_SOURCES)
|
||||
$(service_test_SOURCES) $(tcpclient_test_SOURCES) \
|
||||
$(tunclient_test_SOURCES) $(udpclient_test_SOURCES)
|
||||
DIST_SOURCES = $(helmetd_SOURCES) $(message_test_SOURCES) \
|
||||
$(service_test_SOURCES) $(tunclient_test_SOURCES) \
|
||||
$(udpclient_test_SOURCES)
|
||||
$(service_test_SOURCES) $(tcpclient_test_SOURCES) \
|
||||
$(tunclient_test_SOURCES) $(udpclient_test_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
@@ -251,7 +257,7 @@ INSTALL_SCRIPT = ${INSTALL}
|
||||
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
|
||||
LDFLAGS = -pthread
|
||||
LIBOBJS =
|
||||
LIBS = -Wl,--as-need -lprotobuf-lite
|
||||
LIBS = -Wl,--as-need -lprotobuf
|
||||
LTLIBOBJS =
|
||||
MAKEINFO = ${SHELL} '/home/ziggi/Projects/tcpserv09/missing' makeinfo
|
||||
MKDIR_P = /bin/mkdir -p
|
||||
@@ -324,7 +330,9 @@ helmetd_SOURCES = helmetd.cpp \
|
||||
hello.pb.cc hello.pb.h \
|
||||
udpclient.cpp udpclient.hpp \
|
||||
resolver.cpp resolver.hpp \
|
||||
iprouter.cpp iprouter.hpp
|
||||
iprouter.cpp iprouter.hpp \
|
||||
tcpclient.cpp tcpclient.hpp \
|
||||
rpcclient.cpp rpcclient.hpp
|
||||
|
||||
tunclient_test_SOURCES = tunclient_test.cpp \
|
||||
tunclient.cpp tunclient.hpp \
|
||||
@@ -341,6 +349,11 @@ udpclient_test_SOURCES = \
|
||||
udpclient.cpp udpclient.hpp \
|
||||
udpclient_test.cpp
|
||||
|
||||
tcpclient_test_SOURCES = \
|
||||
resolver.cpp resolver.hpp \
|
||||
tcpclient.cpp tcpclient.hpp \
|
||||
tcpclient_test.cpp
|
||||
|
||||
message_test_SOURCES = message_test.cpp \
|
||||
hello.pb.cc hello.pb.h
|
||||
|
||||
@@ -456,6 +469,10 @@ service_test$(EXEEXT): $(service_test_OBJECTS) $(service_test_DEPENDENCIES) $(EX
|
||||
@rm -f service_test$(EXEEXT)
|
||||
$(AM_V_CXXLD)$(CXXLINK) $(service_test_OBJECTS) $(service_test_LDADD) $(LIBS)
|
||||
|
||||
tcpclient_test$(EXEEXT): $(tcpclient_test_OBJECTS) $(tcpclient_test_DEPENDENCIES) $(EXTRA_tcpclient_test_DEPENDENCIES)
|
||||
@rm -f tcpclient_test$(EXEEXT)
|
||||
$(AM_V_CXXLD)$(CXXLINK) $(tcpclient_test_OBJECTS) $(tcpclient_test_LDADD) $(LIBS)
|
||||
|
||||
tunclient_test$(EXEEXT): $(tunclient_test_OBJECTS) $(tunclient_test_DEPENDENCIES) $(EXTRA_tunclient_test_DEPENDENCIES)
|
||||
@rm -f tunclient_test$(EXEEXT)
|
||||
$(AM_V_CXXLD)$(CXXLINK) $(tunclient_test_OBJECTS) $(tunclient_test_LDADD) $(LIBS)
|
||||
|
||||
+12
-2
@@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies no-installinfo subdir-objects
|
||||
|
||||
CXXFLAGS = -std=c++23 -Wall -I. -pthread -D_GNU_SOURCE=1
|
||||
LDFLAGS = -pthread
|
||||
LIBS = -Wl,--as-need -lprotobuf-lite
|
||||
LIBS = -Wl,--as-need -lprotobuf
|
||||
|
||||
sbin_PROGRAMS = helmetd
|
||||
|
||||
@@ -14,9 +14,13 @@ helmetd_SOURCES = helmetd.cpp \
|
||||
hello.pb.cc hello.pb.h \
|
||||
udpclient.cpp udpclient.hpp \
|
||||
resolver.cpp resolver.hpp \
|
||||
iprouter.cpp iprouter.hpp
|
||||
iprouter.cpp iprouter.hpp \
|
||||
tcpclient.cpp tcpclient.hpp \
|
||||
rpcclient.cpp rpcclient.hpp
|
||||
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
tcpclient_test \
|
||||
udpclient_test \
|
||||
service_test \
|
||||
tunclient_test \
|
||||
@@ -38,6 +42,12 @@ udpclient_test_SOURCES = \
|
||||
udpclient.cpp udpclient.hpp \
|
||||
udpclient_test.cpp
|
||||
|
||||
tcpclient_test_SOURCES = \
|
||||
resolver.cpp resolver.hpp \
|
||||
tcpclient.cpp tcpclient.hpp \
|
||||
tcpclient_test.cpp
|
||||
|
||||
|
||||
message_test_SOURCES = message_test.cpp \
|
||||
hello.pb.cc hello.pb.h
|
||||
|
||||
|
||||
+26
-9
@@ -89,8 +89,9 @@ NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
sbin_PROGRAMS = helmetd$(EXEEXT)
|
||||
noinst_PROGRAMS = udpclient_test$(EXEEXT) service_test$(EXEEXT) \
|
||||
tunclient_test$(EXEEXT) message_test$(EXEEXT)
|
||||
noinst_PROGRAMS = tcpclient_test$(EXEEXT) udpclient_test$(EXEEXT) \
|
||||
service_test$(EXEEXT) tunclient_test$(EXEEXT) \
|
||||
message_test$(EXEEXT)
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
@@ -108,7 +109,8 @@ am__installdirs = "$(DESTDIR)$(sbindir)"
|
||||
PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS)
|
||||
am_helmetd_OBJECTS = helmetd.$(OBJEXT) tunclient.$(OBJEXT) \
|
||||
service.$(OBJEXT) interface.$(OBJEXT) hello.pb.$(OBJEXT) \
|
||||
udpclient.$(OBJEXT) resolver.$(OBJEXT) iprouter.$(OBJEXT)
|
||||
udpclient.$(OBJEXT) resolver.$(OBJEXT) iprouter.$(OBJEXT) \
|
||||
tcpclient.$(OBJEXT) rpcclient.$(OBJEXT)
|
||||
helmetd_OBJECTS = $(am_helmetd_OBJECTS)
|
||||
helmetd_LDADD = $(LDADD)
|
||||
am_message_test_OBJECTS = message_test.$(OBJEXT) hello.pb.$(OBJEXT)
|
||||
@@ -118,6 +120,10 @@ am_service_test_OBJECTS = service_test.$(OBJEXT) tunclient.$(OBJEXT) \
|
||||
service.$(OBJEXT) interface.$(OBJEXT)
|
||||
service_test_OBJECTS = $(am_service_test_OBJECTS)
|
||||
service_test_LDADD = $(LDADD)
|
||||
am_tcpclient_test_OBJECTS = resolver.$(OBJEXT) tcpclient.$(OBJEXT) \
|
||||
tcpclient_test.$(OBJEXT)
|
||||
tcpclient_test_OBJECTS = $(am_tcpclient_test_OBJECTS)
|
||||
tcpclient_test_LDADD = $(LDADD)
|
||||
am_tunclient_test_OBJECTS = tunclient_test.$(OBJEXT) \
|
||||
tunclient.$(OBJEXT) service.$(OBJEXT) interface.$(OBJEXT)
|
||||
tunclient_test_OBJECTS = $(am_tunclient_test_OBJECTS)
|
||||
@@ -167,11 +173,11 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(helmetd_SOURCES) $(message_test_SOURCES) \
|
||||
$(service_test_SOURCES) $(tunclient_test_SOURCES) \
|
||||
$(udpclient_test_SOURCES)
|
||||
$(service_test_SOURCES) $(tcpclient_test_SOURCES) \
|
||||
$(tunclient_test_SOURCES) $(udpclient_test_SOURCES)
|
||||
DIST_SOURCES = $(helmetd_SOURCES) $(message_test_SOURCES) \
|
||||
$(service_test_SOURCES) $(tunclient_test_SOURCES) \
|
||||
$(udpclient_test_SOURCES)
|
||||
$(service_test_SOURCES) $(tcpclient_test_SOURCES) \
|
||||
$(tunclient_test_SOURCES) $(udpclient_test_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
@@ -251,7 +257,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = -pthread
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = -Wl,--as-need -lprotobuf-lite
|
||||
LIBS = -Wl,--as-need -lprotobuf
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
@@ -324,7 +330,9 @@ helmetd_SOURCES = helmetd.cpp \
|
||||
hello.pb.cc hello.pb.h \
|
||||
udpclient.cpp udpclient.hpp \
|
||||
resolver.cpp resolver.hpp \
|
||||
iprouter.cpp iprouter.hpp
|
||||
iprouter.cpp iprouter.hpp \
|
||||
tcpclient.cpp tcpclient.hpp \
|
||||
rpcclient.cpp rpcclient.hpp
|
||||
|
||||
tunclient_test_SOURCES = tunclient_test.cpp \
|
||||
tunclient.cpp tunclient.hpp \
|
||||
@@ -341,6 +349,11 @@ udpclient_test_SOURCES = \
|
||||
udpclient.cpp udpclient.hpp \
|
||||
udpclient_test.cpp
|
||||
|
||||
tcpclient_test_SOURCES = \
|
||||
resolver.cpp resolver.hpp \
|
||||
tcpclient.cpp tcpclient.hpp \
|
||||
tcpclient_test.cpp
|
||||
|
||||
message_test_SOURCES = message_test.cpp \
|
||||
hello.pb.cc hello.pb.h
|
||||
|
||||
@@ -456,6 +469,10 @@ service_test$(EXEEXT): $(service_test_OBJECTS) $(service_test_DEPENDENCIES) $(EX
|
||||
@rm -f service_test$(EXEEXT)
|
||||
$(AM_V_CXXLD)$(CXXLINK) $(service_test_OBJECTS) $(service_test_LDADD) $(LIBS)
|
||||
|
||||
tcpclient_test$(EXEEXT): $(tcpclient_test_OBJECTS) $(tcpclient_test_DEPENDENCIES) $(EXTRA_tcpclient_test_DEPENDENCIES)
|
||||
@rm -f tcpclient_test$(EXEEXT)
|
||||
$(AM_V_CXXLD)$(CXXLINK) $(tcpclient_test_OBJECTS) $(tcpclient_test_LDADD) $(LIBS)
|
||||
|
||||
tunclient_test$(EXEEXT): $(tunclient_test_OBJECTS) $(tunclient_test_DEPENDENCIES) $(EXTRA_tunclient_test_DEPENDENCIES)
|
||||
@rm -f tunclient_test$(EXEEXT)
|
||||
$(AM_V_CXXLD)$(CXXLINK) $(tunclient_test_OBJECTS) $(tunclient_test_LDADD) $(LIBS)
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
|
||||
extern "C" {
|
||||
#include <arpa/inet.h>
|
||||
}
|
||||
|
||||
#include <expected>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <format>
|
||||
#include <cstdint>
|
||||
|
||||
#include <header.hpp>
|
||||
|
||||
Header::Header(const uint32_t ipSize) {
|
||||
pSize = ipSize;
|
||||
}
|
||||
|
||||
Header::Header(void) {
|
||||
pSize = 0;
|
||||
}
|
||||
|
||||
std::string Header::Encode() {
|
||||
std::string buffer, tmp;
|
||||
auto magic = htonl(MAGIC);
|
||||
tmp = std::string(reinterpret_cast<const char*>(&magic), sizeof(magic));
|
||||
buffer.append(tmp);
|
||||
|
||||
auto size = htonl(pSize);
|
||||
tmp = std::string(reinterpret_cast<const char*>(&size), sizeof(size));
|
||||
buffer.append(tmp);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
std::expected<void, std::string> Header::Decode(const std::string rawHeader) {
|
||||
uint32_t tmp;
|
||||
std::memcpy(&tmp, rawHeader.data(), sizeof(uint32_t));
|
||||
auto magic = ntohl(tmp);
|
||||
if (magic != MAGIC) {
|
||||
return std::unexpected("Wrong magic code");
|
||||
}
|
||||
std::memcpy(&tmp, rawHeader.data() + sizeof(uint32_t), sizeof(uint32_t));
|
||||
pSize = ntohl(tmp);
|
||||
return {};
|
||||
}
|
||||
|
||||
uint32_t Header::PacketSize() {
|
||||
return pSize;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
const uint32_t MAGIC = 0xABBA;
|
||||
|
||||
class Header {
|
||||
private:
|
||||
uint32_t pSize = 0;
|
||||
public:
|
||||
Header(const uint32_t pSize);
|
||||
Header(void);
|
||||
std::string Encode(void);
|
||||
std::expected<void, std::string> Decode(const std::string buffer);
|
||||
uint32_t PacketSize(void);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
#include <expected>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <format>
|
||||
|
||||
#include <header.hpp>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
uint32_t size =
|
||||
Header primary(1021);
|
||||
auto rawHeader = primary.Encode();
|
||||
|
||||
Header second;
|
||||
second.Decode(rawHeader);
|
||||
|
||||
std::cout << std::format("{}\n", second.PacketSize());
|
||||
assert
|
||||
}
|
||||
+180
-102
@@ -8,7 +8,10 @@
|
||||
#include <google/protobuf/io/coded_stream.h>
|
||||
#include <google/protobuf/extension_set.h>
|
||||
#include <google/protobuf/wire_format_lite.h>
|
||||
#include <google/protobuf/io/zero_copy_stream_impl_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>
|
||||
|
||||
@@ -60,12 +63,74 @@ struct HelloDefaultTypeInternal {
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 HelloDefaultTypeInternal _Hello_default_instance_;
|
||||
} // namespace control
|
||||
static ::_pb::Metadata file_level_metadata_hello_2eproto[3];
|
||||
static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_hello_2eproto = nullptr;
|
||||
static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_hello_2eproto = nullptr;
|
||||
|
||||
const uint32_t TableStruct_hello_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::control::Header, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
PROTOBUF_FIELD_OFFSET(::control::Header, _impl_.meta_),
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::control::Meta, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
PROTOBUF_FIELD_OFFSET(::control::Meta, _impl_.rpcname_),
|
||||
~0u, // no _has_bits_
|
||||
PROTOBUF_FIELD_OFFSET(::control::Hello, _internal_metadata_),
|
||||
~0u, // no _extensions_
|
||||
~0u, // no _oneof_case_
|
||||
~0u, // no _weak_field_map_
|
||||
~0u, // no _inlined_string_donated_
|
||||
PROTOBUF_FIELD_OFFSET(::control::Hello, _impl_.meta_),
|
||||
PROTOBUF_FIELD_OFFSET(::control::Hello, _impl_.id_),
|
||||
PROTOBUF_FIELD_OFFSET(::control::Hello, _impl_.name_),
|
||||
};
|
||||
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
|
||||
{ 0, -1, -1, sizeof(::control::Header)},
|
||||
{ 7, -1, -1, sizeof(::control::Meta)},
|
||||
{ 14, -1, -1, sizeof(::control::Hello)},
|
||||
};
|
||||
|
||||
static const ::_pb::Message* const file_default_instances[] = {
|
||||
&::control::_Header_default_instance_._instance,
|
||||
&::control::_Meta_default_instance_._instance,
|
||||
&::control::_Hello_default_instance_._instance,
|
||||
};
|
||||
|
||||
const char descriptor_table_protodef_hello_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
|
||||
"\n\013hello.proto\022\007control\"%\n\006Header\022\033\n\004meta"
|
||||
"\030\001 \001(\0132\r.control.Meta\"\027\n\004Meta\022\017\n\007rpcname"
|
||||
"\030\001 \001(\t\">\n\005Hello\022\033\n\004meta\030\001 \001(\0132\r.control."
|
||||
"Meta\022\n\n\002id\030\002 \001(\005\022\014\n\004name\030\003 \001(\tb\006proto3"
|
||||
;
|
||||
static ::_pbi::once_flag descriptor_table_hello_2eproto_once;
|
||||
const ::_pbi::DescriptorTable descriptor_table_hello_2eproto = {
|
||||
false, false, 158, descriptor_table_protodef_hello_2eproto,
|
||||
"hello.proto",
|
||||
&descriptor_table_hello_2eproto_once, nullptr, 0, 3,
|
||||
schemas, file_default_instances, TableStruct_hello_2eproto::offsets,
|
||||
file_level_metadata_hello_2eproto, file_level_enum_descriptors_hello_2eproto,
|
||||
file_level_service_descriptors_hello_2eproto,
|
||||
};
|
||||
PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_hello_2eproto_getter() {
|
||||
return &descriptor_table_hello_2eproto;
|
||||
}
|
||||
|
||||
// Force running AddDescriptors() at dynamic initialization time.
|
||||
PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_hello_2eproto(&descriptor_table_hello_2eproto);
|
||||
namespace control {
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class Header::_Internal {
|
||||
public:
|
||||
public:
|
||||
static const ::control::Meta& meta(const Header* msg);
|
||||
};
|
||||
|
||||
@@ -75,18 +140,21 @@ Header::_Internal::meta(const Header* msg) {
|
||||
}
|
||||
Header::Header(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned)
|
||||
: ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
|
||||
SharedCtor(arena, is_message_owned);
|
||||
// @@protoc_insertion_point(arena_constructor:control.Header)
|
||||
}
|
||||
Header::Header(const Header& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::MessageLite() {
|
||||
Header* const _this = this; (void)_this;
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Header* const _this = this;
|
||||
(void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.meta_){nullptr}
|
||||
decltype(_impl_.meta_) {
|
||||
nullptr
|
||||
}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
if (from._internal_has_meta()) {
|
||||
_this->_impl_.meta_ = new ::control::Meta(*from._impl_.meta_);
|
||||
}
|
||||
@@ -98,14 +166,16 @@ inline void Header::SharedCtor(
|
||||
(void)arena;
|
||||
(void)is_message_owned;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.meta_){nullptr}
|
||||
decltype(_impl_.meta_) {
|
||||
nullptr
|
||||
}
|
||||
, /*decltype(_impl_._cached_size_)*/{}
|
||||
};
|
||||
}
|
||||
|
||||
Header::~Header() {
|
||||
// @@protoc_insertion_point(destructor:control.Header)
|
||||
if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
|
||||
if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
|
||||
(void)arena;
|
||||
return;
|
||||
}
|
||||
@@ -131,7 +201,7 @@ void Header::Clear() {
|
||||
delete _impl_.meta_;
|
||||
}
|
||||
_impl_.meta_ = nullptr;
|
||||
_internal_metadata_.Clear<std::string>();
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* Header::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
@@ -151,7 +221,7 @@ const char* Header::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
handle_unusual:
|
||||
handle_unusual:
|
||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||
CHK_(ptr);
|
||||
ctx->SetLastTag(tag);
|
||||
@@ -159,7 +229,7 @@ const char* Header::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
}
|
||||
ptr = UnknownFieldParse(
|
||||
tag,
|
||||
_internal_metadata_.mutable_unknown_fields<std::string>(),
|
||||
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
|
||||
ptr, ctx);
|
||||
CHK_(ptr != nullptr);
|
||||
} // while
|
||||
@@ -185,8 +255,8 @@ uint8_t* Header::_InternalSerialize(
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
|
||||
static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
|
||||
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:control.Header)
|
||||
return target;
|
||||
@@ -207,22 +277,21 @@ size_t Header::ByteSizeLong() const {
|
||||
*_impl_.meta_);
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
|
||||
}
|
||||
int cached_size = ::_pbi::ToCachedSize(total_size);
|
||||
SetCachedSize(cached_size);
|
||||
return total_size;
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
|
||||
}
|
||||
|
||||
void Header::CheckTypeAndMergeFrom(
|
||||
const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
|
||||
MergeFrom(*::_pbi::DownCast<const Header*>(
|
||||
&from));
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Header::_class_data_ = {
|
||||
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
|
||||
Header::MergeImpl
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Header::GetClassData() const {
|
||||
return &_class_data_;
|
||||
}
|
||||
|
||||
void Header::MergeFrom(const Header& from) {
|
||||
Header* const _this = this;
|
||||
|
||||
void Header::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Header*>(&to_msg);
|
||||
auto& from = static_cast<const Header&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:control.Header)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
@@ -232,7 +301,7 @@ void Header::MergeFrom(const Header& from) {
|
||||
_this->_internal_mutable_meta()->::control::Meta::MergeFrom(
|
||||
from._internal_meta());
|
||||
}
|
||||
_this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Header::CopyFrom(const Header& from) {
|
||||
@@ -252,35 +321,37 @@ void Header::InternalSwap(Header* other) {
|
||||
swap(_impl_.meta_, other->_impl_.meta_);
|
||||
}
|
||||
|
||||
std::string Header::GetTypeName() const {
|
||||
return "control.Header";
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata Header::GetMetadata() const {
|
||||
return ::_pbi::AssignDescriptors(
|
||||
&descriptor_table_hello_2eproto_getter, &descriptor_table_hello_2eproto_once,
|
||||
file_level_metadata_hello_2eproto[0]);
|
||||
}
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class Meta::_Internal {
|
||||
public:
|
||||
public:
|
||||
};
|
||||
|
||||
Meta::Meta(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned)
|
||||
: ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
|
||||
SharedCtor(arena, is_message_owned);
|
||||
// @@protoc_insertion_point(arena_constructor:control.Meta)
|
||||
}
|
||||
Meta::Meta(const Meta& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::MessageLite() {
|
||||
Meta* const _this = this; (void)_this;
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Meta* const _this = this;
|
||||
(void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.rpcname_){}
|
||||
decltype(_impl_.rpcname_) {}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_impl_.rpcname_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.rpcname_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_rpcname().empty()) {
|
||||
_this->_impl_.rpcname_.Set(from._internal_rpcname(),
|
||||
_this->GetArenaForAllocation());
|
||||
@@ -293,18 +364,18 @@ inline void Meta::SharedCtor(
|
||||
(void)arena;
|
||||
(void)is_message_owned;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.rpcname_){}
|
||||
decltype(_impl_.rpcname_) {}
|
||||
, /*decltype(_impl_._cached_size_)*/{}
|
||||
};
|
||||
_impl_.rpcname_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.rpcname_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
}
|
||||
|
||||
Meta::~Meta() {
|
||||
// @@protoc_insertion_point(destructor:control.Meta)
|
||||
if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
|
||||
if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
|
||||
(void)arena;
|
||||
return;
|
||||
}
|
||||
@@ -327,7 +398,7 @@ void Meta::Clear() {
|
||||
(void) cached_has_bits;
|
||||
|
||||
_impl_.rpcname_.ClearToEmpty();
|
||||
_internal_metadata_.Clear<std::string>();
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* Meta::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
@@ -342,14 +413,14 @@ const char* Meta::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
auto str = _internal_mutable_rpcname();
|
||||
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
|
||||
CHK_(ptr);
|
||||
CHK_(::_pbi::VerifyUTF8(str, nullptr));
|
||||
CHK_(::_pbi::VerifyUTF8(str, "control.Meta.rpcname"));
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
handle_unusual:
|
||||
handle_unusual:
|
||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||
CHK_(ptr);
|
||||
ctx->SetLastTag(tag);
|
||||
@@ -357,7 +428,7 @@ const char* Meta::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
}
|
||||
ptr = UnknownFieldParse(
|
||||
tag,
|
||||
_internal_metadata_.mutable_unknown_fields<std::string>(),
|
||||
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
|
||||
ptr, ctx);
|
||||
CHK_(ptr != nullptr);
|
||||
} // while
|
||||
@@ -386,8 +457,8 @@ uint8_t* Meta::_InternalSerialize(
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
|
||||
static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
|
||||
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:control.Meta)
|
||||
return target;
|
||||
@@ -408,22 +479,21 @@ size_t Meta::ByteSizeLong() const {
|
||||
this->_internal_rpcname());
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
|
||||
}
|
||||
int cached_size = ::_pbi::ToCachedSize(total_size);
|
||||
SetCachedSize(cached_size);
|
||||
return total_size;
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
|
||||
}
|
||||
|
||||
void Meta::CheckTypeAndMergeFrom(
|
||||
const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
|
||||
MergeFrom(*::_pbi::DownCast<const Meta*>(
|
||||
&from));
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Meta::_class_data_ = {
|
||||
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
|
||||
Meta::MergeImpl
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Meta::GetClassData() const {
|
||||
return &_class_data_;
|
||||
}
|
||||
|
||||
void Meta::MergeFrom(const Meta& from) {
|
||||
Meta* const _this = this;
|
||||
|
||||
void Meta::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Meta*>(&to_msg);
|
||||
auto& from = static_cast<const Meta&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:control.Meta)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
@@ -432,7 +502,7 @@ void Meta::MergeFrom(const Meta& from) {
|
||||
if (!from._internal_rpcname().empty()) {
|
||||
_this->_internal_set_rpcname(from._internal_rpcname());
|
||||
}
|
||||
_this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Meta::CopyFrom(const Meta& from) {
|
||||
@@ -457,15 +527,16 @@ void Meta::InternalSwap(Meta* other) {
|
||||
);
|
||||
}
|
||||
|
||||
std::string Meta::GetTypeName() const {
|
||||
return "control.Meta";
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata Meta::GetMetadata() const {
|
||||
return ::_pbi::AssignDescriptors(
|
||||
&descriptor_table_hello_2eproto_getter, &descriptor_table_hello_2eproto_once,
|
||||
file_level_metadata_hello_2eproto[1]);
|
||||
}
|
||||
|
||||
|
||||
// ===================================================================
|
||||
|
||||
class Hello::_Internal {
|
||||
public:
|
||||
public:
|
||||
static const ::control::Meta& meta(const Hello* msg);
|
||||
};
|
||||
|
||||
@@ -475,24 +546,27 @@ Hello::_Internal::meta(const Hello* msg) {
|
||||
}
|
||||
Hello::Hello(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned)
|
||||
: ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
|
||||
SharedCtor(arena, is_message_owned);
|
||||
// @@protoc_insertion_point(arena_constructor:control.Hello)
|
||||
}
|
||||
Hello::Hello(const Hello& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::MessageLite() {
|
||||
Hello* const _this = this; (void)_this;
|
||||
: ::PROTOBUF_NAMESPACE_ID::Message() {
|
||||
Hello* const _this = this;
|
||||
(void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.name_){}
|
||||
, decltype(_impl_.meta_){nullptr}
|
||||
, decltype(_impl_.id_){}
|
||||
decltype(_impl_.name_) {}
|
||||
, decltype(_impl_.meta_) {
|
||||
nullptr
|
||||
}
|
||||
, decltype(_impl_.id_) {}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
|
||||
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
_impl_.name_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_name().empty()) {
|
||||
_this->_impl_.name_.Set(from._internal_name(),
|
||||
_this->GetArenaForAllocation());
|
||||
@@ -509,20 +583,24 @@ inline void Hello::SharedCtor(
|
||||
(void)arena;
|
||||
(void)is_message_owned;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.name_){}
|
||||
, decltype(_impl_.meta_){nullptr}
|
||||
, decltype(_impl_.id_){0}
|
||||
decltype(_impl_.name_) {}
|
||||
, decltype(_impl_.meta_) {
|
||||
nullptr
|
||||
}
|
||||
, decltype(_impl_.id_) {
|
||||
0
|
||||
}
|
||||
, /*decltype(_impl_._cached_size_)*/{}
|
||||
};
|
||||
_impl_.name_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
}
|
||||
|
||||
Hello::~Hello() {
|
||||
// @@protoc_insertion_point(destructor:control.Hello)
|
||||
if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
|
||||
if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
|
||||
(void)arena;
|
||||
return;
|
||||
}
|
||||
@@ -551,7 +629,7 @@ void Hello::Clear() {
|
||||
}
|
||||
_impl_.meta_ = nullptr;
|
||||
_impl_.id_ = 0;
|
||||
_internal_metadata_.Clear<std::string>();
|
||||
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
|
||||
}
|
||||
|
||||
const char* Hello::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
@@ -582,14 +660,14 @@ const char* Hello::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
auto str = _internal_mutable_name();
|
||||
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
|
||||
CHK_(ptr);
|
||||
CHK_(::_pbi::VerifyUTF8(str, nullptr));
|
||||
CHK_(::_pbi::VerifyUTF8(str, "control.Hello.name"));
|
||||
} else
|
||||
goto handle_unusual;
|
||||
continue;
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
handle_unusual:
|
||||
handle_unusual:
|
||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||
CHK_(ptr);
|
||||
ctx->SetLastTag(tag);
|
||||
@@ -597,7 +675,7 @@ const char* Hello::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
}
|
||||
ptr = UnknownFieldParse(
|
||||
tag,
|
||||
_internal_metadata_.mutable_unknown_fields<std::string>(),
|
||||
_internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
|
||||
ptr, ctx);
|
||||
CHK_(ptr != nullptr);
|
||||
} // while
|
||||
@@ -639,8 +717,8 @@ uint8_t* Hello::_InternalSerialize(
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
|
||||
static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
|
||||
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:control.Hello)
|
||||
return target;
|
||||
@@ -673,22 +751,21 @@ size_t Hello::ByteSizeLong() const {
|
||||
total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_id());
|
||||
}
|
||||
|
||||
if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
|
||||
total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
|
||||
}
|
||||
int cached_size = ::_pbi::ToCachedSize(total_size);
|
||||
SetCachedSize(cached_size);
|
||||
return total_size;
|
||||
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
|
||||
}
|
||||
|
||||
void Hello::CheckTypeAndMergeFrom(
|
||||
const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
|
||||
MergeFrom(*::_pbi::DownCast<const Hello*>(
|
||||
&from));
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData Hello::_class_data_ = {
|
||||
::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
|
||||
Hello::MergeImpl
|
||||
};
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*Hello::GetClassData() const {
|
||||
return &_class_data_;
|
||||
}
|
||||
|
||||
void Hello::MergeFrom(const Hello& from) {
|
||||
Hello* const _this = this;
|
||||
|
||||
void Hello::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
|
||||
auto* const _this = static_cast<Hello*>(&to_msg);
|
||||
auto& from = static_cast<const Hello&>(from_msg);
|
||||
// @@protoc_insertion_point(class_specific_merge_from_start:control.Hello)
|
||||
GOOGLE_DCHECK_NE(&from, _this);
|
||||
uint32_t cached_has_bits = 0;
|
||||
@@ -704,7 +781,7 @@ void Hello::MergeFrom(const Hello& from) {
|
||||
if (from._internal_id() != 0) {
|
||||
_this->_internal_set_id(from._internal_id());
|
||||
}
|
||||
_this->_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
|
||||
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
|
||||
}
|
||||
|
||||
void Hello::CopyFrom(const Hello& from) {
|
||||
@@ -735,11 +812,12 @@ void Hello::InternalSwap(Hello* other) {
|
||||
reinterpret_cast<char*>(&other->_impl_.meta_));
|
||||
}
|
||||
|
||||
std::string Hello::GetTypeName() const {
|
||||
return "control.Hello";
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata Hello::GetMetadata() const {
|
||||
return ::_pbi::AssignDescriptors(
|
||||
&descriptor_table_hello_2eproto_getter, &descriptor_table_hello_2eproto_once,
|
||||
file_level_metadata_hello_2eproto[2]);
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(namespace_scope)
|
||||
} // namespace control
|
||||
PROTOBUF_NAMESPACE_OPEN
|
||||
|
||||
+147
-74
@@ -25,9 +25,11 @@
|
||||
#include <google/protobuf/arenastring.h>
|
||||
#include <google/protobuf/generated_message_util.h>
|
||||
#include <google/protobuf/metadata_lite.h>
|
||||
#include <google/protobuf/message_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_hello_2eproto
|
||||
@@ -41,6 +43,7 @@ PROTOBUF_NAMESPACE_CLOSE
|
||||
struct TableStruct_hello_2eproto {
|
||||
static const uint32_t offsets[];
|
||||
};
|
||||
extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_hello_2eproto;
|
||||
namespace control {
|
||||
class Header;
|
||||
struct HeaderDefaultTypeInternal;
|
||||
@@ -62,8 +65,8 @@ namespace control {
|
||||
// ===================================================================
|
||||
|
||||
class Header final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:control.Header) */ {
|
||||
public:
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message { /* @@protoc_insertion_point(class_definition:control.Header) */
|
||||
public:
|
||||
inline Header() : Header(nullptr) {}
|
||||
~Header() override;
|
||||
explicit PROTOBUF_CONSTEXPR Header(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
|
||||
@@ -81,9 +84,9 @@ class Header final :
|
||||
inline Header& operator=(Header&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetOwningArena() == from.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetOwningArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
@@ -92,6 +95,15 @@ class Header final :
|
||||
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 Header& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
@@ -107,12 +119,12 @@ class Header final :
|
||||
}
|
||||
inline void Swap(Header* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
|
||||
@@ -129,9 +141,15 @@ class Header final :
|
||||
Header* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<Header>(arena);
|
||||
}
|
||||
void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final;
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Header& from);
|
||||
void MergeFrom(const Header& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom( const Header& from) {
|
||||
Header::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;
|
||||
|
||||
@@ -139,25 +157,30 @@ class Header 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(); }
|
||||
int GetCachedSize() const final {
|
||||
return _impl_._cached_size_.Get();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const;
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(Header* other);
|
||||
|
||||
private:
|
||||
private:
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "control.Header";
|
||||
}
|
||||
protected:
|
||||
protected:
|
||||
explicit Header(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned = false);
|
||||
public:
|
||||
public:
|
||||
|
||||
std::string GetTypeName() const final;
|
||||
static const ClassData _class_data_;
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
@@ -168,24 +191,24 @@ class Header final :
|
||||
};
|
||||
// .control.Meta meta = 1;
|
||||
bool has_meta() const;
|
||||
private:
|
||||
private:
|
||||
bool _internal_has_meta() const;
|
||||
public:
|
||||
public:
|
||||
void clear_meta();
|
||||
const ::control::Meta& meta() const;
|
||||
PROTOBUF_NODISCARD ::control::Meta* release_meta();
|
||||
::control::Meta* mutable_meta();
|
||||
void set_allocated_meta(::control::Meta* meta);
|
||||
private:
|
||||
private:
|
||||
const ::control::Meta& _internal_meta() const;
|
||||
::control::Meta* _internal_mutable_meta();
|
||||
public:
|
||||
public:
|
||||
void unsafe_arena_set_allocated_meta(
|
||||
::control::Meta* meta);
|
||||
::control::Meta* unsafe_arena_release_meta();
|
||||
|
||||
// @@protoc_insertion_point(class_scope:control.Header)
|
||||
private:
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
@@ -195,14 +218,16 @@ class Header final :
|
||||
::control::Meta* meta_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
union {
|
||||
Impl_ _impl_;
|
||||
};
|
||||
friend struct ::TableStruct_hello_2eproto;
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class Meta final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:control.Meta) */ {
|
||||
public:
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message { /* @@protoc_insertion_point(class_definition:control.Meta) */
|
||||
public:
|
||||
inline Meta() : Meta(nullptr) {}
|
||||
~Meta() override;
|
||||
explicit PROTOBUF_CONSTEXPR Meta(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
|
||||
@@ -220,9 +245,9 @@ class Meta final :
|
||||
inline Meta& operator=(Meta&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetOwningArena() == from.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetOwningArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
@@ -231,6 +256,15 @@ class Meta final :
|
||||
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 Meta& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
@@ -246,12 +280,12 @@ class Meta final :
|
||||
}
|
||||
inline void Swap(Meta* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
|
||||
@@ -268,9 +302,15 @@ class Meta final :
|
||||
Meta* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<Meta>(arena);
|
||||
}
|
||||
void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final;
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Meta& from);
|
||||
void MergeFrom(const Meta& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom( const Meta& from) {
|
||||
Meta::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;
|
||||
|
||||
@@ -278,25 +318,30 @@ class Meta 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(); }
|
||||
int GetCachedSize() const final {
|
||||
return _impl_._cached_size_.Get();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const;
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(Meta* other);
|
||||
|
||||
private:
|
||||
private:
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "control.Meta";
|
||||
}
|
||||
protected:
|
||||
protected:
|
||||
explicit Meta(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned = false);
|
||||
public:
|
||||
public:
|
||||
|
||||
std::string GetTypeName() const final;
|
||||
static const ClassData _class_data_;
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
@@ -313,14 +358,14 @@ class Meta final :
|
||||
std::string* mutable_rpcname();
|
||||
PROTOBUF_NODISCARD std::string* release_rpcname();
|
||||
void set_allocated_rpcname(std::string* rpcname);
|
||||
private:
|
||||
private:
|
||||
const std::string& _internal_rpcname() const;
|
||||
inline PROTOBUF_ALWAYS_INLINE void _internal_set_rpcname(const std::string& value);
|
||||
std::string* _internal_mutable_rpcname();
|
||||
public:
|
||||
public:
|
||||
|
||||
// @@protoc_insertion_point(class_scope:control.Meta)
|
||||
private:
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
@@ -330,14 +375,16 @@ class Meta final :
|
||||
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr rpcname_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
union {
|
||||
Impl_ _impl_;
|
||||
};
|
||||
friend struct ::TableStruct_hello_2eproto;
|
||||
};
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
class Hello final :
|
||||
public ::PROTOBUF_NAMESPACE_ID::MessageLite /* @@protoc_insertion_point(class_definition:control.Hello) */ {
|
||||
public:
|
||||
public ::PROTOBUF_NAMESPACE_ID::Message { /* @@protoc_insertion_point(class_definition:control.Hello) */
|
||||
public:
|
||||
inline Hello() : Hello(nullptr) {}
|
||||
~Hello() override;
|
||||
explicit PROTOBUF_CONSTEXPR Hello(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized);
|
||||
@@ -355,9 +402,9 @@ class Hello final :
|
||||
inline Hello& operator=(Hello&& from) noexcept {
|
||||
if (this == &from) return *this;
|
||||
if (GetOwningArena() == from.GetOwningArena()
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
&& GetOwningArena() != nullptr
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_MOVE
|
||||
) {
|
||||
InternalSwap(&from);
|
||||
} else {
|
||||
@@ -366,6 +413,15 @@ class Hello final :
|
||||
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 Hello& default_instance() {
|
||||
return *internal_default_instance();
|
||||
}
|
||||
@@ -381,12 +437,12 @@ class Hello final :
|
||||
}
|
||||
inline void Swap(Hello* other) {
|
||||
if (other == this) return;
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() != nullptr &&
|
||||
GetOwningArena() == other->GetOwningArena()) {
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
#else // PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
if (GetOwningArena() == other->GetOwningArena()) {
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
#endif // !PROTOBUF_FORCE_COPY_IN_SWAP
|
||||
InternalSwap(other);
|
||||
} else {
|
||||
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
|
||||
@@ -403,9 +459,15 @@ class Hello final :
|
||||
Hello* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
|
||||
return CreateMaybeMessage<Hello>(arena);
|
||||
}
|
||||
void CheckTypeAndMergeFrom(const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) final;
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
|
||||
void CopyFrom(const Hello& from);
|
||||
void MergeFrom(const Hello& from);
|
||||
using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom;
|
||||
void MergeFrom( const Hello& from) {
|
||||
Hello::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;
|
||||
|
||||
@@ -413,25 +475,30 @@ class Hello 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(); }
|
||||
int GetCachedSize() const final {
|
||||
return _impl_._cached_size_.Get();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned);
|
||||
void SharedDtor();
|
||||
void SetCachedSize(int size) const;
|
||||
void SetCachedSize(int size) const final;
|
||||
void InternalSwap(Hello* other);
|
||||
|
||||
private:
|
||||
private:
|
||||
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
|
||||
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
|
||||
return "control.Hello";
|
||||
}
|
||||
protected:
|
||||
protected:
|
||||
explicit Hello(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
bool is_message_owned = false);
|
||||
public:
|
||||
public:
|
||||
|
||||
std::string GetTypeName() const final;
|
||||
static const ClassData _class_data_;
|
||||
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final;
|
||||
|
||||
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
|
||||
|
||||
// nested types ----------------------------------------------------
|
||||
|
||||
@@ -450,26 +517,26 @@ class Hello final :
|
||||
std::string* mutable_name();
|
||||
PROTOBUF_NODISCARD std::string* release_name();
|
||||
void set_allocated_name(std::string* name);
|
||||
private:
|
||||
private:
|
||||
const std::string& _internal_name() const;
|
||||
inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
|
||||
std::string* _internal_mutable_name();
|
||||
public:
|
||||
public:
|
||||
|
||||
// .control.Meta meta = 1;
|
||||
bool has_meta() const;
|
||||
private:
|
||||
private:
|
||||
bool _internal_has_meta() const;
|
||||
public:
|
||||
public:
|
||||
void clear_meta();
|
||||
const ::control::Meta& meta() const;
|
||||
PROTOBUF_NODISCARD ::control::Meta* release_meta();
|
||||
::control::Meta* mutable_meta();
|
||||
void set_allocated_meta(::control::Meta* meta);
|
||||
private:
|
||||
private:
|
||||
const ::control::Meta& _internal_meta() const;
|
||||
::control::Meta* _internal_mutable_meta();
|
||||
public:
|
||||
public:
|
||||
void unsafe_arena_set_allocated_meta(
|
||||
::control::Meta* meta);
|
||||
::control::Meta* unsafe_arena_release_meta();
|
||||
@@ -478,13 +545,13 @@ class Hello final :
|
||||
void clear_id();
|
||||
int32_t id() const;
|
||||
void set_id(int32_t value);
|
||||
private:
|
||||
private:
|
||||
int32_t _internal_id() const;
|
||||
void _internal_set_id(int32_t value);
|
||||
public:
|
||||
public:
|
||||
|
||||
// @@protoc_insertion_point(class_scope:control.Hello)
|
||||
private:
|
||||
private:
|
||||
class _Internal;
|
||||
|
||||
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
|
||||
@@ -496,7 +563,9 @@ class Hello final :
|
||||
int32_t id_;
|
||||
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
|
||||
};
|
||||
union { Impl_ _impl_; };
|
||||
union {
|
||||
Impl_ _impl_;
|
||||
};
|
||||
friend struct ::TableStruct_hello_2eproto;
|
||||
};
|
||||
// ===================================================================
|
||||
@@ -505,8 +574,8 @@ class Hello final :
|
||||
// ===================================================================
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#endif // __GNUC__
|
||||
// Header
|
||||
|
||||
@@ -552,7 +621,9 @@ inline ::control::Meta* Header::release_meta() {
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
|
||||
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
|
||||
if (GetArenaForAllocation() == nullptr) { delete old; }
|
||||
if (GetArenaForAllocation() == nullptr) {
|
||||
delete old;
|
||||
}
|
||||
#else // PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
if (GetArenaForAllocation() != nullptr) {
|
||||
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
|
||||
@@ -700,7 +771,9 @@ inline ::control::Meta* Hello::release_meta() {
|
||||
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp);
|
||||
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
|
||||
if (GetArenaForAllocation() == nullptr) { delete old; }
|
||||
if (GetArenaForAllocation() == nullptr) {
|
||||
delete old;
|
||||
}
|
||||
#else // PROTOBUF_FORCE_COPY_IN_RELEASE
|
||||
if (GetArenaForAllocation() != nullptr) {
|
||||
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
|
||||
@@ -819,7 +892,7 @@ inline void Hello::set_allocated_name(std::string* name) {
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package control;
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
option cc_generic_services = false;
|
||||
//option optimize_for = LITE_RUNTIME;
|
||||
//option cc_generic_services = false;
|
||||
|
||||
message Header {
|
||||
Meta meta = 1;
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
#include <cstring>
|
||||
#include <expected>
|
||||
#include <iostream>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class RPCClient {
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
#include <cstring>
|
||||
#include <expected>
|
||||
#include <iostream>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <google/protobuf/message.h>
|
||||
|
||||
#include <rcpclient.hpp>
|
||||
|
||||
//google::protobuf::Message
|
||||
|
||||
std::expected<void, std::string> Transaction(const google::protobuf::Message& m) {
|
||||
return {};
|
||||
}
|
||||
+18
-19
@@ -15,6 +15,12 @@ extern "C" {
|
||||
#include <span>
|
||||
#include <iostream>
|
||||
|
||||
#include <cstring>
|
||||
#include <expected>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#include <tcpclient.hpp>
|
||||
|
||||
TCPClient::TCPClient() {
|
||||
@@ -25,9 +31,9 @@ TCPClient::TCPClient() {
|
||||
std::expected<void, std::string> TCPClient::Connect(const std::string naddress, const int port) {
|
||||
|
||||
struct sockaddr_in sa;
|
||||
if (inet_pton(AF_INET, address.c_str(), &(sa.sin_addr)) == 1) {
|
||||
if (inet_pton(AF_INET, naddress.c_str(), &(sa.sin_addr)) == 1) {
|
||||
family = AF_INET;
|
||||
} else if (inet_pton(AF_INET6, address.c_str(), &(sa.sin_addr)) == 1) {
|
||||
} else if (inet_pton(AF_INET6, naddress.c_str(), &(sa.sin_addr)) == 1) {
|
||||
family = AF_INET6;
|
||||
} else {
|
||||
int errnocopy = errno;
|
||||
@@ -44,7 +50,7 @@ std::expected<void, std::string> TCPClient::Connect(const std::string naddress,
|
||||
|
||||
serv_addr.sin_family = AF_INET;
|
||||
serv_addr.sin_port = htons(port);
|
||||
const char* addr = address.data();
|
||||
const char* addr = naddress.data();
|
||||
if (inet_pton(AF_INET, addr, &serv_addr.sin_addr) <= 0) {
|
||||
return std::unexpected("Invalid server IP address");
|
||||
}
|
||||
@@ -65,15 +71,6 @@ std::expected<void, std::string> TCPClient::Connect(const std::string naddress,
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
std::expected<int, std::string> TCPClient::Write(std::span<const std::byte> payload) {
|
||||
int n = 0;
|
||||
if ((n = write(sock, payload.data(), payload.size())) < 0) {
|
||||
return std::unexpected("Write error");
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
std::expected<int, std::string> TCPClient::Write(std::string payload) {
|
||||
int n = 0;
|
||||
if ((n = write(sock, payload.data(), payload.size())) < 0) {
|
||||
@@ -82,16 +79,18 @@ std::expected<int, std::string> TCPClient::Write(std::string payload) {
|
||||
return n;
|
||||
}
|
||||
|
||||
std::expected<int, std::string> TCPClient::Read(std::vector<std::byte>* buffer) {
|
||||
int n = 0;
|
||||
if ((n = read(sock, buffer->data(), buffer->size())) < 0) {
|
||||
std::expected<int, std::string> TCPClient::Read(std::string& res, int size) {
|
||||
char buffer[size + 1];
|
||||
memset(&buffer, 0, size + 1);
|
||||
int rsize = 0;
|
||||
if ((rsize = read(sock, &buffer, size)) < 0) {
|
||||
return std::unexpected("Read error");
|
||||
}
|
||||
return n;
|
||||
res.append(buffer, rsize);
|
||||
return rsize;
|
||||
}
|
||||
|
||||
std::expected<int, std::string> TCPClient::Read(std::vector<uint8_t>* buffer) {
|
||||
return read(sock, buffer->data(), buffer->size());
|
||||
TCPClient::~TCPClient() {
|
||||
close(sock);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-10
@@ -10,16 +10,9 @@ private:
|
||||
int sock;
|
||||
int family;
|
||||
public:
|
||||
TCPClient();
|
||||
TCPClient(void);
|
||||
std::expected<void, std::string> Connect(std::string address, const int port);
|
||||
|
||||
std::expected<int, std::string> Write(std::span<const std::byte> payload);
|
||||
std::expected<int, std::string> Write(std::string payload);
|
||||
|
||||
std::expected<int, std::string> Read(std::vector<std::byte>* buffer);
|
||||
std::expected<int, std::string> Read(std::vector<uint8_t>* buffer);
|
||||
|
||||
~TCPClient() {
|
||||
close(sock);
|
||||
}
|
||||
std::expected<int, std::string> Read(std::string& buffer, int size);
|
||||
~TCPClient(void);
|
||||
};
|
||||
|
||||
+4
-6
@@ -20,15 +20,13 @@ int main( int argc, char** argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> buffer;
|
||||
buffer.resize(2048);
|
||||
auto rSize = client.Read(&buffer);
|
||||
std::string buffer;
|
||||
auto rSize = client.Read(buffer, 8);
|
||||
if (!rSize) {
|
||||
std::cerr << rSize.error() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::cout << rSize.value() << std::endl;
|
||||
std::cout << std::format("read {} bytes", rSize.value()) << std::endl;
|
||||
std::cout << std::format("{}", buffer) << std::endl;
|
||||
|
||||
std::string s(buffer.begin(), buffer.end());
|
||||
std::cout << std::format("{}", s) << std::endl;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
|
||||
|
||||
class Packet {
|
||||
std::string meta;
|
||||
std::string payload;
|
||||
}
|
||||
Reference in New Issue
Block a user