From 1566e0a502906b957c228af8886d07f77d83b159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9E=D0=BB=D0=B5=D0=B3=20=D0=91=D0=BE=D1=80=D0=BE=D0=B4?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Tue, 19 May 2026 13:43:20 +0200 Subject: [PATCH] working commit --- Makefile | 829 ------------------------------------------------- Makefile.in | 5 + configure | 230 +++++++++++++- configure.ac | 121 +++++++- defines.hpp | 23 +- defines.hpp.in | 15 + helmetsrv.conf | 2 +- helmetsrv.cpp | 5 +- iprouter.cpp | 2 +- uxclient.cpp | 19 +- 10 files changed, 399 insertions(+), 852 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 8399ded..0000000 --- a/Makefile +++ /dev/null @@ -1,829 +0,0 @@ -# Makefile.in generated by automake 1.17 from Makefile.am. -# Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994-2024 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - - - -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -am__rm_f = rm -f $(am__rm_f_notfound) -am__rm_rf = rm -rf $(am__rm_f_notfound) -pkgdatadir = $(datadir)/helmet -pkgincludedir = $(includedir)/helmet -pkglibdir = $(libdir)/helmet -pkglibexecdir = $(libexecdir)/helmet -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -sbin_PROGRAMS = helmetsrv$(EXEEXT) helmetcli$(EXEEXT) -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ - $(am__configure_deps) $(am__DIST_COMMON) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = defines.hpp -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(sbindir)" -PROGRAMS = $(sbin_PROGRAMS) -am__objects_1 = uxlogger.$(OBJEXT) msgheader.$(OBJEXT) \ - interface.$(OBJEXT) iprouter.$(OBJEXT) stringaux.$(OBJEXT) \ - networkaux.$(OBJEXT) uxcontrol.pb.$(OBJEXT) -am_helmetcli_OBJECTS = helmetcli.$(OBJEXT) uxclient.$(OBJEXT) \ - $(am__objects_1) -helmetcli_OBJECTS = $(am_helmetcli_OBJECTS) -helmetcli_LDADD = $(LDADD) -am_helmetsrv_OBJECTS = helmetsrv.$(OBJEXT) tservice.$(OBJEXT) \ - sockhand.$(OBJEXT) srvconfig.$(OBJEXT) $(am__objects_1) -helmetsrv_OBJECTS = $(am_helmetsrv_OBJECTS) -helmetsrv_LDADD = $(LDADD) -AM_V_P = $(am__v_P_$(V)) -am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I. -depcomp = -am__maybe_remake_depfiles = -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_$(V)) -am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = -CXXLD = $(CXX) -CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ - -o $@ -AM_V_CXXLD = $(am__v_CXXLD_$(V)) -am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_$(V)) -am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_$(V)) -am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(helmetcli_SOURCES) $(helmetsrv_SOURCES) -DIST_SOURCES = $(helmetcli_SOURCES) $(helmetsrv_SOURCES) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ - defines.hpp.in -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -AM_RECURSIVE_TARGETS = cscope -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/defines.hpp.in \ - compile install-sh missing -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - if test -d "$(distdir)"; then \ - find "$(distdir)" -type d ! -perm -700 -exec chmod u+rwx {} ';' \ - ; rm -rf "$(distdir)" \ - || { sleep 5 && rm -rf "$(distdir)"; }; \ - else :; fi -am__post_remove_distdir = $(am__remove_distdir) -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = -9 -DIST_TARGETS = dist-gzip -# Exists only to be overridden by the user if desired. -AM_DISTCHECK_DVI_TARGET = dvi -distuninstallcheck_listfiles = find . -type f -print -am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ - | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' -distcleancheck_listfiles = \ - find . \( -type f -a \! \ - \( -name .nfs* -o -name .smb* -o -name .__afs* \) \) -print -ACLOCAL = ${SHELL} '/home/ziggi/Projects/stvpn/missing' aclocal-1.17 -AMTAR = $${TAR-tar} -AM_DEFAULT_VERBOSITY = 1 -ASTYLE = /bin/astyle -AUTOCONF = ${SHELL} '/home/ziggi/Projects/stvpn/missing' autoconf -AUTOHEADER = ${SHELL} '/home/ziggi/Projects/stvpn/missing' autoheader -AUTOMAKE = ${SHELL} '/home/ziggi/Projects/stvpn/missing' automake-1.17 -AWK = mawk -CC = gcc -CCDEPMODE = depmode=none -CFLAGS = -g -O2 -CPPFLAGS = -CSCOPE = cscope -CTAGS = ctags -CXX = g++ -CXXDEPMODE = depmode=none -CXXFLAGS = -O -std=c++23 -Wall -I. -pthread -D_GNU_SOURCE=1 -MMD -MP -CYGPATH_W = echo -DEFS = -DHAVE_CONFIG_H -DEPDIR = .deps -ECHO_C = -ECHO_N = -n -ECHO_T = -ETAGS = etags -EXEEXT = -INSTALL = /bin/install -c -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = $(install_sh) -c -s -LDFLAGS = -pthread -LIBOBJS = -LIBS = -Wl,--as-need -lprotobuf -LTLIBOBJS = -MAKEINFO = ${SHELL} '/home/ziggi/Projects/stvpn/missing' makeinfo -MKDIR_P = /bin/mkdir -p -OBJEXT = o -PACKAGE = helmet -PACKAGE_BUGREPORT = -PACKAGE_NAME = helmet -PACKAGE_STRING = helmet 0.0.1 -PACKAGE_TARNAME = helmet -PACKAGE_URL = -PACKAGE_VERSION = 0.0.1 -PATH_SEPARATOR = : -PROTOC = /bin/protoc -RANLIB = ranlib -SET_MAKE = -SHELL = /bin/bash -STRIP = -VERSION = 0.0.1 -abs_builddir = /home/ziggi/Projects/stvpn -abs_srcdir = /home/ziggi/Projects/stvpn -abs_top_builddir = /home/ziggi/Projects/stvpn -abs_top_srcdir = /home/ziggi/Projects/stvpn -ac_ct_CC = gcc -ac_ct_CXX = g++ -am__include = include -am__leading_dot = . -am__quote = -am__rm_f_notfound = -am__tar = $${TAR-tar} chof - "$$tardir" -am__untar = $${TAR-tar} xf - -am__xargs_n = xargs -n -bindir = ${exec_prefix}/bin -build_alias = -builddir = . -datadir = ${datarootdir} -datarootdir = ${prefix}/share -docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} -dvidir = ${docdir} -exec_prefix = ${prefix} -host_alias = -htmldir = ${docdir} -includedir = ${prefix}/include -infodir = ${datarootdir}/info -install_sh = ${SHELL} /home/ziggi/Projects/stvpn/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${exec_prefix}/libexec -localedir = ${datarootdir}/locale -localstatedir = ${prefix}/var -mandir = ${datarootdir}/man -mkdir_p = $(MKDIR_P) -oldincludedir = /usr/include -pdfdir = ${docdir} -prefix = /usr/local -program_transform_name = s,x,x, -psdir = ${docdir} -runstatedir = ${localstatedir}/run -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -srcdir = . -sysconfdir = ${prefix}/etc -target_alias = -top_build_prefix = -top_builddir = . -top_srcdir = . -AUTOMAKE_OPTIONS = foreign no-dependencies no-installinfo subdir-objects -helmetsrv_SOURCES = helmetsrv.cpp \ - tservice.cpp tservice.hpp \ - sockhand.cpp dockhand.hpp \ - srvconfig.cpp srvconfig.hpp \ - $(helmet_SOURCES) - -helmetcli_SOURCES = helmetcli.cpp \ - uxclient.cpp uxclient.hpp \ - $(helmet_SOURCES) - -helmet_SOURCES = \ - uxlogger.cpp uxlogger.hpp \ - msgheader.cpp msgheader.hpp \ - interface.cpp interface.hpp \ - iprouter.cpp iprouter.hpp \ - stringaux.cpp stringaux.hpp \ - networkaux.cpp networkaux.hpp \ - uxcontrol.pb.cc uxcontrol.pb.h - -ASTYLE_OPTS = --indent=spaces=8 --style=java -all: defines.hpp - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .cc .cpp .o .obj -am--refresh: Makefile - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ - $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - $(am__cd) $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -$(am__aclocal_m4_deps): - -defines.hpp: stamp-h1 - @test -f $@ || rm -f stamp-h1 - @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 - -stamp-h1: $(srcdir)/defines.hpp.in $(top_builddir)/config.status - $(AM_V_at)rm -f stamp-h1 - $(AM_V_GEN)cd $(top_builddir) && $(SHELL) ./config.status defines.hpp -$(srcdir)/defines.hpp.in: $(am__configure_deps) - $(AM_V_GEN)($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - $(AM_V_at)rm -f stamp-h1 - $(AM_V_at)touch $@ - -distclean-hdr: - -rm -f defines.hpp stamp-h1 -install-sbinPROGRAMS: $(sbin_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-sbinPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(sbindir)" && $(am__rm_f) $$files - -clean-sbinPROGRAMS: - -$(am__rm_f) $(sbin_PROGRAMS) - -helmetcli$(EXEEXT): $(helmetcli_OBJECTS) $(helmetcli_DEPENDENCIES) $(EXTRA_helmetcli_DEPENDENCIES) - @rm -f helmetcli$(EXEEXT) - $(AM_V_CXXLD)$(CXXLINK) $(helmetcli_OBJECTS) $(helmetcli_LDADD) $(LIBS) - -helmetsrv$(EXEEXT): $(helmetsrv_OBJECTS) $(helmetsrv_DEPENDENCIES) $(EXTRA_helmetsrv_DEPENDENCIES) - @rm -f helmetsrv$(EXEEXT) - $(AM_V_CXXLD)$(CXXLINK) $(helmetsrv_OBJECTS) $(helmetsrv_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -.cc.o: - $(AM_V_CXX)$(CXXCOMPILE) -c -o $@ $< - -.cc.obj: - $(AM_V_CXX)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cpp.o: - $(AM_V_CXX)$(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: - $(AM_V_CXX)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscope: cscope.files - test ! -s cscope.files \ - || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) -clean-cscope: - -rm -f cscope.files -cscope.files: clean-cscope cscopelist -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -rm -f cscope.out cscope.in.out cscope.po.out cscope.files -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) - $(am__remove_distdir) - $(AM_V_at)$(MKDIR_P) "$(distdir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -755 \ - -exec chmod u+rwx,go+rx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r "$(distdir)" -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz - $(am__post_remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__post_remove_distdir) - -dist-lzip: distdir - tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__post_remove_distdir) - -dist-xz: distdir - tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__post_remove_distdir) - -dist-zstd: distdir - tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst - $(am__post_remove_distdir) - -dist-tarZ: distdir - @echo WARNING: "Support for distribution archives compressed with" \ - "legacy program 'compress' is deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__post_remove_distdir) - -dist-shar: distdir - @echo WARNING: "Support for shar distribution archives is" \ - "deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz - $(am__post_remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__post_remove_distdir) - -dist dist-all: - $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' - $(am__post_remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - eval GZIP= gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lz*) \ - lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ - *.tar.xz*) \ - xz -dc $(distdir).tar.xz | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - eval GZIP= gzip -dc $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - *.tar.zst*) \ - zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ - esac - chmod -R a-w $(distdir) - chmod u+w $(distdir) - mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst - chmod a-w $(distdir) - test -d $(distdir)/_build || exit 0; \ - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build/sub \ - && ../../configure \ - $(AM_DISTCHECK_CONFIGURE_FLAGS) \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - --srcdir=../.. --prefix="$$dc_install_base" \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ - && cd "$$am__cwd" \ - || exit 1 - $(am__post_remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @test -n '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: trying to run $@ with an empty' \ - '$$(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - $(am__cd) '$(distuninstallcheck_dir)' || { \ - echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ - exit 1; \ - }; \ - test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) defines.hpp -installdirs: - for dir in "$(DESTDIR)$(sbindir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -$(am__rm_f) $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || $(am__rm_f) $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-local clean-sbinPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-sbinPROGRAMS - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-sbinPROGRAMS - -.MAKE: all install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \ - clean-cscope clean-generic clean-local clean-sbinPROGRAMS \ - cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ - dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ - dist-zstd distcheck distclean distclean-compile \ - distclean-generic distclean-hdr distclean-tags distcleancheck \ - distdir distuninstallcheck dvi dvi-am html html-am info \ - info-am install install-am install-data install-data-am \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-sbinPROGRAMS install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am uninstall-sbinPROGRAMS - -.PRECIOUS: Makefile - -format: - $(ASTYLE) $(ASTYLE_OPTS) *.hpp *.cpp - -proto: - $(PROTOC) --cpp_out=. uxcontrol.proto - -clean-local: - rm -rf autom4te.cache - rm -f *~ - rm -f *.o - rm -f *.orig - rm -f *.d - --include *.d - -# 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. -.NOEXPORT: - -# Tell GNU make to disable its built-in pattern rules. -%:: %,v -%:: RCS/%,v -%:: RCS/% -%:: s.% -%:: SCCS/s.% diff --git a/Makefile.in b/Makefile.in index 6f0647f..662a1d9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -296,6 +296,11 @@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ +srv_confdir = @srv_confdir@ +srv_devel_mode = @srv_devel_mode@ +srv_logdir = @srv_logdir@ +srv_rundir = @srv_rundir@ +srv_sharedir = @srv_sharedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ diff --git a/configure b/configure index 362fe8b..99d230b 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.72 for helmet 0.0.1. +# Generated by GNU Autoconf 2.72 for stvpn 0.0.1. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation, @@ -598,10 +598,10 @@ MFLAGS= MAKEFLAGS= # Identity of this package. -PACKAGE_NAME='helmet' -PACKAGE_TARNAME='helmet' +PACKAGE_NAME='stvpn' +PACKAGE_TARNAME='stvpn' PACKAGE_VERSION='0.0.1' -PACKAGE_STRING='helmet 0.0.1' +PACKAGE_STRING='stvpn 0.0.1' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -610,6 +610,13 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +srv_sharedir +srv_rundir +srv_logdir +srv_confdir +srv_devel_mode +SYSTEMD_FALSE +SYSTEMD_TRUE ASTYLE PROTOC am__fastdepCXX_FALSE @@ -712,6 +719,10 @@ ac_user_opts=' enable_option_checking enable_silent_rules enable_dependency_tracking +enable_devel_mode +with_confdir +with_logdir +with_rundir ' ac_precious_vars='build_alias host_alias @@ -1272,7 +1283,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -'configure' configures helmet 0.0.1 to adapt to many kinds of systems. +'configure' configures stvpn 0.0.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1321,7 +1332,7 @@ Fine tuning of the installation directories: --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/helmet] + --docdir=DIR documentation root [DATAROOTDIR/doc/stvpn] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -1339,7 +1350,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of helmet 0.0.1:";; + short | recursive ) echo "Configuration of stvpn 0.0.1:";; esac cat <<\_ACEOF @@ -1353,6 +1364,15 @@ Optional Features: do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build + --enable-devel-mode Enable developmend mode + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-confdir=PATH set configuration dir to PATH (default: + $SRV_CONFDIR) + --with-logdir=PATH set path for logdir (default: $SRV_LOGDIR) + --with-rundir=PATH set path for rundir (default: $SRV_RUNDIR) Some influential environment variables: CC C compiler command @@ -1432,7 +1452,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -helmet configure 0.0.1 +stvpn configure 0.0.1 generated by GNU Autoconf 2.72 Copyright (C) 2023 Free Software Foundation, Inc. @@ -1549,7 +1569,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by helmet $as_me 0.0.1, which was +It was created by stvpn $as_me 0.0.1, which was generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw @@ -3228,7 +3248,7 @@ fi # Define the identity of the package. - PACKAGE='helmet' + PACKAGE='stvpn' VERSION='0.0.1' @@ -4984,6 +5004,184 @@ done + if false; then + SYSTEMD_TRUE= + SYSTEMD_FALSE='#' +else + SYSTEMD_TRUE='#' + SYSTEMD_FALSE= +fi + +if test -d /lib/systemd/system; then + if true; then + SYSTEMD_TRUE= + SYSTEMD_FALSE='#' +else + SYSTEMD_TRUE='#' + SYSTEMD_FALSE= +fi + +fi + + +test "x$prefix" == "xNONE" && prefix=$ac_default_prefix +test "x$libexecdir" == "xNONE" && libexecdir=${prefix}/lib + + + +# Check whether --enable-devel-mode was given. +if test ${enable_devel_mode+y} +then : + enableval=$enable_devel_mode; +fi + + + + +printf "%s\n" "#define srv_devel_mode \"false\"" >>confdefs.h + +srv_devel_mode="false" + + +if test "x$enable_devel_mode" = "xyes" +then : + + SRCDIR=`pwd` + enable_devel_mode=yes + +fi + + +SRV_CONFDIR="${prefix}/etc/${PACKAGE}" + + +# Check whether --with-confdir was given. +if test ${with_confdir+y} +then : + withval=$with_confdir; if test ! -z "$withval" ; then + case $withval in + /*) + SRV_CONFDIR="$withval" + ;; + *) + as_fn_error $? "You must specify an absolute path to --with-confdir=PATH" "$LINENO" 5 + ;; + esac + fi +fi + + + +if test "x$enable_devel_mode" = "xyes" +then : + + SRV_CONFDIR="${SRCDIR}" + sysconfdir="${SRCDIR}" + +else case e in #( + e) + test "x$SRV_CONFDIR" == "x/usr/etc/${PACKAGE}" && SRV_CONFDIR="/etc/${PACKAGE}" + test "x$prefix" == "x/usr" && sysconfdir="/etc" + ;; +esac +fi + +printf "%s\n" "#define SRV_CONFDIR \"\$SRV_CONFDIR\"" >>confdefs.h + + +printf "%s\n" "#define SRV_CONFDIR \"$SRV_CONFDIR\"" >>confdefs.h + +srv_confdir="$SRV_CONFDIR" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: srv_confdir set as ${SRV_CONFDIR}" >&5 +printf "%s\n" "$as_me: srv_confdir set as ${SRV_CONFDIR}" >&6;} + + +SRV_LOGDIR="/var/log/${PACKAGE}" + + +# Check whether --with-logdir was given. +if test ${with_logdir+y} +then : + withval=$with_logdir; if test ! -z "$withval" ; then + case $withval in + /*) + SRV_LOGDIR="$withval" + ;; + *) + as_fn_error $? "You must specify an absolute path to --with-logdir=PATH" "$LINENO" 5 + ;; + esac + fi +fi + + +if test "x$enable_devel_mode" = "xyes" +then : + + SRV_LOGDIR="${SRCDIR}/tmp/log" + +fi + + +printf "%s\n" "#define SRV_LOGDIR \"$SRV_LOGDIR\"" >>confdefs.h + +srv_logdir="$SRV_LOGDIR" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: srv_logdir set as ${SRV_LOGDIR}" >&5 +printf "%s\n" "$as_me: srv_logdir set as ${SRV_LOGDIR}" >&6;} + + +SRV_RUNDIR="/var/run/${PACKAGE}" + + +# Check whether --with-rundir was given. +if test ${with_rundir+y} +then : + withval=$with_rundir; if test ! -z "$withval" ; then + case $withval in + /*) + SRV_RUNDIR="$withval" + ;; + *) + as_fn_error $? "You must specify an absolute path to --with-rundir=PATH" "$LINENO" 5 + ;; + esac + fi +fi + + +if test "x$enable_devel_mode" = "xyes" +then : + + SRV_RUNDIR="${SRCDIR}/tmp/run" + +fi + + + +printf "%s\n" "#define SRV_RUNDIR \"$SRV_RUNDIR\"" >>confdefs.h + +srv_rundir="$SRV_RUNDIR" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: srv_rundir set as ${SRV_RUNDIR}" >&5 +printf "%s\n" "$as_me: srv_rundir set as ${SRV_RUNDIR}" >&6;} + + + +printf "%s\n" "#define SRV_SHAREDIR \"$SRV_SHAREDIR\"" >>confdefs.h + +srv_sharedir="$SRV_SHAREDIR" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: srv_sharedir set as ${SRV_SHAREDIR}" >&5 +printf "%s\n" "$as_me: srv_sharedir set as ${SRV_SHAREDIR}" >&6;} + + + ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF @@ -5135,6 +5333,14 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${SYSTEMD_TRUE}" && test -z "${SYSTEMD_FALSE}"; then + as_fn_error $? "conditional \"SYSTEMD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SYSTEMD_TRUE}" && test -z "${SYSTEMD_FALSE}"; then + as_fn_error $? "conditional \"SYSTEMD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -5528,7 +5734,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by helmet $as_me 0.0.1, which was +This file was extended by stvpn $as_me 0.0.1, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5596,7 +5802,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -helmet config.status 0.0.1 +stvpn config.status 0.0.1 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 0f1ae60..87cd7ef 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([helmet],[0.0.1]) +AC_INIT([stvpn],[0.0.1]) AM_INIT_AUTOMAKE AC_PREFIX_DEFAULT(/usr/local) AC_CONFIG_HEADERS([defines.hpp]) @@ -11,6 +11,125 @@ AC_PATH_PROGS([PROTOC],[protoc true]) AC_PATH_PROGS([ASTYLE],[astyle true]) +AM_CONDITIONAL(SYSTEMD, false) +if test -d /lib/systemd/system; then + AM_CONDITIONAL(SYSTEMD, true) +fi + + +test "x$prefix" == "xNONE" && prefix=$ac_default_prefix +test "x$libexecdir" == "xNONE" && libexecdir=${prefix}/lib + + +dnl -------------------------------------------------------------------------------------- + +AC_ARG_ENABLE([devel-mode], + AS_HELP_STRING([--enable-devel-mode], [Enable developmend mode])) + + +AC_DEFINE_UNQUOTED(srv_devel_mode, "false", [developmend mode]) +AC_SUBST(srv_devel_mode, "false") + +AS_IF([test "x$enable_devel_mode" = "xyes"], [ + SRCDIR=`pwd` + enable_devel_mode=yes +]) + +dnl -------------------------------------------------------------------------------------- + +SRV_CONFDIR="${prefix}/etc/${PACKAGE}" + +AC_ARG_WITH(confdir, + AS_HELP_STRING([--with-confdir=PATH],[set configuration dir to PATH (default: $SRV_CONFDIR)]), + [ if test ! -z "$withval" ; then + case $withval in + /*) + SRV_CONFDIR="$withval" + ;; + *) + AC_MSG_ERROR(You must specify an absolute path to --with-confdir=PATH) + ;; + esac + fi ]) + + +AS_IF([test "x$enable_devel_mode" = "xyes"], [ +dnl SRV_CONFDIR="${SRCDIR}/etc/${PACKAGE}" +dnl sysconfdir="${SRCDIR}/etc/${PACKAGE}" + SRV_CONFDIR="${SRCDIR}" + sysconfdir="${SRCDIR}" +], [ + test "x$SRV_CONFDIR" == "x/usr/etc/${PACKAGE}" && SRV_CONFDIR="/etc/${PACKAGE}" + test "x$prefix" == "x/usr" && sysconfdir="/etc" +]) + +AC_DEFINE(SRV_CONFDIR, "$SRV_CONFDIR") +AC_DEFINE_UNQUOTED(SRV_CONFDIR, "$SRV_CONFDIR", [location of configuration files for ${PACKAGE}]) +AC_SUBST(srv_confdir, "$SRV_CONFDIR") + +AC_MSG_NOTICE(srv_confdir set as ${SRV_CONFDIR}) + +dnl -------------------------------------------------------------------------------------- + +SRV_LOGDIR="/var/log/${PACKAGE}" + +AC_ARG_WITH(logdir, + AS_HELP_STRING([--with-logdir=PATH],[set path for logdir (default: $SRV_LOGDIR)]), + [ if test ! -z "$withval" ; then + case $withval in + /*) + SRV_LOGDIR="$withval" + ;; + *) + AC_MSG_ERROR(You must specify an absolute path to --with-logdir=PATH) + ;; + esac + fi]) + +AS_IF([test "x$enable_devel_mode" = "xyes"], [ + SRV_LOGDIR="${SRCDIR}/tmp/log" +]) + +AC_DEFINE_UNQUOTED(SRV_LOGDIR, "$SRV_LOGDIR", [location of ${PACKAGE} logdir]) +AC_SUBST(srv_logdir, "$SRV_LOGDIR") + +AC_MSG_NOTICE(srv_logdir set as ${SRV_LOGDIR}) + +dnl -------------------------------------------------------------------------------------- + +SRV_RUNDIR="/var/run/${PACKAGE}" + +AC_ARG_WITH(rundir, + AS_HELP_STRING([--with-rundir=PATH],[set path for rundir (default: $SRV_RUNDIR)]), + [ if test ! -z "$withval" ; then + case $withval in + /*) + SRV_RUNDIR="$withval" + ;; + *) + AC_MSG_ERROR(You must specify an absolute path to --with-rundir=PATH) + ;; + esac + fi ]) + +AS_IF([test "x$enable_devel_mode" = "xyes"], [ + SRV_RUNDIR="${SRCDIR}/tmp/run" +]) + + +AC_DEFINE_UNQUOTED(SRV_RUNDIR, "$SRV_RUNDIR", [location of rundir]) +AC_SUBST(srv_rundir, "$SRV_RUNDIR") + +AC_MSG_NOTICE(srv_rundir set as ${SRV_RUNDIR}) + + +AC_DEFINE_UNQUOTED(SRV_SHAREDIR, "$SRV_SHAREDIR", [location of share dir]) +AC_SUBST(srv_sharedir, "$SRV_SHAREDIR") + +AC_MSG_NOTICE(srv_sharedir set as ${SRV_SHAREDIR}) + + + AC_CONFIG_FILES([ Makefile ]) diff --git a/defines.hpp b/defines.hpp index 7a066fd..5ce0985 100644 --- a/defines.hpp +++ b/defines.hpp @@ -2,19 +2,19 @@ /* defines.hpp.in. Generated from configure.ac by autoheader. */ /* Name of package */ -#define PACKAGE "helmet" +#define PACKAGE "stvpn" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ -#define PACKAGE_NAME "helmet" +#define PACKAGE_NAME "stvpn" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "helmet 0.0.1" +#define PACKAGE_STRING "stvpn 0.0.1" /* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "helmet" +#define PACKAGE_TARNAME "stvpn" /* Define to the home page for this package. */ #define PACKAGE_URL "" @@ -22,5 +22,20 @@ /* Define to the version of this package. */ #define PACKAGE_VERSION "0.0.1" +/* location of configuration files for ${PACKAGE} */ +#define SRV_CONFDIR "/home/ziggi/Projects/stvpn" + +/* location of ${PACKAGE} logdir */ +#define SRV_LOGDIR "/home/ziggi/Projects/stvpn/tmp/log" + +/* location of rundir */ +#define SRV_RUNDIR "/home/ziggi/Projects/stvpn/tmp/run" + +/* location of share dir */ +#define SRV_SHAREDIR "" + /* Version number of package */ #define VERSION "0.0.1" + +/* developmend mode */ +#define srv_devel_mode "false" diff --git a/defines.hpp.in b/defines.hpp.in index 98294c7..01b5f44 100644 --- a/defines.hpp.in +++ b/defines.hpp.in @@ -21,5 +21,20 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION +/* location of configuration files for ${PACKAGE} */ +#undef SRV_CONFDIR + +/* location of ${PACKAGE} logdir */ +#undef SRV_LOGDIR + +/* location of rundir */ +#undef SRV_RUNDIR + +/* location of share dir */ +#undef SRV_SHAREDIR + /* Version number of package */ #undef VERSION + +/* developmend mode */ +#undef srv_devel_mode diff --git a/helmetsrv.conf b/helmetsrv.conf index d10491a..79ab997 100644 --- a/helmetsrv.conf +++ b/helmetsrv.conf @@ -1,3 +1,3 @@ listenport = 1025; tunnelnet = 10.1.1.0/24; -localnet = 172.17.0.0/24; +localnet = 10.11.11.0/24; diff --git a/helmetsrv.cpp b/helmetsrv.cpp index 8054508..58bf211 100644 --- a/helmetsrv.cpp +++ b/helmetsrv.cpp @@ -3,14 +3,15 @@ #include #include +#include #include #include #include std::expected Run() { ServConfig config; - - auto readRes = config.Read("helmetsrv.conf"); + std::string confdir(SRV_CONFDIR); + auto readRes = config.Read(confdir + "/" + "helmetsrv.conf"); if (!readRes) { return std::unexpected("Read config error: " + readRes.error()); } diff --git a/iprouter.cpp b/iprouter.cpp index cca3671..4058098 100644 --- a/iprouter.cpp +++ b/iprouter.cpp @@ -49,7 +49,7 @@ std::expected Router::AddRoute(std::string address, uint64_t }; char buffer[INET_ADDRSTRLEN]; - uint32_t mask = (prefix == 0) ? 0 : (~0U << (32 - prefix)); + uint32_t mask = (prefix == 0) ? 0 : htonl(~0U << (32 - prefix)); struct in_addr addr; addr.s_addr = mask; diff --git a/uxclient.cpp b/uxclient.cpp index 832db2e..8410604 100644 --- a/uxclient.cpp +++ b/uxclient.cpp @@ -20,6 +20,7 @@ extern "C" { #include #include #include +#include #include @@ -147,6 +148,12 @@ void UxClient::RecvMessages(void) { routeMessage.ParseFromString(rawMessage); auto network = routeMessage.address(); auto prefix = routeMessage.prefix(); + auto networkRes = nethost(network, prefix, 0); + if (!networkRes) { + uxlogger.Error(networkRes.error()); + break; + } + network = networkRes.value(); uxlogger.Info(std::format("Received route {}/{} gw {}", network, prefix, tunAddress)); if (tunAddress != "") { Router router; @@ -217,14 +224,22 @@ std::expected UxClient::Run(void) { if (!createRes) { return std::unexpected(createRes.error()); } - /* + auto setAddrRes = interface.SetIP4Address("10.1.1.1"); + if (!setAddrRes) { + uxlogger.Error(setAddrRes.error()); + } + auto setMaskRes = interface.SetIP4Netmask(24); + if (!setMaskRes) { + uxlogger.Error(setMaskRes.error()); + } Router router; - auto addRouteRes = router.AddRoute("1.1.1.2", 32, "10.1.1.2"); + auto addRouteRes = router.AddRoute("1.1.1.0", 24, "10.1.1.1", ""); if (!addRouteRes) { return std::unexpected(addRouteRes.error()); } */ + std::thread sendThr(&UxClient::SendMessages, this); sendThr.detach();