projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Version 5.9.0
[yaz-moved-to-github.git]
/
src
/
zget.c
diff --git
a/src/zget.c
b/src/zget.c
index
01a6330
..
7b11217
100644
(file)
--- a/
src/zget.c
+++ b/
src/zget.c
@@
-1,17
+1,19
@@
-/*
- * Copyright (C) 1995-2005, Index Data ApS
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) Index Data
* See the file LICENSE for details.
* See the file LICENSE for details.
- *
- * $Id: zget.c,v 1.10 2005-01-27 09:06:12 adam Exp $
*/
/**
* \file zget.c
* \brief Implements Z39.50 package creator utilities
*/
*/
/**
* \file zget.c
* \brief Implements Z39.50 package creator utilities
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <yaz/proto.h>
#include <yaz/proto.h>
+#include <yaz/oid_db.h>
-Z_InitRequest *zget_InitRequest(ODR o)
+static Z_InitRequest *zget_InitRequest(ODR o)
{
Z_InitRequest *r = (Z_InitRequest *)odr_malloc(o, sizeof(*r));
{
Z_InitRequest *r = (Z_InitRequest *)odr_malloc(o, sizeof(*r));
@@
-19,7
+21,7
@@
Z_InitRequest *zget_InitRequest(ODR o)
r->options = (Odr_bitmask *)odr_malloc(o, sizeof(*r->options));
ODR_MASK_ZERO(r->options);
r->protocolVersion = (Odr_bitmask *)
r->options = (Odr_bitmask *)odr_malloc(o, sizeof(*r->options));
ODR_MASK_ZERO(r->options);
r->protocolVersion = (Odr_bitmask *)
- odr_malloc(o, sizeof(*r->protocolVersion));
+ odr_malloc(o, sizeof(*r->protocolVersion));
ODR_MASK_SET(r->options, Z_Options_search);
ODR_MASK_SET(r->options, Z_Options_present);
ODR_MASK_SET(r->options, Z_Options_search);
ODR_MASK_SET(r->options, Z_Options_present);
@@
-35,19
+37,16
@@
Z_InitRequest *zget_InitRequest(ODR o)
r->implementationId = "81";
r->implementationName = "YAZ";
r->implementationVersion = YAZ_VERSION
r->implementationId = "81";
r->implementationName = "YAZ";
r->implementationVersion = YAZ_VERSION
-#ifdef YAZ_DATE_STR
- " (" YAZ_DATE_STR ")"
+#ifdef YAZ_VERSION_SHA1
+ " " YAZ_VERSION_SHA1
#endif
#endif
-#ifdef YAZ_OS
- " " YAZ_OS
-#endif
- ;
+ ;
r->userInformationField = 0;
r->otherInfo = 0;
return r;
}
r->userInformationField = 0;
r->otherInfo = 0;
return r;
}
-Z_InitResponse *zget_InitResponse(ODR o)
+static Z_InitResponse *zget_InitResponse(ODR o)
{
Z_InitResponse *r = (Z_InitResponse *)odr_malloc(o, sizeof(*r));
{
Z_InitResponse *r = (Z_InitResponse *)odr_malloc(o, sizeof(*r));
@@
-58,23
+57,20
@@
Z_InitResponse *zget_InitResponse(ODR o)
ODR_MASK_ZERO(r->protocolVersion);
r->preferredMessageSize = odr_intdup(o, 30*1024);
r->maximumRecordSize = odr_intdup(o, 30*1024);
ODR_MASK_ZERO(r->protocolVersion);
r->preferredMessageSize = odr_intdup(o, 30*1024);
r->maximumRecordSize = odr_intdup(o, 30*1024);
- r->result = odr_intdup(o, 1);
+ r->result = odr_booldup(o, 1);
r->implementationId = "81";
r->implementationName = "YAZ";
r->implementationVersion = YAZ_VERSION
r->implementationId = "81";
r->implementationName = "YAZ";
r->implementationVersion = YAZ_VERSION
-#ifdef YAZ_DATE_STR
- " (" YAZ_DATE_STR ")"
-#endif
-#ifdef YAZ_OS
- " " YAZ_OS
+#ifdef YAZ_VERSION_SHA1
+ " " YAZ_VERSION_SHA1
#endif
#endif
- ;
+ ;
r->userInformationField = 0;
r->otherInfo = 0;
return r;
}
r->userInformationField = 0;
r->otherInfo = 0;
return r;
}
-Z_SearchRequest *zget_SearchRequest(ODR o)
+static Z_SearchRequest *zget_SearchRequest(ODR o)
{
Z_SearchRequest *r = (Z_SearchRequest *)odr_malloc(o, sizeof(*r));
{
Z_SearchRequest *r = (Z_SearchRequest *)odr_malloc(o, sizeof(*r));
@@
-82,7
+78,7
@@
Z_SearchRequest *zget_SearchRequest(ODR o)
r->smallSetUpperBound = odr_intdup(o, 0);
r->largeSetLowerBound = odr_intdup(o, 1);
r->mediumSetPresentNumber = odr_intdup(o, 0);
r->smallSetUpperBound = odr_intdup(o, 0);
r->largeSetLowerBound = odr_intdup(o, 1);
r->mediumSetPresentNumber = odr_intdup(o, 0);
- r->replaceIndicator = odr_intdup(o, 1);
+ r->replaceIndicator = odr_booldup(o, 1);
r->resultSetName = "default";
r->num_databaseNames = 0;
r->databaseNames = 0;
r->resultSetName = "default";
r->num_databaseNames = 0;
r->databaseNames = 0;
@@
-95,7
+91,7
@@
Z_SearchRequest *zget_SearchRequest(ODR o)
return r;
}
return r;
}
-Z_SearchResponse *zget_SearchResponse(ODR o)
+static Z_SearchResponse *zget_SearchResponse(ODR o)
{
Z_SearchResponse *r = (Z_SearchResponse *)odr_malloc(o, sizeof(*r));
{
Z_SearchResponse *r = (Z_SearchResponse *)odr_malloc(o, sizeof(*r));
@@
-103,7
+99,7
@@
Z_SearchResponse *zget_SearchResponse(ODR o)
r->resultCount = odr_intdup(o, 0);
r->numberOfRecordsReturned = odr_intdup(o, 0);
r->nextResultSetPosition = odr_intdup(o, 0);
r->resultCount = odr_intdup(o, 0);
r->numberOfRecordsReturned = odr_intdup(o, 0);
r->nextResultSetPosition = odr_intdup(o, 0);
- r->searchStatus = odr_intdup(o, 1);
+ r->searchStatus = odr_booldup(o, 1);
r->resultSetStatus = 0;
r->presentStatus = 0;
r->records = 0;
r->resultSetStatus = 0;
r->presentStatus = 0;
r->records = 0;
@@
-112,7
+108,7
@@
Z_SearchResponse *zget_SearchResponse(ODR o)
return r;
}
return r;
}
-Z_PresentRequest *zget_PresentRequest(ODR o)
+static Z_PresentRequest *zget_PresentRequest(ODR o)
{
Z_PresentRequest *r = (Z_PresentRequest *)odr_malloc(o, sizeof(*r));
{
Z_PresentRequest *r = (Z_PresentRequest *)odr_malloc(o, sizeof(*r));
@@
-131,7
+127,7
@@
Z_PresentRequest *zget_PresentRequest(ODR o)
return r;
}
return r;
}
-Z_PresentResponse *zget_PresentResponse(ODR o)
+static Z_PresentResponse *zget_PresentResponse(ODR o)
{
Z_PresentResponse *r = (Z_PresentResponse *)odr_malloc(o, sizeof(*r));
{
Z_PresentResponse *r = (Z_PresentResponse *)odr_malloc(o, sizeof(*r));
@@
-144,10
+140,10
@@
Z_PresentResponse *zget_PresentResponse(ODR o)
return r;
}
return r;
}
-Z_DeleteResultSetRequest *zget_DeleteResultSetRequest(ODR o)
+static Z_DeleteResultSetRequest *zget_DeleteResultSetRequest(ODR o)
{
Z_DeleteResultSetRequest *r = (Z_DeleteResultSetRequest *)
{
Z_DeleteResultSetRequest *r = (Z_DeleteResultSetRequest *)
- odr_malloc(o, sizeof(*r));
+ odr_malloc(o, sizeof(*r));
r->referenceId = 0;
r->deleteFunction = odr_intdup(o, Z_DeleteResultSetRequest_list);
r->referenceId = 0;
r->deleteFunction = odr_intdup(o, Z_DeleteResultSetRequest_list);
@@
-157,11
+153,11
@@
Z_DeleteResultSetRequest *zget_DeleteResultSetRequest(ODR o)
return r;
}
return r;
}
-Z_DeleteResultSetResponse *zget_DeleteResultSetResponse(ODR o)
+static Z_DeleteResultSetResponse *zget_DeleteResultSetResponse(ODR o)
{
Z_DeleteResultSetResponse *r = (Z_DeleteResultSetResponse *)
{
Z_DeleteResultSetResponse *r = (Z_DeleteResultSetResponse *)
- odr_malloc(o, sizeof(*r));
-
+ odr_malloc(o, sizeof(*r));
+
r->referenceId = 0;
r->deleteOperationStatus = odr_intdup(o, Z_DeleteStatus_success);
r->deleteListStatuses = 0;
r->referenceId = 0;
r->deleteOperationStatus = odr_intdup(o, Z_DeleteStatus_success);
r->deleteListStatuses = 0;
@@
-172,10
+168,10
@@
Z_DeleteResultSetResponse *zget_DeleteResultSetResponse(ODR o)
return r;
}
return r;
}
-Z_ScanRequest *zget_ScanRequest(ODR o)
+static Z_ScanRequest *zget_ScanRequest(ODR o)
{
Z_ScanRequest *r = (Z_ScanRequest *)odr_malloc(o, sizeof(*r));
{
Z_ScanRequest *r = (Z_ScanRequest *)odr_malloc(o, sizeof(*r));
-
+
r->referenceId = 0;
r->num_databaseNames = 0;
r->databaseNames = 0;
r->referenceId = 0;
r->num_databaseNames = 0;
r->databaseNames = 0;
@@
-188,10
+184,10
@@
Z_ScanRequest *zget_ScanRequest(ODR o)
return r;
}
return r;
}
-Z_ScanResponse *zget_ScanResponse(ODR o)
+static Z_ScanResponse *zget_ScanResponse(ODR o)
{
Z_ScanResponse *r = (Z_ScanResponse *)odr_malloc(o, sizeof(*r));
{
Z_ScanResponse *r = (Z_ScanResponse *)odr_malloc(o, sizeof(*r));
-
+
r->referenceId = 0;
r->stepSize = 0;
r->scanStatus = odr_intdup(o, Z_Scan_success);
r->referenceId = 0;
r->stepSize = 0;
r->scanStatus = odr_intdup(o, Z_Scan_success);
@@
-203,11
+199,11
@@
Z_ScanResponse *zget_ScanResponse(ODR o)
return r;
}
return r;
}
-Z_TriggerResourceControlRequest *zget_TriggerResourceControlRequest(ODR o)
+static Z_TriggerResourceControlRequest *zget_TriggerResourceControlRequest(ODR o)
{
Z_TriggerResourceControlRequest *r = (Z_TriggerResourceControlRequest *)
{
Z_TriggerResourceControlRequest *r = (Z_TriggerResourceControlRequest *)
- odr_malloc(o, sizeof(*r));
-
+ odr_malloc(o, sizeof(*r));
+
r->referenceId = 0;
r->requestedAction = odr_intdup(o, Z_TriggerResourceControlRequest_resourceReport);
r->prefResourceReportFormat = 0;
r->referenceId = 0;
r->requestedAction = odr_intdup(o, Z_TriggerResourceControlRequest_resourceReport);
r->prefResourceReportFormat = 0;
@@
-216,37
+212,37
@@
Z_TriggerResourceControlRequest *zget_TriggerResourceControlRequest(ODR o)
return r;
}
return r;
}
-Z_ResourceControlRequest *zget_ResourceControlRequest(ODR o)
+static Z_ResourceControlRequest *zget_ResourceControlRequest(ODR o)
{
Z_ResourceControlRequest *r = (Z_ResourceControlRequest *)
{
Z_ResourceControlRequest *r = (Z_ResourceControlRequest *)
- odr_malloc(o, sizeof(*r));
+ odr_malloc(o, sizeof(*r));
r->referenceId = 0;
r->suspendedFlag = 0;
r->resourceReport = 0;
r->partialResultsAvailable = 0;
r->referenceId = 0;
r->suspendedFlag = 0;
r->resourceReport = 0;
r->partialResultsAvailable = 0;
- r->responseRequired = odr_intdup(o, 0);
+ r->responseRequired = odr_booldup(o, 0);
r->triggeredRequestFlag = 0;
r->otherInfo = 0;
return r;
}
r->triggeredRequestFlag = 0;
r->otherInfo = 0;
return r;
}
-Z_ResourceControlResponse *zget_ResourceControlResponse(ODR o)
+static Z_ResourceControlResponse *zget_ResourceControlResponse(ODR o)
{
Z_ResourceControlResponse *r = (Z_ResourceControlResponse *)
{
Z_ResourceControlResponse *r = (Z_ResourceControlResponse *)
- odr_malloc(o, sizeof(*r));
+ odr_malloc(o, sizeof(*r));
r->referenceId = 0;
r->referenceId = 0;
- r->continueFlag = odr_intdup(o, 1);
+ r->continueFlag = odr_booldup(o, 1);
r->resultSetWanted = 0;
r->otherInfo = 0;
return r;
}
r->resultSetWanted = 0;
r->otherInfo = 0;
return r;
}
-Z_AccessControlRequest *zget_AccessControlRequest(ODR o)
+static Z_AccessControlRequest *zget_AccessControlRequest(ODR o)
{
Z_AccessControlRequest *r = (Z_AccessControlRequest *)
{
Z_AccessControlRequest *r = (Z_AccessControlRequest *)
- odr_malloc(o, sizeof(*r));
+ odr_malloc(o, sizeof(*r));
r->referenceId = 0;
r->which = Z_AccessControlRequest_simpleForm;
r->referenceId = 0;
r->which = Z_AccessControlRequest_simpleForm;
@@
-255,10
+251,10
@@
Z_AccessControlRequest *zget_AccessControlRequest(ODR o)
return r;
}
return r;
}
-Z_AccessControlResponse *zget_AccessControlResponse(ODR o)
+static Z_AccessControlResponse *zget_AccessControlResponse(ODR o)
{
Z_AccessControlResponse *r = (Z_AccessControlResponse *)
{
Z_AccessControlResponse *r = (Z_AccessControlResponse *)
- odr_malloc(o, sizeof(*r));
+ odr_malloc(o, sizeof(*r));
r->referenceId = 0;
r->which = Z_AccessControlResponse_simpleForm;
r->referenceId = 0;
r->which = Z_AccessControlResponse_simpleForm;
@@
-268,7
+264,7
@@
Z_AccessControlResponse *zget_AccessControlResponse(ODR o)
return r;
}
return r;
}
-Z_Segment *zget_Segment(ODR o)
+static Z_Segment *zget_Segment(ODR o)
{
Z_Segment *r = (Z_Segment *)odr_malloc(o, sizeof(*r));
{
Z_Segment *r = (Z_Segment *)odr_malloc(o, sizeof(*r));
@@
-280,7
+276,7
@@
Z_Segment *zget_Segment(ODR o)
return r;
}
return r;
}
-Z_Close *zget_Close(ODR o)
+static Z_Close *zget_Close(ODR o)
{
Z_Close *r = (Z_Close *)odr_malloc(o, sizeof(*r));
{
Z_Close *r = (Z_Close *)odr_malloc(o, sizeof(*r));
@@
-293,10
+289,10
@@
Z_Close *zget_Close(ODR o)
return r;
}
return r;
}
-Z_ResourceReportRequest *zget_ResourceReportRequest(ODR o)
+static Z_ResourceReportRequest *zget_ResourceReportRequest(ODR o)
{
Z_ResourceReportRequest *r = (Z_ResourceReportRequest *)
{
Z_ResourceReportRequest *r = (Z_ResourceReportRequest *)
- odr_malloc(o, sizeof(*r));
+ odr_malloc(o, sizeof(*r));
r->referenceId = 0;
r->opId = 0;
r->referenceId = 0;
r->opId = 0;
@@
-305,10
+301,10
@@
Z_ResourceReportRequest *zget_ResourceReportRequest(ODR o)
return r;
}
return r;
}
-Z_ResourceReportResponse *zget_ResourceReportResponse(ODR o)
+static Z_ResourceReportResponse *zget_ResourceReportResponse(ODR o)
{
Z_ResourceReportResponse *r = (Z_ResourceReportResponse *)
{
Z_ResourceReportResponse *r = (Z_ResourceReportResponse *)
- odr_malloc(o, sizeof(*r));
+ odr_malloc(o, sizeof(*r));
r->referenceId = 0;
r->resourceReportStatus = odr_intdup(o, Z_ResourceReportResponse_success);
r->referenceId = 0;
r->resourceReportStatus = odr_intdup(o, Z_ResourceReportResponse_success);
@@
-317,7
+313,7
@@
Z_ResourceReportResponse *zget_ResourceReportResponse(ODR o)
return r;
}
return r;
}
-Z_SortRequest *zget_SortRequest(ODR o)
+static Z_SortRequest *zget_SortRequest(ODR o)
{
Z_SortRequest *r = (Z_SortRequest *)odr_malloc(o, sizeof(*r));
{
Z_SortRequest *r = (Z_SortRequest *)odr_malloc(o, sizeof(*r));
@@
-329,7
+325,7
@@
Z_SortRequest *zget_SortRequest(ODR o)
return r;
}
return r;
}
-Z_SortResponse *zget_SortResponse(ODR o)
+static Z_SortResponse *zget_SortResponse(ODR o)
{
Z_SortResponse *r = (Z_SortResponse *)odr_malloc(o, sizeof(*r));
{
Z_SortResponse *r = (Z_SortResponse *)odr_malloc(o, sizeof(*r));
@@
-342,10
+338,10
@@
Z_SortResponse *zget_SortResponse(ODR o)
return r;
}
return r;
}
-Z_ExtendedServicesRequest *zget_ExtendedServicesRequest(ODR o)
+static Z_ExtendedServicesRequest *zget_ExtendedServicesRequest(ODR o)
{
Z_ExtendedServicesRequest *r = (Z_ExtendedServicesRequest *)
{
Z_ExtendedServicesRequest *r = (Z_ExtendedServicesRequest *)
- odr_malloc(o, sizeof(*r));
+ odr_malloc(o, sizeof(*r));
r->referenceId = 0;
r->function = odr_intdup(o, Z_ExtendedServicesRequest_create);
r->referenceId = 0;
r->function = odr_intdup(o, Z_ExtendedServicesRequest_create);
@@
-362,10
+358,10
@@
Z_ExtendedServicesRequest *zget_ExtendedServicesRequest(ODR o)
return r;
}
return r;
}
-Z_ExtendedServicesResponse *zget_ExtendedServicesResponse(ODR o)
+static Z_ExtendedServicesResponse *zget_ExtendedServicesResponse(ODR o)
{
Z_ExtendedServicesResponse *r = (Z_ExtendedServicesResponse *)
{
Z_ExtendedServicesResponse *r = (Z_ExtendedServicesResponse *)
- odr_malloc(o, sizeof(*r));
+ odr_malloc(o, sizeof(*r));
r->referenceId = 0;
r->operationStatus = odr_intdup(o, Z_ExtendedServicesResponse_done);
r->referenceId = 0;
r->operationStatus = odr_intdup(o, Z_ExtendedServicesResponse_done);
@@
-376,11
+372,11
@@
Z_ExtendedServicesResponse *zget_ExtendedServicesResponse(ODR o)
return r;
}
return r;
}
-Z_DuplicateDetectionRequest *zget_DuplicateDetectionRequest(ODR o)
+static Z_DuplicateDetectionRequest *zget_DuplicateDetectionRequest(ODR o)
{
Z_DuplicateDetectionRequest *r = (Z_DuplicateDetectionRequest *)
odr_malloc(o, sizeof(*r));
{
Z_DuplicateDetectionRequest *r = (Z_DuplicateDetectionRequest *)
odr_malloc(o, sizeof(*r));
-
+
r->referenceId = 0;
r->num_inputResultSetIds = 0;
r->inputResultSetIds = 0;
r->referenceId = 0;
r->num_inputResultSetIds = 0;
r->inputResultSetIds = 0;
@@
-397,11
+393,11
@@
Z_DuplicateDetectionRequest *zget_DuplicateDetectionRequest(ODR o)
return r;
}
return r;
}
-Z_DuplicateDetectionResponse *zget_DuplicateDetectionResponse(ODR o)
+static Z_DuplicateDetectionResponse *zget_DuplicateDetectionResponse(ODR o)
{
Z_DuplicateDetectionResponse *r = (Z_DuplicateDetectionResponse *)
odr_malloc(o, sizeof(*r));
{
Z_DuplicateDetectionResponse *r = (Z_DuplicateDetectionResponse *)
odr_malloc(o, sizeof(*r));
-
+
r->referenceId = 0;
r->status = odr_intdup(o, Z_DuplicateDetectionResponse_success);
r->resultSetCount = 0;
r->referenceId = 0;
r->status = odr_intdup(o, Z_DuplicateDetectionResponse_success);
r->resultSetCount = 0;
@@
-410,11
+406,11
@@
Z_DuplicateDetectionResponse *zget_DuplicateDetectionResponse(ODR o)
r->otherInfo = 0;
return r;
}
r->otherInfo = 0;
return r;
}
-
+
Z_APDU *zget_APDU(ODR o, int which)
{
Z_APDU *r = (Z_APDU *)odr_malloc(o, sizeof(*r));
Z_APDU *zget_APDU(ODR o, int which)
{
Z_APDU *r = (Z_APDU *)odr_malloc(o, sizeof(*r));
-
+
switch (r->which = which)
{
case Z_APDU_initRequest:
switch (r->which = which)
{
case Z_APDU_initRequest:
@@
-486,7
+482,7
@@
Z_APDU *zget_APDU(ODR o, int which)
break;
case Z_APDU_extendedServicesResponse:
r->u.extendedServicesResponse = zget_ExtendedServicesResponse(o);
break;
case Z_APDU_extendedServicesResponse:
r->u.extendedServicesResponse = zget_ExtendedServicesResponse(o);
- break;
+ break;
case Z_APDU_duplicateDetectionRequest:
r->u.duplicateDetectionRequest = zget_DuplicateDetectionRequest(o);
break;
case Z_APDU_duplicateDetectionRequest:
r->u.duplicateDetectionRequest = zget_DuplicateDetectionRequest(o);
break;
@@
-494,18
+490,18
@@
Z_APDU *zget_APDU(ODR o, int which)
r->u.duplicateDetectionResponse = zget_DuplicateDetectionResponse(o);
break;
default:
r->u.duplicateDetectionResponse = zget_DuplicateDetectionResponse(o);
break;
default:
- return 0;
+ return 0;
}
return r;
}
Z_DefaultDiagFormat *zget_DefaultDiagFormat(ODR o, int error,
}
return r;
}
Z_DefaultDiagFormat *zget_DefaultDiagFormat(ODR o, int error,
- const char *addinfo)
+ const char *addinfo)
{
{
- Z_DefaultDiagFormat *dr = (Z_DefaultDiagFormat *)
- odr_malloc (o, sizeof(*dr));
-
- dr->diagnosticSetId = yaz_oidval_to_z3950oid (o, CLASS_DIAGSET, VAL_BIB1);
+ Z_DefaultDiagFormat *dr = (Z_DefaultDiagFormat *)
+ odr_malloc(o, sizeof(*dr));
+
+ dr->diagnosticSetId = odr_oiddup(o, yaz_oid_diagset_bib_1);
dr->condition = odr_intdup(o, error);
dr->which = Z_DefaultDiagFormat_v2Addinfo;
dr->u.v2Addinfo = odr_strdup (o, addinfo ? addinfo : "");
dr->condition = odr_intdup(o, error);
dr->which = Z_DefaultDiagFormat_v2Addinfo;
dr->u.v2Addinfo = odr_strdup (o, addinfo ? addinfo : "");
@@
-531,15
+527,15
@@
Z_DiagRecs *zget_DiagRecs(ODR o, int error, const char *addinfo)
}
Z_NamePlusRecord *zget_surrogateDiagRec(ODR o, const char *dbname,
}
Z_NamePlusRecord *zget_surrogateDiagRec(ODR o, const char *dbname,
- int error, const char *addinfo)
+ int error, const char *addinfo)
{
{
- Z_NamePlusRecord *rec = (Z_NamePlusRecord *) odr_malloc (o, sizeof(*rec));
- Z_DiagRec *drec = (Z_DiagRec *)odr_malloc (o, sizeof(*drec));
-
+ Z_NamePlusRecord *rec = (Z_NamePlusRecord *) odr_malloc(o, sizeof(*rec));
+ Z_DiagRec *drec = (Z_DiagRec *)odr_malloc(o, sizeof(*drec));
+
if (dbname)
if (dbname)
- rec->databaseName = odr_strdup(o, dbname);
+ rec->databaseName = odr_strdup(o, dbname);
else
else
- rec->databaseName = 0;
+ rec->databaseName = 0;
rec->which = Z_NamePlusRecord_surrogateDiagnostic;
rec->u.surrogateDiagnostic = drec;
drec->which = Z_DiagRec_defaultFormat;
rec->which = Z_NamePlusRecord_surrogateDiagnostic;
rec->u.surrogateDiagnostic = drec;
drec->which = Z_DiagRec_defaultFormat;
@@
-550,7
+546,6
@@
Z_NamePlusRecord *zget_surrogateDiagRec(ODR o, const char *dbname,
Z_External *zget_init_diagnostics(ODR odr, int error, const char *addinfo)
{
Z_External *x, *x2;
Z_External *zget_init_diagnostics(ODR odr, int error, const char *addinfo)
{
Z_External *x, *x2;
- oident oid;
Z_OtherInformation *u;
Z_OtherInformationUnit *l;
Z_DiagnosticFormat *d;
Z_OtherInformation *u;
Z_OtherInformationUnit *l;
Z_DiagnosticFormat *d;
@@
-558,14
+553,11
@@
Z_External *zget_init_diagnostics(ODR odr, int error, const char *addinfo)
x = (Z_External*) odr_malloc(odr, sizeof *x);
x->descriptor = 0;
x = (Z_External*) odr_malloc(odr, sizeof *x);
x->descriptor = 0;
- x->indirect_reference = 0;
- oid.proto = PROTO_Z3950;
- oid.oclass = CLASS_USERINFO;
- oid.value = VAL_USERINFO1;
- x->direct_reference = odr_oiddup(odr, oid_getoidbyent(&oid));
+ x->indirect_reference = 0;
+ x->direct_reference = odr_oiddup(odr, yaz_oid_userinfo_userinfo_1);
x->which = Z_External_userInfo1;
x->which = Z_External_userInfo1;
- u = odr_malloc(odr, sizeof *u);
+ u = (Z_OtherInformation *) odr_malloc(odr, sizeof *u);
x->u.userInfo1 = u;
u->num_elements = 1;
u->list = (Z_OtherInformationUnit**) odr_malloc(odr, sizeof *u->list);
x->u.userInfo1 = u;
u->num_elements = 1;
u->list = (Z_OtherInformationUnit**) odr_malloc(odr, sizeof *u->list);
@@
-578,16
+570,14
@@
Z_External *zget_init_diagnostics(ODR odr, int error, const char *addinfo)
l->information.externallyDefinedInfo = x2;
x2->descriptor = 0;
x2->indirect_reference = 0;
l->information.externallyDefinedInfo = x2;
x2->descriptor = 0;
x2->indirect_reference = 0;
- oid.oclass = CLASS_DIAGSET;
- oid.value = VAL_DIAG1;
- x2->direct_reference = odr_oiddup(odr, oid_getoidbyent(&oid));
+ x2->direct_reference = odr_oiddup(odr, yaz_oid_diagset_diag_1);
x2->which = Z_External_diag1;
d = (Z_DiagnosticFormat*) odr_malloc(odr, sizeof *d);
x2->u.diag1 = d;
d->num = 1;
x2->which = Z_External_diag1;
d = (Z_DiagnosticFormat*) odr_malloc(odr, sizeof *d);
x2->u.diag1 = d;
d->num = 1;
- d->elements = (Z_DiagnosticFormat_s**) odr_malloc (odr, sizeof *d->elements);
- d->elements[0] = (Z_DiagnosticFormat_s*) odr_malloc (odr, sizeof *d->elements[0]);
+ d->elements = (Z_DiagnosticFormat_s**) odr_malloc(odr, sizeof *d->elements);
+ d->elements[0] = (Z_DiagnosticFormat_s*) odr_malloc(odr, sizeof *d->elements[0]);
e = d->elements[0];
e->which = Z_DiagnosticFormat_s_defaultDiagRec;
e = d->elements[0];
e->which = Z_DiagnosticFormat_s_defaultDiagRec;
@@
-597,10
+587,9
@@
Z_External *zget_init_diagnostics(ODR odr, int error, const char *addinfo)
}
Z_External *zget_init_diagnostics_octet(ODR odr, int error,
}
Z_External *zget_init_diagnostics_octet(ODR odr, int error,
- const char *addinfo)
+ const char *addinfo)
{
Z_External *x, *x2;
{
Z_External *x, *x2;
- oident oid;
Z_OtherInformation *u;
Z_OtherInformationUnit *l;
Z_DiagnosticFormat *d;
Z_OtherInformation *u;
Z_OtherInformationUnit *l;
Z_DiagnosticFormat *d;
@@
-609,7
+598,7
@@
Z_External *zget_init_diagnostics_octet(ODR odr, int error,
int octet_len;
ODR encode;
int octet_len;
ODR encode;
- u = odr_malloc(odr, sizeof *u);
+ u = (Z_OtherInformation *) odr_malloc(odr, sizeof *u);
u->num_elements = 1;
u->list = (Z_OtherInformationUnit**) odr_malloc(odr, sizeof *u->list);
u->list[0] = (Z_OtherInformationUnit*) odr_malloc(odr, sizeof *u->list[0]);
u->num_elements = 1;
u->list = (Z_OtherInformationUnit**) odr_malloc(odr, sizeof *u->list);
u->list[0] = (Z_OtherInformationUnit*) odr_malloc(odr, sizeof *u->list[0]);
@@
-621,17
+610,15
@@
Z_External *zget_init_diagnostics_octet(ODR odr, int error,
l->information.externallyDefinedInfo = x2;
x2->descriptor = 0;
x2->indirect_reference = 0;
l->information.externallyDefinedInfo = x2;
x2->descriptor = 0;
x2->indirect_reference = 0;
- oid.oclass = CLASS_DIAGSET;
- oid.proto = PROTO_Z3950;
- oid.value = VAL_DIAG1;
- x2->direct_reference = odr_oiddup(odr, oid_getoidbyent(&oid));
+
+ x2->direct_reference = odr_oiddup(odr, yaz_oid_diagset_diag_1);
x2->which = Z_External_diag1;
d = (Z_DiagnosticFormat*) odr_malloc(odr, sizeof *d);
x2->u.diag1 = d;
d->num = 1;
x2->which = Z_External_diag1;
d = (Z_DiagnosticFormat*) odr_malloc(odr, sizeof *d);
x2->u.diag1 = d;
d->num = 1;
- d->elements = (Z_DiagnosticFormat_s**) odr_malloc (odr, sizeof *d->elements);
- d->elements[0] = (Z_DiagnosticFormat_s*) odr_malloc (odr, sizeof *d->elements[0]);
+ d->elements = (Z_DiagnosticFormat_s**) odr_malloc(odr, sizeof *d->elements);
+ d->elements[0] = (Z_DiagnosticFormat_s*) odr_malloc(odr, sizeof *d->elements[0]);
e = d->elements[0];
e->which = Z_DiagnosticFormat_s_defaultDiagRec;
e = d->elements[0];
e->which = Z_DiagnosticFormat_s_defaultDiagRec;
@@
-646,20
+633,22
@@
Z_External *zget_init_diagnostics_octet(ODR odr, int error,
x = (Z_External*) odr_malloc(odr, sizeof *x);
x->descriptor = 0;
x = (Z_External*) odr_malloc(odr, sizeof *x);
x->descriptor = 0;
- x->indirect_reference = 0;
- oid.proto = PROTO_Z3950;
- oid.oclass = CLASS_USERINFO;
- oid.value = VAL_USERINFO1;
- x->direct_reference = odr_oiddup(odr, oid_getoidbyent(&oid));
-
+ x->indirect_reference = 0;
+ x->direct_reference = odr_oiddup(odr, yaz_oid_userinfo_userinfo_1);
x->which = Z_External_octet;
x->which = Z_External_octet;
- x->u.octet_aligned = (Odr_oct *) odr_malloc(odr, sizeof(Odr_oct));
- x->u.octet_aligned->buf = odr_malloc(odr, octet_len);
- memcpy(x->u.octet_aligned->buf, octet_buf, octet_len);
- x->u.octet_aligned->len = octet_len;
+ x->u.octet_aligned = odr_create_Odr_oct(odr, octet_buf, octet_len);
odr_destroy(encode);
return x;
}
odr_destroy(encode);
return x;
}
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+