working commit
This commit is contained in:
@@ -217,6 +217,7 @@ distcleancheck_listfiles = \
|
||||
ACLOCAL = ${SHELL} '/home/ziggi/Projects/tcpserv09/missing' aclocal-1.17
|
||||
AMTAR = $${TAR-tar}
|
||||
AM_DEFAULT_VERBOSITY = 1
|
||||
ASTYLE = /bin/astyle
|
||||
AUTOCONF = ${SHELL} '/home/ziggi/Projects/tcpserv09/missing' autoconf
|
||||
AUTOHEADER = ${SHELL} '/home/ziggi/Projects/tcpserv09/missing' autoheader
|
||||
AUTOMAKE = ${SHELL} '/home/ziggi/Projects/tcpserv09/missing' automake-1.17
|
||||
@@ -334,6 +335,7 @@ udpclient_test_SOURCES = \
|
||||
udpclient.cpp udpclient.hpp \
|
||||
udpclient_test.cpp
|
||||
|
||||
ASTYLE_OPTS = --indent=spaces=8 --style=java
|
||||
all: defines.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
||||
@@ -835,11 +837,14 @@ run: helmetd
|
||||
|
||||
hello.pb.cc hello.pb.h: hello.proto
|
||||
$(PROTOC) --cpp_out=. hello.proto
|
||||
format:
|
||||
$(ASTYLE) $(ASTYLE_OPTS) *.hpp *.cpp
|
||||
|
||||
clean-local:
|
||||
rm -rf autom4te.cache
|
||||
rm -f *~
|
||||
rm -f *.o
|
||||
rm -f *.orig
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -45,8 +45,14 @@ run: helmetd
|
||||
hello.pb.cc hello.pb.h: hello.proto
|
||||
$(PROTOC) --cpp_out=. hello.proto
|
||||
|
||||
ASTYLE_OPTS = --indent=spaces=8 --style=java
|
||||
format:
|
||||
$(ASTYLE) $(ASTYLE_OPTS) *.hpp *.cpp
|
||||
|
||||
clean-local:
|
||||
rm -rf autom4te.cache
|
||||
rm -f *~
|
||||
rm -f *.o
|
||||
rm -f *.orig
|
||||
|
||||
|
||||
|
||||
@@ -217,6 +217,7 @@ distcleancheck_listfiles = \
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
ASTYLE = @ASTYLE@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
@@ -334,6 +335,7 @@ udpclient_test_SOURCES = \
|
||||
udpclient.cpp udpclient.hpp \
|
||||
udpclient_test.cpp
|
||||
|
||||
ASTYLE_OPTS = --indent=spaces=8 --style=java
|
||||
all: defines.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
||||
@@ -835,11 +837,14 @@ run: helmetd
|
||||
|
||||
hello.pb.cc hello.pb.h: hello.proto
|
||||
$(PROTOC) --cpp_out=. hello.proto
|
||||
format:
|
||||
$(ASTYLE) $(ASTYLE_OPTS) *.hpp *.cpp
|
||||
|
||||
clean-local:
|
||||
rm -rf autom4te.cache
|
||||
rm -f *~
|
||||
rm -f *.o
|
||||
rm -f *.orig
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -610,6 +610,7 @@ ac_subst_vars='am__EXEEXT_FALSE
|
||||
am__EXEEXT_TRUE
|
||||
LTLIBOBJS
|
||||
LIBOBJS
|
||||
ASTYLE
|
||||
PROTOC
|
||||
am__fastdepCXX_FALSE
|
||||
am__fastdepCXX_TRUE
|
||||
@@ -4879,7 +4880,7 @@ fi
|
||||
|
||||
|
||||
|
||||
for ac_prog in protoc
|
||||
for ac_prog in protoc 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
|
||||
@@ -4930,6 +4931,58 @@ fi
|
||||
test -n "$PROTOC" && break
|
||||
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"
|
||||
|
||||
|
||||
+3
-1
@@ -7,7 +7,9 @@ AC_PROG_CC([gcc cc])
|
||||
AC_PROG_RANLIB
|
||||
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([
|
||||
Makefile
|
||||
|
||||
+14
-11
@@ -38,7 +38,7 @@ namespace control {
|
||||
// ===================================================================
|
||||
|
||||
class Hello::_Internal {
|
||||
public:
|
||||
public:
|
||||
};
|
||||
|
||||
Hello::Hello(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
@@ -49,17 +49,18 @@ Hello::Hello(::PROTOBUF_NAMESPACE_ID::Arena* arena,
|
||||
}
|
||||
Hello::Hello(const Hello& from)
|
||||
: ::PROTOBUF_NAMESPACE_ID::MessageLite() {
|
||||
Hello* const _this = this; (void)_this;
|
||||
Hello* const _this = this;
|
||||
(void)_this;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.name_){}
|
||||
, decltype(_impl_.id_){}
|
||||
decltype(_impl_.name_) {}
|
||||
, decltype(_impl_.id_) {}
|
||||
, /*decltype(_impl_._cached_size_)*/{}};
|
||||
|
||||
_internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
|
||||
_impl_.name_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
if (!from._internal_name().empty()) {
|
||||
_this->_impl_.name_.Set(from._internal_name(),
|
||||
_this->GetArenaForAllocation());
|
||||
@@ -73,14 +74,16 @@ inline void Hello::SharedCtor(
|
||||
(void)arena;
|
||||
(void)is_message_owned;
|
||||
new (&_impl_) Impl_{
|
||||
decltype(_impl_.name_){}
|
||||
, decltype(_impl_.id_){0}
|
||||
decltype(_impl_.name_) {}
|
||||
, decltype(_impl_.id_) {
|
||||
0
|
||||
}
|
||||
, /*decltype(_impl_._cached_size_)*/{}
|
||||
};
|
||||
_impl_.name_.InitDefault();
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
_impl_.name_.Set("", GetArenaForAllocation());
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
|
||||
}
|
||||
|
||||
Hello::~Hello() {
|
||||
@@ -139,7 +142,7 @@ const char* Hello::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
|
||||
default:
|
||||
goto handle_unusual;
|
||||
} // switch
|
||||
handle_unusual:
|
||||
handle_unusual:
|
||||
if ((tag == 0) || ((tag & 7) == 4)) {
|
||||
CHK_(ptr);
|
||||
ctx->SetLastTag(tag);
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@
|
||||
#define INTERFACE_HPP
|
||||
|
||||
class Interface {
|
||||
private:
|
||||
private:
|
||||
int tunfd;
|
||||
std::string ifname;
|
||||
int mtu;
|
||||
public:
|
||||
public:
|
||||
std::expected<void, std::string> Create(const std::string name);
|
||||
std::string Name();
|
||||
int MTU();
|
||||
|
||||
+4
-4
@@ -3,18 +3,18 @@
|
||||
#include <string>
|
||||
|
||||
class Address {
|
||||
private:
|
||||
private:
|
||||
int family;
|
||||
std::string address;
|
||||
public:
|
||||
public:
|
||||
Address(const std::string iaddress, const int ifamily);
|
||||
int GetFamily();
|
||||
std::string GetAddress();
|
||||
};
|
||||
|
||||
class Resolver {
|
||||
private:
|
||||
private:
|
||||
int family;
|
||||
public:
|
||||
public:
|
||||
std::expected<Address, std::string> Resolve(const std::string hostname);
|
||||
};
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@
|
||||
#include <service.hpp>
|
||||
|
||||
class Server {
|
||||
private:
|
||||
private:
|
||||
Interface iface;
|
||||
public:
|
||||
public:
|
||||
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);
|
||||
}
|
||||
|
||||
std::expected<void, std::string> Service::Bind(void){
|
||||
std::expected<void, std::string> Service::Bind(void) {
|
||||
struct sockaddr_in address;
|
||||
int srvsock;
|
||||
if ((srvsock = socket(AF_INET, SOCK_STREAM, 0)) == 0) {
|
||||
@@ -62,7 +62,7 @@ std::expected<void, std::string> Service::Bind(void){
|
||||
return {};
|
||||
}
|
||||
|
||||
std::expected<void, std::string> Service::Listen(Handler *handler){
|
||||
std::expected<void, std::string> Service::Listen(Handler *handler) {
|
||||
struct sockaddr_in address;
|
||||
int addrlen = sizeof(address);
|
||||
int newsock = 0;
|
||||
|
||||
+3
-3
@@ -6,15 +6,15 @@
|
||||
#include <string>
|
||||
|
||||
class Handler {
|
||||
public:
|
||||
public:
|
||||
void Handle(int sock);
|
||||
};
|
||||
|
||||
class Service {
|
||||
private:
|
||||
private:
|
||||
int port;
|
||||
int sock;
|
||||
public:
|
||||
public:
|
||||
explicit Service(int port);
|
||||
std::expected<void, std::string> Bind(void);
|
||||
std::expected<void, std::string> Listen(Handler *handler);
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ extern "C" {
|
||||
#include <udpclient.hpp>
|
||||
|
||||
|
||||
UDPClient::UDPClient(void){
|
||||
UDPClient::UDPClient(void) {
|
||||
sockfd = 0;
|
||||
rmax = 2024;
|
||||
};
|
||||
|
||||
+2
-2
@@ -3,13 +3,13 @@
|
||||
#define UPDCLIENT_HPP
|
||||
|
||||
class UDPClient {
|
||||
private:
|
||||
private:
|
||||
int sockfd;
|
||||
std::string address;
|
||||
int port;
|
||||
int rmax;
|
||||
int family;
|
||||
public:
|
||||
public:
|
||||
UDPClient(void);
|
||||
std::expected<void, std::string> Bind(std::string address, int port);
|
||||
std::expected<void, std::string> Send(std::string buffer);
|
||||
|
||||
Reference in New Issue
Block a user