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 "saml2_audience_restriction.h"
26 
27 /**
28  * SECTION:saml2_audience_restriction
29  * @short_description: &lt;saml2:AudienceRestriction&gt;
30  *
31  * <figure><title>Schema fragment for saml2:AudienceRestriction</title>
32  * <programlisting><![CDATA[
33  *
34  * <complexType name="AudienceRestrictionType">
35  *   <complexContent>
36  *     <extension base="saml:ConditionAbstractType">
37  *       <sequence>
38  *         <element ref="saml:Audience" maxOccurs="unbounded"/>
39  *       </sequence>
40  *     </extension>
41  *   </complexContent>
42  * </complexType>
43  * ]]></programlisting>
44  * </figure>
45  */
46 
47 /*****************************************************************************/
48 /* private methods                                                           */
49 /*****************************************************************************/
50 
51 
52 static struct XmlSnippet schema_snippets[] = {
53 	{ "Audience", SNIPPET_CONTENT,
54 		G_STRUCT_OFFSET(LassoSaml2AudienceRestriction, Audience), NULL, NULL, NULL},
55 	{NULL, 0, 0, NULL, NULL, NULL}
56 };
57 
58 static LassoNodeClass *parent_class = NULL;
59 
60 
61 /*****************************************************************************/
62 /* instance and class init functions                                         */
63 /*****************************************************************************/
64 
65 
66 static void
class_init(LassoSaml2AudienceRestrictionClass * klass,void * unused G_GNUC_UNUSED)67 class_init(LassoSaml2AudienceRestrictionClass *klass, void *unused G_GNUC_UNUSED)
68 {
69 	LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
70 
71 	parent_class = g_type_class_peek_parent(klass);
72 	nclass->node_data = g_new0(LassoNodeClassData, 1);
73 	lasso_node_class_set_nodename(nclass, "AudienceRestriction");
74 	lasso_node_class_set_ns(nclass, LASSO_SAML2_ASSERTION_HREF, LASSO_SAML2_ASSERTION_PREFIX);
75 	lasso_node_class_add_snippets(nclass, schema_snippets);
76 }
77 
78 GType
lasso_saml2_audience_restriction_get_type()79 lasso_saml2_audience_restriction_get_type()
80 {
81 	static GType this_type = 0;
82 
83 	if (!this_type) {
84 		static const GTypeInfo this_info = {
85 			sizeof (LassoSaml2AudienceRestrictionClass),
86 			NULL,
87 			NULL,
88 			(GClassInitFunc) class_init,
89 			NULL,
90 			NULL,
91 			sizeof(LassoSaml2AudienceRestriction),
92 			0,
93 			NULL,
94 			NULL
95 		};
96 
97 		this_type = g_type_register_static(LASSO_TYPE_SAML2_CONDITION_ABSTRACT,
98 				"LassoSaml2AudienceRestriction", &this_info, 0);
99 	}
100 	return this_type;
101 }
102 
103 /**
104  * lasso_saml2_audience_restriction_new:
105  *
106  * Creates a new #LassoSaml2AudienceRestriction object.
107  *
108  * Return value: a newly created #LassoSaml2AudienceRestriction object
109  **/
110 LassoNode*
lasso_saml2_audience_restriction_new()111 lasso_saml2_audience_restriction_new()
112 {
113 	return g_object_new(LASSO_TYPE_SAML2_AUDIENCE_RESTRICTION, NULL);
114 }
115