~ubuntu-branches/ubuntu/hardy/lasso/hardy-security

« back to all changes in this revision

Viewing changes to lasso/xml/id-wsf-2.0/dstref_query_response.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Bienia
  • Date: 2007-11-01 20:01:20 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071101200120-9ruoui67n24xyz9c
Tags: 2.1.1-2ubuntu1
* Merge from debian unstable (LP: #134095), remaining changes:
  + debian/control:
    - Modify Maintainer value to match DebianMaintainerField spec.
  + configure{,.ac}:
    - Add missing quotes around the value for PHP[45]_LIBS.
* Fix two lintian warnings:
  + debian/control:
    - liblasso3-dev: Replace ${Source-Version} with ${binary:Version}
  + debian/rules:
    - Don't ignore a make clean error.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: dstref_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, write to the Free Software
 
22
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
23
 */
 
24
 
 
25
#include "dstref_query_response.h"
 
26
 
 
27
/*
 
28
 * Schema fragment (liberty-idwsf-dst-ref-v2.1.xsd):
 
29
 *
 
30
 * <xs:complexType name="QueryResponseType">
 
31
 *   <xs:complexContent>
 
32
 *     <xs:extension base="dst:DataResponseBaseType">
 
33
 *       <xs:sequence>
 
34
 *         <xs:element ref="dst:TestResult" minOccurs="0" maxOccurs="unbounded"/>
 
35
 *         <xs:element ref="dstref:Data" minOccurs="0" maxOccurs="unbounded"/>
 
36
 *       </xs:sequence>
 
37
 *     </xs:extension>
 
38
 *   </xs:complexContent>
 
39
 * </xs:complexType>
 
40
 */
 
41
 
 
42
/*****************************************************************************/
 
43
/* private methods                                                           */
 
44
/*****************************************************************************/
 
45
 
 
46
 
 
47
static struct XmlSnippet schema_snippets[] = {
 
48
        { "TestResult", SNIPPET_LIST_NODES,
 
49
                G_STRUCT_OFFSET(LassoIdWsf2DstRefQueryResponse, TestResult) },
 
50
        { "Data", SNIPPET_LIST_NODES,
 
51
                G_STRUCT_OFFSET(LassoIdWsf2DstRefQueryResponse, Data),
 
52
                "LassoIdWsf2DstRefData" },
 
53
        {NULL, 0, 0}
 
54
};
 
55
 
 
56
static LassoNodeClass *parent_class = NULL;
 
57
 
 
58
 
 
59
static xmlNode*
 
60
get_xmlNode(LassoNode *node, gboolean lasso_dump)
 
61
{
 
62
       xmlNode *xmlnode;
 
63
 
 
64
       xmlnode = parent_class->get_xmlNode(node, lasso_dump);
 
65
       xml_insure_namespace(xmlnode, NULL, TRUE,
 
66
                       LASSO_IDWSF2_DSTREF_QUERY_RESPONSE(node)->hrefServiceType,
 
67
                       LASSO_IDWSF2_DSTREF_QUERY_RESPONSE(node)->prefixServiceType);
 
68
 
 
69
       return xmlnode;
 
70
}
 
71
 
 
72
static int
 
73
init_from_xml(LassoNode *node, xmlNode *xmlnode)
 
74
{
 
75
       LassoIdWsf2DstRefQueryResponse *object = LASSO_IDWSF2_DSTREF_QUERY_RESPONSE(node);
 
76
       int res;
 
77
 
 
78
       res = parent_class->init_from_xml(node, xmlnode);
 
79
       if (res != 0) {
 
80
               return res;
 
81
       }
 
82
 
 
83
       object->hrefServiceType = g_strdup((char*)xmlnode->ns->href);
 
84
       object->prefixServiceType = lasso_get_prefix_for_idwsf2_dst_service_href(
 
85
                       object->hrefServiceType);
 
86
       if (object->prefixServiceType == NULL) {
 
87
               /* XXX: what to do here ? */
 
88
       }
 
89
 
 
90
       return 0;
 
91
}
 
92
 
 
93
 
 
94
/*****************************************************************************/
 
95
/* instance and class init functions                                         */
 
96
/*****************************************************************************/
 
97
 
 
98
static void
 
99
instance_init(LassoIdWsf2DstRefQueryResponse *node)
 
100
{
 
101
        node->TestResult = NULL;
 
102
        node->Data = NULL;
 
103
        node->prefixServiceType = NULL;
 
104
        node->hrefServiceType = NULL;
 
105
}
 
106
 
 
107
static void
 
108
class_init(LassoIdWsf2DstRefQueryResponseClass *klass)
 
109
{
 
110
        LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
 
111
 
 
112
        parent_class = g_type_class_peek_parent(klass);
 
113
        nclass->get_xmlNode = get_xmlNode;
 
114
        nclass->init_from_xml = init_from_xml;
 
115
        nclass->node_data = g_new0(LassoNodeClassData, 1);
 
116
        lasso_node_class_set_nodename(nclass, "QueryResponse");
 
117
        lasso_node_class_set_ns(nclass, LASSO_IDWSF2_DSTREF_HREF, LASSO_IDWSF2_DSTREF_PREFIX);
 
118
        lasso_node_class_add_snippets(nclass, schema_snippets);
 
119
}
 
120
 
 
121
GType
 
122
lasso_idwsf2_dstref_query_response_get_type()
 
123
{
 
124
        static GType this_type = 0;
 
125
 
 
126
        if (!this_type) {
 
127
                static const GTypeInfo this_info = {
 
128
                        sizeof (LassoIdWsf2DstRefQueryResponseClass),
 
129
                        NULL,
 
130
                        NULL,
 
131
                        (GClassInitFunc) class_init,
 
132
                        NULL,
 
133
                        NULL,
 
134
                        sizeof(LassoIdWsf2DstRefQueryResponse),
 
135
                        0,
 
136
                        (GInstanceInitFunc) instance_init,
 
137
                };
 
138
 
 
139
                this_type = g_type_register_static(LASSO_TYPE_IDWSF2_DST_DATA_RESPONSE_BASE,
 
140
                                "LassoIdWsf2DstRefQueryResponse", &this_info, 0);
 
141
        }
 
142
        return this_type;
 
143
}
 
144
 
 
145
/**
 
146
 * lasso_idwsf2_dstref_query_response_new:
 
147
 *
 
148
 * Creates a new #LassoIdWsf2DstRefQueryResponse object.
 
149
 *
 
150
 * Return value: a newly created #LassoIdWsf2DstRefQueryResponse object
 
151
 **/
 
152
LassoIdWsf2DstRefQueryResponse*
 
153
lasso_idwsf2_dstref_query_response_new()
 
154
{
 
155
        return g_object_new(LASSO_TYPE_IDWSF2_DSTREF_QUERY_RESPONSE, NULL);
 
156
}