added private extensions hook on server startup
authorVictor Kirhenshtein <victor@netxms.org>
Wed, 18 Oct 2017 10:11:31 +0000 (13:11 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Wed, 18 Oct 2017 10:11:31 +0000 (13:11 +0300)
configure.ac
src/server/core/Makefile.am
src/server/core/main.cpp

index 2771153..f88a985 100644 (file)
@@ -229,6 +229,18 @@ AC_ARG_WITH(profiler,
        LDFLAGS="$LDFLAGS -lprofiler"
 ])
 
+AC_ARG_WITH(private-extensions,
+[AS_HELP_STRING(--with-private-extensions,enable private extensions)],
+[
+       if test "x$withval" != "xno" ; then
+               WITH_PRIVATE_EXTENSIONS="yes"
+               CXXFLAGS="$CXXFLAGS -DCUSTOM_INIT_CODE"
+               if test "x$withval" != "x" && test "x$withval" != "xyes" ; then
+                       CUSTOM_INCLUDE="$withval"
+               fi
+       fi
+])
+
 AC_ARG_WITH(internal-libexpat,
 [AS_HELP_STRING(--with-internal-libexpat,force use of bundled libexpat)],
 [
@@ -3464,6 +3476,7 @@ AM_CONDITIONAL([USE_ENCRYPTION], [test "x${WITH_ENCRYPTION}" = "xyes"])
 AM_CONDITIONAL([HPUX_HPPA], [test "x$HPUX_HPPA" = "xyes"])
 AM_CONDITIONAL([MQTT_SUPPORT], [test "x$MQTT_SUPPORT" = "xyes"])
 AM_CONDITIONAL([XMPP_SUPPORT], [test "x$XMPP_SUPPORT" = "xyes"])
+AM_CONDITIONAL([WITH_PRIVATE_EXTENSIONS], [test "x$WITH_PRIVATE_EXTENSIONS" = "xyes"])
 AM_CONDITIONAL([ZEROMQ_SUPPORT], [test "x$ZEROMQ_SUPPORT" = "xyes"])
 
 
@@ -3508,10 +3521,11 @@ AS_IF([test "x$with_dist" = "xyes"],
 # Substitute variables
 #--------------------------------------------------------------------
 
-AC_SUBST(DB_DRIVERS)
 AC_SUBST(MODULES)
 AC_SUBST(AGENT_DIRS)
 AC_SUBST(AGENT_LIBS)
+AC_SUBST(CUSTOM_INCLUDE)
+AC_SUBST(DB_DRIVERS)
 AC_SUBST(SUBAGENT_DIRS)
 AC_SUBST(SERVER_INCLUDE)
 AC_SUBST(SERVER_LIBS)
index 32721d6..304f88f 100644 (file)
@@ -36,7 +36,8 @@ libnxcore_la_SOURCES =  accesspoint.cpp acl.cpp actions.cpp addrlist.cpp \
                        uniroot.cpp upload_job.cpp uptimecalc.cpp userdb.cpp \
                        userdb_objects.cpp vpnconn.cpp vrrp.cpp watchdog.cpp \
                        winperf.cpp xmpp.cpp zeromq.cpp zone.cpp
-libnxcore_la_CPPFLAGS=-I@top_srcdir@/include -I@top_srcdir@/src/server/include @MQTT_CPPFLAGS@ @ZEROMQ_CPPFLAGS@
+libnxcore_la_CPPFLAGS = -I@top_srcdir@/include -I@top_srcdir@/src/server/include @MQTT_CPPFLAGS@ @ZEROMQ_CPPFLAGS@
+libnxcore_la_CXXFLAGS = -I@top_srcdir@/@CUSTOM_INCLUDE@
 libnxcore_la_LDFLAGS = -version-info $(NETXMS_LIBRARY_VERSION) @MQTT_LDFLAGS@ @ZEROMQ_LDFLAGS@
 libnxcore_la_LIBADD = \
        ../libnxsrv/libnxsrv.la \
@@ -61,6 +62,9 @@ libnxcore_la_LIBADD += @top_srcdir@/src/jansson/libnxjansson.la
 else
 libnxcore_la_LIBADD += -ljansson
 endif
+if WITH_PRIVATE_EXTENSIONS
+libnxcore_la_CXXFLAGS += -I@top_srcdir@/private/netxms/include -I@top_srcdir@/private/netxms/src/server/init -I@top_srcdir@/private/common/src/licensing
+endif
 
 EXTRA_DIST = \
        nxcore.vcproj \
index 9378d9b..a532fcd 100644 (file)
 #include "zeromq.h"
 #endif
 
+#ifdef CUSTOM_INIT_CODE
+#include <server_custom_init.cpp>
+#endif
+
 /**
  * Messages generated by mc.pl (for UNIX version only)
  */
@@ -850,6 +854,12 @@ retry_db_lock:
        // Initialize certificate store and CA
        InitCertificates();
 
+       // Call custom initialization code
+#ifdef CUSTOM_INIT_CODE
+       if (!ServerCustomInit())
+          return FALSE;
+#endif
+
        // Create synchronization stuff
        m_condShutdown = ConditionCreate(TRUE);