1 <?xml version="1.0" encoding="utf-8" standalone="no"?>
3 <!DOCTYPE reference PUBLIC "-//OASIS/DTD DocBook XML V4.5//EN"
4 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
11 <firstname>Petr</firstname>
12 <surname>Písař</surname>
15 <simpara>He has written libisds.</simpara>
18 <productname>libisds</productname>
21 <title>Manual for Libisds</title>
24 <refentry id="libisds.3">
26 <refentrytitle>libisds</refentrytitle>
27 <manvolnum>3</manvolnum>
31 <refname>libisds</refname>
32 <refpurpose>ISDS client library</refpurpose>
36 <synopsis><![CDATA[#include <isds.h>
43 ctx = isds_ctx_create();
45 err = isds_login(ctx, NULL, "username", "password", NULL, NULL);
47 printf("isds_login() failed: %s: %s\n",
48 isds_strerror(err), isds_long_message(ctx));
50 printf("Logged in.\n");
53 err = isds_ctx_free(&ctx);
59 <title>Description</title>
61 <para>This is a client library for accessing SOAP services of
62 <abbrev>ISDS</abbrev> (<phrase lang="cs">Informační systém datových
63 schránek</phrase> / Data Box Information System) as defined in
64 <ulink url="http://portal.gov.cz/zakon/300/2008">Czech
65 <abbrev>ISDS</abbrev> Act (300/2008 <abbrev>Coll.</abbrev>)</ulink>
66 and implied documents. Current implementation details are described in
67 <phrase lang="cs">Provozní řád</phrase> that can be downloaded from
68 <ulink url="https://www.datoveschranky.info/ke-stazeni"><phrase
69 lang="cs">Dokumenty ke stažení</phrase> section of
70 <abbrev>ISDS</abbrev> Information Portal</ulink>.</para>
72 <para>The library provides a C language interface with synchronous
73 non-reentrant blocking calls. Network communication progress reporting
74 and operation logging and library debugging are implemented by calling
75 back application-provided functions. Network operations can be
76 canceled from network reporting call-back.</para>
80 <title>Library Initialization and Deinitialization</title>
82 <para>A libisds application must include <filename>isds.h</filename>
83 header file. The application must call <function>isds_init</function>
84 function to initialize the library before calling any other library
85 functions. After last libisds call, <function>isds_cleanup</function>
86 function should be called to clean up some global resources and to
87 deinitialize dependent libraries.</para>
91 <title>Contexts</title>
93 <para>Most of the functions operate on an established connection to the
94 <abbrev>ISDS</abbrev> server. This is called a context and it's
95 represented by a pointer to an opaque
96 <structname>isds_ctx</structname> structure. The structure maintains
97 state about network connection, authorization or error from last call
98 on the context.</para>
100 <para>The context is allocated by <function>isds_ctx_create</function>
101 function and deallocated by <function>isds_ctx_free</function>
104 <para>There are more context subtypes. A specific subtype is assigned to
105 the context when a fresh new context is passed to one of the few
106 stratifying functions (<function>isds_login</function>,
107 <function>czp_convert_document</function>,
108 <function>isds_request_new_testing_box</function>). Once the context
109 is specialized, you can use it only with functions understanding the
110 subtype. This is not enforced by the library now, but it does not
111 matter much because all the other functions assume the
112 <function>isds_login</function> was called on the context. In other
113 words, do not share the context among the three stratifying
116 <para>For example create a context with
117 <function>isds_ctx_create</function>, then call
118 <function>isds_login</function>, then work with box, then call
119 <function>isds_logout</function>. Here you can reuse the context and
120 log in as another user by calling <function>isds_login</function>
121 again or destroy the context with <function>isds_ctx_free</function> if
122 you don't need it anymore.</para>
124 <para>Or create a context with <function>isds_ctx_create</function>,
125 send a document to authorized conversion using
126 <function>czp_convert_document</function>, then you can send more
127 documents to the authorized conversion by calling
128 <function>czp_convert_document</function> again on the same context
129 and finally destroy the context with
130 <function>isds_ctx_free</function>.</para>
135 <title>Errors</title>
137 <para>Most of the functions return an error code of
138 <type>isds_error</type> type. <errorname>IE_SUCCESS</errorname> value
139 denotes a successful call. Other values represent some kind of
142 <para>You can use <function>isds_strerror</function> function to obtain
143 a human readable string representation of the error code.</para>
145 <para>If a function with context argument failed, you can use
146 <function>isds_long_message</function> function to obtain a detailed
147 error message. Please note that returned value lasts only to the next
148 call on the context.</para>
152 <title>Character Encoding</title>
154 <para>All strings exchanged between the library and the application are
155 encoded in <abbrev>UTF-8</abbrev>. Although there are a few
160 <para><function>isds_strerror</function> and
161 <function>isds_long_message</function> functions return
162 locale encoded string.</para>
166 <para><function>isds_version</function> returns locale encoded
171 <para>Log call-back function set by
172 <function>isds_set_log_callback</function> function is called with
173 raw byte stream.</para>
177 <para><structname>isds_pki_credentials</structname> structure string
178 members have encoding specific to cryptographic library linked to
186 <title>Global Settings</title>
188 <para>Some functions influence library behavior globally. These are:</para>
192 <para><function>isds_init</function> and
193 <function>isds_cleanup</function> used to initialize and
194 deinitialize the library.</para>
198 <para><function>isds_set_logging</function> and
199 <function>isds_set_log_callback</function> to set logging.</para>
205 <title>Logging and Debugging</title>
207 <para>Logging is global for all libisds calls. Log level and facility
208 can be set with <function>isds_set_logging</function> function.</para>
210 <para>The log is printed on standard error output by default.
211 Application can redirect the messages to a call-back function by
212 registering the call-back function with
213 <function>isds_set_log_callback</function>.</para>
217 <title>Network Input/Output</title>
219 <para>Some functions operating on a context create network sockets and
220 do network input and output.</para>
222 <para>Network timeout can be set with
223 <function>isds_set_timeout</function> function. Function calls aborted
224 owing to the timeout will return
225 <errorname>IE_TIMED_OUT</errorname>.</para>
227 <para>Network operation progress can be monitored by a call-back
228 function. The call-back function can be registered using
229 <function>isds_set_progress_callback</function> function. Registered
230 call-back function will be called periodically with arguments
231 declaring amount of transferred data. The call-back return value
232 determines whether to continue in the network operation or to cancel
233 the operation. Functions failed owing to canceling network operation
234 will return <errorname>IE_ABORTED</errorname>.</para>
238 <title>Memory management</title>
240 <para>The library provides destructors for all libisds data structures.
241 For example <function>isds_ctx_free</function> function accepts a pointer
242 to a pointer to the <structname>isds_ctx</structname> structure, frees
243 the double referenced structure (recursively), writes NULL to the
244 pointed pointer (which invalidates the pointer effectively) and returns
247 <para>Upon a function call, all output arguments are automatically
248 reallocated to desired size. On a function failure, all output
249 arguments are automatically deallocated and their pointers set to
250 NULL. Exceptions are documented at respective functions.</para>
252 <para>Output strings are allocated using standard
253 <function>malloc</function> call. Application is responsible for their
254 deallocation (in case of no failure and if not specified otherwise.)
255 Use standard <function>free</function> call for strings,
256 use libisds destructors for libisds structures.</para>
260 <title>Available Functions, Types, and Constants</title>
262 <para>See <filename>isds.h</filename> header file.</para>
266 <title>See Also</title>
270 <refentrytitle>libcurl</refentrytitle>
271 <manvolnum>3</manvolnum>