From 22d55d7c347551afb4de6d24027f44413920b2c4 Mon Sep 17 00:00:00 2001 From: Slawomir Bochenski Date: Thu, 10 Mar 2011 12:04:25 +0100 Subject: [PATCH] obexd: Add skeleton for Message Access Profile plugin This patch introduces skeleton of a plugin supporting server role side of Bluetooth SIG profile defining procedures for exchanging message objects. The plugin can be compiled with different backends used for accessing message repository. This can be selected during configure: ./configure --with-messages=backend_name When no backend is specified, the default dummy is chosen. There is also a new command line option to obexd needed to start Message Access service: obexd [...] --mas --- obexd/plugins/mas.c | 42 ++++++++++++++++++++++++++++++++++ obexd/plugins/messages-dummy.c | 28 +++++++++++++++++++++++ obexd/plugins/messages.h | 22 ++++++++++++++++++ obexd/src/main.c | 11 +++++++-- obexd/src/obex.h | 1 + 5 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 obexd/plugins/mas.c create mode 100644 obexd/plugins/messages-dummy.c create mode 100644 obexd/plugins/messages.h diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c new file mode 100644 index 000000000..0eab43bb5 --- /dev/null +++ b/obexd/plugins/mas.c @@ -0,0 +1,42 @@ +/* + * + * OBEX Server + * + * Copyright (C) 2010-2011 Nokia Corporation + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "plugin.h" +#include "log.h" + +#include "messages.h" + +static int mas_init(void) +{ + return 0; +} + +static void mas_exit(void) +{ +} + +OBEX_PLUGIN_DEFINE(mas, mas_init, mas_exit) diff --git a/obexd/plugins/messages-dummy.c b/obexd/plugins/messages-dummy.c new file mode 100644 index 000000000..fd9679d71 --- /dev/null +++ b/obexd/plugins/messages-dummy.c @@ -0,0 +1,28 @@ +/* + * + * OBEX Server + * + * Copyright (C) 2010-2011 Nokia Corporation + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "messages.h" diff --git a/obexd/plugins/messages.h b/obexd/plugins/messages.h new file mode 100644 index 000000000..c5102443b --- /dev/null +++ b/obexd/plugins/messages.h @@ -0,0 +1,22 @@ +/* + * + * OBEX Server + * + * Copyright (C) 2010-2011 Nokia Corporation + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ diff --git a/obexd/src/main.c b/obexd/src/main.c index 1e7861578..8154e3be3 100644 --- a/obexd/src/main.c +++ b/obexd/src/main.c @@ -84,6 +84,7 @@ 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) @@ -125,6 +126,8 @@ static GOptionEntry options[] = { "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" }, { NULL }, }; @@ -212,9 +215,10 @@ int main(int argc, char *argv[]) if (option_opp == FALSE && option_ftp == FALSE && option_pbap == FALSE && option_irmc == FALSE && - option_syncevolution == FALSE) { + option_syncevolution == FALSE && + option_mas == FALSE) { fprintf(stderr, "No server selected (use either " - "--opp, --ftp, --pbap, --irmc or --syncevolution)\n"); + "--opp, --ftp, --pbap, --irmc, --mas, or --syncevolution)\n"); exit(EXIT_FAILURE); } @@ -278,6 +282,9 @@ int main(int argc, char *argv[]) obex_server_init(OBEX_SYNCEVOLUTION, NULL, TRUE, FALSE, FALSE, NULL); + if (option_mas == TRUE) + 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); exit(EXIT_FAILURE); diff --git a/obexd/src/obex.h b/obexd/src/obex.h index c3f6e3dc7..94274c263 100644 --- a/obexd/src/obex.h +++ b/obexd/src/obex.h @@ -36,6 +36,7 @@ #define OBEX_IRMC (1 << 5) #define OBEX_PCSUITE (1 << 6) #define OBEX_SYNCEVOLUTION (1 << 7) +#define OBEX_MAS (1 << 8) #define TARGET_SIZE 16 -- 2.47.3