Update media-service-upnp to version 0.3.0 ( ca17a69 )
[profile/ivi/media-service-upnp.git] / src / task.h
1 /*
2  * media-service-upnp
3  *
4  * Copyright (C) 2012 Intel Corporation. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU Lesser General Public License,
8  * version 2.1, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
13  * for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Mark Ryan <mark.d.ryan@intel.com>
20  *
21  */
22
23 #ifndef MSU_TASK_H__
24 #define MSU_TASK_H__
25
26 #include <gio/gio.h>
27 #include <glib.h>
28
29 enum msu_task_type_t_ {
30         MSU_TASK_GET_VERSION,
31         MSU_TASK_GET_SERVERS,
32         MSU_TASK_GET_CHILDREN,
33         MSU_TASK_GET_ALL_PROPS,
34         MSU_TASK_GET_PROP,
35         MSU_TASK_SEARCH,
36         MSU_TASK_GET_RESOURCE,
37         MSU_TASK_SET_PREFER_LOCAL_ADDRESSES,
38         MSU_TASK_SET_PROTOCOL_INFO,
39         MSU_TASK_UPLOAD_TO_ANY,
40         MSU_TASK_UPLOAD,
41         MSU_TASK_GET_UPLOAD_STATUS,
42         MSU_TASK_GET_UPLOAD_IDS,
43         MSU_TASK_CANCEL_UPLOAD,
44         MSU_TASK_DELETE_OBJECT,
45         MSU_TASK_CREATE_CONTAINER,
46         MSU_TASK_CREATE_CONTAINER_IN_ANY,
47         MSU_TASK_UPDATE_OBJECT
48 };
49 typedef enum msu_task_type_t_ msu_task_type_t;
50
51 typedef void (*msu_cancel_task_t)(void *handle);
52
53 typedef struct msu_task_get_children_t_ msu_task_get_children_t;
54 struct msu_task_get_children_t_ {
55         gboolean containers;
56         gboolean items;
57         guint start;
58         guint count;
59         GVariant *filter;
60         gchar *sort_by;
61 };
62
63 typedef struct msu_task_get_props_t_ msu_task_get_props_t;
64 struct msu_task_get_props_t_ {
65         gchar *interface_name;
66 };
67
68 typedef struct msu_task_get_prop_t_ msu_task_get_prop_t;
69 struct msu_task_get_prop_t_ {
70         gchar *prop_name;
71         gchar *interface_name;
72 };
73
74 typedef struct msu_task_search_t_ msu_task_search_t;
75 struct msu_task_search_t_ {
76         gchar *query;
77         guint start;
78         guint count;
79         gchar *sort_by;
80         GVariant *filter;
81 };
82
83 typedef struct msu_task_get_resource_t_ msu_task_get_resource_t;
84 struct msu_task_get_resource_t_ {
85         gchar *protocol_info;
86         GVariant *filter;
87 };
88
89 typedef struct msu_task_set_prefer_local_addresses_t_
90                                         msu_task_set_prefer_local_addresses_t;
91 struct msu_task_set_prefer_local_addresses_t_ {
92         gboolean prefer;
93 };
94
95 typedef struct msu_task_set_protocol_info_t_ msu_task_set_protocol_info_t;
96 struct msu_task_set_protocol_info_t_ {
97         gchar *protocol_info;
98 };
99
100 typedef struct msu_task_upload_t_ msu_task_upload_t;
101 struct msu_task_upload_t_ {
102         gchar *display_name;
103         gchar *file_path;
104 };
105
106 typedef struct msu_task_upload_action_t_ msu_task_upload_action_t;
107 struct msu_task_upload_action_t_ {
108         guint upload_id;
109 };
110
111 typedef struct msu_task_create_container_t_ msu_task_create_container_t;
112 struct msu_task_create_container_t_ {
113         gchar *display_name;
114         gchar *type;
115         GVariant *child_types;
116 };
117
118 typedef struct msu_task_update_t_ msu_task_update_t;
119 struct msu_task_update_t_ {
120         GVariant *to_add_update;
121         GVariant *to_delete;
122 };
123
124 typedef struct msu_task_t_ msu_task_t;
125 struct msu_task_t_ {
126         msu_task_type_t type;
127         gchar *path;
128         const gchar *result_format;
129         GVariant *result;
130         GDBusMethodInvocation *invocation;
131         gboolean synchronous;
132         gboolean multiple_retvals;
133         union {
134                 msu_task_get_children_t get_children;
135                 msu_task_get_props_t get_props;
136                 msu_task_get_prop_t get_prop;
137                 msu_task_search_t search;
138                 msu_task_get_resource_t resource;
139                 msu_task_set_prefer_local_addresses_t prefer_local_addresses;
140                 msu_task_set_protocol_info_t protocol_info;
141                 msu_task_upload_t upload;
142                 msu_task_upload_action_t upload_action;
143                 msu_task_create_container_t create_container;
144                 msu_task_update_t update;
145         } ut;
146 };
147
148 msu_task_t *msu_task_get_version_new(GDBusMethodInvocation *invocation);
149 msu_task_t *msu_task_get_servers_new(GDBusMethodInvocation *invocation);
150 msu_task_t *msu_task_get_children_new(GDBusMethodInvocation *invocation,
151                                       const gchar *path, GVariant *parameters,
152                                       gboolean items, gboolean containers);
153 msu_task_t *msu_task_get_children_ex_new(GDBusMethodInvocation *invocation,
154                                          const gchar *path,
155                                          GVariant *parameters, gboolean items,
156                                          gboolean containers);
157 msu_task_t *msu_task_get_prop_new(GDBusMethodInvocation *invocation,
158                                   const gchar *path, GVariant *parameters);
159 msu_task_t *msu_task_get_props_new(GDBusMethodInvocation *invocation,
160                                    const gchar *path, GVariant *parameters);
161 msu_task_t *msu_task_search_new(GDBusMethodInvocation *invocation,
162                                 const gchar *path, GVariant *parameters);
163 msu_task_t *msu_task_search_ex_new(GDBusMethodInvocation *invocation,
164                                    const gchar *path, GVariant *parameters);
165 msu_task_t *msu_task_get_resource_new(GDBusMethodInvocation *invocation,
166                                       const gchar *path, GVariant *parameters);
167 msu_task_t *msu_task_set_protocol_info_new(GDBusMethodInvocation *invocation,
168                                            GVariant *parameters);
169 msu_task_t *msu_task_prefer_local_addresses_new(
170                                         GDBusMethodInvocation *invocation,
171                                         GVariant *parameters);
172 msu_task_t *msu_task_upload_to_any_new(GDBusMethodInvocation *invocation,
173                                        const gchar *path, GVariant *parameters);
174 msu_task_t *msu_task_upload_new(GDBusMethodInvocation *invocation,
175                                 const gchar *path, GVariant *parameters);
176 msu_task_t *msu_task_get_upload_status_new(GDBusMethodInvocation *invocation,
177                                            const gchar *path,
178                                            GVariant *parameters);
179 msu_task_t *msu_task_get_upload_ids_new(GDBusMethodInvocation *invocation,
180                                         const gchar *path);
181 msu_task_t *msu_task_cancel_upload_new(GDBusMethodInvocation *invocation,
182                                        const gchar *path,
183                                        GVariant *parameters);
184 msu_task_t *msu_task_delete_new(GDBusMethodInvocation *invocation,
185                                 const gchar *path);
186 msu_task_t *msu_task_create_container_new_generic(
187                                         GDBusMethodInvocation *invocation,
188                                         msu_task_type_t type,
189                                         const gchar *path,
190                                         GVariant *parameters);
191 msu_task_t *msu_task_update_new(GDBusMethodInvocation *invocation,
192                                    const gchar *path, GVariant *parameters);
193 void msu_task_complete_and_delete(msu_task_t *task);
194 void msu_task_fail_and_delete(msu_task_t *task, GError *error);
195 void msu_task_cancel_and_delete(msu_task_t *task);
196 void msu_task_delete(msu_task_t *task);
197
198 #endif