Implements the OBEX server/SyncML client binding for syncEvolution (http://syncevolution.org/).
Subsystems (2)
PATCH 1/1 Implements the OBEX server/SyncML client binding for syncEvolution (http://syncevolution.org/).
In particular this patch supports Server Alerted Sync(SAN). With server alerted sync, the SyncML server initiates the OBEX link, so it is the OBEX client. On the other hand the SyncML client waits for the request from SyncML server, so it is the OBEX server.
OBEX/SyncML binding spec is at http://www.openmobilealliance.net/
Technical/release_program/docs/Common/V1_2_1-20070813-A/OMA-TS-SyncML_OBEXBinding-V1_2-20070221-A.pdf
--- Makefile.am | 2 +- src/main.c | 16 ++- src/manager.c | 33 +++++ src/obex.c | 47 +++++-- src/obex.h | 10 ++ src/syncevolution.c | 362 +++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 457 insertions(+), 13 deletions(-) create mode 100644 src/syncevolution.c
Makefile.am +1 -1
@@ -31,7 +31,7 @@ src_obexd_SOURCES = $(gdbus_sources) \ src/main.c src/obexd.h src/plugin.h src/plugin.c \ src/logging.h src/logging.c src/btio.h src/btio.c \ src/dbus.h src/manager.c src/obex.h src/obex.c \ - src/opp.c src/ftp.c src/pbap.c \ + src/opp.c src/ftp.c src/pbap.c src/syncevolution.c \ src/bluetooth.h src/bluetooth.c \ src/phonebook.h src/phonebook.c
src/main.c +14 -2
@@ -53,6 +53,7 @@#define OPP_CHANNEL 9#define FTP_CHANNEL 10#define PBAP_CHANNEL 15 +#define SYNCEVOLUTION_CHANNEL 16#define PCSUITE_CHANNEL 24#define DEFAULT_ROOT_PATH "/tmp"
@@ -172,6 +173,7 @@ static gboolean option_ftp = FALSE;static gboolean option_pbap = FALSE;static gboolean option_pcsuite = FALSE;static gboolean option_symlinks = FALSE; +static gboolean option_syncevolution = FALSE;static GOptionEntry options[] = { {"nodaemon" ,'n' ,G_OPTION_FLAG_REVERSE ,
@@ -199,6 +201,8 @@ static GOptionEntry options[] = { "Enable Phonebook Access 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 client" }, { NULL }, };
@@ -337,9 +341,9 @@ int main(int argc, char *argv[]) log_option |=LOG_PERROR ;if (option_opp == FALSE && option_ftp == FALSE && - option_pbap == FALSE) { + option_pbap == FALSE && option_syncevolution == FALSE) {fprintf (stderr,"No server selected (use either " -"--opp or --ftp or both)\n" ); +"--opp, --ftp, --pbap or --syncevolution)\n" );exit (EXIT_FAILURE ); }
@@ -408,6 +412,14 @@ int main(int argc, char *argv[]) option_capability); } +if (option_syncevolution == TRUE) { + services |=OBEX_SYNCEVOLUTION ; +bluetooth_init (OBEX_SYNCEVOLUTION ,"OBEX server for" +" Syncevolution client" ,NULL , +SYNCEVOLUTION_CHANNEL , TRUE, FALSE, FALSE, +NULL ); + } +if (option_devnode)devnode_setup ();
src/manager.c +33 -0
@@ -216,6 +216,35 @@ static const gchar *pcsuite_record = </attribute> \ </record>"; +static const gchar *syncevolution_record = +"<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \ +<record> \ +<attribute id=\"0x0001\"> \ +<sequence> \ +<uuid value=\"00000002-0000-1000-8000-0002ee000002\"/> \ +</sequence> \ +</attribute> \ +\ +<attribute id=\"0x0004\"> \ +<sequence> \ +<sequence> \ +<uuid value=\"0x0100\"/> \ +</sequence> \ +<sequence> \ +<uuid value=\"0x0003\"/> \ +<uint8 value=\"%u\" name=\"channel\"/> \ +</sequence> \ +<sequence> \ +<uuid value=\"0x0008\"/> \ +</sequence> \ +</sequence> \ +</attribute> \ +\ +<attribute id=\"0x0100\"> \ +<text value=\"%s\" name=\"name\"/> \ +</attribute> \ +</record>" ; +#define TRANSFER_INTERFACE OPENOBEX_SERVICE ".Transfer"#define SESSION_INTERFACE OPENOBEX_SERVICE ".Session"
@@ -525,6 +554,10 @@ static gchar *create_xml_record(const char *name,case OBEX_PCSUITE : xml =g_markup_printf_escaped (pcsuite_record, channel, name);break ; +case OBEX_SYNCEVOLUTION : + xml =g_markup_printf_escaped (syncevolution_record, channel, + name); +break ;default : xml =NULL ;break ;
src/obex.c +37 -10
118 lines not on this page · raw message
src/obex.h +10 -0
@@ -27,6 +27,7 @@#include <config.h> #endif +#include <dbus/dbus.h> #include <glib.h> #include "phonebook.h"
@@ -36,6 +37,7 @@#define OBEX_BIP (1 << 3)#define OBEX_PBAP (1 << 4)#define OBEX_PCSUITE (1 << 5) +#define OBEX_SYNCEVOLUTION (1 << 6)#define OBJECT_SIZE_UNKNOWN -1#define OBJECT_SIZE_DELETE -2
@@ -86,6 +88,9 @@ struct obex_session {obex_t *obex;struct phonebook_context *pbctx;gboolean finished; +DBusConnection *dbus_conn; +gchar *conn_obj; +gboolean reply_received; };gint obex_session_start (GIOChannel *io,struct server *server);
@@ -106,6 +111,11 @@ gboolean pbap_phonebook_context_create(struct obex_session *session);void pbap_phonebook_context_destroy (struct obex_session *session);struct obex_session *pbap_get_session (struct phonebook_context *context); +gboolean synce_connect (struct obex_session *os); +void synce_put (obex_t *obex,obex_object_t *obj); +void synce_get (obex_t *obex,obex_object_t *obj); +void synce_destroy (struct obex_session *os); +gint os_prepare_get (struct obex_session *os,gchar *file,guint32 *size);gint os_prepare_put (struct obex_session *os);
src/syncevolution.c new file +362 -0
362 lines not on this page · raw message
Signature · 1 line
1.5.4.5
Hello Forrest!
I hope those more familiar with OBEX will comment on those aspects. I have some questions pertaining to SyncEvolution and the usage of this new feature.
On Tue, 2009-10-20 at 03:58 +0100, Zhao, Forrest wrote:
[...]
src/main.c line 57
Quoted 10 lines
src/main.c +1
-0@@ -53,6 +53,7 @@#define OPP_CHANNEL 9#define FTP_CHANNEL 10#define PBAP_CHANNEL 15 +#define SYNCEVOLUTION_CHANNEL 16#define PCSUITE_CHANNEL 24
Do we want to call this "SYNCEVOLUTION" or "SYNCML"? Both has pros and cons. Treating it as generic SyncML capability hides the detail that it's currently based on SyncEvolution. Exposing SyncEvolution itself would allow to activate multiple different SyncML implementations at the same time.
My preference would be to keep it as is, but I wanted to ask anyway.
Off topic: what is the "PC Suite Services server"?
src/main.c static GOptionEntry options[] = { · line 205
Quoted 2 lines
src/main.c +2
-0+ {"syncevolution" ,'e' ,0 ,G_OPTION_ARG_NONE , &option_syncevolution, + "Enable OBEX server for Syncevolution client" },
Mind the spelling: "syncevolution" (lower case) is the command line tool, "SyncEvolution" (camel case) the project. "Syncevolution" is a typo ;-)
Is there documentation that should be updated together with introducing the new feature?
src/main.c int main(int argc, char *argv[]) · line 422
Quoted 8 lines
src/main.c +8
-0+if (option_syncevolution == TRUE) { + services |=OBEX_SYNCEVOLUTION ; +bluetooth_init (OBEX_SYNCEVOLUTION ,"OBEX server for" +" Syncevolution client" ,NULL , +SYNCEVOLUTION_CHANNEL , TRUE, FALSE, FALSE, +NULL ); + } +
Which string is going to appear in the service description (the SDP part)? This one here? Mentioning "SyncML" would be useful. So I suggest "OBEX server for SyncML, using SyncEvolution". Leave out the "SyncEvolution client", because the term client is a) overloaded (SyncML/OBEX/D-Bus) and b) SyncEvolution could be both client and server in this context (SAN => SyncML client, SyncML message => SyncML server).
Signature · 6 lines
Best Regards, Patrick Ohly The content of this message is my personal opinion only and although I am an employee of Intel, the statements I make here in no way represent Intel's position on the issue, nor am I authorized to speak on behalf of Intel on this matter.
Quoted 9 lines · Patrick Ohly
src/main.c int main(int argc, char *argv[]) · line 422
Quoted 8 lines
src/main.c +8
-0+if (option_syncevolution == TRUE) { + services |=OBEX_SYNCEVOLUTION ; +bluetooth_init (OBEX_SYNCEVOLUTION ,"OBEX server for" +" Syncevolution client" ,NULL , +SYNCEVOLUTION_CHANNEL , TRUE, FALSE, FALSE, +NULL ); + } +
Quoted 6 lines
Which string is going to appear in the service description (the SDP part)? This one here? Mentioning "SyncML" would be useful. So I suggest "OBEX server for SyncML, using SyncEvolution". Leave out the "SyncEvolution client", because the term client is a) overloaded (SyncML/OBEX/D-Bus) and b) SyncEvolution could be both client and server in this context (SAN => SyncML client, SyncML message => SyncML server).
see SDP specification, you can provide ServiceName ("SyncML") and ProviderName ("SyncEvolution") attributes in the service record..
iain
Quoted 15 lines
src/main.c line 57
Quoted 8 lines
src/main.c +1
-0@@ -53,6 +53,7 @@ #define OPP_CHANNEL 9 #define FTP_CHANNEL 10 #define PBAP_CHANNEL 15 +#define SYNCEVOLUTION_CHANNEL 16 #define PCSUITE_CHANNEL 24Do we want to call this "SYNCEVOLUTION" or "SYNCML"? Both has pros and cons. Treating it as generic SyncML capability hides the detail that it's currently based on SyncEvolution. Exposing SyncEvolution itself would allow to activate multiple different SyncML implementations at the same time.
Quoted 1 line
My preference would be to keep it as is, but I wanted to ask anyway.
I have the same idea as you do, and prefer to keep it as "SYNCEVOLUTION".
Quoted 3 lines
Off topic: what is the "PC Suite Services server"?
It's Nokia OBEX PC Suite Services. Johan may know more details about it.
Quoted 7 lines
src/main.c static GOptionEntry options[] = { · line 205
Quoted 2 lines
src/main.c +2
-0+ { "syncevolution", 'e', 0, G_OPTION_ARG_NONE, &option_syncevolution, + "Enable OBEX server for Syncevolution client" },Mind the spelling: "syncevolution" (lower case) is the command line tool, "SyncEvolution" (camel case) the project. "Syncevolution" is a typo ;-)
Will fix it ASAP.
Quoted 2 lines
Is there documentation that should be updated together with introducing the new feature?
The patch does not introduce any new d-bus API to obexd, so no doc need to be updated.
Quoted 10 lines
Quoted 9 lines
+ if (
option_syncevolution== TRUE) {
+ services |=OBEX_SYNCEVOLUTION;
+ bluetooth_init(OBEX_SYNCEVOLUTION, "OBEX server for"
+ " Syncevolution client", NULL,
+SYNCEVOLUTION_CHANNEL, TRUE, FALSE, FALSE,
+ NULL);
+ }
+
Quoted 7 lines
Which string is going to appear in the service description (the SDP part)? This one here? Mentioning "SyncML" would be useful. So I suggest "OBEX server for SyncML, using SyncEvolution". Leave out the "SyncEvolution client", because the term client is a) overloaded (SyncML/OBEX/D-Bus) and b) SyncEvolution could be both client and server in this context (SAN => SyncML client, SyncML message => SyncML server).
OK. Will expose service name as "OBEX server for SyncML, using SyncEvolution" since ProviderName attribute is not supported by obexd now.
Quoted 54 lines · Zhao Forrest
Quoted 15 lines
src/main.c line 57
Quoted 8 lines
src/main.c +1
-0@@ -53,6 +53,7 @@ #define OPP_CHANNEL 9 #define FTP_CHANNEL 10 #define PBAP_CHANNEL 15 +#define SYNCEVOLUTION_CHANNEL 16 #define PCSUITE_CHANNEL 24Do we want to call this "SYNCEVOLUTION" or "SYNCML"? Both has pros and cons. Treating it as generic SyncML capability hides the detail that it's currently based on SyncEvolution. Exposing SyncEvolution itself would allow to activate multiple different SyncML implementations at the same time.
Quoted 1 line
My preference would be to keep it as is, but I wanted to ask anyway.
I have the same idea as you do, and prefer to keep it as "SYNCEVOLUTION".
Quoted 3 lines
Off topic: what is the "PC Suite Services server"?
It's Nokia OBEX PC Suite Services. Johan may know more details about it.
Quoted 7 lines
src/main.c static GOptionEntry options[] = { · line 205
Quoted 2 lines
src/main.c +2
-0+ { "syncevolution", 'e', 0, G_OPTION_ARG_NONE, &option_syncevolution, + "Enable OBEX server for Syncevolution client" },Mind the spelling: "syncevolution" (lower case) is the command line tool, "SyncEvolution" (camel case) the project. "Syncevolution" is a typo ;-)
Will fix it ASAP.
Quoted 2 lines
Is there documentation that should be updated together with introducing the new feature?
The patch does not introduce any new d-bus API to obexd, so no doc need to be updated.
Quoted 10 lines
Quoted 9 lines
+ if (
option_syncevolution== TRUE) {
+ services |=OBEX_SYNCEVOLUTION;
+ bluetooth_init(OBEX_SYNCEVOLUTION, "OBEX server for"
+ " Syncevolution client", NULL,
+SYNCEVOLUTION_CHANNEL, TRUE, FALSE, FALSE,
+ NULL);
+ }
+Quoted 7 lines
Which string is going to appear in the service description (the SDP part)? This one here? Mentioning "SyncML" would be useful. So I suggest "OBEX server for SyncML, using SyncEvolution". Leave out the "SyncEvolution client", because the term client is a) overloaded (SyncML/OBEX/D-Bus) and b) SyncEvolution could be both client and server in this context (SAN => SyncML client, SyncML message => SyncML server).
Quoted 2 lines
OK. Will expose service name as "OBEX server for SyncML, using SyncEvolution" since ProviderName attribute is not supported by obexd now.
If it's consensus the right way would be exposing SyncEvolution through ProviderName, please add a comment to the code telling that, so someone remember to fix it by the time obexd supports it.
Signature · 5 lines
João Paulo Rechi Vita MSc Computer Science Student Computer Engineer IC / Unicamp http://jprvita.wordpress.com/
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 9 lines
+ if (
option_syncevolution== TRUE) {
+ services |=OBEX_SYNCEVOLUTION;
+ bluetooth_init(OBEX_SYNCEVOLUTION, "OBEX server for"
+ " Syncevolution client", NULL,
+SYNCEVOLUTION_CHANNEL, TRUE, FALSE, FALSE,
+ NULL);
+ }
+Which string is going to appear in the service description (the SDP part)? This one here? Mentioning "SyncML" would be useful. So I suggest "OBEX server for SyncML, using SyncEvolution". Leave out the "SyncEvolution client", because the term client is a) overloaded (SyncML/OBEX/D-Bus) and b) SyncEvolution could be both client and server in this context (SAN => SyncML client, SyncML message => SyncML server).
Quoted 7 lines
Quoted 2 lines
OK. Will expose service name as "OBEX server for SyncML, using SyncEvolution" since ProviderName attribute is not supported by obexd now.
If it's consensus the right way would be exposing SyncEvolution through ProviderName, please add a comment to the code telling that, so someone remember to fix it by the time obexd supports it.
Thank you for reminding. A FIXME comment will be put here.