*** empty log message ***
[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.24  1995-08-29 11:17:43  quinn
28  * *** empty log message ***
29  *
30  * Revision 1.23  1995/08/21  09:10:36  quinn
31  * Smallish fixes to suppport new formats.
32  *
33  * Revision 1.22  1995/08/17  12:45:14  quinn
34  * Fixed minor problems with GRS-1. Added support in c&s.
35  *
36  * Revision 1.21  1995/08/15  12:00:11  quinn
37  * Updated External
38  *
39  * Revision 1.20  1995/08/10  08:54:35  quinn
40  * Added Explain.
41  *
42  * Revision 1.19  1995/06/19  12:38:28  quinn
43  * Reorganized include-files. Added small features.
44  *
45  * Revision 1.18  1995/06/16  13:16:05  quinn
46  * Fixed Defaultdiagformat.
47  *
48  * Revision 1.17  1995/06/15  15:42:05  quinn
49  * Fixed some v3 bugs
50  *
51  * Revision 1.16  1995/06/15  07:45:06  quinn
52  * Moving to v3.
53  *
54  * Revision 1.15  1995/06/14  15:26:43  quinn
55  * *** empty log message ***
56  *
57  * Revision 1.14  1995/06/07  14:42:34  quinn
58  * Fixed CLOSE
59  *
60  * Revision 1.13  1995/06/07  14:36:47  quinn
61  * Added CLOSE
62  *
63  * Revision 1.12  1995/06/05  10:53:13  quinn
64  * Smallish.
65  *
66  * Revision 1.11  1995/06/02  09:49:47  quinn
67  * Add access control
68  *
69  * Revision 1.10  1995/05/29  08:11:34  quinn
70  * Moved oid from odr/asn to util.
71  *
72  * Revision 1.9  1995/05/22  11:31:25  quinn
73  * Added PDUs
74  *
75  * Revision 1.8  1995/05/17  08:41:35  quinn
76  * Added delete to proto & other little things.
77  * Relaying auth info to backend.
78  *
79  * Revision 1.7  1995/05/16  08:50:37  quinn
80  * License, documentation, and memory fixes
81  *
82  * Revision 1.6  1995/05/15  11:55:55  quinn
83  * Work on asynchronous activity.
84  *
85  * Revision 1.5  1995/04/17  11:28:18  quinn
86  * Smallish
87  *
88  * Revision 1.4  1995/04/10  10:22:47  quinn
89  * Added SCAN
90  *
91  * Revision 1.3  1995/03/30  12:18:09  quinn
92  * Added info.
93  *
94  * Revision 1.2  1995/03/30  10:26:48  quinn
95  * Added Term structure
96  *
97  * Revision 1.1  1995/03/30  09:39:42  quinn
98  * Moved .h files to include directory
99  *
100  * Revision 1.11  1995/03/30  09:08:44  quinn
101  * Added Resource control protocol
102  *
103  * Revision 1.10  1995/03/29  15:39:39  quinn
104  * Adding some resource control elements, and a null-check to getentbyoid
105  *
106  * Revision 1.9  1995/03/29  08:06:18  quinn
107  * Added a few v3 elements
108  *
109  * Revision 1.8  1995/03/22  10:12:49  quinn
110  * Added Z_PRES constants.
111  *
112  * Revision 1.7  1995/03/20  09:45:12  quinn
113  * Working towards v3
114  *
115  * Revision 1.5  1995/03/07  16:29:34  quinn
116  * Added authentication stuff.
117  *
118  * Revision 1.4  1995/03/07  10:13:00  quinn
119  * Added prototype for z_APDU()
120  *
121  * Revision 1.3  1995/02/14  11:54:23  quinn
122  * Fixing include.
123  *
124  * Revision 1.2  1995/02/09  15:51:40  quinn
125  * Works better now.
126  *
127  * Revision 1.1  1995/02/06  16:44:48  quinn
128  * First hack at Z/SR protocol
129  *
130  */
131
132 #ifndef PROTO_H
133 #define PROTO_H
134
135 #include <odr.h>
136 #include <oid.h>
137 #include <odr_use.h>
138 #include <yaz-version.h>
139
140 /*
141  * Because we didn't have time to put all of the extra v3 elements in here
142  * before the first applications were written, we have to place them
143  * in #ifdefs in places where they would break existing code. If you are
144  * developing new stuff, we urge you to leave them in, even if you don't
145  * intend to use any v3 features. When we are comfortable that the old
146  * apps have been updated, we'll remove the #ifdefs.
147  */
148
149 #define Z_95
150
151 /* ----------------- GLOBAL AUXILIARY DEFS ----------------*/
152
153 struct Z_External;
154 typedef struct Z_External Z_External;
155
156 typedef Odr_oct Z_ReferenceId;
157 typedef char Z_DatabaseName;
158 typedef char Z_ResultSetId;
159 typedef Odr_oct Z_ResultsetId;
160
161 typedef struct Z_InfoCategory
162 {
163     Odr_oid *categoryTypeId;         /* OPTIONAL */
164     int *categoryValue;
165 } Z_InfoCategory;
166
167 typedef struct Z_OtherInformationUnit
168 {
169     Z_InfoCategory *category;        /* OPTIONAL */
170     enum
171     {
172         Z_OtherInfo_characterInfo,
173         Z_OtherInfo_binaryInfo,
174         Z_OtherInfo_externallyDefinedInfo,
175         Z_OtherInfo_oid
176     } which;
177     union
178     {
179         char *characterInfo; 
180         Odr_oct *binaryInfo;
181         Z_External *externallyDefinedInfo;
182         Odr_oid *oid;
183     } information;
184 } Z_OtherInformationUnit;
185
186 typedef struct Z_OtherInformation
187 {
188     int num_elements;
189     Z_OtherInformationUnit **list;
190 } Z_OtherInformation;
191
192 typedef struct Z_StringOrNumeric
193 {
194     enum
195     {
196         Z_StringOrNumeric_string,
197         Z_StringOrNumeric_numeric
198     } which;
199     union
200     {
201         char *string;
202         int *numeric;
203     } u;
204 } Z_StringOrNumeric;
205
206 typedef struct Z_Unit
207 {
208     char *unitSystem;               /* OPTIONAL */
209     Z_StringOrNumeric *unitType;    /* OPTIONAL */
210     Z_StringOrNumeric *unit;        /* OPTIONAL */
211     int *scaleFactor;               /* OPTIONAL */
212 } Z_Unit;
213
214 typedef struct Z_IntUnit
215 {
216     int *value;
217     Z_Unit *unitUsed;
218 } Z_IntUnit;
219
220 typedef Odr_oct Z_SUTRS;
221
222 /* ----------------- INIT SERVICE  ----------------*/
223
224 typedef struct
225 {
226     char *groupId;       /* OPTIONAL */
227     char *userId;         /* OPTIONAL */
228     char *password;      /* OPTIONAL */
229 } Z_IdPass;
230
231 typedef struct Z_IdAuthentication
232 {
233     enum
234     {
235         Z_IdAuthentication_open,
236         Z_IdAuthentication_idPass,
237         Z_IdAuthentication_anonymous,
238         Z_IdAuthentication_other
239     } which;
240     union
241     {
242         char *open;
243         Z_IdPass *idPass;
244         Odr_null *anonymous;
245         Z_External *other;
246     } u;
247 } Z_IdAuthentication;
248
249 #define Z_ProtocolVersion_1               0
250 #define Z_ProtocolVersion_2               1
251 #define Z_ProtocolVersion_3               2
252
253 #define Z_Options_search                  0
254 #define Z_Options_present                 1
255 #define Z_Options_delSet                  2
256 #define Z_Options_resourceReport          3
257 #define Z_Options_triggerResourceCtrl     4
258 #define Z_Options_resourceCtrl            5
259 #define Z_Options_accessCtrl              6
260 #define Z_Options_scan                    7
261 #define Z_Options_sort                    8
262 #define Z_Options_reserved                9
263 #define Z_Options_extendedServices       10
264 #define Z_Options_level_1Segmentation    11
265 #define Z_Options_level_2Segmentation    12
266 #define Z_Options_concurrentOperations   13
267 #define Z_Options_namedResultSets        14
268
269 typedef struct Z_InitRequest
270 {
271     Z_ReferenceId *referenceId;                   /* OPTIONAL */
272     Odr_bitmask *protocolVersion;
273     Odr_bitmask *options;
274     int *preferredMessageSize;
275     int *maximumRecordSize;
276     Z_IdAuthentication* idAuthentication;        /* OPTIONAL */
277     char *implementationId;                      /* OPTIONAL */
278     char *implementationName;                    /* OPTIONAL */
279     char *implementationVersion;                 /* OPTIONAL */
280     Z_External *userInformationField;          /* OPTIONAL */
281 #ifdef Z_95
282     Z_OtherInformation *otherInfo;               /* OPTIONAL */
283 #endif
284 } Z_InitRequest;
285
286 typedef struct Z_InitResponse
287 {
288     Z_ReferenceId *referenceId;    /* OPTIONAL */
289     Odr_bitmask *protocolVersion;
290     Odr_bitmask *options;
291     int *preferredMessageSize;
292     int *maximumRecordSize;
293     bool_t *result;
294     char *implementationId;      /* OPTIONAL */
295     char *implementationName;    /* OPTIONAL */
296     char *implementationVersion; /* OPTIONAL */
297     Z_External *userInformationField; /* OPTIONAL */
298 #ifdef Z_95
299     Z_OtherInformation *otherInfo;    /* OPTIONAL */
300 #endif
301 } Z_InitResponse;
302
303 typedef struct Z_NSRAuthentication
304 {
305     char *user;
306     char *password;
307     char *account;
308 } Z_NSRAuthentication;
309
310 int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt);
311
312 int z_StrAuthentication(ODR o, char **p, int opt);
313
314 /* ------------------ SEARCH SERVICE ----------------*/
315
316 typedef struct Z_DatabaseSpecificUnit
317 {
318     char *databaseName;
319     char *elementSetName;
320 } Z_DatabaseSpecificUnit;
321
322 typedef struct Z_DatabaseSpecific
323 {
324     int num_elements;
325     Z_DatabaseSpecificUnit **elements;
326 } Z_DatabaseSpecific;
327
328 typedef struct Z_ElementSetNames
329 {
330     int which;
331 #define Z_ElementSetNames_generic 0
332 #define Z_ElementSetNames_databaseSpecific 1
333     union
334     {
335         char *generic;
336         Z_DatabaseSpecific *databaseSpecific;
337     } u;
338 } Z_ElementSetNames;
339
340 /* ---------------------- RPN QUERY --------------------------- */
341
342 typedef struct Z_ComplexAttribute
343 {
344     int num_list;
345     Z_StringOrNumeric **list;
346     int num_semanticAction;
347     int **semanticAction;           /* OPTIONAL */
348 } Z_ComplexAttribute;
349
350 typedef struct Z_AttributeElement
351 {
352 #ifdef Z_95
353     Odr_oid *attributeSet;           /* OPTIONAL - v3 only */
354 #endif
355     int *attributeType;
356 #ifdef Z_95
357     enum
358     {
359         Z_AttributeValue_numeric,
360         Z_AttributeValue_complex
361     } which;
362     union
363     {
364         int *numeric;
365         Z_ComplexAttribute *complex;
366     } value;
367 #else
368     int *attributeValue;
369 #endif
370 } Z_AttributeElement;
371
372 typedef struct Z_Term 
373 {
374     enum
375     {
376         Z_Term_general,
377         Z_Term_numeric,
378         Z_Term_characterString,
379         Z_Term_oid,
380         Z_Term_dateTime,
381         Z_Term_external,
382         Z_Term_integerAndUnit,
383         Z_Term_null
384     } which;
385     union
386     {
387         Odr_oct *general; /* this is required for v2 */
388         int *numeric;
389         char *characterString;
390         Odr_oid *oid;
391         char *dateTime;
392         Z_External *external;
393         /* Z_IntUnit *integerAndUnit; */
394         Odr_null *null;
395     } u;
396 } Z_Term;
397
398 typedef struct Z_AttributesPlusTerm
399 {
400     int num_attributes;
401     Z_AttributeElement **attributeList;
402     Z_Term *term;
403 } Z_AttributesPlusTerm;
404
405 typedef struct Z_ResultSetPlusAttributes
406 {
407     char *resultSet;
408     int num_attributes;
409     Z_AttributeElement **attributeList;
410 } Z_ResultSetPlusAttributes;
411
412 typedef struct Z_ProximityOperator
413 {
414     bool_t *exclusion;          /* OPTIONAL */
415     int *distance;
416     bool_t *ordered;
417     int *relationType;
418 #define Z_Prox_lessThan           1
419 #define Z_Prox_lessThanOrEqual    2
420 #define Z_Prox_equal              3
421 #define Z_Prox_greaterThanOrEqual 4
422 #define Z_Prox_greaterThan        5
423 #define Z_Prox_notEqual           6
424     enum
425     {
426         Z_ProxCode_known,
427         Z_ProxCode_private
428     } which;
429     int *proximityUnitCode;
430 #define Z_ProxUnit_character       1
431 #define Z_ProxUnit_word            2
432 #define Z_ProxUnit_sentence        3
433 #define Z_ProxUnit_paragraph       4
434 #define Z_ProxUnit_section         5
435 #define Z_ProxUnit_chapter         6
436 #define Z_ProxUnit_document        7
437 #define Z_ProxUnit_element         8
438 #define Z_ProxUnit_subelement      9
439 #define Z_ProxUnit_elementType    10
440 #define Z_ProxUnit_byte           11   /* v3 only */
441 } Z_ProximityOperator;
442
443 typedef struct Z_Operator
444 {
445     enum
446     {
447         Z_Operator_and,
448         Z_Operator_or,
449         Z_Operator_and_not,
450         Z_Operator_prox
451     } which;
452     union
453     {
454         Odr_null *and;          /* these guys are nulls. */
455         Odr_null *or;
456         Odr_null *and_not;
457         Z_ProximityOperator *prox;
458     } u;
459 } Z_Operator;
460
461 typedef struct Z_Operand
462 {
463     enum
464     {
465         Z_Operand_APT,
466         Z_Operand_resultSetId,
467         Z_Operand_resultAttr             /* v3 only */
468     } which;
469     union
470     {
471         Z_AttributesPlusTerm *attributesPlusTerm;
472         Z_ResultSetId *resultSetId;
473         Z_ResultSetPlusAttributes *resultAttr;
474     } u;
475 } Z_Operand;
476
477 typedef struct Z_Complex
478 {
479     struct Z_RPNStructure *s1;
480     struct Z_RPNStructure *s2;
481     Z_Operator *operator;
482 } Z_Complex;
483
484 typedef struct Z_RPNStructure
485 {
486     enum
487     {
488         Z_RPNStructure_simple,
489         Z_RPNStructure_complex
490     } which;
491     union
492     {
493         Z_Operand *simple;
494         Z_Complex *complex;
495     } u;
496 } Z_RPNStructure;
497
498 typedef struct Z_RPNQuery
499 {
500     Odr_oid *attributeSetId;
501     Z_RPNStructure *RPNStructure;
502 } Z_RPNQuery;
503
504 /* -------------------------- SEARCHREQUEST -------------------------- */
505
506 typedef struct Z_Query
507 {
508     enum
509     {
510         Z_Query_type_1 = 1,
511         Z_Query_type_2,
512         Z_Query_type_101
513     }
514     which;
515     union
516     {
517         Z_RPNQuery *type_1;
518         Odr_oct *type_2;
519         Z_RPNQuery *type_101;
520     } u;
521 } Z_Query;
522
523 typedef struct Z_SearchRequest
524 {
525     Z_ReferenceId *referenceId;   /* OPTIONAL */
526     int *smallSetUpperBound;
527     int *largeSetLowerBound;
528     int *mediumSetPresentNumber;
529     bool_t *replaceIndicator;
530     char *resultSetName;
531     int num_databaseNames;
532     char **databaseNames;
533     Z_ElementSetNames *smallSetElementSetNames;    /* OPTIONAL */
534     Z_ElementSetNames *mediumSetElementSetNames;    /* OPTIONAL */
535     Odr_oid *preferredRecordSyntax;  /* OPTIONAL */
536     Z_Query *query;
537 #ifdef Z_95
538     Z_OtherInformation *additionalSearchInfo;       /* OPTIONAL */
539     Z_OtherInformation *otherInfo;                  /* OPTIONAL */
540 #endif
541 } Z_SearchRequest;
542
543 /* ------------------------ RECORD -------------------------- */
544
545 typedef Z_External Z_DatabaseRecord;
546
547 #ifdef Z_95
548
549 typedef struct Z_DefaultDiagFormat
550 {
551     Odr_oid *diagnosticSetId; /* This is opt'l to interwork with bad targets */
552     int *condition;
553     /* until the whole character set issue becomes more definite,
554      * you can probably ignore this on input. */
555     enum  
556     {
557         Z_DiagForm_v2AddInfo,
558         Z_DiagForm_v3AddInfo
559     } which;
560     char *addinfo;
561 } Z_DefaultDiagFormat;
562
563 typedef struct Z_DiagRec
564 {
565     enum
566     {   
567         Z_DiagRec_defaultFormat,
568         Z_DiagRec_externallyDefined
569     } which;
570     union
571     {
572         Z_DefaultDiagFormat *defaultFormat;
573         Z_External *externallyDefined;
574     } u;
575 } Z_DiagRec;
576
577 #else
578
579 typedef struct Z_DiagRec
580 {
581     Odr_oid *diagnosticSetId; /* This is opt'l to interwork with bad targets */
582     int *condition;
583     char *addinfo;
584 } Z_DiagRec;
585
586 #endif
587
588 typedef struct Z_DiagRecs
589 {
590     int num_diagRecs;
591     Z_DiagRec **diagRecs;
592 } Z_DiagRecs;
593
594 typedef struct Z_NamePlusRecord
595 {
596     char *databaseName;      /* OPTIONAL */
597     enum
598     {
599         Z_NamePlusRecord_databaseRecord,
600         Z_NamePlusRecord_surrogateDiagnostic
601     }
602     which;
603     union
604     {
605         Z_DatabaseRecord *databaseRecord;
606         Z_DiagRec *surrogateDiagnostic;
607     } u;
608 } Z_NamePlusRecord;
609
610 typedef struct Z_NamePlusRecordList
611 {
612     int num_records;
613     Z_NamePlusRecord **records;
614 } Z_NamePlusRecordList;
615
616 typedef struct Z_Records
617 {
618     enum
619     {
620         Z_Records_DBOSD,
621         Z_Records_NSD,
622         Z_Records_multipleNSD
623     } which;
624     union
625     {
626         Z_NamePlusRecordList *databaseOrSurDiagnostics;
627         Z_DiagRec *nonSurrogateDiagnostic;
628         Z_DiagRecs *multipleNonSurDiagnostics;
629     } u;
630 } Z_Records;
631
632 /* ------------------------ SEARCHRESPONSE ------------------ */
633
634 typedef struct Z_SearchResponse
635 {
636     Z_ReferenceId *referenceId;       /* OPTIONAL */
637     int *resultCount;
638     int *numberOfRecordsReturned;
639     int *nextResultSetPosition;
640     bool_t *searchStatus;
641     int *resultSetStatus;              /* OPTIONAL */
642 #define Z_RES_SUBSET        1
643 #define Z_RES_INTERIM       2
644 #define Z_RES_NONE          3
645     int *presentStatus;                /* OPTIONAL */
646 #define Z_PRES_SUCCESS      0
647 #define Z_PRES_PARTIAL_1    1
648 #define Z_PRES_PARTIAL_2    2
649 #define Z_PRES_PARTIAL_3    3
650 #define Z_PRES_PARTIAL_4    4
651 #define Z_PRES_FAILURE      5
652     Z_Records *records;                  /* OPTIONAL */
653 #ifdef Z_95
654     Z_OtherInformation *additionalSearchInfo;
655     Z_OtherInformation *otherInfo;
656 #endif
657 } Z_SearchResponse;
658
659 /* ------------------------- PRESENT SERVICE -----------------*/
660
661 typedef struct Z_ElementSpec
662 {
663     enum
664     {
665         Z_ElementSpec_elementSetName,
666         Z_ElementSpec_externalSpec
667     } which;
668     union
669     {
670         char *elementSetName;
671         Z_External *externalSpec;
672     } u;
673 } Z_ElementSpec;
674
675 typedef struct Z_Specification
676 {
677     Odr_oid *schema;                  /* OPTIONAL */
678     Z_ElementSpec *elementSpec;       /* OPTIONAL */
679 } Z_Specification;
680
681 typedef struct Z_DbSpecific
682 {
683     char *databaseName;
684     Z_Specification *spec;
685 } Z_DbSpecific;
686
687 typedef struct Z_CompSpec
688 {
689     bool_t *selectAlternativeSyntax;
690     Z_Specification *generic;            /* OPTIONAL */
691     int num_dbSpecific;
692     Z_DbSpecific **dbSpecific;           /* OPTIONAL */
693     int num_recordSyntax;
694     Odr_oid **recordSyntax;              /* OPTIONAL */
695 } Z_CompSpec;
696
697 typedef struct Z_RecordComposition
698 {
699     enum
700     {
701         Z_RecordComp_simple,
702         Z_RecordComp_complex
703     } which;
704     union
705     {
706         Z_ElementSetNames *simple;
707         Z_CompSpec *complex;
708     } u;
709 } Z_RecordComposition;
710
711 typedef struct Z_Range
712 {
713     int *startingPosition;
714     int *numberOfRecords;
715 } Z_Range;
716
717 typedef struct Z_PresentRequest
718 {
719     Z_ReferenceId *referenceId;              /* OPTIONAL */
720     Z_ResultSetId *resultSetId;
721     int *resultSetStartPoint;
722     int *numberOfRecordsRequested;
723 #ifdef Z_95
724     int num_ranges;
725     Z_Range **additionalRanges;              /* OPTIONAL */
726     Z_RecordComposition *recordComposition;  /* OPTIONAL */
727 #else
728     Z_ElementSetNames *elementSetNames;  /* OPTIONAL */
729 #endif
730     Odr_oid *preferredRecordSyntax;  /* OPTIONAL */
731 #ifdef Z_95
732     int *maxSegmentCount;                 /* OPTIONAL */
733     int *maxRecordSize;                   /* OPTIONAL */
734     int *maxSegmentSize;                  /* OPTIONAL */
735     Z_OtherInformation *otherInfo;        /* OPTIONAL */
736 #endif
737 } Z_PresentRequest;
738
739 typedef struct Z_PresentResponse
740 {
741     Z_ReferenceId *referenceId;        /* OPTIONAL */
742     int *numberOfRecordsReturned;
743     int *nextResultSetPosition;
744     int *presentStatus;
745     Z_Records *records;
746 #ifdef Z_95
747     Z_OtherInformation *otherInfo;     /* OPTIONAL */
748 #endif
749 } Z_PresentResponse;
750
751 /* ------------------ RESOURCE CONTROL ----------------*/
752
753 typedef struct Z_TriggerResourceControlRequest
754 {
755     Z_ReferenceId *referenceId;    /* OPTIONAL */
756     int *requestedAction;
757 #define Z_TriggerResourceCtrl_resourceReport  1
758 #define Z_TriggerResourceCtrl_resourceControl 2
759 #define Z_TriggerResourceCtrl_cancel          3
760     Odr_oid *prefResourceReportFormat;  /* OPTIONAL */
761     bool_t *resultSetWanted;            /* OPTIONAL */
762 #ifdef Z_95
763     Z_OtherInformation *otherInfo;
764 #endif
765 } Z_TriggerResourceControlRequest;
766
767 typedef struct Z_ResourceControlRequest
768 {
769     Z_ReferenceId *referenceId;    /* OPTIONAL */
770     bool_t *suspendedFlag;         /* OPTIONAL */
771     Z_External *resourceReport; /* OPTIONAL */
772     int *partialResultsAvailable;  /* OPTIONAL */
773 #define Z_ResourceControlRequest_subset    1
774 #define Z_ResourceControlRequest_interim   2
775 #define Z_ResourceControlRequest_none      3
776     bool_t *responseRequired;
777     bool_t *triggeredRequestFlag;  /* OPTIONAL */
778 #ifdef Z_95
779     Z_OtherInformation *otherInfo;
780 #endif
781 } Z_ResourceControlRequest;
782
783 typedef struct Z_ResourceControlResponse
784 {
785     Z_ReferenceId *referenceId;    /* OPTIONAL */
786     bool_t *continueFlag;
787     bool_t *resultSetWanted;       /* OPTIONAL */
788 #ifdef Z_95
789     Z_OtherInformation *otherInfo;
790 #endif
791 } Z_ResourceControlResponse;
792
793
794 /* ------------------ ACCESS CTRL SERVICE ----------------*/
795
796 typedef struct Z_AccessControlRequest
797 {
798     Z_ReferenceId *referenceId;           /* OPTIONAL */
799     enum
800     {
801         Z_AccessRequest_simpleForm,
802         Z_AccessRequest_externallyDefined
803     } which;
804     union
805     {
806         Odr_oct *simpleForm;
807         Z_External *externallyDefined;
808     } u;
809 #ifdef Z_95
810     Z_OtherInformation *otherInfo;           /* OPTIONAL */
811 #endif
812 } Z_AccessControlRequest;
813
814 typedef struct Z_AccessControlResponse
815 {
816     Z_ReferenceId *referenceId;              /* OPTIONAL */
817     enum
818     {
819         Z_AccessResponse_simpleForm,
820         Z_AccessResponse_externallyDefined
821     } which;
822     union
823     {
824         Odr_oct *simpleForm;
825         Z_External *externallyDefined;
826     } u;
827     Z_DiagRec *diagnostic;                   /* OPTIONAL */
828 #ifdef Z_95
829     Z_OtherInformation *otherInfo;           /* OPTIONAL */
830 #endif
831 } Z_AccessControlResponse;
832
833 /* ------------------------ SCAN SERVICE -------------------- */
834
835 typedef struct Z_AttributeList
836 {
837     int num_attributes;
838     Z_AttributeElement **attributes;
839 } Z_AttributeList;
840
841 typedef struct Z_AlternativeTerm
842 {
843     int num_terms;
844     Z_AttributesPlusTerm **terms;
845 } Z_AlternativeTerm;
846
847 typedef struct Z_OccurrenceByAttributes
848 {
849     Z_AttributeList *attributes;
850 #if 0
851     enum
852     {
853         Z_OByAtt_global,
854         Z_ObyAtt_byDatabase
855     } which;
856     union
857     {
858 #endif
859         int *global;
860 #if 0
861         /* Z_ByDatabase *byDatabase; */
862     } u;
863 #endif
864 } Z_OccurrenceByAttributes;
865
866 typedef struct Z_TermInfo
867 {
868     Z_Term *term;
869     Z_AttributeList *suggestedAttributes;  /* OPTIONAL */
870     Z_AlternativeTerm *alternativeTerm;    /* OPTIONAL */
871     int *globalOccurrences;                /* OPTIONAL */
872     Z_OccurrenceByAttributes *byAttributes; /* OPTIONAL */
873 } Z_TermInfo;
874
875 typedef struct Z_Entry
876 {
877     enum
878     {
879         Z_Entry_termInfo,
880         Z_Entry_surrogateDiagnostic
881     } which;
882     union
883     {
884         Z_TermInfo *termInfo;
885         Z_DiagRec *surrogateDiagnostic;
886     } u;
887 } Z_Entry;
888
889 typedef struct Z_Entries
890 {
891     int num_entries;
892     Z_Entry **entries;
893 } Z_Entries;
894
895 typedef struct Z_ListEntries
896 {
897     enum
898     {
899         Z_ListEntries_entries,
900         Z_ListEntries_nonSurrogateDiagnostics
901     } which;
902     union
903     {
904         Z_Entries *entries;
905         Z_DiagRecs *nonSurrogateDiagnostics;
906     } u;
907 } Z_ListEntries;
908
909 typedef struct Z_ScanRequest
910 {
911     Z_ReferenceId *referenceId;       /* OPTIONAL */
912     int num_databaseNames;
913     char **databaseNames;
914     Odr_oid *attributeSet;          /* OPTIONAL */
915     Z_AttributesPlusTerm *termListAndStartPoint;
916     int *stepSize;                    /* OPTIONAL */
917     int *numberOfTermsRequested;
918     int *preferredPositionInResponse;   /* OPTIONAL */
919 #ifdef Z_95
920     Z_OtherInformation *otherInfo;
921 #endif
922 } Z_ScanRequest;
923
924 typedef struct Z_ScanResponse
925 {
926     Z_ReferenceId *referenceId;       /* OPTIONAL */
927     int *stepSize;                    /* OPTIONAL */
928     int *scanStatus;
929 #define Z_Scan_success      0
930 #define Z_Scan_partial_1    1
931 #define Z_Scan_partial_2    2
932 #define Z_Scan_partial_3    3
933 #define Z_Scan_partial_4    4
934 #define Z_Scan_partial_5    5
935 #define Z_Scan_failure      6
936     int *numberOfEntriesReturned;
937     int *positionOfTerm;              /* OPTIONAL */
938     Z_ListEntries *entries;           /* OPTIONAL */
939     Odr_oid *attributeSet;            /* OPTIONAL */
940 #ifdef Z_95
941     Z_OtherInformation *otherInfo;
942 #endif
943 } Z_ScanResponse; 
944
945
946 /* ------------------------ DELETE -------------------------- */
947
948 #define Z_DeleteStatus_success                          0
949 #define Z_DeleteStatus_resultSetDidNotExist             1
950 #define Z_DeleteStatus_previouslyDeletedByTarget        2
951 #define Z_DeleteStatus_systemProblemAtTarget            3
952 #define Z_DeleteStatus_accessNotAllowed                 4
953 #define Z_DeleteStatus_resourceControlAtOrigin          5
954 #define Z_DeleteStatus_resourceControlAtTarget          6
955 #define Z_DeleteStatus_bulkDeleteNotSupported           7
956 #define Z_DeleteStatus_notAllRsltSetsDeletedOnBulkDlte  8
957 #define Z_DeleteStatus_notAllRequestedResultSetsDeleted 9
958 #define Z_DeleteStatus_resultSetInUse                  10
959
960 typedef struct Z_ListStatus
961 {
962     Z_ResultSetId *id;
963     int *status;
964 } Z_ListStatus;
965
966 typedef struct Z_DeleteResultSetRequest
967 {
968     Z_ReferenceId *referenceId;        /* OPTIONAL */
969     int *deleteFunction;
970 #define Z_DeleteRequest_list    0
971 #define Z_DeleteRequest_all     1
972     int num_ids;
973     Z_ResultSetId **resultSetList;      /* OPTIONAL */
974 #ifdef Z_95
975     Z_OtherInformation *otherInfo;
976 #endif
977 } Z_DeleteResultSetRequest;
978
979 typedef struct Z_DeleteResultSetResponse
980 {
981     Z_ReferenceId *referenceId;        /* OPTIONAL */
982     int *deleteOperationStatus;
983     int num_statuses;
984     Z_ListStatus *deleteListStatuses;  /* OPTIONAL */
985     int *numberNotDeleted;             /* OPTIONAL */
986     int num_bulkStatuses;
987     Z_ListStatus *bulkStatuses;        /* OPTIONAL */
988     char *deleteMessage;               /* OPTIONAL */
989 #ifdef Z_95
990     Z_OtherInformation *otherInfo;
991 #endif
992 } Z_DeleteResultSetResponse;
993
994 /* ------------------------ CLOSE SERVICE ------------------- */
995
996 typedef struct Z_Close
997 {
998     Z_ReferenceId *referenceId;         /* OPTIONAL */
999     int *closeReason;
1000 #define Z_Close_finished           0
1001 #define Z_Close_shutdown           1
1002 #define Z_Close_systemProblem      2
1003 #define Z_Close_costLimit          3
1004 #define Z_Close_resources          4
1005 #define Z_Close_securityViolation  5
1006 #define Z_Close_protocolError      6
1007 #define Z_Close_lackOfActivity     7
1008 #define Z_Close_peerAbort          8
1009 #define Z_Close_unspecified        9
1010     char *diagnosticInformation;          /* OPTIONAL */
1011     Odr_oid *resourceReportFormat;        /* OPTIONAL */
1012     Z_External *resourceReport;         /* OPTIONAL */
1013 #ifdef Z_95
1014     Z_OtherInformation *otherInfo;        /* OPTIONAL */
1015 #endif
1016 } Z_Close;
1017
1018 /* ------------------------ SEGMENTATION -------------------- */
1019
1020 typedef struct Z_Segment
1021 {
1022     Z_ReferenceId *referenceId;   /* OPTIONAL */
1023     int *numberOfRecordsReturned;
1024     int num_segmentRecords;
1025     Z_NamePlusRecord **segmentRecords;
1026     Z_OtherInformation *otherInfo;  /* OPTIONAL */
1027 } Z_Segment;
1028
1029 /* ----------------------- Extended Services ---------------- */
1030
1031 typedef struct Z_Permissions
1032 {
1033     char *userId;                         
1034     int num_allowableFunctions;
1035     int **allowableFunctions;             
1036 #define Z_Permissions_delete              1
1037 #define Z_Permissions_modifyContents      2
1038 #define Z_Permissions_modifyPermissions   3
1039 #define Z_Permissions_present             4
1040 #define Z_Permissions_invoke              5
1041 } Z_Permissions;
1042
1043 typedef struct Z_ExtendedServicesRequest
1044 {
1045     Z_ReferenceId *referenceId;             /* OPTIONAL */
1046     int *function;                        
1047 #define Z_ExtendedServicesRequest_create              1
1048 #define Z_ExtendedServicesRequest_delete              2
1049 #define Z_ExtendedServicesRequest_modify              3
1050     Odr_oid *packageType;                 
1051     char *packageName;                      /* OPTIONAL */
1052     char *userId;                           /* OPTIONAL */
1053     Z_IntUnit *retentionTime;               /* OPTIONAL */
1054     Z_Permissions *permissions;             /* OPTIONAL */
1055     char *description;                      /* OPTIONAL */
1056     Z_External *taskSpecificParameters;     /* OPTIONAL */
1057     int *waitAction;                      
1058 #define Z_ExtendedServicesRequest_wait                1
1059 #define Z_ExtendedServicesRequest_waitIfPossible      2
1060 #define Z_ExtendedServicesRequest_dontWait            3
1061 #define Z_ExtendedServicesRequest_dontReturnPackage   4
1062     char *elements;             /* OPTIONAL */
1063     Z_OtherInformation *otherInfo;          /* OPTIONAL */
1064 } Z_ExtendedServicesRequest;
1065
1066 typedef struct Z_ExtendedServicesResponse
1067 {
1068     Z_ReferenceId *referenceId;             /* OPTIONAL */
1069     int *operationStatus;                 
1070 #define Z_ExtendedServicesResponse_done                1
1071 #define Z_ExtendedServicesResponse_accepted            2
1072 #define Z_ExtendedServicesResponse_failure             3
1073     int num_diagnostics;
1074     Z_DiagRec **diagnostics;                /* OPTIONAL */
1075     Z_External *taskPackage;                /* OPTIONAL */
1076     Z_OtherInformation *otherInfo;          /* OPTIONAL */
1077 } Z_ExtendedServicesResponse;
1078
1079 /* ------------------------ APDU ---------------------------- */
1080
1081 typedef struct Z_APDU
1082 {    
1083     enum Z_APDU_which
1084     {
1085         Z_APDU_initRequest,
1086         Z_APDU_initResponse,
1087         Z_APDU_searchRequest,
1088         Z_APDU_searchResponse,
1089         Z_APDU_presentRequest,
1090         Z_APDU_presentResponse,
1091         Z_APDU_deleteResultSetRequest,
1092         Z_APDU_deleteResultSetResponse,
1093         Z_APDU_resourceControlRequest,
1094         Z_APDU_resourceControlResponse,
1095         Z_APDU_triggerResourceControlRequest,
1096         Z_APDU_scanRequest,
1097         Z_APDU_scanResponse,
1098         Z_APDU_segmentRequest,
1099         Z_APDU_extendedServicesRequest,
1100         Z_APDU_extendedServicesResponse,
1101         Z_APDU_close
1102     } which;
1103     union
1104     {
1105         Z_InitRequest  *initRequest;
1106         Z_InitResponse *initResponse;
1107         Z_SearchRequest *searchRequest;
1108         Z_SearchResponse *searchResponse;
1109         Z_PresentRequest *presentRequest;
1110         Z_PresentResponse *presentResponse;
1111         Z_DeleteResultSetRequest *deleteResultSetRequest;
1112         Z_DeleteResultSetResponse *deleteResultSetResponse;
1113         Z_ResourceControlRequest *resourceControlRequest;
1114         Z_ResourceControlResponse *resourceControlResponse;
1115         Z_TriggerResourceControlRequest *triggerResourceControlRequest;
1116         Z_ScanRequest *scanRequest;
1117         Z_ScanResponse *scanResponse;
1118         Z_Segment *segmentRequest;
1119         Z_ExtendedServicesRequest *extendedServicesRequest;
1120         Z_ExtendedServicesResponse *extendedServicesResponse;
1121         Z_Close *close;
1122     } u;
1123 } Z_APDU;
1124
1125 int z_APDU(ODR o, Z_APDU **p, int opt);
1126 int z_SUTRS(ODR o, Odr_oct **p, int opt);
1127
1128 Z_InitRequest *zget_InitRequest(ODR o);
1129 Z_InitResponse *zget_InitResponse(ODR o);
1130 Z_SearchRequest *zget_SearchRequest(ODR o);
1131 Z_SearchResponse *zget_SearchResponse(ODR o);
1132 Z_PresentRequest *zget_PresentRequest(ODR o);
1133 Z_PresentResponse *zget_PresentResponse(ODR o);
1134 Z_DeleteResultSetRequest *zget_DeleteResultSetRequest(ODR o);
1135 Z_DeleteResultSetResponse *zget_DeleteResultSetResponse(ODR o);
1136 Z_ScanRequest *zget_ScanRequest(ODR o);
1137 Z_ScanResponse *zget_ScanResponse(ODR o);
1138 Z_TriggerResourceControlRequest *zget_TriggerResourceControlRequest(ODR o);
1139 Z_ResourceControlRequest *zget_ResourceControlRequest(ODR o);
1140 Z_ResourceControlResponse *zget_ResourceControlResponse(ODR o);
1141 Z_Close *zget_Close(ODR o);
1142 int z_InternationalString(ODR o, char **p, int opt);
1143 int z_OtherInformation(ODR o, Z_OtherInformation **p, int opt);
1144 int z_ElementSetName(ODR o, char **p, int opt);
1145 int z_IntUnit(ODR o, Z_IntUnit **p, int opt);
1146 int z_Unit(ODR o, Z_Unit **p, int opt);
1147 int z_DatabaseName(ODR o, Z_DatabaseName **p, int opt);
1148 int z_StringOrNumeric(ODR o, Z_StringOrNumeric **p, int opt);
1149 int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt);
1150 int z_Term(ODR o, Z_Term **p, int opt);
1151 int z_Specification(ODR o, Z_Specification **p, int opt);
1152 int z_Permissions(ODR o, Z_Permissions **p, int opt);
1153 int z_DiagRec(ODR o, Z_DiagRec **p, int opt);
1154 int z_AttributeList(ODR o, Z_AttributeList **p, int opt);
1155 int z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt);
1156 Z_APDU *zget_APDU(ODR o, enum Z_APDU_which which);
1157
1158 #include <prt-rsc.h>
1159 #include <prt-acc.h>
1160 #include <prt-exp.h>
1161 #include <prt-grs.h>
1162 #include <prt-exd.h>
1163 #include <prt-dia.h>
1164
1165 #include <prt-ext.h>
1166
1167 #endif