tizen 2.3.1 release
[external/gupnp.git] / libgupnp / gupnp-service.h
1 /*
2  * Copyright (C) 2007 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_H__
23 #define __GUPNP_SERVICE_H__
24
25 #include <stdarg.h>
26
27 #include "gupnp-service-info.h"
28
29 G_BEGIN_DECLS
30
31 GType
32 gupnp_service_get_type (void) G_GNUC_CONST;
33
34 #define GUPNP_TYPE_SERVICE \
35                 (gupnp_service_get_type ())
36 #define GUPNP_SERVICE(obj) \
37                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
38                  GUPNP_TYPE_SERVICE, \
39                  GUPnPService))
40 #define GUPNP_SERVICE_CLASS(obj) \
41                 (G_TYPE_CHECK_CLASS_CAST ((obj), \
42                  GUPNP_TYPE_SERVICE, \
43                  GUPnPServiceClass))
44 #define GUPNP_IS_SERVICE(obj) \
45                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
46                  GUPNP_TYPE_SERVICE))
47 #define GUPNP_IS_SERVICE_CLASS(obj) \
48                 (G_TYPE_CHECK_CLASS_TYPE ((obj), \
49                  GUPNP_TYPE_SERVICE))
50 #define GUPNP_SERVICE_GET_CLASS(obj) \
51                 (G_TYPE_INSTANCE_GET_CLASS ((obj), \
52                  GUPNP_TYPE_SERVICE, \
53                  GUPnPServiceClass))
54
55 /**
56  * GUPnPServiceAction
57  *
58  * Opaque structure for holding in-progress action data.
59  **/
60 typedef struct _GUPnPServiceAction GUPnPServiceAction;
61
62 GType
63 gupnp_service_action_get_type (void) G_GNUC_CONST;
64
65 #define GUPNP_TYPE_SERVICE_ACTION (gupnp_service_action_get_type ())
66
67 typedef struct _GUPnPServicePrivate GUPnPServicePrivate;
68
69 /**
70  * GUPnPService:
71  *
72  * This struct contains private data only, and should be accessed using the
73  * functions below.
74  */
75 typedef struct {
76         GUPnPServiceInfo parent;
77
78         GUPnPServicePrivate *priv;
79 } GUPnPService;
80
81 typedef struct {
82         GUPnPServiceInfoClass parent_class;
83
84         void (* action_invoked) (GUPnPService       *service,
85                                  GUPnPServiceAction *action);
86
87         void (* query_variable) (GUPnPService       *service,
88                                  const char         *variable,
89                                  GValue             *value);
90
91         void (* notify_failed)  (GUPnPService       *service,
92                                  const GList        *callback_urls,
93                                  const GError       *reason);
94
95         /* future padding */
96         void (* _gupnp_reserved1) (void);
97         void (* _gupnp_reserved2) (void);
98         void (* _gupnp_reserved3) (void);
99         void (* _gupnp_reserved4) (void);
100 } GUPnPServiceClass;
101
102
103 GType
104 gupnp_service_action_get_type (void);
105
106 const char *
107 gupnp_service_action_get_name     (GUPnPServiceAction *action);
108
109 GList *
110 gupnp_service_action_get_locales  (GUPnPServiceAction *action);
111
112 void
113 gupnp_service_action_get          (GUPnPServiceAction *action,
114                                    ...) G_GNUC_NULL_TERMINATED;
115
116 void
117 gupnp_service_action_get_valist   (GUPnPServiceAction *action,
118                                    va_list             var_args);
119
120 GList *
121 gupnp_service_action_get_values (GUPnPServiceAction *action,
122                                  GList              *arg_names,
123                                  GList              *arg_types);
124
125 void
126 gupnp_service_action_get_value    (GUPnPServiceAction *action,
127                                    const char         *argument,
128                                    GValue             *value);
129
130 GValue *
131 gupnp_service_action_get_gvalue   (GUPnPServiceAction *action,
132                                    const char         *argument,
133                                    GType               type);
134
135 void
136 gupnp_service_action_set          (GUPnPServiceAction *action,
137                                    ...) G_GNUC_NULL_TERMINATED;
138
139 void
140 gupnp_service_action_set_valist   (GUPnPServiceAction *action,
141                                    va_list             var_args);
142
143 void
144 gupnp_service_action_set_values   (GUPnPServiceAction *action,
145                                    GList              *arg_names,
146                                    GList              *arg_values);
147
148 void
149 gupnp_service_action_set_value    (GUPnPServiceAction *action,
150                                    const char         *argument,
151                                    const GValue       *value);
152
153 void
154 gupnp_service_action_return       (GUPnPServiceAction *action);
155
156 void
157 gupnp_service_action_return_error (GUPnPServiceAction *action,
158                                    guint               error_code,
159                                    const char         *error_description);
160
161 SoupMessage *
162 gupnp_service_action_get_message  (GUPnPServiceAction *action);
163
164 void
165 gupnp_service_notify              (GUPnPService *service,
166                                    ...) G_GNUC_NULL_TERMINATED;
167
168 void
169 gupnp_service_notify_valist       (GUPnPService *service,
170                                    va_list       var_args);
171
172 void
173 gupnp_service_notify_value        (GUPnPService *service,
174                                    const char   *variable,
175                                    const GValue *value);
176
177 void
178 gupnp_service_freeze_notify       (GUPnPService *service);
179
180 void
181 gupnp_service_thaw_notify         (GUPnPService *service);
182
183 void
184 gupnp_service_signals_autoconnect (GUPnPService *service,
185                                    gpointer      user_data,
186                                    GError      **error);
187
188 G_END_DECLS
189
190 #endif /* __GUPNP_SERVICE_H__ */