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 | |
| parent | 2ea07eebe111fa8c02f2341af91a39bd1a955d95 (diff) | |
Initial version : added DST part of WSF for sis specific attribute services.
| -rw-r--r-- | lasso/xml/dst_data.c | 122 | ||||
| -rw-r--r-- | lasso/xml/dst_data.h | 80 | ||||
| -rw-r--r-- | lasso/xml/dst_query.c | 131 | ||||
| -rw-r--r-- | lasso/xml/dst_query.h | 90 | ||||
| -rw-r--r-- | lasso/xml/dst_query_item.c | 140 | ||||
| -rw-r--r-- | lasso/xml/dst_query_item.h | 91 | ||||
| -rw-r--r-- | lasso/xml/dst_query_response.c | 138 | ||||
| -rw-r--r-- | lasso/xml/dst_query_response.h | 93 |
8 files changed, 885 insertions, 0 deletions
diff --git a/lasso/xml/dst_data.c b/lasso/xml/dst_data.c new file mode 100644 index 00000000..1ed51896 --- /dev/null +++ b/lasso/xml/dst_data.c @@ -0,0 +1,122 @@ +/* $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_data.h> + + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +#define snippets() \ + LassoDstData *data = LASSO_DST_DATA(node); \ + struct XmlSnippet snippets[] = { \ + { NULL, 0, NULL} \ + }; + +static LassoNodeClass *parent_class = NULL; + +static xmlNode* +get_xmlNode(LassoNode *node) +{ + xmlNode *xmlnode; + snippets(); + + xmlnode = xmlNewNode(NULL, "Data"); + 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(LassoDstData *node) +{ + +} + +static void +class_init(LassoDstDataClass *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_data_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDstDataClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDstData), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDstData", &this_info, 0); + } + return this_type; +} + +LassoDstData* +lasso_dst_data_new(const char *itemIDRef) +{ + LassoDstData *data; + + data = g_object_new(LASSO_TYPE_DST_DATA, NULL); + + return data; +} + diff --git a/lasso/xml/dst_data.h b/lasso/xml/dst_data.h new file mode 100644 index 00000000..e06eb510 --- /dev/null +++ b/lasso/xml/dst_data.h @@ -0,0 +1,80 @@ +/* $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 + */ + +#ifndef __LASSO_DST_DATA_H__ +#define __LASSO_DST_DATA_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_DST_DATA (lasso_dst_data_get_type()) +#define LASSO_DST_DATA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_DST_DATA, LassoDstData)) +#define LASSO_DST_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_DST_DATA, LassoDstDataClass)) +#define LASSO_IS_DST_DATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_DST_DATA)) +#define LASSO_IS_DST_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_DST_DATA)) +#define LASSO_DST_DATA_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \ + LASSO_TYPE_DST_DATA, LassoDstDataClass)) + +typedef struct _LassoDstData LassoDstData; +typedef struct _LassoDstDataClass LassoDstDataClass; + +/* + * Schema fragment (liberty-idwsf-dst-v1.0.xsd): + * <xs:element name="Data" minOccurs="0" maxOccurs="unbounded"> + * <xs:complexType> + * <xs:sequence> + * <xs:any minOccurs="0" maxOccurs="unbounded"/> + * </xs:sequence> + * <xs:attribute name="id" type="xs:ID"/> + * <xs:attribute name="itemIDRef" type="IDReferenceType"/> + * </xs:complexType> + * </xs:element> +*/ + +struct _LassoDstData { + LassoNode parent; + + GList *any; + + char *id; + char *itemIDRef; +}; + +struct _LassoDstDataClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_dst_data_get_type(void); +LASSO_EXPORT LassoDstData* lasso_dst_data_new(const char *itemIDRef); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DST_DATA_H__ */ 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; +} + diff --git a/lasso/xml/dst_query.h b/lasso/xml/dst_query.h new file mode 100644 index 00000000..3c107a45 --- /dev/null +++ b/lasso/xml/dst_query.h @@ -0,0 +1,90 @@ +/* $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 + */ + +#ifndef __LASSO_DST_QUERY_H__ +#define __LASSO_DST_QUERY_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> +#include <lasso/xml/dst_query_item.h> + +#define LASSO_TYPE_DST_QUERY (lasso_dst_query_get_type()) +#define LASSO_DST_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_DST_QUERY, LassoDstQuery)) +#define LASSO_DST_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_DST_QUERY, LassoDstQueryClass)) +#define LASSO_IS_DST_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_DST_QUERY)) +#define LASSO_IS_DST_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_DST_QUERY)) +#define LASSO_DST_QUERY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \ + LASSO_TYPE_DST_QUERY, LassoDstQueryClass)) + +typedef struct _LassoDstQuery LassoDstQuery; +typedef struct _LassoDstQueryClass LassoDstQueryClass; + +/* + Schema fragment (liberty-idwsf-dst-v1.0.xsd): + + <xs:element name="Query" type="QueryType"/> + <xs:complexType name="QueryType"> + <xs:sequence> + <xs:group ref="ResourceIDGroup" minOccurs="0"/> + <xs:element name="QueryItem" maxOccurs="unbounded"/> + <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="id" type="xs:ID"/> + <xs:attribute name="itemID" type="IDType"/> + </xs:complexType> + +*/ + +struct _LassoDstQuery { + LassoNode parent; + + char *ResourceID; + char *EncryptedResourceID; + GList *QueryItem; + GList *Extension; + + char *id; + char *itemID; +}; + +struct _LassoDstQueryClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_dst_query_get_type(void); +LASSO_EXPORT LassoDstQuery* lasso_dst_query_new(LassoDstQueryItem *QueryItem, + const char *id, + const char *itemID); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DST_QUERY_H__ */ diff --git a/lasso/xml/dst_query_item.c b/lasso/xml/dst_query_item.c new file mode 100644 index 00000000..71436e98 --- /dev/null +++ b/lasso/xml/dst_query_item.c @@ -0,0 +1,140 @@ +/* $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_item.h> + + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +/* FIXME : implement includeCommonAttributes attribute in snippets */ +#define snippets() \ + LassoDstQueryItem *query_item = LASSO_DST_QUERY_ITEM(node); \ + struct XmlSnippet snippets[] = { \ + { "Select", SNIPPET_LIST_NODES, (void**)&(query_item->Select) }, \ + { "id", SNIPPET_ATTRIBUTE, (void**)&(query_item->id) }, \ + { "itemID", SNIPPET_ATTRIBUTE, (void**)&(query_item->itemID) }, \ + { "changedSince", SNIPPET_ATTRIBUTE, (void**)&(query_item->changedSince) }, \ + { NULL, 0, NULL} \ + }; + +static LassoNodeClass *parent_class = NULL; + +static xmlNode* +get_xmlNode(LassoNode *node) +{ + xmlNode *xmlnode; + snippets(); + + xmlnode = xmlNewNode(NULL, "QueryItem"); + 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(LassoDstQueryItem *node) +{ + node->Select = NULL; + + node->id = NULL; + node->includeCommonAttributes = FALSE; + node->itemID = NULL; + node->changedSince = NULL; +} + +static void +class_init(LassoDstQueryItemClass *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_item_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDstQueryItemClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDstQueryItem), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDstQueryItem", &this_info, 0); + } + return this_type; +} + +LassoDstQueryItem* +lasso_dst_query_item_new(LassoDstSelect *Select, + const char *id, + const char *itemID, + const char *changedSince) +{ + LassoDstQueryItem *node; + + node = g_object_new(LASSO_TYPE_DST_QUERY_ITEM, NULL); + + node->Select = g_list_append(node->Select, Select); + node->id = g_strdup(id); + node->itemID = g_strdup(itemID); + node->changedSince = g_strdup(changedSince); + + return node; +} + diff --git a/lasso/xml/dst_query_item.h b/lasso/xml/dst_query_item.h new file mode 100644 index 00000000..f5303063 --- /dev/null +++ b/lasso/xml/dst_query_item.h @@ -0,0 +1,91 @@ +/* $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 + */ + +#ifndef __LASSO_DST_QUERY_ITEM_H__ +#define __LASSO_DST_QUERY_ITEM_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> +#include <lasso/xml/dst_select.h> + +#define LASSO_TYPE_DST_QUERY_ITEM (lasso_dst_query_item_get_type()) +#define LASSO_DST_QUERY_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_DST_QUERY_ITEM, LassoDstQueryItem)) +#define LASSO_DST_QUERY_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_DST_QUERY_ITEM, LassoDstQueryItemClass)) +#define LASSO_IS_DST_QUERY_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + LASSO_TYPE_DST_QUERY_ITEM)) +#define LASSO_IS_DST_QUERY_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + LASSO_TYPE_DST_QUERY_ITEM)) +#define LASSO_DST_QUERY_ITEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \ + LASSO_TYPE_DST_QUERY_ITEM, LassoDstQueryItemClass)) + +typedef struct _LassoDstQueryItem LassoDstQueryItem; +typedef struct _LassoDstQueryItemClass LassoDstQueryItemClass; + +/* + * Schema fragment (liberty-idwsf-dst-v1.0.xsd): + * <xs:element name="QueryItem" maxOccurs="unbounded"> + * <xs:complexType> + * <xs:sequence> + * <xs:element name="Select" type="SelectType"/> + * </xs:sequence> + * <xs:attribute name="id" type="xs:ID"/> + * <xs:attribute name="includeCommonAttributes" type="xs:boolean" default="0"/> + * <xs:attribute name="itemID" type="IDType"/> + * <xs:attribute name="changedSince" type="xs:dateTime"/> + * </xs:complexType> + * </xs:element> +*/ + +struct _LassoDstQueryItem { + LassoNode parent; + + GList *Select; + + char *id; + gboolean includeCommonAttributes; + char *itemID; + char *changedSince; +}; + +struct _LassoDstQueryItemClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_dst_query_item_get_type(void); +LASSO_EXPORT LassoDstQueryItem* lasso_dst_query_item_new(LassoDstSelect *Select, + const char *id, + const char *itemID, + const char *changedSince); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DST_QUERY_ITEM_H__ */ diff --git a/lasso/xml/dst_query_response.c b/lasso/xml/dst_query_response.c new file mode 100644 index 00000000..dd06eb1f --- /dev/null +++ b/lasso/xml/dst_query_response.c @@ -0,0 +1,138 @@ +/* $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_response.h> + + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +#define snippets() \ + LassoDstQueryResponse *query_response = LASSO_DST_QUERY_RESPONSE(node); \ + struct XmlSnippet snippets[] = { \ + { "Status", SNIPPET_NODE, (void**)&(query_response->Status) }, \ + { NULL, 0, NULL } \ + }; + +static LassoNodeClass *parent_class = NULL; + +static xmlNode* +get_xmlNode(LassoNode *node) +{ + xmlNode *xmlnode; + snippets(); + + xmlnode = xmlNewNode(NULL, "QueryResponse"); + 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(LassoDstQueryResponse *node) +{ + node->Status = NULL; + node->Data = NULL; + /* FIXME : implement Extension element */ + + node->id = NULL; + node->itemIDRef = NULL; + node->timeStamp = NULL; +} + +static void +class_init(LassoDstQueryResponseClass *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_response_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDstQueryResponseClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDstQueryResponse), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDstQueryResponse", &this_info, 0); + } + return this_type; +} + +LassoDstQueryResponse* +lasso_dst_query_response_new(LassoUtilityStatus *Status, + const char *id, + const char *itemIDRef, + const char *timeStamp) +{ + LassoDstQueryResponse *node; + + node = g_object_new(LASSO_TYPE_DST_QUERY_RESPONSE, NULL); + + node->Status = Status; + + node->id = g_strdup(id); + node->itemIDRef = g_strdup(itemIDRef); + node->timeStamp = g_strdup(timeStamp); + + return node; +} + diff --git a/lasso/xml/dst_query_response.h b/lasso/xml/dst_query_response.h new file mode 100644 index 00000000..95aa4c03 --- /dev/null +++ b/lasso/xml/dst_query_response.h @@ -0,0 +1,93 @@ +/* $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 + */ + +#ifndef __LASSO_DST_QUERY_RESPONSE_H__ +#define __LASSO_DST_QUERY_RESPONSE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/dst_data.h> +#include <lasso/xml/utility_status.h> +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_DST_QUERY_RESPONSE (lasso_dst_query_response_get_type()) +#define LASSO_DST_QUERY_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_DST_QUERY_RESPONSE, LassoDstQueryResponse)) +#define LASSO_DST_QUERY_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_DST_QUERY_RESPONSE, LassoDstQueryResponseClass)) +#define LASSO_IS_DST_QUERY_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + LASSO_TYPE_DST_QUERY_RESPONSE)) +#define LASSO_IS_DST_QUERY_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + LASSO_TYPE_DST_QUERY_RESPONSE)) +#define LASSO_DST_QUERY_RESPONSE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \ + LASSO_TYPE_DST_QUERY_RESPONSE, LassoDstQueryResponseClass)) + +typedef struct _LassoDstQueryResponse LassoDstQueryResponse; +typedef struct _LassoDstQueryResponseClass LassoDstQueryResponseClass; + +/* +* Schema fragment (liberty-idwsf-dst-v1.0.xsd): +* <xs:element name="QueryResponse" type="QueryResponseType"/> +* <xs:complexType name="QueryResponseType"> +* <xs:sequence> +* <xs:element ref="Status"/> +* <xs:element name="Data" minOccurs="0" maxOccurs="unbounded"/> +* <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/> +* </xs:sequence> +* <xs:attribute name="id" type="xs:ID"/> +* <xs:attribute name="itemIDRef" type="IDReferenceType"/> +* <xs:attribute name="timeStamp" type="xs:dateTime"/> +* </xs:complexType> +*/ + +struct _LassoDstQueryResponse { + LassoNode parent; + + LassoUtilityStatus *Status; + LassoDstData *Data; + /* FIXME : implement Extension element */ + + char *id; + char *itemIDRef; + char *timeStamp; +}; + +struct _LassoDstQueryResponseClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_dst_query_response_get_type(void); +LASSO_EXPORT LassoDstQueryResponse* lasso_dst_query_response_new(LassoUtilityStatus *Status, + const char *id, + const char *itemIDRef, + const char *timeStamp); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DST_QUERY_RESPONSE_H__ */ |
