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