diff options
| author | Damien Laniel <dlaniel@entrouvert.com> | 2007-04-19 16:33:52 +0000 |
|---|---|---|
| committer | Damien Laniel <dlaniel@entrouvert.com> | 2007-04-19 16:33:52 +0000 |
| commit | 5bdab807c421c8e084952af64c005f8384b27e27 (patch) | |
| tree | 40313283497926fefa2ad19ca6547c51e42ca2a1 | |
| parent | 4b75639c20a9e8dd8d2a427954f0f0275889bdaf (diff) | |
| download | lasso-5bdab807c421c8e084952af64c005f8384b27e27.tar.gz lasso-5bdab807c421c8e084952af64c005f8384b27e27.tar.xz lasso-5bdab807c421c8e084952af64c005f8384b27e27.zip | |
Build a Disco EPR within saml 2 login assertion
| -rw-r--r-- | lasso/id-ff/identity.c | 39 | ||||
| -rw-r--r-- | lasso/id-wsf-2.0/discovery.c | 5 | ||||
| -rw-r--r-- | lasso/id-wsf-2.0/wsf2_profile.h | 12 | ||||
| -rw-r--r-- | lasso/saml-2.0/login.c | 42 | ||||
| -rw-r--r-- | lasso/xml/id-wsf-2.0/Makefile.am | 6 | ||||
| -rw-r--r-- | lasso/xml/id-wsf-2.0/disco_abstract.c | 97 | ||||
| -rw-r--r-- | lasso/xml/id-wsf-2.0/disco_abstract.h | 69 | ||||
| -rw-r--r-- | lasso/xml/id-wsf-2.0/disco_providerid.c | 98 | ||||
| -rw-r--r-- | lasso/xml/id-wsf-2.0/disco_providerid.h | 70 | ||||
| -rw-r--r-- | lasso/xml/id-wsf-2.0/disco_service_type.c | 98 | ||||
| -rw-r--r-- | lasso/xml/id-wsf-2.0/disco_service_type.h | 70 | ||||
| -rw-r--r-- | lasso/xml/ws/wsa_attributed_uri.c | 2 | ||||
| -rw-r--r-- | lasso/xml/ws/wsa_metadata.c | 1 | ||||
| -rw-r--r-- | lasso/xml/ws/wsa_metadata.h | 4 |
14 files changed, 585 insertions, 28 deletions
diff --git a/lasso/id-ff/identity.c b/lasso/id-ff/identity.c index 16f295bd..c9234d47 100644 --- a/lasso/id-ff/identity.c +++ b/lasso/id-ff/identity.c @@ -228,26 +228,27 @@ lasso_identity_add_svc_metadata(LassoIdentity *identity, LassoIdWsf2DiscoSvcMeta return 0; } -/* GList* */ -/* lasso_identity_get_svc_metadatas(LassoIdentity *identity, const char *service_type) */ -/* { */ -/* GList *iter; */ -/* LassoIdWsf2DiscoSvcMetadata *t; */ -/* GList *result = NULL; */ -/* */ -/* iter = identity->private_data->svc_metadatas; */ -/* while (iter) { */ -/* t = iter->data; */ -/* iter = g_list_next(iter); */ -/* if (service_type == NULL || (t->ServiceContext && strcmp( */ -/* t->ServiceContext->ServiceType, service_type) == 0)) { */ -/* result = g_list_append(result, g_object_ref(t)); */ -/* } */ -/* } */ - -/* return result; */ -/* } */ +GList* +lasso_identity_get_svc_metadatas(LassoIdentity *identity, const char *service_type) +{ + GList *iter; + LassoIdWsf2DiscoSvcMetadata *t; + GList *result = NULL; + + g_return_val_if_fail(LASSO_IS_IDENTITY(identity), NULL); + + iter = identity->private_data->svcMD; + while (iter) { + t = iter->data; + iter = g_list_next(iter); + if (service_type == NULL || (t->ServiceContext && strcmp( + t->ServiceContext->ServiceType, service_type) == 0)) { + result = g_list_append(result, g_object_ref(t)); + } + } + return result; +} #endif diff --git a/lasso/id-wsf-2.0/discovery.c b/lasso/id-wsf-2.0/discovery.c index eae1adfb..430bb500 100644 --- a/lasso/id-wsf-2.0/discovery.c +++ b/lasso/id-wsf-2.0/discovery.c @@ -40,8 +40,9 @@ #include <lasso/id-ff/providerprivate.h> #include <lasso/id-wsf-2.0/discovery.h> -#include <lasso/id-wsf-2.0/wsf2_profile_private.h> +#include <lasso/id-wsf-2.0/wsf2_profile.h> #include <lasso/id-wsf-2.0/server.h> +#include <lasso/id-wsf-2.0/identity.h> struct _LassoIdWsf2DiscoveryPrivate { @@ -174,7 +175,6 @@ lasso_idwsf2_discovery_process_metadata_register_response_msg(LassoIdWsf2Discove const gchar *message) { LassoIdWsf2DiscoSvcMDRegisterResponse *response; - LassoSoapEnvelope *envelope; int res = 0; g_return_val_if_fail(LASSO_IS_IDWSF2_DISCOVERY(discovery), @@ -284,7 +284,6 @@ lasso_idwsf2_discovery_process_metadata_association_add_response_msg( LassoIdWsf2Discovery *discovery, const gchar *message) { LassoIdWsf2DiscoSvcMDAssociationAddResponse *response; - LassoSoapEnvelope *envelope; int res = 0; g_return_val_if_fail(LASSO_IS_IDWSF2_DISCOVERY(discovery), diff --git a/lasso/id-wsf-2.0/wsf2_profile.h b/lasso/id-wsf-2.0/wsf2_profile.h index 4d6fc561..117d6755 100644 --- a/lasso/id-wsf-2.0/wsf2_profile.h +++ b/lasso/id-wsf-2.0/wsf2_profile.h @@ -78,6 +78,8 @@ struct _LassoWsf2ProfileClass { LASSO_EXPORT GType lasso_wsf2_profile_get_type(void); +LASSO_EXPORT LassoWsf2Profile* lasso_wsf2_profile_new(LassoServer *server); + LASSO_EXPORT LassoIdentity* lasso_wsf2_profile_get_identity(LassoWsf2Profile *profile); LASSO_EXPORT LassoSession* lasso_wsf2_profile_get_session(LassoWsf2Profile *profile); LASSO_EXPORT gboolean lasso_wsf2_profile_is_identity_dirty(LassoWsf2Profile *profile); @@ -86,9 +88,9 @@ LASSO_EXPORT gint lasso_wsf2_profile_set_identity_from_dump(LassoWsf2Profile *pr const gchar *dump); LASSO_EXPORT gint lasso_wsf2_profile_set_session_from_dump(LassoWsf2Profile *profile, const gchar *dump); - -/* LASSO_EXPORT LassoSoapEnvelope* lasso_wsf2_profile_build_soap_envelope(const char *refToMessageId, */ -/* const char *providerId); */ + +LASSO_EXPORT gint lasso_wsf2_profile_init_soap_request(LassoWsf2Profile *profile, + LassoNode *request); LASSO_EXPORT gint lasso_wsf2_profile_build_soap_request_msg(LassoWsf2Profile *profile); @@ -100,6 +102,10 @@ LASSO_EXPORT gint lasso_wsf2_profile_build_soap_response_msg(LassoWsf2Profile *p LASSO_EXPORT gint lasso_wsf2_profile_process_soap_response_msg(LassoWsf2Profile *profile, const gchar *message); +/* Private method */ +LassoSoapEnvelope* lasso_wsf2_profile_build_soap_envelope(const char *refToMessageId, + const char *providerId); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/lasso/saml-2.0/login.c b/lasso/saml-2.0/login.c index 8d82837b..33ae164c 100644 --- a/lasso/saml-2.0/login.c +++ b/lasso/saml-2.0/login.c @@ -50,7 +50,12 @@ #include <lasso/xml/saml-2.0/saml2_attribute_value.h> #ifdef LASSO_WSF_ENABLED +#include <lasso/id-wsf-2.0/identity.h> #include <lasso/xml/ws/wsa_endpoint_reference.h> +#include <lasso/xml/id-wsf-2.0/disco_svc_metadata.h> +#include <lasso/xml/id-wsf-2.0/disco_abstract.h> +#include <lasso/xml/id-wsf-2.0/disco_providerid.h> +#include <lasso/xml/id-wsf-2.0/disco_service_type.h> #endif static int lasso_saml20_login_process_federation(LassoLogin *login, gboolean is_consent_obtained); @@ -590,18 +595,51 @@ static void lasso_saml20_login_assertion_add_discovery(LassoLogin *login, LassoSaml2Assertion *assertion) { #ifdef LASSO_WSF_ENABLED + GList *svcMDs; + LassoIdWsf2DiscoSvcMetadata *svcMD; LassoWsAddrEndpointReference *epr; LassoWsAddrMetadata *metadata; LassoSaml2AttributeStatement *attributeStatement; LassoSaml2Attribute *attribute; LassoSaml2AttributeValue *attributeValue; + svcMDs = lasso_identity_get_svc_metadatas(LASSO_PROFILE(login)->identity, + LASSO_IDWSF2_DISCO_HREF); + if (svcMDs == NULL) { + return; + } + + /* FIXME : foreach on the whole list and build on epr for each svcMD */ + svcMD = svcMDs->data; + + if (svcMD == NULL || svcMD->ServiceContext == NULL + || svcMD->ServiceContext->EndpointContext == NULL) { + return; + } + /* Build EndpointReference */ epr = LASSO_WSA_ENDPOINT_REFERENCE(lasso_wsa_endpoint_reference_new()); - + + epr->Address = LASSO_WSA_ATTRIBUTED_URI(lasso_wsa_attributed_uri_new_with_string( + svcMD->ServiceContext->EndpointContext->Address)); + metadata = LASSO_WSA_METADATA(lasso_wsa_metadata_new()); - + + /* Abstract */ + metadata->any = g_list_append(metadata->any, + lasso_idwsf2_disco_abstract_new_with_content(svcMD->Abstract)); + /* ProviderID */ + metadata->any = g_list_append(metadata->any, + lasso_idwsf2_disco_providerid_new_with_content(svcMD->ProviderID)); + /* ServiceType */ + metadata->any = g_list_append(metadata->any, + lasso_idwsf2_disco_service_type_new_with_content( + svcMD->ServiceContext->ServiceType)); + /* Framework */ + metadata->any = g_list_append(metadata->any, + g_object_ref(svcMD->ServiceContext->EndpointContext->Framework)); + epr->Metadata = metadata; /* Add the EPR to the assertion as a SAML attribute */ diff --git a/lasso/xml/id-wsf-2.0/Makefile.am b/lasso/xml/id-wsf-2.0/Makefile.am index e8fe4a1c..679f331e 100644 --- a/lasso/xml/id-wsf-2.0/Makefile.am +++ b/lasso/xml/id-wsf-2.0/Makefile.am @@ -19,6 +19,9 @@ liblasso_xml_id_wsf2_la_SOURCES = \ disco_svc_md_association_add_response.c \ disco_svc_md_register.c \ disco_svc_md_register_response.c \ + disco_abstract.c \ + disco_providerid.c \ + disco_service_type.c \ soap_binding_framework.c \ util_status.c @@ -33,5 +36,8 @@ liblassoinclude_HEADERS = \ disco_svc_md_association_add_response.h \ disco_svc_md_register.h \ disco_svc_md_register_response.h \ + disco_abstract.h \ + disco_providerid.h \ + disco_service_type.h \ soap_binding_framework.h \ util_status.h diff --git a/lasso/xml/id-wsf-2.0/disco_abstract.c b/lasso/xml/id-wsf-2.0/disco_abstract.c new file mode 100644 index 00000000..a0ebf602 --- /dev/null +++ b/lasso/xml/id-wsf-2.0/disco_abstract.c @@ -0,0 +1,97 @@ +/* $Id: disco_abstract.c 2183 2005-01-22 15:57:56 dlaniel $ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004, 2005 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 <lasso/xml/id-wsf-2.0/disco_abstract.h> + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "content", SNIPPET_TEXT_CHILD, G_STRUCT_OFFSET(LassoIdWsf2DiscoAbstract, content) }, + { NULL, 0, 0} +}; + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoIdWsf2DiscoAbstract *node) +{ + node->content = NULL; +} + +static void +class_init(LassoIdWsf2DiscoAbstractClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + nclass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nclass, "Abstract"); + 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_abstract_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoIdWsf2DiscoAbstractClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoIdWsf2DiscoAbstract), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoIdWsf2DiscoAbstract", &this_info, 0); + } + return this_type; +} + +LassoIdWsf2DiscoAbstract* +lasso_idwsf2_disco_abstract_new() +{ + return LASSO_IDWSF2_DISCO_ABSTRACT(g_object_new(LASSO_TYPE_IDWSF2_DISCO_ABSTRACT, NULL)); +} + +LassoIdWsf2DiscoAbstract* +lasso_idwsf2_disco_abstract_new_with_content(gchar *content) +{ + LassoIdWsf2DiscoAbstract *idwsf2_disco_abstract = LASSO_IDWSF2_DISCO_ABSTRACT( + g_object_new(LASSO_TYPE_IDWSF2_DISCO_ABSTRACT, NULL)); + + idwsf2_disco_abstract->content = g_strdup(content); + + return idwsf2_disco_abstract; +} diff --git a/lasso/xml/id-wsf-2.0/disco_abstract.h b/lasso/xml/id-wsf-2.0/disco_abstract.h new file mode 100644 index 00000000..e7857d81 --- /dev/null +++ b/lasso/xml/id-wsf-2.0/disco_abstract.h @@ -0,0 +1,69 @@ +/* $Id: disco_abstract.h 2183 2005-01-22 15:57:56Z dlaniel $ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004, 2005 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_ABSTRACT_H__ +#define __LASSO_IDWSF2_DISCO_ABSTRACT_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_IDWSF2_DISCO_ABSTRACT (lasso_idwsf2_disco_abstract_get_type()) +#define LASSO_IDWSF2_DISCO_ABSTRACT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_IDWSF2_DISCO_ABSTRACT, LassoIdWsf2DiscoAbstract)) +#define LASSO_IDWSF2_DISCO_ABSTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_IDWSF2_DISCO_ABSTRACT, LassoIdWsf2DiscoAbstractClass)) +#define LASSO_IS_IDWSF2_DISCO_ABSTRACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + LASSO_TYPE_IDWSF2_DISCO_ABSTRACT)) +#define LASSO_IS_IDWSF2_DISCO_ABSTRACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + LASSO_TYPE_IDWSF2_DISCO_ABSTRACT)) +#define LASSO_IDWSF2_DISCO_ABSTRACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \ + LASSO_TYPE_IDWSF2_DISCO_ABSTRACT, LassoIdWsf2DiscoAbstractClass)) + +typedef struct _LassoIdWsf2DiscoAbstract LassoIdWsf2DiscoAbstract; +typedef struct _LassoIdWsf2DiscoAbstractClass LassoIdWsf2DiscoAbstractClass; + +struct _LassoIdWsf2DiscoAbstract { + LassoNode parent; + + gchar *content; +}; + +struct _LassoIdWsf2DiscoAbstractClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_idwsf2_disco_abstract_get_type(void); + +LASSO_EXPORT LassoIdWsf2DiscoAbstract* lasso_idwsf2_disco_abstract_new(void); + +LASSO_EXPORT LassoIdWsf2DiscoAbstract* lasso_idwsf2_disco_abstract_new_with_content(gchar *content); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_IDWSF2_DISCO_ABSTRACT_H__ */ diff --git a/lasso/xml/id-wsf-2.0/disco_providerid.c b/lasso/xml/id-wsf-2.0/disco_providerid.c new file mode 100644 index 00000000..df64bd97 --- /dev/null +++ b/lasso/xml/id-wsf-2.0/disco_providerid.c @@ -0,0 +1,98 @@ +/* $Id: disco_providerid.c 2183 2005-01-22 15:57:56 dlaniel $ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004, 2005 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 <lasso/xml/id-wsf-2.0/disco_providerid.h> + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "content", SNIPPET_TEXT_CHILD, G_STRUCT_OFFSET(LassoIdWsf2DiscoProviderID, content) }, + { NULL, 0, 0} +}; + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoIdWsf2DiscoProviderID *node) +{ + node->content = NULL; +} + +static void +class_init(LassoIdWsf2DiscoProviderIDClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + nclass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nclass, "ProviderID"); + 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_providerid_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoIdWsf2DiscoProviderIDClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoIdWsf2DiscoProviderID), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoIdWsf2DiscoProviderID", &this_info, 0); + } + return this_type; +} + +LassoIdWsf2DiscoProviderID* +lasso_idwsf2_disco_providerid_new() +{ + return LASSO_IDWSF2_DISCO_PROVIDERID(g_object_new( + LASSO_TYPE_IDWSF2_DISCO_PROVIDERID, NULL)); +} + +LassoIdWsf2DiscoProviderID* +lasso_idwsf2_disco_providerid_new_with_content(gchar *content) +{ + LassoIdWsf2DiscoProviderID *idwsf2_disco_providerid = LASSO_IDWSF2_DISCO_PROVIDERID( + g_object_new(LASSO_TYPE_IDWSF2_DISCO_PROVIDERID, NULL)); + + idwsf2_disco_providerid->content = g_strdup(content); + + return idwsf2_disco_providerid; +} diff --git a/lasso/xml/id-wsf-2.0/disco_providerid.h b/lasso/xml/id-wsf-2.0/disco_providerid.h new file mode 100644 index 00000000..43b37dda --- /dev/null +++ b/lasso/xml/id-wsf-2.0/disco_providerid.h @@ -0,0 +1,70 @@ +/* $Id: disco_providerid.h 2183 2005-01-22 15:57:56Z dlaniel $ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004, 2005 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_PROVIDERID_H__ +#define __LASSO_IDWSF2_DISCO_PROVIDERID_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_IDWSF2_DISCO_PROVIDERID (lasso_idwsf2_disco_providerid_get_type()) +#define LASSO_IDWSF2_DISCO_PROVIDERID(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_IDWSF2_DISCO_PROVIDERID, LassoIdWsf2DiscoProviderID)) +#define LASSO_IDWSF2_DISCO_PROVIDERID_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_IDWSF2_DISCO_PROVIDERID, LassoIdWsf2DiscoProviderIDClass)) +#define LASSO_IS_IDWSF2_DISCO_PROVIDERID(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + LASSO_TYPE_IDWSF2_DISCO_PROVIDERID)) +#define LASSO_IS_IDWSF2_DISCO_PROVIDERID_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + LASSO_TYPE_IDWSF2_DISCO_PROVIDERID)) +#define LASSO_IDWSF2_DISCO_PROVIDERID_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \ + LASSO_TYPE_IDWSF2_DISCO_PROVIDERID, LassoIdWsf2DiscoProviderIDClass)) + +typedef struct _LassoIdWsf2DiscoProviderID LassoIdWsf2DiscoProviderID; +typedef struct _LassoIdWsf2DiscoProviderIDClass LassoIdWsf2DiscoProviderIDClass; + +struct _LassoIdWsf2DiscoProviderID { + LassoNode parent; + + gchar *content; +}; + +struct _LassoIdWsf2DiscoProviderIDClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_idwsf2_disco_providerid_get_type(void); + +LASSO_EXPORT LassoIdWsf2DiscoProviderID* lasso_idwsf2_disco_providerid_new(void); + +LASSO_EXPORT LassoIdWsf2DiscoProviderID* + lasso_idwsf2_disco_providerid_new_with_content(gchar *content); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_IDWSF2_DISCO_PROVIDERID_H__ */ diff --git a/lasso/xml/id-wsf-2.0/disco_service_type.c b/lasso/xml/id-wsf-2.0/disco_service_type.c new file mode 100644 index 00000000..eeef0c62 --- /dev/null +++ b/lasso/xml/id-wsf-2.0/disco_service_type.c @@ -0,0 +1,98 @@ +/* $Id: disco_service_type.c 2183 2005-01-22 15:57:56 dlaniel $ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004, 2005 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 <lasso/xml/id-wsf-2.0/disco_service_type.h> + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "content", SNIPPET_TEXT_CHILD, G_STRUCT_OFFSET(LassoIdWsf2DiscoServiceType, content) }, + { NULL, 0, 0} +}; + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoIdWsf2DiscoServiceType *node) +{ + node->content = NULL; +} + +static void +class_init(LassoIdWsf2DiscoServiceTypeClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + nclass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nclass, "ServiceType"); + 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_service_type_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoIdWsf2DiscoServiceTypeClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoIdWsf2DiscoServiceType), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoIdWsf2DiscoServiceType", &this_info, 0); + } + return this_type; +} + +LassoIdWsf2DiscoServiceType* +lasso_idwsf2_disco_service_type_new() +{ + return LASSO_IDWSF2_DISCO_SERVICE_TYPE(g_object_new( + LASSO_TYPE_IDWSF2_DISCO_SERVICE_TYPE, NULL)); +} + +LassoIdWsf2DiscoServiceType* +lasso_idwsf2_disco_service_type_new_with_content(gchar *content) +{ + LassoIdWsf2DiscoServiceType *idwsf2_disco_service_type = LASSO_IDWSF2_DISCO_SERVICE_TYPE( + g_object_new(LASSO_TYPE_IDWSF2_DISCO_SERVICE_TYPE, NULL)); + + idwsf2_disco_service_type->content = g_strdup(content); + + return idwsf2_disco_service_type; +} diff --git a/lasso/xml/id-wsf-2.0/disco_service_type.h b/lasso/xml/id-wsf-2.0/disco_service_type.h new file mode 100644 index 00000000..c9054f9c --- /dev/null +++ b/lasso/xml/id-wsf-2.0/disco_service_type.h @@ -0,0 +1,70 @@ +/* $Id: disco_service_type.h 2183 2005-01-22 15:57:56Z dlaniel $ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004, 2005 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_SERVICE_TYPE_H__ +#define __LASSO_IDWSF2_DISCO_SERVICE_TYPE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_IDWSF2_DISCO_SERVICE_TYPE (lasso_idwsf2_disco_service_type_get_type()) +#define LASSO_IDWSF2_DISCO_SERVICE_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_IDWSF2_DISCO_SERVICE_TYPE, LassoIdWsf2DiscoServiceType)) +#define LASSO_IDWSF2_DISCO_SERVICE_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_IDWSF2_DISCO_SERVICE_TYPE, LassoIdWsf2DiscoServiceTypeClass)) +#define LASSO_IS_IDWSF2_DISCO_SERVICE_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ + LASSO_TYPE_IDWSF2_DISCO_SERVICE_TYPE)) +#define LASSO_IS_IDWSF2_DISCO_SERVICE_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + LASSO_TYPE_IDWSF2_DISCO_SERVICE_TYPE)) +#define LASSO_IDWSF2_DISCO_SERVICE_TYPE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), \ + LASSO_TYPE_IDWSF2_DISCO_SERVICE_TYPE, LassoIdWsf2DiscoServiceTypeClass)) + +typedef struct _LassoIdWsf2DiscoServiceType LassoIdWsf2DiscoServiceType; +typedef struct _LassoIdWsf2DiscoServiceTypeClass LassoIdWsf2DiscoServiceTypeClass; + +struct _LassoIdWsf2DiscoServiceType { + LassoNode parent; + + gchar *content; +}; + +struct _LassoIdWsf2DiscoServiceTypeClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_idwsf2_disco_service_type_get_type(void); + +LASSO_EXPORT LassoIdWsf2DiscoServiceType* lasso_idwsf2_disco_service_type_new(void); + +LASSO_EXPORT LassoIdWsf2DiscoServiceType* + lasso_idwsf2_disco_service_type_new_with_content(gchar *content); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_IDWSF2_DISCO_SERVICE_TYPE_H__ */ diff --git a/lasso/xml/ws/wsa_attributed_uri.c b/lasso/xml/ws/wsa_attributed_uri.c index 2b45b89b..3ddf53e6 100644 --- a/lasso/xml/ws/wsa_attributed_uri.c +++ b/lasso/xml/ws/wsa_attributed_uri.c @@ -42,7 +42,7 @@ static struct XmlSnippet schema_snippets[] = { - { "content", SNIPPET_CONTENT, + { "content", SNIPPET_TEXT_CHILD, G_STRUCT_OFFSET(LassoWsAddrAttributedURI, content) }, { "any", SNIPPET_ATTRIBUTE | SNIPPET_ANY, G_STRUCT_OFFSET(LassoWsAddrAttributedURI, attributes) }, diff --git a/lasso/xml/ws/wsa_metadata.c b/lasso/xml/ws/wsa_metadata.c index 3b69bae9..563949f9 100644 --- a/lasso/xml/ws/wsa_metadata.c +++ b/lasso/xml/ws/wsa_metadata.c @@ -41,6 +41,7 @@ static struct XmlSnippet schema_snippets[] = { + { "", SNIPPET_LIST_NODES, G_STRUCT_OFFSET(LassoWsAddrMetadata, any) }, { "any", SNIPPET_ATTRIBUTE | SNIPPET_ANY, G_STRUCT_OFFSET(LassoWsAddrMetadata, attributes) }, {NULL, 0, 0} diff --git a/lasso/xml/ws/wsa_metadata.h b/lasso/xml/ws/wsa_metadata.h index 44abb2b8..057cd91b 100644 --- a/lasso/xml/ws/wsa_metadata.h +++ b/lasso/xml/ws/wsa_metadata.h @@ -54,6 +54,10 @@ struct _LassoWsAddrMetadata { LassoNode parent; /*< public >*/ + + /* elements */ + GList *any; + /* attributes */ GHashTable *attributes; }; |
