summaryrefslogtreecommitdiffstats
path: root/lasso/xml/lib_authentication_statement.c
diff options
context:
space:
mode:
Diffstat (limited to 'lasso/xml/lib_authentication_statement.c')
-rw-r--r--lasso/xml/lib_authentication_statement.c54
1 files changed, 14 insertions, 40 deletions
diff --git a/lasso/xml/lib_authentication_statement.c b/lasso/xml/lib_authentication_statement.c
index 9189437a..6c300a1a 100644
--- a/lasso/xml/lib_authentication_statement.c
+++ b/lasso/xml/lib_authentication_statement.c
@@ -48,42 +48,15 @@
/* private methods */
/*****************************************************************************/
-#define snippets() \
- LassoLibAuthenticationStatement *statement = LASSO_LIB_AUTHENTICATION_STATEMENT(node); \
- struct XmlSnippet snippets[] = { \
- { "AuthnContext", SNIPPET_NODE, (void**)&(statement->AuthnContext) }, \
- { "ReauthenticateOnOrAfter", SNIPPET_ATTRIBUTE, \
- (void**)&(statement->ReauthenticateOnOrAfter) }, \
- { "SessionIndex", SNIPPET_ATTRIBUTE, (void**)&(statement->SessionIndex) }, \
- { NULL, 0, NULL} \
- };
-
-static LassoNodeClass *parent_class = NULL;
-
-static xmlNode*
-get_xmlNode(LassoNode *node)
-{
- xmlNode *xmlnode;
- snippets();
-
- xmlnode = parent_class->get_xmlNode(node);
- xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_LIB_HREF, LASSO_LIB_PREFIX));
- build_xml_with_snippets(xmlnode, snippets);
-
- return xmlnode;
-}
-
-static int
-init_from_xml(LassoNode *node, xmlNode *xmlnode)
-{
- snippets();
-
- if (parent_class->init_from_xml(node, xmlnode))
- return -1;
- init_xml_with_snippets(xmlnode, snippets);
-
- return 0;
-}
+static struct XmlSnippet schema_snippets[] = {
+ { "AuthnContext", SNIPPET_NODE,
+ G_STRUCT_OFFSET(LassoLibAuthenticationStatement, AuthnContext) },
+ { "ReauthenticateOnOrAfter", SNIPPET_ATTRIBUTE,
+ G_STRUCT_OFFSET(LassoLibAuthenticationStatement, ReauthenticateOnOrAfter) },
+ { "SessionIndex", SNIPPET_ATTRIBUTE,
+ G_STRUCT_OFFSET(LassoLibAuthenticationStatement, SessionIndex) },
+ { NULL, 0, 0}
+};
/*****************************************************************************/
/* instance and class init functions */
@@ -100,11 +73,12 @@ instance_init(LassoLibAuthenticationStatement *node)
static void
class_init(LassoLibAuthenticationStatementClass *klass)
{
- LassoNodeClass *nodeClass = LASSO_NODE_CLASS(klass);
+ LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
- parent_class = g_type_class_peek_parent(klass);
- nodeClass->get_xmlNode = get_xmlNode;
- nodeClass->init_from_xml = init_from_xml;
+ nclass->node_data = g_new0(LassoNodeClassData, 1);
+ lasso_node_class_set_nodename(nclass, "AuthenticationStatement");
+ lasso_node_class_set_ns(nclass, LASSO_LIB_HREF, LASSO_LIB_PREFIX);
+ lasso_node_class_add_snippets(nclass, schema_snippets);
}
GType