From 07288c32f2d33850347ad5b5f4d4240c2a1731f9 Mon Sep 17 00:00:00 2001 From: Beat Forster Date: Wed, 30 Sep 2009 17:38:53 +0200 Subject: SetNonce fChanged problem fixed; some type casting cAppChar --- src/sysync_SDK/DB_Interfaces/text_db/sync_dbapi_text.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sysync_SDK/DB_Interfaces/text_db/sync_dbapi_text.cpp b/src/sysync_SDK/DB_Interfaces/text_db/sync_dbapi_text.cpp index 4f9f40f..912cb9a 100644 --- a/src/sysync_SDK/DB_Interfaces/text_db/sync_dbapi_text.cpp +++ b/src/sysync_SDK/DB_Interfaces/text_db/sync_dbapi_text.cpp @@ -493,6 +493,7 @@ TSyError Session_SaveNonce( CContext sContext, cAppCharP nonce ) DEBUG_DB ( sc->fCB, MyDB, Se_SN, "%d '%s'", sc,nonce ); if (sc->fDev) { sc->fDev->fToken= nonce; + sc->fDevList.fChanged= true; err= sc->fDevList.SaveDB( true, sc->fCB ); // save it } // if @@ -1127,13 +1128,13 @@ TSyError InsertItem( CContext aContext, cAppCharP aItemData, ItemID newID ) string newItemID; TDBItem* act; - ItemID_Struct a; a.item = ""; - a.parent= newID->parent; if (!a.parent) a.parent= ""; + ItemID_Struct a; a.item = (appCharP)""; + a.parent= newID->parent; if (!a.parent) a.parent= (appCharP)""; TSyError err= ac->fItemList.CreateEmptyItem( &a, newItemID, act, ac->fNewID ); - if (err) a.item= "???"; // undefined - else a.item= (char*)newItemID.c_str(); + if (err) a.item= (appCharP)"???"; // undefined + else a.item= (appCharP)newItemID.c_str(); string s= ItemID_Info( &a ); DEBUG_DB( ac->fCB, MyDB,Da_II, "%s '%s' err=%d", s.c_str(), aItemData, err ); -- cgit v1.2.3 From 49836dc43c3ad70c93c3af2141e7c8fb7ee4e5e1 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Fri, 2 Oct 2009 13:24:54 +0200 Subject: libsynthesis + autotools: must be linked against libz When compiling with the autotools, libz is always taken from the system. Therefore libsynthesis must be linked against it unconditionally. This worked before if the application was linked against libz via some other library, but failed in a minimalistic link test with just libsyncevolution/libsynthesissdk/libsynthesis. --- src/Makefile.am.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am.in b/src/Makefile.am.in index 7ff58aa..0db8b55 100644 --- a/src/Makefile.am.in +++ b/src/Makefile.am.in @@ -54,7 +54,7 @@ LIBSYNTHESIS_CFLAGS = \ $(PCRE_CFLAGS) $(SQLITE3_CFLAGS) $(ZLIB_CFLAGS) $(XMLPARSE_CFLAGS) $(LIBICAL_CFLAGS) $(LIBECAL_CFLAGS) libsynthesis_la_CFLAGS = $(LIBSYNTHESIS_CFLAGS) libsynthesis_la_CXXFLAGS = $(LIBSYNTHESIS_CFLAGS) -libsynthesis_la_LIBADD = $(PCRE_LIBS) $(SQLITE3_LIBS) $(XMLPARSE_LIBS) $(LIBICAL_LIBS) $(LIBECAL_LIBS) libsmltk.la +libsynthesis_la_LIBADD = $(PCRE_LIBS) $(SQLITE3_LIBS) $(XMLPARSE_LIBS) $(LIBICAL_LIBS) $(LIBECAL_LIBS) libsmltk.la -lz if COND_XMLPARSE LIBSYNTHESIS_CFLAGS += -I$(srcdir)/expat -I$(srcdir)/expat/xmltok -I$(srcdir)/expat/xmlparse libsynthesis_la_SOURCES += \ -- cgit v1.2.3 From e7fb14b9b62e61568b766b23c8d125602424e287 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Sun, 27 Sep 2009 22:56:55 +0200 Subject: TSyncSession: unitialized fEncoding When an app using the server engine doesn't set the encoding, the TSyncSession::fEncoding member was used uninitialized. Setting it in the TSyncSession to SML_UNDEF fixes this and activates the "guess encoding based on message content" branch, as intended. --- src/sysync/syncsession.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sysync/syncsession.cpp b/src/sysync/syncsession.cpp index bc5fb79..63b044a 100644 --- a/src/sysync/syncsession.cpp +++ b/src/sysync/syncsession.cpp @@ -894,6 +894,7 @@ TSyncSession::TSyncSession( TP_START(fTPInfo,TP_general); DEBUGPRINTFX(DBG_EXOTIC,("TSyncSession::TSyncSession: Profiling initialized")); // set fields + fEncoding = SML_UNDEF; fLocalAbortReason = true; // unless set otherwise fAbortReasonStatus = 0; fSessionIsBusy = false; // not busy by default -- cgit v1.2.3 From 9ba430dc2b5eafd6e880d9bb899d1d5e06928bf5 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Sun, 27 Sep 2009 23:03:21 +0200 Subject: autotools: added make rules for server engine (libsynthesisserver.so) The selection of files follows the src/*.mk examples. As before, the list of files for each library has to be generated before calling automake. --- src/Makefile.am.in | 84 ++++++++++++++++++++++++++++++-------------------- src/gen-makefile-am.sh | 42 ++++++++++++++++++++++--- 2 files changed, 89 insertions(+), 37 deletions(-) diff --git a/src/Makefile.am.in b/src/Makefile.am.in index 0db8b55..4681fa7 100644 --- a/src/Makefile.am.in +++ b/src/Makefile.am.in @@ -9,26 +9,43 @@ $(srcdir)/Makefile.am: $(srcdir)/Makefile.am.in $(srcdir)/gen-makefile-am.sh cd $(srcdir) && sh ./gen-makefile-am.sh +# versioning for *all* libs +# +# CURRENT - most recent interface version +# REVISION - minor version number of that interface implementation +# AGE - number of previous interface versions supported in addition +# to the current one +# +# When adding to the interface, increment CURRENT and AGE and reset +# REVISION to zero. When breaking the interface in a backwards +# incompatible way, increment CURRENT and reset AGE and REVISION to +# zero. When fixing something without interface change, increment +# REVISION. +ENGINE_CURRENT = 2 +ENGINE_REVISION = 0 +ENGINE_AGE = 2 + CLEANFILES = EXTRA_DIST = -lib_LTLIBRARIES = libsmltk.la libsynthesis.la libsynthesissdk.la +lib_LTLIBRARIES = libsmltk.la libsynthesis.la libsynthesisserver.la libsynthesissdk.la nobase_include_HEADERS = @LIBSYNTHESISSDK_HEADERS@ synthesis/target_options.h # Configuration header files are searched in this order: # - Targets/ReleasedProducts/autotools: files only used when compiling with autotools -# - Targets/ReleasedProducts/[clientEngine_opensource_linux|SDK]: files also used with Synthesis Linux makefile +# - Targets/ReleasedProducts/[clientEngine_opensource_linux|serverEngine_opensource_linux|SDK]: files also used with Synthesis Linux makefile # # Always included first via -include: # - config.h: configure result (top directory) -# - Targets/ReleasedProducts/clientEngine_opensource_linux/clientengine_demo_x86_linux_prefix.h +# - Targets/ReleasedProducts/clientEngine_opensource_linux/clientengine_demo_x86_linux_prefix.h resp. Targets/ReleasedProducts/serverEngine_opensource_linux/serverengine_opensource_linux_prefix.h # # Included as needed: # - define.h: hard-coded SyncML Toolkit config (from search path above) -libsynthesis_la_SOURCES = @LIBSYNTHESIS_SOURCES@ +libsynthesis_la_SOURCES = @LIBSYNTHESIS_SOURCES@ \ + $(XMLPARSE_SOURCES) libsynthesis_la_CPPFLAGS = -I$(srcdir)/sysync_SDK/Sources -LIBSYNTHESIS_CFLAGS = \ +libsynthesis_la_CFLAGS = \ -include $(top_builddir)/config.h \ -include $(srcdir)/Targets/ReleasedProducts/clientEngine_opensource_linux/clientengine_demo_x86_linux_prefix.h \ -I$(srcdir)/Targets/ReleasedProducts/clientEngine_autotools/ \ @@ -51,13 +68,33 @@ LIBSYNTHESIS_CFLAGS = \ -I$(srcdir)/DB_interfaces/odbc_db/ \ -I$(srcdir)/DB_interfaces/api_db/ \ -I$(srcdir)/sysync_SDK/Sources/ \ - $(PCRE_CFLAGS) $(SQLITE3_CFLAGS) $(ZLIB_CFLAGS) $(XMLPARSE_CFLAGS) $(LIBICAL_CFLAGS) $(LIBECAL_CFLAGS) -libsynthesis_la_CFLAGS = $(LIBSYNTHESIS_CFLAGS) -libsynthesis_la_CXXFLAGS = $(LIBSYNTHESIS_CFLAGS) -libsynthesis_la_LIBADD = $(PCRE_LIBS) $(SQLITE3_LIBS) $(XMLPARSE_LIBS) $(LIBICAL_LIBS) $(LIBECAL_LIBS) libsmltk.la -lz + $(PCRE_CFLAGS) \ + $(SQLITE3_CFLAGS) \ + $(ZLIB_CFLAGS) \ + $(XMLPARSE_CFLAGS) \ + $(XMLPARSE_CFLAGS_BUILTIN) \ + $(LIBICAL_CFLAGS) \ + $(LIBECAL_CFLAGS) +libsynthesis_la_CXXFLAGS = $(libsynthesis_la_CFLAGS) +libsynthesis_la_LIBADD = $(PCRE_LIBS) $(SQLITE3_LIBS) $(XMLPARSE_LIBS) $(LIBICAL_LIBS) $(LIBECAL_LIBS) libsmltk.la +libsynthesis_la_LDFLAGS = -version-info $(ENGINE_CURRENT):$(ENGINE_REVISION):$(ENGINE_AGE) \ + -Wl,--version-script=$(srcdir)/synthesis-linker.map +libsynthesis_la_DEPENDENCIES = $(srcdir)/synthesis-linker.map libsmltk.la + + +libsynthesisserver_la_SOURCES = @LIBSYNTHESISSERVER_SOURCES@ \ + $(XMLPARSE_SOURCES) +libsynthesisserver_la_CPPFLAGS = $(libsynthesis_la_CPPFLAGS) +libsynthesisserver_la_CFLAGS = $(subst clientEngine,serverEngine, \ + $(subst clientengine_demo_x86_linux_prefix.h,serverengine_opensource_linux_prefix.h, $(libsynthesis_la_CFLAGS))) +libsynthesisserver_la_CXXFLAGS = $(libsynthesisserver_la_CFLAGS) +libsynthesisserver_la_LIBADD = $(libsynthesis_la_LIBADD) +libsynthesisserver_la_LDFLAGS = $(libsynthesis_la_LDFLAGS) +libsynthesisserver_la_DEPENDENCIES = $(libsynthesis_la_DEPENDENCIES) + if COND_XMLPARSE -LIBSYNTHESIS_CFLAGS += -I$(srcdir)/expat -I$(srcdir)/expat/xmltok -I$(srcdir)/expat/xmlparse -libsynthesis_la_SOURCES += \ +XMLPARSE_CFLAGS_BUILTIN = -I$(srcdir)/expat -I$(srcdir)/expat/xmltok -I$(srcdir)/expat/xmlparse +XMLPARSE_SOURCES = \ expat/xmlparse/xmlparse.c \ expat/xmlparse/xmlparse.h \ expat/xmltok/ascii.h \ @@ -77,28 +114,9 @@ EXTRA_DIST += \ expat/xmltok/xmltok_ns.c else # add path to xmlparse.h which includes the system's xmltok/xmlparse.h -LIBSYNTHESIS_CFLAGS += -I$(srcdir)/Targets/ReleasedProducts/clientEngine_autotools/systemxml +XMLPARSE_CFLAGS_BUILTIN = -I$(srcdir)/Targets/ReleasedProducts/clientEngine_autotools/systemxml endif -# versioning: -# CURRENT - most recent interface version -# REVISION - minor version number of that interface implementation -# AGE - number of previous interface versions supported in addition -# to the current one -# -# When adding to the interface, increment CURRENT and AGE and reset -# REVISION to zero. When breaking the interface in a backwards -# incompatible way, increment CURRENT and reset AGE and REVISION to -# zero. When fixing something without interface change, increment -# REVISION. -ENGINE_CURRENT = 2 -ENGINE_REVISION = 0 -ENGINE_AGE = 2 -libsynthesis_la_LDFLAGS = -version-info $(ENGINE_CURRENT):$(ENGINE_REVISION):$(ENGINE_AGE) \ - -Wl,--version-script=$(srcdir)/synthesis-linker.map -libsynthesis_la_DEPENDENCIES = $(srcdir)/synthesis-linker.map libsmltk.la - -libsynthesissdk_la_LIBADD = libsynthesis.la libsynthesissdk_la_LDFLAGS = -static libsynthesissdk_la_SOURCES = @LIBSYNTHESISSDK_HEADERS@ if COND_STATIC @@ -131,8 +149,8 @@ synthesis/target_options.h: $(srcdir)/Targets/ReleasedProducts/SDK/target_option # libsmltk: compiled just like libsynthesis libsmltk_la_SOURCES = @LIBSMLTK_SOURCES@ -libsmltk_la_CFLAGS = $(LIBSYNTHESIS_CFLAGS) -libsmltk_la_CXXFLAGS = $(LIBSYNTHESIS_CFLAGS) +libsmltk_la_CFLAGS = $(libsynthesis_la_CFLAGS) +libsmltk_la_CXXFLAGS = $(libsmltk_la_CFLAGS) # versioning: same as of engine! changes in libsmltk are not tracked separately. libsmltk_la_LDFLAGS = -version-info $(ENGINE_CURRENT):$(ENGINE_REVISION):$(ENGINE_AGE) \ diff --git a/src/gen-makefile-am.sh b/src/gen-makefile-am.sh index b94270f..a39dce3 100755 --- a/src/gen-makefile-am.sh +++ b/src/gen-makefile-am.sh @@ -4,11 +4,45 @@ # automake. This is necessary because automake cannot build a list # of source files dynamically. -# find expression for files which are in sysync_SDK/Sources but only -# need to be compiled into libsynthesissdk.a -SDK_FILES='-name admindata.cpp -o -name admindata.h -o -name blobs.cpp -o -name blobs.h -o -name dbitem.cpp -o -name dbitem.h -o -name enginemodulebridge.cpp -o -name enginemodulebridge.h -o -name stringutil.cpp -o -name stringutil.h -o -name target_options.h -o -name timeutil.cpp -o -name timeutil.h -o -name UI_util.cpp -o -name UI_util.h' +# directories which contain sources for the sync engine +ENGINE_SOURCES="sysync DB_interfaces sysync_SDK/Sources Transport_interfaces/engine platform_adapters" -sed -e "s;@LIBSYNTHESIS_SOURCES@;`find sysync DB_interfaces sysync_SDK/Sources Transport_interfaces/engine platform_adapters syncapps/clientEngine_custom \( -name '*.cpp' -o -name '*.[ch]' \) \! \( ${SDK_FILES} -o -name clientprovisioning_inc.cpp -o -name \*_tables_inc.cpp -o -name syncserver.cpp -o -name syncsessiondispatch.cpp \) -printf '%p '`;" \ +# files needed exclusively for libsynthesissdk.a +SDK_FILES="-false `sed -e 's/^/-o -name /' < Date: Thu, 1 Oct 2009 13:17:56 +0200 Subject: added "namespace sysync" Apparently the C++ classes (which were defined inside that namespace) were placed in the namespace. The string constants (BeginCDATA) were not, leading to name clashes. --- src/sysync/dataobjtype.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sysync/dataobjtype.cpp b/src/sysync/dataobjtype.cpp index 1deafa5..1273901 100755 --- a/src/sysync/dataobjtype.cpp +++ b/src/sysync/dataobjtype.cpp @@ -22,6 +22,7 @@ using namespace sysync; +namespace sysync { const char* BeginCDATA= ""; @@ -966,7 +967,7 @@ bool TDataObjType::copyCTCapInfoFrom(TSyncItemType &aSourceItem) } // TDataObjType::copyCTCapInfoFrom - +} // namespace sysync /* end of TDataObjType implementation */ // eof -- cgit v1.2.3 From ae7a2df5a5a12456f15e3a36d749f37d4ea43e62 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 1 Oct 2009 13:33:08 +0200 Subject: use ENGINE_ENTRY_CXX to mark external C++ functions On Windows, this is the same as ENGINE_ENTRY: function is added to DLL function table with C function name. On Mac OS X and Linux, these functions can be exported with their normal C++ name, which helps to avoid name clashes. --- src/sysync/engineentry.h | 144 ++++++++++++++++----------------- src/sysync_SDK/Sources/sync_dbapidef.h | 3 + 2 files changed, 75 insertions(+), 72 deletions(-) diff --git a/src/sysync/engineentry.h b/src/sysync/engineentry.h index 8d79b77..5802a12 100755 --- a/src/sysync/engineentry.h +++ b/src/sysync/engineentry.h @@ -24,89 +24,89 @@ using namespace std; namespace sysync { -ENGINE_ENTRY void DebugDB ( void* aCB, cAppCharP aParams ) ENTRY_ATTR; -ENGINE_ENTRY void DebugExotic ( void* aCB, cAppCharP aParams ) ENTRY_ATTR; -ENGINE_ENTRY void DebugBlock ( void* aCB, cAppCharP aTag, - cAppCharP aDesc, - cAppCharP aAttrText ) ENTRY_ATTR; -ENGINE_ENTRY void DebugEndBlock ( void* aCB, cAppCharP aTag ) ENTRY_ATTR; -ENGINE_ENTRY void DebugEndThread ( void* aCB ) ENTRY_ATTR; +ENGINE_ENTRY_CXX void DebugDB ( void* aCB, cAppCharP aParams ) ENTRY_ATTR; +ENGINE_ENTRY_CXX void DebugExotic ( void* aCB, cAppCharP aParams ) ENTRY_ATTR; +ENGINE_ENTRY_CXX void DebugBlock ( void* aCB, cAppCharP aTag, + cAppCharP aDesc, + cAppCharP aAttrText ) ENTRY_ATTR; +ENGINE_ENTRY_CXX void DebugEndBlock ( void* aCB, cAppCharP aTag ) ENTRY_ATTR; +ENGINE_ENTRY_CXX void DebugEndThread ( void* aCB ) ENTRY_ATTR; // ---------------------------------------------------------------------------------------- -ENGINE_ENTRY TSyError SetStringMode ( void* aCB, uInt16 aCharSet, - uInt16 aLineEndMode, bool aBigEndian ) ENTRY_ATTR; -ENGINE_ENTRY TSyError InitEngineXML ( void* aCB, cAppCharP aConfigXML ) ENTRY_ATTR; -ENGINE_ENTRY TSyError InitEngineFile ( void* aCB, cAppCharP aConfigFilePath ) ENTRY_ATTR; -ENGINE_ENTRY TSyError InitEngineCB ( void* aCB, TXMLConfigReadFunc aReaderFunc, void* aContext ) ENTRY_ATTR; - - -ENGINE_ENTRY TSyError OpenSession ( void* aCB, SessionH *aSessionH, uInt32 aSelector, - cAppCharP aSessionName ) ENTRY_ATTR; -ENGINE_ENTRY TSyError OpenSessionKey ( void* aCB, SessionH aSessionH, - KeyH *aKeyH, uInt16 aMode ) ENTRY_ATTR; -ENGINE_ENTRY TSyError SessionStep ( void* aCB, SessionH aSessionH, uInt16 *aStepCmd, - TEngineProgressInfo *aInfoP ) ENTRY_ATTR; -ENGINE_ENTRY TSyError GetSyncMLBuffer ( void* aCB, SessionH aSessionH, bool aForSend, - appPointer *aBuffer, memSize *aBufSize ) ENTRY_ATTR; -ENGINE_ENTRY TSyError RetSyncMLBuffer ( void* aCB, SessionH aSessionH, bool aForSend, - memSize aRetSize ) ENTRY_ATTR; -ENGINE_ENTRY TSyError ReadSyncMLBuffer ( void* aCB, SessionH aSessionH, - appPointer aBuffer, memSize aBufSize, - memSize *aValSize ) ENTRY_ATTR; -ENGINE_ENTRY TSyError WriteSyncMLBuffer( void* aCB, SessionH aSessionH, - appPointer aBuffer, memSize aValSize ) ENTRY_ATTR; -ENGINE_ENTRY TSyError CloseSession ( void* aCB, SessionH aSessionH ) ENTRY_ATTR; - - -ENGINE_ENTRY TSyError OpenKeyByPath ( void* aCB, KeyH *aKeyH, - KeyH aParentKeyH, cAppCharP aPath, uInt16 aMode ) ENTRY_ATTR; -ENGINE_ENTRY TSyError OpenSubkey ( void* aCB, KeyH *aKeyH, - KeyH aParentKeyH, sInt32 aID, uInt16 aMode ) ENTRY_ATTR; -ENGINE_ENTRY TSyError DeleteSubkey ( void* aCB, KeyH aParentKeyH, sInt32 aID ) ENTRY_ATTR; -ENGINE_ENTRY TSyError GetKeyID ( void* aCB, KeyH aKeyH, sInt32 *aID ) ENTRY_ATTR; -ENGINE_ENTRY TSyError SetTextMode ( void* aCB, KeyH aKeyH, uInt16 aCharSet, - uInt16 aLineEndMode, bool aBigEndian ) ENTRY_ATTR; -ENGINE_ENTRY TSyError SetTimeMode ( void* aCB, KeyH aKeyH, uInt16 aTimeMode ) ENTRY_ATTR; -ENGINE_ENTRY TSyError CloseKey ( void* aCB, KeyH aKeyH ) ENTRY_ATTR; - -ENGINE_ENTRY TSyError GetValue ( void* aCB, KeyH aKeyH, cAppCharP aValName, uInt16 aValType, - appPointer aBuffer, memSize aBufSize, memSize *aValSize ) ENTRY_ATTR; -ENGINE_ENTRY TSyError GetValueByID ( void* aCB, KeyH aKeyH, sInt32 aID, sInt32 arrIndex, - uInt16 aValType, - appPointer aBuffer, memSize aBufSize, memSize *aValSize ) ENTRY_ATTR; -ENGINE_ENTRY sInt32 GetValueID ( void* aCB, KeyH aKeyH, cAppCharP aName ) ENTRY_ATTR; -ENGINE_ENTRY TSyError SetValue ( void* aCB, KeyH aKeyH, cAppCharP aValName, uInt16 aValType, - cAppPointer aBuffer, memSize aValSize ) ENTRY_ATTR; -ENGINE_ENTRY TSyError SetValueByID ( void* aCB, KeyH aKeyH, sInt32 aID, sInt32 arrIndex, - uInt16 aValType, - cAppPointer aBuffer, memSize aValSize ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError SetStringMode ( void* aCB, uInt16 aCharSet, + uInt16 aLineEndMode, bool aBigEndian ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError InitEngineXML ( void* aCB, cAppCharP aConfigXML ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError InitEngineFile ( void* aCB, cAppCharP aConfigFilePath ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError InitEngineCB ( void* aCB, TXMLConfigReadFunc aReaderFunc, void* aContext ) ENTRY_ATTR; + + +ENGINE_ENTRY_CXX TSyError OpenSession ( void* aCB, SessionH *aSessionH, uInt32 aSelector, + cAppCharP aSessionName ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError OpenSessionKey ( void* aCB, SessionH aSessionH, + KeyH *aKeyH, uInt16 aMode ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError SessionStep ( void* aCB, SessionH aSessionH, uInt16 *aStepCmd, + TEngineProgressInfo *aInfoP ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError GetSyncMLBuffer ( void* aCB, SessionH aSessionH, bool aForSend, + appPointer *aBuffer, memSize *aBufSize ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError RetSyncMLBuffer ( void* aCB, SessionH aSessionH, bool aForSend, + memSize aRetSize ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError ReadSyncMLBuffer ( void* aCB, SessionH aSessionH, + appPointer aBuffer, memSize aBufSize, + memSize *aValSize ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError WriteSyncMLBuffer( void* aCB, SessionH aSessionH, + appPointer aBuffer, memSize aValSize ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError CloseSession ( void* aCB, SessionH aSessionH ) ENTRY_ATTR; + + +ENGINE_ENTRY_CXX TSyError OpenKeyByPath ( void* aCB, KeyH *aKeyH, + KeyH aParentKeyH, cAppCharP aPath, uInt16 aMode ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError OpenSubkey ( void* aCB, KeyH *aKeyH, + KeyH aParentKeyH, sInt32 aID, uInt16 aMode ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError DeleteSubkey ( void* aCB, KeyH aParentKeyH, sInt32 aID ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError GetKeyID ( void* aCB, KeyH aKeyH, sInt32 *aID ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError SetTextMode ( void* aCB, KeyH aKeyH, uInt16 aCharSet, + uInt16 aLineEndMode, bool aBigEndian ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError SetTimeMode ( void* aCB, KeyH aKeyH, uInt16 aTimeMode ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError CloseKey ( void* aCB, KeyH aKeyH ) ENTRY_ATTR; + +ENGINE_ENTRY_CXX TSyError GetValue ( void* aCB, KeyH aKeyH, cAppCharP aValName, uInt16 aValType, + appPointer aBuffer, memSize aBufSize, memSize *aValSize ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError GetValueByID ( void* aCB, KeyH aKeyH, sInt32 aID, sInt32 arrIndex, + uInt16 aValType, + appPointer aBuffer, memSize aBufSize, memSize *aValSize ) ENTRY_ATTR; +ENGINE_ENTRY_CXX sInt32 GetValueID ( void* aCB, KeyH aKeyH, cAppCharP aName ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError SetValue ( void* aCB, KeyH aKeyH, cAppCharP aValName, uInt16 aValType, + cAppPointer aBuffer, memSize aValSize ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError SetValueByID ( void* aCB, KeyH aKeyH, sInt32 aID, sInt32 arrIndex, + uInt16 aValType, + cAppPointer aBuffer, memSize aValSize ) ENTRY_ATTR; // ---- tunnel -------------------------------------------------------------------------------------------------------- -ENGINE_ENTRY TSyError StartDataRead ( CContext ac, cAppCharP lastToken, cAppCharP resumeToken ) ENTRY_ATTR; -ENGINE_ENTRY TSyError ReadNextItem ( CContext ac, ItemID aID, appCharP *aItemData, - sInt32 *aStatus, bool aFirst ) ENTRY_ATTR; -ENGINE_ENTRY TSyError ReadItem ( CContext ac, cItemID aID, appCharP *aItemData ) ENTRY_ATTR; -ENGINE_ENTRY TSyError EndDataRead ( CContext ac ) ENTRY_ATTR; -ENGINE_ENTRY TSyError StartDataWrite ( CContext ac ) ENTRY_ATTR; -ENGINE_ENTRY TSyError InsertItem ( CContext ac, cAppCharP aItemData, ItemID aID ) ENTRY_ATTR; -ENGINE_ENTRY TSyError UpdateItem ( CContext ac, cAppCharP aItemData, cItemID aID, ItemID updID ) ENTRY_ATTR; -ENGINE_ENTRY TSyError MoveItem ( CContext ac, cItemID aID, cAppCharP newParID ) ENTRY_ATTR; -ENGINE_ENTRY TSyError DeleteItem ( CContext ac, cItemID aID ) ENTRY_ATTR; -ENGINE_ENTRY TSyError EndDataWrite ( CContext ac, bool success, appCharP *newToken ) ENTRY_ATTR; -ENGINE_ENTRY void DisposeObj ( CContext ac, void* memory ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError StartDataRead ( CContext ac, cAppCharP lastToken, cAppCharP resumeToken ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError ReadNextItem ( CContext ac, ItemID aID, appCharP *aItemData, + sInt32 *aStatus, bool aFirst ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError ReadItem ( CContext ac, cItemID aID, appCharP *aItemData ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError EndDataRead ( CContext ac ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError StartDataWrite ( CContext ac ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError InsertItem ( CContext ac, cAppCharP aItemData, ItemID aID ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError UpdateItem ( CContext ac, cAppCharP aItemData, cItemID aID, ItemID updID ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError MoveItem ( CContext ac, cItemID aID, cAppCharP newParID ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError DeleteItem ( CContext ac, cItemID aID ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError EndDataWrite ( CContext ac, bool success, appCharP *newToken ) ENTRY_ATTR; +ENGINE_ENTRY_CXX void DisposeObj ( CContext ac, void* memory ) ENTRY_ATTR; // ---- asKey ---- -ENGINE_ENTRY TSyError ReadNextItemAsKey( CContext ac, ItemID aID, KeyH aItemKey, - sInt32 *aStatus, bool aFirst ) ENTRY_ATTR; -ENGINE_ENTRY TSyError ReadItemAsKey ( CContext ac, cItemID aID, KeyH aItemKey ) ENTRY_ATTR; -ENGINE_ENTRY TSyError InsertItemAsKey ( CContext ac, KeyH aItemKey, ItemID aID ) ENTRY_ATTR; -ENGINE_ENTRY TSyError UpdateItemAsKey ( CContext ac, KeyH aItemKey, cItemID aID, ItemID updID ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError ReadNextItemAsKey( CContext ac, ItemID aID, KeyH aItemKey, + sInt32 *aStatus, bool aFirst ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError ReadItemAsKey ( CContext ac, cItemID aID, KeyH aItemKey ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError InsertItemAsKey ( CContext ac, KeyH aItemKey, ItemID aID ) ENTRY_ATTR; +ENGINE_ENTRY_CXX TSyError UpdateItemAsKey ( CContext ac, KeyH aItemKey, cItemID aID, ItemID updID ) ENTRY_ATTR; // ---------------------------------------------------------------------------------------- -ENGINE_ENTRY void CB_Connect( void* aCB ) ENTRY_ATTR; +ENGINE_ENTRY_CXX void CB_Connect( void* aCB ) ENTRY_ATTR; // engine local helper, used e.g. from PluginDS/Agent void CB_Connect_KeyAccess ( void* aCB ); diff --git a/src/sysync_SDK/Sources/sync_dbapidef.h b/src/sysync_SDK/Sources/sync_dbapidef.h index 6521ecc..10a0233 100755 --- a/src/sysync_SDK/Sources/sync_dbapidef.h +++ b/src/sysync_SDK/Sources/sync_dbapidef.h @@ -46,6 +46,7 @@ #if defined MACOSX #define ENGINE_ENTRY ENTRY_C + #define ENGINE_ENTRY_CXX #ifdef __GNUC__ #define ENTRY_ATTR __attribute__((visibility("default"))) @@ -56,9 +57,11 @@ /* Visual Studio 2005 requires a specific entry point definition */ /* This definition is empty for all other platforms */ #define ENGINE_ENTRY ENTRY_C _declspec(dllexport) + #define ENGINE_ENTRY_CXX ENGINE_ENTRY #define ENTRY_ATTR #else #define ENGINE_ENTRY ENTRY_C + #define ENGINE_ENTRY_CXX #define ENTRY_ATTR #endif -- cgit v1.2.3 From cca99dfb3389a037c2476a5202197d1191ef52ae Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 1 Oct 2009 13:37:55 +0200 Subject: Linux platform_DLL: open shared library with name as requested On Linux it may be necessary to open a library with a name like libfoo.so.2: this is the library libfoo.so with the API revision 2. The corresponding libfoo.so is normally only used when linking an application and might not be installed at runtime. With this patch, opening such a libfoo.so.2 becomes possible. Previously the .so suffix was always appended. --- src/platform_adapters/linux/platform_DLL.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/platform_adapters/linux/platform_DLL.cpp b/src/platform_adapters/linux/platform_DLL.cpp index 3f5bb63..ebc80a0 100755 --- a/src/platform_adapters/linux/platform_DLL.cpp +++ b/src/platform_adapters/linux/platform_DLL.cpp @@ -63,6 +63,8 @@ public: string aName= aDLLName; do { + aDLL = dlopen(aName.c_str(), RTLD_LAZY); if (!dlerror()) break; + aName+= DSuff; aDLL = dlopen(aName.c_str(), RTLD_LAZY); if (!dlerror()) break; -- cgit v1.2.3 From 233131b74453238f7b342cd3c928cc58ab9a2487 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 1 Oct 2009 13:46:38 +0200 Subject: SDK engine connect: allow choosing between client and server engine This patch extends the semantic of the "name" parameter in ConnectEngine() so that it becomes possible to choose between the client and server version of the engine when both are inside the same library or executable (linked statically). The semantic now is: "[]" = builtin client engine "[server:]" = builtin server engine (different names of entry points) "" = client engine inside dynamic library "server:" = server engine inside dynamic library The server engine has to use the "SySync_src_" prefix for its entry points when it is to be opened with the "server:" qualifier. If it uses the normal "SySync_" prefix, then it can be opened without that qualifier, as before. Support for "[server:]" depends on a new define, DBAPI_SRV_LINKED. This was made conditional so that users of the SDK are not forced to link against the server engine (similar to DBAPI_LINKED for the client engine). At the moment, DBAPI_SRV_LINKED is not set anywhere. This will be added for compilation via autotools in a separate commit. --- src/sysync_SDK/Sources/UI_util.cpp | 54 +++++++++++++++++++++------ src/sysync_SDK/Sources/UI_util.h | 6 ++- src/sysync_SDK/Sources/enginemodulebridge.cpp | 5 ++- src/sysync_SDK/Sources/enginemodulebridge.h | 1 + 4 files changed, 51 insertions(+), 15 deletions(-) diff --git a/src/sysync_SDK/Sources/UI_util.cpp b/src/sysync_SDK/Sources/UI_util.cpp index 8adad13..8572998 100644 --- a/src/sysync_SDK/Sources/UI_util.cpp +++ b/src/sysync_SDK/Sources/UI_util.cpp @@ -96,7 +96,8 @@ static bool IsLib( cAppCharP name ) // Connect SyncML engine -TSyError UI_Connect( UI_Call_In &aCI, appPointer &aDLL, cAppCharP aEngineName, +TSyError UI_Connect( UI_Call_In &aCI, appPointer &aDLL, bool &aIsServer, + cAppCharP aEngineName, CVersion aPrgVersion, uInt16 aDebugFlags ) { @@ -115,6 +116,7 @@ TSyError UI_Connect( UI_Call_In &aCI, appPointer &aDLL, cAppCharP aEngineName, uInt16 aDebugFlags ); GetCEProc fConnectEngine= NULL; + aIsServer = false; do { aCI = NULL; // no such structure available at the beginning aDLL= NULL; @@ -129,19 +131,37 @@ TSyError UI_Connect( UI_Call_In &aCI, appPointer &aDLL, cAppCharP aEngineName, } // if if (IsLib( name.c_str() )) { - #ifdef DBAPI_LINKED + if (name == "[]") { +#ifdef DBAPI_LINKED fConnectEngine= SYSYNC_EXTERNAL(ConnectEngine); - #endif +#endif + } else if (name == "[server:]") { + aIsServer=true; +#ifdef DBAPI_SRV_LINKED + fConnectEngine= SySync_srv_ConnectEngine; +#endif + } break; } // if - name+= DLL_Suffix; - err= ConnectDLL( name.c_str(), aDLL ); // try with suffix first + + cAppCharP prefix = "server:"; + size_t prefixlen = strlen(prefix); + if (name.size() > prefixlen && + !name.compare(0, prefixlen, prefix)) { + // ignore prefix and if we find the lib, look for different entry points + aIsServer=true; + name = name.substr(prefixlen); + SyFName= "SySync_srv_ConnectEngine"; + FName= "SrvConnectEngine"; + } + + err= ConnectDLL( name.c_str(), aDLL ); // try with name directly if (dbg) printf( "modu='%s' err=%d\n", name.c_str(), err ); if (err) { - name= aEngineName; - err= ConnectDLL( name.c_str(), aDLL ); // then try directly + name+= DLL_Suffix; + err= ConnectDLL( name.c_str(), aDLL ); // try with suffix next } // if if (dbg) printf( "modu='%s' err=%d\n", name.c_str(), err ); @@ -171,7 +191,7 @@ TSyError UI_Connect( UI_Call_In &aCI, appPointer &aDLL, cAppCharP aEngineName, } // UI_Connect -TSyError UI_Disconnect( UI_Call_In aCI, appPointer aDLL ) +TSyError UI_Disconnect( UI_Call_In aCI, appPointer aDLL, bool aIsServer ) { // Always search for BOTH names, independently of environment cAppCharP SyFName= "SySync_DisconnectEngine"; @@ -184,13 +204,24 @@ TSyError UI_Disconnect( UI_Call_In aCI, appPointer aDLL ) do { if (aDLL==NULL) { - #ifdef DBAPI_LINKED + if (aIsServer) { +#ifdef DBAPI_LINKED fDisconnectEngine= SYSYNC_EXTERNAL(DisconnectEngine); - #endif +#endif + } else { +#ifdef DBAPI_SRV_LINKED + fDisconnectEngine= SySync_srv_DisconnectEngine; +#endif + } break; } // if + if (aIsServer) { + SyFName = "SySync_srv_DisconnectEngine"; + FName = "SrvDisconnectEngine"; + } + cAppCharP fN= SyFName; err= DLL_Func( aDLL, fN, fFunc ); fDisconnectEngine= (GetDEProc)fFunc; @@ -226,7 +257,8 @@ TSyError UI_CreateContext( CContext &uContext, cAppCharP aEngineName, { TSyError err; UIContext* uc= new UIContext; - err= UI_Connect( uc->uCI, uc->uDLL, aEngineName, aPrgVersion, aDebugFlags ); + bool isServer; + err= UI_Connect( uc->uCI, uc->uDLL, isServer, aEngineName, aPrgVersion, aDebugFlags ); uc->uName= aEngineName; DEBUG_DB ( uc->uCI, MyMod,"UI_CreateContext", "'%s'", uc->uName.c_str() ); uContext= (CContext)uc; diff --git a/src/sysync_SDK/Sources/UI_util.h b/src/sysync_SDK/Sources/UI_util.h index f55aea7..82ea4b1 100644 --- a/src/sysync_SDK/Sources/UI_util.h +++ b/src/sysync_SDK/Sources/UI_util.h @@ -31,11 +31,13 @@ UIContext* UiC( CContext uContext ); /* Function definitions */ TSyError UI_Connect ( UI_Call_In &aCI, - appPointer &aDLL, cAppCharP aEngineName, + appPointer &aDLL, + bool &aIsServer, cAppCharP aEngineName, CVersion aPrgVersion, uInt16 aDebugFlags ); TSyError UI_Disconnect ( UI_Call_In aCI, - appPointer aDLL ); + appPointer aDLL, + bool aIsServer ); TSyError UI_CreateContext( CContext &uContext, cAppCharP aEngineName, diff --git a/src/sysync_SDK/Sources/enginemodulebridge.cpp b/src/sysync_SDK/Sources/enginemodulebridge.cpp index 379d3c8..eeaa0de 100644 --- a/src/sysync_SDK/Sources/enginemodulebridge.cpp +++ b/src/sysync_SDK/Sources/enginemodulebridge.cpp @@ -28,6 +28,7 @@ namespace sysync { // -------------------------------------------------------------- TEngineModuleBridge::TEngineModuleBridge() { fDLL= NULL; + fIsServer= false; } // constructor @@ -40,7 +41,7 @@ TEngineModuleBridge::~TEngineModuleBridge() { // -------------------------------------------------------------- TSyError TEngineModuleBridge::Init() { - TSyError err= UI_Connect( fCI, fDLL, fEngineName.c_str(), fPrgVersion, fDebugFlags ); + TSyError err= UI_Connect( fCI, fDLL, fIsServer, fEngineName.c_str(), fPrgVersion, fDebugFlags ); return err; } // Init @@ -48,7 +49,7 @@ TSyError TEngineModuleBridge::Init() TSyError TEngineModuleBridge::Term() { TSyError err= LOCERR_OK; - if (fCI) { err= UI_Disconnect( fCI, fDLL ); fCI= NULL; } + if (fCI) { err= UI_Disconnect( fCI, fDLL, fIsServer ); fCI= NULL; } return err; } // Term diff --git a/src/sysync_SDK/Sources/enginemodulebridge.h b/src/sysync_SDK/Sources/enginemodulebridge.h index 7d133d3..58c232d 100644 --- a/src/sysync_SDK/Sources/enginemodulebridge.h +++ b/src/sysync_SDK/Sources/enginemodulebridge.h @@ -31,6 +31,7 @@ class TEngineModuleBridge : public TEngineModuleBase virtual ~TEngineModuleBridge(); appPointer fDLL; + bool fIsServer; virtual TSyError Init(); virtual TSyError Term(); -- cgit v1.2.3 From 5842bf15aa132ddf47f72e7ee05f54393952efc8 Mon Sep 17 00:00:00 2001 From: Lukas Zeller Date: Sat, 3 Oct 2009 14:33:52 +0200 Subject: engine entry points: adjusted as per discussion (Patrick/bfo) --- src/sysync_SDK/Sources/UI_util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sysync_SDK/Sources/UI_util.cpp b/src/sysync_SDK/Sources/UI_util.cpp index 8572998..550f336 100644 --- a/src/sysync_SDK/Sources/UI_util.cpp +++ b/src/sysync_SDK/Sources/UI_util.cpp @@ -153,7 +153,7 @@ TSyError UI_Connect( UI_Call_In &aCI, appPointer &aDLL, bool &aIsServer, aIsServer=true; name = name.substr(prefixlen); SyFName= "SySync_srv_ConnectEngine"; - FName= "SrvConnectEngine"; + FName= "srv_ConnectEngine"; } err= ConnectDLL( name.c_str(), aDLL ); // try with name directly @@ -219,7 +219,7 @@ TSyError UI_Disconnect( UI_Call_In aCI, appPointer aDLL, bool aIsServer ) if (aIsServer) { SyFName = "SySync_srv_DisconnectEngine"; - FName = "SrvDisconnectEngine"; + FName = "srv_DisconnectEngine"; } cAppCharP fN= SyFName; -- cgit v1.2.3