aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/afb-args.c (renamed from src/afb-config.c)15
-rw-r--r--src/afb-args.h (renamed from src/afb-config.h)2
-rw-r--r--src/afb-supervision.c2
-rw-r--r--src/afs-args.c (renamed from src/afs-config.c)16
-rw-r--r--src/afs-args.h (renamed from src/afs-config.h)5
-rw-r--r--src/main-afb-daemon.c4
-rw-r--r--src/main-afs-supervisor.c6
8 files changed, 22 insertions, 32 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index eb299d28..4ef001f0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -52,11 +52,11 @@ SET(AFB_LIB_SOURCES
afb-api-v3.c
afb-api-ws.c
afb-apiset.c
+ afb-args.c
afb-auth.c
afb-autoset.c
afb-calls.c
afb-common.c
- afb-config.c
afb-context.c
afb-cred.c
afb-debug.c
@@ -135,7 +135,7 @@ INSTALL(TARGETS afb-daemon
# build and install afb-daemon
###########################################
IF(INCLUDE_SUPERVISOR)
- ADD_EXECUTABLE(afs-supervisor main-afs-supervisor.c afs-supervisor.c afs-discover.c afs-config.c)
+ ADD_EXECUTABLE(afs-supervisor main-afs-supervisor.c afs-supervisor.c afs-discover.c afs-args.c)
TARGET_LINK_LIBRARIES(afs-supervisor
afb-lib
${link_libraries}
diff --git a/src/afb-config.c b/src/afb-args.c
index b9552f69..05a88655 100644
--- a/src/afb-config.c
+++ b/src/afb-args.c
@@ -31,7 +31,7 @@
#endif
#include "verbose.h"
-#include "afb-config.h"
+#include "afb-args.h"
#include "afb-hook-flags.h"
#include "wrap-json.h"
@@ -985,11 +985,6 @@ static void fulfill_config(struct json_object *config)
#endif
}
-void afb_config_dump(struct json_object *config)
-{
- dump(config, stderr, "--", "CONFIG");
-}
-
static void on_environment(struct json_object *config, int optid, const char *name, void (*func)(struct json_object*, int, const char*))
{
char *value = secure_getenv(name);
@@ -1043,7 +1038,7 @@ static void parse_environment(struct json_object *config)
on_environment_bool(config, SET_TRAP_FAULTS, "AFB_TRAP_FAULTS");
}
-struct json_object *afb_config_parse_arguments(int argc, char **argv)
+struct json_object *afb_args_parse(int argc, char **argv)
{
struct json_object *result;
@@ -1055,12 +1050,8 @@ struct json_object *afb_config_parse_arguments(int argc, char **argv)
parse_arguments(argc, argv, result);
fulfill_config(result);
if (verbose_wants(Log_Level_Info))
- afb_config_dump(result);
+ dump(result, stderr, "--", "CONFIG");
return result;
}
-struct json_object *afb_config_json(struct json_object *config)
-{
- return NULL;
-}
diff --git a/src/afb-config.h b/src/afb-args.h
index 0c7a87e1..87dc45ff 100644
--- a/src/afb-config.h
+++ b/src/afb-args.h
@@ -18,5 +18,5 @@
struct json_object;
-extern struct json_object *afb_config_parse_arguments(int argc, char **argv);
+extern struct json_object *afb_args_parse(int argc, char **argv);
diff --git a/src/afb-supervision.c b/src/afb-supervision.c
index 63462017..5790c3ad 100644
--- a/src/afb-supervision.c
+++ b/src/afb-supervision.c
@@ -41,7 +41,7 @@
#include "afb-xreq.h"
#include "afb-trace.h"
#include "afb-session.h"
-#include "afb-config.h"
+#include "afb-args.h"
#include "afb-supervision.h"
#include "afs-supervision.h"
#include "afb-stub-ws.h"
diff --git a/src/afs-config.c b/src/afs-args.c
index 2d429685..1606b336 100644
--- a/src/afs-config.c
+++ b/src/afs-args.c
@@ -25,7 +25,7 @@
#include <unistd.h>
#include "verbose.h"
-#include "afs-config.h"
+#include "afs-args.h"
#if !defined(AFB_VERSION)
# error "you should define AFB_VERSION"
@@ -240,7 +240,7 @@ static void noarg(int optc)
| Parse option and launch action
+--------------------------------------------------------- */
-static void parse_arguments(int argc, char **argv, struct afs_config *config)
+static void parse_arguments(int argc, char **argv, struct afs_args *config)
{
char *programName = argv[0];
int optc, ind;
@@ -346,7 +346,7 @@ static void parse_arguments(int argc, char **argv, struct afs_config *config)
free(gnuOptions);
}
-static void fulfill_config(struct afs_config *config)
+static void fulfill_config(struct afs_args *config)
{
// default HTTP port
if (config->httpdPort == 0)
@@ -389,7 +389,7 @@ static void fulfill_config(struct afs_config *config)
config->token = AFS_SUPERVISOR_TOKEN;
}
-void afs_config_dump(struct afs_config *config)
+static void dump(struct afs_args *config)
{
#define NN(x) (x)?:""
#define P(...) fprintf(stderr, __VA_ARGS__)
@@ -428,13 +428,13 @@ void afs_config_dump(struct afs_config *config)
#undef NN
}
-static void parse_environment(struct afs_config *config)
+static void parse_environment(struct afs_args *config)
{
}
-struct afs_config *afs_config_parse_arguments(int argc, char **argv)
+struct afs_args *afs_args_parse(int argc, char **argv)
{
- struct afs_config *result;
+ struct afs_args *result;
result = calloc(1, sizeof *result);
@@ -442,7 +442,7 @@ struct afs_config *afs_config_parse_arguments(int argc, char **argv)
parse_arguments(argc, argv, result);
fulfill_config(result);
if (verbose_wants(Log_Level_Info))
- afs_config_dump(result);
+ dump(result);
return result;
}
diff --git a/src/afs-config.h b/src/afs-args.h
index 1fe7da2a..1c8d2e80 100644
--- a/src/afs-config.h
+++ b/src/afs-args.h
@@ -17,7 +17,7 @@
#pragma once
// main config structure
-struct afs_config {
+struct afs_args {
char *rootdir; // base dir for files
char *roothttp; // directory for http files
char *rootbase; // Angular HTML5 base URL
@@ -36,6 +36,5 @@ struct afs_config {
int nbSessionMax; // max count of sessions
};
-extern struct afs_config *afs_config_parse_arguments(int argc, char **argv);
-extern void afs_config_dump(struct afs_config *config);
+extern struct afs_args *afs_args_parse(int argc, char **argv);
diff --git a/src/main-afb-daemon.c b/src/main-afb-daemon.c
index 75706b7a..4ef4b280 100644
--- a/src/main-afb-daemon.c
+++ b/src/main-afb-daemon.c
@@ -38,7 +38,7 @@
#include <systemd/sd-daemon.h>
-#include "afb-config.h"
+#include "afb-args.h"
#include "afb-hswitch.h"
#include "afb-apiset.h"
#include "afb-autoset.h"
@@ -898,7 +898,7 @@ int main(int argc, char *argv[])
afb_debug("main-entry");
// ------------- Build session handler & init config -------
- main_config = afb_config_parse_arguments(argc, argv);
+ main_config = afb_args_parse(argc, argv);
if (sig_monitor_init(
!json_object_object_get_ex(main_config, "trap-faults", &obj)
|| json_object_get_boolean(obj)) < 0) {
diff --git a/src/main-afs-supervisor.c b/src/main-afs-supervisor.c
index 6b79c9c1..e56e1d86 100644
--- a/src/main-afs-supervisor.c
+++ b/src/main-afs-supervisor.c
@@ -34,7 +34,7 @@
#include "afb-session.h"
#include "afs-supervisor.h"
-#include "afs-config.h"
+#include "afs-args.h"
#include "verbose.h"
#include "jobs.h"
@@ -46,7 +46,7 @@
#endif
/* the main config */
-struct afs_config *main_config;
+struct afs_args *main_config;
/* the main apiset */
struct afb_apiset *main_apiset;
@@ -212,7 +212,7 @@ error:
int main(int ac, char **av)
{
/* scan arguments */
- main_config = afs_config_parse_arguments(ac, av);
+ main_config = afs_args_parse(ac, av);
if (main_config->name) {
verbose_set_name(main_config->name, 0);
process_name_set_name(main_config->name);