Fixed CLOSE
[yaz-moved-to-github.git] / include / proto.h
1 /*
2  * Copyright (c) 1995, Index Data.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software and
5  * its documentation, in whole or in part, for any purpose, is hereby granted,
6  * provided that:
7  *
8  * 1. This copyright and permission notice appear in all copies of the
9  * software and its documentation. Notices of copyright or attribution
10  * which appear at the beginning of any file must remain unchanged.
11  *
12  * 2. The name of Index Data or the individual authors may not be used to
13  * endorse or promote products derived from this software without specific
14  * prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
18  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
19  * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
20  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
21  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR
22  * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
23  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
24  * OF THIS SOFTWARE.
25  *
26  * $Log: proto.h,v $
27  * Revision 1.14  1995-06-07 14:42:34  quinn
28  * Fixed CLOSE
29  *
30  * Revision 1.13  1995/06/07  14:36:47  quinn
31  * Added CLOSE
32  *
33  * Revision 1.12  1995/06/05  10:53:13  quinn
34  * Smallish.
35  *
36  * Revision 1.11  1995/06/02  09:49:47  quinn
37  * Add access control
38  *
39  * Revision 1.10  1995/05/29  08:11:34  quinn
40  * Moved oid from odr/asn to util.
41  *
42  * Revision 1.9  1995/05/22  11:31:25  quinn
43  * Added PDUs
44  *
45  * Revision 1.8  1995/05/17  08:41:35  quinn
46  * Added delete to proto & other little things.
47  * Relaying auth info to backend.
48  *
49  * Revision 1.7  1995/05/16  08:50:37  quinn
50  * License, documentation, and memory fixes
51  *
52  * Revision 1.6  1995/05/15  11:55:55  quinn
53  * Work on asynchronous activity.
54  *
55  * Revision 1.5  1995/04/17  11:28:18  quinn
56  * Smallish
57  *
58  * Revision 1.4  1995/04/10  10:22:47  quinn
59  * Added SCAN
60  *
61  * Revision 1.3  1995/03/30  12:18:09  quinn
62  * Added info.
63  *
64  * Revision 1.2  1995/03/30  10:26:48  quinn
65  * Added Term structure
66  *
67  * Revision 1.1  1995/03/30  09:39:42  quinn
68  * Moved .h files to include directory
69  *
70  * Revision 1.11  1995/03/30  09:08:44  quinn
71  * Added Resource control protocol
72  *
73  * Revision 1.10  1995/03/29  15:39:39  quinn
74  * Adding some resource control elements, and a null-check to getentbyoid
75  *
76  * Revision 1.9  1995/03/29  08:06:18  quinn
77  * Added a few v3 elements
78  *
79  * Revision 1.8  1995/03/22  10:12:49  quinn
80  * Added Z_PRES constants.
81  *
82  * Revision 1.7  1995/03/20  09:45:12  quinn
83  * Working towards v3
84  *
85  * Revision 1.5  1995/03/07  16:29:34  quinn
86  * Added authentication stuff.
87  *
88  * Revision 1.4  1995/03/07  10:13:00  quinn
89  * Added prototype for z_APDU()
90  *
91  * Revision 1.3  1995/02/14  11:54:23  quinn
92  * Fixing include.
93  *
94  * Revision 1.2  1995/02/09  15:51:40  quinn
95  * Works better now.
96  *
97  * Revision 1.1  1995/02/06  16:44:48  quinn
98  * First hack at Z/SR protocol
99  *
100  */
101
102 #ifndef PROTO_H
103 #define PROTO_H
104
105 #include <odr.h>
106 #include <oid.h>
107 #include <odr_use.h>
108
109 /* ----------------- GLOBAL AUXILIARY DEFS ----------------*/
110
111 typedef Odr_oct Z_ReferenceId;
112 typedef char Z_DatabaseName;
113 typedef char Z_ResultSetId;
114 typedef Odr_oct Z_ResultsetId;
115 typedef Odr_external Z_UserInformationField;
116
117 typedef struct Z_InfoCategory
118 {
119     Odr_oid *categoryTypeId;         /* OPTIONAL */
120     int *categoryValue;
121 } Z_InfoCategory;
122
123 typedef struct Z_OtherInformationUnit
124 {
125     Z_InfoCategory *category;        /* OPTIONAL */
126     enum
127     {
128         Z_OtherInfo_characterInfo,
129         Z_OtherInfo_binaryInfo,
130         Z_OtherInfo_externallyDefinedInfo,
131         Z_OtherInfo_oid
132     } which;
133     union
134     {
135         char *characterInfo; 
136         Odr_oct *binaryInfo;
137         Odr_external *externallyDefinedInfo;
138         Odr_oid *oid;
139     } information;
140 } Z_OtherInformationUnit;
141
142 typedef struct Z_OtherInformation
143 {
144     int num_elements;
145     Z_OtherInformationUnit **list;
146 } Z_OtherInformation;
147
148 typedef struct Z_StringOrNumeric
149 {
150     enum
151     {
152         Z_StringOrNumeric_string,
153         Z_StringOrNumeric_numeric
154     } which;
155     union
156     {
157         char *string;
158         int *numeric;
159     } u;
160 } Z_StringOrNumeric;
161
162 typedef struct Z_Unit
163 {
164     char *unitSystem;               /* OPTIONAL */
165     Z_StringOrNumeric *unitType;    /* OPTIONAL */
166     Z_StringOrNumeric *unit;        /* OPTIONAL */
167     int *scaleFactor;               /* OPTIONAL */
168 } Z_Unit;
169
170 typedef struct Z_IntUnit
171 {
172     int *value;
173     Z_Unit *unitUsed;
174 } Z_IntUnit;
175
176 /* ----------------- INIT SERVICE  ----------------*/
177
178 typedef struct
179 {
180     char *groupId;       /* OPTIONAL */
181     char *userId;         /* OPTIONAL */
182     char *password;      /* OPTIONAL */
183 } Z_IdPass;
184
185 typedef struct Z_IdAuthentication
186 {
187     enum
188     {
189         Z_IdAuthentication_open,
190         Z_IdAuthentication_idPass,
191         Z_IdAuthentication_anonymous,
192         Z_IdAuthentication_other
193     } which;
194     union
195     {
196         char *open;
197         Z_IdPass *idPass;
198         Odr_null *anonymous;
199         Odr_external *other;
200     } u;
201 } Z_IdAuthentication;
202
203 #define Z_ProtocolVersion_1            0
204 #define Z_ProtocolVersion_2            1
205 #define Z_ProtocolVersion_3            2
206
207 #define Z_Options_search               0
208 #define Z_Options_present              1
209 #define Z_Options_delSet               2
210 #define Z_Options_resourceReport       3
211 #define Z_Options_triggerResourceCtrl  4
212 #define Z_Options_resourceCtrl         5
213 #define Z_Options_accessCtrl           6
214 #define Z_Options_scan                 7
215 #define Z_Options_sort                 8
216 #define Z_Options_reserved             9
217 #define Z_Options_extendedServices    10
218 #define Z_Options_level_1Segmentation 11
219 #define Z_Options_level_2Segmentation 12
220 #define Z_Options_concurrentOperations 13
221 #define Z_Options_namedResultSets     14
222
223 typedef struct Z_InitRequest
224 {
225     Z_ReferenceId *referenceId;                   /* OPTIONAL */
226     Odr_bitmask *options;
227     Odr_bitmask *protocolVersion;
228     int *preferredMessageSize;
229     int *maximumRecordSize;
230     Z_IdAuthentication* idAuthentication;        /* OPTIONAL */
231     char *implementationId;                      /* OPTIONAL */
232     char *implementationName;                    /* OPTIONAL */
233     char *implementationVersion;                 /* OPTIONAL */
234     Z_UserInformationField *userInformationField; /* OPTIONAL */
235 } Z_InitRequest;
236
237 typedef struct Z_InitResponse
238 {
239     Z_ReferenceId *referenceId;    /* OPTIONAL */
240     Odr_bitmask *options;
241     Odr_bitmask *protocolVersion;
242     int *preferredMessageSize;
243     int *maximumRecordSize;
244     bool_t *result;
245     char *implementationId;      /* OPTIONAL */
246     char *implementationName;    /* OPTIONAL */
247     char *implementationVersion; /* OPTIONAL */
248     Z_UserInformationField *userInformationField; /* OPTIONAL */
249 } Z_InitResponse;
250
251 typedef struct Z_NSRAuthentication
252 {
253     char *user;
254     char *password;
255     char *account;
256 } Z_NSRAuthentication;
257
258 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt);
259
260 int z_StrAuthentication(ODR o, char **p, int opt);
261
262
263 /* ------------------ RESOURCE CONTROL ----------------*/
264
265 typedef struct Z_TriggerResourceControlRequest
266 {
267     Z_ReferenceId *referenceId;    /* OPTIONAL */
268     int *requestedAction;
269 #define Z_TriggerResourceCtrl_resourceReport  1
270 #define Z_TriggerResourceCtrl_resourceControl 2
271 #define Z_TriggerResourceCtrl_cancel          3
272     Odr_oid *prefResourceReportFormat;  /* OPTIONAL */
273     bool_t *resultSetWanted;            /* OPTIONAL */
274 } Z_TriggerResourceControlRequest;
275
276 typedef struct Z_ResourceControlRequest
277 {
278     Z_ReferenceId *referenceId;    /* OPTIONAL */
279     bool_t *suspendedFlag;         /* OPTIONAL */
280     Odr_external *resourceReport; /* OPTIONAL */
281     int *partialResultsAvailable;  /* OPTIONAL */
282 #define Z_ResourceControlRequest_subset    1
283 #define Z_ResourceControlRequest_interim   2
284 #define Z_ResourceControlRequest_none      3
285     bool_t *responseRequired;
286     bool_t *triggeredRequestFlag;  /* OPTIONAL */
287 } Z_ResourceControlRequest;
288
289 typedef struct Z_ResourceControlResponse
290 {
291     Z_ReferenceId *referenceId;    /* OPTIONAL */
292     bool_t *continueFlag;
293     bool_t *resultSetWanted;       /* OPTIONAL */
294 } Z_ResourceControlResponse;
295
296 /* ------------------ SEARCH SERVICE ----------------*/
297
298 typedef Odr_oid Z_PreferredRecordSyntax;
299
300 typedef struct Z_DatabaseSpecificUnit
301 {
302     char *databaseName;
303     char *elementSetName;
304 } Z_DatabaseSpecificUnit;
305
306 typedef struct Z_DatabaseSpecific
307 {
308     int num_elements;
309     Z_DatabaseSpecificUnit **elements;
310 } Z_DatabaseSpecific;
311
312 typedef struct Z_ElementSetNames
313 {
314     int which;
315 #define Z_ElementSetNames_generic 0
316 #define Z_ElementSetNames_databaseSpecific 1
317     union
318     {
319         char *generic;
320         Z_DatabaseSpecific *databaseSpecific;
321     } u;
322 } Z_ElementSetNames;
323
324 /* ---------------------- RPN QUERY --------------------------- */
325
326 typedef struct Z_AttributeElement
327 {
328     int *attributeType;
329     int *attributeValue;
330 } Z_AttributeElement;
331
332 #define Z_V3
333 #ifdef Z_V3
334
335 typedef struct Z_Term 
336 {
337     enum
338     {
339         Z_Term_general,
340         Z_Term_numeric,
341         Z_Term_characterString,
342         Z_Term_oid,
343         Z_Term_dateTime,
344         Z_Term_external,
345         Z_Term_integerAndUnit,
346         Z_Term_null
347     } which;
348     union
349     {
350         Odr_oct *general; /* this is required for v2 */
351         int *numeric;
352         char *characterString;
353         Odr_oid *oid;
354         char *dateTime;
355         Odr_external *external;
356         /* Z_IntUnit *integerAndUnit; */
357         Odr_null *null;
358     } u;
359 } Z_Term;
360
361 #endif
362
363 typedef struct Z_AttributesPlusTerm
364 {
365     int num_attributes;
366     Z_AttributeElement **attributeList;
367 #ifdef Z_V3
368     Z_Term *term;
369 #else
370     Odr_oct *term;
371 #endif
372 } Z_AttributesPlusTerm;
373
374 typedef struct Z_ProximityOperator
375 {
376     bool_t *exclusion;          /* OPTIONAL */
377     int *distance;
378     bool_t *ordered;
379     int *relationType;
380 #define Z_Prox_lessThan           1
381 #define Z_Prox_lessThanOrEqual    2
382 #define Z_Prox_equal              3
383 #define Z_Prox_greaterThanOrEqual 4
384 #define Z_Prox_greaterThan        5
385 #define Z_Prox_notEqual           6
386     enum
387     {
388         Z_ProxCode_known,
389         Z_ProxCode_private
390     } which;
391     int *proximityUnitCode;
392 #define Z_ProxUnit_character       1
393 #define Z_ProxUnit_word            2
394 #define Z_ProxUnit_sentence        3
395 #define Z_ProxUnit_paragraph       4
396 #define Z_ProxUnit_section         5
397 #define Z_ProxUnit_chapter         6
398 #define Z_ProxUnit_document        7
399 #define Z_ProxUnit_element         8
400 #define Z_ProxUnit_subelement      9
401 #define Z_ProxUnit_elementType    10
402 #define Z_ProxUnit_byte           11   /* v3 only */
403 } Z_ProximityOperator;
404
405 typedef struct Z_Operator
406 {
407     enum
408     {
409         Z_Operator_and,
410         Z_Operator_or,
411         Z_Operator_and_not,
412         Z_Operator_prox
413     } which;
414     union
415     {
416         Odr_null *and;          /* these guys are nulls. */
417         Odr_null *or;
418         Odr_null *and_not;
419         Z_ProximityOperator *prox;
420     } u;
421 } Z_Operator;
422
423 typedef struct Z_Operand
424 {
425     int which;
426 #define Z_Operand_APT 0
427 #define Z_Operand_resultSetId 1
428     union
429     {
430         Z_AttributesPlusTerm *attributesPlusTerm;
431         Z_ResultSetId *resultSetId;
432     } u;
433 } Z_Operand;
434
435 typedef struct Z_Complex
436 {
437     struct Z_RPNStructure *s1;
438     struct Z_RPNStructure *s2;
439     Z_Operator *operator;
440 } Z_Complex;
441
442 typedef struct Z_RPNStructure
443 {
444     int which;
445 #define Z_RPNStructure_simple 0
446 #define Z_RPNStructure_complex 1
447     union
448     {
449         Z_Operand *simple;
450         Z_Complex *complex;
451     } u;
452 } Z_RPNStructure;
453
454 typedef struct Z_RPNQuery
455 {
456     Odr_oid *attributeSetId;
457     Z_RPNStructure *RPNStructure;
458 } Z_RPNQuery;
459
460 /* -------------------------- SEARCHREQUEST -------------------------- */
461
462 typedef struct Z_Query
463 {
464     int which;
465 #define Z_Query_type_1 1
466 #define Z_Query_type_2 2
467     union
468     {
469         Z_RPNQuery *type_1;
470         Odr_oct *type_2;
471     } u;
472 } Z_Query;
473
474 typedef struct Z_SearchRequest
475 {
476     Z_ReferenceId *referenceId;   /* OPTIONAL */
477     int *smallSetUpperBound;
478     int *largeSetLowerBound;
479     int *mediumSetPresentNumber;
480     bool_t *replaceIndicator;
481     char *resultSetName;
482     int num_databaseNames;
483     char **databaseNames;
484     Z_ElementSetNames *smallSetElementSetNames;    /* OPTIONAL */
485     Z_ElementSetNames *mediumSetElementSetNames;    /* OPTIONAL */
486     Z_PreferredRecordSyntax *preferredRecordSyntax;  /* OPTIONAL */
487     Z_Query *query;
488 } Z_SearchRequest;
489
490 /* ------------------------ RECORD -------------------------- */
491
492 typedef Odr_external Z_DatabaseRecord;
493
494 typedef struct Z_DiagRec
495 {
496     Odr_oid *diagnosticSetId;
497     int *condition;
498     char *addinfo;
499 } Z_DiagRec;
500
501 typedef struct Z_NamePlusRecord
502 {
503     char *databaseName;      /* OPTIONAL */
504     int which;
505 #define Z_NamePlusRecord_databaseRecord 0
506 #define Z_NamePlusRecord_surrogateDiagnostic 1
507     union
508     {
509         Z_DatabaseRecord *databaseRecord;
510         Z_DiagRec *surrogateDiagnostic;
511     } u;
512 } Z_NamePlusRecord;
513
514 typedef struct Z_NamePlusRecordList
515 {
516     int num_records;
517     Z_NamePlusRecord **records;
518 } Z_NamePlusRecordList;
519
520 typedef struct Z_Records
521 {
522     int which;
523 #define Z_Records_DBOSD 0
524 #define Z_Records_NSD 1
525     union
526     {
527         Z_NamePlusRecordList *databaseOrSurDiagnostics;
528         Z_DiagRec *nonSurrogateDiagnostic;
529     } u;
530 } Z_Records;
531
532 /* ------------------ ACCESS CTRL SERVICE ----------------*/
533
534 typedef struct Z_AccessControlRequest
535 {
536     Z_ReferenceId *referenceId;           /* OPTIONAL */
537     enum
538     {
539         Z_AccessRequest_simpleForm,
540         Z_AccessRequest_externallyDefined
541     } which;
542     union
543     {
544         Odr_oct *simpleForm;
545         Odr_external *externallyDefined;
546     } u;
547 #ifdef Z_OTHERINFO
548     Z_OtherInformation *otherInfo;           /* OPTIONAL */
549 #endif
550 } Z_AccessControlRequest;
551
552 typedef struct Z_AccessControlResponse
553 {
554     Z_ReferenceId *referenceId;              /* OPTIONAL */
555     enum
556     {
557         Z_AccessResponse_simpleForm,
558         Z_AccessResponse_externallyDefined
559     } which;
560     union
561     {
562         Odr_oct *simpleForm;
563         Odr_external *externallyDefined;
564     } u;
565     Z_DiagRec *diagnostic;                   /* OPTIONAL */
566 #ifdef Z_OTHERINFO
567     Z_OtherInformation *otherInfo;           /* OPTIONAL */
568 #endif
569 } Z_AccessControlResponse;
570
571 /* ------------------------ SCAN SERVICE -------------------- */
572
573 typedef struct Z_AttributeList
574 {
575     int num_attributes;
576     Z_AttributeElement **attributes;
577 } Z_AttributeList;
578
579 typedef struct Z_AlternativeTerm
580 {
581     int num_terms;
582     Z_AttributesPlusTerm **terms;
583 } Z_AlternativeTerm;
584
585 typedef struct Z_OccurrenceByAttributes
586 {
587     Z_AttributeList *attributes;
588 #if 0
589     enum
590     {
591         Z_OByAtt_global,
592         Z_ObyAtt_byDatabase
593     } which;
594     union
595     {
596 #endif
597         int *global;
598 #if 0
599         /* Z_ByDatabase *byDatabase; */
600     } u;
601 #endif
602 } Z_OccurrenceByAttributes;
603
604 typedef struct Z_TermInfo
605 {
606     Z_Term *term;
607     Z_AttributeList *suggestedAttributes;  /* OPTIONAL */
608     Z_AlternativeTerm *alternativeTerm;    /* OPTIONAL */
609     int *globalOccurrences;                /* OPTIONAL */
610     Z_OccurrenceByAttributes *byAttributes; /* OPTIONAL */
611 } Z_TermInfo;
612
613 typedef struct Z_Entry
614 {
615     enum
616     {
617         Z_Entry_termInfo,
618         Z_Entry_surrogateDiagnostic
619     } which;
620     union
621     {
622         Z_TermInfo *termInfo;
623         Z_DiagRec *surrogateDiagnostic;
624     } u;
625 } Z_Entry;
626
627 typedef struct Z_Entries
628 {
629     int num_entries;
630     Z_Entry **entries;
631 } Z_Entries;
632
633 typedef struct Z_DiagRecs
634 {
635     int num_diagRecs;
636     Z_DiagRec **diagRecs;
637 } Z_DiagRecs;
638
639 typedef struct Z_ListEntries
640 {
641     enum
642     {
643         Z_ListEntries_entries,
644         Z_ListEntries_nonSurrogateDiagnostics
645     } which;
646     union
647     {
648         Z_Entries *entries;
649         Z_DiagRecs *nonSurrogateDiagnostics;
650     } u;
651 } Z_ListEntries;
652
653 typedef struct Z_ScanRequest
654 {
655     Z_ReferenceId *referenceId;       /* OPTIONAL */
656     int num_databaseNames;
657     char **databaseNames;
658     Odr_oid *attributeSet;          /* OPTIONAL */
659     Z_AttributesPlusTerm *termListAndStartPoint;
660     int *stepSize;                    /* OPTIONAL */
661     int *numberOfTermsRequested;
662     int *preferredPositionInResponse;   /* OPTIONAL */
663 } Z_ScanRequest;
664
665 typedef struct Z_ScanResponse
666 {
667     Z_ReferenceId *referenceId;       /* OPTIONAL */
668     int *stepSize;                    /* OPTIONAL */
669     int *scanStatus;
670 #define Z_Scan_success      0
671 #define Z_Scan_partial_1    1
672 #define Z_Scan_partial_2    2
673 #define Z_Scan_partial_3    3
674 #define Z_Scan_partial_4    4
675 #define Z_Scan_partial_5    5
676 #define Z_Scan_failure      6
677     int *numberOfEntriesReturned;
678     int *positionOfTerm;              /* OPTIONAL */
679     Z_ListEntries *entries;           /* OPTIONAL */
680     Odr_oid *attributeSet;            /* OPTIONAL */
681 } Z_ScanResponse; 
682
683 /* ------------------------ SEARCHRESPONSE ------------------ */
684
685 typedef struct Z_SearchResponse
686 {
687     Z_ReferenceId *referenceId;       /* OPTIONAL */
688     int *resultCount;
689     int *numberOfRecordsReturned;
690     int *nextResultSetPosition;
691     bool_t *searchStatus;
692     int *resultSetStatus;              /* OPTIONAL */
693 #define Z_RES_SUBSET        1
694 #define Z_RES_INTERIM       2
695 #define Z_RES_NONE          3
696     int *presentStatus;                /* OPTIONAL */
697 #define Z_PRES_SUCCESS      0
698 #define Z_PRES_PARTIAL_1    1
699 #define Z_PRES_PARTIAL_2    2
700 #define Z_PRES_PARTIAL_3    3
701 #define Z_PRES_PARTIAL_4    4
702 #define Z_PRES_FAILURE      5
703     Z_Records *records;                  /* OPTIONAL */
704 } Z_SearchResponse;
705
706 /* ------------------------- PRESENT SERVICE -----------------*/
707
708 typedef struct Z_PresentRequest
709 {
710     Z_ReferenceId *referenceId;          /* OPTIONAL */
711     Z_ResultSetId *resultSetId;
712     int *resultSetStartPoint;
713     int *numberOfRecordsRequested;
714     Z_ElementSetNames *elementSetNames;  /* OPTIONAL */
715     Z_PreferredRecordSyntax *preferredRecordSyntax;  /* OPTIONAL */
716 } Z_PresentRequest;
717
718 typedef struct Z_PresentResponse
719 {
720     Z_ReferenceId *referenceId;        /* OPTIONAL */
721     int *numberOfRecordsReturned;
722     int *nextResultSetPosition;
723     int *presentStatus;
724     Z_Records *records;
725 } Z_PresentResponse;
726
727 /* ------------------------ DELETE -------------------------- */
728
729 #define Z_DeleteStatus_success                          0
730 #define Z_DeleteStatus_resultSetDidNotExist             1
731 #define Z_DeleteStatus_previouslyDeletedByTarget        2
732 #define Z_DeleteStatus_systemProblemAtTarget            3
733 #define Z_DeleteStatus_accessNotAllowed                 4
734 #define Z_DeleteStatus_resourceControlAtOrigin          5
735 #define Z_DeleteStatus_resourceControlAtTarget          6
736 #define Z_DeleteStatus_bulkDeleteNotSupported           7
737 #define Z_DeleteStatus_notAllRsltSetsDeletedOnBulkDlte  8
738 #define Z_DeleteStatus_notAllRequestedResultSetsDeleted 9
739 #define Z_DeleteStatus_resultSetInUse                  10
740
741 typedef struct Z_ListStatus
742 {
743     Z_ResultSetId *id;
744     int *status;
745 } Z_ListStatus;
746
747 typedef struct Z_DeleteResultSetRequest
748 {
749     Z_ReferenceId *referenceId;        /* OPTIONAL */
750     int *deleteFunction;
751 #define Z_DeleteRequest_list    0
752 #define Z_DeleteRequest_all     1
753     int num_ids;
754     Z_ResultSetId **resultSetList;      /* OPTIONAL */
755 #ifdef Z_OTHERINFO
756     Z_OtherInformation *otherInfo;
757 #endif
758 } Z_DeleteResultSetRequest;
759
760 typedef struct Z_DeleteResultSetResponse
761 {
762     Z_ReferenceId *referenceId;        /* OPTIONAL */
763     int *deleteOperationStatus;
764     int num_statuses;
765     Z_ListStatus *deleteListStatuses;  /* OPTIONAL */
766     int *numberNotDeleted;             /* OPTIONAL */
767     int num_bulkStatuses;
768     Z_ListStatus *bulkStatuses;        /* OPTIONAL */
769     char *deleteMessage;               /* OPTIONAL */
770 #ifdef Z_OTHERINFO
771     Z_OtherInformation *otherInfo;
772 #endif
773 } Z_DeleteResultSetResponse;
774
775 /* ------------------------ CLOSE SERVICE ------------------- */
776
777 typedef struct Z_Close
778 {
779     Z_ReferenceId *referenceId;         /* OPTIONAL */
780     int *closeReason;
781 #define Z_Close_finished           0
782 #define Z_Close_shutdown           1
783 #define Z_Close_systemProblem      2
784 #define Z_Close_costLimit          3
785 #define Z_Close_resources          4
786 #define Z_Close_securityViolation  5
787 #define Z_Close_protocolError      6
788 #define Z_Close_lackOfActivity     7
789 #define Z_Close_peerAbort          8
790 #define Z_Close_unspecified        9
791     char *diagnosticInformation;          /* OPTIONAL */
792     Odr_oid *resourceReportFormat;        /* OPTIONAL */
793     Odr_external *resourceReport;         /* OPTIONAL */
794 #ifdef Z_OTHERINFO
795     Z_OtherInformation *otherInfo;        /* OPTIONAL */
796 #endif
797 } Z_Close;
798
799 /* ------------------------ APDU ---------------------------- */
800
801 typedef struct Z_APDU
802 {    
803     enum Z_APDU_which
804     {
805         Z_APDU_initRequest,
806         Z_APDU_initResponse,
807         Z_APDU_searchRequest,
808         Z_APDU_searchResponse,
809         Z_APDU_presentRequest,
810         Z_APDU_presentResponse,
811         Z_APDU_deleteResultSetRequest,
812         Z_APDU_deleteResultSetResponse,
813         Z_APDU_resourceControlRequest,
814         Z_APDU_resourceControlResponse,
815         Z_APDU_triggerResourceControlRequest,
816         Z_APDU_scanRequest,
817         Z_APDU_scanResponse,
818         Z_APDU_close
819     } which;
820     union
821     {
822         Z_InitRequest  *initRequest;
823         Z_InitResponse *initResponse;
824         Z_SearchRequest *searchRequest;
825         Z_SearchResponse *searchResponse;
826         Z_PresentRequest *presentRequest;
827         Z_PresentResponse *presentResponse;
828         Z_DeleteResultSetRequest *deleteResultSetRequest;
829         Z_DeleteResultSetResponse *deleteResultSetResponse;
830         Z_ResourceControlRequest *resourceControlRequest;
831         Z_ResourceControlResponse *resourceControlResponse;
832         Z_TriggerResourceControlRequest *triggerResourceControlRequest;
833         Z_ScanRequest *scanRequest;
834         Z_ScanResponse *scanResponse;
835         Z_Close *close;
836     } u;
837 } Z_APDU;
838
839 int z_APDU(ODR o, Z_APDU **p, int opt);
840
841 Z_InitRequest *zget_InitRequest(ODR o);
842 Z_InitResponse *zget_InitResponse(ODR o);
843 Z_SearchRequest *zget_SearchRequest(ODR o);
844 Z_SearchResponse *zget_SearchResponse(ODR o);
845 Z_PresentRequest *zget_PresentRequest(ODR o);
846 Z_PresentResponse *zget_PresentResponse(ODR o);
847 Z_DeleteResultSetRequest *zget_DeleteResultSetRequest(ODR o);
848 Z_DeleteResultSetResponse *zget_DeleteResultSetResponse(ODR o);
849 Z_ScanRequest *zget_ScanRequest(ODR o);
850 Z_ScanResponse *zget_ScanResponse(ODR o);
851 Z_TriggerResourceControlRequest *zget_TriggerResourceControlRequest(ODR o);
852 Z_ResourceControlRequest *zget_ResourceControlRequest(ODR o);
853 Z_ResourceControlResponse *zget_ResourceControlResponse(ODR o);
854 Z_Close *zget_Close(ODR o);
855 Z_APDU *zget_APDU(ODR o, enum Z_APDU_which which);
856
857 #include <prt-rsc.h>
858 #include <prt-acc.h>
859
860 #endif