working commit

This commit is contained in:
2026-04-24 16:50:15 +02:00
parent 37d9ee63cc
commit ace92da151
26 changed files with 3879 additions and 1893 deletions
+58 -28
View File
@@ -91,7 +91,7 @@ POST_UNINSTALL = :
sbin_PROGRAMS = helmetd$(EXEEXT) sbin_PROGRAMS = helmetd$(EXEEXT)
noinst_PROGRAMS = tcpclient_test$(EXEEXT) udpclient_test$(EXEEXT) \ noinst_PROGRAMS = tcpclient_test$(EXEEXT) udpclient_test$(EXEEXT) \
service_test$(EXEEXT) tunclient_test$(EXEEXT) \ service_test$(EXEEXT) tunclient_test$(EXEEXT) \
message_test$(EXEEXT) rpcclient_test$(EXEEXT) fakeconnect_test$(EXEEXT)
subdir = . subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -107,21 +107,30 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(sbindir)" am__installdirs = "$(DESTDIR)$(sbindir)"
PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS) PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS)
am_fakeconnect_test_OBJECTS = fakeconnect_test.$(OBJEXT) \
rpcclient.$(OBJEXT) rpcheader.$(OBJEXT) netclient.$(OBJEXT) \
nethandler.$(OBJEXT) fakeconnect.$(OBJEXT) \
control.pb.$(OBJEXT)
fakeconnect_test_OBJECTS = $(am_fakeconnect_test_OBJECTS)
fakeconnect_test_LDADD = $(LDADD)
am_helmetd_OBJECTS = helmetd.$(OBJEXT) tunclient.$(OBJEXT) \ am_helmetd_OBJECTS = helmetd.$(OBJEXT) tunclient.$(OBJEXT) \
service.$(OBJEXT) interface.$(OBJEXT) hello.pb.$(OBJEXT) \ service.$(OBJEXT) interface.$(OBJEXT) udpclient.$(OBJEXT) \
udpclient.$(OBJEXT) resolver.$(OBJEXT) iprouter.$(OBJEXT) \ resolver.$(OBJEXT) iprouter.$(OBJEXT) netclient.$(OBJEXT) \
tcpclient.$(OBJEXT) rpcclient.$(OBJEXT) tcpclient.$(OBJEXT) rpcclient.$(OBJEXT) control.pb.$(OBJEXT)
helmetd_OBJECTS = $(am_helmetd_OBJECTS) helmetd_OBJECTS = $(am_helmetd_OBJECTS)
helmetd_LDADD = $(LDADD) helmetd_LDADD = $(LDADD)
am_message_test_OBJECTS = message_test.$(OBJEXT) hello.pb.$(OBJEXT) am_rpcclient_test_OBJECTS = rpcclient_test.$(OBJEXT) \
message_test_OBJECTS = $(am_message_test_OBJECTS) rpcclient.$(OBJEXT) rpcheader.$(OBJEXT) netclient.$(OBJEXT) \
message_test_LDADD = $(LDADD) nethandler.$(OBJEXT) fakeconnect.$(OBJEXT) \
control.pb.$(OBJEXT)
rpcclient_test_OBJECTS = $(am_rpcclient_test_OBJECTS)
rpcclient_test_LDADD = $(LDADD)
am_service_test_OBJECTS = service_test.$(OBJEXT) tunclient.$(OBJEXT) \ am_service_test_OBJECTS = service_test.$(OBJEXT) tunclient.$(OBJEXT) \
service.$(OBJEXT) interface.$(OBJEXT) service.$(OBJEXT) interface.$(OBJEXT)
service_test_OBJECTS = $(am_service_test_OBJECTS) service_test_OBJECTS = $(am_service_test_OBJECTS)
service_test_LDADD = $(LDADD) service_test_LDADD = $(LDADD)
am_tcpclient_test_OBJECTS = resolver.$(OBJEXT) tcpclient.$(OBJEXT) \ am_tcpclient_test_OBJECTS = resolver.$(OBJEXT) netclient.$(OBJEXT) \
tcpclient_test.$(OBJEXT) tcpclient.$(OBJEXT) tcpclient_test.$(OBJEXT)
tcpclient_test_OBJECTS = $(am_tcpclient_test_OBJECTS) tcpclient_test_OBJECTS = $(am_tcpclient_test_OBJECTS)
tcpclient_test_LDADD = $(LDADD) tcpclient_test_LDADD = $(LDADD)
am_tunclient_test_OBJECTS = tunclient_test.$(OBJEXT) \ am_tunclient_test_OBJECTS = tunclient_test.$(OBJEXT) \
@@ -172,12 +181,14 @@ AM_V_CCLD = $(am__v_CCLD_$(V))
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 = am__v_CCLD_1 =
SOURCES = $(helmetd_SOURCES) $(message_test_SOURCES) \ SOURCES = $(fakeconnect_test_SOURCES) $(helmetd_SOURCES) \
$(service_test_SOURCES) $(tcpclient_test_SOURCES) \ $(rpcclient_test_SOURCES) $(service_test_SOURCES) \
$(tunclient_test_SOURCES) $(udpclient_test_SOURCES) $(tcpclient_test_SOURCES) $(tunclient_test_SOURCES) \
DIST_SOURCES = $(helmetd_SOURCES) $(message_test_SOURCES) \ $(udpclient_test_SOURCES)
$(service_test_SOURCES) $(tcpclient_test_SOURCES) \ DIST_SOURCES = $(fakeconnect_test_SOURCES) $(helmetd_SOURCES) \
$(tunclient_test_SOURCES) $(udpclient_test_SOURCES) $(rpcclient_test_SOURCES) $(service_test_SOURCES) \
$(tcpclient_test_SOURCES) $(tunclient_test_SOURCES) \
$(udpclient_test_SOURCES)
am__can_run_installinfo = \ am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \ case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \ n|no|NO) false;; \
@@ -241,7 +252,7 @@ CSCOPE = cscope
CTAGS = ctags CTAGS = ctags
CXX = g++ CXX = g++
CXXDEPMODE = depmode=none CXXDEPMODE = depmode=none
CXXFLAGS = -std=c++23 -Wall -I. -pthread -D_GNU_SOURCE=1 CXXFLAGS = -g -std=c++23 -Wall -I. -pthread -D_GNU_SOURCE=1
CYGPATH_W = echo CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps DEPDIR = .deps
@@ -327,12 +338,13 @@ helmetd_SOURCES = helmetd.cpp \
tunclient.cpp tunclient.hpp \ tunclient.cpp tunclient.hpp \
service.cpp service.hpp \ service.cpp service.hpp \
interface.cpp interface.hpp \ interface.cpp interface.hpp \
hello.pb.cc hello.pb.h \
udpclient.cpp udpclient.hpp \ udpclient.cpp udpclient.hpp \
resolver.cpp resolver.hpp \ resolver.cpp resolver.hpp \
iprouter.cpp iprouter.hpp \ iprouter.cpp iprouter.hpp \
netclient.cpp netclient.hpp \
tcpclient.cpp tcpclient.hpp \ tcpclient.cpp tcpclient.hpp \
rpcclient.cpp rpcclient.hpp rpcclient.cpp rpcclient.hpp \
control.pb.cc control.pb.h
tunclient_test_SOURCES = tunclient_test.cpp \ tunclient_test_SOURCES = tunclient_test.cpp \
tunclient.cpp tunclient.hpp \ tunclient.cpp tunclient.hpp \
@@ -351,11 +363,25 @@ udpclient_test_SOURCES = \
tcpclient_test_SOURCES = \ tcpclient_test_SOURCES = \
resolver.cpp resolver.hpp \ resolver.cpp resolver.hpp \
netclient.cpp netclient.hpp \
tcpclient.cpp tcpclient.hpp \ tcpclient.cpp tcpclient.hpp \
tcpclient_test.cpp tcpclient_test.cpp
message_test_SOURCES = message_test.cpp \ rpcclient_test_SOURCES = rpcclient_test.cpp \
hello.pb.cc hello.pb.h rpcclient.cpp rpcclient.hpp \
rpcheader.cpp rpcheader.hpp \
netclient.cpp netclient.hpp \
nethandler.cpp nethandler.hpp \
fakeconnect.cpp fakeconnect.hpp \
control.pb.cc control.pb.h
fakeconnect_test_SOURCES = fakeconnect_test.cpp \
rpcclient.cpp rpcclient.hpp \
rpcheader.cpp rpcheader.hpp \
netclient.cpp netclient.hpp \
nethandler.cpp nethandler.hpp \
fakeconnect.cpp fakeconnect.hpp \
control.pb.cc control.pb.h
ASTYLE_OPTS = --indent=spaces=8 --style=java ASTYLE_OPTS = --indent=spaces=8 --style=java
all: defines.h all: defines.h
@@ -457,13 +483,17 @@ uninstall-sbinPROGRAMS:
clean-sbinPROGRAMS: clean-sbinPROGRAMS:
-$(am__rm_f) $(sbin_PROGRAMS) -$(am__rm_f) $(sbin_PROGRAMS)
fakeconnect_test$(EXEEXT): $(fakeconnect_test_OBJECTS) $(fakeconnect_test_DEPENDENCIES) $(EXTRA_fakeconnect_test_DEPENDENCIES)
@rm -f fakeconnect_test$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(fakeconnect_test_OBJECTS) $(fakeconnect_test_LDADD) $(LIBS)
helmetd$(EXEEXT): $(helmetd_OBJECTS) $(helmetd_DEPENDENCIES) $(EXTRA_helmetd_DEPENDENCIES) helmetd$(EXEEXT): $(helmetd_OBJECTS) $(helmetd_DEPENDENCIES) $(EXTRA_helmetd_DEPENDENCIES)
@rm -f helmetd$(EXEEXT) @rm -f helmetd$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(helmetd_OBJECTS) $(helmetd_LDADD) $(LIBS) $(AM_V_CXXLD)$(CXXLINK) $(helmetd_OBJECTS) $(helmetd_LDADD) $(LIBS)
message_test$(EXEEXT): $(message_test_OBJECTS) $(message_test_DEPENDENCIES) $(EXTRA_message_test_DEPENDENCIES) rpcclient_test$(EXEEXT): $(rpcclient_test_OBJECTS) $(rpcclient_test_DEPENDENCIES) $(EXTRA_rpcclient_test_DEPENDENCIES)
@rm -f message_test$(EXEEXT) @rm -f rpcclient_test$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(message_test_OBJECTS) $(message_test_LDADD) $(LIBS) $(AM_V_CXXLD)$(CXXLINK) $(rpcclient_test_OBJECTS) $(rpcclient_test_LDADD) $(LIBS)
service_test$(EXEEXT): $(service_test_OBJECTS) $(service_test_DEPENDENCIES) $(EXTRA_service_test_DEPENDENCIES) service_test$(EXEEXT): $(service_test_OBJECTS) $(service_test_DEPENDENCIES) $(EXTRA_service_test_DEPENDENCIES)
@rm -f service_test$(EXEEXT) @rm -f service_test$(EXEEXT)
@@ -859,17 +889,17 @@ uninstall-am: uninstall-sbinPROGRAMS
.PRECIOUS: Makefile .PRECIOUS: Makefile
test: message_test test: fakeconnect_test
./message_test ./fakeconnect_test
run: helmetd run: helmetd
./helmetd ./helmetd
proto: proto:
$(PROTOC) --cpp_out=. hello.proto $(PROTOC) --cpp_out=. control.proto
hello.pb.cc hello.pb.h: hello.proto control.pb.cc control.pb.h: control.proto
$(PROTOC) --cpp_out=. hello.proto $(PROTOC) --cpp_out=. control.proto
format: format:
$(ASTYLE) $(ASTYLE_OPTS) *.hpp *.cpp $(ASTYLE) $(ASTYLE_OPTS) *.hpp *.cpp
+26 -12
View File
@@ -1,7 +1,7 @@
AUTOMAKE_OPTIONS = foreign no-dependencies no-installinfo subdir-objects AUTOMAKE_OPTIONS = foreign no-dependencies no-installinfo subdir-objects
CXXFLAGS = -std=c++23 -Wall -I. -pthread -D_GNU_SOURCE=1 CXXFLAGS = -g -std=c++23 -Wall -I. -pthread -D_GNU_SOURCE=1
LDFLAGS = -pthread LDFLAGS = -pthread
LIBS = -Wl,--as-need -lprotobuf LIBS = -Wl,--as-need -lprotobuf
@@ -11,12 +11,13 @@ helmetd_SOURCES = helmetd.cpp \
tunclient.cpp tunclient.hpp \ tunclient.cpp tunclient.hpp \
service.cpp service.hpp \ service.cpp service.hpp \
interface.cpp interface.hpp \ interface.cpp interface.hpp \
hello.pb.cc hello.pb.h \
udpclient.cpp udpclient.hpp \ udpclient.cpp udpclient.hpp \
resolver.cpp resolver.hpp \ resolver.cpp resolver.hpp \
iprouter.cpp iprouter.hpp \ iprouter.cpp iprouter.hpp \
netclient.cpp netclient.hpp \
tcpclient.cpp tcpclient.hpp \ tcpclient.cpp tcpclient.hpp \
rpcclient.cpp rpcclient.hpp rpcclient.cpp rpcclient.hpp \
control.pb.cc control.pb.h
noinst_PROGRAMS = \ noinst_PROGRAMS = \
@@ -24,7 +25,8 @@ noinst_PROGRAMS = \
udpclient_test \ udpclient_test \
service_test \ service_test \
tunclient_test \ tunclient_test \
message_test rpcclient_test \
fakeconnect_test
tunclient_test_SOURCES = tunclient_test.cpp \ tunclient_test_SOURCES = tunclient_test.cpp \
tunclient.cpp tunclient.hpp \ tunclient.cpp tunclient.hpp \
@@ -44,26 +46,38 @@ udpclient_test_SOURCES = \
tcpclient_test_SOURCES = \ tcpclient_test_SOURCES = \
resolver.cpp resolver.hpp \ resolver.cpp resolver.hpp \
netclient.cpp netclient.hpp \
tcpclient.cpp tcpclient.hpp \ tcpclient.cpp tcpclient.hpp \
tcpclient_test.cpp tcpclient_test.cpp
rpcclient_test_SOURCES = rpcclient_test.cpp \
rpcclient.cpp rpcclient.hpp \
rpcheader.cpp rpcheader.hpp \
netclient.cpp netclient.hpp \
nethandler.cpp nethandler.hpp \
fakeconnect.cpp fakeconnect.hpp \
control.pb.cc control.pb.h
message_test_SOURCES = message_test.cpp \ fakeconnect_test_SOURCES = fakeconnect_test.cpp \
hello.pb.cc hello.pb.h rpcclient.cpp rpcclient.hpp \
rpcheader.cpp rpcheader.hpp \
netclient.cpp netclient.hpp \
nethandler.cpp nethandler.hpp \
fakeconnect.cpp fakeconnect.hpp \
control.pb.cc control.pb.h
test: message_test test: fakeconnect_test
./message_test ./fakeconnect_test
run: helmetd run: helmetd
./helmetd ./helmetd
proto: proto:
$(PROTOC) --cpp_out=. hello.proto $(PROTOC) --cpp_out=. control.proto
control.pb.cc control.pb.h: control.proto
hello.pb.cc hello.pb.h: hello.proto $(PROTOC) --cpp_out=. control.proto
$(PROTOC) --cpp_out=. hello.proto
ASTYLE_OPTS = --indent=spaces=8 --style=java ASTYLE_OPTS = --indent=spaces=8 --style=java
format: format:
+58 -28
View File
@@ -91,7 +91,7 @@ POST_UNINSTALL = :
sbin_PROGRAMS = helmetd$(EXEEXT) sbin_PROGRAMS = helmetd$(EXEEXT)
noinst_PROGRAMS = tcpclient_test$(EXEEXT) udpclient_test$(EXEEXT) \ noinst_PROGRAMS = tcpclient_test$(EXEEXT) udpclient_test$(EXEEXT) \
service_test$(EXEEXT) tunclient_test$(EXEEXT) \ service_test$(EXEEXT) tunclient_test$(EXEEXT) \
message_test$(EXEEXT) rpcclient_test$(EXEEXT) fakeconnect_test$(EXEEXT)
subdir = . subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -107,21 +107,30 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(sbindir)" am__installdirs = "$(DESTDIR)$(sbindir)"
PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS) PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS)
am_fakeconnect_test_OBJECTS = fakeconnect_test.$(OBJEXT) \
rpcclient.$(OBJEXT) rpcheader.$(OBJEXT) netclient.$(OBJEXT) \
nethandler.$(OBJEXT) fakeconnect.$(OBJEXT) \
control.pb.$(OBJEXT)
fakeconnect_test_OBJECTS = $(am_fakeconnect_test_OBJECTS)
fakeconnect_test_LDADD = $(LDADD)
am_helmetd_OBJECTS = helmetd.$(OBJEXT) tunclient.$(OBJEXT) \ am_helmetd_OBJECTS = helmetd.$(OBJEXT) tunclient.$(OBJEXT) \
service.$(OBJEXT) interface.$(OBJEXT) hello.pb.$(OBJEXT) \ service.$(OBJEXT) interface.$(OBJEXT) udpclient.$(OBJEXT) \
udpclient.$(OBJEXT) resolver.$(OBJEXT) iprouter.$(OBJEXT) \ resolver.$(OBJEXT) iprouter.$(OBJEXT) netclient.$(OBJEXT) \
tcpclient.$(OBJEXT) rpcclient.$(OBJEXT) tcpclient.$(OBJEXT) rpcclient.$(OBJEXT) control.pb.$(OBJEXT)
helmetd_OBJECTS = $(am_helmetd_OBJECTS) helmetd_OBJECTS = $(am_helmetd_OBJECTS)
helmetd_LDADD = $(LDADD) helmetd_LDADD = $(LDADD)
am_message_test_OBJECTS = message_test.$(OBJEXT) hello.pb.$(OBJEXT) am_rpcclient_test_OBJECTS = rpcclient_test.$(OBJEXT) \
message_test_OBJECTS = $(am_message_test_OBJECTS) rpcclient.$(OBJEXT) rpcheader.$(OBJEXT) netclient.$(OBJEXT) \
message_test_LDADD = $(LDADD) nethandler.$(OBJEXT) fakeconnect.$(OBJEXT) \
control.pb.$(OBJEXT)
rpcclient_test_OBJECTS = $(am_rpcclient_test_OBJECTS)
rpcclient_test_LDADD = $(LDADD)
am_service_test_OBJECTS = service_test.$(OBJEXT) tunclient.$(OBJEXT) \ am_service_test_OBJECTS = service_test.$(OBJEXT) tunclient.$(OBJEXT) \
service.$(OBJEXT) interface.$(OBJEXT) service.$(OBJEXT) interface.$(OBJEXT)
service_test_OBJECTS = $(am_service_test_OBJECTS) service_test_OBJECTS = $(am_service_test_OBJECTS)
service_test_LDADD = $(LDADD) service_test_LDADD = $(LDADD)
am_tcpclient_test_OBJECTS = resolver.$(OBJEXT) tcpclient.$(OBJEXT) \ am_tcpclient_test_OBJECTS = resolver.$(OBJEXT) netclient.$(OBJEXT) \
tcpclient_test.$(OBJEXT) tcpclient.$(OBJEXT) tcpclient_test.$(OBJEXT)
tcpclient_test_OBJECTS = $(am_tcpclient_test_OBJECTS) tcpclient_test_OBJECTS = $(am_tcpclient_test_OBJECTS)
tcpclient_test_LDADD = $(LDADD) tcpclient_test_LDADD = $(LDADD)
am_tunclient_test_OBJECTS = tunclient_test.$(OBJEXT) \ am_tunclient_test_OBJECTS = tunclient_test.$(OBJEXT) \
@@ -172,12 +181,14 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 = am__v_CCLD_1 =
SOURCES = $(helmetd_SOURCES) $(message_test_SOURCES) \ SOURCES = $(fakeconnect_test_SOURCES) $(helmetd_SOURCES) \
$(service_test_SOURCES) $(tcpclient_test_SOURCES) \ $(rpcclient_test_SOURCES) $(service_test_SOURCES) \
$(tunclient_test_SOURCES) $(udpclient_test_SOURCES) $(tcpclient_test_SOURCES) $(tunclient_test_SOURCES) \
DIST_SOURCES = $(helmetd_SOURCES) $(message_test_SOURCES) \ $(udpclient_test_SOURCES)
$(service_test_SOURCES) $(tcpclient_test_SOURCES) \ DIST_SOURCES = $(fakeconnect_test_SOURCES) $(helmetd_SOURCES) \
$(tunclient_test_SOURCES) $(udpclient_test_SOURCES) $(rpcclient_test_SOURCES) $(service_test_SOURCES) \
$(tcpclient_test_SOURCES) $(tunclient_test_SOURCES) \
$(udpclient_test_SOURCES)
am__can_run_installinfo = \ am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \ case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \ n|no|NO) false;; \
@@ -241,7 +252,7 @@ CSCOPE = @CSCOPE@
CTAGS = @CTAGS@ CTAGS = @CTAGS@
CXX = @CXX@ CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@ CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = -std=c++23 -Wall -I. -pthread -D_GNU_SOURCE=1 CXXFLAGS = -g -std=c++23 -Wall -I. -pthread -D_GNU_SOURCE=1
CYGPATH_W = @CYGPATH_W@ CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@ DEFS = @DEFS@
DEPDIR = @DEPDIR@ DEPDIR = @DEPDIR@
@@ -327,12 +338,13 @@ helmetd_SOURCES = helmetd.cpp \
tunclient.cpp tunclient.hpp \ tunclient.cpp tunclient.hpp \
service.cpp service.hpp \ service.cpp service.hpp \
interface.cpp interface.hpp \ interface.cpp interface.hpp \
hello.pb.cc hello.pb.h \
udpclient.cpp udpclient.hpp \ udpclient.cpp udpclient.hpp \
resolver.cpp resolver.hpp \ resolver.cpp resolver.hpp \
iprouter.cpp iprouter.hpp \ iprouter.cpp iprouter.hpp \
netclient.cpp netclient.hpp \
tcpclient.cpp tcpclient.hpp \ tcpclient.cpp tcpclient.hpp \
rpcclient.cpp rpcclient.hpp rpcclient.cpp rpcclient.hpp \
control.pb.cc control.pb.h
tunclient_test_SOURCES = tunclient_test.cpp \ tunclient_test_SOURCES = tunclient_test.cpp \
tunclient.cpp tunclient.hpp \ tunclient.cpp tunclient.hpp \
@@ -351,11 +363,25 @@ udpclient_test_SOURCES = \
tcpclient_test_SOURCES = \ tcpclient_test_SOURCES = \
resolver.cpp resolver.hpp \ resolver.cpp resolver.hpp \
netclient.cpp netclient.hpp \
tcpclient.cpp tcpclient.hpp \ tcpclient.cpp tcpclient.hpp \
tcpclient_test.cpp tcpclient_test.cpp
message_test_SOURCES = message_test.cpp \ rpcclient_test_SOURCES = rpcclient_test.cpp \
hello.pb.cc hello.pb.h rpcclient.cpp rpcclient.hpp \
rpcheader.cpp rpcheader.hpp \
netclient.cpp netclient.hpp \
nethandler.cpp nethandler.hpp \
fakeconnect.cpp fakeconnect.hpp \
control.pb.cc control.pb.h
fakeconnect_test_SOURCES = fakeconnect_test.cpp \
rpcclient.cpp rpcclient.hpp \
rpcheader.cpp rpcheader.hpp \
netclient.cpp netclient.hpp \
nethandler.cpp nethandler.hpp \
fakeconnect.cpp fakeconnect.hpp \
control.pb.cc control.pb.h
ASTYLE_OPTS = --indent=spaces=8 --style=java ASTYLE_OPTS = --indent=spaces=8 --style=java
all: defines.h all: defines.h
@@ -457,13 +483,17 @@ uninstall-sbinPROGRAMS:
clean-sbinPROGRAMS: clean-sbinPROGRAMS:
-$(am__rm_f) $(sbin_PROGRAMS) -$(am__rm_f) $(sbin_PROGRAMS)
fakeconnect_test$(EXEEXT): $(fakeconnect_test_OBJECTS) $(fakeconnect_test_DEPENDENCIES) $(EXTRA_fakeconnect_test_DEPENDENCIES)
@rm -f fakeconnect_test$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(fakeconnect_test_OBJECTS) $(fakeconnect_test_LDADD) $(LIBS)
helmetd$(EXEEXT): $(helmetd_OBJECTS) $(helmetd_DEPENDENCIES) $(EXTRA_helmetd_DEPENDENCIES) helmetd$(EXEEXT): $(helmetd_OBJECTS) $(helmetd_DEPENDENCIES) $(EXTRA_helmetd_DEPENDENCIES)
@rm -f helmetd$(EXEEXT) @rm -f helmetd$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(helmetd_OBJECTS) $(helmetd_LDADD) $(LIBS) $(AM_V_CXXLD)$(CXXLINK) $(helmetd_OBJECTS) $(helmetd_LDADD) $(LIBS)
message_test$(EXEEXT): $(message_test_OBJECTS) $(message_test_DEPENDENCIES) $(EXTRA_message_test_DEPENDENCIES) rpcclient_test$(EXEEXT): $(rpcclient_test_OBJECTS) $(rpcclient_test_DEPENDENCIES) $(EXTRA_rpcclient_test_DEPENDENCIES)
@rm -f message_test$(EXEEXT) @rm -f rpcclient_test$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(message_test_OBJECTS) $(message_test_LDADD) $(LIBS) $(AM_V_CXXLD)$(CXXLINK) $(rpcclient_test_OBJECTS) $(rpcclient_test_LDADD) $(LIBS)
service_test$(EXEEXT): $(service_test_OBJECTS) $(service_test_DEPENDENCIES) $(EXTRA_service_test_DEPENDENCIES) service_test$(EXEEXT): $(service_test_OBJECTS) $(service_test_DEPENDENCIES) $(EXTRA_service_test_DEPENDENCIES)
@rm -f service_test$(EXEEXT) @rm -f service_test$(EXEEXT)
@@ -859,17 +889,17 @@ uninstall-am: uninstall-sbinPROGRAMS
.PRECIOUS: Makefile .PRECIOUS: Makefile
test: message_test test: fakeconnect_test
./message_test ./fakeconnect_test
run: helmetd run: helmetd
./helmetd ./helmetd
proto: proto:
$(PROTOC) --cpp_out=. hello.proto $(PROTOC) --cpp_out=. control.proto
hello.pb.cc hello.pb.h: hello.proto control.pb.cc control.pb.h: control.proto
$(PROTOC) --cpp_out=. hello.proto $(PROTOC) --cpp_out=. control.proto
format: format:
$(ASTYLE) $(ASTYLE_OPTS) *.hpp *.cpp $(ASTYLE) $(ASTYLE_OPTS) *.hpp *.cpp
+1608
View File
File diff suppressed because it is too large Load Diff
+1748
View File
File diff suppressed because it is too large Load Diff
+36
View File
@@ -0,0 +1,36 @@
syntax = "proto3";
package control;
//option optimize_for = LITE_RUNTIME;
//option cc_generic_services = false;
message ReqMeta {
string rpcname = 1;
}
message ResMeta {
bool error = 1;
string message = 2;
}
message Request {
ReqMeta meta = 1;
}
message Result {
ResMeta meta = 1;
}
message HelloRequest {
ReqMeta meta = 1;
int32 id = 2;
string name = 3;
}
message HelloResult {
ResMeta meta = 1;
int32 id = 2;
string name = 3;
}
+54
View File
@@ -0,0 +1,54 @@
#include <cstring>
#include <expected>
#include <iostream>
#include <span>
#include <sstream>
#include <string>
#include <vector>
#include <memory>
#include <fakeconnect.hpp>
#include <nethandler.hpp>
#include <rpcheader.hpp>
FakeConnector::FakeConnector(NetHandler& hand) {
handler = &hand;
}
std::expected<int, std::string> FakeConnector::Write(std::string reqNetPacket) {
std::stringstream ss(reqNetPacket);
// Read binary header
std::string reqRawHeader;
const int rhSize = 8;
reqRawHeader.resize(rhSize);
ss.read(reqRawHeader.data(), rhSize);
// Decode header
RPCHeader reqHeader;
reqHeader.Decode(reqRawHeader);
// Read protobuf packet
std::string reqData;
auto pSize = reqHeader.PacketSize();
reqData.resize(pSize);
ss.read(reqData.data(), pSize);
// Call handler
std::string resData;
handler->Handle(reqData, resData);
// Pack result
std::string resNetPacket;
RPCHeader resHeader(resData.size());
resNetPacket.append(resHeader.Encode());
resNetPacket.append(resData);
in = resNetPacket;
return reqNetPacket.size();
}
std::expected<int, std::string> FakeConnector::Read(std::string& res, int size) {
res = in;
return 0;
}
FakeConnector::~FakeConnector() {}
+27
View File
@@ -0,0 +1,27 @@
#ifndef FAKECLIENT_HPP
#define FAKECLIENT_HPP
#include <expected>
#include <string>
#include <vector>
#include <span>
#include <iostream>
#include <sstream>
#include <memory>
#include <netclient.hpp>
#include <nethandler.hpp>
class FakeConnector : public NetClient {
private:
NetHandler* handler;
std::string in;
public:
FakeConnector(NetHandler& hand);
std::expected<int, std::string> Write(std::string payload) override;
std::expected<int, std::string> Read(std::string& buffer, int size) override;
~FakeConnector(void);
};
#endif
+53
View File
@@ -0,0 +1,53 @@
#include <expected>
#include <string>
#include <vector>
#include <span>
#include <iostream>
#include <sstream>
#include <netclient.hpp>
#include <nethandler.hpp>
#include <fakeconnect.hpp>
#include <rpcheader.hpp>
#include <control.pb.h>
class FakeHandler : public NetHandler {
public:
std::expected<void, std::string> Handle(std::string& req, std::string& res) override;
};
std::expected<void, std::string> FakeHandler::Handle(std::string& req, std::string& res) {
control::HelloRequest pbReq;
pbReq.ParseFromString(req);
std::cout << std::format("name: {}\n", pbReq.name());
std::cout << std::format("id: {}\n", pbReq.id());
return {};
}
int main(int argc, char** argv) {
FakeHandler handler;
FakeConnector conn(handler);
control::HelloRequest pbReq;
pbReq.set_id(10);
pbReq.set_name("barefoo");
std::string rawReq;
pbReq.SerializeToString(&rawReq);
RPCHeader reqHeader(rawReq.size());
auto rawHeader = reqHeader.Encode();
std::cout << rawHeader.size() << std::endl;
std::string reqPacket;
reqPacket.append(rawHeader);
reqPacket.append(rawReq);
conn.Write(reqPacket);
std::string rawRes;
}
-839
View File
@@ -1,839 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: hello.proto
#include "hello.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 control {
PROTOBUF_CONSTEXPR Header::Header(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.meta_)*/nullptr
, /*decltype(_impl_._cached_size_)*/{}} {}
struct HeaderDefaultTypeInternal {
PROTOBUF_CONSTEXPR HeaderDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
~HeaderDefaultTypeInternal() {}
union {
Header _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 HeaderDefaultTypeInternal _Header_default_instance_;
PROTOBUF_CONSTEXPR Meta::Meta(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.rpcname_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_._cached_size_)*/{}} {}
struct MetaDefaultTypeInternal {
PROTOBUF_CONSTEXPR MetaDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
~MetaDefaultTypeInternal() {}
union {
Meta _instance;
};
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MetaDefaultTypeInternal _Meta_default_instance_;
PROTOBUF_CONSTEXPR Hello::Hello(
::_pbi::ConstantInitialized): _impl_{
/*decltype(_impl_.name_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}}
, /*decltype(_impl_.meta_)*/nullptr
, /*decltype(_impl_.id_)*/0
, /*decltype(_impl_._cached_size_)*/{}} {}
struct HelloDefaultTypeInternal {
PROTOBUF_CONSTEXPR HelloDefaultTypeInternal()
: _instance(::_pbi::ConstantInitialized{}) {}
~HelloDefaultTypeInternal() {}
union {
Hello _instance;
};
};
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:
static const ::control::Meta& meta(const Header* msg);
};
const ::control::Meta&
Header::_Internal::meta(const Header* msg) {
return *msg->_impl_.meta_;
}
Header::Header(::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:control.Header)
}
Header::Header(const Header& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
Header* const _this = this;
(void)_this;
new (&_impl_) Impl_{
decltype(_impl_.meta_) {
nullptr
}
, /*decltype(_impl_._cached_size_)*/{}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
if (from._internal_has_meta()) {
_this->_impl_.meta_ = new ::control::Meta(*from._impl_.meta_);
}
// @@protoc_insertion_point(copy_constructor:control.Header)
}
inline void Header::SharedCtor(
::_pb::Arena* arena, bool is_message_owned) {
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
decltype(_impl_.meta_) {
nullptr
}
, /*decltype(_impl_._cached_size_)*/{}
};
}
Header::~Header() {
// @@protoc_insertion_point(destructor:control.Header)
if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
(void)arena;
return;
}
SharedDtor();
}
inline void Header::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
if (this != internal_default_instance()) delete _impl_.meta_;
}
void Header::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
void Header::Clear() {
// @@protoc_insertion_point(message_clear_start:control.Header)
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaForAllocation() == nullptr && _impl_.meta_ != nullptr) {
delete _impl_.meta_;
}
_impl_.meta_ = nullptr;
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
const char* Header::_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) {
// .control.Meta meta = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_meta(), 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* Header::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:control.Header)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// .control.Meta meta = 1;
if (this->_internal_has_meta()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(1, _Internal::meta(this),
_Internal::meta(this).GetCachedSize(), target, stream);
}
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:control.Header)
return target;
}
size_t Header::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:control.Header)
size_t total_size = 0;
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
// .control.Meta meta = 1;
if (this->_internal_has_meta()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.meta_);
}
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
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::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;
(void) cached_has_bits;
if (from._internal_has_meta()) {
_this->_internal_mutable_meta()->::control::Meta::MergeFrom(
from._internal_meta());
}
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void Header::CopyFrom(const Header& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:control.Header)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool Header::IsInitialized() const {
return true;
}
void Header::InternalSwap(Header* other) {
using std::swap;
_internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_impl_.meta_, other->_impl_.meta_);
}
::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:
};
Meta::Meta(::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:control.Meta)
}
Meta::Meta(const Meta& from)
: ::PROTOBUF_NAMESPACE_ID::Message() {
Meta* const _this = this;
(void)_this;
new (&_impl_) Impl_{
decltype(_impl_.rpcname_) {}
, /*decltype(_impl_._cached_size_)*/{}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
_impl_.rpcname_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.rpcname_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_rpcname().empty()) {
_this->_impl_.rpcname_.Set(from._internal_rpcname(),
_this->GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:control.Meta)
}
inline void Meta::SharedCtor(
::_pb::Arena* arena, bool is_message_owned) {
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
decltype(_impl_.rpcname_) {}
, /*decltype(_impl_._cached_size_)*/{}
};
_impl_.rpcname_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.rpcname_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
Meta::~Meta() {
// @@protoc_insertion_point(destructor:control.Meta)
if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
(void)arena;
return;
}
SharedDtor();
}
inline void Meta::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
_impl_.rpcname_.Destroy();
}
void Meta::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
void Meta::Clear() {
// @@protoc_insertion_point(message_clear_start:control.Meta)
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_impl_.rpcname_.ClearToEmpty();
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
const char* Meta::_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 rpcname = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
auto str = _internal_mutable_rpcname();
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
CHK_(::_pbi::VerifyUTF8(str, "control.Meta.rpcname"));
} 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* Meta::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:control.Meta)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// string rpcname = 1;
if (!this->_internal_rpcname().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_rpcname().data(), static_cast<int>(this->_internal_rpcname().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"control.Meta.rpcname");
target = stream->WriteStringMaybeAliased(
1, this->_internal_rpcname(), 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:control.Meta)
return target;
}
size_t Meta::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:control.Meta)
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 rpcname = 1;
if (!this->_internal_rpcname().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_rpcname());
}
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
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::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;
(void) cached_has_bits;
if (!from._internal_rpcname().empty()) {
_this->_internal_set_rpcname(from._internal_rpcname());
}
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void Meta::CopyFrom(const Meta& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:control.Meta)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool Meta::IsInitialized() const {
return true;
}
void Meta::InternalSwap(Meta* 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_.rpcname_, lhs_arena,
&other->_impl_.rpcname_, rhs_arena
);
}
::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:
static const ::control::Meta& meta(const Hello* msg);
};
const ::control::Meta&
Hello::_Internal::meta(const Hello* msg) {
return *msg->_impl_.meta_;
}
Hello::Hello(::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:control.Hello)
}
Hello::Hello(const Hello& from)
: ::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_._cached_size_)*/{}};
_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
_impl_.name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (!from._internal_name().empty()) {
_this->_impl_.name_.Set(from._internal_name(),
_this->GetArenaForAllocation());
}
if (from._internal_has_meta()) {
_this->_impl_.meta_ = new ::control::Meta(*from._impl_.meta_);
}
_this->_impl_.id_ = from._impl_.id_;
// @@protoc_insertion_point(copy_constructor:control.Hello)
}
inline void Hello::SharedCtor(
::_pb::Arena* arena, bool is_message_owned) {
(void)arena;
(void)is_message_owned;
new (&_impl_) Impl_{
decltype(_impl_.name_) {}
, decltype(_impl_.meta_) {
nullptr
}
, decltype(_impl_.id_) {
0
}
, /*decltype(_impl_._cached_size_)*/{}
};
_impl_.name_.InitDefault();
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
_impl_.name_.Set("", GetArenaForAllocation());
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
}
Hello::~Hello() {
// @@protoc_insertion_point(destructor:control.Hello)
if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
(void)arena;
return;
}
SharedDtor();
}
inline void Hello::SharedDtor() {
GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
_impl_.name_.Destroy();
if (this != internal_default_instance()) delete _impl_.meta_;
}
void Hello::SetCachedSize(int size) const {
_impl_._cached_size_.Set(size);
}
void Hello::Clear() {
// @@protoc_insertion_point(message_clear_start:control.Hello)
uint32_t cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
_impl_.name_.ClearToEmpty();
if (GetArenaForAllocation() == nullptr && _impl_.meta_ != nullptr) {
delete _impl_.meta_;
}
_impl_.meta_ = nullptr;
_impl_.id_ = 0;
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
const char* Hello::_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) {
// .control.Meta meta = 1;
case 1:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
ptr = ctx->ParseMessage(_internal_mutable_meta(), ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// int32 id = 2;
case 2:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
_impl_.id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
CHK_(ptr);
} else
goto handle_unusual;
continue;
// string name = 3;
case 3:
if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
auto str = _internal_mutable_name();
ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx);
CHK_(ptr);
CHK_(::_pbi::VerifyUTF8(str, "control.Hello.name"));
} 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* Hello::_InternalSerialize(
uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
// @@protoc_insertion_point(serialize_to_array_start:control.Hello)
uint32_t cached_has_bits = 0;
(void) cached_has_bits;
// .control.Meta meta = 1;
if (this->_internal_has_meta()) {
target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
InternalWriteMessage(1, _Internal::meta(this),
_Internal::meta(this).GetCachedSize(), target, stream);
}
// int32 id = 2;
if (this->_internal_id() != 0) {
target = stream->EnsureSpace(target);
target = ::_pbi::WireFormatLite::WriteInt32ToArray(2, this->_internal_id(), target);
}
// string name = 3;
if (!this->_internal_name().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
"control.Hello.name");
target = stream->WriteStringMaybeAliased(
3, this->_internal_name(), 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:control.Hello)
return target;
}
size_t Hello::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:control.Hello)
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 name = 3;
if (!this->_internal_name().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_name());
}
// .control.Meta meta = 1;
if (this->_internal_has_meta()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
*_impl_.meta_);
}
// int32 id = 2;
if (this->_internal_id() != 0) {
total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_id());
}
return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}
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::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;
(void) cached_has_bits;
if (!from._internal_name().empty()) {
_this->_internal_set_name(from._internal_name());
}
if (from._internal_has_meta()) {
_this->_internal_mutable_meta()->::control::Meta::MergeFrom(
from._internal_meta());
}
if (from._internal_id() != 0) {
_this->_internal_set_id(from._internal_id());
}
_this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}
void Hello::CopyFrom(const Hello& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:control.Hello)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool Hello::IsInitialized() const {
return true;
}
void Hello::InternalSwap(Hello* 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_.name_, lhs_arena,
&other->_impl_.name_, rhs_arena
);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(Hello, _impl_.id_)
+ sizeof(Hello::_impl_.id_)
- PROTOBUF_FIELD_OFFSET(Hello, _impl_.meta_)>(
reinterpret_cast<char*>(&_impl_.meta_),
reinterpret_cast<char*>(&other->_impl_.meta_));
}
::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
template<> PROTOBUF_NOINLINE ::control::Header*
Arena::CreateMaybeMessage< ::control::Header >(Arena* arena) {
return Arena::CreateMessageInternal< ::control::Header >(arena);
}
template<> PROTOBUF_NOINLINE ::control::Meta*
Arena::CreateMaybeMessage< ::control::Meta >(Arena* arena) {
return Arena::CreateMessageInternal< ::control::Meta >(arena);
}
template<> PROTOBUF_NOINLINE ::control::Hello*
Arena::CreateMaybeMessage< ::control::Hello >(Arena* arena) {
return Arena::CreateMessageInternal< ::control::Hello >(arena);
}
PROTOBUF_NAMESPACE_CLOSE
// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
-909
View File
@@ -1,909 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: hello.proto
#ifndef GOOGLE_PROTOBUF_INCLUDED_hello_2eproto
#define GOOGLE_PROTOBUF_INCLUDED_hello_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_hello_2eproto
PROTOBUF_NAMESPACE_OPEN
namespace internal {
class AnyMetadata;
} // namespace internal
PROTOBUF_NAMESPACE_CLOSE
// Internal implementation detail -- do not use these members.
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;
extern HeaderDefaultTypeInternal _Header_default_instance_;
class Hello;
struct HelloDefaultTypeInternal;
extern HelloDefaultTypeInternal _Hello_default_instance_;
class Meta;
struct MetaDefaultTypeInternal;
extern MetaDefaultTypeInternal _Meta_default_instance_;
} // namespace control
PROTOBUF_NAMESPACE_OPEN
template<> ::control::Header* Arena::CreateMaybeMessage<::control::Header>(Arena*);
template<> ::control::Hello* Arena::CreateMaybeMessage<::control::Hello>(Arena*);
template<> ::control::Meta* Arena::CreateMaybeMessage<::control::Meta>(Arena*);
PROTOBUF_NAMESPACE_CLOSE
namespace control {
// ===================================================================
class Header final :
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);
Header(const Header& from);
Header(Header&& from) noexcept
: Header() {
*this = ::std::move(from);
}
inline Header& operator=(const Header& from) {
CopyFrom(from);
return *this;
}
inline Header& operator=(Header&& 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 Header& default_instance() {
return *internal_default_instance();
}
static inline const Header* internal_default_instance() {
return reinterpret_cast<const Header*>(
&_Header_default_instance_);
}
static constexpr int kIndexInFileMessages =
0;
friend void swap(Header& a, Header& b) {
a.Swap(&b);
}
inline void Swap(Header* 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(Header* other) {
if (other == this) return;
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
Header* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
return CreateMaybeMessage<Header>(arena);
}
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(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;
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(Header* other);
private:
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "control.Header";
}
protected:
explicit Header(::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 {
kMetaFieldNumber = 1,
};
// .control.Meta meta = 1;
bool has_meta() const;
private:
bool _internal_has_meta() const;
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:
const ::control::Meta& _internal_meta() const;
::control::Meta* _internal_mutable_meta();
public:
void unsafe_arena_set_allocated_meta(
::control::Meta* meta);
::control::Meta* unsafe_arena_release_meta();
// @@protoc_insertion_point(class_scope:control.Header)
private:
class _Internal;
template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
typedef void InternalArenaConstructable_;
typedef void DestructorSkippable_;
struct Impl_ {
::control::Meta* meta_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
};
union {
Impl_ _impl_;
};
friend struct ::TableStruct_hello_2eproto;
};
// -------------------------------------------------------------------
class Meta final :
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);
Meta(const Meta& from);
Meta(Meta&& from) noexcept
: Meta() {
*this = ::std::move(from);
}
inline Meta& operator=(const Meta& from) {
CopyFrom(from);
return *this;
}
inline Meta& operator=(Meta&& 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 Meta& default_instance() {
return *internal_default_instance();
}
static inline const Meta* internal_default_instance() {
return reinterpret_cast<const Meta*>(
&_Meta_default_instance_);
}
static constexpr int kIndexInFileMessages =
1;
friend void swap(Meta& a, Meta& b) {
a.Swap(&b);
}
inline void Swap(Meta* 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(Meta* other) {
if (other == this) return;
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
Meta* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
return CreateMaybeMessage<Meta>(arena);
}
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(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;
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(Meta* other);
private:
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "control.Meta";
}
protected:
explicit Meta(::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 {
kRpcnameFieldNumber = 1,
};
// string rpcname = 1;
void clear_rpcname();
const std::string& rpcname() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_rpcname(ArgT0&& arg0, ArgT... args);
std::string* mutable_rpcname();
PROTOBUF_NODISCARD std::string* release_rpcname();
void set_allocated_rpcname(std::string* rpcname);
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:
// @@protoc_insertion_point(class_scope:control.Meta)
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 rpcname_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
};
union {
Impl_ _impl_;
};
friend struct ::TableStruct_hello_2eproto;
};
// -------------------------------------------------------------------
class Hello final :
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);
Hello(const Hello& from);
Hello(Hello&& from) noexcept
: Hello() {
*this = ::std::move(from);
}
inline Hello& operator=(const Hello& from) {
CopyFrom(from);
return *this;
}
inline Hello& operator=(Hello&& 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 Hello& default_instance() {
return *internal_default_instance();
}
static inline const Hello* internal_default_instance() {
return reinterpret_cast<const Hello*>(
&_Hello_default_instance_);
}
static constexpr int kIndexInFileMessages =
2;
friend void swap(Hello& a, Hello& b) {
a.Swap(&b);
}
inline void Swap(Hello* 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(Hello* other) {
if (other == this) return;
GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
Hello* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
return CreateMaybeMessage<Hello>(arena);
}
using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
void CopyFrom(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;
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(Hello* other);
private:
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "control.Hello";
}
protected:
explicit Hello(::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 {
kNameFieldNumber = 3,
kMetaFieldNumber = 1,
kIdFieldNumber = 2,
};
// string name = 3;
void clear_name();
const std::string& name() const;
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
PROTOBUF_NODISCARD std::string* release_name();
void set_allocated_name(std::string* name);
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:
// .control.Meta meta = 1;
bool has_meta() const;
private:
bool _internal_has_meta() const;
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:
const ::control::Meta& _internal_meta() const;
::control::Meta* _internal_mutable_meta();
public:
void unsafe_arena_set_allocated_meta(
::control::Meta* meta);
::control::Meta* unsafe_arena_release_meta();
// int32 id = 2;
void clear_id();
int32_t id() const;
void set_id(int32_t value);
private:
int32_t _internal_id() const;
void _internal_set_id(int32_t value);
public:
// @@protoc_insertion_point(class_scope:control.Hello)
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 name_;
::control::Meta* meta_;
int32_t id_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
};
union {
Impl_ _impl_;
};
friend struct ::TableStruct_hello_2eproto;
};
// ===================================================================
// ===================================================================
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif // __GNUC__
// Header
// .control.Meta meta = 1;
inline bool Header::_internal_has_meta() const {
return this != internal_default_instance() && _impl_.meta_ != nullptr;
}
inline bool Header::has_meta() const {
return _internal_has_meta();
}
inline void Header::clear_meta() {
if (GetArenaForAllocation() == nullptr && _impl_.meta_ != nullptr) {
delete _impl_.meta_;
}
_impl_.meta_ = nullptr;
}
inline const ::control::Meta& Header::_internal_meta() const {
const ::control::Meta* p = _impl_.meta_;
return p != nullptr ? *p : reinterpret_cast<const ::control::Meta&>(
::control::_Meta_default_instance_);
}
inline const ::control::Meta& Header::meta() const {
// @@protoc_insertion_point(field_get:control.Header.meta)
return _internal_meta();
}
inline void Header::unsafe_arena_set_allocated_meta(
::control::Meta* meta) {
if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.meta_);
}
_impl_.meta_ = meta;
if (meta) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:control.Header.meta)
}
inline ::control::Meta* Header::release_meta() {
::control::Meta* temp = _impl_.meta_;
_impl_.meta_ = nullptr;
#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;
}
#else // PROTOBUF_FORCE_COPY_IN_RELEASE
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
return temp;
}
inline ::control::Meta* Header::unsafe_arena_release_meta() {
// @@protoc_insertion_point(field_release:control.Header.meta)
::control::Meta* temp = _impl_.meta_;
_impl_.meta_ = nullptr;
return temp;
}
inline ::control::Meta* Header::_internal_mutable_meta() {
if (_impl_.meta_ == nullptr) {
auto* p = CreateMaybeMessage<::control::Meta>(GetArenaForAllocation());
_impl_.meta_ = p;
}
return _impl_.meta_;
}
inline ::control::Meta* Header::mutable_meta() {
::control::Meta* _msg = _internal_mutable_meta();
// @@protoc_insertion_point(field_mutable:control.Header.meta)
return _msg;
}
inline void Header::set_allocated_meta(::control::Meta* meta) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete _impl_.meta_;
}
if (meta) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(meta);
if (message_arena != submessage_arena) {
meta = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, meta, submessage_arena);
}
} else {
}
_impl_.meta_ = meta;
// @@protoc_insertion_point(field_set_allocated:control.Header.meta)
}
// -------------------------------------------------------------------
// Meta
// string rpcname = 1;
inline void Meta::clear_rpcname() {
_impl_.rpcname_.ClearToEmpty();
}
inline const std::string& Meta::rpcname() const {
// @@protoc_insertion_point(field_get:control.Meta.rpcname)
return _internal_rpcname();
}
template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void Meta::set_rpcname(ArgT0&& arg0, ArgT... args) {
_impl_.rpcname_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:control.Meta.rpcname)
}
inline std::string* Meta::mutable_rpcname() {
std::string* _s = _internal_mutable_rpcname();
// @@protoc_insertion_point(field_mutable:control.Meta.rpcname)
return _s;
}
inline const std::string& Meta::_internal_rpcname() const {
return _impl_.rpcname_.Get();
}
inline void Meta::_internal_set_rpcname(const std::string& value) {
_impl_.rpcname_.Set(value, GetArenaForAllocation());
}
inline std::string* Meta::_internal_mutable_rpcname() {
return _impl_.rpcname_.Mutable(GetArenaForAllocation());
}
inline std::string* Meta::release_rpcname() {
// @@protoc_insertion_point(field_release:control.Meta.rpcname)
return _impl_.rpcname_.Release();
}
inline void Meta::set_allocated_rpcname(std::string* rpcname) {
if (rpcname != nullptr) {
} else {
}
_impl_.rpcname_.SetAllocated(rpcname, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (_impl_.rpcname_.IsDefault()) {
_impl_.rpcname_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:control.Meta.rpcname)
}
// -------------------------------------------------------------------
// Hello
// .control.Meta meta = 1;
inline bool Hello::_internal_has_meta() const {
return this != internal_default_instance() && _impl_.meta_ != nullptr;
}
inline bool Hello::has_meta() const {
return _internal_has_meta();
}
inline void Hello::clear_meta() {
if (GetArenaForAllocation() == nullptr && _impl_.meta_ != nullptr) {
delete _impl_.meta_;
}
_impl_.meta_ = nullptr;
}
inline const ::control::Meta& Hello::_internal_meta() const {
const ::control::Meta* p = _impl_.meta_;
return p != nullptr ? *p : reinterpret_cast<const ::control::Meta&>(
::control::_Meta_default_instance_);
}
inline const ::control::Meta& Hello::meta() const {
// @@protoc_insertion_point(field_get:control.Hello.meta)
return _internal_meta();
}
inline void Hello::unsafe_arena_set_allocated_meta(
::control::Meta* meta) {
if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.meta_);
}
_impl_.meta_ = meta;
if (meta) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:control.Hello.meta)
}
inline ::control::Meta* Hello::release_meta() {
::control::Meta* temp = _impl_.meta_;
_impl_.meta_ = nullptr;
#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;
}
#else // PROTOBUF_FORCE_COPY_IN_RELEASE
if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE
return temp;
}
inline ::control::Meta* Hello::unsafe_arena_release_meta() {
// @@protoc_insertion_point(field_release:control.Hello.meta)
::control::Meta* temp = _impl_.meta_;
_impl_.meta_ = nullptr;
return temp;
}
inline ::control::Meta* Hello::_internal_mutable_meta() {
if (_impl_.meta_ == nullptr) {
auto* p = CreateMaybeMessage<::control::Meta>(GetArenaForAllocation());
_impl_.meta_ = p;
}
return _impl_.meta_;
}
inline ::control::Meta* Hello::mutable_meta() {
::control::Meta* _msg = _internal_mutable_meta();
// @@protoc_insertion_point(field_mutable:control.Hello.meta)
return _msg;
}
inline void Hello::set_allocated_meta(::control::Meta* meta) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete _impl_.meta_;
}
if (meta) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(meta);
if (message_arena != submessage_arena) {
meta = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, meta, submessage_arena);
}
} else {
}
_impl_.meta_ = meta;
// @@protoc_insertion_point(field_set_allocated:control.Hello.meta)
}
// int32 id = 2;
inline void Hello::clear_id() {
_impl_.id_ = 0;
}
inline int32_t Hello::_internal_id() const {
return _impl_.id_;
}
inline int32_t Hello::id() const {
// @@protoc_insertion_point(field_get:control.Hello.id)
return _internal_id();
}
inline void Hello::_internal_set_id(int32_t value) {
_impl_.id_ = value;
}
inline void Hello::set_id(int32_t value) {
_internal_set_id(value);
// @@protoc_insertion_point(field_set:control.Hello.id)
}
// string name = 3;
inline void Hello::clear_name() {
_impl_.name_.ClearToEmpty();
}
inline const std::string& Hello::name() const {
// @@protoc_insertion_point(field_get:control.Hello.name)
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
inline PROTOBUF_ALWAYS_INLINE
void Hello::set_name(ArgT0&& arg0, ArgT... args) {
_impl_.name_.Set(static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:control.Hello.name)
}
inline std::string* Hello::mutable_name() {
std::string* _s = _internal_mutable_name();
// @@protoc_insertion_point(field_mutable:control.Hello.name)
return _s;
}
inline const std::string& Hello::_internal_name() const {
return _impl_.name_.Get();
}
inline void Hello::_internal_set_name(const std::string& value) {
_impl_.name_.Set(value, GetArenaForAllocation());
}
inline std::string* Hello::_internal_mutable_name() {
return _impl_.name_.Mutable(GetArenaForAllocation());
}
inline std::string* Hello::release_name() {
// @@protoc_insertion_point(field_release:control.Hello.name)
return _impl_.name_.Release();
}
inline void Hello::set_allocated_name(std::string* name) {
if (name != nullptr) {
} else {
}
_impl_.name_.SetAllocated(name, GetArenaForAllocation());
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
if (_impl_.name_.IsDefault()) {
_impl_.name_.Set("", GetArenaForAllocation());
}
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
// @@protoc_insertion_point(field_set_allocated:control.Hello.name)
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// @@protoc_insertion_point(namespace_scope)
} // namespace control
// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_hello_2eproto
-21
View File
@@ -1,21 +0,0 @@
syntax = "proto3";
package control;
//option optimize_for = LITE_RUNTIME;
//option cc_generic_services = false;
message Header {
Meta meta = 1;
}
message Meta {
string rpcname = 1;
}
message Hello {
Meta meta = 1;
int32 id = 2;
string name = 3;
}
-26
View File
@@ -1,26 +0,0 @@
#include <expected>
#include <string>
#include <cstring>
#include <iostream>
#include <format>
#include <hello.pb.h>
int main(int argc, char** argv) {
control::Hello msg;
msg.set_id(1);
msg.set_name("bare");
auto meta = msg.mutable_meta();
meta->set_rpcname("getHello");
std::string buffer;
msg.SerializeToString(&buffer);
control::Header newmsg;
newmsg.ParsePartialFromString(buffer);
auto newmeta = newmsg.meta();
std::cout << std::format("{}\n", meta->rpcname());
}
+41
View File
@@ -0,0 +1,41 @@
extern "C" {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
}
#include <expected>
#include <string>
#include <vector>
#include <span>
#include <iostream>
#include <cstring>
#include <expected>
#include <string>
#include <iostream>
#include <sstream>
#include <netclient.hpp>
NetClient::NetClient() {}
std::expected<void, std::string> NetClient::Connect(const std::string naddress, const int port) {
return {};
}
std::expected<int, std::string> NetClient::Write(std::string payload) {
return payload.size();
}
std::expected<int, std::string> NetClient::Read(std::string& res, int size) {
return 0;
}
NetClient::~NetClient() {}
+21
View File
@@ -0,0 +1,21 @@
#ifndef NETCLIENT_HPP
#define NETCLIENT_HPP
#include <expected>
#include <string>
#include <vector>
#include <span>
#include <iostream>
#include <sstream>
class NetClient {
public:
NetClient(void);
virtual std::expected<void, std::string> Connect(std::string address, const int port);
virtual std::expected<int, std::string> Write(std::string payload);
virtual std::expected<int, std::string> Read(std::string& buffer, int size);
virtual ~NetClient(void);
};
#endif
+33
View File
@@ -0,0 +1,33 @@
extern "C" {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
}
#include <expected>
#include <string>
#include <vector>
#include <span>
#include <iostream>
#include <cstring>
#include <expected>
#include <string>
#include <iostream>
#include <sstream>
#include <nethandler.hpp>
NetHandler::NetHandler() {}
std::expected<void, std::string> NetHandler::Handle(std::string& req, std::string& res) {
return {};
}
NetHandler::~NetHandler() {}
+27
View File
@@ -0,0 +1,27 @@
#ifndef NETHANDLER_HPP
#define NETHANDLER_HPP
#include <expected>
#include <string>
#include <vector>
#include <span>
#include <iostream>
#include <sstream>
#include <netclient.hpp>
class NetHandler {
public:
NetHandler(void);
virtual std::expected<void, std::string> Handle(std::string& req, std::string& res);
virtual ~NetHandler(void);
NetHandler(const NetHandler&) = delete;
NetHandler& operator=(const NetHandler&) = delete;
};
#endif
-11
View File
@@ -1,11 +0,0 @@
#include <cstring>
#include <expected>
#include <iostream>
#include <span>
#include <string>
#include <vector>
class RPCClient {
};
+33 -4
View File
@@ -1,18 +1,47 @@
#include <cstring> #include <cstring>
#include <expected> #include <expected>
#include <iostream> #include <iostream>
#include <span> #include <span>
#include <string> #include <string>
#include <vector> #include <vector>
#include <sstream>
#include <google/protobuf/message.h> #include <google/protobuf/message.h>
#include <control.pb.h>
#include <rcpclient.hpp> #include <rpcclient.hpp>
#include <rpcheader.hpp>
//google::protobuf::Message
std::expected<void, std::string> Transaction(const google::protobuf::Message& m) { void Router(std::string& req, std::string& res) {
std::string rawResult;
control::HelloResult helloRes;
helloRes.Clear();
helloRes.set_name("foobare");
helloRes.set_id(12);
helloRes.SerializeToString(&rawResult);
res.append(rawResult);
}
std::expected<void, std::string> RPCClient::Transaction(const pbMessage& pbReq, pbMessage& pbRes) {
std::string rawRequest;
pbReq.SerializeToString(&rawRequest);
//RPCHeader header(rawRequest.size());
//auto rawHeader = header.Encode();
std::string reqPacket;
//request.append(rawHeader);
reqPacket.append(rawRequest);
std::string resPacket;
Router(reqPacket, resPacket);
pbRes.ParseFromString(resPacket);
return {}; return {};
} }
+18
View File
@@ -0,0 +1,18 @@
#include <cstring>
#include <expected>
#include <iostream>
#include <span>
#include <string>
#include <vector>
#include <google/protobuf/message.h>
using pbMessage = google::protobuf::Message;
using pbMessagePtr = std::unique_ptr<pbMessage>;
class RPCClient {
public:
std::expected<void, std::string> Transaction(const pbMessage& req, pbMessage& res);
};
+23
View File
@@ -0,0 +1,23 @@
#include <expected>
#include <string>
#include <cstring>
#include <iostream>
#include <format>
#include <control.pb.h>
#include <rpcclient.hpp>
int main(int argc, char** argv) {
RPCClient rpcCli;
control::HelloRequest pbReq;
pbReq.set_id(10);
pbReq.set_name("barefoo");
control::HelloResult pbRes;
pbRes.Clear();
auto trRes = rpcCli.Transaction(pbReq, pbRes);
std::cout << std::format("res name: {}\n", pbRes.name());
}
+6 -6
View File
@@ -10,17 +10,17 @@ extern "C" {
#include <format> #include <format>
#include <cstdint> #include <cstdint>
#include <header.hpp> #include <rpcheader.hpp>
Header::Header(const uint32_t ipSize) { RPCHeader::RPCHeader(const uint32_t ipSize) {
pSize = ipSize; pSize = ipSize;
} }
Header::Header(void) { RPCHeader::RPCHeader(void) {
pSize = 0; pSize = 0;
} }
std::string Header::Encode() { std::string RPCHeader::Encode() {
std::string buffer, tmp; std::string buffer, tmp;
auto magic = htonl(MAGIC); auto magic = htonl(MAGIC);
tmp = std::string(reinterpret_cast<const char*>(&magic), sizeof(magic)); tmp = std::string(reinterpret_cast<const char*>(&magic), sizeof(magic));
@@ -32,7 +32,7 @@ std::string Header::Encode() {
return buffer; return buffer;
} }
std::expected<void, std::string> Header::Decode(const std::string rawHeader) { std::expected<void, std::string> RPCHeader::Decode(const std::string rawHeader) {
uint32_t tmp; uint32_t tmp;
std::memcpy(&tmp, rawHeader.data(), sizeof(uint32_t)); std::memcpy(&tmp, rawHeader.data(), sizeof(uint32_t));
auto magic = ntohl(tmp); auto magic = ntohl(tmp);
@@ -44,6 +44,6 @@ std::expected<void, std::string> Header::Decode(const std::string rawHeader) {
return {}; return {};
} }
uint32_t Header::PacketSize() { uint32_t RPCHeader::PacketSize() {
return pSize; return pSize;
} }
+3 -3
View File
@@ -3,12 +3,12 @@
const uint32_t MAGIC = 0xABBA; const uint32_t MAGIC = 0xABBA;
class Header { class RPCHeader {
private: private:
uint32_t pSize = 0; uint32_t pSize = 0;
public: public:
Header(const uint32_t pSize); RPCHeader(const uint32_t pSize);
Header(void); RPCHeader(void);
std::string Encode(void); std::string Encode(void);
std::expected<void, std::string> Decode(const std::string buffer); std::expected<void, std::string> Decode(const std::string buffer);
uint32_t PacketSize(void); uint32_t PacketSize(void);
+3 -4
View File
@@ -5,14 +5,13 @@
#include <iostream> #include <iostream>
#include <format> #include <format>
#include <header.hpp> #include <rpcheader.hpp>
int main(int argc, char** argv) { int main(int argc, char** argv) {
uint32_t size = RPCHeader primary(1021);
Header primary(1021);
auto rawHeader = primary.Encode(); auto rawHeader = primary.Encode();
Header second; RPCHeader second;
second.Decode(rawHeader); second.Decode(rawHeader);
std::cout << std::format("{}\n", second.PacketSize()); std::cout << std::format("{}\n", second.PacketSize());
+2
View File
@@ -5,6 +5,8 @@
#include <span> #include <span>
#include <iostream> #include <iostream>
//#include <netclient.hpp>
class TCPClient { class TCPClient {
private: private:
int sock; int sock;
+1 -2
View File
@@ -8,8 +8,7 @@
#include <header.hpp> #include <header.hpp>
int main(int argc, char** argv) { int main(int argc, char** argv) {
uint32_t size = Header primary(1021);
Header primary(1021);
auto rawHeader = primary.Encode(); auto rawHeader = primary.Encode();
Header second; Header second;