From: Sebastian Hammer Date: Fri, 16 Jun 1995 13:15:56 +0000 (+0000) Subject: Fixed Defaultdiagformat. X-Git-Tag: YAZ.1.8~967 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=1110373102ed65ffcaa5384aa0514516b162c543 Fixed Defaultdiagformat. --- diff --git a/asn/proto.c b/asn/proto.c index a69d49b..2cd5d94 100644 --- a/asn/proto.c +++ b/asn/proto.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: proto.c,v $ - * Revision 1.30 1995-06-15 15:42:01 quinn + * Revision 1.31 1995-06-16 13:15:56 quinn + * Fixed Defaultdiagformat. + * + * Revision 1.30 1995/06/15 15:42:01 quinn * Fixed some v3 bugs * * Revision 1.29 1995/06/15 07:44:49 quinn @@ -125,6 +128,11 @@ int z_UserInformationField(ODR o, Odr_external **p, int opt) 11, opt); } +int z_InternationalString(ODR o, char **p, int opt) +{ + return odr_generalstring(o, p, opt); +} + int z_InfoCategory(ODR o, Z_InfoCategory **p, int opt) { if (!odr_sequence_begin(o, p, sizeof(**p))) @@ -724,6 +732,14 @@ int z_DatabaseRecord(ODR o, Z_DatabaseRecord **p, int opt) int z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt) { + static Odr_arm arm[] = + { + {-1, -1, -1, Z_DiagForm_v2AddInfo, odr_visiblestring}, + {-1, -1, -1, Z_DiagForm_v3AddInfo, z_InternationalString}, + {ODR_IMPLICIT, ODR_CONTEXT, ODR_VISIBLESTRING, Z_DiagForm_v2AddInfo, + odr_visiblestring}, /* to match some weird server.. */ + {-1, -1, -1, -1, 0} + }; if (!odr_sequence_begin(o, p, sizeof(**p))) return opt && odr_ok(o); return @@ -735,9 +751,7 @@ int z_DefaultDiagFormat(ODR o, Z_DefaultDiagFormat **p, int opt) * 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_choice(o, arm, &(*p)->addinfo, &(*p)->which) && odr_sequence_end(o); } diff --git a/include/odr.h b/include/odr.h index 065323b..a1787fb 100644 --- a/include/odr.h +++ b/include/odr.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: odr.h,v $ - * Revision 1.7 1995-05-29 08:11:32 quinn + * Revision 1.8 1995-06-16 13:16:04 quinn + * Fixed Defaultdiagformat. + * + * Revision 1.7 1995/05/29 08:11:32 quinn * Moved oid from odr/asn to util. * * Revision 1.6 1995/05/22 14:47:00 quinn @@ -137,6 +140,7 @@ #define ODR_PRINTABLESTRING 19 #define ODR_GRAPHICSTRING 25 #define ODR_VISIBLESTRING 26 +#define ODR_GENERALSTRING 27 /* * odr stream directions diff --git a/include/proto.h b/include/proto.h index 95e2277..62fdd31 100644 --- a/include/proto.h +++ b/include/proto.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: proto.h,v $ - * Revision 1.17 1995-06-15 15:42:05 quinn + * Revision 1.18 1995-06-16 13:16:05 quinn + * Fixed Defaultdiagformat. + * + * Revision 1.17 1995/06/15 15:42:05 quinn * Fixed some v3 bugs * * Revision 1.16 1995/06/15 07:45:06 quinn @@ -524,6 +527,13 @@ typedef struct Z_DefaultDiagFormat { Odr_oid *diagnosticSetId; /* This is opt'l to interwork with bad targets */ int *condition; + /* until the whole character set issue becomes more definite, + * you can probably ignore this on input. */ + enum + { + Z_DiagForm_v2AddInfo, + Z_DiagForm_v3AddInfo + } which; char *addinfo; } Z_DefaultDiagFormat; diff --git a/include/prt.h b/include/prt.h index 8fb09e9..a47a9d9 100644 --- a/include/prt.h +++ b/include/prt.h @@ -25,7 +25,7 @@ int odp_more_chunks(ODR o, unsigned char *base, int len); int odr_constructed_more(ODR o); int odr_bitstring(ODR o, Odr_bitmask **p, int opt); int ber_bitstring(ODR o, Odr_bitmask *p, int cons); -int odr_visiblestring(ODR o, char **p, int opt); +int odr_generalstring(ODR o, char **p, int opt); int ber_oidc(ODR o, Odr_oid *p); int odr_oid(ODR o, Odr_oid **p, int opt); int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp); diff --git a/odr/odr_use.c b/odr/odr_use.c index 7fca63b..9af8acf 100644 --- a/odr/odr_use.c +++ b/odr/odr_use.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: odr_use.c,v $ - * Revision 1.3 1995-05-16 08:51:00 quinn + * Revision 1.4 1995-06-16 13:16:12 quinn + * Fixed Defaultdiagformat. + * + * Revision 1.3 1995/05/16 08:51:00 quinn * License, documentation, and memory fixes * * Revision 1.2 1995/02/09 15:51:50 quinn @@ -47,6 +50,16 @@ int odr_visiblestring(ODR o, char **p, int opt) opt); } +/* + * a char may not be sufficient to hold a general string, but we'll deal + * with that once we start looking more closely at UniCode & co. + */ +int odr_generalstring(ODR o, char **p, int opt) +{ + return odr_implicit(o, odr_cstring, p, ODR_UNIVERSAL, ODR_GENERALSTRING, + opt); +} + int odr_graphicstring(ODR o, char **p, int opt) { return odr_implicit(o, odr_cstring, p, ODR_UNIVERSAL, ODR_GRAPHICSTRING, diff --git a/server/seshigh.c b/server/seshigh.c index be46c57..c1d5350 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: seshigh.c,v $ - * Revision 1.36 1995-06-16 10:31:36 quinn + * Revision 1.37 1995-06-16 13:16:14 quinn + * Fixed Defaultdiagformat. + * + * Revision 1.36 1995/06/16 10:31:36 quinn * Added session timeout. * * Revision 1.35 1995/06/15 07:45:14 quinn @@ -620,6 +623,7 @@ static Z_Records *diagrec(oid_proto proto, int error, char *addinfo) #endif dr.diagnosticSetId = oid_getoidbyent(&bib1); dr.condition = &err; + dr.which = Z_DiagForm_v2AddInfo; dr.addinfo = addinfo ? addinfo : ""; return &rec; } @@ -657,6 +661,7 @@ static Z_NamePlusRecord *surrogatediagrec(oid_proto proto, char *dbname, #endif dr.diagnosticSetId = oid_getoidbyent(&bib1); dr.condition = &err; + dr.which = Z_DiagForm_v2AddInfo; dr.addinfo = addinfo ? addinfo : ""; return &rec; } @@ -693,6 +698,7 @@ static Z_DiagRecs *diagrecs(oid_proto proto, int error, char *addinfo) #endif rec.diagnosticSetId = oid_getoidbyent(&bib1); rec.condition = &err; + rec.which = Z_DiagForm_v2AddInfo; rec.addinfo = addinfo ? addinfo : ""; return &recs; }