working commit
This commit is contained in:
@@ -217,6 +217,7 @@ distcleancheck_listfiles = \
|
|||||||
ACLOCAL = ${SHELL} '/home/ziggi/Projects/tcpserv09/missing' aclocal-1.17
|
ACLOCAL = ${SHELL} '/home/ziggi/Projects/tcpserv09/missing' aclocal-1.17
|
||||||
AMTAR = $${TAR-tar}
|
AMTAR = $${TAR-tar}
|
||||||
AM_DEFAULT_VERBOSITY = 1
|
AM_DEFAULT_VERBOSITY = 1
|
||||||
|
ASTYLE = /bin/astyle
|
||||||
AUTOCONF = ${SHELL} '/home/ziggi/Projects/tcpserv09/missing' autoconf
|
AUTOCONF = ${SHELL} '/home/ziggi/Projects/tcpserv09/missing' autoconf
|
||||||
AUTOHEADER = ${SHELL} '/home/ziggi/Projects/tcpserv09/missing' autoheader
|
AUTOHEADER = ${SHELL} '/home/ziggi/Projects/tcpserv09/missing' autoheader
|
||||||
AUTOMAKE = ${SHELL} '/home/ziggi/Projects/tcpserv09/missing' automake-1.17
|
AUTOMAKE = ${SHELL} '/home/ziggi/Projects/tcpserv09/missing' automake-1.17
|
||||||
@@ -334,6 +335,7 @@ udpclient_test_SOURCES = \
|
|||||||
udpclient.cpp udpclient.hpp \
|
udpclient.cpp udpclient.hpp \
|
||||||
udpclient_test.cpp
|
udpclient_test.cpp
|
||||||
|
|
||||||
|
ASTYLE_OPTS = --indent=spaces=8 --style=java
|
||||||
all: defines.h
|
all: defines.h
|
||||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||||
|
|
||||||
@@ -835,11 +837,14 @@ run: helmetd
|
|||||||
|
|
||||||
hello.pb.cc hello.pb.h: hello.proto
|
hello.pb.cc hello.pb.h: hello.proto
|
||||||
$(PROTOC) --cpp_out=. hello.proto
|
$(PROTOC) --cpp_out=. hello.proto
|
||||||
|
format:
|
||||||
|
$(ASTYLE) $(ASTYLE_OPTS) *.hpp *.cpp
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -rf autom4te.cache
|
rm -rf autom4te.cache
|
||||||
rm -f *~
|
rm -f *~
|
||||||
rm -f *.o
|
rm -f *.o
|
||||||
|
rm -f *.orig
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
|||||||
@@ -45,8 +45,14 @@ run: helmetd
|
|||||||
hello.pb.cc hello.pb.h: hello.proto
|
hello.pb.cc hello.pb.h: hello.proto
|
||||||
$(PROTOC) --cpp_out=. hello.proto
|
$(PROTOC) --cpp_out=. hello.proto
|
||||||
|
|
||||||
|
ASTYLE_OPTS = --indent=spaces=8 --style=java
|
||||||
|
format:
|
||||||
|
$(ASTYLE) $(ASTYLE_OPTS) *.hpp *.cpp
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -rf autom4te.cache
|
rm -rf autom4te.cache
|
||||||
rm -f *~
|
rm -f *~
|
||||||
rm -f *.o
|
rm -f *.o
|
||||||
|
rm -f *.orig
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ distcleancheck_listfiles = \
|
|||||||
ACLOCAL = @ACLOCAL@
|
ACLOCAL = @ACLOCAL@
|
||||||
AMTAR = @AMTAR@
|
AMTAR = @AMTAR@
|
||||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||||
|
ASTYLE = @ASTYLE@
|
||||||
AUTOCONF = @AUTOCONF@
|
AUTOCONF = @AUTOCONF@
|
||||||
AUTOHEADER = @AUTOHEADER@
|
AUTOHEADER = @AUTOHEADER@
|
||||||
AUTOMAKE = @AUTOMAKE@
|
AUTOMAKE = @AUTOMAKE@
|
||||||
@@ -334,6 +335,7 @@ udpclient_test_SOURCES = \
|
|||||||
udpclient.cpp udpclient.hpp \
|
udpclient.cpp udpclient.hpp \
|
||||||
udpclient_test.cpp
|
udpclient_test.cpp
|
||||||
|
|
||||||
|
ASTYLE_OPTS = --indent=spaces=8 --style=java
|
||||||
all: defines.h
|
all: defines.h
|
||||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||||
|
|
||||||
@@ -835,11 +837,14 @@ run: helmetd
|
|||||||
|
|
||||||
hello.pb.cc hello.pb.h: hello.proto
|
hello.pb.cc hello.pb.h: hello.proto
|
||||||
$(PROTOC) --cpp_out=. hello.proto
|
$(PROTOC) --cpp_out=. hello.proto
|
||||||
|
format:
|
||||||
|
$(ASTYLE) $(ASTYLE_OPTS) *.hpp *.cpp
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -rf autom4te.cache
|
rm -rf autom4te.cache
|
||||||
rm -f *~
|
rm -f *~
|
||||||
rm -f *.o
|
rm -f *.o
|
||||||
|
rm -f *.orig
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
|||||||
@@ -610,6 +610,7 @@ ac_subst_vars='am__EXEEXT_FALSE
|
|||||||
am__EXEEXT_TRUE
|
am__EXEEXT_TRUE
|
||||||
LTLIBOBJS
|
LTLIBOBJS
|
||||||
LIBOBJS
|
LIBOBJS
|
||||||
|
ASTYLE
|
||||||
PROTOC
|
PROTOC
|
||||||
am__fastdepCXX_FALSE
|
am__fastdepCXX_FALSE
|
||||||
am__fastdepCXX_TRUE
|
am__fastdepCXX_TRUE
|
||||||
@@ -4879,7 +4880,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
for ac_prog in protoc
|
for ac_prog in protoc true
|
||||||
do
|
do
|
||||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||||
set dummy $ac_prog; ac_word=$2
|
set dummy $ac_prog; ac_word=$2
|
||||||
@@ -4930,6 +4931,58 @@ fi
|
|||||||
test -n "$PROTOC" && break
|
test -n "$PROTOC" && break
|
||||||
done
|
done
|
||||||
|
|
||||||
|
for ac_prog in astyle true
|
||||||
|
do
|
||||||
|
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||||
|
set dummy $ac_prog; ac_word=$2
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||||
|
printf %s "checking for $ac_word... " >&6; }
|
||||||
|
if test ${ac_cv_path_ASTYLE+y}
|
||||||
|
then :
|
||||||
|
printf %s "(cached) " >&6
|
||||||
|
else case e in #(
|
||||||
|
e) case $ASTYLE in
|
||||||
|
[\\/]* | ?:[\\/]*)
|
||||||
|
ac_cv_path_ASTYLE="$ASTYLE" # Let the user override the test with a path.
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
||||||
|
for as_dir in $PATH
|
||||||
|
do
|
||||||
|
IFS=$as_save_IFS
|
||||||
|
case $as_dir in #(((
|
||||||
|
'') as_dir=./ ;;
|
||||||
|
*/) ;;
|
||||||
|
*) as_dir=$as_dir/ ;;
|
||||||
|
esac
|
||||||
|
for ac_exec_ext in '' $ac_executable_extensions; do
|
||||||
|
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
|
||||||
|
ac_cv_path_ASTYLE="$as_dir$ac_word$ac_exec_ext"
|
||||||
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
|
||||||
|
break 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
IFS=$as_save_IFS
|
||||||
|
|
||||||
|
;;
|
||||||
|
esac ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
ASTYLE=$ac_cv_path_ASTYLE
|
||||||
|
if test -n "$ASTYLE"; then
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ASTYLE" >&5
|
||||||
|
printf "%s\n" "$ASTYLE" >&6; }
|
||||||
|
else
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
printf "%s\n" "no" >&6; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
test -n "$ASTYLE" && break
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ac_config_files="$ac_config_files Makefile"
|
ac_config_files="$ac_config_files Makefile"
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -7,7 +7,9 @@ AC_PROG_CC([gcc cc])
|
|||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_CXX([g++ c++])
|
AC_PROG_CXX([g++ c++])
|
||||||
|
|
||||||
AC_PATH_PROGS([PROTOC],[protoc])
|
AC_PATH_PROGS([PROTOC],[protoc true])
|
||||||
|
AC_PATH_PROGS([ASTYLE],[astyle true])
|
||||||
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
|
|||||||
+14
-11
@@ -38,7 +38,7 @@ namespace control {
|
|||||||
// ===================================================================
|
// ===================================================================
|
||||||
|
|
||||||
class Hello::_Internal {
|
class Hello::_Internal {
|
||||||
public:
|
public:
|
||||||
};
|
};
|
||||||
|
|
||||||
Hello::Hello(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
Hello::Hello(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||||
@@ -49,17 +49,18 @@ Hello::Hello(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
|||||||
}
|
}
|
||||||
Hello::Hello(const Hello& from)
|
Hello::Hello(const Hello& from)
|
||||||
: ::PROTOBUF_NAMESPACE_ID::MessageLite() {
|
: ::PROTOBUF_NAMESPACE_ID::MessageLite() {
|
||||||
Hello* const _this = this; (void)_this;
|
Hello* const _this = this;
|
||||||
|
(void)_this;
|
||||||
new (&_impl_) Impl_{
|
new (&_impl_) Impl_{
|
||||||
decltype(_impl_.name_){}
|
decltype(_impl_.name_) {}
|
||||||
, decltype(_impl_.id_){}
|
, decltype(_impl_.id_) {}
|
||||||
, /*decltype(_impl_._cached_size_)*/{}};
|
, /*decltype(_impl_._cached_size_)*/{}};
|
||||||
|
|
||||||
_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
|
_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
|
||||||
_impl_.name_.InitDefault();
|
_impl_.name_.InitDefault();
|
||||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||||
_impl_.name_.Set("", GetArenaForAllocation());
|
_impl_.name_.Set("", GetArenaForAllocation());
|
||||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||||
if (!from._internal_name().empty()) {
|
if (!from._internal_name().empty()) {
|
||||||
_this->_impl_.name_.Set(from._internal_name(),
|
_this->_impl_.name_.Set(from._internal_name(),
|
||||||
_this->GetArenaForAllocation());
|
_this->GetArenaForAllocation());
|
||||||
@@ -73,14 +74,16 @@ inline void Hello::SharedCtor(
|
|||||||
(void)arena;
|
(void)arena;
|
||||||
(void)is_message_owned;
|
(void)is_message_owned;
|
||||||
new (&_impl_) Impl_{
|
new (&_impl_) Impl_{
|
||||||
decltype(_impl_.name_){}
|
decltype(_impl_.name_) {}
|
||||||
, decltype(_impl_.id_){0}
|
, decltype(_impl_.id_) {
|
||||||
|
0
|
||||||
|
}
|
||||||
, /*decltype(_impl_._cached_size_)*/{}
|
, /*decltype(_impl_._cached_size_)*/{}
|
||||||
};
|
};
|
||||||
_impl_.name_.InitDefault();
|
_impl_.name_.InitDefault();
|
||||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||||
_impl_.name_.Set("", GetArenaForAllocation());
|
_impl_.name_.Set("", GetArenaForAllocation());
|
||||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||||
}
|
}
|
||||||
|
|
||||||
Hello::~Hello() {
|
Hello::~Hello() {
|
||||||
@@ -139,7 +142,7 @@ const char* Hello::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
|||||||
default:
|
default:
|
||||||
goto handle_unusual;
|
goto handle_unusual;
|
||||||
} // switch
|
} // switch
|
||||||
handle_unusual:
|
handle_unusual:
|
||||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||||
CHK_(ptr);
|
CHK_(ptr);
|
||||||
ctx->SetLastTag(tag);
|
ctx->SetLastTag(tag);
|
||||||
|
|||||||
+2
-2
@@ -3,11 +3,11 @@
|
|||||||
#define INTERFACE_HPP
|
#define INTERFACE_HPP
|
||||||
|
|
||||||
class Interface {
|
class Interface {
|
||||||
private:
|
private:
|
||||||
int tunfd;
|
int tunfd;
|
||||||
std::string ifname;
|
std::string ifname;
|
||||||
int mtu;
|
int mtu;
|
||||||
public:
|
public:
|
||||||
std::expected<void, std::string> Create(const std::string name);
|
std::expected<void, std::string> Create(const std::string name);
|
||||||
std::string Name();
|
std::string Name();
|
||||||
int MTU();
|
int MTU();
|
||||||
|
|||||||
+4
-4
@@ -3,18 +3,18 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class Address {
|
class Address {
|
||||||
private:
|
private:
|
||||||
int family;
|
int family;
|
||||||
std::string address;
|
std::string address;
|
||||||
public:
|
public:
|
||||||
Address(const std::string iaddress, const int ifamily);
|
Address(const std::string iaddress, const int ifamily);
|
||||||
int GetFamily();
|
int GetFamily();
|
||||||
std::string GetAddress();
|
std::string GetAddress();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Resolver {
|
class Resolver {
|
||||||
private:
|
private:
|
||||||
int family;
|
int family;
|
||||||
public:
|
public:
|
||||||
std::expected<Address, std::string> Resolve(const std::string hostname);
|
std::expected<Address, std::string> Resolve(const std::string hostname);
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-2
@@ -8,8 +8,8 @@
|
|||||||
#include <service.hpp>
|
#include <service.hpp>
|
||||||
|
|
||||||
class Server {
|
class Server {
|
||||||
private:
|
private:
|
||||||
Interface iface;
|
Interface iface;
|
||||||
public:
|
public:
|
||||||
std::expected<void, std::string> Create(const std::string name, const std::string addr, const int prefix);
|
std::expected<void, std::string> Create(const std::string name, const std::string addr, const int prefix);
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-2
@@ -31,7 +31,7 @@ Service::~Service() {
|
|||||||
close(port);
|
close(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::expected<void, std::string> Service::Bind(void){
|
std::expected<void, std::string> Service::Bind(void) {
|
||||||
struct sockaddr_in address;
|
struct sockaddr_in address;
|
||||||
int srvsock;
|
int srvsock;
|
||||||
if ((srvsock = socket(AF_INET, SOCK_STREAM, 0)) == 0) {
|
if ((srvsock = socket(AF_INET, SOCK_STREAM, 0)) == 0) {
|
||||||
@@ -62,7 +62,7 @@ std::expected<void, std::string> Service::Bind(void){
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::expected<void, std::string> Service::Listen(Handler *handler){
|
std::expected<void, std::string> Service::Listen(Handler *handler) {
|
||||||
struct sockaddr_in address;
|
struct sockaddr_in address;
|
||||||
int addrlen = sizeof(address);
|
int addrlen = sizeof(address);
|
||||||
int newsock = 0;
|
int newsock = 0;
|
||||||
|
|||||||
+3
-3
@@ -6,15 +6,15 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class Handler {
|
class Handler {
|
||||||
public:
|
public:
|
||||||
void Handle(int sock);
|
void Handle(int sock);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Service {
|
class Service {
|
||||||
private:
|
private:
|
||||||
int port;
|
int port;
|
||||||
int sock;
|
int sock;
|
||||||
public:
|
public:
|
||||||
explicit Service(int port);
|
explicit Service(int port);
|
||||||
std::expected<void, std::string> Bind(void);
|
std::expected<void, std::string> Bind(void);
|
||||||
std::expected<void, std::string> Listen(Handler *handler);
|
std::expected<void, std::string> Listen(Handler *handler);
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ extern "C" {
|
|||||||
#include <udpclient.hpp>
|
#include <udpclient.hpp>
|
||||||
|
|
||||||
|
|
||||||
UDPClient::UDPClient(void){
|
UDPClient::UDPClient(void) {
|
||||||
sockfd = 0;
|
sockfd = 0;
|
||||||
rmax = 2024;
|
rmax = 2024;
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-2
@@ -3,13 +3,13 @@
|
|||||||
#define UPDCLIENT_HPP
|
#define UPDCLIENT_HPP
|
||||||
|
|
||||||
class UDPClient {
|
class UDPClient {
|
||||||
private:
|
private:
|
||||||
int sockfd;
|
int sockfd;
|
||||||
std::string address;
|
std::string address;
|
||||||
int port;
|
int port;
|
||||||
int rmax;
|
int rmax;
|
||||||
int family;
|
int family;
|
||||||
public:
|
public:
|
||||||
UDPClient(void);
|
UDPClient(void);
|
||||||
std::expected<void, std::string> Bind(std::string address, int port);
|
std::expected<void, std::string> Bind(std::string address, int port);
|
||||||
std::expected<void, std::string> Send(std::string buffer);
|
std::expected<void, std::string> Send(std::string buffer);
|
||||||
|
|||||||
Reference in New Issue
Block a user