upgrade obexd to 0.47
[profile/ivi/obexd.git] / client / transfer.h
1 /*
2  *
3  *  OBEX Client
4  *
5  *  Copyright (C) 2007-2010  Marcel Holtmann <marcel@holtmann.org>
6  *  Copyright (C) 2011-2012  BMW Car IT GmbH. All rights reserved.
7  *
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  *
23  */
24
25 struct obc_transfer;
26
27 typedef void (*transfer_callback_t) (struct obc_transfer *transfer,
28                                         GError *err, void *user_data);
29
30 struct obc_transfer *obc_transfer_get(const char *type, const char *name,
31                                         const char *filename, GError **err);
32 struct obc_transfer *obc_transfer_put(const char *type, const char *name,
33                                         const char *filename,
34                                         const void *contents, size_t size,
35                                         GError **err);
36
37 gboolean obc_transfer_register(struct obc_transfer *transfer,
38                                         DBusConnection *conn,
39                                         const char *path,
40                                         const char *owner,
41                                         GError **err);
42
43 void obc_transfer_unregister(struct obc_transfer *transfer);
44
45 gboolean obc_transfer_set_callback(struct obc_transfer *transfer,
46                                         transfer_callback_t func,
47                                         void *user_data);
48
49 gboolean obc_transfer_start(struct obc_transfer *transfer, void *obex,
50                                                                 GError **err);
51 guint8 obc_transfer_get_operation(struct obc_transfer *transfer);
52
53 void obc_transfer_set_params(struct obc_transfer *transfer,
54                                                 const void *data, size_t size);
55 const void *obc_transfer_get_params(struct obc_transfer *transfer,
56                                                                 size_t *size);
57 int obc_transfer_get_contents(struct obc_transfer *transfer, char **contents,
58                                                                 size_t *size);
59
60 const char *obc_transfer_get_path(struct obc_transfer *transfer);
61 gint64 obc_transfer_get_size(struct obc_transfer *transfer);
62
63 DBusMessage *obc_transfer_create_dbus_reply(struct obc_transfer *transfer,
64                                                         DBusMessage *message);