X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=asn%2Fproto.c;h=ce6e3043005b8c653dd0c6237f75fb9e464bae8d;hb=33821b1729f0afa0cadcecf57fc67fea7138bdab;hp=1506e5899eb425e373b85cea6999db6d69addbfc;hpb=10981b2f116449523a9f628c20a78212ce91553e;p=yaz-moved-to-github.git diff --git a/asn/proto.c b/asn/proto.c index 1506e58..ce6e304 100644 --- a/asn/proto.c +++ b/asn/proto.c @@ -4,7 +4,28 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: proto.c,v $ - * Revision 1.3 1995-02-09 15:51:39 quinn + * Revision 1.10 1995-03-15 11:17:40 quinn + * Fixed some return-checks from choice.. need better ay to handle those.. + * + * Revision 1.9 1995/03/15 08:37:06 quinn + * Fixed protocol bugs. + * + * Revision 1.8 1995/03/14 16:59:24 quinn + * Fixed OPTIONAL flag in attributeelement + * + * Revision 1.7 1995/03/07 16:29:33 quinn + * Added authentication stuff. + * + * Revision 1.6 1995/03/01 14:46:03 quinn + * Fixed protocol bug in 8777query. + * + * Revision 1.5 1995/02/14 11:54:22 quinn + * Fixing include. + * + * Revision 1.4 1995/02/10 15:54:30 quinn + * Small adjustments. + * + * Revision 1.3 1995/02/09 15:51:39 quinn * Works better now. * * Revision 1.2 1995/02/06 21:26:07 quinn @@ -62,7 +83,7 @@ int z_InitRequest(ODR o, Z_InitRequest **p, int opt) 5, 0) && odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT, 6, 0) && - odr_implicit(o, odr_visiblestring, &pp->idAuthentication, ODR_CONTEXT, + odr_explicit(o, odr_any, &pp->idAuthentication, ODR_CONTEXT, 7, 1) && odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT, 110, 1) && @@ -91,8 +112,6 @@ int z_InitResponse(ODR o, Z_InitResponse **p, int opt) odr_implicit(o, odr_integer, &pp->maximumRecordSize, ODR_CONTEXT, 6, 0) && odr_implicit(o, odr_bool, &pp->result, ODR_CONTEXT, 12, 0) && - odr_implicit(o, odr_visiblestring, &pp->idAuthentication, ODR_CONTEXT, - 7, 1) && odr_implicit(o, odr_visiblestring, &pp->implementationId, ODR_CONTEXT, 110, 1) && odr_implicit(o, odr_visiblestring, &pp->implementationName, ODR_CONTEXT, @@ -103,6 +122,22 @@ int z_InitResponse(ODR o, Z_InitResponse **p, int opt) odr_sequence_end(o); } +int z_NSRAuthentication(ODR o, Z_NSRAuthentication **p, int opt) +{ + if (!odr_sequence_begin(o, p, sizeof(**p))) + return opt; + return + odr_visiblestring(o, &(*p)->user, 0) && + odr_visiblestring(o, &(*p)->password, 0) && + odr_visiblestring(o, &(*p)->account, 0) && + odr_sequence_end(o); +} + +int z_StrAuthentication(ODR o, char **p, int opt) +{ + return odr_visiblestring(o, p, opt); +} + /* ------------------------ SEARCH SERVICE ----------------------- */ int z_ElementSetName(ODR o, char **p, int opt) @@ -173,9 +208,9 @@ int z_AttributeElement(ODR o, Z_AttributeElement **p, int opt) return opt; return odr_implicit(o, odr_integer, &(*p)->attributeType, ODR_CONTEXT, - 120, 1) && + 120, 0) && odr_implicit(o, odr_integer, &(*p)->attributeValue, ODR_CONTEXT, - 121, 1) && + 121, 0) && odr_sequence_end(o); } @@ -216,7 +251,7 @@ int z_Operator(ODR o, Z_Operator **p, int opt) odr_constructed_end(o)) return 1; *p = 0; - return opt; + return opt && !o->error; } int z_Operand(ODR o, Z_Operand **p, int opt) @@ -235,7 +270,7 @@ int z_Operand(ODR o, Z_Operand **p, int opt) if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) return 1; *p = 0; - return opt; + return opt && !o->error; } int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt); @@ -267,7 +302,7 @@ int z_RPNStructure(ODR o, Z_RPNStructure **p, int opt) if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) return 1; *p = 0; - return opt; + return opt && !o->error; } int z_RPNQuery(ODR o, Z_RPNQuery **p, int opt) @@ -287,7 +322,7 @@ int z_Query(ODR o, Z_Query **p, int opt) static Odr_arm arm[] = { {ODR_IMPLICIT, ODR_CONTEXT, 1, Z_Query_type_1, z_RPNQuery}, - {ODR_IMPLICIT, ODR_CONTEXT, 2, Z_Query_type_2, odr_octetstring}, + {ODR_EXPLICIT, ODR_CONTEXT, 2, Z_Query_type_2, odr_octetstring}, {-1, -1, -1, -1, 0} }; @@ -298,7 +333,7 @@ int z_Query(ODR o, Z_Query **p, int opt) if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) return 1; *p = 0; - return opt; + return opt && !o->error; } int z_SearchRequest(ODR o, Z_SearchRequest **p, int opt) @@ -376,7 +411,7 @@ int z_NamePlusRecordList(ODR o, Z_NamePlusRecordList **p, int opt) { if (o->direction == ODR_DECODE) *p = nalloc(o, sizeof(**p)); - if (odr_sequence_of(o, z_NamePlusRecordList, &(*p)->records, + if (odr_sequence_of(o, z_NamePlusRecord, &(*p)->records, &(*p)->num_records)) return 1; *p = 0; @@ -399,7 +434,7 @@ int z_Records(ODR o, Z_Records **p, int opt) if (odr_choice(o, arm, &(*p)->u, &(*p)->which)) return 1; *p = 0; - return opt; + return opt && !o->error; } /* ------------------------ SEARCHRESPONSE ----------------*/ @@ -496,10 +531,8 @@ int z_APDU(ODR o, Z_APDU **p, int opt) if (!odr_choice(o, arm, &(*p)->u, &(*p)->which)) { if (o->direction == ODR_DECODE) - { *p = 0; - return opt; - } + return opt && !o->error; } return 1; }