From: Sebastian Hammer Date: Thu, 15 Jun 1995 07:44:49 +0000 (+0000) Subject: Moving to v3. X-Git-Tag: YAZ.1.8~977 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=1db60f5a7396b9b37560f6b6962be0b68240486c Moving to v3. --- diff --git a/asn/proto.c b/asn/proto.c index b238dd2..45735b6 100644 --- a/asn/proto.c +++ b/asn/proto.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: proto.c,v $ - * Revision 1.28 1995-06-14 15:26:35 quinn + * Revision 1.29 1995-06-15 07:44:49 quinn + * Moving to v3. + * + * Revision 1.28 1995/06/14 15:26:35 quinn * *** empty log message *** * * Revision 1.27 1995/06/07 14:36:22 quinn @@ -153,9 +156,10 @@ int z_OtherInformationUnit(ODR o, Z_OtherInformationUnit **p, int opt) int z_OtherInformation(ODR o, Z_OtherInformation **p, int opt) { - if (o->direction == ODR_ENCODE) + if (o->direction == ODR_DECODE) *p = odr_malloc(o, sizeof(**p)); - + else if (!*p) + return opt; odr_implicit_settag(o, ODR_CONTEXT, 201); if (odr_sequence_of(o, z_OtherInformationUnit, &(*p)->list, &(*p)->num_elements)) @@ -177,6 +181,8 @@ int z_StringOrNumeric(ODR o, Z_StringOrNumeric **p, int opt) if (o->direction == ODR_DECODE) *p = odr_malloc(o, sizeof(**p)); + else if (!*p) + return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) return 1; *p = 0; @@ -255,6 +261,8 @@ int z_IdAuthentication(ODR o, Z_IdAuthentication **p, int opt) if (o->direction == ODR_DECODE) *p = odr_malloc(o, sizeof(**p)); + else if (!*p) + return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) return 1; @@ -338,7 +346,7 @@ int z_TriggerResourceControlRequest(ODR o, Z_TriggerResourceControlRequest **p, ODR_CONTEXT, 47, 1) && odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT, 48, 1) && -#ifdef Z_OTHERINFO +#ifdef Z_95 z_OtherInformation(o, &(*p)->otherInfo, 1) && #endif odr_sequence_end(o); @@ -359,7 +367,7 @@ int z_ResourceControlRequest(ODR o, Z_ResourceControlRequest **p, int opt) 42, 0) && odr_implicit(o, odr_bool, &(*p)->triggeredRequestFlag, ODR_CONTEXT, 43, 1) && -#ifdef Z_OTHERINFO +#ifdef Z_95 z_OtherInformation(o, &(*p)->otherInfo, 1) && #endif odr_sequence_end(o); @@ -374,7 +382,7 @@ int z_ResourceControlResponse(ODR o, Z_ResourceControlResponse **p, int opt) odr_implicit(o, odr_bool, &(*p)->continueFlag, ODR_CONTEXT, 44, 0) && odr_implicit(o, odr_bool, &(*p)->resultSetWanted, ODR_CONTEXT, 45, 1) && -#ifdef Z_OTHERINFO +#ifdef Z_95 z_OtherInformation(o, &(*p)->otherInfo, 1) && #endif odr_sequence_end(o); @@ -475,7 +483,7 @@ int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt) odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT, 120, 0) && #ifdef Z_95 - odr_choice(o, arm, &(*p)->u, &(*p)->which) && + odr_choice(o, arm, &(*p)->value, &(*p)->which) && #else odr_implicit(o, odr_integer, &(*p)->attributeValue, ODR_CONTEXT, 121, 0) && @@ -574,8 +582,6 @@ int z_Operator(ODR o, Z_Operator **p, int opt) return opt && odr_ok(o); if (o->direction == ODR_DECODE) *p = odr_malloc(o, sizeof(**p)); - else - (*p)->u.and = ODR_NULLVAL; if (odr_choice(o, arm, &(*p)->u, &(*p)->which) && odr_constructed_end(o)) @@ -594,7 +600,7 @@ int z_Operand(ODR o, Z_Operand **p, int opt) {-1, -1, -1, -1, 0} }; - if (o->direction ==ODR_DECODE) + if (o->direction == ODR_DECODE) *p = odr_malloc(o, sizeof(**p)); else if (!*p) return opt; @@ -711,6 +717,48 @@ int z_DatabaseRecord(ODR o, Z_DatabaseRecord **p, int opt) return odr_external(o, (Odr_external **) p, opt); } +#ifdef Z_95 + +int z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt && odr_ok(o); + return + odr_oid(o, &(*p)->diagnosticSetId, 1) && /* SHOULD NOT BE OPT! */ + odr_integer(o, &(*p)->condition, 0) && + /* + * I no longer recall what server tagged the addinfo.. but it isn't + * hurting anyone, so... + * We need to turn it into a choice, or something, because of + * that damn generalstring in v3. + */ + (odr_visiblestring(o, &(*p)->addinfo, 0) || + odr_implicit(o, odr_cstring, &(*p)->addinfo, ODR_CONTEXT, + ODR_VISIBLESTRING, 1)) && + odr_sequence_end(o); +} + +int z_DiagRec(ODR o, Z_DiagRec **p, int opt) +{ + static Odr_arm arm[] = + { + {-1, -1, -1, Z_DiagRec_defaultFormat, z_DefaultDiagFormat}, + {-1, -1, -1, Z_DiagRec_externallyDefined, odr_external}, + {-1, -1, -1, -1, 0} + }; + + if (o->direction == ODR_DECODE) + *p = odr_malloc(o, sizeof(**p)); + else if (!*p) + return opt; + if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) + return 1; + *p = 0; + return opt && odr_ok(o); +} + +#else + int z_DiagRec(ODR o, Z_DiagRec **p, int opt) { if (!odr_sequence_begin(o, p, sizeof(**p))) @@ -730,6 +778,8 @@ int z_DiagRec(ODR o, Z_DiagRec **p, int opt) odr_sequence_end(o); } +#endif + int z_NamePlusRecord(ODR o, Z_NamePlusRecord **p, int opt) { static Odr_arm arm[] = @@ -756,6 +806,8 @@ int z_NamePlusRecordList(ODR o, Z_NamePlusRecordList **p, int opt) { if (o->direction == ODR_DECODE) *p = odr_malloc(o, sizeof(**p)); + else if (!*p) + return opt; if (odr_sequence_of(o, z_NamePlusRecord, &(*p)->records, &(*p)->num_records)) return 1; @@ -799,7 +851,7 @@ int z_AccessControlRequest(ODR o, Z_AccessControlRequest **p, int opt) return z_ReferenceId(o, &(*p)->referenceId, 1) && odr_choice(o, arm, &(*p)->u, &(*p)->which) && -#ifdef Z_OTHERINFO +#ifdef Z_95 z_OtherInformation(o, &(*p)->otherInfo, 1) && #endif odr_sequence_end(o); @@ -821,7 +873,7 @@ int z_AccessControlResponse(ODR o, Z_AccessControlResponse **p, int opt) z_ReferenceId(o, &(*p)->referenceId, 1) && odr_choice(o, arm, &(*p)->u, &(*p)->which) && odr_explicit(o, z_DiagRec, &(*p)->diagnostic, ODR_CONTEXT, 223, 1) && -#ifdef Z_OTHERINFO +#ifdef Z_95 z_OtherInformation(o, &(*p)->otherInfo, 1) && #endif odr_sequence_end(o); @@ -937,6 +989,8 @@ int z_Entry(ODR o, Z_Entry **p, int opt) if (o->direction == ODR_DECODE) *p = odr_malloc(o, sizeof(**p)); + else if (!*p) + return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) return 1; @@ -984,6 +1038,8 @@ int z_ListEntries(ODR o, Z_ListEntries **p, int opt) if (o->direction == ODR_DECODE) *p = odr_malloc(o, sizeof(**p)); + else if (!*p) + return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) return 1; @@ -1079,13 +1135,15 @@ int z_ElementSpec(ODR o, Z_ElementSpec **p, int opt) { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_ElementSpec_elementSetName, odr_visiblestring}, - {ODR_IMPLICIT; ODR_CONTEXT, 2, Z_ElementSpec_externalSpec, + {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_ElementSpec_externalSpec, odr_external}, {-1, -1, -1, -1, 0} }; if (o->direction == ODR_DECODE) *p = odr_malloc(o, sizeof(**p)); + else if (!*p) + return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) return 1; @@ -1108,7 +1166,8 @@ int z_DbSpecific(ODR o, Z_DbSpecific **p, int opt) if (!odr_sequence_begin(o, p, sizeof(**p))) return opt && odr_ok(o); return - odr_explicit(o, z_DatabaseName, &(*p)->db, ODR_CONTEXT, 1, 0) && + odr_explicit(o, z_DatabaseName, &(*p)->databaseName, ODR_CONTEXT, + 1, 0) && odr_implicit(o, z_Specification, &(*p)->spec, ODR_CONTEXT, 2, 0) && odr_sequence_end(o); } @@ -1122,11 +1181,11 @@ int z_CompSpec(ODR o, Z_CompSpec **p, int opt) 1, 0) && odr_implicit(o, z_Specification, &(*p)->generic, ODR_CONTEXT, 2, 1) && odr_implicit_settag(o, ODR_CONTEXT, 3) && - (odr_sequence_of(o, z_DbSpecific, &(*p)->num_dbSpecific, - &(*p)->dbSpecific) || odr_ok(o)) && + (odr_sequence_of(o, z_DbSpecific, &(*p)->dbSpecific, + &(*p)->num_dbSpecific) || odr_ok(o)) && odr_implicit_settag(o, ODR_CONTEXT, 4) && - (odr_sequence_of(o, odr_oid, &(*p)->num_recordSyntax, - &(*p)->recordSyntax) || odr_ok(o)) && + (odr_sequence_of(o, odr_oid, &(*p)->recordSyntax, + &(*p)->num_recordSyntax) || odr_ok(o)) && odr_sequence_end(o); } @@ -1143,6 +1202,8 @@ int z_RecordComposition(ODR o, Z_RecordComposition **p, int opt) if (o->direction == ODR_DECODE) *p = odr_malloc(o, sizeof(**p)); + else if (!*p) + return opt; if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) return 1; @@ -1178,8 +1239,8 @@ int z_PresentRequest(ODR o, Z_PresentRequest **p, int opt) 29, 0) && #ifdef Z_95 odr_implicit_settag(o, ODR_CONTEXT, 212) && - (odr_sequence_of(o, z_Range, &(*p)->num_ranges, - &(*p)->additionalRanges) || odr_ok(o)) && + (odr_sequence_of(o, z_Range, &(*p)->additionalRanges, + &(*p)->num_ranges) || odr_ok(o)) && z_RecordComposition(o, &(*p)->recordComposition, 1) && #else z_ElementSetNames(o, &pp->elementSetNames, 1) && @@ -1191,7 +1252,7 @@ int z_PresentRequest(ODR o, Z_PresentRequest **p, int opt) 204, 1) && odr_implicit(o, odr_integer, &(*p)->maxRecordSize, ODR_CONTEXT, 206, 1) && - odr_impplicit(o, odr_integer, &(*p)->maxSegmentSize, ODR_CONTEXT, + odr_implicit(o, odr_integer, &(*p)->maxSegmentSize, ODR_CONTEXT, 207, 1) && z_OtherInformation(o, &(*p)->otherInfo, 1) && #endif @@ -1212,7 +1273,7 @@ int z_PresentResponse(ODR o, Z_PresentResponse **p, int opt) z_PresentStatus(o, &pp->presentStatus, 0) && z_Records(o, &pp->records, 1) && #ifdef Z_95 - Z_OtherInformation(o, &(*p)->otherInfo, 1) && + z_OtherInformation(o, &(*p)->otherInfo, 1) && #endif odr_sequence_end(o); } @@ -1244,7 +1305,7 @@ int z_DeleteResultSetRequest(ODR o, Z_DeleteResultSetRequest **p, int opt) 0) && (odr_sequence_of(o, z_ListStatus, &(*p)->resultSetList, &(*p)->num_ids) || odr_ok(o)) && -#ifdef Z_OTHERINFO +#ifdef Z_95 z_OtherInformation(o, &(*p)->otherInfo, 1) && #endif odr_sequence_end(o); @@ -1268,7 +1329,7 @@ int z_DeleteResultSetResponse(ODR o, Z_DeleteResultSetResponse **p, int opt) &(*p)->num_bulkStatuses) || odr_ok(o)) && odr_implicit(o, odr_visiblestring, &(*p)->deleteMessage, ODR_CONTEXT, 36, 1) && -#ifdef Z_OTHERINFO +#ifdef Z_95 z_OtherInformation(o, &(*p)->otherInfo, 1) && #endif odr_sequence_end(o); @@ -1285,8 +1346,8 @@ int z_Segment(ODR o, Z_Segment **p, int opt) odr_implicit(o, odr_integer, &(*p)->numberOfRecordsReturned, ODR_CONTEXT, 24, 0) && odr_implicit_settag(o, ODR_CONTEXT, 0) && - odr_sequence_of(o, z_NamePlusRecord, &(*p)->num_segmentRecords, - &(*p)->segmentRecords) && + odr_sequence_of(o, z_NamePlusRecord, &(*p)->segmentRecords, + &(*p)->num_segmentRecords) && z_OtherInformation(o, &(*p)->otherInfo, 1) && odr_sequence_end(o); } @@ -1306,7 +1367,7 @@ int z_Close(ODR o, Z_Close **p, int opt) 4, 1) && odr_implicit(o, odr_external, &(*p)->resourceReport, ODR_CONTEXT, 5, 1) && -#ifdef Z_OTHERINFO +#ifdef Z_95 z_OtherInformation(o, &(*p)->otherInfo, 1) && #endif odr_sequence_end(o); diff --git a/asn/zget.c b/asn/zget.c index 016adbb..d6dbf65 100644 --- a/asn/zget.c +++ b/asn/zget.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zget.c,v $ - * Revision 1.6 1995-06-14 15:26:37 quinn + * Revision 1.7 1995-06-15 07:44:52 quinn + * Moving to v3. + * + * Revision 1.6 1995/06/14 15:26:37 quinn * *** empty log message *** * * Revision 1.5 1995/06/07 14:42:30 quinn @@ -45,6 +48,9 @@ Z_InitRequest *zget_InitRequest(ODR o) r->implementationName = "Index Data/YAZ"; r->implementationVersion = YAZ_VERSION; r->userInformationField = 0; +#ifdef Z_95 + r->otherInfo = 0; +#endif return r; } @@ -67,6 +73,9 @@ Z_InitResponse *zget_InitResponse(ODR o) r->implementationName = "Index Data/YAZ"; r->implementationVersion = YAZ_VERSION; r->userInformationField = 0; +#ifdef Z_95 + r->otherInfo = 0; +#endif return r; } @@ -90,6 +99,10 @@ Z_SearchRequest *zget_SearchRequest(ODR o) r->mediumSetElementSetNames = 0; r->preferredRecordSyntax = 0; r->query = 0; +#ifdef Z_95 + r->additionalSearchInfo = 0; + r->otherInfo = 0; +#endif return r; } @@ -109,6 +122,10 @@ Z_SearchResponse *zget_SearchResponse(ODR o) r->resultSetStatus = 0; r->presentStatus = 0; r->records = 0; +#ifdef Z_95 + r->additionalSearchInfo = 0; + r->otherInfo = 0; +#endif return r; } @@ -122,8 +139,20 @@ Z_PresentRequest *zget_PresentRequest(ODR o) *r->resultSetStartPoint = 1; r->numberOfRecordsRequested = odr_malloc(o, sizeof(int)); *r->numberOfRecordsRequested = 10; +#ifdef Z_95 + r->num_ranges = 0; + r->additionalRanges = 0; + r->recordComposition = 0; +#else r->elementSetNames = 0; +#endif r->preferredRecordSyntax = 0; +#ifdef Z_95 + r->maxSegmentCount = 0; + r->maxRecordSize = 0; + r->maxSegmentSize = 0; + r->otherInfo = 0; +#endif return r; } @@ -139,6 +168,9 @@ Z_PresentResponse *zget_PresentResponse(ODR o) r->presentStatus = odr_malloc(o, sizeof(int)); *r->presentStatus = Z_PRES_SUCCESS; r->records = 0; +#ifdef Z_95 + r->otherInfo = 0; +#endif return r; } @@ -151,6 +183,9 @@ Z_DeleteResultSetRequest *zget_DeleteResultSetRequest(ODR o) *r->deleteFunction = Z_DeleteRequest_list; r->num_ids = 0; r->resultSetList = 0; +#ifdef Z_95 + r->otherInfo = 0; +#endif return r; } @@ -167,6 +202,9 @@ Z_DeleteResultSetResponse *zget_DeleteResultSetResponse(ODR o) r->num_bulkStatuses = 0; r->bulkStatuses = 0; r->deleteMessage = 0; +#ifdef Z_95 + r->otherInfo = 0; +#endif return r; } @@ -183,6 +221,9 @@ Z_ScanRequest *zget_ScanRequest(ODR o) r->numberOfTermsRequested = odr_malloc(o, sizeof(int)); *r->numberOfTermsRequested = 20; r->preferredPositionInResponse = 0; +#ifdef Z_95 + r->otherInfo = 0; +#endif return r; } @@ -199,6 +240,9 @@ Z_ScanResponse *zget_ScanResponse(ODR o) r->positionOfTerm =0; r->entries = 0; r->attributeSet = 0; +#ifdef Z_95 + r->otherInfo = 0; +#endif return r; } @@ -211,6 +255,9 @@ Z_TriggerResourceControlRequest *zget_TriggerResourceControlRequest(ODR o) *r->requestedAction = Z_TriggerResourceCtrl_resourceReport; r->prefResourceReportFormat = 0; r->resultSetWanted = 0; +#ifdef Z_95 + r->otherInfo = 0; +#endif return r; } @@ -225,6 +272,9 @@ Z_ResourceControlRequest *zget_ResourceControlRequest(ODR o) r->responseRequired = odr_malloc(o, sizeof(bool_t)); *r->responseRequired = 0; r->triggeredRequestFlag = 0; +#ifdef Z_95 + r->otherInfo = 0; +#endif return r; } @@ -236,6 +286,9 @@ Z_ResourceControlResponse *zget_ResourceControlResponse(ODR o) r->continueFlag = odr_malloc(o, sizeof(bool_t)); *r->continueFlag = 1; r->resultSetWanted = 0; +#ifdef Z_95 + r->otherInfo = 0; +#endif return r; } @@ -246,6 +299,9 @@ Z_AccessControlRequest *zget_AccessControlRequest(ODR o) r->referenceId = 0; r->which = Z_AccessRequest_simpleForm; r->u.simpleForm = 0; +#ifdef Z_95 + r->otherInfo = 0; +#endif return r; } @@ -257,6 +313,22 @@ Z_AccessControlResponse *zget_AccessControlResponse(ODR o) r->which = Z_AccessResponse_simpleForm; r->u.simpleForm = 0; r->diagnostic = 0; +#ifdef Z_95 + r->otherInfo = 0; +#endif + return r; +} + +Z_Segment *zget_Segment(ODR o) +{ + Z_Segment *r = odr_malloc(o, sizeof(*r)); + + r->referenceId = 0; + r->numberOfRecordsReturned = odr_malloc(o, sizeof(int)); + *r->numberOfRecordsReturned = 0; + r->num_segmentRecords = 0; + r->segmentRecords = 0; + r->otherInfo = 0; return r; } @@ -270,6 +342,9 @@ Z_Close *zget_Close(ODR o) r->diagnosticInformation = 0; r->resourceReportFormat = 0; r->resourceReport = 0; +#ifdef Z_95 + r->otherInfo = 0; +#endif return r; } @@ -309,6 +384,9 @@ Z_APDU *zget_APDU(ODR o, enum Z_APDU_which which) case Z_APDU_resourceControlResponse: r->u.resourceControlResponse = zget_ResourceControlResponse(o); break; + case Z_APDU_segmentRequest: + r->u.segmentRequest = zget_Segment(o); + break; case Z_APDU_close: r->u.close = zget_Close(o); break; diff --git a/client/client.c b/client/client.c index 199af39..1cd8151 100644 --- a/client/client.c +++ b/client/client.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: client.c,v $ - * Revision 1.11 1995-06-14 15:26:40 quinn + * Revision 1.12 1995-06-15 07:44:57 quinn + * Moving to v3. + * + * Revision 1.11 1995/06/14 15:26:40 quinn * *** empty log message *** * * Revision 1.10 1995/06/06 14:56:58 quinn @@ -296,13 +299,27 @@ void display_record(Z_DatabaseRecord *p) static void display_diagrec(Z_DiagRec *p) { oident *ent; +#ifdef Z_95 + Z_DefaultDiagFormat *r; +#else + Z_DiagRec *r = p; +#endif printf("Diagnostic message from database.\n"); - if (!(ent = oid_getentbyoid(p->diagnosticSetId)) || +#ifdef Z_95 + if (p->which != Z_DiagRec_defaultFormat) + { + printf("Diagnostic record not in default format.\n"); + return; + } + else + r = p->u.defaultFormat; +#endif + if (!(ent = oid_getentbyoid(r->diagnosticSetId)) || ent->class != CLASS_DIAGSET || ent->value != VAL_BIB1) printf("Missing or unknown diagset\n"); - printf("Error condition: %d", *p->condition); - printf(" -- %s\n", p->addinfo ? p->addinfo : ""); + printf("Error condition: %d", *r->condition); + printf(" -- %s\n", r->addinfo ? r->addinfo : ""); } static void display_nameplusrecord(Z_NamePlusRecord *p) @@ -646,11 +663,11 @@ int cmd_scan(char *arg) } if (*arg) { - if (send_scanrequest(arg, 5, 19) < 0) + if (send_scanrequest(arg, 5, 20) < 0) return 0; } else - if (send_scanrequest(last_scan, 1, 19) < 0) + if (send_scanrequest(last_scan, 1, 20) < 0) return 0; return 2; } diff --git a/include/proto.h b/include/proto.h index a34002b..3d05a57 100644 --- a/include/proto.h +++ b/include/proto.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: proto.h,v $ - * Revision 1.15 1995-06-14 15:26:43 quinn + * Revision 1.16 1995-06-15 07:45:06 quinn + * Moving to v3. + * + * Revision 1.15 1995/06/14 15:26:43 quinn * *** empty log message *** * * Revision 1.14 1995/06/07 14:42:34 quinn @@ -119,7 +122,7 @@ * apps have been updated, we'll remove the #ifdefs. */ -#define Z_V3 +#define Z_95 /* ----------------- GLOBAL AUXILIARY DEFS ----------------*/ @@ -331,14 +334,12 @@ typedef struct Z_AttributeElement { int *numeric; Z_ComplexAttribute *complex; - } u; + } value; #else int *attributeValue; #endif } Z_AttributeElement; -#ifdef Z_V3 - typedef struct Z_Term { enum @@ -365,17 +366,11 @@ typedef struct Z_Term } u; } Z_Term; -#endif - typedef struct Z_AttributesPlusTerm { int num_attributes; Z_AttributeElement **attributeList; -#ifdef Z_V3 Z_Term *term; -#else - Odr_oct *term; -#endif } Z_AttributesPlusTerm; typedef struct Z_ResultSetPlusAttributes @@ -730,6 +725,9 @@ typedef struct Z_TriggerResourceControlRequest #define Z_TriggerResourceCtrl_cancel 3 Odr_oid *prefResourceReportFormat; /* OPTIONAL */ bool_t *resultSetWanted; /* OPTIONAL */ +#ifdef Z_95 + Z_OtherInformation *otherInfo; +#endif } Z_TriggerResourceControlRequest; typedef struct Z_ResourceControlRequest @@ -743,6 +741,9 @@ typedef struct Z_ResourceControlRequest #define Z_ResourceControlRequest_none 3 bool_t *responseRequired; bool_t *triggeredRequestFlag; /* OPTIONAL */ +#ifdef Z_95 + Z_OtherInformation *otherInfo; +#endif } Z_ResourceControlRequest; typedef struct Z_ResourceControlResponse @@ -750,6 +751,9 @@ typedef struct Z_ResourceControlResponse Z_ReferenceId *referenceId; /* OPTIONAL */ bool_t *continueFlag; bool_t *resultSetWanted; /* OPTIONAL */ +#ifdef Z_95 + Z_OtherInformation *otherInfo; +#endif } Z_ResourceControlResponse; @@ -768,7 +772,7 @@ typedef struct Z_AccessControlRequest Odr_oct *simpleForm; Odr_external *externallyDefined; } u; -#ifdef Z_OTHERINFO +#ifdef Z_95 Z_OtherInformation *otherInfo; /* OPTIONAL */ #endif } Z_AccessControlRequest; @@ -787,7 +791,7 @@ typedef struct Z_AccessControlResponse Odr_external *externallyDefined; } u; Z_DiagRec *diagnostic; /* OPTIONAL */ -#ifdef Z_OTHERINFO +#ifdef Z_95 Z_OtherInformation *otherInfo; /* OPTIONAL */ #endif } Z_AccessControlResponse; @@ -884,6 +888,9 @@ typedef struct Z_ScanRequest int *stepSize; /* OPTIONAL */ int *numberOfTermsRequested; int *preferredPositionInResponse; /* OPTIONAL */ +#ifdef Z_95 + Z_OtherInformation *otherInfo; +#endif } Z_ScanRequest; typedef struct Z_ScanResponse @@ -902,6 +909,9 @@ typedef struct Z_ScanResponse int *positionOfTerm; /* OPTIONAL */ Z_ListEntries *entries; /* OPTIONAL */ Odr_oid *attributeSet; /* OPTIONAL */ +#ifdef Z_95 + Z_OtherInformation *otherInfo; +#endif } Z_ScanResponse; @@ -933,7 +943,7 @@ typedef struct Z_DeleteResultSetRequest #define Z_DeleteRequest_all 1 int num_ids; Z_ResultSetId **resultSetList; /* OPTIONAL */ -#ifdef Z_OTHERINFO +#ifdef Z_95 Z_OtherInformation *otherInfo; #endif } Z_DeleteResultSetRequest; @@ -948,7 +958,7 @@ typedef struct Z_DeleteResultSetResponse int num_bulkStatuses; Z_ListStatus *bulkStatuses; /* OPTIONAL */ char *deleteMessage; /* OPTIONAL */ -#ifdef Z_OTHERINFO +#ifdef Z_95 Z_OtherInformation *otherInfo; #endif } Z_DeleteResultSetResponse; @@ -972,7 +982,7 @@ typedef struct Z_Close char *diagnosticInformation; /* OPTIONAL */ Odr_oid *resourceReportFormat; /* OPTIONAL */ Odr_external *resourceReport; /* OPTIONAL */ -#ifdef Z_OTHERINFO +#ifdef Z_95 Z_OtherInformation *otherInfo; /* OPTIONAL */ #endif } Z_Close; @@ -981,9 +991,10 @@ typedef struct Z_Close typedef struct Z_Segment { - Z_ReferenceId *referenceid; /* OPTIONAL */ + Z_ReferenceId *referenceId; /* OPTIONAL */ int *numberOfRecordsReturned; - Z_NamePlusRecord *segmentRecords; + int num_segmentRecords; + Z_NamePlusRecord **segmentRecords; Z_OtherInformation *otherInfo; /* OPTIONAL */ } Z_Segment; diff --git a/include/statserv.h b/include/statserv.h index 88a0a2d..8173bf0 100644 --- a/include/statserv.h +++ b/include/statserv.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: statserv.h,v $ - * Revision 1.3 1995-05-16 08:50:38 quinn + * Revision 1.4 1995-06-15 07:45:08 quinn + * Moving to v3. + * + * Revision 1.3 1995/05/16 08:50:38 quinn * License, documentation, and memory fixes * * @@ -46,6 +49,7 @@ typedef struct statserv_options_block int idle_timeout; /* how many minutes to wait before closing */ int maxrecordsize; /* maximum value for negotiation */ char configname[ODR_MAXNAME+1]; /* given to the backend in bend_init */ + char setuid[ODR_MAXNAME+1]; /* setuid to this user after binding */ } statserv_options_block; int statserv_main(int argc, char **argv); diff --git a/rfc1006/Makefile b/rfc1006/Makefile index 3e679d7..038f698 100644 --- a/rfc1006/Makefile +++ b/rfc1006/Makefile @@ -1,14 +1,14 @@ # Copyright (C) 1994, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.5 1995-05-30 10:25:46 quinn Exp $ +# $Id: Makefile,v 1.6 1995-06-15 07:45:09 quinn Exp $ SHELL=/bin/sh INCLUDE=-I../include -I. -I../../xtimosi/src LIBDIR=../lib LIBINCLUDE=-L$(LIBDIR) CFLAGS= -g -Wall -pedantic -ansi -DEFS=$(INCLUDE) #-DTRACE_TRANSPORT +DEFS=$(INCLUDE) -DTRACE_TRANSPORT LIB=$(LIBDIR)/librfc.a LIBS=-lodr PO = rfct.o makensap.o diff --git a/rfc1006/rfct.c b/rfc1006/rfct.c index c31bce7..4ff8e98 100644 --- a/rfc1006/rfct.c +++ b/rfc1006/rfct.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: rfct.c,v $ - * Revision 1.5 1995-05-31 08:29:35 quinn + * Revision 1.6 1995-06-15 07:45:11 quinn + * Moving to v3. + * + * Revision 1.5 1995/05/31 08:29:35 quinn * Nothing significant. * * Revision 1.4 1995/05/18 13:02:07 quinn @@ -75,11 +78,11 @@ /* * Simple implementation of XTI/TP0/RFC1006/Sockets. - * Note: This is neither complete nor robust. It just has to tick us over - * until mr. Furniss finishes his own implementation. + * Note: There is still some work to do in here, but basically it works. * * TODO: Asynchronous mode needs a lot of little adjustments to various - * return values and error codes, etc. + * return values and error codes, etc. Formally, we should probably hold + * this up against the protocol state tables, and see if it's correct. * * Check if addressing info is returned correctly by all calls. */ @@ -605,7 +608,7 @@ int t_snd(int fd, char *buf, unsigned nbytes, int flags) return nbytes; } -int _t_rcv(int fd, char *buf, unsigned nbytes, int *flags) +int t_rcv(int fd, char *buf, unsigned nbytes, int *flags) { struct rfct_control *cnt = control[fd]; struct tpdu_data_header dhead; @@ -719,6 +722,8 @@ int _t_rcv(int fd, char *buf, unsigned nbytes, int *flags) return got; } +#if 0 + int t_rcv(int fd, char *buf, unsigned nbytes, int *flags) { int res; @@ -736,6 +741,8 @@ int t_rcv(int fd, char *buf, unsigned nbytes, int *flags) return total; } +#endif + int t_close(int fd) { struct rfct_control *cnt = control[fd]; diff --git a/server/seshigh.c b/server/seshigh.c index ddad040..6811402 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: seshigh.c,v $ - * Revision 1.34 1995-06-14 15:26:46 quinn + * Revision 1.35 1995-06-15 07:45:14 quinn + * Moving to v3. + * + * Revision 1.34 1995/06/14 15:26:46 quinn * *** empty log message *** * * Revision 1.33 1995/06/06 14:57:05 quinn @@ -581,8 +584,13 @@ static Z_Records *diagrec(oid_proto proto, int error, char *addinfo) { static Z_Records rec; oident bib1; - static Z_DiagRec dr; static int err; +#ifdef Z_95 + static Z_DiagRec drec; + static Z_DefaultDiagFormat dr; +#else + static Z_DiagRec dr; +#endif bib1.proto = proto; bib1.class = CLASS_DIAGSET; @@ -592,7 +600,13 @@ static Z_Records *diagrec(oid_proto proto, int error, char *addinfo) "NULL"); err = error; rec.which = Z_Records_NSD; +#ifdef Z_95 + rec.u.nonSurrogateDiagnostic = &drec; + drec.which = Z_DiagRec_defaultFormat; + drec.u.defaultFormat = &dr; +#else rec.u.nonSurrogateDiagnostic = &dr; +#endif dr.diagnosticSetId = oid_getoidbyent(&bib1); dr.condition = &err; dr.addinfo = addinfo ? addinfo : ""; @@ -606,9 +620,14 @@ static Z_NamePlusRecord *surrogatediagrec(oid_proto proto, char *dbname, int error, char *addinfo) { static Z_NamePlusRecord rec; - static Z_DiagRec dr; static int err; oident bib1; +#ifdef Z_95 + static Z_DiagRec drec; + static Z_DefaultDiagFormat dr; +#else + static Z_DiagRec dr; +#endif bib1.proto = proto; bib1.class = CLASS_DIAGSET; @@ -618,7 +637,13 @@ static Z_NamePlusRecord *surrogatediagrec(oid_proto proto, char *dbname, err = error; rec.databaseName = dbname; rec.which = Z_NamePlusRecord_surrogateDiagnostic; +#ifdef Z_95 + rec.u.surrogateDiagnostic = &drec; + drec.which = Z_DiagRec_defaultFormat; + drec.u.defaultFormat = &dr; +#else rec.u.surrogateDiagnostic = &dr; +#endif dr.diagnosticSetId = oid_getoidbyent(&bib1); dr.condition = &err; dr.addinfo = addinfo ? addinfo : ""; @@ -631,9 +656,14 @@ static Z_NamePlusRecord *surrogatediagrec(oid_proto proto, char *dbname, static Z_DiagRecs *diagrecs(oid_proto proto, int error, char *addinfo) { static Z_DiagRecs recs; - static Z_DiagRec *recp[1], rec; static int err; oident bib1; +#ifdef Z_95 + static Z_DiagRec *recp[1], drec; + static Z_DefaultDiagFormat rec; +#else + static Z_DiagRec *recp[1], rec; +#endif logf(LOG_DEBUG, "DiagRecs: %d -- %s", error, addinfo); bib1.proto = proto; @@ -643,7 +673,13 @@ static Z_DiagRecs *diagrecs(oid_proto proto, int error, char *addinfo) err = error; recs.num_diagRecs = 1; recs.diagRecs = recp; +#ifdef Z_95 + recp[0] = &drec; + drec.which = Z_DiagRec_defaultFormat; + drec.u.defaultFormat = &rec; +#else recp[0] = &rec; +#endif rec.diagnosticSetId = oid_getoidbyent(&bib1); rec.condition = &err; rec.addinfo = addinfo ? addinfo : ""; @@ -815,6 +851,10 @@ static Z_APDU *response_searchRequest(association *assoc, request *reqb, apdu.which = Z_APDU_searchResponse; apdu.u.searchResponse = &resp; resp.referenceId = req->referenceId; +#ifdef Z_95 + resp.additionalSearchInfo = 0; + resp.otherInfo = 0; +#endif *fd = -1; if (!bsrt && !(bsrt = bend_searchresponse(assoc->backend))) { @@ -908,10 +948,13 @@ static Z_APDU *process_presentRequest(association *assoc, request *reqb, apdu.which = Z_APDU_presentResponse; apdu.u.presentResponse = &resp; resp.referenceId = req->referenceId; +#ifdef Z_95 + resp.otherInfo = 0; +#endif num = *req->numberOfRecordsRequested; resp.records = pack_records(assoc, req->resultSetId, - *req->resultSetStartPoint, &num, req->elementSetNames, &next, &presst); + *req->resultSetStartPoint, &num, 0, &next, &presst); if (!resp.records) return 0; resp.numberOfRecordsReturned = # @@ -950,6 +993,9 @@ static Z_APDU *process_scanRequest(association *assoc, request *reqb, int *fd) res.entries = &ents; ents.which = Z_ListEntries_nonSurrogateDiagnostics; res.attributeSet = 0; +#ifdef Z_95 + res.otherInfo = 0; +#endif if (req->attributeSet && (!(attent = oid_getentbyoid(req->attributeSet)) || attent->class != CLASS_ATTSET || attent->value != VAL_BIB1)) diff --git a/server/statserv.c b/server/statserv.c index c556df9..5ac15e9 100644 --- a/server/statserv.c +++ b/server/statserv.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: statserv.c,v $ - * Revision 1.21 1995-06-06 08:15:40 quinn + * Revision 1.22 1995-06-15 07:45:17 quinn + * Moving to v3. + * + * Revision 1.21 1995/06/06 08:15:40 quinn * Cosmetic. * * Revision 1.20 1995/05/29 08:12:09 quinn @@ -82,6 +85,8 @@ #include #include #include +#include +#include #include #include @@ -109,7 +114,8 @@ static statserv_options_block control_block = { PROTO_Z3950, /* application protocol */ 60, /* idle timeout (minutes) */ 1024*1024*4, /* maximum PDU size (approx.) to allow */ - "default-config" /* configuration name to pass to backend */ + "default-config", /* configuration name to pass to backend */ + "" /* set user id */ }; #define DEFAULT_LISTENER "tcp:localhost:9999" @@ -328,7 +334,7 @@ int statserv_main(int argc, char **argv) int protocol = control_block.default_proto; me = argv[0]; - while ((ret = options("a:szSl:v:", argv, argc, &arg)) != -2) + while ((ret = options("a:szSl:v:u:", argv, argc, &arg)) != -2) { switch (ret) { @@ -349,8 +355,10 @@ int statserv_main(int argc, char **argv) break; case 'a': strcpy(control_block.apdufile, arg ? arg : ""); break; + case 'u': + strcpy(control_block.setuid, arg ? arg : ""); break; default: - fprintf(stderr, "Usage: %s [ -a -v -l -zsS ... ]\n", me); + fprintf(stderr, "Usage: %s [ -a -v -l -u -zsS ... ]\n", me); exit(1); } } @@ -358,6 +366,21 @@ int statserv_main(int argc, char **argv) signal(SIGCHLD, catchchld); if (!listeners && *control_block.default_listen) add_listener(control_block.default_listen, protocol); + if (*control_block.setuid) + { + struct passwd *pw; + + if (!(pw = getpwnam(control_block.setuid))) + { + logf(LOG_FATAL|LOG_ERRNO, "%s", control_block.setuid); + exit(1); + } + if (setuid(pw->pw_uid) < 0) + { + logf(LOG_FATAL|LOG_ERRNO, "setuid"); + exit(1); + } + } logf(LOG_LOG, "Entering event loop."); return event_loop(); diff --git a/util/pquery.c b/util/pquery.c index f2b0d4f..c5fe651 100644 --- a/util/pquery.c +++ b/util/pquery.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: pquery.c,v $ - * Revision 1.3 1995-06-14 11:06:35 adam + * Revision 1.4 1995-06-15 07:45:19 quinn + * Moving to v3. + * + * Revision 1.3 1995/06/14 11:06:35 adam * Bug fix: Attributes wasn't interpreted correctly! * * Revision 1.2 1995/05/26 08:56:11 adam @@ -115,7 +118,12 @@ static Z_AttributesPlusTerm *rpn_term (ODR o, int num_attr, int *attr_list) zapt->attributeList[i] = odr_malloc (o,sizeof(**zapt->attributeList)); zapt->attributeList[i]->attributeType = &attr_tmp[2*i]; +#ifdef Z_95 + zapt->attributeList[i]->which = Z_AttributeValue_numeric; + zapt->attributeList[i]->value = &attr_tmp[2*i+1]; +#else zapt->attributeList[i]->attributeValue = &attr_tmp[2*i+1]; +#endif } } else diff --git a/util/yaz-ccl.c b/util/yaz-ccl.c index bfb375a..a801874 100644 --- a/util/yaz-ccl.c +++ b/util/yaz-ccl.c @@ -38,8 +38,14 @@ static Z_AttributesPlusTerm *ccl_rpn_term (struct ccl_rpn_node *p) assert (zapt->attributeList[i]); zapt->attributeList[i]->attributeType = &attr->type; +#ifdef Z_95 + zapt->attributeList[i]->attributeSet = 0; + zapt->attributeList[i]->which = Z_AttributeValue_numeric; + zapt->attributeList[i]->value.numeric = &attr->value; +#else zapt->attributeList[i]->attributeValue = &attr->value; +#endif } } else