📄 authoritykeyidentifier.c
字号:
case MAKE_TAG_ID (UNIV, CONS, BMPSTRING_TAG_CODE): (k->choiceId) = DIRECTORYSTRING_BMPSTRING; rc = BDecComponentBMPString (mem_op, b, tagId0, elmtLen0, (&k->a.bmpString), &totalElmtsLen1, DEC_ALLOC_MODE_0 ); if ( rc != LDAP_SUCCESS ) return rc; (k->a.bmpString)->identifier.bv_val = (k->a.bmpString)->id_buf; (k->a.bmpString)->identifier.bv_len = strlen("bmpString"); strcpy( (k->a.bmpString)->identifier.bv_val, "bmpString"); break; default: Asn1Error ("ERROR - unexpected tag in CHOICE\n"); return -1; break; } /* end switch */ if( !(old_mode & DEC_ALLOC_MODE_1) ) { *v = t = (ComponentDirectoryString*) CompAlloc( mem_op, sizeof(ComponentDirectoryString) ); if ( !t ) return -1; *t = *k; } t->syntax = (Syntax*)NULL; t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) ); if ( !t->comp_desc ) { free ( t ); return -1; } t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentDirectoryString ; t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentDirectoryString ; t->comp_desc->cd_free = (comp_free_func*)NULL; t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentDirectoryString; t->comp_desc->cd_type = ASN_COMPOSITE; t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE; t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentDirectoryString; (*bytesDecoded) += totalElmtsLen1; return LDAP_SUCCESS;} /* BDecDirectoryStringContent */intGDecComponentDirectoryString PARAMS (( mem_op,b, v, bytesDecoded, mode),void* mem_op _AND_GenBuf * b _AND_ComponentDirectoryString **v _AND_AsnLen *bytesDecoded _AND_int mode){ char* peek_head,*peek_head2; int i, strLen,strLen2, rc, old_mode = mode; ComponentDirectoryString *k,*t, c_temp; if ( !(mode & DEC_ALLOC_MODE_1) ) { memset(&c_temp,0,sizeof(c_temp)); k = &c_temp; } else k = t = *v; mode = DEC_ALLOC_MODE_2; if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading identifier"); return LDAP_PROTOCOL_ERROR; } if( !(strLen2 = LocateNextGSERToken(mem_op,b,&peek_head2,GSER_NO_COPY)) ){ Asn1Error("Error during Reading identifier"); return LDAP_PROTOCOL_ERROR; } if(*peek_head2 != ':'){ Asn1Error("Missing : in encoded data"); return LDAP_PROTOCOL_ERROR; } if( strncmp("teletexString",peek_head, strlen("teletexString")) == 0){ (k->choiceId) = DIRECTORYSTRING_TELETEXSTRING; rc = GDecComponentTeletexString (mem_op, b, (&k->a.teletexString), bytesDecoded, DEC_ALLOC_MODE_0 ); if ( rc != LDAP_SUCCESS ) return rc; (k->a.teletexString)->identifier.bv_val = peek_head; (k->a.teletexString)->identifier.bv_len = strLen; } else if( strncmp("printableString",peek_head,strlen("printableString")) == 0){ (k->choiceId) = DIRECTORYSTRING_PRINTABLESTRING; rc = GDecComponentPrintableString (mem_op, b, (&k->a.printableString), bytesDecoded, DEC_ALLOC_MODE_0 ); if ( rc != LDAP_SUCCESS ) return rc; (k->a.printableString)->identifier.bv_val = peek_head; (k->a.printableString)->identifier.bv_len = strLen; } else if( strncmp("universalString",peek_head,strlen("universalString")) == 0){ (k->choiceId) = DIRECTORYSTRING_UNIVERSALSTRING; rc = GDecComponentUniversalString (mem_op, b, (&k->a.universalString), bytesDecoded, DEC_ALLOC_MODE_0 ); if ( rc != LDAP_SUCCESS ) return rc; (k->a.universalString)->identifier.bv_val = peek_head; (k->a.universalString)->identifier.bv_len = strLen; } else if( strncmp("utf8String",peek_head,strlen("utf8String")) == 0){ (k->choiceId) = DIRECTORYSTRING_UTF8STRING; rc = GDecComponentUTF8String (mem_op, b, (&k->a.utf8String), bytesDecoded, DEC_ALLOC_MODE_0 ); if ( rc != LDAP_SUCCESS ) return rc; (k->a.utf8String)->identifier.bv_val = peek_head; (k->a.utf8String)->identifier.bv_len = strLen; } else if( strncmp("bmpString",peek_head,strlen("bmpString")) == 0){ (k->choiceId) = DIRECTORYSTRING_BMPSTRING; rc = GDecComponentBMPString (mem_op, b, (&k->a.bmpString), bytesDecoded, DEC_ALLOC_MODE_0 ); if ( rc != LDAP_SUCCESS ) return rc; (k->a.bmpString)->identifier.bv_val = peek_head; (k->a.bmpString)->identifier.bv_len = strLen; } else { Asn1Error("Undefined Identifier"); return LDAP_PROTOCOL_ERROR; } if( !(old_mode & DEC_ALLOC_MODE_1) ) { *v = t = (ComponentDirectoryString*) CompAlloc( mem_op, sizeof(ComponentDirectoryString) ); if ( !t ) return -1; *t = *k; } t->syntax = (Syntax*)NULL; t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) ); if ( !t->comp_desc ) { free ( t ); return -1; } t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentDirectoryString ; t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentDirectoryString ; t->comp_desc->cd_free = (comp_free_func*)NULL; t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentDirectoryString; t->comp_desc->cd_type = ASN_COMPOSITE; t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE; t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentDirectoryString; return LDAP_SUCCESS;} /* GDecDirectoryStringContent */intMatchingComponentEDIPartyName ( char* oid, ComponentSyntaxInfo* csi_attr, ComponentSyntaxInfo* csi_assert ) { int rc; MatchingRule* mr; if ( oid ) { mr = retrieve_matching_rule( oid, csi_attr->csi_comp_desc->cd_type_id); if ( mr ) return component_value_match( mr, csi_attr, csi_assert ); } rc = 1; if(COMPONENTNOT_NULL( ((ComponentEDIPartyName*)csi_attr)->nameAssigner ) ) { rc = MatchingComponentDirectoryString ( oid, (ComponentSyntaxInfo*)((ComponentEDIPartyName*)csi_attr)->nameAssigner, (ComponentSyntaxInfo*)((ComponentEDIPartyName*)csi_assert)->nameAssigner ); if ( rc != LDAP_COMPARE_TRUE ) return rc; } rc = MatchingComponentDirectoryString ( oid, (ComponentSyntaxInfo*)((ComponentEDIPartyName*)csi_attr)->partyName, (ComponentSyntaxInfo*)((ComponentEDIPartyName*)csi_assert)->partyName ); if ( rc != LDAP_COMPARE_TRUE ) return rc; return LDAP_COMPARE_TRUE;} /* BMatchingComponentEDIPartyName */void*ExtractingComponentEDIPartyName ( void* mem_op, ComponentReference* cr, ComponentEDIPartyName *comp ){ if ( ( comp->nameAssigner->identifier.bv_val && strncmp(comp->nameAssigner->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->nameAssigner->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) { if ( cr->cr_curr->ci_next == NULL ) return comp->nameAssigner; else { cr->cr_curr = cr->cr_curr->ci_next; return ExtractingComponentDirectoryString ( mem_op, cr, comp->nameAssigner ); } } if ( ( comp->partyName->identifier.bv_val && strncmp(comp->partyName->identifier.bv_val, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) || ( strncmp(comp->partyName->id_buf, cr->cr_curr->ci_val.ci_identifier.bv_val,cr->cr_curr->ci_val.ci_identifier.bv_len) == 0 ) ) { if ( cr->cr_curr->ci_next == NULL ) return comp->partyName; else { cr->cr_curr = cr->cr_curr->ci_next; return ExtractingComponentDirectoryString ( mem_op, cr, comp->partyName ); } } return NULL;} /* ExtractingComponentEDIPartyName */intBDecComponentEDIPartyName PARAMS ((b, tagId0, elmtLen0, v, bytesDecoded, mode),void* mem_op _AND_GenBuf * b _AND_AsnTag tagId0 _AND_AsnLen elmtLen0 _AND_ComponentEDIPartyName **v _AND_AsnLen *bytesDecoded _AND_int mode){ int seqDone = FALSE; AsnLen totalElmtsLen1 = 0; AsnLen elmtLen1; AsnTag tagId1; int mandatoryElmtCount1 = 0; AsnLen totalElmtsLen2 = 0; AsnLen elmtLen2; AsnTag tagId2; AsnLen totalElmtsLen3 = 0; AsnLen elmtLen3; AsnTag tagId3; int old_mode = mode; int rc; ComponentEDIPartyName *k, *t, c_temp; if ( !(mode & DEC_ALLOC_MODE_1) ) { memset(&c_temp,0,sizeof(c_temp)); k = &c_temp; } else k = t = *v; mode = DEC_ALLOC_MODE_2; tagId1 = BDecTag (b, &totalElmtsLen1 ); if (((tagId1 == MAKE_TAG_ID (CNTX, CONS, 0)))) { elmtLen1 = BDecLen (b, &totalElmtsLen1 ); rc = tagId2 = BDecTag (b, &totalElmtsLen1 ); elmtLen2 = BDecLen (b, &totalElmtsLen1 ); BDecComponentDirectoryString (mem_op, b, tagId2, elmtLen2, (&k->nameAssigner), &totalElmtsLen1, mode); if (elmtLen1 == INDEFINITE_LEN) BDecEoc(b, &totalElmtsLen1 ); if ( rc != LDAP_SUCCESS ) return rc; (k->nameAssigner)->identifier.bv_val = (k->nameAssigner)->id_buf; (k->nameAssigner)->identifier.bv_len = strlen("nameAssigner"); strcpy( (k->nameAssigner)->identifier.bv_val, "nameAssigner"); if (elmtLen1 == INDEFINITE_LEN) BDecEoc (b, &totalElmtsLen1 ); tagId1 = BDecTag (b, &totalElmtsLen1); } if (((tagId1 == MAKE_TAG_ID (CNTX, CONS, 1)))) { elmtLen1 = BDecLen (b, &totalElmtsLen1 ); rc = tagId2 = BDecTag (b, &totalElmtsLen1 ); elmtLen2 = BDecLen (b, &totalElmtsLen1 ); BDecComponentDirectoryString (mem_op, b, tagId2, elmtLen2, (&k->partyName), &totalElmtsLen1, mode); if (elmtLen1 == INDEFINITE_LEN) BDecEoc(b, &totalElmtsLen1 ); if ( rc != LDAP_SUCCESS ) return rc; (k->partyName)->identifier.bv_val = (k->partyName)->id_buf; (k->partyName)->identifier.bv_len = strlen("partyName"); strcpy( (k->partyName)->identifier.bv_val, "partyName"); if (elmtLen1 == INDEFINITE_LEN) BDecEoc (b, &totalElmtsLen1 ); seqDone = TRUE; if (elmtLen0 == INDEFINITE_LEN) BDecEoc (b, &totalElmtsLen1 ); else if (totalElmtsLen1 != elmtLen0) return -1; } else return -1; if (!seqDone) return -1; if( !(old_mode & DEC_ALLOC_MODE_1) ) { *v = t = (ComponentEDIPartyName*) CompAlloc( mem_op, sizeof(ComponentEDIPartyName) ); if ( !t ) return -1; *t = *k; } t->syntax = (Syntax*)NULL; t->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) ); if ( !t->comp_desc ) { free ( t ); return -1; } t->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentEDIPartyName ; t->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentEDIPartyName ; t->comp_desc->cd_free = (comp_free_func*)NULL; t->comp_desc->cd_extract_i = (extract_component_from_id_func*)ExtractingComponentEDIPartyName; t->comp_desc->cd_type = ASN_COMPOSITE; t->comp_desc->cd_type_id = COMPOSITE_ASN1_TYPE; t->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentEDIPartyName; (*bytesDecoded) += totalElmtsLen1; return LDAP_SUCCESS;} /* BDecEDIPartyName*/intGDecComponentEDIPartyName PARAMS (( mem_op,b, v, bytesDecoded, mode),void* mem_op _AND_GenBuf * b _AND_ComponentEDIPartyName **v _AND_AsnLen *bytesDecoded _AND_int mode){ char* peek_head,*peek_head2; int i, strLen,strLen2, rc, old_mode = mode; ComponentEDIPartyName *k,*t, c_temp; if ( !(mode & DEC_ALLOC_MODE_1) ) { memset(&c_temp,0,sizeof(c_temp)); k = &c_temp; } else k = t = *v; mode = DEC_ALLOC_MODE_2; *bytesDecoded = 0; if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading { in encoded data"); return LDAP_PROTOCOL_ERROR; } if(*peek_head != '{'){ Asn1Error("Missing { in encoded data"); return LDAP_PROTOCOL_ERROR; } if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading identifier"); return LDAP_PROTOCOL_ERROR; } if ( strncmp( peek_head, "nameAssigner", strlen("nameAssigner") ) == 0 ) { rc = GDecComponentDirectoryString (mem_op, b, (&k->nameAssigner), bytesDecoded, mode); if ( rc != LDAP_SUCCESS ) return rc; ( k->nameAssigner)->identifier.bv_val = peek_head; ( k->nameAssigner)->identifier.bv_len = strLen; if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading , "); return LDAP_PROTOCOL_ERROR; } if(*peek_head != ','){ Asn1Error("Missing , in encoding"); return LDAP_PROTOCOL_ERROR; } if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ){ Asn1Error("Error during Reading identifier"); return LDAP_PROTOCOL_ERROR; } } if ( strncmp( peek_head, "partyName", strlen("partyName") ) == 0 ) { rc = GDecComponentDirectoryString (mem_op, b, (&k->partyName), bytesDecoded, mode); if ( rc != LDAP_SUCCESS ) return rc; ( k->partyName)->identifier.bv_val = peek_head; ( k->partyName)->identifier.bv_len = strLen; } if( !(strLen = LocateNextGSERToken(mem_op,b,&peek_head,GSER_NO_COPY)) ) { Asn1Error("Error during Reading } in encoding"); return LDAP_PROTOCOL_ERROR; } if(*peek_head != '}'){ Asn1Error("Missing } in encoding"); return LDAP_PROTOCOL_ERROR; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -