2 * Copyright (c) 1995-2003, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: zget.c,v 1.13 2003-01-06 08:20:29 adam Exp $
11 Z_InitRequest *zget_InitRequest(ODR o)
13 Z_InitRequest *r = (Z_InitRequest *)odr_malloc(o, sizeof(*r));
16 r->options = (Odr_bitmask *)odr_malloc(o, sizeof(*r->options));
17 ODR_MASK_ZERO(r->options);
18 r->protocolVersion = (Odr_bitmask *)
19 odr_malloc(o, sizeof(*r->protocolVersion));
21 ODR_MASK_SET(r->options, Z_Options_search);
22 ODR_MASK_SET(r->options, Z_Options_present);
24 ODR_MASK_ZERO(r->protocolVersion);
26 ODR_MASK_SET(r->protocolVersion, Z_ProtocolVersion_1);
27 ODR_MASK_SET(r->protocolVersion, Z_ProtocolVersion_2);
29 r->preferredMessageSize = odr_intdup(o, 30*1024);
30 r->maximumRecordSize = odr_intdup(o, 30*1024);
31 r->idAuthentication = 0;
32 r->implementationId = "81";
33 r->implementationName = "Index Data/YAZ";
34 r->implementationVersion = YAZ_VERSION
42 r->userInformationField = 0;
47 Z_InitResponse *zget_InitResponse(ODR o)
49 Z_InitResponse *r = (Z_InitResponse *)odr_malloc(o, sizeof(*r));
52 r->options = (Odr_bitmask *)odr_malloc(o, sizeof(*r->options));
53 ODR_MASK_ZERO(r->options);
54 r->protocolVersion = (Odr_bitmask *)odr_malloc(o, sizeof(*r->protocolVersion));
55 ODR_MASK_ZERO(r->protocolVersion);
56 r->preferredMessageSize = odr_intdup(o, 30*1024);
57 r->maximumRecordSize = odr_intdup(o, 30*1024);
58 r->result = odr_intdup(o, 1);
59 r->implementationId = "81";
60 r->implementationName = "Index Data/YAZ";
61 r->implementationVersion = YAZ_VERSION
69 r->userInformationField = 0;
74 Z_SearchRequest *zget_SearchRequest(ODR o)
76 Z_SearchRequest *r = (Z_SearchRequest *)odr_malloc(o, sizeof(*r));
79 r->smallSetUpperBound = odr_intdup(o, 0);
80 r->largeSetLowerBound = odr_intdup(o, 1);
81 r->mediumSetPresentNumber = odr_intdup(o, 0);
82 r->replaceIndicator = odr_intdup(o, 1);
83 r->resultSetName = "default";
84 r->num_databaseNames = 0;
86 r->smallSetElementSetNames = 0;
87 r->mediumSetElementSetNames = 0;
88 r->preferredRecordSyntax = 0;
90 r->additionalSearchInfo = 0;
95 Z_SearchResponse *zget_SearchResponse(ODR o)
97 Z_SearchResponse *r = (Z_SearchResponse *)odr_malloc(o, sizeof(*r));
100 r->resultCount = odr_intdup(o, 0);
101 r->numberOfRecordsReturned = odr_intdup(o, 0);
102 r->nextResultSetPosition = odr_intdup(o, 0);
103 r->searchStatus = odr_intdup(o, 1);
104 r->resultSetStatus = 0;
105 r->presentStatus = 0;
107 r->additionalSearchInfo = 0;
112 Z_PresentRequest *zget_PresentRequest(ODR o)
114 Z_PresentRequest *r = (Z_PresentRequest *)odr_malloc(o, sizeof(*r));
117 r->resultSetId = "default";
118 r->resultSetStartPoint = odr_intdup(o, 1);
119 r->numberOfRecordsRequested = odr_intdup(o, 10);
121 r->additionalRanges = 0;
122 r->recordComposition = 0;
123 r->preferredRecordSyntax = 0;
124 r->maxSegmentCount = 0;
125 r->maxRecordSize = 0;
126 r->maxSegmentSize = 0;
131 Z_PresentResponse *zget_PresentResponse(ODR o)
133 Z_PresentResponse *r = (Z_PresentResponse *)odr_malloc(o, sizeof(*r));
136 r->numberOfRecordsReturned = odr_intdup(o, 0);
137 r->nextResultSetPosition = odr_intdup(o, 0);
138 r->presentStatus = odr_intdup(o, Z_PRES_SUCCESS);
144 Z_DeleteResultSetRequest *zget_DeleteResultSetRequest(ODR o)
146 Z_DeleteResultSetRequest *r = (Z_DeleteResultSetRequest *)
147 odr_malloc(o, sizeof(*r));
150 r->deleteFunction = odr_intdup(o, Z_DeleteRequest_list);
151 r->num_resultSetList = 0;
152 r->resultSetList = 0;
157 Z_DeleteResultSetResponse *zget_DeleteResultSetResponse(ODR o)
159 Z_DeleteResultSetResponse *r = (Z_DeleteResultSetResponse *)
160 odr_malloc(o, sizeof(*r));
163 r->deleteOperationStatus = odr_intdup(o, Z_DeleteStatus_success);
164 r->deleteListStatuses = 0;
165 r->numberNotDeleted = 0;
167 r->deleteMessage = 0;
172 Z_ScanRequest *zget_ScanRequest(ODR o)
174 Z_ScanRequest *r = (Z_ScanRequest *)odr_malloc(o, sizeof(*r));
177 r->num_databaseNames = 0;
178 r->databaseNames = 0;
180 r->termListAndStartPoint = 0;
182 r->numberOfTermsRequested = odr_intdup(o, 20);
183 r->preferredPositionInResponse = 0;
188 Z_ScanResponse *zget_ScanResponse(ODR o)
190 Z_ScanResponse *r = (Z_ScanResponse *)odr_malloc(o, sizeof(*r));
194 r->scanStatus = odr_intdup(o, Z_Scan_success);
195 r->numberOfEntriesReturned = odr_intdup(o, 0);
196 r->positionOfTerm =0;
203 Z_TriggerResourceControlRequest *zget_TriggerResourceControlRequest(ODR o)
205 Z_TriggerResourceControlRequest *r = (Z_TriggerResourceControlRequest *)
206 odr_malloc(o, sizeof(*r));
209 r->requestedAction = odr_intdup(o, Z_TriggerResourceCtrl_resourceReport);
210 r->prefResourceReportFormat = 0;
211 r->resultSetWanted = 0;
216 Z_ResourceControlRequest *zget_ResourceControlRequest(ODR o)
218 Z_ResourceControlRequest *r = (Z_ResourceControlRequest *)
219 odr_malloc(o, sizeof(*r));
222 r->suspendedFlag = 0;
223 r->resourceReport = 0;
224 r->partialResultsAvailable = 0;
225 r->responseRequired = odr_intdup(o, 0);
226 r->triggeredRequestFlag = 0;
231 Z_ResourceControlResponse *zget_ResourceControlResponse(ODR o)
233 Z_ResourceControlResponse *r = (Z_ResourceControlResponse *)
234 odr_malloc(o, sizeof(*r));
237 r->continueFlag = odr_intdup(o, 1);
238 r->resultSetWanted = 0;
243 Z_AccessControlRequest *zget_AccessControlRequest(ODR o)
245 Z_AccessControlRequest *r = (Z_AccessControlRequest *)
246 odr_malloc(o, sizeof(*r));
249 r->which = Z_AccessRequest_simpleForm;
255 Z_AccessControlResponse *zget_AccessControlResponse(ODR o)
257 Z_AccessControlResponse *r = (Z_AccessControlResponse *)
258 odr_malloc(o, sizeof(*r));
261 r->which = Z_AccessResponse_simpleForm;
268 Z_Segment *zget_Segment(ODR o)
270 Z_Segment *r = (Z_Segment *)odr_malloc(o, sizeof(*r));
273 r->numberOfRecordsReturned = odr_intdup(o, 0);
274 r->num_segmentRecords = 0;
275 r->segmentRecords = (Z_NamePlusRecord **) odr_nullval();
280 Z_Close *zget_Close(ODR o)
282 Z_Close *r = (Z_Close *)odr_malloc(o, sizeof(*r));
285 r->closeReason = odr_intdup(o, Z_Close_finished);
286 r->diagnosticInformation = 0;
287 r->resourceReportFormat = 0;
288 r->resourceReport = 0;
293 Z_ResourceReportRequest *zget_ResourceReportRequest(ODR o)
295 Z_ResourceReportRequest *r = (Z_ResourceReportRequest *)
296 odr_malloc(o, sizeof(*r));
300 r->prefResourceReportFormat = 0;
305 Z_ResourceReportResponse *zget_ResourceReportResponse(ODR o)
307 Z_ResourceReportResponse *r = (Z_ResourceReportResponse *)
308 odr_malloc(o, sizeof(*r));
311 r->resourceReportStatus = odr_intdup(o, Z_ResourceReportStatus_success);
312 r->resourceReport = 0;
317 Z_SortRequest *zget_SortRequest(ODR o)
319 Z_SortRequest *r = (Z_SortRequest *)odr_malloc(o, sizeof(*r));
322 r->inputResultSetNames = 0;
323 r->sortedResultSetName = 0;
329 Z_SortResponse *zget_SortResponse(ODR o)
331 Z_SortResponse *r = (Z_SortResponse *)odr_malloc(o, sizeof(*r));
334 r->sortStatus = odr_intdup(o, Z_SortStatus_success);
335 r->resultSetStatus = odr_intdup(o, Z_SortResultSetStatus_empty);
341 Z_ExtendedServicesRequest *zget_ExtendedServicesRequest(ODR o)
343 Z_ExtendedServicesRequest *r = (Z_ExtendedServicesRequest *)
344 odr_malloc(o, sizeof(*r));
347 r->function = odr_intdup(o, Z_ExtendedServicesRequest_create);
351 r->retentionTime = 0;
354 r->taskSpecificParameters = 0;
355 r->waitAction = odr_intdup(o, Z_ExtendedServicesRequest_waitIfPossible);
361 Z_ExtendedServicesResponse *zget_ExtendedServicesResponse(ODR o)
363 Z_ExtendedServicesResponse *r = (Z_ExtendedServicesResponse *)
364 odr_malloc(o, sizeof(*r));
367 r->operationStatus = odr_intdup(o, Z_ExtendedServicesResponse_done);
368 r->num_diagnostics = 0;
375 Z_DuplicateDetectionRequest *zget_DuplicateDetectionRequest(ODR o)
377 Z_DuplicateDetectionRequest *r = (Z_DuplicateDetectionRequest *)
378 odr_malloc(o, sizeof(*r));
381 r->num_inputResultSetIds = 0;
382 r->inputResultSetIds = 0;
383 r->outputResultSetName = 0;
384 r->applicablePortionOfRecord = 0;
385 r->num_duplicateDetectionCriteria = 0;
386 r->duplicateDetectionCriteria = 0;
388 r->num_retentionCriteria = 0;
389 r->retentionCriteria = 0;
390 r->num_sortCriteria = 0;
396 Z_DuplicateDetectionResponse *zget_DuplicateDetectionResponse(ODR o)
398 Z_DuplicateDetectionResponse *r = (Z_DuplicateDetectionResponse *)
399 odr_malloc(o, sizeof(*r));
402 r->status = odr_intdup(o, Z_DuplicateDetectionResponse_success);
403 r->resultSetCount = 0;
404 r->num_diagnostics = 0;
410 Z_APDU *zget_APDU(ODR o, int which)
412 Z_APDU *r = (Z_APDU *)odr_malloc(o, sizeof(*r));
414 switch (r->which = which)
416 case Z_APDU_initRequest:
417 r->u.initRequest = zget_InitRequest(o);
419 case Z_APDU_initResponse:
420 r->u.initResponse = zget_InitResponse(o);
422 case Z_APDU_searchRequest:
423 r->u.searchRequest = zget_SearchRequest(o);
425 case Z_APDU_searchResponse:
426 r->u.searchResponse = zget_SearchResponse(o);
428 case Z_APDU_presentRequest:
429 r->u.presentRequest = zget_PresentRequest(o);
431 case Z_APDU_presentResponse:
432 r->u.presentResponse = zget_PresentResponse(o);
434 case Z_APDU_deleteResultSetRequest:
435 r->u.deleteResultSetRequest = zget_DeleteResultSetRequest(o);
437 case Z_APDU_deleteResultSetResponse:
438 r->u.deleteResultSetResponse = zget_DeleteResultSetResponse(o);
440 case Z_APDU_scanRequest:
441 r->u.scanRequest = zget_ScanRequest(o);
443 case Z_APDU_scanResponse:
444 r->u.scanResponse = zget_ScanResponse(o);
446 case Z_APDU_triggerResourceControlRequest:
447 r->u.triggerResourceControlRequest =
448 zget_TriggerResourceControlRequest(o);
450 case Z_APDU_resourceControlRequest:
451 r->u.resourceControlRequest = zget_ResourceControlRequest(o);
453 case Z_APDU_resourceControlResponse:
454 r->u.resourceControlResponse = zget_ResourceControlResponse(o);
456 case Z_APDU_segmentRequest:
457 r->u.segmentRequest = zget_Segment(o);
460 r->u.close = zget_Close(o);
462 case Z_APDU_accessControlRequest:
463 r->u.accessControlRequest = zget_AccessControlRequest(o);
465 case Z_APDU_accessControlResponse:
466 r->u.accessControlResponse = zget_AccessControlResponse(o);
468 case Z_APDU_resourceReportRequest:
469 r->u.resourceReportRequest = zget_ResourceReportRequest(o);
471 case Z_APDU_resourceReportResponse:
472 r->u.resourceReportResponse = zget_ResourceReportResponse(o);
474 case Z_APDU_sortRequest:
475 r->u.sortRequest = zget_SortRequest(o);
477 case Z_APDU_sortResponse:
478 r->u.sortResponse = zget_SortResponse(o);
480 case Z_APDU_extendedServicesRequest:
481 r->u.extendedServicesRequest = zget_ExtendedServicesRequest(o);
483 case Z_APDU_extendedServicesResponse:
484 r->u.extendedServicesResponse = zget_ExtendedServicesResponse(o);
486 case Z_APDU_duplicateDetectionRequest:
487 r->u.duplicateDetectionRequest = zget_DuplicateDetectionRequest(o);
489 case Z_APDU_duplicateDetectionResponse:
490 r->u.duplicateDetectionResponse = zget_DuplicateDetectionResponse(o);
493 fprintf(stderr, "Bad APDU-type to zget_APDU");