Fix CA path setting really
[libisds.git] / src / isds_priv.h
blob7a45bbfe3e8d56c2fcaeac6b5f2b8d7e3c6f2e52
1 #ifndef __ISDS_ISDS_PRIV_H__
2 #define __ISDS_ISDS_PRIV_H__
4 /* Structures not to export outside library */
5 #include "../config.h"
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>
13 #include "gettext.h"
15 #define _(x) ((const char *) dgettext(PACKAGE, (x)))
17 #define SOAP_NS "http://schemas.xmlsoap.org/soap/envelope/"
18 #define SOAP2_NS "http://www.w3.org/2003/05/soap-envelope"
19 #define ISDS1_NS "http://isds.czechpoint.cz"
20 #define ISDS_NS "http://isds.czechpoint.cz/v20"
21 #define SISDS_INCOMING_NS "http://isds.czechpoint.cz/v20/message"
22 #define SISDS_OUTGOING_NS "http://isds.czechpoint.cz/v20/SentMessage"
23 #define SISDS_DELIVERY_NS "http://isds.czechpoint.cz/v20/delivery"
24 #define SCHEMA_NS "http://www.w3.org/2001/XMLSchema"
25 #define DEPOSIT_NS "urn:uschovnaWSDL"
28 /* Used to choose proper name space for message elements.
29 * See register_namespaces(). */
30 typedef enum {
31 MESSAGE_NS_1,
32 MESSAGE_NS_UNSIGNED,
33 MESSAGE_NS_SIGNED_INCOMING,
34 MESSAGE_NS_SIGNED_OUTGOING,
35 MESSAGE_NS_SIGNED_DELIVERY
36 } message_ns_type;
38 /* Type of a context */
39 typedef enum {
40 CTX_TYPE_NONE = 0, /* Not configured for any connection yet */
41 CTX_TYPE_ISDS, /* Connection to ISDS */
42 CTX_TYPE_CZP, /* Connection to Czech POINT document deposit */
43 CTX_TYPE_TESTING_REQUEST_COLLECTOR /* Connection to server collectiong
44 new testing box requests */
45 } context_type;
47 /* Global variables.
48 * Allocated in isds_init() and deallocated in isds_cleanup(). */
49 unsigned int log_facilities;
50 isds_log_level log_level;
51 isds_log_callback log_callback; /* Pass global log message to application.
52 NULL to log to stderr itself */
53 void *log_callback_data; /* Application specific data to pass to
54 registered log_callback function */
55 const char *version_gpgme; /* Static string with GPGME version */
56 const char *version_gcrypt; /* Static string with gcrypt version */
57 const char *version_expat; /* Static string with expat version */
59 /* End of global variables */
61 /* Context */
62 struct isds_ctx {
63 context_type type; /* Context type */
64 unsigned int timeout; /* milliseconds */
65 char *url; /* URL of the ISDS web service */
66 char *username;
67 char *password;
68 struct isds_pki_credentials *pki_credentials;
69 CURL *curl; /* CURL session handle */
70 _Bool *tls_verify_server; /* Verify the server? */
71 isds_progress_callback progress_callback; /* Call it during
72 communication with server.
73 NULL for nothing */
74 void *progress_callback_data; /* Application provided argument
75 for progress_callback */
76 char *tls_ca_file; /* File name with CA certificates */
77 char *tls_ca_dir; /* Directory name with CA certificates */
78 char *long_message; /* message buffer */
81 /* Stores message into context' long_message buffer.
82 * Application can pick the message up using isds_long_message().
83 * NULL @message truncates the buffer but does not deallocate it.
84 * @message is coded in locale encoding */
85 isds_error isds_log_message(struct isds_ctx *context, const char *message);
87 /* Appends message into context' long_message buffer.
88 * Application can pick the message up using isds_long_message().
89 * NULL message has void effect. */
90 isds_error isds_append_message(struct isds_ctx *context, const char *message);
92 /* Stores formated message into context' long_message buffer.
93 * Application can pick the message up using isds_long_message(). */
94 isds_error isds_printf_message(struct isds_ctx *context,
95 const char *format, ...);
97 /* Log @message in class @facility with log @level into global log. @message
98 * is printf(3) formating string, variadic arguments may be neccessary.
99 * For debugging purposes. */
100 isds_error isds_log(const isds_log_facility facility,
101 const isds_log_level level, const char *message, ...);
103 /* Makes known all relevant namespaces to given XPath context
104 * @xpat_ctx is XPath context
105 * @message_ns selects propper message name space. Unsisnged and signed
106 * messages differs.
107 * prefix and to URI ISDS_NS */
108 isds_error register_namespaces(xmlXPathContextPtr xpath_ctx,
109 const message_ns_type message_ns);
111 #endif