diff options
| author | Damien Laniel <dlaniel@entrouvert.com> | 2007-04-24 15:25:08 +0000 |
|---|---|---|
| committer | Damien Laniel <dlaniel@entrouvert.com> | 2007-04-24 15:25:08 +0000 |
| commit | 5c99d2ea80d0aade07462a8d3ee7e329a76e2c7a (patch) | |
| tree | 8e7a08e805c17fbdf72b53b1bfd2cd08064b015a /lasso/xml | |
| parent | fce9becb19dcf6501c760c952416654fb3920fad (diff) | |
| download | lasso-5c99d2ea80d0aade07462a8d3ee7e329a76e2c7a.tar.gz lasso-5c99d2ea80d0aade07462a8d3ee7e329a76e2c7a.tar.xz lasso-5c99d2ea80d0aade07462a8d3ee7e329a76e2c7a.zip | |
implemented discovery query
Diffstat (limited to 'lasso/xml')
| -rw-r--r-- | lasso/xml/id-wsf-2.0/Makefile.am | 2 | ||||
| -rw-r--r-- | lasso/xml/id-wsf-2.0/disco_query.c | 78 | ||||
| -rw-r--r-- | lasso/xml/id-wsf-2.0/disco_query.h | 45 | ||||
| -rw-r--r-- | lasso/xml/id-wsf-2.0/disco_query_response.c | 113 | ||||
| -rw-r--r-- | lasso/xml/id-wsf-2.0/disco_query_response.h | 55 | ||||
| -rw-r--r-- | lasso/xml/id-wsf-2.0/disco_requested_service.c | 153 | ||||
| -rw-r--r-- | lasso/xml/id-wsf-2.0/disco_requested_service.h | 91 | ||||
| -rw-r--r-- | lasso/xml/strings.h | 6 | ||||
| -rw-r--r-- | lasso/xml/ws/wsa_endpoint_reference.c | 10 | ||||
| -rw-r--r-- | lasso/xml/ws/wsa_endpoint_reference.h | 4 | ||||
| -rw-r--r-- | lasso/xml/xml.c | 10 |
11 files changed, 402 insertions, 165 deletions
diff --git a/lasso/xml/id-wsf-2.0/Makefile.am b/lasso/xml/id-wsf-2.0/Makefile.am index 679f331e..9e53299d 100644 --- a/lasso/xml/id-wsf-2.0/Makefile.am +++ b/lasso/xml/id-wsf-2.0/Makefile.am @@ -13,6 +13,7 @@ liblasso_xml_id_wsf2_la_SOURCES = \ disco_options.c \ disco_query.c \ disco_query_response.c \ + disco_requested_service.c \ disco_service_context.c \ disco_svc_metadata.c \ disco_svc_md_association_add.c \ @@ -30,6 +31,7 @@ liblassoinclude_HEADERS = \ disco_options.h \ disco_query.h \ disco_query_response.h \ + disco_requested_service.c \ disco_service_context.h \ disco_svc_metadata.h \ disco_svc_md_association_add.h \ diff --git a/lasso/xml/id-wsf-2.0/disco_query.c b/lasso/xml/id-wsf-2.0/disco_query.c index bf5c8955..caf5c524 100644 --- a/lasso/xml/id-wsf-2.0/disco_query.c +++ b/lasso/xml/id-wsf-2.0/disco_query.c @@ -1,8 +1,8 @@ -/* $Id: disco_query.c,v 1.7 2005/01/22 15:57:55 $ +/* $Id: disco_query.c,v 1.0 2005/10/14 15:17:55 fpeters Exp $ * * Lasso - A free implementation of the Liberty Alliance specifications. * - * Copyright (C) 2007 Entr'ouvert + * Copyright (C) 2004-2007 Entr'ouvert * http://lasso.entrouvert.org * * Authors: See AUTHORS file in top-level directory. @@ -22,38 +22,40 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <lasso/xml/id-wsf-2.0/disco_query.h> +#include "disco_query.h" /* - * Schema fragments (liberty-idwsf-disco-svc-v2.0.xsd) : - * - * <xs:element name="Query" type="QueryType"/> + * Schema fragment (liberty-idwsf-disco-svc-v2.0.xsd): * * <xs:complexType name="QueryType"> * <xs:sequence> * <xs:element name="RequestedService" - * type="RequestedServiceType" - * minOccurs="0" - * maxOccurs="unbounded"/> - * </xs:sequence> - * <xs:anyAttribute namespace="##other" processContents="lax"/> - * </xs:complexType> - */ + * type="RequestedServiceType" + * minOccurs="0" + * maxOccurs="unbounded"/> + * </xs:sequence> + * + * <xs:anyAttribute namespace="##other" processContents="lax"/> + * </xs:complexType> + */ /*****************************************************************************/ /* private methods */ /*****************************************************************************/ + static struct XmlSnippet schema_snippets[] = { -// { "ResourceID", SNIPPET_NODE, G_STRUCT_OFFSET(LassoIdWsf2DiscoQuery, ResourceID) }, -// { "EncryptedResourceID", -// SNIPPET_NODE, G_STRUCT_OFFSET(LassoIdWsf2DiscoQuery, EncryptedResourceID) }, -// { "RequestedServiceType", SNIPPET_LIST_NODES, -// G_STRUCT_OFFSET(LassoIdWsf2DiscoQuery, RequestedServiceType) }, - { "id", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoIdWsf2DiscoQuery, id) }, - { NULL, 0, 0} + { "RequestedService", SNIPPET_LIST_NODES, + G_STRUCT_OFFSET(LassoIdWsf2DiscoQuery, RequestedService), + "LassoIdWsf2DiscoRequestedService" }, + { "any", SNIPPET_ATTRIBUTE | SNIPPET_ANY, + G_STRUCT_OFFSET(LassoIdWsf2DiscoQuery, attributes) }, + {NULL, 0, 0} }; +static LassoNodeClass *parent_class = NULL; + + /*****************************************************************************/ /* instance and class init functions */ /*****************************************************************************/ @@ -61,10 +63,9 @@ static struct XmlSnippet schema_snippets[] = { static void instance_init(LassoIdWsf2DiscoQuery *node) { -// node->ResourceID = NULL; -// node->EncryptedResourceID = NULL; -// node->RequestedServiceType = NULL; - node->id = NULL; + node->RequestedService = NULL; + node->attributes = g_hash_table_new_full( + g_str_hash, g_str_equal, g_free, g_free); } static void @@ -72,6 +73,7 @@ class_init(LassoIdWsf2DiscoQueryClass *klass) { LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + parent_class = g_type_class_peek_parent(klass); nclass->node_data = g_new0(LassoNodeClassData, 1); lasso_node_class_set_nodename(nclass, "Query"); lasso_node_class_set_ns(nclass, LASSO_IDWSF2_DISCO_HREF, LASSO_IDWSF2_DISCO_PREFIX); @@ -102,25 +104,15 @@ lasso_idwsf2_disco_query_get_type() return this_type; } -LassoIdWsf2DiscoQuery* +/** + * lasso_idwsf2_disco_query_new: + * + * Creates a new #LassoIdWsf2DiscoQuery object. + * + * Return value: a newly created #LassoIdWsf2DiscoQuery object + **/ +LassoNode* lasso_idwsf2_disco_query_new() { - LassoIdWsf2DiscoQuery *node; - - node = g_object_new(LASSO_TYPE_IDWSF2_DISCO_QUERY, NULL); - - return node; -} - -LassoIdWsf2DiscoQuery* -lasso_idwsf2_disco_query_new_from_message(const gchar *message) -{ - LassoIdWsf2DiscoQuery *node; - - g_return_val_if_fail(message != NULL, NULL); - - node = g_object_new(LASSO_TYPE_IDWSF2_DISCO_QUERY, NULL); - lasso_node_init_from_message(LASSO_NODE(node), message); - - return node; + return g_object_new(LASSO_TYPE_IDWSF2_DISCO_QUERY, NULL); } diff --git a/lasso/xml/id-wsf-2.0/disco_query.h b/lasso/xml/id-wsf-2.0/disco_query.h index df6a6ac5..2285d5ee 100644 --- a/lasso/xml/id-wsf-2.0/disco_query.h +++ b/lasso/xml/id-wsf-2.0/disco_query.h @@ -1,8 +1,8 @@ -/* $Id: disco_query.h,v 1.8 2005/01/22 15:57:55 $ +/* $Id: disco_query.h,v 1.0 2005/10/14 15:17:55 fpeters Exp $ * * Lasso - A free implementation of the Liberty Alliance specifications. * - * Copyright (C) 2007 Entr'ouvert + * Copyright (C) 2004-2007 Entr'ouvert * http://lasso.entrouvert.org * * Authors: See AUTHORS file in top-level directory. @@ -27,43 +27,54 @@ #ifdef __cplusplus extern "C" { -#endif /* __cplusplus */ +#endif /* __cplusplus */ #include <lasso/xml/xml.h> -//#include <lasso/xml/disco_resource_id.h> -//#include <lasso/xml/disco_encrypted_resource_id.h> -//#include <lasso/xml/disco_requested_service_type.h> #define LASSO_TYPE_IDWSF2_DISCO_QUERY (lasso_idwsf2_disco_query_get_type()) -#define LASSO_IDWSF2_DISCO_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - LASSO_TYPE_IDWSF2_DISCO_QUERY, LassoIdWsf2DiscoQuery)) -#define LASSO_IDWSF2_DISCO_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ - LASSO_TYPE_IDWSF2_DISCO_QUERY, LassoIdWsf2DiscoQueryClass)) -#define LASSO_IS_IDWSF2_DISCO_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_IDWSF2_DISCO_QUERY)) +#define LASSO_IDWSF2_DISCO_QUERY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_IDWSF2_DISCO_QUERY, \ + LassoIdWsf2DiscoQuery)) +#define LASSO_IDWSF2_DISCO_QUERY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_IDWSF2_DISCO_QUERY, \ + LassoIdWsf2DiscoQueryClass)) +#define LASSO_IS_IDWSF2_DISCO_QUERY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + LASSO_TYPE_IDWSF2_DISCO_QUERY)) #define LASSO_IS_IDWSF2_DISCO_QUERY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass),LASSO_TYPE_IDWSF2_DISCO_QUERY)) + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + LASSO_TYPE_IDWSF2_DISCO_QUERY)) #define LASSO_IDWSF2_DISCO_QUERY_GET_CLASS(o) \ - (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_IDWSF2_DISCO_QUERY, LassoIdWsf2DiscoQueryClass)) + (G_TYPE_INSTANCE_GET_CLASS ((o), \ + LASSO_TYPE_IDWSF2_DISCO_QUERY, \ + LassoIdWsf2DiscoQueryClass)) + typedef struct _LassoIdWsf2DiscoQuery LassoIdWsf2DiscoQuery; typedef struct _LassoIdWsf2DiscoQueryClass LassoIdWsf2DiscoQueryClass; + struct _LassoIdWsf2DiscoQuery { LassoNode parent; -// GList *RequestedService; - gchar *id; + /*< public >*/ + /* elements */ + GList *RequestedService; /* of LassoIdWsf2DiscoRequestedService */ + /* attributes */ + GHashTable *attributes; }; + struct _LassoIdWsf2DiscoQueryClass { LassoNodeClass parent; }; LASSO_EXPORT GType lasso_idwsf2_disco_query_get_type(void); +LASSO_EXPORT LassoNode* lasso_idwsf2_disco_query_new(void); -LASSO_EXPORT LassoIdWsf2DiscoQuery* lasso_idwsf2_disco_query_new(void); -LASSO_EXPORT LassoIdWsf2DiscoQuery* lasso_idwsf2_disco_query_new_from_message(const gchar *message); #ifdef __cplusplus } diff --git a/lasso/xml/id-wsf-2.0/disco_query_response.c b/lasso/xml/id-wsf-2.0/disco_query_response.c index 7bda0c3e..49d4e2d8 100644 --- a/lasso/xml/id-wsf-2.0/disco_query_response.c +++ b/lasso/xml/id-wsf-2.0/disco_query_response.c @@ -1,8 +1,8 @@ -/* $Id: disco_query_response.c,v 1.9 2005/08/12 09:08:44$ +/* $Id: disco_query_response.c,v 1.0 2005/10/14 15:17:55 fpeters Exp $ * * Lasso - A free implementation of the Liberty Alliance specifications. * - * Copyright (C) 2007 Entr'ouvert + * Copyright (C) 2004-2007 Entr'ouvert * http://lasso.entrouvert.org * * Authors: See AUTHORS file in top-level directory. @@ -22,67 +22,42 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <lasso/xml/id-wsf-2.0/disco_query_response.h> +#include "disco_query_response.h" /* * Schema fragment (liberty-idwsf-disco-svc-v2.0.xsd): * - * <xs:element name="QueryResponse" type="QueryResponseType"/> - * * <xs:complexType name="QueryResponseType"> * <xs:sequence> * <xs:element ref="lu:Status"/> - * <xs:element ref="wsa:EndpointReference" - * minOccurs="0" - * maxOccurs="unbounded"/> - * </xs:sequence> - * <xs:anyAttribute namespace="##other" processContents="lax"/> - * </xs:complexType> + * + * <xs:element ref="wsa:EndpointReference" + * minOccurs="0" + * maxOccurs="unbounded"/> + * </xs:sequence> + * <xs:anyAttribute namespace="##other" processContents="lax"/> + * </xs:complexType> */ /*****************************************************************************/ /* private methods */ /*****************************************************************************/ + static struct XmlSnippet schema_snippets[] = { -// { "Status", SNIPPET_NODE, -// G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, Status) }, -// { "ResourceOffering", SNIPPET_LIST_NODES, -// G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, ResourceOffering) }, -// { "Credentials", SNIPPET_NODE, -// G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, Credentials) }, - { "id", SNIPPET_ATTRIBUTE, - G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, id) }, - { NULL, 0, 0} + { "Status", SNIPPET_NODE, + G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, Status), + "LassoIdWsf2UtilStatus" }, + { "EndpointReference", SNIPPET_LIST_NODES, + G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, EndpointReference), + "LassoWsAddrEndpointReference" }, + { "any", SNIPPET_ATTRIBUTE | SNIPPET_ANY, + G_STRUCT_OFFSET(LassoIdWsf2DiscoQueryResponse, attributes) }, + {NULL, 0, 0} }; static LassoNodeClass *parent_class = NULL; -static void -insure_namespace(xmlNode *xmlnode, xmlNs *ns) -{ - xmlNode *t = xmlnode->children; - - xmlSetNs(xmlnode, ns); - while (t) { - if (t->type == XML_ELEMENT_NODE && t->ns == NULL) - insure_namespace(t, ns); - t = t->next; - } -} - -static xmlNode* -get_xmlNode(LassoNode *node, gboolean lasso_dump) -{ - xmlNode *xmlnode; - xmlNs *ns; - - xmlnode = parent_class->get_xmlNode(node, lasso_dump); - ns = xmlNewNs(NULL, (xmlChar*)LASSO_IDWSF2_DISCO_HREF, (xmlChar*)LASSO_IDWSF2_DISCO_PREFIX); - insure_namespace(xmlnode, ns); - - return xmlnode; -} /*****************************************************************************/ /* instance and class init functions */ @@ -92,19 +67,17 @@ static void instance_init(LassoIdWsf2DiscoQueryResponse *node) { node->Status = NULL; -// node->ResourceOffering = NULL; -// node->Credentials = NULL; - - node->id = NULL; + node->EndpointReference = NULL; + node->attributes = g_hash_table_new_full( + g_str_hash, g_str_equal, g_free, g_free); } static void -class_init(LassoIdWsf2DiscoQueryResponseClass *class) +class_init(LassoIdWsf2DiscoQueryResponseClass *klass) { - LassoNodeClass *nclass = LASSO_NODE_CLASS(class); + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); - parent_class = g_type_class_peek_parent(class); - nclass->get_xmlNode = get_xmlNode; + parent_class = g_type_class_peek_parent(klass); nclass->node_data = g_new0(LassoNodeClassData, 1); lasso_node_class_set_nodename(nclass, "QueryResponse"); lasso_node_class_set_ns(nclass, LASSO_IDWSF2_DISCO_HREF, LASSO_IDWSF2_DISCO_PREFIX); @@ -135,29 +108,15 @@ lasso_idwsf2_disco_query_response_get_type() return this_type; } -LassoIdWsf2DiscoQueryResponse* -lasso_idwsf2_disco_query_response_new(LassoUtilityStatus *status) -{ - LassoIdWsf2DiscoQueryResponse *node; - - g_return_val_if_fail(LASSO_IS_UTILITY_STATUS(status), NULL); - - node = g_object_new(LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE, NULL); - - node->Status = status; - - return node; -} - -LassoIdWsf2DiscoQueryResponse* -lasso_idwsf2_disco_query_response_new_from_message(const gchar *message) +/** + * lasso_idwsf2_disco_query_response_new: + * + * Creates a new #LassoIdWsf2DiscoQueryResponse object. + * + * Return value: a newly created #LassoIdWsf2DiscoQueryResponse object + **/ +LassoNode* +lasso_idwsf2_disco_query_response_new() { - LassoIdWsf2DiscoQueryResponse *response; - - g_return_val_if_fail(message != NULL, NULL); - - response = g_object_new(LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE, NULL); - lasso_node_init_from_message(LASSO_NODE(response), message); - - return response; + return g_object_new(LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE, NULL); } diff --git a/lasso/xml/id-wsf-2.0/disco_query_response.h b/lasso/xml/id-wsf-2.0/disco_query_response.h index d26c97dc..15de70e2 100644 --- a/lasso/xml/id-wsf-2.0/disco_query_response.h +++ b/lasso/xml/id-wsf-2.0/disco_query_response.h @@ -1,8 +1,8 @@ -/* $Id: disco_query_response.h,v 1.5 2005/01/22 15:57:55 $ +/* $Id: disco_query_response.h,v 1.0 2005/10/14 15:17:55 fpeters Exp $ * * Lasso - A free implementation of the Liberty Alliance specifications. * - * Copyright (C) 2007 Entr'ouvert + * Copyright (C) 2004-2007 Entr'ouvert * http://lasso.entrouvert.org * * Authors: See AUTHORS file in top-level directory. @@ -27,48 +27,57 @@ #ifdef __cplusplus extern "C" { -#endif /* __cplusplus */ +#endif /* __cplusplus */ #include <lasso/xml/xml.h> -//#include <lasso/xml/disco_credentials.h> -#include <lasso/xml/utility_status.h> - -#define LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE (lasso_idwsf2_disco_query_response_get_type()) -#define LASSO_IDWSF2_DISCO_QUERY_RESPONSE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE, LassoIdWsf2DiscoQueryResponse)) -#define LASSO_IDWSF2_DISCO_QUERY_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ - LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE, LassoIdWsf2DiscoQueryResponseClass)) +#include "util_status.h" + +#define LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE \ + (lasso_idwsf2_disco_query_response_get_type()) +#define LASSO_IDWSF2_DISCO_QUERY_RESPONSE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE, \ + LassoIdWsf2DiscoQueryResponse)) +#define LASSO_IDWSF2_DISCO_QUERY_RESPONSE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE, \ + LassoIdWsf2DiscoQueryResponseClass)) #define LASSO_IS_IDWSF2_DISCO_QUERY_RESPONSE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE)) + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE)) #define LASSO_IS_IDWSF2_DISCO_QUERY_RESPONSE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE)) + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE)) #define LASSO_IDWSF2_DISCO_QUERY_RESPONSE_GET_CLASS(o) \ - (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE, \ - LassoIdWsf2DiscoQueryResponseClass)) + (G_TYPE_INSTANCE_GET_CLASS ((o), \ + LASSO_TYPE_IDWSF2_DISCO_QUERY_RESPONSE, \ + LassoIdWsf2DiscoQueryResponseClass)) + typedef struct _LassoIdWsf2DiscoQueryResponse LassoIdWsf2DiscoQueryResponse; typedef struct _LassoIdWsf2DiscoQueryResponseClass LassoIdWsf2DiscoQueryResponseClass; + struct _LassoIdWsf2DiscoQueryResponse { LassoNode parent; - LassoUtilityStatus *Status; -// GList *ResourceOffering; -// LassoIdWsf2DiscoCredentials *Credentials; - - char *id; + /*< public >*/ + /* elements */ + LassoIdWsf2UtilStatus *Status; + GList *EndpointReference; /* of LassoWsAddrEndpointReference */ + /* attributes */ + GHashTable *attributes; }; + struct _LassoIdWsf2DiscoQueryResponseClass { LassoNodeClass parent; }; LASSO_EXPORT GType lasso_idwsf2_disco_query_response_get_type(void); +LASSO_EXPORT LassoNode* lasso_idwsf2_disco_query_response_new(void); -LASSO_EXPORT LassoIdWsf2DiscoQueryResponse* lasso_idwsf2_disco_query_response_new(LassoUtilityStatus *status); -LASSO_EXPORT LassoIdWsf2DiscoQueryResponse* lasso_idwsf2_disco_query_response_new_from_message( - const gchar *message); #ifdef __cplusplus } diff --git a/lasso/xml/id-wsf-2.0/disco_requested_service.c b/lasso/xml/id-wsf-2.0/disco_requested_service.c new file mode 100644 index 00000000..bcf03a47 --- /dev/null +++ b/lasso/xml/id-wsf-2.0/disco_requested_service.c @@ -0,0 +1,153 @@ +/* $Id: disco_requested_service.c,v 1.0 2005/10/14 15:17:55 fpeters Exp $ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004-2007 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * 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 "disco_requested_service.h" + +/* + * Schema fragment (liberty-idwsf-disco-svc-v2.0.xsd): + * + * <xs:complexType name="RequestedServiceType"> + * <xs:sequence> + * <xs:element ref="ServiceType" minOccurs="0" maxOccurs="unbounded" /> + * + * <xs:element ref="ProviderID" minOccurs="0" maxOccurs="unbounded" /> + * + * <xs:element ref="Options" minOccurs="0" maxOccurs="unbounded"/> + * + * <xs:element ref="SecurityMechID" minOccurs="0" maxOccurs="unbounded"/> + * + * <xs:element ref="Framework" minOccurs="0" maxOccurs="unbounded"/> + * + * <xs:element ref="Action" minOccurs="0" maxOccurs="unbounded"/> + * + * <xs:any namespace="##other" + * processContents="lax" + * minOccurs="0" + * maxOccurs="unbounded"/> + * + * </xs:sequence> + * + * <xs:attribute name="reqID" type="xs:string" use="optional" /> + * <xs:attribute name="resultsType" type="xs:string" use="optional" /> + * + * </xs:complexType> + */ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + + +static struct XmlSnippet schema_snippets[] = { + { "ServiceType", SNIPPET_LIST_CONTENT, + G_STRUCT_OFFSET(LassoIdWsf2DiscoRequestedService, ServiceType) }, + { "ProviderID", SNIPPET_LIST_CONTENT, + G_STRUCT_OFFSET(LassoIdWsf2DiscoRequestedService, ProviderID) }, + { "Options", SNIPPET_LIST_NODES, + G_STRUCT_OFFSET(LassoIdWsf2DiscoRequestedService, Options), + "LassoIdWsf2DiscoOptions" }, + { "SecurityMechID", SNIPPET_LIST_CONTENT, + G_STRUCT_OFFSET(LassoIdWsf2DiscoRequestedService, SecurityMechID) }, + { "Framework", SNIPPET_LIST_NODES, + G_STRUCT_OFFSET(LassoIdWsf2DiscoRequestedService, Framework) }, + { "Action", SNIPPET_LIST_CONTENT, + G_STRUCT_OFFSET(LassoIdWsf2DiscoRequestedService, Action) }, + { "any", SNIPPET_NODE | SNIPPET_ANY, + G_STRUCT_OFFSET(LassoIdWsf2DiscoRequestedService, any) }, + { "reqID", SNIPPET_ATTRIBUTE, + G_STRUCT_OFFSET(LassoIdWsf2DiscoRequestedService, reqID) }, + { "resultsType", SNIPPET_ATTRIBUTE, + G_STRUCT_OFFSET(LassoIdWsf2DiscoRequestedService, resultsType) }, + {NULL, 0, 0} +}; + +static LassoNodeClass *parent_class = NULL; + + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoIdWsf2DiscoRequestedService *node) +{ + node->ServiceType = NULL; + node->ProviderID = NULL; + node->Options = NULL; + node->SecurityMechID = NULL; + node->Framework = NULL; + node->Action = NULL; + node->any = NULL; + node->reqID = NULL; + node->resultsType = NULL; +} + +static void +class_init(LassoIdWsf2DiscoRequestedServiceClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + parent_class = g_type_class_peek_parent(klass); + nclass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nclass, "RequestedService"); + lasso_node_class_set_ns(nclass, LASSO_IDWSF2_DISCO_HREF, LASSO_IDWSF2_DISCO_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); +} + +GType +lasso_idwsf2_disco_requested_service_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoIdWsf2DiscoRequestedServiceClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoIdWsf2DiscoRequestedService), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoIdWsf2DiscoRequestedService", &this_info, 0); + } + return this_type; +} + +/** + * lasso_idwsf2_disco_requested_service_new: + * + * Creates a new #LassoIdWsf2DiscoRequestedService object. + * + * Return value: a newly created #LassoIdWsf2DiscoRequestedService object + **/ +LassoNode* +lasso_idwsf2_disco_requested_service_new() +{ + return g_object_new(LASSO_TYPE_IDWSF2_DISCO_REQUESTED_SERVICE, NULL); +} diff --git a/lasso/xml/id-wsf-2.0/disco_requested_service.h b/lasso/xml/id-wsf-2.0/disco_requested_service.h new file mode 100644 index 00000000..098dffee --- /dev/null +++ b/lasso/xml/id-wsf-2.0/disco_requested_service.h @@ -0,0 +1,91 @@ +/* $Id: disco_requested_service.h,v 1.0 2005/10/14 15:17:55 fpeters Exp $ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004-2007 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * 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_IDWSF2_DISCO_REQUESTED_SERVICE_H__ +#define __LASSO_IDWSF2_DISCO_REQUESTED_SERVICE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_IDWSF2_DISCO_REQUESTED_SERVICE \ + (lasso_idwsf2_disco_requested_service_get_type()) +#define LASSO_IDWSF2_DISCO_REQUESTED_SERVICE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_IDWSF2_DISCO_REQUESTED_SERVICE, \ + LassoIdWsf2DiscoRequestedService)) +#define LASSO_IDWSF2_DISCO_REQUESTED_SERVICE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_IDWSF2_DISCO_REQUESTED_SERVICE, \ + LassoIdWsf2DiscoRequestedServiceClass)) +#define LASSO_IS_IDWSF2_DISCO_REQUESTED_SERVICE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + LASSO_TYPE_IDWSF2_DISCO_REQUESTED_SERVICE)) +#define LASSO_IS_IDWSF2_DISCO_REQUESTED_SERVICE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + LASSO_TYPE_IDWSF2_DISCO_REQUESTED_SERVICE)) +#define LASSO_IDWSF2_DISCO_REQUESTED_SERVICE_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), \ + LASSO_TYPE_IDWSF2_DISCO_REQUESTED_SERVICE, \ + LassoIdWsf2DiscoRequestedServiceClass)) + + +typedef struct _LassoIdWsf2DiscoRequestedService LassoIdWsf2DiscoRequestedService; +typedef struct _LassoIdWsf2DiscoRequestedServiceClass LassoIdWsf2DiscoRequestedServiceClass; + + +struct _LassoIdWsf2DiscoRequestedService { + LassoNode parent; + + /*< public >*/ + /* elements */ + GList *ServiceType; + GList *ProviderID; + GList *Options; /* of LassoIdWsf2DiscoOptions */ + GList *SecurityMechID; + GList *Framework; + GList *Action; + LassoNode *any; + /* attributes */ + char *reqID; + char *resultsType; +}; + + +struct _LassoIdWsf2DiscoRequestedServiceClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_idwsf2_disco_requested_service_get_type(void); +LASSO_EXPORT LassoNode* lasso_idwsf2_disco_requested_service_new(void); + + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_IDWSF2_DISCO_REQUESTED_SERVICE_H__ */ diff --git a/lasso/xml/strings.h b/lasso/xml/strings.h index 5bab31f6..4aeaf5db 100644 --- a/lasso/xml/strings.h +++ b/lasso/xml/strings.h @@ -474,6 +474,12 @@ #define LASSO_IDWSF2_DISCO_HREF "urn:liberty:disco:2006-08" #define LASSO_IDWSF2_DISCO_PREFIX "disco" +#define LASSO_EP_HREF "urn:liberty:id-sis-ep:2003-08" +#define LASSO_EP_PREFIX "ep" + +#define LASSO_PP_HREF "urn:liberty:id-sis-pp:2003-08" +#define LASSO_PP_PREFIX "pp" + #define LASSO_IDWSF2_DST_HREF "urn:liberty:dst:2006-08" #define LASSO_IDWSF2_DST_PREFIX "dst" diff --git a/lasso/xml/ws/wsa_endpoint_reference.c b/lasso/xml/ws/wsa_endpoint_reference.c index 9c91cd19..1474661e 100644 --- a/lasso/xml/ws/wsa_endpoint_reference.c +++ b/lasso/xml/ws/wsa_endpoint_reference.c @@ -39,6 +39,16 @@ */ /*****************************************************************************/ +/* public methods */ +/*****************************************************************************/ + +void +lasso_wsa_endpoint_reference_destroy(LassoWsAddrEndpointReference *epr) +{ + lasso_node_destroy(LASSO_NODE(epr)); +} + +/*****************************************************************************/ /* private methods */ /*****************************************************************************/ diff --git a/lasso/xml/ws/wsa_endpoint_reference.h b/lasso/xml/ws/wsa_endpoint_reference.h index bf2eb8fa..6bc6e1bf 100644 --- a/lasso/xml/ws/wsa_endpoint_reference.h +++ b/lasso/xml/ws/wsa_endpoint_reference.h @@ -70,11 +70,11 @@ struct _LassoWsAddrEndpointReferenceClass { LassoNodeClass parent; }; +void lasso_wsa_endpoint_reference_destroy(LassoWsAddrEndpointReference *epr); + LASSO_EXPORT GType lasso_wsa_endpoint_reference_get_type(void); LASSO_EXPORT LassoNode* lasso_wsa_endpoint_reference_new(void); - - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c index 0caa83f4..edc9b2a8 100644 --- a/lasso/xml/xml.c +++ b/lasso/xml/xml.c @@ -2197,7 +2197,8 @@ static void xmlUseNsDef(xmlNs *ns, xmlNode *node) { xmlNode *t; - xmlNs *ns2, *ns3; + xmlNs *ns2; + xmlNs *ns3 = NULL; if (sameNs(ns, node->ns)) { node->ns = ns; @@ -2215,11 +2216,14 @@ xmlUseNsDef(xmlNs *ns, xmlNode *node) } else if (node->nsDef) { for (ns2 = node->nsDef; ns2->next; ns2 = ns2->next) { if (sameNs(ns2->next, ns)) { - ns3 = ns2; ns2->next = ns2->next->next; - xmlFreeNs(ns3); + if (ns3 != NULL) { + xmlFreeNs(ns3); + } + ns3 = ns2; } } + /* FIXME : memory leak : ns3 should be freed here */ } } |
