Initial submission of GUPnP to Tizen IVI
[profile/ivi/GUPnP.git] / libgupnp / gupnp-service-introspection.h
1 /*
2  * Copyright (C) 2007 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
3  * Copyright (C) 2006, 2007 OpenedHand Ltd.
4  *
5  * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
6  *         Jorn Baayen <jorn@openedhand.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library 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 GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23
24 #ifndef __GUPNP_SERVICE_INTROSPECTION_H__
25 #define __GUPNP_SERVICE_INTROSPECTION_H__
26
27 #include <glib-object.h>
28
29 G_BEGIN_DECLS
30
31 GType
32 gupnp_service_introspection_get_type (void) G_GNUC_CONST;
33
34 #define GUPNP_TYPE_SERVICE_INTROSPECTION \
35                 (gupnp_service_introspection_get_type ())
36 #define GUPNP_SERVICE_INTROSPECTION(obj) \
37                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
38                  GUPNP_TYPE_SERVICE_INTROSPECTION, \
39                  GUPnPServiceIntrospection))
40 #define GUPNP_SERVICE_INTROSPECTION_CLASS(obj) \
41                 (G_TYPE_CHECK_CLASS_CAST ((obj), \
42                  GUPNP_TYPE_SERVICE_INTROSPECTION, \
43                  GUPnPServiceIntrospectionClass))
44 #define GUPNP_IS_SERVICE_INTROSPECTION(obj) \
45                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
46                  GUPNP_TYPE_SERVICE_INTROSPECTION))
47 #define GUPNP_IS_SERVICE_INTROSPECTION_CLASS(obj) \
48                 (G_TYPE_CHECK_CLASS_TYPE ((obj), \
49                  GUPNP_TYPE_SERVICE_INTROSPECTION))
50 #define GUPNP_SERVICE_INTROSPECTION_GET_CLASS(obj) \
51                 (G_TYPE_INSTANCE_GET_CLASS ((obj), \
52                  GUPNP_TYPE_SERVICE_INTROSPECTION, \
53                  GUPnPServiceIntrospectionClass))
54
55 /**
56  * GUPnPServiceActionArgDirection:
57  * @GUPNP_SERVICE_ACTION_ARG_DIRECTION_IN: An "in" variable, to the service.
58  * @GUPNP_SERVICE_ACTION_ARG_DIRECTION_OUT: An "out" variable, from the service.
59  *
60  * Represents the direction of a service state variable.
61  **/
62 typedef enum
63 {
64         GUPNP_SERVICE_ACTION_ARG_DIRECTION_IN,
65         GUPNP_SERVICE_ACTION_ARG_DIRECTION_OUT
66 } GUPnPServiceActionArgDirection;
67
68 /**
69  * GUPnPServiceActionArgInfo:
70  * @name: The name of the action argument.
71  * @direction: The direction of the action argument.
72  * @related_state_variable: The name of the state variable associated with this
73  * argument.
74  * @retval: Whether this argument is the return value of the action.
75  *
76  * This structure contains information about the argument of service action.
77  **/
78 typedef struct {
79         char                          *name;
80         GUPnPServiceActionArgDirection direction;
81         char                          *related_state_variable;
82         gboolean                       retval;
83 } GUPnPServiceActionArgInfo;
84
85 /**
86  * GUPnPServiceActionInfo:
87  * @name: The name of the action argument.
88  * @arguments: A GList of all the arguments
89  * (of type #GUPnPServiceActionArgInfo) of this action.
90  *
91  * This structure contains information about a service action.
92  **/
93 typedef struct {
94         char  *name;
95         GList *arguments; /* list of #GUPnPServiceActionArgInfo */
96 } GUPnPServiceActionInfo;
97
98 /**
99  * GUPnPServiceStateVariableInfo:
100  * @name: The name of the state variable.
101  * @send_events: Whether this state variable can source events.
102  * @is_numeric: Wether this state variable is a numeric type (integer and
103  * float).
104  * @type: The GType of this state variable.
105  * @default_value: The default value of this state variable.
106  * @minimum: The minimum value of this state variable. Only applies to numeric
107  * data types.
108  * @maximum: The maximum value of this state variable. Only applies to numeric
109  * data types.
110  * @step: The step value of this state variable. Only applies to numeric
111  * data types.
112  * @allowed_values: The allowed values of this state variable. Only applies to
113  * string data types. Unlike the other fields in this structure, this field
114  * contains a list of (char *) strings rather than GValues.
115  *
116  * This structure contains information about service state variable.
117  **/
118 typedef struct {
119         char    *name;
120         gboolean send_events;
121         gboolean is_numeric;
122         GType    type;
123         GValue   default_value;
124         GValue   minimum;
125         GValue   maximum;
126         GValue   step;
127         GList   *allowed_values;
128 } GUPnPServiceStateVariableInfo;
129
130 typedef struct _GUPnPServiceIntrospectionPrivate
131                 GUPnPServiceIntrospectionPrivate;
132 typedef struct _GUPnPServiceIntrospection
133                 GUPnPServiceIntrospection;
134 typedef struct _GUPnPServiceIntrospectionClass
135                 GUPnPServiceIntrospectionClass;
136
137 /**
138  * GUPnPServiceIntrospection:
139  *
140  * This struct contains private data only, and should be accessed using the
141  * functions below.
142  */
143 struct _GUPnPServiceIntrospection {
144         GObject parent;
145
146         GUPnPServiceIntrospectionPrivate *priv;
147 };
148
149 struct _GUPnPServiceIntrospectionClass {
150         GObjectClass parent_class;
151 };
152
153 const GList *
154 gupnp_service_introspection_list_action_names
155                                 (GUPnPServiceIntrospection *introspection);
156
157 const GList *
158 gupnp_service_introspection_list_actions
159                                 (GUPnPServiceIntrospection *introspection);
160
161 const GUPnPServiceActionInfo *
162 gupnp_service_introspection_get_action
163                                 (GUPnPServiceIntrospection *introspection,
164                                  const gchar               *action_name);
165
166 const GList *
167 gupnp_service_introspection_list_state_variable_names
168                                 (GUPnPServiceIntrospection *introspection);
169
170 const GList *
171 gupnp_service_introspection_list_state_variables
172                                 (GUPnPServiceIntrospection *introspection);
173
174 const GUPnPServiceStateVariableInfo *
175 gupnp_service_introspection_get_state_variable
176                                 (GUPnPServiceIntrospection *introspection,
177                                  const gchar               *variable_name);
178
179 G_END_DECLS
180
181 #endif /* __GUPNP_SERVICE_INTROSPECTION_H__ */