1 /* $Id$
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 "samlp2_status_code.h"
26 
27 /**
28  * SECTION:samlp2_status_code
29  * @short_description: &lt;samlp2:StatusCode&gt;
30  *
31  * <figure><title>Schema fragment for samlp2:StatusCode</title>
32  * <programlisting><![CDATA[
33  *
34  * <complexType name="StatusCodeType">
35  *   <sequence>
36  *     <element ref="samlp:StatusCode" minOccurs="0"/>
37  *   </sequence>
38  *   <attribute name="Value" type="anyURI" use="required"/>
39  * </complexType>
40  * ]]></programlisting>
41  * </figure>
42  */
43 
44 /*****************************************************************************/
45 /* private methods                                                           */
46 /*****************************************************************************/
47 
48 
49 static struct XmlSnippet schema_snippets[] = {
50 	{ "StatusCode", SNIPPET_NODE,
51 		G_STRUCT_OFFSET(LassoSamlp2StatusCode, StatusCode), NULL, NULL, NULL},
52 	{ "Value", SNIPPET_ATTRIBUTE,
53 		G_STRUCT_OFFSET(LassoSamlp2StatusCode, Value), NULL, NULL, NULL},
54 	{NULL, 0, 0, NULL, NULL, NULL}
55 };
56 
57 static LassoNodeClass *parent_class = NULL;
58 
59 
60 /*****************************************************************************/
61 /* instance and class init functions                                         */
62 /*****************************************************************************/
63 
64 
65 static void
class_init(LassoSamlp2StatusCodeClass * klass,void * unused G_GNUC_UNUSED)66 class_init(LassoSamlp2StatusCodeClass *klass, void *unused G_GNUC_UNUSED)
67 {
68 	LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
69 
70 	parent_class = g_type_class_peek_parent(klass);
71 	nclass->node_data = g_new0(LassoNodeClassData, 1);
72 	lasso_node_class_set_nodename(nclass, "StatusCode");
73 	lasso_node_class_set_ns(nclass, LASSO_SAML2_PROTOCOL_HREF, LASSO_SAML2_PROTOCOL_PREFIX);
74 	lasso_node_class_add_snippets(nclass, schema_snippets);
75 }
76 
77 GType
lasso_samlp2_status_code_get_type()78 lasso_samlp2_status_code_get_type()
79 {
80 	static GType this_type = 0;
81 
82 	if (!this_type) {
83 		static const GTypeInfo this_info = {
84 			sizeof (LassoSamlp2StatusCodeClass),
85 			NULL,
86 			NULL,
87 			(GClassInitFunc) class_init,
88 			NULL,
89 			NULL,
90 			sizeof(LassoSamlp2StatusCode),
91 			0,
92 			NULL,
93 			NULL
94 		};
95 
96 		this_type = g_type_register_static(LASSO_TYPE_NODE,
97 				"LassoSamlp2StatusCode", &this_info, 0);
98 	}
99 	return this_type;
100 }
101 
102 /**
103  * lasso_samlp2_status_code_new:
104  *
105  * Creates a new #LassoSamlp2StatusCode object.
106  *
107  * Return value: a newly created #LassoSamlp2StatusCode object
108  **/
109 LassoNode*
lasso_samlp2_status_code_new()110 lasso_samlp2_status_code_new()
111 {
112 	return g_object_new(LASSO_TYPE_SAMLP2_STATUS_CODE, NULL);
113 }
114