summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am47
-rw-r--r--include/Makefile.in646
-rw-r--r--include/corosync/cfg.h315
-rw-r--r--include/corosync/cmap.h378
-rw-r--r--include/corosync/config.h.in542
-rw-r--r--include/corosync/coroapi.h526
-rw-r--r--include/corosync/corodefs.h62
-rw-r--r--include/corosync/corotypes.h189
-rw-r--r--include/corosync/cpg.h440
-rw-r--r--include/corosync/hdb.h250
-rw-r--r--include/corosync/icmap.h565
-rw-r--r--include/corosync/ipc_cfg.h307
-rw-r--r--include/corosync/ipc_cmap.h263
-rw-r--r--include/corosync/ipc_cpg.h502
-rw-r--r--include/corosync/ipc_quorum.h142
-rw-r--r--include/corosync/ipc_votequorum.h265
-rw-r--r--include/corosync/logsys.h350
-rw-r--r--include/corosync/mar_gen.h307
-rw-r--r--include/corosync/quorum.h211
-rw-r--r--include/corosync/sam.h250
-rw-r--r--include/corosync/sq.h404
-rw-r--r--include/corosync/swab.h77
-rw-r--r--include/corosync/totem/totem.h295
-rw-r--r--include/corosync/totem/totemip.h131
-rw-r--r--include/corosync/totem/totempg.h210
-rw-r--r--include/corosync/totem/totemstats.h120
-rw-r--r--include/corosync/votequorum.h317
27 files changed, 8111 insertions, 0 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..4b6697e
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,47 @@
+# Copyright (c) 2009 Red Hat, Inc.
+#
+# Authors: Andrew Beekhof
+# Steven Dake (sdake@redhat.com)
+#
+# This software licensed under BSD license, the text of which follows:
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# - Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# - Neither the name of the MontaVista Software, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+MAINTAINERCLEANFILES = Makefile.in corosync/config.h.in
+
+CS_H = hdb.h cpg.h cfg.h corodefs.h \
+ corotypes.h quorum.h votequorum.h sam.h cmap.h
+
+CS_INTERNAL_H = ipc_cfg.h ipc_cpg.h ipc_quorum.h \
+ quorum.h sq.h ipc_votequorum.h ipc_cmap.h \
+ logsys.h coroapi.h icmap.h mar_gen.h swab.h
+
+TOTEM_H = totem.h totemip.h totempg.h totemstats.h
+
+EXTRA_DIST = $(noinst_HEADERS)
+
+noinst_HEADERS = $(CS_INTERNAL_H:%=corosync/%) $(TOTEM_H:%=corosync/totem/%)
+
+nobase_include_HEADERS = $(CS_H:%=corosync/%)
diff --git a/include/Makefile.in b/include/Makefile.in
new file mode 100644
index 0000000..75b2d1c
--- /dev/null
+++ b/include/Makefile.in
@@ -0,0 +1,646 @@
+# Makefile.in generated by automake 1.13.4 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright (c) 2009 Red Hat, Inc.
+#
+# Authors: Andrew Beekhof
+# Steven Dake (sdake@redhat.com)
+#
+# This software licensed under BSD license, the text of which follows:
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# - Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# - Neither the name of the MontaVista Software, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = include
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(nobase_include_HEADERS) $(noinst_HEADERS)
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/lib/libcfg.verso $(top_srcdir)/lib/libcpg.verso \
+ $(top_srcdir)/lib/libquorum.verso \
+ $(top_srcdir)/lib/libsam.verso \
+ $(top_srcdir)/lib/libvotequorum.verso \
+ $(top_srcdir)/lib/libcmap.verso $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/corosync/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(includedir)"
+HEADERS = $(nobase_include_HEADERS) $(noinst_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUGTOOL = @AUGTOOL@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASHPATH = @BASHPATH@
+BINDGEN = @BINDGEN@
+CARGO = @CARGO@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFG_SONAME = @CFG_SONAME@
+CFLAGS = @CFLAGS@
+CLIPPY = @CLIPPY@
+CMAP_SONAME = @CMAP_SONAME@
+COROSYSCONFDIR = @COROSYSCONFDIR@
+CPG_SONAME = @CPG_SONAME@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOT = @DOT@
+DOXYGEN = @DOXYGEN@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GROFF = @GROFF@
+INITCONFIGDIR = @INITCONFIGDIR@
+INITDDIR = @INITDDIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBQB_CFLAGS = @LIBQB_CFLAGS@
+LIBQB_LIBS = @LIBQB_LIBS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LINT_FLAGS = @LINT_FLAGS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LOGDIR = @LOGDIR@
+LOGROTATEDIR = @LOGROTATEDIR@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+QUORUM_SONAME = @QUORUM_SONAME@
+RANLIB = @RANLIB@
+RUSTC = @RUSTC@
+RUSTDOC = @RUSTDOC@
+RUSTFMT = @RUSTFMT@
+RUST_FLAGS = @RUST_FLAGS@
+RUST_TARGET_DIR = @RUST_TARGET_DIR@
+SAM_SONAME = @SAM_SONAME@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNMPCONFIG = @SNMPCONFIG@
+SNMP_LIBS = @SNMP_LIBS@
+SOMAJOR = @SOMAJOR@
+SOMICRO = @SOMICRO@
+SOMINOR = @SOMINOR@
+SONAME = @SONAME@
+STRIP = @STRIP@
+SYSTEMDDIR = @SYSTEMDDIR@
+VERSCRIPT_LDFLAGS = @VERSCRIPT_LDFLAGS@
+VERSION = @VERSION@
+VOTEQUORUM_SONAME = @VOTEQUORUM_SONAME@
+WITH_LIST = @WITH_LIST@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+corosyncrustver = @corosyncrustver@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+knet_CFLAGS = @knet_CFLAGS@
+knet_LIBS = @knet_LIBS@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libsystemd_CFLAGS = @libsystemd_CFLAGS@
+libsystemd_LIBS = @libsystemd_LIBS@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+nozzle_CFLAGS = @nozzle_CFLAGS@
+nozzle_LIBS = @nozzle_LIBS@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+statgrab_CFLAGS = @statgrab_CFLAGS@
+statgrab_LIBS = @statgrab_LIBS@
+statgrabge090_CFLAGS = @statgrabge090_CFLAGS@
+statgrabge090_LIBS = @statgrabge090_LIBS@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+MAINTAINERCLEANFILES = Makefile.in corosync/config.h.in
+CS_H = hdb.h cpg.h cfg.h corodefs.h \
+ corotypes.h quorum.h votequorum.h sam.h cmap.h
+
+CS_INTERNAL_H = ipc_cfg.h ipc_cpg.h ipc_quorum.h \
+ quorum.h sq.h ipc_votequorum.h ipc_cmap.h \
+ logsys.h coroapi.h icmap.h mar_gen.h swab.h
+
+TOTEM_H = totem.h totemip.h totempg.h totemstats.h
+EXTRA_DIST = $(noinst_HEADERS)
+noinst_HEADERS = $(CS_INTERNAL_H:%=corosync/%) $(TOTEM_H:%=corosync/totem/%)
+nobase_include_HEADERS = $(CS_H:%=corosync/%)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign include/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-nobase_includeHEADERS: $(nobase_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+ fi; \
+ $(am__nobase_list) | while read dir files; do \
+ xfiles=; for file in $$files; do \
+ if test -f "$$file"; then xfiles="$$xfiles $$file"; \
+ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
+ test -z "$$xfiles" || { \
+ test "x$$dir" = x. || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)/$$dir'"; \
+ $(MKDIR_P) "$(DESTDIR)$(includedir)/$$dir"; }; \
+ echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(includedir)/$$dir'"; \
+ $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(includedir)/$$dir" || exit $$?; }; \
+ done
+
+uninstall-nobase_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
+ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-nobase_includeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-nobase_includeHEADERS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
+ clean-libtool cscopelist-am ctags ctags-am distclean \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man \
+ install-nobase_includeHEADERS install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+ uninstall-am uninstall-nobase_includeHEADERS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/include/corosync/cfg.h b/include/corosync/cfg.h
new file mode 100644
index 0000000..f3bce09
--- /dev/null
+++ b/include/corosync/cfg.h
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2005 MontaVista Software, Inc.
+ * Copyright (c) 2006-2013 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef COROSYNC_CFG_H_DEFINED
+#define COROSYNC_CFG_H_DEFINED
+
+#include <netinet/in.h>
+#include <corosync/corotypes.h>
+
+typedef uint64_t corosync_cfg_handle_t;
+
+/**
+ * Shutdown types.
+ */
+typedef enum {
+ /**
+ * REQUEST is the normal shutdown.
+ * Other daemons will be consulted.
+ */
+ COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST = 0,
+ /**
+ * REGARDLESS will tell other daemons but ignore their opinions.
+ */
+ COROSYNC_CFG_SHUTDOWN_FLAG_REGARDLESS = 1,
+ /**
+ * IMMEDIATE will shut down straight away
+ * (but still tell other nodes).
+ */
+ COROSYNC_CFG_SHUTDOWN_FLAG_IMMEDIATE = 2,
+} corosync_cfg_shutdown_flags_t;
+
+/**
+ * @brief enum corosync_cfg_shutdown_reply_flags_t
+ */
+typedef enum {
+ COROSYNC_CFG_SHUTDOWN_FLAG_NO = 0,
+ COROSYNC_CFG_SHUTDOWN_FLAG_YES = 1,
+} corosync_cfg_shutdown_reply_flags_t;
+
+/**
+ * @brief corosync_cfg_shutdown_callback_t callback
+ */
+typedef void (*corosync_cfg_shutdown_callback_t) (
+ corosync_cfg_handle_t cfg_handle,
+ corosync_cfg_shutdown_flags_t flags);
+
+/**
+ * @brief struct corosync_cfg_shutdown_callback_t
+ */
+typedef struct {
+ corosync_cfg_shutdown_callback_t corosync_cfg_shutdown_callback;
+} corosync_cfg_callbacks_t;
+
+/**
+ * A node address. This is a complete sockaddr_in[6]
+ *
+ * To explain:
+ * If you cast cna_address to a 'struct sockaddr', the sa_family field
+ * will be AF_INET or AF_INET6. Armed with that knowledge you can then
+ * cast it to a sockaddr_in or sockaddr_in6 and pull out the address.
+ * No other sockaddr fields are valid.
+ * Also, you must ignore any part of the sockaddr beyond the length supplied
+ */
+typedef struct
+{
+ int address_length; /**< @todo FIXME: set but never used */
+ char address[sizeof(struct sockaddr_in6)];
+} corosync_cfg_node_address_t;
+
+/*
+ * Interfaces
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief corosync_cfg_initialize
+ * @param cfg_handle
+ * @param cfg_callbacks
+ * @return
+ */
+cs_error_t
+corosync_cfg_initialize (
+ corosync_cfg_handle_t *cfg_handle,
+ const corosync_cfg_callbacks_t *cfg_callbacks);
+
+/**
+ * @brief corosync_cfg_fd_get
+ * @param cfg_handle
+ * @param selection_fd
+ * @return
+ */
+cs_error_t
+corosync_cfg_fd_get (
+ corosync_cfg_handle_t cfg_handle,
+ int32_t *selection_fd);
+
+/**
+ * @brief corosync_cfg_dispatch
+ * @param cfg_handle
+ * @param dispatch_flags
+ * @return
+ */
+cs_error_t
+corosync_cfg_dispatch (
+ corosync_cfg_handle_t cfg_handle,
+ cs_dispatch_flags_t dispatch_flags);
+
+/**
+ * @brief corosync_cfg_finalize
+ * @param cfg_handle
+ * @return
+ */
+cs_error_t
+corosync_cfg_finalize (
+ corosync_cfg_handle_t cfg_handle);
+
+/**
+ * @brief corosync_cfg_ring_status_get
+ * @param cfg_handle
+ * @param interface_names
+ * @param status
+ * @param interface_count
+ * @return
+ */
+cs_error_t
+corosync_cfg_ring_status_get (
+ corosync_cfg_handle_t cfg_handle,
+ char ***interface_names,
+ char ***status,
+ unsigned int *interface_count);
+
+typedef enum {
+ CFG_NODE_STATUS_V1 = 1,
+} corosync_cfg_node_status_version_t;
+
+#define CFG_MAX_HOST_LEN 256
+#define CFG_MAX_LINKS 8
+
+struct corosync_knet_link_status_v1 {
+ 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 int mtu; /* current detected MTU on this link */
+ char src_ipaddr[CFG_MAX_HOST_LEN];
+ char dst_ipaddr[CFG_MAX_HOST_LEN];
+};
+
+struct corosync_cfg_node_status_v1 {
+ corosync_cfg_node_status_version_t version;
+ unsigned int nodeid;
+ uint8_t reachable;
+ uint8_t remote;
+ uint8_t external;
+ uint8_t onwire_min;
+ uint8_t onwire_max;
+ uint8_t onwire_ver;
+ struct corosync_knet_link_status_v1 link_status[CFG_MAX_LINKS];
+};
+
+/**
+ * @brief corosync_cfg_node_status_get
+ * @param cfg_handle
+ * @param nodeid
+ * @param node_status
+ * @return
+ */
+cs_error_t
+corosync_cfg_node_status_get (
+ corosync_cfg_handle_t cfg_handle,
+ unsigned int nodeid,
+ corosync_cfg_node_status_version_t version,
+ void *node_status);
+
+/**
+ * @brief corosync_cfg_kill_node
+ * @param cfg_handle
+ * @param nodeid
+ * @param reason
+ * @return
+ */
+cs_error_t
+corosync_cfg_kill_node (
+ corosync_cfg_handle_t cfg_handle,
+ unsigned int nodeid,
+ const char *reason);
+
+/**
+ * @brief corosync_cfg_trackstart
+ * Track CFG for shutdown requests
+ * @param cfg_handle
+ * @param track_flags (none currently supported)
+ * @param reason
+ * @return
+ */
+cs_error_t
+corosync_cfg_trackstart (
+ corosync_cfg_handle_t cfg_handle,
+ uint8_t track_flags);
+
+/**
+ * @brief corosync_cfg_trackstop
+ * Stop tracking CFG for shutdown requests
+ * @param cfg_handle
+ * @param reason
+ * @return
+ */
+cs_error_t
+corosync_cfg_trackstop (
+ corosync_cfg_handle_t cfg_handle);
+
+/**
+ * @brief corosync_cfg_try_shutdown
+ * @param cfg_handle
+ * @param flags
+ * @return
+ */
+cs_error_t
+corosync_cfg_try_shutdown (
+ corosync_cfg_handle_t cfg_handle,
+ corosync_cfg_shutdown_flags_t flags);
+
+/**
+ * @brief corosync_cfg_replyto_shutdown
+ * @param cfg_handle
+ * @param flags
+ * @return
+ */
+cs_error_t
+corosync_cfg_replyto_shutdown (
+ corosync_cfg_handle_t cfg_handle,
+ corosync_cfg_shutdown_reply_flags_t flags);
+
+/**
+ * @brief corosync_cfg_get_node_addrs
+ * @param cfg_handle
+ * @param nodeid
+ * @param max_addrs
+ * @param num_addrs
+ * @param addrs
+ * @return
+ */
+cs_error_t
+corosync_cfg_get_node_addrs (
+ corosync_cfg_handle_t cfg_handle,
+ unsigned int nodeid,
+ size_t max_addrs,
+ int *num_addrs,
+ corosync_cfg_node_address_t *addrs);
+
+/**
+ * @brief corosync_cfg_local_get
+ * @param handle
+ * @param local_nodeid
+ * @return
+ */
+cs_error_t
+corosync_cfg_local_get (
+ corosync_cfg_handle_t handle,
+ unsigned int *local_nodeid);
+
+/**
+ * @brief corosync_cfg_reload_config
+ * @param handle
+ * @return
+ */
+cs_error_t corosync_cfg_reload_config (
+ corosync_cfg_handle_t handle);
+
+/**
+ * @brief Reopen logging files
+ * @param handle CFG service handle
+ * @return CS_OK on success, CS_ERR_NOT_SUPPORTED if reopening of logging files is not available,
+ * otherwise one of common errors.
+ */
+cs_error_t corosync_cfg_reopen_log_files (
+ corosync_cfg_handle_t handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* COROSYNC_CFG_H_DEFINED */
diff --git a/include/corosync/cmap.h b/include/corosync/cmap.h
new file mode 100644
index 0000000..29b2e9e
--- /dev/null
+++ b/include/corosync/cmap.h
@@ -0,0 +1,378 @@
+/*
+ * Copyright (c) 2011-2017 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Jan Friesse (jfriesse@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the Red Hat, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef COROSYNC_CMAP_H_DEFINED
+#define COROSYNC_CMAP_H_DEFINED
+
+#include <corosync/corotypes.h>
+#include <corosync/hdb.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup cmap_corosync
+ *
+ * @{
+ */
+
+/*
+ * Handle for cmap service connection
+ */
+typedef uint64_t cmap_handle_t;
+
+/*
+ * Handle for cmap iterator
+ */
+typedef uint64_t cmap_iter_handle_t;
+
+/*
+ * Handle for cmap tracking function
+ */
+typedef uint64_t cmap_track_handle_t;
+
+/*
+ * Maximum length of key in cmap
+ */
+#define CMAP_KEYNAME_MAXLEN 255
+/*
+ * Minumum length of key in cmap
+ */
+#define CMAP_KEYNAME_MINLEN 3
+
+/*
+ * Tracking values.
+ */
+#define CMAP_TRACK_ADD 4
+#define CMAP_TRACK_DELETE 1
+#define CMAP_TRACK_MODIFY 2
+
+/**
+ * Whole prefix is tracked, instead of key only (so "totem." tracking means that
+ * "totem.nodeid", "totem.version", ... applies). This value is also never returned
+ * inside of callback and is used only in adding track
+ */
+#define CMAP_TRACK_PREFIX 8
+
+/**
+ * Possible types of value. Binary is raw data without trailing zero with given length
+ */
+typedef enum {
+ CMAP_VALUETYPE_INT8 = 1,
+ CMAP_VALUETYPE_UINT8 = 2,
+ CMAP_VALUETYPE_INT16 = 3,
+ CMAP_VALUETYPE_UINT16 = 4,
+ CMAP_VALUETYPE_INT32 = 5,
+ CMAP_VALUETYPE_UINT32 = 6,
+ CMAP_VALUETYPE_INT64 = 7,
+ CMAP_VALUETYPE_UINT64 = 8,
+ CMAP_VALUETYPE_FLOAT = 9,
+ CMAP_VALUETYPE_DOUBLE = 10,
+ CMAP_VALUETYPE_STRING = 11,
+ CMAP_VALUETYPE_BINARY = 12,
+} cmap_value_types_t;
+
+typedef enum {
+ CMAP_MAP_DEFAULT = 0,
+ CMAP_MAP_ICMAP = 0,
+ CMAP_MAP_STATS = 1,
+} cmap_map_t;
+
+/**
+ * Structure passed as new_value and old_value in change callback. It contains type of
+ * key, length of key and pointer to value of key
+ */
+struct cmap_notify_value {
+ cmap_value_types_t type;
+ size_t len;
+ const void *data;
+};
+
+/**
+ * Prototype for notify callback function. Even is one of CMAP_TRACK_* event, key_name is
+ * changed key, new and old_value contains values or are zeroed (in other words, type is non
+ * existing 0 type) if there were no old (creating of key) or new (deleting of key) value.
+ * user_data are passed when adding tracking.
+ */
+typedef void (*cmap_notify_fn_t) (
+ cmap_handle_t cmap_handle,
+ cmap_track_handle_t cmap_track_handle,
+ int32_t event,
+ const char *key_name,
+ struct cmap_notify_value new_value,
+ struct cmap_notify_value old_value,
+ void *user_data);
+
+/**
+ * Create a new cmap connection
+ *
+ * @param handle will be filled with handle to be used for all following
+ * operations with cht.
+ */
+extern cs_error_t cmap_initialize (
+ cmap_handle_t *handle);
+
+/**
+ * Create a new cmap connection on a specified map
+ *
+ * @param handle will be filled with handle to be used for all following
+ * operations with cht.
+ * @param map is the 'map' to use for this connection
+ */
+extern cs_error_t cmap_initialize_map (
+ cmap_handle_t *handle,
+ cmap_map_t map);
+
+/**
+ * Close the cmap handle
+ * @param handle cmap handle
+ */
+extern cs_error_t cmap_finalize (
+ cmap_handle_t handle);
+
+/**
+ * Get a file descriptor on which to poll. cmap_handle_t is NOT a
+ * file descriptor and may not be used directly.
+ * @param handle cmap handle initialized by cmap_initialize
+ * @param fd file descriptor for poll
+ */
+extern cs_error_t cmap_fd_get (
+ cmap_handle_t handle,
+ int *fd);
+
+/**
+ * Dispatch data from service.
+ * @param handle cmap handle initialized by cmap_initialize
+ * @param dispatch_types one of standard corosync dispatch values
+ */
+extern cs_error_t cmap_dispatch (
+ cmap_handle_t handle,
+ cs_dispatch_flags_t dispatch_types);
+/**
+ * @brief cmap_context_get
+ * @param handle
+ * @param context
+ * @return
+ */
+extern cs_error_t cmap_context_get (
+ cmap_handle_t handle,
+ const void **context);
+
+/**
+ * @brief cmap_context_set
+ * @param handle
+ * @param context
+ * @return
+ */
+extern cs_error_t cmap_context_set (
+ cmap_handle_t handle,
+ const void *context);
+
+/**
+ * Store value in cmap
+ * @param handle cmap handle
+ * @param key_name name of key where to store value
+ * @param value value to store
+ * @param value_len length of value to store
+ * @param type type to store
+ */
+extern cs_error_t cmap_set(
+ cmap_handle_t handle,
+ const char *key_name,
+ const void *value,
+ size_t value_len,
+ cmap_value_types_t type);
+
+/*
+ * Shortcuts for cmap_set with given type
+ */
+extern cs_error_t cmap_set_int8(cmap_handle_t handle, const char *key_name, int8_t value);
+extern cs_error_t cmap_set_uint8(cmap_handle_t handle, const char *key_name, uint8_t value);
+extern cs_error_t cmap_set_int16(cmap_handle_t handle, const char *key_name, int16_t value);
+extern cs_error_t cmap_set_uint16(cmap_handle_t handle, const char *key_name, uint16_t value);
+extern cs_error_t cmap_set_int32(cmap_handle_t handle, const char *key_name, int32_t value);
+extern cs_error_t cmap_set_uint32(cmap_handle_t handle, const char *key_name, uint32_t value);
+extern cs_error_t cmap_set_int64(cmap_handle_t handle, const char *key_name, int64_t value);
+extern cs_error_t cmap_set_uint64(cmap_handle_t handle, const char *key_name, uint64_t value);
+extern cs_error_t cmap_set_float(cmap_handle_t handle, const char *key_name, float value);
+extern cs_error_t cmap_set_double(cmap_handle_t handle, const char *key_name, double value);
+extern cs_error_t cmap_set_string(cmap_handle_t handle, const char *key_name, const char *value);
+
+/**
+ * Deletes key from cmap database
+ * @param handle cmap handle
+ * @param key_name name of key to delete
+ */
+extern cs_error_t cmap_delete(cmap_handle_t handle, const char *key_name);
+
+/**
+ * @brief Retrieve value of key key_name and store it in user preallocated value pointer.
+ *
+ * value can be NULL, and then only value_len and/or type is returned (both of them
+ * can also be NULL). If value is not NULL, actual length of value in map is checked
+ * against value_len. If *value_len is shorter then length of value in map, error
+ * CS_ERR_INVALID_PARAM is returned. After successful copy of value, value_len is
+ * set to actual length of value in map.
+ *
+ * @param handle cmap handle
+ * @param key_name name of key where to get value
+ * @param value pointer to store data (or NULL)
+ * @param value_len pointer with length of value (value != NULL), or pointer where value length
+ * will be returned (value == NULL) or NULL.
+ * @param type type of value in cmap
+ */
+extern cs_error_t cmap_get(
+ cmap_handle_t handle,
+ const char *key_name,
+ void *value,
+ size_t *value_len,
+ cmap_value_types_t *type);
+
+/*
+ * Shortcuts for cmap_get.
+ */
+extern cs_error_t cmap_get_int8(cmap_handle_t handle, const char *key_name, int8_t *i8);
+extern cs_error_t cmap_get_uint8(cmap_handle_t handle, const char *key_name, uint8_t *u8);
+extern cs_error_t cmap_get_int16(cmap_handle_t handle, const char *key_name, int16_t *i16);
+extern cs_error_t cmap_get_uint16(cmap_handle_t handle, const char *key_name, uint16_t *u16);
+extern cs_error_t cmap_get_int32(cmap_handle_t handle, const char *key_name, int32_t *i32);
+extern cs_error_t cmap_get_uint32(cmap_handle_t handle, const char *key_name, uint32_t *u32);
+extern cs_error_t cmap_get_int64(cmap_handle_t handle, const char *key_name, int64_t *i64);
+extern cs_error_t cmap_get_uint64(cmap_handle_t handle, const char *key_name, uint64_t *u64);
+extern cs_error_t cmap_get_float(cmap_handle_t handle, const char *key_name, float *flt);
+extern cs_error_t cmap_get_double(cmap_handle_t handle, const char *key_name, double *dbl);
+
+/**
+ * @brief Shortcut for cmap_get for string type.
+ *
+ * Returned string is newly allocated and caller is responsible for freeing memory
+ *
+ * @param handle cmap handle
+ * @param key_name name of key to get value from
+ * @param str pointer where char pointer will be stored
+ */
+extern cs_error_t cmap_get_string(cmap_handle_t handle, const char *key_name, char **str);
+
+/**
+ * @brief Increment value of key_name if it is [u]int* type
+ *
+ * @param handle cmap handle
+ * @param key_name key name
+ */
+extern cs_error_t cmap_inc(cmap_handle_t handle, const char *key_name);
+
+/**
+ * @brief Decrement value of key_name if it is [u]int* type
+ *
+ * @param handle cmap handle
+ * @param key_name key name
+ */
+extern cs_error_t cmap_dec(cmap_handle_t handle, const char *key_name);
+
+/**
+ * @brief Initialize iterator with given prefix
+ *
+ * @param handle cmap handle
+ * @param prefix prefix to iterate on
+ * @param cmap_iter_handle value used for getting next value of iterator and/or deleting iteration
+ */
+extern cs_error_t cmap_iter_init(cmap_handle_t handle, const char *prefix, cmap_iter_handle_t *cmap_iter_handle);
+
+/**
+ * @brief Return next item in iterator iter.
+ *
+ * value_len and type are optional (= can be NULL), but if set,
+ * length of returned value and/or type is returned.
+ *
+ * @param handle cmap handle
+ * @param iter_handle handle of iteration returned by cmap_iter_init
+ * @param key_name place to store name of key. Maximum length is CMAP_KEYNAME_MAXLEN and
+ * trailing zero is always added so size of the buffer has to be at least
+ * CMAP_KEYNAME_MAXLEN + 1.
+ * @param value_len length of value
+ * @param type type of value
+ * @return CS_NO_SECTION if there are no more sections to iterate
+ */
+extern cs_error_t cmap_iter_next(
+ cmap_handle_t handle,
+ cmap_iter_handle_t iter_handle,
+ char key_name[],
+ size_t *value_len,
+ cmap_value_types_t *type);
+
+/**
+ * @brief Finalize iterator
+ * @param handle
+ * @param iter_handle
+ * @return
+ */
+extern cs_error_t cmap_iter_finalize(cmap_handle_t handle, cmap_iter_handle_t iter_handle);
+
+/**
+ * @brief Add tracking function for given key_name.
+ *
+ * Tracked changes (add|modify|delete) depend on track_type,
+ * which is bitwise or of CMAP_TRACK_* values. notify_fn is called on change, where user_data pointer
+ * is passed (unchanged). Value which can be used to delete tracking is passed as cmap_track.
+ *
+ * @param handle cmap handle
+ * @param key_name name of key to track changes on
+ * @param track_type bitwise-or of CMAP_TRACK_* values
+ * @param notify_fn function to be called on change of key
+ * @param user_data given pointer is unchanged passed to notify_fn
+ * @param cmap_track_handle handle used for removing of newly created track
+ */
+extern cs_error_t cmap_track_add(
+ cmap_handle_t handle,
+ const char *key_name,
+ int32_t track_type,
+ cmap_notify_fn_t notify_fn,
+ void *user_data,
+ cmap_track_handle_t *cmap_track_handle);
+
+/**
+ * Delete track created previously by cmap_track_add
+ * @param handle cmap handle
+ * @param track_handle Track handle
+ */
+extern cs_error_t cmap_track_delete(cmap_handle_t handle, cmap_track_handle_t track_handle);
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* COROSYNC_CMAP_H_DEFINED */
diff --git a/include/corosync/config.h.in b/include/corosync/config.h.in
new file mode 100644
index 0000000..f827615
--- /dev/null
+++ b/include/corosync/config.h.in
@@ -0,0 +1,542 @@
+/* include/corosync/config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if the `closedir' function returns void instead of `int'. */
+#undef CLOSEDIR_VOID
+
+/* corosync config directory */
+#undef COROSYSCONFDIR
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+ systems. This function is required for `alloca.c' support on those systems.
+ */
+#undef CRAY_STACKSEG_END
+
+/* Define to 1 if using `alloca.c'. */
+#undef C_ALLOCA
+
+/* Compiling Debugging code */
+#undef DEBUG
+
+/* Build in support for sending SNMP traps */
+#undef ENABLE_SNMP
+
+/* Define to 1 if you have the `alarm' function. */
+#undef HAVE_ALARM
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+ */
+#undef HAVE_ALLOCA_H
+
+/* Define to 1 if you have the `alphasort' function. */
+#undef HAVE_ALPHASORT
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#undef HAVE_ARPA_INET_H
+
+/* Define to 1 if you have the `atexit' function. */
+#undef HAVE_ATEXIT
+
+/* Define to 1 if you have the `bzero' function. */
+#undef HAVE_BZERO
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#undef HAVE_CLOCK_GETTIME
+
+/* have dbus */
+#undef HAVE_DBUS
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Define to 1 if you have the `dup2' function. */
+#undef HAVE_DUP2
+
+/* Define to 1 if you have the `endgrent' function. */
+#undef HAVE_ENDGRENT
+
+/* Define to 1 if you have the `endpwent' function. */
+#undef HAVE_ENDPWENT
+
+/* Define to 1 if you have the `fcntl' function. */
+#undef HAVE_FCNTL
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `fdatasync' function. */
+#undef HAVE_FDATASYNC
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the `ftruncate' function. */
+#undef HAVE_FTRUNCATE
+
+/* Define to 1 if you have the `getcwd' function. */
+#undef HAVE_GETCWD
+
+/* Define to 1 if you have the `gethostname' function. */
+#undef HAVE_GETHOSTNAME
+
+/* Define to 1 if you have the `getifaddrs' function. */
+#undef HAVE_GETIFADDRS
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define to 1 if you have the `getpeereid' function. */
+#undef HAVE_GETPEEREID
+
+/* Define to 1 if you have the `getpeerucred' function. */
+#undef HAVE_GETPEERUCRED
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the <ifaddrs.h> header file. */
+#undef HAVE_IFADDRS_H
+
+/* Define to 1 if you have the `inet_ntoa' function. */
+#undef HAVE_INET_NTOA
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* have knet access list */
+#undef HAVE_KNET_ACCESS_LIST
+
+/* have knet crypto reconfig support */
+#undef HAVE_KNET_CRYPTO_RECONF
+
+/* have knet onwire versioning */
+#undef HAVE_KNET_ONWIRE_VER
+
+/* Define to 1 if you have the `asan' library (-lasan). */
+#undef HAVE_LIBASAN
+
+/* have nozzle */
+#undef HAVE_LIBNOZZLE
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+#undef HAVE_LIBNSL
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#undef HAVE_LIBPTHREAD
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+#undef HAVE_LIBRT
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+#undef HAVE_LIBSOCKET
+
+/* have libstatgrab >= 0.90 */
+#undef HAVE_LIBSTATGRAB_GE_090
+
+/* have systemd interface library */
+#undef HAVE_LIBSYSTEMD
+
+/* Define to 1 if you have the `tsan' library (-ltsan). */
+#undef HAVE_LIBTSAN
+
+/* Define to 1 if you have the `ubsan' library (-lubsan). */
+#undef HAVE_LIBUBSAN
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the `localtime_r' function. */
+#undef HAVE_LOCALTIME_R
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the `mkdir' function. */
+#undef HAVE_MKDIR
+
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* have resource monitoring */
+#undef HAVE_MONITORING
+
+/* msghdr has msg_accrights */
+#undef HAVE_MSGHDR_ACCRIGHTS
+
+/* msghdr has msg_accrightslen */
+#undef HAVE_MSGHDR_ACCRIGHTSLEN
+
+/* msghdr has msg_control */
+#undef HAVE_MSGHDR_CONTROL
+
+/* msghdr has msg_controllen */
+#undef HAVE_MSGHDR_CONTROLLEN
+
+/* msghdr has msg_flags */
+#undef HAVE_MSGHDR_FLAGS
+
+/* Define to 1 if you have the `munmap' function. */
+#undef HAVE_MUNMAP
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
+/* Define to 1 if you have the `netsnmp_tdomain_transport' function. */
+#undef HAVE_NETSNMP_TDOMAIN_TRANSPORT
+
+/* Define to 1 if you have the `netsnmp_transport_open_client' function. */
+#undef HAVE_NETSNMP_TRANSPORT_OPEN_CLIENT
+
+/* Define to 1 if you have the <net-snmp/net-snmp-config.h> header file. */
+#undef HAVE_NET_SNMP_NET_SNMP_CONFIG_H
+
+/* Define to 1 if you have the `pthread_setschedparam' function. */
+#undef HAVE_PTHREAD_SETSCHEDPARAM
+
+/* have qb_log_file_reopen */
+#undef HAVE_QB_LOG_FILE_REOPEN
+
+/* have qb_log_thread_priority_set */
+#undef HAVE_QB_LOG_THREAD_PRIORITY_SET
+
+/* Define to 1 if you have the <readline/history.h> header file. */
+#undef HAVE_READLINE_HISTORY_H
+
+/* Define to 1 if you have the <readline/readline.h> header file. */
+#undef HAVE_READLINE_READLINE_H
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+ and to 0 otherwise. */
+#undef HAVE_REALLOC
+
+/* Define to 1 if you have the `scandir' function. */
+#undef HAVE_SCANDIR
+
+/* Define to 1 if you have the `sched_get_priority_max' function. */
+#undef HAVE_SCHED_GET_PRIORITY_MAX
+
+/* Define to 1 if you have the `sched_setscheduler' function. */
+#undef HAVE_SCHED_SETSCHEDULER
+
+/* Define to 1 if you have the `select' function. */
+#undef HAVE_SELECT
+
+/* have small_memory_footprint */
+#undef HAVE_SMALL_MEMORY_FOOTPRINT
+
+/* Define to 1 if you have the `socket' function. */
+#undef HAVE_SOCKET
+
+/* sockaddr_in6 needs sin6_len */
+#undef HAVE_SOCK_SIN6_LEN
+
+/* sockaddr_in needs sin_len */
+#undef HAVE_SOCK_SIN_LEN
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#undef HAVE_STDDEF_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strrchr' function. */
+#undef HAVE_STRRCHR
+
+/* Define to 1 if you have the `strspn' function. */
+#undef HAVE_STRSPN
+
+/* Define to 1 if you have the `strstr' function. */
+#undef HAVE_STRSTR
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if you have the <syslog.h> header file. */
+#undef HAVE_SYSLOG_H
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_DIR_H
+
+/* Define to 1 if you have the <sys/file.h> header file. */
+#undef HAVE_SYS_FILE_H
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_NDIR_H
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#undef HAVE_SYS_UIO_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <utmpx.h> header file. */
+#undef HAVE_UTMPX_H
+
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the <vfork.h> header file. */
+#undef HAVE_VFORK_H
+
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
+/* have watchdog */
+#undef HAVE_WATCHDOG
+
+/* Define to 1 if `fork' works. */
+#undef HAVE_WORKING_FORK
+
+/* Define to 1 if `vfork' works. */
+#undef HAVE_WORKING_VFORK
+
+/* localstate directory */
+#undef LOCALSTATEDIR
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* have net-snmp5.4 over */
+#undef NETSNMPV54
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* corosync built-in features */
+#undef PACKAGE_FEATURES
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to the type of arg 1 for `select'. */
+#undef SELECT_TYPE_ARG1
+
+/* Define to the type of args 2, 3 and 4 for `select'. */
+#undef SELECT_TYPE_ARG234
+
+/* Define to the type of arg 5 for `select'. */
+#undef SELECT_TYPE_ARG5
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at runtime.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+#undef _UINT32_T
+
+/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+#undef _UINT64_T
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+#undef _UINT8_T
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef gid_t
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to the type of a signed integer type of width exactly 16 bits if
+ such a type exists and the standard includes do not define it. */
+#undef int16_t
+
+/* Define to the type of a signed integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+#undef int32_t
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+ such a type exists and the standard includes do not define it. */
+#undef int64_t
+
+/* Define to the type of a signed integer type of width exactly 8 bits if such
+ a type exists and the standard includes do not define it. */
+#undef int8_t
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to rpl_realloc if the replacement function should be used. */
+#undef realloc
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef ssize_t
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef uid_t
+
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint16_t
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint32_t
+
+/* Define to the type of an unsigned integer type of width exactly 64 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint64_t
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint8_t
+
+/* Define as `fork' if `vfork' does not work. */
+#undef vfork
+
+/* Define to empty if the keyword `volatile' does not work. Warning: valid
+ code using `volatile' can become incorrect without. Disable with care. */
+#undef volatile
diff --git a/include/corosync/coroapi.h b/include/corosync/coroapi.h
new file mode 100644
index 0000000..9d14b7b
--- /dev/null
+++ b/include/corosync/coroapi.h
@@ -0,0 +1,526 @@
+/*
+ * Copyright (c) 2008-2012 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef COROAPI_H_DEFINED
+#define COROAPI_H_DEFINED
+
+#include <config.h>
+
+#include <stdio.h>
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+#include <corosync/hdb.h>
+#include <qb/qbloop.h>
+#include <corosync/swab.h>
+
+/**
+ * @brief The mar_message_source_t struct
+ */
+typedef struct {
+ uint32_t nodeid __attribute__((aligned(8)));
+ void *conn __attribute__((aligned(8)));
+} mar_message_source_t __attribute__((aligned(8)));
+
+/**
+ * @brief swab_mar_message_source_t
+ * @param to_swab
+ */
+static inline void swab_mar_message_source_t (mar_message_source_t *to_swab)
+{
+ swab32 (to_swab->nodeid);
+ /*
+ * if it is from a byteswapped machine, then we can safely
+ * ignore its conn info data structure since this is only
+ * local to the machine
+ */
+ to_swab->conn = NULL;
+}
+
+#ifndef TIMER_HANDLE_T
+/**
+ * @brief corosync_timer_handle_t
+ */
+typedef qb_loop_timer_handle corosync_timer_handle_t;
+#define TIMER_HANDLE_T 1
+#endif
+
+/**
+ * @brief The corosync_tpg_group struct
+ */
+struct corosync_tpg_group {
+ const void *group;
+ size_t group_len;
+};
+
+#define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
+
+#define INTERFACE_MAX 8
+
+#ifndef MESSAGE_QUEUE_MAX
+#ifdef HAVE_SMALL_MEMORY_FOOTPRINT
+#define PROCESSOR_COUNT_MAX 16
+#define MESSAGE_SIZE_MAX 1024*64
+#define MESSAGE_QUEUE_MAX 512
+#else
+#define PROCESSOR_COUNT_MAX 384
+#define MESSAGE_SIZE_MAX 1024*1024
+#define MESSAGE_QUEUE_MAX ((4 * MESSAGE_SIZE_MAX) / totem_config->net_mtu)
+#endif /* HAVE_SMALL_MEMORY_FOOTPRINT */
+#endif /* MESSAGE_QUEUE_MAX */
+
+#define TOTEM_AGREED 0
+#define TOTEM_SAFE 1
+
+#define MILLI_2_NANO_SECONDS 1000000ULL
+
+#if !defined(TOTEM_IP_ADDRESS)
+/**
+ * @brief The totem_ip_address struct
+ */
+struct totem_ip_address {
+ unsigned int nodeid;
+ unsigned short family;
+ unsigned char addr[TOTEMIP_ADDRLEN];
+} __attribute__((packed));
+#endif
+
+#if !defined(MEMB_RING_ID)
+/**
+ * @brief The memb_ring_id struct
+ */
+struct memb_ring_id {
+ unsigned int nodeid;
+ unsigned long long seq;
+} __attribute__((packed));
+#endif
+
+#if !defined(TOTEM_CONFIGURATION_TYPE)
+/**
+ * @brief The totem_configuration_type enum
+ */
+enum totem_configuration_type {
+ TOTEM_CONFIGURATION_REGULAR,
+ TOTEM_CONFIGURATION_TRANSITIONAL
+};
+#endif
+
+#if !defined(TOTEM_CALLBACK_TOKEN_TYPE)
+/**
+ * @brief The totem_callback_token_type enum
+ */
+enum totem_callback_token_type {
+ TOTEM_CALLBACK_TOKEN_RECEIVED = 1,
+ TOTEM_CALLBACK_TOKEN_SENT = 2
+};
+#endif
+
+/**
+ * @brief The cs_lib_flow_control enum
+ */
+enum cs_lib_flow_control {
+ CS_LIB_FLOW_CONTROL_REQUIRED = 1,
+ CS_LIB_FLOW_CONTROL_NOT_REQUIRED = 2
+};
+#define corosync_lib_flow_control cs_lib_flow_control
+#define COROSYNC_LIB_FLOW_CONTROL_REQUIRED CS_LIB_FLOW_CONTROL_REQUIRED
+#define COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED CS_LIB_FLOW_CONTROL_NOT_REQUIRED
+
+/**
+ * @brief The cs_lib_allow_inquorate enum
+ */
+enum cs_lib_allow_inquorate {
+ CS_LIB_DISALLOW_INQUORATE = 0, /* default */
+ CS_LIB_ALLOW_INQUORATE = 1
+};
+
+#if !defined (COROSYNC_FLOW_CONTROL_STATE)
+/**
+ * @brief The cs_flow_control_state enum
+ */
+enum cs_flow_control_state {
+ CS_FLOW_CONTROL_STATE_DISABLED,
+ CS_FLOW_CONTROL_STATE_ENABLED
+};
+#define corosync_flow_control_state cs_flow_control_state
+#define CS_FLOW_CONTROL_STATE_DISABLED CS_FLOW_CONTROL_STATE_DISABLED
+#define CS_FLOW_CONTROL_STATE_ENABLED CS_FLOW_CONTROL_STATE_ENABLED
+
+#endif /* COROSYNC_FLOW_CONTROL_STATE */
+/**
+ * @brief The cs_fatal_error_t enum.
+ */
+typedef enum {
+ COROSYNC_FATAL_ERROR_EXIT = -1,
+ COROSYNC_LIBAIS_SOCKET = -6,
+ COROSYNC_LIBAIS_BIND = -7,
+ COROSYNC_READKEY = -8,
+ COROSYNC_INVALID_CONFIG = -9,
+ COROSYNC_DYNAMICLOAD = -12,
+ COROSYNC_OUT_OF_MEMORY = -15,
+ COROSYNC_FATAL_ERR = -16
+} cs_fatal_error_t;
+#define corosync_fatal_error_t cs_fatal_error_t;
+
+#ifndef QUORUM_H_DEFINED
+/**
+ *@brief The quorum_callback_fn_t callback
+ */
+typedef void (*quorum_callback_fn_t) (int quorate, void *context);
+
+/**
+ * @brief The quorum_callin_functions struct
+ */
+struct quorum_callin_functions {
+ int (*quorate) (void);
+ int (*register_callback) (quorum_callback_fn_t callback_fn, void *contexxt);
+ int (*unregister_callback) (quorum_callback_fn_t callback_fn, void *context);
+};
+
+/**
+ * @brief The sync_callback_fn_t callback
+ */
+typedef void (*sync_callback_fn_t) (
+ const unsigned int *view_list,
+ size_t view_list_entries,
+ int primary_designated,
+ struct memb_ring_id *ring_id);
+
+#endif /* QUORUM_H_DEFINED */
+
+
+/**
+ * @brief The corosync_api_v1 struct
+ */
+struct corosync_api_v1 {
+ /*
+ * Time and timer APIs
+ */
+ int (*timer_add_duration) (
+ unsigned long long nanoseconds_in_future,
+ void *data,
+ void (*timer_nf) (void *data),
+ corosync_timer_handle_t *handle);
+
+ int (*timer_add_absolute) (
+ unsigned long long nanoseconds_from_epoch,
+ void *data,
+ void (*timer_fn) (void *data),
+ corosync_timer_handle_t *handle);
+
+ void (*timer_delete) (
+ corosync_timer_handle_t timer_handle);
+
+ unsigned long long (*timer_time_get) (void);
+
+ unsigned long long (*timer_expire_time_get) (
+ corosync_timer_handle_t timer_handle);
+
+ /*
+ * IPC APIs
+ */
+ void (*ipc_source_set) (mar_message_source_t *source, void *conn);
+
+ int (*ipc_source_is_local) (const mar_message_source_t *source);
+
+ void *(*ipc_private_data_get) (void *conn);
+
+ int (*ipc_response_send) (void *conn, const void *msg, size_t mlen);
+
+ int (*ipc_response_iov_send) (void *conn,
+ const struct iovec *iov, unsigned int iov_len);
+
+ int (*ipc_dispatch_send) (void *conn, const void *msg, size_t mlen);
+
+ int (*ipc_dispatch_iov_send) (void *conn,
+ const struct iovec *iov, unsigned int iov_len);
+
+ void (*ipc_refcnt_inc) (void *conn);
+
+ void (*ipc_refcnt_dec) (void *conn);
+
+ /*
+ * Totem APIs
+ */
+ unsigned int (*totem_nodeid_get) (void);
+
+ int (*totem_family_get) (void);
+
+ int (*totem_mcast) (const struct iovec *iovec,
+ unsigned int iov_len, unsigned int guarantee);
+
+ int (*totem_ifaces_get) (
+ unsigned int nodeid,
+ unsigned int *interface_ids,
+ struct totem_ip_address *interfaces,
+ unsigned int interfaces_size,
+ char ***status,
+ unsigned int *iface_count);
+
+ const char *(*totem_ifaces_print) (unsigned int nodeid);
+
+ const char *(*totem_ip_print) (const struct totem_ip_address *addr);
+
+ int (*totem_crypto_set) (const char *cipher_type, const char *hash_type);
+
+ int (*totem_callback_token_create) (
+ void **handle_out,
+ enum totem_callback_token_type type,
+ int delete,
+ int (*callback_fn) (enum totem_callback_token_type type,
+ const void *),
+ const void *data);
+
+ /*
+ * Totem open process groups API for those service engines
+ * wanting their own groups
+ */
+ int (*tpg_init) (
+ void **instance,
+
+ void (*deliver_fn) (
+ unsigned int nodeid,
+ const void *msg,
+ unsigned int msg_len,
+ int endian_conversion_required),
+
+ void (*confchg_fn) (
+ enum totem_configuration_type configuration_type,
+ const unsigned int *member_list,
+ size_t member_list_entries,
+ const unsigned int *left_list,
+ size_t left_list_entries,
+ const unsigned int *joined_list,
+ size_t joined_list_entries,
+ const struct memb_ring_id *ring_id));
+
+ int (*tpg_exit) (
+ void *instance);
+
+ int (*tpg_join) (
+ void *instance,
+ const struct corosync_tpg_group *groups,
+ size_t group_cnt);
+
+ int (*tpg_leave) (
+ void *instance,
+ const struct corosync_tpg_group *groups,
+ size_t group_cnt);
+
+ int (*tpg_joined_mcast) (
+ void *totempg_groups_instance,
+ const struct iovec *iovec,
+ unsigned int iov_len,
+ int guarantee);
+
+ int (*tpg_joined_reserve) (
+ void *totempg_groups_instance,
+ const struct iovec *iovec,
+ unsigned int iov_len);
+
+ int (*tpg_joined_release) (
+ int reserved_msgs);
+
+ int (*tpg_groups_mcast) (
+ void *instance,
+ int guarantee,
+ const struct corosync_tpg_group *groups,
+ size_t groups_cnt,
+ const struct iovec *iovec,
+ unsigned int iov_len);
+
+ int (*tpg_groups_reserve) (
+ void *instance,
+ const struct corosync_tpg_group *groups,
+ size_t groups_cnt,
+ const struct iovec *iovec,
+ unsigned int iov_len);
+
+ int (*tpg_groups_release) (
+ int reserved_msgs);
+
+ int (*schedwrk_create) (
+ hdb_handle_t *handle,
+ int (schedwrk_fn) (const void *),
+ const void *context);
+
+ void (*schedwrk_destroy) (hdb_handle_t handle);
+
+ int (*sync_request) (
+ const char *service_name);
+
+ /*
+ * User plugin-callable functions for quorum
+ */
+ int (*quorum_is_quorate) (void);
+ int (*quorum_register_callback) (quorum_callback_fn_t callback_fn, void *context);
+ int (*quorum_unregister_callback) (quorum_callback_fn_t callback_fn, void *context);
+
+ /*
+ * This one is for the quorum management plugin's use
+ */
+ int (*quorum_initialize)(struct quorum_callin_functions *fns);
+
+ /*
+ * Plugin loading and unloading
+ */
+ int (*plugin_interface_reference) (
+ hdb_handle_t *handle,
+ const char *iface_name,
+ int version,
+ void **interface,
+ void *context);
+
+ int (*plugin_interface_release) (hdb_handle_t handle);
+
+ /*
+ * Service loading and unloading APIs
+ */
+ unsigned int (*service_link_and_init) (
+ struct corosync_api_v1 *corosync_api_v1,
+ const char *service_name,
+ unsigned int service_ver);
+
+ unsigned int (*service_unlink_and_exit) (
+ struct corosync_api_v1 *corosync_api_v1,
+ const char *service_name,
+ unsigned int service_ver);
+
+ /*
+ * Error handling APIs
+ */
+ void (*error_memory_failure) (void) __attribute__ ((noreturn));
+
+#define corosync_fatal_error(err) api->fatal_error ((err), __FILE__, __LINE__)
+ void (*fatal_error) (cs_fatal_error_t err,
+ const char *file,
+ unsigned int line) __attribute__ ((noreturn));
+
+ void (*shutdown_request) (void);
+
+ void (*state_dump) (void);
+
+ qb_loop_t *(*poll_handle_get) (void);
+
+ void *(*totem_get_stats)(void);
+
+ int (*schedwrk_create_nolock) (
+ hdb_handle_t *handle,
+ int (schedwrk_fn) (const void *),
+ const void *context);
+
+ int (*poll_dispatch_add) (qb_loop_t * handle,
+ int fd,
+ int events,
+ void *data,
+
+ int (*dispatch_fn) (int fd,
+ int revents,
+ void *data));
+
+
+ int (*poll_dispatch_delete) (
+ qb_loop_t * handle,
+ int fd);
+
+};
+
+#define SERVICE_ID_MAKE(a,b) ( ((a)<<16) | (b) )
+
+#define SERVICE_HANDLER_MAXIMUM_COUNT 64
+
+#define SERVICES_COUNT_MAX 64
+
+/**
+ * @brief The corosync_lib_handler struct
+ */
+struct corosync_lib_handler {
+ void (*lib_handler_fn) (void *conn, const void *msg);
+ enum cs_lib_flow_control flow_control;
+};
+
+/**
+ * @brief The corosync_exec_handler struct
+ */
+struct corosync_exec_handler {
+ void (*exec_handler_fn) (const void *msg, unsigned int nodeid);
+ void (*exec_endian_convert_fn) (void *msg);
+};
+
+/**
+ * @brief The corosync_service_engine_iface_ver0 struct
+ */
+struct corosync_service_engine_iface_ver0 {
+ struct corosync_service_engine *(*corosync_get_service_engine_ver0) (void);
+};
+
+/**
+ * @brief The corosync_service_engine struct
+ */
+struct corosync_service_engine {
+ const char *name;
+ unsigned short id;
+ unsigned short priority; /* Lower priority are loaded first, unloaded last.
+ * 0 is a special case which always loaded _and_ unloaded last
+ */
+ size_t private_data_size;
+ enum cs_lib_flow_control flow_control;
+ enum cs_lib_allow_inquorate allow_inquorate;
+ char *(*exec_init_fn) (struct corosync_api_v1 *);
+ int (*exec_exit_fn) (void);
+ void (*exec_dump_fn) (void);
+ int (*lib_init_fn) (void *conn);
+ int (*lib_exit_fn) (void *conn);
+ struct corosync_lib_handler *lib_engine;
+ int lib_engine_count;
+ struct corosync_exec_handler *exec_engine;
+ int exec_engine_count;
+ int (*config_init_fn) (struct corosync_api_v1 *);
+ void (*confchg_fn) (
+ enum totem_configuration_type configuration_type,
+ const unsigned int *member_list, size_t member_list_entries,
+ const unsigned int *left_list, size_t left_list_entries,
+ const unsigned int *joined_list, size_t joined_list_entries,
+ const struct memb_ring_id *ring_id);
+ void (*sync_init) (
+ const unsigned int *trans_list,
+ size_t trans_list_entries,
+ const unsigned int *member_list,
+ size_t member_list_entries,
+ const struct memb_ring_id *ring_id);
+ int (*sync_process) (void);
+ void (*sync_activate) (void);
+ void (*sync_abort) (void);
+};
+
+#endif /* COROAPI_H_DEFINED */
diff --git a/include/corosync/corodefs.h b/include/corosync/corodefs.h
new file mode 100644
index 0000000..17d59d6
--- /dev/null
+++ b/include/corosync/corodefs.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2009-2011 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CORODEFS_H_DEFINED
+#define CORODEFS_H_DEFINED
+
+#include <netinet/in.h>
+
+/**
+ * @brief The corosync_service_types enum
+ */
+enum corosync_service_types {
+ CMAP_SERVICE = 0,
+ CFG_SERVICE = 1,
+ CPG_SERVICE = 2,
+ QUORUM_SERVICE = 3,
+ PLOAD_SERVICE = 4,
+ VOTEQUORUM_SERVICE = 5,
+ MON_SERVICE = 6,
+ WD_SERVICE = 7,
+};
+
+#ifdef HAVE_SMALL_MEMORY_FOOTPRINT
+#define PROCESSOR_COUNT_MAX 16
+#else
+#define PROCESSOR_COUNT_MAX 384
+#endif /* HAVE_SMALL_MEMORY_FOOTPRINT */
+
+#define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
+
+#endif /* CORODEFS_H_DEFINED */
diff --git a/include/corosync/corotypes.h b/include/corosync/corotypes.h
new file mode 100644
index 0000000..a661cb6
--- /dev/null
+++ b/include/corosync/corotypes.h
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2008 Allied Telesis Labs.
+ * Copyright (c) 2012 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Angus Salkeld (ahsalkeld@gmail.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef COROTYPES_H_DEFINED
+#define COROTYPES_H_DEFINED
+
+#include <stdint.h>
+#include <errno.h>
+#include <time.h>
+#include <sys/time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief cs_time_t
+ */
+typedef int64_t cs_time_t;
+
+#define CS_FALSE 0
+#define CS_TRUE !CS_FALSE
+#define CS_MAX_NAME_LENGTH 256
+#define CS_TIME_END ((cs_time_t)0x7FFFFFFFFFFFFFFFULL)
+#define CS_MAX(x, y) (((x) > (y)) ? (x) : (y))
+
+#define CS_PRI_NODE_ID "%" PRIu32
+#define CS_PRI_NODE_ID_PADDED "%10" PRIu32
+#define CS_PRI_RING_ID_SEQ "%" PRIx64
+#define CS_PRI_RING_ID "%" PRIx32 ".%" PRIx64
+/**
+ * @brief The cs_name_t struct
+ */
+typedef struct {
+ uint16_t length;
+ uint8_t value[CS_MAX_NAME_LENGTH];
+} cs_name_t;
+
+
+/**
+ * @brief The cs_version_t struct
+ */
+typedef struct {
+ char releaseCode;
+ unsigned char majorVersion;
+ unsigned char minorVersion;
+} cs_version_t;
+
+/**
+ * @brief The cs_dispatch_flags_t enum
+ */
+typedef enum {
+ CS_DISPATCH_ONE = 1,
+ CS_DISPATCH_ALL = 2,
+ CS_DISPATCH_BLOCKING = 3,
+ CS_DISPATCH_ONE_NONBLOCKING = 4
+} cs_dispatch_flags_t;
+
+#define CS_TRACK_CURRENT 0x01
+#define CS_TRACK_CHANGES 0x02
+#define CS_TRACK_CHANGES_ONLY 0x04
+
+/**
+ * @brief The cs_error_t enum
+ */
+typedef enum {
+ CS_OK = 1,
+ CS_ERR_LIBRARY = 2,
+ CS_ERR_VERSION = 3,
+ CS_ERR_INIT = 4,
+ CS_ERR_TIMEOUT = 5,
+ CS_ERR_TRY_AGAIN = 6,
+ CS_ERR_INVALID_PARAM = 7,
+ CS_ERR_NO_MEMORY = 8,
+ CS_ERR_BAD_HANDLE = 9,
+ CS_ERR_BUSY = 10,
+ CS_ERR_ACCESS = 11,
+ CS_ERR_NOT_EXIST = 12,
+ CS_ERR_NAME_TOO_LONG = 13,
+ CS_ERR_EXIST = 14,
+ CS_ERR_NO_SPACE = 15,
+ CS_ERR_INTERRUPT = 16,
+ CS_ERR_NAME_NOT_FOUND = 17,
+ CS_ERR_NO_RESOURCES = 18,
+ CS_ERR_NOT_SUPPORTED = 19,
+ CS_ERR_BAD_OPERATION = 20,
+ CS_ERR_FAILED_OPERATION = 21,
+ CS_ERR_MESSAGE_ERROR = 22,
+ CS_ERR_QUEUE_FULL = 23,
+ CS_ERR_QUEUE_NOT_AVAILABLE = 24,
+ CS_ERR_BAD_FLAGS = 25,
+ CS_ERR_TOO_BIG = 26,
+ CS_ERR_NO_SECTIONS = 27,
+ CS_ERR_CONTEXT_NOT_FOUND = 28,
+ CS_ERR_TOO_MANY_GROUPS = 30,
+ CS_ERR_SECURITY = 100
+} cs_error_t;
+
+#define CS_IPC_TIMEOUT_MS -1
+
+#define CS_TIME_MS_IN_SEC 1000ULL
+#define CS_TIME_US_IN_SEC 1000000ULL
+#define CS_TIME_NS_IN_SEC 1000000000ULL
+#define CS_TIME_US_IN_MSEC 1000ULL
+#define CS_TIME_NS_IN_MSEC 1000000ULL
+#define CS_TIME_NS_IN_USEC 1000ULL
+
+/**
+ * @brief cs_timestamp_get
+ * @return
+ */
+static inline uint64_t cs_timestamp_get(void)
+{
+ uint64_t result;
+
+#if defined _POSIX_MONOTONIC_CLOCK && _POSIX_MONOTONIC_CLOCK >= 0
+ struct timespec ts;
+
+ clock_gettime (CLOCK_MONOTONIC, &ts);
+ result = (ts.tv_sec * CS_TIME_NS_IN_SEC) + (uint64_t)ts.tv_nsec;
+#else
+ struct timeval time_from_epoch;
+
+ gettimeofday (&time_from_epoch, 0);
+ result = ((time_from_epoch.tv_sec * CS_TIME_NS_IN_SEC) +
+ (time_from_epoch.tv_usec * CS_TIME_NS_IN_USEC));
+#endif
+
+ return result;
+}
+/**
+ * @brief qb_to_cs_error
+ * @param result
+ * @return
+ */
+cs_error_t qb_to_cs_error (int result);
+
+/**
+ * @brief cs_strerror
+ * @param err
+ * @return
+ */
+const char * cs_strerror(cs_error_t err);
+
+/**
+ * @brief hdb_error_to_cs
+ * @param res
+ * @return
+ */
+cs_error_t hdb_error_to_cs (int res);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* COROTYPES_H_DEFINED */
+
diff --git a/include/corosync/cpg.h b/include/corosync/cpg.h
new file mode 100644
index 0000000..39200fd
--- /dev/null
+++ b/include/corosync/cpg.h
@@ -0,0 +1,440 @@
+/*
+ * Copyright (c) 2006-2019 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Christine Caulfield (ccaulfi@redhat.com)
+ * Author: Jan Friesse (jfriesse@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef COROSYNC_CPG_H_DEFINED
+#define COROSYNC_CPG_H_DEFINED
+
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <corosync/corotypes.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup cpg_corosync
+ *
+ * @{
+ */
+/**
+ * @brief cpg_handle_t
+ */
+typedef uint64_t cpg_handle_t;
+
+/**
+ * @brief cpg_iteration_handle_t
+ */
+typedef uint64_t cpg_iteration_handle_t;
+
+/**
+ * @brief The cpg_guarantee_t enum
+ */
+typedef enum {
+ CPG_TYPE_UNORDERED, /**< not implemented */
+ CPG_TYPE_FIFO, /**< same as agreed */
+ CPG_TYPE_AGREED,
+ CPG_TYPE_SAFE /**< not implemented */
+} cpg_guarantee_t;
+
+/**
+ * @brief The cpg_flow_control_state_t enum
+ */
+typedef enum {
+ CPG_FLOW_CONTROL_DISABLED, /**< flow control is disabled - new messages may be sent */
+ CPG_FLOW_CONTROL_ENABLED /**< flow control is enabled - new messages should not be sent */
+} cpg_flow_control_state_t;
+
+
+/**
+ * @brief The cpg_reason_t enum
+ */
+typedef enum {
+ CPG_REASON_UNDEFINED = 0,
+ CPG_REASON_JOIN = 1,
+ CPG_REASON_LEAVE = 2,
+ CPG_REASON_NODEDOWN = 3,
+ CPG_REASON_NODEUP = 4,
+ CPG_REASON_PROCDOWN = 5
+} cpg_reason_t;
+
+/**
+ * @brief The cpg_iteration_type_t enum
+ */
+typedef enum {
+ CPG_ITERATION_NAME_ONLY = 1,
+ CPG_ITERATION_ONE_GROUP = 2,
+ CPG_ITERATION_ALL = 3,
+} cpg_iteration_type_t;
+
+/**
+ * @brief The cpg_model_t enum
+ */
+typedef enum {
+ CPG_MODEL_V1 = 1,
+} cpg_model_t;
+
+/**
+ * @brief The cpg_address struct
+ */
+struct cpg_address {
+ uint32_t nodeid;
+ uint32_t pid;
+ uint32_t reason;
+};
+
+#define CPG_MAX_NAME_LENGTH 128
+/**
+ * @brief The cpg_name struct
+ */
+struct cpg_name {
+ uint32_t length;
+ char value[CPG_MAX_NAME_LENGTH];
+};
+
+#define CPG_MEMBERS_MAX 128
+
+/**
+ * @brief The cpg_iteration_description_t struct
+ */
+struct cpg_iteration_description_t {
+ struct cpg_name group;
+ uint32_t nodeid;
+ uint32_t pid;
+};
+
+/**
+ * @brief The cpg_ring_id struct
+ */
+struct cpg_ring_id {
+ uint32_t nodeid;
+ uint64_t seq;
+};
+
+/**
+ * @brief The cpg_deliver_fn_t callback
+ */
+typedef void (*cpg_deliver_fn_t) (
+ cpg_handle_t handle,
+ const struct cpg_name *group_name,
+ uint32_t nodeid,
+ uint32_t pid,
+ /**
+ * Unlike many "msg" pointers, this one is deliberately *not*
+ * declared const in order to permit in-place endian conversion.
+ */
+ void *msg,
+ size_t msg_len);
+
+/**
+ * @brief The cpg_confchg_fn_t callback
+ */
+typedef void (*cpg_confchg_fn_t) (
+ cpg_handle_t handle,
+ const struct cpg_name *group_name,
+ const struct cpg_address *member_list, size_t member_list_entries,
+ const struct cpg_address *left_list, size_t left_list_entries,
+ const struct cpg_address *joined_list, size_t joined_list_entries);
+
+/**
+ * @brief The cpg_totem_confchg_fn_t callback
+ */
+typedef void (*cpg_totem_confchg_fn_t) (
+ cpg_handle_t handle,
+ struct cpg_ring_id ring_id,
+ uint32_t member_list_entries,
+ const uint32_t *member_list);
+
+/**
+ * @brief The cpg_callbacks_t struct
+ */
+typedef struct {
+ cpg_deliver_fn_t cpg_deliver_fn;
+ cpg_confchg_fn_t cpg_confchg_fn;
+} cpg_callbacks_t;
+
+/**
+ * @brief The cpg_model_data_t struct
+ */
+typedef struct {
+ cpg_model_t model;
+} cpg_model_data_t;
+
+#define CPG_MODEL_V1_DELIVER_INITIAL_TOTEM_CONF 0x01
+
+/**
+ * @brief The cpg_model_v1_data_t struct
+ */
+typedef struct {
+ cpg_model_t model;
+ cpg_deliver_fn_t cpg_deliver_fn;
+ cpg_confchg_fn_t cpg_confchg_fn;
+ cpg_totem_confchg_fn_t cpg_totem_confchg_fn;
+ unsigned int flags;
+} cpg_model_v1_data_t;
+
+
+/** @} */
+
+/**
+ * @brief Create a new cpg connection
+ * @param handle
+ * @param callbacks
+ * @return
+ */
+cs_error_t cpg_initialize (
+ cpg_handle_t *handle,
+ cpg_callbacks_t *callbacks);
+
+/**
+ * @brief Create a new cpg connection, initialize with model
+ * @param handle
+ * @param model
+ * @param model_data
+ * @param context
+ * @return
+ */
+cs_error_t cpg_model_initialize (
+ cpg_handle_t *handle,
+ cpg_model_t model,
+ cpg_model_data_t *model_data,
+ void *context);
+
+/**
+ * @brief Close the cpg handle
+ * @param handle
+ * @return
+ */
+cs_error_t cpg_finalize (
+ cpg_handle_t handle);
+
+/**
+ * @brief Get a file descriptor on which to poll.
+ *
+ * cpg_handle_t is NOT a file descriptor and may not be used directly.
+ *
+ * @param handle
+ * @param fd
+ * @return
+ */
+cs_error_t cpg_fd_get (
+ cpg_handle_t handle,
+ int *fd);
+
+/**
+ * @brief Get maximum size of a message that will not be fragmented
+ * @param handle
+ * @param size
+ * @return
+ */
+cs_error_t cpg_max_atomic_msgsize_get (
+ cpg_handle_t handle,
+ uint32_t *size);
+
+/**
+ * @brief Get contexts for a CPG handle
+ * @param handle
+ * @param context
+ * @return
+ */
+cs_error_t cpg_context_get (
+ cpg_handle_t handle,
+ void **context);
+
+/**
+ * @brief Set contexts for a CPG handle
+ * @param handle
+ * @param context
+ * @return
+ */
+cs_error_t cpg_context_set (
+ cpg_handle_t handle,
+ void *context);
+
+/**
+ * @brief Dispatch messages and configuration changes
+ * @param handle
+ * @param dispatch_types
+ * @return
+ */
+cs_error_t cpg_dispatch (
+ cpg_handle_t handle,
+ cs_dispatch_flags_t dispatch_types);
+
+/**
+ * @brief Join one or more groups.
+ *
+ * messages multicasted with cpg_mcast_joined will be sent to every
+ * group that has been joined on handle handle. Any message multicasted
+ * to a group that has been previously joined will be delivered in cpg_dispatch
+ *
+ * @param handle
+ * @param group
+ * @return
+ */
+cs_error_t cpg_join (
+ cpg_handle_t handle,
+ const struct cpg_name *group);
+
+/**
+ * @brief Leave one or more groups
+ * @param handle
+ * @param group
+ * @return
+ */
+cs_error_t cpg_leave (
+ cpg_handle_t handle,
+ const struct cpg_name *group);
+
+/**
+ * @brief Multicast to groups joined with cpg_join.
+ *
+ * @param handle
+ * @param guarantee
+ * @param iovec This iovec will be multicasted to all groups joined with
+ * the cpg_join interface for handle.
+ * @param iov_len
+ */
+cs_error_t cpg_mcast_joined (
+ cpg_handle_t handle,
+ cpg_guarantee_t guarantee,
+ const struct iovec *iovec,
+ unsigned int iov_len);
+
+/**
+ * @brief Get membership information from cpg
+ * @param handle
+ * @param groupName
+ * @param member_list
+ * @param member_list_entries
+ * @return
+ */
+cs_error_t cpg_membership_get (
+ cpg_handle_t handle,
+ struct cpg_name *groupName,
+ struct cpg_address *member_list,
+ int *member_list_entries);
+/**
+ * @brief cpg_local_get
+ * @param handle
+ * @param local_nodeid
+ * @return
+ */
+cs_error_t cpg_local_get (
+ cpg_handle_t handle,
+ unsigned int *local_nodeid);
+
+/**
+ * @brief cpg_flow_control_state_get
+ * @param handle
+ * @param flow_control_enabled
+ * @return
+ */
+cs_error_t cpg_flow_control_state_get (
+ cpg_handle_t handle,
+ cpg_flow_control_state_t *flow_control_enabled);
+
+/**
+ * @brief cpg_zcb_alloc
+ * @param handle
+ * @param size
+ * @param buffer
+ * @return
+ */
+cs_error_t cpg_zcb_alloc (
+ cpg_handle_t handle,
+ size_t size,
+ void **buffer);
+
+/**
+ * @brief cpg_zcb_free
+ * @param handle
+ * @param buffer
+ * @return
+ */
+cs_error_t cpg_zcb_free (
+ cpg_handle_t handle,
+ void *buffer);
+
+/**
+ * @brief cpg_zcb_mcast_joined
+ * @param handle
+ * @param guarantee
+ * @param msg
+ * @param msg_len
+ * @return
+ */
+cs_error_t cpg_zcb_mcast_joined (
+ cpg_handle_t handle,
+ cpg_guarantee_t guarantee,
+ void *msg,
+ size_t msg_len);
+
+/**
+ * @brief cpg_iteration_initialize
+ * @param handle
+ * @param iteration_type
+ * @param group
+ * @param cpg_iteration_handle
+ * @return
+ */
+cs_error_t cpg_iteration_initialize(
+ cpg_handle_t handle,
+ cpg_iteration_type_t iteration_type,
+ const struct cpg_name *group,
+ cpg_iteration_handle_t *cpg_iteration_handle);
+
+/**
+ * @brief cpg_iteration_next
+ * @param handle
+ * @param description
+ * @return
+ */
+cs_error_t cpg_iteration_next(
+ cpg_iteration_handle_t handle,
+ struct cpg_iteration_description_t *description);
+
+/**
+ * @brief cpg_iteration_finalize
+ * @param handle
+ * @return
+ */
+cs_error_t cpg_iteration_finalize (
+ cpg_iteration_handle_t handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* COROSYNC_CPG_H_DEFINED */
diff --git a/include/corosync/hdb.h b/include/corosync/hdb.h
new file mode 100644
index 0000000..01f379b
--- /dev/null
+++ b/include/corosync/hdb.h
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2002-2006 MontaVista Software, Inc.
+ * Copyright (c) 2006-2011 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HDB_H_DEFINED
+#define HDB_H_DEFINED
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <errno.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+#include <stdint.h>
+#include <inttypes.h>
+#include <qb/qbhdb.h>
+
+typedef qb_handle_t hdb_handle_t;
+
+/*
+ * Formatting for string printing on 32/64 bit systems
+ */
+#define HDB_D_FORMAT QB_HDB_D_FORMAT
+#define HDB_X_FORMAT QB_HDB_X_FORMAT
+
+#define hdb_handle_database qb_hdb
+
+/**
+ * @brief hdb_database_lock
+ * @param mutex
+ */
+static inline void hdb_database_lock (pthread_mutex_t *mutex)
+{
+ pthread_mutex_lock (mutex);
+}
+
+/**
+ * @brief hdb_database_unlock
+ * @param mutex
+ */
+static inline void hdb_database_unlock (pthread_mutex_t *mutex)
+{
+ pthread_mutex_unlock (mutex);
+}
+
+/**
+ * @brief hdb_database_lock_init
+ * @param mutex
+ */
+static inline void hdb_database_lock_init (pthread_mutex_t *mutex)
+{
+ pthread_mutex_init (mutex, NULL);
+}
+
+/**
+ * @brief hdb_database_lock_destroy
+ * @param mutex
+ */
+static inline void hdb_database_lock_destroy (pthread_mutex_t *mutex)
+{
+ pthread_mutex_destroy (mutex);
+}
+
+#define DECLARE_HDB_DATABASE QB_HDB_DECLARE
+
+/**
+ * @brief hdb_create
+ * @param handle_database
+ */
+static inline void hdb_create (
+ struct hdb_handle_database *handle_database)
+{
+ qb_hdb_create (handle_database);
+}
+
+/**
+ * @brief hdb_destroy
+ * @param handle_database
+ */
+static inline void hdb_destroy (
+ struct hdb_handle_database *handle_database)
+{
+ qb_hdb_destroy (handle_database);
+}
+
+/**
+ * @brief hdb_handle_create
+ * @param handle_database
+ * @param instance_size
+ * @param handle_id_out
+ * @return
+ */
+static inline int hdb_handle_create (
+ struct hdb_handle_database *handle_database,
+ int instance_size,
+ hdb_handle_t *handle_id_out)
+{
+ return (qb_hdb_handle_create (handle_database, instance_size,
+ handle_id_out));
+}
+
+/**
+ * @brief hdb_handle_get
+ * @param handle_database
+ * @param handle_in
+ * @param instance
+ * @return
+ */
+static inline int hdb_handle_get (
+ struct hdb_handle_database *handle_database,
+ hdb_handle_t handle_in,
+ void **instance)
+{
+ return (qb_hdb_handle_get (handle_database, handle_in, instance));
+}
+
+/**
+ * @brief hdb_handle_get_always
+ * @param handle_database
+ * @param handle_in
+ * @param instance
+ * @return
+ */
+static inline int hdb_handle_get_always (
+ struct hdb_handle_database *handle_database,
+ hdb_handle_t handle_in,
+ void **instance)
+{
+ return (qb_hdb_handle_get_always (handle_database, handle_in, instance));
+}
+
+/**
+ * @brief hdb_handle_put
+ * @param handle_database
+ * @param handle_in
+ * @return
+ */
+static inline int hdb_handle_put (
+ struct hdb_handle_database *handle_database,
+ hdb_handle_t handle_in)
+{
+ return (qb_hdb_handle_put (handle_database, handle_in));
+}
+
+/**
+ * @brief hdb_handle_destroy
+ * @param handle_database
+ * @param handle_in
+ * @return
+ */
+static inline int hdb_handle_destroy (
+ struct hdb_handle_database *handle_database,
+ hdb_handle_t handle_in)
+{
+ return (qb_hdb_handle_destroy (handle_database, handle_in));
+}
+
+/**
+ * @brief hdb_handle_refcount_get
+ * @param handle_database
+ * @param handle_in
+ * @return
+ */
+static inline int hdb_handle_refcount_get (
+ struct hdb_handle_database *handle_database,
+ hdb_handle_t handle_in)
+{
+ return (qb_hdb_handle_refcount_get (handle_database, handle_in));
+}
+
+/**
+ * @brief hdb_iterator_reset
+ * @param handle_database
+ */
+static inline void hdb_iterator_reset (
+ struct hdb_handle_database *handle_database)
+{
+ qb_hdb_iterator_reset (handle_database);
+}
+
+/**
+ * @brief hdb_iterator_next
+ * @param handle_database
+ * @param instance
+ * @param handle
+ * @return
+ */
+static inline int hdb_iterator_next (
+ struct hdb_handle_database *handle_database,
+ void **instance,
+ hdb_handle_t *handle)
+{
+ return (qb_hdb_iterator_next (handle_database, instance, handle));
+}
+
+/**
+ * @brief hdb_base_convert
+ * @param handle
+ * @return
+ */
+static inline unsigned int hdb_base_convert (hdb_handle_t handle)
+{
+ return (qb_hdb_base_convert (handle));
+}
+
+/**
+ * @brief hdb_nocheck_convert
+ * @param handle
+ * @return
+ */
+static inline unsigned long long hdb_nocheck_convert (unsigned int handle)
+{
+ return (qb_hdb_nocheck_convert (handle));
+}
+
+#endif /* HDB_H_DEFINED */
diff --git a/include/corosync/icmap.h b/include/corosync/icmap.h
new file mode 100644
index 0000000..b168376
--- /dev/null
+++ b/include/corosync/icmap.h
@@ -0,0 +1,565 @@
+/*
+ * Copyright (c) 2011-2017 Red Hat, Inc.
+ *
+ * Author: Jan Friesse (jfriesse@redhat.com)
+ *
+ * All rights reserved.
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the Red Hat, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef ICMAP_H_DEFINED
+#define ICMAP_H_DEFINED
+
+#include <stdlib.h>
+#include <corosync/corotypes.h>
+#include <qb/qbmap.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Maximum length of key in icmap
+ */
+#define ICMAP_KEYNAME_MAXLEN 255
+
+/**
+ * Minimum lenght of key in icmap
+ */
+#define ICMAP_KEYNAME_MINLEN 3
+
+/**
+ * Possible types of value. Binary is raw data without trailing zero with given length
+ */
+typedef enum {
+ ICMAP_VALUETYPE_INT8 = 1,
+ ICMAP_VALUETYPE_UINT8 = 2,
+ ICMAP_VALUETYPE_INT16 = 3,
+ ICMAP_VALUETYPE_UINT16 = 4,
+ ICMAP_VALUETYPE_INT32 = 5,
+ ICMAP_VALUETYPE_UINT32 = 6,
+ ICMAP_VALUETYPE_INT64 = 7,
+ ICMAP_VALUETYPE_UINT64 = 8,
+ ICMAP_VALUETYPE_FLOAT = 9,
+ ICMAP_VALUETYPE_DOUBLE = 10,
+ ICMAP_VALUETYPE_STRING = 11,
+ ICMAP_VALUETYPE_BINARY = 12,
+} icmap_value_types_t;
+
+/*
+ * Tracking values.
+ */
+#define ICMAP_TRACK_ADD 4
+#define ICMAP_TRACK_DELETE 1
+#define ICMAP_TRACK_MODIFY 2
+
+/**
+ * Whole prefix is tracked, instead of key only (so "totem." tracking means that
+ * "totem.nodeid", "totem.version", ... applies). This value is also never returned
+ * inside of callback and is used only in adding track
+ */
+#define ICMAP_TRACK_PREFIX 8
+
+/**
+ * Structure passed as new_value and old_value in change callback. It contains type of
+ * key, length of key and pointer to value of key
+ */
+struct icmap_notify_value {
+ icmap_value_types_t type;
+ size_t len;
+ const void *data;
+};
+
+/**
+ * Prototype for notify callback function. Even is one of ICMAP_TRACK_* event, key_name is
+ * changed key, new and old_value contains values or are zeroed (in other words, type is non
+ * existing 0 type) if there were no old (creating of key) or new (deleting of key) value.
+ * user_data are passed when adding tracking.
+ */
+typedef void (*icmap_notify_fn_t) (
+ int32_t event,
+ const char *key_name,
+ struct icmap_notify_value new_value,
+ struct icmap_notify_value old_value,
+ void *user_data);
+
+/**
+ * @brief icmap type.
+ *
+ * icmap.c contains global variable (icmap_global_map) of this type. This
+ * is used in every non-reentant call. Also only in this table are implemented
+ * operations like set_ro and tracking of values. Other tables (created by
+ * icmap_init_r) are simple map tables with get/set/iter operations.
+ */
+typedef struct icmap_map *icmap_map_t;
+
+/**
+ * @brief Itterator type
+ */
+typedef qb_map_iter_t *icmap_iter_t;
+
+/**
+ * @brief Track type
+ */
+typedef struct icmap_track *icmap_track_t;
+
+/**
+ * @brief Initialize global icmap
+ * @return
+ */
+extern cs_error_t icmap_init(void);
+
+/**
+ * @brief Initialize additional (local, reentrant) icmap_map. Content of variable
+ * result is undefined if return code is not CS_OK.
+ * @param result
+ * @return
+ */
+extern cs_error_t icmap_init_r(icmap_map_t *result);
+
+/**
+ * @brief Finalize global icmap
+ */
+extern void icmap_fini(void);
+
+/**
+ * @brief Finalize local, reentrant icmap
+ * @param map
+ */
+extern void icmap_fini_r(const icmap_map_t map);
+
+/**
+ * @brief Return global icmap
+ * @return
+ */
+extern icmap_map_t icmap_get_global_map(void);
+
+/**
+ * @brief Compare value of key with name key_name1 in map1 with key with name key_name2
+ * in map2.
+ *
+ * Two values must have same type, length and value to be considered equal.
+ * Function returns 0 when any of map1, key_name1, map2, key_name2 are NULL, or
+ * key_name is not found in map, or keys are not equal. != 0 is returned when
+ * values are equal.
+ *
+ * @param map1
+ * @param key_name1
+ * @param map2
+ * @param key_name2
+ * @return
+ */
+extern int icmap_key_value_eq(
+ const icmap_map_t map1,
+ const char *key_name1,
+ const icmap_map_t map2,
+ const char *key_name2);
+
+/**
+ * @brief Store value with value_len length and type as key_name name in global icmap.
+ * @param key_name
+ * @param value
+ * @param value_len
+ * @param type
+ * @return
+ */
+extern cs_error_t icmap_set(
+ const char *key_name,
+ const void *value,
+ size_t value_len,
+ icmap_value_types_t type);
+
+/**
+ * @brief Reentrant version of icmap_set
+ * @param map
+ * @param key_name
+ * @param value
+ * @param value_len
+ * @param type
+ * @return
+ */
+extern cs_error_t icmap_set_r(
+ const icmap_map_t map,
+ const char *key_name,
+ const void *value,
+ size_t value_len,
+ icmap_value_types_t type);
+
+/*
+ * Shortcuts for setting values
+ */
+extern cs_error_t icmap_set_int8(const char *key_name, int8_t value);
+extern cs_error_t icmap_set_uint8(const char *key_name, uint8_t value);
+extern cs_error_t icmap_set_int16(const char *key_name, int16_t value);
+extern cs_error_t icmap_set_uint16(const char *key_name, uint16_t value);
+extern cs_error_t icmap_set_int32(const char *key_name, int32_t value);
+extern cs_error_t icmap_set_uint32(const char *key_name, uint32_t value);
+extern cs_error_t icmap_set_int64(const char *key_name, int64_t value);
+extern cs_error_t icmap_set_uint64(const char *key_name, uint64_t value);
+extern cs_error_t icmap_set_float(const char *key_name, float value);
+extern cs_error_t icmap_set_double(const char *key_name, double value);
+extern cs_error_t icmap_set_string(const char *key_name, const char *value);
+
+extern cs_error_t icmap_set_int8_r(const icmap_map_t map, const char *key_name, int8_t value);
+extern cs_error_t icmap_set_uint8_r(const icmap_map_t map, const char *key_name, uint8_t value);
+extern cs_error_t icmap_set_int16_r(const icmap_map_t map, const char *key_name, int16_t value);
+extern cs_error_t icmap_set_uint16_r(const icmap_map_t map, const char *key_name, uint16_t value);
+extern cs_error_t icmap_set_int32_r(const icmap_map_t map, const char *key_name, int32_t value);
+extern cs_error_t icmap_set_uint32_r(const icmap_map_t map, const char *key_name, uint32_t value);
+extern cs_error_t icmap_set_int64_r(const icmap_map_t map, const char *key_name, int64_t value);
+extern cs_error_t icmap_set_uint64_r(const icmap_map_t map, const char *key_name, uint64_t value);
+extern cs_error_t icmap_set_float_r(const icmap_map_t map, const char *key_name, float value);
+extern cs_error_t icmap_set_double_r(const icmap_map_t map, const char *key_name, double value);
+extern cs_error_t icmap_set_string_r(const icmap_map_t map, const char *key_name, const char *value);
+
+/**
+ * @brief Delete key from map
+ * @param key_name
+ * @return
+ */
+extern cs_error_t icmap_delete(const char *key_name);
+
+/**
+ * @brief icmap_delete_r
+ * @param map
+ * @param key_name
+ * @return
+ */
+extern cs_error_t icmap_delete_r(const icmap_map_t map, const char *key_name);
+
+/**
+ * @brief Retrieve value of key key_name and store it in user preallocated value pointer.
+ *
+ * Value can be NULL, and then only value_len and/or type is returned (both of them
+ * can also be NULL). If value is not NULL, actual length of value in map is checked
+ * against value_len. If *value_len is shorter then length of value in map, error
+ * CS_ERR_INVALID_PARAM is returned. After successful copy of value, value_len is
+ * set to actual length of value in map.
+ *
+ * @param key_name
+ * @param value
+ * @param value_len
+ * @param type
+ * @return
+ */
+extern cs_error_t icmap_get(
+ const char *key_name,
+ void *value,
+ size_t *value_len,
+ icmap_value_types_t *type);
+
+/**
+ * @brief Same as icmap_get but it's reentrant and operates on given icmap_map
+ * @param map
+ * @param key_name
+ * @param value
+ * @param value_len
+ * @param type
+ * @return
+ */
+extern cs_error_t icmap_get_r(
+ const icmap_map_t map,
+ const char *key_name,
+ void *value,
+ size_t *value_len,
+ icmap_value_types_t *type);
+
+/*
+ * Shortcuts for icmap_get
+ */
+extern cs_error_t icmap_get_int8(const char *key_name, int8_t *i8);
+extern cs_error_t icmap_get_uint8(const char *key_name, uint8_t *u8);
+extern cs_error_t icmap_get_int16(const char *key_name, int16_t *i16);
+extern cs_error_t icmap_get_uint16(const char *key_name, uint16_t *u16);
+extern cs_error_t icmap_get_int32(const char *key_name, int32_t *i32);
+extern cs_error_t icmap_get_uint32(const char *key_name, uint32_t *u32);
+extern cs_error_t icmap_get_int64(const char *key_name, int64_t *i64);
+extern cs_error_t icmap_get_uint64(const char *key_name, uint64_t *u64);
+extern cs_error_t icmap_get_float(const char *key_name, float *flt);
+extern cs_error_t icmap_get_double(const char *key_name, double *dbl);
+
+/*
+ * Shortcuts for icmap_get_r
+ */
+extern cs_error_t icmap_get_int8_r(const icmap_map_t map, const char *key_name, int8_t *i8);
+extern cs_error_t icmap_get_uint8_r(const icmap_map_t map, const char *key_name, uint8_t *u8);
+extern cs_error_t icmap_get_int16_r(const icmap_map_t map, const char *key_name, int16_t *i16);
+extern cs_error_t icmap_get_uint16_r(const icmap_map_t map, const char *key_name, uint16_t *u16);
+extern cs_error_t icmap_get_int32_r(const icmap_map_t map, const char *key_name, int32_t *i32);
+extern cs_error_t icmap_get_uint32_r(const icmap_map_t map, const char *key_name, uint32_t *u32);
+extern cs_error_t icmap_get_int64_r(const icmap_map_t map, const char *key_name, int64_t *i64);
+extern cs_error_t icmap_get_uint64_r(const icmap_map_t map, const char *key_name, uint64_t *u64);
+extern cs_error_t icmap_get_float_r(const icmap_map_t map, const char *key_name, float *flt);
+extern cs_error_t icmap_get_double_r(const icmap_map_t map, const char *key_name, double *dbl);
+extern cs_error_t icmap_get_string_r(const icmap_map_t map, const char *key_name, char **str);
+
+/**
+ * @brief Shortcut for icmap_get for string type.
+ *
+ * Returned string is newly allocated and
+ * caller is responsible for freeing memory
+ *
+ * @param key_name
+ * @param str
+ * @return
+ */
+extern cs_error_t icmap_get_string(const char *key_name, char **str);
+
+/**
+ * @brief icmap_adjust_int
+ *
+ * Defined only for [u]int* values. It adds step to current value.
+ *
+ * @param key_name
+ * @param step
+ * @return
+ */
+extern cs_error_t icmap_adjust_int(const char *key_name, int32_t step);
+
+/**
+ * @brief icmap_adjust_int_r
+ * @param map
+ * @param key_name
+ * @param step
+ * @return
+ */
+extern cs_error_t icmap_adjust_int_r(const icmap_map_t map, const char *key_name, int32_t step);
+
+/**
+ * @brief icmap_fast_adjust_int
+ *
+ * Defined only for [u]int* values. It adds step to current value. Difference
+ * between this function and icmap_adjust_int is given in fact, that in
+ * tracking callback, old value is undefined, but whole process is done
+ * without malloc/memcpy.
+ *
+ * @param key_name
+ * @param step
+ * @return
+ */
+extern cs_error_t icmap_fast_adjust_int(const char *key_name, int32_t step);
+
+/**
+ * @brief icmap_fast_adjust_int_r
+ * @param map
+ * @param key_name
+ * @param step
+ * @return
+ */
+extern cs_error_t icmap_fast_adjust_int_r(const icmap_map_t map, const char *key_name, int32_t step);
+
+/**
+ * @brief Increase stored value by one
+ * @param key_name
+ * @return
+ */
+extern cs_error_t icmap_inc(const char *key_name);
+
+/**
+ * @brief icmap_inc_r
+ * @param map
+ * @param key_name
+ * @return
+ */
+extern cs_error_t icmap_inc_r(const icmap_map_t map, const char *key_name);
+
+/**
+ * @brief Decrease stored value by one
+ * @param key_name
+ * @return
+ */
+extern cs_error_t icmap_dec(const char *key_name);
+
+/**
+ * @brief icmap_dec_r
+ * @param map
+ * @param key_name
+ * @return
+ */
+extern cs_error_t icmap_dec_r(const icmap_map_t map, const char *key_name);
+
+/**
+ * @brief Increase stored value by one.
+ *
+ * Difference between this function and icmap_inc
+ * is same as between icmap_adjust_int and icmap_fast_adjust_int.
+ *
+ * @param key_name
+ * @return
+ */
+extern cs_error_t icmap_fast_inc(const char *key_name);
+
+/**
+ * @brief icmap_fast_inc_r
+ * @param map
+ * @param key_name
+ * @return
+ */
+extern cs_error_t icmap_fast_inc_r(const icmap_map_t map, const char *key_name);
+
+/**
+ * @brief Decrease stored value by one.
+ *
+ * Difference between this function and icmap_dec
+ * is same as between icmap_adjust_int and icmap_fast_adjust_int.
+ *
+ * @param key_name
+ * @return
+ */
+extern cs_error_t icmap_fast_dec(const char *key_name);
+
+/**
+ * @brief icmap_fast_dec_r
+ * @param map
+ * @param key_name
+ * @return
+ */
+extern cs_error_t icmap_fast_dec_r(const icmap_map_t map, const char *key_name);
+
+/**
+ * @brief Initialize iterator with given prefix
+ * @param prefix
+ * @return
+ */
+extern icmap_iter_t icmap_iter_init(const char *prefix);
+
+/**
+ * @brief icmap_iter_init_r
+ * @param map
+ * @param prefix
+ * @return
+ */
+extern icmap_iter_t icmap_iter_init_r(const icmap_map_t map, const char *prefix);
+
+/**
+ * @brief Return next item in iterator iter.
+ *
+ * value_len and type are optional (= can be NULL), but if set, length of returned value
+ * and/or type is returned. Function returns following key_name or NULL if iteration is over.
+ *
+ * @param iter
+ * @param value_len
+ * @param type
+ * @return
+ */
+extern const char *icmap_iter_next(icmap_iter_t iter, size_t *value_len, icmap_value_types_t *type);
+
+/**
+ * @brief Finalize iterator
+ * @param iter
+ */
+extern void icmap_iter_finalize(icmap_iter_t iter);
+
+/**
+ * @brief Add tracking function for given key_name.
+ *
+ * Tracked changes (add|modify|delete) depend on track_type, which is bitwise or of ICMAP_TRACK_* values.
+ * notify_fn is called on change, where user_data pointer is passed (unchanged).
+ * Value which can be used to delete tracking is passed as icmap_track.
+ *
+ * @param key_name
+ * @param track_type
+ * @param notify_fn
+ * @param user_data
+ * @param icmap_track
+ * @return
+ */
+extern cs_error_t icmap_track_add(
+ const char *key_name,
+ int32_t track_type,
+ icmap_notify_fn_t notify_fn,
+ void *user_data,
+ icmap_track_t *icmap_track);
+
+/**
+ * @brief Return user data associated with given track
+ * @param icmap_track
+ * @return
+ */
+extern void *icmap_track_get_user_data(icmap_track_t icmap_track);
+
+/**
+ * @brief Remove previously added track
+ * @param icmap_track
+ * @return
+ */
+extern cs_error_t icmap_track_delete(icmap_track_t icmap_track);
+
+/**
+ * @brief Set read-only access for given key (key_name) or prefix,
+ * If prefix is set. ro_access can be !0, which means, that old information
+ * about ro of this key is deleted. Read-only access is used only in CMAP service!
+ * (in other word it prevents users from deleting/changing key, but doesn't
+ * guarantee anything for internal icmap users.)
+ * @param key_name
+ * @param prefix
+ * @param ro_access
+ * @return
+ */
+extern cs_error_t icmap_set_ro_access(const char *key_name, int prefix, int ro_access);
+
+/**
+ * @brief Check in given key is read only. Returns !0 if so, otherwise (key is rw) 0.
+ * @param key_name
+ * @return
+ */
+extern int icmap_is_key_ro(const char *key_name);
+
+/**
+ * @brief Converts given key_name to valid key name (replacing all prohibited characters by _)
+ * @param key_name
+ */
+extern void icmap_convert_name_to_valid_name(char *key_name);
+
+/**
+ * @brief Copy content of src_map icmap to dst_map icmap.
+ * @param dst_map
+ * @param src_map
+ * @return
+ */
+extern cs_error_t icmap_copy_map(icmap_map_t dst_map, const icmap_map_t src_map);
+
+/*
+ * Returns length of value of given type, or 0 for string and binary data type
+ */
+size_t icmap_get_valuetype_len(icmap_value_types_t type);
+
+/*
+ * Converts track type of icmap to qb
+ */
+int32_t icmap_tt_to_qbtt(int32_t track_type);
+
+/*
+ * Convert track type of qb to icmap
+ */
+int32_t icmap_qbtt_to_tt(int32_t track_type);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ICMAP_H_DEFINED */
diff --git a/include/corosync/ipc_cfg.h b/include/corosync/ipc_cfg.h
new file mode 100644
index 0000000..07e4adc
--- /dev/null
+++ b/include/corosync/ipc_cfg.h
@@ -0,0 +1,307 @@
+/*
+ * Copyright (c) 2005 MontaVista Software, Inc.
+ * Copyright (c) 2009-2013 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef IPC_CFG_H_DEFINED
+#define IPC_CFG_H_DEFINED
+
+#include <netinet/in.h>
+#include <corosync/corotypes.h>
+#include <corosync/mar_gen.h>
+
+#define CFG_INTERFACE_NAME_MAX_LEN 128
+#define CFG_INTERFACE_STATUS_MAX_LEN 512
+/*
+ * Too keep future ABI compatibility, this value
+ * is intentionaly bigger then INTERFACE_MAX
+ */
+#define CFG_MAX_INTERFACES 16
+
+/**
+ * @brief The req_lib_cfg_types enum
+ */
+enum req_lib_cfg_types {
+ MESSAGE_REQ_CFG_RINGSTATUSGET = 0,
+ MESSAGE_REQ_CFG_RINGREENABLE = 1,
+ MESSAGE_REQ_CFG_KILLNODE = 2,
+ MESSAGE_REQ_CFG_TRYSHUTDOWN = 3,
+ MESSAGE_REQ_CFG_REPLYTOSHUTDOWN = 4,
+ MESSAGE_REQ_CFG_GET_NODE_ADDRS = 5,
+ MESSAGE_REQ_CFG_LOCAL_GET = 6,
+ MESSAGE_REQ_CFG_RELOAD_CONFIG = 7,
+ MESSAGE_REQ_CFG_REOPEN_LOG_FILES = 8,
+ MESSAGE_REQ_CFG_NODESTATUSGET = 9,
+ MESSAGE_REQ_CFG_TRACKSTART = 10,
+ MESSAGE_REQ_CFG_TRACKSTOP = 11
+};
+
+/**
+ * @brief The res_lib_cfg_types enum
+ */
+enum res_lib_cfg_types {
+ MESSAGE_RES_CFG_RINGSTATUSGET = 0,
+ MESSAGE_RES_CFG_RINGREENABLE = 1,
+ MESSAGE_RES_CFG_STATETRACKSTART = 2,
+ MESSAGE_RES_CFG_STATETRACKSTOP = 3,
+ MESSAGE_RES_CFG_ADMINISTRATIVESTATESET = 4,
+ MESSAGE_RES_CFG_ADMINISTRATIVESTATEGET = 5,
+ MESSAGE_RES_CFG_SERVICELOAD = 6,
+ MESSAGE_RES_CFG_SERVICEUNLOAD = 7,
+ MESSAGE_RES_CFG_KILLNODE = 8,
+ MESSAGE_RES_CFG_TRYSHUTDOWN = 9,
+ MESSAGE_RES_CFG_TESTSHUTDOWN = 10,
+ MESSAGE_RES_CFG_GET_NODE_ADDRS = 11,
+ MESSAGE_RES_CFG_LOCAL_GET = 12,
+ MESSAGE_RES_CFG_REPLYTOSHUTDOWN = 13,
+ MESSAGE_RES_CFG_RELOAD_CONFIG = 14,
+ MESSAGE_RES_CFG_REOPEN_LOG_FILES = 15,
+ MESSAGE_RES_CFG_NODESTATUSGET = 16
+};
+
+/**
+ * @brief The req_lib_cfg_ringstatusget struct
+ */
+struct req_lib_cfg_ringstatusget {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cfg_ringstatusget struct
+ */
+struct res_lib_cfg_ringstatusget {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint32_t interface_count __attribute__((aligned(8)));
+ char interface_name[CFG_MAX_INTERFACES][CFG_INTERFACE_NAME_MAX_LEN] __attribute__((aligned(8)));
+ char interface_status[CFG_MAX_INTERFACES][CFG_INTERFACE_STATUS_MAX_LEN] __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cfg_nodestatusget struct
+ */
+struct req_lib_cfg_nodestatusget {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ unsigned int nodeid __attribute__((aligned(8)));
+ mar_uint32_t version __attribute__((aligned(8)));
+};
+
+struct res_lib_cfg_nodestatusget_version {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ corosync_cfg_node_status_version_t version __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cfg_nodestatusget struct
+ */
+struct res_lib_cfg_nodestatusget_v1 {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ struct corosync_cfg_node_status_v1 node_status __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cfg_ringreenable struct
+ */
+struct req_lib_cfg_ringreenable {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cfg_ringreenable struct
+ */
+struct res_lib_cfg_ringreenable {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cfg_killnode struct
+ */
+struct req_lib_cfg_killnode {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ unsigned int nodeid __attribute__((aligned(8)));
+ cs_name_t reason __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cfg_killnode struct
+ */
+struct res_lib_cfg_killnode {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cfg_tryshutdown struct
+ */
+struct req_lib_cfg_tryshutdown {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ unsigned int flags;
+};
+
+/**
+ * @brief The res_lib_cfg_tryshutdown struct
+ */
+struct res_lib_cfg_tryshutdown {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cfg_replytoshutdown struct
+ */
+struct req_lib_cfg_replytoshutdown {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ unsigned int response;
+};
+
+/**
+ * @brief The res_lib_cfg_replytoshutdown struct
+ */
+struct res_lib_cfg_replytoshutdown {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cfg_testshutdown struct
+ */
+struct res_lib_cfg_testshutdown {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ unsigned int flags;
+};
+
+/**
+ * @brief The req_lib_cfg_get_node_addrs struct
+ */
+struct req_lib_cfg_get_node_addrs {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ unsigned int nodeid;
+};
+
+/**
+ * @brief The res_lib_cfg_get_node_addrs struct
+ */
+struct res_lib_cfg_get_node_addrs {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ unsigned int family;
+ unsigned int num_addrs;
+ /* array of TOTEMIP_ADDRLEN items */
+ char addrs[];
+};
+
+/**
+ * @brief The req_lib_cfg_local_get struct
+ */
+struct req_lib_cfg_local_get {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cfg_local_get struct
+ */
+struct res_lib_cfg_local_get {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint32_t local_nodeid __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cfg_reload_config struct
+ */
+struct req_lib_cfg_reload_config {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cfg_reload_config struct
+ */
+struct res_lib_cfg_reload_config {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cfg_reopen_log_files struct
+ */
+struct req_lib_cfg_reopen_log_files {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cfg_reopen_log_files struct
+ */
+struct res_lib_cfg_reopen_log_files {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+struct req_lib_cfg_trackstart {
+ struct qb_ipc_request_header header;
+ uint8_t track_flags;
+};
+
+struct res_lib_cfg_trackstart {
+ struct qb_ipc_response_header header;
+};
+
+struct req_lib_cfg_trackstop {
+ struct qb_ipc_request_header header;
+};
+
+struct res_lib_cfg_trackstop {
+ struct qb_ipc_response_header header;
+};
+
+
+/**
+ * @brief corosync_administrative_target_t enum
+ */
+typedef enum {
+ AIS_AMF_ADMINISTRATIVETARGET_SERVICEUNIT = 0,
+ AIS_AMF_ADMINISTRATIVETARGET_SERVICEGROUP = 1,
+ AIS_AMF_ADMINISTRATIVETARGET_COMPONENTSERVICEINSTANCE = 2,
+ AIS_AMF_ADMINISTRATIVETARGET_NODE = 3
+} corosync_administrative_target_t;
+
+/**
+ * @brief corosync_administrative_state_t enum
+ */
+typedef enum {
+ AIS_AMF_ADMINISTRATIVESTATE_UNLOCKED = 0,
+ AIS_AMF_ADMINISTRATIVESTATE_LOCKED = 1,
+ AIS_AMF_ADMINISTRATIVESTATE_STOPPING = 2
+} corosync_administrative_state_t;
+
+/**
+ * @brief corosync_shutdown_flags_t enum
+ */
+typedef enum {
+ CFG_SHUTDOWN_FLAG_REQUEST = 0,
+ CFG_SHUTDOWN_FLAG_REGARDLESS = 1,
+ CFG_SHUTDOWN_FLAG_IMMEDIATE = 2,
+} corosync_shutdown_flags_t;
+
+
+#endif /* IPC_CFG_H_DEFINED */
diff --git a/include/corosync/ipc_cmap.h b/include/corosync/ipc_cmap.h
new file mode 100644
index 0000000..8a39b03
--- /dev/null
+++ b/include/corosync/ipc_cmap.h
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2011-2017 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Jan Friesse (jfriesse@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the Red Hat, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IPC_CMAP_H_DEFINED
+#define IPC_CMAP_H_DEFINED
+
+#include <netinet/in.h>
+#include <corosync/corotypes.h>
+#include <corosync/mar_gen.h>
+
+/**
+ * @brief The req_cmap_types enum
+ */
+enum req_cmap_types {
+ MESSAGE_REQ_CMAP_SET = 0,
+ MESSAGE_REQ_CMAP_DELETE = 1,
+ MESSAGE_REQ_CMAP_GET = 2,
+ MESSAGE_REQ_CMAP_ADJUST_INT = 3,
+ MESSAGE_REQ_CMAP_ITER_INIT = 4,
+ MESSAGE_REQ_CMAP_ITER_NEXT = 5,
+ MESSAGE_REQ_CMAP_ITER_FINALIZE = 6,
+ MESSAGE_REQ_CMAP_TRACK_ADD = 7,
+ MESSAGE_REQ_CMAP_TRACK_DELETE = 8,
+ MESSAGE_REQ_CMAP_SET_CURRENT_MAP = 9,
+};
+
+/**
+ * @brief The res_cmap_types enum
+ */
+enum res_cmap_types {
+ MESSAGE_RES_CMAP_SET = 0,
+ MESSAGE_RES_CMAP_DELETE = 1,
+ MESSAGE_RES_CMAP_GET = 2,
+ MESSAGE_RES_CMAP_ADJUST_INT = 3,
+ MESSAGE_RES_CMAP_ITER_INIT = 4,
+ MESSAGE_RES_CMAP_ITER_NEXT = 5,
+ MESSAGE_RES_CMAP_ITER_FINALIZE = 6,
+ MESSAGE_RES_CMAP_TRACK_ADD = 7,
+ MESSAGE_RES_CMAP_TRACK_DELETE = 8,
+ MESSAGE_RES_CMAP_NOTIFY_CALLBACK = 9,
+ MESSAGE_RES_CMAP_SET_CURRENT_MAP = 10,
+};
+
+enum {
+ CMAP_SETMAP_DEFAULT = 0,
+ CMAP_SETMAP_STATS = 1,
+};
+
+/**
+ * @brief The req_lib_cmap_set struct
+ */
+struct req_lib_cmap_set {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_name_t key_name __attribute__((aligned(8)));
+ mar_size_t value_len __attribute__((aligned(8)));
+ mar_uint8_t type __attribute__((aligned(8)));
+ mar_uint8_t value[] __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cmap_set struct
+ */
+struct res_lib_cmap_set {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cmap_delete struct
+ */
+struct req_lib_cmap_delete {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_name_t key_name __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cmap_delete struct
+ */
+struct res_lib_cmap_delete {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cmap_get struct
+ */
+struct req_lib_cmap_get {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_name_t key_name __attribute__((aligned(8)));
+ mar_size_t value_len __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cmap_get struct
+ */
+struct res_lib_cmap_get {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_size_t value_len __attribute__((aligned(8)));
+ mar_uint8_t type __attribute__((aligned(8)));
+ mar_uint8_t value[] __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cmap_adjust_int struct
+ */
+struct req_lib_cmap_adjust_int {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_name_t key_name __attribute__((aligned(8)));
+ mar_int32_t step __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cmap_adjust_int struct
+ */
+struct res_lib_cmap_adjust_int {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cmap_iter_init struct
+ */
+struct req_lib_cmap_iter_init {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_name_t prefix __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cmap_iter_init struct
+ */
+struct res_lib_cmap_iter_init {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint64_t iter_handle __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cmap_iter_next struct
+ */
+struct req_lib_cmap_iter_next {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_uint64_t iter_handle __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cmap_iter_next struct
+ */
+struct res_lib_cmap_iter_next {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_name_t key_name __attribute__((aligned(8)));
+ mar_size_t value_len __attribute__((aligned(8)));
+ mar_uint8_t type __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cmap_iter_finalize struct
+ */
+struct req_lib_cmap_iter_finalize {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_uint64_t iter_handle __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cmap_iter_finalize struct
+ */
+struct res_lib_cmap_iter_finalize {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cmap_track_add struct
+ */
+struct req_lib_cmap_track_add {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_name_t key_name __attribute__((aligned(8)));
+ mar_int32_t track_type __attribute__((aligned(8)));
+ mar_uint64_t track_inst_handle __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cmap_track_add struct
+ */
+struct res_lib_cmap_track_add {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint64_t track_handle __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cmap_track_delete struct
+ */
+struct req_lib_cmap_track_delete {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_uint64_t track_handle __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cmap_track_delete struct
+ */
+struct res_lib_cmap_track_delete {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint64_t track_inst_handle __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cmap_notify_callback struct
+ */
+struct res_lib_cmap_notify_callback {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint64_t track_inst_handle __attribute__((aligned(8)));
+ mar_name_t key_name __attribute__((aligned(8)));
+ mar_int32_t event __attribute__((aligned(8)));
+ mar_uint8_t new_value_type __attribute__((aligned(8)));
+ mar_uint8_t old_value_type __attribute__((aligned(8)));
+ mar_size_t new_value_len __attribute__((aligned(8)));
+ mar_size_t old_value_len __attribute__((aligned(8)));
+ /*
+ * After old_vale_len, there are two items with length of new_value_len
+ * and old_value_len, only first (as a pointer) is defined
+ *
+ * mar_uint8_t *new_value;
+ * mar_uint8_t *old_value;
+ */
+ mar_uint8_t new_value[];
+};
+
+/**
+ * @brief The req_lib_cmap_set_current_map struct
+ * used by cmap_initialize_map()
+ */
+struct req_lib_cmap_set_current_map {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_int32_t map __attribute__((aligned(8)));
+};
+
+
+#endif /* IPC_CMAP_H_DEFINED */
diff --git a/include/corosync/ipc_cpg.h b/include/corosync/ipc_cpg.h
new file mode 100644
index 0000000..67ef737
--- /dev/null
+++ b/include/corosync/ipc_cpg.h
@@ -0,0 +1,502 @@
+/*
+ * Copyright (c) 2006-2015 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Christine Caulfield (ccaulfie@redhat.com)
+ * Author: Jan Friesse (jfriesse@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef IPC_CPG_H_DEFINED
+#define IPC_CPG_H_DEFINED
+
+#include <netinet/in.h>
+#include <qb/qbipc_common.h>
+#include <corosync/corotypes.h>
+#include <corosync/mar_gen.h>
+
+#define CPG_ZC_PATH_LEN 128
+
+/**
+ * @brief The req_cpg_types enum
+ */
+enum req_cpg_types {
+ MESSAGE_REQ_CPG_JOIN = 0,
+ MESSAGE_REQ_CPG_LEAVE = 1,
+ MESSAGE_REQ_CPG_MCAST = 2,
+ MESSAGE_REQ_CPG_MEMBERSHIP = 3,
+ MESSAGE_REQ_CPG_LOCAL_GET = 4,
+ MESSAGE_REQ_CPG_ITERATIONINITIALIZE = 5,
+ MESSAGE_REQ_CPG_ITERATIONNEXT = 6,
+ MESSAGE_REQ_CPG_ITERATIONFINALIZE = 7,
+ MESSAGE_REQ_CPG_FINALIZE = 8,
+ MESSAGE_REQ_CPG_ZC_ALLOC = 9,
+ MESSAGE_REQ_CPG_ZC_FREE = 10,
+ MESSAGE_REQ_CPG_ZC_EXECUTE = 11,
+ MESSAGE_REQ_CPG_PARTIAL_MCAST = 12,
+};
+
+/**
+ * @brief The res_cpg_types enum
+ */
+enum res_cpg_types {
+ MESSAGE_RES_CPG_JOIN = 0,
+ MESSAGE_RES_CPG_LEAVE = 1,
+ MESSAGE_RES_CPG_MCAST = 2,
+ MESSAGE_RES_CPG_MEMBERSHIP = 3,
+ MESSAGE_RES_CPG_CONFCHG_CALLBACK = 4,
+ MESSAGE_RES_CPG_DELIVER_CALLBACK = 5,
+ MESSAGE_RES_CPG_FLOW_CONTROL_STATE_SET = 6,
+ MESSAGE_RES_CPG_LOCAL_GET = 7,
+ MESSAGE_RES_CPG_FLOWCONTROL_CALLBACK = 8,
+ MESSAGE_RES_CPG_ITERATIONINITIALIZE = 9,
+ MESSAGE_RES_CPG_ITERATIONNEXT = 10,
+ MESSAGE_RES_CPG_ITERATIONFINALIZE = 11,
+ MESSAGE_RES_CPG_FINALIZE = 12,
+ MESSAGE_RES_CPG_TOTEM_CONFCHG_CALLBACK = 13,
+ MESSAGE_RES_CPG_ZC_ALLOC = 14,
+ MESSAGE_RES_CPG_ZC_FREE = 15,
+ MESSAGE_RES_CPG_ZC_EXECUTE = 16,
+ MESSAGE_RES_CPG_PARTIAL_DELIVER_CALLBACK = 17,
+ MESSAGE_RES_CPG_PARTIAL_SEND = 18,
+};
+
+/**
+ * @brief The lib_cpg_confchg_reason enum
+ */
+enum lib_cpg_confchg_reason {
+ CONFCHG_CPG_REASON_JOIN = 1,
+ CONFCHG_CPG_REASON_LEAVE = 2,
+ CONFCHG_CPG_REASON_NODEDOWN = 3,
+ CONFCHG_CPG_REASON_NODEUP = 4,
+ CONFCHG_CPG_REASON_PROCDOWN = 5
+};
+
+/**
+ * @brief The lib_cpg_partial_types enum
+ */
+enum lib_cpg_partial_types {
+ LIBCPG_PARTIAL_FIRST = 1,
+ LIBCPG_PARTIAL_CONTINUED = 2,
+ LIBCPG_PARTIAL_LAST = 3,
+};
+
+/**
+ * @brief mar_cpg_name_t struct
+ */
+typedef struct {
+ uint32_t length __attribute__((aligned(8)));
+ char value[CPG_MAX_NAME_LENGTH] __attribute__((aligned(8)));
+} mar_cpg_name_t;
+
+/**
+ * @brief swab_mar_cpg_name_t
+ * @param to_swab
+ */
+static inline void swab_mar_cpg_name_t (mar_cpg_name_t *to_swab)
+{
+ swab_mar_uint32_t (&to_swab->length);
+}
+
+/**
+ * @brief marshall_from_mar_cpg_name_t
+ * @param dest
+ * @param src
+ */
+static inline void marshall_from_mar_cpg_name_t (
+ struct cpg_name *dest,
+ const mar_cpg_name_t *src)
+{
+ dest->length = src->length;
+ memcpy (&dest->value, &src->value, CPG_MAX_NAME_LENGTH);
+}
+
+/**
+ * @brief marshall_to_mar_cpg_name_t
+ * @param dest
+ * @param src
+ */
+static inline void marshall_to_mar_cpg_name_t (
+ mar_cpg_name_t *dest,
+ const struct cpg_name *src)
+{
+ dest->length = src->length;
+ memcpy (&dest->value, &src->value, CPG_MAX_NAME_LENGTH);
+}
+
+/**
+ * @brief mar_cpg_address_t struct
+ */
+typedef struct {
+ mar_uint32_t nodeid __attribute__((aligned(8)));
+ mar_uint32_t pid __attribute__((aligned(8)));
+ mar_uint32_t reason __attribute__((aligned(8)));
+} mar_cpg_address_t;
+
+/**
+ * @brief marshall_from_mar_cpg_address_t
+ * @param dest
+ * @param src
+ */
+static inline void marshall_from_mar_cpg_address_t (
+ struct cpg_address *dest,
+ const mar_cpg_address_t *src)
+{
+ dest->nodeid = src->nodeid;
+ dest->pid = src->pid;
+ dest->reason = src->reason;
+}
+
+/**
+ * @brief marshall_to_mar_cpg_address_t
+ * @param dest
+ * @param src
+ */
+static inline void marshall_to_mar_cpg_address_t (
+ mar_cpg_address_t *dest,
+ const struct cpg_address *src)
+{
+ dest->nodeid = src->nodeid;
+ dest->pid = src->pid;
+ dest->reason = src->reason;
+}
+
+/**
+ * @brief mar_name_compare
+ * @param g1
+ * @param g2
+ * @return
+ */
+static inline int mar_name_compare (
+ const mar_cpg_name_t *g1,
+ const mar_cpg_name_t *g2)
+{
+ return (g1->length == g2->length?
+ memcmp (g1->value, g2->value, g1->length):
+ g1->length - g2->length);
+}
+
+/**
+ * @brief mar_cpg_iteration_description_t struct
+ */
+typedef struct {
+ mar_cpg_name_t group;
+ mar_uint32_t nodeid;
+ mar_uint32_t pid;
+} mar_cpg_iteration_description_t;
+
+/**
+ * @brief marshall_from_mar_cpg_iteration_description_t
+ * @param dest
+ * @param src
+ */
+static inline void marshall_from_mar_cpg_iteration_description_t(
+ struct cpg_iteration_description_t *dest,
+ const mar_cpg_iteration_description_t *src)
+{
+ dest->nodeid = src->nodeid;
+ dest->pid = src->pid;
+ marshall_from_mar_cpg_name_t (&dest->group, &src->group);
+};
+
+/**
+ * @brief mar_cpg_ring_id_t struct
+ */
+typedef struct {
+ mar_uint32_t nodeid __attribute__((aligned(8)));
+ mar_uint64_t seq __attribute__((aligned(8)));
+} mar_cpg_ring_id_t;
+
+/**
+ * @brief marshall_from_mar_cpg_ring_id_t
+ * @param dest
+ * @param src
+ */
+static inline void marshall_from_mar_cpg_ring_id_t (
+ struct cpg_ring_id *dest,
+ const mar_cpg_ring_id_t *src)
+{
+ dest->nodeid = src->nodeid;
+ dest->seq = src->seq;
+}
+
+/**
+ * @brief The req_lib_cpg_join struct
+ */
+struct req_lib_cpg_join {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_cpg_name_t group_name __attribute__((aligned(8)));
+ mar_uint32_t pid __attribute__((aligned(8)));
+ mar_uint32_t flags __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cpg_join struct
+ */
+struct res_lib_cpg_join {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cpg_finalize struct
+ */
+struct req_lib_cpg_finalize {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cpg_finalize struct
+ */
+struct res_lib_cpg_finalize {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cpg_local_get struct
+ */
+struct req_lib_cpg_local_get {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cpg_local_get struct
+ */
+struct res_lib_cpg_local_get {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint32_t local_nodeid __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cpg_partial_send struct
+ */
+struct res_lib_cpg_partial_send {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cpg_mcast struct
+ */
+struct req_lib_cpg_mcast {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint32_t guarantee __attribute__((aligned(8)));
+ mar_uint32_t msglen __attribute__((aligned(8)));
+ mar_uint8_t message[] __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cpg_partial_mcast struct
+ */
+struct req_lib_cpg_partial_mcast {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint32_t guarantee __attribute__((aligned(8)));
+ mar_uint32_t msglen __attribute__((aligned(8)));
+ mar_uint32_t fraglen __attribute__((aligned(8)));
+ mar_uint32_t type __attribute__((aligned(8)));
+ mar_uint8_t message[] __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cpg_mcast struct
+ */
+struct res_lib_cpg_mcast {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * Message from another node
+ */
+struct res_lib_cpg_deliver_callback {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_cpg_name_t group_name __attribute__((aligned(8)));
+ mar_uint32_t msglen __attribute__((aligned(8)));
+ mar_uint32_t nodeid __attribute__((aligned(8)));
+ mar_uint32_t pid __attribute__((aligned(8)));
+ mar_uint8_t message[] __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cpg_partial_deliver_callback struct
+ */
+struct res_lib_cpg_partial_deliver_callback {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_cpg_name_t group_name __attribute__((aligned(8)));
+ mar_uint32_t msglen __attribute__((aligned(8)));
+ mar_uint32_t fraglen __attribute__((aligned(8)));
+ mar_uint32_t nodeid __attribute__((aligned(8)));
+ mar_uint32_t pid __attribute__((aligned(8)));
+ mar_uint32_t type __attribute__((aligned(8)));
+ mar_uint8_t message[] __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cpg_flowcontrol_callback struct
+ */
+struct res_lib_cpg_flowcontrol_callback {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint32_t flow_control_state __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cpg_membership_get struct
+ */
+struct req_lib_cpg_membership_get {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_cpg_name_t group_name __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cpg_membership_get struct
+ */
+struct res_lib_cpg_membership_get {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint32_t member_count __attribute__((aligned(8)));
+ mar_cpg_address_t member_list[PROCESSOR_COUNT_MAX];
+};
+
+/**
+ * @brief The res_lib_cpg_confchg_callback struct
+ */
+struct res_lib_cpg_confchg_callback {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_cpg_name_t group_name __attribute__((aligned(8)));
+ mar_uint32_t member_list_entries __attribute__((aligned(8)));
+ mar_uint32_t joined_list_entries __attribute__((aligned(8)));
+ mar_uint32_t left_list_entries __attribute__((aligned(8)));
+ mar_cpg_address_t member_list[];
+// struct cpg_address left_list[];
+// struct cpg_address joined_list[];
+};
+
+/**
+ * @brief The res_lib_cpg_totem_confchg_callback struct
+ */
+struct res_lib_cpg_totem_confchg_callback {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_cpg_ring_id_t ring_id __attribute__((aligned(8)));
+ mar_uint32_t member_list_entries __attribute__((aligned(8)));
+ mar_uint32_t member_list[];
+};
+
+/**
+ * @brief The req_lib_cpg_leave struct
+ */
+struct req_lib_cpg_leave {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_cpg_name_t group_name __attribute__((aligned(8)));
+ mar_uint32_t pid __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cpg_leave struct
+ */
+struct res_lib_cpg_leave {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cpg_iterationinitialize struct
+ */
+struct req_lib_cpg_iterationinitialize {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_cpg_name_t group_name __attribute__((aligned(8)));
+ mar_uint32_t iteration_type __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cpg_iterationinitialize struct
+ */
+struct res_lib_cpg_iterationinitialize {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ hdb_handle_t iteration_handle __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cpg_iterationnext struct
+ */
+struct req_lib_cpg_iterationnext {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ hdb_handle_t iteration_handle __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cpg_iterationnext struct
+ */
+struct res_lib_cpg_iterationnext {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_cpg_iteration_description_t description __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_cpg_iterationfinalize struct
+ */
+struct req_lib_cpg_iterationfinalize {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ hdb_handle_t iteration_handle __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_cpg_iterationfinalize struct
+ */
+struct res_lib_cpg_iterationfinalize {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief mar_req_coroipcc_zc_alloc_t struct
+ */
+typedef struct {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ size_t map_size __attribute__((aligned(8)));
+ char path_to_file[CPG_ZC_PATH_LEN] __attribute__((aligned(8)));
+} mar_req_coroipcc_zc_alloc_t __attribute__((aligned(8)));
+
+/**
+ * @brief mar_req_coroipcc_zc_free_t struct
+ */
+typedef struct {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ size_t map_size __attribute__((aligned(8)));
+ uint64_t server_address __attribute__((aligned(8)));
+} mar_req_coroipcc_zc_free_t __attribute__((aligned(8)));
+
+/**
+ * @brief mar_req_coroipcc_zc_execute_t struct
+ */
+typedef struct {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ uint64_t server_address __attribute__((aligned(8)));
+} mar_req_coroipcc_zc_execute_t __attribute__((aligned(8)));
+
+/**
+ * @brief coroipcs_zc_header struct
+ */
+struct coroipcs_zc_header {
+ int map_size;
+ uint64_t server_address;
+};
+#endif /* IPC_CPG_H_DEFINED */
diff --git a/include/corosync/ipc_quorum.h b/include/corosync/ipc_quorum.h
new file mode 100644
index 0000000..62c7ddf
--- /dev/null
+++ b/include/corosync/ipc_quorum.h
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2008-2020 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Christine Caulfield (ccaulfie@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef IPC_QUORUM_H_DEFINED
+#define IPC_QUORUM_H_DEFINED
+
+#include <corosync/corotypes.h>
+#include <corosync/mar_gen.h>
+
+/**
+ * @brief The req_quorum_types enum
+ */
+enum req_quorum_types {
+ MESSAGE_REQ_QUORUM_GETQUORATE = 0,
+ MESSAGE_REQ_QUORUM_TRACKSTART,
+ MESSAGE_REQ_QUORUM_TRACKSTOP,
+ MESSAGE_REQ_QUORUM_GETTYPE,
+ MESSAGE_REQ_QUORUM_MODEL_GETTYPE
+};
+
+/**
+ * @brief The res_quorum_types enum
+ */
+enum res_quorum_types {
+ MESSAGE_RES_QUORUM_GETQUORATE = 0,
+ MESSAGE_RES_QUORUM_TRACKSTART,
+ MESSAGE_RES_QUORUM_TRACKSTOP,
+ MESSAGE_RES_QUORUM_NOTIFICATION,
+ MESSAGE_RES_QUORUM_GETTYPE,
+ MESSAGE_RES_QUORUM_MODEL_GETTYPE,
+ MESSAGE_RES_QUORUM_V1_QUORUM_NOTIFICATION,
+ MESSAGE_RES_QUORUM_V1_NODELIST_NOTIFICATION
+};
+
+/*
+ * Must be in sync with definition in quorum.h
+ */
+enum lib_quorum_model {
+ LIB_QUORUM_MODEL_V0 = 0,
+ LIB_QUORUM_MODEL_V1 = 1,
+};
+
+typedef struct {
+ mar_uint32_t nodeid __attribute__((aligned(8)));
+ mar_uint64_t seq __attribute__((aligned(8)));
+} mar_quorum_ring_id_t;
+
+/**
+ * @brief The req_lib_quorum_trackstart struct
+ */
+struct req_lib_quorum_trackstart {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ unsigned int track_flags;
+};
+
+/**
+ * @brief The res_lib_quorum_getquorate struct
+ */
+struct res_lib_quorum_getquorate {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint32_t quorate;
+};
+
+/**
+ * @brief The res_lib_quorum_notification struct
+ */
+struct res_lib_quorum_notification {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_int32_t quorate __attribute__((aligned(8)));
+ mar_uint64_t ring_seq __attribute__((aligned(8)));
+ mar_uint32_t view_list_entries __attribute__((aligned(8)));
+ mar_uint32_t view_list[];
+};
+
+struct res_lib_quorum_v1_quorum_notification {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_int32_t quorate __attribute__((aligned(8)));
+ mar_quorum_ring_id_t ring_id __attribute__((aligned(8)));
+ mar_uint32_t view_list_entries __attribute__((aligned(8)));
+ mar_uint32_t view_list[];
+};
+
+struct res_lib_quorum_v1_nodelist_notification {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_quorum_ring_id_t ring_id __attribute__((aligned(8)));
+ mar_uint32_t member_list_entries __attribute__((aligned(8)));
+ mar_uint32_t joined_list_entries __attribute__((aligned(8)));
+ mar_uint32_t left_list_entries __attribute__((aligned(8)));
+ mar_uint32_t member_list[];
+// mar_uint32_t joined_list[];
+// mar_uint32_t left_list[];
+};
+
+/**
+ * @brief The res_lib_quorum_gettype struct
+ */
+struct res_lib_quorum_gettype {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint32_t quorum_type;
+};
+
+struct req_lib_quorum_model_gettype {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ mar_uint32_t model __attribute__((aligned(8)));
+};
+
+struct res_lib_quorum_model_gettype {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint32_t quorum_type __attribute__((aligned(8)));
+};
+
+#endif
diff --git a/include/corosync/ipc_votequorum.h b/include/corosync/ipc_votequorum.h
new file mode 100644
index 0000000..5f855d0
--- /dev/null
+++ b/include/corosync/ipc_votequorum.h
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2009-2012 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Authors: Christine Caulfield (ccaulfie@redhat.com)
+ * Fabio M. Di Nitto (fdinitto@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef IPC_VOTEQUORUM_H_DEFINED
+#define IPC_VOTEQUORUM_H_DEFINED
+
+#include <corosync/mar_gen.h>
+#define VOTEQUORUM_QDEVICE_NODEID 0
+#define VOTEQUORUM_QDEVICE_MAX_NAME_LEN 255
+#define VOTEQUORUM_QDEVICE_DEFAULT_TIMEOUT 10000
+
+/**
+ * @brief The req_votequorum_types enum
+ */
+enum req_votequorum_types {
+ MESSAGE_REQ_VOTEQUORUM_GETINFO = 0,
+ MESSAGE_REQ_VOTEQUORUM_SETEXPECTED,
+ MESSAGE_REQ_VOTEQUORUM_SETVOTES,
+ MESSAGE_REQ_VOTEQUORUM_TRACKSTART,
+ MESSAGE_REQ_VOTEQUORUM_TRACKSTOP,
+ MESSAGE_REQ_VOTEQUORUM_QDEVICE_REGISTER,
+ MESSAGE_REQ_VOTEQUORUM_QDEVICE_UNREGISTER,
+ MESSAGE_REQ_VOTEQUORUM_QDEVICE_UPDATE,
+ MESSAGE_REQ_VOTEQUORUM_QDEVICE_POLL,
+ MESSAGE_REQ_VOTEQUORUM_QDEVICE_MASTER_WINS
+};
+
+/**
+ * @brief The res_votequorum_types enum
+ */
+enum res_votequorum_types {
+ MESSAGE_RES_VOTEQUORUM_STATUS = 0,
+ MESSAGE_RES_VOTEQUORUM_GETINFO,
+ MESSAGE_RES_VOTEQUORUM_TRACKSTART,
+ MESSAGE_RES_VOTEQUORUM_QUORUM_NOTIFICATION,
+ MESSAGE_RES_VOTEQUORUM_EXPECTEDVOTES_NOTIFICATION,
+ MESSAGE_RES_VOTEQUORUM_NODELIST_NOTIFICATION,
+};
+
+/**
+ * @brief The mar_votequorum_ring_id struct
+ */
+struct mar_votequorum_ring_id {
+ mar_uint32_t nodeid;
+ mar_uint64_t seq;
+};
+
+/**
+ * @brief The req_lib_votequorum_qdevice_register struct
+ */
+struct req_lib_votequorum_qdevice_register {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
+};
+
+/**
+ * @brief The req_lib_votequorum_qdevice_unregister struct
+ */
+struct req_lib_votequorum_qdevice_unregister {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
+};
+
+/**
+ * @brief The req_lib_votequorum_qdevice_update struct
+ */
+struct req_lib_votequorum_qdevice_update {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ char oldname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
+ char newname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
+};
+
+/**
+ * @brief The req_lib_votequorum_qdevice_poll struct
+ */
+struct req_lib_votequorum_qdevice_poll {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
+ int cast_vote;
+ struct mar_votequorum_ring_id ring_id __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_votequorum_qdevice_master_wins struct
+ */
+struct req_lib_votequorum_qdevice_master_wins {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
+ unsigned int allow;
+};
+
+/**
+ * @brief The req_lib_votequorum_setvotes struct
+ */
+struct req_lib_votequorum_setvotes {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ unsigned int votes;
+ int nodeid;
+};
+
+/**
+ * @brief The req_lib_votequorum_setexpected struct
+ */
+struct req_lib_votequorum_setexpected {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ unsigned int expected_votes;
+};
+
+/**
+ * @brief The req_lib_votequorum_trackstart struct
+ */
+struct req_lib_votequorum_trackstart {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ uint64_t context;
+ unsigned int track_flags;
+};
+
+/**
+ * @brief The req_lib_votequorum_general struct
+ */
+struct req_lib_votequorum_general {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The req_lib_votequorum_getinfo struct
+ */
+struct req_lib_votequorum_getinfo {
+ struct qb_ipc_request_header header __attribute__((aligned(8)));
+ int nodeid;
+};
+
+/**
+ * @brief The res_lib_votequorum_status struct
+ */
+struct res_lib_votequorum_status {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+};
+
+#define VOTEQUORUM_INFO_TWONODE 1
+#define VOTEQUORUM_INFO_QUORATE 2
+#define VOTEQUORUM_INFO_WAIT_FOR_ALL 4
+#define VOTEQUORUM_INFO_LAST_MAN_STANDING 8
+#define VOTEQUORUM_INFO_AUTO_TIE_BREAKER 16
+#define VOTEQUORUM_INFO_ALLOW_DOWNSCALE 32
+#define VOTEQUORUM_INFO_QDEVICE_REGISTERED 64
+#define VOTEQUORUM_INFO_QDEVICE_ALIVE 128
+#define VOTEQUORUM_INFO_QDEVICE_CAST_VOTE 256
+#define VOTEQUORUM_INFO_QDEVICE_MASTER_WINS 512
+
+#define VOTEQUORUM_NODESTATE_MEMBER 1
+#define VOTEQUORUM_NODESTATE_DEAD 2
+#define VOTEQUORUM_NODESTATE_LEAVING 3
+
+/**
+ * @brief The res_lib_votequorum_getinfo struct
+ */
+struct res_lib_votequorum_getinfo {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ unsigned int nodeid;
+ unsigned int state;
+ unsigned int votes;
+ unsigned int expected_votes;
+ unsigned int highest_expected;
+ unsigned int total_votes;
+ unsigned int quorum;
+ unsigned int flags;
+ unsigned int qdevice_votes;
+ char qdevice_name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
+};
+
+/**
+ * @brief The votequorum_node struct
+ */
+struct votequorum_node {
+ mar_uint32_t nodeid;
+ mar_uint32_t state;
+};
+
+/**
+ * @brief The res_lib_votequorum_quorum_notification struct
+ */
+struct res_lib_votequorum_quorum_notification {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint32_t quorate __attribute__((aligned(8)));
+ mar_uint64_t context __attribute__((aligned(8)));
+ mar_uint32_t node_list_entries __attribute__((aligned(8)));
+ struct votequorum_node node_list[] __attribute__((aligned(8)));
+};
+
+struct res_lib_votequorum_nodelist_notification {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint64_t context __attribute__((aligned(8)));
+ struct mar_votequorum_ring_id ring_id __attribute__((aligned(8)));
+ mar_uint32_t node_list_entries __attribute__((aligned(8)));
+ mar_uint32_t node_list[] __attribute__((aligned(8)));
+};
+
+/**
+ * @brief The res_lib_votequorum_expectedvotes_notification struct
+ */
+struct res_lib_votequorum_expectedvotes_notification {
+ struct qb_ipc_response_header header __attribute__((aligned(8)));
+ mar_uint64_t context __attribute__((aligned(8)));
+ mar_uint32_t expected_votes __attribute__((aligned(8)));
+};
+
+/**
+ * @brief marshall_from_mar_votequorum_ring_id
+ * @param dest
+ * @param src
+ */
+static inline void marshall_from_mar_votequorum_ring_id (
+ votequorum_ring_id_t *dest,
+ const struct mar_votequorum_ring_id *src)
+{
+ dest->nodeid = src->nodeid;
+ dest->seq = src->seq;
+};
+
+/**
+ * @brief marshall_to_mar_votequorum_ring_id
+ * @param dest
+ * @param src
+ */
+static inline void marshall_to_mar_votequorum_ring_id (
+ struct mar_votequorum_ring_id *dest,
+ const votequorum_ring_id_t *src)
+{
+ dest->nodeid = src->nodeid;
+ dest->seq = src->seq;
+};
+
+#endif
diff --git a/include/corosync/logsys.h b/include/corosync/logsys.h
new file mode 100644
index 0000000..325b24b
--- /dev/null
+++ b/include/corosync/logsys.h
@@ -0,0 +1,350 @@
+/*
+ * Copyright (c) 2002-2004 MontaVista Software, Inc.
+ * Copyright (c) 2006-2012 Red Hat, Inc.
+ *
+ * Author: Steven Dake (sdake@redhat.com)
+ * Author: Lon Hohberger (lhh@redhat.com)
+ * Author: Fabio M. Di Nitto (fdinitto@redhat.com)
+ *
+ * All rights reserved.
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef LOGSYS_H_DEFINED
+#define LOGSYS_H_DEFINED
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <syslog.h>
+#include <pthread.h>
+#include <limits.h>
+
+#include <corosync/corotypes.h>
+
+#include <qb/qbconfig.h>
+#include <qb/qblog.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * All of the LOGSYS_MODE's can be ORed together for combined behavior
+ *
+ * FORK and THREADED are ignored for SUBSYSTEMS
+ */
+#define LOGSYS_MODE_OUTPUT_FILE (1<<0)
+#define LOGSYS_MODE_OUTPUT_STDERR (1<<1)
+#define LOGSYS_MODE_OUTPUT_SYSLOG (1<<2)
+#define LOGSYS_MODE_FORK (1<<3)
+#define LOGSYS_MODE_THREADED (1<<4)
+
+/*
+ * Log priorities, compliant with syslog and SA Forum Log spec.
+ */
+#define LOGSYS_LEVEL_EMERG LOG_EMERG
+#define LOGSYS_LEVEL_ALERT LOG_ALERT
+#define LOGSYS_LEVEL_CRIT LOG_CRIT
+#define LOGSYS_LEVEL_ERROR LOG_ERR
+#define LOGSYS_LEVEL_WARNING LOG_WARNING
+#define LOGSYS_LEVEL_NOTICE LOG_NOTICE
+#define LOGSYS_LEVEL_INFO LOG_INFO
+#define LOGSYS_LEVEL_DEBUG LOG_DEBUG
+#define LOGSYS_LEVEL_TRACE LOG_TRACE
+
+/*
+ * logsys_logger bits
+ *
+ * SUBSYS_COUNT defines the maximum number of subsystems
+ * SUBSYS_NAMELEN defines the maximum len of a subsystem name
+ */
+#define LOGSYS_MAX_SUBSYS_COUNT 32
+#define LOGSYS_MAX_SUBSYS_NAMELEN 64
+#define LOGSYS_MAX_PERROR_MSG_LEN 128
+
+/*
+ * Debug levels
+ */
+#define LOGSYS_DEBUG_OFF 0
+#define LOGSYS_DEBUG_ON 1
+#define LOGSYS_DEBUG_TRACE 2
+
+#ifndef LOGSYS_UTILS_ONLY
+
+/**
+ * @brief configuration bits that can only be done for the whole system
+ * @param format
+ * @return
+ */
+extern int logsys_format_set (
+ const char *format);
+
+/**
+ * @brief logsys_format_get
+ * @return
+ */
+extern char *logsys_format_get (void);
+
+/**
+ * @brief per system/subsystem settings.
+ *
+ * NOTE: once a subsystem is created and configured, changing
+ * the default does NOT affect the subsystems.
+ *
+ * Pass a NULL subsystem to change them all
+ *
+ * @param subsys
+ * @param facility
+ * @return
+ */
+extern int logsys_config_syslog_facility_set (
+ const char *subsys,
+ unsigned int facility);
+
+/**
+ * @brief logsys_config_syslog_priority_set
+ * @param subsys
+ * @param priority
+ * @return
+ */
+extern int logsys_config_syslog_priority_set (
+ const char *subsys,
+ unsigned int priority);
+
+/**
+ * @brief logsys_config_mode_set
+ * @param subsys
+ * @param mode
+ * @return
+ */
+extern int logsys_config_mode_set (
+ const char *subsys,
+ unsigned int mode);
+
+/**
+ * @brief logsys_config_mode_get
+ * @param subsys
+ * @return
+ */
+extern unsigned int logsys_config_mode_get (
+ const char *subsys);
+
+/**
+ * @brief logsys_config_apply
+ */
+void logsys_config_apply(void);
+
+/**
+ * @brief to close a logfile, just invoke this function with a NULL
+ * file or if you want to change logfile, the old one will
+ * be closed for you.
+ *
+ * @param subsys
+ * @param error_string
+ * @param file
+ * @return
+ */
+extern int logsys_config_file_set (
+ const char *subsys,
+ const char **error_string,
+ const char *file);
+
+/**
+ * @brief logsys_config_logfile_priority_set
+ * @param subsys
+ * @param priority
+ * @return
+ */
+extern int logsys_config_logfile_priority_set (
+ const char *subsys,
+ unsigned int priority);
+
+/**
+ * @brief enabling debug, disable message priority filtering.
+ * everything is sent everywhere. priority values
+ * for file and syslog are not overwritten.
+ *
+ * @param subsys
+ * @param value
+ * @return
+ */
+extern int logsys_config_debug_set (
+ const char *subsys,
+ unsigned int value);
+
+/**
+ * @brief Return the debug flag for this subsys
+ *
+ * @param subsys
+ * @return LOGSYS_DEBUG_OFF | LOGSYS_DEBUG_ON | LOGSYS_DEBUG_TRACE
+ */
+extern int logsys_config_debug_get (
+ const char *subsys);
+
+/*
+ * External API - helpers
+ *
+ * convert facility/priority to/from name/values
+ */
+/**
+ * @brief logsys_priority_id_get
+ * @param name
+ * @return
+ */
+extern int logsys_priority_id_get (
+ const char *name);
+
+/**
+ * @brief logsys_priority_name_get
+ * @param priority
+ * @return
+ */
+extern const char *logsys_priority_name_get (
+ unsigned int priority);
+
+/**
+ * @brief _logsys_system_setup
+ * @param mainsystem
+ * @param mode
+ * @param syslog_facility
+ * @param syslog_priority
+ * @return
+ */
+extern int _logsys_system_setup(
+ const char *mainsystem,
+ unsigned int mode,
+ int syslog_facility,
+ int syslog_priority);
+
+/**
+ * @brief logsys_system_fini
+ */
+extern void logsys_system_fini (void);
+
+/**
+ * @brief _logsys_config_subsys_get
+ * @param subsys
+ * @return
+ */
+extern int _logsys_config_subsys_get (
+ const char *subsys);
+
+/**
+ * @brief _logsys_subsys_create
+ * @param subsys
+ * @param filename
+ * @return
+ */
+extern int _logsys_subsys_create (const char *subsys, const char *filename);
+
+/**
+ * @brief logsys_thread_start
+ * @return
+ */
+extern int logsys_thread_start (void);
+
+extern void logsys_blackbox_set(int enable);
+
+extern void logsys_blackbox_prefork(void);
+
+extern void logsys_blackbox_postfork(void);
+
+extern cs_error_t logsys_reopen_log_files(void);
+
+/**
+ * @brief logsys_subsys_id
+ */
+static int logsys_subsys_id __attribute__((unused)) = LOGSYS_MAX_SUBSYS_COUNT;
+
+/**
+ * @brief The LOGSYS_DECLARE_SYSTEM macro
+ * @param name
+ * @param mode
+ * @param syslog_facility
+ * @param syslog_priority
+ */
+#define LOGSYS_DECLARE_SYSTEM(name,mode,syslog_facility,syslog_priority)\
+QB_LOG_INIT_DATA(logsys_qb_init); \
+__attribute__ ((constructor)) \
+static void logsys_system_init (void) \
+{ \
+ if (_logsys_system_setup (name,mode,syslog_facility,syslog_priority) < 0) { \
+ fprintf (stderr, \
+ "Unable to setup logging system: %s.\n", name); \
+ exit (-1); \
+ } \
+}
+
+/**
+ * @brief The LOGSYS_DECLARE_SUBSYS macro
+ * @param subsys
+ */
+#define LOGSYS_DECLARE_SUBSYS(subsys) \
+__attribute__ ((constructor)) \
+static void logsys_subsys_init (void) \
+{ \
+ logsys_subsys_id = \
+ _logsys_subsys_create ((subsys), __FILE__); \
+ if (logsys_subsys_id == -1) { \
+ fprintf (stderr, \
+ "Unable to create logging subsystem: %s.\n", subsys); \
+ exit (-1); \
+ } \
+}
+
+/**
+ * @brief The LOGSYS_PERROR macro
+ * @param err_num
+ * @param level
+ * @param fmt
+ * @param args
+ */
+#define LOGSYS_PERROR(err_num, level, fmt, args...) do { \
+ char _error_str[LOGSYS_MAX_PERROR_MSG_LEN]; \
+ const char *_error_ptr = qb_strerror_r(err_num, _error_str, sizeof(_error_str)); \
+ qb_log(level, fmt ": %s (%d)", ##args, _error_ptr, err_num); \
+ } while(0)
+
+#define log_printf(level, format, args...) qb_log(level, format, ##args)
+#define ENTER qb_enter
+#define LEAVE qb_leave
+#define TRACE1(format, args...) qb_log(LOG_TRACE, "TRACE1:" #format, ##args)
+#define TRACE2(format, args...) qb_log(LOG_TRACE, "TRACE2:" #format, ##args)
+#define TRACE3(format, args...) qb_log(LOG_TRACE, "TRACE3:" #format, ##args)
+#define TRACE4(format, args...) qb_log(LOG_TRACE, "TRACE4:" #format, ##args)
+#define TRACE5(format, args...) qb_log(LOG_TRACE, "TRACE5:" #format, ##args)
+#define TRACE6(format, args...) qb_log(LOG_TRACE, "TRACE6:" #format, ##args)
+#define TRACE7(format, args...) qb_log(LOG_TRACE, "TRACE7:" #format, ##args)
+#define TRACE8(format, args...) qb_log(LOG_TRACE, "TRACE8:" #format, ##args)
+
+#endif /* LOGSYS_UTILS_ONLY */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOGSYS_H_DEFINED */
diff --git a/include/corosync/mar_gen.h b/include/corosync/mar_gen.h
new file mode 100644
index 0000000..7aa7f78
--- /dev/null
+++ b/include/corosync/mar_gen.h
@@ -0,0 +1,307 @@
+/*
+ * Copyright (c) 2006-2011 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MAR_GEN_H_DEFINED
+#define MAR_GEN_H_DEFINED
+
+#include <stdint.h>
+#include <string.h>
+
+#include <corosync/corotypes.h>
+#include <corosync/swab.h>
+
+#define MAR_ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
+
+typedef int8_t mar_int8_t;
+typedef int16_t mar_int16_t;
+typedef int32_t mar_int32_t;
+typedef int64_t mar_int64_t;
+
+typedef uint8_t mar_uint8_t;
+typedef uint16_t mar_uint16_t;
+typedef uint32_t mar_uint32_t;
+typedef uint64_t mar_uint64_t;
+
+/**
+ * @brief swab_mar_int8_t
+ * @param to_swab
+ */
+static inline void swab_mar_int8_t (mar_int8_t *to_swab)
+{
+ return;
+}
+
+/**
+ * @brief swab_mar_int16_t
+ * @param to_swab
+ */
+static inline void swab_mar_int16_t (mar_int16_t *to_swab)
+{
+ *to_swab = swab16 (*to_swab);
+}
+
+/**
+ * @brief swab_mar_int32_t
+ * @param to_swab
+ */
+static inline void swab_mar_int32_t (mar_int32_t *to_swab)
+{
+ *to_swab = swab32 (*to_swab);
+}
+
+/**
+ * @brief swab_mar_int64_t
+ * @param to_swab
+ */
+static inline void swab_mar_int64_t (mar_int64_t *to_swab)
+{
+ *to_swab = swab64 (*to_swab);
+}
+
+/**
+ * @brief swab_mar_uint8_t
+ * @param to_swab
+ */
+static inline void swab_mar_uint8_t (mar_uint8_t *to_swab)
+{
+ return;
+}
+
+/**
+ * @brief swab_mar_uint16_t
+ * @param to_swab
+ */
+static inline void swab_mar_uint16_t (mar_uint16_t *to_swab)
+{
+ *to_swab = swab16 (*to_swab);
+}
+
+/**
+ * @brief swab_mar_uint32_t
+ * @param to_swab
+ */
+static inline void swab_mar_uint32_t (mar_uint32_t *to_swab)
+{
+ *to_swab = swab32 (*to_swab);
+}
+
+/**
+ * @brief swab_mar_uint64_t
+ * @param to_swab
+ */
+static inline void swab_mar_uint64_t (mar_uint64_t *to_swab)
+{
+ *to_swab = swab64 (*to_swab);
+}
+
+/**
+ * @brief swabbin
+ * @param data
+ * @param len
+ */
+static inline void swabbin(char *data, size_t len)
+{
+ int i;
+ char tmp;
+
+ for (i = 0; i < len / 2; i++) {
+ tmp = data[i];
+ data[i] = data[len - i - 1];
+ data[len - i - 1] = tmp;
+ }
+}
+
+/**
+ * @brief swabflt
+ * @param flt
+ */
+static inline void swabflt(float *flt)
+{
+ swabbin((char *)flt, sizeof(*flt));
+}
+
+/**
+ * @brief swabdbl
+ * @param dbl
+ */
+static inline void swabdbl(double *dbl)
+{
+ swabbin((char *)dbl, sizeof(*dbl));
+}
+
+/**
+ * @brief mar_name_t struct
+ */
+typedef struct {
+ mar_uint16_t length __attribute__((aligned(8)));
+ mar_uint8_t value[CS_MAX_NAME_LENGTH] __attribute__((aligned(8)));
+} mar_name_t;
+
+/**
+ * @brief get_mar_name_t
+ * @param name
+ * @return
+ */
+static inline const char *get_mar_name_t (const mar_name_t *name) {
+ return ((const char *)name->value);
+}
+
+/**
+ * @brief mar_name_match
+ * @param name1
+ * @param name2
+ * @return
+ */
+static inline int mar_name_match(const mar_name_t *name1, const mar_name_t *name2)
+{
+ if (name1->length == name2->length) {
+ return ((strncmp ((const char *)name1->value,
+ (const char *)name2->value,
+ name1->length)) == 0);
+ }
+ return 0;
+}
+
+/**
+ * @brief swab_mar_name_t
+ * @param to_swab
+ */
+static inline void swab_mar_name_t (mar_name_t *to_swab)
+{
+ swab_mar_uint16_t (&to_swab->length);
+}
+
+/**
+ * @brief marshall_from_mar_name_t
+ * @param dest
+ * @param src
+ */
+static inline void marshall_from_mar_name_t (
+ cs_name_t *dest,
+ const mar_name_t *src)
+{
+ dest->length = src->length;
+ memcpy (dest->value, src->value, CS_MAX_NAME_LENGTH);
+}
+
+/**
+ * @brief marshall_to_mar_name_t
+ * @param dest
+ * @param src
+ */
+static inline void marshall_to_mar_name_t (
+ mar_name_t *dest,
+ const cs_name_t *src)
+{
+ dest->length = src->length;
+ memcpy (dest->value, src->value, CS_MAX_NAME_LENGTH);
+}
+
+/**
+ * @brief mar_bool_t enum
+ */
+typedef enum {
+ MAR_FALSE = 0,
+ MAR_TRUE = 1
+} mar_bool_t;
+
+/**
+ * @brief mar_time_t
+ */
+typedef mar_uint64_t mar_time_t;
+
+/**
+ * @brief swab_mar_time_t
+ * @param to_swab
+ */
+static inline void swab_mar_time_t (mar_time_t *to_swab)
+{
+ swab_mar_uint64_t (to_swab);
+}
+
+#define MAR_TIME_END ((int64_t)0x7fffffffffffffffull)
+#define MAR_TIME_BEGIN 0x0ULL
+#define MAR_TIME_UNKNOWN 0x8000000000000000ULL
+
+#define MAR_TIME_ONE_MICROSECOND 1000ULL
+#define MAR_TIME_ONE_MILLISECOND 1000000ULL
+#define MAR_TIME_ONE_SECOND 1000000000ULL
+#define MAR_TIME_ONE_MINUTE 60000000000ULL
+#define MAR_TIME_ONE_HOUR 3600000000000ULL
+#define MAR_TIME_ONE_DAY 86400000000000ULL
+#define MAR_TIME_MAX CS_TIME_END
+
+#define MAR_TRACK_CURRENT 0x01
+#define MAR_TRACK_CHANGES 0x02
+#define MAR_TRACK_CHANGES_ONLY 0x04
+
+/**
+ * @brief mar_invocation_t
+ */
+typedef mar_uint64_t mar_invocation_t;
+
+/**
+ * @brief swab_mar_invocation_t
+ * @param to_swab
+ */
+static inline void swab_mar_invocation_t (mar_invocation_t *to_swab)
+{
+ swab_mar_uint64_t (to_swab);
+}
+
+/**
+ * @brief mar_size_t
+ */
+typedef mar_uint64_t mar_size_t;
+
+/**
+ * @brief swab_mar_size_t
+ * @param to_swab
+ */
+static inline void swab_mar_size_t (mar_size_t *to_swab)
+{
+ swab_mar_uint64_t (to_swab);
+}
+
+/**
+ * @brief swab_coroipc_request_header_t
+ * @param to_swab
+ */
+static inline void swab_coroipc_request_header_t (struct qb_ipc_request_header *to_swab)
+{
+ swab_mar_int32_t (&to_swab->size);
+ swab_mar_int32_t (&to_swab->id);
+}
+
+#endif /* MAR_GEN_H_DEFINED */
diff --git a/include/corosync/quorum.h b/include/corosync/quorum.h
new file mode 100644
index 0000000..93c46be
--- /dev/null
+++ b/include/corosync/quorum.h
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2008-2020 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Christine Caulfield (ccaulfi@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the Red Hat, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef COROSYNC_QUORUM_H_DEFINED
+#define COROSYNC_QUORUM_H_DEFINED
+
+#include <corosync/corotypes.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ QUORUM_MODEL_V0 = 0,
+ QUORUM_MODEL_V1 = 1,
+} quorum_model_t;
+
+/**
+ * @brief quorum_handle_t
+ */
+typedef uint64_t quorum_handle_t;
+
+struct quorum_ring_id {
+ uint32_t nodeid;
+ uint64_t seq;
+};
+
+/**
+ * @brief The quorum_notification_fn_t callback
+ */
+typedef void (*quorum_notification_fn_t) (
+ quorum_handle_t handle,
+ uint32_t quorate,
+ uint64_t ring_seq,
+ uint32_t view_list_entries,
+ uint32_t *view_list
+ );
+
+typedef void (*quorum_v1_quorum_notification_fn_t) (
+ quorum_handle_t handle,
+ uint32_t quorate,
+ struct quorum_ring_id ring_id,
+ uint32_t member_list_entries, const uint32_t *member_list
+);
+
+typedef void (*quorum_v1_nodelist_notification_fn_t) (
+ quorum_handle_t handle,
+ struct quorum_ring_id ring_id,
+ uint32_t member_list_entries, const uint32_t *member_list,
+ uint32_t joined_list_entries, const uint32_t *joined_list,
+ uint32_t left_list_entries, const uint32_t *left_list
+);
+
+/**
+ * @brief The quorum_callbacks_t struct
+ */
+typedef struct {
+ quorum_notification_fn_t quorum_notify_fn;
+} quorum_callbacks_t;
+
+typedef struct {
+ quorum_model_t model;
+} quorum_model_data_t;
+
+typedef struct {
+ quorum_model_t model;
+ quorum_notification_fn_t quorum_notify_fn;
+} quorum_model_v0_data_t;
+
+typedef struct {
+ quorum_model_t model;
+ quorum_v1_quorum_notification_fn_t quorum_notify_fn;
+ quorum_v1_nodelist_notification_fn_t nodelist_notify_fn;
+} quorum_model_v1_data_t;
+
+#define QUORUM_FREE 0
+#define QUORUM_SET 1
+
+/**
+ * @brief Create a new quorum connection
+ * @param handle
+ * @param callbacks
+ * @param quorum_type
+ * @return
+ */
+cs_error_t quorum_initialize (
+ quorum_handle_t *handle,
+ quorum_callbacks_t *callbacks,
+ uint32_t *quorum_type);
+
+cs_error_t quorum_model_initialize (
+ quorum_handle_t *handle,
+ quorum_model_t model,
+ quorum_model_data_t *model_data,
+ uint32_t *quorum_type,
+ void *context);
+
+/**
+ * @brief Close the quorum handle
+ * @param handle
+ * @return
+ */
+cs_error_t quorum_finalize (
+ quorum_handle_t handle);
+
+/**
+ * @brief Get a file descriptor on which to poll.
+ *
+ * @note quorum_handle_t is NOT a file descriptor and may not be used directly.
+ *
+ * @param handle
+ * @param fd
+ * @return
+ */
+cs_error_t quorum_fd_get (
+ quorum_handle_t handle,
+ int *fd);
+
+/**
+ * @brief Dispatch messages and configuration changes
+ * @param handle
+ * @param dispatch_types
+ * @return
+ */
+cs_error_t quorum_dispatch (
+ quorum_handle_t handle,
+ cs_dispatch_flags_t dispatch_types);
+
+/**
+ * @brief Get quorum information.
+ * @param handle
+ * @param quorate
+ * @return
+ */
+cs_error_t quorum_getquorate (
+ quorum_handle_t handle,
+ int *quorate);
+
+/**
+ * @brief Track node and quorum changes
+ * @param handle
+ * @param flags
+ * @return
+ */
+cs_error_t quorum_trackstart (
+ quorum_handle_t handle,
+ unsigned int flags );
+
+/**
+ * @brief quorum_trackstop
+ * @param handle
+ * @return
+ */
+cs_error_t quorum_trackstop (
+ quorum_handle_t handle);
+
+/**
+ * @brief quorum_context_set
+ * @param handle
+ * @param context
+ * @return
+ */
+cs_error_t quorum_context_set (
+ quorum_handle_t handle,
+ const void *context);
+
+/**
+ * @brief quorum_context_get
+ * @param handle
+ * @param context
+ * @return
+ */
+cs_error_t quorum_context_get (
+ quorum_handle_t handle,
+ const void **context);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* COROSYNC_QUORUM_H_DEFINED */
diff --git a/include/corosync/sam.h b/include/corosync/sam.h
new file mode 100644
index 0000000..01f5a2f
--- /dev/null
+++ b/include/corosync/sam.h
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2009-2011 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Jan Friesse (jfriesse@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the Red Hat, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef COROSYNC_SAM_H_DEFINED
+#define COROSYNC_SAM_H_DEFINED
+
+#include <corosync/corotypes.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief sam_recovery_policy_t enum
+ */
+typedef enum {
+ SAM_RECOVERY_POLICY_QUIT = 1,
+ SAM_RECOVERY_POLICY_RESTART = 2,
+ SAM_RECOVERY_POLICY_QUORUM = 0x08,
+ SAM_RECOVERY_POLICY_QUORUM_QUIT = SAM_RECOVERY_POLICY_QUORUM | SAM_RECOVERY_POLICY_QUIT,
+ SAM_RECOVERY_POLICY_QUORUM_RESTART = SAM_RECOVERY_POLICY_QUORUM | SAM_RECOVERY_POLICY_RESTART,
+ SAM_RECOVERY_POLICY_CMAP = 0x10,
+ SAM_RECOVERY_POLICY_CONFDB = 0x10,
+} sam_recovery_policy_t;
+
+/**
+ * @brief Callback definition for event driven checking
+ */
+typedef int (*sam_hc_callback_t)(void);
+
+/**
+ * @brief Create a new SAM connection.
+ *
+ * This function must be called before any other.
+ * It is recommended to call it as one of first in application.
+ *
+ * @param time_interval Time interval in milliseconds of healthcheck. After this time, application
+ * will be killed and recovery policy will be taken. This can be zero, which means,
+ * that there is no time limit (only fall of application is checked and only then
+ * recovery action is taken)
+ * @param recovery_policy One of SAM_RECOVERY_POLICY_RESTART, which means, that after
+ * timeout application will be killed and new instance will be started.
+ * SAM_RECOVERY_POLICY_QUIT will just stop application
+ *
+ * @retval CS_OK in case no problem appeared
+ * @retval CS_ERR_BAD_HANDLE in case user is trying to initialize initialized instance
+ * @retval CS_ERR_INVALID_PARAM in case recovery_policy had bad value
+ */
+cs_error_t sam_initialize (
+ int time_interval,
+ sam_recovery_policy_t recovery_policy);
+
+/**
+ * @brief Close the SAM handle.
+ *
+ * This function should be called as late as possible.
+ * (in reality, if you plan just quit, and checking is stopped, there is no need
+ * to call it). Function will stop healtchecking and put library to state, where
+ * no new start is possible.
+ *
+ * @retval CS_OK in case no problem appeared
+ * @retval CS_ERR_BAD_HANDLE library was not initialized by #sam_initialize
+ */
+cs_error_t sam_finalize (void);
+
+/**
+ * @brief Start healthchecking.
+ *
+ * From this time, you should call every time_interval
+ * sam_hc_send, otherwise, recovery action will be taken.
+ *
+ * @retval CS_OK in case no problem appeared
+ * @retval CS_ERR_BAD_HANDLE component was not registered by #sam_register
+ */
+cs_error_t sam_start (void);
+
+/**
+ * @brief Stop healthchecking.
+ *
+ * Oposite of #sam_start. You can call sam_start and sam_stop how many
+ * times you want.
+ *
+ * @retval CS_OK in case no problem appeared
+ * @retval CS_ERR_BAD_HANDLE healthchecking is not in running state (no sam_start
+ * was called)
+ */
+cs_error_t sam_stop (void);
+
+/**
+ * @brief Set warning signal to be sent.
+ *
+ * Default signal is SIGTERM. You can use SIGKILL to emulate NOT sending
+ * warning signal and just send SIGKILL.
+ *
+ * @retval CS_OK in case no problem appeared
+ * @retval CS_ERR_BAD_HANDLE library was not initialized by #sam_initialize or
+ * is finalized
+ */
+cs_error_t sam_warn_signal_set (int warn_signal);
+
+/**
+ * @brief Register application.
+ *
+ * This is one of most crucial function. In case, your
+ * application will be restarted, you will always return to point after calling
+ * this function. This function can be called only once, and SAM must be initialized
+ * by sam_initialize. You can choose any place in your application, where to call
+ * this function.
+ *
+ * @param instance_id NULL or pointer to int memory, where current instance
+ * of application will be returned. It's always safe to suppose, that first instance
+ * (this means, no recovery action was taken yet) will be always 1 and instance_id
+ * will be raising up to MAX_INT (after this, it will fall to 0).
+ *
+ * @retval CS_OK in case no problem appeared
+ * @retval CS_ERR_BAD_HANDLE in case, you call this function twice, or before sam_init
+ * @retval CS_ERR_LIBRARY internal library call failed. This can be one of pipe or fork
+ * creation. You can get more information from errno
+ */
+cs_error_t sam_register (
+ unsigned int *instance_id);
+
+/**
+ * @brief Send healthcheck confirmation.
+ *
+ * This should be called after #sam_start
+ *
+ * @retval CS_OK in case no problem appeared
+ * @retval CS_ERR_BAD_HANDLE healthchecking is not in running state (no sam_start was
+ * called, or called after sam_stop/sam_finalize)
+ */
+cs_error_t sam_hc_send (void);
+
+/**
+ * @brief Register healtcheck callback.
+ *
+ * After you will call this function, and set
+ * cb to something else then NULL, SAM is automatically switched from
+ * application driven healtchecking to event driven healtchecking. In other
+ * words, is not longer needed to call sam_hc_send, but your callback function
+ * must return 0 in case of healtchecking is correct, or value different then
+ * 0, in case something happend. After next hc iteration, warning signal and
+ * after that kill signal is sent back to your application.
+ *
+ * @param cb Pointer to healtcheck function, or NULL to switch back to application driven hc
+ *
+ * @retval CS_OK in case no problem appeared
+ * @retval CS_ERR_BAD_HANDLE in case, you call this function before sam_init or after sam_start
+ * @retval CS_ERR_LIBRARY internal library call failed. This can be one of pipe or pthread
+ * creation.
+ */
+cs_error_t sam_hc_callback_register (sam_hc_callback_t cb);
+
+/**
+ * @brief Return size of stored data.
+ *
+ * @param size Pointer to variable, where stored data size is returned. If
+ * nothing or NULL is stored, then 0 is returned.
+ *
+ * @retval CS_OK in case no problem appeared
+ * @retval CS_ERR_BAD_HANDLE in case you call this function before sam_init or after
+ * sam_finalize
+ * @retval CS_ERR_INVALID_PARAM if size parameter is NULL
+ */
+cs_error_t sam_data_getsize (size_t *size);
+
+/**
+ * @brief Return stored data.
+ *
+ * @param data Pointer to place, where to store data
+ * @param size Allocated size of data
+ *
+ * @retval CS_OK if no problem appeared
+ * @retval CS_ERR_BAD_HANDLE if you call this function before sam_init or after sam_finalize
+ * @retval CS_ERR_INVALID_PARAM if data is NULL or size is less then currently saved user data length
+ */
+cs_error_t sam_data_restore (
+ void *data,
+ size_t size);
+
+/**
+ * @brief Store user data.
+ *
+ * Such stored data survives restart of child.
+ *
+ * @param data Data to store. You can use NULL to delete data
+ * @param size Size of data to store.
+ *
+ * @retval CS_OK in case no problem appeared
+ * @retval CS_ERR_BAD_HANDLE if you call this function before sam_init or
+ * after sam_finalize
+ * @retval CS_ERR_NO_MEMORY if data is too large and malloc/realloc was not
+ * succesfull
+ * @retval CS_ERR_LIBRARY if some internal error appeared (communication with parent
+ * process)
+ */
+cs_error_t sam_data_store (
+ const void *data,
+ size_t size);
+
+/**
+ * @brief Marks child as failed.
+ *
+ * This can be called only with SAM_RECOVERY_POLICY_CMAP flag set and
+ * makes sense only for SAM_RECOVERY_POLICY_RESTART. This will kill child without sending warning
+ * signal. Cmap state key will be set to failed.
+ *
+ * @retval CS_OK in case no problem appeared
+ * @retval CS_ERR_BAD_HANDLE library was not initialized or was already finalized
+ * @retval CS_ERR_INVALID_PARAM recovery policy doesn't have SAM_RECOVERY_POLICY_CMAP flag set
+ * @retval CS_ERR_LIBRARY if some internal error appeared (communication with parent
+ * process)
+ */
+cs_error_t sam_mark_failed (void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* COROSYNC_SAM_H_DEFINED */
diff --git a/include/corosync/sq.h b/include/corosync/sq.h
new file mode 100644
index 0000000..39345d5
--- /dev/null
+++ b/include/corosync/sq.h
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) 2003-2004 MontaVista Software, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SORTQUEUE_H_DEFINED
+#define SORTQUEUE_H_DEFINED
+
+#include <errno.h>
+#include <string.h>
+
+/**
+ * @brief The sq struct
+ */
+struct sq {
+ unsigned int head;
+ unsigned int size;
+ void *items;
+ unsigned int *items_inuse;
+ unsigned int *items_miss_count;
+ unsigned int size_per_item;
+ unsigned int head_seqid;
+ unsigned int item_count;
+ unsigned int pos_max;
+};
+
+/*
+ * Compare a unsigned rollover-safe value to an unsigned rollover-safe value
+ */
+
+/**
+ * ADJUST_ROLLOVER_POINT is the value used to determine when a window should be
+ * used to calculate a less-then or less-then-equal comparison.
+ */
+#define ADJUST_ROLLOVER_POINT 0x80000000
+
+/**
+ * ADJUST_ROLLOVER_VALUE is the value by which both values in a comparison are
+ * adjusted if either value in a comparison is greater then
+ * ADJUST_ROLLOVER_POINT.
+ */
+#define ADJUST_ROLLOVER_VALUE 0x10000
+
+/**
+ * @brief sq_lt_compare
+ * @param a
+ * @param b
+ * @return
+ */
+static inline int sq_lt_compare (unsigned int a, unsigned int b) {
+ if ((a > ADJUST_ROLLOVER_POINT) || (b > ADJUST_ROLLOVER_POINT)) {
+ if ((a - ADJUST_ROLLOVER_VALUE) < (b - ADJUST_ROLLOVER_VALUE)) {
+ return (1);
+ }
+ } else {
+ if (a < b) {
+ return (1);
+ }
+ }
+ return (0);
+}
+
+/**
+ * @brief sq_lte_compare
+ * @param a
+ * @param b
+ * @return
+ */
+static inline int sq_lte_compare (unsigned int a, unsigned int b) {
+ if ((a > ADJUST_ROLLOVER_POINT) || (b > ADJUST_ROLLOVER_POINT)) {
+ if ((a - ADJUST_ROLLOVER_VALUE) <= (b - ADJUST_ROLLOVER_VALUE)) {
+ return (1);
+ }
+ } else {
+ if (a <= b) {
+ return (1);
+ }
+ }
+ return (0);
+}
+
+/**
+ * @brief sq_init
+ * @param sq
+ * @param item_count
+ * @param size_per_item
+ * @param head_seqid
+ * @return
+ */
+static inline int sq_init (
+ struct sq *sq,
+ int item_count,
+ int size_per_item,
+ int head_seqid)
+{
+ sq->head = 0;
+ sq->size = item_count;
+ sq->size_per_item = size_per_item;
+ sq->head_seqid = head_seqid;
+ sq->item_count = item_count;
+ sq->pos_max = 0;
+
+ sq->items = malloc (item_count * size_per_item);
+ if (sq->items == NULL) {
+ return (-ENOMEM);
+ }
+ memset (sq->items, 0, item_count * size_per_item);
+
+ if ((sq->items_inuse = malloc (item_count * sizeof (unsigned int)))
+ == NULL) {
+ return (-ENOMEM);
+ }
+ if ((sq->items_miss_count = malloc (item_count * sizeof (unsigned int)))
+ == NULL) {
+ return (-ENOMEM);
+ }
+ memset (sq->items_inuse, 0, item_count * sizeof (unsigned int));
+ memset (sq->items_miss_count, 0, item_count * sizeof (unsigned int));
+ return (0);
+}
+
+/**
+ * @brief sq_reinit
+ * @param sq
+ * @param head_seqid
+ */
+static inline void sq_reinit (struct sq *sq, unsigned int head_seqid)
+{
+ sq->head = 0;
+ sq->head_seqid = head_seqid;
+ sq->pos_max = 0;
+
+ memset (sq->items, 0, sq->item_count * sq->size_per_item);
+ memset (sq->items_inuse, 0, sq->item_count * sizeof (unsigned int));
+ memset (sq->items_miss_count, 0, sq->item_count * sizeof (unsigned int));
+}
+
+/**
+ * @brief sq_assert
+ * @param sq
+ * @param pos
+ */
+static inline void sq_assert (const struct sq *sq, unsigned int pos)
+{
+ unsigned int i;
+
+// printf ("Instrument[%d] Asserting from %d to %d\n",
+// pos, sq->pos_max, sq->size);
+ for (i = sq->pos_max + 1; i < sq->size; i++) {
+ assert (sq->items_inuse[i] == 0);
+ }
+}
+
+/**
+ * @brief sq_copy
+ * @param sq_dest
+ * @param sq_src
+ */
+static inline void sq_copy (struct sq *sq_dest, const struct sq *sq_src)
+{
+ sq_assert (sq_src, 20);
+ sq_dest->head = sq_src->head;
+ sq_dest->size = sq_src->item_count;
+ sq_dest->size_per_item = sq_src->size_per_item;
+ sq_dest->head_seqid = sq_src->head_seqid;
+ sq_dest->item_count = sq_src->item_count;
+ sq_dest->pos_max = sq_src->pos_max;
+ memcpy (sq_dest->items, sq_src->items,
+ sq_src->item_count * sq_src->size_per_item);
+ memcpy (sq_dest->items_inuse, sq_src->items_inuse,
+ sq_src->item_count * sizeof (unsigned int));
+ memcpy (sq_dest->items_miss_count, sq_src->items_miss_count,
+ sq_src->item_count * sizeof (unsigned int));
+}
+
+/**
+ * @brief sq_free
+ * @param sq
+ */
+static inline void sq_free (struct sq *sq) {
+ free (sq->items);
+ free (sq->items_inuse);
+ free (sq->items_miss_count);
+}
+
+/**
+ * @brief sq_item_add
+ * @param sq
+ * @param item
+ * @param seqid
+ * @return
+ */
+static inline void *sq_item_add (
+ struct sq *sq,
+ void *item,
+ unsigned int seqid)
+{
+ char *sq_item;
+ unsigned int sq_position;
+
+ sq_position = (sq->head + seqid - sq->head_seqid) % sq->size;
+ if (sq_position > sq->pos_max) {
+ sq->pos_max = sq_position;
+ }
+
+ sq_item = sq->items;
+ sq_item += sq_position * sq->size_per_item;
+ assert(sq->items_inuse[sq_position] == 0);
+ memcpy (sq_item, item, sq->size_per_item);
+ if (seqid == 0) {
+ sq->items_inuse[sq_position] = 1;
+ } else {
+ sq->items_inuse[sq_position] = seqid;
+ }
+ sq->items_miss_count[sq_position] = 0;
+
+ return (sq_item);
+}
+
+/**
+ * @brief sq_item_inuse
+ * @param sq
+ * @param seq_id
+ * @return
+ */
+static inline unsigned int sq_item_inuse (
+ const struct sq *sq,
+ unsigned int seq_id) {
+
+ unsigned int sq_position;
+
+ /*
+ * We need to say that the seqid is in use if it shouldn't
+ * be here in the first place.
+ * To keep old messages from being inserted.
+ */
+#ifdef COMPILE_OUT
+ if (seq_id < sq->head_seqid) {
+ fprintf(stderr, "sq_item_inuse: seqid %d, head %d\n",
+ seq_id, sq->head_seqid);
+ return 1;
+ }
+#endif
+ sq_position = (sq->head - sq->head_seqid + seq_id) % sq->size;
+ return (sq->items_inuse[sq_position] != 0);
+}
+
+/**
+ * @brief sq_item_miss_count
+ * @param sq
+ * @param seq_id
+ * @return
+ */
+static inline unsigned int sq_item_miss_count (
+ const struct sq *sq,
+ unsigned int seq_id)
+{
+ unsigned int sq_position;
+
+ sq_position = (sq->head - sq->head_seqid + seq_id) % sq->size;
+ sq->items_miss_count[sq_position]++;
+ return (sq->items_miss_count[sq_position]);
+}
+
+/**
+ * @brief sq_size_get
+ * @param sq
+ * @return
+ */
+static inline unsigned int sq_size_get (
+ const struct sq *sq)
+{
+ return sq->size;
+}
+
+/**
+ * @brief sq_in_range
+ * @param sq
+ * @param seq_id
+ * @return
+ */
+static inline unsigned int sq_in_range (
+ const struct sq *sq,
+ unsigned int seq_id)
+{
+ int res = 1;
+
+ if (sq->head_seqid > ADJUST_ROLLOVER_POINT) {
+ if (seq_id - ADJUST_ROLLOVER_VALUE <
+ sq->head_seqid - ADJUST_ROLLOVER_VALUE) {
+
+ res = 0;
+ }
+ if ((seq_id - ADJUST_ROLLOVER_VALUE) >=
+ ((sq->head_seqid - ADJUST_ROLLOVER_VALUE) + sq->size)) {
+
+ res = 0;
+ }
+ } else {
+ if (seq_id < sq->head_seqid) {
+ res = 0;
+ }
+ if ((seq_id) >= ((sq->head_seqid) + sq->size)) {
+ res = 0;
+ }
+ }
+ return (res);
+
+}
+
+/**
+ * @brief sq_item_get
+ * @param sq
+ * @param seq_id
+ * @param sq_item_out
+ * @return
+ */
+static inline unsigned int sq_item_get (
+ const struct sq *sq,
+ unsigned int seq_id,
+ void **sq_item_out)
+{
+ char *sq_item;
+ unsigned int sq_position;
+
+ if (seq_id > ADJUST_ROLLOVER_POINT) {
+ assert ((seq_id - ADJUST_ROLLOVER_POINT) <
+ ((sq->head_seqid - ADJUST_ROLLOVER_POINT) + sq->size));
+
+ sq_position = ((sq->head - ADJUST_ROLLOVER_VALUE) -
+ (sq->head_seqid - ADJUST_ROLLOVER_VALUE) + seq_id) % sq->size;
+ } else {
+ assert (seq_id < (sq->head_seqid + sq->size));
+ sq_position = (sq->head - sq->head_seqid + seq_id) % sq->size;
+ }
+//printf ("seqid %x head %x head %x pos %x\n", seq_id, sq->head, sq->head_seqid, sq_position);
+// sq_position = (sq->head - sq->head_seqid + seq_id) % sq->size;
+//printf ("sq_position = %x\n", sq_position);
+//printf ("ITEMGET %d %d %d %d\n", sq_position, sq->head, sq->head_seqid, seq_id);
+ if (sq->items_inuse[sq_position] == 0) {
+ return (ENOENT);
+ }
+ sq_item = sq->items;
+ sq_item += sq_position * sq->size_per_item;
+ *sq_item_out = sq_item;
+ return (0);
+}
+
+/**
+ * @brief sq_items_release
+ * @param sq
+ * @param seqid
+ */
+static inline void sq_items_release (struct sq *sq, unsigned int seqid)
+{
+ unsigned int oldhead;
+
+ oldhead = sq->head;
+
+ sq->head = (sq->head + seqid - sq->head_seqid + 1) % sq->size;
+ if ((oldhead + seqid - sq->head_seqid + 1) > sq->size) {
+// printf ("releasing %d for %d\n", oldhead, sq->size - oldhead);
+// printf ("releasing %d for %d\n", 0, sq->head);
+ memset (&sq->items_inuse[oldhead], 0, (sq->size - oldhead) * sizeof (unsigned int));
+ memset (sq->items_inuse, 0, sq->head * sizeof (unsigned int));
+ } else {
+// printf ("releasing %d for %d\n", oldhead, seqid - sq->head_seqid + 1);
+ memset (&sq->items_inuse[oldhead], 0,
+ (seqid - sq->head_seqid + 1) * sizeof (unsigned int));
+ memset (&sq->items_miss_count[oldhead], 0,
+ (seqid - sq->head_seqid + 1) * sizeof (unsigned int));
+ }
+ sq->head_seqid = seqid + 1;
+}
+
+#endif /* SORTQUEUE_H_DEFINED */
diff --git a/include/corosync/swab.h b/include/corosync/swab.h
new file mode 100644
index 0000000..256a82f
--- /dev/null
+++ b/include/corosync/swab.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2005 MontaVista Software, Inc.
+ * Copyright (c) 2006-2008 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/types.h>
+
+/**
+ * @brief The swab16 macro
+ * @param x
+ */
+#define swab16(x) \
+({ \
+ uint16_t __x = (x); \
+ ((uint16_t)( \
+ (((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \
+ (((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \
+})
+
+/**
+ * @brief The swab32 macro
+ * @param x
+ */
+#define swab32(x) \
+({ \
+ uint32_t __x = (x); \
+ ((uint32_t)( \
+ (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \
+ (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \
+ (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \
+ (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \
+})
+
+/**
+ * @brief The swab64 macro
+ * @param x
+ */
+#define swab64(x) \
+({ \
+ uint64_t __x = (x); \
+ ((uint64_t)( \
+ (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \
+ (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
+ (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
+ (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \
+ (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \
+ (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
+ (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
+ (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \
+})
diff --git a/include/corosync/totem/totem.h b/include/corosync/totem/totem.h
new file mode 100644
index 0000000..3268888
--- /dev/null
+++ b/include/corosync/totem/totem.h
@@ -0,0 +1,295 @@
+/*
+ * Copyright (c) 2005 MontaVista Software, Inc.
+ * Copyright (c) 2006-2022 Red Hat, Inc.
+ *
+ * Author: Steven Dake (sdake@redhat.com)
+ *
+ * All rights reserved.
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef TOTEM_H_DEFINED
+#define TOTEM_H_DEFINED
+#include "totemip.h"
+#include <libknet.h>
+#include <corosync/hdb.h>
+#include <corosync/totem/totemstats.h>
+
+#ifdef HAVE_SMALL_MEMORY_FOOTPRINT
+#define PROCESSOR_COUNT_MAX 16
+#define MESSAGE_SIZE_MAX 1024*64
+#define MESSAGE_QUEUE_MAX 512
+#else
+#define PROCESSOR_COUNT_MAX 384
+#define MESSAGE_SIZE_MAX 1024*1024 /* (1MB) */
+#define MESSAGE_QUEUE_MAX ((4 * MESSAGE_SIZE_MAX) / totem_config->net_mtu)
+#endif /* HAVE_SMALL_MEMORY_FOOTPRINT */
+
+#define FRAME_SIZE_MAX KNET_MAX_PACKET_SIZE
+
+#define CONFIG_STRING_LEN_MAX 128
+/*
+ * Estimation of required buffer size for totemudp and totemudpu - it should be at least
+ * sizeof(memb_join) + PROCESSOR_MAX * 2 * sizeof(srp_addr))
+ * if we want to support PROCESSOR_MAX nodes, but because we don't have
+ * srp_addr and memb_join, we have to use estimation.
+ * TODO: Consider moving srp_addr/memb_join into totem headers instead of totemsrp.c
+ */
+#define UDP_RECEIVE_FRAME_SIZE_MAX (PROCESSOR_COUNT_MAX * (INTERFACE_MAX * 2 * sizeof(struct totem_ip_address)) + 1024)
+
+#define TRANSMITS_ALLOWED 16
+#define SEND_THREADS_MAX 16
+
+/* This must be <= KNET_MAX_LINK */
+#define INTERFACE_MAX 8
+
+#define BIND_MAX_RETRIES 10
+#define BIND_RETRIES_INTERVAL 100
+
+/**
+ * Maximum number of continuous gather states
+ */
+#define MAX_NO_CONT_GATHER 3
+/*
+ * Maximum number of continuous failures get from sendmsg call
+ */
+#define MAX_NO_CONT_SENDMSG_FAILURES 30
+
+struct totem_interface {
+ struct totem_ip_address bindnet;
+ struct totem_ip_address boundto;
+ struct totem_ip_address mcast_addr;
+ struct totem_ip_address local_ip;
+ uint16_t ip_port;
+ uint16_t ttl;
+ uint8_t configured;
+ int member_count;
+ int knet_link_priority;
+ int knet_ping_interval;
+ int knet_ping_timeout;
+ int knet_ping_precision;
+ int knet_pong_count;
+ int knet_transport;
+ struct totem_ip_address member_list[PROCESSOR_COUNT_MAX];
+};
+
+struct totem_logging_configuration {
+ void (*log_printf) (
+ int level,
+ int subsys,
+ const char *function_name,
+ const char *file_name,
+ int file_line,
+ const char *format,
+ ...) __attribute__((format(printf, 6, 7)));
+
+ int log_level_security;
+ int log_level_error;
+ int log_level_warning;
+ int log_level_notice;
+ int log_level_debug;
+ int log_level_trace;
+ int log_subsys_id;
+};
+
+
+/*
+ * COrosync TOtem. Also used as an endian_detector.
+ */
+#define TOTEM_MH_MAGIC 0xC070
+#define TOTEM_MH_VERSION 0x03
+
+struct totem_message_header {
+ unsigned short magic;
+ char version;
+ char type;
+ char encapsulated;
+ unsigned int nodeid;
+ unsigned int target_nodeid;
+} __attribute__((packed));
+
+enum {
+ TOTEM_PRIVATE_KEY_LEN_MIN = KNET_MIN_KEY_LEN,
+ TOTEM_PRIVATE_KEY_LEN_MAX = KNET_MAX_KEY_LEN
+};
+
+enum { TOTEM_LINK_MODE_BYTES = 64 };
+
+typedef enum {
+ TOTEM_TRANSPORT_UDP = 0,
+ TOTEM_TRANSPORT_UDPU = 1,
+ TOTEM_TRANSPORT_KNET = 2
+} totem_transport_t;
+
+#define MEMB_RING_ID
+struct memb_ring_id {
+ unsigned int rep;
+ unsigned long long seq;
+} __attribute__((packed));
+
+typedef enum {
+ CRYPTO_RECONFIG_PHASE_ACTIVATE = 1,
+ CRYPTO_RECONFIG_PHASE_CLEANUP = 2,
+} cfg_message_crypto_reconfig_phase_t;
+
+struct totem_config {
+ int version;
+
+ /*
+ * network
+ */
+ struct totem_interface *interfaces;
+ struct totem_interface *orig_interfaces; /* for reload */
+ unsigned int node_id;
+ unsigned int clear_node_high_bit;
+ unsigned int knet_pmtud_interval;
+ unsigned int knet_mtu;
+
+ /*
+ * key information
+ */
+ unsigned char private_key[TOTEM_PRIVATE_KEY_LEN_MAX];
+
+ unsigned int private_key_len;
+
+ /*
+ * Totem configuration parameters
+ */
+ unsigned int token_timeout;
+
+ unsigned int token_warning;
+
+ unsigned int token_retransmit_timeout;
+
+ unsigned int token_hold_timeout;
+
+ unsigned int token_retransmits_before_loss_const;
+
+ unsigned int join_timeout;
+
+ unsigned int send_join_timeout;
+
+ unsigned int consensus_timeout;
+
+ unsigned int merge_timeout;
+
+ unsigned int downcheck_timeout;
+
+ unsigned int fail_to_recv_const;
+
+ unsigned int seqno_unchanged_const;
+
+ char link_mode[TOTEM_LINK_MODE_BYTES];
+
+ struct totem_logging_configuration totem_logging_configuration;
+
+ unsigned int net_mtu;
+
+ unsigned int threads;
+
+ unsigned int heartbeat_failures_allowed;
+
+ unsigned int max_network_delay;
+
+ unsigned int window_size;
+
+ unsigned int max_messages;
+
+ unsigned int broadcast_use;
+
+ char crypto_model[CONFIG_STRING_LEN_MAX];
+
+ char crypto_cipher_type[CONFIG_STRING_LEN_MAX];
+
+ char crypto_hash_type[CONFIG_STRING_LEN_MAX];
+
+ int crypto_index; /* Num of crypto config currently loaded into knet ( 1 or 2 ) */
+
+ int crypto_changed; /* Has crypto changed since last time? (it's expensive to reload) */
+
+ char knet_compression_model[CONFIG_STRING_LEN_MAX];
+
+ uint32_t knet_compression_threshold;
+
+ int knet_compression_level;
+
+ totem_transport_t transport_number;
+
+ unsigned int miss_count_const;
+
+ enum totem_ip_version_enum ip_version;
+
+ unsigned int block_unlisted_ips;
+
+ unsigned int cancel_token_hold_on_retransmit;
+
+ void (*totem_memb_ring_id_create_or_load) (
+ struct memb_ring_id *memb_ring_id,
+ unsigned int nodeid);
+
+ void (*totem_memb_ring_id_store) (
+ const struct memb_ring_id *memb_ring_id,
+ unsigned int nodeid);
+};
+
+/*
+ * Node status returned from the API
+ * Usually the same as the cfg version (except for
+ * link_status)
+ */
+#define TOTEM_NODE_STATUS_STRUCTURE_VERSION 1
+struct totem_node_status {
+ uint32_t version; /* Structure version */
+ unsigned int nodeid;
+ uint8_t reachable;
+ uint8_t remote;
+ uint8_t external;
+ uint8_t onwire_min;
+ uint8_t onwire_max;
+ uint8_t onwire_ver;
+ struct knet_link_status link_status[KNET_MAX_LINK];
+};
+
+
+#define TOTEM_CONFIGURATION_TYPE
+enum totem_configuration_type {
+ TOTEM_CONFIGURATION_REGULAR,
+ TOTEM_CONFIGURATION_TRANSITIONAL
+};
+
+#define TOTEM_CALLBACK_TOKEN_TYPE
+enum totem_callback_token_type {
+ TOTEM_CALLBACK_TOKEN_RECEIVED = 1,
+ TOTEM_CALLBACK_TOKEN_SENT = 2
+};
+
+enum totem_event_type {
+ TOTEM_EVENT_DELIVERY_CONGESTED,
+ TOTEM_EVENT_NEW_MSG,
+};
+
+#endif /* TOTEM_H_DEFINED */
diff --git a/include/corosync/totem/totemip.h b/include/corosync/totem/totemip.h
new file mode 100644
index 0000000..842e8e9
--- /dev/null
+++ b/include/corosync/totem/totemip.h
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2005-2019 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Patrick Caulfield (pcaulfie@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* IPv4/6 abstraction */
+
+#ifndef TOTEMIP_H_DEFINED
+#define TOTEMIP_H_DEFINED
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <stdint.h>
+#include <qb/qblist.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef SO_NOSIGPIPE
+#ifndef MSG_NOSIGNAL
+#define MSG_NOSIGNAL 0
+#endif
+void totemip_nosigpipe(int s);
+#else
+#define totemip_nosigpipe(s)
+#endif
+
+#define TOTEMIP_ADDRLEN (sizeof(struct in6_addr))
+
+/* These are the things that get passed around */
+#define TOTEM_IP_ADDRESS
+struct totem_ip_address
+{
+ unsigned int nodeid;
+ unsigned short family;
+ unsigned char addr[TOTEMIP_ADDRLEN];
+} __attribute__((packed));
+
+enum totem_ip_version_enum {
+ TOTEM_IP_VERSION_4, /* Use only AF_INET */
+ TOTEM_IP_VERSION_6, /* Use only AF_INET6 */
+ TOTEM_IP_VERSION_4_6, /* Use AF_UNSPEC and filter result preferring AF_INET */
+ TOTEM_IP_VERSION_6_4 /* Use AF_UNSPEC and filter result preferring AF_INET6 */
+};
+
+struct totem_ip_if_address
+{
+ struct totem_ip_address ip_addr;
+ struct totem_ip_address mask_addr;
+ int interface_up;
+ int interface_num;
+ char *name;
+ struct qb_list_head list;
+};
+
+extern int totemip_equal(const struct totem_ip_address *addr1,
+ const struct totem_ip_address *addr2);
+extern int totemip_sa_equal(const struct totem_ip_address *totem_ip,
+ const struct sockaddr *sa);
+extern int totemip_compare(const void *a, const void *b);
+extern int totemip_is_mcast(struct totem_ip_address *addr);
+extern void totemip_copy(struct totem_ip_address *addr1,
+ const struct totem_ip_address *addr2);
+int totemip_localhost(int family, struct totem_ip_address *localhost);
+extern int totemip_localhost_check(const struct totem_ip_address *addr);
+extern const char *totemip_print(const struct totem_ip_address *addr);
+extern const char *totemip_sa_print(const struct sockaddr *sa);
+extern int totemip_sockaddr_to_totemip_convert(const struct sockaddr_storage *saddr,
+ struct totem_ip_address *ip_addr);
+extern int totemip_totemip_to_sockaddr_convert(struct totem_ip_address *ip_addr,
+ uint16_t port, struct sockaddr_storage *saddr, int *addrlen);
+extern int totemip_parse(struct totem_ip_address *totemip, const char *addr,
+ enum totem_ip_version_enum ip_version);
+extern int totemip_iface_check(struct totem_ip_address *bindnet,
+ struct totem_ip_address *boundto,
+ int *interface_up,
+ int *interface_num,
+ int mask_high_bit);
+
+extern int totemip_getifaddrs(struct qb_list_head *addrs);
+
+extern void totemip_freeifaddrs(struct qb_list_head *addrs);
+
+/* These two simulate a zero in_addr by clearing the family field */
+static inline void totemip_zero_set(struct totem_ip_address *addr)
+{
+ addr->family = 0;
+}
+static inline int totemip_zero_check(const struct totem_ip_address *addr)
+{
+ return (addr->family == 0);
+}
+
+extern size_t totemip_udpip_header_size(int family);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/corosync/totem/totempg.h b/include/corosync/totem/totempg.h
new file mode 100644
index 0000000..d63540c
--- /dev/null
+++ b/include/corosync/totem/totempg.h
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2003-2005 MontaVista Software, Inc.
+ * Copyright (c) 2006-2011 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Steven Dake (sdake@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ * Totem Single Ring Protocol
+ *
+ * depends on poll abstraction, POSIX, IPV4
+ */
+
+#ifndef TOTEMPG_H_DEFINED
+#define TOTEMPG_H_DEFINED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include "totem.h"
+#include <qb/qbloop.h>
+
+struct totempg_group {
+ const void *group;
+ size_t group_len;
+};
+
+#define TOTEMPG_AGREED 0
+#define TOTEMPG_SAFE 1
+
+/**
+ * Initialize the totem process groups abstraction
+ */
+extern int totempg_initialize (
+ qb_loop_t* poll_handle,
+ struct totem_config *totem_config
+);
+
+extern void totempg_finalize (void);
+
+extern int totempg_callback_token_create (void **handle_out,
+ enum totem_callback_token_type type,
+ int delete,
+ int (*callback_fn) (enum totem_callback_token_type type, const void *),
+ const void *data);
+
+extern void totempg_callback_token_destroy (void *handle);
+
+/**
+ * Initialize a groups instance
+ */
+extern int totempg_groups_initialize (
+ void **instance,
+
+ void (*deliver_fn) (
+ unsigned int nodeid,
+ const void *msg,
+ unsigned int msg_len,
+ int endian_conversion_required),
+
+ void (*confchg_fn) (
+ enum totem_configuration_type configuration_type,
+ const unsigned int *member_list, size_t member_list_entries,
+ const unsigned int *left_list, size_t left_list_entries,
+ const unsigned int *joined_list, size_t joined_list_entries,
+ const struct memb_ring_id *ring_id));
+
+extern int totempg_groups_finalize (void *instance);
+
+extern int totempg_groups_join (
+ void *instance,
+ const struct totempg_group *groups,
+ size_t group_cnt);
+
+extern int totempg_groups_leave (
+ void *instance,
+ const struct totempg_group *groups,
+ size_t group_cnt);
+
+extern int totempg_groups_mcast_joined (
+ void *instance,
+ const struct iovec *iovec,
+ unsigned int iov_len,
+ int guarantee);
+
+extern int totempg_groups_joined_reserve (
+ void *instance,
+ const struct iovec *iovec,
+ unsigned int iov_len);
+
+extern int totempg_groups_joined_release (
+ int msg_count);
+
+extern int totempg_groups_mcast_groups (
+ void *instance,
+ int guarantee,
+ const struct totempg_group *groups,
+ size_t groups_cnt,
+ const struct iovec *iovec,
+ unsigned int iov_len);
+
+extern int totempg_groups_send_ok_groups (
+ void *instance,
+ const struct totempg_group *groups,
+ size_t groups_cnt,
+ const struct iovec *iovec,
+ unsigned int iov_len);
+
+extern int totempg_ifaces_get (
+ unsigned int nodeid,
+ unsigned int *interface_id,
+ struct totem_ip_address *interfaces,
+ unsigned int interfaces_size,
+ char ***status,
+ unsigned int *iface_count);
+
+extern int totempg_nodestatus_get (unsigned int nodeid,
+ struct totem_node_status *node_status);
+
+extern void* totempg_get_stats (void);
+
+void totempg_event_signal (enum totem_event_type type, int value);
+
+extern const char *totempg_ifaces_print (unsigned int nodeid);
+
+extern unsigned int totempg_my_nodeid_get (void);
+
+extern int totempg_my_family_get (void);
+
+extern int totempg_crypto_set (const char *cipher_type, const char *hash_type);
+
+extern void totempg_service_ready_register (
+ void (*totem_service_ready) (void));
+
+extern int totempg_iface_set (
+ struct totem_ip_address *interface_addr,
+ unsigned short ip_port,
+ unsigned int iface_no);
+
+extern int totempg_member_add (
+ const struct totem_ip_address *member,
+ int ring_no);
+
+extern int totempg_member_remove (
+ const struct totem_ip_address *member,
+ int ring_no);
+
+enum totem_q_level {
+ TOTEM_Q_LEVEL_LOW,
+ TOTEM_Q_LEVEL_GOOD,
+ TOTEM_Q_LEVEL_HIGH,
+ TOTEM_Q_LEVEL_CRITICAL
+};
+
+void totempg_check_q_level(void *instance);
+
+typedef void (*totem_queue_level_changed_fn) (enum totem_q_level level);
+extern void totempg_queue_level_register_callback (totem_queue_level_changed_fn);
+
+extern void totempg_threaded_mode_enable (void);
+
+extern void totempg_trans_ack (void);
+
+extern int totempg_reconfigure (void);
+
+extern int totempg_crypto_reconfigure_phase (cfg_message_crypto_reconfig_phase_t phase);
+
+extern void totempg_force_gather (void);
+
+extern void totempg_get_config(struct totem_config *config);
+
+extern void totempg_put_config(struct totem_config *config);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* TOTEMPG_H_DEFINED */
diff --git a/include/corosync/totem/totemstats.h b/include/corosync/totem/totemstats.h
new file mode 100644
index 0000000..51e604c
--- /dev/null
+++ b/include/corosync/totem/totemstats.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2017 Red Hat, Inc.
+ *
+ * Author: Christine Caulfield (ccaulfie@redhat.com)
+ *
+ * All rights reserved.
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef TOTEMSTATS_H_DEFINED
+#define TOTEMSTATS_H_DEFINED
+
+typedef struct {
+ int is_dirty;
+ time_t last_updated;
+} totem_stats_header_t;
+
+typedef struct {
+ totem_stats_header_t hdr;
+ uint32_t iface_changes;
+} totemnet_stats_t;
+
+typedef struct {
+ uint32_t rx;
+ uint32_t tx;
+ int backlog_calc;
+} totemsrp_token_stats_t;
+
+typedef struct {
+ totem_stats_header_t hdr;
+ uint64_t orf_token_tx;
+ uint64_t orf_token_rx;
+ uint64_t memb_merge_detect_tx;
+ uint64_t memb_merge_detect_rx;
+ uint64_t memb_join_tx;
+ uint64_t memb_join_rx;
+ uint64_t mcast_tx;
+ uint64_t mcast_retx;
+ uint64_t mcast_rx;
+ uint64_t memb_commit_token_tx;
+ uint64_t memb_commit_token_rx;
+ uint64_t token_hold_cancel_tx;
+ uint64_t token_hold_cancel_rx;
+ uint64_t operational_entered;
+ uint64_t operational_token_lost;
+ uint64_t gather_entered;
+ uint64_t gather_token_lost;
+ uint64_t commit_entered;
+ uint64_t commit_token_lost;
+ uint64_t recovery_entered;
+ uint64_t recovery_token_lost;
+ uint64_t consensus_timeouts;
+ uint64_t rx_msg_dropped;
+ uint32_t continuous_gather;
+ uint32_t continuous_sendmsg_failures;
+ uint64_t time_since_token_last_received; // relative time
+
+ uint8_t firewall_enabled_or_nic_failure;
+ uint32_t mtt_rx_token;
+ uint32_t avg_token_workload;
+ uint32_t avg_backlog_calc;
+
+ int earliest_token;
+ int latest_token;
+#define TOTEM_TOKEN_STATS_MAX 100
+ totemsrp_token_stats_t token[TOTEM_TOKEN_STATS_MAX];
+
+} totemsrp_stats_t;
+
+typedef struct {
+ totem_stats_header_t hdr;
+ totemsrp_stats_t *srp;
+ uint32_t msg_reserved;
+ uint32_t msg_queue_avail;
+} totempg_stats_t;
+
+
+extern int totemknet_link_get_status (
+ knet_node_id_t node, uint8_t link,
+ struct knet_link_status *status);
+
+int totemknet_handle_get_stats (
+ struct knet_handle_stats *stats);
+
+void stats_knet_add_member(knet_node_id_t nodeid, uint8_t link);
+
+void stats_knet_del_member(knet_node_id_t nodeid, uint8_t link);
+
+void stats_knet_add_handle(void);
+
+#define TOTEMPG_STATS_CLEAR_TOTEM 1
+#define TOTEMPG_STATS_CLEAR_TRANSPORT 2
+
+extern void totempg_stats_clear (int flags);
+
+#endif /* TOTEMSTATS_H_DEFINED */
diff --git a/include/corosync/votequorum.h b/include/corosync/votequorum.h
new file mode 100644
index 0000000..7863046
--- /dev/null
+++ b/include/corosync/votequorum.h
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2009-2012 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Authors: Christine Caulfield (ccaulfie@redhat.com)
+ * Fabio M. Di Nitto (fdinitto@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef COROSYNC_VOTEQUORUM_H_DEFINED
+#define COROSYNC_VOTEQUORUM_H_DEFINED
+
+#include <corosync/corotypes.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief votequorum_handle_t
+ */
+typedef uint64_t votequorum_handle_t;
+
+#define VOTEQUORUM_INFO_TWONODE 1
+#define VOTEQUORUM_INFO_QUORATE 2
+#define VOTEQUORUM_INFO_WAIT_FOR_ALL 4
+#define VOTEQUORUM_INFO_LAST_MAN_STANDING 8
+#define VOTEQUORUM_INFO_AUTO_TIE_BREAKER 16
+#define VOTEQUORUM_INFO_ALLOW_DOWNSCALE 32
+#define VOTEQUORUM_INFO_QDEVICE_REGISTERED 64
+#define VOTEQUORUM_INFO_QDEVICE_ALIVE 128
+#define VOTEQUORUM_INFO_QDEVICE_CAST_VOTE 256
+#define VOTEQUORUM_INFO_QDEVICE_MASTER_WINS 512
+
+#define VOTEQUORUM_QDEVICE_NODEID 0
+#define VOTEQUORUM_QDEVICE_MAX_NAME_LEN 255
+#define VOTEQUORUM_QDEVICE_DEFAULT_TIMEOUT 10000
+#define VOTEQUORUM_QDEVICE_DEFAULT_SYNC_TIMEOUT 30000
+
+#define VOTEQUORUM_NODESTATE_MEMBER 1
+#define VOTEQUORUM_NODESTATE_DEAD 2
+#define VOTEQUORUM_NODESTATE_LEAVING 3
+
+/** @} */
+
+/**
+ * @brief The votequorum_info struct
+ */
+struct votequorum_info {
+ unsigned int node_id;
+ unsigned int node_state;
+ unsigned int node_votes;
+ unsigned int node_expected_votes;
+ unsigned int highest_expected;
+ unsigned int total_votes;
+ unsigned int quorum;
+ unsigned int flags;
+ unsigned int qdevice_votes;
+ char qdevice_name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN];
+};
+
+/**
+ * @brief The votequorum_node_t struct
+ */
+typedef struct {
+ uint32_t nodeid;
+ uint32_t state;
+} votequorum_node_t;
+
+/**
+ * @brief The votequorum_ring_id_t struct
+ */
+typedef struct {
+ uint32_t nodeid;
+ uint64_t seq;
+} votequorum_ring_id_t;
+
+/**
+ * @brief The votequorum_quorum_notification_fn_t callback
+ */
+typedef void (*votequorum_quorum_notification_fn_t) (
+ votequorum_handle_t handle,
+ uint64_t context,
+ uint32_t quorate,
+ uint32_t node_list_entries,
+ votequorum_node_t node_list[]);
+
+typedef void (*votequorum_nodelist_notification_fn_t) (
+ votequorum_handle_t handle,
+ uint64_t context,
+ votequorum_ring_id_t ring_id,
+ uint32_t node_list_entries,
+ uint32_t node_list[]);
+
+/**
+ * @brief The votequorum_expectedvotes_notification_fn_t callback
+ */
+typedef void (*votequorum_expectedvotes_notification_fn_t) (
+ votequorum_handle_t handle,
+ uint64_t context,
+ uint32_t expected_votes);
+
+/**
+ * @brief The votequorum_callbacks_t struct
+ */
+typedef struct {
+ votequorum_quorum_notification_fn_t votequorum_quorum_notify_fn;
+ votequorum_expectedvotes_notification_fn_t votequorum_expectedvotes_notify_fn;
+ votequorum_nodelist_notification_fn_t votequorum_nodelist_notify_fn;
+} votequorum_callbacks_t;
+
+/**
+ * @brief Create a new quorum connection
+ * @param handle
+ * @param callbacks
+ * @return
+ */
+cs_error_t votequorum_initialize (
+ votequorum_handle_t *handle,
+ votequorum_callbacks_t *callbacks);
+
+/**
+ * @brief Close the quorum handle
+ * @param handle
+ * @return
+ */
+cs_error_t votequorum_finalize (
+ votequorum_handle_t handle);
+
+/**
+ * @brief Dispatch messages and configuration changes
+ * @param handle
+ * @param dispatch_types
+ * @return
+ */
+cs_error_t votequorum_dispatch (
+ votequorum_handle_t handle,
+ cs_dispatch_flags_t dispatch_types);
+
+/**
+ * @brief Get a file descriptor on which to poll.
+ *
+ * @note votequorum_handle_t is NOT a file descriptor and may not be used directly.
+ *
+ * @param handle
+ * @param fd
+ * @return
+ */
+cs_error_t votequorum_fd_get (
+ votequorum_handle_t handle,
+ int *fd);
+
+/**
+ * @brief Get quorum information.
+ * @param handle
+ * @param nodeid
+ * @param info
+ * @return
+ */
+cs_error_t votequorum_getinfo (
+ votequorum_handle_t handle,
+ unsigned int nodeid,
+ struct votequorum_info *info);
+
+/**
+ * @brief set expected_votes
+ * @param handle
+ * @param expected_votes
+ * @return
+ */
+cs_error_t votequorum_setexpected (
+ votequorum_handle_t handle,
+ unsigned int expected_votes);
+
+/**
+ * @brief set votes for a node
+ * @param handle
+ * @param nodeid
+ * @param votes
+ * @return
+ */
+cs_error_t votequorum_setvotes (
+ votequorum_handle_t handle,
+ unsigned int nodeid,
+ unsigned int votes);
+
+/**
+ * @brief Track node and quorum changes
+ * @param handle
+ * @param context
+ * @param flags
+ * @return
+ */
+cs_error_t votequorum_trackstart (
+ votequorum_handle_t handle,
+ uint64_t context,
+ unsigned int flags);
+
+/**
+ * @brief votequorum_trackstop
+ * @param handle
+ * @return
+ */
+cs_error_t votequorum_trackstop (
+ votequorum_handle_t handle);
+
+/**
+ * @brief Save and retrieve private data/context
+ * @param handle
+ * @param context
+ * @return
+ */
+cs_error_t votequorum_context_get (
+ votequorum_handle_t handle,
+ void **context);
+
+/**
+ * @brief votequorum_context_set
+ * @param handle
+ * @param context
+ * @return
+ */
+cs_error_t votequorum_context_set (
+ votequorum_handle_t handle,
+ void *context);
+
+/**
+ * @brief Register a quorum device
+ *
+ * it will be DEAD until polled
+ *
+ * @param handle
+ * @param name
+ * @return
+ */
+cs_error_t votequorum_qdevice_register (
+ votequorum_handle_t handle,
+ const char *name);
+
+/**
+ * @brief Unregister a quorum device
+ * @param handle
+ * @param name
+ * @return
+ */
+cs_error_t votequorum_qdevice_unregister (
+ votequorum_handle_t handle,
+ const char *name);
+
+/**
+ * @brief Update registered name of a quorum device
+ * @param handle
+ * @param oldname
+ * @param newname
+ * @return
+ */
+cs_error_t votequorum_qdevice_update (
+ votequorum_handle_t handle,
+ const char *oldname,
+ const char *newname);
+
+/**
+ * @brief Poll a quorum device
+ * @param handle
+ * @param name
+ * @param cast_vote
+ * @param ring_id
+ * @return
+ */
+cs_error_t votequorum_qdevice_poll (
+ votequorum_handle_t handle,
+ const char *name,
+ unsigned int cast_vote,
+ votequorum_ring_id_t ring_id);
+
+/**
+ * @brief Allow qdevice to tell votequorum if master_wins can be enabled or not
+ * @param handle
+ * @param name
+ * @param allow
+ * @return
+ */
+cs_error_t votequorum_qdevice_master_wins (
+ votequorum_handle_t handle,
+ const char *name,
+ unsigned int allow);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* COROSYNC_VOTEQUORUM_H_DEFINED */