1 /* $Id: disco_query_response.c,v 1.0 2005/10/14 15:17:55 fpeters Exp $
2 *
3 * Lasso - A free implementation of the Liberty Alliance specifications.
4 *
5 * Copyright (C) 2004-2007 Entr'ouvert
6 * http://lasso.entrouvert.org
7 *
8 * Authors: See AUTHORS file in top-level directory.
9 *
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.
14 *
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.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 */
23
24 #include "../private.h"
25 #include "disco_query_response.h"
26 #include "idwsf2_strings.h"
27
28 /**
29 * SECTION:disco_query_response
30 * @short_description: <disco:QueryResponse>
31 *
32 * <figure><title>Schema fragment for disco:QueryResponse</title>
33 * <programlisting><![CDATA[
34 *
35 * <xs:complexType name="QueryResponseType">
36 * <xs:sequence>
37 * <xs:element ref="lu:Status"/>
38 *
39 * <xs:element ref="wsa:EndpointReference"
40 * minOccurs="0"
41 * maxOccurs="unbounded"/>
42 * </xs:sequence>
43 * <xs:anyAttribute namespace="##other" processContents="lax"/>
44 * </xs:complexType>
45 * ]]></programlisting>
46 * </figure>
47 */
48
49 /*****************************************************************************/
50 /* private methods */
51 /*****************************************************************************/
52
53
54 static struct XmlSnippet schema_snippets[] = {
55 { "Status", SNIPPET_NODE,
56 G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, Status),
57 "LassoIdWsf2UtilStatus", LASSO_IDWSF2_UTIL_PREFIX, LASSO_IDWSF2_DISCOVERY_HREF},
58 { "EndpointReference", SNIPPET_LIST_NODES,
59 G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, EndpointReference),
60 "LassoWsAddrEndpointReference", LASSO_WSA_PREFIX, LASSO_WSA_HREF},
61 { "attributes", SNIPPET_ATTRIBUTE | SNIPPET_ANY,
62 G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, attributes), NULL, NULL, NULL},
63 {NULL, 0, 0, NULL, NULL, NULL}
64 };
65
66 static LassoNodeClass *parent_class = NULL;
67
68
69 /*****************************************************************************/
70 /* instance and class init functions */
71 /*****************************************************************************/
72
73 static void
instance_init(LassoIdWsf2DiscoQueryResponse * node)74 instance_init(LassoIdWsf2DiscoQueryResponse *node)
75 {
76 node->attributes = g_hash_table_new_full(
77 g_str_hash, g_str_equal, g_free, g_free);
78 }
79
80 static void
class_init(LassoIdWsf2DiscoQueryResponseClass * klass,void * unused G_GNUC_UNUSED)81 class_init(LassoIdWsf2DiscoQueryResponseClass *klass, void *unused G_GNUC_UNUSED)
82 {
83 LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
84
85 parent_class = g_type_class_peek_parent(klass);
86 nclass->node_data = g_new0(LassoNodeClassData, 1);
87 lasso_node_class_set_nodename(nclass, "QueryResponse");
88 lasso_node_class_set_ns(nclass, LASSO_IDWSF2_DISCOVERY_HREF, LASSO_IDWSF2_DISCOVERY_PREFIX);
89 lasso_node_class_add_snippets(nclass, schema_snippets);
90 }
91
92 GType
lasso_idwsf2_disco_query_response_get_type()93 lasso_idwsf2_disco_query_response_get_type()
94 {
95 static GType this_type = 0;
96
97 if (!this_type) {
98 static const GTypeInfo this_info = {
99 sizeof (LassoIdWsf2DiscoQueryResponseClass),
100 NULL,
101 NULL,
102 (GClassInitFunc) class_init,
103 NULL,
104 NULL,
105 sizeof(LassoIdWsf2DiscoQueryResponse),
106 0,
107 (GInstanceInitFunc) instance_init,
108 NULL
109 };
110
111 this_type = g_type_register_static(LASSO_TYPE_NODE,
112 "LassoIdWsf2DiscoQueryResponse", &this_info, 0);
113 }
114 return this_type;
115 }
116
117 /**
118 * lasso_idwsf2_disco_query_response_new:
119 *
120 * Creates a new #LassoIdWsf2DiscoQueryResponse object.
121 *
122 * Return value: a newly created #LassoIdWsf2DiscoQueryResponse object
123 **/
124 LassoIdWsf2DiscoQueryResponse*
lasso_idwsf2_disco_query_response_new()125 lasso_idwsf2_disco_query_response_new()
126 {
127 return g_object_new(LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE, NULL);
128 }
129