diff options
| author | Valery Febvre <vfebvre at easter-eggs.com> | 2004-11-29 10:21:39 +0000 |
|---|---|---|
| committer | Valery Febvre <vfebvre at easter-eggs.com> | 2004-11-29 10:21:39 +0000 |
| commit | 419c7282997a91c9bbd9e630d40beaa977b4a5ae (patch) | |
| tree | b7ee02e0fd5d4dfbc9e93fb2740e059b0abf1843 | |
| parent | 3b7c5be162d7ad6f3cdf1181f3721d5a30db32f4 (diff) | |
| download | lasso-419c7282997a91c9bbd9e630d40beaa977b4a5ae.tar.gz lasso-419c7282997a91c9bbd9e630d40beaa977b4a5ae.tar.xz lasso-419c7282997a91c9bbd9e630d40beaa977b4a5ae.zip | |
Added 8 classes for discovering identity services (ID-WSF)
They provide methods to build Modify & ModifyResponse messages.
| -rw-r--r-- | lasso/xml/Makefile.am | 16 | ||||
| -rw-r--r-- | lasso/xml/disco_description.c | 153 | ||||
| -rw-r--r-- | lasso/xml/disco_description.h | 69 | ||||
| -rw-r--r-- | lasso/xml/disco_insert_entry.c | 127 | ||||
| -rw-r--r-- | lasso/xml/disco_insert_entry.h | 64 | ||||
| -rw-r--r-- | lasso/xml/disco_modify.c | 139 | ||||
| -rw-r--r-- | lasso/xml/disco_modify.h | 93 | ||||
| -rw-r--r-- | lasso/xml/disco_modify_response.c | 145 | ||||
| -rw-r--r-- | lasso/xml/disco_modify_response.h | 66 | ||||
| -rw-r--r-- | lasso/xml/disco_options.c | 123 | ||||
| -rw-r--r-- | lasso/xml/disco_options.h | 63 | ||||
| -rw-r--r-- | lasso/xml/disco_remove_entry.c | 121 | ||||
| -rw-r--r-- | lasso/xml/disco_remove_entry.h | 62 | ||||
| -rw-r--r-- | lasso/xml/disco_resource_offering.c | 158 | ||||
| -rw-r--r-- | lasso/xml/disco_resource_offering.h | 73 | ||||
| -rw-r--r-- | lasso/xml/disco_service_instance.c | 131 | ||||
| -rw-r--r-- | lasso/xml/disco_service_instance.h | 66 |
17 files changed, 1669 insertions, 0 deletions
diff --git a/lasso/xml/Makefile.am b/lasso/xml/Makefile.am index 025407f8..cc4e2cda 100644 --- a/lasso/xml/Makefile.am +++ b/lasso/xml/Makefile.am @@ -14,6 +14,14 @@ liblasso_xml_la_SOURCES = \ tools.c \ errors.c \ xml.c \ + disco_description.c \ + disco_insert_entry.c \ + disco_modify.c \ + disco_modify_response.c \ + disco_options.c \ + disco_remove_entry.c \ + disco_resource_offering.c \ + disco_service_instance.c \ lib_assertion.c \ lib_authentication_statement.c \ lib_authn_context.c \ @@ -61,6 +69,14 @@ liblassoinclude_HEADERS = \ tools.h \ errors.h \ xml.h \ + disco_description.h \ + disco_insert_entry.h \ + disco_modify.h \ + disco_modify_response.h \ + disco_options.h \ + disco_remove_entry.h \ + disco_resource_offering.h \ + disco_service_instance.h \ lib_assertion.h \ lib_authentication_statement.h \ lib_authn_context.h \ diff --git a/lasso/xml/disco_description.c b/lasso/xml/disco_description.c new file mode 100644 index 00000000..4d85562e --- /dev/null +++ b/lasso/xml/disco_description.c @@ -0,0 +1,153 @@ +/* $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/disco_description.h> + +/* +The schema fragment (liberty-idwsf-disco-svc-1.0-errata-v1.0.xsd): + +<xs:complexType name="DescriptionType"> + <xs:sequence> + <xs:element name="SecurityMechID" type="xs:anyURI" minOccurs="1" maxOccurs="unbounded"/> + <xs:element name="CredentialRef" type="xs:IDREF" minOccurs="0" maxOccurs="unbounded"/> + <xs:choice> + <xs:group ref="WsdlRef"/> + <xs:group ref="BriefSoapHttpDescription"/> + </xs:choice> + </xs:sequence> + <xs:attribute name="id" type="xs:ID"/> +</xs:complexType> + +<xs:group name="WsdlRef"> + <xs:sequence> + <xs:element name="WsdlURI" type="xs:anyURI"/> + <xs:element name="ServiceNameRef" type="xs:QName"/> + </xs:sequence> +</xs:group> + +<xs:group name="BriefSoapHttpDescription"> + <xs:sequence> + <xs:element name="Endpoint" type="xs:anyURI"/> + <xs:element name="SoapAction" type="xs:anyURI" minOccurs="0"/> + </xs:sequence> +</xs:group> +*/ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +#define snippets() \ + LassoDiscoDescription *description = LASSO_DISCO_DESCRIPTION(node); \ + struct XmlSnippet snippets[] = { \ + { "SecurityMechID", 'c', (void**)&(description->SecurityMechID) }, \ + { "CredentialRef", 'c', (void**)&(description->CredentialRef) }, \ + { NULL, 0, NULL} \ + }; + +static LassoNodeClass *parent_class = NULL; + +static xmlNode* +get_xmlNode(LassoNode *node) +{ + xmlNode *xmlnode; + snippets(); + + xmlnode = xmlNewNode(NULL, "Description"); + xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_DISCO_HREF, LASSO_DISCO_PREFIX)); + lasso_node_build_xml_with_snippets(xmlnode, snippets); + if (description->id) { + xmlSetProp(xmlnode, "id", description->id); + } + + return xmlnode; +} + +static int +init_from_xml(LassoNode *node, xmlNode *xmlnode) +{ + snippets(); + + if (parent_class->init_from_xml(node, xmlnode)) { + return -1; + } + + description->id = xmlGetProp(xmlnode, "id"); + lasso_node_init_xml_with_snippets(xmlnode, snippets); + + return 0; +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoDiscoDescription *node) +{ + node->SecurityMechID = NULL; + node->CredentialRef = NULL; + node->id = NULL; +} + +static void +class_init(LassoDiscoDescriptionClass *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_disco_description_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDiscoDescriptionClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDiscoDescription), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDiscoDescription", &this_info, 0); + } + return this_type; +} + +LassoDiscoDescription* +lasso_disco_description_new() +{ + return g_object_new(LASSO_TYPE_DISCO_DESCRIPTION, NULL); +} diff --git a/lasso/xml/disco_description.h b/lasso/xml/disco_description.h new file mode 100644 index 00000000..98b4a124 --- /dev/null +++ b/lasso/xml/disco_description.h @@ -0,0 +1,69 @@ +/* $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_DISCO_DESCRIPTION_H__ +#define __LASSO_DISCO_DESCRIPTION_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_DISCO_DESCRIPTION (lasso_disco_description_get_type()) +#define LASSO_DISCO_DESCRIPTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_DISCO_DESCRIPTION, LassoDiscoDescription)) +#define LASSO_DISCO_DESCRIPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_DISCO_DESCRIPTION, LassoDiscoDescriptionClass)) +#define LASSO_IS_DISCO_DESCRIPTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_DISCO_DESCRIPTION)) +#define LASSO_IS_DISCO_DESCRIPTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_DISCO_DESCRIPTION)) +#define LASSO_DISCO_DESCRIPTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_DISCO_DESCRIPTION, LassoDiscoDescriptionClass)) + +typedef struct _LassoDiscoDescription LassoDiscoDescription; +typedef struct _LassoDiscoDescriptionClass LassoDiscoDescriptionClass; + +struct _LassoDiscoDescription { + LassoNode parent; + + GList *SecurityMechID; + GList *CredentialRef; + + GList *WsdlRef; + GList *BriefSoapHttpDescription; + + char *id; +}; + +struct _LassoDiscoDescriptionClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_disco_description_get_type (void); + +LASSO_EXPORT LassoDiscoDescription* lasso_disco_description_new (); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DISCO_DESCRIPTION_H__ */ diff --git a/lasso/xml/disco_insert_entry.c b/lasso/xml/disco_insert_entry.c new file mode 100644 index 00000000..e607cfef --- /dev/null +++ b/lasso/xml/disco_insert_entry.c @@ -0,0 +1,127 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: Valery Febvre <vfebvre@easter-eggs.com> + * Nicolas Clapies <nclapies@entrouvert.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/disco_insert_entry.h> + +/* +Schema fragment (liberty-idwsf-disco-svc-v1.0.xsd): + +<xs:complexType name="InsertEntryType"> + <xs:sequence> + <xs:element ref="ResourceOffering"/> + <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> +</xs:complexType> +*/ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +#define snippets() \ + LassoDiscoInsertEntry *entry = \ + LASSO_DISCO_INSERT_ENTRY(node); \ + struct XmlSnippet snippets[] = { \ + { "ResourceOffering", 'n', (void**)&(entry->ResourceOffering) }, \ + { "any", 's', (void**)&(entry->any) }, \ + { NULL, 0, NULL} \ + }; + +static LassoNodeClass *parent_class = NULL; + +static xmlNode* +get_xmlNode(LassoNode *node) +{ + xmlNode *xmlnode; + snippets(); + + xmlnode = xmlNewNode(NULL, "InsertEntry"); + xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_DISCO_HREF, LASSO_DISCO_PREFIX)); + lasso_node_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; + } + lasso_node_init_xml_with_snippets(xmlnode, snippets); + + return 0; +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoDiscoInsertEntry *node) +{ + node->ResourceOffering = NULL; + node->any = NULL; +} + +static void +class_init(LassoDiscoInsertEntryClass *klass) +{ + parent_class = g_type_class_peek_parent(klass); + LASSO_NODE_CLASS(klass)->get_xmlNode = get_xmlNode; + LASSO_NODE_CLASS(klass)->init_from_xml = init_from_xml; +} + +GType +lasso_disco_insert_entry_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDiscoInsertEntryClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDiscoInsertEntry), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDiscoInsertEntry", &this_info, 0); + } + return this_type; +} + +LassoDiscoInsertEntry* +lasso_disco_insert_entry_new() +{ + return g_object_new(LASSO_TYPE_DISCO_INSERT_ENTRY, NULL); +} diff --git a/lasso/xml/disco_insert_entry.h b/lasso/xml/disco_insert_entry.h new file mode 100644 index 00000000..80cbe47b --- /dev/null +++ b/lasso/xml/disco_insert_entry.h @@ -0,0 +1,64 @@ +/* $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_DISCO_INSERT_ENTRY_H__ +#define __LASSO_DISCO_INSERT_ENTRY_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> +#include <lasso/xml/disco_resource_offering.h> + +#define LASSO_TYPE_DISCO_INSERT_ENTRY (lasso_disco_insert_entry_get_type()) +#define LASSO_DISCO_INSERT_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_DISCO_INSERT_ENTRY, LassoDiscoInsertEntry)) +#define LASSO_DISCO_INSERT_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_DISCO_INSERT_ENTRY, LassoDiscoInsertEntryClass)) +#define LASSO_IS_DISCO_INSERT_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_DISCO_INSERT_ENTRY)) +#define LASSO_IS_DISCO_INSERT_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_DISCO_INSERT_ENTRY)) +#define LASSO_DISCO_INSERT_ENTRY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_DISCO_INSERT_ENTRY, LassoDiscoInsertEntryClass)) + +typedef struct _LassoDiscoInsertEntry LassoDiscoInsertEntry; +typedef struct _LassoDiscoInsertEntryClass LassoDiscoInsertEntryClass; + +struct _LassoDiscoInsertEntry { + LassoNode parent; + + LassoDiscoResourceOffering *ResourceOffering; + GList *any; +}; + +struct _LassoDiscoInsertEntryClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_disco_insert_entry_get_type(void); +LASSO_EXPORT LassoDiscoInsertEntry* lasso_disco_insert_entry_new(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DISCO_INSERT_ENTRY_H__ */ diff --git a/lasso/xml/disco_modify.c b/lasso/xml/disco_modify.c new file mode 100644 index 00000000..45b5b68f --- /dev/null +++ b/lasso/xml/disco_modify.c @@ -0,0 +1,139 @@ +/* $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/disco_modify.h> + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +#define snippets() \ + LassoDiscoModify *modify = LASSO_DISCO_MODIFY(node); \ + struct XmlSnippet snippets[] = { \ + { "ResourceID", 'c', (void**)&(modify->ResourceID) }, \ + { "EncryptedResourceID", 'c', (void**)&(modify->EncryptedResourceID) }, \ + { "InsertEntry", 's', (void**)&(modify->InsertEntry) }, \ + { "RemoveEntry", 's', (void**)&(modify->RemoveEntry) }, \ + { "id", 'a', (void**)&(modify->id) }, \ + { NULL, 0, NULL} \ + }; + +static LassoNodeClass *parent_class = NULL; + +static xmlNode* +get_xmlNode(LassoNode *node) +{ + xmlNode *xmlnode; + snippets(); + + xmlnode = xmlNewNode(NULL, "Modify"); + xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_DISCO_HREF, LASSO_DISCO_PREFIX)); + lasso_node_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; + } + + lasso_node_init_xml_with_snippets(xmlnode, snippets); + + return 0; +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoDiscoModify *node) +{ + node->ResourceID = NULL; + node->EncryptedResourceID = NULL; + node->InsertEntry = NULL; + node->RemoveEntry = NULL; + node->id = NULL; +} + +static void +class_init(LassoDiscoModifyClass *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_disco_modify_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDiscoModifyClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDiscoModify), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDiscoModify", &this_info, 0); + } + return this_type; +} + +LassoDiscoModify* +lasso_disco_modify_new(char *resourceID, + gboolean encrypted) +{ + LassoDiscoModify *modify; + + g_return_val_if_fail (resourceID != NULL, NULL); + + modify = g_object_new(LASSO_TYPE_DISCO_MODIFY, NULL); + + /* ResourceID or EncryptedResourceID */ + if (encrypted == FALSE) { + modify->ResourceID = g_strdup(resourceID); + } + else { + modify->EncryptedResourceID = g_strdup(resourceID); + } + + return modify; +} diff --git a/lasso/xml/disco_modify.h b/lasso/xml/disco_modify.h new file mode 100644 index 00000000..4b57b410 --- /dev/null +++ b/lasso/xml/disco_modify.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_DISCO_MODIFY_H__ +#define __LASSO_DISCO_MODIFY_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_DISCO_MODIFY (lasso_disco_modify_get_type()) +#define LASSO_DISCO_MODIFY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_DISCO_MODIFY, LassoDiscoModify)) +#define LASSO_DISCO_MODIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_DISCO_MODIFY, LassoDiscoModifyClass)) +#define LASSO_IS_DISCO_MODIFY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_DISCO_MODIFY)) +#define LASSO_IS_DISCO_MODIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_DISCO_MODIFY)) +#define LASSO_DISCO_MODIFY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_DISCO_MODIFY, LassoDiscoModifyClass)) + +typedef struct _LassoDiscoModify LassoDiscoModify; +typedef struct _LassoDiscoModifyClass LassoDiscoModifyClass; + +/* +The schema fragment (liberty-idwsf-disco-svc-1.0-errata-v1.0.xsd): + +<xs:element name="Modify" type="ModifyType"/> +<xs:complexType name="ModifyType"> + <xs:sequence> + <xs:group ref="ResourceIDGroup"/> + <xs:element name="InsertEntry" type="InsertEntryType" minOccurs="0" maxOccurs="unbounded"/> + <xs:element name="RemoveEntry" type="RemoveEntryType" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> + <xs:attribute name="id" type="xs:ID" use="optional"/> +</xs:complexType> + +<xs:group name="ResourceIDGroup"> + <xs:sequence> + <xs:choice minOccurs="0" maxOccurs="1"> + <xs:element ref="ResourceID"/> + <xs:element ref="EncryptedResourceID"/> + </xs:choice> + </xs:sequence> +</xs:group> +*/ + +struct _LassoDiscoModify { + LassoNode parent; + + char *ResourceID; + char *EncryptedResourceID; + + GList *InsertEntry; + GList *RemoveEntry; + + char *id; +}; + +struct _LassoDiscoModifyClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_disco_modify_get_type (void); + +LASSO_EXPORT LassoDiscoModify* lasso_disco_modify_new (char *resourceID, + gboolean encrypted); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DISCO_MODIFY_H__ */ diff --git a/lasso/xml/disco_modify_response.c b/lasso/xml/disco_modify_response.c new file mode 100644 index 00000000..822f811a --- /dev/null +++ b/lasso/xml/disco_modify_response.c @@ -0,0 +1,145 @@ +/* $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/disco_modify_response.h> + +/* +The schema fragment (liberty-idwsf-disco-svc-1.0-errata-v1.0.xsd): + +<xs:element name="ModifyResponse" type="ModifyResponseType"/> +<xs:complexType name="ModifyResponseType"> + <xs:sequence> + <xs:element ref="Status"/> + <xs:element ref="Extension" minOccurs="0" maxOccurs="1"/> + </xs:sequence> + <xs:attribute name="id" type="xs:ID" use="optional"/> + <xs:attribute name="newEntryIDs" use="optional"> + <xs:simpleType> + <xs:list itemType="IDReferenceType"/> + </xs:simpleType> + </xs:attribute> +</xs:complexType> +*/ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +#define snippets() \ + LassoDiscoModifyResponse *response = LASSO_DISCO_MODIFY_RESPONSE(node); \ + struct XmlSnippet snippets[] = { \ + { "Status", 'n', (void**)&(response->Status) }, \ + { NULL, 0, NULL} \ + }; + +static LassoNodeClass *parent_class = NULL; + +static xmlNode* +get_xmlNode(LassoNode *node) +{ + xmlNode *xmlnode; + snippets(); + + xmlnode = parent_class->get_xmlNode(node); + xmlNodeSetName(xmlnode, "ModifyResponse"); + xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_DISCO_HREF, LASSO_DISCO_PREFIX)); + lasso_node_build_xml_with_snippets(xmlnode, snippets); + if (response->id) { + xmlSetProp(xmlnode, "id", response->id); + } + if (response->newEntryIDs) { + xmlSetProp(xmlnode, "newEntryIDs", response->newEntryIDs); + } + + return xmlnode; +} + +static int +init_from_xml(LassoNode *node, xmlNode *xmlnode) +{ + snippets(); + + if (parent_class->init_from_xml(node, xmlnode)) { + return -1; + } + + response->id = xmlGetProp(xmlnode, "id"); + response->newEntryIDs = xmlGetProp(xmlnode, "newEntryIDs"); + lasso_node_init_xml_with_snippets(xmlnode, snippets); + + return 0; +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoDiscoModifyResponse *node) +{ + node->Status = NULL; + node->id = NULL; + node->newEntryIDs = NULL; +} + +static void +class_init(LassoDiscoModifyResponseClass *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_disco_modify_response_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDiscoModifyResponseClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDiscoModifyResponse), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDiscoModifyResponse", &this_info, 0); + } + return this_type; +} + +LassoDiscoModifyResponse* +lasso_disco_modify_response_new() +{ + return g_object_new(LASSO_TYPE_DISCO_MODIFY_RESPONSE, NULL); +} diff --git a/lasso/xml/disco_modify_response.h b/lasso/xml/disco_modify_response.h new file mode 100644 index 00000000..27762422 --- /dev/null +++ b/lasso/xml/disco_modify_response.h @@ -0,0 +1,66 @@ +/* $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_DISCO_MODIFY_RESPONSE_H__ +#define __LASSO_DISCO_MODIFY_RESPONSE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_DISCO_MODIFY_RESPONSE (lasso_disco_modify_response_get_type()) +#define LASSO_DISCO_MODIFY_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_DISCO_MODIFY_RESPONSE, LassoDiscoModifyResponse)) +#define LASSO_DISCO_MODIFY_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_DISCO_MODIFY_RESPONSE, LassoDiscoModifyResponseClass)) +#define LASSO_IS_DISCO_MODIFY_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_DISCO_MODIFY_RESPONSE)) +#define LASSO_IS_DISCO_MODIFY_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_DISCO_MODIFY_RESPONSE)) +#define LASSO_DISCO_MODIFY_RESPONSE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_DISCO_MODIFY_RESPONSE, LassoDiscoModifyResponseClass)) + +typedef struct _LassoDiscoModifyResponse LassoDiscoModifyResponse; +typedef struct _LassoDiscoModifyResponseClass LassoDiscoModifyResponseClass; + +struct _LassoDiscoModifyResponse { + LassoNode parent; + + char *Status; /* FIXME valos */ + + char *id; + char *newEntryIDs; +}; + +struct _LassoDiscoModifyResponseClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_disco_modify_response_get_type (void); + +LASSO_EXPORT LassoDiscoModifyResponse* lasso_disco_modify_response_new (); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DISCO_MODIFY_RESPONSE_H__ */ diff --git a/lasso/xml/disco_options.c b/lasso/xml/disco_options.c new file mode 100644 index 00000000..a68f9cc7 --- /dev/null +++ b/lasso/xml/disco_options.c @@ -0,0 +1,123 @@ +/* $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/disco_options.h> + +/* +The schema fragment (liberty-idwsf-disco-svc-1.0-errata-v1.0.xsd): + +<xs:element name="Options" type="OptionsType"/> +<xs:complexType name="OptionsType"> + <xs:sequence> + <xs:element name="Option" type="xs:anyURI" minOccurs="0" maxOccurs="unbounded"/> + </xs:sequence> +</xs:complexType> +*/ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +#define snippets() \ + LassoDiscoOptions *options = LASSO_DISCO_OPTIONS(node); \ + struct XmlSnippet snippets[] = { \ + { "Option", 't', (void**)&(options->Option) }, \ + { NULL, 0, NULL} \ + }; + +static LassoNodeClass *parent_class = NULL; + +static xmlNode* +get_xmlNode(LassoNode *node) +{ + xmlNode *xmlnode; + snippets(); + + xmlnode = xmlNewNode(NULL, "Options"); + xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_DISCO_HREF, LASSO_DISCO_PREFIX)); + lasso_node_build_xml_with_snippets(xmlnode, snippets); + + return xmlnode; +} + +static int +init_from_xml(LassoNode *node, xmlNode *xmlnode) +{ + if (parent_class->init_from_xml(node, xmlnode)) { + return -1; + } + + return 0; +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoDiscoOptions *node) +{ + node->Option = NULL; +} + +static void +class_init(LassoDiscoOptionsClass *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_disco_options_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDiscoOptionsClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDiscoOptions), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDiscoOptions", &this_info, 0); + } + return this_type; +} + +LassoDiscoOptions* +lasso_disco_options_new() +{ + return g_object_new(LASSO_TYPE_DISCO_OPTIONS, NULL); +} diff --git a/lasso/xml/disco_options.h b/lasso/xml/disco_options.h new file mode 100644 index 00000000..7812f59f --- /dev/null +++ b/lasso/xml/disco_options.h @@ -0,0 +1,63 @@ +/* $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_DISCO_OPTIONS_H__ +#define __LASSO_DISCO_OPTIONS_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_DISCO_OPTIONS (lasso_disco_options_get_type()) +#define LASSO_DISCO_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_DISCO_OPTIONS, LassoDiscoOptions)) +#define LASSO_DISCO_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_DISCO_OPTIONS, LassoDiscoOptionsClass)) +#define LASSO_IS_DISCO_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_DISCO_OPTIONS)) +#define LASSO_IS_DISCO_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_DISCO_OPTIONS)) +#define LASSO_DISCO_OPTIONS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_DISCO_OPTIONS, LassoDiscoOptionsClass)) + +typedef struct _LassoDiscoOptions LassoDiscoOptions; +typedef struct _LassoDiscoOptionsClass LassoDiscoOptionsClass; + +struct _LassoDiscoOptions { + LassoNode parent; + + GList *Option; +}; + +struct _LassoDiscoOptionsClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_disco_options_get_type (void); + +LASSO_EXPORT LassoDiscoOptions* lasso_disco_options_new (); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DISCO_OPTIONS_H__ */ diff --git a/lasso/xml/disco_remove_entry.c b/lasso/xml/disco_remove_entry.c new file mode 100644 index 00000000..a87291ed --- /dev/null +++ b/lasso/xml/disco_remove_entry.c @@ -0,0 +1,121 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: Valery Febvre <vfebvre@easter-eggs.com> + * Nicolas Clapies <nclapies@entrouvert.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/disco_remove_entry.h> + +/* +Schema fragment (liberty-idwsf-disco-svc-v1.0.xsd): + +<xs:complexType name="RemoveEntryType"> + <xs:attribute name="entryID" type="IDReferenceType"/> +</xs:complexType> + +Schema fragment (liberty-idwsf-utility-1.0-errata-v1.0.xsd) + +<xs:simpleType name="IDReferenceType"> + <xs:restriction base="xs:string"/> +</xs:simpleType> +*/ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static LassoNodeClass *parent_class = NULL; + +static xmlNode* +get_xmlNode(LassoNode *node) +{ + xmlNode *xmlnode; + LassoDiscoRemoveEntry *entry = LASSO_DISCO_REMOVE_ENTRY(node); + + xmlnode = xmlNewNode(NULL, "RemoveEntry"); + xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_DISCO_HREF, LASSO_DISCO_PREFIX)); + + xmlSetProp(xmlnode, "entryID", entry->entryID); + + return xmlnode; +} + +static int +init_from_xml(LassoNode *node, xmlNode *xmlnode) +{ + LassoDiscoRemoveEntry *entry = LASSO_DISCO_REMOVE_ENTRY(node); + + if (parent_class->init_from_xml(node, xmlnode)) { + return -1; + } + + entry->entryID = xmlGetProp(xmlnode, "entryID"); + return 0; +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoDiscoRemoveEntry *node) +{ + node->entryID = NULL; +} + +static void +class_init(LassoDiscoRemoveEntryClass *klass) +{ + parent_class = g_type_class_peek_parent(klass); + LASSO_NODE_CLASS(klass)->get_xmlNode = get_xmlNode; + LASSO_NODE_CLASS(klass)->init_from_xml = init_from_xml; +} + +GType +lasso_disco_remove_entry_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDiscoRemoveEntryClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDiscoRemoveEntry), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDiscoRemoveEntry", &this_info, 0); + } + return this_type; +} + +LassoDiscoRemoveEntry* +lasso_disco_remove_entry_new() +{ + return g_object_new(LASSO_TYPE_DISCO_REMOVE_ENTRY, NULL); +} diff --git a/lasso/xml/disco_remove_entry.h b/lasso/xml/disco_remove_entry.h new file mode 100644 index 00000000..aad7b8f6 --- /dev/null +++ b/lasso/xml/disco_remove_entry.h @@ -0,0 +1,62 @@ +/* $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_DISCO_REMOVE_ENTRY_H__ +#define __LASSO_DISCO_REMOVE_ENTRY_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_DISCO_REMOVE_ENTRY (lasso_disco_remove_entry_get_type()) +#define LASSO_DISCO_REMOVE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_DISCO_REMOVE_ENTRY, LassoDiscoRemoveEntry)) +#define LASSO_DISCO_REMOVE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_DISCO_REMOVE_ENTRY, LassoDiscoRemoveEntryClass)) +#define LASSO_IS_DISCO_REMOVE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_DISCO_REMOVE_ENTRY)) +#define LASSO_IS_DISCO_REMOVE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_DISCO_REMOVE_ENTRY)) +#define LASSO_DISCO_REMOVE_ENTRY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_DISCO_REMOVE_ENTRY, LassoDiscoRemoveEntryClass)) + +typedef struct _LassoDiscoRemoveEntry LassoDiscoRemoveEntry; +typedef struct _LassoDiscoRemoveEntryClass LassoDiscoRemoveEntryClass; + +struct _LassoDiscoRemoveEntry { + LassoNode parent; + + char *entryID; +}; + +struct _LassoDiscoRemoveEntryClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_disco_remove_entry_get_type(void); +LASSO_EXPORT LassoDiscoRemoveEntry* lasso_disco_remove_entry_new(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DISCO_REMOVE_ENTRY_H__ */ diff --git a/lasso/xml/disco_resource_offering.c b/lasso/xml/disco_resource_offering.c new file mode 100644 index 00000000..a9c12901 --- /dev/null +++ b/lasso/xml/disco_resource_offering.c @@ -0,0 +1,158 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: Valery Febvre <vfebvre@easter-eggs.com> + * Nicolas Clapies <nclapies@entrouvert.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/disco_resource_offering.h> + +/* +Schema fragment (liberty-idwsf-disco-svc-v1.0.xsd): + +<xs:element name="ResourceOffering" type="ResourceOfferingType"/> +<xs:complexType name="ResourceOfferingType"> + <xs:sequence> + <xs:group ref="ResourceIDGroup"/> + <xs:element name="ServiceInstance" type="ServiceInstanceType"/> + <xs:element ref="Options" minOccurs="0"/> + <xs:element name="Abstract" type="xs:string" minOccurs="0"/> + </xs:sequence> + <xs:attribute name="entryID" type="IDType" use="optional"/> +</xs:complexType> + +<xs:group name="ResourceIDGroup"> + <xs:sequence> + <xs:choice minOccurs="0" maxOccurs="1"> + <xs:element ref="ResourceID"/> + <xs:element ref="EncryptedResourceID"/> + </xs:choice> + </xs:sequence> +</xs:group> + +Schema fragment (liberty-idwsf-utility-1.0-errata-v1.0.xsd) + +<xs:simpleType name="IDType"> + <xs:restriction base="xs:string"/> +</xs:simpleType> +*/ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +#define snippets() \ + LassoDiscoResourceOffering *resource = \ + LASSO_DISCO_RESOURCE_OFFERING(node); \ + struct XmlSnippet snippets[] = { \ + { "ResourceID", 'c', (void**)&(resource->ResourceID) }, \ + { "EncryptedResourceID", 'c', (void**)&(resource->EncryptedResourceID) }, \ + { "ServiceInstance", 'n', (void**)&(resource->ServiceInstance) }, \ + { "Options", 'n', (void**)&(resource->Options) }, \ + { "Abstract", 'c', (void**)&(resource->Abstract) }, \ + { NULL, 0, NULL} \ + }; + +static LassoNodeClass *parent_class = NULL; + +static xmlNode* +get_xmlNode(LassoNode *node) +{ + xmlNode *xmlnode; + snippets(); + + xmlnode = xmlNewNode(NULL, "InsertEntry"); + xmlNodeSetName(xmlnode, "ResourceOffering"); + xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_DISCO_HREF, LASSO_DISCO_PREFIX)); + lasso_node_build_xml_with_snippets(xmlnode, snippets); + if (resource->entryID) { + xmlSetProp(xmlnode, "entryID", resource->entryID); + } + + return xmlnode; +} + +static int +init_from_xml(LassoNode *node, xmlNode *xmlnode) +{ + snippets(); + + if (parent_class->init_from_xml(node, xmlnode)) { + return -1; + } + resource->entryID = xmlGetProp(xmlnode, "entryID"); + lasso_node_init_xml_with_snippets(xmlnode, snippets); + + return 0; +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoDiscoResourceOffering *node) +{ + node->ResourceID = NULL; + node->EncryptedResourceID = NULL; + node->ServiceInstance = NULL; + node->Options = NULL; + node->Abstract = NULL; + node->entryID = NULL; +} + +static void +class_init(LassoDiscoResourceOfferingClass *klass) +{ + parent_class = g_type_class_peek_parent(klass); + LASSO_NODE_CLASS(klass)->get_xmlNode = get_xmlNode; + LASSO_NODE_CLASS(klass)->init_from_xml = init_from_xml; +} + +GType +lasso_disco_resource_offering_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDiscoResourceOfferingClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDiscoResourceOffering), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDiscoResourceOffering", &this_info, 0); + } + return this_type; +} + +LassoDiscoResourceOffering* +lasso_disco_resource_offering_new() +{ + return g_object_new(LASSO_TYPE_DISCO_RESOURCE_OFFERING, NULL); +} diff --git a/lasso/xml/disco_resource_offering.h b/lasso/xml/disco_resource_offering.h new file mode 100644 index 00000000..54348eb1 --- /dev/null +++ b/lasso/xml/disco_resource_offering.h @@ -0,0 +1,73 @@ +/* $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_DISCO_RESOURCE_OFFERING_H__ +#define __LASSO_DISCO_RESOURCE_OFFERING_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> +#include <lasso/xml/disco_service_instance.h> +#include <lasso/xml/disco_options.h> + +#define LASSO_TYPE_DISCO_RESOURCE_OFFERING (lasso_disco_resource_offering_get_type()) +#define LASSO_DISCO_RESOURCE_OFFERING(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_DISCO_RESOURCE_OFFERING, LassoDiscoResourceOffering)) +#define LASSO_DISCO_RESOURCE_OFFERING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_DISCO_RESOURCE_OFFERING, LassoDiscoResourceOfferingClass)) +#define LASSO_IS_DISCO_RESOURCE_OFFERING(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_DISCO_RESOURCE_OFFERING)) +#define LASSO_IS_DISCO_RESOURCE_OFFERING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_DISCO_RESOURCE_OFFERING)) +#define LASSO_DISCO_RESOURCE_OFFERING_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_DISCO_RESOURCE_OFFERING, LassoDiscoResourceOfferingClass)) + +typedef struct _LassoDiscoResourceOffering LassoDiscoResourceOffering; +typedef struct _LassoDiscoResourceOfferingClass LassoDiscoResourceOfferingClass; + +struct _LassoDiscoResourceOffering { + LassoNode parent; + + /* elements */ + char *ResourceID; + char *EncryptedResourceID; + LassoDiscoServiceInstance *ServiceInstance; + LassoDiscoOptions *Options; + char *Abstract; + + /* attributes */ + char *entryID; +}; + +struct _LassoDiscoResourceOfferingClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_disco_resource_offering_get_type(void); + +LASSO_EXPORT LassoDiscoResourceOffering* lasso_disco_resource_offering_new(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DISCO_RESOURCE_OFFERING_H__ */ diff --git a/lasso/xml/disco_service_instance.c b/lasso/xml/disco_service_instance.c new file mode 100644 index 00000000..21c9bf7c --- /dev/null +++ b/lasso/xml/disco_service_instance.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: Valery Febvre <vfebvre@easter-eggs.com> + * Nicolas Clapies <nclapies@entrouvert.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/disco_service_instance.h> + +/* +Schema fragment (liberty-idwsf-disco-svc-v1.0.xsd): + +<xs:complexType name="ServiceInstanceType"> + <xs:sequence> + <xs:element ref="ServiceType"/> + <xs:element name="ProviderID" type="md:entityIDType"/> + <xs:element name="Description" type="DescriptionType" minOccurs="1" maxOccurs="unbounded"/> + </xs:sequence> +</xs:complexType> + +<xs:element name="ServiceType" type="xs:anyURI"/> +*/ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +#define snippets() \ + LassoDiscoServiceInstance *instance = \ + LASSO_DISCO_SERVICE_INSTANCE(node); \ + struct XmlSnippet snippets[] = { \ + { "ServiceType", 'c', (void**)&(instance->ServiceType) }, \ + { "ProviderID", 'c', (void**)&(instance->ProviderID) }, \ + { "Description", 's', (void**)&(instance->Description) }, \ + { NULL, 0, NULL} \ + }; + +static LassoNodeClass *parent_class = NULL; + +static xmlNode* +get_xmlNode(LassoNode *node) +{ + xmlNode *xmlnode; + snippets(); + + xmlnode = xmlNewNode(NULL, "ServiceInstance"); + xmlSetNs(xmlnode, xmlNewNs(xmlnode, LASSO_DISCO_HREF, LASSO_DISCO_PREFIX)); + lasso_node_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; + lasso_node_init_xml_with_snippets(xmlnode, snippets); + + return 0; +} + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoDiscoServiceInstance *node) +{ + node->ServiceType = NULL; + node->ProviderID = NULL; + node->Description = NULL; +} + +static void +class_init(LassoDiscoServiceInstanceClass *klass) +{ + parent_class = g_type_class_peek_parent(klass); + LASSO_NODE_CLASS(klass)->get_xmlNode = get_xmlNode; + LASSO_NODE_CLASS(klass)->init_from_xml = init_from_xml; +} + +GType +lasso_disco_service_instance_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoDiscoServiceInstanceClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoDiscoServiceInstance), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoDiscoServiceInstance", &this_info, 0); + } + return this_type; +} + +LassoDiscoServiceInstance* +lasso_disco_service_instance_new() +{ + return g_object_new(LASSO_TYPE_DISCO_SERVICE_INSTANCE, NULL); +} diff --git a/lasso/xml/disco_service_instance.h b/lasso/xml/disco_service_instance.h new file mode 100644 index 00000000..0a28ebf4 --- /dev/null +++ b/lasso/xml/disco_service_instance.h @@ -0,0 +1,66 @@ +/* $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_DISCO_SERVICE_INSTANCE_H__ +#define __LASSO_DISCO_SERVICE_INSTANCE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> +#include <lasso/xml/disco_description.h> + +#define LASSO_TYPE_DISCO_SERVICE_INSTANCE (lasso_disco_service_instance_get_type()) +#define LASSO_DISCO_SERVICE_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_DISCO_SERVICE_INSTANCE, LassoDiscoServiceInstance)) +#define LASSO_DISCO_SERVICE_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_DISCO_SERVICE_INSTANCE, LassoDiscoServiceInstanceClass)) +#define LASSO_IS_DISCO_SERVICE_INSTANCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_DISCO_SERVICE_INSTANCE)) +#define LASSO_IS_DISCO_SERVICE_INSTANCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_DISCO_SERVICE_INSTANCE)) +#define LASSO_DISCO_SERVICE_INSTANCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_DISCO_SERVICE_INSTANCE, LassoDiscoServiceInstanceClass)) + +typedef struct _LassoDiscoServiceInstance LassoDiscoServiceInstance; +typedef struct _LassoDiscoServiceInstanceClass LassoDiscoServiceInstanceClass; + +struct _LassoDiscoServiceInstance { + LassoNode parent; + + char *ServiceType; + char *ProviderID; + GList *Description; +}; + +struct _LassoDiscoServiceInstanceClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_disco_service_instance_get_type(void); + +LASSO_EXPORT LassoDiscoServiceInstance* lasso_disco_service_instance_new(void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_DISCO_SERVICE_INSTANCE_H__ */ |
