af715681229d4c2410c10e5bc28c55ee22c9528f
[profile/ivi/obexd.git] / client / session.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 #include <stdint.h>
26 #include <glib.h>
27 #include <gdbus.h>
28
29 struct obc_session;
30
31 typedef void (*session_callback_t) (struct obc_session *session,
32                                         struct obc_transfer *transfer,
33                                         GError *err, void *user_data);
34
35 struct obc_session *obc_session_create(const char *source,
36                                                 const char *destination,
37                                                 const char *service,
38                                                 uint8_t channel,
39                                                 const char *owner,
40                                                 session_callback_t function,
41                                                 void *user_data);
42
43 struct obc_session *obc_session_ref(struct obc_session *session);
44 void obc_session_unref(struct obc_session *session);
45 void obc_session_shutdown(struct obc_session *session);
46
47 int obc_session_set_owner(struct obc_session *session, const char *name,
48                         GDBusWatchFunction func);
49 const char *obc_session_get_owner(struct obc_session *session);
50
51 const char *obc_session_get_path(struct obc_session *session);
52 const char *obc_session_get_target(struct obc_session *session);
53
54 const char *obc_session_register(struct obc_session *session,
55                                                 GDBusDestroyFunction destroy);
56
57 guint obc_session_queue(struct obc_session *session,
58                                 struct obc_transfer *transfer,
59                                 session_callback_t func, void *user_data,
60                                 GError **err);
61 guint obc_session_setpath(struct obc_session *session, const char *path,
62                                 session_callback_t func, void *user_data,
63                                 GError **err);
64 guint obc_session_mkdir(struct obc_session *session, const char *folder,
65                                 session_callback_t func, void *user_data,
66                                 GError **err);
67 guint obc_session_copy(struct obc_session *session, const char *srcname,
68                                 const char *destname, session_callback_t func,
69                                 void *user_data, GError **err);
70 guint obc_session_move(struct obc_session *session, const char *srcname,
71                                 const char *destname, session_callback_t func,
72                                 void *user_data, GError **err);
73 guint obc_session_delete(struct obc_session *session, const char *file,
74                                 session_callback_t func, void *user_data,
75                                 GError **err);
76 void obc_session_cancel(struct obc_session *session, guint id,
77                                                         gboolean remove);