1
/* $Id: disco_query.c,v 1.7 2005/01/22 15:57:55 eraviart Exp $
3
* Lasso - A free implementation of the Liberty Alliance specifications.
5
* Copyright (C) 2004, 2005 Entr'ouvert
6
* http://lasso.entrouvert.org
8
* Authors: See AUTHORS file in top-level directory.
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
#include <lasso/xml/disco_query.h>
28
* Schema fragments (liberty-idwsf-disco-svc-1.0-errata-v1.0.xsd):
30
* <xs:element name="Query" type="QueryType"/>
31
* <xs:complexType name="QueryType">
33
* <xs:group ref="ResourceIDGroup"/>
34
* <xs:element name="RequestedServiceType" minOccurs="0" maxOccurs="unbounded">
37
* <xs:element ref="ServiceType"/>
38
* <xs:element ref="Options" minOccurs="0"/>
43
* <xs:attribute name="id" type="xs:ID" use="optional"/>
46
* <xs:group name="ResourceIDGroup">
48
* <xs:choice minOccurs="0" maxOccurs="1">
49
* <xs:element ref="ResourceID"/>
50
* <xs:element ref="EncryptedResourceID"/>
56
/*****************************************************************************/
58
/*****************************************************************************/
60
static struct XmlSnippet schema_snippets[] = {
61
{ "ResourceID", SNIPPET_NODE, G_STRUCT_OFFSET(LassoDiscoQuery, ResourceID) },
62
{ "EncryptedResourceID",
63
SNIPPET_NODE, G_STRUCT_OFFSET(LassoDiscoQuery, EncryptedResourceID) },
64
{ "RequestedServiceType", SNIPPET_LIST_NODES,
65
G_STRUCT_OFFSET(LassoDiscoQuery, RequestedServiceType) },
66
{ "id", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoDiscoQuery, id) },
70
/*****************************************************************************/
71
/* instance and class init functions */
72
/*****************************************************************************/
75
instance_init(LassoDiscoQuery *node)
77
node->ResourceID = NULL;
78
node->EncryptedResourceID = NULL;
79
node->RequestedServiceType = NULL;
84
class_init(LassoDiscoQueryClass *klass)
86
LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
88
nclass->node_data = g_new0(LassoNodeClassData, 1);
89
lasso_node_class_set_nodename(nclass, "Query");
90
lasso_node_class_set_ns(nclass, LASSO_DISCO_HREF, LASSO_DISCO_PREFIX);
91
lasso_node_class_add_snippets(nclass, schema_snippets);
95
lasso_disco_query_get_type()
97
static GType this_type = 0;
100
static const GTypeInfo this_info = {
101
sizeof (LassoDiscoQueryClass),
104
(GClassInitFunc) class_init,
107
sizeof(LassoDiscoQuery),
109
(GInstanceInitFunc) instance_init,
112
this_type = g_type_register_static(LASSO_TYPE_NODE,
113
"LassoDiscoQuery", &this_info, 0);
119
lasso_disco_query_new()
121
LassoDiscoQuery *node;
123
node = g_object_new(LASSO_TYPE_DISCO_QUERY, NULL);
129
lasso_disco_query_new_from_message(const gchar *message)
131
LassoDiscoQuery *node;
133
g_return_val_if_fail(message != NULL, NULL);
135
node = g_object_new(LASSO_TYPE_DISCO_QUERY, NULL);
136
lasso_node_init_from_message(LASSO_NODE(node), message);