libsyncml 0.5.4

- Main Page
- Modules
- Data Structures
- Files

- File List

sml_manager.h
1 /*
2 * libsyncml - A syncml protocol implementation
3 * Copyright (C) 2005 Armin Bauer <armin.bauer@opensync.org>
4 * Copyright (C) 2007-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_MANAGER_H
31 #define _SML_MANAGER_H
32
33 typedef enum {
34 SML_MANAGER_CONNECT_DONE,
35 SML_MANAGER_DISCONNECT_DONE,
36 SML_MANAGER_TRANSPORT_ERROR,
37 SML_MANAGER_SESSION_NEW,
38 SML_MANAGER_SESSION_FINAL,
39 SML_MANAGER_SESSION_END,
40 SML_MANAGER_SESSION_FLUSH,
41 SML_MANAGER_SESSION_WARNING,
42 SML_MANAGER_SESSION_ERROR,
43 SML_MANAGER_SESSION_ESTABLISHED,
44 } SmlManagerEventType;
45
46 typedef void (* SmlManagerEventCb) (SmlManager *manager, SmlManagerEventType type, SmlSession *session, SmlError *error, void *userdata);
47 typedef void (* SmlCommandCb) (SmlSession *session, SmlCommand *cmd, void *userdata);
48 typedef void (* SmlHeaderCb) (SmlSession *session, SmlHeader *header, SmlCred *cred, void *userdata);
49 typedef void (* SmlStatusReplyCb) (SmlSession *session, SmlStatus *status, void *userdata);
50
51 SmlManager *smlManagerNew(SmlTransport *tsp, SmlError **error);
52 void smlManagerFree(SmlManager *manager);
53 SmlBool smlManagerReceive(SmlManager *manager, SmlError **error);
54
55 void smlManagerSetEventCallback(SmlManager *manager, SmlManagerEventCb callback, void *userdata);
56 SmlSession *smlManagerSessionFind(SmlManager *manager, const char *sessionID);
57 SmlBool smlManagerSessionAdd(SmlManager *manager, SmlSession *session, SmlLink *link, SmlError **error);
58 void smlManagerSessionRemove(SmlManager *manager, SmlSession *session);
59
60 SmlBool smlManagerObjectRegister(SmlManager *manager, SmlCommandType type, SmlSession *session, SmlLocation *location, SmlLocation *source, const char *contentType, SmlCommandCb callback, SmlCommandCb childCallback, void *userdata, SmlError **error);
61 void smlManagerRegisterHeaderHandler(SmlManager *manager, SmlHeaderCb callback, SmlStatusReplyCb statuscb, void *userdata);
62
63 void smlManagerObjectFree(SmlObject *object);
64 SmlObject *smlManagerObjectFind(SmlManager *manager, SmlSession *session, SmlCommand *cmd);
65 SmlBool smlManagerDispatchChildCommand(SmlManager *manager, SmlSession *session, SmlCommand *parent, SmlCommand *cmd, SmlError **error);
66 SmlBool smlManagerDispatchHeader(SmlManager *manager, SmlSession *session, SmlHeader *header, SmlCred *cred, SmlError **error);
67 SmlBool smlManagerDispatchCommand(SmlManager *manager, SmlSession *session, SmlCommand *cmd, SmlError **error);
68
69 SmlBool smlManagerStart(SmlManager *manager, SmlError **error);
70 void smlManagerStop(SmlManager *manager);
71 void smlManagerRun(SmlManager *manager);
72 void smlManagerQuit(SmlManager *manager);
73
74 void smlManagerDispatch(SmlManager *manager);
75 SmlBool smlManagerCheck(SmlManager *manager);
76
77 void smlManagerSetLocalMaxMsgSize(SmlManager *manager, unsigned int size);
78 void smlManagerSetLocalMaxObjSize(SmlManager *manager, unsigned int size);
79
80 char *smlManagerGetNewSessionID(SmlManager *manager);
81
82 #endif //_SML_MANAGER_H
83