tizen 2.3.1 release
[external/gupnp.git] / libgupnp / gupnp-service-proxy.h
1 /*
2  * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd.
3  *
4  * Author: Jorn Baayen <jorn@openedhand.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 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  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef __GUPNP_SERVICE_PROXY_H__
23 #define __GUPNP_SERVICE_PROXY_H__
24
25 #include "gupnp-error.h"
26 #include "gupnp-service-info.h"
27
28 G_BEGIN_DECLS
29
30 GType
31 gupnp_service_proxy_get_type (void) G_GNUC_CONST;
32
33 #define GUPNP_TYPE_SERVICE_PROXY \
34                 (gupnp_service_proxy_get_type ())
35 #define GUPNP_SERVICE_PROXY(obj) \
36                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
37                  GUPNP_TYPE_SERVICE_PROXY, \
38                  GUPnPServiceProxy))
39 #define GUPNP_SERVICE_PROXY_CLASS(obj) \
40                 (G_TYPE_CHECK_CLASS_CAST ((obj), \
41                  GUPNP_TYPE_SERVICE_PROXY, \
42                  GUPnPServiceProxyClass))
43 #define GUPNP_IS_SERVICE_PROXY(obj) \
44                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
45                  GUPNP_TYPE_SERVICE_PROXY))
46 #define GUPNP_IS_SERVICE_PROXY_CLASS(obj) \
47                 (G_TYPE_CHECK_CLASS_TYPE ((obj), \
48                  GUPNP_TYPE_SERVICE_PROXY))
49 #define GUPNP_SERVICE_PROXY_GET_CLASS(obj) \
50                 (G_TYPE_INSTANCE_GET_CLASS ((obj), \
51                  GUPNP_TYPE_SERVICE_PROXY, \
52                  GUPnPServiceProxyClass))
53
54 typedef struct _GUPnPServiceProxyPrivate GUPnPServiceProxyPrivate;
55
56 /**
57  * GUPnPServiceProxy:
58  *
59  * This struct contains private data only, and should be accessed using the
60  * functions below.
61  */
62 typedef struct {
63         GUPnPServiceInfo parent;
64
65         GUPnPServiceProxyPrivate *priv;
66 } GUPnPServiceProxy;
67
68 typedef struct {
69         GUPnPServiceInfoClass parent_class;
70
71         /* signals */
72         void (* subscription_lost) (GUPnPServiceProxy *proxy,
73                                     const GError      *reason);
74
75         /* future padding */
76         void (* _gupnp_reserved1) (void);
77         void (* _gupnp_reserved2) (void);
78         void (* _gupnp_reserved3) (void);
79         void (* _gupnp_reserved4) (void);
80 } GUPnPServiceProxyClass;
81
82 /**
83  * GUPnPServiceProxyAction
84  *
85  * Opaque structure for holding in-progress action data.
86  **/
87 typedef struct _GUPnPServiceProxyAction GUPnPServiceProxyAction;
88
89 /**
90  * GUPnPServiceProxyActionCallback:
91  * @proxy: The #GUPnPServiceProxy @action is called from
92  * @action: The #GUPnPServiceProxyAction in progress
93  * @user_data: User data
94  *
95  * Callback notifying that @action on @proxy has returned and
96  * gupnp_service_proxy_end_action() etc can be called.
97  **/
98 typedef void (* GUPnPServiceProxyActionCallback) (
99                                      GUPnPServiceProxy       *proxy,
100                                      GUPnPServiceProxyAction *action,
101                                      gpointer                 user_data);
102
103 /**
104  * GUPnPServiceProxyNotifyCallback:
105  * @proxy: The #GUPnPServiceProxy the notification originates from
106  * @variable: The name of the variable being notified
107  * @value: The #GValue of the variable being notified
108  * @user_data: User data
109  *
110  * Callback notifying that the state variable @variable on @proxy has changed to
111  * @value.
112  **/
113 typedef void (* GUPnPServiceProxyNotifyCallback) (GUPnPServiceProxy *proxy,
114                                                   const char        *variable,
115                                                   GValue            *value,
116                                                   gpointer           user_data);
117
118 gboolean
119 gupnp_service_proxy_send_action    (GUPnPServiceProxy              *proxy,
120                                     const char                     *action,
121                                     GError                        **error,
122                                     ...) G_GNUC_NULL_TERMINATED;
123
124 gboolean
125 gupnp_service_proxy_send_action_valist
126                                    (GUPnPServiceProxy              *proxy,
127                                     const char                     *action,
128                                     GError                        **error,
129                                     va_list                         var_args);
130
131 gboolean
132 gupnp_service_proxy_send_action_hash
133                                    (GUPnPServiceProxy              *proxy,
134                                     const char                     *action,
135                                     GError                        **error,
136                                     GHashTable                     *in_hash,
137                                     GHashTable                     *out_hash);
138
139
140 gboolean
141 gupnp_service_proxy_send_action_list (GUPnPServiceProxy *proxy,
142                                       const char        *action,
143                                       GError           **error,
144                                       GList             *in_names,
145                                       GList             *in_values,
146                                       GList             *out_names,
147                                       GList             *out_types,
148                                       GList            **out_values);
149
150
151 GUPnPServiceProxyAction *
152 gupnp_service_proxy_begin_action   (GUPnPServiceProxy              *proxy,
153                                     const char                     *action,
154                                     GUPnPServiceProxyActionCallback callback,
155                                     gpointer                        user_data,
156                                     ...) G_GNUC_NULL_TERMINATED;
157
158 GUPnPServiceProxyAction *
159 gupnp_service_proxy_begin_action_valist
160                                    (GUPnPServiceProxy              *proxy,
161                                     const char                     *action,
162                                     GUPnPServiceProxyActionCallback callback,
163                                     gpointer                        user_data,
164                                     va_list                         var_args);
165
166 GUPnPServiceProxyAction *
167 gupnp_service_proxy_begin_action_list
168                                    (GUPnPServiceProxy              *proxy,
169                                     const char                     *action,
170                                     GList                          *in_names,
171                                     GList                          *in_values,
172                                     GUPnPServiceProxyActionCallback callback,
173                                     gpointer                        user_data);
174
175 GUPnPServiceProxyAction *
176 gupnp_service_proxy_begin_action_hash
177                                    (GUPnPServiceProxy              *proxy,
178                                     const char                     *action,
179                                     GUPnPServiceProxyActionCallback callback,
180                                     gpointer                        user_data,
181                                     GHashTable                     *hash);
182
183 gboolean
184 gupnp_service_proxy_end_action     (GUPnPServiceProxy              *proxy,
185                                     GUPnPServiceProxyAction        *action,
186                                     GError                        **error,
187                                     ...) G_GNUC_NULL_TERMINATED;
188
189 gboolean
190 gupnp_service_proxy_end_action_valist
191                                    (GUPnPServiceProxy              *proxy,
192                                     GUPnPServiceProxyAction        *action,
193                                     GError                        **error,
194                                     va_list                         var_args);
195
196 gboolean
197 gupnp_service_proxy_end_action_list
198                                   (GUPnPServiceProxy       *proxy,
199                                    GUPnPServiceProxyAction *action,
200                                    GError                  **error,
201                                    GList                   *out_names,
202                                    GList                   *out_types,
203                                    GList                  **out_values);
204
205 gboolean
206 gupnp_service_proxy_end_action_hash
207                                    (GUPnPServiceProxy              *proxy,
208                                     GUPnPServiceProxyAction        *action,
209                                     GError                        **error,
210                                     GHashTable                     *hash);
211
212 void
213 gupnp_service_proxy_cancel_action  (GUPnPServiceProxy              *proxy,
214                                     GUPnPServiceProxyAction        *action);
215
216 gboolean
217 gupnp_service_proxy_add_notify     (GUPnPServiceProxy              *proxy,
218                                     const char                     *variable,
219                                     GType                           type,
220                                     GUPnPServiceProxyNotifyCallback callback,
221                                     gpointer                        user_data);
222
223 gboolean
224 gupnp_service_proxy_remove_notify  (GUPnPServiceProxy              *proxy,
225                                     const char                     *variable,
226                                     GUPnPServiceProxyNotifyCallback callback,
227                                     gpointer                        user_data);
228
229 void
230 gupnp_service_proxy_set_subscribed (GUPnPServiceProxy              *proxy,
231                                     gboolean                        subscribed);
232
233 gboolean
234 gupnp_service_proxy_get_subscribed (GUPnPServiceProxy              *proxy);
235
236 G_END_DECLS
237
238 #endif /* __GUPNP_SERVICE_PROXY_H__ */