diff --git a/Makefile.am b/Makefile.am index 99ccc646..38ac7bc4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,190 +1,185 @@ # # Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. # # Author: Fabio M. Di Nitto # # This software licensed under GPL-2.0+, LGPL-2.0+ # MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \ config.guess config.sub missing install-sh \ ltmain.sh compile config.h.in config.h.in~ \ autoscan.log configure.scan test-driver include $(top_srcdir)/build-aux/check.mk AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 SPEC = $(PACKAGE_NAME).spec TARGZFILE = $(PACKAGE_NAME)-$(VERSION).tar.gz EXTRA_DIST = build-aux autogen.sh .version \ NOTES_TO_PACKAGE_MAINTAINERS \ $(SPEC).in SUBDIRS = init libtap libknet kronosnetd -if BUILD_DOCS -SUBDIRS += docs -endif - if BUILD_POC SUBDIRS += poc-code endif dist_doc_DATA = \ COPYING.applications \ COPYING.libraries \ COPYRIGHT \ README.licence \ - README \ - TODO + README all-local: $(SPEC) clean-local: rm -f $(SPEC) distclean-local: rm -f $(PACKAGE_NAME)-*.tar.* $(PACKAGE_NAME)-*.sha256* tag-* maintainer-clean-local: rm -rf m4 ## make rpm/srpm section. $(SPEC): $(SPEC).in .version config.status rm -f $@-t $@ date="`LC_ALL=C date "+%a %b %d %Y"`" && \ if [ -f $(abs_srcdir)/.tarball-version ]; then \ gitver="`cat $(abs_srcdir)/.tarball-version`" && \ rpmver=$$gitver && \ alphatag="" && \ dirty="" && \ numcomm="0"; \ else \ gitver="`GIT_DIR=$(abs_srcdir)/.git git describe --abbrev=4 --match='v*' HEAD 2>/dev/null`" && \ rpmver=`echo $$gitver | sed -e "s/^v//" -e "s/-.*//g"` && \ alphatag=`echo $$gitver | sed -e "s/.*-//" -e "s/^g//"` && \ vtag=`echo $$gitver | sed -e "s/-.*//g"` && \ numcomm=`GIT_DIR=$(abs_srcdir)/.git git rev-list $$vtag..HEAD | wc -l` && \ cd $(abs_srcdir) && \ git update-index --refresh > /dev/null 2>&1 || true && \ dirty=`git diff-index --name-only HEAD 2>/dev/null` && cd - 2>/dev/null; \ fi && \ if [ -n "$$dirty" ]; then dirty="dirty"; else dirty=""; fi && \ if [ "$$numcomm" = "0" ]; then \ sed \ -e "s#@version@#$$rpmver#g" \ -e "s#%glo.*alpha.*##g" \ -e "s#%glo.*numcomm.*##g" \ -e "s#@dirty@#$$dirty#g" \ -e "s#@date@#$$date#g" \ $(abs_srcdir)/$@.in > $@-t; \ else \ sed \ -e "s#@version@#$$rpmver#g" \ -e "s#@alphatag@#$$alphatag#g" \ -e "s#@numcomm@#$$numcomm#g" \ -e "s#@dirty@#$$dirty#g" \ -e "s#@date@#$$date#g" \ $(abs_srcdir)/$@.in > $@-t; \ fi; \ if [ -z "$$dirty" ]; then sed -i -e "s#%glo.*dirty.*##g" $@-t; fi if BUILDSCTP sed -i -e "s#@sctp@#bcond_without#g" $@-t else sed -i -e "s#@sctp@#bcond_with#g" $@-t endif if BUILDCRYPTONSS sed -i -e "s#@nss@#bcond_without#g" $@-t else sed -i -e "s#@nss@#bcond_with#g" $@-t endif if BUILDCRYPTOOPENSSL sed -i -e "s#@openssl@#bcond_without#g" $@-t else sed -i -e "s#@openssl@#bcond_with#g" $@-t endif if BUILDCOMPZLIB sed -i -e "s#@zlib@#bcond_without#g" $@-t else sed -i -e "s#@zlib@#bcond_with#g" $@-t endif if BUILDCOMPLZ4 sed -i -e "s#@lz4@#bcond_without#g" $@-t else sed -i -e "s#@lz4@#bcond_with#g" $@-t endif if BUILDCOMPLZO2 sed -i -e "s#@lzo2@#bcond_without#g" $@-t else sed -i -e "s#@lzo2@#bcond_with#g" $@-t endif if BUILDCOMPLZMA sed -i -e "s#@lzma@#bcond_without#g" $@-t else sed -i -e "s#@lzma@#bcond_with#g" $@-t endif if BUILDCOMPBZIP2 sed -i -e "s#@bzip2@#bcond_without#g" $@-t else sed -i -e "s#@bzip2@#bcond_with#g" $@-t endif if BUILD_KRONOSNETD sed -i -e "s#@kronosnetd@#bcond_without#g" $@-t else sed -i -e "s#@kronosnetd@#bcond_with#g" $@-t endif if BUILD_LIBTAP sed -i -e "s#@libtap@#bcond_without#g" $@-t else sed -i -e "s#@libtap@#bcond_with#g" $@-t endif if BUILD_RUNAUTOGEN sed -i -e "s#@runautogen@#bcond_without#g" $@-t else sed -i -e "s#@runautogen@#bcond_with#g" $@-t endif sed -i -e "s#@defaultadmgroup@#$(DEFAULTADMGROUP)#g" $@-t chmod a-w $@-t mv $@-t $@ rm -f $@-t* $(TARGZFILE): $(MAKE) dist RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \ --define "_specdir $(abs_builddir)" \ --define "_builddir $(abs_builddir)" \ --define "_srcrpmdir $(abs_builddir)" \ --define "_rpmdir $(abs_builddir)" srpm: clean $(MAKE) $(SPEC) $(TARGZFILE) rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC) rpm: clean $(MAKE) $(SPEC) $(TARGZFILE) rpmbuild $(RPMBUILDOPTS) -ba $(SPEC) # release/versioning BUILT_SOURCES = .version .version: echo $(VERSION) > $@-t && mv $@-t $@ dist-hook: gen-ChangeLog echo $(VERSION) > $(distdir)/.tarball-version gen_start_date = 2000-01-01 .PHONY: gen-ChangeLog gen-ChangeLog: if test -d $(abs_sourcedir)/.git; then \ LC_ALL=C $(top_srcdir)/build-aux/gitlog-to-changelog \ --since=$(gen_start_date) > $(distdir)/cl-t; \ rm -f $(distdir)/ChangeLog; \ mv $(distdir)/cl-t $(distdir)/ChangeLog; \ fi diff --git a/README b/README index ca7bca38..7a61fc72 100644 --- a/README +++ b/README @@ -1,33 +1,35 @@ -kronosnet ---------- +# +# Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. +# +# Author: Fabio M. Di Nitto +# +# This software licensed under GPL-2.0+, LGPL-2.0+ +# + +Upstream resources +------------------ + +https://github.com/kronosnet/kronosnet/ +https://ci.kronosnet.org/ +https://trello.com/kronosnet (TODO list and activities tracking) +https://goo.gl/9ZvkLS (google shared drive) +https://github.com/kronosnet/knet-ansible-ci +https://lists.kronosnet.org/mailman/listinfo/users +https://lists.kronosnet.org/mailman/listinfo/devel +https://lists.kronosnet.org/mailman/listinfo/commits +https://kronosnet.org/ (web 0.1 style) +IRC: #kronosnet on Freenode Architecture ------------ -Please refer to -http://kronosnet.org/docs/kronosnet_architecture.odp -for a few fancy drawings and schemas - -WARNING -------- +Please refer to the google shared drive Presentations directory for +diagrams and fancy schemas -kronosnet is currently in very early stages of its development. -on-wire and configuration compatibility between versions will not -be guaranteed till 1.0 release. +Running knet on FreeBSD +----------------------- -QUICK SETUP ------------ +knet requires big socket buffers and you need to set: +kern.ipc.maxsockbuf=18388608 +in /etc/sysctl.conf or knet will fail to run. -* build/install -* create /etc/pam.d/kronosnetd - - the users that can login with those credentials will gain access - to kronosnetd read only view of the setup -* add kronosnetadm system group - - user in this group, after login to kronosnetd (auth via pam), will - be allowed to perform configuration tasks within kronosnetd -* start kronosnetd - - there is no requirement for kronosnetd to have a configuration file - to start. Configuration can be created at runtime by: - "telnet localhost 50000" -* always refer to http://kronosnet.org/ user manual for latest - information on how to perform runtime configuration tasks diff --git a/TODO b/TODO deleted file mode 100644 index 2fbd3dff..00000000 --- a/TODO +++ /dev/null @@ -1,4 +0,0 @@ -The TODO list has moved to: https://trello.com/b/Aqq9xJfF/todo - -Please read https://trello.com/c/JQIRSPE2/1-how-to-use-this-board - diff --git a/autogen.sh b/autogen.sh index 3c5e1d93..85a6978b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,12 @@ #!/bin/sh +# +# Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. +# +# Author: Fabio M. Di Nitto +# +# This software licensed under GPL-2.0+, LGPL-2.0+ +# + # Run this to generate all the initial makefiles, etc. mkdir -p m4 autoreconf -i -v && echo Now run ./configure and make diff --git a/build-aux/update-copyright.sh b/build-aux/update-copyright.sh index 82f9c4d4..babb25a3 100755 --- a/build-aux/update-copyright.sh +++ b/build-aux/update-copyright.sh @@ -1,29 +1,29 @@ -#!/bin/bash +#!/bin/sh # # Copyright (C) 2017 Red Hat, Inc. All rights reserved. # # Author: Fabio M. Di Nitto # # This software licensed under GPL-2.0+, LGPL-2.0+ # # script to update copyright dates across the tree enddate=$(date +%Y) input=$(grep -ril -e "Copyright.*Red Hat" |grep -v .swp |grep -v update-copyright) for i in $input; do startdate=$(git log --follow "$i" | grep ^Date: | tail -n 1 | awk '{print $6}') if [ "$startdate" != "$enddate" ]; then sed -i -e 's#Copyright (C).*Red Hat#Copyright (C) '$startdate'-'$enddate' Red Hat#g' $i else sed -i -e 's#Copyright (C).*Red Hat#Copyright (C) '$startdate' Red Hat#g' $i fi done input=$(find . -type f |grep -v ".git") for i in $input; do if [ -z "$(grep -i "Copyright" $i)" ]; then echo "WARNING: $i appears to be missing Copyright information" fi done diff --git a/configure.ac b/configure.ac index 6af90c8b..a479aeaf 100644 --- a/configure.ac +++ b/configure.ac @@ -1,534 +1,527 @@ # # Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. # # Authors: Fabio M. Di Nitto # Federico Simoncelli # # This software licensed under GPL-2.0+, LGPL-2.0+ # # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. # AC_PREREQ([2.63]) AC_INIT([kronosnet], m4_esyscmd([build-aux/git-version-gen .tarball-version]), [devel@lists.kronosnet.org]) AC_USE_SYSTEM_EXTENSIONS AM_INIT_AUTOMAKE([1.13 dist-bzip2 dist-xz color-tests -Wno-portability subdir-objects]) LT_PREREQ([2.2.6]) LT_INIT AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([kronosnetd/main.c]) AC_CONFIG_HEADERS([config.h]) AC_CANONICAL_HOST AC_PROG_LIBTOOL AC_LANG([C]) systemddir=${prefix}/lib/systemd/system if test "$prefix" = "NONE"; then prefix="/usr" if test "$localstatedir" = "\${prefix}/var"; then localstatedir="/var" fi if test "$sysconfdir" = "\${prefix}/etc"; then sysconfdir="/etc" fi if test "$systemddir" = "NONE/lib/systemd/system"; then systemddir=/lib/systemd/system fi if test "$libdir" = "\${exec_prefix}/lib"; then if test -e /usr/lib64; then libdir="/usr/lib64" else libdir="/usr/lib" fi fi fi AC_PROG_AWK AC_PROG_GREP AC_PROG_SED AC_PROG_CPP AC_PROG_CC AC_PROG_CC_C99 if test "x$ac_cv_prog_cc_c99" = "xno"; then AC_MSG_ERROR(["C99 support is required"]) fi AC_PROG_LN_S AC_PROG_INSTALL AC_PROG_MAKE_SET PKG_PROG_PKG_CONFIG -AC_CHECK_PROGS([PUBLICAN], [publican], [:]) AC_CHECK_PROGS([DOXYGEN], [doxygen]) AC_CHECK_PROGS([DOXY2MAN], [doxy2man]) manpageupdates=1 if test "x$DOXYGEN" = "x" || test "x$DOXY2MAN" = "x"; then manpageupdates=0; fi AM_CONDITIONAL([MANPAGEUPDATES], [test $manpageupdates -gt 0]) AC_CHECK_PROGS([VALGRIND_EXEC], [valgrind]) AM_CONDITIONAL([HAS_VALGRIND], [test x$VALGRIND_EXEC != "x"]) AC_ARG_ENABLE([libknet-sctp], [ --disable-libknet-sctp : disable libknet SCTP support ],, [ enable_libknet_sctp="yes" ]) AM_CONDITIONAL([BUILDSCTP], [test x$enable_libknet_sctp = xyes]) AC_ARG_ENABLE([crypto-all], [ --disable-crypto-all : disable libknet all crypto modules support ],, [ enable_crypto_all="yes" ]) AC_ARG_ENABLE([crypto-nss], [ --disable-crypto-nss : disable libknet nss support ],, [ enable_crypto_nss="$enable_crypto_all" ]) AM_CONDITIONAL([BUILDCRYPTONSS], [test x$enable_crypto_nss = xyes]) AC_ARG_ENABLE([crypto-openssl], [ --disable-crypto-openssl : disable libknet openssl support ],, [ enable_crypto_openssl="$enable_crypto_all" ]) AM_CONDITIONAL([BUILDCRYPTOOPENSSL], [test x$enable_crypto_openssl = xyes]) AC_ARG_ENABLE([compress-all], [ --disable-compress-all : disable libknet all compress modules support ],, [ enable_compress_all="yes" ]) AC_ARG_ENABLE([compress-zlib], [ --disable-compress-zlib : disable libknet zlib support ],, [ enable_compress_zlib="$enable_compress_all" ]) AM_CONDITIONAL([BUILDCOMPZLIB], [test x$enable_compress_zlib = xyes]) AC_ARG_ENABLE([compress-lz4], [ --disable-compress-lz4 : disable libknet lz4 support ],, [ enable_compress_lz4="$enable_compress_all" ]) AM_CONDITIONAL([BUILDCOMPLZ4], [test x$enable_compress_lz4 = xyes]) AC_ARG_ENABLE([compress-lzo2], [ --disable-compress-lzo2 : disable libknet lzo2 support ],, [ enable_compress_lzo2="$enable_compress_all" ]) AM_CONDITIONAL([BUILDCOMPLZO2], [test x$enable_compress_lzo2 = xyes]) AC_ARG_ENABLE([compress-lzma], [ --disable-compress-lzma : disable libknet lzma support ],, [ enable_compress_lzma="$enable_compress_all" ]) AM_CONDITIONAL([BUILDCOMPLZMA], [test x$enable_compress_lzma = xyes]) AC_ARG_ENABLE([compress-bzip2], [ --disable-compress-bzip2 : disable libknet bzip2 support ],, [ enable_compress_bzip2="$enable_compress_all" ]) AM_CONDITIONAL([BUILDCOMPBZIP2], [test x$enable_compress_bzip2 = xyes]) AC_ARG_ENABLE([poc], [ --enable-poc : enable building poc code ],, [ enable_poc="no" ]) AM_CONDITIONAL([BUILD_POC], [test x$enable_poc = xyes]) AC_ARG_ENABLE([kronosnetd], [ --enable-kronosnetd : Kronosnetd support ],, [ enable_kronosnetd="no" ]) AM_CONDITIONAL([BUILD_KRONOSNETD], [test x$enable_kronosnetd = xyes]) AC_ARG_ENABLE([runautogen], [ --enable-runautogen : run autogen.sh ],, [ enable_runautogen="no" ]) AM_CONDITIONAL([BUILD_RUNAUTOGEN], [test x$enable_runautogen = xyes]) AC_ARG_ENABLE([libtap], [ --enable-libtap : libtap support ],, [ enable_libtap="no" ]) if test "x$enable_kronosnetd" = xyes; then enable_libtap=yes fi AM_CONDITIONAL([BUILD_LIBTAP], [test x$enable_libtap = xyes]) ## local helper functions # this function checks if CC support options passed as # args. Global CFLAGS are ignored during this test. cc_supports_flag() { saveCPPFLAGS="$CPPFLAGS" CPPFLAGS="$@" if echo $CC | grep -q clang; then CPPFLAGS="-Werror $CPPFLAGS" fi AC_MSG_CHECKING([whether $CC supports "$@"]) AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])], [RC=0; AC_MSG_RESULT([yes])], [RC=1; AC_MSG_RESULT([no])]) CPPFLAGS="$saveCPPFLAGS" return $RC } # helper macro to check libs without adding them to LIBS check_lib_no_libs() { lib_no_libs_arg1=$1 shift lib_no_libs_arg2=$1 shift lib_no_libs_args=$@ AC_CHECK_LIB([$lib_no_libs_arg1], [$lib_no_libs_arg2],,, [$lib_no_libs_args]) LIBS=$ac_check_lib_save_LIBS } # Checks for C features AC_C_INLINE # Checks for libraries. AC_CHECK_LIB([pthread], [pthread_create], [AC_SUBST([pthread_LIBS], [-lpthread])], [AC_MSG_ERROR([kronosnet requires pthread library])]) AC_CHECK_LIB([m], [ceil], [AC_SUBST([m_LIBS], [-lm])], [AC_MSG_ERROR([kronosnet requires m library])]) AC_CHECK_LIB([rt], [clock_gettime], [AC_SUBST([rt_LIBS], [-lrt])], [AC_MSG_ERROR([kronosnet requires rt library])]) AC_SEARCH_LIBS([dlopen], [dl dld], [dllibs=$ac_res], [AC_MSG_ERROR([kronosnet requires dl library])]) if test "x$dllibs" != "xnone required"; then AC_SUBST([dl_LIBS], [$dllibs]) fi # OS detection AC_MSG_CHECKING([for os in ${host_os}]) case "$host_os" in *linux*) AC_DEFINE_UNQUOTED([KNET_LINUX], [1], [Compiling for Linux platform]) AC_MSG_RESULT([Linux]) ;; *bsd*) AC_DEFINE_UNQUOTED([KNET_BSD], [1], [Compiling for BSD platform]) AC_MSG_RESULT([BSD]) if test "x$enable_libtap" = xyes; then AC_MSG_ERROR([libtap is not currently supported on BSD platforms]) fi ;; *) AC_MSG_ERROR([Unsupported OS? hmmmm]) ;; esac # crypto libraries checks if test "x$enable_crypto_nss" = xyes; then PKG_CHECK_MODULES([nss],[nss]) AC_DEFINE_UNQUOTED([BUILDCRYPTONSS], [1], [Enable nss crypto]) fi if test "x$enable_crypto_openssl" = xyes; then PKG_CHECK_MODULES([openssl],[openssl < 1.1], [AC_DEFINE_UNQUOTED([BUILDCRYPTOOPENSSL10], [1], [openssl 1.0 crypto])], [PKG_CHECK_MODULES([openssl],[openssl >= 1.1], [AC_DEFINE_UNQUOTED([BUILDCRYPTOOPENSSL11], [1], [openssl 1.1 crypto])])]) AC_DEFINE_UNQUOTED([BUILDCRYPTOOPENSSL], [1], [Enable openssl crypto]) fi # compress libraries checks if test "x$enable_compress_zlib" = xyes; then PKG_CHECK_MODULES([zlib], [zlib]) AC_DEFINE_UNQUOTED([BUILDCOMPZLIB], [1], [Enable zlib compression]) fi if test "x$enable_compress_lz4" = xyes; then PKG_CHECK_MODULES([liblz4], [liblz4]) AC_DEFINE_UNQUOTED([BUILDCOMPLZ4], [1], [Enable lz4 compress]) fi if test "x$enable_compress_lzo2" = xyes; then PKG_CHECK_MODULES([lzo2], [lzo2],, [AC_CHECK_HEADERS([lzo/lzo1x.h], [AC_CHECK_LIB([lzo2], [lzo1x_decompress_safe], [AC_SUBST([lzo2_LIBS], [-llzo2])])], [AC_MSG_ERROR(["missing required lzo/lzo1x.h header"])])]) AC_DEFINE_UNQUOTED([BUILDCOMPLZO2], [1], [Enable lzo2 compress]) fi if test "x$enable_compress_lzma" = xyes; then PKG_CHECK_MODULES([liblzma], [liblzma]) AC_DEFINE_UNQUOTED([BUILDCOMPLZMA], [1], [Enable lzma compress]) fi if test "x$enable_compress_bzip2" = xyes; then PKG_CHECK_MODULES([bzip2], [bzip2],, [AC_CHECK_HEADERS([bzlib.h], [AC_CHECK_LIB([bz2], [BZ2_bzBuffToBuffCompress], [AC_SUBST([bzip2_LIBS], [-lbz2])])], [AC_MSG_ERROR(["missing required bzlib.h"])])]) AC_DEFINE_UNQUOTED([BUILDCOMPBZIP2], [1], [Enable bzip2 compress]) fi # Checks for header files. AC_CHECK_HEADERS([fcntl.h]) AC_CHECK_HEADERS([stdlib.h]) AC_CHECK_HEADERS([string.h]) AC_CHECK_HEADERS([strings.h]) AC_CHECK_HEADERS([sys/ioctl.h]) AC_CHECK_HEADERS([syslog.h]) AC_CHECK_HEADERS([unistd.h]) AC_CHECK_HEADERS([netinet/in.h]) AC_CHECK_HEADERS([sys/socket.h]) AC_CHECK_HEADERS([arpa/inet.h]) AC_CHECK_HEADERS([netdb.h]) AC_CHECK_HEADERS([limits.h]) AC_CHECK_HEADERS([stdint.h]) AC_CHECK_HEADERS([sys/epoll.h]) if test "x$enable_libknet_sctp" = xyes; then AC_CHECK_HEADERS([netinet/sctp.h],, [AC_MSG_ERROR(["missing required SCTP headers"])]) fi # Checks for typedefs, structures, and compiler characteristics. AC_C_INLINE AC_TYPE_SIZE_T AC_TYPE_PID_T AC_TYPE_SSIZE_T AC_TYPE_UINT8_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_INT32_T # Checks for library functions. AC_FUNC_ALLOCA AC_FUNC_FORK AC_FUNC_MALLOC AC_FUNC_REALLOC AC_CHECK_FUNCS([memset]) AC_CHECK_FUNCS([strdup]) AC_CHECK_FUNCS([strerror]) AC_CHECK_FUNCS([dup2]) AC_CHECK_FUNCS([select]) AC_CHECK_FUNCS([socket]) AC_CHECK_FUNCS([inet_ntoa]) AC_CHECK_FUNCS([memmove]) AC_CHECK_FUNCS([strchr]) AC_CHECK_FUNCS([atexit]) AC_CHECK_FUNCS([ftruncate]) AC_CHECK_FUNCS([strrchr]) AC_CHECK_FUNCS([strstr]) AC_CHECK_FUNCS([clock_gettime]) AC_CHECK_FUNCS([strcasecmp]) AC_CHECK_FUNCS([kevent]) # if neither sys/epoll.h nor kevent are present, we should fail. if test "x$ac_cv_header_sys_epoll_h" = xno && test "x$ac_cv_func_kevent" = xno; then AC_MSG_ERROR([Both epoll and kevent unavailable on this OS]) fi if test "x$ac_cv_header_sys_epoll_h" = xyes && test "x$ac_cv_func_kevent" = xyes; then AC_MSG_ERROR([Both epoll and kevent available on this OS, please contact the maintainers to fix the code]) fi # checks (for kronosnetd) if test "x$enable_kronosnetd" = xyes; then AC_CHECK_HEADERS([security/pam_appl.h], [AC_CHECK_LIB([pam], [pam_start])], [AC_MSG_ERROR([Unable to find LinuxPAM devel files])]) AC_CHECK_HEADERS([security/pam_misc.h], [AC_CHECK_LIB([pam_misc], [misc_conv])], [AC_MSG_ERROR([Unable to find LinuxPAM MISC devel files])]) PKG_CHECK_MODULES([libqb], [libqb]) AC_CHECK_LIB([qb], [qb_log_thread_priority_set], [have_qb_log_thread_priority_set="yes"], [have_qb_log_thread_priority_set="no"]) if test "x${have_qb_log_thread_priority_set}" = xyes; then AC_DEFINE_UNQUOTED([HAVE_QB_LOG_THREAD_PRIORITY_SET], [1], [have qb_log_thread_priority_set]) fi fi # local options AC_ARG_ENABLE([debug], [ --enable-debug enable debug build. ], [ default="no" ]) -AC_ARG_ENABLE([publicandocs], - [ --enable-publicandocs enable docs build. ], - [ default="no" ]) - AC_ARG_WITH([initdefaultdir], [ --with-initdefaultdir : path to /etc/sysconfig/.. or /etc/default dir. ], [ INITDEFAULTDIR="$withval" ], [ INITDEFAULTDIR="$sysconfdir/default" ]) AC_ARG_WITH([initddir], [ --with-initddir=DIR : path to init script directory. ], [ INITDDIR="$withval" ], [ INITDDIR="$sysconfdir/init.d" ]) AC_ARG_WITH([systemddir], [ --with-systemddir=DIR : path to systemd unit files directory. ], [ SYSTEMDDIR="$withval" ], [ SYSTEMDDIR="$systemddir" ]) AC_ARG_WITH([syslogfacility], [ --with-syslogfacility=FACILITY default syslog facility. ], [ SYSLOGFACILITY="$withval" ], [ SYSLOGFACILITY="LOG_DAEMON" ]) AC_ARG_WITH([sysloglevel], [ --with-sysloglevel=LEVEL default syslog level. ], [ SYSLOGLEVEL="$withval" ], [ SYSLOGLEVEL="LOG_INFO" ]) AC_ARG_WITH([defaultadmgroup], [ --with-defaultadmgroup=GROUP define PAM group. Users part of this group will be allowed to configure kronosnet. Others will only receive read-only rights. ], [ DEFAULTADMGROUP="$withval" ], [ DEFAULTADMGROUP="kronosnetadm" ]) ## random vars LOGDIR=${localstatedir}/log/ RUNDIR=${localstatedir}/run/ DEFAULT_CONFIG_DIR=${sysconfdir}/kronosnet ## do subst -AM_CONDITIONAL([BUILD_DOCS], [test "x${enable_publicandocs}" = xyes]) AM_CONDITIONAL([DEBUG], [test "x${enable_debug}" = xyes]) AC_SUBST([DEFAULT_CONFIG_DIR]) AC_SUBST([INITDEFAULTDIR]) AC_SUBST([INITDDIR]) AC_SUBST([SYSTEMDDIR]) AC_SUBST([LOGDIR]) AC_SUBST([DEFAULTADMGROUP]) AC_DEFINE_UNQUOTED([DEFAULT_CONFIG_DIR], ["$(eval echo ${DEFAULT_CONFIG_DIR})"], [Default config directory]) AC_DEFINE_UNQUOTED([DEFAULT_CONFIG_FILE], ["$(eval echo ${DEFAULT_CONFIG_DIR}/kronosnetd.conf)"], [Default config file]) AC_DEFINE_UNQUOTED([LOGDIR], ["$(eval echo ${LOGDIR})"], [Default logging directory]) AC_DEFINE_UNQUOTED([DEFAULT_LOG_FILE], ["$(eval echo ${LOGDIR}/kronosnetd.log)"], [Default log file]) AC_DEFINE_UNQUOTED([RUNDIR], ["$(eval echo ${RUNDIR})"], [Default run directory]) AC_DEFINE_UNQUOTED([SYSLOGFACILITY], [$(eval echo ${SYSLOGFACILITY})], [Default syslog facility]) AC_DEFINE_UNQUOTED([SYSLOGLEVEL], [$(eval echo ${SYSLOGLEVEL})], [Default syslog level]) AC_DEFINE_UNQUOTED([DEFAULTADMGROUP], ["$(eval echo ${DEFAULTADMGROUP})"], [Default admin group]) ## *FLAGS handling ENV_CFLAGS="$CFLAGS" ENV_CPPFLAGS="$CPPFLAGS" ENV_LDFLAGS="$LDFLAGS" # debug build stuff if test "x${enable_debug}" = xyes; then AC_DEFINE_UNQUOTED([DEBUG], [1], [Compiling Debugging code]) OPT_CFLAGS="-O0" else OPT_CFLAGS="-O3" fi # gdb flags if test "x${GCC}" = xyes; then GDB_FLAGS="-ggdb3" else GDB_FLAGS="-g" fi # extra warnings EXTRA_WARNINGS="" WARNLIST=" all extra unused shadow missing-prototypes missing-declarations suggest-attribute=noreturn suggest-attribute=format strict-prototypes declaration-after-statement pointer-arith write-strings cast-align bad-function-cast missing-format-attribute float-equal format=2 format-signedness format-security format-nonliteral no-long-long unsigned-char gnu89-inline no-strict-aliasing error address cpp overflow parentheses sequence-point switch shift-overflow=2 overlength-strings retundent-decls init-self uninitialized unused-but-set-variable unused-function unused-result unused-value unused-variable unknown-pragmas no-unused-parameter " for j in $WARNLIST; do if cc_supports_flag -W$j; then EXTRA_WARNINGS="$EXTRA_WARNINGS -W$j"; fi done CFLAGS="$ENV_CFLAGS $lt_prog_compiler_pic $OPT_CFLAGS $GDB_FLAGS \ $EXTRA_WARNINGS $WERROR_CFLAGS" CPPFLAGS="$ENV_CPPFLAGS" LDFLAGS="$ENV_LDFLAGS $lt_prog_compiler_pic -Wl,--as-needed" AC_CONFIG_FILES([ Makefile init/Makefile libtap/Makefile libtap/libtap.pc kronosnetd/Makefile kronosnetd/kronosnetd.logrotate libknet/Makefile libknet/libknet.pc libknet/tests/Makefile libknet/man/Doxyfile libknet/man/Makefile - docs/Makefile poc-code/Makefile poc-code/iov-hash/Makefile poc-code/access-list/Makefile ]) AC_OUTPUT diff --git a/docs/Kronosnet/en-US/Author_Group.xml b/docs/Kronosnet/en-US/Author_Group.xml deleted file mode 100644 index 3840de9e..00000000 --- a/docs/Kronosnet/en-US/Author_Group.xml +++ /dev/null @@ -1,24 +0,0 @@ - - -%BOOK_ENTITIES; -]> - - - Fabio M. - Di Nitto - - Red Hat - - fabbione@kronosnet.org - - - Federico - Simoncelli - - Nethesis - - fsimon@kronosnet.org - - - diff --git a/docs/Kronosnet/en-US/Book_Info.xml b/docs/Kronosnet/en-US/Book_Info.xml deleted file mode 100644 index 5443e63c..00000000 --- a/docs/Kronosnet/en-US/Book_Info.xml +++ /dev/null @@ -1,28 +0,0 @@ - - -%BOOK_ENTITIES; -]> - - Kronosnet - VPNs on steroids - Documentation - 0.1 - 0 - 0 - - - Kronosnet is a playground where to test, experiment and play around with different technologies that apply to VPN solutions. Some of them tailored to HA cluster deployments. - - - - - - - - - - - - - diff --git a/docs/Kronosnet/en-US/Chapter.xml b/docs/Kronosnet/en-US/Chapter.xml deleted file mode 100644 index 626a3b0e..00000000 --- a/docs/Kronosnet/en-US/Chapter.xml +++ /dev/null @@ -1,33 +0,0 @@ - - -%BOOK_ENTITIES; -]> - - Test Chapter - - This is a test paragraph - -
- Test Section 1 - - This is a test paragraph in a section - -
- -
- Test Section 2 - - This is a test paragraph in Section 2 - - - - listitem text - - - - -
- -
- diff --git a/docs/Kronosnet/en-US/Kronosnet.ent b/docs/Kronosnet/en-US/Kronosnet.ent deleted file mode 100644 index 02c56a37..00000000 --- a/docs/Kronosnet/en-US/Kronosnet.ent +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/docs/Kronosnet/en-US/Kronosnet.xml b/docs/Kronosnet/en-US/Kronosnet.xml deleted file mode 100644 index 41d3d873..00000000 --- a/docs/Kronosnet/en-US/Kronosnet.xml +++ /dev/null @@ -1,13 +0,0 @@ - - -%BOOK_ENTITIES; -]> - - - - - - - - diff --git a/docs/Kronosnet/en-US/Preface.xml b/docs/Kronosnet/en-US/Preface.xml deleted file mode 100644 index febcdfe0..00000000 --- a/docs/Kronosnet/en-US/Preface.xml +++ /dev/null @@ -1,13 +0,0 @@ - - -%BOOK_ENTITIES; -]> - - Preface - - - - - - diff --git a/docs/Kronosnet/en-US/Revision_History.xml b/docs/Kronosnet/en-US/Revision_History.xml deleted file mode 100644 index 611bd519..00000000 --- a/docs/Kronosnet/en-US/Revision_History.xml +++ /dev/null @@ -1,27 +0,0 @@ - - -%BOOK_ENTITIES; -]> - - Revision History - - - - 0 - Tue Oct 5 2010 - - Fabio M. - Di Nitto - fabbione@kronosnet.org - - - - Initial creation of book by publican - - - - - - - diff --git a/docs/Kronosnet/publican.cfg b/docs/Kronosnet/publican.cfg deleted file mode 100644 index 79762621..00000000 --- a/docs/Kronosnet/publican.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Config::Simple 4.59 -# Tue Oct 5 13:25:29 2010 - -docname: Kronosnet -xml_lang: en-US -type: Book -brand: common diff --git a/docs/Makefile.am b/docs/Makefile.am deleted file mode 100644 index 41b26d56..00000000 --- a/docs/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. -# -# Author: Fabio M. Di Nitto -# -# This software licensed under GPL-2.0+, LGPL-2.0+ -# - -MAINTAINERCLEANFILES = Makefile.in - -EXTRA_DIST = kronosnet_architecture.odp $(docbook) - -docbook = Kronosnet - -DOCBOOK_FORMATS := pdf,html,html-single,txt - -%.txt: $(wildcard %/en-US/*.xml) - @echo Building $* - cd $* && $(PUBLICAN) build --publish --langs=all --formats=$(DOCBOOK_FORMATS) - touch $@ - -docbook_txt = $(docbook:%=%.txt) - -all-local: $(docbook_txt) */publican.cfg - -clean-local: - @rm -rf $(docbook_txt) - @for book in $(docbook); do rm -rf $$book/tmp $$book/publish; done - -push: - @for book in $(docbook); do \ - rsync -rtz --progress $$book/publish/* fabbione@kronosnet.org:kronosnet/docs; \ - rsync -rtz --progress kronosnet_architecture.odp fabbione@kronosnet.org:kronosnet/docs/kronosnet_architecture.odp; \ - done diff --git a/docs/kronosnet_architecture.odp b/docs/kronosnet_architecture.odp deleted file mode 100644 index ebb4d0b9..00000000 Binary files a/docs/kronosnet_architecture.odp and /dev/null differ diff --git a/init/kronosnetd.default b/init/kronosnetd.default index 04de6604..63d9638c 100644 --- a/init/kronosnetd.default +++ b/init/kronosnetd.default @@ -1,3 +1,11 @@ # kronosnetd startup options (see man kronosnetd.8) +# +# Copyright (C) 2012-2017 Red Hat, Inc. All rights reserved. +# +# Author: Fabio M. Di Nitto +# +# This software licensed under GPL-2.0+, LGPL-2.0+ +# + KNETD_OPTS="" diff --git a/libknet/libknet.h b/libknet/libknet.h index bbb6a446..7ba4cdc4 100644 --- a/libknet/libknet.h +++ b/libknet/libknet.h @@ -1,1923 +1,1924 @@ /* * Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. * * Authors: Fabio M. Di Nitto * Federico Simoncelli * * This software licensed under GPL-2.0+, LGPL-2.0+ */ #ifndef __LIBKNET_H__ #define __LIBKNET_H__ #include #include #include /** * @file libknet.h * @brief kronosnet API include file + * @copyright Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. * * Kronosnet is an advanced VPN system for High Availability applications. */ /* * libknet limits */ /* * Maximum number of hosts */ typedef uint16_t knet_node_id_t; #define KNET_MAX_HOST 65536 /* * Maximum number of links between 2 hosts */ #define KNET_MAX_LINK 8 /* * Maximum packet size that should be written to datafd * see knet_handle_new for details */ #define KNET_MAX_PACKET_SIZE 65536 /* * Buffers used for pretty logging * host is used to store both ip addresses and hostnames */ #define KNET_MAX_HOST_LEN 256 #define KNET_MAX_PORT_LEN 6 /* * Some notifications can be generated either on TX or RX */ #define KNET_NOTIFY_TX 0 #define KNET_NOTIFY_RX 1 /* * Link flags */ /* * Where possible, set traffic priority to high. * On Linux this sets the TOS to INTERACTIVE (6), * see tc-prio(8) for more infomation */ #define KNET_LINK_FLAG_TRAFFICHIPRIO (1ULL << 0) typedef struct knet_handle *knet_handle_t; /* * Handle structs/API calls */ /** * knet_handle_new * * @brief create a new instance of a knet handle * * host_id - Each host in a knet is identified with a unique * ID. when creating a new handle local host_id * must be specified (0 to UINT16T_MAX are all valid). * It is the user's responsibility to check that the value * is unique, or bad things might happen. * * log_fd - Write file descriptor. If set to a value > 0, it will be used * to write log packets from libknet to the application. * Setting to 0 will disable logging from libknet. * It is possible to enable logging at any given time (see logging API). * Make sure to either read from this filedescriptor properly and/or * mark it O_NONBLOCK, otherwise if the fd becomes full, libknet could * block. * * default_log_level - * If logfd is specified, it will initialize all subsystems to log * at default_log_level value. (see logging API) * * @return * on success, a new knet_handle_t is returned. * on failure, NULL is returned and errno is set. */ knet_handle_t knet_handle_new(knet_node_id_t host_id, int log_fd, uint8_t default_log_level); /** * knet_handle_free * @brief Destroy a knet handle, free all resources * * knet_h - pointer to knet_handle_t * * @return * knet_handle_free returns * 0 on success * -1 on error and errno is set. */ int knet_handle_free(knet_handle_t knet_h); /** * knet_handle_enable_sock_notify * @brief Register a callback to receive socket events * * knet_h - pointer to knet_handle_t * * sock_notify_fn_private_data * void pointer to data that can be used to identify * the callback. * * sock_notify_fn * A callback function that is invoked every time * a socket in the datafd pool will report an error (-1) * or an end of read (0) (see socket.7). * This function MUST NEVER block or add substantial delays. * The callback is invoked in an internal unlocked area * to allow calls to knet_handle_add_datafd/knet_handle_remove_datafd * to swap/replace the bad fd. * if both err and errno are 0, it means that the socket * has received a 0 byte packet (EOF?). * The callback function must either remove the fd from knet * (by calling knet_handle_remove_fd()) or dup a new fd in its place. * Failure to do this can cause problems. * * @return * knet_handle_enable_sock_notify returns * 0 on success * -1 on error and errno is set. */ int knet_handle_enable_sock_notify(knet_handle_t knet_h, void *sock_notify_fn_private_data, void (*sock_notify_fn) ( void *private_data, int datafd, int8_t channel, uint8_t tx_rx, int error, int errorno)); /* sorry! can't call it errno ;) */ #define KNET_DATAFD_MAX 32 /** * knet_handle_add_datafd * * @brief Install a file descriptor for communication * * IMPORTANT: In order to add datafd to knet, knet_handle_enable_sock_notify * _MUST_ be set and be able to handle both errors (-1) and * 0 bytes read / write from the provided datafd. * On read error (< 0) from datafd, the socket is automatically * removed from polling to avoid spinning on dead sockets. * It is safe to call knet_handle_remove_datafd even on sockets * that have been removed. * * knet_h - pointer to knet_handle_t * * *datafd - read/write file descriptor. * knet will read data here to send to the other hosts * and will write data received from the network. * Each data packet can be of max size KNET_MAX_PACKET_SIZE! * Applications using knet_send/knet_recv will receive a * proper error if the packet size is not within boundaries. * Applications using their own functions to write to the * datafd should NOT write more than KNET_MAX_PACKET_SIZE. * * Please refer to handle.c on how to set up a socketpair. * * datafd can be 0, and knet_handle_add_datafd will create a properly * populated socket pair the same way as ping_test, or a value * higher than 0. A negative number will return an error. * On exit knet_handle_free will take care to cleanup the * socketpair only if they have been created by knet_handle_add_datafd. * * It is possible to pass either sockets or normal fds. * User provided datafd will be marked as non-blocking and close-on-exit. * * *channel - This value has the same effect of VLAN tagging. * A negative value will auto-allocate a channel. * Setting a value between 0 and 31 will try to allocate that * specific channel (unless already in use). * * It is possible to add up to 32 datafds but be aware that each * one of them must have a receiving end on the other host. * * Example: * hostA channel 0 will be delivered to datafd on hostB channel 0 * hostA channel 1 to hostB channel 1. * * Each channel must have a unique file descriptor. * * If your application could have 2 channels on one host and one * channel on another host, then you can use dst_host_filter * to manipulate channel values on TX and RX. * * @return * knet_handle_add_datafd returns * @retval 0 on success, * *datafd will be populated with a socket if the original value was 0 * or if a specific fd was set, the value is untouched. * *channel will be populated with a channel number if the original value * was negative or the value is untouched if a specific channel * was requested. * * @retval -1 on error and errno is set. * *datafd and *channel are untouched or empty. */ int knet_handle_add_datafd(knet_handle_t knet_h, int *datafd, int8_t *channel); /** * knet_handle_remove_datafd * @brief Remove a file descriptor from knet * * knet_h - pointer to knet_handle_t * * datafd - file descriptor to remove. * NOTE that if the socket/fd was created by knet_handle_add_datafd, * the socket will be closed by libknet. * * @return * knet_handle_remove_datafd returns * 0 on success * -1 on error and errno is set. */ int knet_handle_remove_datafd(knet_handle_t knet_h, int datafd); /** * knet_handle_get_channel * @brief Get the channel associated with a file descriptor * * knet_h - pointer to knet_handle_t * * datafd - get the channel associated to this datafd * * *channel - will contain the result * * @return * knet_handle_get_channel returns * @retval 0 on success * and *channel will contain the result * @retval -1 on error and errno is set. * and *channel content is meaningless */ int knet_handle_get_channel(knet_handle_t knet_h, const int datafd, int8_t *channel); /** * knet_handle_get_datafd * @brief Get the file descriptor associated with a channel * * knet_h - pointer to knet_handle_t * * channel - get the datafd associated to this channel * * *datafd - will contain the result * * @return * knet_handle_get_datafd returns * @retval 0 on success * and *datafd will contain the results * @retval -1 on error and errno is set. * and *datafd content is meaningless */ int knet_handle_get_datafd(knet_handle_t knet_h, const int8_t channel, int *datafd); /** * knet_recv * @brief Receive data from knet nodes * * knet_h - pointer to knet_handle_t * * buff - pointer to buffer to store the received data * * buff_len - buffer length * * channel - channel number * * @return * knet_recv is a commodity function to wrap iovec operations * around a socket. It returns a call to readv(2). */ ssize_t knet_recv(knet_handle_t knet_h, char *buff, const size_t buff_len, const int8_t channel); /** * knet_send * @brief Send data to knet nodes * * knet_h - pointer to knet_handle_t * * buff - pointer to the buffer of data to send * * buff_len - length of data to send * * channel - channel number * * @return * knet_send is a commodity function to wrap iovec operations * around a socket. It returns a call to writev(2). */ ssize_t knet_send(knet_handle_t knet_h, const char *buff, const size_t buff_len, const int8_t channel); /** * knet_send_sync * * @brief Synchronously send data to knet nodes * * knet_h - pointer to knet_handle_t * * buff - pointer to the buffer of data to send * * buff_len - length of data to send * * channel - data channel to use (see knet_handle_add_datafd(3)) * * All knet RX/TX operations are async for performance reasons. * There are applications that might need a sync version of data * transmission and receive errors in case of failure to deliver * to another host. * knet_send_sync bypasses the whole TX async layer and delivers * data directly to the link layer, and returns errors accordingly. * knet_send_sync allows to send only one packet to one host at * a time. It does NOT support multiple destinations or multicast * packets. Decision is still based on dst_host_filter_fn. * * @return * knet_send_sync returns 0 on success and -1 on error. * In addition to normal sendmmsg errors, knet_send_sync can fail * due to: * * @retval ECANCELED - data forward is disabled * @retval EFAULT - dst_host_filter fatal error * @retval EINVAL - dst_host_filter did not provide dst_host_ids_entries on unicast pckts * @retval E2BIG - dst_host_filter did return more than one dst_host_ids_entries on unicast pckts * @retval ENOMSG - received unknown message type * @retval EHOSTDOWN - unicast pckt cannot be delivered because dest host is not connected yet * @retval ECHILD - crypto failed * @retval EAGAIN - sendmmsg was unable to send all messages and there was no progress during retry */ int knet_send_sync(knet_handle_t knet_h, const char *buff, const size_t buff_len, const int8_t channel); /** * knet_handle_enable_filter * * @brief install a filter to route packets * * knet_h - pointer to knet_handle_t * * dst_host_filter_fn_private_data * void pointer to data that can be used to identify * the callback. * * dst_host_filter_fn - * is a callback function that is invoked every time * a packet hits datafd (see knet_handle_new(3)). * the function allows users to tell libknet where the * packet has to be delivered. * * const unsigned char *outdata - is a pointer to the * current packet * ssize_t outdata_len - length of the above data * uint8_t tx_rx - filter is called on tx or rx * (KNET_NOTIFY_TX, KNET_NOTIFY_RX) * knet_node_id_t this_host_id - host_id processing the packet * knet_node_id_t src_host_id - host_id that generated the * packet * knet_node_id_t *dst_host_ids - array of KNET_MAX_HOST knet_node_id_t * where to store the destinations * size_t *dst_host_ids_entries - number of hosts to send the message * * dst_host_filter_fn should return * -1 on error, packet is discarded. * 0 packet is unicast and should be sent to dst_host_ids and there are * dst_host_ids_entries in the buffer. * 1 packet is broadcast/multicast and is sent all hosts. * contents of dst_host_ids and dst_host_ids_entries are ignored. * (see also kronosnetd/etherfilter.* for an example that filters based * on ether protocol) * * @return * knet_handle_enable_filter returns * 0 on success * -1 on error and errno is set. */ int knet_handle_enable_filter(knet_handle_t knet_h, void *dst_host_filter_fn_private_data, int (*dst_host_filter_fn) ( void *private_data, const unsigned char *outdata, ssize_t outdata_len, uint8_t tx_rx, knet_node_id_t this_host_id, knet_node_id_t src_host_id, int8_t *channel, knet_node_id_t *dst_host_ids, size_t *dst_host_ids_entries)); /** * knet_handle_setfwd * * @brief Start packet forwarding * * knet_h - pointer to knet_handle_t * * enable - set to 1 to allow data forwarding, 0 to disable data forwarding. * * @return * knet_handle_setfwd returns * 0 on success * -1 on error and errno is set. * * By default data forwarding is off and no traffic will pass through knet until * it is set on. */ int knet_handle_setfwd(knet_handle_t knet_h, unsigned int enabled); #define KNET_PMTUD_DEFAULT_INTERVAL 60 /** * knet_handle_pmtud_setfreq * * @brief Set the interval between PMTUd scans * * knet_h - pointer to knet_handle_t * * interval - define the interval in seconds between PMTUd scans * range from 1 to 86400 (24h) * * @return * knet_handle_pmtud_setfreq returns * 0 on success * -1 on error and errno is set. * * default interval is 60. */ int knet_handle_pmtud_setfreq(knet_handle_t knet_h, unsigned int interval); /** * knet_handle_pmtud_getfreq * * @brief Get the interval between PMTUd scans * * knet_h - pointer to knet_handle_t * * interval - pointer where to store the current interval value * * @return * knet_handle_pmtud_setfreq returns * 0 on success * -1 on error and errno is set. */ int knet_handle_pmtud_getfreq(knet_handle_t knet_h, unsigned int *interval); /** * knet_handle_enable_pmtud_notify * * @brief install a callback to receive PMTUd changes * * knet_h - pointer to knet_handle_t * * pmtud_notify_fn_private_data * void pointer to data that can be used to identify * the callback. * * pmtud_notify_fn * is a callback function that is invoked every time * a path MTU size change is detected. * The function allows libknet to notify the user * of data MTU, that's the max value that can be send * onwire without fragmentation. The data MTU will always * be lower than real link MTU because it accounts for * protocol overhead, knet packet header and (if configured) * crypto overhead, * This function MUST NEVER block or add substantial delays. * * @return * knet_handle_enable_pmtud_notify returns * 0 on success * -1 on error and errno is set. */ int knet_handle_enable_pmtud_notify(knet_handle_t knet_h, void *pmtud_notify_fn_private_data, void (*pmtud_notify_fn) ( void *private_data, unsigned int data_mtu)); /** * knet_handle_pmtud_get * * @brief Get the current data MTU * * knet_h - pointer to knet_handle_t * * data_mtu - pointer where to store data_mtu * * @return * knet_handle_pmtud_get returns * 0 on success * -1 on error and errno is set. */ int knet_handle_pmtud_get(knet_handle_t knet_h, unsigned int *data_mtu); #define KNET_MIN_KEY_LEN 256 #define KNET_MAX_KEY_LEN 4096 struct knet_handle_crypto_cfg { char crypto_model[16]; char crypto_cipher_type[16]; char crypto_hash_type[16]; unsigned char private_key[KNET_MAX_KEY_LEN]; unsigned int private_key_len; }; /** * knet_handle_crypto * * @brief set up packet cryptographic signing & encryption * * knet_h - pointer to knet_handle_t * * knet_handle_crypto_cfg - * pointer to a knet_handle_crypto_cfg structure * * crypto_model should contain the model name. * Currently only "openssl" and "nss" are supported. * Setting to "none" will disable crypto. * * crypto_cipher_type * should contain the cipher algo name. * It can be set to "none" to disable * encryption. * Currently supported by "nss" model: * "3des", "aes128", "aes192" and "aes256". * "openssl" model supports more modes and it strictly * depends on the openssl build. See: EVP_get_cipherbyname * openssl API call for details. * * crypto_hash_type * should contain the hashing algo name. * It can be set to "none" to disable * hashing. * Currently supported by "nss" model: * "md5", "sha1", "sha256", "sha384" and "sha512". * "openssl" model supports more modes and it strictly * depends on the openssl build. See: EVP_get_digestbyname * openssl API call for details. * * private_key will contain the private shared key. * It has to be at least KNET_MIN_KEY_LEN long. * * private_key_len * length of the provided private_key. * * Implementation notes/current limitations: * - enabling crypto, will increase latency as packets have * to processed. * - enabling crypto might reduce the overall throughtput * due to crypto data overhead. * - re-keying is not implemented yet. * - private/public key encryption/hashing is not currently * planned. * - crypto key must be the same for all hosts in the same * knet instance. * - it is safe to call knet_handle_crypto multiple times at runtime. * The last config will be used. * IMPORTANT: a call to knet_handle_crypto can fail due to: * 1) failure to obtain locking * 2) errors to initializing the crypto level. * This can happen even in subsequent calls to knet_handle_crypto. * A failure in crypto init, might leave your traffic unencrypted! * It's best to stop data forwarding (see knet_handle_setfwd(3)), change crypto config, * start forward again. * * @return * knet_handle_crypto returns: * @retval 0 on success * @retval -1 on error and errno is set. * @retval -2 on crypto subsystem initialization error. No errno is provided at the moment (yet). */ int knet_handle_crypto(knet_handle_t knet_h, struct knet_handle_crypto_cfg *knet_handle_crypto_cfg); #define KNET_COMPRESS_THRESHOLD 100 struct knet_handle_compress_cfg { char compress_model[16]; uint32_t compress_threshold; int compress_level; }; /** * knet_handle_compress * * @brief Set up packet compression * * knet_h - pointer to knet_handle_t * * knet_handle_compress_cfg - * pointer to a knet_handle_compress_cfg structure * * compress_model should contain the mode name. * Currently only "zlib" and "lz4" are supported. * Setting to "none" will disable compression. * * compress_threshold * tells the transmission thread to NOT compress * any packets that are smaller than the value * indicated. Default 100 bytes. * Set to 0 to reset to the default. * Set to 1 to compress everything. * Max accepted value is KNET_MAX_PACKET_SIZE. * * compress_level some compression libraries allow tuning of compression * parameters. * For example zlib value ranges from 0 to 9 where 0 is no * compression and 9 is max compression. * This value is passed pristine to the compression library. * zlib: 0 (no compression), 1 (minimal) .. 9 (max compression). * lz4: 1 (max compression)... 9 (fastest compression). * lz4hc: 1 (min compression) ... LZ4HC_MAX_CLEVEL (16) or LZ4HC_CLEVEL_MAX (12) * depends on the installed version of lz4hc. libknet can detects the max * value and will print an appropriate warning. * lzo2: accepts only some specific values depending on the * requested algorithm: * 1 : lzo1x_1_compress (default) * 11 : lzo1x_1_11_compress * 12 : lzo1x_1_12_compress * 15 : lzo1x_1_15_compress * 999: lzo1x_999_compress * every other values will use default * lzma: 0 (minimal) .. 9 (max compression) * bzip2: 1 (minimal) .. 9 (max compression) * Please refer to the library man pages * on how to be set this value, as it is passed * unmodified to the compression algorithm where supported. * * Implementation notes: * - it is possible to enable/disable compression at any time. * - nodes can be using a different compression algorithm at any time. * - knet does NOT implement the compression algorithm directly. it relies * on external libraries for this functionality. Please read * the libraries man pages to figure out which algorithm/compression * level is best for the data you are planning to transmit. * * @return * knet_handle_compress returns * 0 on success * -1 on error and errno is set. EINVAL means that either the model or the * level are not supported. */ int knet_handle_compress(knet_handle_t knet_h, struct knet_handle_compress_cfg *knet_handle_compress_cfg); struct knet_handle_stats { size_t size; uint64_t tx_uncompressed_packets; uint64_t tx_compressed_packets; uint64_t tx_compressed_original_bytes; uint64_t tx_compressed_size_bytes; uint64_t tx_compress_time_ave; uint64_t tx_compress_time_min; uint64_t tx_compress_time_max; uint64_t rx_compressed_packets; uint64_t rx_compressed_original_bytes; uint64_t rx_compressed_size_bytes; uint64_t rx_compress_time_ave; uint64_t rx_compress_time_min; uint64_t rx_compress_time_max; /* Overhead times, measured in usecs */ uint64_t tx_crypt_packets; uint64_t tx_crypt_byte_overhead; uint64_t tx_crypt_time_ave; uint64_t tx_crypt_time_min; uint64_t tx_crypt_time_max; uint64_t rx_crypt_packets; uint64_t rx_crypt_time_ave; uint64_t rx_crypt_time_min; uint64_t rx_crypt_time_max; }; /** * knet_handle_get_stats * * @brief Get statistics for compression & crypto * * knet_h - pointer to knet_handle_t * * knet_handle_stats * pointer to a knet_handle_stats structure * * struct_size * size of knet_handle_stats structure to allow * for backwards compatibility. libknet will only * copy this much data into the stats structure * so that older callers will not get overflowed if * new fields are added. * * @return * 0 on success * -1 on error and errno is set. * */ int knet_handle_get_stats(knet_handle_t knet_h, struct knet_handle_stats *stats, size_t struct_size); /* * Tell knet_handle_clear_stats whether to clear just the handle stats * or all of them. */ #define KNET_CLEARSTATS_HANDLE_ONLY 1 #define KNET_CLEARSTATS_HANDLE_AND_LINK 2 /** * knet_handle_clear_stats * * @brief Clear knet stats, link and/or handle * * knet_h - pointer to knet_handle_t * * clear_option - Which stats to clear, must be one of * * KNET_CLEARSTATS_HANDLE_ONLY or * KNET_CLEARSTATS_HANDLE_AND_LINK * * @return * 0 on success * -1 on error and errno is set. * */ int knet_handle_clear_stats(knet_handle_t knet_h, int clear_option); /** * knet_handle_get_crypto_list * * @brief Get a list of supported crypto libraries * * knet_h - pointer to knet_handle_t * * crypto_names - array of char * * If NULL then only the number of names is returned in num_names to * to allow the caller to allocate sufficient space. * * num_names - returns the number of strings in crypto_names * * @return * knet_host_add returns * 0 on success * -1 on error and errno is set. */ int knet_handle_get_crypto_list(knet_handle_t knet_h, const char **crypto_names, size_t *num_names); /** * knet_handle_get_compress_list * * @brief Get a list of support compression types * * knet_h - pointer to knet_handle_t * * compress_names - array of char * * If NULL then only the number of names is returned in num_names to * to allow the caller to allocate sufficient space. * * num_names - returns the number of strings in compres_names * * @return * knet_host_add returns * 0 on success * -1 on error and errno is set. */ int knet_handle_get_compress_list(knet_handle_t knet_h, const char **compress_names, size_t *num_names); /* * host structs/API calls */ /** * knet_host_add * * @brief Add a new host ID to knet * * knet_h - pointer to knet_handle_t * * host_id - each host in a knet is identified with a unique ID * (see also knet_handle_new(3)) * * @return * knet_host_add returns: * 0 on success * -1 on error and errno is set. */ int knet_host_add(knet_handle_t knet_h, knet_node_id_t host_id); /** * knet_host_remove * * @brief Remove a host ID from knet * * knet_h - pointer to knet_handle_t * * host_id - each host in a knet is identified with a unique ID * (see also knet_handle_new(3)) * * @return * knet_host_remove returns: * 0 on success * -1 on error and errno is set. */ int knet_host_remove(knet_handle_t knet_h, knet_node_id_t host_id); /** * knet_host_set_name * * @brief Set the name of a knet host * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * name - this name will be used for pretty logging and eventually * search for hosts (see also knet_handle_host_get_name(2) and knet_handle_host_get_id(3)). * Only up to KNET_MAX_HOST_LEN - 1 bytes will be accepted and * name has to be unique for each host. * * @return * knet_host_set_name returns: * 0 on success * -1 on error and errno is set. */ int knet_host_set_name(knet_handle_t knet_h, knet_node_id_t host_id, const char *name); /** * knet_host_get_name_by_host_id * * @brief Get the name of a host given its ID * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * name - pointer to a preallocated buffer of at least size KNET_MAX_HOST_LEN * where the current host name will be stored * (as set by knet_host_set_name or default by knet_host_add) * * @return * knet_host_get_name_by_host_id returns: * 0 on success * -1 on error and errno is set (name is left untouched) */ int knet_host_get_name_by_host_id(knet_handle_t knet_h, knet_node_id_t host_id, char *name); /** * knet_host_get_id_by_host_name * * @brief Get the ID of a host given its name * * knet_h - pointer to knet_handle_t * * name - name to lookup, max len KNET_MAX_HOST_LEN * * host_id - where to store the result * * @return * knet_host_get_id_by_host_name returns: * 0 on success * -1 on error and errno is set. */ int knet_host_get_id_by_host_name(knet_handle_t knet_h, const char *name, knet_node_id_t *host_id); /** * knet_host_get_host_list * * @brief Get a list of hosts known to knet * * knet_h - pointer to knet_handle_t * * host_ids - array of at lest KNET_MAX_HOST size * * host_ids_entries - * number of entries writted in host_ids * * @return * knet_host_get_host_list returns * 0 on success * -1 on error and errno is set. */ int knet_host_get_host_list(knet_handle_t knet_h, knet_node_id_t *host_ids, size_t *host_ids_entries); /* * define switching policies */ #define KNET_LINK_POLICY_PASSIVE 0 #define KNET_LINK_POLICY_ACTIVE 1 #define KNET_LINK_POLICY_RR 2 /** * knet_host_set_policy * * knet_h - pointer to knet_handle_t * * @brief Set the switching policy for a host's links * * host_id - see knet_host_add(3) * * policy - there are currently 3 kind of simple switching policies * based on link configuration. * KNET_LINK_POLICY_PASSIVE - the active link with the lowest * priority will be used. * if one or more active links share * the same priority, the one with * lowest link_id will be used. * * KNET_LINK_POLICY_ACTIVE - all active links will be used * simultaneously to send traffic. * link priority is ignored. * * KNET_LINK_POLICY_RR - round-robin policy, every packet * will be send on a different active * link. * * @return * knet_host_set_policy returns * 0 on success * -1 on error and errno is set. */ int knet_host_set_policy(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t policy); /** * knet_host_get_policy * * @brief Get the switching policy for a host's links * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * policy - will contain the current configured switching policy. * Default is passive when creating a new host. * * @return * knet_host_get_policy returns * 0 on success * -1 on error and errno is set. */ int knet_host_get_policy(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t *policy); /** * knet_host_enable_status_change_notify * * @brief Install a callback to get host status change events * * knet_h - pointer to knet_handle_t * * host_status_change_notify_fn_private_data - * void pointer to data that can be used to identify * the callback * * host_status_change_notify_fn - * is a callback function that is invoked every time * there is a change in the host status. * host status is identified by: * - reachable, this host can send/receive data to/from host_id * - remote, 0 if the host_id is connected locally or 1 if * the there is one or more knet host(s) in between. * NOTE: re-switching is NOT currently implemented, * but this is ready for future and can avoid * an API/ABI breakage later on. * - external, 0 if the host_id is configured locally or 1 if * it has been added from remote nodes config. * NOTE: dynamic topology is NOT currently implemented, * but this is ready for future and can avoid * an API/ABI breakage later on. * This function MUST NEVER block or add substantial delays. * * @return * knet_host_status_change_notify returns * 0 on success * -1 on error and errno is set. */ int knet_host_enable_status_change_notify(knet_handle_t knet_h, void *host_status_change_notify_fn_private_data, void (*host_status_change_notify_fn) ( void *private_data, knet_node_id_t host_id, uint8_t reachable, uint8_t remote, uint8_t external)); /* * define host status structure for quick lookup * struct is in flux as more stats will be added soon * * reachable host_id can be seen either directly connected * or via another host_id * * remote 0 = node is connected locally, 1 is visible via * via another host_id * * external 0 = node is configured/known locally, * 1 host_id has been received via another host_id */ struct knet_host_status { uint8_t reachable; uint8_t remote; uint8_t external; /* add host statistics */ }; /** * knet_host_status_get * * @brief Get the status of a host * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * status - pointer to knet_host_status struct * * @return * knet_handle_pmtud_get returns * 0 on success * -1 on error and errno is set. */ int knet_host_get_status(knet_handle_t knet_h, knet_node_id_t host_id, struct knet_host_status *status); /* * link structs/API calls * * every host allocated/managed by knet_host_* has * KNET_MAX_LINK structures to define the network * paths that connect 2 hosts. * * Each link is identified by a link_id that has a * values between 0 and KNET_MAX_LINK - 1. * * KNOWN LIMITATIONS: * * - let's assume the scenario where two hosts are connected * with any number of links. link_id must match on both sides. * If host_id 0 link_id 0 is configured to connect IP1 to IP2 and * host_id 0 link_id 1 is configured to connect IP3 to IP4, * host_id 1 link_id 0 _must_ connect IP2 to IP1 and likewise * host_id 1 link_id 1 _must_ connect IP4 to IP3. * We might be able to lift this restriction in future, by using * other data to determine src/dst link_id, but for now, deal with it. */ /* * commodity functions to convert strings to sockaddr and viceversa */ /** * knet_strtoaddr * * @brief Convert a hostname string to an address * * host - IPaddr/hostname to convert * be aware only the first IP address will be returned * in case a hostname resolves to multiple IP * * port - port to connect to * * ss - sockaddr_storage where to store the converted data * * sslen - len of the sockaddr_storage * * @return * knet_strtoaddr returns same error codes as getaddrinfo * */ int knet_strtoaddr(const char *host, const char *port, struct sockaddr_storage *ss, socklen_t sslen); /** * knet_addrtostr * * @brief Convert an address to a host name * * ss - sockaddr_storage to convert * * sslen - len of the sockaddr_storage * * host - IPaddr/hostname where to store data * (recommended size: KNET_MAX_HOST_LEN) * * port - port buffer where to store data * (recommended size: KNET_MAX_PORT_LEN) * * @return * knet_strtoaddr returns same error codes as getnameinfo */ int knet_addrtostr(const struct sockaddr_storage *ss, socklen_t sslen, char *addr_buf, size_t addr_buf_size, char *port_buf, size_t port_buf_size); #define KNET_TRANSPORT_LOOPBACK 0 #define KNET_TRANSPORT_UDP 1 #define KNET_TRANSPORT_SCTP 2 #define KNET_MAX_TRANSPORTS 3 /* * The Loopback transport is only valid for connections to localhost, the host * with the same node_id specified in knet_handle_new(). Only one link of this * type is allowed. Data sent down a LOOPBACK link will be copied directly from * the knet send datafd to the knet receive datafd so the application must be set * up to take data from that socket at least as often as it is sent or deadlocks * could occur. If used, a LOOPBACK link must be the only link configured to the * local host. */ struct knet_transport_info { const char *name; /* UDP/SCTP/etc... */ uint8_t id; /* value that can be used for link_set_config */ uint8_t properties; /* currently unused */ }; /** * knet_handle_get_transport_list * * @brief Get a list of the transports support by this build of knet * * knet_h - pointer to knet_handle_t * * transport_list - an array of struct transport_info that must be * at least of size struct transport_info * KNET_MAX_TRANSPORTS * * transport_list_entries - pointer to a size_t where to store how many transports * are available in this build of libknet. * * @return * knet_handle_get_transport_list returns * 0 on success * -1 on error and errno is set. */ int knet_handle_get_transport_list(knet_handle_t knet_h, struct knet_transport_info *transport_list, size_t *transport_list_entries); /** * knet_handle_get_transport_name_by_id * * @brief Get a transport name from its ID number * * knet_h - pointer to knet_handle_t * * transport - one of the KNET_TRANSPORT_xxx constants * * @return * knet_handle_get_transport_name_by_id returns: * * @retval pointer to the name on success or * @retval NULL on error and errno is set. */ const char *knet_handle_get_transport_name_by_id(knet_handle_t knet_h, uint8_t transport); /** * knet_handle_get_transport_id_by_name * * @brief Get a transport ID from its name * * knet_h - pointer to knet_handle_t * * name - transport name (UDP/SCTP/etc) * * @return * knet_handle_get_transport_name_by_id returns: * * @retval KNET_MAX_TRANSPORTS on error and errno is set accordingly * @retval KNET_TRANSPORT_xxx on success. */ uint8_t knet_handle_get_transport_id_by_name(knet_handle_t knet_h, const char *name); #define KNET_TRANSPORT_DEFAULT_RECONNECT_INTERVAL 1000 /** * knet_handle_set_transport_reconnect_interval * * @brief Set the interval between transport attempts to reconnect a failed link * * knet_h - pointer to knet_handle_t * * msecs - milliseconds * * @return * knet_handle_set_transport_reconnect_interval returns * 0 on success * -1 on error and errno is set. */ int knet_handle_set_transport_reconnect_interval(knet_handle_t knet_h, uint32_t msecs); /** * knet_handle_get_transport_reconnect_interval * * @brief Get the interval between transport attempts to reconnect a failed link * * knet_h - pointer to knet_handle_t * * msecs - milliseconds * * @return * knet_handle_get_transport_reconnect_interval returns * 0 on success * -1 on error and errno is set. */ int knet_handle_get_transport_reconnect_interval(knet_handle_t knet_h, uint32_t *msecs); /** * knet_link_set_config * * @brief Configure the link to a host * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * link_id - see knet_link_set_config(3) * * transport - one of the KNET_TRANSPORT_xxx constants * * src_addr - sockaddr_storage that can be either IPv4 or IPv6 * * dst_addr - sockaddr_storage that can be either IPv4 or IPv6 * this can be null if we don't know the incoming * IP address/port and the link will remain quiet * till the node on the other end will initiate a * connection * * flags - KNET_LINK_FLAG_* * * @return * knet_link_set_config returns * 0 on success * -1 on error and errno is set. */ int knet_link_set_config(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t link_id, uint8_t transport, struct sockaddr_storage *src_addr, struct sockaddr_storage *dst_addr, uint64_t flags); /** * knet_link_get_config * * @brief Get the link configutation information * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * link_id - see knet_link_set_config(3) * * transport - see knet_link_set_config(3) * * src_addr - sockaddr_storage that can be either IPv4 or IPv6 * * dst_addr - sockaddr_storage that can be either IPv4 or IPv6 * * dynamic - 0 if dst_addr is static or 1 if dst_addr is dynamic. * In case of 1, dst_addr can be NULL and it will be left * untouched. * * flags - KNET_LINK_FLAG_* * * @return * knet_link_get_config returns * 0 on success. * -1 on error and errno is set. */ int knet_link_get_config(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t link_id, uint8_t *transport, struct sockaddr_storage *src_addr, struct sockaddr_storage *dst_addr, uint8_t *dynamic, uint64_t *flags); /** * knet_link_clear_config * * @brief Clear link information and disconnect the link * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * link_id - see knet_link_set_config(3) * * @return * knet_link_clear_config returns * 0 on success. * -1 on error and errno is set. */ int knet_link_clear_config(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t link_id); /** * knet_link_set_enable * * @brief Enable traffic on a link * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * link_id - see knet_link_set_config(3) * * enabled - 0 disable the link, 1 enable the link * * @return * knet_link_set_enable returns * 0 on success * -1 on error and errno is set. */ int knet_link_set_enable(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t link_id, unsigned int enabled); /** * knet_link_get_enable * * @brief Find out whether a link is enabled or not * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * link_id - see knet_link_set_config(3) * * enabled - 0 disable the link, 1 enable the link * * @return * knet_link_get_enable returns * 0 on success * -1 on error and errno is set. */ int knet_link_get_enable(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t link_id, unsigned int *enabled); #define KNET_LINK_DEFAULT_PING_INTERVAL 1000 /* 1 second */ #define KNET_LINK_DEFAULT_PING_TIMEOUT 2000 /* 2 seconds */ #define KNET_LINK_DEFAULT_PING_PRECISION 2048 /* samples */ /** * knet_link_set_ping_timers * * @brief Set the ping timers for a link * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * link_id - see knet_link_set_config(3) * * interval - specify the ping interval * * timeout - if no pong is received within this time, * the link is declared dead * * precision - how many values of latency are used to calculate * the average link latency (see also knet_link_get_status(3)) * * @return * knet_link_set_ping_timers returns * 0 on success * -1 on error and errno is set. */ int knet_link_set_ping_timers(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t link_id, time_t interval, time_t timeout, unsigned int precision); /** * knet_link_get_ping_timers * * @brief Get the ping timers for a link * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * link_id - see knet_link_set_config(3) * * interval - ping interval * * timeout - if no pong is received within this time, * the link is declared dead * * precision - how many values of latency are used to calculate * the average link latency (see also knet_link_get_status(3)) * * @return * knet_link_get_ping_timers returns * 0 on success * -1 on error and errno is set. */ int knet_link_get_ping_timers(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t link_id, time_t *interval, time_t *timeout, unsigned int *precision); #define KNET_LINK_DEFAULT_PONG_COUNT 5 /** * knet_link_set_pong_count * * @brief Set the pong count for a link * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * link_id - see knet_link_set_config(3) * * pong_count - how many valid ping/pongs before a link is marked UP. * default: 5, value should be > 0 * * @return * knet_link_set_pong_count returns * 0 on success * -1 on error and errno is set. */ int knet_link_set_pong_count(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t link_id, uint8_t pong_count); /** * knet_link_get_pong_count * * @brief Get the pong count for a link * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * link_id - see knet_link_set_config(3) * * pong_count - how many valid ping/pongs before a link is marked UP. * default: 5, value should be > 0 * * @return * knet_link_get_pong_count returns * 0 on success * -1 on error and errno is set. */ int knet_link_get_pong_count(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t link_id, uint8_t *pong_count); /** * knet_link_set_priority * * @brief Set the priority for a link * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * link_id - see knet_link_set_config(3) * * priority - specify the switching priority for this link * see also knet_host_set_policy * * @return * knet_link_set_priority returns * 0 on success * -1 on error and errno is set. */ int knet_link_set_priority(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t link_id, uint8_t priority); /** * knet_link_get_priority * * @brief Get the priority for a link * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * link_id - see knet_link_set_config(3) * * priority - gather the switching priority for this link * see also knet_host_set_policy * * @return * knet_link_get_priority returns * 0 on success * -1 on error and errno is set. */ int knet_link_get_priority(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t link_id, uint8_t *priority); /** * knet_link_get_link_list * * @brief Get a list of links connecting a host * * knet_h - pointer to knet_handle_t * * link_ids - array of at lest KNET_MAX_LINK size * with the list of configured links for a certain host. * * link_ids_entries - * number of entries contained in link_ids * * @return * knet_link_get_link_list returns * 0 on success * -1 on error and errno is set. */ int knet_link_get_link_list(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t *link_ids, size_t *link_ids_entries); /* * define link status structure for quick lookup * * src/dst_{ipaddr,port} strings are filled by * getnameinfo(3) when configuring the link. * if the link is dynamic (see knet_link_set_config(3)) * dst_ipaddr/port will contain ipaddr/port of the currently * connected peer or "Unknown" if it was not possible * to determine the ipaddr/port at runtime. * * enabled see also knet_link_set/get_enable. * * connected the link is connected to a peer and ping/pong traffic * is flowing. * * dynconnected the link has dynamic ip on the other end, and * we can see the other host is sending pings to us. * * latency average latency of this link * see also knet_link_set/get_timeout. * * pong_last if the link is down, this value tells us how long * ago this link was active. A value of 0 means that the link * has never been active. * * knet_link_stats structure that contains details statistics for the link */ #define MAX_LINK_EVENTS 16 struct knet_link_stats { /* onwire values */ uint64_t tx_data_packets; uint64_t rx_data_packets; uint64_t tx_data_bytes; uint64_t rx_data_bytes; uint64_t rx_ping_packets; uint64_t tx_ping_packets; uint64_t rx_ping_bytes; uint64_t tx_ping_bytes; uint64_t rx_pong_packets; uint64_t tx_pong_packets; uint64_t rx_pong_bytes; uint64_t tx_pong_bytes; uint64_t rx_pmtu_packets; uint64_t tx_pmtu_packets; uint64_t rx_pmtu_bytes; uint64_t tx_pmtu_bytes; /* Only filled in when requested */ uint64_t tx_total_packets; uint64_t rx_total_packets; uint64_t tx_total_bytes; uint64_t rx_total_bytes; uint64_t tx_total_errors; uint64_t tx_total_retries; uint32_t tx_pmtu_errors; uint32_t tx_pmtu_retries; uint32_t tx_ping_errors; uint32_t tx_ping_retries; uint32_t tx_pong_errors; uint32_t tx_pong_retries; uint32_t tx_data_errors; uint32_t tx_data_retries; /* measured in usecs */ uint32_t latency_min; uint32_t latency_max; uint32_t latency_ave; uint32_t latency_samples; /* how many times the link has been going up/down */ uint32_t down_count; uint32_t up_count; /* * circular buffer of time_t structs collecting the history * of up/down events on this link. * the index indicates current/last event. * it is safe to walk back the history by decreasing the index */ time_t last_up_times[MAX_LINK_EVENTS]; time_t last_down_times[MAX_LINK_EVENTS]; int8_t last_up_time_index; int8_t last_down_time_index; /* Always add new stats at the end */ }; struct knet_link_status { size_t size; /* For ABI checking */ char src_ipaddr[KNET_MAX_HOST_LEN]; char src_port[KNET_MAX_PORT_LEN]; char dst_ipaddr[KNET_MAX_HOST_LEN]; char dst_port[KNET_MAX_PORT_LEN]; uint8_t enabled; /* link is configured and admin enabled for traffic */ uint8_t connected; /* link is connected for data (local view) */ uint8_t dynconnected; /* link has been activated by remote dynip */ unsigned long long latency; /* average latency computed by fix/exp */ struct timespec pong_last; unsigned int mtu; /* current detected MTU on this link */ unsigned int proto_overhead; /* contains the size of the IP protocol, knet headers and * crypto headers (if configured). This value is filled in * ONLY after the first PMTUd run on that given link, * and can change if link configuration or crypto configuration * changes at runtime. * WARNING: in general mtu + proto_overhead might or might * not match the output of ifconfig mtu due to crypto * requirements to pad packets to some specific boundaries. */ /* Link statistics */ struct knet_link_stats stats; }; /** * knet_link_get_status * * @brief Get the status (and statistics) for a link * * knet_h - pointer to knet_handle_t * * host_id - see knet_host_add(3) * * link_id - see knet_link_set_config(3) * * status - pointer to knet_link_status struct * * struct_size - max size of knet_link_status - allows library to * add fields without ABI change. Returned structure * will be truncated to this length and .size member * indicates the full size. * * @return * knet_link_get_status returns * 0 on success * -1 on error and errno is set. */ int knet_link_get_status(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t link_id, struct knet_link_status *status, size_t struct_size); /* * logging structs/API calls */ /* * libknet is composed of several subsystems. In order * to easily distinguish log messages coming from different * places, each subsystem has its own ID. * * 0-19 config/management * 20-39 internal threads * 40-59 transports * 60-69 crypto implementations */ #define KNET_SUB_COMMON 0 /* common.c */ #define KNET_SUB_HANDLE 1 /* handle.c alloc/dealloc config changes */ #define KNET_SUB_HOST 2 /* host add/del/modify */ #define KNET_SUB_LISTENER 3 /* listeners add/del/modify... */ #define KNET_SUB_LINK 4 /* link add/del/modify */ #define KNET_SUB_TRANSPORT 5 /* Transport common */ #define KNET_SUB_CRYPTO 6 /* crypto.c config generic layer */ #define KNET_SUB_COMPRESS 7 /* compress.c config generic layer */ #define KNET_SUB_FILTER 19 /* allocated for users to log from dst_filter */ #define KNET_SUB_DSTCACHE 20 /* switching thread (destination cache handling) */ #define KNET_SUB_HEARTBEAT 21 /* heartbeat thread */ #define KNET_SUB_PMTUD 22 /* Path MTU Discovery thread */ #define KNET_SUB_TX 23 /* send to link thread */ #define KNET_SUB_RX 24 /* recv from link thread */ #define KNET_SUB_TRANSP_BASE 40 /* Base log level for transports */ #define KNET_SUB_TRANSP_LOOPBACK (KNET_SUB_TRANSP_BASE + KNET_TRANSPORT_LOOPBACK) #define KNET_SUB_TRANSP_UDP (KNET_SUB_TRANSP_BASE + KNET_TRANSPORT_UDP) #define KNET_SUB_TRANSP_SCTP (KNET_SUB_TRANSP_BASE + KNET_TRANSPORT_SCTP) #define KNET_SUB_NSSCRYPTO 60 /* nsscrypto.c */ #define KNET_SUB_OPENSSLCRYPTO 61 /* opensslcrypto.c */ #define KNET_SUB_ZLIBCOMP 70 /* compress_zlib.c */ #define KNET_SUB_LZ4COMP 71 /* compress_lz4.c */ #define KNET_SUB_LZ4HCCOMP 72 /* compress_lz4.c */ #define KNET_SUB_LZO2COMP 73 /* compress_lzo.c */ #define KNET_SUB_LZMACOMP 74 /* compress_lzma.c */ #define KNET_SUB_BZIP2COMP 75 /* compress_bzip2.c */ #define KNET_SUB_UNKNOWN 254 #define KNET_MAX_SUBSYSTEMS KNET_SUB_UNKNOWN + 1 /* * Convert between subsystem IDs and names */ /** * knet_log_get_subsystem_name * * @brief Get a logging system name from its numeric ID * * @return * returns internal name of the subsystem or "common" */ const char *knet_log_get_subsystem_name(uint8_t subsystem); /** * knet_log_get_subsystem_id * * @brief Get a logging system ID from its name * * @return * returns internal ID of the subsystem or KNET_SUB_COMMON */ uint8_t knet_log_get_subsystem_id(const char *name); /* * 4 log levels are enough for everybody */ #define KNET_LOG_ERR 0 /* unrecoverable errors/conditions */ #define KNET_LOG_WARN 1 /* recoverable errors/conditions */ #define KNET_LOG_INFO 2 /* info, link up/down, config changes.. */ #define KNET_LOG_DEBUG 3 /* * Convert between log level values and names */ /** * knet_log_get_loglevel_name * * @brief Get a logging level name from its numeric ID * * @return * returns internal name of the log level or "ERROR" for unknown values */ const char *knet_log_get_loglevel_name(uint8_t level); /** * knet_log_get_loglevel_id * * @brief Get a logging level ID from its name * * @return * returns internal log level ID or KNET_LOG_ERR for invalid names */ uint8_t knet_log_get_loglevel_id(const char *name); /* * every log message is composed by a text message (including a trailing \n) * and message level/subsystem IDs. * In order to make debugging easier it is possible to send those packets * straight to stdout/stderr (see knet_bench.c stdout option). */ #define KNET_MAX_LOG_MSG_SIZE 256 struct knet_log_msg { char msg[KNET_MAX_LOG_MSG_SIZE - (sizeof(uint8_t)*2)]; uint8_t subsystem; /* KNET_SUB_* */ uint8_t msglevel; /* KNET_LOG_* */ }; /** * knet_log_set_log_level * * @brief Set the logging level for a subsystem * * knet_h - same as above * * subsystem - same as above * * level - same as above * * knet_log_set_loglevel allows fine control of log levels by subsystem. * See also knet_handle_new for defaults. * * @return * knet_log_set_loglevel returns * 0 on success * -1 on error and errno is set. */ int knet_log_set_loglevel(knet_handle_t knet_h, uint8_t subsystem, uint8_t level); /** * knet_log_get_log_level * * @brief Get the logging level for a subsystem * * knet_h - same as above * * subsystem - same as above * * level - same as above * * @return * knet_log_get_loglevel returns * 0 on success * -1 on error and errno is set. */ int knet_log_get_loglevel(knet_handle_t knet_h, uint8_t subsystem, uint8_t *level); #endif diff --git a/libknet/libknet_exported_syms b/libknet/libknet_exported_syms index 9db144b9..52efc6a5 100644 --- a/libknet/libknet_exported_syms +++ b/libknet/libknet_exported_syms @@ -1,8 +1,15 @@ # Version and symbol export for libknet.so +# +# Copyright (C) 2016-2017 Red Hat, Inc. All rights reserved. +# +# Author: Fabio M. Di Nitto +# +# This software licensed under GPL-2.0+, LGPL-2.0+ +# -LIBKNET_0.0 { +LIBKNET { global: knet_*; local: *; }; diff --git a/libknet/man/Doxyfile.in b/libknet/man/Doxyfile.in index aa02f138..c92ce729 100644 --- a/libknet/man/Doxyfile.in +++ b/libknet/man/Doxyfile.in @@ -1,9 +1,17 @@ +# +# Copyright (C) 2017 Red Hat, Inc. All rights reserved. +# +# Author: Fabio M. Di Nitto +# Christine Caulfield +# +# This software licensed under GPL-2.0+, LGPL-2.0+ +# PROJECT_NAME = @PACKAGE_NAME@ PROJECT_NUMBER = @PACKAGE_VERSION@ INPUT = @srcdir@/../libknet.h XML_OUTPUT = @abs_builddir@/xml GENERATE_XML = YES XML_PROGRAMLISTING = NO AUTOLINK_SUPPORT = NO GENERATE_HTML = NO GENERATE_LATEX = NO diff --git a/libknet/man/knet_addrtostr.3 b/libknet/man/knet_addrtostr.3 index 0af08d2b..30da4c62 100644 --- a/libknet/man/knet_addrtostr.3 +++ b/libknet/man/knet_addrtostr.3 @@ -1,39 +1,42 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_addrtostr 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_addrtostr 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_addrtostr \- Convert an address to a host name. .SH SYNOPSIS .nf .B #include .sp \fBint knet_addrtostr\fP( \fBconst struct sockaddr_storage *\fP\fIss\fP, \fBsocklen_t \fP\fIsslen\fP, \fBchar *\fP\fIaddr_buf\fP, \fBsize_t \fP\fIaddr_buf_size\fP, \fBchar *\fP\fIport_buf\fP, \fBsize_t \fP\fIport_buf_size\fP ); .fi .SH DESCRIPTION .PP knet_addrtostr .PP ss - sockaddr_storage to convert .PP sslen - len of the sockaddr_storage .PP host - IPaddr/hostname where to store data (recommended size: KNET_MAX_HOST_LEN) .PP port - port buffer where to store data (recommended size: KNET_MAX_PORT_LEN) .SH RETURN VALUE .PP knet_strtoaddr returns same error codes as getnameinfo .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_add_datafd.3 b/libknet/man/knet_handle_add_datafd.3 index 8b9be8c5..906e1f88 100644 --- a/libknet/man/knet_handle_add_datafd.3 +++ b/libknet/man/knet_handle_add_datafd.3 @@ -1,58 +1,61 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_add_datafd 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_add_datafd 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_add_datafd \- Install a file descriptor for communication. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_add_datafd\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBint *\fP\fIdatafd\fP, \fBint8_t *\fP\fIchannel\fP ); .fi .SH DESCRIPTION .PP knet_handle_add_datafd .PP IMPORTANT: In order to add datafd to knet, knet_handle_enable_sock_notify MUST be set and be able to handle both errors (-1) and 0 bytes read / write from the provided datafd. On read error (< 0) from datafd, the socket is automatically removed from polling to avoid spinning on dead sockets. It is safe to call knet_handle_remove_datafd even on sockets that have been removed. .PP knet_h - pointer to knet_handle_t .PP *datafd - read/write file descriptor. knet will read data here to send to the other hosts and will write data received from the network. Each data packet can be of max size KNET_MAX_PACKET_SIZE! Applications using knet_send/knet_recv will receive a proper error if the packet size is not within boundaries. Applications using their own functions to write to the datafd should NOT write more than KNET_MAX_PACKET_SIZE. .PP Please refer to handle.c on how to set up a socketpair. .PP datafd can be 0, and knet_handle_add_datafd will create a properly populated socket pair the same way as ping_test, or a value higher than 0. A negative number will return an error. On exit knet_handle_free will take care to cleanup the socketpair only if they have been created by knet_handle_add_datafd. .PP It is possible to pass either sockets or normal fds. User provided datafd will be marked as non-blocking and close-on-exit. .PP *channel - This value has the same effect of VLAN tagging. A negative value will auto-allocate a channel. Setting a value between 0 and 31 will try to allocate that specific channel (unless already in use). .PP It is possible to add up to 32 datafds but be aware that each one of them must have a receiving end on the other host. .PP Example: hostA channel 0 will be delivered to datafd on hostB channel 0 hostA channel 1 to hostB channel 1. .PP Each channel must have a unique file descriptor. .PP If your application could have 2 channels on one host and one channel on another host, then you can use dst_host_filter to manipulate channel values on TX and RX. .SH RETURN VALUE .PP knet_handle_add_datafd returns .TP .B 0 on success, *datafd will be populated with a socket if the original value was 0 or if a specific fd was set, the value is untouched. *channel will be populated with a channel number if the original value was negative or the value is untouched if a specific channel was requested. .TP .B -1 on error and errno is set. *datafd and *channel are untouched or empty. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_clear_stats.3 b/libknet/man/knet_handle_clear_stats.3 index e851fc68..8fbdda59 100644 --- a/libknet/man/knet_handle_clear_stats.3 +++ b/libknet/man/knet_handle_clear_stats.3 @@ -1,33 +1,36 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_clear_stats 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_clear_stats 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_clear_stats \- Clear knet stats, link and/or handle. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_clear_stats\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBint \fP\fIclear_option\fP ); .fi .SH DESCRIPTION .PP knet_handle_clear_stats .PP knet_h - pointer to knet_handle_t .PP clear_option - Which stats to clear, must be one of .PP KNET_CLEARSTATS_HANDLE_ONLY or KNET_CLEARSTATS_HANDLE_AND_LINK .SH RETURN VALUE .PP 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_compress.3 b/libknet/man/knet_handle_compress.3 index 8985a1b5..f5d01dc5 100644 --- a/libknet/man/knet_handle_compress.3 +++ b/libknet/man/knet_handle_compress.3 @@ -1,55 +1,58 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_compress 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_compress 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_compress \- Set up packet compression. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_compress\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBstruct knet_handle_compress_cfg *\fP\fIknet_handle_compress_cfg\fP ); .fi .SH DESCRIPTION .PP knet_handle_compress .PP knet_h - pointer to knet_handle_t .PP knet_handle_compress_cfg - pointer to a knet_handle_compress_cfg structure .PP compress_model should contain the mode name. Currently only "zlib" and "lz4" are supported. Setting to "none" will disable compression. .PP compress_threshold tells the transmission thread to NOT compress any packets that are smaller than the value indicated. Default 100 bytes. Set to 0 to reset to the default. Set to 1 to compress everything. Max accepted value is KNET_MAX_PACKET_SIZE. .PP compress_level some compression libraries allow tuning of compression parameters. For example zlib value ranges from 0 to 9 where 0 is no compression and 9 is max compression. This value is passed pristine to the compression library. zlib: 0 (no compression), 1 (minimal) .. 9 (max compression). lz4: 1 (max compression)... 9 (fastest compression). lz4hc: 1 (min compression) ... LZ4HC_MAX_CLEVEL (16) or LZ4HC_CLEVEL_MAX (12) depends on the installed version of lz4hc. libknet can detects the max value and will print an appropriate warning. lzo2: accepts only some specific values depending on the requested algorithm: 1 : lzo1x_1_compress (default) 11 : lzo1x_1_11_compress 12 : lzo1x_1_12_compress 15 : lzo1x_1_15_compress 999: lzo1x_999_compress every other values will use default lzma: 0 (minimal) .. 9 (max compression) bzip2: 1 (minimal) .. 9 (max compression) Please refer to the library man pages on how to be set this value, as it is passed unmodified to the compression algorithm where supported. .PP knet does NOT implement the compression algorithm directly. it relies on external libraries for this functionality. Please read the libraries man pages to figure out which algorithm/compression level is best for the data you are planning to transmit. .SH STRUCTURES .SS "" .PP .sp .sp .RS .nf \fB struct knet_handle_compress_cfg { char \fIcompress_model\fP; uint32_t \fIcompress_threshold\fP; int \fIcompress_level\fP; }; \fP .fi .RE .SH RETURN VALUE .PP knet_handle_compress returns 0 on success -1 on error and errno is set. EINVAL means that either the model or the level are not supported. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_crypto.3 b/libknet/man/knet_handle_crypto.3 index 5391ea55..7479fdbc 100644 --- a/libknet/man/knet_handle_crypto.3 +++ b/libknet/man/knet_handle_crypto.3 @@ -1,73 +1,76 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_crypto 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_crypto 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_crypto \- set up packet cryptographic signing & encryption .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_crypto\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBstruct knet_handle_crypto_cfg *\fP\fIknet_handle_crypto_cfg\fP ); .fi .SH DESCRIPTION .PP knet_handle_crypto .PP knet_h - pointer to knet_handle_t .PP knet_handle_crypto_cfg - pointer to a knet_handle_crypto_cfg structure .PP crypto_model should contain the model name. Currently only "openssl" and "nss" are supported. Setting to "none" will disable crypto. .PP crypto_cipher_type should contain the cipher algo name. It can be set to "none" to disable encryption. Currently supported by "nss" model: "3des", "aes128", "aes192" and "aes256". "openssl" model supports more modes and it strictly depends on the openssl build. See: EVP_get_cipherbyname openssl API call for details. .PP crypto_hash_type should contain the hashing algo name. It can be set to "none" to disable hashing. Currently supported by "nss" model: "md5", "sha1", "sha256", "sha384" and "sha512". "openssl" model supports more modes and it strictly depends on the openssl build. See: EVP_get_digestbyname openssl API call for details. .PP private_key will contain the private shared key. It has to be at least KNET_MIN_KEY_LEN long. .PP private_key_len length of the provided private_key. .PP it is safe to call knet_handle_crypto multiple times at runtime. The last config will be used. IMPORTANT: a call to knet_handle_crypto can fail due to: 1) failure to obtain locking 2) errors to initializing the crypto level. This can happen even in subsequent calls to knet_handle_crypto. A failure in crypto init, might leave your traffic unencrypted! It's best to stop data forwarding (see knet_handle_setfwd(3)), change crypto config, start forward again. .SH STRUCTURES .SS "" .PP .sp .sp .RS .nf \fB struct knet_handle_crypto_cfg { char \fIcrypto_model\fP; char \fIcrypto_cipher_type\fP; char \fIcrypto_hash_type\fP; unsigned char \fIprivate_key\fP; unsigned int \fIprivate_key_len\fP; }; \fP .fi .RE .SH RETURN VALUE .PP knet_handle_crypto returns: .TP .B 0 on success .TP .B -1 on error and errno is set. .TP .B -2 on crypto subsystem initialization error. No errno is provided at the moment (yet). .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_enable_filter.3 b/libknet/man/knet_handle_enable_filter.3 index d8992455..c0f0426d 100644 --- a/libknet/man/knet_handle_enable_filter.3 +++ b/libknet/man/knet_handle_enable_filter.3 @@ -1,38 +1,41 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_enable_filter 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_enable_filter 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_enable_filter \- install a filter to route packets .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_enable_filter\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBvoid *\fP\fIdst_host_filter_fn_private_data\fP, \fBint(*)(void *private_data, const unsigned char *outdata, ssize_t outdata_len, uint8_t tx_rx, knet_node_id_t this_host_id, knet_node_id_t src_host_id, int8_t *channel, knet_node_id_t *dst_host_ids, size_t *dst_host_ids_entries) \fP\fIdst_host_filter_fn\fP ); .fi .SH DESCRIPTION .PP knet_handle_enable_filter .PP knet_h - pointer to knet_handle_t .PP dst_host_filter_fn_private_data void pointer to data that can be used to identify the callback. .PP dst_host_filter_fn - is a callback function that is invoked every time a packet hits datafd (see knet_handle_new(3)). the function allows users to tell libknet where the packet has to be delivered. .PP const unsigned char *outdata - is a pointer to the current packet ssize_t outdata_len - length of the above data uint8_t tx_rx - filter is called on tx or rx (KNET_NOTIFY_TX, KNET_NOTIFY_RX) knet_node_id_t this_host_id - host_id processing the packet knet_node_id_t src_host_id - host_id that generated the packet knet_node_id_t *dst_host_ids - array of KNET_MAX_HOST knet_node_id_t where to store the destinations size_t *dst_host_ids_entries - number of hosts to send the message .PP dst_host_filter_fn should return -1 on error, packet is discarded. 0 packet is unicast and should be sent to dst_host_ids and there are dst_host_ids_entries in the buffer. 1 packet is broadcast/multicast and is sent all hosts. contents of dst_host_ids and dst_host_ids_entries are ignored. (see also kronosnetd/etherfilter.* for an example that filters based on ether protocol) .SH RETURN VALUE .PP knet_handle_enable_filter returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_enable_pmtud_notify.3 b/libknet/man/knet_handle_enable_pmtud_notify.3 index 40929d7d..3c61c56b 100644 --- a/libknet/man/knet_handle_enable_pmtud_notify.3 +++ b/libknet/man/knet_handle_enable_pmtud_notify.3 @@ -1,34 +1,37 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_enable_pmtud_notify 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_enable_pmtud_notify 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_enable_pmtud_notify \- install a callback to receive PMTUd changes .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_enable_pmtud_notify\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBvoid *\fP\fIpmtud_notify_fn_private_data\fP, \fBvoid(*)(void *private_data, unsigned int data_mtu) \fP\fIpmtud_notify_fn\fP ); .fi .SH DESCRIPTION .PP knet_handle_enable_pmtud_notify .PP knet_h - pointer to knet_handle_t .PP pmtud_notify_fn_private_data void pointer to data that can be used to identify the callback. .PP pmtud_notify_fn is a callback function that is invoked every time a path MTU size change is detected. The function allows libknet to notify the user of data MTU, that's the max value that can be send onwire without fragmentation. The data MTU will always be lower than real link MTU because it accounts for protocol overhead, knet packet header and (if configured) crypto overhead, This function MUST NEVER block or add substantial delays. .SH RETURN VALUE .PP knet_handle_enable_pmtud_notify returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_enable_sock_notify.3 b/libknet/man/knet_handle_enable_sock_notify.3 index 4d0ab2ab..47797739 100644 --- a/libknet/man/knet_handle_enable_sock_notify.3 +++ b/libknet/man/knet_handle_enable_sock_notify.3 @@ -1,32 +1,35 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_enable_sock_notify 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_enable_sock_notify 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_enable_sock_notify \- Register a callback to receive socket events. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_enable_sock_notify\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBvoid *\fP\fIsock_notify_fn_private_data\fP, \fBvoid(*)(void *private_data, int datafd, int8_t channel, uint8_t tx_rx, int error, int errorno) \fP\fIsock_notify_fn\fP ); .fi .SH DESCRIPTION .PP knet_handle_enable_sock_notify knet_h - pointer to knet_handle_t .PP sock_notify_fn_private_data void pointer to data that can be used to identify the callback. .PP sock_notify_fn A callback function that is invoked every time a socket in the datafd pool will report an error (-1) or an end of read (0) (see socket.7). This function MUST NEVER block or add substantial delays. The callback is invoked in an internal unlocked area to allow calls to knet_handle_add_datafd/knet_handle_remove_datafd to swap/replace the bad fd. if both err and errno are 0, it means that the socket has received a 0 byte packet (EOF?). The callback function must either remove the fd from knet (by calling knet_handle_remove_fd()) or dup a new fd in its place. Failure to do this can cause problems. .SH RETURN VALUE .PP knet_handle_enable_sock_notify returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_free.3 b/libknet/man/knet_handle_free.3 index 6d09972e..48482ccc 100644 --- a/libknet/man/knet_handle_free.3 +++ b/libknet/man/knet_handle_free.3 @@ -1,26 +1,29 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_free 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_free 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_free \- Destroy a knet handle, free all resources. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_free\fP( \fBknet_handle_t \fP\fIknet_h\fP ); .fi .SH DESCRIPTION .PP knet_handle_free knet_h - pointer to knet_handle_t .SH RETURN VALUE .PP knet_handle_free returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_get_channel.3 b/libknet/man/knet_handle_get_channel.3 index f06322f0..a6143f48 100644 --- a/libknet/man/knet_handle_get_channel.3 +++ b/libknet/man/knet_handle_get_channel.3 @@ -1,40 +1,43 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_get_channel 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_get_channel 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_get_channel \- Get the channel associated with a file descriptor. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_get_channel\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBconst int \fP\fIdatafd\fP, \fBint8_t *\fP\fIchannel\fP ); .fi .SH DESCRIPTION .PP knet_handle_get_channel knet_h - pointer to knet_handle_t .PP datafd - get the channel associated to this datafd .PP *channel - will contain the result .SH RETURN VALUE .PP knet_handle_get_channel returns .TP .B 0 on success and *channel will contain the result .TP .B -1 on error and errno is set. and *channel content is meaningless .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_get_compress_list.3 b/libknet/man/knet_handle_get_compress_list.3 index 4741bf86..daaf0b32 100644 --- a/libknet/man/knet_handle_get_compress_list.3 +++ b/libknet/man/knet_handle_get_compress_list.3 @@ -1,34 +1,37 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_get_compress_list 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_get_compress_list 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_get_compress_list \- Get a list of support compression types. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_get_compress_list\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBconst char **\fP\fIcompress_names\fP, \fBsize_t *\fP\fInum_names\fP ); .fi .SH DESCRIPTION .PP knet_handle_get_compress_list .PP knet_h - pointer to knet_handle_t .PP compress_names - array of char * If NULL then only the number of names is returned in num_names to to allow the caller to allocate sufficient space. .PP num_names - returns the number of strings in compres_names .SH RETURN VALUE .PP knet_host_add returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_get_crypto_list.3 b/libknet/man/knet_handle_get_crypto_list.3 index 24f63afc..66644d3b 100644 --- a/libknet/man/knet_handle_get_crypto_list.3 +++ b/libknet/man/knet_handle_get_crypto_list.3 @@ -1,34 +1,37 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_get_crypto_list 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_get_crypto_list 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_get_crypto_list \- Get a list of supported crypto libraries. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_get_crypto_list\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBconst char **\fP\fIcrypto_names\fP, \fBsize_t *\fP\fInum_names\fP ); .fi .SH DESCRIPTION .PP knet_handle_get_crypto_list .PP knet_h - pointer to knet_handle_t .PP crypto_names - array of char * If NULL then only the number of names is returned in num_names to to allow the caller to allocate sufficient space. .PP num_names - returns the number of strings in crypto_names .SH RETURN VALUE .PP knet_host_add returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_get_datafd.3 b/libknet/man/knet_handle_get_datafd.3 index 11b063b4..3e94f313 100644 --- a/libknet/man/knet_handle_get_datafd.3 +++ b/libknet/man/knet_handle_get_datafd.3 @@ -1,40 +1,43 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_get_datafd 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_get_datafd 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_get_datafd \- Get the file descriptor associated with a channel. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_get_datafd\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBconst int8_t \fP\fIchannel\fP, \fBint *\fP\fIdatafd\fP ); .fi .SH DESCRIPTION .PP knet_handle_get_datafd knet_h - pointer to knet_handle_t .PP channel - get the datafd associated to this channel .PP *datafd - will contain the result .SH RETURN VALUE .PP knet_handle_get_datafd returns .TP .B 0 on success and *datafd will contain the results .TP .B -1 on error and errno is set. and *datafd content is meaningless .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_get_stats.3 b/libknet/man/knet_handle_get_stats.3 index 2674641c..cb3fa879 100644 --- a/libknet/man/knet_handle_get_stats.3 +++ b/libknet/man/knet_handle_get_stats.3 @@ -1,70 +1,73 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_get_stats 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_get_stats 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_get_stats \- Get statistics for compression & crypto. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_get_stats\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBstruct knet_handle_stats *\fP\fIstats\fP, \fBsize_t \fP\fIstruct_size\fP ); .fi .SH DESCRIPTION .PP knet_handle_get_stats .PP knet_h - pointer to knet_handle_t .PP knet_handle_stats pointer to a knet_handle_stats structure .PP struct_size size of knet_handle_stats structure to allow for backwards compatibility. libknet will only copy this much data into the stats structure so that older callers will not get overflowed if new fields are added. .SH STRUCTURES .SS "" .PP .sp .sp .RS .nf \fB struct knet_handle_stats { size_t \fIsize\fP; uint64_t \fItx_uncompressed_packets\fP; uint64_t \fItx_compressed_packets\fP; uint64_t \fItx_compressed_original_bytes\fP; uint64_t \fItx_compressed_size_bytes\fP; uint64_t \fItx_compress_time_ave\fP; uint64_t \fItx_compress_time_min\fP; uint64_t \fItx_compress_time_max\fP; uint64_t \fIrx_compressed_packets\fP; uint64_t \fIrx_compressed_original_bytes\fP; uint64_t \fIrx_compressed_size_bytes\fP; uint64_t \fIrx_compress_time_ave\fP; uint64_t \fIrx_compress_time_min\fP; uint64_t \fIrx_compress_time_max\fP; uint64_t \fItx_crypt_packets\fP; uint64_t \fItx_crypt_byte_overhead\fP; uint64_t \fItx_crypt_time_ave\fP; uint64_t \fItx_crypt_time_min\fP; uint64_t \fItx_crypt_time_max\fP; uint64_t \fIrx_crypt_packets\fP; uint64_t \fIrx_crypt_time_ave\fP; uint64_t \fIrx_crypt_time_min\fP; uint64_t \fIrx_crypt_time_max\fP; }; \fP .fi .RE .SH RETURN VALUE .PP 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_get_transport_id_by_name.3 b/libknet/man/knet_handle_get_transport_id_by_name.3 index 4cbbe7f7..01063e32 100644 --- a/libknet/man/knet_handle_get_transport_id_by_name.3 +++ b/libknet/man/knet_handle_get_transport_id_by_name.3 @@ -1,39 +1,42 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_get_transport_id_by_name 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_get_transport_id_by_name 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_get_transport_id_by_name \- Get a transport ID from its name. .SH SYNOPSIS .nf .B #include .sp \fBuint8_t knet_handle_get_transport_id_by_name\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBconst char *\fP\fIname\fP ); .fi .SH DESCRIPTION .PP knet_handle_get_transport_id_by_name .PP knet_h - pointer to knet_handle_t .PP name - transport name (UDP/SCTP/etc) .SH RETURN VALUE .PP knet_handle_get_transport_name_by_id returns: .TP .B KNET_MAX_TRANSPORTS on error and errno is set accordingly .TP .B KNET_TRANSPORT_xxx on success. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_get_transport_list.3 b/libknet/man/knet_handle_get_transport_list.3 index e81d7caf..d1d8b832 100644 --- a/libknet/man/knet_handle_get_transport_list.3 +++ b/libknet/man/knet_handle_get_transport_list.3 @@ -1,50 +1,53 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_get_transport_list 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_get_transport_list 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_get_transport_list \- Get a list of the transports support by this build of knet. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_get_transport_list\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBstruct knet_transport_info *\fP\fItransport_list\fP, \fBsize_t *\fP\fItransport_list_entries\fP ); .fi .SH DESCRIPTION .PP knet_handle_get_transport_list .PP knet_h - pointer to knet_handle_t .PP transport_list - an array of struct transport_info that must be at least of size struct transport_info * KNET_MAX_TRANSPORTS .PP transport_list_entries - pointer to a size_t where to store how many transports are available in this build of libknet. .SH STRUCTURES .SS "" .PP .sp .sp .RS .nf \fB struct knet_transport_info { const char *\fIname\fP; uint8_t \fIid\fP; uint8_t \fIproperties\fP; }; \fP .fi .RE .SH RETURN VALUE .PP knet_handle_get_transport_list returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_get_transport_name_by_id.3 b/libknet/man/knet_handle_get_transport_name_by_id.3 index bec3a5c1..f825c61b 100644 --- a/libknet/man/knet_handle_get_transport_name_by_id.3 +++ b/libknet/man/knet_handle_get_transport_name_by_id.3 @@ -1,39 +1,42 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_get_transport_name_by_id 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_get_transport_name_by_id 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_get_transport_name_by_id \- Get a transport name from its ID number. .SH SYNOPSIS .nf .B #include .sp \fBconst char * knet_handle_get_transport_name_by_id\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBuint8_t \fP\fItransport\fP ); .fi .SH DESCRIPTION .PP knet_handle_get_transport_name_by_id .PP knet_h - pointer to knet_handle_t .PP transport - one of the KNET_TRANSPORT_xxx constants .SH RETURN VALUE .PP knet_handle_get_transport_name_by_id returns: .TP .B pointer to the name on success or .TP .B NULL on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_get_transport_reconnect_interval.3 b/libknet/man/knet_handle_get_transport_reconnect_interval.3 index d3201584..73bdd060 100644 --- a/libknet/man/knet_handle_get_transport_reconnect_interval.3 +++ b/libknet/man/knet_handle_get_transport_reconnect_interval.3 @@ -1,31 +1,34 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_get_transport_reconnect_interval 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_get_transport_reconnect_interval 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_get_transport_reconnect_interval \- Get the interval between transport attempts to reconnect a failed link. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_get_transport_reconnect_interval\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBuint32_t *\fP\fImsecs\fP ); .fi .SH DESCRIPTION .PP knet_handle_get_transport_reconnect_interval .PP knet_h - pointer to knet_handle_t .PP msecs - milliseconds .SH RETURN VALUE .PP knet_handle_get_transport_reconnect_interval returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_new.3 b/libknet/man/knet_handle_new.3 index 72028864..485611d7 100644 --- a/libknet/man/knet_handle_new.3 +++ b/libknet/man/knet_handle_new.3 @@ -1,34 +1,37 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_new 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_new 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_new \- create a new instance of a knet handle .SH SYNOPSIS .nf .B #include .sp \fBknet_handle_t knet_handle_new\fP( \fBknet_node_id_t \fP\fIhost_id\fP, \fBint \fP\fIlog_fd\fP, \fBuint8_t \fP\fIdefault_log_level\fP ); .fi .SH DESCRIPTION .PP knet_handle_new .PP host_id - Each host in a knet is identified with a unique ID. when creating a new handle local host_id must be specified (0 to UINT16T_MAX are all valid). It is the user's responsibility to check that the value is unique, or bad things might happen. .PP log_fd - Write file descriptor. If set to a value > 0, it will be used to write log packets from libknet to the application. Setting to 0 will disable logging from libknet. It is possible to enable logging at any given time (see logging API). Make sure to either read from this filedescriptor properly and/or mark it O_NONBLOCK, otherwise if the fd becomes full, libknet could block. .PP default_log_level - If logfd is specified, it will initialize all subsystems to log at default_log_level value. (see logging API) .SH RETURN VALUE .PP on success, a new knet_handle_t is returned. on failure, NULL is returned and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_pmtud_get.3 b/libknet/man/knet_handle_pmtud_get.3 index 22167faa..49a200c6 100644 --- a/libknet/man/knet_handle_pmtud_get.3 +++ b/libknet/man/knet_handle_pmtud_get.3 @@ -1,31 +1,34 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_pmtud_get 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_pmtud_get 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_pmtud_get \- Get the current data MTU. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_pmtud_get\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBunsigned int *\fP\fIdata_mtu\fP ); .fi .SH DESCRIPTION .PP knet_handle_pmtud_get .PP knet_h - pointer to knet_handle_t .PP data_mtu - pointer where to store data_mtu .SH RETURN VALUE .PP knet_handle_pmtud_get returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_pmtud_getfreq.3 b/libknet/man/knet_handle_pmtud_getfreq.3 index ff4a6c6c..cd9ef62f 100644 --- a/libknet/man/knet_handle_pmtud_getfreq.3 +++ b/libknet/man/knet_handle_pmtud_getfreq.3 @@ -1,31 +1,34 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_pmtud_getfreq 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_pmtud_getfreq 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_pmtud_getfreq \- Get the interval between PMTUd scans. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_pmtud_getfreq\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBunsigned int *\fP\fIinterval\fP ); .fi .SH DESCRIPTION .PP knet_handle_pmtud_getfreq .PP knet_h - pointer to knet_handle_t .PP interval - pointer where to store the current interval value .SH RETURN VALUE .PP knet_handle_pmtud_setfreq returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_pmtud_setfreq.3 b/libknet/man/knet_handle_pmtud_setfreq.3 index 8bcc158f..3c99af5a 100644 --- a/libknet/man/knet_handle_pmtud_setfreq.3 +++ b/libknet/man/knet_handle_pmtud_setfreq.3 @@ -1,33 +1,36 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_pmtud_setfreq 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_pmtud_setfreq 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_pmtud_setfreq \- Set the interval between PMTUd scans. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_pmtud_setfreq\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBunsigned int \fP\fIinterval\fP ); .fi .SH DESCRIPTION .PP knet_handle_pmtud_setfreq .PP knet_h - pointer to knet_handle_t .PP interval - define the interval in seconds between PMTUd scans range from 1 to 86400 (24h) .PP default interval is 60. .SH RETURN VALUE .PP knet_handle_pmtud_setfreq returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_remove_datafd.3 b/libknet/man/knet_handle_remove_datafd.3 index f616733b..6add15b2 100644 --- a/libknet/man/knet_handle_remove_datafd.3 +++ b/libknet/man/knet_handle_remove_datafd.3 @@ -1,29 +1,32 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_remove_datafd 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_remove_datafd 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_remove_datafd \- Remove a file descriptor from knet. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_remove_datafd\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBint \fP\fIdatafd\fP ); .fi .SH DESCRIPTION .PP knet_handle_remove_datafd knet_h - pointer to knet_handle_t .PP datafd - file descriptor to remove. NOTE that if the socket/fd was created by knet_handle_add_datafd, the socket will be closed by libknet. .SH RETURN VALUE .PP knet_handle_remove_datafd returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_set_transport_reconnect_interval.3 b/libknet/man/knet_handle_set_transport_reconnect_interval.3 index f27ed340..2297280a 100644 --- a/libknet/man/knet_handle_set_transport_reconnect_interval.3 +++ b/libknet/man/knet_handle_set_transport_reconnect_interval.3 @@ -1,31 +1,34 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_set_transport_reconnect_interval 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_set_transport_reconnect_interval 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_set_transport_reconnect_interval \- Set the interval between transport attempts to reconnect a failed link. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_set_transport_reconnect_interval\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBuint32_t \fP\fImsecs\fP ); .fi .SH DESCRIPTION .PP knet_handle_set_transport_reconnect_interval .PP knet_h - pointer to knet_handle_t .PP msecs - milliseconds .SH RETURN VALUE .PP knet_handle_set_transport_reconnect_interval returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_handle_setfwd.3 b/libknet/man/knet_handle_setfwd.3 index a09f7fe6..8aa90966 100644 --- a/libknet/man/knet_handle_setfwd.3 +++ b/libknet/man/knet_handle_setfwd.3 @@ -1,33 +1,36 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_handle_setfwd 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_handle_setfwd 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_handle_setfwd \- Start packet forwarding. .SH SYNOPSIS .nf .B #include .sp \fBint knet_handle_setfwd\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBunsigned int \fP\fIenabled\fP ); .fi .SH DESCRIPTION .PP knet_handle_setfwd .PP knet_h - pointer to knet_handle_t .PP enable - set to 1 to allow data forwarding, 0 to disable data forwarding. .PP By default data forwarding is off and no traffic will pass through knet until it is set on. .SH RETURN VALUE .PP knet_handle_setfwd returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_host_add.3 b/libknet/man/knet_host_add.3 index 7133f6e2..c6b1f0a1 100644 --- a/libknet/man/knet_host_add.3 +++ b/libknet/man/knet_host_add.3 @@ -1,31 +1,34 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_host_add 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_host_add 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_host_add \- Add a new host ID to knet. .SH SYNOPSIS .nf .B #include .sp \fBint knet_host_add\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP ); .fi .SH DESCRIPTION .PP knet_host_add .PP knet_h - pointer to knet_handle_t .PP host_id - each host in a knet is identified with a unique ID (see also knet_handle_new(3)) .SH RETURN VALUE .PP knet_host_add returns: 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_host_enable_status_change_notify.3 b/libknet/man/knet_host_enable_status_change_notify.3 index 38973bde..032ee788 100644 --- a/libknet/man/knet_host_enable_status_change_notify.3 +++ b/libknet/man/knet_host_enable_status_change_notify.3 @@ -1,34 +1,37 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_host_enable_status_change_notify 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_host_enable_status_change_notify 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_host_enable_status_change_notify \- Install a callback to get host status change events. .SH SYNOPSIS .nf .B #include .sp \fBint knet_host_enable_status_change_notify\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBvoid *\fP\fIhost_status_change_notify_fn_private_data\fP, \fBvoid(*)(void *private_data, knet_node_id_t host_id, uint8_t reachable, uint8_t remote, uint8_t external) \fP\fIhost_status_change_notify_fn\fP ); .fi .SH DESCRIPTION .PP knet_host_enable_status_change_notify .PP knet_h - pointer to knet_handle_t .PP host_status_change_notify_fn_private_data - void pointer to data that can be used to identify the callback .PP external, 0 if the host_id is configured locally or 1 if it has been added from remote nodes config. NOTE: dynamic topology is NOT currently implemented, but this is ready for future and can avoid an API/ABI breakage later on. This function MUST NEVER block or add substantial delays. .SH RETURN VALUE .PP knet_host_status_change_notify returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_host_get_host_list.3 b/libknet/man/knet_host_get_host_list.3 index 299a0d12..fc618795 100644 --- a/libknet/man/knet_host_get_host_list.3 +++ b/libknet/man/knet_host_get_host_list.3 @@ -1,34 +1,37 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_host_get_host_list 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_host_get_host_list 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_host_get_host_list \- Get a list of hosts known to knet. .SH SYNOPSIS .nf .B #include .sp \fBint knet_host_get_host_list\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t *\fP\fIhost_ids\fP, \fBsize_t *\fP\fIhost_ids_entries\fP ); .fi .SH DESCRIPTION .PP knet_host_get_host_list .PP knet_h - pointer to knet_handle_t .PP host_ids - array of at lest KNET_MAX_HOST size .PP host_ids_entries - number of entries writted in host_ids .SH RETURN VALUE .PP knet_host_get_host_list returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_host_get_id_by_host_name.3 b/libknet/man/knet_host_get_id_by_host_name.3 index bfa706c1..bdd7260b 100644 --- a/libknet/man/knet_host_get_id_by_host_name.3 +++ b/libknet/man/knet_host_get_id_by_host_name.3 @@ -1,34 +1,37 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_host_get_id_by_host_name 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_host_get_id_by_host_name 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_host_get_id_by_host_name \- Get the ID of a host given its name. .SH SYNOPSIS .nf .B #include .sp \fBint knet_host_get_id_by_host_name\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBconst char *\fP\fIname\fP, \fBknet_node_id_t *\fP\fIhost_id\fP ); .fi .SH DESCRIPTION .PP knet_host_get_id_by_host_name .PP knet_h - pointer to knet_handle_t .PP name - name to lookup, max len KNET_MAX_HOST_LEN .PP host_id - where to store the result .SH RETURN VALUE .PP knet_host_get_id_by_host_name returns: 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_host_get_name_by_host_id.3 b/libknet/man/knet_host_get_name_by_host_id.3 index 85998fb5..3868b198 100644 --- a/libknet/man/knet_host_get_name_by_host_id.3 +++ b/libknet/man/knet_host_get_name_by_host_id.3 @@ -1,34 +1,37 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_host_get_name_by_host_id 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_host_get_name_by_host_id 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_host_get_name_by_host_id \- Get the name of a host given its ID. .SH SYNOPSIS .nf .B #include .sp \fBint knet_host_get_name_by_host_id\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBchar *\fP\fIname\fP ); .fi .SH DESCRIPTION .PP knet_host_get_name_by_host_id .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP name - pointer to a preallocated buffer of at least size KNET_MAX_HOST_LEN where the current host name will be stored (as set by knet_host_set_name or default by knet_host_add) .SH RETURN VALUE .PP knet_host_get_name_by_host_id returns: 0 on success -1 on error and errno is set (name is left untouched) .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_host_get_policy.3 b/libknet/man/knet_host_get_policy.3 index bc16cb8c..71483e7e 100644 --- a/libknet/man/knet_host_get_policy.3 +++ b/libknet/man/knet_host_get_policy.3 @@ -1,34 +1,37 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_host_get_policy 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_host_get_policy 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_host_get_policy \- Get the switching policy for a host's links. .SH SYNOPSIS .nf .B #include .sp \fBint knet_host_get_policy\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t *\fP\fIpolicy\fP ); .fi .SH DESCRIPTION .PP knet_host_get_policy .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP policy - will contain the current configured switching policy. Default is passive when creating a new host. .SH RETURN VALUE .PP knet_host_get_policy returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_host_get_status.3 b/libknet/man/knet_host_get_status.3 index 74a93ee9..fe5a1d98 100644 --- a/libknet/man/knet_host_get_status.3 +++ b/libknet/man/knet_host_get_status.3 @@ -1,50 +1,53 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_host_get_status 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_host_get_status 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_host_get_status \- Get the status of a host. .SH SYNOPSIS .nf .B #include .sp \fBint knet_host_get_status\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBstruct knet_host_status *\fP\fIstatus\fP ); .fi .SH DESCRIPTION .PP knet_host_status_get .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP status - pointer to knet_host_status struct .SH STRUCTURES .SS "" .PP .sp .sp .RS .nf \fB struct knet_host_status { uint8_t \fIreachable\fP; uint8_t \fIremote\fP; uint8_t \fIexternal\fP; }; \fP .fi .RE .SH RETURN VALUE .PP knet_handle_pmtud_get returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_host_remove.3 b/libknet/man/knet_host_remove.3 index 44a61eb6..7827eb76 100644 --- a/libknet/man/knet_host_remove.3 +++ b/libknet/man/knet_host_remove.3 @@ -1,31 +1,34 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_host_remove 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_host_remove 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_host_remove \- Remove a host ID from knet. .SH SYNOPSIS .nf .B #include .sp \fBint knet_host_remove\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP ); .fi .SH DESCRIPTION .PP knet_host_remove .PP knet_h - pointer to knet_handle_t .PP host_id - each host in a knet is identified with a unique ID (see also knet_handle_new(3)) .SH RETURN VALUE .PP knet_host_remove returns: 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_host_set_name.3 b/libknet/man/knet_host_set_name.3 index 181c9269..c435161f 100644 --- a/libknet/man/knet_host_set_name.3 +++ b/libknet/man/knet_host_set_name.3 @@ -1,34 +1,37 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_host_set_name 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_host_set_name 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_host_set_name \- Set the name of a knet host. .SH SYNOPSIS .nf .B #include .sp \fBint knet_host_set_name\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBconst char *\fP\fIname\fP ); .fi .SH DESCRIPTION .PP knet_host_set_name .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP name - this name will be used for pretty logging and eventually search for hosts (see also knet_handle_host_get_name(2) and knet_handle_host_get_id(3)). Only up to KNET_MAX_HOST_LEN - 1 bytes will be accepted and name has to be unique for each host. .SH RETURN VALUE .PP knet_host_set_name returns: 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_host_set_policy.3 b/libknet/man/knet_host_set_policy.3 index e35b3412..9f0945dc 100644 --- a/libknet/man/knet_host_set_policy.3 +++ b/libknet/man/knet_host_set_policy.3 @@ -1,38 +1,41 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_host_set_policy 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_host_set_policy 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_host_set_policy \- Set the switching policy for a host's links. .SH SYNOPSIS .nf .B #include .sp \fBint knet_host_set_policy\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t \fP\fIpolicy\fP ); .fi .SH DESCRIPTION .PP knet_host_set_policy .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP policy - there are currently 3 kind of simple switching policies based on link configuration. KNET_LINK_POLICY_PASSIVE - the active link with the lowest priority will be used. if one or more active links share the same priority, the one with lowest link_id will be used. .PP KNET_LINK_POLICY_ACTIVE - all active links will be used simultaneously to send traffic. link priority is ignored. .PP KNET_LINK_POLICY_RR - round-robin policy, every packet will be send on a different active link. .SH RETURN VALUE .PP knet_host_set_policy returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_link_clear_config.3 b/libknet/man/knet_link_clear_config.3 index fd87ef33..ca319da3 100644 --- a/libknet/man/knet_link_clear_config.3 +++ b/libknet/man/knet_link_clear_config.3 @@ -1,34 +1,37 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_link_clear_config 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_link_clear_config 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_link_clear_config \- Clear link information and disconnect the link. .SH SYNOPSIS .nf .B #include .sp \fBint knet_link_clear_config\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t \fP\fIlink_id\fP ); .fi .SH DESCRIPTION .PP knet_link_clear_config .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP link_id - see knet_link_set_config(3) .SH RETURN VALUE .PP knet_link_clear_config returns 0 on success. -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_link_get_config.3 b/libknet/man/knet_link_get_config.3 index ed2c33d5..af3d62e5 100644 --- a/libknet/man/knet_link_get_config.3 +++ b/libknet/man/knet_link_get_config.3 @@ -1,49 +1,52 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_link_get_config 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_link_get_config 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_link_get_config \- Get the link configutation information. .SH SYNOPSIS .nf .B #include .sp \fBint knet_link_get_config\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t \fP\fIlink_id\fP, \fBuint8_t *\fP\fItransport\fP, \fBstruct sockaddr_storage *\fP\fIsrc_addr\fP, \fBstruct sockaddr_storage *\fP\fIdst_addr\fP, \fBuint8_t *\fP\fIdynamic\fP, \fBuint64_t *\fP\fIflags\fP ); .fi .SH DESCRIPTION .PP knet_link_get_config .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP link_id - see knet_link_set_config(3) .PP transport - see knet_link_set_config(3) .PP src_addr - sockaddr_storage that can be either IPv4 or IPv6 .PP dst_addr - sockaddr_storage that can be either IPv4 or IPv6 .PP dynamic - 0 if dst_addr is static or 1 if dst_addr is dynamic. In case of 1, dst_addr can be NULL and it will be left untouched. .PP flags - KNET_LINK_FLAG_* .SH RETURN VALUE .PP knet_link_get_config returns 0 on success. -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_link_get_enable.3 b/libknet/man/knet_link_get_enable.3 index f74c9a42..7ca14d52 100644 --- a/libknet/man/knet_link_get_enable.3 +++ b/libknet/man/knet_link_get_enable.3 @@ -1,37 +1,40 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_link_get_enable 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_link_get_enable 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_link_get_enable \- Find out whether a link is enabled or not. .SH SYNOPSIS .nf .B #include .sp \fBint knet_link_get_enable\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t \fP\fIlink_id\fP, \fBunsigned int *\fP\fIenabled\fP ); .fi .SH DESCRIPTION .PP knet_link_get_enable .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP link_id - see knet_link_set_config(3) .PP enabled - 0 disable the link, 1 enable the link .SH RETURN VALUE .PP knet_link_get_enable returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_link_get_link_list.3 b/libknet/man/knet_link_get_link_list.3 index bac91dd0..207a4988 100644 --- a/libknet/man/knet_link_get_link_list.3 +++ b/libknet/man/knet_link_get_link_list.3 @@ -1,35 +1,38 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_link_get_link_list 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_link_get_link_list 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_link_get_link_list \- Get a list of links connecting a host. .SH SYNOPSIS .nf .B #include .sp \fBint knet_link_get_link_list\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t *\fP\fIlink_ids\fP, \fBsize_t *\fP\fIlink_ids_entries\fP ); .fi .SH DESCRIPTION .PP knet_link_get_link_list .PP knet_h - pointer to knet_handle_t .PP link_ids - array of at lest KNET_MAX_LINK size with the list of configured links for a certain host. .PP link_ids_entries - number of entries contained in link_ids .SH RETURN VALUE .PP knet_link_get_link_list returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_link_get_ping_timers.3 b/libknet/man/knet_link_get_ping_timers.3 index be1e13d8..658499d9 100644 --- a/libknet/man/knet_link_get_ping_timers.3 +++ b/libknet/man/knet_link_get_ping_timers.3 @@ -1,43 +1,46 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_link_get_ping_timers 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_link_get_ping_timers 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_link_get_ping_timers \- Get the ping timers for a link. .SH SYNOPSIS .nf .B #include .sp \fBint knet_link_get_ping_timers\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t \fP\fIlink_id\fP, \fBtime_t *\fP\fIinterval\fP, \fBtime_t *\fP\fItimeout\fP, \fBunsigned int *\fP\fIprecision\fP ); .fi .SH DESCRIPTION .PP knet_link_get_ping_timers .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP link_id - see knet_link_set_config(3) .PP interval - ping interval .PP timeout - if no pong is received within this time, the link is declared dead .PP precision - how many values of latency are used to calculate the average link latency (see also knet_link_get_status(3)) .SH RETURN VALUE .PP knet_link_get_ping_timers returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_link_get_pong_count.3 b/libknet/man/knet_link_get_pong_count.3 index c00f21e4..0d0995c2 100644 --- a/libknet/man/knet_link_get_pong_count.3 +++ b/libknet/man/knet_link_get_pong_count.3 @@ -1,37 +1,40 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_link_get_pong_count 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_link_get_pong_count 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_link_get_pong_count \- Get the pong count for a link. .SH SYNOPSIS .nf .B #include .sp \fBint knet_link_get_pong_count\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t \fP\fIlink_id\fP, \fBuint8_t *\fP\fIpong_count\fP ); .fi .SH DESCRIPTION .PP knet_link_get_pong_count .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP link_id - see knet_link_set_config(3) .PP pong_count - how many valid ping/pongs before a link is marked UP. default: 5, value should be > 0 .SH RETURN VALUE .PP knet_link_get_pong_count returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_link_get_priority.3 b/libknet/man/knet_link_get_priority.3 index a813a09b..eee0348d 100644 --- a/libknet/man/knet_link_get_priority.3 +++ b/libknet/man/knet_link_get_priority.3 @@ -1,37 +1,40 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_link_get_priority 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_link_get_priority 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_link_get_priority \- Get the priority for a link. .SH SYNOPSIS .nf .B #include .sp \fBint knet_link_get_priority\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t \fP\fIlink_id\fP, \fBuint8_t *\fP\fIpriority\fP ); .fi .SH DESCRIPTION .PP knet_link_get_priority .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP link_id - see knet_link_set_config(3) .PP priority - gather the switching priority for this link see also knet_host_set_policy .SH RETURN VALUE .PP knet_link_get_priority returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_link_get_status.3 b/libknet/man/knet_link_get_status.3 index 5d36f1ca..7dc20c7c 100644 --- a/libknet/man/knet_link_get_status.3 +++ b/libknet/man/knet_link_get_status.3 @@ -1,66 +1,69 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_link_get_status 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_link_get_status 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_link_get_status \- Get the status (and statistics) for a link. .SH SYNOPSIS .nf .B #include .sp \fBint knet_link_get_status\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t \fP\fIlink_id\fP, \fBstruct knet_link_status *\fP\fIstatus\fP, \fBsize_t \fP\fIstruct_size\fP ); .fi .SH DESCRIPTION .PP knet_link_get_status .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP link_id - see knet_link_set_config(3) .PP status - pointer to knet_link_status struct .PP struct_size - max size of knet_link_status - allows library to add fields without ABI change. Returned structure will be truncated to this length and .size member indicates the full size. .SH STRUCTURES .SS "" .PP .sp .sp .RS .nf \fB struct knet_link_status { size_t \fIsize\fP; char \fIsrc_ipaddr\fP; char \fIsrc_port\fP; char \fIdst_ipaddr\fP; char \fIdst_port\fP; uint8_t \fIenabled\fP; uint8_t \fIconnected\fP; uint8_t \fIdynconnected\fP; unsigned long long \fIlatency\fP; struct timespec \fIpong_last\fP; unsigned int \fImtu\fP; unsigned int \fIproto_overhead\fP; struct knet_link_stats \fIstats\fP; }; \fP .fi .RE .SH RETURN VALUE .PP knet_link_get_status returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_link_set_config.3 b/libknet/man/knet_link_set_config.3 index 2d17830f..43bf24b6 100644 --- a/libknet/man/knet_link_set_config.3 +++ b/libknet/man/knet_link_set_config.3 @@ -1,46 +1,49 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_link_set_config 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_link_set_config 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_link_set_config \- Configure the link to a host. .SH SYNOPSIS .nf .B #include .sp \fBint knet_link_set_config\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t \fP\fIlink_id\fP, \fBuint8_t \fP\fItransport\fP, \fBstruct sockaddr_storage *\fP\fIsrc_addr\fP, \fBstruct sockaddr_storage *\fP\fIdst_addr\fP, \fBuint64_t \fP\fIflags\fP ); .fi .SH DESCRIPTION .PP knet_link_set_config .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP link_id - see knet_link_set_config(3) .PP transport - one of the KNET_TRANSPORT_xxx constants .PP src_addr - sockaddr_storage that can be either IPv4 or IPv6 .PP dst_addr - sockaddr_storage that can be either IPv4 or IPv6 this can be null if we don't know the incoming IP address/port and the link will remain quiet till the node on the other end will initiate a connection .PP flags - KNET_LINK_FLAG_* .SH RETURN VALUE .PP knet_link_set_config returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_link_set_enable.3 b/libknet/man/knet_link_set_enable.3 index 68e0e1b0..46854552 100644 --- a/libknet/man/knet_link_set_enable.3 +++ b/libknet/man/knet_link_set_enable.3 @@ -1,37 +1,40 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_link_set_enable 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_link_set_enable 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_link_set_enable \- Enable traffic on a link. .SH SYNOPSIS .nf .B #include .sp \fBint knet_link_set_enable\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t \fP\fIlink_id\fP, \fBunsigned int \fP\fIenabled\fP ); .fi .SH DESCRIPTION .PP knet_link_set_enable .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP link_id - see knet_link_set_config(3) .PP enabled - 0 disable the link, 1 enable the link .SH RETURN VALUE .PP knet_link_set_enable returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_link_set_ping_timers.3 b/libknet/man/knet_link_set_ping_timers.3 index 370e31d6..7a333ae9 100644 --- a/libknet/man/knet_link_set_ping_timers.3 +++ b/libknet/man/knet_link_set_ping_timers.3 @@ -1,43 +1,46 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_link_set_ping_timers 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_link_set_ping_timers 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_link_set_ping_timers \- Set the ping timers for a link. .SH SYNOPSIS .nf .B #include .sp \fBint knet_link_set_ping_timers\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t \fP\fIlink_id\fP, \fBtime_t \fP\fIinterval\fP, \fBtime_t \fP\fItimeout\fP, \fBunsigned int \fP\fIprecision\fP ); .fi .SH DESCRIPTION .PP knet_link_set_ping_timers .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP link_id - see knet_link_set_config(3) .PP interval - specify the ping interval .PP timeout - if no pong is received within this time, the link is declared dead .PP precision - how many values of latency are used to calculate the average link latency (see also knet_link_get_status(3)) .SH RETURN VALUE .PP knet_link_set_ping_timers returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_link_set_pong_count.3 b/libknet/man/knet_link_set_pong_count.3 index 23cee849..063a4eab 100644 --- a/libknet/man/knet_link_set_pong_count.3 +++ b/libknet/man/knet_link_set_pong_count.3 @@ -1,37 +1,40 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_link_set_pong_count 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_link_set_pong_count 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_link_set_pong_count \- Set the pong count for a link. .SH SYNOPSIS .nf .B #include .sp \fBint knet_link_set_pong_count\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t \fP\fIlink_id\fP, \fBuint8_t \fP\fIpong_count\fP ); .fi .SH DESCRIPTION .PP knet_link_set_pong_count .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP link_id - see knet_link_set_config(3) .PP pong_count - how many valid ping/pongs before a link is marked UP. default: 5, value should be > 0 .SH RETURN VALUE .PP knet_link_set_pong_count returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_link_set_priority.3 b/libknet/man/knet_link_set_priority.3 index e887e712..52aa5b82 100644 --- a/libknet/man/knet_link_set_priority.3 +++ b/libknet/man/knet_link_set_priority.3 @@ -1,37 +1,40 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_link_set_priority 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_link_set_priority 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_link_set_priority \- Set the priority for a link. .SH SYNOPSIS .nf .B #include .sp \fBint knet_link_set_priority\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBknet_node_id_t \fP\fIhost_id\fP, \fBuint8_t \fP\fIlink_id\fP, \fBuint8_t \fP\fIpriority\fP ); .fi .SH DESCRIPTION .PP knet_link_set_priority .PP knet_h - pointer to knet_handle_t .PP host_id - see knet_host_add(3) .PP link_id - see knet_link_set_config(3) .PP priority - specify the switching priority for this link see also knet_host_set_policy .SH RETURN VALUE .PP knet_link_set_priority returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_log_get_loglevel.3 b/libknet/man/knet_log_get_loglevel.3 index 74f1d703..508ba09e 100644 --- a/libknet/man/knet_log_get_loglevel.3 +++ b/libknet/man/knet_log_get_loglevel.3 @@ -1,34 +1,37 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_log_get_loglevel 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_log_get_loglevel 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_log_get_loglevel \- Get the logging level for a subsystem. .SH SYNOPSIS .nf .B #include .sp \fBint knet_log_get_loglevel\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBuint8_t \fP\fIsubsystem\fP, \fBuint8_t *\fP\fIlevel\fP ); .fi .SH DESCRIPTION .PP knet_log_get_log_level .PP knet_h - same as above .PP subsystem - same as above .PP level - same as above .SH RETURN VALUE .PP knet_log_get_loglevel returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_log_get_loglevel_id.3 b/libknet/man/knet_log_get_loglevel_id.3 index 7bc54825..d7b8d9e9 100644 --- a/libknet/man/knet_log_get_loglevel_id.3 +++ b/libknet/man/knet_log_get_loglevel_id.3 @@ -1,26 +1,29 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_log_get_loglevel_id 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_log_get_loglevel_id 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_log_get_loglevel_id \- Get a logging level ID from its name. .SH SYNOPSIS .nf .B #include .sp \fBuint8_t knet_log_get_loglevel_id\fP( \fBconst char *\fP\fIname\fP ); .fi .SH DESCRIPTION .PP knet_log_get_loglevel_id .SH RETURN VALUE .PP returns internal log level ID or KNET_LOG_ERR for invalid names .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_log_get_loglevel_name.3 b/libknet/man/knet_log_get_loglevel_name.3 index 3ae9dfa9..eacc537f 100644 --- a/libknet/man/knet_log_get_loglevel_name.3 +++ b/libknet/man/knet_log_get_loglevel_name.3 @@ -1,26 +1,29 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_log_get_loglevel_name 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_log_get_loglevel_name 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_log_get_loglevel_name \- Get a logging level name from its numeric ID. .SH SYNOPSIS .nf .B #include .sp \fBconst char * knet_log_get_loglevel_name\fP( \fBuint8_t \fP\fIlevel\fP ); .fi .SH DESCRIPTION .PP knet_log_get_loglevel_name .SH RETURN VALUE .PP returns internal name of the log level or "ERROR" for unknown values .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_log_get_subsystem_id.3 b/libknet/man/knet_log_get_subsystem_id.3 index 3ddbcad5..877a2788 100644 --- a/libknet/man/knet_log_get_subsystem_id.3 +++ b/libknet/man/knet_log_get_subsystem_id.3 @@ -1,26 +1,29 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_log_get_subsystem_id 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_log_get_subsystem_id 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_log_get_subsystem_id \- Get a logging system ID from its name. .SH SYNOPSIS .nf .B #include .sp \fBuint8_t knet_log_get_subsystem_id\fP( \fBconst char *\fP\fIname\fP ); .fi .SH DESCRIPTION .PP knet_log_get_subsystem_id .SH RETURN VALUE .PP returns internal ID of the subsystem or KNET_SUB_COMMON .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_log_get_subsystem_name.3 b/libknet/man/knet_log_get_subsystem_name.3 index e707b76e..17665c47 100644 --- a/libknet/man/knet_log_get_subsystem_name.3 +++ b/libknet/man/knet_log_get_subsystem_name.3 @@ -1,26 +1,29 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_log_get_subsystem_name 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_log_get_subsystem_name 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_log_get_subsystem_name \- Get a logging system name from its numeric ID. .SH SYNOPSIS .nf .B #include .sp \fBconst char * knet_log_get_subsystem_name\fP( \fBuint8_t \fP\fIsubsystem\fP ); .fi .SH DESCRIPTION .PP knet_log_get_subsystem_name .SH RETURN VALUE .PP returns internal name of the subsystem or "common" .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_log_set_loglevel.3 b/libknet/man/knet_log_set_loglevel.3 index 8147f9e2..72254a2a 100644 --- a/libknet/man/knet_log_set_loglevel.3 +++ b/libknet/man/knet_log_set_loglevel.3 @@ -1,36 +1,39 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_log_set_loglevel 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_log_set_loglevel 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_log_set_loglevel \- Set the logging level for a subsystem. .SH SYNOPSIS .nf .B #include .sp \fBint knet_log_set_loglevel\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBuint8_t \fP\fIsubsystem\fP, \fBuint8_t \fP\fIlevel\fP ); .fi .SH DESCRIPTION .PP knet_log_set_log_level .PP knet_h - same as above .PP subsystem - same as above .PP level - same as above .PP knet_log_set_loglevel allows fine control of log levels by subsystem. See also knet_handle_new for defaults. .SH RETURN VALUE .PP knet_log_set_loglevel returns 0 on success -1 on error and errno is set. .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_recv.3 b/libknet/man/knet_recv.3 index 2f319130..fe139377 100644 --- a/libknet/man/knet_recv.3 +++ b/libknet/man/knet_recv.3 @@ -1,35 +1,38 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_recv 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_recv 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_recv \- Receive data from knet nodes. .SH SYNOPSIS .nf .B #include .sp \fBssize_t knet_recv\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBchar *\fP\fIbuff\fP, \fBconst size_t \fP\fIbuff_len\fP, \fBconst int8_t \fP\fIchannel\fP ); .fi .SH DESCRIPTION .PP knet_recv knet_h - pointer to knet_handle_t .PP buff - pointer to buffer to store the received data .PP buff_len - buffer length .PP channel - channel number .SH RETURN VALUE .PP knet_recv is a commodity function to wrap iovec operations around a socket. It returns a call to readv(2). .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_send.3 b/libknet/man/knet_send.3 index 455533d5..85d1278f 100644 --- a/libknet/man/knet_send.3 +++ b/libknet/man/knet_send.3 @@ -1,35 +1,38 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_send 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_send 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_send \- Send data to knet nodes. .SH SYNOPSIS .nf .B #include .sp \fBssize_t knet_send\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBconst char *\fP\fIbuff\fP, \fBconst size_t \fP\fIbuff_len\fP, \fBconst int8_t \fP\fIchannel\fP ); .fi .SH DESCRIPTION .PP knet_send knet_h - pointer to knet_handle_t .PP buff - pointer to the buffer of data to send .PP buff_len - length of data to send .PP channel - channel number .SH RETURN VALUE .PP knet_send is a commodity function to wrap iovec operations around a socket. It returns a call to writev(2). .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_send_sync.3 b/libknet/man/knet_send_sync.3 index 0be7172b..36e4c53b 100644 --- a/libknet/man/knet_send_sync.3 +++ b/libknet/man/knet_send_sync.3 @@ -1,71 +1,74 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_send_sync 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_send_sync 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_send_sync \- Synchronously send data to knet nodes. .SH SYNOPSIS .nf .B #include .sp \fBint knet_send_sync\fP( \fBknet_handle_t \fP\fIknet_h\fP, \fBconst char *\fP\fIbuff\fP, \fBconst size_t \fP\fIbuff_len\fP, \fBconst int8_t \fP\fIchannel\fP ); .fi .SH DESCRIPTION .PP knet_send_sync .PP knet_h - pointer to knet_handle_t .PP buff - pointer to the buffer of data to send .PP buff_len - length of data to send .PP channel - data channel to use (see knet_handle_add_datafd(3)) .PP All knet RX/TX operations are async for performance reasons. There are applications that might need a sync version of data transmission and receive errors in case of failure to deliver to another host. knet_send_sync bypasses the whole TX async layer and delivers data directly to the link layer, and returns errors accordingly. knet_send_sync allows to send only one packet to one host at a time. It does NOT support multiple destinations or multicast packets. Decision is still based on dst_host_filter_fn. .SH RETURN VALUE .PP knet_send_sync returns 0 on success and -1 on error. In addition to normal sendmmsg errors, knet_send_sync can fail due to: .TP .B ECANCELED - data forward is disabled .TP .B EFAULT - dst_host_filter fatal error .TP .B EINVAL - dst_host_filter did not provide dst_host_ids_entries on unicast pckts .TP .B E2BIG - dst_host_filter did return more than one dst_host_ids_entries on unicast pckts .TP .B ENOMSG - received unknown message type .TP .B EHOSTDOWN - unicast pckt cannot be delivered because dest host is not connected yet .TP .B ECHILD - crypto failed .TP .B EAGAIN - sendmmsg was unable to send all messages and there was no progress during retry .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/knet_strtoaddr.3 b/libknet/man/knet_strtoaddr.3 index dffcb92c..02b71012 100644 --- a/libknet/man/knet_strtoaddr.3 +++ b/libknet/man/knet_strtoaddr.3 @@ -1,37 +1,40 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH knet_strtoaddr 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH knet_strtoaddr 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" knet_strtoaddr \- Convert a hostname string to an address. .SH SYNOPSIS .nf .B #include .sp \fBint knet_strtoaddr\fP( \fBconst char *\fP\fIhost\fP, \fBconst char *\fP\fIport\fP, \fBstruct sockaddr_storage *\fP\fIss\fP, \fBsocklen_t \fP\fIsslen\fP ); .fi .SH DESCRIPTION .PP knet_strtoaddr .PP host - IPaddr/hostname to convert be aware only the first IP address will be returned in case a hostname resolves to multiple IP .PP port - port to connect to .PP ss - sockaddr_storage where to store the converted data .PP sslen - len of the sockaddr_storage .SH RETURN VALUE .PP knet_strtoaddr returns same error codes as getaddrinfo .SH SEE ALSO .PP .nh .ad l \fIlibknet.h\fP(3), \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/man/libknet.h.3 b/libknet/man/libknet.h.3 index 9aa5b30f..5cdfd598 100644 --- a/libknet/man/libknet.h.3 +++ b/libknet/man/libknet.h.3 @@ -1,207 +1,210 @@ .\" File automatically generated by doxy2man0.2 -.\" Generation date: Mon Oct 30 2017 -.TH libknet.h 3 2017-10-30 "kronosnet" "Kronosnet Programmer's Manual" +.\" Generation date: Tue Nov 7 2017 +.TH libknet.h 3 2017-11-07 "kronosnet" "Kronosnet Programmer's Manual" .SH "NAME" libknet.h \- kronosnet API include file .SH SYNOPSIS .nf .B #include .fi .SH DESCRIPTION .PP Kronosnet is an advanced VPN system for High Availability applications. .PP .sp .RS .nf \fB int knet_addrtostr(const struct sockaddr_storage *, socklen_t, char *, size_t, char *, size_t); int knet_handle_add_datafd(knet_handle_t, int *, int8_t *); int knet_handle_clear_stats(knet_handle_t, int); int knet_handle_compress(knet_handle_t, struct knet_handle_compress_cfg *); int knet_handle_crypto(knet_handle_t, struct knet_handle_crypto_cfg *); int knet_handle_enable_filter(knet_handle_t, void *, int(*)(void *private_data, const unsigned char *outdata, ssize_t outdata_len, uint8_t tx_rx, knet_node_id_t this_host_id, knet_node_id_t src_host_id, int8_t *channel, knet_node_id_t *dst_host_ids, size_t *dst_host_ids_entries)); int knet_handle_enable_pmtud_notify(knet_handle_t, void *, void(*)(void *private_data, unsigned int data_mtu)); int knet_handle_enable_sock_notify(knet_handle_t, void *, void(*)(void *private_data, int datafd, int8_t channel, uint8_t tx_rx, int error, int errorno)); int knet_handle_free(knet_handle_t); int knet_handle_get_channel(knet_handle_t, const int, int8_t *); int knet_handle_get_compress_list(knet_handle_t, const char **, size_t *); int knet_handle_get_crypto_list(knet_handle_t, const char **, size_t *); int knet_handle_get_datafd(knet_handle_t, const int8_t, int *); int knet_handle_get_stats(knet_handle_t, struct knet_handle_stats *, size_t); uint8_t knet_handle_get_transport_id_by_name(knet_handle_t, const char *); int knet_handle_get_transport_list(knet_handle_t, struct knet_transport_info *, size_t *); const char *knet_handle_get_transport_name_by_id(knet_handle_t, uint8_t); int knet_handle_get_transport_reconnect_interval(knet_handle_t, uint32_t *); knet_handle_t knet_handle_new(knet_node_id_t, int, uint8_t); int knet_handle_pmtud_get(knet_handle_t, unsigned int *); int knet_handle_pmtud_getfreq(knet_handle_t, unsigned int *); int knet_handle_pmtud_setfreq(knet_handle_t, unsigned int); int knet_handle_remove_datafd(knet_handle_t, int); int knet_handle_set_transport_reconnect_interval(knet_handle_t, uint32_t); int knet_handle_setfwd(knet_handle_t, unsigned int); int knet_host_add(knet_handle_t, knet_node_id_t); int knet_host_enable_status_change_notify(knet_handle_t, void *, void(*)(void *private_data, knet_node_id_t host_id, uint8_t reachable, uint8_t remote, uint8_t external)); int knet_host_get_host_list(knet_handle_t, knet_node_id_t *, size_t *); int knet_host_get_id_by_host_name(knet_handle_t, const char *, knet_node_id_t *); int knet_host_get_name_by_host_id(knet_handle_t, knet_node_id_t, char *); int knet_host_get_policy(knet_handle_t, knet_node_id_t, uint8_t *); int knet_host_get_status(knet_handle_t, knet_node_id_t, struct knet_host_status *); int knet_host_remove(knet_handle_t, knet_node_id_t); int knet_host_set_name(knet_handle_t, knet_node_id_t, const char *); int knet_host_set_policy(knet_handle_t, knet_node_id_t, uint8_t); int knet_link_clear_config(knet_handle_t, knet_node_id_t, uint8_t); int knet_link_get_config(knet_handle_t, knet_node_id_t, uint8_t, uint8_t *, struct sockaddr_storage *, struct sockaddr_storage *, uint8_t *, uint64_t *); int knet_link_get_enable(knet_handle_t, knet_node_id_t, uint8_t, unsigned int *); int knet_link_get_link_list(knet_handle_t, knet_node_id_t, uint8_t *, size_t *); int knet_link_get_ping_timers(knet_handle_t, knet_node_id_t, uint8_t, time_t *, time_t *, unsigned int *); int knet_link_get_pong_count(knet_handle_t, knet_node_id_t, uint8_t, uint8_t *); int knet_link_get_priority(knet_handle_t, knet_node_id_t, uint8_t, uint8_t *); int knet_link_get_status(knet_handle_t, knet_node_id_t, uint8_t, struct knet_link_status *, size_t); int knet_link_set_config(knet_handle_t, knet_node_id_t, uint8_t, uint8_t, struct sockaddr_storage *, struct sockaddr_storage *, uint64_t); int knet_link_set_enable(knet_handle_t, knet_node_id_t, uint8_t, unsigned int); int knet_link_set_ping_timers(knet_handle_t, knet_node_id_t, uint8_t, time_t, time_t, unsigned int); int knet_link_set_pong_count(knet_handle_t, knet_node_id_t, uint8_t, uint8_t); int knet_link_set_priority(knet_handle_t, knet_node_id_t, uint8_t, uint8_t); int knet_log_get_loglevel(knet_handle_t, uint8_t, uint8_t *); uint8_t knet_log_get_loglevel_id(const char *); const char *knet_log_get_loglevel_name(uint8_t); uint8_t knet_log_get_subsystem_id(const char *); const char *knet_log_get_subsystem_name(uint8_t); int knet_log_set_loglevel(knet_handle_t, uint8_t, uint8_t); ssize_t knet_recv(knet_handle_t, char *, const size_t, const int8_t); ssize_t knet_send(knet_handle_t, const char *, const size_t, const int8_t); int knet_send_sync(knet_handle_t, const char *, const size_t, const int8_t); int knet_strtoaddr(const char *, const char *, struct sockaddr_storage *, socklen_t); \fP .fi .RE .SS "" .PP .sp .sp .RS .nf \fB +struct knet_handle_compress_cfg { + char \fIcompress_model\fP; + uint32_t \fIcompress_threshold\fP; + int \fIcompress_level\fP; +}; +\fP +.fi +.RE +.SS "" +.PP +.sp +.sp +.RS +.nf +\fB struct knet_link_status { size_t \fIsize\fP; char \fIsrc_ipaddr\fP; char \fIsrc_port\fP; char \fIdst_ipaddr\fP; char \fIdst_port\fP; uint8_t \fIenabled\fP; uint8_t \fIconnected\fP; uint8_t \fIdynconnected\fP; unsigned long long \fIlatency\fP; struct timespec \fIpong_last\fP; unsigned int \fImtu\fP; unsigned int \fIproto_overhead\fP; struct knet_link_stats \fIstats\fP; }; \fP .fi .RE .SS "" .PP .sp .sp .RS .nf \fB -struct knet_handle_crypto_cfg { - char \fIcrypto_model\fP; - char \fIcrypto_cipher_type\fP; - char \fIcrypto_hash_type\fP; - unsigned char \fIprivate_key\fP; - unsigned int \fIprivate_key_len\fP; -}; -\fP -.fi -.RE -.SS "" -.PP -.sp -.sp -.RS -.nf -\fB struct knet_handle_stats { size_t \fIsize\fP; uint64_t \fItx_uncompressed_packets\fP; uint64_t \fItx_compressed_packets\fP; uint64_t \fItx_compressed_original_bytes\fP; uint64_t \fItx_compressed_size_bytes\fP; uint64_t \fItx_compress_time_ave\fP; uint64_t \fItx_compress_time_min\fP; uint64_t \fItx_compress_time_max\fP; uint64_t \fIrx_compressed_packets\fP; uint64_t \fIrx_compressed_original_bytes\fP; uint64_t \fIrx_compressed_size_bytes\fP; uint64_t \fIrx_compress_time_ave\fP; uint64_t \fIrx_compress_time_min\fP; uint64_t \fIrx_compress_time_max\fP; uint64_t \fItx_crypt_packets\fP; uint64_t \fItx_crypt_byte_overhead\fP; uint64_t \fItx_crypt_time_ave\fP; uint64_t \fItx_crypt_time_min\fP; uint64_t \fItx_crypt_time_max\fP; uint64_t \fIrx_crypt_packets\fP; uint64_t \fIrx_crypt_time_ave\fP; uint64_t \fIrx_crypt_time_min\fP; uint64_t \fIrx_crypt_time_max\fP; }; \fP .fi .RE .SS "" .PP .sp .sp .RS .nf \fB -struct knet_host_status { - uint8_t \fIreachable\fP; - uint8_t \fIremote\fP; - uint8_t \fIexternal\fP; +struct knet_handle_crypto_cfg { + char \fIcrypto_model\fP; + char \fIcrypto_cipher_type\fP; + char \fIcrypto_hash_type\fP; + unsigned char \fIprivate_key\fP; + unsigned int \fIprivate_key_len\fP; }; \fP .fi .RE .SS "" .PP .sp .sp .RS .nf \fB struct knet_transport_info { const char *\fIname\fP; uint8_t \fIid\fP; uint8_t \fIproperties\fP; }; \fP .fi .RE .SS "" .PP .sp .sp .RS .nf \fB -struct knet_handle_compress_cfg { - char \fIcompress_model\fP; - uint32_t \fIcompress_threshold\fP; - int \fIcompress_level\fP; +struct knet_host_status { + uint8_t \fIreachable\fP; + uint8_t \fIremote\fP; + uint8_t \fIexternal\fP; }; \fP .fi .RE .SH SEE ALSO .PP .nh .ad l \fIknet_addrtostr\fP(3), \fIknet_handle_add_datafd\fP(3), \fIknet_handle_clear_stats\fP(3), \fIknet_handle_compress\fP(3), \fIknet_handle_crypto\fP(3), \fIknet_handle_enable_filter\fP(3), \fIknet_handle_enable_pmtud_notify\fP(3), \fIknet_handle_enable_sock_notify\fP(3), \fIknet_handle_free\fP(3), \fIknet_handle_get_channel\fP(3), \fIknet_handle_get_compress_list\fP(3), \fIknet_handle_get_crypto_list\fP(3), \fIknet_handle_get_datafd\fP(3), \fIknet_handle_get_stats\fP(3), \fIknet_handle_get_transport_id_by_name\fP(3), \fIknet_handle_get_transport_list\fP(3), \fIknet_handle_get_transport_name_by_id\fP(3), \fIknet_handle_get_transport_reconnect_interval\fP(3), \fIknet_handle_new\fP(3), \fIknet_handle_pmtud_get\fP(3), \fIknet_handle_pmtud_getfreq\fP(3), \fIknet_handle_pmtud_setfreq\fP(3), \fIknet_handle_remove_datafd\fP(3), \fIknet_handle_set_transport_reconnect_interval\fP(3), \fIknet_handle_setfwd\fP(3), \fIknet_host_add\fP(3), \fIknet_host_enable_status_change_notify\fP(3), \fIknet_host_get_host_list\fP(3), \fIknet_host_get_id_by_host_name\fP(3), \fIknet_host_get_name_by_host_id\fP(3), \fIknet_host_get_policy\fP(3), \fIknet_host_get_status\fP(3), \fIknet_host_remove\fP(3), \fIknet_host_set_name\fP(3), \fIknet_host_set_policy\fP(3), \fIknet_link_clear_config\fP(3), \fIknet_link_get_config\fP(3), \fIknet_link_get_enable\fP(3), \fIknet_link_get_link_list\fP(3), \fIknet_link_get_ping_timers\fP(3), \fIknet_link_get_pong_count\fP(3), \fIknet_link_get_priority\fP(3), \fIknet_link_get_status\fP(3), \fIknet_link_set_config\fP(3), \fIknet_link_set_enable\fP(3), \fIknet_link_set_ping_timers\fP(3), \fIknet_link_set_pong_count\fP(3), \fIknet_link_set_priority\fP(3), \fIknet_log_get_loglevel\fP(3), \fIknet_log_get_loglevel_id\fP(3), \fIknet_log_get_loglevel_name\fP(3), \fIknet_log_get_subsystem_id\fP(3), \fIknet_log_get_subsystem_name\fP(3), \fIknet_log_set_loglevel\fP(3), \fIknet_recv\fP(3), \fIknet_send\fP(3), \fIknet_send_sync\fP(3), \fIknet_strtoaddr\fP(3) .ad .hy +.SH COPYRIGHT +.PP +Copyright (C) 2010-2017 Red Hat, Inc. All rights reserved. diff --git a/libknet/tests/api-test-coverage b/libknet/tests/api-test-coverage index 82f6963d..029d3ef9 100755 --- a/libknet/tests/api-test-coverage +++ b/libknet/tests/api-test-coverage @@ -1,79 +1,86 @@ #!/bin/sh +# +# Copyright (C) 2016-2017 Red Hat, Inc. All rights reserved. +# +# Author: Fabio M. Di Nitto +# +# This software licensed under GPL-2.0+, LGPL-2.0+ +# srcdir="$1"/libknet/tests builddir="$2"/libknet/tests headerapicalls="$(grep knet_ "$srcdir"/../libknet.h | grep -v "^ \*" | grep -v ^struct | grep -v "^[[:space:]]" | grep -v typedef | sed -e 's/(.*//g' -e 's/^const //g' -e 's/\*//g' | awk '{print $2}')" exportedapicalls="$(nm -B -D "$builddir"/../.libs/libknet.so | grep ' T ' | awk '{print $3}')" echo "Checking for exported symbols NOT available in header file" for i in $exportedapicalls; do found=0 for x in $headerapicalls; do if [ "$x" = "$i" ]; then found=1 break; fi done if [ "$found" = 0 ]; then echo "Symbol $i not found in header file" exit 1 fi done echo "Checking for symbols in header file NOT exported by binary lib" for i in $headerapicalls; do found=0 for x in $exportedapicalls; do if [ "$x" = "$i" ]; then found=1 break; fi done if [ "$found" = 0 ]; then echo "Symbol $i not found in binary lib" exit 1 fi done echo "Checking for tests with memcheck exceptions" for i in $(grep -l is_memcheck "$srcdir"/*.c | grep -v test-common); do echo "WARNING: $(basename $i) - has memcheck exception enabled" done echo "Checking for tests with helgrind exceptions" for i in $(grep -l is_helgrind "$srcdir"/*.c | grep -v test-common); do echo "WARNING: $(basename $i) has helgrind exception enabled" done echo "Checking for api test coverage" numapicalls=0 found=0 missing=0 for i in $headerapicalls; do numapicalls=$((numapicalls + 1)) if [ -f $srcdir/api_${i}.c ]; then found=$((found + 1)) else missing=$((missing + 1)) echo "MISSING: $i" fi done echo "Summary" echo "-------" echo "Found : $found" echo "Missing : $missing" echo "Total : $numapicalls" which bc > /dev/null 2>&1 && { coverage=$(echo "scale=3; $found / $numapicalls * 100" | bc -l) echo "Coverage: $coverage%" } exit 0 diff --git a/libknet/tests/pckt_test.c b/libknet/tests/pckt_test.c index 0dc32d99..f10d8a72 100644 --- a/libknet/tests/pckt_test.c +++ b/libknet/tests/pckt_test.c @@ -1,19 +1,27 @@ +/* + * Copyright (C) 2015-2017 Red Hat, Inc. All rights reserved. + * + * Author: Fabio M. Di Nitto + * + * This software licensed under GPL-2.0+, LGPL-2.0+ + */ + #include #include "onwire.h" int main(void) { printf("\nKronosnet network header size printout:\n\n"); printf("KNET_HEADER_ALL_SIZE: %zu\n", KNET_HEADER_ALL_SIZE); printf("KNET_HEADER_SIZE: %zu\n", KNET_HEADER_SIZE); printf("KNET_HEADER_PING_SIZE: %zu (%zu)\n", KNET_HEADER_PING_SIZE, sizeof(struct knet_header_payload_ping)); printf("KNET_HEADER_PMTUD_SIZE: %zu (%zu)\n", KNET_HEADER_PMTUD_SIZE, sizeof(struct knet_header_payload_pmtud)); printf("KNET_HEADER_DATA_SIZE: %zu (%zu)\n", KNET_HEADER_DATA_SIZE, sizeof(struct knet_header_payload_data)); printf("\n"); printf("KNET_HOSTINFO_ALL_SIZE: %zu\n", KNET_HOSTINFO_ALL_SIZE); printf("KNET_HOSTINFO_SIZE: %zu\n", KNET_HOSTINFO_SIZE); printf("KNET_HOSTINFO_LINK_STATUS_SIZE: %zu (%zu)\n", KNET_HOSTINFO_LINK_STATUS_SIZE, sizeof(struct knet_hostinfo_payload_link_status)); return 0; } diff --git a/libknet/transport_common.c b/libknet/transport_common.c index 5de9acca..2b0887a1 100644 --- a/libknet/transport_common.c +++ b/libknet/transport_common.c @@ -1,539 +1,547 @@ +/* + * Copyright (C) 2016-2017 Red Hat, Inc. All rights reserved. + * + * Author: Fabio M. Di Nitto + * + * This software licensed under GPL-2.0+, LGPL-2.0+ + */ + #include "config.h" #include #include #include #include #include #include #include "libknet.h" #include "compat.h" #include "host.h" #include "link.h" #include "logging.h" #include "common.h" #include "transports.h" /* * reuse Jan Friesse's compat layer as wrapper to drop usage of sendmmsg * * TODO: kill those wrappers once we work on packet delivery guaranteed */ int _recvmmsg(int sockfd, struct knet_mmsghdr *msgvec, unsigned int vlen, unsigned int flags) { int savederrno = 0, err = 0; unsigned int i; for (i = 0; i < vlen; i++) { err = recvmsg(sockfd, &msgvec[i].msg_hdr, flags); savederrno = errno; if (err >= 0) { msgvec[i].msg_len = err; } else { if ((i > 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) { savederrno = 0; } break; } } errno = savederrno; return ((i > 0) ? (int)i : err); } int _sendmmsg(int sockfd, struct knet_mmsghdr *msgvec, unsigned int vlen, unsigned int flags) { int savederrno = 0, err = 0; unsigned int i; for (i = 0; i < vlen; i++) { err = sendmsg(sockfd, &msgvec[i].msg_hdr, flags); savederrno = errno; if (err < 0) { break; } } errno = savederrno; return ((i > 0) ? (int)i : err); } int _configure_common_socket(knet_handle_t knet_h, int sock, uint64_t flags, const char *type) { int err = 0, savederrno = 0; int value; if (_fdset_cloexec(sock)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set %s CLOEXEC socket opts: %s", type, strerror(savederrno)); goto exit_error; } if (_fdset_nonblock(sock)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set %s NONBLOCK socket opts: %s", type, strerror(savederrno)); goto exit_error; } value = KNET_RING_RCVBUFF; #ifdef SO_RCVBUFFORCE if (setsockopt(sock, SOL_SOCKET, SO_RCVBUFFORCE, &value, sizeof(value)) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set %s receive buffer: %s", type, strerror(savederrno)); goto exit_error; } #else if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, &value, sizeof(value)) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set %s SO_RECVBUF: %s", type, strerror(savederrno)); goto exit_error; } #endif value = KNET_RING_RCVBUFF; #ifdef SO_SNDBUFFORCE if (setsockopt(sock, SOL_SOCKET, SO_SNDBUFFORCE, &value, sizeof(value)) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set %s send buffer: %s", type, strerror(savederrno)); goto exit_error; } #else if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &value, sizeof(value)) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set %s SO_SNDBUF: %s", type, strerror(savederrno)); goto exit_error; } #endif #ifdef SO_PRIORITY if (flags & KNET_LINK_FLAG_TRAFFICHIPRIO) { value = 6; /* TC_PRIO_INTERACTIVE */ if (setsockopt(sock, SOL_SOCKET, SO_PRIORITY, &value, sizeof(value)) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set %s priority: %s", type, strerror(savederrno)); goto exit_error; } } #endif #if defined(IP_TOS) && defined(IPTOS_LOWDELAY) if (flags & KNET_LINK_FLAG_TRAFFICHIPRIO) { value = IPTOS_LOWDELAY; if (setsockopt(sock, IPPROTO_IP, IP_TOS, &value, sizeof(value)) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set %s priority: %s", type, strerror(savederrno)); goto exit_error; } } #endif exit_error: errno = savederrno; return err; } int _configure_transport_socket(knet_handle_t knet_h, int sock, struct sockaddr_storage *address, uint64_t flags, const char *type) { int err = 0, savederrno = 0; int value; if (_configure_common_socket(knet_h, sock, flags, type) < 0) { savederrno = errno; err = -1; goto exit_error; } #ifdef IP_FREEBIND value = 1; if (setsockopt(sock, SOL_IP, IP_FREEBIND, &value, sizeof(value)) <0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set FREEBIND on %s socket: %s", type, strerror(savederrno)); goto exit_error; } #endif #ifdef IP_BINDANY /* BSD */ value = 1; if (setsockopt(sock, IPPROTO_IP, IP_BINDANY, &value, sizeof(value)) <0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set BINDANY on %s socket: %s", type, strerror(savederrno)); goto exit_error; } #endif if (address->ss_family == AF_INET6) { value = 1; if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &value, sizeof(value)) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set %s IPv6 only: %s", type, strerror(savederrno)); goto exit_error; } #ifdef IPV6_MTU_DISCOVER value = IPV6_PMTUDISC_PROBE; if (setsockopt(sock, SOL_IPV6, IPV6_MTU_DISCOVER, &value, sizeof(value)) <0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set PMTUDISC on %s socket: %s", type, strerror(savederrno)); goto exit_error; } #else value = 1; if (setsockopt(sock, IPPROTO_IPV6, IPV6_DONTFRAG, &value, sizeof(value)) <0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set DONTFRAG on %s socket: %s", type, strerror(savederrno)); goto exit_error; } #endif } else { #ifdef IP_MTU_DISCOVER value = IP_PMTUDISC_PROBE; if (setsockopt(sock, SOL_IP, IP_MTU_DISCOVER, &value, sizeof(value)) <0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set PMTUDISC on %s socket: %s", type, strerror(savederrno)); goto exit_error; } #else value = 1; if (setsockopt(sock, IPPROTO_IP, IP_DONTFRAG, &value, sizeof(value)) <0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set DONTFRAG on %s socket: %s", type, strerror(savederrno)); goto exit_error; } #endif } value = 1; if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(value)) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set %s reuseaddr: %s", type, strerror(savederrno)); goto exit_error; } exit_error: errno = savederrno; return err; } int _init_socketpair(knet_handle_t knet_h, int *sock) { int err = 0, savederrno = 0; int i; if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sock) != 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_HANDLE, "Unable to initialize socketpair: %s", strerror(savederrno)); goto exit_fail; } for (i = 0; i < 2; i++) { if (_configure_common_socket(knet_h, sock[i], 0, "local socketpair") < 0) { savederrno = errno; err = -1; goto exit_fail; } } exit_fail: errno = savederrno; return err; } void _close_socketpair(knet_handle_t knet_h, int *sock) { int i; for (i = 0; i < 2; i++) { if (sock[i]) { close(sock[i]); sock[i] = 0; } } } /* * must be called with global read lock * * return -1 on error * return 0 if fd is invalid * return 1 if fd is valid */ int _is_valid_fd(knet_handle_t knet_h, int sockfd) { int ret = 0; if (sockfd < 0) { errno = EINVAL; return -1; } if (sockfd > KNET_MAX_FDS) { errno = EINVAL; return -1; } if (knet_h->knet_transport_fd_tracker[sockfd].transport >= KNET_MAX_TRANSPORTS) { ret = 0; } else { ret = 1; } return ret; } /* * must be called with global write lock */ int _set_fd_tracker(knet_handle_t knet_h, int sockfd, uint8_t transport, uint8_t data_type, void *data) { if (sockfd < 0) { errno = EINVAL; return -1; } if (sockfd > KNET_MAX_FDS) { errno = EINVAL; return -1; } knet_h->knet_transport_fd_tracker[sockfd].transport = transport; knet_h->knet_transport_fd_tracker[sockfd].data_type = data_type; knet_h->knet_transport_fd_tracker[sockfd].data = data; return 0; } /* * public api */ int knet_handle_get_transport_list(knet_handle_t knet_h, struct knet_transport_info *transport_list, size_t *transport_list_entries) { int err = 0, savederrno = 0; int i, count; if (!knet_h) { errno = EINVAL; return -1; } if (!transport_list) { errno = EINVAL; return -1; } if (!transport_list_entries) { errno = EINVAL; return -1; } savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock); if (savederrno) { log_err(knet_h, KNET_SUB_HANDLE, "Unable to get read lock: %s", strerror(savederrno)); errno = savederrno; return -1; } count = 0; /* * we could potentially build this struct * at knet_handle_new init time, but * let's keep it dynamic in case at somepoint * we need to init transports dynamically * at runtime vs init time. */ for (i=0; itransport_ops[i]) { transport_list[count].name = knet_h->transport_ops[i]->transport_name; transport_list[count].id = knet_h->transport_ops[i]->transport_id; count++; } } *transport_list_entries = count; pthread_rwlock_unlock(&knet_h->global_rwlock); return err; } const char *knet_handle_get_transport_name_by_id(knet_handle_t knet_h, uint8_t transport) { int savederrno = 0; const char *name = NULL; if (!knet_h) { errno = EINVAL; return name; } if (transport >= KNET_MAX_TRANSPORTS) { errno = EINVAL; return name; } savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock); if (savederrno) { log_err(knet_h, KNET_SUB_HANDLE, "Unable to get read lock: %s", strerror(savederrno)); errno = savederrno; return name; } if (knet_h->transport_ops[transport]) { name = knet_h->transport_ops[transport]->transport_name; } else { savederrno = ENOENT; } pthread_rwlock_unlock(&knet_h->global_rwlock); errno = savederrno; return name; } uint8_t knet_handle_get_transport_id_by_name(knet_handle_t knet_h, const char *name) { int savederrno = 0; uint8_t err = KNET_MAX_TRANSPORTS; int i; if (!knet_h) { errno = EINVAL; return err; } if (!name) { errno = EINVAL; return err; } savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock); if (savederrno) { log_err(knet_h, KNET_SUB_HANDLE, "Unable to get read lock: %s", strerror(savederrno)); errno = savederrno; return err; } for (i=0; itransport_ops[i]) { if (!strcmp(knet_h->transport_ops[i]->transport_name, name)) { err = knet_h->transport_ops[i]->transport_id; break; } } } if (err == KNET_MAX_TRANSPORTS) { savederrno = EINVAL; } pthread_rwlock_unlock(&knet_h->global_rwlock); errno = savederrno; return err; } int knet_handle_set_transport_reconnect_interval(knet_handle_t knet_h, uint32_t msecs) { int savederrno = 0; if (!knet_h) { errno = EINVAL; return -1; } if (!msecs) { errno = EINVAL; return -1; } if (msecs < 1000) { log_warn(knet_h, KNET_SUB_HANDLE, "reconnect internval below 1 sec (%u msecs) might be too aggressive", msecs); } if (msecs > 60000) { log_warn(knet_h, KNET_SUB_HANDLE, "reconnect internval above 1 minute (%u msecs) could cause long delays in network convergiance", msecs); } savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock); if (savederrno) { log_err(knet_h, KNET_SUB_HANDLE, "Unable to get read lock: %s", strerror(savederrno)); errno = savederrno; return -1; } knet_h->reconnect_int = msecs; pthread_rwlock_unlock(&knet_h->global_rwlock); return 0; } int knet_handle_get_transport_reconnect_interval(knet_handle_t knet_h, uint32_t *msecs) { int savederrno = 0; if (!knet_h) { errno = EINVAL; return -1; } if (!msecs) { errno = EINVAL; return -1; } savederrno = pthread_rwlock_rdlock(&knet_h->global_rwlock); if (savederrno) { log_err(knet_h, KNET_SUB_HANDLE, "Unable to get read lock: %s", strerror(savederrno)); errno = savederrno; return -1; } *msecs = knet_h->reconnect_int; pthread_rwlock_unlock(&knet_h->global_rwlock); return 0; } diff --git a/libknet/transport_loopback.c b/libknet/transport_loopback.c index 56cc7cff..a26ce758 100644 --- a/libknet/transport_loopback.c +++ b/libknet/transport_loopback.c @@ -1,85 +1,93 @@ +/* + * Copyright (C) 2017 Red Hat, Inc. All rights reserved. + * + * Author: Christine Caulfield + * + * This software licensed under GPL-2.0+, LGPL-2.0+ + */ + #include "config.h" #include #include #include #include #include #include #include #include #include #include "libknet.h" #include "compat.h" #include "host.h" #include "link.h" #include "logging.h" #include "common.h" #include "transports.h" #include "threads_common.h" #define KNET_PMTUD_LOOPBACK_OVERHEAD 0 /* This is just a file of empty calls as the actual loopback is in threads_tx.c as a special case when receiving a packet from the localhost */ static int loopback_transport_link_set_config(knet_handle_t knet_h, struct knet_link *kn_link) { return 0; } static int loopback_transport_link_clear_config(knet_handle_t knet_h, struct knet_link *kn_link) { return 0; } static int loopback_transport_free(knet_handle_t knet_h) { return 0; } static int loopback_transport_init(knet_handle_t knet_h) { return 0; } static int loopback_transport_rx_sock_error(knet_handle_t knet_h, int sockfd, int recv_err, int recv_errno) { return 0; } static int loopback_transport_tx_sock_error(knet_handle_t knet_h, int sockfd, int recv_err, int recv_errno) { return 0; } static int loopback_transport_rx_is_data(knet_handle_t knet_h, int sockfd, struct knet_mmsghdr *msg) { return 0; } static int loopback_transport_link_dyn_connect(knet_handle_t knet_h, int sockfd, struct knet_link *kn_link) { return 0; } static knet_transport_ops_t loopback_transport_ops = { .transport_name = "LOOPBACK", .transport_id = KNET_TRANSPORT_LOOPBACK, .transport_mtu_overhead = KNET_PMTUD_LOOPBACK_OVERHEAD, .transport_init = loopback_transport_init, .transport_free = loopback_transport_free, .transport_link_set_config = loopback_transport_link_set_config, .transport_link_clear_config = loopback_transport_link_clear_config, .transport_link_dyn_connect = loopback_transport_link_dyn_connect, .transport_rx_sock_error = loopback_transport_rx_sock_error, .transport_tx_sock_error = loopback_transport_tx_sock_error, .transport_rx_is_data = loopback_transport_rx_is_data, }; knet_transport_ops_t *get_loopback_transport() { return &loopback_transport_ops; } diff --git a/libknet/transport_sctp.c b/libknet/transport_sctp.c index 150e642a..2fed9183 100644 --- a/libknet/transport_sctp.c +++ b/libknet/transport_sctp.c @@ -1,1440 +1,1448 @@ +/* + * Copyright (C) 2016-2017 Red Hat, Inc. All rights reserved. + * + * Author: Christine Caulfield + * + * This software licensed under GPL-2.0+, LGPL-2.0+ + */ + #include "config.h" #include #include #include #include #include #include #include #include "compat.h" #include "host.h" #include "links.h" #include "logging.h" #include "common.h" #include "transports.h" #include "threads_common.h" #ifdef HAVE_NETINET_SCTP_H #include /* * https://en.wikipedia.org/wiki/SCTP_packet_structure */ #define KNET_PMTUD_SCTP_OVERHEAD_COMMON 12 #define KNET_PMTUD_SCTP_OVERHEAD_DATA_CHUNK 16 #define KNET_PMTUD_SCTP_OVERHEAD KNET_PMTUD_SCTP_OVERHEAD_COMMON + KNET_PMTUD_SCTP_OVERHEAD_DATA_CHUNK typedef struct sctp_handle_info { struct knet_list_head listen_links_list; struct knet_list_head connect_links_list; int connect_epollfd; int connectsockfd[2]; int listen_epollfd; int listensockfd[2]; pthread_t connect_thread; pthread_t listen_thread; } sctp_handle_info_t; /* * use by fd_tracker data type */ #define SCTP_NO_LINK_INFO 0 #define SCTP_LISTENER_LINK_INFO 1 #define SCTP_ACCEPTED_LINK_INFO 2 #define SCTP_CONNECT_LINK_INFO 3 /* * this value is per listener */ #define MAX_ACCEPTED_SOCKS 256 typedef struct sctp_listen_link_info { struct knet_list_head list; int listen_sock; int accepted_socks[MAX_ACCEPTED_SOCKS]; struct sockaddr_storage src_address; int on_listener_epoll; int on_rx_epoll; } sctp_listen_link_info_t; typedef struct sctp_accepted_link_info { char mread_buf[KNET_DATABUFSIZE]; ssize_t mread_len; sctp_listen_link_info_t *link_info; } sctp_accepted_link_info_t ; typedef struct sctp_connect_link_info { struct knet_list_head list; sctp_listen_link_info_t *listener; struct knet_link *link; struct sockaddr_storage dst_address; int connect_sock; int on_connected_epoll; int on_rx_epoll; int close_sock; } sctp_connect_link_info_t; /* * socket handling functions * * those functions do NOT perform locking. locking * should be handled in the right context from callers */ /* * sockets are removed from rx_epoll from callers * see also error handling functions */ static int _close_connect_socket(knet_handle_t knet_h, struct knet_link *kn_link) { int err = 0, savederrno = 0; sctp_connect_link_info_t *info = kn_link->transport_link; sctp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_SCTP]; struct epoll_event ev; if (info->on_connected_epoll) { memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLOUT; ev.data.fd = info->connect_sock; if (epoll_ctl(handle_info->connect_epollfd, EPOLL_CTL_DEL, info->connect_sock, &ev)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to remove connected socket from the epoll pool: %s", strerror(errno)); goto exit_error; } info->on_connected_epoll = 0; } exit_error: if (info->connect_sock != -1) { if (_set_fd_tracker(knet_h, info->connect_sock, KNET_MAX_TRANSPORTS, SCTP_NO_LINK_INFO, NULL) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to set fd tracker: %s", strerror(savederrno)); goto exit_error; } close(info->connect_sock); info->connect_sock = -1; } errno = savederrno; return err; } static int _enable_sctp_notifications(knet_handle_t knet_h, int sock, const char *type) { int err = 0, savederrno = 0; struct sctp_event_subscribe events; memset(&events, 0, sizeof (events)); events.sctp_data_io_event = 1; events.sctp_association_event = 1; events.sctp_send_failure_event = 1; events.sctp_address_event = 1; events.sctp_peer_error_event = 1; events.sctp_shutdown_event = 1; if (setsockopt(sock, IPPROTO_SCTP, SCTP_EVENTS, &events, sizeof (events)) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to enable %s events: %s", type, strerror(savederrno)); } errno = savederrno; return err; } static int _configure_sctp_socket(knet_handle_t knet_h, int sock, struct sockaddr_storage *address, uint64_t flags, const char *type) { int err = 0, savederrno = 0; int value; int level; #ifdef SOL_SCTP level = SOL_SCTP; #else level = IPPROTO_SCTP; #endif if (_configure_transport_socket(knet_h, sock, address, flags, type) < 0) { savederrno = errno; err = -1; goto exit_error; } value = 1; if (setsockopt(sock, level, SCTP_NODELAY, &value, sizeof(value)) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSPORT, "Unable to set sctp nodelay: %s", strerror(savederrno)); goto exit_error; } if (_enable_sctp_notifications(knet_h, sock, type) < 0) { savederrno = errno; err = -1; } exit_error: errno = savederrno; return err; } static int _reconnect_socket(knet_handle_t knet_h, struct knet_link *kn_link) { int err = 0, savederrno = 0; sctp_connect_link_info_t *info = kn_link->transport_link; sctp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_SCTP]; struct epoll_event ev; if (connect(info->connect_sock, (struct sockaddr *)&kn_link->dst_addr, sockaddr_len(&kn_link->dst_addr)) < 0) { if ((errno != EALREADY) && (errno != EINPROGRESS) && (errno != EISCONN)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to connect SCTP socket %d: %s", info->connect_sock, strerror(savederrno)); goto exit_error; } } if (!info->on_connected_epoll) { memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLOUT; ev.data.fd = info->connect_sock; if (epoll_ctl(handle_info->connect_epollfd, EPOLL_CTL_ADD, info->connect_sock, &ev)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to add send/recv to epoll pool: %s", strerror(savederrno)); goto exit_error; } info->on_connected_epoll = 1; } exit_error: errno = savederrno; return err; } static int _create_connect_socket(knet_handle_t knet_h, struct knet_link *kn_link) { int err = 0, savederrno = 0; sctp_connect_link_info_t *info = kn_link->transport_link; sctp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_SCTP]; struct epoll_event ev; int connect_sock; connect_sock = socket(kn_link->dst_addr.ss_family, SOCK_STREAM, IPPROTO_SCTP); if (connect_sock < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to create send/recv socket: %s", strerror(savederrno)); goto exit_error; } if (_configure_sctp_socket(knet_h, connect_sock, &kn_link->dst_addr, kn_link->flags, "SCTP connect") < 0) { savederrno = errno; err = -1; goto exit_error; } if (_set_fd_tracker(knet_h, connect_sock, KNET_TRANSPORT_SCTP, SCTP_CONNECT_LINK_INFO, info) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to set fd tracker: %s", strerror(savederrno)); goto exit_error; } info->connect_sock = connect_sock; info->close_sock = 0; if (_reconnect_socket(knet_h, kn_link) < 0) { savederrno = errno; err = -1; goto exit_error; } exit_error: if (err) { if (info->on_connected_epoll) { epoll_ctl(handle_info->connect_epollfd, EPOLL_CTL_DEL, connect_sock, &ev); } if (connect_sock >= 0) { close(connect_sock); } } errno = savederrno; return err; } static int sctp_transport_tx_sock_error(knet_handle_t knet_h, int sockfd, int recv_err, int recv_errno) { sctp_connect_link_info_t *connect_info = knet_h->knet_transport_fd_tracker[sockfd].data; sctp_accepted_link_info_t *accepted_info = knet_h->knet_transport_fd_tracker[sockfd].data; sctp_listen_link_info_t *listen_info; if (recv_err < 0) { switch (knet_h->knet_transport_fd_tracker[sockfd].data_type) { case SCTP_CONNECT_LINK_INFO: if (connect_info->link->transport_connected == 0) { return -1; } break; case SCTP_ACCEPTED_LINK_INFO: listen_info = accepted_info->link_info; if (listen_info->listen_sock != sockfd) { if (listen_info->on_rx_epoll == 0) { return -1; } } break; } if (recv_errno == EAGAIN) { #ifdef DEBUG log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Sock: %d is overloaded. Slowing TX down", sockfd); #endif /* Don't hold onto the lock while sleeping */ pthread_rwlock_unlock(&knet_h->global_rwlock); usleep(KNET_THREADS_TIMERES / 16); pthread_rwlock_rdlock(&knet_h->global_rwlock); return 1; } return -1; } return 0; } /* * socket error management functions * * both called with global read lock. * * NOTE: we need to remove the fd from the epoll as soon as possible * even before we notify the respective thread to take care of it * because scheduling can make it so that this thread will overload * and the threads supposed to take care of the error will never * be able to take action. * we CANNOT handle FDs here diretly (close/reconnect/etc) due * to locking context. We need to delegate that to their respective * management threads within global write lock. * * this function is called from: * - RX thread with recv_err <= 0 directly on recvmmsg error * - transport_rx_is_data when msg_len == 0 (recv_err = 1) * - transport_rx_is_data on notification (recv_err = 2) * * basically this small abouse of recv_err is to detect notifications * generated by sockets created by listen(). */ static int sctp_transport_rx_sock_error(knet_handle_t knet_h, int sockfd, int recv_err, int recv_errno) { struct epoll_event ev; sctp_connect_link_info_t *connect_info = knet_h->knet_transport_fd_tracker[sockfd].data; sctp_accepted_link_info_t *accepted_info = knet_h->knet_transport_fd_tracker[sockfd].data; sctp_listen_link_info_t *listen_info; sctp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_SCTP]; switch (knet_h->knet_transport_fd_tracker[sockfd].data_type) { case SCTP_CONNECT_LINK_INFO: /* * all connect link have notifications enabled * and we accept only data from notification and * generic recvmmsg errors. * * Errors generated by msg_len 0 can be ignored because * they follow a notification (double notification) */ if (recv_err != 1) { connect_info->link->transport_connected = 0; if (connect_info->on_rx_epoll) { memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = sockfd; if (epoll_ctl(knet_h->recv_from_links_epollfd, EPOLL_CTL_DEL, sockfd, &ev)) { log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to remove EOFed socket from epoll pool: %s", strerror(errno)); return -1; } connect_info->on_rx_epoll = 0; } log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Notifying connect thread that sockfd %d received an error", sockfd); if (sendto(handle_info->connectsockfd[1], &sockfd, sizeof(int), MSG_DONTWAIT | MSG_NOSIGNAL, NULL, 0) != sizeof(int)) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to notify connect thread: %s", strerror(errno)); } } break; case SCTP_ACCEPTED_LINK_INFO: listen_info = accepted_info->link_info; if (listen_info->listen_sock != sockfd) { if (recv_err != 1) { if (listen_info->on_rx_epoll) { memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = sockfd; if (epoll_ctl(knet_h->recv_from_links_epollfd, EPOLL_CTL_DEL, sockfd, &ev)) { log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to remove EOFed socket from epoll pool: %s", strerror(errno)); return -1; } listen_info->on_rx_epoll = 0; } log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Notifying listen thread that sockfd %d received an error", sockfd); if (sendto(handle_info->listensockfd[1], &sockfd, sizeof(int), MSG_DONTWAIT | MSG_NOSIGNAL, NULL, 0) != sizeof(int)) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to notify listen thread: %s", strerror(errno)); } } } else { /* * this means the listen() socket has generated * a notification. now what? :-) */ log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Received stray notification for listen() socket %d", sockfd); } break; default: log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Received unknown notification? %d", sockfd); break; } /* * Under RX pressure we need to give time to IPC to pick up the message */ /* Don't hold onto the lock while sleeping */ pthread_rwlock_unlock(&knet_h->global_rwlock); usleep(KNET_THREADS_TIMERES / 2); pthread_rwlock_rdlock(&knet_h->global_rwlock); return 0; } /* * NOTE: sctp_transport_rx_is_data is called with global rdlock * delegate any FD error management to sctp_transport_rx_sock_error * and keep this code to parsing incoming data only */ static int sctp_transport_rx_is_data(knet_handle_t knet_h, int sockfd, struct knet_mmsghdr *msg) { size_t i; struct iovec *iov = msg->msg_hdr.msg_iov; size_t iovlen = msg->msg_hdr.msg_iovlen; struct sctp_assoc_change *sac; union sctp_notification *snp; sctp_accepted_link_info_t *info = knet_h->knet_transport_fd_tracker[sockfd].data; if (!(msg->msg_hdr.msg_flags & MSG_NOTIFICATION)) { if (msg->msg_len == 0) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "received 0 bytes len packet: %d", sockfd); /* * NOTE: with event notification enabled, we receive error twice: * 1) from the event notification * 2) followed by a 0 byte msg_len * * This is generally not a problem if not for causing extra * handling for the same issue. Should we drop notifications * and keep the code generic (handle all errors via msg_len = 0) * or keep the duplication as safety measure, or drop msg_len = 0 * handling (what about sockets without events enabled?) */ sctp_transport_rx_sock_error(knet_h, sockfd, 1, 0); return 1; } /* * missing MSG_EOR has to be treated as a short read * from the socket and we need to fill in the mread buf * while we wait for MSG_EOR */ if (!(msg->msg_hdr.msg_flags & MSG_EOR)) { /* * copy the incoming data into mread_buf + mread_len (incremental) * and increase mread_len */ memmove(info->mread_buf + info->mread_len, iov->iov_base, msg->msg_len); info->mread_len = info->mread_len + msg->msg_len; return 0; } /* * got EOR. * if mread_len is > 0 we are completing a packet from short reads * complete reassembling the packet in mread_buf, copy it back in the iov * and set the iov/msg len numbers (size) correctly */ if (info->mread_len) { /* * add last fragment to mread_buf */ memmove(info->mread_buf + info->mread_len, iov->iov_base, msg->msg_len); info->mread_len = info->mread_len + msg->msg_len; /* * move all back into the iovec */ memmove(iov->iov_base, info->mread_buf, info->mread_len); msg->msg_len = info->mread_len; info->mread_len = 0; } return 2; } if (!(msg->msg_hdr.msg_flags & MSG_EOR)) { return 1; } for (i=0; i< iovlen; i++) { snp = iov[i].iov_base; switch (snp->sn_header.sn_type) { case SCTP_ASSOC_CHANGE: log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "[event] sctp assoc change"); sac = &snp->sn_assoc_change; if (sac->sac_state == SCTP_COMM_LOST) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "[event] sctp assoc change: comm_lost"); sctp_transport_rx_sock_error(knet_h, sockfd, 2, 0); } break; case SCTP_SHUTDOWN_EVENT: log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "[event] sctp shutdown event"); sctp_transport_rx_sock_error(knet_h, sockfd, 2, 0); break; case SCTP_SEND_FAILED: log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "[event] sctp send failed"); break; case SCTP_PEER_ADDR_CHANGE: log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "[event] sctp peer addr change"); break; case SCTP_REMOTE_ERROR: log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "[event] sctp remote error"); break; default: log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "[event] unknown sctp event type: %hu\n", snp->sn_header.sn_type); break; } } return 0; } /* * connect / outgoing socket management thread */ /* * _handle_connected_sctp* are called with a global write lock * from the connect_thread */ static void _handle_connected_sctp(knet_handle_t knet_h, int connect_sock) { int err; struct epoll_event ev; unsigned int status, len = sizeof(status); sctp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_SCTP]; sctp_connect_link_info_t *info = knet_h->knet_transport_fd_tracker[connect_sock].data; struct knet_link *kn_link = info->link; err = getsockopt(connect_sock, SOL_SOCKET, SO_ERROR, &status, &len); if (err) { log_err(knet_h, KNET_SUB_TRANSP_SCTP, "SCTP getsockopt() on connecting socket %d failed: %s", connect_sock, strerror(errno)); return; } if (info->close_sock) { if (_close_connect_socket(knet_h, kn_link) < 0) { log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to close sock %d from _handle_connected_sctp: %s", connect_sock, strerror(errno)); return; } info->close_sock = 0; if (_create_connect_socket(knet_h, kn_link) < 0) { log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to recreate connecting sock! %s", strerror(errno)); return; } } if (status) { log_info(knet_h, KNET_SUB_TRANSP_SCTP, "SCTP connect on %d to %s port %s failed: %s", connect_sock, kn_link->status.dst_ipaddr, kn_link->status.dst_port, strerror(status)); /* * No need to create a new socket if connect failed, * just retry connect */ _reconnect_socket(knet_h, info->link); return; } /* * Connected - Remove us from the connect epoll */ memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLOUT; ev.data.fd = connect_sock; if (epoll_ctl(handle_info->connect_epollfd, EPOLL_CTL_DEL, connect_sock, &ev)) { log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to remove connected socket %d from epoll pool: %s", connect_sock, strerror(errno)); } info->on_connected_epoll = 0; kn_link->transport_connected = 1; kn_link->outsock = info->connect_sock; memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = connect_sock; if (epoll_ctl(knet_h->recv_from_links_epollfd, EPOLL_CTL_ADD, connect_sock, &ev)) { log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to add connected socket to epoll pool: %s", strerror(errno)); } info->on_rx_epoll = 1; log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "SCTP handler fd %d now connected to %s port %s", connect_sock, kn_link->status.dst_ipaddr, kn_link->status.dst_port); } static void _handle_connected_sctp_errors(knet_handle_t knet_h) { int sockfd = -1; sctp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_SCTP]; sctp_connect_link_info_t *info; if (recv(handle_info->connectsockfd[0], &sockfd, sizeof(int), MSG_DONTWAIT | MSG_NOSIGNAL) != sizeof(int)) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Short read on connectsockfd"); return; } if (_is_valid_fd(knet_h, sockfd) < 1) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Received stray notification for connected socket fd error"); return; } log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Processing connected error on socket: %d", sockfd); info = knet_h->knet_transport_fd_tracker[sockfd].data; info->close_sock = 1; info->link->transport_connected = 0; _reconnect_socket(knet_h, info->link); } static void *_sctp_connect_thread(void *data) { int savederrno; int i, nev; knet_handle_t knet_h = (knet_handle_t) data; sctp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_SCTP]; struct epoll_event events[KNET_EPOLL_MAX_EVENTS]; while (!shutdown_in_progress(knet_h)) { nev = epoll_wait(handle_info->connect_epollfd, events, KNET_EPOLL_MAX_EVENTS, -1); if (nev < 0) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "SCTP connect handler EPOLL ERROR: %s", strerror(errno)); continue; } /* * Sort out which FD has a connection */ savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock); if (savederrno) { log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to get write lock: %s", strerror(savederrno)); continue; } /* * minor optimization: deduplicate events * * in some cases we can receive multiple notifcations * of the same FD having issues or need handling. * It's enough to process it once even tho it's safe * to handle them multiple times. */ for (i = 0; i < nev; i++) { if (events[i].data.fd == handle_info->connectsockfd[0]) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Received notification from rx_error for connected socket"); _handle_connected_sctp_errors(knet_h); } else { if (_is_valid_fd(knet_h, events[i].data.fd) == 1) { _handle_connected_sctp(knet_h, events[i].data.fd); } else { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Received stray notification for dead fd %d\n", events[i].data.fd); } } } pthread_rwlock_unlock(&knet_h->global_rwlock); /* * this thread can generate events for itself. * we need to sleep in between loops to allow other threads * to be scheduled */ usleep(knet_h->reconnect_int * 1000); } return NULL; } /* * listen/incoming connections management thread */ /* * Listener received a new connection * called with a write lock from main thread */ static void _handle_incoming_sctp(knet_handle_t knet_h, int listen_sock) { int err = 0, savederrno = 0; int new_fd; int i = -1; sctp_listen_link_info_t *info = knet_h->knet_transport_fd_tracker[listen_sock].data; struct epoll_event ev; struct sockaddr_storage ss; socklen_t sock_len = sizeof(ss); char addr_str[KNET_MAX_HOST_LEN]; char port_str[KNET_MAX_PORT_LEN]; sctp_accepted_link_info_t *accept_info = NULL; new_fd = accept(listen_sock, (struct sockaddr *)&ss, &sock_len); if (new_fd < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Incoming: accept error: %s", strerror(errno)); goto exit_error; } if (knet_addrtostr(&ss, sizeof(ss), addr_str, KNET_MAX_HOST_LEN, port_str, KNET_MAX_PORT_LEN) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Incoming: unable to gather socket info"); goto exit_error; } log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Incoming: received connection from: %s port: %s", addr_str, port_str); /* * Keep a track of all accepted FDs */ for (i=0; iaccepted_socks[i] == -1) { info->accepted_socks[i] = new_fd; break; } } if (i == MAX_ACCEPTED_SOCKS) { errno = EBUSY; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Incoming: too many connections!"); goto exit_error; } if (_configure_common_socket(knet_h, new_fd, 0, "SCTP incoming") < 0) { /* Inherit flags from listener? */ savederrno = errno; err = -1; goto exit_error; } if (_enable_sctp_notifications(knet_h, new_fd, "Incoming connection") < 0) { savederrno = errno; err = -1; goto exit_error; } accept_info = malloc(sizeof(sctp_accepted_link_info_t)); if (!accept_info) { savederrno = errno; err = -1; goto exit_error; } memset(accept_info, 0, sizeof(sctp_accepted_link_info_t)); accept_info->link_info = info; if (_set_fd_tracker(knet_h, new_fd, KNET_TRANSPORT_SCTP, SCTP_ACCEPTED_LINK_INFO, accept_info) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to set fd tracker: %s", strerror(errno)); goto exit_error; } memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = new_fd; if (epoll_ctl(knet_h->recv_from_links_epollfd, EPOLL_CTL_ADD, new_fd, &ev)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Incoming: unable to add accepted socket %d to epoll pool: %s", new_fd, strerror(errno)); goto exit_error; } info->on_rx_epoll = 1; log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Incoming: accepted new fd %d for %s/%s (listen fd: %d). index: %d", new_fd, addr_str, port_str, info->listen_sock, i); exit_error: if (err) { if ((i >= 0) || (i < MAX_ACCEPTED_SOCKS)) { info->accepted_socks[i] = -1; } _set_fd_tracker(knet_h, new_fd, KNET_MAX_TRANSPORTS, SCTP_NO_LINK_INFO, NULL); free(accept_info); close(new_fd); } errno = savederrno; return; } /* * Listen thread received a notification of a bad socket that needs closing * called with a write lock from main thread */ static void _handle_listen_sctp_errors(knet_handle_t knet_h) { int sockfd = -1; sctp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_SCTP]; sctp_accepted_link_info_t *accept_info; sctp_listen_link_info_t *info; struct knet_host *host; int link_idx; int i; if (recv(handle_info->listensockfd[0], &sockfd, sizeof(int), MSG_DONTWAIT | MSG_NOSIGNAL) != sizeof(int)) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Short read on listensockfd"); return; } if (_is_valid_fd(knet_h, sockfd) < 1) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Received stray notification for listen socket fd error"); return; } log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Processing listen error on socket: %d", sockfd); accept_info = knet_h->knet_transport_fd_tracker[sockfd].data; info = accept_info->link_info; /* * clear all links using this accepted socket as * outbound dynamically connected socket */ for (host = knet_h->host_head; host != NULL; host = host->next) { for (link_idx = 0; link_idx < KNET_MAX_LINK; link_idx++) { if ((host->link[link_idx].dynamic == KNET_LINK_DYNIP) && (host->link[link_idx].outsock == sockfd)) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Found dynamic connection on host %d link %d (%d)", host->host_id, link_idx, sockfd); host->link[link_idx].status.dynconnected = 0; host->link[link_idx].transport_connected = 0; host->link[link_idx].outsock = 0; memset(&host->link[link_idx].dst_addr, 0, sizeof(struct sockaddr_storage)); } } } for (i=0; iaccepted_socks[i]) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Closing accepted socket %d", sockfd); _set_fd_tracker(knet_h, sockfd, KNET_MAX_TRANSPORTS, SCTP_NO_LINK_INFO, NULL); info->accepted_socks[i] = -1; free(accept_info); close(sockfd); } } } static void *_sctp_listen_thread(void *data) { int savederrno; int i, nev; knet_handle_t knet_h = (knet_handle_t) data; sctp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_SCTP]; struct epoll_event events[KNET_EPOLL_MAX_EVENTS]; while (!shutdown_in_progress(knet_h)) { nev = epoll_wait(handle_info->listen_epollfd, events, KNET_EPOLL_MAX_EVENTS, -1); if (nev < 0) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "SCTP listen handler EPOLL ERROR: %s", strerror(errno)); continue; } savederrno = pthread_rwlock_wrlock(&knet_h->global_rwlock); if (savederrno) { log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to get write lock: %s", strerror(savederrno)); continue; } /* * Sort out which FD has an incoming connection */ for (i = 0; i < nev; i++) { if (events[i].data.fd == handle_info->listensockfd[0]) { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Received notification from rx_error for listener/accepted socket"); _handle_listen_sctp_errors(knet_h); } else { if (_is_valid_fd(knet_h, events[i].data.fd) == 1) { _handle_incoming_sctp(knet_h, events[i].data.fd); } else { log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Received listen notification from invalid socket"); } } } pthread_rwlock_unlock(&knet_h->global_rwlock); } return NULL; } /* * sctp_link_listener_start/stop are called in global write lock * context from set_config and clear_config. */ static sctp_listen_link_info_t *sctp_link_listener_start(knet_handle_t knet_h, struct knet_link *kn_link) { int err = 0, savederrno = 0; int listen_sock = -1; struct epoll_event ev; sctp_listen_link_info_t *info = NULL; sctp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_SCTP]; /* * Only allocate a new listener if src address is different */ knet_list_for_each_entry(info, &handle_info->listen_links_list, list) { if (memcmp(&info->src_address, &kn_link->src_addr, sizeof(struct sockaddr_storage)) == 0) { return info; } } info = malloc(sizeof(sctp_listen_link_info_t)); if (!info) { err = -1; goto exit_error; } memset(info, 0, sizeof(sctp_listen_link_info_t)); memset(info->accepted_socks, -1, sizeof(info->accepted_socks)); memmove(&info->src_address, &kn_link->src_addr, sizeof(struct sockaddr_storage)); listen_sock = socket(kn_link->src_addr.ss_family, SOCK_STREAM, IPPROTO_SCTP); if (listen_sock < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to create listener socket: %s", strerror(savederrno)); goto exit_error; } if (_configure_sctp_socket(knet_h, listen_sock, &kn_link->src_addr, kn_link->flags, "SCTP listener") < 0) { savederrno = errno; err = -1; goto exit_error; } if (bind(listen_sock, (struct sockaddr *)&kn_link->src_addr, sockaddr_len(&kn_link->src_addr)) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to bind listener socket: %s", strerror(savederrno)); goto exit_error; } if (listen(listen_sock, 5) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to listen on listener socket: %s", strerror(savederrno)); goto exit_error; } if (_set_fd_tracker(knet_h, listen_sock, KNET_TRANSPORT_SCTP, SCTP_LISTENER_LINK_INFO, info) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to set fd tracker: %s", strerror(savederrno)); goto exit_error; } memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = listen_sock; if (epoll_ctl(handle_info->listen_epollfd, EPOLL_CTL_ADD, listen_sock, &ev)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to add listener to epoll pool: %s", strerror(savederrno)); goto exit_error; } info->on_listener_epoll = 1; info->listen_sock = listen_sock; knet_list_add(&info->list, &handle_info->listen_links_list); log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "Listening on fd %d for %s:%s", listen_sock, kn_link->status.src_ipaddr, kn_link->status.src_port); exit_error: if (err) { if (info->on_listener_epoll) { epoll_ctl(handle_info->listen_epollfd, EPOLL_CTL_DEL, listen_sock, &ev); } if (listen_sock >= 0) { close(listen_sock); } if (info) { free(info); info = NULL; } } errno = savederrno; return info; } static int sctp_link_listener_stop(knet_handle_t knet_h, struct knet_link *kn_link) { int err = 0, savederrno = 0; int found = 0, i; struct knet_host *host; int link_idx; sctp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_SCTP]; sctp_connect_link_info_t *this_link_info = kn_link->transport_link; sctp_listen_link_info_t *info = this_link_info->listener; sctp_connect_link_info_t *link_info; struct epoll_event ev; for (host = knet_h->host_head; host != NULL; host = host->next) { for (link_idx = 0; link_idx < KNET_MAX_LINK; link_idx++) { if (&host->link[link_idx] == kn_link) continue; link_info = host->link[link_idx].transport_link; if ((link_info) && (link_info->listener == info) && (host->link[link_idx].status.enabled == 1)) { found = 1; break; } } } if (found) { this_link_info->listener = NULL; log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "SCTP listener socket %d still in use", info->listen_sock); savederrno = EBUSY; err = -1; goto exit_error; } if (info->on_listener_epoll) { memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = info->listen_sock; if (epoll_ctl(handle_info->listen_epollfd, EPOLL_CTL_DEL, info->listen_sock, &ev)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to remove listener to epoll pool: %s", strerror(savederrno)); goto exit_error; } info->on_listener_epoll = 0; } if (_set_fd_tracker(knet_h, info->listen_sock, KNET_MAX_TRANSPORTS, SCTP_NO_LINK_INFO, NULL) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to set fd tracker: %s", strerror(savederrno)); goto exit_error; } close(info->listen_sock); for (i=0; i< MAX_ACCEPTED_SOCKS; i++) { if (info->accepted_socks[i] > -1) { memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = info->accepted_socks[i]; if (epoll_ctl(knet_h->recv_from_links_epollfd, EPOLL_CTL_DEL, info->accepted_socks[i], &ev)) { log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to remove EOFed socket from epoll pool: %s", strerror(errno)); } info->on_rx_epoll = 0; free(knet_h->knet_transport_fd_tracker[info->accepted_socks[i]].data); close(info->accepted_socks[i]); if (_set_fd_tracker(knet_h, info->accepted_socks[i], KNET_MAX_TRANSPORTS, SCTP_NO_LINK_INFO, NULL) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to set fd tracker: %s", strerror(savederrno)); goto exit_error; } info->accepted_socks[i] = -1; } } knet_list_del(&info->list); free(info); this_link_info->listener = NULL; exit_error: errno = savederrno; return err; } /* * Links config/clear. Both called with global wrlock from link_set_config/clear_config */ static int sctp_transport_link_set_config(knet_handle_t knet_h, struct knet_link *kn_link) { int savederrno = 0, err = 0; sctp_connect_link_info_t *info; sctp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_SCTP]; info = malloc(sizeof(sctp_connect_link_info_t)); if (!info) { goto exit_error; } memset(info, 0, sizeof(sctp_connect_link_info_t)); kn_link->transport_link = info; info->link = kn_link; memmove(&info->dst_address, &kn_link->dst_addr, sizeof(struct sockaddr_storage)); info->on_connected_epoll = 0; info->connect_sock = -1; info->listener = sctp_link_listener_start(knet_h, kn_link); if (!info->listener) { savederrno = errno; err = -1; goto exit_error; } if (kn_link->dynamic == KNET_LINK_STATIC) { if (_create_connect_socket(knet_h, kn_link) < 0) { savederrno = errno; err = -1; goto exit_error; } kn_link->outsock = info->connect_sock; } knet_list_add(&info->list, &handle_info->connect_links_list); exit_error: if (err) { if (info) { if (info->connect_sock) { close(info->connect_sock); } if (info->listener) { sctp_link_listener_stop(knet_h, kn_link); } kn_link->transport_link = NULL; free(info); } } errno = savederrno; return err; } /* * called with global wrlock */ static int sctp_transport_link_clear_config(knet_handle_t knet_h, struct knet_link *kn_link) { int err = 0, savederrno = 0; sctp_connect_link_info_t *info; struct epoll_event ev; if (!kn_link) { errno = EINVAL; return -1; } info = kn_link->transport_link; if (!info) { errno = EINVAL; return -1; } if ((sctp_link_listener_stop(knet_h, kn_link) <0) && (errno != EBUSY)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to remove listener trasport: %s", strerror(savederrno)); goto exit_error; } if (info->on_rx_epoll) { memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = info->connect_sock; if (epoll_ctl(knet_h->recv_from_links_epollfd, EPOLL_CTL_DEL, info->connect_sock, &ev)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to remove connected socket from epoll pool: %s", strerror(savederrno)); goto exit_error; } info->on_rx_epoll = 0; } if (_close_connect_socket(knet_h, kn_link) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to close connected socket: %s", strerror(savederrno)); goto exit_error; } knet_list_del(&info->list); free(info); kn_link->transport_link = NULL; exit_error: errno = savederrno; return err; } /* * transport_free and transport_init are * called only from knet_handle_new and knet_handle_free. * all resources (hosts/links) should have been already freed at this point * and they are called in a write locked context, hence they * don't need their own locking. */ static int sctp_transport_free(knet_handle_t knet_h) { sctp_handle_info_t *handle_info; void *thread_status; struct epoll_event ev; if (!knet_h->transports[KNET_TRANSPORT_SCTP]) { errno = EINVAL; return -1; } handle_info = knet_h->transports[KNET_TRANSPORT_SCTP]; /* * keep it here while we debug list usage and such */ if (!knet_list_empty(&handle_info->listen_links_list)) { log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Internal error. listen links list is not empty"); } if (!knet_list_empty(&handle_info->connect_links_list)) { log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Internal error. connect links list is not empty"); } if (handle_info->listen_thread) { pthread_cancel(handle_info->listen_thread); pthread_join(handle_info->listen_thread, &thread_status); } if (handle_info->connect_thread) { pthread_cancel(handle_info->connect_thread); pthread_join(handle_info->connect_thread, &thread_status); } if (handle_info->listensockfd[0] >= 0) { memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = handle_info->listensockfd[0]; epoll_ctl(handle_info->listen_epollfd, EPOLL_CTL_DEL, handle_info->listensockfd[0], &ev); } if (handle_info->connectsockfd[0] >= 0) { memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = handle_info->connectsockfd[0]; epoll_ctl(handle_info->connect_epollfd, EPOLL_CTL_DEL, handle_info->connectsockfd[0], &ev); } _close_socketpair(knet_h, handle_info->connectsockfd); _close_socketpair(knet_h, handle_info->listensockfd); if (handle_info->listen_epollfd >= 0) { close(handle_info->listen_epollfd); } if (handle_info->connect_epollfd >= 0) { close(handle_info->connect_epollfd); } free(handle_info); knet_h->transports[KNET_TRANSPORT_SCTP] = NULL; return 0; } static int sctp_transport_init(knet_handle_t knet_h) { int err = 0, savederrno = 0; sctp_handle_info_t *handle_info; struct epoll_event ev; if (knet_h->transports[KNET_TRANSPORT_SCTP]) { errno = EEXIST; return -1; } handle_info = malloc(sizeof(sctp_handle_info_t)); if (!handle_info) { return -1; } memset(handle_info, 0,sizeof(sctp_handle_info_t)); knet_h->transports[KNET_TRANSPORT_SCTP] = handle_info; knet_list_init(&handle_info->listen_links_list); knet_list_init(&handle_info->connect_links_list); handle_info->listen_epollfd = epoll_create(KNET_EPOLL_MAX_EVENTS + 1); if (handle_info->listen_epollfd < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to create epoll listen fd: %s", strerror(savederrno)); goto exit_fail; } if (_fdset_cloexec(handle_info->listen_epollfd)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to set CLOEXEC on listen_epollfd: %s", strerror(savederrno)); goto exit_fail; } handle_info->connect_epollfd = epoll_create(KNET_EPOLL_MAX_EVENTS + 1); if (handle_info->connect_epollfd < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to create epoll connect fd: %s", strerror(savederrno)); goto exit_fail; } if (_fdset_cloexec(handle_info->connect_epollfd)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to set CLOEXEC on connect_epollfd: %s", strerror(savederrno)); goto exit_fail; } if (_init_socketpair(knet_h, handle_info->connectsockfd) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to init connect socketpair: %s", strerror(savederrno)); goto exit_fail; } memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = handle_info->connectsockfd[0]; if (epoll_ctl(handle_info->connect_epollfd, EPOLL_CTL_ADD, handle_info->connectsockfd[0], &ev)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to add connectsockfd[0] to connect epoll pool: %s", strerror(savederrno)); goto exit_fail; } if (_init_socketpair(knet_h, handle_info->listensockfd) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to init listen socketpair: %s", strerror(savederrno)); goto exit_fail; } memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = handle_info->listensockfd[0]; if (epoll_ctl(handle_info->listen_epollfd, EPOLL_CTL_ADD, handle_info->listensockfd[0], &ev)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to add listensockfd[0] to listen epoll pool: %s", strerror(savederrno)); goto exit_fail; } /* * Start connect & listener threads */ savederrno = pthread_create(&handle_info->listen_thread, 0, _sctp_listen_thread, (void *) knet_h); if (savederrno) { err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to start sctp listen thread: %s", strerror(savederrno)); goto exit_fail; } savederrno = pthread_create(&handle_info->connect_thread, 0, _sctp_connect_thread, (void *) knet_h); if (savederrno) { err = -1; log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to start sctp connect thread: %s", strerror(savederrno)); goto exit_fail; } exit_fail: if (err < 0) { sctp_transport_free(knet_h); } errno = savederrno; return err; } static int sctp_transport_link_dyn_connect(knet_handle_t knet_h, int sockfd, struct knet_link *kn_link) { kn_link->outsock = sockfd; kn_link->status.dynconnected = 1; kn_link->transport_connected = 1; return 0; } static knet_transport_ops_t sctp_transport_ops = { .transport_name = "SCTP", .transport_id = KNET_TRANSPORT_SCTP, .transport_mtu_overhead = KNET_PMTUD_SCTP_OVERHEAD, .transport_init = sctp_transport_init, .transport_free = sctp_transport_free, .transport_link_set_config = sctp_transport_link_set_config, .transport_link_clear_config = sctp_transport_link_clear_config, .transport_link_dyn_connect = sctp_transport_link_dyn_connect, .transport_rx_sock_error = sctp_transport_rx_sock_error, .transport_tx_sock_error = sctp_transport_tx_sock_error, .transport_rx_is_data = sctp_transport_rx_is_data, }; knet_transport_ops_t *get_sctp_transport() { return &sctp_transport_ops; } #else // HAVE_NETINET_SCTP_H knet_transport_ops_t *get_sctp_transport() { return NULL; } #endif diff --git a/libknet/transport_udp.c b/libknet/transport_udp.c index 2c0a81cc..d5dd7058 100644 --- a/libknet/transport_udp.c +++ b/libknet/transport_udp.c @@ -1,408 +1,416 @@ +/* + * Copyright (C) 2016-2017 Red Hat, Inc. All rights reserved. + * + * Author: Christine Caulfield + * + * This software licensed under GPL-2.0+, LGPL-2.0+ + */ + #include "config.h" #include #include #include #include #include #include #include #include #include #if defined (IP_RECVERR) || defined (IPV6_RECVERR) #include #endif #include "libknet.h" #include "compat.h" #include "host.h" #include "link.h" #include "logging.h" #include "common.h" #include "transports.h" #include "threads_common.h" #define KNET_PMTUD_UDP_OVERHEAD 8 typedef struct udp_handle_info { struct knet_list_head links_list; } udp_handle_info_t; typedef struct udp_link_info { struct knet_list_head list; struct sockaddr_storage local_address; int socket_fd; int on_epoll; } udp_link_info_t; static int udp_transport_link_set_config(knet_handle_t knet_h, struct knet_link *kn_link) { int err = 0, savederrno = 0; int sock = -1; struct epoll_event ev; udp_link_info_t *info; udp_handle_info_t *handle_info = knet_h->transports[KNET_TRANSPORT_UDP]; #if defined (IP_RECVERR) || defined (IPV6_RECVERR) int value; #endif /* * Only allocate a new link if the local address is different */ knet_list_for_each_entry(info, &handle_info->links_list, list) { if (memcmp(&info->local_address, &kn_link->src_addr, sizeof(struct sockaddr_storage)) == 0) { log_debug(knet_h, KNET_SUB_TRANSP_UDP, "Re-using existing UDP socket for new link"); kn_link->outsock = info->socket_fd; kn_link->transport_link = info; kn_link->transport_connected = 1; return 0; } } info = malloc(sizeof(udp_link_info_t)); if (!info) { err = -1; goto exit_error; } sock = socket(kn_link->src_addr.ss_family, SOCK_DGRAM, 0); if (sock < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_LISTENER, "Unable to create listener socket: %s", strerror(savederrno)); goto exit_error; } if (_configure_transport_socket(knet_h, sock, &kn_link->src_addr, kn_link->flags, "UDP") < 0) { savederrno = errno; err = -1; goto exit_error; } #ifdef IP_RECVERR if (kn_link->src_addr.ss_family == AF_INET) { value = 1; if (setsockopt(sock, SOL_IP, IP_RECVERR, &value, sizeof(value)) <0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_UDP, "Unable to set RECVERR on socket: %s", strerror(savederrno)); goto exit_error; } } #endif #ifdef IPV6_RECVERR if (kn_link->src_addr.ss_family == AF_INET6) { value = 1; if (setsockopt(sock, SOL_IPV6, IPV6_RECVERR, &value, sizeof(value)) <0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_UDP, "Unable to set RECVERR on socket: %s", strerror(savederrno)); goto exit_error; } } #endif if (bind(sock, (struct sockaddr *)&kn_link->src_addr, sockaddr_len(&kn_link->src_addr))) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_UDP, "Unable to bind listener socket: %s", strerror(savederrno)); goto exit_error; } memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = sock; if (epoll_ctl(knet_h->recv_from_links_epollfd, EPOLL_CTL_ADD, sock, &ev)) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_UDP, "Unable to add listener to epoll pool: %s", strerror(savederrno)); goto exit_error; } info->on_epoll = 1; if (_set_fd_tracker(knet_h, sock, KNET_TRANSPORT_UDP, 0, info) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_UDP, "Unable to set fd tracker: %s", strerror(savederrno)); goto exit_error; } memmove(&info->local_address, &kn_link->src_addr, sizeof(struct sockaddr_storage)); info->socket_fd = sock; knet_list_add(&info->list, &handle_info->links_list); kn_link->outsock = sock; kn_link->transport_link = info; kn_link->transport_connected = 1; exit_error: if (err) { if (info) { if (info->on_epoll) { epoll_ctl(knet_h->recv_from_links_epollfd, EPOLL_CTL_DEL, sock, &ev); } free(info); } if (sock >= 0) { close(sock); } } errno = savederrno; return err; } static int udp_transport_link_clear_config(knet_handle_t knet_h, struct knet_link *kn_link) { int err = 0, savederrno = 0; int found = 0; struct knet_host *host; int link_idx; udp_link_info_t *info = kn_link->transport_link; struct epoll_event ev; for (host = knet_h->host_head; host != NULL; host = host->next) { for (link_idx = 0; link_idx < KNET_MAX_LINK; link_idx++) { if (&host->link[link_idx] == kn_link) continue; if ((host->link[link_idx].transport_link == info) && (host->link[link_idx].status.enabled == 1)) { found = 1; break; } } } if (found) { log_debug(knet_h, KNET_SUB_TRANSP_UDP, "UDP socket %d still in use", info->socket_fd); savederrno = EBUSY; err = -1; goto exit_error; } if (info->on_epoll) { memset(&ev, 0, sizeof(struct epoll_event)); ev.events = EPOLLIN; ev.data.fd = info->socket_fd; if (epoll_ctl(knet_h->recv_from_links_epollfd, EPOLL_CTL_DEL, info->socket_fd, &ev) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_UDP, "Unable to remove UDP socket from epoll poll: %s", strerror(errno)); goto exit_error; } info->on_epoll = 0; } if (_set_fd_tracker(knet_h, info->socket_fd, KNET_MAX_TRANSPORTS, 0, NULL) < 0) { savederrno = errno; err = -1; log_err(knet_h, KNET_SUB_TRANSP_UDP, "Unable to set fd tracker: %s", strerror(savederrno)); goto exit_error; } close(info->socket_fd); knet_list_del(&info->list); free(kn_link->transport_link); exit_error: errno = savederrno; return err; } static int udp_transport_free(knet_handle_t knet_h) { udp_handle_info_t *handle_info; if (!knet_h->transports[KNET_TRANSPORT_UDP]) { errno = EINVAL; return -1; } handle_info = knet_h->transports[KNET_TRANSPORT_UDP]; /* * keep it here while we debug list usage and such */ if (!knet_list_empty(&handle_info->links_list)) { log_err(knet_h, KNET_SUB_TRANSP_UDP, "Internal error. handle list is not empty"); return -1; } free(handle_info); knet_h->transports[KNET_TRANSPORT_UDP] = NULL; return 0; } static int udp_transport_init(knet_handle_t knet_h) { udp_handle_info_t *handle_info; if (knet_h->transports[KNET_TRANSPORT_UDP]) { errno = EEXIST; return -1; } handle_info = malloc(sizeof(udp_handle_info_t)); if (!handle_info) { return -1; } memset(handle_info, 0, sizeof(udp_handle_info_t)); knet_h->transports[KNET_TRANSPORT_UDP] = handle_info; knet_list_init(&handle_info->links_list); return 0; } #if defined (IP_RECVERR) || defined (IPV6_RECVERR) static int read_errs_from_sock(knet_handle_t knet_h, int sockfd) { int err = 0, savederrno = 0; int got_err = 0; char buffer[1024]; struct iovec iov; struct msghdr msg; struct cmsghdr *cmsg; struct sock_extended_err *sock_err; struct icmphdr icmph; struct sockaddr_storage remote; struct sockaddr_storage *origin; char addr_str[KNET_MAX_HOST_LEN]; char port_str[KNET_MAX_PORT_LEN]; iov.iov_base = &icmph; iov.iov_len = sizeof(icmph); msg.msg_name = (void*)&remote; msg.msg_namelen = sizeof(remote); msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_flags = 0; msg.msg_control = buffer; msg.msg_controllen = sizeof(buffer); for (;;) { err = recvmsg(sockfd, &msg, MSG_ERRQUEUE); savederrno = errno; if (err < 0) { if (!got_err) { errno = savederrno; return -1; } else { return 0; } } got_err = 1; for (cmsg = CMSG_FIRSTHDR(&msg);cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) { if (((cmsg->cmsg_level == SOL_IP) && (cmsg->cmsg_type == IP_RECVERR)) || ((cmsg->cmsg_level == SOL_IPV6 && (cmsg->cmsg_type == IPV6_RECVERR)))) { sock_err = (struct sock_extended_err*)(void *)CMSG_DATA(cmsg); if (sock_err) { switch (sock_err->ee_origin) { case 0: /* no origin */ case 1: /* local source (EMSGSIZE) */ /* * those errors are way too noisy */ break; case 2: /* ICMP */ case 3: /* ICMP6 */ origin = (struct sockaddr_storage *)(void *)SO_EE_OFFENDER(sock_err); if (knet_addrtostr(origin, sizeof(origin), addr_str, KNET_MAX_HOST_LEN, port_str, KNET_MAX_PORT_LEN) < 0) { log_debug(knet_h, KNET_SUB_TRANSP_UDP, "Received ICMP error from unknown source: %s", strerror(sock_err->ee_errno)); } else { log_debug(knet_h, KNET_SUB_TRANSP_UDP, "Received ICMP error from %s: %s", addr_str, strerror(sock_err->ee_errno)); } break; } } else { log_debug(knet_h, KNET_SUB_TRANSP_UDP, "No data in MSG_ERRQUEUE"); } } } } } #else static int read_errs_from_sock(knet_handle_t knet_h, int sockfd) { return 0; } #endif static int udp_transport_rx_sock_error(knet_handle_t knet_h, int sockfd, int recv_err, int recv_errno) { if (recv_errno == EAGAIN) { read_errs_from_sock(knet_h, sockfd); } return 0; } static int udp_transport_tx_sock_error(knet_handle_t knet_h, int sockfd, int recv_err, int recv_errno) { if (recv_err < 0) { if (recv_errno == EMSGSIZE) { return 0; } if ((recv_errno == ENOBUFS) || (recv_errno == EAGAIN)) { #ifdef DEBUG log_debug(knet_h, KNET_SUB_TRANSP_UDP, "Sock: %d is overloaded. Slowing TX down", sockfd); #endif usleep(KNET_THREADS_TIMERES / 16); } else { read_errs_from_sock(knet_h, sockfd); } return 1; } return 0; } static int udp_transport_rx_is_data(knet_handle_t knet_h, int sockfd, struct knet_mmsghdr *msg) { if (msg->msg_len == 0) return 0; return 2; } static int udp_transport_link_dyn_connect(knet_handle_t knet_h, int sockfd, struct knet_link *kn_link) { kn_link->status.dynconnected = 1; return 0; } static knet_transport_ops_t udp_transport_ops = { .transport_name = "UDP", .transport_id = KNET_TRANSPORT_UDP, .transport_mtu_overhead = KNET_PMTUD_UDP_OVERHEAD, .transport_init = udp_transport_init, .transport_free = udp_transport_free, .transport_link_set_config = udp_transport_link_set_config, .transport_link_clear_config = udp_transport_link_clear_config, .transport_link_dyn_connect = udp_transport_link_dyn_connect, .transport_rx_sock_error = udp_transport_rx_sock_error, .transport_tx_sock_error = udp_transport_tx_sock_error, .transport_rx_is_data = udp_transport_rx_is_data, }; knet_transport_ops_t *get_udp_transport() { return &udp_transport_ops; } diff --git a/libtap/api-test-coverage b/libtap/api-test-coverage index b2c9c97f..0e544611 100755 --- a/libtap/api-test-coverage +++ b/libtap/api-test-coverage @@ -1,42 +1,49 @@ -#!/bin/bash +#!/bin/sh +# +# Copyright (C) 2016-2017 Red Hat, Inc. All rights reserved. +# +# Author: Fabio M. Di Nitto +# +# This software licensed under GPL-2.0+, LGPL-2.0+ +# srcdir="$1"/libtap builddir="$2"/libtap headerapicalls="$(grep tap_ "$srcdir"/libtap.h | grep -v "^ \*" | grep -v ^struct | grep -v "^[[:space:]]" | grep -v typedef | sed -e 's/(.*//g' -e 's/^const //g' -e 's/\*//g' | awk '{print $2}')" exportedapicalls="$(nm -B -D "$builddir"/.libs/libtap.so | grep ' T ' | awk '{print $3}')" echo "Checking for exported symbols NOT available in header file" for i in $exportedapicalls; do found=0 for x in $headerapicalls; do if [ "$x" = "$i" ]; then found=1 break; fi done if [ "$found" = 0 ]; then echo "Symbol $i not found in header file" exit 1 fi done echo "Checking for symbols in header file NOT exported by binary lib" for i in $headerapicalls; do found=0 for x in $exportedapicalls; do if [ "$x" = "$i" ]; then found=1 break; fi done if [ "$found" = 0 ]; then echo "Symbol $i not found in binary lib" exit 1 fi done exit 0 diff --git a/libtap/libtap_exported_syms b/libtap/libtap_exported_syms index 77a3dbb7..f07f8ef3 100644 --- a/libtap/libtap_exported_syms +++ b/libtap/libtap_exported_syms @@ -1,6 +1,15 @@ -Base { +# Version and symbol export for libtap.so +# +# Copyright (C) 2011-2017 Red Hat, Inc. All rights reserved. +# +# Author: Fabio M. Di Nitto +# +# This software licensed under GPL-2.0+, LGPL-2.0+ +# + +LIBTAP { global: tap_*; local: *; }; diff --git a/poc-code/access-list/ipcheck.c b/poc-code/access-list/ipcheck.c index c151e440..313092a6 100644 --- a/poc-code/access-list/ipcheck.c +++ b/poc-code/access-list/ipcheck.c @@ -1,210 +1,218 @@ +/* + * Copyright (C) 2016-2017 Red Hat, Inc. All rights reserved. + * + * Author: Christine Caulfield + * + * This software licensed under GPL-2.0+, LGPL-2.0+ + */ + #include #include #include #include #include #include "ipcheck.h" struct ip_match_entry { ipcheck_type_t type; ipcheck_acceptreject_t acceptreject; struct sockaddr_storage addr1; /* Actual IP address, mask top or low IP */ struct sockaddr_storage addr2; /* high IP address or address bitmask */ struct ip_match_entry *next; }; /* Lists of things to match against. These are dummy structs to provide a quick list head */ static struct ip_match_entry match_entry_head_v4; static struct ip_match_entry match_entry_head_v6; /* * IPv4 See if the address we have matches the current match entry * */ static int ip_matches_v4(struct sockaddr_storage *checkip, struct ip_match_entry *match_entry) { struct sockaddr_in *ip_to_check; struct sockaddr_in *match1; struct sockaddr_in *match2; ip_to_check = (struct sockaddr_in *)checkip; match1 = (struct sockaddr_in *)&match_entry->addr1; match2 = (struct sockaddr_in *)&match_entry->addr2; switch(match_entry->type) { case IPCHECK_TYPE_ADDRESS: if (ip_to_check->sin_addr.s_addr == match1->sin_addr.s_addr) return 1; break; case IPCHECK_TYPE_MASK: if ((ip_to_check->sin_addr.s_addr & match2->sin_addr.s_addr) == match1->sin_addr.s_addr) return 1; break; case IPCHECK_TYPE_RANGE: if ((ntohl(ip_to_check->sin_addr.s_addr) >= ntohl(match1->sin_addr.s_addr)) && (ntohl(ip_to_check->sin_addr.s_addr) <= ntohl(match2->sin_addr.s_addr))) return 1; break; } return 0; } /* Compare two IPv6 addresses */ static int ip6addr_cmp(struct in6_addr *a, struct in6_addr *b) { uint64_t a_high, a_low; uint64_t b_high, b_low; /* Not sure why '&' doesn't work below, so I used '+' instead which is effectively the same thing because the bottom 32bits are always zero and the value unsigned */ a_high = ((uint64_t)htonl(a->s6_addr32[0]) << 32) + (uint64_t)htonl(a->s6_addr32[1]); a_low = ((uint64_t)htonl(a->s6_addr32[2]) << 32) + (uint64_t)htonl(a->s6_addr32[3]); b_high = ((uint64_t)htonl(b->s6_addr32[0]) << 32) + (uint64_t)htonl(b->s6_addr32[1]); b_low = ((uint64_t)htonl(b->s6_addr32[2]) << 32) + (uint64_t)htonl(b->s6_addr32[3]); if (a_high > b_high) return 1; if (a_high < b_high) return -1; if (a_low > b_low) return 1; if (a_low < b_low) return -1; return 0; } /* * IPv6 See if the address we have matches the current match entry * */ static int ip_matches_v6(struct sockaddr_storage *checkip, struct ip_match_entry *match_entry) { struct sockaddr_in6 *ip_to_check; struct sockaddr_in6 *match1; struct sockaddr_in6 *match2; int i; ip_to_check = (struct sockaddr_in6 *)checkip; match1 = (struct sockaddr_in6 *)&match_entry->addr1; match2 = (struct sockaddr_in6 *)&match_entry->addr2; switch(match_entry->type) { case IPCHECK_TYPE_ADDRESS: if (!memcmp(ip_to_check->sin6_addr.s6_addr32, match1->sin6_addr.s6_addr32, sizeof(struct in6_addr))) return 1; break; case IPCHECK_TYPE_MASK: /* * Note that this little loop will quit early if there is a non-match so the * comparison might look backwards compared to the IPv4 one */ for (i=sizeof(struct in6_addr)/4-1; i>=0; i--) { if ((ip_to_check->sin6_addr.s6_addr32[i] & match2->sin6_addr.s6_addr32[i]) != match1->sin6_addr.s6_addr32[i]) return 0; } return 1; case IPCHECK_TYPE_RANGE: if ((ip6addr_cmp(&ip_to_check->sin6_addr, &match1->sin6_addr) >= 0) && (ip6addr_cmp(&ip_to_check->sin6_addr, &match2->sin6_addr) <= 0)) return 1; break; } return 0; } /* * YOU ARE HERE */ int ipcheck_validate(struct sockaddr_storage *checkip) { struct ip_match_entry *match_entry; int (*match_fn)(struct sockaddr_storage *checkip, struct ip_match_entry *match_entry); if (checkip->ss_family == AF_INET){ match_entry = match_entry_head_v4.next; match_fn = ip_matches_v4; } else { match_entry = match_entry_head_v6.next; match_fn = ip_matches_v6; } while (match_entry) { if (match_fn(checkip, match_entry)) { if (match_entry->acceptreject == IPCHECK_ACCEPT) return 1; else return 0; } match_entry = match_entry->next; } return 0; /* Default reject */ } /* * Routines to manuipulate the lists */ void ipcheck_clear(void) { struct ip_match_entry *match_entry; struct ip_match_entry *next_match_entry; match_entry = match_entry_head_v4.next; while (match_entry) { next_match_entry = match_entry->next; free(match_entry); match_entry = next_match_entry; } match_entry = match_entry_head_v6.next; while (match_entry) { next_match_entry = match_entry->next; free(match_entry); match_entry = next_match_entry; } } int ipcheck_addip(struct sockaddr_storage *ip1, struct sockaddr_storage *ip2, ipcheck_type_t type, ipcheck_acceptreject_t acceptreject) { struct ip_match_entry *match_entry; struct ip_match_entry *new_match_entry; if (type == IPCHECK_TYPE_RANGE && (ip1->ss_family != ip2->ss_family)) return -1; if (ip1->ss_family == AF_INET){ match_entry = &match_entry_head_v4; } else { match_entry = &match_entry_head_v6; } new_match_entry = malloc(sizeof(struct ip_match_entry)); if (!new_match_entry) return -1; memmove(&new_match_entry->addr1, ip1, sizeof(struct sockaddr_storage)); memmove(&new_match_entry->addr2, ip2, sizeof(struct sockaddr_storage)); new_match_entry->type = type; new_match_entry->acceptreject = acceptreject; new_match_entry->next = NULL; /* Find the end of the list */ /* is this OK, or should we use a doubly-linked list or bulk-load API call? */ while (match_entry->next) { match_entry = match_entry->next; } match_entry->next = new_match_entry; return 0; } diff --git a/poc-code/access-list/ipcheck.h b/poc-code/access-list/ipcheck.h index c7b3fee6..8341e69d 100644 --- a/poc-code/access-list/ipcheck.h +++ b/poc-code/access-list/ipcheck.h @@ -1,10 +1,16 @@ - +/* + * Copyright (C) 2016-2017 Red Hat, Inc. All rights reserved. + * + * Author: Christine Caulfield + * + * This software licensed under GPL-2.0+, LGPL-2.0+ + */ typedef enum {IPCHECK_TYPE_ADDRESS, IPCHECK_TYPE_MASK, IPCHECK_TYPE_RANGE} ipcheck_type_t; typedef enum {IPCHECK_ACCEPT, IPCHECK_REJECT} ipcheck_acceptreject_t; int ipcheck_validate(struct sockaddr_storage *checkip); void ipcheck_clear(void); int ipcheck_addip(struct sockaddr_storage *ip1, struct sockaddr_storage *ip2, ipcheck_type_t type, ipcheck_acceptreject_t acceptreject); diff --git a/poc-code/access-list/test_ipcheck.c b/poc-code/access-list/test_ipcheck.c index 520e2aac..ff6e2e51 100644 --- a/poc-code/access-list/test_ipcheck.c +++ b/poc-code/access-list/test_ipcheck.c @@ -1,185 +1,193 @@ +/* + * Copyright (C) 2016-2017 Red Hat, Inc. All rights reserved. + * + * Author: Christine Caulfield + * + * This software licensed under GPL-2.0+, LGPL-2.0+ + */ + #include #include #include #include #include #include #include #include #include "ipcheck.h" /* This is a test program .. remember! */ #define BUFLEN 1024 static int get_ipaddress(char *buf, struct sockaddr_storage *addr) { struct addrinfo *info; struct addrinfo hints; int res; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; res = getaddrinfo(buf, NULL, &hints, &info); if (!res) { memmove(addr, info->ai_addr, info->ai_addrlen); free(info); } return res; } static int read_address(char *buf, struct sockaddr_storage *addr) { return get_ipaddress(buf, addr); } static int read_mask(char *buf, struct sockaddr_storage *addr, struct sockaddr_storage *addr2) { char tmpbuf[BUFLEN]; char *slash; int ret; slash = strchr(buf, '/'); if (!slash) return 1; strncpy(tmpbuf, buf, slash-buf); tmpbuf[slash-buf] = '\0'; ret = get_ipaddress(tmpbuf, addr); if (ret) return ret; ret = get_ipaddress(slash+1, addr2); if (ret) return ret; return 0; } static int read_range(char *buf, struct sockaddr_storage *addr1, struct sockaddr_storage *addr2) { char tmpbuf[BUFLEN]; char *hyphen; int ret; hyphen = strchr(buf, '-'); if (!hyphen) return 1; strncpy(tmpbuf, buf, hyphen-buf); tmpbuf[hyphen-buf] = '\0'; ret = get_ipaddress(tmpbuf, addr1); if (ret) return ret; ret = get_ipaddress(hyphen+1, addr2); if (ret) return ret; return 0; } static int load_file(void) { FILE *filterfile; char filebuf[BUFLEN]; int line = 0; int ret; ipcheck_type_t type; ipcheck_acceptreject_t acceptreject; struct sockaddr_storage addr1; struct sockaddr_storage addr2; ipcheck_clear(); filterfile = fopen("test_ipcheck.txt", "r"); if (!filterfile) { fprintf(stderr, "Cannot open test_ipcheck.txt\n"); return 1; } while (fgets(filebuf, sizeof(filebuf), filterfile)) { filebuf[strlen(filebuf)-1] = '\0'; /* remove trailing LF */ line++; /* * First char is A (accept) or R (Reject) */ switch(filebuf[0] & 0x5F) { case 'A': acceptreject = IPCHECK_ACCEPT; break; case 'R': acceptreject = IPCHECK_REJECT; break; default: fprintf(stderr, "Unknown record type on line %d: %s\n", line, filebuf); goto next_record; } /* * Second char is the filter type: * A Address * M Mask * R Range */ switch(filebuf[1] & 0x5F) { case 'A': type = IPCHECK_TYPE_ADDRESS; ret = read_address(filebuf+2, &addr1); break; case 'M': type = IPCHECK_TYPE_MASK; ret = read_mask(filebuf+2, &addr1, &addr2); break; case 'R': type = IPCHECK_TYPE_RANGE; ret = read_range(filebuf+2, &addr1, &addr2); break; default: fprintf(stderr, "Unknown filter type on line %d: %s\n", line, filebuf); goto next_record; break; } if (ret) { fprintf(stderr, "Failed to parse address on line %d: %s\n", line, filebuf); } else { ipcheck_addip(&addr1, &addr2, type, acceptreject); } next_record: {} /* empty statement to mollify the compiler */ } fclose(filterfile); return 0; } int main(int argc, char *argv[]) { struct sockaddr_storage saddr; int ret; int i; if (load_file()) return 1; for (i=1; i + * + * This software licensed under GPL-2.0+, LGPL-2.0+ + */ + /* Example code to illustrate DES enccryption/decryption using NSS. * The example skips the details of obtaining the Key & IV to use, and * just uses a hardcoded Key & IV. * Note: IV is only needed if Cipher Blocking Chaining (CBC) mode of encryption * is used * * The recommended approach is to store and transport WRAPPED (encrypted) * DES Keys (IVs can be in the clear). However, it is a common (and dangerous) * practice to use raw DES Keys. This example shows the use of a RAW key. */ #ifdef BUILDCRYPTONSS #include #include #include #include /* example Key & IV */ unsigned char gKey[] = {0xe8, 0xa7, 0x7c, 0xe2, 0x05, 0x63, 0x6a, 0x31}; unsigned char gIV[] = {0xe4, 0xbb, 0x3b, 0xd3, 0xc3, 0x71, 0x2e, 0x58}; int main(int argc, char **argv) { CK_MECHANISM_TYPE hashMech; PK11SlotInfo* slot = NULL; PK11SymKey* SymKey = NULL; SECItem SecParam; PK11Context* HashContext = NULL; SECItem keyItem; SECStatus rv, rv1, rv2; unsigned char buf1[1024], buf2[1024]; char data[1024]; unsigned int i; unsigned int tmp2_outlen; /* Initialize NSS * * If your application code has already initialized NSS, you can skip it * * here. * * This code uses the simplest of the Init functions, which does not * * require a NSS database to exist * */ rv = NSS_NoDB_Init("."); if (rv != SECSuccess) { fprintf(stderr, "NSS initialization failed (err %d)\n", PR_GetError()); goto out; } /* choose mechanism: CKM_DES_CBC_PAD, CKM_DES3_ECB, CKM_DES3_CBC..... * * Note that some mechanisms (*_PAD) imply the padding is handled for you * * by NSS. If you choose something else, then data padding is the * * application's responsibility * */ hashMech = CKM_SHA_1_HMAC; slot = PK11_GetBestSlot(hashMech, NULL); /* slot = PK11_GetInternalKeySlot(); is a simpler alternative but in * * theory, it *may not* return the optimal slot for the operation. For * * DES ops, Internal slot is typically the best slot * */ if (slot == NULL) { fprintf(stderr, "Unable to find security device (err %d)\n", PR_GetError()); goto out; } /* NSS passes blobs around as SECItems. These contain a pointer to * * data and a length. Turn the raw key into a SECItem. */ keyItem.type = siBuffer; keyItem.data = gKey; keyItem.len = sizeof(gKey); /* Turn the raw key into a key object. We use PK11_OriginUnwrap * * to indicate the key was unwrapped - which is what should be done * * normally anyway - using raw keys isn't a good idea */ SymKey = PK11_ImportSymKey(slot, hashMech, PK11_OriginUnwrap, CKA_SIGN, &keyItem, NULL); if (SymKey == NULL) { fprintf(stderr, "Failure to import key into NSS (err %d)\n", PR_GetError()); goto out; } SecParam.type = siBuffer; SecParam.data = 0; SecParam.len = 0; /* sample data we'll hash */ strcpy(data, "Hash me!"); fprintf(stderr, "Clear Data: %s\n", data); /* ========================= START SECTION ============================= */ /* If using the the same key and iv over and over, stuff before this */ /* section and after this section needs to be done only ONCE */ /* Create cipher context */ HashContext = PK11_CreateContextBySymKey(hashMech, CKA_SIGN, SymKey, &SecParam); if (!HashContext) { fprintf(stderr, "no hash context today?\n"); goto out; } if (PK11_DigestBegin(HashContext) != SECSuccess) { fprintf(stderr, "hash doesn't begin?\n"); goto out; } rv1 = PK11_DigestOp(HashContext, (unsigned char *)data, strlen(data)+1); rv2 = PK11_DigestFinal(HashContext, buf2, &tmp2_outlen, SHA1_BLOCK_LENGTH); PK11_DestroyContext(HashContext, PR_TRUE); if (rv1 != SECSuccess || rv2 != SECSuccess) goto out; fprintf(stderr, "Hash Data: "); for (i=0; i int main(void) { printf("you need nss build for this PoC to work\n"); return 0; } #endif