The implementation of API transparency through
DBUS is not used at the moment.
To improve independancy to systemd (it relies on
systemd library) removing it should be possible.
Change-Id: I5750a92527dc3e9cf7dcd27625dce6a020797a3d
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
set(AGL_DEVEL OFF CACHE BOOL "Activates developping features")
set(INCLUDE_MONITORING OFF CACHE BOOL "Activates installation of monitoring")
set(INCLUDE_SUPERVISOR OFF CACHE BOOL "Activates installation of supervisor")
set(AGL_DEVEL OFF CACHE BOOL "Activates developping features")
set(INCLUDE_MONITORING OFF CACHE BOOL "Activates installation of monitoring")
set(INCLUDE_SUPERVISOR OFF CACHE BOOL "Activates installation of supervisor")
+set(INCLUDE_DBUS_TRANSPARENCY OFF CACHE BOOL "Allows API transparency over DBUS")
set(AFS_SUPERVISION_SOCKET "@urn:AGL:afs:supervision:socket" CACHE STRING "Internal socket for supervision")
set(AFS_SUPERVISOR_PORT 1619 CACHE STRING "Port of service for the supervisor")
set(AFS_SUPERVISOR_TOKEN HELLO CACHE STRING "Secret token for the supervisor")
set(AFS_SUPERVISION_SOCKET "@urn:AGL:afs:supervision:socket" CACHE STRING "Internal socket for supervision")
set(AFS_SUPERVISOR_PORT 1619 CACHE STRING "Port of service for the supervisor")
set(AFS_SUPERVISOR_TOKEN HELLO CACHE STRING "Secret token for the supervisor")
IF(AGL_DEVEL)
ADD_DEFINITIONS(-DAGL_DEVEL)
IF(AGL_DEVEL)
ADD_DEFINITIONS(-DAGL_DEVEL)
IF(cynara_FOUND)
ADD_DEFINITIONS(-DBACKEND_PERMISSION_IS_CYNARA)
IF(cynara_FOUND)
ADD_DEFINITIONS(-DBACKEND_PERMISSION_IS_CYNARA)
ADD_LIBRARY(afb-lib STATIC
afb-api.c
ADD_LIBRARY(afb-lib STATIC
afb-api.c
afb-api-dyn.c
afb-api-so.c
afb-api-so-v1.c
afb-api-dyn.c
afb-api-so.c
afb-api-so-v1.c
+IF(INCLUDE_DBUS_TRANSPARENCY)
+ ADD_DEFINITIONS(-DWITH_DBUS_TRANSPARENCY)
+ TARGET_SOURCES(afb-lib PUBLIC afb-api-dbus.c)
+ENDIF()
+
###########################################
# build and install afb-daemon
###########################################
###########################################
# build and install afb-daemon
###########################################
#error "you should define AFB_VERSION"
#endif
#error "you should define AFB_VERSION"
#endif
+/* set the HAS_ options */
+#if defined(WITH_MONITORING_OPTION)
+# define HAS_MONITORING 1
+#else
+# define HAS_MONITORING 0
+#endif
+#if defined(WITH_DBUS_TRANSPARENCY)
+# define HAS_DBUS 1
+#else
+# define HAS_DBUS 0
+#endif
+
// default
#define DEFLT_CNTX_TIMEOUT 32000000 // default Client Connection
// Timeout: few more than one year
// default
#define DEFLT_CNTX_TIMEOUT 32000000 // default Client Connection
// Timeout: few more than one year
-#define DBUS_CLIENT 20
-#define DBUS_SERVICE 21
+#if HAS_DBUS
+# define DBUS_CLIENT 20
+# define DBUS_SERVICE 21
+#endif
+
#define SO_BINDING 22
#define SET_SESSIONMAX 23
#define SO_BINDING 22
#define SET_SESSIONMAX 23
#define SET_TRACEEVT 'E'
#define SET_EXEC 'e'
#define DISPLAY_HELP 'h'
#define SET_TRACEEVT 'E'
#define SET_EXEC 'e'
#define DISPLAY_HELP 'h'
-#if defined(WITH_MONITORING_OPTION)
-#define SET_MONITORING 'M'
+#if HAS_MONITORING
+# define SET_MONITORING 'M'
#endif
#define SET_NAME 'n'
#define SET_TCP_PORT 'p'
#endif
#define SET_NAME 'n'
#define SET_TCP_PORT 'p'
const char shortopts[] =
"c:D:E:ehn:p:qrS:s:T:t:u:Vvw:"
const char shortopts[] =
"c:D:E:ehn:p:qrS:s:T:t:u:Vvw:"
-#if defined(WITH_MONITORING_OPTION)
{SET_MODE, 1, "mode", "Set the mode: either local, remote or global"},
{SET_MODE, 1, "mode", "Set the mode: either local, remote or global"},
{DBUS_CLIENT, 1, "dbus-client", "Bind to an afb service through dbus"},
{DBUS_SERVICE, 1, "dbus-server", "Provides an afb service through dbus"},
{DBUS_CLIENT, 1, "dbus-client", "Bind to an afb service through dbus"},
{DBUS_SERVICE, 1, "dbus-server", "Provides an afb service through dbus"},
{WS_CLIENT, 1, "ws-client", "Bind to an afb service through websocket"},
{WS_SERVICE, 1, "ws-server", "Provides an afb service through websockets"},
{WS_CLIENT, 1, "ws-client", "Bind to an afb service through websocket"},
{WS_SERVICE, 1, "ws-server", "Provides an afb service through websockets"},
{SET_NO_HTTPD, 0, "no-httpd", "Forbids HTTP service"},
{SET_EXEC, 0, "exec", "Execute the remaining arguments"},
{SET_NO_HTTPD, 0, "no-httpd", "Forbids HTTP service"},
{SET_EXEC, 0, "exec", "Execute the remaining arguments"},
-#if defined(WITH_MONITORING_OPTION)
{SET_MONITORING, 0, "monitoring", "enable HTTP monitoring at <ROOT>/monitoring/"},
#endif
{0, 0, NULL, NULL}
{SET_MONITORING, 0, "monitoring", "enable HTTP monitoring at <ROOT>/monitoring/"},
#endif
{0, 0, NULL, NULL}
+--------------------------------------------------------- */
static void printVersion(FILE * file)
{
+--------------------------------------------------------- */
static void printVersion(FILE * file)
{
- static const char version[] =
- "\n"
- " AFB [Application Framework Binder] version="AFB_VERSION"\n"
+ static char pm[2] = { '-', '+' };
+ fprintf(file,
- " Copyright (C) 2015, 2016, 2017 \"IoT.bzh\"\n"
+ " AGL Framework Binder [AFB %s] %cDBUS %cMONITOR\n"
+ "\n",
+ AFB_VERSION,
+ pm[HAS_DBUS],
+ pm[HAS_MONITORING]
+ );
+ fprintf(file,
+ " Copyright (C) 2015-2018 \"IoT.bzh\"\n"
" AFB comes with ABSOLUTELY NO WARRANTY.\n"
" Licence Apache 2\n"
" AFB comes with ABSOLUTELY NO WARRANTY.\n"
" Licence Apache 2\n"
- "\n";
-
- fprintf(file, "%s", version);
}
/*----------------------------------------------------------
}
/*----------------------------------------------------------
config->mode = argvalenum(optc, mode_desc);
break;
config->mode = argvalenum(optc, mode_desc);
break;
case DBUS_CLIENT:
list_add(&config->dbus_clients, argvalstr(optc));
break;
case DBUS_CLIENT:
list_add(&config->dbus_clients, argvalstr(optc));
break;
case DBUS_SERVICE:
list_add(&config->dbus_servers, argvalstr(optc));
break;
case DBUS_SERVICE:
list_add(&config->dbus_servers, argvalstr(optc));
break;
case WS_CLIENT:
list_add(&config->ws_clients, argvalstr(optc));
case WS_CLIENT:
list_add(&config->ws_clients, argvalstr(optc));
config->random_token = 1;
break;
config->random_token = 1;
break;
-#if defined(WITH_MONITORING_OPTION)
case SET_MONITORING:
config->monitoring = 1;
break;
case SET_MONITORING:
config->monitoring = 1;
break;
if (config->ldpaths == NULL && config->weak_ldpaths == NULL && !config->no_ldpaths)
list_add(&config->ldpaths, BINDING_INSTALL_DIR);
if (config->ldpaths == NULL && config->weak_ldpaths == NULL && !config->no_ldpaths)
list_add(&config->ldpaths, BINDING_INSTALL_DIR);
-#if defined(WITH_MONITORING_OPTION)
if (config->monitoring)
list_add(&config->aliases, strdup("/monitoring:"BINDING_INSTALL_DIR"/monitoring"));
#endif
if (config->monitoring)
list_add(&config->aliases, strdup("/monitoring:"BINDING_INSTALL_DIR"/monitoring"));
#endif
L(dbus_clients)
L(dbus_servers)
L(dbus_clients)
L(dbus_servers)
L(ws_clients)
L(ws_servers)
L(so_bindings)
L(ws_clients)
L(ws_servers)
L(so_bindings)
B(no_ldpaths)
B(noHttpd)
B(background)
B(no_ldpaths)
B(noHttpd)
B(background)
-#if defined(WITH_MONITORING_OPTION)
B(monitoring)
#endif
B(random_token)
B(monitoring)
#endif
B(random_token)
L(dbus_clients)
L(dbus_servers)
L(dbus_clients)
L(dbus_servers)
L(ws_clients)
L(ws_servers)
L(so_bindings)
L(ws_clients)
L(ws_servers)
L(so_bindings)
B(no_ldpaths)
B(noHttpd)
B(background)
B(no_ldpaths)
B(noHttpd)
B(background)
-#if defined(WITH_MONITORING_OPTION)
B(monitoring)
#endif
B(random_token)
B(monitoring)
#endif
B(random_token)
char *name; /* name to set to the daemon */
struct afb_config_list *aliases;
char *name; /* name to set to the daemon */
struct afb_config_list *aliases;
+#if defined(WITH_DBUS_TRANSPARENCY)
struct afb_config_list *dbus_clients;
struct afb_config_list *dbus_servers;
struct afb_config_list *dbus_clients;
struct afb_config_list *dbus_servers;
struct afb_config_list *ws_clients;
struct afb_config_list *ws_servers;
struct afb_config_list *so_bindings;
struct afb_config_list *ws_clients;
struct afb_config_list *ws_servers;
struct afb_config_list *so_bindings;
unsigned no_ldpaths: 1; /* disable default ldpaths */
unsigned noHttpd: 1;
unsigned background: 1; /* run in backround mode */
unsigned no_ldpaths: 1; /* disable default ldpaths */
unsigned noHttpd: 1;
unsigned background: 1; /* run in backround mode */
+#if defined(WITH_MONITORING_OPTION)
unsigned monitoring: 1; /* activates monitoring */
unsigned monitoring: 1; /* activates monitoring */
unsigned random_token: 1; /* expects a random token */
};
unsigned random_token: 1; /* expects a random token */
};
#include "afb-hswitch.h"
#include "afb-apiset.h"
#include "afb-api-so.h"
#include "afb-hswitch.h"
#include "afb-apiset.h"
#include "afb-api-so.h"
-#include "afb-api-dbus.h"
+#if defined(WITH_DBUS_TRANSPARENCY)
+# include "afb-api-dbus.h"
+#endif
#include "afb-api-ws.h"
#include "afb-hsrv.h"
#include "afb-hreq.h"
#include "afb-api-ws.h"
#include "afb-hsrv.h"
#include "afb-hreq.h"
/* load bindings */
afb_debug("start-load");
apiset_start_list(main_config->so_bindings, afb_api_so_add_binding, "the binding");
/* load bindings */
afb_debug("start-load");
apiset_start_list(main_config->so_bindings, afb_api_so_add_binding, "the binding");
+#if defined(WITH_DBUS_TRANSPARENCY)
apiset_start_list(main_config->dbus_clients, afb_api_dbus_add_client, "the afb-dbus client");
apiset_start_list(main_config->dbus_clients, afb_api_dbus_add_client, "the afb-dbus client");
apiset_start_list(main_config->ws_clients, afb_api_ws_add_client_weak, "the afb-websocket client");
apiset_start_list(main_config->ldpaths, afb_api_so_add_pathset_fails, "the binding path set");
apiset_start_list(main_config->weak_ldpaths, afb_api_so_add_pathset_nofails, "the weak binding path set");
apiset_start_list(main_config->ws_clients, afb_api_ws_add_client_weak, "the afb-websocket client");
apiset_start_list(main_config->ldpaths, afb_api_so_add_pathset_fails, "the binding path set");
apiset_start_list(main_config->weak_ldpaths, afb_api_so_add_pathset_nofails, "the weak binding path set");
+#if defined(WITH_DBUS_TRANSPARENCY)
apiset_start_list(main_config->dbus_servers, afb_api_dbus_add_server, "the afb-dbus service");
apiset_start_list(main_config->dbus_servers, afb_api_dbus_add_server, "the afb-dbus service");
apiset_start_list(main_config->ws_servers, afb_api_ws_add_server, "the afb-websocket service");
DEBUG("Init config done");
apiset_start_list(main_config->ws_servers, afb_api_ws_add_server, "the afb-websocket service");
DEBUG("Init config done");