]> git.sur5r.net Git - openldap/blobdiff - contrib/slapd-modules/comp_match/componentlib.c
Merge remote-tracking branch 'origin/mdb.master'
[openldap] / contrib / slapd-modules / comp_match / componentlib.c
index 1d17da7e5e1813b7355e4202f26b530b146c632e..93141b3bc88cccd5b78e44a4282dcb3476e23e51 100644 (file)
@@ -67,9 +67,12 @@ FreeComponentBits ( ComponentBits* v ) {
 int
 GEncComponentBits ( GenBuf *b, ComponentBits *in )
 {
-    if ( !in )
-       return (-1);
-    return GEncAsnBitsContent ( b, &in->value );
+       GAsnBits bits = {0};
+
+       bits.value = in->value;
+       if ( !in )
+               return (-1);
+       return GEncAsnBitsContent ( b, &bits);
 }
 
 
@@ -99,23 +102,8 @@ GDecComponentBits ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int
                return LDAP_DECODING_ERROR;
        }
        k->value = result.value;
+       k->comp_desc = get_component_description (BASICTYPE_BITSTRING);
 
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc ) {
-               if ( k ) CompFree( mem_op,  k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentBits;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentBits;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentBits;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_BITSTRING;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentBits;
-       /* Real Decoding code need to be followed */
        return LDAP_SUCCESS;
 }
 
@@ -159,21 +147,7 @@ BDecComponentBits ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
        }
 
        k->value = result;
-
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree( mem_op,  k );
-               return LDAP_DECODING_ERROR;
-       }
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentBits;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentBits;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentBits;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_BITSTRING;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentBits;
+       k->comp_desc = get_component_description (BASICTYPE_BITSTRING);
  
        return LDAP_SUCCESS;
 }
@@ -181,12 +155,16 @@ BDecComponentBits ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
 /*
  * Component GSER BMPString Encoder
  */
- int
- GEncComponentBMPString ( GenBuf *b, ComponentBMPString *in )
- {
-    if ( !in || in->value.octetLen <= 0 ) return (-1);
-    return GEncBMPStringContent ( b, &in->value );
- }
+int
+GEncComponentBMPString ( GenBuf *b, ComponentBMPString *in )
+{
+       GBMPString t = {0};
+
+       if ( !in || in->value.octetLen <= 0 )
+               return (-1);
+       t.value = in->value;
+       return GEncBMPStringContent ( b, &t );
+}
 
 /*
  * Component GSER BMPString Decoder
@@ -217,21 +195,7 @@ GDecComponentBMPString ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded,
        }
 
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentBMPString;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentBMPString;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentBMPString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_BMP_STR;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentBMPString;
+       k->comp_desc = get_component_description (BASICTYPE_BMP_STR);
  
        return LDAP_SUCCESS;
 
@@ -277,21 +241,7 @@ BDecComponentBMPString ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void
        }
 
        k->value = result;
-
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentBMPString;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentBMPString;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentBMPString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_BMP_STR;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentBMPString;
+       k->comp_desc = get_component_description (BASICTYPE_BMP_STR);
  
        return LDAP_SUCCESS;
 
@@ -303,9 +253,11 @@ BDecComponentBMPString ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void
 int
 GEncComponentUTF8String ( GenBuf *b, ComponentUTF8String *in )
 {
-    if ( !in || in->value.octetLen <= 0 )
-        return (-1);
-    return GEncUTF8StringContent ( b, &in->value );
+       GUTF8String t = {0};
+       if ( !in || in->value.octetLen <= 0 )
+               return (-1);
+       t.value = in->value;
+       return GEncUTF8StringContent ( b, &t );
 }
 
 /*
@@ -337,21 +289,7 @@ GDecComponentUTF8String ( void* mem_op, GenBuf *b, void *v,
        }
        
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree( mem_op,  k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentUTF8String;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentUTF8String;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentUTF8String;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_UTF8_STR;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentUTF8String;
+       k->comp_desc = get_component_description (BASICTYPE_UTF8_STR);
  
        return LDAP_SUCCESS;
 }
@@ -395,21 +333,9 @@ BDecComponentUTF8String ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len,
        }
 
        k->value = result;
+       k->comp_desc = get_component_description (BASICTYPE_UTF8_STR);
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentUTF8String;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentUTF8String;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentUTF8String;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_UTF8_STR;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentUTF8String;
+       return LDAP_SUCCESS;
 }
 
 /*
@@ -418,9 +344,12 @@ BDecComponentUTF8String ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len,
 int
 GEncComponentTeletexString ( GenBuf *b, ComponentTeletexString *in )
 {
-    if ( !in || in->value.octetLen <= 0 )
-        return (-1);
-    return GEncTeletexStringContent ( b, &in->value );
+       GTeletexString t = {0};
+
+       if ( !in || in->value.octetLen <= 0 )
+               return (-1);
+       t.value = in->value;
+       return GEncTeletexStringContent ( b, &t );
 }
 
 /*
@@ -452,21 +381,7 @@ GDecComponentTeletexString  ( void* mem_op, GenBuf *b, void *v,
        }
 
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentTeletexString;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentTeletexString;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentTeletexString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_VIDEOTEX_STR;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentTeletexString;
+       k->comp_desc = get_component_description (BASICTYPE_VIDEOTEX_STR);
  
        return LDAP_SUCCESS;
 }
@@ -500,9 +415,12 @@ MatchingComponentBool(char* oid, ComponentSyntaxInfo* csi_attr,
 int
 GEncComponentBool ( GenBuf *b, ComponentBool *in )
 {
-    if ( !in )
-        return (-1);
-    return GEncAsnBoolContent ( b, &in->value );
+       GAsnBool t = {0};
+
+       if ( !in )
+               return (-1);
+       t.value = in->value;
+       return GEncAsnBoolContent ( b, &t );
 }
 
 /*
@@ -531,21 +449,7 @@ GDecComponentBool ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int
        }
 
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentBool;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentBool;
-       k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_BOOLEAN;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentBool;
+       k->comp_desc = get_component_description (BASICTYPE_BOOLEAN);
  
         return LDAP_SUCCESS;
 }
@@ -588,22 +492,8 @@ BDecComponentBool ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
        }
 
        k->value = result;
+       k->comp_desc = get_component_description (BASICTYPE_BOOLEAN);
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentBool;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentBool;
-       k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_BOOLEAN;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentBool;
         return LDAP_SUCCESS;
 }
 
@@ -636,9 +526,12 @@ MatchingComponentEnum ( char* oid, ComponentSyntaxInfo *csi_attr,
 int
 GEncComponentEnum ( GenBuf *b, ComponentEnum *in )
 {
-    if ( !in )
-       return (-1);
-    return GEncAsnEnumContent ( b, &in->value );
+       GAsnEnum t = {0};
+
+       if ( !in )
+               return (-1);
+       t.value = in->value;
+       return GEncAsnEnumContent ( b, &t );
 }
 
 /*
@@ -675,11 +568,10 @@ GDecComponentEnum ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int
                if ( k ) CompFree ( mem_op, k );
                return LDAP_DECODING_ERROR;
        }
+       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentEnum;
        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentEnum;
        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentEnum;
        k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
        k->comp_desc->cd_extract_i = NULL;
        k->comp_desc->cd_type = ASN_BASIC;
        k->comp_desc->cd_type_id = BASICTYPE_ENUMERATED;
@@ -733,11 +625,10 @@ BDecComponentEnum ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
                if ( k  ) CompFree ( mem_op, k );
                return LDAP_DECODING_ERROR;
        }
+       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentEnum;
         k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentEnum;
         k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentEnum;
        k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
         k->comp_desc->cd_extract_i = NULL;
         k->comp_desc->cd_type = ASN_BASIC;
         k->comp_desc->cd_type_id = BASICTYPE_ENUMERATED;
@@ -752,8 +643,10 @@ BDecComponentEnum ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
 int
 GEncComponentIA5Stirng ( GenBuf *b, ComponentIA5String* in )
 {
-    if ( !in || in->value.octetLen <= 0 ) return (-1);
-    return GEncIA5StringContent( b, &in->value );
+       GIA5String t = {0};
+       t.value = in->value;
+       if ( !in || in->value.octetLen <= 0 ) return (-1);
+       return GEncIA5StringContent( b, &t );
 }
 
 /*
@@ -801,11 +694,10 @@ BDecComponentIA5String ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void
                if ( k ) CompFree ( mem_op, k );
                return LDAP_DECODING_ERROR;
        }
+       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentIA5String;
         k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentIA5String;
         k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentIA5String;
        k->comp_desc->cd_free = (comp_free_func*)FreeComponentIA5String;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
         k->comp_desc->cd_extract_i = NULL;
         k->comp_desc->cd_type = ASN_BASIC;
         k->comp_desc->cd_type_id = BASICTYPE_IA5_STR;
@@ -844,8 +736,12 @@ function*/
 int
 GEncComponentInt ( GenBuf *b, ComponentInt* in )
 {
-    if ( !in ) return (-1);
-    return GEncAsnIntContent ( b, &in->value );
+       GAsnInt t = {0};
+
+       if ( !in )
+               return (-1);
+       t.value = in->value;
+       return GEncAsnIntContent ( b, &t );
 }
 
 /*
@@ -874,21 +770,7 @@ GDecComponentInt( void* mem_op, GenBuf * b, void *v, AsnLen *bytesDecoded, int m
                return LDAP_DECODING_ERROR;
        }
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentInt;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentInt;
-       k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_INTEGER;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentInt;
+       k->comp_desc = get_component_description (BASICTYPE_INTEGER );
 
         return LDAP_SUCCESS;
 }
@@ -928,20 +810,7 @@ BDecComponentInt ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
        }
        k->value = result;
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentInt;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentInt;
-       k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_INTEGER;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentInt;
+       k->comp_desc = get_component_description (BASICTYPE_INTEGER );
         
         return LDAP_SUCCESS;
 }
@@ -973,8 +842,12 @@ MatchingComponentNull ( char *oid, ComponentSyntaxInfo *csi_attr,
 int
 GEncComponentNull ( GenBuf *b, ComponentNull *in )
 {
-    if ( !in ) return (-1);
-    return GEncAsnNullContent ( b, &in->value );
+       GAsnNull t = {0};
+
+       if ( !in )
+               return (-1);
+       t.value = in->value;
+       return GEncAsnNullContent ( b, &t );
 }
 
 /*
@@ -1009,11 +882,10 @@ GDecComponentNull ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int
                if ( k ) CompFree ( mem_op, k );
                return LDAP_DECODING_ERROR;
        }
+       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentNull;
        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentNull;
        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentNull;
        k->comp_desc->cd_free = (comp_free_func*)FreeComponentNull;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
        k->comp_desc->cd_extract_i = NULL;
        k->comp_desc->cd_type = ASN_BASIC;
        k->comp_desc->cd_type_id = BASICTYPE_NULL;
@@ -1068,11 +940,10 @@ BDecComponentNull ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
                if ( k ) CompFree ( mem_op, k );
                return LDAP_DECODING_ERROR;
        }
+       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentNull;
        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentNull;
        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentNull;
        k->comp_desc->cd_free = (comp_free_func*)FreeComponentNull;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
        k->comp_desc->cd_extract_i = NULL;
        k->comp_desc->cd_type = ASN_BASIC;
        k->comp_desc->cd_type_id = BASICTYPE_NULL;
@@ -1123,11 +994,10 @@ BDecComponentNumericString ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len,
                if ( k ) CompFree ( mem_op, k );
                return LDAP_DECODING_ERROR;
        }
+       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentNumericString;
         k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentNumericString;
         k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentNumericString;
        k->comp_desc->cd_free = (comp_free_func*)FreeComponentNumericString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
         k->comp_desc->cd_extract_i = NULL;
         k->comp_desc->cd_type = ASN_BASIC;
         k->comp_desc->cd_type_id = BASICTYPE_NUMERIC_STR;
@@ -1177,9 +1047,12 @@ MatchingComponentOcts ( char* oid, ComponentSyntaxInfo* csi_attr,
 int
 GEncComponentOcts ( GenBuf* b, ComponentOcts *in )
 {
-    if ( !in || in->value.octetLen <= 0 )
-        return (-1);
-    return GEncAsnOctsContent ( b, &in->value );
+       GAsnOcts t = {0};
+       if ( !in || in->value.octetLen <= 0 )
+               return (-1);
+
+       t.value = in->value;
+       return GEncAsnOctsContent ( b, &t );
 }
 
 /*
@@ -1214,11 +1087,10 @@ GDecComponentOcts ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int
                if ( k ) CompFree ( mem_op, k );
                return LDAP_DECODING_ERROR;
        }
+       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentOcts;
        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentOcts;
        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentOcts;
        k->comp_desc->cd_free = (comp_free_func*)FreeComponentOcts;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
        k->comp_desc->cd_extract_i = NULL;
        k->comp_desc->cd_type = ASN_BASIC;
        k->comp_desc->cd_type_id = BASICTYPE_OCTETSTRING;
@@ -1271,11 +1143,10 @@ BDecComponentOcts ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
                if ( k ) CompFree ( mem_op, k );
                return LDAP_DECODING_ERROR;
        }
+       k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentOcts;
         k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentOcts;
         k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentOcts;
        k->comp_desc->cd_free = (comp_free_func*)FreeComponentOcts;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
         k->comp_desc->cd_extract_i = NULL;
         k->comp_desc->cd_type = ASN_BASIC;
         k->comp_desc->cd_type_id = BASICTYPE_OCTETSTRING;
@@ -1314,8 +1185,12 @@ MatchingComponentOid ( char *oid, ComponentSyntaxInfo *csi_attr ,
  */
 GEncComponentOid ( GenBuf *b, ComponentOid *in )
 {
-    if ( !in || in->value.octetLen <= 0 ) return (-1);
-    return GEncAsnOidContent( b, &in->value );
+       GAsnOid t = {0};
+
+       if ( !in || in->value.octetLen <= 0 )
+               return (-1);
+       t.value = in->value;
+       return GEncAsnOidContent( b, (GAsnOcts*)&t );
 }
 
 /*
@@ -1340,7 +1215,7 @@ GDecAsnDescOidContent ( void* mem_op, GenBuf *b, GAsnOid *result, AsnLen *bytesD
        peek_head = ad_type->sat_atype.at_oid;
        strLen = strlen ( peek_head );
 
-       result->value.octs = EncodeComponentOid ( mem_op, peek_head , &strLen );
+       result->value.octs = (char*)EncodeComponentOid ( mem_op, peek_head , &strLen );
        result->value.octetLen = strLen;
        return LDAP_SUCCESS;
 }
@@ -1394,21 +1269,7 @@ GDecComponentOid ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int m
                }
        }
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentOid;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentOid;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentOid;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_OID;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentOid;
+       k->comp_desc = get_component_description (BASICTYPE_OID);
 
        return LDAP_SUCCESS;
 }
@@ -1452,20 +1313,8 @@ BDecComponentOid ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
        }
        k->value = result;
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentOid;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentOid;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentOid;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_OID;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentOid;
+       k->comp_desc = get_component_description (BASICTYPE_OID);
+
        return LDAP_SUCCESS;
 }
 
@@ -1509,23 +1358,57 @@ BDecComponentPrintableString( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len,
        }
        k->value = result;
 
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
+       k->comp_desc = get_component_description (BASICTYPE_PRINTABLE_STR);
+
+       return LDAP_SUCCESS;
+}
+
+/*
+ * Component BER Decoder : TeletexString
+ */
+
+int
+BDecComponentTeletexStringTag ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int mode )
+{
+       return BDecComponentTeletexString ( mem_op, b, 0, 0, v, bytesDecoded, mode|CALL_TAG_DECODER );
+}
+
+int
+BDecComponentTeletexString( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v, AsnLen *bytesDecoded, int mode )
+{
+        char* peek_head;
+        int i, strLen, rc;
+        void* component_values;
+        ComponentTeletexString* k, **k2;
+       AsnOid result;
+                                                                          
+        k = (ComponentTeletexString*) v;
+                                                                          
+        if ( mode & DEC_ALLOC_MODE_0 ) {
+                k2 = (ComponentTeletexString**) v;
+                *k2 = (ComponentTeletexString*) CompAlloc( mem_op, sizeof( ComponentTeletexString ) );
+               if ( !*k2 ) return LDAP_DECODING_ERROR;
+                k = *k2;
+        }
+
+       if ( mode & CALL_TAG_DECODER ) {
+               mode = mode & CALL_CONTENT_DECODER;
+               rc = BDecTeletexString ( mem_op, b, &result, bytesDecoded );
+       } else {
+               rc = BDecTeletexStringContent ( mem_op, b, tagId, len, &result, bytesDecoded );
+       }
+       if ( rc < 0 ) {
                if ( k ) CompFree ( mem_op, k );
                return LDAP_DECODING_ERROR;
        }
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentPrintableString;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentPrintableString;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentPrintableString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_PRINTABLE_STR;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentPrintableString;
+       k->value = result;
+
+       k->comp_desc = get_component_description (BASICTYPE_T61_STR);
+
        return LDAP_SUCCESS;
 }
 
+
 /*
  * Matching function : Real
  */
@@ -1555,9 +1438,11 @@ MatchingComponentReal (char* oid, ComponentSyntaxInfo *csi_attr,
 int
 GEncComponentReal ( GenBuf *b, ComponentReal *in )
 {
-    if ( !in )
-       return (-1);
-    return GEncAsnRealContent ( b, &in->value );
+       GAsnReal t = {0};
+       if ( !in )
+               return (-1);
+       t.value = in->value;
+       return GEncAsnRealContent ( b, &t );
 }
 
 /*
@@ -1586,21 +1471,7 @@ GDecComponentReal ( void* mem_op, GenBuf *b, void *v, AsnLen *bytesDecoded, int
                return LDAP_DECODING_ERROR;
        }
        k->value = result.value;
-
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentReal;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentReal;
-       k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_REAL;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentReal;
+       k->comp_desc = get_component_description (BASICTYPE_REAL);
 
         return LDAP_SUCCESS;
 }
@@ -1642,21 +1513,7 @@ BDecComponentReal ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, void *v,
                return LDAP_DECODING_ERROR;
        }
        k->value = result;
-
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentReal;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentReal;
-       k->comp_desc->cd_free = (comp_free_func*)NULL;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_REAL;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentReal;
+       k->comp_desc = get_component_description (BASICTYPE_REAL);
 
         return LDAP_SUCCESS;
 }
@@ -1694,9 +1551,12 @@ MatchingComponentRelativeOid ( char* oid, ComponentSyntaxInfo *csi_attr,
 int
 GEncComponentRelativeOid ( GenBuf *b, ComponentRelativeOid *in )
 {
-    if ( !in || in->value.octetLen <= 0 )
-       return (-1);
-    return GEncAsnRelativeOidContent ( b , &in->value );
+       GAsnRelativeOid t = {0};
+
+       if ( !in || in->value.octetLen <= 0 )
+               return (-1);
+       t.value = in->value;
+       return GEncAsnRelativeOidContent ( b , (GAsnOcts*)&t );
 }
 
 /*
@@ -1725,22 +1585,8 @@ GDecComponentRelativeOid ( void* mem_op, GenBuf *b,void *v, AsnLen *bytesDecoded
                return LDAP_DECODING_ERROR;
        }
        k->value = result.value;
+       k->comp_desc = get_component_description (BASICTYPE_OID);
 
-       k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-       k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentRelativeOid;
-       k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentRelativeOid;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentRelativeOid;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-       k->comp_desc->cd_extract_i = NULL;
-       k->comp_desc->cd_type = ASN_BASIC;
-       k->comp_desc->cd_type_id = BASICTYPE_OID;
-       k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentRelativeOid;
-       
        return LDAP_SUCCESS;
 }
 
@@ -1781,21 +1627,8 @@ BDecComponentRelativeOid ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, vo
                return LDAP_DECODING_ERROR;
        }
        k->value = result;
+       k->comp_desc = get_component_description (BASICTYPE_OID);
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentRelativeOid;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentRelativeOid;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentRelativeOid;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_RELATIVE_OID;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentRelativeOid;
        return LDAP_SUCCESS;
 }
 
@@ -1805,9 +1638,11 @@ BDecComponentRelativeOid ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len, vo
 int
 GEncComponentUniversalString ( GenBuf *b, ComponentUniversalString *in )
 {
-    if ( !in || in->value.octetLen <= 0 )
-       return (-1);
-    return GEncUniversalStringContent( b, &in->value );
+       GUniversalString t = {0};
+       if ( !in || in->value.octetLen <= 0 )
+               return (-1);
+       t.value = in->value;
+       return GEncUniversalStringContent( b, &t );
 }
 
 /*
@@ -1864,21 +1699,8 @@ BDecComponentUniversalString ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len
                return LDAP_DECODING_ERROR;
        }
        k->value = result;
+       k->comp_desc = get_component_description (BASICTYPE_UNIVERSAL_STR);
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentUniversalString;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentUniversalString;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentUniversalString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_UNIVERSAL_STR;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentUniversalString;
        return LDAP_SUCCESS;
 }
 
@@ -1915,21 +1737,8 @@ BDecComponentVisibleString ( void* mem_op, GenBuf *b, AsnTag tagId, AsnLen len,
                rc = BDecVisibleStringContent ( mem_op, b, tagId, len, &result, bytesDecoded );
        }
        k->value = result;
+       k->comp_desc = get_component_description (BASICTYPE_VISIBLE_STR);
 
-        k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
-       if ( !k->comp_desc )  {
-               if ( k ) CompFree ( mem_op, k );
-               return LDAP_DECODING_ERROR;
-       }
-        k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentVisibleString;
-        k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentVisibleString;
-       k->comp_desc->cd_free = (comp_free_func*)FreeComponentVisibleString;
-       k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-       k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
-        k->comp_desc->cd_extract_i = NULL;
-        k->comp_desc->cd_type = ASN_BASIC;
-        k->comp_desc->cd_type_id = BASICTYPE_VISIBLE_STR;
-        k->comp_desc->cd_all_match = (allcomponent_matching_func*)MatchingComponentVisibleString;
        return LDAP_SUCCESS;
 }
 
@@ -2003,9 +1812,10 @@ SetAnyTypeByComponentInt( ComponentAny *v, ComponentInt id) {
 int
 GEncComponentAny ( GenBuf *b, ComponentAny *in )
 {
-    if ( in->cai != NULL  && in->cai->Encode != NULL )
-        return in->cai->Encode(b, &in->value );
-    else return (-1);
+       if ( in->cai != NULL  && in->cai->Encode != NULL )
+               return in->cai->Encode(b, &in->value );
+       else
+               return (-1);
 }
 
 int
@@ -2034,11 +1844,10 @@ BEncComponentAny ( void* mem_op, GenBuf *b, ComponentAny *result, AsnLen *bytesD
                        if ( k ) CompFree ( mem_op, k );
                        return LDAP_DECODING_ERROR;
                }
+               k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentAny;
                k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentAny;
                k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentAny;
                k->comp_desc->cd_free = (comp_free_func*)FreeComponentAny;
-               k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-               k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
                k->comp_desc->cd_extract_i = NULL;
                k->comp_desc->cd_type = ASN_BASIC;
                k->comp_desc->cd_type_id = BASICTYPE_ANY;
@@ -2068,26 +1877,17 @@ BDecComponentAny ( void* mem_op, GenBuf *b, ComponentAny *result, AsnLen *bytesD
         }
        
        if ((result->cai != NULL) && (result->cai->BER_Decode != NULL)) {
-#if 0
-               result->value = (void*) CompAlloc ( mem_op, result->cai->size );
-               if ( !result->value ) return 0;
-#endif
-               result->cai->BER_Decode ( mem_op, b, &result->value, (int*)bytesDecoded, DEC_ALLOC_MODE_0 );
-#if 0
-               rc = BDecComponentTop( result->cai->BER_Decode, mem_op, 0, 0, &result->value, bytesDecoded, DEC_ALLOC_MODE_0 );
-               if ( rc != LDAP_SUCCESS ) return rc;
-#endif
+               result->cai->BER_Decode ( mem_op, b, (ComponentSyntaxInfo*)&result->value, (int*)bytesDecoded, DEC_ALLOC_MODE_0 );
 
                k->comp_desc = CompAlloc( mem_op, sizeof( ComponentDesc ) );
                if ( !k->comp_desc )  {
                        if ( k ) CompFree ( mem_op, k );
                        return LDAP_DECODING_ERROR;
                }
+               k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentAny;
                k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentAny;
                k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentAny;
                k->comp_desc->cd_free = (comp_free_func*)FreeComponentAny;
-               k->comp_desc->cd_pretty = (slap_syntax_transform_func*)NULL;
-               k->comp_desc->cd_validate = (slap_syntax_validate_func*)NULL;
                k->comp_desc->cd_extract_i = NULL;
                k->comp_desc->cd_type = ASN_BASIC;
                k->comp_desc->cd_type_id = BASICTYPE_ANY;
@@ -2121,6 +1921,7 @@ GDecComponentAny ( void* mem_op, GenBuf *b, ComponentAny *result, AsnLen *bytesD
                        if ( k ) CompFree ( mem_op, k );
                        return LDAP_DECODING_ERROR;
                }
+               k->comp_desc->cd_gser_encoder = (encoder_func*)GEncComponentAny;
                k->comp_desc->cd_gser_decoder = (gser_decoder_func*)GDecComponentAny;
                k->comp_desc->cd_ber_decoder = (ber_decoder_func*)BDecComponentAny;
                k->comp_desc->cd_free = (comp_free_func*)FreeComponentAny;
@@ -2271,9 +2072,9 @@ RetrieveOidDecoderMappingbyOid( char* ch_oid, int oid_len ) {
        mem_op = comp_nibble_memory_allocator ( 128, 16 );
        oid.octs = EncodeComponentOid ( mem_op, ch_oid, &oid_len);
        oid.octetLen = oid_len;
-       if( strLen <= 0 ) {
+       if( oid_len <= 0 ) {
                comp_nibble_memory_free( mem_op );
-               return;
+               return NULL;
        }
        
        /* use encoded oid as hash string */
@@ -2310,7 +2111,7 @@ RetrieveOidDecoderMappingbyDesc( char* desc, int desc_len ) {
 
        mem_op = comp_nibble_memory_allocator ( 128, 16 );
 
-       oid.octs = EncodeComponentOid ( mem_op, oid.octs , &oid.octetLen );
+       oid.octs = EncodeComponentOid ( mem_op, oid.octs , (int*)&oid.octetLen );
        if( oid.octetLen <= 0 ) {
                comp_nibble_memory_free( mem_op );
                return (OidDecoderMapping*) NULL;