summaryrefslogtreecommitdiffstats
path: root/lasso/xml/lib_request_authn_context.c
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2004-11-17 23:04:57 +0000
committerFrederic Peters <fpeters@entrouvert.com>2004-11-17 23:04:57 +0000
commit59bdda3549b13cbe97ce49fdb541f8bad006f08e (patch)
tree5f8809c208fafea2e5fda8078b032636ebece261 /lasso/xml/lib_request_authn_context.c
parentcfc07351978eef632c1b06f06f7246c2860cfc9c (diff)
downloadlasso-59bdda3549b13cbe97ce49fdb541f8bad006f08e.tar.gz
lasso-59bdda3549b13cbe97ce49fdb541f8bad006f08e.tar.xz
lasso-59bdda3549b13cbe97ce49fdb541f8bad006f08e.zip
use same "xmlsnippets" (name will probably change) to build xml nodes
Diffstat (limited to 'lasso/xml/lib_request_authn_context.c')
-rw-r--r--lasso/xml/lib_request_authn_context.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/lasso/xml/lib_request_authn_context.c b/lasso/xml/lib_request_authn_context.c
index 5263fa7d..4a72216f 100644
--- a/lasso/xml/lib_request_authn_context.c
+++ b/lasso/xml/lib_request_authn_context.c
@@ -48,27 +48,28 @@ Schema fragment (liberty-idff-protocols-schema-v1.2.xsd):
/* private methods */
/*****************************************************************************/
+#define snippets() \
+ LassoLibRequestAuthnContext *context = LASSO_LIB_REQUEST_AUTHN_CONTEXT(node); \
+ struct XmlSnippet snippets[] = { \
+ { "AuthnContextClassRef", 'c', (void**)&(context->AuthnContextClassRef) }, \
+ { "AuthnContextStatementRef", 'c', (void**)&(context->AuthnContextStatementRef) }, \
+ { "AuthnContextComparisonType", 'c', \
+ (void**)&(context->AuthnContextComparisonType) }, \
+ { NULL, 0, NULL} \
+ };
+
static LassoNodeClass *parent_class = NULL;
static xmlNode*
get_xmlNode(LassoNode *node)
{
xmlNode *xmlnode;
- LassoLibRequestAuthnContext *context = LASSO_LIB_REQUEST_AUTHN_CONTEXT(node);
+ snippets();
xmlnode = parent_class->get_xmlNode(node);
xmlNodeSetName(xmlnode, "RequestAuthnContext");
xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_LIB_HREF, LASSO_LIB_PREFIX));
-
- if (context->AuthnContextClassRef)
- xmlNewTextChild(xmlnode, NULL,
- "AuthnContextClassRef", context->AuthnContextClassRef);
- if (context->AuthnContextStatementRef)
- xmlNewTextChild(xmlnode, NULL,
- "AuthnContextStatementRef", context->AuthnContextStatementRef);
- if (context->AuthnContextComparisonType)
- xmlNewTextChild(xmlnode, NULL,
- "AuthnContextComparisonType", context->AuthnContextComparisonType);
+ lasso_node_build_xml_with_snippets(xmlnode, snippets);
return xmlnode;
}
@@ -76,14 +77,7 @@ get_xmlNode(LassoNode *node)
static int
init_from_xml(LassoNode *node, xmlNode *xmlnode)
{
- LassoLibRequestAuthnContext *context = LASSO_LIB_REQUEST_AUTHN_CONTEXT(node);
- struct XmlSnippet snippets[] = {
- { "AuthnContextClassRef", 'c', (void**)&(context->AuthnContextClassRef) },
- { "AuthnContextStatementRef", 'c', (void**)&(context->AuthnContextStatementRef) },
- { "AuthnContextComparisonType", 'c',
- (void**)&(context->AuthnContextComparisonType) },
- { NULL, 0, NULL}
- };
+ snippets();
if (parent_class->init_from_xml(node, xmlnode))
return -1;