libsyncml  0.5.4
standard.h
1 /*
2  * libsyncml - A syncml protocol implementation
3  * Copyright (C) 2008-2009 Michael Bell <michael.bell@opensync.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  */
20 
32 
33 #ifndef _SML_DATA_SYNC_API_STANDARD_H_
34 #define _SML_DATA_SYNC_API_STANDARD_H_
35 
36 #include <libsyncml/syncml.h>
37 
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #endif
42 
45 typedef enum SmlDataSyncEventType {
46  SML_DATA_SYNC_EVENT_ERROR = 0,
47  SML_DATA_SYNC_EVENT_CONNECT = 1,
48  SML_DATA_SYNC_EVENT_GOT_ALL_ALERTS = 2,
49  SML_DATA_SYNC_EVENT_GOT_ALL_CHANGES = 3,
50  SML_DATA_SYNC_EVENT_GOT_ALL_MAPPINGS = 4,
51  SML_DATA_SYNC_EVENT_DISCONNECT = 5,
52  SML_DATA_SYNC_EVENT_FINISHED = 6,
54 
55 typedef struct SmlDataSyncObject SmlDataSyncObject;
56 
57 /* object creation and configuration */
58 
59 SmlDataSyncObject *smlDataSyncNew(
60  SmlSessionType dsType,
61  SmlTransportType tspType,
62  SmlError **error);
63 void smlDataSyncObjectRef(SmlDataSyncObject *dsObject);
64 SmlBool smlDataSyncSetOption(
65  SmlDataSyncObject *dsObject,
66  const char *name,
67  const char *value,
68  SmlError **error);
69 SmlBool smlDataSyncAddDatastore(SmlDataSyncObject *dsObject,
70  const char *contentType,
71  const char *target,
72  const char *source,
73  SmlError **error);
74 
75 /* init session */
76 
77 SmlBool smlDataSyncInit(SmlDataSyncObject *dsObject, SmlError **error);
78 SmlBool smlDataSyncRun(SmlDataSyncObject *dsObject, SmlError **error);
79 
80 /* synchronize */
81 
82 SmlBool smlDataSyncAddChange(
83  SmlDataSyncObject *dsObject,
84  const char *source,
85  SmlChangeType type,
86  const char *name,
87  const char *data,
88  unsigned int size,
89  void *userdata, /* for SmlDataSyncChangeStatusCallback */
90  SmlError **error);
91 SmlBool smlDataSyncSendChanges(SmlDataSyncObject *dsObject, SmlError **error);
92 SmlBool smlDataSyncAddMapping(
93  SmlDataSyncObject *dsObject,
94  const char *source,
95  const char *remoteID,
96  const char *localID,
97  SmlError **error);
98 
112 SmlBool smlDataSyncAbort(
113  SmlDataSyncObject *dsObject,
114  SmlError **error);
115 
126  SmlDataSyncObject *dsObject,
127  SmlError **error);
128 
129 /* close session */
130 
131 void smlDataSyncObjectUnref(SmlDataSyncObject **dsObject);
132 
133 #ifdef __cplusplus
134 }
135 #endif
136 
137 #endif /* _SML_DATA_SYNC_API_STANDARD_H_ */
138 
This is the central synchronization object.
Definition: data_sync.h:110
SmlDataSyncEventType
These are all possible events which the high level API sends.
Definition: standard.h:45
const SmlLocation * smlDataSyncGetTarget(SmlDataSyncObject *dsObject, SmlError **error)
Definition: data_sync.c:832
SmlBool smlDataSyncAbort(SmlDataSyncObject *dsObject, SmlError **error)
Represent an error.