X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fe2-interface.git;a=blobdiff_plain;f=e2sim%2Fasn1c%2Fconstr_SEQUENCE_OF.c;fp=e2sim%2Fasn1c%2Fconstr_SEQUENCE_OF.c;h=9c5d6cded323d5614df481595ec569299223a5f1;hp=0000000000000000000000000000000000000000;hb=f5900596513e4359fc839ba361da085674e90b68;hpb=215d350dbe06a4c7ee370815f26128a7f7e160cb diff --git a/e2sim/asn1c/constr_SEQUENCE_OF.c b/e2sim/asn1c/constr_SEQUENCE_OF.c new file mode 100644 index 0000000..9c5d6cd --- /dev/null +++ b/e2sim/asn1c/constr_SEQUENCE_OF.c @@ -0,0 +1,92 @@ +/*- + * Copyright (c) 2003, 2004, 2006 Lev Walkin . + * All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#include +#include +#include + +asn_TYPE_operation_t asn_OP_SEQUENCE_OF = { + SEQUENCE_OF_free, +#if !defined(ASN_DISABLE_PRINT_SUPPORT) + SEQUENCE_OF_print, +#else + 0, +#endif /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ + SEQUENCE_OF_compare, +#if !defined(ASN_DISABLE_BER_SUPPORT) + SEQUENCE_OF_decode_ber, + SEQUENCE_OF_encode_der, +#else + 0, + 0, +#endif /* !defined(ASN_DISABLE_BER_SUPPORT) */ +#if !defined(ASN_DISABLE_XER_SUPPORT) + SEQUENCE_OF_decode_xer, + SEQUENCE_OF_encode_xer, +#else + 0, + 0, +#endif /* !defined(ASN_DISABLE_XER_SUPPORT) */ +#if !defined(ASN_DISABLE_JER_SUPPORT) + SEQUENCE_OF_encode_jer, +#else + 0, +#endif /* !defined(ASN_DISABLE_JER_SUPPORT) */ +#if !defined(ASN_DISABLE_OER_SUPPORT) + SEQUENCE_OF_decode_oer, /* Same as SET OF decoder. */ + SEQUENCE_OF_encode_oer, /* Same as SET OF encoder */ +#else + 0, + 0, +#endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ +#if !defined(ASN_DISABLE_UPER_SUPPORT) + SEQUENCE_OF_decode_uper, /* Same as SET OF decoder */ + SEQUENCE_OF_encode_uper, +#else + 0, + 0, +#endif /* !defined(ASN_DISABLE_UPER_SUPPORT) */ +#if !defined(ASN_DISABLE_APER_SUPPORT) + SEQUENCE_OF_decode_aper, + SEQUENCE_OF_encode_aper, +#else + 0, + 0, +#endif /* !defined(ASN_DISABLE_APER_SUPPORT) */ +#if !defined(ASN_DISABLE_RFILL_SUPPORT) + SEQUENCE_OF_random_fill, +#else + 0, +#endif /* !defined(ASN_DISABLE_RFILL_SUPPORT) */ + 0 /* Use generic outmost tag fetcher */ +}; + +int +SEQUENCE_OF_compare(const asn_TYPE_descriptor_t *td, const void *aptr, + const void *bptr) { + const asn_anonymous_sequence_ *a = _A_CSEQUENCE_FROM_VOID(aptr); + const asn_anonymous_sequence_ *b = _A_CSEQUENCE_FROM_VOID(bptr); + ssize_t idx; + + if(a && b) { + ssize_t common_length = (a->count < b->count ? a->count : b->count); + for(idx = 0; idx < common_length; idx++) { + int ret = td->elements->type->op->compare_struct( + td->elements->type, a->array[idx], b->array[idx]); + if(ret) return ret; + } + + if(idx < b->count) /* more elements in b */ + return -1; /* a is shorter, so put it first */ + if(idx < a->count) return 1; + + } else if(!a) { + return -1; + } else if(!b) { + return 1; + } + + return 0; +}