Skip to contentSkip to conversation

Simplify options for including/excluding plugins

PATCH In review Luiz Augusto von Dentz 3 participants 6 messages May 25, 2011 – May 29, 2011

Subsystems (2)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/3 Simplify options for including/excluding plugins

From: Luiz Augusto von Dentz <[email protected]>

Plugins options are now handle with --plugin(-p)/--noplugin(-P) which takes a string set containing the plugin names separated by ',',':' or ' 'similar to bluetoothd, ofono and connman.

---
 src/main.c   |   68 +++++++++++++++------------------------------------------
 src/obexd.h  |    2 +-
 src/plugin.c |   51 +++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 68 insertions(+), 53 deletions(-)
src/main.c +18 -50
index 8154e3b..e1ce442 100644
@@ -75,16 +75,11 @@ static char *option_debug = NULL;
 static char *option_root = NULL;
 static char *option_root_setup = NULL;
 static char *option_capability = NULL;
+static char *option_plugin = NULL;
+static char *option_noplugin = NULL;
 
 static gboolean option_autoaccept = FALSE;
-static gboolean option_opp = FALSE;
-static gboolean option_ftp = FALSE;
-static gboolean option_pbap = FALSE;
-static gboolean option_irmc = FALSE;
-static gboolean option_pcsuite = FALSE;
 static gboolean option_symlinks = FALSE;
-static gboolean option_syncevolution = FALSE;
-static gboolean option_mas = FALSE;
 
 static gboolean parse_debug(const char *key, const char *value,
 				gpointer user_data, GError **error)
@@ -114,20 +109,10 @@ static GOptionEntry options[] = {
 				"Specify capability file", "FILE" },
 	{ "auto-accept", 'a', 0, G_OPTION_ARG_NONE, &option_autoaccept,
 				"Automatically accept push requests" },
-	{ "opp", 'o', 0, G_OPTION_ARG_NONE, &option_opp,
-				"Enable Object Push server" },
-	{ "ftp", 'f', 0, G_OPTION_ARG_NONE, &option_ftp,
-				"Enable File Transfer server" },
-	{ "pbap", 'p', 0, G_OPTION_ARG_NONE, &option_pbap,
-				"Enable Phonebook Access server" },
-	{ "irmc", 'i', 0, G_OPTION_ARG_NONE, &option_irmc,
-				"Enable IrMC Sync server" },
-	{ "pcsuite", 's', 0, G_OPTION_ARG_NONE, &option_pcsuite,
-				"Enable PC Suite Services server" },
-	{ "syncevolution", 'e', 0, G_OPTION_ARG_NONE, &option_syncevolution,
-				"Enable OBEX server for SyncEvolution" },
-        { "mas", 'm', 0, G_OPTION_ARG_NONE, &option_mas,
-				"Enable Message Access server" },
+	{ "plugin", 'p', 0, G_OPTION_ARG_STRING, &option_plugin,
+				"Specify plugins to load", "NAME,..." },
+	{ "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
+				"Specify plugins not to load", "NAME,..." },
 	{ NULL },
 };
 
@@ -212,16 +197,6 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	if (option_opp == FALSE && option_ftp == FALSE &&
-				option_pbap == FALSE &&
-				option_irmc == FALSE &&
-				option_syncevolution == FALSE &&
-				option_mas == FALSE) {
-		fprintf(stderr, "No server selected (use either "
-				"--opp, --ftp, --pbap, --irmc, --mas, or --syncevolution)\n");
-		exit(EXIT_FAILURE);
-	}
-
 	__obex_log_init("obexd", option_debug, option_detach);
 
 	DBG("Entering main loop");
@@ -251,39 +226,32 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	plugin_init();
-
 	if (option_capability == NULL)
 		option_capability = g_strdup(DEFAULT_CAP_FILE);
 
-	if (option_opp == TRUE)
-		obex_server_init(OBEX_OPP, option_root, FALSE,
+	plugin_init(option_plugin, option_noplugin);
+
+	obex_server_init(OBEX_OPP, option_root, FALSE,
 				option_autoaccept, option_symlinks,
 				NULL);
 
-	if (option_ftp == TRUE)
-		obex_server_init(OBEX_FTP, option_root, TRUE,
+	obex_server_init(OBEX_FTP, option_root, TRUE,
 				option_autoaccept, option_symlinks,
 				option_capability);
 
-	if (option_pbap == TRUE)
-		obex_server_init(OBEX_PBAP, NULL, TRUE, FALSE, FALSE, NULL);
-
-	if (option_pcsuite == TRUE)
-		obex_server_init(OBEX_PCSUITE, option_root, TRUE,
+	obex_server_init(OBEX_PCSUITE, option_root, TRUE,
 				option_autoaccept, option_symlinks,
 				option_capability);
 
-	if (option_irmc == TRUE)
-		obex_server_init(OBEX_IRMC, NULL, TRUE, FALSE, FALSE,
-				option_capability);
+	obex_server_init(OBEX_PBAP, NULL, TRUE, FALSE, FALSE,
+							option_capability);
+
+	obex_server_init(OBEX_IRMC, NULL, TRUE, FALSE, FALSE,
+							option_capability);
 
-	if (option_syncevolution == TRUE)
-		obex_server_init(OBEX_SYNCEVOLUTION, NULL, TRUE, FALSE,
-							FALSE, NULL);
+	obex_server_init(OBEX_SYNCEVOLUTION, NULL, TRUE, FALSE, FALSE, NULL);
 
-	if (option_mas == TRUE)
-		obex_server_init(OBEX_MAS, NULL, TRUE, FALSE, FALSE, NULL);
+	obex_server_init(OBEX_MAS, NULL, TRUE, FALSE, FALSE, NULL);
 
 	if (!root_folder_setup(option_root, option_root_setup)) {
 		error("Unable to setup root folder %s", option_root);
src/obexd.h +1 -1
index df21f00..37106b7 100644
@@ -21,7 +21,7 @@
  *
  */
 
-gboolean plugin_init(void);
+gboolean plugin_init(const char *pattern, const char *exclude);
 void plugin_cleanup(void);
 
 gboolean manager_init(void);
src/plugin.c +49 -2

80 lines not on this page · raw message

Signature · 1 line
1.7.5.1
author maintainer
#1 lore raw

PATCH 2/3 Remove unused obex.conf

From: Luiz Augusto von Dentz <[email protected]>

obexd currently does not support configuration files.

---
 Makefile.am   |    2 +-
 src/obex.conf |   20 --------------------
 2 files changed, 1 insertions(+), 21 deletions(-)
 delete mode 100644 src/obex.conf
Makefile.am +1 -1
index 8d8fdc6..0be6c33 100644
@@ -138,7 +138,7 @@ INCLUDES = -I$(builddir)/src -I$(srcdir)/src -I$(srcdir)/plugins \
 
 CLEANFILES = $(service_DATA) $(builtin_files)
 
-EXTRA_DIST = src/genbuiltin $(doc_files) $(test_files) src/obex.conf \
+EXTRA_DIST = src/genbuiltin $(doc_files) $(test_files) \
 			src/obexd.service.in client/obex-client.service.in \
 			plugins/phonebook-dummy.c plugins/phonebook-ebook.c \
 			plugins/phonebook-tracker.c \
src/obex.conf deleted +0 -20
deleted file mode 100644
index 12f88b6..0000000
@@ -1,20 +0,0 @@
-# Configuration file for the OBEX Daemon
-[General]
-
-EnabledTransports=Bluetooth
-
-[Bluetooth]
-Enable=OPUSH
-
-# Object Push Server options
-[OPUSH]
-name=OBEX Object Push Server
-channel=9
-folder=/tmp
-auto_accept=true
-
-# FTP Server options
-# [FTP]
-# name=OBEX FTP Server
-# channel=10
-# folder=/tmp
Signature · 1 line
1.7.5.1
author maintainer
#2 lore raw

PATCH 3/3 Improve usage documentation for some options

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

---
 src/main.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
src/main.c +6 -2
index e1ce442..5b30f07 100644
@@ -100,13 +100,17 @@ static GOptionEntry options[] = {
 				G_OPTION_ARG_CALLBACK, parse_debug,
 				"Enable debug information output", "DEBUG" },
 	{ "root", 'r', 0, G_OPTION_ARG_STRING, &option_root,
-				"Specify root folder location", "PATH" },
+				"Specify root folder location. Both absolute"
+				"and relative can be use, but relative paths"
+				"are assume to be relative to user $HOME"
+				"folder", "PATH" },
 	{ "root-setup", 'S', 0, G_OPTION_ARG_STRING, &option_root_setup,
 				"Root folder setup script", "SCRIPT" },
 	{ "symlinks", 'l', 0, G_OPTION_ARG_NONE, &option_symlinks,
 				"Enable symlinks on root folder" },
 	{ "capability", 'c', 0, G_OPTION_ARG_STRING, &option_capability,
-				"Specify capability file", "FILE" },
+				"Specify capability file, use '!' mark for"
+				"scripts", "FILE" },
 	{ "auto-accept", 'a', 0, G_OPTION_ARG_NONE, &option_autoaccept,
 				"Automatically accept push requests" },
 	{ "plugin", 'p', 0, G_OPTION_ARG_STRING, &option_plugin,
Signature · 1 line
1.7.5.1
#3 lore raw

Re: [PATCH 3/3] Improve usage documentation for some options

Hi Luiz,

Quoted 11 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

---
 src/main.c |    8 ++++++--

 1 files changed, 6 insertions(+), 2 deletions(-)
src/main.c +0 -0
index e1ce442..5b30f07 100644

src/main.c static GOptionEntry options[] = { · line 106

Quoted 8 lines
src/main.c +4 -1
@@ -100,13 +100,17 @@ static GOptionEntry options[] = {
                                G_OPTION_ARG_CALLBACK, parse_debug,
                                "Enable debug information output", "DEBUG" },
        { "root", 'r', 0, G_OPTION_ARG_STRING, &option_root,
-                               "Specify root folder location", "PATH" },
+                               "Specify root folder location. Both absolute"
+                               "and relative can be use, but relative paths"
+                               "are assume to be relative to user $HOME"
+                               "folder", "PATH" },

IIRC, you should add the spaces to the string if you want them on the printed string, otherwise you will see:

absoluteand
pathsare
etc.

src/main.c static GOptionEntry options[] = { · line 113

Quoted 8 lines
src/main.c +2 -1
        { "root-setup", 'S', 0, G_OPTION_ARG_STRING, &option_root_setup,
                                "Root folder setup script", "SCRIPT" },
        { "symlinks", 'l', 0, G_OPTION_ARG_NONE, &option_symlinks,
                                "Enable symlinks on root folder" },
        { "capability", 'c', 0, G_OPTION_ARG_STRING, &option_capability,
-                               "Specify capability file", "FILE" },
+                               "Specify capability file, use '!' mark for"
+                               "scripts", "FILE" },

Same here.

Regards,

Signature · 3 lines
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
author maintainer
#4 lore raw

Re: [PATCH 3/3] Improve usage documentation for some options

Hi,

Quoted 27 lines · Anderson Lizardo

Hi Luiz,

Quoted 11 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

---
 src/main.c |    8 ++++++--

 1 files changed, 6 insertions(+), 2 deletions(-)
src/main.c +0 -0
index e1ce442..5b30f07 100644

src/main.c static GOptionEntry options[] = { · line 106

Quoted 8 lines
src/main.c +4 -1
@@ -100,13 +100,17 @@ static GOptionEntry options[] = {
                                G_OPTION_ARG_CALLBACK, parse_debug,
                                "Enable debug information output", "DEBUG" },
        { "root", 'r', 0, G_OPTION_ARG_STRING, &option_root,
-                               "Specify root folder location", "PATH" },
+                               "Specify root folder location. Both absolute"
+                               "and relative can be use, but relative paths"
+                               "are assume to be relative to user $HOME"
+                               "folder", "PATH" },

IIRC, you should add the spaces to the string if you want them on the printed string, otherwise you will see:

Quoted 3 lines

absoluteand
pathsare
etc.

It sure does need the extra spaces, gonna fix them, thanks.

Quoted 17 lines

src/main.c static GOptionEntry options[] = { · line 113

Quoted 8 lines
src/main.c +2 -1
        { "root-setup", 'S', 0, G_OPTION_ARG_STRING, &option_root_setup,
                                "Root folder setup script", "SCRIPT" },
        { "symlinks", 'l', 0, G_OPTION_ARG_NONE, &option_symlinks,
                                "Enable symlinks on root folder" },
        { "capability", 'c', 0, G_OPTION_ARG_STRING, &option_capability,
-                               "Specify capability file", "FILE" },
+                               "Specify capability file, use '!' mark for"
+                               "scripts", "FILE" },

Same here.

Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

Signature · 2 lines
Luiz Augusto von Dentz
Computer Engineer
#5 lore raw
In reply to Luiz Augusto von Dentz

Hi Luiz,

Quoted 8 lines · Luiz Augusto von Dentz

Plugins options are now handle with --plugin(-p)/--noplugin(-P) which takes a string set containing the plugin names separated by ',',':' or ' 'similar to bluetoothd, ofono and connman.

---
 src/main.c   |   68 +++++++++++++++------------------------------------------
 src/obexd.h  |    2 +-
 src/plugin.c |   51 +++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 68 insertions(+), 53 deletions(-)

All three patches have been pushed. Thanks.

Johan