libsyncml 0.5.4

- Main Page
- Modules
- Data Structures
- Files

- File List

sml_ds_server.h
1 /*
2 * libsyncml - A syncml protocol implementation
3 * Copyright (C) 2005 Armin Bauer <armin.bauer@opensync.org>
4 * Copyright (C) 2007 Michael Bell <michael.bell@opensync.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
29
30 #ifndef _SML_DS_SERVER_H_
31 #define _SML_DS_SERVER_H_
32
33 typedef struct SmlDsServer SmlDsServer;
34 typedef struct SmlDsSession SmlDsSession;
35
36 typedef enum {
37 SML_DS_EVENT_GOTCHANGES = 0,
38 SML_DS_EVENT_COMMITEDCHANGES = 1
39 } SmlDsEvent;
40
41 typedef void (* SmlDsSessionConnectCb) (SmlDsSession *dsession, void *userdata);
42 typedef SmlBool (* SmlDsSessionAlertCb) (SmlDsSession *dsession, SmlAlertType type, const char *last, const char *next, void *userdata);
43 typedef void (* SmlDsSessionSyncCb) (SmlDsSession *dsession, unsigned int numchanges, void *userdata);
44 typedef void (* SmlDsSessionEventCb) (SmlDsSession *dsession, SmlDsEvent event, void *userdata);
45 typedef SmlBool (* SmlDsSessionChangesCb) (SmlDsSession *dsession, SmlChangeType type, const char *uid, char *data, unsigned int size, const char *contenttype, void *userdata, SmlError **error);
46 /* FIXME: newuid must be removed before next API break */
47 /* FIXME: an internal mapping callback already exists */
48 /* FIXME: DEPRECATED */
49 typedef void (* SmlDsSessionWriteCb) (SmlDsSession *dsession, SmlStatus *status, const char *newuid, void *userdata);
50
51 SmlDsServer *smlDsServerNew(const char *type, SmlLocation *location, SmlError **error);
52 SmlDsServer *smlDsClientNew(const char *type, SmlLocation *location, SmlLocation *target, SmlError **error);
53 SmlDsServerType smlDsServerGetServerType(SmlDsServer *server);
54 void smlDsServerFree(SmlDsServer *server);
55 SmlBool smlDsServerRegister(SmlDsServer *server, SmlManager *manager, SmlError **error);
56 SmlBool smlDsServerAddSan(SmlDsServer *server, SmlNotification *san, SmlError **error);
57 void smlDsServerReset(SmlDsServer *server);
58 void smlDsServerSetConnectCallback(SmlDsServer *server, SmlDsSessionConnectCb callback, void *userdata);
59 const char *smlDsServerGetLocation(SmlDsServer *server);
60 const char *smlDsServerGetContentType(SmlDsServer *server);
61 SmlDsSession *smlDsServerSendAlert(SmlDsServer *server, SmlSession *session, SmlAlertType type, const char *last, const char *next, SmlStatusReplyCb callback, void *userdata, SmlError **error);
62
63 SmlDsSession *smlDsSessionNew(SmlDsServer *server, SmlSession *session, SmlError **error);
64 SmlDsSession *smlDsSessionRef(SmlDsSession *dsession);
65 void smlDsSessionUnref(SmlDsSession *dsession);
66 void smlDsSessionDispatch(SmlDsSession *dsession);
67 SmlBool smlDsSessionCheck(SmlDsSession *dsession);
68 void smlDsSessionGetAlert(SmlDsSession *dsession, SmlDsSessionAlertCb callback, void *userdata);
69 SmlBool smlDsSessionSendAlert(SmlDsSession *dsession, SmlAlertType type, const char *last, const char *next, SmlStatusReplyCb callback, void *userdata, SmlError **error);
70 void smlDsSessionGetChanges(SmlDsSession *dsession, SmlDsSessionChangesCb chgCallback, void *userdata);
71 void smlDsSessionGetSync(SmlDsSession *dsession, SmlDsSessionSyncCb chgCallback, void *userdata);
72 void smlDsSessionGetEvent(SmlDsSession *dsession, SmlDsSessionEventCb eventCallback, void *userdata);
73 SmlBool smlDsSessionSendSync(SmlDsSession *dsession, unsigned int num_changes, SmlStatusReplyCb callback, void *userdata, SmlError **error);
74 SmlBool smlDsSessionQueueChange(SmlDsSession *dsession, SmlChangeType type, const char *uid, const char *data, unsigned int size, const char *contenttype, SmlDsSessionWriteCb callback, void *userdata, SmlError **error);
75 SmlBool smlDsSessionCloseSync(SmlDsSession *dsession, SmlError **error);
76 SmlBool smlDsSessionQueueMap(SmlDsSession *dsession, const char *uid, const char *newuid, SmlError **error);
77 SmlBool smlDsSessionCloseMap(SmlDsSession *dsession, SmlStatusReplyCb callback, void *userdata, SmlError **error);
78 const char *smlDsSessionGetLocation(SmlDsSession *dsession);
79 const char *smlDsSessionGetContentType(SmlDsSession *dsession);
80 SmlDsServer *smlDsSessionGetServer(SmlDsSession *dsession);
81 SmlLocation *smlDsSessionGetTarget(SmlDsSession *dsession);
82
83 /* multi session safe SAN handling */
84
85 typedef SmlErrorType (* SmlDsServerSanSessionCb) (SmlDsServer *dsserver, SmlSession *session, SmlAlertType type, void *userdata);
86 void smlDsServerSetSanSessionCallback(SmlDsServer *server, SmlDsServerSanSessionCb callback, void *userdata);
87
88 /* deprecated SAN handling */
89
90 typedef SmlErrorType (* SmlDsServerSanCb) (SmlDsServer *dsserver, SmlAlertType type, void *userdata);
91 void smlDsServerSetSanCallback(SmlDsServer *server, SmlDsServerSanCb callback, void *userdata) LIBSYNCML_DEPRECATED;
92
93 #endif //_SML_DS_SERVER_H_
94