summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Zeller <luz@synthesis.ch>2010-04-30 16:56:14 +0200
committerLukas Zeller <luz@synthesis.ch>2010-04-30 17:42:04 +0200
commitb15e49512cac7eca01950d479982f73991ad18ff (patch)
tree81b46e7b83fb651e548d0ba812405f25a22dff8d
parent0c8d940865c15b2d5bb0e76814921038f894eee6 (diff)
engine 3.4.0.7: Progress events now session local and available for server sessions
- new macros for generating progress events - in engine builds, progress events are strictly session local now and are directly delivered via SessionStep. - in monolithic builds, progress events are still passed down to the app level and delivered via a app level callback as in previous versions.
-rw-r--r--src/Transport_interfaces/engine/enginesessiondispatch.cpp12
-rw-r--r--src/Transport_interfaces/engine/enginesessiondispatch.h2
-rw-r--r--src/global_options.h4
-rwxr-xr-xsrc/sysync/binfileimplclient.cpp4
-rwxr-xr-xsrc/sysync/binfileimplds.cpp4
-rw-r--r--src/sysync/localengineds.cpp39
-rw-r--r--src/sysync/stdlogicds.cpp6
-rwxr-xr-xsrc/sysync/syncagent.cpp129
-rwxr-xr-xsrc/sysync/syncagent.h21
-rwxr-xr-xsrc/sysync/syncappbase.cpp12
-rwxr-xr-xsrc/sysync/syncappbase.h23
-rw-r--r--src/sysync/syncclientbase.cpp137
-rw-r--r--src/sysync/syncclientbase.h26
-rw-r--r--src/sysync/syncsession.cpp61
-rwxr-xr-xsrc/sysync/syncsession.h47
15 files changed, 276 insertions, 251 deletions
diff --git a/src/Transport_interfaces/engine/enginesessiondispatch.cpp b/src/Transport_interfaces/engine/enginesessiondispatch.cpp
index 83bba90..afde74e 100644
--- a/src/Transport_interfaces/engine/enginesessiondispatch.cpp
+++ b/src/Transport_interfaces/engine/enginesessiondispatch.cpp
@@ -287,7 +287,7 @@ TEngineServerSessionHandle::TEngineServerSessionHandle(TServerEngineInterface *a
{
fServerSessionP = NULL;
fSmlInstanceID = 0;
- fSessionStatus = LOCERR_WRONGUSAGE;
+ fServerSessionStatus = LOCERR_WRONGUSAGE;
fServerEngineInterface = aServerEngineInterface;
}
@@ -321,8 +321,8 @@ TSyError TServerEngineInterface::OpenSessionInternal(SessionH &aNewSessionH, uIn
#ifdef DBAPI_TUNNEL_SUPPORT
#error "%%% tbi"
// Create a new session, sessionName selects datastore
- fSessionStatus = sessionDispatchP->CreateTunnelSession(aSessionName);
- if (fSessionStatus==LOCERR_OK) {
+ sessionHandleP->fServerSessionStatus = sessionDispatchP->CreateTunnelSession(aSessionName);
+ if (sessionHandleP->fServerSessionStatus==LOCERR_OK) {
// return the session pointer as handle
%%%aNewSessionH=clientBaseP->fClientSessionP;
}
@@ -366,7 +366,7 @@ TSyError TServerEngineInterface::OpenSessionInternal(SessionH &aNewSessionH, uIn
if (sessionP) {
// assign to handle
sessionHandleP->fServerSessionP = sessionP;
- sessionHandleP->fSessionStatus = LOCERR_OK;
+ sessionHandleP->fServerSessionStatus = LOCERR_OK;
// also create a toolkit instance for the session (so we can start receiving data)
if (!getSyncAppBase()->newSmlInstance(
SML_XML,
@@ -474,9 +474,9 @@ TSyError TServerEngineInterface::SessionStep(SessionH aSessionH, uInt16 &aStepCm
break;
}
// let server session handle it
- sessionHandleP->fSessionStatus = serverSessionP->SessionStep(aStepCmd, aInfoP);
+ sessionHandleP->fServerSessionStatus = serverSessionP->SessionStep(aStepCmd, aInfoP);
// return step status
- return sessionHandleP->fSessionStatus;
+ return sessionHandleP->fServerSessionStatus;
} // TServerEngineInterface::SessionStep
diff --git a/src/Transport_interfaces/engine/enginesessiondispatch.h b/src/Transport_interfaces/engine/enginesessiondispatch.h
index fae2b65..0ae1b68 100644
--- a/src/Transport_interfaces/engine/enginesessiondispatch.h
+++ b/src/Transport_interfaces/engine/enginesessiondispatch.h
@@ -131,7 +131,7 @@ public:
// the toolkit instance used by the session
InstanceID_t fSmlInstanceID;
// status of the session
- localstatus fSessionStatus;
+ localstatus fServerSessionStatus;
};
diff --git a/src/global_options.h b/src/global_options.h
index 91c4a99..c077170 100644
--- a/src/global_options.h
+++ b/src/global_options.h
@@ -71,8 +71,8 @@
#endif
#ifndef SYSYNC_BUILDNUMBER
-#define SYSYNC_BUILDNUMBER 6
-#define SYSYNC_BUILDNUMBER_TXT "6"
+#define SYSYNC_BUILDNUMBER 7
+#define SYSYNC_BUILDNUMBER_TXT "7"
#endif
diff --git a/src/sysync/binfileimplclient.cpp b/src/sysync/binfileimplclient.cpp
index a643f6a..33968fa 100755
--- a/src/sysync/binfileimplclient.cpp
+++ b/src/sysync/binfileimplclient.cpp
@@ -2839,8 +2839,8 @@ localstatus TBinfileImplClient::SelectProfile(uInt32 aProfileSelector, bool aAut
// silently discard (do not sync it)
PDEBUGPRINTFX(DBG_ERROR,("Local Database for datastore '%s' prepares not ok -> not synced",binfiledsP->getName()));
// show event (alerted for no database)
- OBJ_PROGRESS_EVENT(
- getSyncAppBase(),
+ SESSION_PROGRESS_EVENT(
+ this,
pev_error,
binfiledscfgP,
LOCERR_LOCDBNOTRDY,0,0
diff --git a/src/sysync/binfileimplds.cpp b/src/sysync/binfileimplds.cpp
index 07f311b..3890be8 100755
--- a/src/sysync/binfileimplds.cpp
+++ b/src/sysync/binfileimplds.cpp
@@ -785,9 +785,7 @@ localstatus TBinfileImplDS::changeLogPreflight(bool &aValidChangelog)
while (foundone) {
// report event to allow progress display, use existing number as approx for total # of items
++seen;
- #ifdef PROGRESS_EVENTS
- fSessionP->getSyncAppBase()->NotifyProgressEvent(pev_preparing,getDSConfig(),seen,numexistinglogentries);
- #endif
+ DB_PROGRESS_EVENT(this,pev_preparing,seen,numexistinglogentries,0);
// process now
bool chgentryexists=false; // none found yet
// - get local ID
diff --git a/src/sysync/localengineds.cpp b/src/sysync/localengineds.cpp
index 97dfb6a..c81f0da 100644
--- a/src/sysync/localengineds.cpp
+++ b/src/sysync/localengineds.cpp
@@ -2676,10 +2676,9 @@ TAlertCommand *TLocalEngineDS::engProcessSyncAlert(
));
#ifdef PROGRESS_EVENTS
// - progress event
- OBJ_PROGRESS_EVENT(
- fSessionP->getSyncAppBase(),
+ DB_PROGRESS_EVENT(
+ this,
pev_alerted,
- fDSConfigP,
fSlowSync ? (fFirstTimeSync ? 2 : 1) : 0,
fResuming ? 1 : 0,
fSyncMode
@@ -3925,7 +3924,7 @@ bool TLocalEngineDS::engProcessSyncCmd(
fSlowSync ? "slow" : "normal"
));
if (fRemoteNumberOfChanges>=0) PDEBUGPRINTFX(DBG_HOT,("- NumberOfChanges announced by remote = %ld",(long)fRemoteNumberOfChanges));
- OBJ_PROGRESS_EVENT(fSessionP->getSyncAppBase(),pev_syncstart,fDSConfigP,0,0,0);
+ DB_PROGRESS_EVENT(this,pev_syncstart,0,0,0);
}
else {
// - not yet started
@@ -4190,10 +4189,9 @@ void TLocalEngineDS::engAbortDataStoreSync(TSyError aStatusCode, bool aLocalProb
aLocalProblem ? "LOCAL" : "REMOTE",
aStatusCode
));
- OBJ_PROGRESS_EVENT(
- fSessionP->getSyncAppBase(),
+ DB_PROGRESS_EVENT(
+ this,
pev_syncend,
- fDSConfigP,
getAbortStatusCode(), //%%%aLocalProblem ? localError(aStatusCode) : syncmlError(aStatusCode),
fSlowSync ? (fFirstTimeSync ? 2 : 1) : 0,
fResuming ? 1 : 0
@@ -4361,10 +4359,9 @@ void TLocalEngineDS::engFinishDataStoreSync(localstatus aErrorStatus)
if (aErrorStatus!=LOCERR_OK)
engAbortDataStoreSync(aErrorStatus,true); // if we have an error here, this is considered a local problem
else {
- OBJ_PROGRESS_EVENT(
- fSessionP->getSyncAppBase(),
+ DB_PROGRESS_EVENT(
+ this,
pev_syncend,
- fDSConfigP,
fAbortStatusCode,
fSlowSync ? (fFirstTimeSync ? 2 : 1) : 0,
fResuming ? 1 : 0
@@ -4481,17 +4478,17 @@ void TLocalEngineDS::showStatistics(void)
}
CONSOLEPRINTF((""));
// Always provide statistics as events
- OBJ_PROGRESS_EVENT(fSessionP->getSyncAppBase(),pev_dsstats_l,fDSConfigP,fLocalItemsAdded,fLocalItemsUpdated,fLocalItemsDeleted);
- OBJ_PROGRESS_EVENT(fSessionP->getSyncAppBase(),pev_dsstats_r,fDSConfigP,fRemoteItemsAdded,fRemoteItemsUpdated,fRemoteItemsDeleted);
- OBJ_PROGRESS_EVENT(fSessionP->getSyncAppBase(),pev_dsstats_e,fDSConfigP,fLocalItemsError,fRemoteItemsError,0);
+ DB_PROGRESS_EVENT(this,pev_dsstats_l,fLocalItemsAdded,fLocalItemsUpdated,fLocalItemsDeleted);
+ DB_PROGRESS_EVENT(this,pev_dsstats_r,fRemoteItemsAdded,fRemoteItemsUpdated,fRemoteItemsDeleted);
+ DB_PROGRESS_EVENT(this,pev_dsstats_e,fLocalItemsError,fRemoteItemsError,0);
#ifdef SYSYNC_SERVER
if (IS_SERVER) {
- OBJ_PROGRESS_EVENT(fSessionP->getSyncAppBase(),pev_dsstats_s,fDSConfigP,fSlowSyncMatches,0,0);
- OBJ_PROGRESS_EVENT(fSessionP->getSyncAppBase(),pev_dsstats_c,fDSConfigP,fConflictsServerWins,fConflictsClientWins,fConflictsDuplicated);
+ DB_PROGRESS_EVENT(this,pev_dsstats_s,fSlowSyncMatches,0,0);
+ DB_PROGRESS_EVENT(this,pev_dsstats_c,fConflictsServerWins,fConflictsClientWins,fConflictsDuplicated);
}
#endif
// NOTE: pev_dsstats_d should remain the last log data event sent (as it terminates collecting data in some GUIs)
- OBJ_PROGRESS_EVENT(fSessionP->getSyncAppBase(),pev_dsstats_d,fDSConfigP,fOutgoingDataBytes,fIncomingDataBytes,fRemoteItemsError);
+ DB_PROGRESS_EVENT(this,pev_dsstats_d,fOutgoingDataBytes,fIncomingDataBytes,fRemoteItemsError);
// Always show statistics in debug log
#ifdef SYDEBUG
PDEBUGPRINTFX(DBG_HOT,("Sync Statistics for '%s' (%s), %s sync",
@@ -5141,7 +5138,7 @@ bool TLocalEngineDS::engProcessRemoteItemAsServer(
if(CheckAborted(aStatusCommand))
return false;
// send event (but no abort checking)
- OBJ_PROGRESS_EVENT(fSessionP->getSyncAppBase(),pev_itemreceived,fDSConfigP,++fItemsReceived,fRemoteNumberOfChanges,0);
+ DB_PROGRESS_EVENT(this,pev_itemreceived,++fItemsReceived,fRemoteNumberOfChanges,0);
fPreventAdd = false;
fIgnoreUpdate = false;
// show
@@ -5959,7 +5956,7 @@ bool TLocalEngineDS::engProcessRemoteItemAsServer(
SYSYNC_THROW(TSyncException("Unknown sync op in TLocalEngineDS::processRemoteItemAsServer"));
} // switch
if (ok) {
- OBJ_PROGRESS_EVENT(fSessionP->getSyncAppBase(),pev_itemprocessed,fDSConfigP,fLocalItemsAdded,fLocalItemsUpdated,fLocalItemsDeleted);
+ DB_PROGRESS_EVENT(this,pev_itemprocessed,fLocalItemsAdded,fLocalItemsUpdated,fLocalItemsDeleted);
}
else {
// if the DB has a error string to show, add it here
@@ -6023,10 +6020,10 @@ bool TLocalEngineDS::engProcessRemoteItemAsClient(
// send event and check for user abort
#ifdef PROGRESS_EVENTS
- if (!fSessionP->getSyncAppBase()->NotifyProgressEvent(pev_itemreceived,fDSConfigP,++fItemsReceived,fRemoteNumberOfChanges)) {
+ if (!DB_PROGRESS_EVENT(this,pev_itemreceived,++fItemsReceived,fRemoteNumberOfChanges,0)) {
fSessionP->AbortSession(500,true,LOCERR_USERABORT); // this also causes datastore to be aborted
}
- if (!fSessionP->getSyncAppBase()->NotifyProgressEvent(pev_suspendcheck)) {
+ if (!SESSION_PROGRESS_EVENT(fSessionP,pev_suspendcheck,NULL,0,0,0)) {
fSessionP->SuspendSession(LOCERR_USERSUSPEND);
}
#endif
@@ -6201,7 +6198,7 @@ bool TLocalEngineDS::engProcessRemoteItemAsClient(
} // switch
// processed
if (ok) {
- OBJ_PROGRESS_EVENT(fSessionP->getSyncAppBase(),pev_itemprocessed,fDSConfigP,fLocalItemsAdded,fLocalItemsUpdated,fLocalItemsDeleted);
+ DB_PROGRESS_EVENT(this,pev_itemprocessed,fLocalItemsAdded,fLocalItemsUpdated,fLocalItemsDeleted);
}
else {
// if the DB has a error string to show, add it here
diff --git a/src/sysync/stdlogicds.cpp b/src/sysync/stdlogicds.cpp
index 3e72783..1c2c3cf 100644
--- a/src/sysync/stdlogicds.cpp
+++ b/src/sysync/stdlogicds.cpp
@@ -871,7 +871,7 @@ bool TStdLogicDS::logicGenerateSyncCommandsAsServer(
fItemsSent++; // overall counter for statistics
itemcount++; // per message counter
// send event (but no check for abort)
- OBJ_PROGRESS_EVENT(fSessionP->getSyncAppBase(),pev_itemsent,getDSConfig(),fItemsSent,getNumberOfChanges(),0);
+ DB_PROGRESS_EVENT(this,pev_itemsent,fItemsSent,getNumberOfChanges(),0);
}
}; // while not aborted and not message full
// we are not done until all aNextMessageCommands are also out
@@ -1033,13 +1033,13 @@ bool TStdLogicDS::logicGenerateSyncCommandsAsClient(
fItemsSent++;
// send event and check for abort
#ifdef PROGRESS_EVENTS
- if (!fSessionP->getSyncAppBase()->NotifyProgressEvent(pev_itemsent,getDSConfig(),fItemsSent,getNumberOfChanges())) {
+ if (!DB_PROGRESS_EVENT(this,pev_itemsent,fItemsSent,getNumberOfChanges(),0)) {
implEndDataRead(); // terminate reading
fSessionP->AbortSession(500,true,LOCERR_USERABORT);
return false; // error
}
// check for "soft" suspension
- if (!fSessionP->getSyncAppBase()->NotifyProgressEvent(pev_suspendcheck)) {
+ if (!SESSION_PROGRESS_EVENT(fSessionP,pev_suspendcheck,NULL,0,0,0)) {
fSessionP->SuspendSession(LOCERR_USERSUSPEND);
}
#endif
diff --git a/src/sysync/syncagent.cpp b/src/sysync/syncagent.cpp
index 28fc4ab..5759d91 100755
--- a/src/sysync/syncagent.cpp
+++ b/src/sysync/syncagent.cpp
@@ -617,10 +617,25 @@ TSyncAgent::TSyncAgent(
) :
TSyncSession(aAppBaseP,aSessionID)
{
+ // General
+ #ifdef ENGINE_LIBRARY
+ // init the flags which are set by STEPCMD_SUSPEND, STEPCMD_ABORT and STEPCMD_TRANSPFAIL
+ fAbortRequested = false;
+ fSuspendRequested = false;
+ fEngineSessionStatus = LOCERR_WRONGUSAGE;
+ #ifdef NON_FULLY_GRANULAR_ENGINE
+ // - erase the list of queued progress events
+ fProgressInfoList.clear();
+ fPendingStepCmd = 0; // none pending
+ #endif // NON_FULLY_GRANULAR_ENGINE
+ // - issue session start event here (in non-engine case this is done in TSyncSession constructor)
+ SESSION_PROGRESS_EVENT(this,pev_sessionstart,NULL,0,0,0);
+ #endif // ENGINE_LIBRARY
+ // Specific for Client or Server
if (IS_CLIENT) {
#ifdef SYSYNC_CLIENT
#ifdef HARD_CODED_SERVER_URI
- fNoCRCPrefixLen=0;
+ fNoCRCPrefixLen = 0;
#endif
#ifdef ENGINE_LIBRARY
// engine
@@ -629,7 +644,7 @@ TSyncAgent::TSyncAgent(
// reset session now to get correct initial state
InternalResetSession();
// restart with session numbering at 1 (incremented before use)
- fClientSessionNo=0;
+ fClientSessionNo = 0;
#endif // SYSYNC_CLIENT
}
else {
@@ -962,7 +977,7 @@ localstatus TSyncAgent::NextMessage(bool &aDone)
aDone=true;
#ifdef PROGRESS_EVENTS
// check for user suspend
- if (!getSyncAppBase()->NotifyProgressEvent(pev_suspendcheck)) {
+ if (!SESSION_PROGRESS_EVENT(this,pev_suspendcheck,NULL,0,0,0)) {
SuspendSession(LOCERR_USERSUSPEND);
}
#endif
@@ -2848,18 +2863,109 @@ appPointer TSyncAgent::newSessionKey(TEngineInterface *aEngineInterfaceP)
TSyError TSyncAgent::SessionStep(uInt16 &aStepCmd, TEngineProgressInfo *aInfoP)
{
+ #ifdef NON_FULLY_GRANULAR_ENGINE
+ // pre-process step command and generate pseudo-steps to empty progress event queue
+ // preprocess general step codes
+ switch (aStepCmd) {
+ case STEPCMD_TRANSPFAIL :
+ // directly abort
+ AbortSession(LOCERR_TRANSPFAIL,true);
+ goto abort;
+ case STEPCMD_ABORT :
+ // directly abort
+ AbortSession(LOCERR_USERABORT,true);
+ abort:
+ // also set the flag so subsequent progress events will result the abort status
+ fAbortRequested=true;
+ aStepCmd = STEPCMD_STEP; // convert to normal step
+ goto step;
+ case STEPCMD_SUSPEND :
+ // directly suspend
+ SuspendSession(LOCERR_USERSUSPEND);
+ // also set the flag so subsequent pev_suspendcheck events will result the suspend status
+ fSuspendRequested=true;
+ aStepCmd = STEPCMD_OK; // this is a out-of-order step, and always just returns STEPCMD_OK.
+ fEngineSessionStatus = 0; // ok for now, subsequent steps will perform the actual suspend
+ goto done; // no more action for now
+ case STEPCMD_STEP :
+ step:
+ // first just return all queued up progress events
+ if (fProgressInfoList.size()>0) {
+ // get first element in list
+ TEngineProgressInfoList::iterator pos = fProgressInfoList.begin();
+ // pass it back to caller if caller is interested
+ if (aInfoP) {
+ *aInfoP = *pos; // copy progress event
+ }
+ // delete progress event from list
+ fProgressInfoList.erase(pos);
+ // that's it for now, engine state does not change, wait for next step
+ aStepCmd = STEPCMD_PROGRESS;
+ return LOCERR_OK;
+ }
+ else if (fPendingStepCmd != 0) {
+ // now return previously generated step command
+ // Note: engine is already in the new state matching fPendingStepCmd
+ aStepCmd = fPendingStepCmd;
+ fEngineSessionStatus = fPendingStatus;
+ fPendingStepCmd=0; // none pending any more
+ fPendingStatus=0;
+ return fEngineSessionStatus; // return pending status now
+ }
+ // all progress events are delivered, now we can do the real work
+ }
+ #endif // NON_FULLY_GRANULAR_ENGINE
+ // Now perform the actual step
if (IS_CLIENT) {
#ifdef SYSYNC_CLIENT
- return ClientSessionStep(aStepCmd,aInfoP);
+ fEngineSessionStatus = ClientSessionStep(aStepCmd,aInfoP);
#endif // SYSYNC_CLIENT
}
else {
#ifdef SYSYNC_SERVER
- return ServerSessionStep(aStepCmd,aInfoP);
+ fEngineSessionStatus = ServerSessionStep(aStepCmd,aInfoP);
#endif // SYSYNC_SERVER
}
+ #ifdef NON_FULLY_GRANULAR_ENGINE
+ // make sure caller issues STEPCMD_STEP to get all pending progress events
+ if (fProgressInfoList.size()>0) {
+ // save pending step command for returning later
+ fPendingStepCmd = aStepCmd;
+ fPendingStatus = fEngineSessionStatus;
+ // return request for more steps instead
+ aStepCmd = STEPCMD_OK;
+ fEngineSessionStatus = LOCERR_OK;
+ }
+ #endif // NON_FULLY_GRANULAR_ENGINE
+done:
+ // return step status
+ return fEngineSessionStatus;
} // TSyncAgent::SessionStep
+
+bool TSyncAgent::HandleSessionProgressEvent(TEngineProgressInfo aProgressInfo)
+{
+ // handle some events specially
+ if (aProgressInfo.eventtype==pev_suspendcheck)
+ return !(fSuspendRequested);
+ else {
+ // engine progress record that needs to be queued
+ // - check for message
+ if (aProgressInfo.eventtype==pev_display100) {
+ // this is a pointer to a string, save it separately
+ // extra1 is a pointer to the message text
+ // - save it for retrieval via SessionKey
+ fAlertMessage = (cAppCharP)(aProgressInfo.extra1);
+ // - don't pass pointer
+ aProgressInfo.extra1 = 0;
+ }
+ // queue progress event
+ fProgressInfoList.push_back(aProgressInfo);
+ }
+ return !(fAbortRequested);
+} // TSyncAgent::HandleSessionProgressEvent
+
+
#endif // ENGINE_LIBRARY
@@ -3219,7 +3325,7 @@ TSyError TSyncAgent::ClientSessionStep(uInt16 &aStepCmd, TEngineProgressInfo *aI
switch (stepCmdIn) {
case STEPCMD_GOTDATA : {
// got data, now start processing it
- OBJ_PROGRESS_EVENT(getSyncAppBase(),pev_recvend,NULL,0,0,0);
+ SESSION_PROGRESS_EVENT(this,pev_recvend,NULL,0,0,0);
// check content type now
MemPtr_t data = NULL;
MemSize_t datasize;
@@ -3251,7 +3357,7 @@ TSyError TSyncAgent::ClientSessionStep(uInt16 &aStepCmd, TEngineProgressInfo *aI
// performing the STEPCMD_RESENDDATA just generates a new send start event, but otherwise no engine action
fClientEngineState = ces_resending;
aStepCmd = STEPCMD_RESENDDATA; // return the same step command, to differentiate it from STEPCMD_SENDDATA
- OBJ_PROGRESS_EVENT(getSyncAppBase(),pev_sendstart,NULL,0,0,0);
+ SESSION_PROGRESS_EVENT(this,pev_sendstart,NULL,0,0,0);
sta = LOCERR_OK;
break;
} // switch stepCmdIn for ces_needdata
@@ -3265,7 +3371,7 @@ TSyError TSyncAgent::ClientSessionStep(uInt16 &aStepCmd, TEngineProgressInfo *aI
case STEPCMD_SENTDATA :
// allowed in dataready or resending state
// sent (or re-sent) data, now request answer data
- OBJ_PROGRESS_EVENT(getSyncAppBase(),pev_sendend,NULL,0,0,0);
+ SESSION_PROGRESS_EVENT(this,pev_sendend,NULL,0,0,0);
fClientEngineState = ces_needdata;
aStepCmd = STEPCMD_NEEDDATA;
sta = LOCERR_OK;
@@ -3315,7 +3421,7 @@ TSyError TSyncAgent::ClientGeneratingStep(uInt16 &aStepCmd, TEngineProgressInfo
// next is sending request to server
fClientEngineState = ces_dataready;
aStepCmd = STEPCMD_SENDDATA;
- OBJ_PROGRESS_EVENT(getSyncAppBase(),pev_sendstart,NULL,0,0,0);
+ SESSION_PROGRESS_EVENT(this,pev_sendstart,NULL,0,0,0);
}
// return status
return sta;
@@ -3614,10 +3720,9 @@ static TSyError readDisplayAlert(
appPointer aBuffer, memSize aBufSize, memSize &aValSize
)
{
- TClientEngineInterface *clientEngineP =
- static_cast<TClientEngineInterface *>(aStructFieldsKeyP->getEngineInterface());
+ TAgentParamsKey *mykeyP = static_cast<TAgentParamsKey *>(aStructFieldsKeyP);
return TStructFieldsKey::returnString(
- clientEngineP->fAlertMessage.c_str(),
+ mykeyP->fAgentP->fAlertMessage.c_str(),
aBuffer,aBufSize,aValSize
);
} // readDisplayAlert
diff --git a/src/sysync/syncagent.h b/src/sysync/syncagent.h
index 8a11522..632a209 100755
--- a/src/sysync/syncagent.h
+++ b/src/sysync/syncagent.h
@@ -250,7 +250,11 @@ public:
/// @param aInfoP[in] pointer to a TEngineProgressInfo structure, NULL if no progress info needed
/// @return LOCERR_OK on success, SyncML or LOCERR_xxx error code on failure
TSyError SessionStep(uInt16 &aStepCmd, TEngineProgressInfo *aInfoP);
- #endif
+ #ifdef PROGRESS_EVENTS
+ // Handle (or dispatch) Session level progress event
+ virtual bool HandleSessionProgressEvent(TEngineProgressInfo aProgressInfo);
+ #endif // PROGRESS_EVENTS
+ #endif // ENGINE_LIBRARY
/// @brief Get new session key to access details of this session
virtual appPointer newSessionKey(TEngineInterface *aEngineInterfaceP);
#endif // ENGINEINTERFACE_SUPPORT
@@ -452,6 +456,21 @@ protected:
TServerEngineState fServerEngineState;
// - request size
MemSize_t fRequestSize;
+ #ifdef NON_FULLY_GRANULAR_ENGINE
+ // progress event queue until engine is fully granular
+ TEngineProgressInfoList fProgressInfoList;
+ // pending step command and status during progress retrieval steps
+ uInt16 fPendingStepCmd;
+ localstatus fPendingStatus;
+public:
+ string fAlertMessage;
+protected:
+ #endif // NON_FULLY_GRANULAR_ENGINE
+ // current session status
+ localstatus fEngineSessionStatus;
+ // suspend and abort requests
+ bool fSuspendRequested;
+ bool fAbortRequested;
#endif // ENGINE_LIBRARY
// set if map command received in this session
bool fMapSeen;
diff --git a/src/sysync/syncappbase.cpp b/src/sysync/syncappbase.cpp
index 8384dbb..bf8255d 100755
--- a/src/sysync/syncappbase.cpp
+++ b/src/sysync/syncappbase.cpp
@@ -43,7 +43,7 @@ extern "C" int GlobalNotifyProgressEvent (
#ifdef PROGRESS_EVENTS
TSyncAppBase *baseP = getExistingSyncAppBase();
if (baseP) {
- return baseP->NotifyProgressEvent(aEventType,NULL,aExtra1,aExtra2,aExtra3);
+ return baseP->NotifyAppProgressEvent(aEventType,NULL,aExtra1,aExtra2,aExtra3);
}
#endif
return true; // not aborted
@@ -1160,7 +1160,7 @@ TSyncAppBase::TSyncAppBase() :
fDeleting(false),
fConfigP(NULL),
fRequestCount(0),
- #ifdef PROGRESS_EVENTS
+ #if defined(PROGRESS_EVENTS) && !defined(ENGINE_LIBRARY)
fProgressEventFunc(NULL),
#endif
#ifdef ENGINEINTERFACE_SUPPORT
@@ -1910,10 +1910,10 @@ localstatus TSyncAppBase::readXMLConfigStandard(const char *aConfigFileName, boo
/* progress sevent notification */
-#ifdef PROGRESS_EVENTS
+#if defined(PROGRESS_EVENTS) && !defined(ENGINE_LIBRARY)
// event generator
-bool TSyncAppBase::NotifyProgressEvent(
+bool TSyncAppBase::NotifyAppProgressEvent(
TProgressEventType aEventType,
TLocalDSConfig *aDatastoreID,
sInt32 aExtra1,
@@ -1939,9 +1939,9 @@ bool TSyncAppBase::NotifyProgressEvent(
}
// if no callback, never abort
return true; // ok, no abort
-} // TSyncAppBase::NotifyProgressEvent
+} // TSyncAppBase::NotifyAppProgressEvent
-#endif
+#endif // non-engine progress events
diff --git a/src/sysync/syncappbase.h b/src/sysync/syncappbase.h
index 3690781..55de173 100755
--- a/src/sysync/syncappbase.h
+++ b/src/sysync/syncappbase.h
@@ -47,13 +47,20 @@ int wbxmlConv(int argc, const char *argv[]);
#endif
-// progress event posting macro
+// progress event posting macros
+// Note: engine libraries only have session level progress events
#ifdef PROGRESS_EVENTS
- #define PROGRESS_EVENT(e,d,x,y,z) NotifyProgressEvent(e,d,x,y,z)
- #define OBJ_PROGRESS_EVENT(o,e,d,x,y,z) o->NotifyProgressEvent(e,d,x,y,z)
+ #ifndef ENGINE_LIBRARY
+ #define APP_PROGRESS_EVENT(a,e,d,x,y,z) a->NotifyAppProgressEvent(e,d,x,y,z)
+ #endif
+ #define SESSION_PROGRESS_EVENT(s,e,d,x,y,z) s->NotifySessionProgressEvent(e,d,x,y,z)
+ #define DB_PROGRESS_EVENT(d,e,x,y,z) d->getSession()->NotifySessionProgressEvent(e,d->getDSConfig(),x,y,z)
#else
- #define PROGRESS_EVENT(e,d,x,y,z) true
- #define OBJ_PROGRESS_EVENT(o,e,d,x,y,z) true
+ #ifndef ENGINE_LIBRARY
+ #define APP_PROGRESS_EVENT(a,e,d,x,y,z) true
+ #endif
+ #define SESSION_PROGRESS_EVENT(s,e,d,x,y,z) true
+ #define DB_PROGRESS_EVENT(s,e,d,x,y,z) true
#endif
// non-class print to console (#ifdef CONSOLEINFO)
@@ -561,19 +568,19 @@ public:
// somewhat scattered within object to make reverse engineering harder
bool fRegOK; // updated by checkRegInfo, used to disable hard-coded-expiry
#endif
- #ifdef PROGRESS_EVENTS
+ #if defined(PROGRESS_EVENTS) && !defined(ENGINE_LIBRARY)
// callback for progress events
TProgressEventFunc fProgressEventFunc;
void *fProgressEventContext;
// event generator
- bool NotifyProgressEvent(
+ bool NotifyAppProgressEvent(
TProgressEventType aEventType,
TLocalDSConfig *aDatastoreID=NULL,
sInt32 aExtra1=0,
sInt32 aExtra2=0,
sInt32 aExtra3=0
);
- #endif
+ #endif // non-engine progress events
#ifdef ENGINEINTERFACE_SUPPORT
// owning engineInterface
TEngineInterface *fEngineInterfaceP;
diff --git a/src/sysync/syncclientbase.cpp b/src/sysync/syncclientbase.cpp
index 424d034..6b4f50c 100644
--- a/src/sysync/syncclientbase.cpp
+++ b/src/sysync/syncclientbase.cpp
@@ -49,47 +49,6 @@ TSyncAppBase *TClientEngineInterface::newSyncAppBase(void)
// EngineInterface methods
// -----------------------
-// progress callback which queues up progress events for later delivery via SessionStep()
-static bool progressCallback(
- const TProgressEvent &aEvent,
- void *aContext
-)
-{
- TClientEngineInterface *clientEngineP = static_cast<TClientEngineInterface *>(aContext);
-
- // handle some events specially
- if (aEvent.eventtype == pev_nop)
- return true; // just continue
- else if (aEvent.eventtype == pev_suspendcheck)
- return !(clientEngineP->fSuspendRequested);
- else {
- // create engine progress record
- TEngineProgressInfo info;
- info.eventtype = (uInt16)(aEvent.eventtype);
- // - datastore ID, if any
- if (aEvent.datastoreID != NULL)
- info.targetID = (sInt32)(aEvent.datastoreID->fLocalDBTypeID);
- else
- info.targetID = 0;
- // - handle display message event specially
- if (aEvent.eventtype==pev_display100) {
- info.extra1 = 0;
- // extra1 is a pointer to the message text, save it for retrieval via SessionKey
- clientEngineP->fAlertMessage = (cAppCharP)(aEvent.extra);
- }
- else {
- info.extra1 = aEvent.extra;
- }
- info.extra2 = aEvent.extra2;
- info.extra3 = aEvent.extra3;
- // append it at the end of the list
- clientEngineP->fProgressInfoList.push_back(info);
- }
- return !(clientEngineP->fAbortRequested);
-} // progressCallback
-
-
-
/// @brief Open a session
/// @param aNewSessionH[out] receives session handle for all session execution calls
@@ -99,6 +58,7 @@ static bool progressCallback(
TSyError TClientEngineInterface::OpenSessionInternal(SessionH &aNewSessionH, uInt32 aSelector, cAppCharP aSessionName)
{
TSyncClientBase *clientBaseP = static_cast<TSyncClientBase *>(getSyncAppBase());
+ localstatus sta = LOCERR_WRONGUSAGE;
// No client session may exist when opening a new one
if (clientBaseP->fClientSessionP)
@@ -108,8 +68,8 @@ TSyError TClientEngineInterface::OpenSessionInternal(SessionH &aNewSessionH, uIn
// initiate a DBAPI tunnel session.
#ifdef DBAPI_TUNNEL_SUPPORT
// Create a new session, sessionName selects datastore
- fSessionStatus = clientBaseP->CreateTunnelSession(aSessionName);
- if (fSessionStatus==LOCERR_OK) {
+ sta = clientBaseP->CreateTunnelSession(aSessionName);
+ if (sta==LOCERR_OK) {
// return the session pointer as handle
aNewSessionH=(SessionH)clientBaseP->fClientSessionP;
}
@@ -134,29 +94,17 @@ TSyError TClientEngineInterface::OpenSessionInternal(SessionH &aNewSessionH, uIn
#endif
}
else {
- #ifdef NON_FULLY_GRANULAR_ENGINE
- // Install callback to catch progress events and deliver them via SessionStep
- // - erase the list of queued progress events
- fProgressInfoList.clear();
- fPendingStepCmd=0; // none pending
- // init the flags which are set by STEPCMD_SUSPEND, STEPCMD_ABORT and STEPCMD_TRANSPFAIL
- fAbortRequested=false;
- fSuspendRequested=false;
- // - install the callback for catching all progress events (including those during session creation)
- clientBaseP->fProgressEventFunc=progressCallback;
- clientBaseP->fProgressEventContext=this; // pass link to myself
- #endif // NON_FULLY_GRANULAR_ENGINE
// Create a new session
- fSessionStatus = clientBaseP->CreateSession();
+ sta = clientBaseP->CreateSession();
// Pass profile ID
- if (fSessionStatus==LOCERR_OK) {
+ if (sta==LOCERR_OK) {
clientBaseP->fClientSessionP->SetProfileSelector(aSelector & SESSIONSEL_PROFILEID_MASK);
// return the session pointer as handle
aNewSessionH=(SessionH)clientBaseP->fClientSessionP;
}
}
// done
- return fSessionStatus;
+ return sta;
} // TClientEngineInterface::OpenSessionInternal
@@ -199,9 +147,6 @@ TSyError TClientEngineInterface::CloseSession(SessionH aSessionH)
return LOCERR_WRONGUSAGE; // something wrong with that handle
// terminate running session (if any)
clientBaseP->KillClientSession(LOCERR_USERABORT); // closing while session in progress counts as user abort
- // - remove the callback
- clientBaseP->fProgressEventFunc=NULL;
- clientBaseP->fProgressEventContext=NULL;
// done
return LOCERR_OK;
} // TClientEngineInterface::CloseSession
@@ -225,74 +170,8 @@ TSyError TClientEngineInterface::SessionStep(SessionH aSessionH, uInt16 &aStepCm
return LOCERR_WRONGUSAGE; // something wrong with that handle
// get client session pointer
TSyncAgent *clientSessionP = static_cast<TSyncAgent *>((void *)aSessionH);
- #ifdef NON_FULLY_GRANULAR_ENGINE
- // pre-process setp command and generate pseudo-steps to empty progress event queue
- // preprocess general step codes
- switch (aStepCmd) {
- case STEPCMD_TRANSPFAIL :
- // directly abort
- clientSessionP->AbortSession(LOCERR_TRANSPFAIL,true);
- goto abort;
- case STEPCMD_ABORT :
- // directly abort
- clientSessionP->AbortSession(LOCERR_USERABORT,true);
- abort:
- // also set the flag so subsequent progress events will result the abort status
- fAbortRequested=true;
- aStepCmd = STEPCMD_STEP; // convert to normal step
- goto step;
- case STEPCMD_SUSPEND :
- // directly suspend
- clientSessionP->SuspendSession(LOCERR_USERSUSPEND);
- // also set the flag so subsequent pev_suspendcheck events will result the suspend status
- fSuspendRequested=true;
- aStepCmd = STEPCMD_OK; // this is a out-of-order step, and always just returns STEPCMD_OK.
- fSessionStatus = 0; // ok for now, subsequent steps will perform the actual suspend
- goto done; // no more action for now
- case STEPCMD_STEP :
- step:
- // first just return all queued up progress events
- if (fProgressInfoList.size()>0) {
- // get first element in list
- TEngineProgressInfoList::iterator pos = fProgressInfoList.begin();
- // pass it back to caller if caller is interested
- if (aInfoP) {
- *aInfoP = *pos; // copy progress event
- }
- // delete progress event from list
- fProgressInfoList.erase(pos);
- // that's it for now, engine state does not change, wait for next step
- aStepCmd = STEPCMD_PROGRESS;
- return LOCERR_OK;
- }
- else if (fPendingStepCmd != 0) {
- // now return previously generated step command
- // Note: engine is already in the new state matching fPendingStepCmd
- aStepCmd = fPendingStepCmd;
- fSessionStatus = fPendingStatus;
- fPendingStepCmd=0; // none pending any more
- fPendingStatus=0;
- return fSessionStatus; // return pending status now
- }
- // all progress events are delivered, now we can do the real work
- }
- #endif
- // let client session handle it (if a session exists at all)
- fSessionStatus = clientSessionP->SessionStep(aStepCmd, aInfoP);
- #ifdef NON_FULLY_GRANULAR_ENGINE
- // make sure caller issues STEPCMD_STEP to get all pending progress events
- if (fProgressInfoList.size()>0) {
- // save pending step command for returning later
- fPendingStepCmd = aStepCmd;
- fPendingStatus = fSessionStatus;
- // return request for more steps instead
- aStepCmd = STEPCMD_OK;
- fSessionStatus = LOCERR_OK;
- }
- #endif
-done:
- // return step status
- return fSessionStatus;
+ // let client session handle it
+ return clientSessionP->SessionStep(aStepCmd, aInfoP);
} // TClientEngineInterface::SessionStep
diff --git a/src/sysync/syncclientbase.h b/src/sysync/syncclientbase.h
index 38d1165..31a3038 100644
--- a/src/sysync/syncclientbase.h
+++ b/src/sysync/syncclientbase.h
@@ -36,14 +36,7 @@ class TClientEngineInterface:
typedef TEngineInterface inherited;
public:
// constructor
- TClientEngineInterface()
- #ifdef ENGINE_LIBRARY
- : fSessionStatus(LOCERR_WRONGUSAGE)
- #ifdef NON_FULLY_GRANULAR_ENGINE
- ,fPendingStepCmd(0)
- #endif
- #endif
- {};
+ TClientEngineInterface() {};
#ifndef ENGINE_LIBRARY
@@ -94,23 +87,6 @@ protected:
/// @brief returns the SML instance for a given session handle
virtual InstanceID_t getSmlInstanceOfSession(SessionH aSessionH);
-private:
- // status of the session
- localstatus fSessionStatus;
-
- #ifdef NON_FULLY_GRANULAR_ENGINE
-public:
- // progress event queue until engine is fully granular
- TEngineProgressInfoList fProgressInfoList;
- // pending step command and status during progress retrieval steps
- uInt16 fPendingStepCmd;
- localstatus fPendingStatus;
- string fAlertMessage;
- // suspend and abort requests
- bool fSuspendRequested;
- bool fAbortRequested;
- #endif // NON_FULLY_GRANULAR_ENGINE
-
#endif // ENGINE_LIBRARY
}; // TClientEngineInterface
diff --git a/src/sysync/syncsession.cpp b/src/sysync/syncsession.cpp
index 0be6112..8c92513 100644
--- a/src/sysync/syncsession.cpp
+++ b/src/sysync/syncsession.cpp
@@ -1002,7 +1002,10 @@ TSyncSession::TSyncSession(
InternalResetSessionEx(false);
DEBUGPRINTFX(DBG_EXOTIC,("TSyncSession::TSyncSession: InternalResetSession called"));
// show starting
- OBJ_PROGRESS_EVENT(getSyncAppBase(),pev_sessionstart,NULL,0,0,0);
+ #ifndef ENGINE_LIBRARY
+ // - don't show it here in library case as Agent must be ready as well to distribute event correctly
+ SESSION_PROGRESS_EVENT(this,pev_sessionstart,NULL,0,0,0);
+ #endif
#ifdef SYDEBUG
#if defined(SYSYNC_SERVER) && defined(SYSYNC_CLIENT)
#define CAN_BE_TEXT "Server+Client"
@@ -1211,7 +1214,7 @@ void TSyncSession::TerminateSession(void)
MP_SHOWCURRENT(DBG_PROFILE,"TSyncSession deleting");
// show ending (if not normal, then ending was already shown in AbortSession())
if (normalend) {
- OBJ_PROGRESS_EVENT(getSyncAppBase(),pev_sessionend,NULL, allsuccess ? 0 : LOCERR_INCOMPLETE,0,0);
+ SESSION_PROGRESS_EVENT(this,pev_sessionend,NULL, allsuccess ? 0 : LOCERR_INCOMPLETE,0,0);
}
// is NOW terminated
fTerminated = true;
@@ -1347,12 +1350,6 @@ void TSyncSession::InternalResetSessionEx(bool terminationCall)
}
}
#endif
- /* %%% moved to ResetSession() because this might not be called from
- destructor as datastores might refer to derived session which is
- already destructed then
- // - Note: datastores may not be cleared here, only reset
- TerminateDatastores();
- */
// - remove all remote datastores
TRemoteDataStorePContainer::iterator pos1;
for (pos1=fRemoteDataStores.begin(); pos1!=fRemoteDataStores.end(); ++pos1) {
@@ -1546,6 +1543,48 @@ void TSyncSession::InternalResetSessionEx(bool terminationCall)
+#ifdef PROGRESS_EVENTS
+
+// event generator
+bool TSyncSession::NotifySessionProgressEvent(
+ TProgressEventType aEventType,
+ TLocalDSConfig *aDatastoreID,
+ sInt32 aExtra1,
+ sInt32 aExtra2,
+ sInt32 aExtra3
+)
+{
+ #ifdef ENGINE_LIBRARY
+ // library build, session level events get queued and dispatched via sessionstep
+ // - handle some events specially
+ if (aEventType == pev_nop)
+ return true; // just continue
+ else {
+ // - prepare info record
+ TEngineProgressInfo info;
+ info.eventtype = (uInt16)(aEventType);
+ // - datastore ID, if any
+ if (aDatastoreID != NULL)
+ info.targetID = (sInt32)(aDatastoreID->fLocalDBTypeID);
+ else
+ info.targetID = 0;
+ // - extras
+ info.extra1 = aExtra1;
+ info.extra2 = aExtra2;
+ info.extra3 = aExtra3;
+ // - handle it
+ return HandleSessionProgressEvent(info);
+ }
+ #else
+ // old monolithic build, pass to appbase which dispatches them to the app via callback
+ return getSyncAppBase()->NotifyAppProgressEvent(aEventType,aDatastoreID,aExtra1,aExtra2,aExtra3);
+ #endif
+} // TSyncAppBase::NotifySessionProgressEvent
+
+#endif // PROGRESS_EVENTS
+
+
+
// get root config pointer
// NOTE: we have moved this here because Palm linker
// would have problems accessing it as syncsession.cpp is
@@ -1671,8 +1710,8 @@ void TSyncSession::AbortSession(TSyError aStatusCode, bool aLocalProblem, TSyErr
fLocalAbortReason ? "LOCAL" : "REMOTE",
fAbortReasonStatus
));
- OBJ_PROGRESS_EVENT(
- getSyncAppBase(),
+ SESSION_PROGRESS_EVENT(
+ this,
pev_sessionend,
NULL,
getAbortReasonStatus(),
@@ -4827,7 +4866,7 @@ TSmlCommand *TSyncSession::processAlertItem(
smlPCDataToCharP(aItemP->data)
));
// callback to allow GUI clients to display the message
- if (!OBJ_PROGRESS_EVENT(getSyncAppBase(),pev_display100,NULL,uIntPtr(smlPCDataToCharP(aItemP->data)),0,0)) {
+ if (!SESSION_PROGRESS_EVENT(this,pev_display100,NULL,uIntPtr(smlPCDataToCharP(aItemP->data)),0,0)) {
// user answered no to our question "continue?"
aStatusCommand.setStatusCode(514); // cancelled
// Do NOT abort the session, so give the server a chance to do someting more sensible based on the 514 status.
diff --git a/src/sysync/syncsession.h b/src/sysync/syncsession.h
index 153f987..edb6640 100755
--- a/src/sysync/syncsession.h
+++ b/src/sysync/syncsession.h
@@ -312,7 +312,19 @@ public:
// Initialize a datastore tunnel session
virtual localstatus InitializeTunnelSession(cAppCharP aDatastoreName) { return LOCERR_NOTIMP; }; // is usually implemented in customimplagent, as it depends on DBApi architecture
virtual TLocalEngineDS *getTunnelDS() { return NULL; }; // is usually implemented in customimplagent
- #endif
+ #endif // DBAPI_TUNNEL_SUPPORT
+ #ifdef PROGRESS_EVENTS
+ // Create Session level progress event
+ bool NotifySessionProgressEvent(
+ TProgressEventType aEventType,
+ TLocalDSConfig *aDatastoreID,
+ sInt32 aExtra1,
+ sInt32 aExtra2,
+ sInt32 aExtra3
+ );
+ // Handle (or dispatch) Session level progress event
+ virtual bool HandleSessionProgressEvent(TEngineProgressInfo aProgressInfo) { return true; }; // no handling by default
+ #endif // PROGRESS_EVENTS
// called when incoming SyncHdr fails to execute
virtual bool syncHdrFailure(bool aTryAgain) = 0;
// Abort session
@@ -347,7 +359,7 @@ public:
#ifdef ENGINEINTERFACE_SUPPORT
/// @brief Get new session key to access details of this session
virtual appPointer newSessionKey(TEngineInterface *aEngineInterfaceP) = 0;
- #endif
+ #endif // ENGINEINTERFACE_SUPPORT
// session handling
// - get session owner (dispatcher/clientbase)
TSyncAppBase *getSyncAppBase(void) { return fSyncAppBaseP; }
@@ -379,7 +391,7 @@ public:
const char *getRemoteInfoString(void) { return fRemoteInfoString.c_str(); };
const char *getRemoteDescName(void) { return fRemoteDescName.c_str(); };
const char *getSyncUserName(void) { return fSyncUserName.c_str(); };
- #endif
+ #endif // MINIMAL_CODE
sInt32 getLastIncomingMsgID(void) { return fIncomingMsgID; };
void setSessionBusy(bool aBusy) { fSessionIsBusy=aBusy; }; // make session behave busy generally
bool getReadOnly(void) { return fReadOnly; }; // read-only option
@@ -416,13 +428,6 @@ public:
TStatusCommand &aStatusCommand, // pre-set 200 status, can be modified in case of errors
TLocalEngineDS *&aLocalDataStoreP // receives datastore pointer, if alert affects a datastore
);
- /* %%% obsolete, now as alert has its own private datastore pointer
- // - alert status processing
- virtual bool handleAlertStatus(
- TSyError aStatusCode, // status code
- const char *aLocalURI // should be local URI of datastore which sent the alert
- );
- */
// - handle status received for SyncHdr, returns false if not handled
virtual bool handleHeaderStatus(TStatusCommand * /* aStatusCmdP */) { return false; } // no special handling by default
// - map operation
@@ -602,12 +607,12 @@ public:
// - flags
bool fXMLtranslate; // dump XML translation of SyncML traffic
bool fMsgDump; // dump raw SyncML messages
- #endif
+ #endif // SYDEBUG
// log writing
#ifndef MINIMAL_CODE
void WriteLogLine(const char *aLogline);
bool logEnabled(void) { return fLogEnabled; };
- #endif
+ #endif // MINIMAL_CODE
// current database date & time (defaults to system time)
virtual lineartime_t getDatabaseNowAs(timecontext_t aContext) { return getSystemNowAs(aContext); };
// devinf
@@ -619,7 +624,7 @@ public:
#ifdef SYDEBUG
TDebugLogger *getDbgLogger(void) { return &fSessionLogger; };
uInt32 getDbgMask(void) { return fSessionDebugLogs ? fSessionLogger.getMask() : 0; };
- #endif
+ #endif // SYDEBUG
// Remote-specific options, will be set up by checkClient/ServerSpecifics()
bool fLimitedRemoteFieldLengths; // if set, all fields will be assumed to have limited, but unknown field length (used for cut-off detection)
bool fDontSendEmptyProperties; // if set, no empty properties will be sent to client
@@ -646,7 +651,7 @@ public:
#ifndef NO_REMOTE_RULES
bool isActiveRule(cAppCharP aRuleName, TRemoteRuleConfig *aRuleP=NULL); // check if given rule (by name, or if aRuleName=NULL by rule pointer) is active
TRemoteRulesList fActiveRemoteRules; // list of remote rules currently active in this session
- #endif
+ #endif // NO_REMOTE_RULES
// legacy mode
bool fLegacyMode; // if set, remote will see the types marked preferred="legacy" in devInf as preferred types, not the regular preferred ones
// lenient mode
@@ -654,7 +659,7 @@ public:
#ifdef EXPIRES_AFTER_DATE
// copy of scrambled now
sInt32 fCopyOfScrambledNow;
- #endif
+ #endif // EXPIRES_AFTER_DATE
// Sync datastores
// - find local datastore by URI and separate identifying from optional part of URI
TLocalEngineDS *findLocalDataStoreByURI(const char *aURI,string *aOptions=NULL, string *aIdentifyingURI=NULL);
@@ -671,7 +676,7 @@ public:
#ifdef SCRIPT_SUPPORT
// access to session script context
TScriptContext *getSessionScriptContext(void) { return fSessionScriptContextP; };
- #endif
+ #endif // SCRIPT_SUPPORT
// unprotected options
// - set if we should send property lists in CTCap
bool fShowCTCapProps;
@@ -686,11 +691,11 @@ public:
/// fSessionDebugLogs should be removed (but this needs rewriting of the XML and SML dumpers)
// - set if debug log for this session is enabled
bool fSessionDebugLogs;
- #endif
+ #endif // SYDEBUG
#ifndef MINIMAL_CODE
// - se if normal log for this session is enabled
bool fLogEnabled; // real log file enabled
- #endif
+ #endif // MINIMAL_CODE
// - remote options (SyncML 1.1)
bool fRemoteWantsNOC; // remote wants number-of-changes info
bool fRemoteCanHandleUTC; // remote can handle UTC time
@@ -866,11 +871,11 @@ protected:
string fRemoteDevInf_swv;
string fRemoteDevInf_fwv;
string fRemoteDevInf_hwv;
- #endif
+ #endif // MINIMAL_CODE
#ifdef SCRIPT_SUPPORT
// Session level script context
TScriptContext *fSessionScriptContextP;
- #endif
+ #endif // SCRIPT_SUPPORT
// Session options
bool fReadOnly;
// Session state vars
@@ -913,7 +918,7 @@ private:
// debug logging
#ifdef SYDEBUG
TDebugLogger fSessionLogger; // the logger
- #endif
+ #endif // SYDEBUG
// internal vars
TSyncAppBase *fSyncAppBaseP; // the owning application base (dispatcher/client base)
/* %%% prepared, to be implemented. Currently constant limits