~ubuntu-branches/ubuntu/trusty/lasso/trusty

1.2.2 by Frederic Peters
Import upstream version 2.3.5
1
/* $Id: wsu_timestamp.c,v 1.0 2005/10/14 15:17:55 fpeters Exp $
1.1.5 by Michael Bienia
Import upstream version 2.1.1
2
 *
3
 * Lasso - A free implementation of the Liberty Alliance specifications.
4
 *
5
 * Copyright (C) 2004-2007 Entr'ouvert
6
 * http://lasso.entrouvert.org
1.2.2 by Frederic Peters
Import upstream version 2.3.5
7
 *
1.1.5 by Michael Bienia
Import upstream version 2.1.1
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.
1.2.2 by Frederic Peters
Import upstream version 2.3.5
14
 *
1.1.5 by Michael Bienia
Import upstream version 2.1.1
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.
1.2.2 by Frederic Peters
Import upstream version 2.3.5
19
 *
1.1.5 by Michael Bienia
Import upstream version 2.1.1
20
 * You should have received a copy of the GNU General Public License
1.2.4 by Frederic Peters
Import upstream version 2.4.0
21
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
1.1.5 by Michael Bienia
Import upstream version 2.1.1
22
 */
23
1.2.2 by Frederic Peters
Import upstream version 2.3.5
24
#include "../private.h"
1.1.5 by Michael Bienia
Import upstream version 2.1.1
25
#include "wsu_timestamp.h"
1.2.2 by Frederic Peters
Import upstream version 2.3.5
26
#include "../idwsf_strings.h"
1.1.5 by Michael Bienia
Import upstream version 2.1.1
27
28
/*
29
 * Schema fragment (oasis-200401-wss-wssecurity-utility-1.0.xsd):
30
 *
31
 * <xs:complexType name="TimestampType">
32
 *   <xs:annotation>
33
 *     <xs:documentation>
34
 *       This complex type ties together the timestamp related elements into a composite type.
35
 *     </xs:documentation>
36
 *   </xs:annotation>
37
 *   <xs:sequence>
38
 *     <xs:element ref="wsu:Created" minOccurs="0"/>
39
 *     <xs:element ref="wsu:Expires" minOccurs="0"/>
40
 *     <xs:choice minOccurs="0" maxOccurs="unbounded">
41
 *       <xs:any namespace="##other" processContents="lax"/>
42
 *     </xs:choice>
43
 *   </xs:sequence>
44
 *   <xs:attributeGroup ref="wsu:commonAtts"/>
45
 * </xs:complexType>
46
 */
47
48
/*****************************************************************************/
49
/* private methods                                                           */
50
/*****************************************************************************/
51
52
53
static struct XmlSnippet schema_snippets[] = {
54
	{ "Created", SNIPPET_CONTENT,
1.2.2 by Frederic Peters
Import upstream version 2.3.5
55
		G_STRUCT_OFFSET(LassoWsUtil1Timestamp, Created), NULL, NULL, NULL},
1.1.5 by Michael Bienia
Import upstream version 2.1.1
56
	{ "Expires", SNIPPET_CONTENT,
1.2.2 by Frederic Peters
Import upstream version 2.3.5
57
		G_STRUCT_OFFSET(LassoWsUtil1Timestamp, Expires), NULL, NULL, NULL},
1.1.5 by Michael Bienia
Import upstream version 2.1.1
58
	{ "Id", SNIPPET_ATTRIBUTE,
1.2.2 by Frederic Peters
Import upstream version 2.3.5
59
		G_STRUCT_OFFSET(LassoWsUtil1Timestamp, Id), NULL, NULL, NULL},
1.1.5 by Michael Bienia
Import upstream version 2.1.1
60
	{ "attributes", SNIPPET_ATTRIBUTE | SNIPPET_ANY,
1.2.2 by Frederic Peters
Import upstream version 2.3.5
61
		G_STRUCT_OFFSET(LassoWsUtil1Timestamp, attributes), NULL, NULL, NULL},
62
	{NULL, 0, 0, NULL, NULL, NULL}
1.1.5 by Michael Bienia
Import upstream version 2.1.1
63
};
64
65
static LassoNodeClass *parent_class = NULL;
66
67
68
/*****************************************************************************/
69
/* instance and class init functions                                         */
70
/*****************************************************************************/
71
72
static void
73
instance_init(LassoWsUtil1Timestamp *node)
74
{
75
	node->attributes = g_hash_table_new_full(
76
		g_str_hash, g_str_equal, g_free, g_free);
77
}
78
79
static void
80
class_init(LassoWsUtil1TimestampClass *klass)
81
{
82
	LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
83
84
	parent_class = g_type_class_peek_parent(klass);
85
	nclass->node_data = g_new0(LassoNodeClassData, 1);
86
	lasso_node_class_set_nodename(nclass, "Timestamp");
87
	lasso_node_class_set_ns(nclass, LASSO_WSUTIL1_HREF, LASSO_WSUTIL1_PREFIX);
88
	lasso_node_class_add_snippets(nclass, schema_snippets);
89
}
90
91
GType
92
lasso_wsu_timestamp_get_type()
93
{
94
	static GType this_type = 0;
95
96
	if (!this_type) {
97
		static const GTypeInfo this_info = {
98
			sizeof (LassoWsUtil1TimestampClass),
99
			NULL,
100
			NULL,
101
			(GClassInitFunc) class_init,
102
			NULL,
103
			NULL,
104
			sizeof(LassoWsUtil1Timestamp),
105
			0,
106
			(GInstanceInitFunc) instance_init,
1.2.2 by Frederic Peters
Import upstream version 2.3.5
107
			NULL
1.1.5 by Michael Bienia
Import upstream version 2.1.1
108
		};
109
110
		this_type = g_type_register_static(LASSO_TYPE_NODE,
111
				"LassoWsUtil1Timestamp", &this_info, 0);
112
	}
113
	return this_type;
114
}
115
116
/**
117
 * lasso_wsu_timestamp_new:
118
 *
119
 * Creates a new #LassoWsUtil1Timestamp object.
120
 *
121
 * Return value: a newly created #LassoWsUtil1Timestamp object
122
 **/
123
LassoWsUtil1Timestamp*
124
lasso_wsu_timestamp_new()
125
{
126
	return g_object_new(LASSO_TYPE_WSU_TIMESTAMP, NULL);
127
}