blob: 160e518ac1672684e52fa0ba3a50b4a8e53104c0 [file] [log] [blame]
naman.gupta4e29ea32021-09-24 14:19:08 +05301/*
2 * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
3 * From ASN.1 module "E2AP-IEs"
subhash kumar singhf86662b2022-03-22 00:39:54 +05304 * found in "e2ap-v2.asn"
5 * `asn1c -pdu=auto -fincludes-quoted -fcompound-names -findirect-choice -fno-include-deps -gen-PER -no-gen-example -no-gen-OER`
naman.gupta4e29ea32021-09-24 14:19:08 +05306 */
7
8#include "RANfunctionOID.h"
9
10static const int permitted_alphabet_table_1[256] = {
11 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
12 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
13 1, 0, 0, 0, 0, 0, 0, 2, 3, 4, 0, 5, 6, 7, 8, 9, /* . '() +,-./ */
1410,11,12,13,14,15,16,17,18,19,20, 0, 0,21, 0,22, /* 0123456789: = ? */
15 0,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37, /* ABCDEFGHIJKLMNO */
1638,39,40,41,42,43,44,45,46,47,48, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ */
17 0,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, /* abcdefghijklmno */
1864,65,66,67,68,69,70,71,72,73,74, 0, 0, 0, 0, 0, /* pqrstuvwxyz */
19};
20static const int permitted_alphabet_code2value_1[74] = {
2132,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,
2255,56,57,58,61,63,65,66,67,68,69,70,71,72,73,74,
2375,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
2497,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
25113,114,115,116,117,118,119,120,121,122,};
26
27
28static int check_permitted_alphabet_1(const void *sptr) {
29 const int *table = permitted_alphabet_table_1;
30 /* The underlying type is PrintableString */
31 const PrintableString_t *st = (const PrintableString_t *)sptr;
32 const uint8_t *ch = st->buf;
33 const uint8_t *end = ch + st->size;
34
35 for(; ch < end; ch++) {
36 uint8_t cv = *ch;
37 if(!table[cv]) return -1;
38 }
39 return 0;
40}
41
42int
43RANfunctionOID_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
44 asn_app_constraint_failed_f *ctfailcb, void *app_key) {
45 const PrintableString_t *st = (const PrintableString_t *)sptr;
46 size_t size;
47
48 if(!sptr) {
49 ASN__CTFAIL(app_key, td, sptr,
50 "%s: value not given (%s:%d)",
51 td->name, __FILE__, __LINE__);
52 return -1;
53 }
54
55 size = st->size;
56
57 if((size >= 1 && size <= 1000)
58 && !check_permitted_alphabet_1(st)) {
59 /* Constraint check succeeded */
60 return 0;
61 } else {
62 ASN__CTFAIL(app_key, td, sptr,
63 "%s: constraint failed (%s:%d)",
64 td->name, __FILE__, __LINE__);
65 return -1;
66 }
67}
68
69static int asn_PER_MAP_RANfunctionOID_1_v2c(unsigned int value) {
70 if(value >= sizeof(permitted_alphabet_table_1)/sizeof(permitted_alphabet_table_1[0]))
71 return -1;
72 return permitted_alphabet_table_1[value] - 1;
73}
74static int asn_PER_MAP_RANfunctionOID_1_c2v(unsigned int code) {
75 if(code >= sizeof(permitted_alphabet_code2value_1)/sizeof(permitted_alphabet_code2value_1[0]))
76 return -1;
77 return permitted_alphabet_code2value_1[code];
78}
79/*
80 * This type is implemented using PrintableString,
81 * so here we adjust the DEF accordingly.
82 */
83asn_per_constraints_t asn_PER_type_RANfunctionOID_constr_1 CC_NOTUSED = {
84 { APC_CONSTRAINED, 7, 7, 32, 122 } /* (32..122) */,
85 { APC_CONSTRAINED | APC_EXTENSIBLE, 10, 10, 1, 1000 } /* (SIZE(1..1000,...)) */,
86 asn_PER_MAP_RANfunctionOID_1_v2c, /* Value to PER code map */
87 asn_PER_MAP_RANfunctionOID_1_c2v /* PER code to value map */
88};
89static const ber_tlv_tag_t asn_DEF_RANfunctionOID_tags_1[] = {
90 (ASN_TAG_CLASS_UNIVERSAL | (19 << 2))
91};
92asn_TYPE_descriptor_t asn_DEF_RANfunctionOID = {
93 "RANfunctionOID",
94 "RANfunctionOID",
95 &asn_OP_PrintableString,
96 asn_DEF_RANfunctionOID_tags_1,
97 sizeof(asn_DEF_RANfunctionOID_tags_1)
98 /sizeof(asn_DEF_RANfunctionOID_tags_1[0]), /* 1 */
99 asn_DEF_RANfunctionOID_tags_1, /* Same as above */
100 sizeof(asn_DEF_RANfunctionOID_tags_1)
101 /sizeof(asn_DEF_RANfunctionOID_tags_1[0]), /* 1 */
102 { 0, &asn_PER_type_RANfunctionOID_constr_1, RANfunctionOID_constraint },
103 0, 0, /* No members */
104 0 /* No specifics */
105};
106