upload tizen1.0 source
[profile/ivi/obexd.git] / client / session.h
1 /*
2  *
3  *  OBEX Client
4  *
5  *  Copyright (C) 2007-2010  Marcel Holtmann <marcel@holtmann.org>
6  *
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  */
23
24 #include <stdint.h>
25 #include <glib.h>
26 #include <gdbus.h>
27 #include <gobex.h>
28
29 struct obc_session;
30
31 #define OBEX_IO_ERROR obex_io_error_quark()
32 GQuark obex_io_error_quark(void);
33
34 typedef void (*session_callback_t) (struct obc_session *session,
35                                         GError *err, void *user_data);
36
37 struct obc_session *obc_session_create(const char *source,
38                                                 const char *destination,
39                                                 const char *service,
40                                                 uint8_t channel,
41                                                 const char *owner,
42                                                 session_callback_t function,
43                                                 void *user_data);
44
45 struct obc_session *obc_session_ref(struct obc_session *session);
46 void obc_session_unref(struct obc_session *session);
47 void obc_session_shutdown(struct obc_session *session);
48
49 int obc_session_set_owner(struct obc_session *session, const char *name,
50                         GDBusWatchFunction func);
51 const char *obc_session_get_owner(struct obc_session *session);
52
53 int obc_session_set_agent(struct obc_session *session, const char *name,
54                                                         const char *path);
55 const char *obc_session_get_agent(struct obc_session *session);
56
57 const char *obc_session_get_path(struct obc_session *session);
58 const char *obc_session_get_target(struct obc_session *session);
59 GObex *obc_session_get_obex(struct obc_session *session);
60
61 struct obc_transfer *obc_session_get_transfer(struct obc_session *session);
62 void obc_session_add_transfer(struct obc_session *session,
63                                         struct obc_transfer *transfer);
64 void obc_session_remove_transfer(struct obc_session *session,
65                                         struct obc_transfer *transfer);
66
67 int obc_session_send(struct obc_session *session, const char *filename,
68                                 const char *remotename);
69 int obc_session_get(struct obc_session *session, const char *type,
70                 const char *filename, const char *targetname,
71                 const guint8  *apparam, gint apparam_size,
72                 session_callback_t func, void *user_data);
73 int obc_session_pull(struct obc_session *session,
74                                 const char *type, const char *filename,
75                                 session_callback_t function, void *user_data);
76 const char *obc_session_register(struct obc_session *session,
77                                                 GDBusDestroyFunction destroy);
78 int obc_session_put(struct obc_session *session, char *buf,
79                                 const char *targetname);
80
81 #ifdef TIZEN_PATCH
82 GSList *opc_get_sessions(void);
83 GSList *opc_get_session_pending(struct obc_session *session);
84 #endif