Aborted transfer does not close connection
[libisds.git] / src / isds.h
blobfbb11f06b295465b4c55c99aed1040b00b29bea2
1 #ifndef __ISDS_ISDS_H__
2 #define __ISDS_ISDS_H__
4 /* Public interface for libisds.
5 * Private declarations in isds_priv.h. */
7 #include <stdlib.h> /* For size_t */
8 #include <sys/time.h> /* For struct timeval */
10 #ifdef __cplusplus /* For C++ linker sake */
11 extern "C" {
12 #endif
14 /* _deprecated macro marks library symbols as deprecated. Application should
15 * avoid using such function as soon as possible. */
16 #if defined(__GNUC__)
17 #define _deprecated __attribute__((deprecated))
18 #else
19 #define _deprecated
20 #endif
22 /* Service locators */
23 extern const char isds_locator[]; /* Base URL of production ISDS instance */
24 extern const char isds_testing_locator[]; /* B. URL of testing ISDS instance */
27 struct isds_ctx; /* Context for specific ISDS box */
29 typedef enum {
30 IE_SUCCESS = 0, /* No error, just for C conveniece (0 means Ok) */
31 IE_ERROR, /* Unspecified error */
32 IE_NOTSUP,
33 IE_INVAL,
34 IE_INVALID_CONTEXT,
35 IE_NOT_LOGGED_IN,
36 IE_CONNECTION_CLOSED,
37 IE_TIMED_OUT,
38 IE_NOEXIST,
39 IE_NOMEM,
40 IE_NETWORK,
41 IE_HTTP,
42 IE_SOAP,
43 IE_XML,
44 IE_ISDS,
45 IE_ENUM,
46 IE_DATE,
47 IE_2BIG,
48 IE_2SMALL,
49 IE_NOTUNIQ,
50 IE_NOTEQUAL,
51 IE_PARTIAL_SUCCESS,
52 IE_ABORTED
53 } isds_error;
55 typedef enum {
56 ILL_NONE = 0,
57 ILL_CRIT = 10,
58 ILL_ERR = 20,
59 ILL_WARNING = 30,
60 ILL_INFO = 40,
61 ILL_DEBUG = 50,
62 ILL_ALL = 100
63 } isds_log_level;
65 typedef enum {
66 ILF_NONE = 0x0,
67 ILF_HTTP = 0x1,
68 ILF_SOAP = 0x2,
69 ILF_ISDS = 0x4,
70 ILF_FILE = 0x8,
71 ILF_SEC = 0x10,
72 ILF_XML = 0x20,
73 ILF_ALL = 0xFF
74 } isds_log_facility;
76 /* Return text description of ISDS error */
77 const char *isds_strerror(const isds_error error);
79 /* TLS libisds options */
80 typedef enum {
81 ITLS_VERIFY_SERVER, /* _Bool: Verify server idetity? */
82 ITLS_CA_FILE, /* char *: File name with CA certificates */
83 ITLS_CA_DIRECTORY /* char *: Directory name with CA certificates */
84 } isds_tls_option;
86 /* Box type */
87 typedef enum {
88 DBTYPE_SYSTEM = 0, /* This is special sender value for messages
89 sent by ISDS. */
90 DBTYPE_OVM = 10,
91 DBTYPE_OVM_NOTAR = 11,
92 DBTYPE_OVM_EXEKUT = 12,
93 DBTYPE_OVM_REQ = 13,
94 DBTYPE_PO = 20,
95 DBTYPE_PO_ZAK = 21,
96 DBTYPE_PO_REQ = 22,
97 DBTYPE_PFO = 30,
98 DBTYPE_PFO_ADVOK = 31,
99 DBTYPE_PFO_DANPOR = 32,
100 DBTYPE_PFO_INSSPR = 33,
101 DBTYPE_FO = 40
102 } isds_DbType;
104 /* Box status from point of view of accesibilty */
105 typedef enum {
106 DBSTATE_ACCESSIBLE = 1,
107 DBSTATE_TEMP_UNACCESSIBLE = 2,
108 DBSTATE_NOT_YET_ACCESSIBLE = 3,
109 DBSTATE_PERM_UNACCESSIBLE = 4,
110 DBSTATE_REMOVED = 5
111 } isds_DbState;
113 /* User permissions from point of view of ISDS.
114 * Instances can be bitmaps of any discrete values. */
115 typedef enum {
116 PRIVIL_READ_NON_PERSONAL = 0x1, /* Can download and read messages with
117 dmPersonalDelivery == false */
118 PRIVIL_READ_ALL = 0x2, /* Can download and read messages with
119 dmPersonalDelivery == true */
120 PRIVIL_CREATE_DM = 0x4, /* Can create and sent messages,
121 can dowload outgoing (sent) messages */
122 PRIVIL_VIEW_INFO = 0x8, /* Can list messages and data about
123 post and delivery */
124 PRIVIL_SEARCH_DB = 0x10, /* Can search for boxes */
125 PRIVIL_OWNER_ADM = 0x20, /* Can administer his box (add/remove
126 permitted users and theirs
127 permissions) */
128 PRIVIL_READ_VAULT = 0x40, /* Cen read message stored in data safe */
129 PRIVIL_ERASE_VAULT = 0x80 /* Can delete messages from data safe */
130 } isds_priviledges;
132 /* Message status */
133 typedef enum {
134 MESSAGESTATE_SENT = 0x2, /* Message has been put into ISDS */
135 MESSAGESTATE_STAMPED = 0x4, /* Message stamped by TSA */
136 MESSAGESTATE_INFECTED = 0x8, /* Message included virues,
137 infected document has been removed */
138 MESSAGESTATE_DELIVERED = 0x10, /* Message delivered
139 (dmDeliveryTime stored) */
140 MESSAGESTATE_SUBSTITUTED = 0x20, /* Message delivered through fiction,
141 dmAcceptanceTime stored */
142 MESSAGESTATE_RECEIVED = 0x40, /* Message accepted (by user login or
143 user explicit request),
144 dmAcceptanceTime stored */
145 MESSAGESTATE_READ = 0x80, /* Message has been read by user */
146 MESSAGESTATE_UNDELIVERABLE = 0x100, /* Message could not been delivered
147 (e.g. recipent box has been made
148 unaccessible meantime) */
149 MESSAGESTATE_REMOVED = 0x200, /* Message content deleted */
150 MESSAGESTATE_IN_SAFE = 0x400 /* Message stored in data safe */
152 } isds_message_status;
153 #define MESSAGESTATE_ANY 0x7FE /* Union of all isds_message_status
154 values */
156 /* Hash algoritm types */
157 typedef enum {
158 HASH_ALGORITHM_MD5,
159 HASH_ALGORITHM_SHA_1,
160 HASH_ALGORITHM_SHA_224,
161 HASH_ALGORITHM_SHA_256,
162 HASH_ALGORITHM_SHA_384,
163 HASH_ALGORITHM_SHA_512,
164 } isds_hash_algorithm;
166 /* Buffer storage strategy.
167 * How function should embed application provided buffer into raw element of
168 * output structure. */
169 typedef enum {
170 BUFFER_DONT_STORE, /* Don't fill raw memeber */
171 BUFFER_COPY, /* Copy buffer content into newly allocated raw */
172 BUFFER_MOVE /* Just copy pointer.
173 But leave deallocation to isds_*_free(). */
174 } isds_buffer_strategy;
176 /* Hash value storage */
177 struct isds_hash {
178 isds_hash_algorithm algorithm; /* Hash algoritgm */
179 size_t length; /* Hash value lenght in bytes */
180 void *value; /* Hash value */
183 /* Name of person */
184 struct isds_PersonName {
185 char *pnFirstName;
186 char *pnMiddleName;
187 char *pnLastName;
188 char *pnLastNameAtBirth;
191 /* Date and place of birth */
192 struct isds_BirthInfo {
193 struct tm *biDate; /* Date of Birth in local time at birth place,
194 only tm_year, tm_mon and tm_mday carry sane
195 value */
196 char *biCity;
197 char *biCounty; /* German: Bezirk, Czech: okres */
198 char *biState;
201 /* Post address */
202 struct isds_Address {
203 char *adCity;
204 char *adStreet;
205 char *adNumberInStreet;
206 char *adNumberInMunicipality;
207 char *adZipCode;
208 char *adState;
211 /* Data about box and his owner.
212 * NULL pointer means undefined value */
213 struct isds_DbOwnerInfo {
214 char *dbID; /* Box ID [Max. 7 chars] */
215 isds_DbType *dbType; /* Box Type */
216 char *ic; /* ID */
217 struct isds_PersonName *personName; /* Name of person */
218 char *firmName; /* Name of firm */
219 struct isds_BirthInfo *birthInfo; /* Birth of person */
220 struct isds_Address *address; /* Post address */
221 char *nationality;
222 char *email;
223 char *telNumber;
224 char *identifier; /* External box identifier for data
225 provider (OVM, PO, maybe PFO)
226 [Max. 20 chars] */
227 char *registryCode; /* PFO External registry code
228 [Max. 5 chars] */
229 long int *dbState; /* Box state; 1 <=> active box;
230 long int beacause xsd:integer
231 TODO: enum? */
232 _Bool *dbEffectiveOVM; /* Box has OVM role (§ 5a) */
233 _Bool *dbOpenAddressing; /* Non-OVM Box is free to recieve
234 messages from anybody */
237 /* User type */
238 typedef enum {
239 USERTYPE_PRIMARY, /* Owner of the box */
240 USERTYPE_ENTRUSTED, /* User with limited access to the box */
241 USERTYPE_ADMINISTRATOR, /* User to manage ENTRUSTED_USERs */
242 USERTYPE_OFFICIAL /* ??? */
243 } isds_UserType;
245 /* Data about user.
246 * NULL pointer means undefined value */
247 struct isds_DbUserInfo {
248 char *userID; /* User ID [Min. 6, max. 12 characters] */
249 isds_UserType *userType; /* User type */
250 long int *userPrivils; /* Set of user permissions */
251 struct isds_PersonName *personName; /* Name of the person */
252 struct isds_Address *address; /* Post address */
253 struct tm *biDate; /* Date of birth in local time,
254 only tm_year, tm_mon and tm_mday carry sane
255 value */
256 char *ic; /* ID of a supervising firm [Max. 8 chars] */
257 char *firmName; /* Name of a supervising firm
258 [Max. 100 chars] */
259 char *caStreet; /* Street and number of contact address */
260 char *caCity; /* Czech City of contact address */
261 char *caZipCode; /* Post office code of contact address */
264 /* Message event type */
265 typedef enum {
266 EVENT_UKNOWN, /* Event unknown to this library */
267 EVENT_ACCEPTED_BY_RECIPIENT, /* Message has been delivered and accepted
268 by recipeint action */
269 EVENT_ACCEPTED_BY_FICTION, /* Message has been delivered, acceptance
270 timed out, considered as accepted */
271 EVENT_UNDELIVERABLE, /* Recipient box made unaccessible,
272 thus message is undelivarable */
273 EVENT_COMMERCIAL_ACCEPTED /* Recipient confirmed acceptace of
274 commercial message */
275 } isds_event_type;
277 /* Message event
278 * Alle members are optional as specification states so. */
279 struct isds_event {
280 struct timeval *time; /* When the event occurred */
281 isds_event_type *type; /* Type of the event */
282 char *description; /* Human readable event description
283 generated by ISDS (Czech) */
286 /* Message envelope
287 * Be ware that the string length contraints are forced only on output
288 * memebers transmitted to ISDS. The other direction (downloded from ISDS)
289 * can break these rules. It should not happen, but nobody knows how much
290 * incompatible new version of ISDS protocol will be. This is the gold
291 * Internet rule: be strict on what you put, be tollerant on what you get. */
292 struct isds_envelope {
293 /* Following memebers apply to incoming messages only: */
294 char *dmID; /* Message ID.
295 Maximal length is 20 characters. */
296 char *dbIDSender; /* Box ID of sender.
297 Special value "aaaaaaa" means sent by
298 ISDS.
299 Maximal length is 7 characters. */
300 char *dmSender; /* Sender name;
301 Maximal length is 100 characters. */
302 char *dmSenderAddress; /* Postal address of sender;
303 Maximal length is 100 characters. */
304 long int *dmSenderType; /* Gross Box type of sender
305 TODO: isds_DbType ? */
306 char *dmRecipient; /* Recipient name;
307 Maximal length is 100 characters. */
308 char *dmRecipientAddress; /* Postal address of recipient;
309 Maximal length is 100 characters. */
310 _Bool *dmAmbiguousRecipient; /* Recipient has OVM role */
311 char *dmType; /* Message type:
312 "V" is public message
313 "K" is commercial message */
315 /* Following memebers are assigned by ISDS in different phases of message
316 * life cycle. */
317 unsigned long int *dmOrdinal; /* Ordinal number in list of
318 incoming/outgoing messages */
319 isds_message_status *dmMessageStatus; /* Message state */
320 long int *dmAttachmentSize; /* Size of message documents in
321 kilobytes (rounded). */
322 struct timeval *dmDeliveryTime; /* Time of delivery into a box
323 NULL, if message has not been
324 delivered yet */
325 struct timeval *dmAcceptanceTime; /* Time of accpetance of the message
326 by an user. NULL if message has not
327 been accepted yet. */
328 struct isds_hash *hash; /* Message hash.
329 This is hash of isds:dmDM subtree. */
330 void *timestamp; /* Qualified time stamp */
331 size_t timestamp_length; /* Lenght of timestamp in bytes */
332 struct isds_list *events; /* Events message passed trough;
333 List of isds_event's. */
336 /* Following members apply to both outgoing and incoming messages: */
337 char *dmSenderOrgUnit; /* Organisation unit of sender as string;
338 Optional. */
339 long int *dmSenderOrgUnitNum; /* Organisation unit of sender as number;
340 Optional. */
341 char *dbIDRecipient; /* Box ID of recipient; Mandatory.
342 Maximal length is 7 characters. */
343 char *dmRecipientOrgUnit; /* Organisation unit of recipient as
344 string; Optional. */
345 long int *dmRecipientOrgUnitNum; /* Organisation unit of recipient as
346 number; Optional. */
347 char *dmToHands; /* Person in recipient organisation;
348 Optional. */
349 char *dmAnnotation; /* Subject (title) of the message.
350 Maximal length is 255 characters. */
351 char *dmRecipientRefNumber; /* Czech: číslo jednací příjemce; Optional.
352 Maximal length is 50 characters. */
353 char *dmSenderRefNumber; /* Czech: číslo jednací odesílatele;
354 Optional. Maximal lenght is 50 chars. */
355 char *dmRecipientIdent; /* Czech: spisová značka příjemce; Optional.
356 Maximal length is 50 characters. */
357 char *dmSenderIdent; /* Czech: spisová značka odesílatele;
358 Optional. Maximal lenght is 50 chars. */
360 /* Act addressing in Czech Republic:
361 * Point (Parahraph) § Section Law/Year Coll. */
362 long int *dmLegalTitleLaw; /* Number of act mandating authority */
363 long int *dmLegalTitleYear; /* Year of act issue mandating authority */
364 char *dmLegalTitleSect; /* Section of act mandating authority.
365 Czech: paragraf */
366 char *dmLegalTitlePar; /* Parahraph of act mandating authority.
367 Czech: odstavec */
368 char *dmLegalTitlePoint; /* Point of act mandating authority.
369 Czech: písmeno */
371 _Bool *dmPersonalDelivery; /* If true, only person with higher
372 priviledges can read this message */
373 _Bool *dmAllowSubstDelivery; /* Allow delivery through fiction.
374 I.e. Even if recipient did not read this
375 message, message is considered as
376 delivered after (currently) 10 days.
377 This is delivery through fiction.
378 Applies only to OVM dbType sender. */
379 _Bool *dmOVM; /* OVM sending mode.
380 Non-OVM dbType boxes that has
381 dbEffectiveOVM == true MUST select
382 between true (OVM mode) and
383 false (non-OVM mode).
384 Optionable; Implicit value is true. */
388 /* Document type from point of hiearchy */
389 typedef enum {
390 FILEMETATYPE_MAIN, /* Main document */
391 FILEMETATYPE_ENCLOSURE, /* Appendix */
392 FILEMETATYPE_SIGNATURE, /* Digital signature of other document */
393 FILEMETATYPE_META /* XML document for ESS (electronic
394 document information system) purposes */
395 } isds_FileMetaType;
397 /* Document */
398 struct isds_document {
399 void *data; /* Document content.
400 The encoding and interpretation depends
401 on dmMimeType.
402 TODO: inline XML */
403 size_t data_length; /* Length of the data in bytes */
404 char *dmMimeType; /* MIME type of data; Mandatory. */
405 isds_FileMetaType dmFileMetaType; /* Document type to create hierarchy */
406 char *dmFileGuid; /* Message-local document identifier;
407 Optional. */
408 char *dmUpFileGuid; /* Reference to upper document identifier
409 (dmFileGuid); Optional. */
410 char *dmFileDescr; /* Document name (title). E.g. file name;
411 Mandatory. */
412 char *dmFormat; /* Reference to XML form definition;
413 Defines howto interpret XML document;
414 Optional. */
417 /* Raw message representation content type.
418 * This is necessary to distinguish between different representations without
419 * expensive repated detection.
420 * Infix explanation:
421 * PLAIN_SIGNED data are XML with namespace mangled to signed alternative
422 * CMS_SIGNED data are XML with signed namespace encapsulated in CMS */
423 typedef enum {
424 RAWTYPE_INCOMING_MESSAGE,
425 RAWTYPE_PLAIN_SIGNED_INCOMING_MESSAGE,
426 RAWTYPE_CMS_SIGNED_INCOMING_MESSAGE,
427 RAWTYPE_PLAIN_SIGNED_OUTGOING_MESSAGE,
428 RAWTYPE_CMS_SIGNED_OUTGOING_MESSAGE,
429 RAWTYPE_DELIVERYINFO,
430 RAWTYPE_PLAIN_SIGNED_DELIVERYINFO,
431 RAWTYPE_CMS_SIGNED_DELIVERYINFO
432 } isds_raw_type;
434 /* Message */
435 struct isds_message {
436 void *raw; /* Raw message in XML format as send to or
437 from the ISDS. You can use it to store
438 local copy. This is binary buffer. */
439 size_t raw_length; /* Lenght of raw message in bytes */
440 isds_raw_type raw_type; /* Content type of raw representation
441 Meaningfull only with non-NULL raw
442 member */
443 struct isds_envelope *envelope; /* Message envelope */
444 struct isds_list *documents; /* List of isds_document's.
445 Valid message must contain exactly one
446 document of type FILEMETATYPE_MAIN and
447 can contain any number of other type
448 documents. Totol size of documents
449 must not exceed 10 MB. */
452 /* Message copy recipient and assigned message ID */
453 struct isds_message_copy {
454 /* Input members defined by application */
455 char *dbIDRecipient; /* Box ID of recipient; Mandatory.
456 Maximal length is 7 characters. */
457 char *dmRecipientOrgUnit; /* Organisation unit of recipient as
458 string; Optional. */
459 long int *dmRecipientOrgUnitNum; /* Organisation unit of recipient as
460 number; Optional. */
461 char *dmToHands; /* Person in recipient organisation;
462 Optional. */
464 /* Output members returned from ISDS */
465 isds_error error; /* libisds compatible error of delivery to o ne recipient */
466 char *dmStatus; /* Error description returned by ISDS;
467 Optional. */
468 char *dmID; /* Assigned message ID; Meaningfull only
469 for error == IE_SUCCESS */
472 /* General linked list */
473 struct isds_list {
474 struct isds_list *next; /* Next list item,
475 or NULL if current is last */
476 void *data; /* Payload */
477 void (*destructor) (void **); /* Payload deallocator */
480 /* External box approval */
481 struct isds_approval {
482 _Bool approved; /* True if request for box has been
483 approvedout of ISDS */
484 char *refference; /* Identifier of the approval */
488 /* Initialize ISDS library.
489 * Global function, must be called before other functions.
490 * If it failes you can not use ISDS library and must call isds_cleanup() to
491 * free partially inititialized global variables. */
492 isds_error isds_init(void);
494 /* Deinicialize ISDS library.
495 * Global function, must be called as last library function. */
496 isds_error isds_cleanup(void);
498 /* Create ISDS context.
499 * Each context can be used for different sessions to (possibly) different
500 * ISDS server with different credentials.
501 * Returns new context, or NULL */
502 struct isds_ctx *isds_ctx_create(void);
504 /* Destroy ISDS context and free memmory.
505 * @context will be NULLed on success. */
506 isds_error isds_ctx_free(struct isds_ctx **context);
508 /* Return long message text produced by library fucntion, e.g. detailed error
509 * mesage. Returned pointer is only valid until new library function is
510 * called for the same context. Could be NULL, especially if NULL context is
511 * supplied. Return string is locale encoded. */
512 char *isds_long_message(const struct isds_ctx *context);
514 /* Set logging up.
515 * @facilities is bitmask of isds_log_facility values,
516 * @level is verbosity level. */
517 void isds_set_logging(const unsigned int facilities,
518 const isds_log_level level);
520 /* Function provided by application libisds will call to pass log message.
521 * The message is ussually locale encoded, but raw strings (UTF-8 usually) can
522 * occur when logging raw communitication with ISDS servers. Infixed zero byte
523 * is not excluded, but should not present. Use @length argument to get real
524 * length of the message.
525 * TODO: We will try to fix the encoding issue
526 * @facility is log message class
527 * @level is log message severity
528 * @message is string with zero byte terminator. This can be any arbitrary
529 * chunk of a sentence with or without new line, a sentence can be splitted
530 * into more messages. However it should not happen. If you discover message
531 * without new line, report it as a bug.
532 * @length is size of @message string in bytes excluding trailing zero
533 * @data is pointer that will be passed unchanged to this function at run-time
534 * */
535 typedef void (*isds_log_callback)(
536 isds_log_facility facility, isds_log_level level,
537 const char *message, int length, void *data);
539 /* Register callback function libisds calls when new global log message is
540 * produced by library. Library logs to stderr by default.
541 * @callback is function provided by application libsds will call. See type
542 * defition for @callback argument explanation. Pass NULL to revert logging to
543 * default behaviour.
544 * @data is application specific data @callback gets as last argument */
545 void isds_set_log_callback(isds_log_callback callback, void *data);
547 /* Set timeout in miliseconds for each network job like connecting to server
548 * or sending message. Use 0 to disable timeout limits. */
549 isds_error isds_set_timeout(struct isds_ctx *context,
550 const unsigned int timeout);
552 /* Function provided by application libsds will call with
553 * following five arguments. Value zero of any argument means the value is
554 * unknown.
555 * @upload_total is expected total upload,
556 * @upload_current is cumulative current upload progress
557 * @dowload_total is expected total download
558 * @download_current is cumulative current download progress
559 * @data is pointer that will be passed unchanged to this function at run-time
560 * @return 0 to continue HTTP transfaer, or non-zero to abort transfer */
561 typedef int (*isds_progress_callback)(
562 double upload_total, double upload_current,
563 double download_total, double download_current,
564 void *data);
566 /* Register callback function libisds calls periodocally during HTTP data
567 * transfer.
568 * @context is session context
569 * @callback is function provided by application libsds will call. See type
570 * defition for @callback argument explanation.
571 * @data is application specific data @callback gets as last argument */
572 isds_error isds_set_progress_callback(struct isds_ctx *context,
573 isds_progress_callback callback, void *data);
575 /* Change SSL/TLS settings.
576 * @context is context which setting vill be applied to
577 * @option is name of option. It determines the type of last argument. See
578 * isds_tls_option definition for more info.
579 * @... is value of new setting. Type is determined by @option
580 * */
581 isds_error isds_set_tls(struct isds_ctx *context, const isds_tls_option option,
582 ...);
584 /* Connect and log in into ISDS server.
585 * @url is base address of ISDS web service. Pass NULL or extern isds_locator
586 * variable to use production ISDS instance. You can pass extern
587 * isds_testing_locator variable to select testing instance.
588 * @username is user name of ISDS user
589 * @password is user's secret password
590 * @certificate is NULL terminated string with PEM formated client's
591 * certificate. Use NULL if only password autentication should be performed.
592 * @key is private key for client's certificate as (base64 encoded?) NULL
593 * terminated string. Use NULL if only password autentication is desired.
594 * */
595 isds_error isds_login(struct isds_ctx *context, const char *url,
596 const char *username, const char *password,
597 const char *certificate, const char* key);
599 /* Log out from ISDS server and close connection. */
600 isds_error isds_logout(struct isds_ctx *context);
602 /* Verify connection to ISDS is alive and server is responding.
603 * Sent dumy request to ISDS and expect dummy response. */
604 isds_error isds_ping(struct isds_ctx *context);
606 /* Get data about logged in user and his box. */
607 isds_error isds_GetOwnerInfoFromLogin(struct isds_ctx *context,
608 struct isds_DbOwnerInfo **db_owner_info);
610 /* Get data about logged in user. */
611 isds_error isds_GetUserInfoFromLogin(struct isds_ctx *context,
612 struct isds_DbUserInfo **db_user_info);
614 /* Get expiration time of current password
615 * @context is session context
616 * @expiration is automatically reallocated time when password expires, In
617 * case of error will be nulled. */
618 isds_error isds_get_password_expiration(struct isds_ctx *context,
619 struct timeval **expiration);
621 /* Change user password in ISDS.
622 * User must supply old password, new password will takes effect after some
623 * time, current session can continue. Password must fulfill some constraints.
624 * @context is session context
625 * @old_password is current password.
626 * @new_password is requested new password */
627 isds_error isds_change_password(struct isds_ctx *context,
628 const char *old_password, const char *new_password);
630 /* Create new box.
631 * @context is session context
632 * @box is box description to create including single primary user (in case of
633 * FO box type). It outputs box ID assigned by ISDS in dbID element.
634 * @users is list of struct isds_DbUserInfo (primary users in case of non-FO
635 * box, or contact address of PFO box owner)
636 * @former_names is optional undocumented string. Pass NULL if you don't care.
637 * @upper_box_id is optional ID of supper box if currently created box is
638 * subordinated.
639 * @ceo_label is optional title of OVM box owner (e.g. mayor)
640 * @approval is optional external approval of box manipulation
641 * @refnumber is reallocated serial number of request assigned by ISDS. Use
642 * NULL, if you don't care.*/
643 isds_error isds_add_box(struct isds_ctx *context,
644 struct isds_DbOwnerInfo *box, const struct isds_list *users,
645 const char *former_names, const char *upper_box_id,
646 const char *ceo_label, const struct isds_approval *approval,
647 char **refnumber);
649 /* Notify ISDS about new PFO entity.
650 * This function has no real effect.
651 * @context is session context
652 * @box is PFO description including single primary user.
653 * @users is list of struct isds_DbUserInfo (contact address of PFO box owner)
654 * @former_names is optional undocumented string. Pass NULL if you don't care.
655 * @upper_box_id is optional ID of supper box if currently created box is
656 * subordinated.
657 * @ceo_label is optional title of OVM box owner (e.g. mayor)
658 * @approval is optional external approval of box manipulation
659 * @refnumber is reallocated serial number of request assigned by ISDS. Use
660 * NULL, if you don't care.*/
661 isds_error isds_add_pfoinfo(struct isds_ctx *context,
662 const struct isds_DbOwnerInfo *box, const struct isds_list *users,
663 const char *former_names, const char *upper_box_id,
664 const char *ceo_label, const struct isds_approval *approval,
665 char **refnumber);
667 /* Remove given given box permanetly.
668 * @context is session context
669 * @box is box description to delete
670 * @since is date of box owner cancalation. Only tm_year, tm_mon and tm_mday
671 * carry sane value.
672 * @approval is optional external approval of box manipulation
673 * @refnumber is reallocated serial number of request assigned by ISDS. Use
674 * NULL, if you don't care.*/
675 isds_error isds_delete_box(struct isds_ctx *context,
676 const struct isds_DbOwnerInfo *box, const struct tm *since,
677 const struct isds_approval *approval, char **refnumber);
679 /* Update data about given box.
680 * @context is session context
681 * @old_box current box description
682 * @new_box are updated data about @old_box
683 * @approval is optional external approval of box manipulation
684 * @refnumber is reallocated serial number of request assigned by ISDS. Use
685 * NULL, if you don't care.*/
686 isds_error isds_UpdateDataBoxDescr(struct isds_ctx *context,
687 const struct isds_DbOwnerInfo *old_box,
688 const struct isds_DbOwnerInfo *new_box,
689 const struct isds_approval *approval, char **refnumber);
691 /* Get data about all users assigned to given box.
692 * @context is session context
693 * @box_id is box ID
694 * @users is automatically reallocated list of struct isds_DbUserInfo */
695 isds_error isds_GetDataBoxUsers(struct isds_ctx *context, const char *box_id,
696 struct isds_list **users);
698 /* Update data about user assigned to given box.
699 * @context is session context
700 * @box is box identification
701 * @old_user identifies user to update
702 * @new_user are updated data about @old_user
703 * @refnumber is reallocated serial number of request assigned by ISDS. Use
704 * NULL, if you don't care.*/
705 isds_error isds_UpdateDataBoxUser(struct isds_ctx *context,
706 const struct isds_DbOwnerInfo *box,
707 const struct isds_DbUserInfo *old_user,
708 const struct isds_DbUserInfo *new_user,
709 char **refnumber);
711 /* Reset credentials of user assigned to given box.
712 * @context is session context
713 * @box is box identification
714 * @user identifies user to reset password
715 * @fee_paid is true if fee has been paid, false otherwise
716 * @approval is optional external approval of box manipulation
717 * @token is NULL if new password should be delivered off-line to the user.
718 * It is valid pointer if user should obtain new password on-line on dedicated
719 * web server. Then it output automatically reallocated token user needs to
720 * use to athtorize on the web server to view his new password.
721 * @refnumber is reallocated serial number of request assigned by ISDS. Use
722 * NULL, if you don't care.*/
723 isds_error isds_reset_password(struct isds_ctx *context,
724 const struct isds_DbOwnerInfo *box,
725 const struct isds_DbUserInfo *user,
726 const _Bool fee_paid, const struct isds_approval *approval,
727 char **token, char **refnumber);
729 /* Assign new user to given box.
730 * @context is session context
731 * @box is box identification
732 * @user defines new user to add
733 * @approval is optional external approval of box manipulation
734 * @refnumber is reallocated serial number of request assigned by ISDS. Use
735 * NULL, if you don't care.*/
736 isds_error isds_add_user(struct isds_ctx *context,
737 const struct isds_DbOwnerInfo *box, const struct isds_DbUserInfo *user,
738 const struct isds_approval *approval, char **refnumber);
740 /* Remove user assigned to given box.
741 * @context is session context
742 * @box is box identification
743 * @user identifies user to removve
744 * @approval is optional external approval of box manipulation
745 * @refnumber is reallocated serial number of request assigned by ISDS. Use
746 * NULL, if you don't care.*/
747 isds_error isds_delete_user(struct isds_ctx *context,
748 const struct isds_DbOwnerInfo *box, const struct isds_DbUserInfo *user,
749 const struct isds_approval *approval, char **refnumber);
751 /* Find boxes suiting given criteria.
752 * @context is ISDS session context.
753 * @criteria is filter. You should fill in at least some members.
754 * @boxes is automatically reallocated list of isds_DbOwnerInfo structures,
755 * possibly empty. Input NULL or valid old structure.
756 * @return:
757 * IE_SUCCESS if search sucseeded, @boxes contains usefull data
758 * IE_NOEXIST if no such box exists, @boxes will be NULL
759 * IE_2BIG if too much boxes exist and server truncated the resuluts, @boxes
760 * contains still valid data
761 * other code if something bad happens. @boxes will be NULL. */
762 isds_error isds_FindDataBox(struct isds_ctx *context,
763 const struct isds_DbOwnerInfo *criteria,
764 struct isds_list **boxes);
766 /* Get status of a box.
767 * @context is ISDS session context.
768 * @box_id is UTF-8 encoded box identifier as zero terminated string
769 * @box_status is return value of box status.
770 * @return:
771 * IE_SUCCESS if box has been found and its status retrieved
772 * IE_NOEXIST if box is not known to ISDS server
773 * or other appropriate error.
774 * You can use isds_DbState to enumerate box status. However out of enum
775 * range value can be returned too. This is feature because ISDS
776 * specification leaves the set of values open.
777 * Be ware that status DBSTATE_REMOVED is signaled as IE_SUCCESS. That means
778 * the box has been deleted, but ISDS still lists its former existence. */
779 isds_error isds_CheckDataBox(struct isds_ctx *context, const char *box_id,
780 long int *box_status);
782 /* Switch box into state where box can receive commercial messages (off by
783 * default)
784 * @context is ISDS session context.
785 * @box_id is UTF-8 encoded box identifier as zero terminated string
786 * @allow is true for enable, false for disable commercial messages income
787 * @approval is optional external approval of box manipulation
788 * @refnumber is reallocated serial number of request assigned by ISDS. Use
789 * NULL, if you don't care. */
790 isds_error isds_switch_commercial_receiving(struct isds_ctx *context,
791 const char *box_id, const _Bool allow,
792 const struct isds_approval *approval, char **refnumber);
794 /* Switch box into / out of state where non-OVM box can act as OVM (e.g. force
795 * message acceptance). This is just a box permission. Sender must apply
796 * such role by sending each message.
797 * @context is ISDS session context.
798 * @box_id is UTF-8 encoded box identifier as zero terminated string
799 * @allow is true for enable, false for disable OVM role permission
800 * @approval is optional external approval of box manipulation
801 * @refnumber is reallocated serial number of request assigned by ISDS. Use
802 * NULL, if you don't care. */
803 isds_error isds_switch_effective_ovm(struct isds_ctx *context,
804 const char *box_id, const _Bool allow,
805 const struct isds_approval *approval, char **refnumber);
807 /* Switch box accessibility state on request of box owner.
808 * Despite the name, owner must do the request off-line. This function is
809 * designed for such off-line meeting points (e.g. Czech POINT).
810 * @context is ISDS session context.
811 * @box identifies box to swith accesibilty state.
812 * @allow is true for making accesibale, false to disallow access.
813 * @approval is optional external approval of box manipulation
814 * @refnumber is reallocated serial number of request assigned by ISDS. Use
815 * NULL, if you don't care. */
816 isds_error isds_switch_box_accessibility_on_owner_request(
817 struct isds_ctx *context, const struct isds_DbOwnerInfo *box,
818 const _Bool allow, const struct isds_approval *approval,
819 char **refnumber);
821 /* Disable box accessibility on law enforcement (e.g. by prison) since exact
822 * date.
823 * @context is ISDS session context.
824 * @box identifies box to swith accesibilty state.
825 * @since is date since accesseibility has been denied. This can be past too.
826 * Only tm_year, tm_mon and tm_mday carry sane value.
827 * @approval is optional external approval of box manipulation
828 * @refnumber is reallocated serial number of request assigned by ISDS. Use
829 * NULL, if you don't care. */
830 isds_error isds_disable_box_accessibility_externaly(
831 struct isds_ctx *context, const struct isds_DbOwnerInfo *box,
832 const struct tm *since, const struct isds_approval *approval,
833 char **refnumber);
835 /* Send a message via ISDS to a recipent
836 * @context is session context
837 * @outgoing_message is message to send; Some memebers are mandatory (like
838 * dbIDRecipient), some are optional and some are irrelevant (especialy data
839 * about sender). Included pointer to isds_list documents must contain at
840 * least one document of FILEMETATYPE_MAIN. This is read-write structure, some
841 * members will be filled with valid data from ISDS. Exact list of write
842 * members is subject to change. Currently dmId is changed.
843 * @return ISDS_SUCCESS, or other error code if something goes wrong. */
844 isds_error isds_send_message(struct isds_ctx *context,
845 struct isds_message *outgoing_message);
847 /* Send a message via ISDS to a multiple recipents
848 * @context is session context
849 * @outgoing_message is message to send; Some memebers are mandatory,
850 * some are optional and some are irrelevant (especialy data
851 * about sender). Data about recipient will be substituted by ISDS from
852 * @copies. Included pointer to isds_list documents must
853 * contain at least one document of FILEMETATYPE_MAIN.
854 * @copies is list of isds_message_copy structures addressing all desired
855 * recipients. This is read-write structure, some members will be filled with
856 * valid data from ISDS (message IDs, error codes, error descriptions).
857 * @return
858 * ISDS_SUCCESS if all messages have been sent
859 * ISDS_PARTIAL_SUCCESS if sending of some messages has failed (failed and
860 * succesed messages can be identified by copies->data->error),
861 * or other error code if something other goes wrong. */
862 isds_error isds_send_message_to_multiple_recipients(struct isds_ctx *context,
863 const struct isds_message *outgoing_message,
864 struct isds_list *copies);
866 /* Get list of outgoing (already sent) messages.
867 * Any criterion argument can be NULL, if you don't care about it.
868 * @context is session context. Must not be NULL.
869 * @from_time is minimal time and date of message sending inclusive.
870 * @to_time is maximal time and date of message sending inclusive
871 * @dmSenderOrgUnitNum is the same as isds_envelope.dmSenderOrgUnitNum
872 * @status_filter is bit field of isds_message_status values. Use special
873 * value MESSAGESTATE_ANY to signal you don't care. (It's defined as union of
874 * all values, you can use bitwise arithmetic if you want.)
875 * @offset is index of first message we are interested in. First message is 1.
876 * Set to 0 (or 1) if you don't care.
877 * @number is maximal length of list you want to get as input value, outputs
878 * number of messages matching these criteria. Can be NULL if you don't care
879 * (applies to output value either).
880 * @messages is automatically reallocated list of isds_message's. Be ware that
881 * it returns only brief overview (envelope and some other fields) about each
882 * message, not the complete message. FIXME: Specify exact fields.
883 * The list is sorted by delivery time in ascending order.
884 * Use NULL if you don't care about the metadata (useful if you want to know
885 * only the @number). If you provide &NULL, list will be allocated on heap,
886 * if you provide pointer to non-NULL, list will be freed automacally at first.
887 * Also in case of error the list will be NULLed.
888 * @return IE_SUCCESS or appropriate error code. */
889 isds_error isds_get_list_of_sent_messages(struct isds_ctx *context,
890 const struct timeval *from_time, const struct timeval *to_time,
891 const long int *dmSenderOrgUnitNum, const unsigned int status_filter,
892 const unsigned long int offset, unsigned long int *number,
893 struct isds_list **messages);
895 /* Get list of incoming (addressed to you) messages.
896 * Any criterion argument can be NULL, if you don't care about it.
897 * @context is session context. Must not be NULL.
898 * @from_time is minimal time and date of message sending inclusive.
899 * @to_time is maximal time and date of message sending inclusive
900 * @dmSenderOrgUnitNum is the same as isds_envelope.dmSenderOrgUnitNum
901 * @status_filter is bit field of isds_message_status values. Use special
902 * value MESSAGESTATE_ANY to signal you don't care. (It's defined as union of
903 * all values, you can use bitwise arithmetic if you want.)
904 * @offset is index of first message we are interested in. First message is 1.
905 * Set to 0 (or 1) if you don't care.
906 * @number is maximal length of list you want to get as input value, outputs
907 * number of messages matching these criteria. Can be NULL if you don't care
908 * (applies to output value either).
909 * @messages is automatically reallocated list of isds_message's. Be ware that
910 * it returns only brief overview (envelope and some other fields) about each
911 * message, not the complete message. FIXME: Specify exact fields.
912 * Use NULL if you don't care about the metadata (useful if you want to know
913 * only the @number). If you provide &NULL, list will be allocated on heap,
914 * if you provide pointer to non-NULL, list will be freed automacally at first.
915 * Also in case of error the list will be NULLed.
916 * @return IE_SUCCESS or appropriate error code. */
917 isds_error isds_get_list_of_received_messages(struct isds_ctx *context,
918 const struct timeval *from_time, const struct timeval *to_time,
919 const long int *dmSenderOrgUnitNum, const unsigned int status_filter,
920 const unsigned long int offset, unsigned long int *number,
921 struct isds_list **messages);
923 /* Download incoming message envelope identified by ID.
924 * @context is session context
925 * @message_id is message identifier (you can get them from
926 * isds_get_list_of_received_messages())
927 * @message is automatically reallocated message retrieved from ISDS.
928 * It will miss documents per se. Use isds_get_received_message(), if you are
929 * interrested in documents (content) too.
930 * Returned hash and timestamp require documents to be verifiable. */
931 isds_error isds_get_received_envelope(struct isds_ctx *context,
932 const char *message_id, struct isds_message **message);
934 /* Download signed delivery infosheet of given message identified by ID.
935 * @context is session context
936 * @message_id is message identifier (you can get them from
937 * isds_get_list_of_{sent,received}_messages())
938 * @message is automatically reallocated message retrieved from ISDS.
939 * It will miss documents per se. Use isds_get_signed_received_message(),
940 * if you are interrested in documents (content). OTOH, only this function
941 * can get list events message has gone through. */
942 isds_error isds_get_signed_delivery_info(struct isds_ctx *context,
943 const char *message_id, struct isds_message **message);
945 /* Load delivery info of any format from buffer.
946 * @context is session context
947 * @raw_type advertises format of @buffer content. Only delivery info types
948 * are accepted.
949 * @buffer is DER encoded PKCS#7 structure with signed delivery info. You can
950 * retrieve such data from message->raw after calling
951 * isds_get_signed_delivery_info().
952 * @length is length of buffer in bytes.
953 * @message is automatically reallocated message parsed from @buffer.
954 * @strategy selects how buffer will be attached into raw isds_message member.
955 * */
956 isds_error isds_load_delivery_info(struct isds_ctx *context,
957 const isds_raw_type raw_type,
958 const void *buffer, const size_t length,
959 struct isds_message **message, const isds_buffer_strategy strategy);
961 /* Download delivery infosheet of given message identified by ID.
962 * @context is session context
963 * @message_id is message identifier (you can get them from
964 * isds_get_list_of_{sent,received}_messages())
965 * @message is automatically reallocated message retrieved from ISDS.
966 * It will miss documents per se. Use isds_get_received_message(), if you are
967 * interrested in documents (content). OTOH, only this function can get list
968 * events message has gone through. */
969 isds_error isds_get_delivery_info(struct isds_ctx *context,
970 const char *message_id, struct isds_message **message);
972 /* Deprecated: Use isds_load_message() instead. */
973 /* Load incoming message from buffer.
974 * @context is session context
975 * @buffer XML stream with unsigned message. You can retrieve such data from
976 * message->raw after calling isds_get_received_message().
977 * @length is length of buffer in bytes.
978 * @message is automatically reallocated message parsed from @buffer.
979 * @strategy selects how buffer will be attached into raw isds_message member.
980 * */
981 isds_error isds_load_received_message(struct isds_ctx *context,
982 const void *buffer, const size_t length,
983 struct isds_message **message, const isds_buffer_strategy strategy)
984 _deprecated;
986 /* Download incoming message identified by ID.
987 * @context is session context
988 * @message_id is message identifier (you can get them from
989 * isds_get_list_of_received_messages())
990 * @message is automatically reallocated message retrieved from ISDS */
991 isds_error isds_get_received_message(struct isds_ctx *context,
992 const char *message_id, struct isds_message **message);
994 /* Deprecated: Use isds_load_message() instead. */
995 /* Load signed message from buffer.
996 * @context is session context
997 * @outgoing is true if message is outgoing, false if message is incoming
998 * @buffer is DER encoded PKCS#7 structure with signed message. You can
999 * retrieve such data from message->raw after calling
1000 * isds_get_signed{received,sent}_message().
1001 * @length is length of buffer in bytes.
1002 * @message is automatically reallocated message parsed from @buffer.
1003 * @strategy selects how buffer will be attached into raw isds_message member.
1004 * */
1005 isds_error isds_load_signed_message(struct isds_ctx *context,
1006 const _Bool outgoing, const void *buffer, const size_t length,
1007 struct isds_message **message, const isds_buffer_strategy strategy)
1008 _deprecated;
1010 /* Load message of any type from buffer.
1011 * @context is session context
1012 * @raw_type defines content type of @buffer. Only message types are allowed.
1013 * @buffer is message raw representation. Format (CMS, plain signed,
1014 * message direction) is defined in @raw_type. You can retrieve such data
1015 * from message->raw after calling isds_get_[signed]{received,sent}_message().
1016 * @length is length of buffer in bytes.
1017 * @message is automatically reallocated message parsed from @buffer.
1018 * @strategy selects how buffer will be attached into raw isds_message member.
1019 * */
1020 isds_error isds_load_message(struct isds_ctx *context,
1021 const isds_raw_type raw_type, const void *buffer, const size_t length,
1022 struct isds_message **message, const isds_buffer_strategy strategy);
1024 /* Download signed incoming message identified by ID.
1025 * @context is session context
1026 * @message_id is message identifier (you can get them from
1027 * isds_get_list_of_received_messages())
1028 * @message is automatically reallocated message retrieved from ISDS. The raw
1029 * memeber will be filled with PKCS#7 structure in DER format. */
1030 isds_error isds_get_signed_received_message(struct isds_ctx *context,
1031 const char *message_id, struct isds_message **message);
1033 /* Download signed outgoing message identified by ID.
1034 * @context is session context
1035 * @message_id is message identifier (you can get them from
1036 * isds_get_list_of_sent_messages())
1037 * @message is automatically reallocated message retrieved from ISDS. The raw
1038 * memeber will be filled with PKCS#7 structure in DER format. */
1039 isds_error isds_get_signed_sent_message(struct isds_ctx *context,
1040 const char *message_id, struct isds_message **message);
1042 /* Retrieve hash of message identified by ID stored in ISDS.
1043 * @context is session context
1044 * @message_id is message identifier
1045 * @hash is automatically reallocated message hash downloaded from ISDS.
1046 * Message must exist in system and must not be deleted. */
1047 isds_error isds_download_message_hash(struct isds_ctx *context,
1048 const char *message_id, struct isds_hash **hash);
1050 /* Compute hash of message from raw representation and store it into envelope.
1051 * Original hash structure will be destroyed in envelope.
1052 * @context is session context
1053 * @message is message carrying raw XML message blob
1054 * @algorithm is desired hash algorithm to use */
1055 isds_error isds_compute_message_hash(struct isds_ctx *context,
1056 struct isds_message *message, const isds_hash_algorithm algorithm);
1058 /* Compare two hashes.
1059 * @h1 is first hash
1060 * @h2 is another hash
1061 * @return
1062 * IE_SUCCESS if hashes equal
1063 * IE_NOTUNIQ if hashes are comparable, but they don't equal
1064 * IE_ENUM if not comparable, but both structures defined
1065 * IE_INVAL if some of the structures are undefined (NULL)
1066 * IE_ERROR if internal error occurs */
1067 isds_error isds_hash_cmp(const struct isds_hash *h1,
1068 const struct isds_hash *h2);
1070 /* Check message has gone through ISDS by comparing message hash stored in
1071 * ISDS and locally computed hash. You must provide message with valid raw
1072 * member (do not use isds_load_message(..., BUFFER_DONT_STORE)).
1073 * This is convenient wrapper for isds_download_message_hash(),
1074 * isds_compute_message_hash(), and isds_hash_cmp() sequence.
1075 * @context is session context
1076 * @message is message with valid raw and envelope member; envelope->hash
1077 * member will be changed during funcion run. Use envelope on heap only.
1078 * @return
1079 * IE_SUCCESS if message originates in ISDS
1080 * IE_NOTEQUAL if message is unknown to ISDS
1081 * other code for other errors */
1082 isds_error isds_verify_message_hash(struct isds_ctx *context,
1083 struct isds_message *message);
1085 /* Mark message as read. This is a transactional commit function to acknoledge
1086 * to ISDS the message has been downloaded and processed by client properly.
1087 * @context is session context
1088 * @message_id is message identifier. */
1089 isds_error isds_mark_message_read(struct isds_ctx *context,
1090 const char *message_id);
1092 /* Mark message as received by recipient. This is applicable only to
1093 * commercial message. There is no specified way how to distinguishe
1094 * commercial message from government message yet. Government message is
1095 * received automatically (by law), commenrcial message on recipient request.
1096 * @context is session context
1097 * @message_id is message identifier. */
1098 isds_error isds_mark_message_received(struct isds_ctx *context,
1099 const char *message_id);
1101 /* Send bogus request to ISDS.
1102 * Just for test purposes */
1103 isds_error isds_bogus_request(struct isds_ctx *context);
1105 /* Send document for authorize conversion into Czech POINT system.
1106 * This is public anonymous service, no login necessary. Special context is
1107 * used to reuse keep-a-live HTTPS connection.
1108 * @context is Czech POINT session context. DO NOT use context connected to
1109 * ISDS server. Use new context or context used by this function previously.
1110 * @document is document to convert. Only data, data_length and dmFileDescr
1111 * memebers are signifact. Be ware that not all document formats can be
1112 * converted (signed PDF 1.3 and higher only (2010-02 state)).
1113 * @id is reallocated identifier assigned by Czech POINT system to
1114 * your document on submit. Use is to tell it to Czech POINT officer.
1115 * @date is reallocated document submit date (submitted documents
1116 * expires after some period). Only tm_year, tm_mon and tm_mday carry sane
1117 * value. */
1118 isds_error czp_convert_document(struct isds_ctx *context,
1119 const struct isds_document *document,
1120 char **id, struct tm **date);
1122 /* Close possibly opened connection to Czech POINT document deposit.
1123 * @context is Czech POINT session context. */
1124 isds_error czp_close_connection(struct isds_ctx *context);
1126 /* Send request for new box creation in testing ISDS instance.
1127 * It's not possible to requst for a production box currently, as it
1128 * communicates via e-mail.
1129 * XXX: This function does not work either. Server complains about invalid
1130 * e-mail address.
1131 * XXX: Remove context->type hacks in isds.c and validator.c when removing
1132 * this function
1133 * @context is special session context for box creation request. DO NOT use
1134 * standard context as it could reveal your password. Use fresh new context or
1135 * context previously used by this function.
1136 * @box is box description to create including single primary user (in case of
1137 * FO box type). It outputs box ID assigned by ISDS in dbID element.
1138 * @users is list of struct isds_DbUserInfo (primary users in case of non-FO
1139 * box, or contact address of PFO box owner). The email member is mandatory as
1140 * it will be used to deliver credentials.
1141 * @former_names is optional undocumented string. Pass NULL if you don't care.
1142 * @approval is optional external approval of box manipulation
1143 * @refnumber is reallocated serial number of request assigned by ISDS. Use
1144 * NULL, if you don't care.*/
1145 isds_error isds_request_new_testing_box(struct isds_ctx *context,
1146 struct isds_DbOwnerInfo *box, const struct isds_list *users,
1147 const char *former_names, const struct isds_approval *approval,
1148 char **refnumber);
1150 /* Search for document by document ID in list of documents. IDs are compared
1151 * as UTF-8 string.
1152 * @documents is list of isds_documents
1153 * @id is document identifier
1154 * @return first matching document or NULL. */
1155 const struct isds_document *isds_find_document_by_id(
1156 const struct isds_list *documents, const char *id);
1158 /* Free isds_list with all member data.
1159 * @list list to free, on return will be NULL */
1160 void isds_list_free(struct isds_list **list);
1162 /* Deallocate structure isds_hash and NULL it.
1163 * @hash hash to to free */
1164 void isds_hash_free(struct isds_hash **hash);
1166 /* Deallocate structure isds_DbOwnerInfo recursively and NULL it */
1167 void isds_DbOwnerInfo_free(struct isds_DbOwnerInfo **db_owner_info);
1169 /* Deallocate structure isds_DbUserInfo recursively and NULL it */
1170 void isds_DbUserInfo_free(struct isds_DbUserInfo **db_user_info);
1172 /* Deallocate struct isds_event recursively and NULL it */
1173 void isds_event_free(struct isds_event **event);
1175 /* Deallocate struct isds_envelope recursively and NULL it */
1176 void isds_envelope_free(struct isds_envelope **envelope);
1178 /* Deallocate struct isds_document recursively and NULL it */
1179 void isds_document_free(struct isds_document **document);
1181 /* Deallocate struct isds_message recursively and NULL it */
1182 void isds_message_free(struct isds_message **message);
1184 /* Deallocate struct isds_message_copy recursively and NULL it */
1185 void isds_message_copy_free(struct isds_message_copy **copy);
1187 /* Deallocate struct isds_approval recursively and NULL it */
1188 void isds_approval_free(struct isds_approval **approval);
1190 /* Copy structure isds_PersonName recursively */
1191 struct isds_PersonName *isds_PersonName_duplicate(
1192 const struct isds_PersonName *template);
1194 /* Copy structure isds_Address recursively */
1195 struct isds_Address *isds_Address_duplicate(
1196 const struct isds_Address *template);
1198 /* Copy structure isds_DbOwnerInfo recursively */
1199 struct isds_DbOwnerInfo *isds_DbOwnerInfo_duplicate(
1200 const struct isds_DbOwnerInfo *template);
1202 /* Copy structure isds_DbUserInfo recursively */
1203 struct isds_DbUserInfo *isds_DbUserInfo_duplicate(
1204 const struct isds_DbUserInfo *template);
1206 #ifdef __cplusplus /* For C++ linker sake */
1208 #endif
1210 #endif