summaryrefslogtreecommitdiff
path: root/src/sysync/remotedatastore.h
blob: 2f4787b7bb1ffa77e2a0291330d1f43025e76cbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 *  File:         RemoteDataStore.h
 *
 *  Author:			  Lukas Zeller (luz@synthesis.ch)
 *
 *  TRemoteDataStore
 *    Abstraction of remote data store for SyncML Server
 *    Buffers and forwards incoming remote data store commands for
 *    processing by sync engine.
 *
 *  Copyright (c) 2001-2009 by Synthesis AG (www.synthesis.ch)
 *
 *  2001-06-12 : luz : created
 *
 */

#ifndef RemoteDataStore_H
#define RemoteDataStore_H

// includes
#include "sysync.h"
#include "syncdatastore.h"


namespace sysync {

class TRemoteDataStore: public TSyncDataStore
{
  typedef TSyncDataStore inherited;
  friend class TSyncAgent;
private:
  void init(void); // internal init
  void InternalResetDataStore(void); // reset for re-use without re-creation
public:
  TRemoteDataStore(TSyncSession *aSessionP);
  TRemoteDataStore(TSyncSession *aSessionP, const char *aName, uInt32 aCommonSyncCapMask=0);
  virtual void engResetDataStore(void) { InternalResetDataStore(); inherited::engResetDataStore(); };
  virtual ~TRemoteDataStore();
  // Naming
  // check if this remote datastore is accessible with given URI
  virtual uInt16 isDatastore(const char *aDatastoreURI);
  const char *getFullName(void) { return fFullName.c_str(); }
  void setFullName(const char *aFullName) { fFullName=aFullName; };
  // - SYNC command bracket start (check credentials if needed)
  bool remoteProcessSyncCmd(
    SmlSyncPtr_t aSyncP,            // the Sync element
    TStatusCommand &aStatusCommand, // status that might be modified
    bool &aQueueForLater // will be set if command must be queued for later (re-)execution
  );
  // %%% probably obsolete %%%% process client commands in server case
  // - SYNC command bracket end (but another might follow in next message)
  bool remoteProcessSyncCmdEnd(void);
  // %%% probably obsolete %%%% process client commands in server case
  // - end of all sync commands from client
  bool endOfClientSyncCmds(void);
  // description structure of datastore (NULL if not available)
  // - set description structure, ownership is passed to TSyncDataStore
  virtual bool setDatastoreDevInf(
    SmlDevInfDatastorePtr_t aDataStoreDevInfP,  // the datastore DevInf
    TSyncItemTypePContainer &aLocalItemTypes,   // list to look up local types (for reference)
    TSyncItemTypePContainer &aNewItemTypes      // list to add analyzed types if not already there
  );
  // helpers
  // - return display name
  #ifndef MINIMAL_CODE
  virtual const char *getDisplayName(void) { return fDisplayName.c_str(); };
  #endif
  // - return pure relative (item) URI (removes absolute part or ./ prefix)
  const char *DatastoreRelativeURI(const char *aURI);
protected:
  #ifndef MINIMAL_CODE
  // Display name of Datastore
  string fDisplayName;
  #endif
private:
  string fFullName;
}; // TRemoteDataStore

}	// namespace sysync

#endif	// RemoteDataStore_H

// eof