lasso/lasso/xml/xml.h

175 lines
5.7 KiB
C
Raw Normal View History

2008-09-12 17:06:58 +02:00
/* $Id$
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
2007-05-30 19:17:45 +02:00
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
2008-09-12 17:06:58 +02:00
*
2005-01-22 16:57:56 +01:00
* 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.
2008-09-12 17:06:58 +02:00
*
* 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.
2008-09-12 17:06:58 +02:00
*
* 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_XML_H__
#define __LASSO_XML_H__
#ifdef __cplusplus
extern "C" {
2004-05-25 15:21:49 +02:00
#endif /* __cplusplus */
2004-11-16 16:40:43 +01:00
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <glib/gprintf.h>
#include <libxml/uri.h>
#include <libxml/tree.h>
#include "../export.h"
#include "../errors.h"
#include "strings.h"
#define LASSO_TYPE_NODE (lasso_node_get_type())
#define LASSO_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_NODE, LassoNode))
#define LASSO_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_NODE, LassoNodeClass))
#define LASSO_IS_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_NODE))
#define LASSO_IS_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_NODE))
2004-11-25 23:25:51 +01:00
#define LASSO_NODE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_NODE, LassoNodeClass))
2005-02-21 15:21:52 +01:00
/**
* LassoMessageFormat::
2005-02-21 15:28:52 +01:00
* @LASSO_MESSAGE_FORMAT_ERROR: error while determining format
2005-02-21 15:21:52 +01:00
* @LASSO_MESSAGE_FORMAT_UNKNOWN: unknown format
* @LASSO_MESSAGE_FORMAT_XML: XML
* @LASSO_MESSAGE_FORMAT_BASE64: base-64 encoded
* @LASSO_MESSAGE_FORMAT_QUERY: query string
* @LASSO_MESSAGE_FORMAT_SOAP: SOAP
*
2005-02-21 15:28:52 +01:00
* Return code for lasso_node_init_from_message; it describes the type of the
* message that was passed to that function.
2005-02-21 15:21:52 +01:00
**/
2004-07-09 18:25:08 +02:00
typedef enum {
LASSO_MESSAGE_FORMAT_XSCHEMA_ERROR = -2,
LASSO_MESSAGE_FORMAT_ERROR = -1,
LASSO_MESSAGE_FORMAT_UNKNOWN,
LASSO_MESSAGE_FORMAT_XML,
LASSO_MESSAGE_FORMAT_BASE64,
LASSO_MESSAGE_FORMAT_QUERY,
LASSO_MESSAGE_FORMAT_SOAP
} LassoMessageFormat;
2004-07-09 18:25:08 +02:00
2005-02-21 15:21:52 +01:00
/**
* LassoSignatureType::
* @LASSO_SIGNATURE_TYPE_NONE: no signature
Docs: change the doc production and lot of other fixes * lasso/Makefile.am: distribute extract_sections.py * docs/references/lasso/lasso.types.in: add missing class (mainly SAML2 and ID-WSF 1.0/2.0) from docs/references/lasso.types.in * lasso/xml/strings.h: add lots of documentation, or at least documentation template to strings constants. * id-ff/login.h: * saml-2.0/assertion_query.h: * xml/xml.h: document undocumented enumerations. * lasso/errors.h: add proper documentation about error codes. * lasso/errors.c: new version of the lasso_strerror function * lasso/build_strerror.py: update the script that generater lasso_strerror from the documentation comments. Remove usage of OFTYPE * lasso/id-ff/session.c: * lasso/id-ff/session.h: remove usage of oftype, prefer gtk-introspection annotations instead. * lasso/id-wsf/data_service.h: * lasso/id-wsf/data_service.c: do the same. Add a script to build lasso-sections.txt * lasso/extract_sections.py: this script parses header files and generated lasso-sections.txt content for GObject class descriptions. Add a template file for the lasso-section.txt file * docs/references/lasso-sections.txt.in: this file serves as a base for the generation of lasso-sections.txt Update docs/references/Makefile.am for generating lasso-sections.txt * docs/references/Makefile.am: always rebuild template, using out of source build directory is too weird without it. call new script extract_sections.py to regenerate lasso-sections.txt if header files changed. Update lasso.sgml file with all missing sections * docs/reference/lasso.sgml: add all missing sections, mainly objects from XML schemas. * docs/reference/lasso-sections.txt: update it * *.c: add section documentation to some files. * lasso/xml/strings.h: fix bad usage or docbook markup
2009-08-26 17:15:07 +02:00
* @LASSO_SIGNATURE_TYPE_SIMPLE: sign with the private key, copy the public part in the signature.
* @LASSO_SIGNATURE_TYPE_WITHX509: sign with the private key, copy the associated certificat in the
* signature.
2005-02-21 15:21:52 +01:00
*
* Signature type.
**/
typedef enum {
LASSO_SIGNATURE_TYPE_NONE = 0,
LASSO_SIGNATURE_TYPE_SIMPLE,
LASSO_SIGNATURE_TYPE_WITHX509
} LassoSignatureType;
2005-02-21 15:21:52 +01:00
/**
* LassoSignatureMethod::
Docs: change the doc production and lot of other fixes * lasso/Makefile.am: distribute extract_sections.py * docs/references/lasso/lasso.types.in: add missing class (mainly SAML2 and ID-WSF 1.0/2.0) from docs/references/lasso.types.in * lasso/xml/strings.h: add lots of documentation, or at least documentation template to strings constants. * id-ff/login.h: * saml-2.0/assertion_query.h: * xml/xml.h: document undocumented enumerations. * lasso/errors.h: add proper documentation about error codes. * lasso/errors.c: new version of the lasso_strerror function * lasso/build_strerror.py: update the script that generater lasso_strerror from the documentation comments. Remove usage of OFTYPE * lasso/id-ff/session.c: * lasso/id-ff/session.h: remove usage of oftype, prefer gtk-introspection annotations instead. * lasso/id-wsf/data_service.h: * lasso/id-wsf/data_service.c: do the same. Add a script to build lasso-sections.txt * lasso/extract_sections.py: this script parses header files and generated lasso-sections.txt content for GObject class descriptions. Add a template file for the lasso-section.txt file * docs/references/lasso-sections.txt.in: this file serves as a base for the generation of lasso-sections.txt Update docs/references/Makefile.am for generating lasso-sections.txt * docs/references/Makefile.am: always rebuild template, using out of source build directory is too weird without it. call new script extract_sections.py to regenerate lasso-sections.txt if header files changed. Update lasso.sgml file with all missing sections * docs/reference/lasso.sgml: add all missing sections, mainly objects from XML schemas. * docs/reference/lasso-sections.txt: update it * *.c: add section documentation to some files. * lasso/xml/strings.h: fix bad usage or docbook markup
2009-08-26 17:15:07 +02:00
* @LASSO_SIGNATURE_METHOD_RSA_SHA1: sign using a RSA private key
* @LASSO_SIGNATURE_METHOD_DSA_SHA1: sign using a DSA private key
2005-02-21 15:21:52 +01:00
*
* Signature method.
**/
typedef enum {
LASSO_SIGNATURE_METHOD_RSA_SHA1 = 1,
LASSO_SIGNATURE_METHOD_DSA_SHA1
} LassoSignatureMethod;
2005-02-21 15:21:52 +01:00
typedef struct _LassoNode LassoNode;
typedef struct _LassoNodeClass LassoNodeClass;
typedef struct _LassoNodeClassData LassoNodeClassData;
/**
* _LassoNode:
**/
struct _LassoNode {
GObject parent;
};
struct _LassoNodeClass {
GObjectClass parent_class;
LassoNodeClassData *node_data;
2004-10-27 17:41:05 +02:00
void (* destroy) (LassoNode *node);
char* (* build_query) (LassoNode *node);
gboolean (* init_from_query) (LassoNode *node, char **query_fields);
int (* init_from_xml) (LassoNode *node, xmlNode *xmlnode);
xmlNode* (* get_xmlNode) (LassoNode *node, gboolean lasso_dump);
2004-10-27 17:41:05 +02:00
};
LASSO_EXPORT GType lasso_node_get_type(void);
2004-10-27 17:41:05 +02:00
LASSO_EXPORT LassoNode* lasso_node_new(void);
LASSO_EXPORT LassoNode* lasso_node_new_from_dump(const char *dump);
2004-10-27 17:41:05 +02:00
LASSO_EXPORT LassoNode* lasso_node_new_from_soap(const char *soap);
LASSO_EXPORT LassoNode* lasso_node_new_from_xmlNode(xmlNode* node);
LASSO_EXPORT void lasso_node_cleanup_original_xmlnodes(LassoNode *node);
LASSO_EXPORT void lasso_node_destroy(LassoNode *node);
LASSO_EXPORT char* lasso_node_dump(LassoNode *node);
LASSO_EXPORT char* lasso_node_export_to_base64(LassoNode *node);
2004-05-13 17:59:26 +02:00
LASSO_EXPORT char* lasso_node_export_to_query(LassoNode *node,
LassoSignatureMethod sign_method, const char *private_key_file);
LASSO_EXPORT char* lasso_node_export_to_soap(LassoNode *node);
2004-05-13 17:59:26 +02:00
LASSO_EXPORT gchar* lasso_node_export_to_xml(LassoNode *node);
LASSO_EXPORT char* lasso_node_export_to_paos_request(LassoNode *node, const char *issuer,
const char *responseConsumerURL, const char *relay_state);
LASSO_EXPORT char* lasso_node_export_to_ecp_soap_response(LassoNode *node,
const char *assertionConsumerURL);
LASSO_EXPORT xmlNode* lasso_node_get_xmlNode(LassoNode *node, gboolean lasso_dump);
LASSO_EXPORT xmlNode* lasso_node_get_original_xmlnode(LassoNode *node);
2004-05-13 17:59:26 +02:00
LASSO_EXPORT void lasso_node_set_original_xmlnode(LassoNode *node, xmlNode* xmlNode);
LASSO_EXPORT LassoMessageFormat lasso_node_init_from_message(LassoNode *node, const char *message);
LASSO_EXPORT gboolean lasso_node_init_from_query(LassoNode *node, const char *query);
LASSO_EXPORT int lasso_node_init_from_xml(LassoNode *node, xmlNode *xmlnode);
LASSO_EXPORT const char* lasso_strerror(int error_code);
LASSO_EXPORT void lasso_register_dst_service(const char *prefix, const char *href);
LASSO_EXPORT char* lasso_get_prefix_for_dst_service_href(const char *href);
2007-06-05 15:05:42 +02:00
LASSO_EXPORT void lasso_register_idwsf2_dst_service(const gchar *prefix, const gchar *href);
LASSO_EXPORT gchar* lasso_get_prefix_for_idwsf2_dst_service_href(const gchar *href);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __LASSO_XML_H__ */