diff options
author | Nicolas Clapies <nclapies@entrouvert.com> | 2004-11-30 11:23:26 +0000 |
---|---|---|
committer | Nicolas Clapies <nclapies@entrouvert.com> | 2004-11-30 11:23:26 +0000 |
commit | 7e7c6a812c14ac1cc54197b9acfac2cedd161a2a (patch) | |
tree | 7d4df8a92c5a23696b3ee8fd4ccb2ac6a41946cf /lasso/xml/dst_query.c | |
parent | 2ea07eebe111fa8c02f2341af91a39bd1a955d95 (diff) | |
download | lasso-7e7c6a812c14ac1cc54197b9acfac2cedd161a2a.tar.gz lasso-7e7c6a812c14ac1cc54197b9acfac2cedd161a2a.tar.xz lasso-7e7c6a812c14ac1cc54197b9acfac2cedd161a2a.zip |
Initial version : added DST part of WSF for sis specific attribute services.
Diffstat (limited to 'lasso/xml/dst_query.c')
-rw-r--r-- | lasso/xml/dst_query.c | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/lasso/xml/dst_query.c b/lasso/xml/dst_query.c new file mode 100644 index 00000000..a2287926 --- /dev/null +++ b/lasso/xml/dst_query.c @@ -0,0 +1,131 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: Nicolas Clapies <nclapies@entrouvert.com> + * Valery Febvre <vfebvre@easter-eggs.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <lasso/xml/dst_query.h> + + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +#define snippets() \ + LassoDstQuery *query = LASSO_DST_QUERY(node); \ + struct XmlSnippet snippets[] = { \ + { "ResourceID", SNIPPET_CONTENT, (void**)&query->ResourceID }, \ + { "EncryptedResourceID", SNIPPET_CONTENT, (void**)&query->EncryptedResourceID }, \ + { "QueryItem", SNIPPET_LIST_NODES, (void**)&query->QueryItem }, \ + { "id", SNIPPET_ATTRIBUTE, (void**)&query->id }, \ + { "itemID", SNIPPET_ATTRIBUTE, (void**)&query->itemID }, \ + { NULL, 0, NULL } \ + }; + +static LassoNodeClass *parent_class = NULL; + +static xmlNode* +get_xmlNode(LassoNode *node) +{ + xmlNode *xmlnode; + snippets(); + + xmlnode = xmlNewNode(NULL, "Query"); + xmlSetNs(xmlnode, xmlNewNs(xmlnode, NULL, NULL)); + + 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; +} + + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoDstQuery *node) +{ + +} + +static void +class_init(LassoDstQueryClass *klass) +{ + LassoNodeClass *nodeClass = LASSO_NODE_CLASS(klass); + + parent_class = g_type_class_peek_parent(klass); + nodeClass->get_xmlNode = get_xmlNode; + nodeClass->init_from_xml = init_from_xml; +} + +GType +lasso_dst_query_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDstQueryClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDstQuery), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDstQuery", &this_info, 0); + } + return this_type; +} + +LassoDstQuery* +lasso_dst_query_new(LassoDstQueryItem *QueryItem, const char *id, const char *itemID) +{ + LassoDstQuery *query; + + query = g_object_new(LASSO_TYPE_DST_QUERY, NULL); + + query->QueryItem = g_list_append(query->QueryItem, QueryItem); + query->id = g_strdup(id); + query->itemID = g_strdup(itemID); + + return query; +} + |