blob: ace7722e9b96214fbfc1cd9db13408a6211013ed [file] [log] [blame]
rajalakshmisv21b61dd2021-12-07 04:53:03 +00001/*
2 * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
rajalakshmisv960885a2022-05-31 14:59:10 +00003 * From ASN.1 module "E2SM-RC-IEs"
sandeepindiac588f662022-12-01 22:00:11 +05304 * found in "e2sm_rc.asn"
5 * `asn1c -fcompound-names -fno-include-deps -findirect-choice -pdu=auto -gen-PER -gen-OER -no-gen-example`
rajalakshmisv21b61dd2021-12-07 04:53:03 +00006 */
7
8#include "RANParameter-Name.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
43RANParameter_Name_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 <= 150)
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_RANParameter_Name_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_RANParameter_Name_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 */
83static asn_oer_constraints_t asn_OER_type_RANParameter_Name_constr_1 CC_NOTUSED = {
84 { 0, 0 },
85 -1 /* (SIZE(0..MAX)) */};
86asn_per_constraints_t asn_PER_type_RANParameter_Name_constr_1 CC_NOTUSED = {
87 { APC_CONSTRAINED, 7, 7, 32, 122 } /* (32..122) */,
88 { APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 150 } /* (SIZE(1..150,...)) */,
89 asn_PER_MAP_RANParameter_Name_1_v2c, /* Value to PER code map */
90 asn_PER_MAP_RANParameter_Name_1_c2v /* PER code to value map */
91};
92static const ber_tlv_tag_t asn_DEF_RANParameter_Name_tags_1[] = {
93 (ASN_TAG_CLASS_UNIVERSAL | (19 << 2))
94};
95asn_TYPE_descriptor_t asn_DEF_RANParameter_Name = {
96 "RANParameter-Name",
97 "RANParameter-Name",
98 &asn_OP_PrintableString,
99 asn_DEF_RANParameter_Name_tags_1,
100 sizeof(asn_DEF_RANParameter_Name_tags_1)
101 /sizeof(asn_DEF_RANParameter_Name_tags_1[0]), /* 1 */
102 asn_DEF_RANParameter_Name_tags_1, /* Same as above */
103 sizeof(asn_DEF_RANParameter_Name_tags_1)
104 /sizeof(asn_DEF_RANParameter_Name_tags_1[0]), /* 1 */
105 { &asn_OER_type_RANParameter_Name_constr_1, &asn_PER_type_RANParameter_Name_constr_1, RANParameter_Name_constraint },
106 0, 0, /* No members */
107 0 /* No specifics */
108};
109