2 * Copyright (c) 1995, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.7 1995-06-15 07:44:52 quinn
10 * Revision 1.6 1995/06/14 15:26:37 quinn
11 * *** empty log message ***
13 * Revision 1.5 1995/06/07 14:42:30 quinn
16 * Revision 1.4 1995/06/07 14:36:25 quinn
19 * Revision 1.3 1995/06/05 10:52:06 quinn
20 * Fixed some negligences.
22 * Revision 1.2 1995/05/30 10:15:49 quinn
23 * Added our implementor's ID
25 * Revision 1.1 1995/05/22 11:30:20 quinn
26 * Adding Z39.50-1992 stuff to proto.c. Adding zget.c
33 Z_InitRequest *zget_InitRequest(ODR o)
35 Z_InitRequest *r = odr_malloc(o, sizeof(*r));
38 r->options = odr_malloc(o, sizeof(*r->options));
39 ODR_MASK_ZERO(r->options);
40 r->protocolVersion = odr_malloc(o, sizeof(*r->protocolVersion));
41 ODR_MASK_ZERO(r->protocolVersion);
42 r->preferredMessageSize = odr_malloc(o, sizeof(int));
43 *r->preferredMessageSize = 30*1024;
44 r->maximumRecordSize = odr_malloc(o, sizeof(int));
45 *r->maximumRecordSize = 30*1024;
46 r->idAuthentication = 0;
47 r->implementationId = "YAZ (id=81)";
48 r->implementationName = "Index Data/YAZ";
49 r->implementationVersion = YAZ_VERSION;
50 r->userInformationField = 0;
57 Z_InitResponse *zget_InitResponse(ODR o)
59 Z_InitResponse *r = odr_malloc(o, sizeof(*r));
62 r->options = odr_malloc(o, sizeof(*r->options));
63 ODR_MASK_ZERO(r->options);
64 r->protocolVersion = odr_malloc(o, sizeof(*r->protocolVersion));
65 ODR_MASK_ZERO(r->protocolVersion);
66 r->preferredMessageSize = odr_malloc(o, sizeof(int));
67 *r->preferredMessageSize = 30*1024;
68 r->maximumRecordSize = odr_malloc(o, sizeof(int));
69 *r->maximumRecordSize = 30*1024;
70 r->result = odr_malloc(o, sizeof(bool_t));
72 r->implementationId = "YAZ (id=81)";
73 r->implementationName = "Index Data/YAZ";
74 r->implementationVersion = YAZ_VERSION;
75 r->userInformationField = 0;
82 Z_SearchRequest *zget_SearchRequest(ODR o)
84 Z_SearchRequest *r = odr_malloc(o, sizeof(*r));
87 r->smallSetUpperBound = odr_malloc(o, sizeof(int));
88 *r->smallSetUpperBound = 0;
89 r->largeSetLowerBound = odr_malloc(o, sizeof(int));
90 *r->largeSetLowerBound = 1;
91 r->mediumSetPresentNumber = odr_malloc(o, sizeof(int));
92 *r->mediumSetPresentNumber = 0;
93 r->replaceIndicator = odr_malloc(o, sizeof(bool_t));
94 *r->replaceIndicator = 1;
95 r->resultSetName = "Default";
96 r->num_databaseNames = 0;
98 r->smallSetElementSetNames = 0;
99 r->mediumSetElementSetNames = 0;
100 r->preferredRecordSyntax = 0;
103 r->additionalSearchInfo = 0;
109 Z_SearchResponse *zget_SearchResponse(ODR o)
111 Z_SearchResponse *r = odr_malloc(o, sizeof(*r));
114 r->resultCount = odr_malloc(o, sizeof(int));
116 r->numberOfRecordsReturned = odr_malloc(o, sizeof(int));
117 *r->numberOfRecordsReturned = 0;
118 r->nextResultSetPosition = odr_malloc(o, sizeof(int));
119 *r->nextResultSetPosition = 0;
120 r->searchStatus = odr_malloc(o, sizeof(bool_t));
121 *r->searchStatus = 1;
122 r->resultSetStatus = 0;
123 r->presentStatus = 0;
126 r->additionalSearchInfo = 0;
132 Z_PresentRequest *zget_PresentRequest(ODR o)
134 Z_PresentRequest *r = odr_malloc(o, sizeof(*r));
137 r->resultSetId = "Default";
138 r->resultSetStartPoint = odr_malloc(o, sizeof(int));
139 *r->resultSetStartPoint = 1;
140 r->numberOfRecordsRequested = odr_malloc(o, sizeof(int));
141 *r->numberOfRecordsRequested = 10;
144 r->additionalRanges = 0;
145 r->recordComposition = 0;
147 r->elementSetNames = 0;
149 r->preferredRecordSyntax = 0;
151 r->maxSegmentCount = 0;
152 r->maxRecordSize = 0;
153 r->maxSegmentSize = 0;
159 Z_PresentResponse *zget_PresentResponse(ODR o)
161 Z_PresentResponse *r = odr_malloc(o, sizeof(*r));
164 r->numberOfRecordsReturned = odr_malloc(o, sizeof(int));
165 *r->numberOfRecordsReturned = 0;
166 r->nextResultSetPosition = odr_malloc(o, sizeof(int));
167 *r->nextResultSetPosition = 0;
168 r->presentStatus = odr_malloc(o, sizeof(int));
169 *r->presentStatus = Z_PRES_SUCCESS;
177 Z_DeleteResultSetRequest *zget_DeleteResultSetRequest(ODR o)
179 Z_DeleteResultSetRequest *r = odr_malloc(o, sizeof(*r));
182 r->deleteFunction = odr_malloc(o, sizeof(int));
183 *r->deleteFunction = Z_DeleteRequest_list;
185 r->resultSetList = 0;
192 Z_DeleteResultSetResponse *zget_DeleteResultSetResponse(ODR o)
194 Z_DeleteResultSetResponse *r = odr_malloc(o, sizeof(*r));
197 r->deleteOperationStatus = odr_malloc(o, sizeof(int));
198 *r->deleteOperationStatus = Z_DeleteStatus_success;
200 r->deleteListStatuses = 0;
201 r->numberNotDeleted = 0;
202 r->num_bulkStatuses = 0;
204 r->deleteMessage = 0;
211 Z_ScanRequest *zget_ScanRequest(ODR o)
213 Z_ScanRequest *r = odr_malloc(o, sizeof(*r));
216 r->num_databaseNames = 0;
217 r->databaseNames = 0;
219 r->termListAndStartPoint = 0;
221 r->numberOfTermsRequested = odr_malloc(o, sizeof(int));
222 *r->numberOfTermsRequested = 20;
223 r->preferredPositionInResponse = 0;
230 Z_ScanResponse *zget_ScanResponse(ODR o)
232 Z_ScanResponse *r = odr_malloc(o, sizeof(*r));
236 r->scanStatus = odr_malloc(o, sizeof(int));
237 *r->scanStatus = Z_Scan_success;
238 r->numberOfEntriesReturned = odr_malloc(o, sizeof(int));
239 *r->numberOfEntriesReturned = 0;
240 r->positionOfTerm =0;
249 Z_TriggerResourceControlRequest *zget_TriggerResourceControlRequest(ODR o)
251 Z_TriggerResourceControlRequest *r = odr_malloc(o, sizeof(*r));
254 r->requestedAction = odr_malloc(o, sizeof(int));
255 *r->requestedAction = Z_TriggerResourceCtrl_resourceReport;
256 r->prefResourceReportFormat = 0;
257 r->resultSetWanted = 0;
264 Z_ResourceControlRequest *zget_ResourceControlRequest(ODR o)
266 Z_ResourceControlRequest *r = odr_malloc(o, sizeof(*r));
269 r->suspendedFlag = 0;
270 r->resourceReport = 0;
271 r->partialResultsAvailable = 0;
272 r->responseRequired = odr_malloc(o, sizeof(bool_t));
273 *r->responseRequired = 0;
274 r->triggeredRequestFlag = 0;
281 Z_ResourceControlResponse *zget_ResourceControlResponse(ODR o)
283 Z_ResourceControlResponse *r = odr_malloc(o, sizeof(*r));
286 r->continueFlag = odr_malloc(o, sizeof(bool_t));
287 *r->continueFlag = 1;
288 r->resultSetWanted = 0;
295 Z_AccessControlRequest *zget_AccessControlRequest(ODR o)
297 Z_AccessControlRequest *r = odr_malloc(o, sizeof(*r));
300 r->which = Z_AccessRequest_simpleForm;
308 Z_AccessControlResponse *zget_AccessControlResponse(ODR o)
310 Z_AccessControlResponse *r = odr_malloc(o, sizeof(*r));
313 r->which = Z_AccessResponse_simpleForm;
322 Z_Segment *zget_Segment(ODR o)
324 Z_Segment *r = odr_malloc(o, sizeof(*r));
327 r->numberOfRecordsReturned = odr_malloc(o, sizeof(int));
328 *r->numberOfRecordsReturned = 0;
329 r->num_segmentRecords = 0;
330 r->segmentRecords = 0;
335 Z_Close *zget_Close(ODR o)
337 Z_Close *r = odr_malloc(o, sizeof(*r));
340 r->closeReason = odr_malloc(o, sizeof(int));
341 *r->closeReason = Z_Close_finished;
342 r->diagnosticInformation = 0;
343 r->resourceReportFormat = 0;
344 r->resourceReport = 0;
351 Z_APDU *zget_APDU(ODR o, enum Z_APDU_which which)
353 Z_APDU *r = odr_malloc(o, sizeof(*r));
355 switch (r->which = which)
357 case Z_APDU_initRequest:
358 r->u.initRequest = zget_InitRequest(o); break;
359 case Z_APDU_initResponse:
360 r->u.initResponse = zget_InitResponse(o); break;
361 case Z_APDU_searchRequest:
362 r->u.searchRequest = zget_SearchRequest(o); break;
363 case Z_APDU_searchResponse:
364 r->u.searchResponse = zget_SearchResponse(o); break;
365 case Z_APDU_presentRequest:
366 r->u.presentRequest = zget_PresentRequest(o); break;
367 case Z_APDU_presentResponse:
368 r->u.presentResponse = zget_PresentResponse(o); break;
369 case Z_APDU_deleteResultSetRequest:
370 r->u.deleteResultSetRequest = zget_DeleteResultSetRequest(o); break;
371 case Z_APDU_deleteResultSetResponse:
372 r->u.deleteResultSetResponse = zget_DeleteResultSetResponse(o);
374 case Z_APDU_scanRequest:
375 r->u.scanRequest = zget_ScanRequest(o); break;
376 case Z_APDU_scanResponse:
377 r->u.scanResponse = zget_ScanResponse(o); break;
378 case Z_APDU_triggerResourceControlRequest:
379 r->u.triggerResourceControlRequest =
380 zget_TriggerResourceControlRequest(o); break;
381 case Z_APDU_resourceControlRequest:
382 r->u.resourceControlRequest = zget_ResourceControlRequest(o);
384 case Z_APDU_resourceControlResponse:
385 r->u.resourceControlResponse = zget_ResourceControlResponse(o);
387 case Z_APDU_segmentRequest:
388 r->u.segmentRequest = zget_Segment(o);
391 r->u.close = zget_Close(o);
394 fprintf(stderr, "Bad APDU-type to zget_APDU");