libsyncml 0.5.4

- Main Page
- Modules
- Data Structures
- Files

- File List

sml_ds_server_internals.h
1 /*
2 * libsyncml - A syncml protocol implementation
3 * Copyright (C) 2005 Armin Bauer <armin.bauer@opensync.org>
4 * Copyright (C) 2008 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_INTERNALS_H_
31 #define _SML_DS_SERVER_INTERNALS_H_
32
33 typedef void (* SmlDsSessionMapCb) (SmlDsSession *dsession, SmlLocation *orig, SmlLocation *mapped, void *userdata);
34
35 typedef struct SmlWriteContext {
36 SmlDsSessionWriteCb callback;
37 char *uid;
38 char *newuid;
39 SmlStatus *status;
40 void *userdata;
41 SmlChangeType type;
42 SmlDsSession *session;
43 } SmlWriteContext;
44
45 struct SmlDsSession {
46 gint refCount;
47
48 SmlDsServer *server;
49 SmlSession *session;
50
51 SmlLocation *target;
52 SmlLocation *location;
53
55 SmlDsSessionAlertCb recvAlertCallback;
56 void *recvAlertCallbackUserdata;
57 SmlCommand *alertCommand;
58
60 SmlStatusReplyCb sentAlertCallback;
61 void *sentAlertCallbackUserdata;
62
64 SmlDsSessionSyncCb recvSyncCallback;
65 void *recvSyncCallbackUserdata;
66 SmlDsSessionChangesCb changesCallback;
67 void *changesCallbackUserdata;
72 GList *recvSync;
73 GList *recvChanges;
74 SmlErrorType syncReply;
75 SmlBool finalLock;
76 SmlBool emptySync;
77
79 SmlStatusReplyCb sentSyncCallback;
80 void *sentSyncCallbackUserdata;
81
83 SmlDsSessionEventCb recvEventCallback;
84 void *recvEventCallbackUserdata;
85
87 SmlCommand *syncCommand;
88
89 GList *pendingMaps;
90 GMutex *pendingMapsLock;
91 GList *mapItems;
92
94 SmlDsSessionMapCb recvMappingCallback;
95 void *recvMappingCallbackUserdata;
96
97 GMutex *write_lock;
98 GMutex *lock;
99 };
100
101 struct SmlDsServer {
102 SmlLocation *location;
104 SmlLocation *target;
105 char *contenttype;
106 SmlDsServerType servertype;
107 SmlManager *manager;
108
110 SmlDsSessionConnectCb connectCallback;
111 void *connectCallbackUserdata;
112
113 SmlDsServerSanSessionCb sanSessionCallback;
114 void *sanSessionCallbackUserdata;
115 SmlDsServerSanCb sanCallback;
116 void *sanCallbackUserdata;
117 };
118
119 void smlDsSessionRecvAlert(SmlSession *session, SmlCommand *cmd, void *userdata);
120 void smlDsSessionRecvSync(SmlSession *session, SmlCommand *cmd, void *userdata);
121 void smlDsSessionRecvChange(SmlSession *session, SmlCommand *cmd, void *userdata);
122 void smlDsSessionRecvMap(SmlSession *session, SmlCommand *cmd, void *userdata);
123 SmlDsSession *smlDsServerRecvAlert(SmlDsServer *server, SmlSession *session, SmlCommand *cmd);
124
125 SmlDsSession *smlDsSessionNew(SmlDsServer *server, SmlSession *session, SmlError **error);
126 void smlDsSessionFree(SmlDsSession *dsession);
127
128 void smlDsSessionGetMapping(SmlDsSession *dsession, SmlDsSessionMapCb mapCallback, void *userdata);
129
130 #endif //_SML_DS_SERVER_INTERNALS_H_
131