diff options
| author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2008-08-01 14:06:45 +0000 |
|---|---|---|
| committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2008-08-01 14:06:45 +0000 |
| commit | bfe206c67f8a6fa50cb75320045ef0c580dbf834 (patch) | |
| tree | 7750b5903525ce2405655e7112cc771e61c2b09f | |
| parent | 30b937c092d9718813982c1a57b0cdb90e78fc57 (diff) | |
| download | lasso-bfe206c67f8a6fa50cb75320045ef0c580dbf834.tar.gz lasso-bfe206c67f8a6fa50cb75320045ef0c580dbf834.tar.xz lasso-bfe206c67f8a6fa50cb75320045ef0c580dbf834.zip | |
add soap binding util function to lookup specific SOAP header for ID-WSF SOAP encapsulation
| -rw-r--r-- | lasso/Makefile.am | 4 | ||||
| -rw-r--r-- | lasso/soap_binding.c | 46 | ||||
| -rw-r--r-- | lasso/soap_binding.h | 43 |
3 files changed, 91 insertions, 2 deletions
diff --git a/lasso/Makefile.am b/lasso/Makefile.am index 7d586bfa..c7527915 100644 --- a/lasso/Makefile.am +++ b/lasso/Makefile.am @@ -16,10 +16,10 @@ lasso.rc.lo: $(top_srcdir)/win32/lasso.rc lib_LTLIBRARIES = liblasso.la -liblassoinclude_HEADERS = export.h lasso.h lasso_config.h errors.h +liblassoinclude_HEADERS = export.h lasso.h lasso_config.h errors.h soap_binding.h BUILT_SOURCES = types.c errors.c symbols.sym -liblasso_la_SOURCES = lasso.c errors.c +liblasso_la_SOURCES = lasso.c errors.c soap_binding.c if WSF_ENABLED SYMBOLS_ARGS = -wsf diff --git a/lasso/soap_binding.c b/lasso/soap_binding.c new file mode 100644 index 00000000..3265d022 --- /dev/null +++ b/lasso/soap_binding.c @@ -0,0 +1,46 @@ + +#include <lasso/soap_binding.h> + + +static LassoSoapHeader * +lasso_soap_binding_get_header( + +#define find_node_type_in_list(iter, check) \ + { while (iter && ! check(iter->data)) \ + iter = iter->next; } + +/** Look up the sb:Provider header in the SOAP message envelope. + * + * @envelope a LassoSoapEnvelope + * @return NULL if no Provider element is present in the header of the SOAP envelope. If found it returns a reference you do not own. */ +LassoSoapBindingProvider* +lasso_soap_binding_get_provider(LassoSoapEnvelope *envelope) { + g_return_val_if_fail(envelope, NULL); + + if (envelope->Header) { + GList *iter = envelop->Header->Other; + find_node_type_in_list(iter, LASSO_IS_SOAP_BINDING_PROVIDER); + if (iter) { + return LASSO_SOAP_BINDING_PROVIDER(iter->data); + } + } + return NULL; +} + +/** Look up the sb:Correlation header in the SOAP message envelope. + * + * @envelope a LassoSoapEnvelope + * @return NULL if no Correlation element is present in the header of the SOAP envelope. If found it returns a reference you do not own. */ +LassoSoapBindingCorrelation* +lasso_soap_binding_get_correlation(LassoSoapEnvelope *evelope) { + g_return_val_if_fail(envelope, NULL); + + if (envelope->Header) { + GList *iter = envelop->Header->Other; + find_node_type_in_list(iter, LASSO_IS_SOAP_BINDING_CORRELATION); + if (iter) { + return LASSO_SOAP_BINDING_CORRELATION(iter->data); + } + } + return NULL; +} diff --git a/lasso/soap_binding.h b/lasso/soap_binding.h new file mode 100644 index 00000000..529edc50 --- /dev/null +++ b/lasso/soap_binding.h @@ -0,0 +1,43 @@ +/* $Id$ + * + * 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_SOAP_BINDING_H__ +#define __LASSO_SOAP_BINDING_H__ + +#include <lasso/xml/soap_binding_provider.h> +#include <lasso/xml/soap_binding_correlation.h> +#include <lasso/xml/soap_envelope.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +LASSO_EXPORT LassoSoapBindingProvider* lasso_soap_binding_get_provider(LassoSoapEnvelope *envelope); + +LASSO_EXPORT LassoSoapBindingCorrelation* lasso_soap_binding_get_correlation(LassoSoapEnvelope *evelope); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* __LASSO_SOAP_BINDING_H__ */ |
