libsyncml 0.5.4

- Main Page
- Modules
- Data Structures
- Files

- File List

sml_transport.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
22 #ifndef _SML_TRANSPORT_H_
23 #define _SML_TRANSPORT_H_
24
25 typedef enum SmlTransportEventType {
26 SML_TRANSPORT_EVENT_CONNECT_DONE,
27 SML_TRANSPORT_EVENT_DISCONNECT_DONE,
28 SML_TRANSPORT_EVENT_ERROR,
29 SML_TRANSPORT_EVENT_DATA
30 } SmlTransportEventType;
31
32 typedef enum {
33 SML_TRANSPORT_CONNECTION_TYPE_UNKNOWN = 0,
34 SML_TRANSPORT_CONNECTION_TYPE_SERIAL = 1,
35 SML_TRANSPORT_CONNECTION_TYPE_BLUETOOTH = 2,
36 SML_TRANSPORT_CONNECTION_TYPE_IRDA = 3,
37 SML_TRANSPORT_CONNECTION_TYPE_NET = 4,
38 SML_TRANSPORT_CONNECTION_TYPE_USB = 5
39 } SmlTransportConnectionType;
40
41 typedef SmlBool (* SmlTransportEventCb) (SmlTransport *tsp, SmlLink *link, SmlTransportEventType type, SmlTransportData *data, SmlError *error, void *userdata);
42
43 SmlTransport *smlTransportNew(SmlTransportType type, SmlError **error);
44 void smlTransportFree(SmlTransport *tsp);
45
46 SmlBool smlTransportSetConfigOption(SmlTransport *tsp, const char *name, const char *value, SmlError **error);
47 SmlBool smlTransportSetConnectionType(SmlTransport *tsp, SmlTransportConnectionType type, SmlError **error);
48 SmlBool smlTransportInitialize(SmlTransport *tsp, SmlError **error);
49
50 void smlTransportSetEventCallback(SmlTransport *tsp, SmlTransportEventCb callback, void *userdata);
51 SmlBool smlTransportFinalize(SmlTransport *tsp, SmlError **error);
52 SmlBool smlTransportConnect(SmlTransport *tsp, SmlError **error);
53 SmlBool smlTransportDisconnect(SmlTransport *tsp, SmlLink *link, SmlError **error);
54 SmlBool smlTransportSend(SmlTransport *tsp, SmlLink *link, SmlTransportData *data, SmlError **error);
55 SmlTransportData *smlTransportDataNew(char *data, unsigned long size, SmlMimeType mimetype, SmlBool ownsData, SmlError **error);
56 SmlTransportData *smlTransportDataRef(SmlTransportData *data);
57 void smlTransportDataDeref(SmlTransportData *data);
58 SmlLink *smlLinkNew(SmlTransport *tsp, void *link_data, SmlError **error);
59 SmlLink *smlLinkRef(SmlLink *link);
60 void smlLinkDeref(SmlLink *link);
61 void smlTransportSetError(SmlTransport *tsp, SmlLink *link, SmlError **error);
62 SmlTransportType smlTransportGetType(SmlTransport *tsp);
63 SmlTransport *smlManagerGetTransport(SmlManager *manager);
64
65 /* This function will only be removed from the header. */
66 SmlBool smlTransportRunAsync(SmlTransport *tsp, SmlError **error) LIBSYNCML_DEPRECATED; /* expire date: 20090728 */
67 void smlTransportStop(SmlTransport *tsp) LIBSYNCML_DEPRECATED; /* expire date: 20090815 */
68 /* The function always returns NULL.
69 * The function is not removed to protect the intergrity of the library.
70 * Actually no user of this function is known.
71 */
72 SmlLink *smlLinkFind(SmlTransport *tsp, void *link_data) LIBSYNCML_DEPRECATED; /* expire data: 20091223 */
73
74 #endif //_SML_TRANSPORT_H_