diff options
| author | Nicolas Clapies <nclapies@entrouvert.com> | 2005-03-02 08:23:09 +0000 |
|---|---|---|
| committer | Nicolas Clapies <nclapies@entrouvert.com> | 2005-03-02 08:23:09 +0000 |
| commit | dafcd5d41e66a95c342a8e036b02d805227df80d (patch) | |
| tree | ca15a0c6f0416a982bc70012170c4f985709ef63 | |
| parent | 3a8676512506f19018170eb0bd3b7934a581700f (diff) | |
Added soap envelope and soap binding. It is useful for id-wsf but could be used in other parts later.
| -rw-r--r-- | lasso/xml/Makefile.am | 8 | ||||
| -rw-r--r-- | lasso/xml/soap_binding_correlation.c | 131 | ||||
| -rw-r--r-- | lasso/xml/soap_binding_correlation.h | 78 | ||||
| -rw-r--r-- | lasso/xml/soap_body.c | 120 | ||||
| -rw-r--r-- | lasso/xml/soap_body.h | 69 | ||||
| -rw-r--r-- | lasso/xml/soap_envelope.c | 111 | ||||
| -rw-r--r-- | lasso/xml/soap_envelope.h | 71 | ||||
| -rw-r--r-- | lasso/xml/soap_header.c | 107 | ||||
| -rw-r--r-- | lasso/xml/soap_header.h | 68 | ||||
| -rw-r--r-- | lasso/xml/strings.h | 4 | ||||
| -rw-r--r-- | lasso/xml/xml.c | 4 |
11 files changed, 770 insertions, 1 deletions
diff --git a/lasso/xml/Makefile.am b/lasso/xml/Makefile.am index a2a042ba..35faf6de 100644 --- a/lasso/xml/Makefile.am +++ b/lasso/xml/Makefile.am @@ -95,6 +95,10 @@ liblasso_xml_la_SOURCES = \ samlp_response_abstract.c \ samlp_status.c \ samlp_status_code.c \ + soap_binding_correlation.c \ + soap_body.c \ + soap_envelope.c \ + soap_header.c \ utility_status.c liblassoinclude_HEADERS = \ @@ -184,6 +188,10 @@ liblassoinclude_HEADERS = \ samlp_response_abstract.h \ samlp_status.h \ samlp_status_code.h \ + soap_binding_correlation.h \ + soap_body.h \ + soap_envelope.h \ + soap_header.h \ utility_status.h lasso_private_h_sources = \ diff --git a/lasso/xml/soap_binding_correlation.c b/lasso/xml/soap_binding_correlation.c new file mode 100644 index 00000000..b50ac11b --- /dev/null +++ b/lasso/xml/soap_binding_correlation.c @@ -0,0 +1,131 @@ +/* $Id$ + * + * 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/soap_binding_correlation.h> + +/* + * Schema fragments (liberty-idwsf-soap-binding-v1.1.xsd): + * <xs:complexType name="correlationType"> + * <xs:attribute name="messageID" type="IDType" use="required"/> + * <xs:attribute name="refToMessageID" type="IDType" use="optional"/> + * <xs:attribute name="timestamp" type="xs: dateTime" use="required"/> + * <xs:attribute name="id" type="xs:ID" use="optional"/> + * <xs:attribute ref="S:mustUnderstand" use="optional"/> + * <xs:attribute ref="S:actor" use="optional"/> + * </xs:complexType> + */ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "messageID", SNIPPET_ATTRIBUTE, + G_STRUCT_OFFSET(LassoSoapBindingCorrelation, messageID) }, + { "refToMessageID", SNIPPET_ATTRIBUTE, + G_STRUCT_OFFSET(LassoSoapBindingCorrelation, refToMessageID) }, + { "timestamp", SNIPPET_ATTRIBUTE, + G_STRUCT_OFFSET(LassoSoapBindingCorrelation, timestamp) }, + { "id", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoSoapBindingCorrelation, id) }, + { "mustUnderstand", SNIPPET_ATTRIBUTE, + G_STRUCT_OFFSET(LassoSoapBindingCorrelation, mustUnderstand) }, + { "actor", SNIPPET_ATTRIBUTE, G_STRUCT_OFFSET(LassoSoapBindingCorrelation, actor) }, + { NULL, 0, 0} +}; + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoSoapBindingCorrelation *node) +{ + node->messageID = NULL; + node->refToMessageID = NULL; + node->timestamp = NULL; + node->id = NULL; + node->mustUnderstand = NULL; + node->actor = NULL; +} + +static void +class_init(LassoSoapBindingCorrelationClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + nclass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nclass, "Correlation"); + lasso_node_class_set_ns(nclass, LASSO_SOAP_BINDING_HREF, LASSO_SOAP_BINDING_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); +} + +GType +lasso_soap_binding_correlation_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoSoapBindingCorrelationClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoSoapBindingCorrelation), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoSoapBindingCorrelation", &this_info, 0); + } + return this_type; +} + +LassoSoapBindingCorrelation* +lasso_soap_binding_correlation_new(const gchar *messageId, const gchar *timestamp) +{ + LassoSoapBindingCorrelation *node; + + node = g_object_new(LASSO_TYPE_SOAP_BINDING_CORRELATION, NULL); + + node->messageID = g_strdup(messageId); + node->timestamp = g_strdup(timestamp); + + return node; +} + +LassoSoapBindingCorrelation* +lasso_soap_binding_correlation_new_from_message(const gchar *message) +{ + LassoSoapBindingCorrelation *node; + + g_return_val_if_fail(message != NULL, NULL); + + node = g_object_new(LASSO_TYPE_SOAP_BINDING_CORRELATION, NULL); + lasso_node_init_from_message(LASSO_NODE(node), message); + + return node; +} diff --git a/lasso/xml/soap_binding_correlation.h b/lasso/xml/soap_binding_correlation.h new file mode 100644 index 00000000..bf488421 --- /dev/null +++ b/lasso/xml/soap_binding_correlation.h @@ -0,0 +1,78 @@ +/* $Id$ + * + * 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_SOAP_BINDING_CORRELATION_H__ +#define __LASSO_SOAP_BINDING_CORRELATION_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_SOAP_BINDING_CORRELATION (lasso_soap_binding_correlation_get_type()) +#define LASSO_SOAP_BINDING_CORRELATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_SOAP_BINDING_CORRELATION, LassoSoapBindingCorrelation)) +#define LASSO_SOAP_BINDING_CORRELATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_SOAP_BINDING_CORRELATION, LassoSoapBindingCorrelationClass)) +#define LASSO_IS_SOAP_BINDING_CORRELATION(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SOAP_BINDING_CORRELATION)) +#define LASSO_IS_SOAP_BINDING_CORRELATION_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass),LASSO_TYPE_SOAP_BINDING_CORRELATION)) +#define LASSO_SOAP_BINDING_CORRELATION_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), \ + LASSO_TYPE_SOAP_BINDING_CORRELATION, LassoSoapBindingCorrelationClass)) + +typedef struct _LassoSoapBindingCorrelation LassoSoapBindingCorrelation; +typedef struct _LassoSoapBindingCorrelationClass LassoSoapBindingCorrelationClass; + +struct _LassoSoapBindingCorrelation { + LassoNode parent; + + gchar *messageID; + gchar *refToMessageID; + gchar *timestamp; + gchar *id; + gchar *mustUnderstand; + gchar *actor; +}; + +struct _LassoSoapBindingCorrelationClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_soap_binding_correlation_get_type(void); + +LASSO_EXPORT LassoSoapBindingCorrelation* lasso_soap_binding_correlation_new( + const gchar *messageId, + const gchar *timestamp); + +LASSO_EXPORT LassoSoapBindingCorrelation* lasso_soap_binding_correlation_new_from_message( + const gchar *message); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_SOAP_BINDING_CORRELATION_H__ */ diff --git a/lasso/xml/soap_body.c b/lasso/xml/soap_body.c new file mode 100644 index 00000000..4e55227f --- /dev/null +++ b/lasso/xml/soap_body.c @@ -0,0 +1,120 @@ +/* $Id$ + * + * 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/soap_body.h> + +/* + * Schema fragments (http://www.w3.org/2001/06/soap-envelope): + * + * <xs:element name="Body" type="tns:Body"/> + * <xs:complexType name="Body"> + * <xs:sequence> + * <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/> + * </xs:sequence> + * <xs:anyAttribute namespace="##any" processContents="lax"> + * <xs:annotation> + * <xs:documentation> + * Prose in the spec does not specify that attributes are allowed on the Body element + * </xs:documentation> + * </xs:annotation> + * </xs:anyAttribute> + * </xs:complexType> + */ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "", SNIPPET_LIST_NODES, G_STRUCT_OFFSET(LassoSoapBody, Any) }, + { NULL, 0, 0} +}; + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoSoapBody *node) +{ + node->Any = NULL; +} + +static void +class_init(LassoSoapBodyClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + nclass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nclass, "Body"); + lasso_node_class_set_ns(nclass, LASSO_SOAP_ENV_HREF, LASSO_SOAP_ENV_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); +} + +GType +lasso_soap_body_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoSoapBodyClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoSoapBody), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoSoapBody", &this_info, 0); + } + return this_type; +} + +LassoSoapBody* +lasso_soap_body_new() +{ + LassoSoapBody *node; + + node = g_object_new(LASSO_TYPE_SOAP_BODY, NULL); + + return node; +} + +LassoSoapBody* +lasso_soap_body_new_from_message(const gchar *message) +{ + LassoSoapBody *node; + + g_return_val_if_fail(message != NULL, NULL); + + node = g_object_new(LASSO_TYPE_SOAP_BODY, NULL); + lasso_node_init_from_message(LASSO_NODE(node), message); + + return node; +} diff --git a/lasso/xml/soap_body.h b/lasso/xml/soap_body.h new file mode 100644 index 00000000..8eff9830 --- /dev/null +++ b/lasso/xml/soap_body.h @@ -0,0 +1,69 @@ +/* $Id$ + * + * 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_SOAP_BODY_H__ +#define __LASSO_SOAP_BODY_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_SOAP_BODY (lasso_soap_body_get_type()) +#define LASSO_SOAP_BODY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_SOAP_BODY, LassoSoapBody)) +#define LASSO_SOAP_BODY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_SOAP_BODY, LassoSoapBodyClass)) +#define LASSO_IS_SOAP_BODY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SOAP_BODY)) +#define LASSO_IS_SOAP_BODY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass),LASSO_TYPE_SOAP_BODY)) +#define LASSO_SOAP_BODY_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SOAP_BODY, LassoSoapBodyClass)) + +typedef struct _LassoSoapBody LassoSoapBody; +typedef struct _LassoSoapBodyClass LassoSoapBodyClass; + +struct _LassoSoapBody { + LassoNode parent; + + GList *Any; + /* TODO : supports of any attributes */ +}; + +struct _LassoSoapBodyClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_soap_body_get_type(void); + +LASSO_EXPORT LassoSoapBody* lasso_soap_body_new(void); + +LASSO_EXPORT LassoSoapBody* lasso_soap_body_new_from_message(const gchar *message); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_SOAP_BODY_H__ */ diff --git a/lasso/xml/soap_envelope.c b/lasso/xml/soap_envelope.c new file mode 100644 index 00000000..aa463b36 --- /dev/null +++ b/lasso/xml/soap_envelope.c @@ -0,0 +1,111 @@ +/* $Id$ + * + * 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/soap_envelope.h> + +/* + * Schema fragments (): + * + */ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "Header", SNIPPET_NODE, G_STRUCT_OFFSET(LassoSoapEnvelope, Header) }, + { "Body", SNIPPET_NODE, G_STRUCT_OFFSET(LassoSoapEnvelope, Body) }, + { NULL, 0, 0} +}; + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoSoapEnvelope *node) +{ + node->Body = NULL; + node->Header = NULL; +} + +static void +class_init(LassoSoapEnvelopeClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + nclass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nclass, "Envelope"); + lasso_node_class_set_ns(nclass, LASSO_SOAP_ENV_HREF, LASSO_SOAP_ENV_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); +} + +GType +lasso_soap_envelope_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoSoapEnvelopeClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoSoapEnvelope), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoSoapEnvelope", &this_info, 0); + } + return this_type; +} + +LassoSoapEnvelope* +lasso_soap_envelope_new(LassoSoapBody *body) +{ + LassoSoapEnvelope *node; + + node = g_object_new(LASSO_TYPE_SOAP_ENVELOPE, NULL); + + node->Body = body; + + return node; +} + +LassoSoapEnvelope* +lasso_soap_envelope_new_from_message(const gchar *message) +{ + LassoSoapEnvelope *node; + + g_return_val_if_fail(message != NULL, NULL); + + node = g_object_new(LASSO_TYPE_SOAP_ENVELOPE, NULL); + lasso_node_init_from_message(LASSO_NODE(node), message); + + return node; +} diff --git a/lasso/xml/soap_envelope.h b/lasso/xml/soap_envelope.h new file mode 100644 index 00000000..fcbed37c --- /dev/null +++ b/lasso/xml/soap_envelope.h @@ -0,0 +1,71 @@ +/* $Id$ + * + * 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_SOAP_ENVELOPE_H__ +#define __LASSO_SOAP_ENVELOPE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> +#include <lasso/xml/soap_body.h> +#include <lasso/xml/soap_header.h> + +#define LASSO_TYPE_SOAP_ENVELOPE (lasso_soap_envelope_get_type()) +#define LASSO_SOAP_ENVELOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_SOAP_ENVELOPE, LassoSoapEnvelope)) +#define LASSO_SOAP_ENVELOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_SOAP_ENVELOPE, LassoSoapEnvelopeClass)) +#define LASSO_IS_SOAP_ENVELOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SOAP_ENVELOPE)) +#define LASSO_IS_SOAP_ENVELOPE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass),LASSO_TYPE_SOAP_ENVELOPE)) +#define LASSO_SOAP_ENVELOPE_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SOAP_ENVELOPE, LassoSoapEnvelopeClass)) + +typedef struct _LassoSoapEnvelope LassoSoapEnvelope; +typedef struct _LassoSoapEnvelopeClass LassoSoapEnvelopeClass; + +struct _LassoSoapEnvelope { + LassoNode parent; + + LassoSoapHeader *Header; + LassoSoapBody *Body; +}; + +struct _LassoSoapEnvelopeClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_soap_envelope_get_type(void); + +LASSO_EXPORT LassoSoapEnvelope* lasso_soap_envelope_new(LassoSoapBody *body); + +LASSO_EXPORT LassoSoapEnvelope* lasso_soap_envelope_new_from_message(const gchar *message); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_SOAP_ENVELOPE_H__ */ diff --git a/lasso/xml/soap_header.c b/lasso/xml/soap_header.c new file mode 100644 index 00000000..0ff1d376 --- /dev/null +++ b/lasso/xml/soap_header.c @@ -0,0 +1,107 @@ +/* $Id$ + * + * 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/soap_header.h> + +/* + * Schema fragments (http://www.w3.org/2001/06/soap-envelope): + * + */ + +/*****************************************************************************/ +/* private methods */ +/*****************************************************************************/ + +static struct XmlSnippet schema_snippets[] = { + { "", SNIPPET_LIST_NODES, G_STRUCT_OFFSET(LassoSoapHeader, Other) }, + { NULL, 0, 0} +}; + +/*****************************************************************************/ +/* instance and class init functions */ +/*****************************************************************************/ + +static void +instance_init(LassoSoapHeader *node) +{ + node->Other = NULL; +} + +static void +class_init(LassoSoapHeaderClass *klass) +{ + LassoNodeClass *nclass = LASSO_NODE_CLASS(klass); + + nclass->node_data = g_new0(LassoNodeClassData, 1); + lasso_node_class_set_nodename(nclass, "Header"); + lasso_node_class_set_ns(nclass, LASSO_SOAP_ENV_HREF, LASSO_SOAP_ENV_PREFIX); + lasso_node_class_add_snippets(nclass, schema_snippets); +} + +GType +lasso_soap_header_get_type() +{ + static GType this_type = 0; + + if (!this_type) { + static const GTypeInfo this_info = { + sizeof (LassoSoapHeaderClass), + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof(LassoSoapHeader), + 0, + (GInstanceInitFunc) instance_init, + }; + + this_type = g_type_register_static(LASSO_TYPE_NODE, + "LassoSoapHeader", &this_info, 0); + } + return this_type; +} + +LassoSoapHeader* +lasso_soap_header_new() +{ + LassoSoapHeader *node; + + node = g_object_new(LASSO_TYPE_SOAP_HEADER, NULL); + + return node; +} + +LassoSoapHeader* +lasso_soap_header_new_from_message(const gchar *message) +{ + LassoSoapHeader *node; + + g_return_val_if_fail(message != NULL, NULL); + + node = g_object_new(LASSO_TYPE_SOAP_HEADER, NULL); + lasso_node_init_from_message(LASSO_NODE(node), message); + + return node; +} diff --git a/lasso/xml/soap_header.h b/lasso/xml/soap_header.h new file mode 100644 index 00000000..0495fec6 --- /dev/null +++ b/lasso/xml/soap_header.h @@ -0,0 +1,68 @@ +/* $Id$ + * + * 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_SOAP_HEADER_H__ +#define __LASSO_SOAP_HEADER_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <lasso/xml/xml.h> + +#define LASSO_TYPE_SOAP_HEADER (lasso_soap_header_get_type()) +#define LASSO_SOAP_HEADER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + LASSO_TYPE_SOAP_HEADER, LassoSoapHeader)) +#define LASSO_SOAP_HEADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), \ + LASSO_TYPE_SOAP_HEADER, LassoSoapHeaderClass)) +#define LASSO_IS_SOAP_HEADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SOAP_HEADER)) +#define LASSO_IS_SOAP_HEADER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass),LASSO_TYPE_SOAP_HEADER)) +#define LASSO_SOAP_HEADER_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SOAP_HEADER, LassoSoapHeaderClass)) + +typedef struct _LassoSoapHeader LassoSoapHeader; +typedef struct _LassoSoapHeaderClass LassoSoapHeaderClass; + +struct _LassoSoapHeader { + LassoNode parent; + + GList *Other; +}; + +struct _LassoSoapHeaderClass { + LassoNodeClass parent; +}; + +LASSO_EXPORT GType lasso_soap_header_get_type(void); + +LASSO_EXPORT LassoSoapHeader* lasso_soap_header_new(void); + +LASSO_EXPORT LassoSoapHeader* lasso_soap_header_new_from_message(const gchar *message); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LASSO_SOAP_HEADER_H__ */ diff --git a/lasso/xml/strings.h b/lasso/xml/strings.h index e50b5f7b..1563fb1b 100644 --- a/lasso/xml/strings.h +++ b/lasso/xml/strings.h @@ -255,10 +255,12 @@ /* SOAP */ /*****************************************************************************/ -/* prefix & href */ #define LASSO_SOAP_ENV_HREF "http://schemas.xmlsoap.org/soap/envelope/" #define LASSO_SOAP_ENV_PREFIX "soap-env" +#define LASSO_SOAP_BINDING_HREF "urn:liberty:sb:2003-08" +#define LASSO_SOAP_BINDING_PREFIX "soap-binding" + /*****************************************************************************/ /* Others */ /*****************************************************************************/ diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c index fff3453e..361ea2bc 100644 --- a/lasso/xml/xml.c +++ b/lasso/xml/xml.c @@ -721,6 +721,10 @@ lasso_node_new_from_xmlNode(xmlNode *xmlnode) return NULL; } + if (strcmp(xmlnode->ns->href, LASSO_SOAP_ENV_HREF) == 0) + prefix = "Soap"; + if (strcmp(xmlnode->ns->href, LASSO_SOAP_BINDING_HREF) == 0) + prefix = "SoapBinding"; if (strcmp(xmlnode->ns->href, LASSO_DISCO_HREF) == 0) prefix = "Disco"; if (strcmp(xmlnode->ns->href, LASSO_LIB_HREF) == 0) |
