Use sisds NS prefix to parse signed message
[libisds.git] / src / isds_priv.h
blobad0461e68d0c6396d9345c17f0556e5997868bfb
1 #ifndef __ISDS_ISDS_PRIV_H__
2 #define __ISDS_ISDS_PRIV_H__
4 /* Structures not to export outside library */
6 #include "isds.h"
7 #include <curl/curl.h>
8 #include <libxml/parser.h>
9 #include <libxml/tree.h>
10 #include <libxml/xpath.h>
11 #include <libxml/xpathInternals.h>
12 #include <libxml/xmlsave.h>
14 #define _(x) (x)
15 #define SOAP_NS "http://schemas.xmlsoap.org/soap/envelope/"
16 #define SOAP2_NS "http://www.w3.org/2003/05/soap-envelope"
17 #define ISDS_NS "http://isds.czechpoint.cz/v20"
18 #define SISDS_NS "http://isds.czechpoint.cz/v20/message"
19 #define SCHEMA_NS "http://www.w3.org/2001/XMLSchema"
21 /* Global variables.
22 * Allocated in isds_init() and deallocated in isds_cleanup(). */
23 xmlNodePtr xml_node;
24 xmlNsPtr soap_ns, isds_ns;
25 unsigned int log_facilities;
26 isds_log_level log_level;
28 /* End of global variables */
30 /* Context */
31 struct isds_ctx {
32 unsigned int timeout; /* milliseconds */
33 char *url; /* URL of the ISDS web service */
34 char *username;
35 char *password;
36 char *client_certificate;
37 char *private_key;
38 CURL *curl; /* CURL session handle */
39 _Bool *tls_verify_server; /* Verify the server? */
40 char *tls_ca_file; /* File name with CA certificates */
41 char *tls_ca_dir; /* Directory name with CA certificates */
42 char *long_message; /* message buffer */
45 /* Stores message into context' long_message buffer.
46 * Application can pick the message up using isds_long_message().
47 * NULL @message truncates the buffer but does not deallocate it.
48 * @message is coded in locale encoding */
49 isds_error isds_log_message(struct isds_ctx *context, const char *message);
51 /* Appends message into context' long_message buffer.
52 * Application can pick the message up using isds_long_message().
53 * NULL message has void effect. */
54 isds_error isds_append_message(struct isds_ctx *context, const char *message);
56 /* Stores formated message into context' long_message buffer.
57 * Application can pick the message up using isds_long_message(). */
58 isds_error isds_printf_message(struct isds_ctx *context,
59 const char *format, ...);
61 /* Log @message in class @facility with log @level into global log. @message
62 * is printf(3) formating string, variadic arguments may be neccessary.
63 * For debugging purposes. */
64 isds_error isds_log(const isds_log_facility facility,
65 const isds_log_level level, const char *message, ...);
67 /* Makes known all relevant namespaces to given XPath context
68 * @xpat_ctx is XPath context
69 * @distinguish_sisds == false means to make `sisds' prefix equalled to `isds'
70 * prefix and to URI ISDS_NS */
71 isds_error register_namespaces(xmlXPathContextPtr xpath_ctx,
72 const _Bool distinguish_sisds);
74 #endif