From 49a9c258afabc41be2483299d5aed5adadce844d Mon Sep 17 00:00:00 2001 From: rayzhang Date: Fri, 15 Apr 2016 19:23:38 +0000 Subject: [PATCH 01/28] add support for parsing class object set --- libasn1fix/asn1fix_cws.c | 17 +- libasn1parser/asn1p_y.c | 1635 +++++++++++++++++++------------------- libasn1parser/asn1p_y.h | 2 +- libasn1parser/asn1p_y.y | 26 +- 4 files changed, 865 insertions(+), 815 deletions(-) diff --git a/libasn1fix/asn1fix_cws.c b/libasn1fix/asn1fix_cws.c index aefb15ccf..f6e00fce6 100644 --- a/libasn1fix/asn1fix_cws.c +++ b/libasn1fix/asn1fix_cws.c @@ -103,6 +103,7 @@ _asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass, case WC_FIELD: { struct asn1p_ioc_cell_s *cell; int lbraces = 0; + int lquotes = 0; uint8_t *p; SKIPSPACES; @@ -110,6 +111,8 @@ _asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass, p = buf; if(p < bend && *p == '{') lbraces = 1, p++; + if(p < bend && *p == '"') + lquotes = 1, p++; for(; p < bend; p++) { if(lbraces) { /* Search the terminating brace */ @@ -117,11 +120,14 @@ _asn1f_parse_class_object_data(arg_t *arg, asn1p_expr_t *eclass, case '}': lbraces--; break; case '{': lbraces++; break; } - } else if(isspace(*p)) { + } else if (lquotes) { + if (*p == '"') + lquotes--; + } else if(isspace(*p) || *p == ',') { break; } } - if(lbraces) { + if(lbraces || lquotes) { FATAL("Field reference %s found in class value definition for %s at line %d can not be satisfied by broken value \"%s\"", chunk->content.token, arg->expr->Identifier, arg->expr->_lineno, buf); @@ -185,7 +191,6 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_row_s *row, struct asn1p_i p[bend - buf] = '\0'; if(!isalpha(*p)) { - if(isdigit(*p)) { asn1c_integer_t value; if(asn1p_atoi(p, &value)) { @@ -197,6 +202,12 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_row_s *row, struct asn1p_i expr->meta_type = AMT_VALUE; expr->expr_type = ASN_BASIC_INTEGER; expr->value = asn1p_value_fromint(value); + } else if (*p == '"') { + expr = asn1p_expr_new(arg->expr->_lineno, arg->expr->module); + expr->Identifier = p; + expr->meta_type = AMT_VALUE; + expr->expr_type = ASN_BASIC_CHARACTER_STRING; + expr->value = asn1p_value_frombuf(p + 1, strlen(p) - 2, 0); } else { WARNING("asn1c is not yet able to parse arbitrary direct values; try converting %s at line %d to a reference.", p, arg->expr->_lineno); free(p); diff --git a/libasn1parser/asn1p_y.c b/libasn1parser/asn1p_y.c index e15fc02d1..b68ef5956 100644 --- a/libasn1parser/asn1p_y.c +++ b/libasn1parser/asn1p_y.c @@ -429,7 +429,7 @@ typedef union YYSTYPE struct asn1p_type_tag_s tag; } tv_nametag; } -/* Line 193 of yacc.c. */ +/* Line 187 of yacc.c. */ #line 434 "y.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -493,7 +493,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -658,16 +658,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 7 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 793 +#define YYLAST 803 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 123 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 122 +#define YYNNTS 124 /* YYNRULES -- Number of rules. */ -#define YYNRULES 313 +#define YYNRULES 316 /* YYNRULES -- Number of states. */ -#define YYNSTATES 473 +#define YYNSTATES 477 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -744,26 +744,26 @@ static const yytype_uint16 yyprhs[] = 526, 528, 530, 532, 534, 536, 539, 541, 544, 546, 548, 550, 552, 554, 556, 558, 560, 562, 564, 566, 568, 570, 572, 574, 576, 578, 580, 581, 583, 585, - 587, 592, 596, 601, 603, 605, 609, 615, 617, 619, - 623, 625, 629, 631, 635, 637, 641, 646, 650, 652, - 654, 658, 662, 666, 670, 672, 674, 677, 680, 682, - 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, - 706, 712, 714, 718, 720, 724, 725, 727, 729, 731, - 733, 735, 737, 739, 740, 746, 749, 751, 754, 757, - 761, 763, 765, 769, 774, 776, 780, 783, 787, 789, - 793, 794, 796, 798, 801, 804, 808, 810, 814, 816, - 821, 826, 828, 830, 832, 834, 836, 838, 839, 841, - 844, 849, 850, 852, 854, 856, 857, 859, 861, 863, - 865, 867, 868, 870 + 587, 592, 596, 601, 603, 605, 607, 609, 613, 619, + 621, 625, 627, 631, 633, 637, 639, 643, 648, 652, + 654, 656, 660, 664, 668, 672, 674, 676, 677, 681, + 684, 687, 689, 691, 693, 695, 697, 699, 701, 703, + 705, 707, 709, 713, 719, 721, 725, 727, 731, 732, + 734, 736, 738, 740, 742, 744, 746, 747, 753, 756, + 758, 761, 764, 768, 770, 772, 776, 781, 783, 787, + 790, 794, 796, 800, 801, 803, 805, 808, 811, 815, + 817, 821, 823, 828, 833, 835, 837, 839, 841, 843, + 845, 846, 848, 851, 856, 857, 859, 861, 863, 864, + 866, 868, 870, 872, 874, 875, 877 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { 124, 0, -1, 125, -1, 126, -1, 125, 126, -1, - -1, 241, 127, 128, 41, 132, 3, 28, 135, 46, + -1, 243, 127, 128, 41, 132, 3, 28, 135, 46, -1, -1, 129, -1, 110, 130, 111, -1, 110, 111, - -1, 131, -1, 130, 131, -1, 244, -1, 244, 112, + -1, 131, -1, 130, 131, -1, 246, -1, 246, 112, 12, 113, -1, 12, -1, -1, 133, -1, 134, -1, 133, 134, -1, 48, 91, -1, 59, 91, -1, 27, 91, -1, 50, 60, -1, 18, 64, -1, -1, 136, @@ -771,120 +771,120 @@ static const yytype_int16 yyrhs[] = 155, -1, 185, -1, 153, -1, -1, 45, 18, 139, -1, 195, -1, -1, 141, -1, 61, 142, 114, -1, 61, 53, -1, -1, 143, -1, 145, -1, 143, 145, - -1, -1, 129, -1, 146, 53, 241, 144, -1, 147, - -1, 146, 115, 147, -1, 241, -1, 241, 110, 111, - -1, 244, -1, -1, 149, -1, 49, 150, 114, -1, + -1, -1, 129, -1, 146, 53, 243, 144, -1, 147, + -1, 146, 115, 147, -1, 243, -1, 243, 110, 111, + -1, 246, -1, -1, 149, -1, 49, 150, 114, -1, 49, 24, 114, -1, 49, 114, -1, 151, -1, 150, - 115, 151, -1, 241, -1, 241, 110, 111, -1, 244, - -1, 110, 202, 111, -1, 241, 154, 3, 152, -1, - 194, -1, 179, -1, 179, 110, 158, 111, -1, 241, - 3, 175, -1, 241, 3, 165, -1, 241, 110, 156, - 111, 3, 175, -1, 241, 110, 156, 111, 3, 165, - -1, 157, -1, 156, 115, 157, -1, 241, -1, 241, - 116, 244, -1, 241, 116, 241, -1, 192, 116, 244, - -1, 192, 116, 241, -1, 159, -1, 158, 115, 159, - -1, 175, -1, 188, -1, 244, -1, 152, -1, -1, + 115, 151, -1, 243, -1, 243, 110, 111, -1, 246, + -1, 110, 203, 111, -1, 243, 154, 3, 152, -1, + 194, -1, 179, -1, 179, 110, 158, 111, -1, 243, + 3, 175, -1, 243, 3, 165, -1, 243, 110, 156, + 111, 3, 175, -1, 243, 110, 156, 111, 3, 165, + -1, 157, -1, 156, 115, 157, -1, 243, -1, 243, + 116, 246, -1, 243, 116, 243, -1, 192, 116, 246, + -1, 192, 116, 243, -1, 159, -1, 158, 115, 159, + -1, 175, -1, 188, -1, 246, -1, 152, -1, -1, 161, -1, 162, -1, 161, 115, 162, -1, 161, 115, - 4, 161, 5, -1, 244, 175, 229, -1, 175, 229, + 4, 161, 5, -1, 246, 175, 231, -1, 175, 231, -1, 37, 75, 175, -1, 174, -1, 164, -1, 163, - 115, 164, -1, 244, 175, -1, 174, -1, 175, -1, + 115, 164, -1, 246, 175, -1, 174, -1, 175, -1, 35, 110, 167, 111, 169, -1, -1, 95, -1, 168, - -1, 167, 115, 168, -1, 19, 229, -1, 20, 175, - 166, 229, -1, 20, 183, 229, -1, 20, 184, 229, - -1, 19, 183, 229, -1, 19, 175, 229, -1, 19, - 184, 229, -1, -1, 170, -1, -1, 102, 89, 110, + -1, 167, 115, 168, -1, 19, 231, -1, 20, 175, + 166, 231, -1, 20, 183, 231, -1, 20, 184, 231, + -1, 19, 183, 231, -1, 19, 175, 231, -1, 19, + 184, 231, -1, -1, 170, -1, -1, 102, 89, 110, 171, 172, 111, -1, 173, -1, 172, 173, -1, 6, -1, 21, -1, 182, -1, 117, 172, 118, -1, 109, - -1, 109, 119, 189, -1, 109, 119, 234, -1, 236, + -1, 109, 119, 189, -1, 109, 119, 236, -1, 238, 177, 198, -1, -1, 176, 178, -1, 154, -1, 34, 110, 163, 111, -1, 85, 110, 160, 111, -1, 86, - 110, 160, 111, -1, 85, 198, 75, 243, 236, 177, - -1, 86, 198, 75, 243, 236, 177, -1, 25, -1, - 25, 42, 32, 244, -1, 63, 75, 179, -1, 17, - -1, 17, 120, 241, -1, 242, 120, 241, -1, 17, - 120, 244, -1, 242, -1, 242, 120, 180, -1, 181, + 110, 160, 111, -1, 85, 198, 75, 245, 238, 177, + -1, 86, 198, 75, 245, 238, 177, -1, 25, -1, + 25, 42, 32, 246, -1, 63, 75, 179, -1, 17, + -1, 17, 120, 243, -1, 244, 120, 243, -1, 17, + 120, 246, -1, 244, -1, 244, 120, 180, -1, 181, -1, 180, 120, 181, -1, 182, -1, 19, -1, 20, -1, 19, -1, 183, 120, 19, -1, 183, 120, 20, - -1, 18, -1, 244, 175, 3, 186, -1, 188, -1, - 189, -1, 244, 116, 186, -1, -1, 110, 187, 191, + -1, 18, -1, 246, 175, 3, 186, -1, 188, -1, + 189, -1, 246, 116, 186, -1, -1, 110, 187, 191, -1, 70, -1, 52, -1, 93, -1, 8, -1, 10, - -1, 190, -1, 234, -1, 244, -1, 241, 120, 244, + -1, 190, -1, 236, -1, 246, -1, 243, 120, 246, -1, 9, -1, 15, -1, 16, -1, 7, -1, 191, 7, -1, 31, -1, 70, -1, 83, -1, 193, -1, 74, 88, -1, 72, 58, -1, 84, -1, 51, -1, 43, 78, -1, 33, 88, -1, 98, -1, 54, -1, 195, -1, 65, -1, 47, -1, 29, 88, -1, 192, - -1, 193, 231, -1, 30, -1, 55, -1, 56, -1, + -1, 193, 233, -1, 30, -1, 55, -1, 56, -1, 57, -1, 66, -1, 71, -1, 81, -1, 90, -1, 92, -1, 97, -1, 99, -1, 100, -1, 101, -1, 73, -1, 106, -1, 107, -1, 104, -1, 105, -1, -1, 199, -1, 200, -1, 201, -1, 87, 112, 202, 113, -1, 112, 202, 113, -1, 201, 112, 202, 113, - -1, 109, -1, 203, -1, 203, 115, 109, -1, 203, - 115, 109, 115, 203, -1, 218, -1, 204, -1, 24, - 103, 207, -1, 205, -1, 204, 196, 205, -1, 206, - -1, 205, 197, 206, -1, 207, -1, 207, 103, 207, - -1, 209, 112, 202, 113, -1, 112, 202, 113, -1, - 210, -1, 212, -1, 210, 222, 210, -1, 68, 222, - 210, -1, 210, 222, 67, -1, 68, 222, 67, -1, - 213, -1, 208, -1, 77, 9, -1, 77, 244, -1, - 87, -1, 53, -1, 52, -1, 93, -1, 235, -1, - 190, -1, 211, -1, 244, -1, 8, -1, 10, -1, - 241, -1, 102, 36, 201, -1, 102, 37, 110, 214, - 111, -1, 215, -1, 214, 115, 215, -1, 109, -1, - 244, 198, 216, -1, -1, 217, -1, 80, -1, 22, - -1, 76, -1, 219, -1, 223, -1, 221, -1, -1, - 38, 32, 110, 220, 191, -1, 39, 175, -1, 108, - -1, 108, 121, -1, 121, 108, -1, 121, 108, 121, - -1, 224, -1, 225, -1, 110, 241, 111, -1, 224, - 110, 226, 111, -1, 227, -1, 226, 115, 227, -1, - 122, 228, -1, 122, 120, 228, -1, 244, -1, 228, - 120, 244, -1, -1, 230, -1, 76, -1, 40, 186, - -1, 110, 111, -1, 110, 232, 111, -1, 233, -1, - 232, 115, 233, -1, 244, -1, 244, 112, 234, 113, - -1, 244, 112, 189, 113, -1, 234, -1, 109, -1, - 12, -1, 13, -1, 234, -1, 14, -1, -1, 237, - -1, 238, 240, -1, 117, 239, 12, 118, -1, -1, - 96, -1, 26, -1, 82, -1, -1, 59, -1, 48, - -1, 17, -1, 18, -1, 18, -1, -1, 244, -1, - 11, -1 + -1, 203, -1, 220, -1, 109, -1, 204, -1, 204, + 115, 109, -1, 204, 115, 109, 115, 204, -1, 205, + -1, 24, 103, 208, -1, 206, -1, 205, 196, 206, + -1, 207, -1, 206, 197, 207, -1, 208, -1, 208, + 103, 208, -1, 211, 112, 203, 113, -1, 112, 203, + 113, -1, 212, -1, 214, -1, 212, 224, 212, -1, + 68, 224, 212, -1, 212, 224, 67, -1, 68, 224, + 67, -1, 215, -1, 210, -1, -1, 110, 209, 191, + -1, 77, 9, -1, 77, 246, -1, 87, -1, 53, + -1, 52, -1, 93, -1, 237, -1, 190, -1, 213, + -1, 246, -1, 8, -1, 10, -1, 243, -1, 102, + 36, 201, -1, 102, 37, 110, 216, 111, -1, 217, + -1, 216, 115, 217, -1, 109, -1, 246, 198, 218, + -1, -1, 219, -1, 80, -1, 22, -1, 76, -1, + 221, -1, 225, -1, 223, -1, -1, 38, 32, 110, + 222, 191, -1, 39, 175, -1, 108, -1, 108, 121, + -1, 121, 108, -1, 121, 108, 121, -1, 226, -1, + 227, -1, 110, 243, 111, -1, 226, 110, 228, 111, + -1, 229, -1, 228, 115, 229, -1, 122, 230, -1, + 122, 120, 230, -1, 246, -1, 230, 120, 246, -1, + -1, 232, -1, 76, -1, 40, 186, -1, 110, 111, + -1, 110, 234, 111, -1, 235, -1, 234, 115, 235, + -1, 246, -1, 246, 112, 236, 113, -1, 246, 112, + 189, 113, -1, 236, -1, 109, -1, 12, -1, 13, + -1, 236, -1, 14, -1, -1, 239, -1, 240, 242, + -1, 117, 241, 12, 118, -1, -1, 96, -1, 26, + -1, 82, -1, -1, 59, -1, 48, -1, 17, -1, + 18, -1, 18, -1, -1, 246, -1, 11, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 357, 357, 363, 368, 385, 385, 414, 415, 419, - 422, 428, 434, 443, 447, 451, 461, 462, 471, 474, - 483, 486, 489, 492, 496, 517, 518, 527, 536, 539, - 555, 562, 575, 583, 582, 596, 609, 610, 613, 623, - 629, 630, 633, 638, 645, 646, 650, 661, 666, 673, - 679, 685, 695, 696, 708, 711, 714, 722, 727, 734, - 740, 746, 755, 758, 768, 781, 791, 811, 817, 833, - 839, 847, 856, 867, 871, 878, 885, 893, 904, 909, - 916, 919, 927, 938, 961, 962, 965, 970, 974, 981, - 988, 994, 1001, 1007, 1012, 1019, 1024, 1027, 1034, 1044, - 1045, 1049, 1056, 1066, 1076, 1087, 1097, 1108, 1118, 1129, - 1141, 1142, 1149, 1148, 1157, 1161, 1168, 1172, 1175, 1179, - 1185, 1193, 1202, 1214, 1236, 1243, 1262, 1265, 1271, 1277, - 1283, 1293, 1303, 1309, 1320, 1335, 1343, 1353, 1363, 1373, - 1381, 1403, 1411, 1420, 1424, 1429, 1438, 1442, 1446, 1453, - 1473, 1483, 1484, 1485, 1492, 1492, 1497, 1505, 1510, 1515, - 1519, 1523, 1526, 1532, 1543, 1561, 1565, 1570, 1578, 1587, - 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, - 1612, 1613, 1614, 1621, 1622, 1623, 1627, 1633, 1646, 1647, - 1651, 1655, 1656, 1657, 1658, 1659, 1663, 1664, 1665, 1666, - 1670, 1671, 1678, 1678, 1679, 1679, 1682, 1683, 1689, 1693, - 1696, 1706, 1709, 1715, 1719, 1722, 1728, 1736, 1742, 1743, - 1749, 1750, 1756, 1757, 1764, 1765, 1771, 1779, 1787, 1793, - 1799, 1806, 1814, 1822, 1831, 1834, 1840, 1845, 1856, 1859, - 1865, 1870, 1875, 1876, 1877, 1878, 1892, 1896, 1903, 1917, - 1920, 1926, 1929, 1935, 1941, 1955, 1956, 1960, 1963, 1966, - 1974, 1975, 1976, 1981, 1980, 1992, 2000, 2001, 2002, 2003, - 2006, 2009, 2018, 2033, 2039, 2045, 2059, 2070, 2086, 2089, - 2107, 2111, 2115, 2119, 2142, 2146, 2152, 2157, 2164, 2171, - 2179, 2187, 2194, 2205, 2209, 2216, 2217, 2248, 2249, 2253, - 2260, 2266, 2267, 2268, 2269, 2273, 2274, 2275, 2279, 2283, - 2291, 2298, 2299, 2305 + 0, 358, 358, 364, 369, 386, 386, 415, 416, 420, + 423, 429, 435, 444, 448, 452, 462, 463, 472, 475, + 484, 487, 490, 493, 497, 518, 519, 528, 537, 540, + 556, 563, 576, 584, 583, 597, 610, 611, 614, 624, + 630, 631, 634, 639, 646, 647, 651, 662, 667, 674, + 680, 686, 696, 697, 709, 712, 715, 723, 728, 735, + 741, 747, 756, 759, 769, 782, 792, 812, 818, 834, + 840, 848, 857, 868, 872, 879, 886, 894, 905, 910, + 917, 920, 928, 939, 962, 963, 966, 971, 975, 982, + 989, 995, 1002, 1008, 1013, 1020, 1025, 1028, 1035, 1045, + 1046, 1050, 1057, 1067, 1077, 1088, 1098, 1109, 1119, 1130, + 1142, 1143, 1150, 1149, 1158, 1162, 1169, 1173, 1176, 1180, + 1186, 1194, 1203, 1215, 1237, 1244, 1263, 1266, 1272, 1278, + 1284, 1294, 1304, 1310, 1321, 1336, 1344, 1354, 1364, 1374, + 1382, 1404, 1412, 1421, 1425, 1430, 1439, 1443, 1447, 1454, + 1474, 1484, 1485, 1486, 1493, 1493, 1498, 1506, 1511, 1516, + 1520, 1524, 1527, 1533, 1544, 1562, 1566, 1571, 1579, 1588, + 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1610, 1611, 1612, + 1613, 1614, 1615, 1622, 1623, 1624, 1628, 1634, 1647, 1648, + 1652, 1656, 1657, 1658, 1659, 1660, 1664, 1665, 1666, 1667, + 1671, 1672, 1679, 1679, 1680, 1680, 1683, 1684, 1690, 1694, + 1697, 1707, 1710, 1716, 1719, 1725, 1729, 1732, 1738, 1749, + 1750, 1756, 1757, 1763, 1764, 1771, 1772, 1778, 1786, 1794, + 1800, 1806, 1813, 1821, 1829, 1838, 1841, 1844, 1844, 1854, + 1859, 1870, 1873, 1879, 1884, 1889, 1890, 1891, 1892, 1906, + 1910, 1917, 1931, 1934, 1940, 1943, 1949, 1955, 1969, 1970, + 1974, 1977, 1980, 1988, 1989, 1990, 1995, 1994, 2006, 2014, + 2015, 2016, 2017, 2020, 2023, 2032, 2047, 2053, 2059, 2073, + 2084, 2100, 2103, 2121, 2125, 2129, 2133, 2156, 2160, 2166, + 2171, 2178, 2185, 2193, 2201, 2208, 2219, 2223, 2230, 2231, + 2262, 2263, 2267, 2274, 2280, 2281, 2282, 2283, 2287, 2288, + 2289, 2293, 2297, 2305, 2312, 2313, 2319 }; #endif @@ -944,13 +944,13 @@ static const char *const yytname[] = "RestrictedCharacterStringValue", "Opaque", "BasicTypeId", "BasicTypeId_UniverationCompatible", "BasicType", "BasicString", "UnionMark", "IntersectionMark", "optConstraints", "Constraint", - "SubtypeConstraint", "SetOfConstraints", "ElementSetSpecs", - "ElementSetSpec", "Unions", "Intersections", "IntersectionElements", - "ConstraintSubtypeElement", "PatternConstraint", "ConstraintSpec", - "SingleValue", "BitStringValue", "ContainedSubtype", - "InnerTypeConstraint", "WithComponentsList", "WithComponentsElement", - "optPresenceConstraint", "PresenceConstraint", "GeneralConstraint", - "UserDefinedConstraint", "@5", "ContentsConstraint", + "SubtypeConstraint", "SetOfConstraints", "ConstraintSpecs", + "ElementSetSpecs", "ElementSetSpec", "Unions", "Intersections", + "IntersectionElements", "ConstraintSubtypeElement", "@5", + "PatternConstraint", "ConstraintSpec", "SingleValue", "BitStringValue", + "ContainedSubtype", "InnerTypeConstraint", "WithComponentsList", + "WithComponentsElement", "optPresenceConstraint", "PresenceConstraint", + "GeneralConstraint", "UserDefinedConstraint", "@6", "ContentsConstraint", "ConstraintRangeSpec", "TableConstraint", "SimpleTableConstraint", "ComponentRelationConstraint", "AtNotationList", "AtNotationElement", "ComponentIdList", "optMarker", "Marker", "UniverationDefinition", @@ -1005,17 +1005,17 @@ static const yytype_uint8 yyr1[] = 192, 192, 192, 193, 193, 193, 194, 194, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 196, 196, 197, 197, 198, 198, 199, 200, - 200, 201, 201, 202, 202, 202, 202, 202, 203, 203, - 204, 204, 205, 205, 206, 206, 207, 207, 207, 207, - 207, 207, 207, 207, 207, 207, 208, 208, 209, 209, - 210, 210, 210, 210, 210, 210, 211, 211, 212, 213, - 213, 214, 214, 215, 215, 216, 216, 217, 217, 217, - 218, 218, 218, 220, 219, 221, 222, 222, 222, 222, - 223, 223, 224, 225, 226, 226, 227, 227, 228, 228, - 229, 229, 230, 230, 231, 231, 232, 232, 233, 233, - 233, 233, 233, 234, 234, 235, 235, 236, 236, 237, - 238, 239, 239, 239, 239, 240, 240, 240, 241, 241, - 242, 243, 243, 244 + 200, 201, 201, 202, 202, 203, 203, 203, 203, 204, + 204, 205, 205, 206, 206, 207, 207, 208, 208, 208, + 208, 208, 208, 208, 208, 208, 208, 209, 208, 210, + 210, 211, 211, 212, 212, 212, 212, 212, 212, 213, + 213, 214, 215, 215, 216, 216, 217, 217, 218, 218, + 219, 219, 219, 220, 220, 220, 222, 221, 223, 224, + 224, 224, 224, 225, 225, 226, 227, 228, 228, 229, + 229, 230, 230, 231, 231, 232, 232, 233, 233, 234, + 234, 235, 235, 235, 235, 235, 236, 236, 237, 237, + 238, 238, 239, 240, 241, 241, 241, 241, 242, 242, + 242, 243, 243, 244, 245, 245, 246 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -1042,17 +1042,17 @@ static const yytype_uint8 yyr2[] = 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, - 4, 3, 4, 1, 1, 3, 5, 1, 1, 3, - 1, 3, 1, 3, 1, 3, 4, 3, 1, 1, - 3, 3, 3, 3, 1, 1, 2, 2, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 5, 1, 3, 1, 3, 0, 1, 1, 1, 1, - 1, 1, 1, 0, 5, 2, 1, 2, 2, 3, - 1, 1, 3, 4, 1, 3, 2, 3, 1, 3, - 0, 1, 1, 2, 2, 3, 1, 3, 1, 4, - 4, 1, 1, 1, 1, 1, 1, 0, 1, 2, - 4, 0, 1, 1, 1, 0, 1, 1, 1, 1, - 1, 0, 1, 1 + 4, 3, 4, 1, 1, 1, 1, 3, 5, 1, + 3, 1, 3, 1, 3, 1, 3, 4, 3, 1, + 1, 3, 3, 3, 3, 1, 1, 0, 3, 2, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 3, 5, 1, 3, 1, 3, 0, 1, + 1, 1, 1, 1, 1, 1, 0, 5, 2, 1, + 2, 2, 3, 1, 1, 3, 4, 1, 3, 2, + 3, 1, 3, 0, 1, 1, 2, 2, 3, 1, + 3, 1, 4, 4, 1, 1, 1, 1, 1, 1, + 0, 1, 2, 4, 0, 1, 1, 1, 0, 1, + 1, 1, 1, 1, 0, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -1060,8 +1060,8 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 0, 308, 309, 0, 2, 3, 5, 1, 4, 7, - 0, 0, 8, 313, 15, 10, 0, 11, 13, 16, + 0, 311, 312, 0, 2, 3, 5, 1, 4, 7, + 0, 0, 8, 316, 15, 10, 0, 11, 13, 16, 9, 12, 0, 0, 0, 0, 0, 0, 0, 17, 18, 0, 24, 22, 20, 23, 21, 0, 19, 14, 52, 0, 0, 26, 36, 53, 0, 56, 0, 57, @@ -1069,45 +1069,45 @@ static const yytype_uint16 yydefact[] = 39, 0, 41, 42, 0, 47, 49, 51, 188, 0, 189, 190, 191, 192, 193, 201, 194, 195, 196, 197, 198, 199, 200, 27, 28, 32, 30, 31, 35, 0, - 297, 58, 60, 38, 43, 0, 0, 0, 33, 29, - 297, 135, 310, 0, 170, 0, 0, 184, 177, 181, + 300, 58, 60, 38, 43, 0, 0, 0, 33, 29, + 300, 135, 313, 0, 170, 0, 0, 184, 177, 181, 183, 171, 0, 0, 172, 176, 180, 0, 0, 65, - 186, 173, 64, 182, 139, 301, 0, 124, 298, 305, + 186, 173, 64, 182, 139, 304, 0, 124, 301, 308, 44, 48, 50, 34, 0, 68, 67, 0, 185, 179, - 178, 175, 174, 0, 71, 0, 173, 73, 0, 297, - 0, 187, 0, 303, 304, 302, 0, 0, 0, 206, - 307, 306, 299, 45, 46, 0, 136, 138, 0, 0, - 0, 0, 0, 63, 159, 165, 160, 293, 294, 166, + 178, 175, 174, 0, 71, 0, 173, 73, 0, 300, + 0, 187, 0, 306, 307, 305, 0, 0, 0, 206, + 310, 309, 302, 45, 46, 0, 136, 138, 0, 0, + 0, 0, 0, 63, 159, 165, 160, 296, 297, 166, 167, 157, 158, 83, 0, 78, 80, 81, 161, 162, - 82, 292, 284, 0, 286, 291, 288, 144, 145, 140, + 82, 295, 287, 0, 289, 294, 291, 144, 145, 140, 141, 143, 137, 0, 156, 154, 150, 151, 152, 0, 163, 132, 0, 0, 206, 206, 126, 125, 0, 0, - 123, 207, 208, 209, 297, 297, 0, 101, 297, 72, - 77, 76, 75, 74, 246, 247, 296, 0, 0, 297, - 240, 239, 0, 0, 238, 241, 0, 213, 0, 0, - 243, 0, 214, 218, 220, 222, 224, 235, 0, 228, - 244, 229, 234, 217, 260, 262, 261, 270, 271, 295, - 242, 248, 245, 66, 297, 285, 0, 0, 0, 300, - 0, 0, 0, 0, 297, 0, 297, 0, 297, 0, - 0, 0, 0, 149, 146, 0, 282, 280, 280, 280, - 103, 281, 99, 280, 280, 110, 0, 70, 69, 0, - 0, 265, 266, 0, 0, 236, 237, 0, 0, 0, + 123, 207, 208, 209, 300, 300, 0, 101, 300, 72, + 77, 76, 75, 74, 249, 250, 299, 0, 243, 242, + 0, 0, 241, 244, 0, 215, 237, 0, 246, 0, + 216, 219, 221, 223, 225, 236, 0, 229, 247, 230, + 235, 298, 245, 251, 248, 66, 300, 288, 0, 0, + 0, 303, 0, 0, 0, 0, 300, 0, 300, 0, + 300, 0, 0, 0, 300, 237, 0, 213, 214, 263, + 265, 264, 273, 274, 0, 149, 146, 0, 285, 283, + 283, 283, 103, 284, 99, 283, 283, 110, 0, 70, + 69, 0, 269, 0, 0, 239, 240, 0, 0, 0, 0, 62, 0, 202, 203, 0, 204, 205, 0, 0, - 0, 0, 0, 79, 287, 0, 0, 163, 142, 168, - 155, 164, 153, 0, 120, 0, 93, 96, 97, 297, - 134, 0, 0, 85, 86, 92, 280, 297, 311, 0, - 311, 0, 211, 0, 283, 108, 0, 107, 109, 100, - 280, 105, 106, 0, 98, 111, 102, 219, 263, 267, - 268, 233, 231, 249, 0, 272, 227, 215, 221, 223, - 225, 0, 232, 230, 0, 0, 274, 290, 289, 169, - 133, 0, 127, 297, 95, 297, 128, 297, 90, 280, - 297, 312, 129, 297, 210, 212, 147, 148, 104, 0, - 0, 269, 253, 0, 251, 206, 0, 226, 0, 276, - 278, 273, 0, 121, 122, 94, 91, 297, 87, 89, - 124, 124, 112, 264, 250, 0, 255, 216, 277, 0, - 275, 0, 130, 131, 0, 252, 258, 259, 257, 254, - 256, 279, 88, 116, 117, 0, 0, 114, 118, 0, - 113, 115, 119 + 0, 0, 79, 290, 0, 0, 163, 142, 168, 155, + 164, 153, 0, 120, 0, 93, 96, 97, 300, 134, + 0, 0, 85, 86, 92, 283, 300, 314, 0, 314, + 0, 0, 268, 0, 211, 0, 0, 286, 108, 0, + 107, 109, 100, 283, 105, 106, 0, 98, 111, 102, + 220, 270, 271, 234, 232, 252, 0, 238, 228, 217, + 222, 224, 226, 0, 233, 231, 293, 292, 169, 133, + 0, 127, 300, 95, 300, 128, 300, 90, 283, 300, + 315, 129, 300, 210, 266, 275, 0, 0, 277, 212, + 147, 148, 104, 0, 272, 256, 0, 254, 206, 0, + 227, 121, 122, 94, 91, 300, 87, 89, 124, 124, + 0, 0, 279, 281, 276, 0, 112, 253, 0, 258, + 218, 0, 130, 131, 267, 280, 0, 278, 0, 255, + 261, 262, 260, 257, 259, 88, 282, 116, 117, 0, + 0, 114, 118, 0, 113, 115, 119 }; /* YYDEFGOTO[NTERM-NUM]. */ @@ -1116,165 +1116,166 @@ static const yytype_int16 yydefgoto[] = -1, 3, 4, 5, 9, 11, 12, 16, 17, 28, 29, 30, 42, 43, 83, 84, 133, 54, 55, 61, 62, 164, 63, 64, 65, 44, 45, 48, 49, 183, - 85, 118, 86, 143, 144, 184, 185, 352, 353, 354, - 345, 346, 135, 370, 226, 227, 374, 375, 454, 466, - 467, 355, 356, 158, 159, 217, 119, 199, 200, 468, - 298, 299, 87, 206, 280, 207, 208, 250, 340, 120, - 121, 122, 123, 325, 328, 220, 221, 222, 223, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - 262, 423, 424, 459, 460, 263, 264, 420, 265, 314, - 266, 267, 268, 395, 396, 429, 300, 301, 151, 193, - 194, 269, 270, 127, 128, 129, 156, 162, 271, 124, - 410, 272 + 85, 118, 86, 143, 144, 184, 185, 351, 352, 353, + 344, 345, 135, 373, 226, 227, 377, 378, 458, 470, + 471, 354, 355, 158, 159, 217, 119, 199, 200, 472, + 300, 301, 87, 206, 272, 207, 208, 248, 339, 120, + 121, 122, 123, 325, 328, 220, 221, 222, 223, 286, + 287, 250, 251, 252, 253, 254, 319, 255, 256, 257, + 258, 259, 260, 426, 427, 463, 464, 288, 289, 440, + 290, 314, 291, 292, 293, 417, 418, 442, 302, 303, + 151, 193, 194, 261, 262, 127, 128, 129, 156, 162, + 263, 124, 409, 264 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -276 +#define YYPACT_NINF -297 static const yytype_int16 yypact[] = { - 223, -276, -276, 28, 223, -276, -276, -276, -276, -61, - 13, 25, -276, -276, -276, -276, 42, -276, -56, 229, - -276, -276, 90, 54, 32, 64, 129, 79, 193, 229, - -276, 104, -276, -276, -276, -276, -276, 197, -276, -276, - 133, 66, 185, -276, 191, -276, 144, -276, 154, -276, - 176, -276, -276, 196, 524, -276, -276, -276, 237, 149, - -276, 177, 237, -276, -26, -276, 189, -276, -276, 291, - -276, -276, -276, -276, -276, -276, -276, -276, -276, -276, - -276, -276, -276, 524, -276, -276, -276, -276, -276, 272, - 200, -276, -276, -276, -276, 223, 237, 209, -276, -276, - -18, 202, -276, 247, -276, 253, 269, -276, -276, -276, - -276, -276, 296, 261, -276, -276, -276, 692, 356, 255, - -276, 258, -276, -276, 243, 77, 372, -276, -276, 184, - -61, -276, -276, -276, 266, -276, -276, 237, -276, -276, - -276, -276, -276, -64, -276, 262, -276, 263, 267, 99, - 84, -276, 294, -276, -276, -276, 368, 211, 616, -57, - -276, -276, -276, -276, -276, 288, -276, -276, 378, 692, - 237, 237, 399, -276, -276, -276, -276, -276, -276, -276, - -276, -276, -276, -276, 150, -276, -276, -276, -276, -276, - -276, -276, -276, 169, -276, -276, 271, -276, -276, 265, - -276, -276, -276, 268, -276, -276, -276, -276, -276, 270, - 273, 345, 278, 317, 78, 124, -276, -276, 282, 399, - -276, -276, -276, 283, 219, 46, 181, -276, -18, -276, - -276, -276, -276, -276, -276, -276, -276, 293, 366, 200, - -276, -276, 63, 199, -276, -276, 295, -276, 223, 399, - -276, 289, 284, 218, 235, -276, 298, -276, 290, 63, - -276, -276, -276, -276, -276, -276, -276, 309, -276, -276, - -276, -276, -276, -276, 99, -276, 69, 233, 332, -276, - 396, 393, 211, 373, 49, 340, 8, 346, 8, 347, - 399, 307, 399, -276, -276, 211, -276, -8, 110, -8, - -276, -276, 329, 110, -8, 323, 288, -276, -276, 550, - 316, -276, 308, 320, 190, -276, -276, 318, 321, 322, - 319, -276, 325, -276, -276, 550, -276, -276, 550, 550, - 399, 432, 314, -276, -276, 336, 337, -276, -276, -276, - 457, -276, -276, 393, 349, 182, -276, -276, -276, 200, - -276, 390, 355, 357, -276, -276, -8, 200, 393, 359, - 393, 358, -276, 360, -276, -276, 341, -276, -276, -276, - -8, -276, -276, 385, -276, -276, -276, -276, -276, -276, - 354, -276, -276, 283, 74, -276, -276, 362, 235, -276, - -276, 365, -276, -276, 0, 183, -276, -276, -276, -276, - -276, 233, -276, 49, -276, 200, -276, 4, -276, -8, - 200, -276, -276, 200, -276, -276, -276, -276, -276, 369, - 396, -276, -276, 195, -276, -57, 445, -276, 393, 361, - -276, -276, 314, -276, -276, -276, -276, 68, -276, -276, - -276, -276, -276, 457, -276, 74, 159, -276, 361, 393, - -276, 11, -276, -276, 55, -276, -276, -276, -276, -276, - -276, -276, -276, -276, -276, 55, 17, -276, -276, 51, - -276, -276, -276 + 133, -297, -297, 114, 133, -297, -297, -297, -297, -74, + 38, 19, -297, -297, -297, -297, 57, -297, 46, 155, + -297, -297, 152, 137, 119, 131, 156, 136, 232, 155, + -297, 124, -297, -297, -297, -297, -297, 239, -297, -297, + 229, 15, 214, -297, 228, -297, 191, -297, 168, -297, + 193, -297, -297, 175, 549, -297, -297, -297, 207, 198, + -297, 199, 207, -297, -23, -297, 204, -297, -297, 298, + -297, -297, -297, -297, -297, -297, -297, -297, -297, -297, + -297, -297, -297, 549, -297, -297, -297, -297, -297, 385, + 206, -297, -297, -297, -297, 133, 207, 213, -297, -297, + 35, 205, -297, 240, -297, 241, 249, -297, -297, -297, + -297, -297, 272, 243, -297, -297, -297, 702, 330, 224, + -297, 226, -297, -297, 217, 73, 335, -297, -297, -19, + -74, -297, -297, -297, 230, -297, -297, 207, -297, -297, + -297, -297, -297, 69, -297, 223, -297, 225, 234, 94, + 72, -297, 235, -297, -297, -297, 334, 517, 626, -34, + -297, -297, -297, -297, -297, 273, -297, -297, 345, 702, + 207, 207, 488, -297, -297, -297, -297, -297, -297, -297, + -297, -297, -297, -297, 84, -297, -297, -297, -297, -297, + -297, -297, -297, 98, -297, -297, 250, -297, -297, 244, + -297, -297, -297, 245, -297, -297, -297, -297, -297, 247, + 252, 319, 255, 295, 107, 111, -297, -297, 257, 233, + -297, -297, -297, 259, 189, 6, 115, -297, 35, -297, + -297, -297, -297, -297, -297, -297, -297, 269, -297, -297, + 0, 87, -297, -297, 258, -297, -297, 488, -297, 262, + 260, 190, 194, -297, 271, -297, 265, 0, -297, -297, + -297, -297, -297, -297, -297, -297, 94, -297, 82, 221, + 288, -297, 380, 378, 517, 359, 61, 294, 79, 318, + 79, 322, 233, 366, 206, 133, 286, -297, -297, -297, + -297, -297, 290, -297, 233, -297, -297, 517, -297, 1, + -5, 1, -297, -297, 306, -5, 1, 302, 273, -297, + -297, 506, 287, 301, 370, -297, -297, 300, 297, 380, + 304, -297, 311, -297, -297, 506, -297, -297, 506, 506, + 488, 536, -297, -297, 308, 310, -297, -297, -297, 404, + -297, -297, 378, 305, 125, -297, -297, -297, 206, -297, + 338, 315, 312, -297, -297, 1, 206, 378, 323, 378, + 317, 333, -297, 336, -297, 326, 320, -297, -297, 299, + -297, -297, -297, 1, -297, -297, 356, -297, -297, -297, + -297, -297, 328, -297, -297, 259, 11, 404, -297, 346, + 194, -297, -297, 340, -297, -297, -297, -297, -297, -297, + 221, -297, 61, -297, 206, -297, 17, -297, 1, 206, + -297, -297, 206, -297, -297, -297, -1, 162, -297, -297, + -297, -297, -297, 350, -297, -297, 165, -297, -34, 342, + -297, -297, -297, -297, -297, 54, -297, -297, -297, -297, + 380, 378, 344, -297, -297, 326, -297, -297, 11, 126, + -297, 9, -297, -297, 404, 344, 378, -297, 60, -297, + -297, -297, -297, -297, -297, -297, -297, -297, -297, 60, + 55, -297, -297, 36, -297, -297, -297 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -276, -276, -276, 476, -276, -276, 352, -276, 467, -276, - -276, 456, -276, -276, -276, 404, -276, -276, -276, -276, - -276, -276, 426, -276, 394, -276, -276, -276, 431, 343, - -276, 335, -276, -276, 326, -276, 220, 208, 65, 93, - -276, 100, 276, -276, -276, 201, -276, -276, -276, 40, - -275, -270, -87, -276, -74, -276, 221, -276, 232, -148, - 287, 292, -276, -166, -276, -142, -265, -139, 94, -91, - -75, -276, 15, -276, -276, -213, -276, -276, 198, -199, - 92, -276, 194, 188, -165, -276, -276, -227, -276, -276, - -276, -276, 75, -276, -276, -276, -276, -276, -276, 264, - -276, -276, -276, -276, 89, 96, -264, -276, -276, -276, - 250, -128, -276, -195, -276, -276, -276, -276, 5, -276, - 167, -10 + -297, -297, -297, 458, -297, -297, 337, -297, 449, -297, + -297, 441, -297, -297, -297, 388, -297, -297, -297, -297, + -297, -297, 410, -297, 377, -297, -297, -297, 416, 331, + -297, 329, -297, -297, 307, -297, 212, 200, 53, 75, + -297, 88, 261, -297, -297, 183, -297, -297, -297, 23, + -189, -259, -87, -297, -117, -297, 216, -297, 237, -125, + 283, 284, -297, -210, -297, -134, -265, -141, -296, -80, + -72, -297, -36, -297, -297, -213, -297, -297, 177, -82, + -165, 81, -297, 186, 185, -291, -297, -297, -297, -280, + -297, -297, -297, -297, 83, -297, -297, -297, -297, -297, + -297, 279, -297, -297, -297, -297, 92, 97, -188, -297, + -297, -297, 274, -138, -297, -121, -297, -297, -297, -297, + 5, -297, 180, -10 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -281 +#define YYTABLE_NINF -284 static const yytype_int16 yytable[] = { - 18, 287, 289, 126, 201, 6, 18, 187, 437, 6, - 188, 13, 335, 136, 347, 13, 462, 134, 188, 13, - 291, 189, 195, 463, 13, 14, 145, 95, 7, 189, - 218, 51, 295, 365, 367, 368, 197, 198, 464, 371, - 372, 351, 146, 67, 90, 351, 50, 168, 51, 10, - 320, 169, 67, 13, 14, 219, 22, 463, 66, 89, - 13, 463, 186, 50, 293, 294, 19, 66, 296, 88, - 197, 198, 464, 90, 197, 198, 464, 13, 145, 13, - 13, 177, 178, 1, 2, 13, 67, 382, 89, 96, - 46, 361, 408, 363, 146, 13, 177, 178, 88, 125, - 130, 66, 31, 153, 393, 351, 418, 174, 175, 176, - 13, 177, 178, 344, 179, 180, 342, 344, 32, -84, - 428, 125, 147, 33, 15, 125, 407, 167, 470, 364, - 201, 391, 187, 347, 465, 188, 433, 297, 302, 190, - 196, 308, 166, 188, 377, 439, 189, 210, 195, 336, - 295, 181, 311, 20, 189, 34, 188, 202, 344, 154, - 231, 233, 209, 125, 390, 218, 125, 189, 465, 472, - 36, 312, 465, 155, 147, 230, 232, 344, 191, -25, - 47, 456, 41, 422, 313, 125, 296, 186, 286, 35, - 219, 471, 182, 191, 471, 192, 37, 348, 234, 175, - 235, 13, 177, 178, 236, 179, 180, 13, 315, 172, - 13, 218, 446, 1, 2, 440, 125, 39, 441, 174, - 175, 176, 13, 177, 178, 40, 179, 180, 1, 2, - 366, 52, 160, 316, 288, 457, 219, 293, 294, 458, - 1, 2, 240, 161, 13, 177, 178, 23, 13, 60, - 1, 2, 53, 319, 1, 2, 24, 381, 56, 295, - 92, 273, 404, 181, 190, 274, 196, 337, 57, 58, - 409, 341, 210, 434, 349, 100, 357, 25, 357, 26, - 275, 204, 209, 245, 276, 210, 59, 209, 27, 101, - 102, 93, 305, 402, 431, 296, 306, 403, 432, 97, - 209, 103, 68, 104, 182, 105, 444, 224, 225, 98, - 445, 1, 2, 197, 198, 106, 348, 125, 436, 107, - 132, 205, 137, 108, 323, 324, 109, 70, 71, 72, - -280, 317, 318, 400, -280, 138, 125, 110, 73, 326, - 327, 139, 111, 74, 112, 75, 113, 140, 411, 142, - 411, 197, 198, 76, 141, 114, 115, 101, 102, 148, - 416, 417, 77, 152, 78, 149, 452, 453, 150, 79, - 116, 80, 81, 82, 425, 157, 165, 172, 170, 171, - 203, 228, 117, 277, 430, 278, 279, 283, 284, 282, - 281, 337, 285, 349, 290, 292, 309, 357, 310, 322, - 321, 329, 330, 339, 13, 343, 209, 234, 175, 235, - 13, 177, 178, 236, 179, 180, 1, 2, 430, 332, - 362, 358, 360, 237, 369, 373, 378, 357, 380, 379, - 219, 384, 386, 385, 387, 425, 394, 238, 239, 461, - 234, 175, 235, 13, 177, 178, 236, 179, 180, 397, - 398, 240, 241, 234, 175, 235, 13, 177, 178, 236, - 179, 180, 1, 2, 399, 405, 406, 242, 401, 237, - 412, 414, 407, 415, 419, 421, 243, 426, 427, 442, - 8, 449, 163, 21, 240, 38, 244, 99, 94, 91, - 131, 173, 245, 216, 333, 229, 359, 240, 241, 392, - 438, 246, 451, 435, 307, 469, 350, 376, 247, 248, - 338, 249, 303, 242, 443, 383, 389, 304, 447, 388, - 455, 450, 243, 331, 448, 245, 334, 413, 0, 0, - 0, 0, 244, 0, 0, 13, 0, 0, 245, 0, - 0, 1, 2, 0, 0, 0, 0, 246, 0, 0, - 0, 0, 0, 0, 68, 0, 0, 249, 234, 175, - 235, 13, 177, 178, 236, 179, 180, 1, 2, 69, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, - 71, 72, 0, 0, 0, 0, 0, 0, 0, 0, - 73, 0, 0, 0, 0, 74, 0, 75, 0, 0, - 0, 0, 240, 241, 0, 76, 0, 0, 0, 0, - 0, 0, 0, 0, 77, 0, 78, 0, 242, 0, - 0, 79, 0, 80, 81, 82, 0, 243, 0, 0, - 0, 0, 0, 101, 102, 0, 0, 244, 0, 0, - 0, 211, 0, 245, 0, 103, 68, 104, 0, 105, - 212, 0, 246, 0, 0, 0, 0, 0, 0, 106, - 0, 0, 249, 107, 0, 0, 0, 108, 0, 0, + 18, 279, 281, 126, 334, 6, 18, 249, 188, 6, + 13, 189, 195, 136, 465, 187, 188, 346, 88, 189, + 380, 435, 13, 387, 295, 296, 13, 201, 13, 160, + 95, 51, 1, 2, 384, 297, 10, 145, 392, 46, + 161, 297, 467, 67, 90, 146, 50, 88, 51, 13, + 14, 395, 67, 218, 350, 197, 198, 468, 66, 89, + 19, 467, 186, 50, 341, 13, 467, 66, 13, 14, + 134, 298, 13, 90, 197, 198, 468, 298, 219, 197, + 198, 468, 320, 13, 177, 178, 67, 367, 89, 145, + 13, 350, 96, 13, 177, 178, 315, 146, 13, 153, + 130, 66, 174, 175, 176, 13, 177, 178, 312, 179, + 180, 368, 370, 371, 7, 369, 350, 374, 375, 441, + 425, 313, 147, 125, 406, 188, 343, 167, 189, 47, + 195, 335, 187, 188, 125, 431, 189, 299, 304, 190, + 196, 310, 166, 346, 454, 201, 181, 210, 460, 15, + 1, 2, 125, 469, 476, 154, 188, 202, 22, 189, + 231, 233, 209, 343, 31, 393, 474, 407, 20, 155, + 343, 125, 469, 23, 147, 230, 232, 469, 125, 186, + 168, 191, 24, 192, 169, 422, 13, 182, 343, 347, + -84, 191, 1, 2, 218, 265, 125, 362, 218, 266, + 360, 32, 461, 25, 172, 26, 462, 295, 296, 267, + 33, 125, 366, 268, 27, 449, 35, 278, 13, 219, + 437, 280, 34, 219, 1, 2, 307, 36, 60, 297, + 308, 316, 13, 177, 178, 37, 401, 39, 1, 2, + 402, 234, 175, 235, 13, 177, 178, 236, 179, 180, + 1, 2, 1, 2, 197, 198, 190, 237, 196, 336, + 52, 403, 432, 340, 210, 298, 348, 40, 356, 408, + 356, 283, 284, 444, 209, -25, 447, 445, 41, 209, + 448, 475, 57, 58, 475, 238, 239, 210, 438, 53, + 363, 439, 224, 225, 317, 318, 323, 324, 326, 327, + -283, 240, 209, 59, -283, 56, 125, 197, 198, 92, + 241, 101, 102, 93, 97, 347, 98, 434, 420, 421, + 242, 452, 453, 125, 132, 137, 243, 140, 138, 139, + 141, 142, 399, 148, 149, 244, 150, 152, 157, 170, + 165, 171, 245, 285, 172, 247, 203, 410, 228, 410, + 234, 175, 235, 13, 177, 178, 236, 179, 180, 1, + 2, 275, 269, 271, 270, 276, 237, 273, 274, 282, + 277, 294, 311, 321, 329, 322, 428, 330, 234, 175, + 235, 13, 177, 178, 236, 179, 180, 338, 100, 13, + 336, 342, 348, 357, 238, 239, 356, 359, 361, 364, + 365, 372, 101, 102, 376, 209, 443, 386, 381, 382, + 240, 398, 219, 404, 103, 68, 104, 388, 105, 241, + 389, 396, 238, 397, 400, 356, 405, 406, 106, 242, + 413, 443, 107, 419, 411, 243, 108, 383, 428, 109, + 70, 71, 72, 414, 244, 423, 466, 415, 416, 424, + 110, 73, 246, 430, 247, 111, 74, 112, 75, 113, + 446, 429, 8, 243, 456, 21, 76, 163, 114, 115, + 38, 99, 94, 131, 91, 77, 229, 78, 332, 173, + 358, 436, 79, 116, 80, 81, 82, 216, 451, 309, + 433, 379, 473, 349, 385, 117, 234, 175, 235, 13, + 177, 178, 236, 179, 180, 1, 2, 337, 305, 306, + 450, 390, 237, 391, 234, 175, 235, 13, 177, 178, + 236, 179, 180, 1, 2, 174, 175, 176, 13, 177, + 178, 459, 179, 180, 1, 2, 331, 457, 455, 412, + 238, 239, 333, 0, 234, 175, 235, 13, 177, 178, + 236, 179, 180, 0, 0, 0, 240, 0, 238, 239, + 13, 0, 0, 0, 0, 241, 1, 2, 0, 181, + 0, 0, 0, 0, 240, 242, 0, 0, 0, 68, + 0, 243, 0, 241, 0, 0, 0, 204, 238, 0, + 244, 0, 0, 242, 69, 0, 0, 245, 246, 243, + 247, 0, 0, 394, 70, 71, 72, 0, 244, 0, + 182, 0, 0, 0, 0, 73, 246, 0, 247, 0, + 74, 0, 75, 0, 0, 0, 0, 205, 0, 243, + 76, 0, 0, 0, 0, 0, 0, 0, 0, 77, + 0, 78, 0, 101, 102, 0, 79, 0, 80, 81, + 82, 211, 0, 0, 0, 103, 68, 104, 0, 105, + 212, 0, 0, 0, 0, 0, 0, 0, 0, 106, + 0, 0, 0, 107, 0, 0, 0, 108, 0, 0, 109, 70, 71, 72, 0, 0, 0, 0, 0, 213, 0, 110, 73, 0, 0, 0, 111, 74, 112, 75, 113, 0, 0, 0, 0, 0, 0, 76, 0, 114, @@ -1292,73 +1293,74 @@ static const yytype_int16 yytable[] = static const yytype_int16 yycheck[] = { - 10, 214, 215, 90, 152, 0, 16, 149, 4, 4, - 149, 11, 277, 100, 284, 11, 5, 35, 157, 11, - 219, 149, 150, 6, 11, 12, 117, 53, 0, 157, - 87, 41, 40, 297, 298, 299, 19, 20, 21, 303, - 304, 37, 117, 53, 54, 37, 41, 111, 58, 110, - 249, 115, 62, 11, 12, 112, 112, 6, 53, 54, - 11, 6, 149, 58, 18, 19, 41, 62, 76, 54, - 19, 20, 21, 83, 19, 20, 21, 11, 169, 11, - 11, 12, 13, 17, 18, 11, 96, 314, 83, 115, - 24, 290, 356, 292, 169, 11, 12, 13, 83, 117, - 95, 96, 12, 26, 331, 37, 370, 8, 9, 10, - 11, 12, 13, 109, 15, 16, 282, 109, 64, 111, - 120, 117, 117, 91, 111, 117, 115, 137, 111, 295, - 278, 330, 274, 403, 117, 274, 401, 224, 225, 149, - 150, 228, 137, 282, 309, 409, 274, 157, 276, 277, - 40, 52, 239, 111, 282, 91, 295, 152, 109, 82, - 170, 171, 157, 117, 329, 87, 117, 295, 117, 118, - 91, 108, 117, 96, 169, 170, 171, 109, 109, 46, - 114, 22, 49, 109, 121, 117, 76, 274, 110, 60, - 112, 466, 93, 109, 469, 111, 3, 284, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 11, 9, 110, - 11, 87, 425, 17, 18, 410, 117, 113, 413, 8, - 9, 10, 11, 12, 13, 28, 15, 16, 17, 18, - 120, 46, 48, 243, 110, 76, 112, 18, 19, 80, - 17, 18, 52, 59, 11, 12, 13, 18, 11, 53, - 17, 18, 61, 248, 17, 18, 27, 67, 114, 40, - 111, 111, 349, 52, 274, 115, 276, 277, 114, 115, - 357, 281, 282, 401, 284, 3, 286, 48, 288, 50, - 111, 70, 277, 93, 115, 295, 110, 282, 59, 17, - 18, 114, 111, 111, 111, 76, 115, 115, 115, 110, - 295, 29, 30, 31, 93, 33, 111, 19, 20, 18, - 115, 17, 18, 19, 20, 43, 403, 117, 405, 47, - 111, 110, 120, 51, 106, 107, 54, 55, 56, 57, - 111, 36, 37, 343, 115, 88, 117, 65, 66, 104, - 105, 88, 70, 71, 72, 73, 74, 78, 358, 88, - 360, 19, 20, 81, 58, 83, 84, 17, 18, 3, - 19, 20, 90, 120, 92, 110, 440, 441, 110, 97, - 98, 99, 100, 101, 384, 3, 110, 110, 116, 116, - 12, 3, 110, 112, 394, 120, 118, 42, 110, 116, - 120, 401, 75, 403, 112, 112, 103, 407, 32, 115, - 111, 103, 112, 7, 11, 32, 401, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 428, 110, - 113, 75, 75, 24, 95, 102, 110, 437, 108, 121, - 112, 110, 113, 111, 109, 445, 122, 38, 39, 449, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 113, - 113, 52, 53, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 7, 75, 111, 68, 119, 24, - 111, 113, 115, 113, 89, 121, 77, 115, 113, 110, - 4, 120, 130, 16, 52, 29, 87, 83, 62, 58, - 96, 148, 93, 158, 274, 169, 288, 52, 53, 67, - 407, 102, 437, 403, 228, 465, 285, 306, 109, 110, - 278, 112, 225, 68, 420, 317, 328, 225, 426, 325, - 445, 432, 77, 259, 428, 93, 276, 360, -1, -1, - -1, -1, 87, -1, -1, 11, -1, -1, 93, -1, - -1, 17, 18, -1, -1, -1, -1, 102, -1, -1, - -1, -1, -1, -1, 30, -1, -1, 112, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 45, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, - 56, 57, -1, -1, -1, -1, -1, -1, -1, -1, - 66, -1, -1, -1, -1, 71, -1, 73, -1, -1, - -1, -1, 52, 53, -1, 81, -1, -1, -1, -1, - -1, -1, -1, -1, 90, -1, 92, -1, 68, -1, - -1, 97, -1, 99, 100, 101, -1, 77, -1, -1, - -1, -1, -1, 17, 18, -1, -1, 87, -1, -1, - -1, 25, -1, 93, -1, 29, 30, 31, -1, 33, - 34, -1, 102, -1, -1, -1, -1, -1, -1, 43, - -1, -1, 112, 47, -1, -1, -1, 51, -1, -1, + 10, 214, 215, 90, 269, 0, 16, 172, 149, 4, + 11, 149, 150, 100, 5, 149, 157, 276, 54, 157, + 311, 4, 11, 319, 18, 19, 11, 152, 11, 48, + 53, 41, 17, 18, 314, 40, 110, 117, 329, 24, + 59, 40, 6, 53, 54, 117, 41, 83, 58, 11, + 12, 331, 62, 87, 37, 19, 20, 21, 53, 54, + 41, 6, 149, 58, 274, 11, 6, 62, 11, 12, + 35, 76, 11, 83, 19, 20, 21, 76, 112, 19, + 20, 21, 247, 11, 12, 13, 96, 297, 83, 169, + 11, 37, 115, 11, 12, 13, 9, 169, 11, 26, + 95, 96, 8, 9, 10, 11, 12, 13, 108, 15, + 16, 299, 300, 301, 0, 120, 37, 305, 306, 120, + 109, 121, 117, 117, 115, 266, 109, 137, 266, 114, + 268, 269, 266, 274, 117, 400, 274, 224, 225, 149, + 150, 228, 137, 402, 440, 270, 52, 157, 22, 111, + 17, 18, 117, 117, 118, 82, 297, 152, 112, 297, + 170, 171, 157, 109, 12, 330, 111, 355, 111, 96, + 109, 117, 117, 18, 169, 170, 171, 117, 117, 266, + 111, 109, 27, 111, 115, 373, 11, 93, 109, 276, + 111, 109, 17, 18, 87, 111, 117, 284, 87, 115, + 282, 64, 76, 48, 110, 50, 80, 18, 19, 111, + 91, 117, 294, 115, 59, 428, 60, 110, 11, 112, + 408, 110, 91, 112, 17, 18, 111, 91, 53, 40, + 115, 241, 11, 12, 13, 3, 111, 113, 17, 18, + 115, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 17, 18, 19, 20, 266, 24, 268, 269, + 46, 348, 400, 273, 274, 76, 276, 28, 278, 356, + 280, 38, 39, 111, 269, 46, 111, 115, 49, 274, + 115, 470, 114, 115, 473, 52, 53, 297, 409, 61, + 285, 412, 19, 20, 36, 37, 106, 107, 104, 105, + 111, 68, 297, 110, 115, 114, 117, 19, 20, 111, + 77, 17, 18, 114, 110, 402, 18, 404, 19, 20, + 87, 438, 439, 117, 111, 120, 93, 78, 88, 88, + 58, 88, 342, 3, 110, 102, 110, 120, 3, 116, + 110, 116, 109, 110, 110, 112, 12, 357, 3, 359, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 42, 112, 118, 120, 110, 24, 120, 116, 112, + 75, 112, 103, 111, 103, 115, 386, 112, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 7, 3, 11, + 400, 32, 402, 75, 52, 53, 406, 75, 32, 113, + 110, 95, 17, 18, 102, 400, 416, 110, 121, 108, + 68, 7, 112, 75, 29, 30, 31, 113, 33, 77, + 109, 113, 52, 113, 119, 435, 111, 115, 43, 87, + 113, 441, 47, 113, 111, 93, 51, 67, 448, 54, + 55, 56, 57, 110, 102, 89, 456, 111, 122, 121, + 65, 66, 110, 113, 112, 70, 71, 72, 73, 74, + 110, 115, 4, 93, 120, 16, 81, 130, 83, 84, + 29, 83, 62, 96, 58, 90, 169, 92, 266, 148, + 280, 406, 97, 98, 99, 100, 101, 158, 435, 228, + 402, 308, 469, 277, 317, 110, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 270, 225, 225, + 429, 325, 24, 328, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 8, 9, 10, 11, 12, + 13, 448, 15, 16, 17, 18, 257, 445, 441, 359, + 52, 53, 268, -1, 8, 9, 10, 11, 12, 13, + 14, 15, 16, -1, -1, -1, 68, -1, 52, 53, + 11, -1, -1, -1, -1, 77, 17, 18, -1, 52, + -1, -1, -1, -1, 68, 87, -1, -1, -1, 30, + -1, 93, -1, 77, -1, -1, -1, 70, 52, -1, + 102, -1, -1, 87, 45, -1, -1, 109, 110, 93, + 112, -1, -1, 67, 55, 56, 57, -1, 102, -1, + 93, -1, -1, -1, -1, 66, 110, -1, 112, -1, + 71, -1, 73, -1, -1, -1, -1, 110, -1, 93, + 81, -1, -1, -1, -1, -1, -1, -1, -1, 90, + -1, 92, -1, 17, 18, -1, 97, -1, 99, 100, + 101, 25, -1, -1, -1, 29, 30, 31, -1, 33, + 34, -1, -1, -1, -1, -1, -1, -1, -1, 43, + -1, -1, -1, 47, -1, -1, -1, 51, -1, -1, 54, 55, 56, 57, -1, -1, -1, -1, -1, 63, -1, 65, 66, -1, -1, -1, 70, 71, 72, 73, 74, -1, -1, -1, -1, -1, -1, 81, -1, 83, @@ -1378,54 +1380,54 @@ static const yytype_int16 yycheck[] = symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 17, 18, 124, 125, 126, 241, 0, 126, 127, - 110, 128, 129, 11, 12, 111, 130, 131, 244, 41, + 0, 17, 18, 124, 125, 126, 243, 0, 126, 127, + 110, 128, 129, 11, 12, 111, 130, 131, 246, 41, 111, 131, 112, 18, 27, 48, 50, 59, 132, 133, 134, 12, 64, 91, 91, 60, 91, 3, 134, 113, 28, 49, 135, 136, 148, 149, 24, 114, 150, 151, - 241, 244, 46, 61, 140, 141, 114, 114, 115, 110, - 53, 142, 143, 145, 146, 147, 241, 244, 30, 45, + 243, 246, 46, 61, 140, 141, 114, 114, 115, 110, + 53, 142, 143, 145, 146, 147, 243, 246, 30, 45, 55, 56, 57, 66, 71, 73, 81, 90, 92, 97, - 99, 100, 101, 137, 138, 153, 155, 185, 195, 241, - 244, 151, 111, 114, 145, 53, 115, 110, 18, 138, + 99, 100, 101, 137, 138, 153, 155, 185, 195, 243, + 246, 151, 111, 114, 145, 53, 115, 110, 18, 138, 3, 17, 18, 29, 31, 33, 43, 47, 51, 54, 65, 70, 72, 74, 83, 84, 98, 110, 154, 179, - 192, 193, 194, 195, 242, 117, 175, 236, 237, 238, - 241, 147, 111, 139, 35, 165, 175, 120, 88, 88, - 78, 58, 88, 156, 157, 192, 193, 241, 3, 110, - 110, 231, 120, 26, 82, 96, 239, 3, 176, 177, - 48, 59, 240, 129, 144, 110, 241, 244, 111, 115, + 192, 193, 194, 195, 244, 117, 175, 238, 239, 240, + 243, 147, 111, 139, 35, 165, 175, 120, 88, 88, + 78, 58, 88, 156, 157, 192, 193, 243, 3, 110, + 110, 233, 120, 26, 82, 96, 241, 3, 176, 177, + 48, 59, 242, 129, 144, 110, 243, 246, 111, 115, 116, 116, 110, 152, 8, 9, 10, 12, 13, 15, - 16, 52, 93, 152, 158, 159, 175, 188, 190, 234, - 244, 109, 111, 232, 233, 234, 244, 19, 20, 180, - 181, 182, 241, 12, 70, 110, 186, 188, 189, 241, - 244, 25, 34, 63, 85, 86, 154, 178, 87, 112, + 16, 52, 93, 152, 158, 159, 175, 188, 190, 236, + 246, 109, 111, 234, 235, 236, 246, 19, 20, 180, + 181, 182, 243, 12, 70, 110, 186, 188, 189, 243, + 246, 25, 34, 63, 85, 86, 154, 178, 87, 112, 198, 199, 200, 201, 19, 20, 167, 168, 3, 157, - 241, 244, 241, 244, 8, 10, 14, 24, 38, 39, - 52, 53, 68, 77, 87, 93, 102, 109, 110, 112, - 190, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 218, 219, 221, 223, 224, 225, 234, - 235, 241, 244, 111, 115, 111, 115, 112, 120, 118, - 187, 120, 116, 42, 110, 75, 110, 198, 110, 198, - 112, 202, 112, 18, 19, 40, 76, 175, 183, 184, - 229, 230, 175, 183, 184, 111, 115, 165, 175, 103, - 32, 175, 108, 121, 222, 9, 244, 36, 37, 241, - 202, 111, 115, 106, 107, 196, 104, 105, 197, 103, - 112, 222, 110, 159, 233, 189, 234, 244, 181, 7, - 191, 244, 186, 32, 109, 163, 164, 174, 175, 244, - 179, 37, 160, 161, 162, 174, 175, 244, 75, 160, - 75, 202, 113, 202, 186, 229, 120, 229, 229, 95, - 166, 229, 229, 102, 169, 170, 168, 207, 110, 121, - 108, 67, 210, 201, 110, 111, 113, 109, 205, 206, - 207, 202, 67, 210, 122, 226, 227, 113, 113, 7, - 244, 119, 111, 115, 175, 75, 111, 115, 229, 175, - 243, 244, 111, 243, 113, 113, 19, 20, 229, 89, - 220, 121, 109, 214, 215, 244, 115, 113, 120, 228, - 244, 111, 115, 189, 234, 164, 175, 4, 162, 229, - 236, 236, 110, 191, 111, 115, 198, 203, 228, 120, - 227, 161, 177, 177, 171, 215, 22, 76, 80, 216, - 217, 244, 5, 6, 21, 117, 172, 173, 182, 172, - 111, 173, 118 + 243, 246, 243, 246, 8, 10, 14, 24, 52, 53, + 68, 77, 87, 93, 102, 109, 110, 112, 190, 203, + 204, 205, 206, 207, 208, 210, 211, 212, 213, 214, + 215, 236, 237, 243, 246, 111, 115, 111, 115, 112, + 120, 118, 187, 120, 116, 42, 110, 75, 110, 198, + 110, 198, 112, 38, 39, 110, 202, 203, 220, 221, + 223, 225, 226, 227, 112, 18, 19, 40, 76, 175, + 183, 184, 231, 232, 175, 183, 184, 111, 115, 165, + 175, 103, 108, 121, 224, 9, 246, 36, 37, 209, + 203, 111, 115, 106, 107, 196, 104, 105, 197, 103, + 112, 224, 159, 235, 189, 236, 246, 181, 7, 191, + 246, 186, 32, 109, 163, 164, 174, 175, 246, 179, + 37, 160, 161, 162, 174, 175, 246, 75, 160, 75, + 202, 32, 175, 243, 113, 110, 202, 186, 231, 120, + 231, 231, 95, 166, 231, 231, 102, 169, 170, 168, + 208, 121, 108, 67, 212, 201, 110, 191, 113, 109, + 206, 207, 208, 203, 67, 212, 113, 113, 7, 246, + 119, 111, 115, 175, 75, 111, 115, 231, 175, 245, + 246, 111, 245, 113, 110, 111, 122, 228, 229, 113, + 19, 20, 231, 89, 121, 109, 216, 217, 246, 115, + 113, 189, 236, 164, 175, 4, 162, 231, 238, 238, + 222, 120, 230, 246, 111, 115, 110, 111, 115, 198, + 204, 161, 177, 177, 191, 230, 120, 229, 171, 217, + 22, 76, 80, 218, 219, 5, 246, 6, 21, 117, + 172, 173, 182, 172, 111, 173, 118 }; #define yyerrok (yyerrstatus = 0) @@ -1499,7 +1501,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -2240,14 +2242,14 @@ yyparse () switch (yyn) { case 2: -#line 357 "asn1p_y.y" +#line 358 "asn1p_y.y" { *(void **)param = (yyvsp[(1) - (1)].a_grammar); } break; case 3: -#line 363 "asn1p_y.y" +#line 364 "asn1p_y.y" { (yyval.a_grammar) = asn1p_new(); checkmem((yyval.a_grammar)); @@ -2256,7 +2258,7 @@ yyparse () break; case 4: -#line 368 "asn1p_y.y" +#line 369 "asn1p_y.y" { (yyval.a_grammar) = (yyvsp[(1) - (2)].a_grammar); TQ_ADD(&((yyval.a_grammar)->modules), (yyvsp[(2) - (2)].a_module), mod_next); @@ -2264,12 +2266,12 @@ yyparse () break; case 5: -#line 385 "asn1p_y.y" +#line 386 "asn1p_y.y" { currentModule = asn1p_module_new(); } break; case 6: -#line 390 "asn1p_y.y" +#line 391 "asn1p_y.y" { (yyval.a_module) = currentModule; @@ -2290,31 +2292,31 @@ yyparse () break; case 7: -#line 414 "asn1p_y.y" +#line 415 "asn1p_y.y" { (yyval.a_oid) = 0; } break; case 8: -#line 415 "asn1p_y.y" +#line 416 "asn1p_y.y" { (yyval.a_oid) = (yyvsp[(1) - (1)].a_oid); } break; case 9: -#line 419 "asn1p_y.y" +#line 420 "asn1p_y.y" { (yyval.a_oid) = (yyvsp[(2) - (3)].a_oid); } break; case 10: -#line 422 "asn1p_y.y" +#line 423 "asn1p_y.y" { (yyval.a_oid) = 0; } break; case 11: -#line 428 "asn1p_y.y" +#line 429 "asn1p_y.y" { (yyval.a_oid) = asn1p_oid_new(); asn1p_oid_add_arc((yyval.a_oid), &(yyvsp[(1) - (1)].a_oid_arc)); @@ -2324,7 +2326,7 @@ yyparse () break; case 12: -#line 434 "asn1p_y.y" +#line 435 "asn1p_y.y" { (yyval.a_oid) = (yyvsp[(1) - (2)].a_oid); asn1p_oid_add_arc((yyval.a_oid), &(yyvsp[(2) - (2)].a_oid_arc)); @@ -2334,7 +2336,7 @@ yyparse () break; case 13: -#line 443 "asn1p_y.y" +#line 444 "asn1p_y.y" { /* iso */ (yyval.a_oid_arc).name = (yyvsp[(1) - (1)].tv_str); (yyval.a_oid_arc).number = -1; @@ -2342,7 +2344,7 @@ yyparse () break; case 14: -#line 447 "asn1p_y.y" +#line 448 "asn1p_y.y" { /* iso(1) */ (yyval.a_oid_arc).name = (yyvsp[(1) - (4)].tv_str); (yyval.a_oid_arc).number = (yyvsp[(3) - (4)].a_int); @@ -2350,7 +2352,7 @@ yyparse () break; case 15: -#line 451 "asn1p_y.y" +#line 452 "asn1p_y.y" { /* 1 */ (yyval.a_oid_arc).name = 0; (yyval.a_oid_arc).number = (yyvsp[(1) - (1)].a_int); @@ -2358,61 +2360,61 @@ yyparse () break; case 16: -#line 461 "asn1p_y.y" +#line 462 "asn1p_y.y" { (yyval.a_module_flags) = MSF_NOFLAGS; } break; case 17: -#line 462 "asn1p_y.y" +#line 463 "asn1p_y.y" { (yyval.a_module_flags) = (yyvsp[(1) - (1)].a_module_flags); } break; case 18: -#line 471 "asn1p_y.y" +#line 472 "asn1p_y.y" { (yyval.a_module_flags) = (yyvsp[(1) - (1)].a_module_flags); } break; case 19: -#line 474 "asn1p_y.y" +#line 475 "asn1p_y.y" { (yyval.a_module_flags) = (yyvsp[(1) - (2)].a_module_flags) | (yyvsp[(2) - (2)].a_module_flags); } break; case 20: -#line 483 "asn1p_y.y" +#line 484 "asn1p_y.y" { (yyval.a_module_flags) = MSF_EXPLICIT_TAGS; } break; case 21: -#line 486 "asn1p_y.y" +#line 487 "asn1p_y.y" { (yyval.a_module_flags) = MSF_IMPLICIT_TAGS; } break; case 22: -#line 489 "asn1p_y.y" +#line 490 "asn1p_y.y" { (yyval.a_module_flags) = MSF_AUTOMATIC_TAGS; } break; case 23: -#line 492 "asn1p_y.y" +#line 493 "asn1p_y.y" { (yyval.a_module_flags) = MSF_EXTENSIBILITY_IMPLIED; } break; case 24: -#line 496 "asn1p_y.y" +#line 497 "asn1p_y.y" { /* X.680Amd1 specifies TAG and XER */ if(strcmp((yyvsp[(1) - (2)].tv_str), "TAG") == 0) { @@ -2431,19 +2433,19 @@ yyparse () break; case 25: -#line 517 "asn1p_y.y" +#line 518 "asn1p_y.y" { (yyval.a_module) = 0; } break; case 26: -#line 518 "asn1p_y.y" +#line 519 "asn1p_y.y" { (yyval.a_module) = (yyvsp[(1) - (1)].a_module); } break; case 27: -#line 527 "asn1p_y.y" +#line 528 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); AL_IMPORT((yyval.a_module), exports, (yyvsp[(1) - (3)].a_module), xp_next); @@ -2453,14 +2455,14 @@ yyparse () break; case 28: -#line 536 "asn1p_y.y" +#line 537 "asn1p_y.y" { (yyval.a_module) = (yyvsp[(1) - (1)].a_module); } break; case 29: -#line 539 "asn1p_y.y" +#line 540 "asn1p_y.y" { if((yyvsp[(1) - (2)].a_module)) { (yyval.a_module) = (yyvsp[(1) - (2)].a_module); @@ -2473,7 +2475,7 @@ yyparse () break; case 30: -#line 555 "asn1p_y.y" +#line 556 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); checkmem((yyval.a_module)); @@ -2484,7 +2486,7 @@ yyparse () break; case 31: -#line 562 "asn1p_y.y" +#line 563 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); checkmem((yyval.a_module)); @@ -2495,7 +2497,7 @@ yyparse () break; case 32: -#line 575 "asn1p_y.y" +#line 576 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); checkmem((yyval.a_module)); @@ -2506,12 +2508,12 @@ yyparse () break; case 33: -#line 583 "asn1p_y.y" +#line 584 "asn1p_y.y" { asn1p_lexer_hack_push_encoding_control(); } break; case 34: -#line 584 "asn1p_y.y" +#line 585 "asn1p_y.y" { fprintf(stderr, "WARNING: ENCODING-CONTROL %s " @@ -2523,7 +2525,7 @@ yyparse () break; case 35: -#line 596 "asn1p_y.y" +#line 597 "asn1p_y.y" { return yyerror( "Attempt to redefine a standard basic string type, " @@ -2532,12 +2534,12 @@ yyparse () break; case 36: -#line 609 "asn1p_y.y" +#line 610 "asn1p_y.y" { (yyval.a_module) = 0; } break; case 38: -#line 613 "asn1p_y.y" +#line 614 "asn1p_y.y" { if(!saved_aid && 0) return yyerror("Unterminated IMPORTS FROM, " @@ -2548,19 +2550,19 @@ yyparse () break; case 39: -#line 623 "asn1p_y.y" +#line 624 "asn1p_y.y" { return yyerror("Empty IMPORTS list"); } break; case 40: -#line 629 "asn1p_y.y" +#line 630 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); } break; case 42: -#line 633 "asn1p_y.y" +#line 634 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); checkmem((yyval.a_module)); @@ -2569,7 +2571,7 @@ yyparse () break; case 43: -#line 638 "asn1p_y.y" +#line 639 "asn1p_y.y" { (yyval.a_module) = (yyvsp[(1) - (2)].a_module); TQ_ADD(&((yyval.a_module)->imports), (yyvsp[(2) - (2)].a_xports), xp_next); @@ -2577,17 +2579,17 @@ yyparse () break; case 44: -#line 645 "asn1p_y.y" +#line 646 "asn1p_y.y" { memset(&(yyval.a_aid), 0, sizeof((yyval.a_aid))); } break; case 45: -#line 646 "asn1p_y.y" +#line 647 "asn1p_y.y" { (yyval.a_aid).oid = (yyvsp[(1) - (1)].a_oid); } break; case 46: -#line 650 "asn1p_y.y" +#line 651 "asn1p_y.y" { (yyval.a_xports) = (yyvsp[(1) - (4)].a_xports); (yyval.a_xports)->fromModuleName = (yyvsp[(3) - (4)].tv_str); @@ -2599,7 +2601,7 @@ yyparse () break; case 47: -#line 661 "asn1p_y.y" +#line 662 "asn1p_y.y" { (yyval.a_xports) = asn1p_xports_new(); checkmem((yyval.a_xports)); @@ -2608,7 +2610,7 @@ yyparse () break; case 48: -#line 666 "asn1p_y.y" +#line 667 "asn1p_y.y" { (yyval.a_xports) = (yyvsp[(1) - (3)].a_xports); TQ_ADD(&((yyval.a_xports)->members), (yyvsp[(3) - (3)].a_expr), next); @@ -2616,7 +2618,7 @@ yyparse () break; case 49: -#line 673 "asn1p_y.y" +#line 674 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -2626,7 +2628,7 @@ yyparse () break; case 50: -#line 679 "asn1p_y.y" +#line 680 "asn1p_y.y" { /* Completely equivalent to above */ (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -2636,7 +2638,7 @@ yyparse () break; case 51: -#line 685 "asn1p_y.y" +#line 686 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -2646,12 +2648,12 @@ yyparse () break; case 52: -#line 695 "asn1p_y.y" +#line 696 "asn1p_y.y" { (yyval.a_module) = 0; } break; case 53: -#line 696 "asn1p_y.y" +#line 697 "asn1p_y.y" { (yyval.a_module) = asn1p_module_new(); checkmem((yyval.a_module)); @@ -2664,21 +2666,21 @@ yyparse () break; case 54: -#line 708 "asn1p_y.y" +#line 709 "asn1p_y.y" { (yyval.a_xports) = (yyvsp[(2) - (3)].a_xports); } break; case 55: -#line 711 "asn1p_y.y" +#line 712 "asn1p_y.y" { (yyval.a_xports) = 0; } break; case 56: -#line 714 "asn1p_y.y" +#line 715 "asn1p_y.y" { /* Empty EXPORTS clause effectively prohibits export. */ (yyval.a_xports) = asn1p_xports_new(); @@ -2687,7 +2689,7 @@ yyparse () break; case 57: -#line 722 "asn1p_y.y" +#line 723 "asn1p_y.y" { (yyval.a_xports) = asn1p_xports_new(); assert((yyval.a_xports)); @@ -2696,7 +2698,7 @@ yyparse () break; case 58: -#line 727 "asn1p_y.y" +#line 728 "asn1p_y.y" { (yyval.a_xports) = (yyvsp[(1) - (3)].a_xports); TQ_ADD(&((yyval.a_xports)->members), (yyvsp[(3) - (3)].a_expr), next); @@ -2704,7 +2706,7 @@ yyparse () break; case 59: -#line 734 "asn1p_y.y" +#line 735 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -2714,7 +2716,7 @@ yyparse () break; case 60: -#line 740 "asn1p_y.y" +#line 741 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -2724,7 +2726,7 @@ yyparse () break; case 61: -#line 746 "asn1p_y.y" +#line 747 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -2734,12 +2736,12 @@ yyparse () break; case 62: -#line 755 "asn1p_y.y" +#line 756 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(2) - (3)].a_constr); } break; case 63: -#line 758 "asn1p_y.y" +#line 759 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (4)].a_expr); assert((yyval.a_expr)->Identifier == 0); @@ -2750,14 +2752,14 @@ yyparse () break; case 64: -#line 768 "asn1p_y.y" +#line 769 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); } break; case 65: -#line 781 "asn1p_y.y" +#line 782 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -2768,7 +2770,7 @@ yyparse () break; case 66: -#line 791 "asn1p_y.y" +#line 792 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -2780,7 +2782,7 @@ yyparse () break; case 67: -#line 811 "asn1p_y.y" +#line 812 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(3) - (3)].a_expr); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); @@ -2790,7 +2792,7 @@ yyparse () break; case 68: -#line 817 "asn1p_y.y" +#line 818 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(3) - (3)].a_expr); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); @@ -2800,7 +2802,7 @@ yyparse () break; case 69: -#line 833 "asn1p_y.y" +#line 834 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(6) - (6)].a_expr); (yyval.a_expr)->Identifier = (yyvsp[(1) - (6)].tv_str); @@ -2809,7 +2811,7 @@ yyparse () break; case 70: -#line 839 "asn1p_y.y" +#line 840 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(6) - (6)].a_expr); (yyval.a_expr)->Identifier = (yyvsp[(1) - (6)].tv_str); @@ -2818,7 +2820,7 @@ yyparse () break; case 71: -#line 847 "asn1p_y.y" +#line 848 "asn1p_y.y" { int ret; (yyval.a_plist) = asn1p_paramlist_new(yylineno); @@ -2831,7 +2833,7 @@ yyparse () break; case 72: -#line 856 "asn1p_y.y" +#line 857 "asn1p_y.y" { int ret; (yyval.a_plist) = (yyvsp[(1) - (3)].a_plist); @@ -2843,7 +2845,7 @@ yyparse () break; case 73: -#line 867 "asn1p_y.y" +#line 868 "asn1p_y.y" { (yyval.a_parg).governor = NULL; (yyval.a_parg).argument = (yyvsp[(1) - (1)].tv_str); @@ -2851,7 +2853,7 @@ yyparse () break; case 74: -#line 871 "asn1p_y.y" +#line 872 "asn1p_y.y" { int ret; (yyval.a_parg).governor = asn1p_ref_new(yylineno); @@ -2862,7 +2864,7 @@ yyparse () break; case 75: -#line 878 "asn1p_y.y" +#line 879 "asn1p_y.y" { int ret; (yyval.a_parg).governor = asn1p_ref_new(yylineno); @@ -2873,7 +2875,7 @@ yyparse () break; case 76: -#line 885 "asn1p_y.y" +#line 886 "asn1p_y.y" { int ret; (yyval.a_parg).governor = asn1p_ref_new(yylineno); @@ -2885,7 +2887,7 @@ yyparse () break; case 77: -#line 893 "asn1p_y.y" +#line 894 "asn1p_y.y" { int ret; (yyval.a_parg).governor = asn1p_ref_new(yylineno); @@ -2897,7 +2899,7 @@ yyparse () break; case 78: -#line 904 "asn1p_y.y" +#line 905 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -2906,7 +2908,7 @@ yyparse () break; case 79: -#line 909 "asn1p_y.y" +#line 910 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); @@ -2914,14 +2916,14 @@ yyparse () break; case 80: -#line 916 "asn1p_y.y" +#line 917 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); } break; case 81: -#line 919 "asn1p_y.y" +#line 920 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -2933,7 +2935,7 @@ yyparse () break; case 82: -#line 927 "asn1p_y.y" +#line 928 "asn1p_y.y" { asn1p_ref_t *ref; (yyval.a_expr) = NEW_EXPR(); @@ -2948,7 +2950,7 @@ yyparse () break; case 83: -#line 938 "asn1p_y.y" +#line 939 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); (yyval.a_expr)->expr_type = A1TC_VALUESET; @@ -2958,17 +2960,17 @@ yyparse () break; case 84: -#line 961 "asn1p_y.y" +#line 962 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); } break; case 85: -#line 962 "asn1p_y.y" +#line 963 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); } break; case 86: -#line 965 "asn1p_y.y" +#line 966 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -2977,7 +2979,7 @@ yyparse () break; case 87: -#line 970 "asn1p_y.y" +#line 971 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); @@ -2985,7 +2987,7 @@ yyparse () break; case 88: -#line 974 "asn1p_y.y" +#line 975 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (5)].a_expr); asn1p_expr_add_many((yyval.a_expr), (yyvsp[(4) - (5)].a_expr)); @@ -2993,7 +2995,7 @@ yyparse () break; case 89: -#line 981 "asn1p_y.y" +#line 982 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (3)].a_expr); assert((yyval.a_expr)->Identifier == 0); @@ -3004,7 +3006,7 @@ yyparse () break; case 90: -#line 988 "asn1p_y.y" +#line 989 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (2)].a_expr); (yyvsp[(2) - (2)].a_marker).flags |= (yyval.a_expr)->marker.flags; @@ -3014,7 +3016,7 @@ yyparse () break; case 91: -#line 994 "asn1p_y.y" +#line 995 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3025,14 +3027,14 @@ yyparse () break; case 92: -#line 1001 "asn1p_y.y" +#line 1002 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); } break; case 93: -#line 1007 "asn1p_y.y" +#line 1008 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3041,7 +3043,7 @@ yyparse () break; case 94: -#line 1012 "asn1p_y.y" +#line 1013 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); @@ -3049,7 +3051,7 @@ yyparse () break; case 95: -#line 1019 "asn1p_y.y" +#line 1020 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (2)].a_expr); assert((yyval.a_expr)->Identifier == 0); @@ -3058,14 +3060,14 @@ yyparse () break; case 96: -#line 1024 "asn1p_y.y" +#line 1025 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); } break; case 97: -#line 1027 "asn1p_y.y" +#line 1028 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); _fixup_anonymous_identifier((yyval.a_expr)); @@ -3073,7 +3075,7 @@ yyparse () break; case 98: -#line 1034 "asn1p_y.y" +#line 1035 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(3) - (5)].a_expr); checkmem((yyval.a_expr)); @@ -3084,17 +3086,17 @@ yyparse () break; case 99: -#line 1044 "asn1p_y.y" +#line 1045 "asn1p_y.y" { (yyval.a_int) = 0; } break; case 100: -#line 1045 "asn1p_y.y" +#line 1046 "asn1p_y.y" { (yyval.a_int) = 1; } break; case 101: -#line 1049 "asn1p_y.y" +#line 1050 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3105,7 +3107,7 @@ yyparse () break; case 102: -#line 1056 "asn1p_y.y" +#line 1057 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); @@ -3113,7 +3115,7 @@ yyparse () break; case 103: -#line 1066 "asn1p_y.y" +#line 1067 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3125,7 +3127,7 @@ yyparse () break; case 104: -#line 1076 "asn1p_y.y" +#line 1077 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); (yyval.a_expr)->Identifier = (yyvsp[(1) - (4)].tv_str); @@ -3138,7 +3140,7 @@ yyparse () break; case 105: -#line 1087 "asn1p_y.y" +#line 1088 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); @@ -3150,7 +3152,7 @@ yyparse () break; case 106: -#line 1097 "asn1p_y.y" +#line 1098 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3163,7 +3165,7 @@ yyparse () break; case 107: -#line 1108 "asn1p_y.y" +#line 1109 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); (yyval.a_expr)->Identifier = (yyvsp[(1) - (3)].tv_str); @@ -3175,7 +3177,7 @@ yyparse () break; case 108: -#line 1118 "asn1p_y.y" +#line 1119 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3188,7 +3190,7 @@ yyparse () break; case 109: -#line 1129 "asn1p_y.y" +#line 1130 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3201,31 +3203,31 @@ yyparse () break; case 110: -#line 1141 "asn1p_y.y" +#line 1142 "asn1p_y.y" { (yyval.a_wsynt) = 0; } break; case 111: -#line 1142 "asn1p_y.y" +#line 1143 "asn1p_y.y" { (yyval.a_wsynt) = (yyvsp[(1) - (1)].a_wsynt); } break; case 112: -#line 1149 "asn1p_y.y" +#line 1150 "asn1p_y.y" { asn1p_lexer_hack_enable_with_syntax(); } break; case 113: -#line 1151 "asn1p_y.y" +#line 1152 "asn1p_y.y" { (yyval.a_wsynt) = (yyvsp[(5) - (6)].a_wsynt); } break; case 114: -#line 1157 "asn1p_y.y" +#line 1158 "asn1p_y.y" { (yyval.a_wsynt) = asn1p_wsyntx_new(); TQ_ADD(&((yyval.a_wsynt)->chunks), (yyvsp[(1) - (1)].a_wchunk), next); @@ -3233,7 +3235,7 @@ yyparse () break; case 115: -#line 1161 "asn1p_y.y" +#line 1162 "asn1p_y.y" { (yyval.a_wsynt) = (yyvsp[(1) - (2)].a_wsynt); TQ_ADD(&((yyval.a_wsynt)->chunks), (yyvsp[(2) - (2)].a_wchunk), next); @@ -3241,7 +3243,7 @@ yyparse () break; case 116: -#line 1168 "asn1p_y.y" +#line 1169 "asn1p_y.y" { (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromstring((yyvsp[(1) - (1)].tv_opaque).buf, 0); (yyval.a_wchunk)->type = WC_WHITESPACE; @@ -3249,14 +3251,14 @@ yyparse () break; case 117: -#line 1172 "asn1p_y.y" +#line 1173 "asn1p_y.y" { (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromstring((yyvsp[(1) - (1)].tv_str), 0); } break; case 118: -#line 1175 "asn1p_y.y" +#line 1176 "asn1p_y.y" { (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromstring((yyvsp[(1) - (1)].a_refcomp).name, 0); (yyval.a_wchunk)->type = WC_FIELD; @@ -3264,14 +3266,14 @@ yyparse () break; case 119: -#line 1179 "asn1p_y.y" +#line 1180 "asn1p_y.y" { (yyval.a_wchunk) = asn1p_wsyntx_chunk_fromsyntax((yyvsp[(2) - (3)].a_wsynt)); } break; case 120: -#line 1185 "asn1p_y.y" +#line 1186 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3283,7 +3285,7 @@ yyparse () break; case 121: -#line 1193 "asn1p_y.y" +#line 1194 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3296,7 +3298,7 @@ yyparse () break; case 122: -#line 1202 "asn1p_y.y" +#line 1203 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3309,7 +3311,7 @@ yyparse () break; case 123: -#line 1214 "asn1p_y.y" +#line 1215 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (3)].a_expr); (yyval.a_expr)->tag = (yyvsp[(1) - (3)].a_tag); @@ -3332,7 +3334,7 @@ yyparse () break; case 124: -#line 1236 "asn1p_y.y" +#line 1237 "asn1p_y.y" { (yyval.a_int) = asn1p_as_pointer ? EM_INDIRECT : 0; asn1p_as_pointer = 0; @@ -3340,7 +3342,7 @@ yyparse () break; case 125: -#line 1243 "asn1p_y.y" +#line 1244 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (2)].a_expr); (yyval.a_expr)->marker.flags |= (yyvsp[(1) - (2)].a_int); @@ -3360,14 +3362,14 @@ yyparse () break; case 126: -#line 1262 "asn1p_y.y" +#line 1263 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (1)].a_expr); } break; case 127: -#line 1265 "asn1p_y.y" +#line 1266 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr); assert((yyval.a_expr)->expr_type == A1TC_INVALID); @@ -3377,7 +3379,7 @@ yyparse () break; case 128: -#line 1271 "asn1p_y.y" +#line 1272 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr); assert((yyval.a_expr)->expr_type == A1TC_INVALID); @@ -3387,7 +3389,7 @@ yyparse () break; case 129: -#line 1277 "asn1p_y.y" +#line 1278 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(3) - (4)].a_expr); assert((yyval.a_expr)->expr_type == A1TC_INVALID); @@ -3397,7 +3399,7 @@ yyparse () break; case 130: -#line 1283 "asn1p_y.y" +#line 1284 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3411,7 +3413,7 @@ yyparse () break; case 131: -#line 1293 "asn1p_y.y" +#line 1294 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3425,7 +3427,7 @@ yyparse () break; case 132: -#line 1303 "asn1p_y.y" +#line 1304 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3435,7 +3437,7 @@ yyparse () break; case 133: -#line 1309 "asn1p_y.y" +#line 1310 "asn1p_y.y" { int ret; (yyval.a_expr) = NEW_EXPR(); @@ -3450,7 +3452,7 @@ yyparse () break; case 134: -#line 1320 "asn1p_y.y" +#line 1321 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3461,7 +3463,7 @@ yyparse () break; case 135: -#line 1335 "asn1p_y.y" +#line 1336 "asn1p_y.y" { int ret; (yyval.a_ref) = asn1p_ref_new(yylineno); @@ -3473,7 +3475,7 @@ yyparse () break; case 136: -#line 1343 "asn1p_y.y" +#line 1344 "asn1p_y.y" { int ret; (yyval.a_ref) = asn1p_ref_new(yylineno); @@ -3487,7 +3489,7 @@ yyparse () break; case 137: -#line 1353 "asn1p_y.y" +#line 1354 "asn1p_y.y" { int ret; (yyval.a_ref) = asn1p_ref_new(yylineno); @@ -3501,7 +3503,7 @@ yyparse () break; case 138: -#line 1363 "asn1p_y.y" +#line 1364 "asn1p_y.y" { int ret; (yyval.a_ref) = asn1p_ref_new(yylineno); @@ -3515,7 +3517,7 @@ yyparse () break; case 139: -#line 1373 "asn1p_y.y" +#line 1374 "asn1p_y.y" { int ret; (yyval.a_ref) = asn1p_ref_new(yylineno); @@ -3527,7 +3529,7 @@ yyparse () break; case 140: -#line 1381 "asn1p_y.y" +#line 1382 "asn1p_y.y" { int ret; (yyval.a_ref) = (yyvsp[(3) - (3)].a_ref); @@ -3550,7 +3552,7 @@ yyparse () break; case 141: -#line 1403 "asn1p_y.y" +#line 1404 "asn1p_y.y" { int ret; (yyval.a_ref) = asn1p_ref_new(yylineno); @@ -3562,7 +3564,7 @@ yyparse () break; case 142: -#line 1411 "asn1p_y.y" +#line 1412 "asn1p_y.y" { int ret; (yyval.a_ref) = (yyvsp[(1) - (3)].a_ref); @@ -3573,7 +3575,7 @@ yyparse () break; case 144: -#line 1424 "asn1p_y.y" +#line 1425 "asn1p_y.y" { (yyval.a_refcomp).lex_type = RLT_AmpUppercase; (yyval.a_refcomp).name = (yyvsp[(1) - (1)].tv_str); @@ -3581,7 +3583,7 @@ yyparse () break; case 145: -#line 1429 "asn1p_y.y" +#line 1430 "asn1p_y.y" { (yyval.a_refcomp).lex_type = RLT_Amplowercase; (yyval.a_refcomp).name = (yyvsp[(1) - (1)].tv_str); @@ -3589,7 +3591,7 @@ yyparse () break; case 146: -#line 1438 "asn1p_y.y" +#line 1439 "asn1p_y.y" { (yyval.a_ref) = asn1p_ref_new(yylineno); asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_AmpUppercase); @@ -3597,7 +3599,7 @@ yyparse () break; case 147: -#line 1442 "asn1p_y.y" +#line 1443 "asn1p_y.y" { (yyval.a_ref) = (yyval.a_ref); asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_AmpUppercase); @@ -3605,7 +3607,7 @@ yyparse () break; case 148: -#line 1446 "asn1p_y.y" +#line 1447 "asn1p_y.y" { (yyval.a_ref) = (yyval.a_ref); asn1p_ref_add_component((yyval.a_ref), (yyvsp[(3) - (3)].tv_str), RLT_Amplowercase); @@ -3613,7 +3615,7 @@ yyparse () break; case 149: -#line 1453 "asn1p_y.y" +#line 1454 "asn1p_y.y" { (yyval.a_ref) = asn1p_ref_new(yylineno); asn1p_ref_add_component((yyval.a_ref), (yyvsp[(1) - (1)].tv_str), RLT_CAPITALS); @@ -3621,7 +3623,7 @@ yyparse () break; case 150: -#line 1473 "asn1p_y.y" +#line 1474 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (4)].a_expr); assert((yyval.a_expr)->Identifier == NULL); @@ -3632,7 +3634,7 @@ yyparse () break; case 153: -#line 1485 "asn1p_y.y" +#line 1486 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint(0); checkmem((yyval.a_value)); @@ -3643,12 +3645,12 @@ yyparse () break; case 154: -#line 1492 "asn1p_y.y" +#line 1493 "asn1p_y.y" { asn1p_lexer_hack_push_opaque_state(); } break; case 155: -#line 1492 "asn1p_y.y" +#line 1493 "asn1p_y.y" { (yyval.a_value) = asn1p_value_frombuf((yyvsp[(3) - (3)].tv_opaque).buf, (yyvsp[(3) - (3)].tv_opaque).len, 0); checkmem((yyval.a_value)); @@ -3657,7 +3659,7 @@ yyparse () break; case 156: -#line 1497 "asn1p_y.y" +#line 1498 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint(0); checkmem((yyval.a_value)); @@ -3666,7 +3668,7 @@ yyparse () break; case 157: -#line 1505 "asn1p_y.y" +#line 1506 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint(0); checkmem((yyval.a_value)); @@ -3675,7 +3677,7 @@ yyparse () break; case 158: -#line 1510 "asn1p_y.y" +#line 1511 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint(0); checkmem((yyval.a_value)); @@ -3684,7 +3686,7 @@ yyparse () break; case 159: -#line 1515 "asn1p_y.y" +#line 1516 "asn1p_y.y" { (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'B'); checkmem((yyval.a_value)); @@ -3692,7 +3694,7 @@ yyparse () break; case 160: -#line 1519 "asn1p_y.y" +#line 1520 "asn1p_y.y" { (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'H'); checkmem((yyval.a_value)); @@ -3700,21 +3702,21 @@ yyparse () break; case 161: -#line 1523 "asn1p_y.y" +#line 1524 "asn1p_y.y" { (yyval.a_value) = (yyval.a_value); } break; case 162: -#line 1526 "asn1p_y.y" +#line 1527 "asn1p_y.y" { (yyval.a_value) = (yyvsp[(1) - (1)].a_value); } break; case 163: -#line 1532 "asn1p_y.y" +#line 1533 "asn1p_y.y" { asn1p_ref_t *ref; int ret; @@ -3729,7 +3731,7 @@ yyparse () break; case 164: -#line 1543 "asn1p_y.y" +#line 1544 "asn1p_y.y" { asn1p_ref_t *ref; int ret; @@ -3747,7 +3749,7 @@ yyparse () break; case 165: -#line 1561 "asn1p_y.y" +#line 1562 "asn1p_y.y" { (yyval.a_value) = asn1p_value_frombuf((yyvsp[(1) - (1)].tv_opaque).buf, (yyvsp[(1) - (1)].tv_opaque).len, 0); checkmem((yyval.a_value)); @@ -3755,7 +3757,7 @@ yyparse () break; case 166: -#line 1565 "asn1p_y.y" +#line 1566 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int)); checkmem((yyval.a_value)); @@ -3764,7 +3766,7 @@ yyparse () break; case 167: -#line 1570 "asn1p_y.y" +#line 1571 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int)); checkmem((yyval.a_value)); @@ -3773,7 +3775,7 @@ yyparse () break; case 168: -#line 1578 "asn1p_y.y" +#line 1579 "asn1p_y.y" { (yyval.tv_opaque).len = (yyvsp[(1) - (1)].tv_opaque).len + 1; (yyval.tv_opaque).buf = malloc((yyval.tv_opaque).len + 1); @@ -3786,7 +3788,7 @@ yyparse () break; case 169: -#line 1587 "asn1p_y.y" +#line 1588 "asn1p_y.y" { int newsize = (yyvsp[(1) - (2)].tv_opaque).len + (yyvsp[(2) - (2)].tv_opaque).len; char *p = malloc(newsize + 1); @@ -3802,87 +3804,87 @@ yyparse () break; case 170: -#line 1602 "asn1p_y.y" +#line 1603 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_BOOLEAN; } break; case 171: -#line 1603 "asn1p_y.y" +#line 1604 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_NULL; } break; case 172: -#line 1604 "asn1p_y.y" +#line 1605 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_REAL; } break; case 173: -#line 1605 "asn1p_y.y" +#line 1606 "asn1p_y.y" { (yyval.a_type) = (yyvsp[(1) - (1)].a_type); } break; case 174: -#line 1606 "asn1p_y.y" +#line 1607 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_OCTET_STRING; } break; case 175: -#line 1607 "asn1p_y.y" +#line 1608 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_OBJECT_IDENTIFIER; } break; case 176: -#line 1608 "asn1p_y.y" +#line 1609 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_RELATIVE_OID; } break; case 177: -#line 1609 "asn1p_y.y" +#line 1610 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_EXTERNAL; } break; case 178: -#line 1610 "asn1p_y.y" +#line 1611 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_EMBEDDED_PDV; } break; case 179: -#line 1611 "asn1p_y.y" +#line 1612 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_CHARACTER_STRING; } break; case 180: -#line 1612 "asn1p_y.y" +#line 1613 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_UTCTime; } break; case 181: -#line 1613 "asn1p_y.y" +#line 1614 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_GeneralizedTime; } break; case 182: -#line 1614 "asn1p_y.y" +#line 1615 "asn1p_y.y" { (yyval.a_type) = (yyvsp[(1) - (1)].a_type); } break; case 183: -#line 1621 "asn1p_y.y" +#line 1622 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_INTEGER; } break; case 184: -#line 1622 "asn1p_y.y" +#line 1623 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_ENUMERATED; } break; case 185: -#line 1623 "asn1p_y.y" +#line 1624 "asn1p_y.y" { (yyval.a_type) = ASN_BASIC_BIT_STRING; } break; case 186: -#line 1627 "asn1p_y.y" +#line 1628 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -3892,7 +3894,7 @@ yyparse () break; case 187: -#line 1633 "asn1p_y.y" +#line 1634 "asn1p_y.y" { if((yyvsp[(2) - (2)].a_expr)) { (yyval.a_expr) = (yyvsp[(2) - (2)].a_expr); @@ -3906,12 +3908,12 @@ yyparse () break; case 188: -#line 1646 "asn1p_y.y" +#line 1647 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_BMPString; } break; case 189: -#line 1647 "asn1p_y.y" +#line 1648 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_GeneralString; fprintf(stderr, "WARNING: GeneralString is not fully supported\n"); @@ -3919,7 +3921,7 @@ yyparse () break; case 190: -#line 1651 "asn1p_y.y" +#line 1652 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_GraphicString; fprintf(stderr, "WARNING: GraphicString is not fully supported\n"); @@ -3927,27 +3929,27 @@ yyparse () break; case 191: -#line 1655 "asn1p_y.y" +#line 1656 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_IA5String; } break; case 192: -#line 1656 "asn1p_y.y" +#line 1657 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_ISO646String; } break; case 193: -#line 1657 "asn1p_y.y" +#line 1658 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_NumericString; } break; case 194: -#line 1658 "asn1p_y.y" +#line 1659 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_PrintableString; } break; case 195: -#line 1659 "asn1p_y.y" +#line 1660 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_T61String; fprintf(stderr, "WARNING: T61String is not fully supported\n"); @@ -3955,22 +3957,22 @@ yyparse () break; case 196: -#line 1663 "asn1p_y.y" +#line 1664 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_TeletexString; } break; case 197: -#line 1664 "asn1p_y.y" +#line 1665 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_UniversalString; } break; case 198: -#line 1665 "asn1p_y.y" +#line 1666 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_UTF8String; } break; case 199: -#line 1666 "asn1p_y.y" +#line 1667 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_VideotexString; fprintf(stderr, "WARNING: VideotexString is not fully supported\n"); @@ -3978,36 +3980,36 @@ yyparse () break; case 200: -#line 1670 "asn1p_y.y" +#line 1671 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_VisibleString; } break; case 201: -#line 1671 "asn1p_y.y" +#line 1672 "asn1p_y.y" { (yyval.a_type) = ASN_STRING_ObjectDescriptor; } break; case 206: -#line 1682 "asn1p_y.y" +#line 1683 "asn1p_y.y" { (yyval.a_constr) = 0; } break; case 207: -#line 1683 "asn1p_y.y" +#line 1684 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; case 209: -#line 1693 "asn1p_y.y" +#line 1694 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_SET, (yyvsp[(1) - (1)].a_constr), 0); } break; case 210: -#line 1696 "asn1p_y.y" +#line 1697 "asn1p_y.y" { /* * This is a special case, for compatibility purposes. @@ -4018,24 +4020,23 @@ yyparse () break; case 211: -#line 1706 "asn1p_y.y" +#line 1707 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(2) - (3)].a_constr); } break; case 212: -#line 1709 "asn1p_y.y" +#line 1710 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_SET, (yyvsp[(1) - (4)].a_constr), (yyvsp[(3) - (4)].a_constr)); } break; case 213: -#line 1715 "asn1p_y.y" +#line 1716 "asn1p_y.y" { - (yyval.a_constr) = asn1p_constraint_new(yylineno); - (yyval.a_constr)->type = ACT_EL_EXT; + (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; @@ -4047,7 +4048,22 @@ yyparse () break; case 215: -#line 1722 "asn1p_y.y" +#line 1725 "asn1p_y.y" + { + (yyval.a_constr) = asn1p_constraint_new(yylineno); + (yyval.a_constr)->type = ACT_EL_EXT; + } + break; + + case 216: +#line 1729 "asn1p_y.y" + { + (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); + } + break; + + case 217: +#line 1732 "asn1p_y.y" { asn1p_constraint_t *ct; ct = asn1p_constraint_new(yylineno); @@ -4056,8 +4072,8 @@ yyparse () } break; - case 216: -#line 1728 "asn1p_y.y" + case 218: +#line 1738 "asn1p_y.y" { asn1p_constraint_t *ct; ct = asn1p_constraint_new(yylineno); @@ -4068,43 +4084,36 @@ yyparse () } break; - case 217: -#line 1736 "asn1p_y.y" - { - (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); - } - break; - - case 219: -#line 1743 "asn1p_y.y" + case 220: +#line 1750 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_AEX, (yyvsp[(3) - (3)].a_constr), 0); } break; - case 221: -#line 1750 "asn1p_y.y" + case 222: +#line 1757 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_UNI, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr)); } break; - case 223: -#line 1757 "asn1p_y.y" + case 224: +#line 1764 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_INT, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr)); } break; - case 225: -#line 1765 "asn1p_y.y" + case 226: +#line 1772 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_EXC, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr)); } break; - case 226: -#line 1771 "asn1p_y.y" + case 227: +#line 1778 "asn1p_y.y" { int ret; (yyval.a_constr) = asn1p_constraint_new(yylineno); @@ -4115,8 +4124,8 @@ yyparse () } break; - case 227: -#line 1779 "asn1p_y.y" + case 228: +#line 1786 "asn1p_y.y" { int ret; (yyval.a_constr) = asn1p_constraint_new(yylineno); @@ -4127,8 +4136,8 @@ yyparse () } break; - case 228: -#line 1787 "asn1p_y.y" + case 229: +#line 1794 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); @@ -4137,8 +4146,8 @@ yyparse () } break; - case 229: -#line 1793 "asn1p_y.y" + case 230: +#line 1800 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); @@ -4147,8 +4156,8 @@ yyparse () } break; - case 230: -#line 1799 "asn1p_y.y" + case 231: +#line 1806 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); @@ -4158,8 +4167,8 @@ yyparse () } break; - case 231: -#line 1806 "asn1p_y.y" + case 232: +#line 1813 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); @@ -4170,8 +4179,8 @@ yyparse () } break; - case 232: -#line 1814 "asn1p_y.y" + case 233: +#line 1821 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); @@ -4182,8 +4191,8 @@ yyparse () } break; - case 233: -#line 1822 "asn1p_y.y" + case 234: +#line 1829 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); @@ -4195,22 +4204,38 @@ yyparse () } break; - case 234: -#line 1831 "asn1p_y.y" + case 235: +#line 1838 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; - case 235: -#line 1834 "asn1p_y.y" + case 236: +#line 1841 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; - case 236: -#line 1840 "asn1p_y.y" + case 237: +#line 1844 "asn1p_y.y" + { asn1p_lexer_hack_push_opaque_state(); } + break; + + case 238: +#line 1844 "asn1p_y.y" + { + (yyval.a_constr) = asn1p_constraint_new(yylineno); + checkmem((yyval.a_constr)); + (yyval.a_constr)->type = ACT_EL_VALUE; + (yyval.a_constr)->value = asn1p_value_frombuf((yyvsp[(3) - (3)].tv_opaque).buf, (yyvsp[(3) - (3)].tv_opaque).len, 0); + (yyval.a_constr)->value->type = ATV_UNPARSED; + } + break; + + case 239: +#line 1854 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); (yyval.a_constr)->type = ACT_CT_PATTERN; @@ -4218,8 +4243,8 @@ yyparse () } break; - case 237: -#line 1845 "asn1p_y.y" + case 240: +#line 1859 "asn1p_y.y" { asn1p_ref_t *ref; (yyval.a_constr) = asn1p_constraint_new(yylineno); @@ -4230,22 +4255,22 @@ yyparse () } break; - case 238: -#line 1856 "asn1p_y.y" + case 241: +#line 1870 "asn1p_y.y" { (yyval.a_ctype) = ACT_CT_SIZE; } break; - case 239: -#line 1859 "asn1p_y.y" + case 242: +#line 1873 "asn1p_y.y" { (yyval.a_ctype) = ACT_CT_FROM; } break; - case 240: -#line 1865 "asn1p_y.y" + case 243: +#line 1879 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint(0); checkmem((yyval.a_value)); @@ -4253,8 +4278,8 @@ yyparse () } break; - case 241: -#line 1870 "asn1p_y.y" + case 244: +#line 1884 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint(1); checkmem((yyval.a_value)); @@ -4262,8 +4287,8 @@ yyparse () } break; - case 245: -#line 1878 "asn1p_y.y" + case 248: +#line 1892 "asn1p_y.y" { asn1p_ref_t *ref; int ret; @@ -4277,24 +4302,24 @@ yyparse () } break; - case 246: -#line 1892 "asn1p_y.y" + case 249: +#line 1906 "asn1p_y.y" { (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'B'); checkmem((yyval.a_value)); } break; - case 247: -#line 1896 "asn1p_y.y" + case 250: +#line 1910 "asn1p_y.y" { (yyval.a_value) = _convert_bitstring2binary((yyvsp[(1) - (1)].tv_str), 'H'); checkmem((yyval.a_value)); } break; - case 248: -#line 1903 "asn1p_y.y" + case 251: +#line 1917 "asn1p_y.y" { asn1p_ref_t *ref; int ret; @@ -4308,36 +4333,36 @@ yyparse () } break; - case 249: -#line 1917 "asn1p_y.y" + case 252: +#line 1931 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_WCOMP, (yyvsp[(3) - (3)].a_constr), 0); } break; - case 250: -#line 1920 "asn1p_y.y" + case 253: +#line 1934 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_WCOMPS, (yyvsp[(4) - (5)].a_constr), 0); } break; - case 251: -#line 1926 "asn1p_y.y" + case 254: +#line 1940 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; - case 252: -#line 1929 "asn1p_y.y" + case 255: +#line 1943 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CT_WCOMPS, (yyvsp[(1) - (3)].a_constr), (yyvsp[(3) - (3)].a_constr)); } break; - case 253: -#line 1935 "asn1p_y.y" + case 256: +#line 1949 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); @@ -4346,8 +4371,8 @@ yyparse () } break; - case 254: -#line 1941 "asn1p_y.y" + case 257: +#line 1955 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); @@ -4358,44 +4383,44 @@ yyparse () } break; - case 255: -#line 1955 "asn1p_y.y" + case 258: +#line 1969 "asn1p_y.y" { (yyval.a_pres) = ACPRES_DEFAULT; } break; - case 256: -#line 1956 "asn1p_y.y" + case 259: +#line 1970 "asn1p_y.y" { (yyval.a_pres) = (yyvsp[(1) - (1)].a_pres); } break; - case 257: -#line 1960 "asn1p_y.y" + case 260: +#line 1974 "asn1p_y.y" { (yyval.a_pres) = ACPRES_PRESENT; } break; - case 258: -#line 1963 "asn1p_y.y" + case 261: +#line 1977 "asn1p_y.y" { (yyval.a_pres) = ACPRES_ABSENT; } break; - case 259: -#line 1966 "asn1p_y.y" + case 262: +#line 1980 "asn1p_y.y" { (yyval.a_pres) = ACPRES_OPTIONAL; } break; - case 263: -#line 1981 "asn1p_y.y" + case 266: +#line 1995 "asn1p_y.y" { asn1p_lexer_hack_push_opaque_state(); } break; - case 264: -#line 1981 "asn1p_y.y" + case 267: +#line 1995 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); @@ -4406,8 +4431,8 @@ yyparse () } break; - case 265: -#line 1992 "asn1p_y.y" + case 268: +#line 2006 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); (yyval.a_constr)->type = ACT_CT_CTNG; @@ -4415,42 +4440,42 @@ yyparse () } break; - case 266: -#line 2000 "asn1p_y.y" + case 269: +#line 2014 "asn1p_y.y" { (yyval.a_ctype) = ACT_EL_RANGE; } break; - case 267: -#line 2001 "asn1p_y.y" + case 270: +#line 2015 "asn1p_y.y" { (yyval.a_ctype) = ACT_EL_RLRANGE; } break; - case 268: -#line 2002 "asn1p_y.y" + case 271: +#line 2016 "asn1p_y.y" { (yyval.a_ctype) = ACT_EL_LLRANGE; } break; - case 269: -#line 2003 "asn1p_y.y" + case 272: +#line 2017 "asn1p_y.y" { (yyval.a_ctype) = ACT_EL_ULRANGE; } break; - case 270: -#line 2006 "asn1p_y.y" + case 273: +#line 2020 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; - case 271: -#line 2009 "asn1p_y.y" + case 274: +#line 2023 "asn1p_y.y" { (yyval.a_constr) = (yyvsp[(1) - (1)].a_constr); } break; - case 272: -#line 2018 "asn1p_y.y" + case 275: +#line 2032 "asn1p_y.y" { asn1p_ref_t *ref = asn1p_ref_new(yylineno); asn1p_constraint_t *ct; @@ -4465,15 +4490,15 @@ yyparse () } break; - case 273: -#line 2033 "asn1p_y.y" + case 276: +#line 2047 "asn1p_y.y" { CONSTRAINT_INSERT((yyval.a_constr), ACT_CA_CRC, (yyvsp[(1) - (4)].a_constr), (yyvsp[(3) - (4)].a_constr)); } break; - case 274: -#line 2039 "asn1p_y.y" + case 277: +#line 2053 "asn1p_y.y" { (yyval.a_constr) = asn1p_constraint_new(yylineno); checkmem((yyval.a_constr)); @@ -4482,8 +4507,8 @@ yyparse () } break; - case 275: -#line 2045 "asn1p_y.y" + case 278: +#line 2059 "asn1p_y.y" { asn1p_constraint_t *ct; ct = asn1p_constraint_new(yylineno); @@ -4494,8 +4519,8 @@ yyparse () } break; - case 276: -#line 2059 "asn1p_y.y" + case 279: +#line 2073 "asn1p_y.y" { char *p = malloc(strlen((yyvsp[(2) - (2)].tv_str)) + 2); int ret; @@ -4509,8 +4534,8 @@ yyparse () } break; - case 277: -#line 2070 "asn1p_y.y" + case 280: +#line 2084 "asn1p_y.y" { char *p = malloc(strlen((yyvsp[(3) - (3)].tv_str)) + 3); int ret; @@ -4525,15 +4550,15 @@ yyparse () } break; - case 278: -#line 2086 "asn1p_y.y" + case 281: +#line 2100 "asn1p_y.y" { (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); } break; - case 279: -#line 2089 "asn1p_y.y" + case 282: +#line 2103 "asn1p_y.y" { int l1 = strlen((yyvsp[(1) - (3)].tv_str)); int l3 = strlen((yyvsp[(3) - (3)].tv_str)); @@ -4545,52 +4570,52 @@ yyparse () } break; - case 280: -#line 2107 "asn1p_y.y" + case 283: +#line 2121 "asn1p_y.y" { (yyval.a_marker).flags = EM_NOMARK; (yyval.a_marker).default_value = 0; } break; - case 281: -#line 2111 "asn1p_y.y" + case 284: +#line 2125 "asn1p_y.y" { (yyval.a_marker) = (yyvsp[(1) - (1)].a_marker); } break; - case 282: -#line 2115 "asn1p_y.y" + case 285: +#line 2129 "asn1p_y.y" { (yyval.a_marker).flags = EM_OPTIONAL | EM_INDIRECT; (yyval.a_marker).default_value = 0; } break; - case 283: -#line 2119 "asn1p_y.y" + case 286: +#line 2133 "asn1p_y.y" { (yyval.a_marker).flags = EM_DEFAULT; (yyval.a_marker).default_value = (yyvsp[(2) - (2)].a_value); } break; - case 284: -#line 2142 "asn1p_y.y" + case 287: +#line 2156 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); } break; - case 285: -#line 2146 "asn1p_y.y" + case 288: +#line 2160 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(2) - (3)].a_expr); } break; - case 286: -#line 2152 "asn1p_y.y" + case 289: +#line 2166 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -4598,16 +4623,16 @@ yyparse () } break; - case 287: -#line 2157 "asn1p_y.y" + case 290: +#line 2171 "asn1p_y.y" { (yyval.a_expr) = (yyvsp[(1) - (3)].a_expr); asn1p_expr_add((yyval.a_expr), (yyvsp[(3) - (3)].a_expr)); } break; - case 288: -#line 2164 "asn1p_y.y" + case 291: +#line 2178 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -4617,8 +4642,8 @@ yyparse () } break; - case 289: -#line 2171 "asn1p_y.y" + case 292: +#line 2185 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -4629,8 +4654,8 @@ yyparse () } break; - case 290: -#line 2179 "asn1p_y.y" + case 293: +#line 2193 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -4641,8 +4666,8 @@ yyparse () } break; - case 291: -#line 2187 "asn1p_y.y" + case 294: +#line 2201 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -4652,8 +4677,8 @@ yyparse () } break; - case 292: -#line 2194 "asn1p_y.y" + case 295: +#line 2208 "asn1p_y.y" { (yyval.a_expr) = NEW_EXPR(); checkmem((yyval.a_expr)); @@ -4664,129 +4689,129 @@ yyparse () } break; - case 293: -#line 2205 "asn1p_y.y" + case 296: +#line 2219 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int)); checkmem((yyval.a_value)); } break; - case 294: -#line 2209 "asn1p_y.y" + case 297: +#line 2223 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromint((yyvsp[(1) - (1)].a_int)); checkmem((yyval.a_value)); } break; - case 296: -#line 2217 "asn1p_y.y" + case 299: +#line 2231 "asn1p_y.y" { (yyval.a_value) = asn1p_value_fromdouble((yyvsp[(1) - (1)].a_dbl)); checkmem((yyval.a_value)); } break; - case 297: -#line 2248 "asn1p_y.y" + case 300: +#line 2262 "asn1p_y.y" { memset(&(yyval.a_tag), 0, sizeof((yyval.a_tag))); } break; - case 298: -#line 2249 "asn1p_y.y" + case 301: +#line 2263 "asn1p_y.y" { (yyval.a_tag) = (yyvsp[(1) - (1)].a_tag); } break; - case 299: -#line 2253 "asn1p_y.y" + case 302: +#line 2267 "asn1p_y.y" { (yyval.a_tag) = (yyvsp[(1) - (2)].a_tag); (yyval.a_tag).tag_mode = (yyvsp[(2) - (2)].a_tag).tag_mode; } break; - case 300: -#line 2260 "asn1p_y.y" + case 303: +#line 2274 "asn1p_y.y" { (yyval.a_tag) = (yyvsp[(2) - (4)].a_tag); (yyval.a_tag).tag_value = (yyvsp[(3) - (4)].a_int); } break; - case 301: -#line 2266 "asn1p_y.y" + case 304: +#line 2280 "asn1p_y.y" { (yyval.a_tag).tag_class = TC_CONTEXT_SPECIFIC; } break; - case 302: -#line 2267 "asn1p_y.y" + case 305: +#line 2281 "asn1p_y.y" { (yyval.a_tag).tag_class = TC_UNIVERSAL; } break; - case 303: -#line 2268 "asn1p_y.y" + case 306: +#line 2282 "asn1p_y.y" { (yyval.a_tag).tag_class = TC_APPLICATION; } break; - case 304: -#line 2269 "asn1p_y.y" + case 307: +#line 2283 "asn1p_y.y" { (yyval.a_tag).tag_class = TC_PRIVATE; } break; - case 305: -#line 2273 "asn1p_y.y" + case 308: +#line 2287 "asn1p_y.y" { (yyval.a_tag).tag_mode = TM_DEFAULT; } break; - case 306: -#line 2274 "asn1p_y.y" + case 309: +#line 2288 "asn1p_y.y" { (yyval.a_tag).tag_mode = TM_IMPLICIT; } break; - case 307: -#line 2275 "asn1p_y.y" + case 310: +#line 2289 "asn1p_y.y" { (yyval.a_tag).tag_mode = TM_EXPLICIT; } break; - case 308: -#line 2279 "asn1p_y.y" + case 311: +#line 2293 "asn1p_y.y" { checkmem((yyvsp[(1) - (1)].tv_str)); (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); } break; - case 309: -#line 2283 "asn1p_y.y" + case 312: +#line 2297 "asn1p_y.y" { checkmem((yyvsp[(1) - (1)].tv_str)); (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); } break; - case 310: -#line 2291 "asn1p_y.y" + case 313: +#line 2305 "asn1p_y.y" { checkmem((yyvsp[(1) - (1)].tv_str)); (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); } break; - case 311: -#line 2298 "asn1p_y.y" + case 314: +#line 2312 "asn1p_y.y" { (yyval.tv_str) = 0; } break; - case 312: -#line 2299 "asn1p_y.y" + case 315: +#line 2313 "asn1p_y.y" { (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); } break; - case 313: -#line 2305 "asn1p_y.y" + case 316: +#line 2319 "asn1p_y.y" { checkmem((yyvsp[(1) - (1)].tv_str)); (yyval.tv_str) = (yyvsp[(1) - (1)].tv_str); @@ -4795,7 +4820,7 @@ yyparse () /* Line 1267 of yacc.c. */ -#line 4799 "y.tab.c" +#line 4824 "y.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -5009,7 +5034,7 @@ yyparse () } -#line 2311 "asn1p_y.y" +#line 2325 "asn1p_y.y" diff --git a/libasn1parser/asn1p_y.h b/libasn1parser/asn1p_y.h index 9963cdea4..30c4ee87c 100644 --- a/libasn1parser/asn1p_y.h +++ b/libasn1parser/asn1p_y.h @@ -293,7 +293,7 @@ typedef union YYSTYPE struct asn1p_type_tag_s tag; } tv_nametag; } -/* Line 1529 of yacc.c. */ +/* Line 1489 of yacc.c. */ #line 298 "y.tab.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/libasn1parser/asn1p_y.y b/libasn1parser/asn1p_y.y index aae339bb2..b8465cb27 100644 --- a/libasn1parser/asn1p_y.y +++ b/libasn1parser/asn1p_y.y @@ -315,6 +315,7 @@ static asn1p_module_t *currentModule; %type optConstraints %type Constraint %type SubtypeConstraint +%type ConstraintSpecs %type GeneralConstraint %type SetOfConstraints %type ElementSetSpecs /* 1..2,...,3 */ @@ -1693,7 +1694,7 @@ SubtypeConstraint: SetOfConstraints { CONSTRAINT_INSERT($$, ACT_CA_SET, $1, 0); } - | TOK_SIZE '(' ElementSetSpecs ')' { + | TOK_SIZE '(' ConstraintSpecs ')' { /* * This is a special case, for compatibility purposes. * It goes without parentheses. @@ -1703,14 +1704,23 @@ SubtypeConstraint: ; SetOfConstraints: - '(' ElementSetSpecs ')' { + '(' ConstraintSpecs ')' { $$ = $2; } - | SetOfConstraints '(' ElementSetSpecs ')' { + | SetOfConstraints '(' ConstraintSpecs ')' { CONSTRAINT_INSERT($$, ACT_CA_SET, $1, $3); } ; +ConstraintSpecs: + ElementSetSpecs { + $$ = $1; + } + | GeneralConstraint { + $$ = $1; + } + ; + ElementSetSpecs: TOK_ThreeDots { $$ = asn1p_constraint_new(yylineno); @@ -1733,9 +1743,6 @@ ElementSetSpecs: ct = $$; CONSTRAINT_INSERT($$, ACT_CA_CSV, ct, $5); } - | GeneralConstraint { - $$ = $1; - } ; ElementSetSpec: @@ -1834,6 +1841,13 @@ ConstraintSubtypeElement: | PatternConstraint { $$ = $1; } + | '{' { asn1p_lexer_hack_push_opaque_state(); } Opaque /* '}' */ { + $$ = asn1p_constraint_new(yylineno); + checkmem($$); + $$->type = ACT_EL_VALUE; + $$->value = asn1p_value_frombuf($3.buf, $3.len, 0); + $$->value->type = ATV_UNPARSED; + } ; PatternConstraint: From 70efeb27fbbd4b48511b83fdc4642f4731413a14 Mon Sep 17 00:00:00 2001 From: rayzhang Date: Sat, 16 Apr 2016 20:44:44 +0000 Subject: [PATCH 02/28] asn1p_fix_enum if it is being referenced before resolved. --- libasn1fix/asn1fix_cws.c | 16 +++++++++++++++- libasn1fix/asn1fix_value.c | 24 ++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/libasn1fix/asn1fix_cws.c b/libasn1fix/asn1fix_cws.c index f6e00fce6..da9202815 100644 --- a/libasn1fix/asn1fix_cws.c +++ b/libasn1fix/asn1fix_cws.c @@ -219,7 +219,21 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_row_s *row, struct asn1p_i assert(ref); expr = asn1f_lookup_symbol(arg, arg->mod, arg->expr->rhs_pspecs, ref); - if(!expr) { + if(!expr && TQ_FIRST(&cell->field->members)) { + expr = asn1p_expr_new(arg->expr->_lineno, arg->expr->module); + expr->Identifier = p; + expr->meta_type = AMT_VALUE; + expr->expr_type = A1TC_REFERENCE; + expr->reference = TQ_FIRST(&cell->field->members)->reference; + expr->value = asn1p_value_fromref(ref, 0); + if (asn1f_value_resolve(arg, expr, 0)) { + expr->Identifier = NULL; + expr->reference = NULL; + asn1p_expr_free(expr); + expr = NULL; + } + } + if (!expr) { FATAL("Cannot find %s referenced by %s at line %d", p, arg->expr->Identifier, arg->expr->_lineno); diff --git a/libasn1fix/asn1fix_value.c b/libasn1fix/asn1fix_value.c index 0e60ef7be..b881afca2 100644 --- a/libasn1fix/asn1fix_value.c +++ b/libasn1fix/asn1fix_value.c @@ -199,8 +199,28 @@ asn1f_look_value_in_type(arg_t *arg, : "" ); - if(child_expr && child_expr->value) { - if(_asn1f_copy_value(arg, value_expr, child_expr)) + if(child_expr) { + /* Maybe hasn't been fixed yet. */ + if (!child_expr->value) { + asn1p_expr_t *saved_expr = arg->expr; + arg->expr = type_expr; + switch (type_expr->expr_type) { + case ASN_BASIC_INTEGER: + asn1f_fix_integer(arg); + break; + case ASN_BASIC_ENUMERATED: + asn1f_fix_enum(arg); + break; + default: + WARNING("Unexpected type %s for %s", + type_expr->expr_type, + type_expr->Identifier); + return -1; + } + arg->expr = saved_expr; + } + if(child_expr->value && _asn1f_copy_value(arg, + value_expr, child_expr)) return -1; /* Fall through */ } From a1cbc4c633e9d9d9d9c3907a72614018446b6deb Mon Sep 17 00:00:00 2001 From: Ray Zhang Date: Sun, 17 Apr 2016 20:08:05 +0800 Subject: [PATCH 03/28] Parse Information Object successfully. Tested with S1AP. Associated Table still needs to be designed. --- libasn1compiler/asn1c_misc.c | 2 +- libasn1fix/asn1fix_constraint.c | 26 ++++++++++++++++++++++++++ libasn1fix/asn1fix_param.c | 17 ++++++++++++++++- libasn1fix/asn1fix_retrieve.c | 5 ++--- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c index 0762850af..d056dbe3a 100644 --- a/libasn1compiler/asn1c_misc.c +++ b/libasn1compiler/asn1c_misc.c @@ -204,7 +204,7 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) { } } - if(terminal && terminal->spec_index != -1) { + if(_format != TNF_RSAFE && terminal && terminal->spec_index != -1) { exprid = terminal; typename = 0; } diff --git a/libasn1fix/asn1fix_constraint.c b/libasn1fix/asn1fix_constraint.c index 847bdcea5..8d436d904 100644 --- a/libasn1fix/asn1fix_constraint.c +++ b/libasn1fix/asn1fix_constraint.c @@ -4,6 +4,7 @@ static void _remove_extensions(arg_t *arg, asn1p_constraint_t *ct, int flast); static int constraint_type_resolve(arg_t *arg, asn1p_constraint_t *ct); +static int constraint_object_resolve(arg_t *arg, asn1p_value_t *value); static int constraint_value_resolve(arg_t *arg, asn1p_value_t **value, enum asn1p_constraint_type_e real_ctype); int @@ -214,6 +215,10 @@ asn1constraint_resolve(arg_t *arg, asn1p_constraint_t *ct, asn1p_expr_type_e ety &ct->range_stop, real_constraint_type); RET2RVAL(ret, rvalue); } + if (ct->value && ct->value->type == ATV_UNPARSED && etype == A1TC_CLASSDEF) { + ret = constraint_object_resolve(arg, ct->value); + RET2RVAL(ret, rvalue); + } /* * Proceed recursively. @@ -346,3 +351,24 @@ constraint_value_resolve(arg_t *arg, return rvalue; } +static int +constraint_object_resolve(arg_t *arg, asn1p_value_t *value) { + asn1p_expr_t tmp_expr = *arg->expr; + asn1p_expr_t *saved_expr = arg->expr; + + tmp_expr.meta_type = AMT_VALUE; + tmp_expr.expr_type = A1TC_REFERENCE; + tmp_expr.value = value; + arg->expr = &tmp_expr; + + if (asn1f_parse_class_object(arg)) { + arg->expr = saved_expr; + FATAL("Parsing ObjectSet %s failed at %d", arg->expr->Identifier, + arg->expr->_lineno); + return -1; + } + + arg->expr = saved_expr; + return 0; +} + diff --git a/libasn1fix/asn1fix_param.c b/libasn1fix/asn1fix_param.c index f8e3a2e73..257c6c446 100644 --- a/libasn1fix/asn1fix_param.c +++ b/libasn1fix/asn1fix_param.c @@ -18,6 +18,7 @@ asn1f_parameterization_fork(arg_t *arg, asn1p_expr_t *expr, asn1p_expr_t *rhs_ps resolver_arg_t rarg; /* resolver argument */ asn1p_expr_t *exc; /* expr clone */ asn1p_expr_t *rpc; /* rhs_pspecs clone */ + asn1p_expr_t *m; /* expr members */ void *p; struct asn1p_pspec_s *pspec; int npspecs; @@ -69,6 +70,12 @@ asn1f_parameterization_fork(arg_t *arg, asn1p_expr_t *expr, asn1p_expr_t *rhs_ps pspec->my_clone = exc; exc->spec_index = npspecs; + /* Passing arguments to members and type references */ + exc->rhs_pspecs = expr->rhs_pspecs ? expr->rhs_pspecs : rhs_pspecs; + TQ_FOR(m, &exc->members, next) { + m->rhs_pspecs = exc->rhs_pspecs; + } + DEBUG("Forked new parameterization for %s", expr->Identifier); /* Commit */ @@ -86,7 +93,15 @@ compare_specializations(arg_t *arg, asn1p_expr_t *a, asn1p_expr_t *b) { if(ac == bc) continue; if(ac->meta_type != bc->meta_type) break; if(ac->expr_type != bc->expr_type) break; - + /* Maybe different object sets */ + if(ac->constraints && bc->constraints + && ac->constraints->containedSubtype + && bc->constraints->containedSubtype + && ac->constraints->containedSubtype->type == ATV_REFERENCED + && bc->constraints->containedSubtype->type == ATV_REFERENCED + && strcmp(ac->constraints->containedSubtype->value.reference->components[0].name, + bc->constraints->containedSubtype->value.reference->components[0].name)) + break; if(!ac->reference && !bc->reference) continue; diff --git a/libasn1fix/asn1fix_retrieve.c b/libasn1fix/asn1fix_retrieve.c index 52506b814..232905f1f 100644 --- a/libasn1fix/asn1fix_retrieve.c +++ b/libasn1fix/asn1fix_retrieve.c @@ -287,14 +287,13 @@ asn1f_lookup_symbol_impl(arg_t *arg, asn1p_module_t *mod, asn1p_expr_t *rhs_pspe break; } if(ref_tc) { + /* It is acceptable that we don't use input parameters */ if(rhs_pspecs && !ref_tc->lhs_params) { - FATAL("Parameterized type %s expected " + WARNING("Parameterized type %s expected " "for %s at line %d", ref_tc->Identifier, asn1f_printable_reference(ref), ref->_lineno); - errno = EPERM; - return NULL; } if(!rhs_pspecs && ref_tc->lhs_params) { FATAL("Type %s expects specialization " From 8ea1fc2bfbd8c88a2bbedd8f00da7501d2958dac Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Tue, 2 Aug 2016 18:44:20 +0300 Subject: [PATCH 04/28] port/merge Eurecom APER support from OPENAIRMME --- asn1c/unber.c | 4 + libasn1compiler/asn1c_C.c | 46 +++- libasn1compiler/asn1c_misc.c | 2 +- libasn1compiler/asn1c_out.h | 16 +- skeletons/ANY.c | 87 ++++++- skeletons/ANY.h | 3 + skeletons/BIT_STRING.c | 2 + skeletons/BMPString.c | 2 + skeletons/BOOLEAN.c | 46 ++++ skeletons/BOOLEAN.h | 2 + skeletons/ENUMERATED.c | 34 +++ skeletons/ENUMERATED.h | 2 + skeletons/GeneralString.c | 2 + skeletons/GeneralizedTime.c | 2 + skeletons/GraphicString.c | 2 + skeletons/IA5String.c | 2 + skeletons/INTEGER.c | 451 ++++++++++++++++++++++++++++++++- skeletons/INTEGER.h | 8 +- skeletons/ISO646String.c | 2 + skeletons/NULL.c | 44 ++++ skeletons/NULL.h | 2 + skeletons/NativeEnumerated.c | 125 +++++++++ skeletons/NativeEnumerated.h | 2 + skeletons/NativeInteger.c | 64 +++++ skeletons/NativeInteger.h | 2 + skeletons/NativeReal.c | 65 +++++ skeletons/NativeReal.h | 2 + skeletons/NumericString.c | 2 + skeletons/OBJECT_IDENTIFIER.c | 2 + skeletons/OCTET_STRING.c | 387 ++++++++++++++++++++++++++-- skeletons/OCTET_STRING.h | 2 + skeletons/ObjectDescriptor.c | 2 + skeletons/PrintableString.c | 2 + skeletons/REAL.c | 17 ++ skeletons/REAL.h | 2 + skeletons/RELATIVE-OID.c | 2 + skeletons/T61String.c | 2 + skeletons/TeletexString.c | 2 + skeletons/UTCTime.c | 2 + skeletons/UTF8String.c | 2 + skeletons/UniversalString.c | 2 + skeletons/VideotexString.c | 2 + skeletons/VisibleString.c | 2 + skeletons/asn_internal.h | 10 +- skeletons/constr_CHOICE.c | 167 +++++++++++- skeletons/constr_CHOICE.h | 2 + skeletons/constr_SEQUENCE.c | 342 ++++++++++++++++++++++++- skeletons/constr_SEQUENCE.h | 2 + skeletons/constr_SEQUENCE_OF.c | 69 ++++- skeletons/constr_SEQUENCE_OF.h | 2 + skeletons/constr_SET.c | 175 +++++++++++++ skeletons/constr_SET.h | 2 + skeletons/constr_SET_OF.c | 92 ++++++- skeletons/constr_SET_OF.h | 2 + skeletons/constr_TYPE.h | 2 + skeletons/per_decoder.c | 83 ++++++ skeletons/per_decoder.h | 22 ++ skeletons/per_encoder.c | 93 +++++++ skeletons/per_encoder.h | 11 + skeletons/per_opentype.c | 29 +++ skeletons/per_opentype.h | 2 + skeletons/per_support.c | 198 ++++++++++++++- skeletons/per_support.h | 27 +- 63 files changed, 2739 insertions(+), 46 deletions(-) diff --git a/asn1c/unber.c b/asn1c/unber.c index 43bdff949..d628ceba9 100644 --- a/asn1c/unber.c +++ b/asn1c/unber.c @@ -846,6 +846,10 @@ OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts, return er; } +asn_dec_rval_t OCTET_STRING_decode_aper(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rv = { 0, 0 }; (void)ctx; (void)td; (void)cts; (void)sptr; (void)pd; return rv; } + +asn_enc_rval_t OCTET_STRING_encode_aper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts, void *sptr, asn_per_outp_t *po) { asn_enc_rval_t er = { 0, 0, 0 }; (void)td; (void)cts; (void)sptr; (void)po; return er; } + size_t xer_whitespace_span(const void *chunk_buf, size_t chunk_size) { (void)chunk_buf; diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c index b4cd736cd..ecbf9bbe2 100644 --- a/libasn1compiler/asn1c_C.c +++ b/libasn1compiler/asn1c_C.c @@ -1242,6 +1242,8 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { OUT("td->xer_encoder = asn_DEF_%s.xer_encoder;\n", type_name); OUT("td->uper_decoder = asn_DEF_%s.uper_decoder;\n", type_name); OUT("td->uper_encoder = asn_DEF_%s.uper_encoder;\n", type_name); + OUT("td->aper_decoder = asn_DEF_%s.aper_decoder;\n", type_name); + OUT("td->aper_encoder = asn_DEF_%s.aper_encoder;\n", type_name); if(!terminal && !tags_count) { OUT("/* The next four lines are here because of -fknown-extern-type */\n"); OUT("td->tags = asn_DEF_%s.tags;\n", type_name); @@ -1394,7 +1396,39 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { ); OUT("}\n"); OUT("\n"); - } + + p = MKID(expr); + if(HIDE_INNER_DEFS) OUT("static "); + OUT("asn_enc_rval_t\n"); + OUT("%s", p); + if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index); + OUT("_encode_aper(asn_TYPE_descriptor_t *td,\n"); + INDENTED( + OUT("\tasn_per_constraints_t *constraints,\n"); + OUT("\tvoid *structure, asn_per_outp_t *per_out) {\n"); + OUT("%s_%d_inherit_TYPE_descriptor(td);\n", + p, expr->_type_unique_index); + OUT("return td->aper_encoder(td, constraints, structure, per_out);\n"); + ); + OUT("}\n"); + OUT("\n"); + + p = MKID(expr); + + if(HIDE_INNER_DEFS) OUT("static "); + OUT("asn_dec_rval_t\n"); + OUT("%s", p); + if(HIDE_INNER_DEFS) OUT("_%d", expr->_type_unique_index); + OUT("_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,\n"); + INDENTED( + OUT("\tasn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) {\n"); + OUT("%s_%d_inherit_TYPE_descriptor(td);\n", + p, expr->_type_unique_index); + OUT("return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data);\n"); + ); + OUT("}\n"); + OUT("\n"); + } REDIR(OT_FUNC_DECLS); @@ -1415,6 +1449,8 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) { if(arg->flags & A1C_GEN_PER) { OUT("per_type_decoder_f %s_decode_uper;\n", p); OUT("per_type_encoder_f %s_encode_uper;\n", p); + OUT("per_type_decoder_f %s_decode_aper;\n", p); + OUT("per_type_encoder_f %s_encode_aper;\n", p); } } @@ -2003,7 +2039,7 @@ emit_member_PER_constraints(arg_t *arg, asn1p_expr_t *expr, const char *pfx) { break; case ASN_STRING_UniversalString: OUT("{ APC_CONSTRAINED,\t32, 32," - " 0, 2147483647 }" + " 0, 2147483647L }" " /* special case 1 */\n"); goto avoid; default: @@ -2456,8 +2492,12 @@ emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, enum tvm_compat tv_mode, int tags_ if(arg->flags & A1C_GEN_PER) { FUNCREF(decode_uper); FUNCREF(encode_uper); + FUNCREF(decode_aper); + FUNCREF(encode_aper); } else { - OUT("0, 0,\t/* No PER support, " + OUT("0, 0,\t/* No UPER support, " + "use \"-gen-PER\" to enable */\n"); + OUT("0, 0,\t/* No APER support, " "use \"-gen-PER\" to enable */\n"); } diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c index d056dbe3a..3f2cce8ca 100644 --- a/libasn1compiler/asn1c_misc.c +++ b/libasn1compiler/asn1c_misc.c @@ -383,7 +383,7 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) { if(left.type == ARE_VALUE && left.value >= 0 && right.type == ARE_VALUE - && right.value > 2147483647 + && right.value > 2147483647L && right.value <= (asn1c_integer_t)(4294967295UL)) return FL_FITS_UNSIGN; diff --git a/libasn1compiler/asn1c_out.h b/libasn1compiler/asn1c_out.h index e21827e07..1d4522a8e 100644 --- a/libasn1compiler/asn1c_out.h +++ b/libasn1compiler/asn1c_out.h @@ -119,15 +119,23 @@ int asn1c_compiled_output(arg_t *arg, const char *fmt, ...); #define OINT(iv) do { \ if(iv == (-2147483647L - 1)) \ OUT("(-2147483647L - 1)"); \ - else \ - OUT("%" PRIdASN, iv); \ + else if (iv > 4294967296UL) \ + OUT("%" PRIdASN "ull", iv); \ + else if (iv > 2147483647L) \ + OUT("%" PRIdASN "ul", iv); \ + else \ + OUT("%" PRIdASN "l", iv); \ } while(0) #define OINTS(iv) do { \ if(iv == (-2147483647L - 1)) \ OUT("(-2147483647L - 1)"); \ - else \ - OUT("% " PRIdASN, iv); \ + else if (iv > 4294967296UL) \ + OUT("%" PRIdASN "ull", iv); \ + else if (iv > 2147483647L) \ + OUT("%" PRIdASN "ul", iv); \ + else \ + OUT("% " PRIdASN "l", iv); \ } while(0) #endif /* ASN1_COMPILED_OUTPUT_H */ diff --git a/skeletons/ANY.c b/skeletons/ANY.c index 77024bdcf..128b5507b 100644 --- a/skeletons/ANY.c +++ b/skeletons/ANY.c @@ -21,7 +21,10 @@ asn_TYPE_descriptor_t asn_DEF_ANY = { OCTET_STRING_encode_der, OCTET_STRING_decode_xer_hex, ANY_encode_xer, - 0, 0, + OCTET_STRING_decode_uper, + OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ 0, 0, 0, 0, 0, /* No PER visible constraints */ @@ -87,6 +90,37 @@ ANY_fromType(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr) { return 0; } +int +ANY_fromType_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr) { + uint8_t *buffer = NULL; + ssize_t erval; + + if(!st || !td) { + errno = EINVAL; + return -1; + } + + if(!sptr) { + if(st->buf) FREEMEM(st->buf); + st->size = 0; + return 0; + } + + erval = aper_encode_to_new_buffer(td, td->per_constraints, sptr, (void**)&buffer); + + if(erval == -1) { + if(buffer) FREEMEM(buffer); + return -1; + } + assert((size_t)erval > 0); + + if(st->buf) FREEMEM(st->buf); + st->buf = buffer; + st->size = erval; + + return 0; +} + ANY_t * ANY_new_fromType(asn_TYPE_descriptor_t *td, void *sptr) { ANY_t tmp; @@ -111,6 +145,30 @@ ANY_new_fromType(asn_TYPE_descriptor_t *td, void *sptr) { } } +ANY_t * +ANY_new_fromType_aper(asn_TYPE_descriptor_t *td, void *sptr) { + ANY_t tmp; + ANY_t *st; + + if(!td || !sptr) { + errno = EINVAL; + return 0; + } + + memset(&tmp, 0, sizeof(tmp)); + + if(ANY_fromType_aper(&tmp, td, sptr)) return 0; + + st = (ANY_t *)CALLOC(1, sizeof(ANY_t)); + if(st) { + *st = tmp; + return st; + } else { + FREEMEM(tmp.buf); + return 0; + } +} + int ANY_to_type(ANY_t *st, asn_TYPE_descriptor_t *td, void **struct_ptr) { asn_dec_rval_t rval; @@ -138,6 +196,33 @@ ANY_to_type(ANY_t *st, asn_TYPE_descriptor_t *td, void **struct_ptr) { } } +int +ANY_to_type_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void **struct_ptr) { + asn_dec_rval_t rval; + void *newst = 0; + + if(!st || !td || !struct_ptr) { + errno = EINVAL; + return -1; + } + + if(st->buf == 0) { + /* Nothing to convert, make it empty. */ + *struct_ptr = (void *)0; + return 0; + } + + rval = aper_decode(0, td, (void **)&newst, st->buf, st->size, 0, 0); + if(rval.code == RC_OK) { + *struct_ptr = newst; + return 0; + } else { + /* Remove possibly partially decoded data. */ + ASN_STRUCT_FREE(*td, newst); + return -1; + } +} + static int ANY__consume_bytes(const void *buffer, size_t size, void *key) { struct _callback_arg *arg = (struct _callback_arg *)key; diff --git a/skeletons/ANY.h b/skeletons/ANY.h index b7d92fa98..a68441dfe 100644 --- a/skeletons/ANY.h +++ b/skeletons/ANY.h @@ -32,10 +32,13 @@ xer_type_encoder_f ANY_encode_xer; /* Convert another ASN.1 type into the ANY. This implies DER encoding. */ int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr); +int ANY_fromType_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr); ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr); +ANY_t *ANY_new_fromType_aper(asn_TYPE_descriptor_t *td, void *sptr); /* Convert the contents of the ANY type into the specified type. */ int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr); +int ANY_to_type_aper(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr); #define ANY_fromBuf(s, buf, size) OCTET_STRING_fromBuf((s), (buf), (size)) #define ANY_new_fromBuf(buf, size) OCTET_STRING_new_fromBuf( \ diff --git a/skeletons/BIT_STRING.c b/skeletons/BIT_STRING.c index 997ff4161..d32a12fcf 100644 --- a/skeletons/BIT_STRING.c +++ b/skeletons/BIT_STRING.c @@ -29,6 +29,8 @@ asn_TYPE_descriptor_t asn_DEF_BIT_STRING = { BIT_STRING_encode_xer, OCTET_STRING_decode_uper, /* Unaligned PER decoder */ OCTET_STRING_encode_uper, /* Unaligned PER encoder */ + OCTET_STRING_decode_aper, /* Aligned PER decoder */ + OCTET_STRING_encode_aper, /* Aligned PER encoder */ 0, /* Use generic outmost tag fetcher */ asn_DEF_BIT_STRING_tags, sizeof(asn_DEF_BIT_STRING_tags) diff --git a/skeletons/BMPString.c b/skeletons/BMPString.c index 8beaabdad..aa248dc08 100644 --- a/skeletons/BMPString.c +++ b/skeletons/BMPString.c @@ -35,6 +35,8 @@ asn_TYPE_descriptor_t asn_DEF_BMPString = { BMPString_encode_xer, /* Convert to UTF-8 */ OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, /* Aligned PER decoder */ + OCTET_STRING_encode_aper, /* Aligned PER encoder */ 0, /* Use generic outmost tag fetcher */ asn_DEF_BMPString_tags, sizeof(asn_DEF_BMPString_tags) diff --git a/skeletons/BOOLEAN.c b/skeletons/BOOLEAN.c index 6e55b3e6f..dbecbafd1 100644 --- a/skeletons/BOOLEAN.c +++ b/skeletons/BOOLEAN.c @@ -24,6 +24,8 @@ asn_TYPE_descriptor_t asn_DEF_BOOLEAN = { BOOLEAN_encode_xer, BOOLEAN_decode_uper, /* Unaligned PER decoder */ BOOLEAN_encode_uper, /* Unaligned PER encoder */ + BOOLEAN_decode_aper, /* Aligned PER decoder */ + BOOLEAN_encode_aper, /* Aligned PER encoder */ 0, /* Use generic outmost tag fetcher */ asn_DEF_BOOLEAN_tags, sizeof(asn_DEF_BOOLEAN_tags) / sizeof(asn_DEF_BOOLEAN_tags[0]), @@ -264,6 +266,35 @@ BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, return rv; } +asn_dec_rval_t +BOOLEAN_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + BOOLEAN_t *st = (BOOLEAN_t *)*sptr; + + (void)opt_codec_ctx; + (void)constraints; + + if(!st) { + st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st))); + if(!st) ASN__DECODE_FAILED; + } + + /* + * Extract a single bit + */ + switch(per_get_few_bits(pd, 1)) { + case 1: *st = 1; break; + case 0: *st = 0; break; + case -1: default: ASN__DECODE_STARVED; + } + + ASN_DEBUG("%s decoded as %s", td->name, *st ? "TRUE" : "FALSE"); + + rv.code = RC_OK; + rv.consumed = 1; + return rv; +} asn_enc_rval_t BOOLEAN_encode_uper(asn_TYPE_descriptor_t *td, @@ -280,3 +311,18 @@ BOOLEAN_encode_uper(asn_TYPE_descriptor_t *td, ASN__ENCODED_OK(er); } + +asn_enc_rval_t +BOOLEAN_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; + asn_enc_rval_t er; + + (void)constraints; + + if(!st) ASN__ENCODE_FAILED; + + per_put_few_bits(po, *st ? 1 : 0, 1); + + ASN__ENCODED_OK(er); +} diff --git a/skeletons/BOOLEAN.h b/skeletons/BOOLEAN.h index 217d0f163..8ea28928b 100644 --- a/skeletons/BOOLEAN.h +++ b/skeletons/BOOLEAN.h @@ -28,6 +28,8 @@ xer_type_decoder_f BOOLEAN_decode_xer; xer_type_encoder_f BOOLEAN_encode_xer; per_type_decoder_f BOOLEAN_decode_uper; per_type_encoder_f BOOLEAN_encode_uper; +per_type_decoder_f BOOLEAN_decode_aper; +per_type_encoder_f BOOLEAN_encode_aper; #ifdef __cplusplus } diff --git a/skeletons/ENUMERATED.c b/skeletons/ENUMERATED.c index ccb003e4d..be46e192d 100644 --- a/skeletons/ENUMERATED.c +++ b/skeletons/ENUMERATED.c @@ -26,6 +26,8 @@ asn_TYPE_descriptor_t asn_DEF_ENUMERATED = { INTEGER_encode_xer, ENUMERATED_decode_uper, /* Unaligned PER decoder */ ENUMERATED_encode_uper, /* Unaligned PER encoder */ + ENUMERATED_decode_aper, /* Aligned PER decoder */ + ENUMERATED_encode_aper, /* Aligned PER encoder */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ENUMERATED_tags, sizeof(asn_DEF_ENUMERATED_tags) / sizeof(asn_DEF_ENUMERATED_tags[0]), @@ -57,6 +59,27 @@ ENUMERATED_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td return rval; } +asn_dec_rval_t +ENUMERATED_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rval; + ENUMERATED_t *st = (ENUMERATED_t *)*sptr; + long value; + void *vptr = &value; + + if(!st) { + st = (ENUMERATED_t *)(*sptr = CALLOC(1, sizeof(*st))); + if(!st) ASN__DECODE_FAILED; + } + + rval = NativeEnumerated_decode_aper(opt_codec_ctx, td, constraints, + (void **)&vptr, pd); + if(rval.code == RC_OK) + if(asn_long2INTEGER(st, value)) + rval.code = RC_FAIL; + return rval; +} + asn_enc_rval_t ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { @@ -69,3 +92,14 @@ ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td, return NativeEnumerated_encode_uper(td, constraints, &value, po); } +asn_enc_rval_t +ENUMERATED_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + ENUMERATED_t *st = (ENUMERATED_t *)sptr; + long value; + + if(asn_INTEGER2long(st, &value)) + ASN__ENCODE_FAILED; + + return NativeEnumerated_encode_aper(td, constraints, &value, po); +} diff --git a/skeletons/ENUMERATED.h b/skeletons/ENUMERATED.h index 542dcae94..5c4a2eda9 100644 --- a/skeletons/ENUMERATED.h +++ b/skeletons/ENUMERATED.h @@ -17,6 +17,8 @@ extern asn_TYPE_descriptor_t asn_DEF_ENUMERATED; per_type_decoder_f ENUMERATED_decode_uper; per_type_encoder_f ENUMERATED_encode_uper; +per_type_decoder_f ENUMERATED_decode_aper; +per_type_encoder_f ENUMERATED_encode_aper; #ifdef __cplusplus } diff --git a/skeletons/GeneralString.c b/skeletons/GeneralString.c index c398d2b3b..934b8a2b4 100644 --- a/skeletons/GeneralString.c +++ b/skeletons/GeneralString.c @@ -24,6 +24,8 @@ asn_TYPE_descriptor_t asn_DEF_GeneralString = { OCTET_STRING_encode_xer, OCTET_STRING_decode_uper, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_GeneralString_tags, sizeof(asn_DEF_GeneralString_tags) diff --git a/skeletons/GeneralizedTime.c b/skeletons/GeneralizedTime.c index 7e144777a..9fd36d262 100644 --- a/skeletons/GeneralizedTime.c +++ b/skeletons/GeneralizedTime.c @@ -181,6 +181,8 @@ asn_TYPE_descriptor_t asn_DEF_GeneralizedTime = { GeneralizedTime_encode_xer, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_GeneralizedTime_tags, sizeof(asn_DEF_GeneralizedTime_tags) diff --git a/skeletons/GraphicString.c b/skeletons/GraphicString.c index e572ccdf4..5f6248630 100644 --- a/skeletons/GraphicString.c +++ b/skeletons/GraphicString.c @@ -24,6 +24,8 @@ asn_TYPE_descriptor_t asn_DEF_GraphicString = { OCTET_STRING_encode_xer, /* Can't expect it to be ASCII/UTF8 */ OCTET_STRING_decode_uper, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_GraphicString_tags, sizeof(asn_DEF_GraphicString_tags) diff --git a/skeletons/IA5String.c b/skeletons/IA5String.c index b856d3047..766963cce 100644 --- a/skeletons/IA5String.c +++ b/skeletons/IA5String.c @@ -29,6 +29,8 @@ asn_TYPE_descriptor_t asn_DEF_IA5String = { OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_IA5String_tags, sizeof(asn_DEF_IA5String_tags) diff --git a/skeletons/INTEGER.c b/skeletons/INTEGER.c index eed82176b..d10057757 100644 --- a/skeletons/INTEGER.c +++ b/skeletons/INTEGER.c @@ -30,6 +30,8 @@ asn_TYPE_descriptor_t asn_DEF_INTEGER = { #else INTEGER_decode_uper, /* Unaligned PER decoder */ INTEGER_encode_uper, /* Unaligned PER encoder */ + INTEGER_decode_aper, + INTEGER_encode_aper, #endif /* ASN_DISABLE_PER_SUPPORT */ 0, /* Use generic outmost tag fetcher */ asn_DEF_INTEGER_tags, @@ -410,7 +412,7 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun (asn_INTEGER_specifics_t *) td->specifics, lstart, lstop); if(el) { - ASN_DEBUG("Found \"%s\" => %ld", + ASN_DEBUG("Found \"%s\" => %lld", el->enum_name, el->nat_value); dec_value = el->nat_value; state = ST_END_ENUM; @@ -608,7 +610,7 @@ INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, if(uper_get_constrained_whole_number(pd, &uvalue, ct->range_bits)) ASN__DECODE_STARVED; - ASN_DEBUG("Got value %lu + low %ld", + ASN_DEBUG("Got value %lu + low %lld", uvalue, ct->lower_bound); uvalue += ct->lower_bound; if(asn_ulong2INTEGER(st, uvalue)) @@ -665,6 +667,149 @@ INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, return rval; } +asn_dec_rval_t +INTEGER_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval = { RC_OK, 0 }; + INTEGER_t *st = (INTEGER_t *)*sptr; + asn_per_constraint_t *ct; + int repeat; + + (void)opt_codec_ctx; + + if(!st) { + st = (INTEGER_t *)(*sptr = CALLOC(1, sizeof(*st))); + if(!st) ASN__DECODE_FAILED; + } + + if(!constraints) constraints = td->per_constraints; + ct = constraints ? &constraints->value : 0; + + if(ct && ct->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) ASN__DECODE_STARVED; + if(inext) ct = 0; + } + + FREEMEM(st->buf); + st->buf = 0; + st->size = 0; + if(ct) { + if(ct->flags & APC_SEMI_CONSTRAINED) { + st->buf = (uint8_t *)CALLOC(1, 2); + if(!st->buf) ASN__DECODE_FAILED; + st->size = 1; + } else if(ct->flags & APC_CONSTRAINED && ct->range_bits >= 0) { + size_t size = (ct->range_bits + 7) >> 3; + st->buf = (uint8_t *)MALLOC(1 + size + 1); + if(!st->buf) ASN__DECODE_FAILED; + st->size = size; + } + } + + /* X.691, #12.2.2 */ + if(ct && ct->flags != APC_UNCONSTRAINED) { + /* #10.5.6 */ + ASN_DEBUG("Integer with range %d bits", ct->range_bits); + if(ct->range_bits >= 0) { + if (ct->range_bits > 16) { + int max_range_bytes = (ct->range_bits >> 3) + 1; + int length, i; + int64_t value = 0; + + for (i = 0; i < max_range_bytes; i++) { + int upper = 1 << (i + 1); + if (upper > max_range_bytes) + break; + } + if ((length = per_get_few_bits(pd, i + 1)) < 0) + ASN__DECODE_FAILED; + if (aper_get_align(pd) != 0) + ASN__DECODE_FAILED; + ASN_DEBUG("Got length %d", length + 1); + for (i = 0; i < length + 1; i++) { + int buf = per_get_few_bits(pd, 8); + if (buf < 0) + ASN__DECODE_FAILED; + value += (((int64_t)buf) << (8 * i)); + } + + if((specs && specs->field_unsigned) + ? asn_uint642INTEGER(st, value) + : asn_int642INTEGER(st, value)) + ASN__DECODE_FAILED; + ASN_DEBUG("Got value %lld + low %lld", + value, ct->lower_bound); + value += ct->lower_bound; + } else { + long value = 0; + if (ct->range_bits < 8) { + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) ASN__DECODE_STARVED; + } else if (ct->range_bits == 8) { + if (aper_get_align(pd) < 0) + ASN__DECODE_FAILED; + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) ASN__DECODE_STARVED; + } else { + /* Align */ + if (aper_get_align(pd) < 0) + ASN__DECODE_FAILED; + value = per_get_few_bits(pd, 16); + if(value < 0) ASN__DECODE_STARVED; + } + if((specs && specs->field_unsigned) + ? asn_ulong2INTEGER(st, value) + : asn_long2INTEGER(st, value)) + ASN__DECODE_FAILED; + ASN_DEBUG("Got value %ld + low %lld", + value, ct->lower_bound); + value += ct->lower_bound; + } + return rval; + } else { + ASN__DECODE_FAILED; + } + } else { + ASN_DEBUG("Decoding unconstrained integer %s", td->name); + } + + /* X.691, #12.2.3, #12.2.4 */ + do { + ssize_t len; + void *p; + int ret; + + /* Get the PER length */ + len = aper_get_length(pd, -1, -1, &repeat); + if(len < 0) ASN__DECODE_STARVED; + + p = REALLOC(st->buf, st->size + len + 1); + if(!p) ASN__DECODE_FAILED; + st->buf = (uint8_t *)p; + + ret = per_get_many_bits(pd, &st->buf[st->size], 0, 8 * len); + if(ret < 0) ASN__DECODE_STARVED; + st->size += len; + } while(repeat); + st->buf[st->size] = 0; /* JIC */ + + /* #12.2.3 */ + if(ct && ct->lower_bound) { + /* + * TODO: replace by in-place arithmetics. + */ + long value; + if(asn_INTEGER2long(st, &value)) + ASN__DECODE_FAILED; + if(asn_long2INTEGER(st, value + ct->lower_bound)) + ASN__DECODE_FAILED; + } + + return rval; +} + asn_enc_rval_t INTEGER_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { @@ -699,7 +844,7 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td, || uval > (unsigned long)ct->upper_bound) inext = 1; } - ASN_DEBUG("Value %lu (%02x/%d) lb %lu ub %lu %s", + ASN_DEBUG("Value %lu (%02x/%d) lb %llu ub %llu %s", uval, st->buf[0], st->size, ct->lower_bound, ct->upper_bound, inext ? "ext" : "fix"); @@ -716,7 +861,7 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td, || value > ct->upper_bound) inext = 1; } - ASN_DEBUG("Value %ld (%02x/%d) lb %ld ub %ld %s", + ASN_DEBUG("Value %ld (%02x/%d) lb %lld ub %lld %s", value, st->buf[0], st->size, ct->lower_bound, ct->upper_bound, inext ? "ext" : "fix"); @@ -743,7 +888,7 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td, } if(ct && ct->lower_bound) { - ASN_DEBUG("Adjust lower bound to %ld", ct->lower_bound); + ASN_DEBUG("Adjust lower bound to %lld", ct->lower_bound); /* TODO: adjust lower bound */ ASN__ENCODE_FAILED; } @@ -762,6 +907,190 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td, #endif /* ASN_DISABLE_PER_SUPPORT */ +asn_enc_rval_t +INTEGER_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + INTEGER_t *st = (INTEGER_t *)sptr; + const uint8_t *buf; + const uint8_t *end; + asn_per_constraint_t *ct; + int64_t value = 0; + + if(!st || st->size == 0) ASN__ENCODE_FAILED; + + if(!constraints) constraints = td->per_constraints; + ct = constraints ? &constraints->value : 0; + + er.encoded = 0; + + if(ct) { + int inext = 0; + if(specs && specs->field_unsigned) { + uint64_t uval; + if(asn_INTEGER2uint64(st, &uval)) + ASN__ENCODE_FAILED; + /* Check proper range */ + if(ct->flags & APC_SEMI_CONSTRAINED) { + if(uval < (unsigned long long)ct->lower_bound) + inext = 1; + } else if(ct->range_bits >= 0) { + if(uval < (unsigned long long)ct->lower_bound + || uval > (unsigned long long)ct->upper_bound) + inext = 1; + } + ASN_DEBUG("Value %llu (%02x/%d) lb %llu ub %llu %s", + uval, st->buf[0], st->size, + ct->lower_bound, ct->upper_bound, + inext ? "ext" : "fix"); + value = uval; + } else { + if(asn_INTEGER2int64(st, &value)) ASN__ENCODE_FAILED; + /* Check proper range */ + if(ct->flags & APC_SEMI_CONSTRAINED) { + if(value < ct->lower_bound) + inext = 1; + } else if(ct->range_bits >= 0) { + if(value < ct->lower_bound + || value > ct->upper_bound) + inext = 1; + } + ASN_DEBUG("Value %lld (%02x/%d) lb %lld ub %lld %s", + value, st->buf[0], st->size, + ct->lower_bound, ct->upper_bound, + inext ? "ext" : "fix"); + } + if(ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, inext, 1)) + ASN__ENCODE_FAILED; + if(inext) ct = 0; + } else if(inext) { + ASN__ENCODE_FAILED; + } + } + + /* X.691, #12.2.2 */ + if(ct && ct->range_bits >= 0) { + /* #10.5.6 */ + ASN_DEBUG("Encoding integer with range %d bits", + ct->range_bits); + + /* #12 <= 8 -> alignment ? */ + if (ct->range_bits < 8) { + if(per_put_few_bits(po, 0x00 | value, ct->range_bits)) + ASN__ENCODE_FAILED; + } else if (ct->range_bits == 8) { + if(aper_put_align(po) < 0) + ASN__ENCODE_FAILED; + if(per_put_few_bits(po, 0x00 | value, ct->range_bits)) + ASN__ENCODE_FAILED; + } else if (ct->range_bits <= 16) { + // Consume the bytes to align on octet + if(aper_put_align(po) < 0) + ASN__ENCODE_FAILED; + if(per_put_few_bits(po, 0x0000 | value, + 16)) + ASN__ENCODE_FAILED; + } else { + /* TODO: extend to >64 bits */ + int64_t v = value; + int i; + + /* Putting length - 1 in the minimum number of bits ex: 5 = 3bits */ + if (per_put_few_bits(po, st->size - 1, (ct->range_bits >> 3)-1)) + ASN__ENCODE_FAILED; + + // Consume the bits to align on octet + if (aper_put_align(po) < 0) + ASN__ENCODE_FAILED; + /* Put the value */ + for (i = 0; i < st->size; i++) { + if(per_put_few_bits(po, (v >> (8 * (st->size - i - 1))) & 0xff, 8)) ASN__ENCODE_FAILED; + } + } + ASN__ENCODED_OK(er); + } + + if(ct && ct->lower_bound) { + ASN_DEBUG("Adjust lower bound to %lld", ct->lower_bound); + /* TODO: adjust lower bound */ + ASN__ENCODE_FAILED; + } + + for(buf = st->buf, end = st->buf + st->size; buf < end;) { + ssize_t mayEncode = aper_put_length(po, -1, end - buf); + if(mayEncode < 0) + ASN__ENCODE_FAILED; + if(per_put_many_bits(po, buf, 8 * mayEncode)) + ASN__ENCODE_FAILED; + buf += mayEncode; + } + + ASN__ENCODED_OK(er); +} + +int +asn_INTEGER2int64(const INTEGER_t *iptr, int64_t *lptr) { + uint8_t *b, *end; + size_t size; + int64_t l; + + /* Sanity checking */ + if(!iptr || !iptr->buf || !lptr) { + errno = EINVAL; + return -1; + } + + /* Cache the begin/end of the buffer */ + b = iptr->buf; /* Start of the INTEGER buffer */ + size = iptr->size; + end = b + size; /* Where to stop */ + + if(size > sizeof(int64_t)) { + uint8_t *end1 = end - 1; + /* + * Slightly more advanced processing, + * able to >sizeof(int64_t) bytes, + * when the actual value is small + * (0x0000000000abcdef would yield a fine 0x00abcdef) + */ + /* Skip out the insignificant leading bytes */ + for(; b < end1; b++) { + switch(*b) { + case 0x00: if((b[1] & 0x80) == 0) continue; break; + case 0xff: if((b[1] & 0x80) != 0) continue; break; + } + break; + } + + size = end - b; + if(size > sizeof(int64_t)) { + /* Still cannot fit the int64_t */ + errno = ERANGE; + return -1; + } + } + + /* Shortcut processing of a corner case */ + if(end == b) { + *lptr = 0; + return 0; + } + + /* Perform the sign initialization */ + /* Actually l = -(*b >> 7); gains nothing, yet unreadable! */ + if((*b >> 7)) l = -1; else l = 0; + + /* Conversion engine */ + for(; b < end; b++) + l = (l << 8) | *b; + + *lptr = l; + return 0; +} + + int asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) { uint8_t *b, *end; @@ -854,6 +1183,38 @@ asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) { return 0; } +int +asn_INTEGER2uint64(const INTEGER_t *iptr, uint64_t *lptr) { + uint8_t *b, *end; + uint64_t l; + size_t size; + + if(!iptr || !iptr->buf || !lptr) { + errno = EINVAL; + return -1; + } + + b = iptr->buf; + size = iptr->size; + end = b + size; + + /* If all extra leading bytes are zeroes, ignore them */ + for(; size > sizeof(uint64_t); b++, size--) { + if(*b) { + /* Value won't fit unsigned long */ + errno = ERANGE; + return -1; + } + } + + /* Conversion engine */ + for(l = 0; b < end; b++) + l = (l << 8) | *b; + + *lptr = l; + return 0; +} + int asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) { uint8_t *buf; @@ -879,6 +1240,86 @@ asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) { return 0; } +int +asn_uint642INTEGER(INTEGER_t *st, uint64_t value) { + uint8_t *buf; + uint8_t *end; + uint8_t *b; + int shr; + + if(value <= INT64_MAX) + return asn_int642INTEGER(st, value); + + buf = (uint8_t *)MALLOC(1 + sizeof(value)); + if(!buf) return -1; + + end = buf + (sizeof(value) + 1); + buf[0] = 0; + for(b = buf + 1, shr = (sizeof(value)-1)*8; b < end; shr -= 8, b++) + *b = (uint8_t)(value >> shr); + + if(st->buf) FREEMEM(st->buf); + st->buf = buf; + st->size = 1 + sizeof(value); + + return 0; +} + +int +asn_int642INTEGER(INTEGER_t *st, int64_t value) { + uint8_t *buf, *bp; + uint8_t *p; + uint8_t *pstart; + uint8_t *pend1; + int littleEndian = 1; /* Run-time detection */ + int add; + + if(!st) { + errno = EINVAL; + return -1; + } + + buf = (uint8_t *)MALLOC(sizeof(value)); + if(!buf) return -1; + + if(*(char *)&littleEndian) { + pstart = (uint8_t *)&value + sizeof(value) - 1; + pend1 = (uint8_t *)&value; + add = -1; + } else { + pstart = (uint8_t *)&value; + pend1 = pstart + sizeof(value) - 1; + add = 1; + } + + /* + * If the contents octet consists of more than one octet, + * then bits of the first octet and bit 8 of the second octet: + * a) shall not all be ones; and + * b) shall not all be zero. + */ + for(p = pstart; p != pend1; p += add) { + switch(*p) { + case 0x00: if((*(p+add) & 0x80) == 0) + continue; + break; + case 0xff: if((*(p+add) & 0x80)) + continue; + break; + } + break; + } + /* Copy the integer body */ + for(pstart = p, bp = buf, pend1 += add; p != pend1; p += add) + *bp++ = *p; + + if(st->buf) FREEMEM(st->buf); + st->buf = buf; + st->size = bp - buf; + + return 0; +} + int asn_long2INTEGER(INTEGER_t *st, long value) { uint8_t *buf, *bp; diff --git a/skeletons/INTEGER.h b/skeletons/INTEGER.h index 9a8809707..5e0d94ae2 100644 --- a/skeletons/INTEGER.h +++ b/skeletons/INTEGER.h @@ -18,7 +18,7 @@ extern asn_TYPE_descriptor_t asn_DEF_INTEGER; /* Map with to integer value association */ typedef struct asn_INTEGER_enum_map_s { - long nat_value; /* associated native integer value */ + int64_t nat_value; /* associated native integer value */ size_t enum_len; /* strlen("tag") */ const char *enum_name; /* "tag" */ } asn_INTEGER_enum_map_t; @@ -41,6 +41,8 @@ xer_type_decoder_f INTEGER_decode_xer; xer_type_encoder_f INTEGER_encode_xer; per_type_decoder_f INTEGER_decode_uper; per_type_encoder_f INTEGER_encode_uper; +per_type_decoder_f INTEGER_decode_aper; +per_type_encoder_f INTEGER_encode_aper; /*********************************** * Some handy conversion routines. * @@ -52,8 +54,12 @@ per_type_encoder_f INTEGER_encode_uper; * -1/ERANGE: Value encoded is out of range for long representation * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()). */ +int asn_INTEGER2int64(const INTEGER_t *i, int64_t *l); +int asn_INTEGER2uint64(const INTEGER_t *i, uint64_t *l); int asn_INTEGER2long(const INTEGER_t *i, long *l); int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l); +int asn_int642INTEGER(INTEGER_t *i, int64_t l); +int asn_uint642INTEGER(INTEGER_t *i, uint64_t l); int asn_long2INTEGER(INTEGER_t *i, long l); int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l); diff --git a/skeletons/ISO646String.c b/skeletons/ISO646String.c index 8d681c821..a6cc76192 100644 --- a/skeletons/ISO646String.c +++ b/skeletons/ISO646String.c @@ -29,6 +29,8 @@ asn_TYPE_descriptor_t asn_DEF_ISO646String = { OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_ISO646String_tags, sizeof(asn_DEF_ISO646String_tags) diff --git a/skeletons/NULL.c b/skeletons/NULL.c index 62bc91e05..51af26257 100644 --- a/skeletons/NULL.c +++ b/skeletons/NULL.c @@ -25,6 +25,8 @@ asn_TYPE_descriptor_t asn_DEF_NULL = { NULL_encode_xer, NULL_decode_uper, /* Unaligned PER decoder */ NULL_encode_uper, /* Unaligned PER encoder */ + NULL_decode_aper, /* Aligned PER decoder */ + NULL_encode_aper, /* Aligned PER encoder */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NULL_tags, sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]), @@ -136,6 +138,34 @@ NULL_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, return rv; } +asn_dec_rval_t +NULL_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + + (void)opt_codec_ctx; + (void)td; + (void)constraints; + (void)pd; + + if(!*sptr) { + *sptr = MALLOC(sizeof(NULL_t)); + if(*sptr) { + *(NULL_t *)*sptr = 0; + } else { + ASN__DECODE_FAILED; + } + } + + /* + * NULL type does not have content octets. + */ + + rv.code = RC_OK; + rv.consumed = 0; + return rv; +} + asn_enc_rval_t NULL_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { @@ -149,3 +179,17 @@ NULL_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, er.encoded = 0; ASN__ENCODED_OK(er); } + +asn_enc_rval_t +NULL_encode_aper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void *sptr, asn_per_outp_t *po) { + asn_enc_rval_t er; + + (void)td; + (void)constraints; + (void)sptr; + (void)po; + + er.encoded = 0; + ASN__ENCODED_OK(er); +} diff --git a/skeletons/NULL.h b/skeletons/NULL.h index 131e77592..90784d811 100644 --- a/skeletons/NULL.h +++ b/skeletons/NULL.h @@ -25,6 +25,8 @@ xer_type_decoder_f NULL_decode_xer; xer_type_encoder_f NULL_encode_xer; per_type_decoder_f NULL_decode_uper; per_type_encoder_f NULL_encode_uper; +per_type_decoder_f NULL_decode_aper; +per_type_encoder_f NULL_encode_aper; #ifdef __cplusplus } diff --git a/skeletons/NativeEnumerated.c b/skeletons/NativeEnumerated.c index 78366af31..7fe735eaf 100644 --- a/skeletons/NativeEnumerated.c +++ b/skeletons/NativeEnumerated.c @@ -30,6 +30,8 @@ asn_TYPE_descriptor_t asn_DEF_NativeEnumerated = { NativeEnumerated_encode_xer, NativeEnumerated_decode_uper, NativeEnumerated_encode_uper, + NativeEnumerated_decode_aper, + NativeEnumerated_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NativeEnumerated_tags, sizeof(asn_DEF_NativeEnumerated_tags) / sizeof(asn_DEF_NativeEnumerated_tags[0]), @@ -125,6 +127,61 @@ NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, return rval; } +asn_dec_rval_t +NativeEnumerated_decode_aper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval = { RC_OK, 0 }; + long *native = (long *)*sptr; + asn_per_constraint_t *ct; + long value; + + (void)opt_codec_ctx; + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else ASN__DECODE_FAILED; /* Mandatory! */ + if(!specs) ASN__DECODE_FAILED; + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) ASN__DECODE_FAILED; + } + + ASN_DEBUG("Decoding %s as NativeEnumerated", td->name); + + if(ct->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) ASN__DECODE_STARVED; + if(inext) ct = 0; + } + + if(ct && ct->range_bits >= 0) { + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) ASN__DECODE_STARVED; + if(value >= (specs->extension + ? specs->extension - 1 : specs->map_count)) + ASN__DECODE_FAILED; + } else { + if(!specs->extension) + ASN__DECODE_FAILED; + /* + * X.691, #10.6: normally small non-negative whole number; + */ + value = uper_get_nsnnwn(pd); + if(value < 0) ASN__DECODE_STARVED; + value += specs->extension - 1; + if(value >= specs->map_count) + ASN__DECODE_FAILED; + } + + *native = specs->value2enum[value].nat_value; + ASN_DEBUG("Decoded %s = %ld", td->name, *native); + + return rval; +} + static int NativeEnumerated__compar_value2enum(const void *ap, const void *bp) { const asn_INTEGER_enum_map_t *a = ap; @@ -205,3 +262,71 @@ NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td, ASN__ENCODED_OK(er); } +asn_enc_rval_t +NativeEnumerated_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + long native, value; + asn_per_constraint_t *ct; + int inext = 0; + asn_INTEGER_enum_map_t key; + asn_INTEGER_enum_map_t *kf; + + if(!sptr) ASN__ENCODE_FAILED; + if(!specs) ASN__ENCODE_FAILED; + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else ASN__ENCODE_FAILED; /* Mandatory! */ + + ASN_DEBUG("Encoding %s as NativeEnumerated", td->name); + + er.encoded = 0; + + native = *(long *)sptr; + if(native < 0) ASN__ENCODE_FAILED; + + key.nat_value = native; + kf = bsearch(&key, specs->value2enum, specs->map_count, + sizeof(key), NativeEnumerated__compar_value2enum); + if(!kf) { + ASN_DEBUG("No element corresponds to %ld", native); + ASN__ENCODE_FAILED; + } + value = kf - specs->value2enum; + + if(ct->range_bits >= 0) { + int cmpWith = specs->extension + ? specs->extension - 1 : specs->map_count; + if(value >= cmpWith) + inext = 1; + } + if(ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, inext, 1)) + ASN__ENCODE_FAILED; + if(inext) ct = 0; + } else if(inext) { + ASN__ENCODE_FAILED; + } + + if(ct && ct->range_bits >= 0) { + if(per_put_few_bits(po, value, ct->range_bits)) + ASN__ENCODE_FAILED; + _ASN_ENCODED_OK(er); + } + + if(!specs->extension) + ASN__ENCODE_FAILED; + + /* + * X.691, #10.6: normally small non-negative whole number; + */ + ASN_DEBUG("value = %ld, ext = %d, inext = %d, res = %ld", + value, specs->extension, inext, + value - (inext ? (specs->extension - 1) : 0)); + if(uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0))) + ASN__ENCODE_FAILED; + + _ASN_ENCODED_OK(er); +} diff --git a/skeletons/NativeEnumerated.h b/skeletons/NativeEnumerated.h index c59bb1ba9..95f053128 100644 --- a/skeletons/NativeEnumerated.h +++ b/skeletons/NativeEnumerated.h @@ -24,6 +24,8 @@ extern asn_TYPE_descriptor_t asn_DEF_NativeEnumerated; xer_type_encoder_f NativeEnumerated_encode_xer; per_type_decoder_f NativeEnumerated_decode_uper; per_type_encoder_f NativeEnumerated_encode_uper; +per_type_decoder_f NativeEnumerated_decode_aper; +per_type_encoder_f NativeEnumerated_encode_aper; #ifdef __cplusplus } diff --git a/skeletons/NativeInteger.c b/skeletons/NativeInteger.c index e8ce6d2c3..9fdc111e8 100644 --- a/skeletons/NativeInteger.c +++ b/skeletons/NativeInteger.c @@ -31,6 +31,8 @@ asn_TYPE_descriptor_t asn_DEF_NativeInteger = { NativeInteger_encode_xer, NativeInteger_decode_uper, /* Unaligned PER decoder */ NativeInteger_encode_uper, /* Unaligned PER encoder */ + NativeInteger_decode_aper, /* Aligned PER decoder */ + NativeInteger_encode_aper, /* Aligned PER encoder */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NativeInteger_tags, sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]), @@ -267,6 +269,42 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, return rval; } +asn_dec_rval_t +NativeInteger_decode_aper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_dec_rval_t rval; + long *native = (long *)*sptr; + INTEGER_t tmpint; + void *tmpintptr = &tmpint; + + (void)opt_codec_ctx; + ASN_DEBUG("Decoding NativeInteger %s (APER)", td->name); + + if(!native) { + native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + if(!native) ASN__DECODE_FAILED; + } + + memset(&tmpint, 0, sizeof tmpint); + rval = INTEGER_decode_aper(opt_codec_ctx, td, constraints, + &tmpintptr, pd); + if(rval.code == RC_OK) { + if((specs&&specs->field_unsigned) + ? asn_INTEGER2ulong(&tmpint, (unsigned long *)native) + : asn_INTEGER2long(&tmpint, native)) + rval.code = RC_FAIL; + else + ASN_DEBUG("NativeInteger %s got value %ld", + td->name, *native); + } + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + + return rval; +} + asn_enc_rval_t NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { @@ -291,6 +329,32 @@ NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, return er; } +asn_enc_rval_t +NativeInteger_encode_aper( + asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + + asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; + asn_enc_rval_t er; + long native; + INTEGER_t tmpint; + + if(!sptr) ASN__ENCODE_FAILED; + + native = *(long *)sptr; + + ASN_DEBUG("Encoding NativeInteger %s %ld (APER)", td->name, native); + + memset(&tmpint, 0, sizeof(tmpint)); + if((specs&&specs->field_unsigned) + ? asn_ulong2INTEGER(&tmpint, native) + : asn_long2INTEGER(&tmpint, native)) + ASN__ENCODE_FAILED; + er = INTEGER_encode_aper(td, constraints, &tmpint, po); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); + return er; +} + /* * INTEGER specific human-readable output. */ diff --git a/skeletons/NativeInteger.h b/skeletons/NativeInteger.h index 4e63a8355..14aa1a49b 100644 --- a/skeletons/NativeInteger.h +++ b/skeletons/NativeInteger.h @@ -29,6 +29,8 @@ xer_type_decoder_f NativeInteger_decode_xer; xer_type_encoder_f NativeInteger_encode_xer; per_type_decoder_f NativeInteger_decode_uper; per_type_encoder_f NativeInteger_encode_uper; +per_type_decoder_f NativeInteger_decode_aper; +per_type_encoder_f NativeInteger_encode_aper; #ifdef __cplusplus } diff --git a/skeletons/NativeReal.c b/skeletons/NativeReal.c index ad6f28c9a..b17b480e1 100644 --- a/skeletons/NativeReal.c +++ b/skeletons/NativeReal.c @@ -32,6 +32,8 @@ asn_TYPE_descriptor_t asn_DEF_NativeReal = { NativeReal_encode_xer, NativeReal_decode_uper, NativeReal_encode_uper, + NativeReal_decode_aper, + NativeReal_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NativeReal_tags, sizeof(asn_DEF_NativeReal_tags) / sizeof(asn_DEF_NativeReal_tags[0]), @@ -228,6 +230,43 @@ NativeReal_decode_uper(asn_codec_ctx_t *opt_codec_ctx, return rval; } +asn_dec_rval_t +NativeReal_decode_aper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void **dbl_ptr, asn_per_data_t *pd) { + double *Dbl = (double *)*dbl_ptr; + asn_dec_rval_t rval; + REAL_t tmp; + void *ptmp = &tmp; + int ret; + + (void)constraints; + + /* + * If the structure is not there, allocate it. + */ + if(Dbl == NULL) { + *dbl_ptr = CALLOC(1, sizeof(*Dbl)); + Dbl = (double *)*dbl_ptr; + if(Dbl == NULL) + ASN__DECODE_FAILED; + } + + memset(&tmp, 0, sizeof(tmp)); + rval = OCTET_STRING_decode_aper(opt_codec_ctx, td, NULL, + &ptmp, pd); + if(rval.code != RC_OK) { + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_REAL, &tmp); + return rval; + } + + ret = asn_REAL2double(&tmp, Dbl); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_REAL, &tmp); + if(ret) ASN__DECODE_FAILED; + + return rval; +} + /* * Encode the NativeReal using the OCTET STRING PER encoder. */ @@ -257,6 +296,32 @@ NativeReal_encode_uper(asn_TYPE_descriptor_t *td, return erval; } +asn_enc_rval_t +NativeReal_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + double Dbl = *(const double *)sptr; + asn_enc_rval_t erval; + REAL_t tmp; + + (void)constraints; + + /* Prepare a temporary clean structure */ + memset(&tmp, 0, sizeof(tmp)); + + if(asn_double2REAL(&tmp, Dbl)) + ASN__ENCODE_FAILED; + + /* Encode a DER REAL */ + erval = OCTET_STRING_encode_aper(td, NULL, &tmp, po); + if(erval.encoded == -1) + erval.structure_ptr = sptr; + + /* Free possibly allocated members of the temporary structure */ + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_REAL, &tmp); + + return erval; +} + /* * Decode the chunk of XML text encoding REAL. */ diff --git a/skeletons/NativeReal.h b/skeletons/NativeReal.h index 68a81d9b0..94ed9ded9 100644 --- a/skeletons/NativeReal.h +++ b/skeletons/NativeReal.h @@ -27,6 +27,8 @@ xer_type_decoder_f NativeReal_decode_xer; xer_type_encoder_f NativeReal_encode_xer; per_type_decoder_f NativeReal_decode_uper; per_type_encoder_f NativeReal_encode_uper; +per_type_decoder_f NativeReal_decode_aper; +per_type_encoder_f NativeReal_encode_aper; #ifdef __cplusplus } diff --git a/skeletons/NumericString.c b/skeletons/NumericString.c index 887b3f52d..1ed631676 100644 --- a/skeletons/NumericString.c +++ b/skeletons/NumericString.c @@ -49,6 +49,8 @@ asn_TYPE_descriptor_t asn_DEF_NumericString = { OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NumericString_tags, sizeof(asn_DEF_NumericString_tags) diff --git a/skeletons/OBJECT_IDENTIFIER.c b/skeletons/OBJECT_IDENTIFIER.c index d0f8b3117..8a782653c 100644 --- a/skeletons/OBJECT_IDENTIFIER.c +++ b/skeletons/OBJECT_IDENTIFIER.c @@ -27,6 +27,8 @@ asn_TYPE_descriptor_t asn_DEF_OBJECT_IDENTIFIER = { OBJECT_IDENTIFIER_encode_xer, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_OBJECT_IDENTIFIER_tags, sizeof(asn_DEF_OBJECT_IDENTIFIER_tags) diff --git a/skeletons/OCTET_STRING.c b/skeletons/OCTET_STRING.c index 5420dedec..548c93117 100644 --- a/skeletons/OCTET_STRING.c +++ b/skeletons/OCTET_STRING.c @@ -36,6 +36,8 @@ asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { OCTET_STRING_encode_xer, OCTET_STRING_decode_uper, /* Unaligned PER decoder */ OCTET_STRING_encode_uper, /* Unaligned PER encoder */ + OCTET_STRING_decode_aper, /* Aligned PER decoder */ + OCTET_STRING_encode_aper, /* Aligned PER encoder */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OCTET_STRING_tags, sizeof(asn_DEF_OCTET_STRING_tags) @@ -1194,14 +1196,14 @@ OCTET_STRING_decode_xer_utf8(asn_codec_ctx_t *opt_codec_ctx, static int OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, size_t units, unsigned int bpc, unsigned int unit_bits, - long lb, long ub, asn_per_constraints_t *pc) { + int64_t lb, int64_t ub, asn_per_constraints_t *pc) { uint8_t *end = buf + units * bpc; - ASN_DEBUG("Expanding %d characters into (%ld..%ld):%d", + ASN_DEBUG("Expanding %d characters into (%lld..%lld):%d", (int)units, lb, ub, unit_bits); /* X.691: 27.5.4 */ - if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { + if((uint64_t)ub <= ((uint64_t)2 << (unit_bits - 1))) { /* Decode without translation */ lb = 0; } else if(pc && pc->code2value) { @@ -1216,7 +1218,7 @@ OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, value = pc->code2value(code); if(value < 0) { ASN_DEBUG("Code %d (0x%02x) is" - " not in map (%ld..%ld)", + " not in map (%lld..%lld)", code, code, lb, ub); return 1; /* FATAL */ } @@ -1240,7 +1242,7 @@ OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, int ch = code + lb; if(code < 0) return -1; /* WMORE */ if(ch > ub) { - ASN_DEBUG("Code %d is out of range (%ld..%ld)", + ASN_DEBUG("Code %d is out of range (%lld..%lld)", ch, lb, ub); return 1; /* FATAL */ } @@ -1258,14 +1260,14 @@ OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, static int OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf, size_t units, unsigned int bpc, unsigned int unit_bits, - long lb, long ub, asn_per_constraints_t *pc) { + int64_t lb, int64_t ub, asn_per_constraints_t *pc) { const uint8_t *end = buf + units * bpc; - ASN_DEBUG("Squeezing %d characters into (%ld..%ld):%d (%d bpc)", + ASN_DEBUG("Squeezing %d characters into (%lld..%lld):%d (%d bpc)", (int)units, lb, ub, unit_bits, bpc); /* X.691: 27.5.4 */ - if((unsigned long)ub <= ((unsigned long)2 << (unit_bits - 1))) { + if((uint64_t)ub <= ((uint64_t)2 << (unit_bits - 1))) { /* Encode as is */ lb = 0; } else if(pc && pc->value2code) { @@ -1282,7 +1284,7 @@ OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf, code = pc->value2code(value); if(code < 0) { ASN_DEBUG("Character %d (0x%02x) is" - " not in map (%ld..%ld)", + " not in map (%lld..%lld)", *buf, *buf, lb, ub); return -1; } @@ -1309,7 +1311,7 @@ OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf, ch = value - lb; if(ch < 0 || ch > ub) { ASN_DEBUG("Character %d (0x%02x)" - " is out of range (%ld..%ld)", + " is out of range (%lld..%lld)", *buf, *buf, lb, ub + lb); return -1; } @@ -1392,7 +1394,7 @@ OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx, if(!st) RETURN(RC_FAIL); } - ASN_DEBUG("PER Decoding %s size %ld .. %ld bits %d", + ASN_DEBUG("PER Decoding %s size %lld .. %lld bits %d", csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible", csiz->lower_bound, csiz->upper_bound, csiz->effective_bits); @@ -1423,14 +1425,14 @@ OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx, if(csiz->effective_bits == 0) { int ret; if(bpc) { - ASN_DEBUG("Encoding OCTET STRING size %ld", + ASN_DEBUG("Encoding OCTET STRING size %lld", csiz->upper_bound); ret = OCTET_STRING_per_get_characters(pd, st->buf, csiz->upper_bound, bpc, unit_bits, cval->lower_bound, cval->upper_bound, pc); if(ret > 0) RETURN(RC_FAIL); } else { - ASN_DEBUG("Encoding BIT STRING size %ld", + ASN_DEBUG("Encoding BIT STRING size %lld", csiz->upper_bound); ret = per_get_many_bits(pd, st->buf, 0, unit_bits * csiz->upper_bound); @@ -1492,6 +1494,194 @@ OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx, return rval; } +asn_dec_rval_t +OCTET_STRING_decode_aper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { + + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_per_constraints_t *pc = constraints ? constraints + : td->per_constraints; + asn_per_constraint_t *cval; + asn_per_constraint_t *csiz; + asn_dec_rval_t rval = { RC_OK, 0 }; + BIT_STRING_t *st = (BIT_STRING_t *)*sptr; + ssize_t consumed_myself = 0; + int repeat; + enum { + OS__BPC_BIT = 0, + OS__BPC_CHAR = 1, + OS__BPC_U16 = 2, + OS__BPC_U32 = 4 + } bpc; /* Bytes per character */ + unsigned int unit_bits; + unsigned int canonical_unit_bits; + + (void)opt_codec_ctx; + + if(pc) { + cval = &pc->value; + csiz = &pc->size; + } else { + cval = &asn_DEF_OCTET_STRING_constraints.value; + csiz = &asn_DEF_OCTET_STRING_constraints.size; + } + + switch(specs->subvariant) { + default: +// case ASN_OSUBV_ANY: +// ASN_DEBUG("Unrecognized subvariant %d", specs->subvariant); +// RETURN(RC_FAIL); + case ASN_OSUBV_BIT: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + break; + case ASN_OSUBV_ANY: + case ASN_OSUBV_STR: + canonical_unit_bits = unit_bits = 8; +// if(cval->flags & APC_CONSTRAINED) +// unit_bits = cval->range_bits; + bpc = OS__BPC_CHAR; + break; + case ASN_OSUBV_U16: + canonical_unit_bits = unit_bits = 16; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U16; + break; + case ASN_OSUBV_U32: + canonical_unit_bits = unit_bits = 32; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U32; + break; + } + + /* + * Allocate the string. + */ + if(!st) { + st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size)); + if(!st) RETURN(RC_FAIL); + } + + ASN_DEBUG("PER Decoding %s size %lld .. %lld bits %d", + csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible", + csiz->lower_bound, csiz->upper_bound, csiz->effective_bits); + + if(csiz->flags & APC_EXTENSIBLE) { + int inext = per_get_few_bits(pd, 1); + if(inext < 0) RETURN(RC_WMORE); + if(inext) { + csiz = &asn_DEF_OCTET_STRING_constraints.size; + cval = &asn_DEF_OCTET_STRING_constraints.value; + unit_bits = canonical_unit_bits; + } + } + + if(csiz->effective_bits >= 0) { + FREEMEM(st->buf); + if(bpc) { + st->size = csiz->upper_bound * bpc; + } else { + st->size = (csiz->upper_bound + 7) >> 3; + } + st->buf = (uint8_t *)MALLOC(st->size + 1); + if(!st->buf) { st->size = 0; RETURN(RC_FAIL); } + } + + /* X.691, #16.5: zero-length encoding */ + /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ + /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ + if(csiz->effective_bits == 0) { + int ret; + if (st->size > 2) { /* X.691 #16 NOTE 1 */ + if (aper_get_align(pd) < 0) + RETURN(RC_FAIL); + } + if(bpc) { + ASN_DEBUG("Decoding OCTET STRING size %lld", + csiz->upper_bound); + ret = OCTET_STRING_per_get_characters(pd, st->buf, + csiz->upper_bound, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + if(ret > 0) RETURN(RC_FAIL); + } else { + ASN_DEBUG("Decoding BIT STRING size %lld", + csiz->upper_bound); + ret = per_get_many_bits(pd, st->buf, 0, + unit_bits * csiz->upper_bound); + } + if(ret < 0) RETURN(RC_WMORE); + consumed_myself += unit_bits * csiz->upper_bound; + st->buf[st->size] = 0; + if(bpc == 0) { + int ubs = (csiz->upper_bound & 0x7); + st->bits_unused = ubs ? 8 - ubs : 0; + } + RETURN(RC_OK); + } + + st->size = 0; + do { + ssize_t raw_len; + ssize_t len_bytes; + ssize_t len_bits; + void *p; + int ret; + + /* Get the PER length */ + if (csiz->upper_bound - csiz->lower_bound == 0) + // Indefinite length case + raw_len = aper_get_length(pd, -1, csiz->effective_bits, &repeat); + else + raw_len = aper_get_length(pd, csiz->upper_bound - csiz->lower_bound + 1, csiz->effective_bits, &repeat); + repeat = 0; + if(raw_len < 0) RETURN(RC_WMORE); + raw_len += csiz->lower_bound; + + ASN_DEBUG("Got PER length eb %ld, len %ld, %s (%s)", + (long)csiz->effective_bits, (long)raw_len, + repeat ? "repeat" : "once", td->name); + + if (raw_len > 2) { /* X.691 #16 NOTE 1 */ + if (aper_get_align(pd) < 0) + RETURN(RC_FAIL); + } + + if(bpc) { + len_bytes = raw_len * bpc; + len_bits = len_bytes * unit_bits; + } else { + len_bits = raw_len; + len_bytes = (len_bits + 7) >> 3; + if(len_bits & 0x7) + st->bits_unused = 8 - (len_bits & 0x7); + /* len_bits be multiple of 16K if repeat is set */ + } + p = REALLOC(st->buf, st->size + len_bytes + 1); + if(!p) RETURN(RC_FAIL); + st->buf = (uint8_t *)p; + + if(bpc) { + ret = OCTET_STRING_per_get_characters(pd, + &st->buf[st->size], raw_len, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + if(ret > 0) RETURN(RC_FAIL); + } else { + ret = per_get_many_bits(pd, &st->buf[st->size], + 0, len_bits); + } + if(ret < 0) RETURN(RC_WMORE); + st->size += len_bytes; + } while(repeat); + st->buf[st->size] = 0; /* nul-terminate */ + + return rval; +} + asn_enc_rval_t OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { @@ -1566,7 +1756,7 @@ OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, } ASN_DEBUG("Encoding %s into %d units of %d bits" - " (%ld..%ld, effective %d)%s", + " (%lld..%lld, effective %d)%s", td->name, sizeinunits, unit_bits, csiz->lower_bound, csiz->upper_bound, csiz->effective_bits, ct_extensible ? " EXT" : ""); @@ -1598,7 +1788,7 @@ OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ if(csiz->effective_bits >= 0) { - ASN_DEBUG("Encoding %d bytes (%ld), length in %d bits", + ASN_DEBUG("Encoding %d bytes (%lld), length in %d bits", st->size, sizeinunits - csiz->lower_bound, csiz->effective_bits); ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound, @@ -1652,6 +1842,173 @@ OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, ASN__ENCODED_OK(er); } +asn_enc_rval_t +OCTET_STRING_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_per_constraints_t *pc = constraints ? constraints + : td->per_constraints; + asn_per_constraint_t *cval; + asn_per_constraint_t *csiz; + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + asn_enc_rval_t er = { 0, 0, 0 }; + int inext = 0; /* Lies not within extension root */ + unsigned int unit_bits; + unsigned int canonical_unit_bits; + unsigned int sizeinunits; + const uint8_t *buf; + int ret; + enum { + OS__BPC_BIT = 0, + OS__BPC_CHAR = 1, + OS__BPC_U16 = 2, + OS__BPC_U32 = 4 + } bpc; /* Bytes per character */ + int ct_extensible; + + if(!st || (!st->buf && st->size)) + ASN__ENCODE_FAILED; + + if(pc) { + cval = &pc->value; + csiz = &pc->size; + } else { + cval = &asn_DEF_OCTET_STRING_constraints.value; + csiz = &asn_DEF_OCTET_STRING_constraints.size; + } + ct_extensible = csiz->flags & APC_EXTENSIBLE; + + switch(specs->subvariant) { + default: +// case ASN_OSUBV_ANY: +// ASN__ENCODE_FAILED; + case ASN_OSUBV_BIT: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + sizeinunits = st->size * 8 - (st->bits_unused & 0x07); + ASN_DEBUG("BIT STRING of %d bytes", + sizeinunits); + break; + case ASN_OSUBV_ANY: + case ASN_OSUBV_STR: + canonical_unit_bits = unit_bits = 8; +// if(cval->flags & APC_CONSTRAINED) +// unit_bits = 8; + bpc = OS__BPC_CHAR; + sizeinunits = st->size; + break; + case ASN_OSUBV_U16: + canonical_unit_bits = unit_bits = 16; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U16; + sizeinunits = st->size / 2; + break; + case ASN_OSUBV_U32: + canonical_unit_bits = unit_bits = 32; + if(cval->flags & APC_CONSTRAINED) + unit_bits = cval->range_bits; + bpc = OS__BPC_U32; + sizeinunits = st->size / 4; + break; + } + + ASN_DEBUG("Encoding %s into %d units of %d bits" + " (%lld..%lld, effective %d)%s", + td->name, sizeinunits, unit_bits, + csiz->lower_bound, csiz->upper_bound, + csiz->effective_bits, ct_extensible ? " EXT" : ""); + + /* Figure out wheter size lies within PER visible constraint */ + + if(csiz->effective_bits >= 0) { + if((int)sizeinunits < csiz->lower_bound + || (int)sizeinunits > csiz->upper_bound) { + if(ct_extensible) { + cval = &asn_DEF_OCTET_STRING_constraints.value; + csiz = &asn_DEF_OCTET_STRING_constraints.size; + unit_bits = canonical_unit_bits; + inext = 1; + } else + ASN__ENCODE_FAILED; + } + } else { + inext = 0; + } + + + if(ct_extensible) { + /* Declare whether length is [not] within extension root */ + if(per_put_few_bits(po, inext, 1)) + ASN__ENCODE_FAILED; + } + + /* X.691, #16.5: zero-length encoding */ + /* X.691, #16.6: short fixed length encoding (up to 2 octets) */ + /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ + if(csiz->effective_bits >= 0) { + ASN_DEBUG("Encoding %d bytes (%lld), length in %d bits", + st->size, sizeinunits - csiz->lower_bound, + csiz->effective_bits); + ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound, + csiz->effective_bits); + if(ret) ASN__ENCODE_FAILED; + if (st->size > 2) { /* X.691 #16 NOTE 1 */ + if (aper_put_align(po) < 0) + ASN__ENCODE_FAILED; + } + if(bpc) { + ret = OCTET_STRING_per_put_characters(po, st->buf, + sizeinunits, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + } else { + ret = per_put_many_bits(po, st->buf, + sizeinunits * unit_bits); + } + if(ret) ASN__ENCODE_FAILED; + ASN__ENCODED_OK(er); + } + + ASN_DEBUG("Encoding %d bytes", st->size); + + if(sizeinunits == 0) { + if(aper_put_length(po, -1, 0)) + ASN__ENCODE_FAILED; + ASN__ENCODED_OK(er); + } + + buf = st->buf; + while(sizeinunits) { + ssize_t maySave = aper_put_length(po, -1, sizeinunits); + + if(maySave < 0) ASN__ENCODE_FAILED; + + ASN_DEBUG("Encoding %ld of %ld", + (long)maySave, (long)sizeinunits); + + if(bpc) { + ret = OCTET_STRING_per_put_characters(po, buf, + maySave, bpc, unit_bits, + cval->lower_bound, cval->upper_bound, pc); + } else { + ret = per_put_many_bits(po, buf, maySave * unit_bits); + } + if(ret) ASN__ENCODE_FAILED; + + if(bpc) + buf += maySave * bpc; + else + buf += maySave >> 3; + sizeinunits -= maySave; + assert(!(maySave & 0x07) || !sizeinunits); + } + + ASN__ENCODED_OK(er); +} + int OCTET_STRING_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key) { diff --git a/skeletons/OCTET_STRING.h b/skeletons/OCTET_STRING.h index 013c7b13f..bc2566684 100644 --- a/skeletons/OCTET_STRING.h +++ b/skeletons/OCTET_STRING.h @@ -32,6 +32,8 @@ xer_type_encoder_f OCTET_STRING_encode_xer; xer_type_encoder_f OCTET_STRING_encode_xer_utf8; per_type_decoder_f OCTET_STRING_decode_uper; per_type_encoder_f OCTET_STRING_encode_uper; +per_type_decoder_f OCTET_STRING_decode_aper; +per_type_encoder_f OCTET_STRING_encode_aper; /****************************** * Handy conversion routines. * diff --git a/skeletons/ObjectDescriptor.c b/skeletons/ObjectDescriptor.c index 31bc1b2c0..f049c1cca 100644 --- a/skeletons/ObjectDescriptor.c +++ b/skeletons/ObjectDescriptor.c @@ -24,6 +24,8 @@ asn_TYPE_descriptor_t asn_DEF_ObjectDescriptor = { OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_ObjectDescriptor_tags, sizeof(asn_DEF_ObjectDescriptor_tags) diff --git a/skeletons/PrintableString.c b/skeletons/PrintableString.c index 7b6828dcc..a0b263d58 100644 --- a/skeletons/PrintableString.c +++ b/skeletons/PrintableString.c @@ -59,6 +59,8 @@ asn_TYPE_descriptor_t asn_DEF_PrintableString = { OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_PrintableString_tags, sizeof(asn_DEF_PrintableString_tags) diff --git a/skeletons/REAL.c b/skeletons/REAL.c index 0a2506201..a157d9b09 100644 --- a/skeletons/REAL.c +++ b/skeletons/REAL.c @@ -51,6 +51,8 @@ asn_TYPE_descriptor_t asn_DEF_REAL = { REAL_encode_xer, REAL_decode_uper, REAL_encode_uper, + REAL_decode_aper, + REAL_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_REAL_tags, sizeof(asn_DEF_REAL_tags) / sizeof(asn_DEF_REAL_tags[0]), @@ -390,6 +392,21 @@ REAL_encode_uper(asn_TYPE_descriptor_t *td, return OCTET_STRING_encode_uper(td, 0, sptr, po); } +asn_dec_rval_t +REAL_decode_aper(asn_codec_ctx_t *opt_codec_ctx, + asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, + void **sptr, asn_per_data_t *pd) { + (void)constraints; /* No PER visible constraints */ + return OCTET_STRING_decode_aper(opt_codec_ctx, td, 0, sptr, pd); +} + +asn_enc_rval_t +REAL_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + (void)constraints; /* No PER visible constraints */ + return OCTET_STRING_encode_aper(td, 0, sptr, po); +} + int asn_REAL2double(const REAL_t *st, double *dbl_value) { unsigned int octv; diff --git a/skeletons/REAL.h b/skeletons/REAL.h index af3e84cce..503e25460 100644 --- a/skeletons/REAL.h +++ b/skeletons/REAL.h @@ -21,6 +21,8 @@ xer_type_decoder_f REAL_decode_xer; xer_type_encoder_f REAL_encode_xer; per_type_decoder_f REAL_decode_uper; per_type_encoder_f REAL_encode_uper; +per_type_decoder_f REAL_decode_aper; +per_type_encoder_f REAL_encode_aper; /*********************************** * Some handy conversion routines. * diff --git a/skeletons/RELATIVE-OID.c b/skeletons/RELATIVE-OID.c index 352ce79fc..eaaa9f3f6 100644 --- a/skeletons/RELATIVE-OID.c +++ b/skeletons/RELATIVE-OID.c @@ -28,6 +28,8 @@ asn_TYPE_descriptor_t asn_DEF_RELATIVE_OID = { RELATIVE_OID_encode_xer, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_RELATIVE_OID_tags, sizeof(asn_DEF_RELATIVE_OID_tags) diff --git a/skeletons/T61String.c b/skeletons/T61String.c index 115d7d430..4a6ad4756 100644 --- a/skeletons/T61String.c +++ b/skeletons/T61String.c @@ -24,6 +24,8 @@ asn_TYPE_descriptor_t asn_DEF_T61String = { OCTET_STRING_encode_xer, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_T61String_tags, sizeof(asn_DEF_T61String_tags) diff --git a/skeletons/TeletexString.c b/skeletons/TeletexString.c index faad69732..40b5c4e6a 100644 --- a/skeletons/TeletexString.c +++ b/skeletons/TeletexString.c @@ -24,6 +24,8 @@ asn_TYPE_descriptor_t asn_DEF_TeletexString = { OCTET_STRING_encode_xer, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_TeletexString_tags, sizeof(asn_DEF_TeletexString_tags) diff --git a/skeletons/UTCTime.c b/skeletons/UTCTime.c index 3983d764c..1666a8eb3 100644 --- a/skeletons/UTCTime.c +++ b/skeletons/UTCTime.c @@ -40,6 +40,8 @@ asn_TYPE_descriptor_t asn_DEF_UTCTime = { UTCTime_encode_xer, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_UTCTime_tags, sizeof(asn_DEF_UTCTime_tags) diff --git a/skeletons/UTF8String.c b/skeletons/UTF8String.c index d666a4e9a..43a8e832b 100644 --- a/skeletons/UTF8String.c +++ b/skeletons/UTF8String.c @@ -25,6 +25,8 @@ asn_TYPE_descriptor_t asn_DEF_UTF8String = { OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_UTF8String_tags, sizeof(asn_DEF_UTF8String_tags) diff --git a/skeletons/UniversalString.c b/skeletons/UniversalString.c index 21753eb4f..b5d63ab9e 100644 --- a/skeletons/UniversalString.c +++ b/skeletons/UniversalString.c @@ -35,6 +35,8 @@ asn_TYPE_descriptor_t asn_DEF_UniversalString = { UniversalString_encode_xer, /* Convert into UTF-8 */ OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_UniversalString_tags, sizeof(asn_DEF_UniversalString_tags) diff --git a/skeletons/VideotexString.c b/skeletons/VideotexString.c index 09967db18..e6fc42386 100644 --- a/skeletons/VideotexString.c +++ b/skeletons/VideotexString.c @@ -24,6 +24,8 @@ asn_TYPE_descriptor_t asn_DEF_VideotexString = { OCTET_STRING_encode_xer, OCTET_STRING_decode_uper, /* Implemented in terms of OCTET STRING */ OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_VideotexString_tags, sizeof(asn_DEF_VideotexString_tags) diff --git a/skeletons/VisibleString.c b/skeletons/VisibleString.c index 0f4dec563..83bdb7534 100644 --- a/skeletons/VisibleString.c +++ b/skeletons/VisibleString.c @@ -29,6 +29,8 @@ asn_TYPE_descriptor_t asn_DEF_VisibleString = { OCTET_STRING_encode_xer_utf8, OCTET_STRING_decode_uper, OCTET_STRING_encode_uper, + OCTET_STRING_decode_aper, + OCTET_STRING_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_VisibleString_tags, sizeof(asn_DEF_VisibleString_tags) diff --git a/skeletons/asn_internal.h b/skeletons/asn_internal.h index 9c94ca6c3..56d4651b2 100644 --- a/skeletons/asn_internal.h +++ b/skeletons/asn_internal.h @@ -20,7 +20,7 @@ extern "C" { #endif /* Environment version might be used to avoid running with the old library */ -#define ASN1C_ENVIRONMENT_VERSION 923 /* Compile-time version */ +#define ASN1C_ENVIRONMENT_VERSION 924 /* Compile-time version */ int get_asn1c_environment_version(void); /* Run-time version */ #define CALLOC(nmemb, size) calloc(nmemb, size) @@ -47,13 +47,17 @@ int get_asn1c_environment_version(void); /* Run-time version */ int asn_debug_indent; #define ASN_DEBUG_INDENT_ADD(i) do { asn_debug_indent += i; } while(0) #endif /* ASN_THREAD_SAFE */ -#define ASN_DEBUG(fmt, args...) do { \ +extern int asn_debug; /* Allow option on execution */ +#define ASN_DEBUG(fmt, args...) \ +if (asn_debug) { \ + do { \ int adi = asn_debug_indent; \ while(adi--) fprintf(stderr, " "); \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, " (%s:%d)\n", \ __FILE__, __LINE__); \ - } while(0) + } while(0); \ +} #else /* !__GNUC__ */ void ASN_DEBUG_f(const char *fmt, ...); #define ASN_DEBUG ASN_DEBUG_f diff --git a/skeletons/constr_CHOICE.c b/skeletons/constr_CHOICE.c index 6116e6a6b..943a0985e 100644 --- a/skeletons/constr_CHOICE.c +++ b/skeletons/constr_CHOICE.c @@ -905,7 +905,88 @@ CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, elm->name, td->name, rv.code); return rv; } - + +asn_dec_rval_t +CHOICE_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_dec_rval_t rv; + asn_per_constraint_t *ct; + asn_TYPE_member_t *elm; /* CHOICE's element */ + void *memb_ptr; + void **memb_ptr2; + void *st = *sptr; + int value; + + if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + ASN__DECODE_FAILED; + + /* + * Create the target structure if it is not present already. + */ + if(!st) { + st = *sptr = CALLOC(1, specs->struct_size); + if(!st) ASN__DECODE_FAILED; + } + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else ct = 0; + + if(ct && ct->flags & APC_EXTENSIBLE) { + value = per_get_few_bits(pd, 1); + if(value < 0) ASN__DECODE_STARVED; + if(value) ct = 0; /* Not restricted */ + } + + if(ct && ct->range_bits >= 0) { + value = per_get_few_bits(pd, ct->range_bits); + if(value < 0) ASN__DECODE_STARVED; + ASN_DEBUG("CHOICE %s got index %d in range %d", + td->name, value, ct->range_bits); + if(value > ct->upper_bound) + ASN__DECODE_FAILED; + } else { + if(specs->ext_start == -1) + ASN__DECODE_FAILED; + value = uper_get_nsnnwn(pd); + if(value < 0) ASN__DECODE_STARVED; + value += specs->ext_start; + if(value >= td->elements_count) + ASN__DECODE_FAILED; + } + + /* Adjust if canonical order is different from natural order */ + if(specs->canonical_order) + value = specs->canonical_order[value]; + + /* Set presence to be able to free it later */ + _set_present_idx(st, specs->pres_offset, specs->pres_size, value + 1); + + elm = &td->elements[value]; + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + ASN_DEBUG("Discovered CHOICE %s encodes %s", td->name, elm->name); + + if(ct && ct->range_bits >= 0) { + rv = elm->type->aper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + } else { + rv = uper_open_type_get(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + } + + if(rv.code != RC_OK) + ASN_DEBUG("Failed to decode %s in %s (CHOICE) %d", + elm->name, td->name, rv.code); + return rv; +} + asn_enc_rval_t CHOICE_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { @@ -918,7 +999,7 @@ CHOICE_encode_uper(asn_TYPE_descriptor_t *td, if(!sptr) ASN__ENCODE_FAILED; - ASN_DEBUG("Encoding %s as CHOICE", td->name); + ASN_DEBUG("Encoding %s as CHOICE using UPER", td->name); if(constraints) ct = &constraints->value; else if(td->per_constraints) ct = &td->per_constraints->value; @@ -988,7 +1069,87 @@ CHOICE_encode_uper(asn_TYPE_descriptor_t *td, ASN__ENCODED_OK(rval); } } - + +asn_enc_rval_t +CHOICE_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics; + asn_TYPE_member_t *elm; /* CHOICE's element */ + asn_per_constraint_t *ct; + void *memb_ptr; + int present; + + if(!sptr) ASN__ENCODE_FAILED; + + ASN_DEBUG("Encoding %s as CHOICE using ALIGNED PER", td->name); + + if(constraints) ct = &constraints->value; + else if(td->per_constraints) ct = &td->per_constraints->value; + else ct = 0; + + present = _fetch_present_idx(sptr, + specs->pres_offset, specs->pres_size); + + /* + * If the structure was not initialized properly, it cannot be encoded: + * can't deduce what to encode in the choice type. + */ + if(present <= 0 || present > td->elements_count) + ASN__ENCODE_FAILED; + else + present--; + + /* Adjust if canonical order is different from natural order */ + if(specs->canonical_order) + present = specs->canonical_order[present]; + + ASN_DEBUG("Encoding %s CHOICE element %d", td->name, present); + + if(ct && ct->range_bits >= 0) { + if(present < ct->lower_bound + || present > ct->upper_bound) { + if(ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, 1, 1)) + ASN__ENCODE_FAILED; + } else { + ASN__ENCODE_FAILED; + } + ct = 0; + } + } + if(ct && ct->flags & APC_EXTENSIBLE) { + if(per_put_few_bits(po, 0, 1)) + ASN__ENCODE_FAILED; + } + + elm = &td->elements[present]; + if(elm->flags & ATF_POINTER) { + /* Member is a pointer to another structure */ + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) ASN__ENCODE_FAILED; + } else { + memb_ptr = (char *)sptr + elm->memb_offset; + } + + if(ct && ct->range_bits >= 0) { + if(per_put_few_bits(po, present, ct->range_bits)) + ASN__ENCODE_FAILED; + + return elm->type->aper_encoder(elm->type, elm->per_constraints, + memb_ptr, po); + } else { + asn_enc_rval_t rval; + if(specs->ext_start == -1) + ASN__ENCODE_FAILED; + if(aper_put_nsnnwn(po, ct->range_bits, present - specs->ext_start)) + ASN__ENCODE_FAILED; + if(aper_open_type_put(elm->type, elm->per_constraints, + memb_ptr, po)) + ASN__ENCODE_FAILED; + rval.encoded = 0; + ASN__ENCODED_OK(rval); + } +} int CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, diff --git a/skeletons/constr_CHOICE.h b/skeletons/constr_CHOICE.h index e824a2206..ddcbb393f 100644 --- a/skeletons/constr_CHOICE.h +++ b/skeletons/constr_CHOICE.h @@ -48,6 +48,8 @@ xer_type_decoder_f CHOICE_decode_xer; xer_type_encoder_f CHOICE_encode_xer; per_type_decoder_f CHOICE_decode_uper; per_type_encoder_f CHOICE_encode_uper; +per_type_decoder_f CHOICE_decode_aper; +per_type_encoder_f CHOICE_encode_aper; asn_outmost_tag_f CHOICE_outmost_tag; #ifdef __cplusplus diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c index 5923023de..19897d37f 100644 --- a/skeletons/constr_SEQUENCE.c +++ b/skeletons/constr_SEQUENCE.c @@ -1242,6 +1242,219 @@ SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, return rv; } +asn_dec_rval_t +SEQUENCE_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; + void *st = *sptr; /* Target structure. */ + int extpresent; /* Extension additions are present */ + uint8_t *opres; /* Presence of optional root members */ + asn_per_data_t opmd; + asn_dec_rval_t rv; + int edx; + + (void)constraints; + + if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + ASN__DECODE_FAILED; + + if(!st) { + st = *sptr = CALLOC(1, specs->struct_size); + if(!st) ASN__DECODE_FAILED; + } + + ASN_DEBUG("Decoding %s as SEQUENCE (APER)", td->name); + + /* Handle extensions */ + if(specs->ext_before >= 0) { + extpresent = per_get_few_bits(pd, 1); + if(extpresent < 0) ASN__DECODE_STARVED; + } else { + extpresent = 0; + } + + /* Prepare a place and read-in the presence bitmap */ + memset(&opmd, 0, sizeof(opmd)); + if(specs->roms_count) { + opres = (uint8_t *)MALLOC(((specs->roms_count + 7) >> 3) + 1); + if(!opres) ASN__DECODE_FAILED; + /* Get the presence map */ + if(per_get_many_bits(pd, opres, 0, specs->roms_count)) { + FREEMEM(opres); + ASN__DECODE_STARVED; + } + opmd.buffer = opres; + opmd.nbits = specs->roms_count; + ASN_DEBUG("Read in presence bitmap for %s of %d bits (%x..)", + td->name, specs->roms_count, *opres); + } else { + opres = 0; + } + + /* + * Get the sequence ROOT elements. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + if(IN_EXTENSION_GROUP(specs, edx)) + continue; + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + memb_ptr = (char *)st + elm->memb_offset; + memb_ptr2 = &memb_ptr; + } + + /* Deal with optionality */ + if(elm->optional) { + int present = per_get_few_bits(&opmd, 1); + ASN_DEBUG("Member %s->%s is optional, p=%d (%d->%d)", + td->name, elm->name, present, + (int)opmd.nboff, (int)opmd.nbits); + if(present == 0) { + /* This element is not present */ + if(elm->default_value) { + /* Fill-in DEFAULT */ + if(elm->default_value(1, memb_ptr2)) { + FREEMEM(opres); + ASN__DECODE_FAILED; + } + ASN_DEBUG("Filled-in default"); + } + /* The member is just not present */ + continue; + } + /* Fall through */ + } + + /* Fetch the member from the stream */ + ASN_DEBUG("Decoding member %s in %s", elm->name, td->name); + rv = elm->type->aper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + if(rv.code != RC_OK) { + ASN_DEBUG("Failed decode %s in %s", + elm->name, td->name); + FREEMEM(opres); + return rv; + } + } + + /* Optionality map is not needed anymore */ + FREEMEM(opres); + + /* + * Deal with extensions. + */ + if(extpresent) { + ssize_t bmlength; + uint8_t *epres; /* Presence of extension members */ + asn_per_data_t epmd; + + bmlength = uper_get_nslength(pd); + if(bmlength < 0) ASN__DECODE_STARVED; + + ASN_DEBUG("Extensions %d present in %s", bmlength, td->name); + + epres = (uint8_t *)MALLOC((bmlength + 15) >> 3); + if(!epres) ASN__DECODE_STARVED; + + /* Get the extensions map */ + if(per_get_many_bits(pd, epres, 0, bmlength)) + ASN__DECODE_STARVED; + + memset(&epmd, 0, sizeof(epmd)); + epmd.buffer = epres; + epmd.nbits = bmlength; + ASN_DEBUG("Read in extensions bitmap for %s of %d bits (%x..)", + td->name, bmlength, *epres); + + /* Go over extensions and read them in */ + for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + if(!IN_EXTENSION_GROUP(specs, edx)) { + ASN_DEBUG("%d is not extension", edx); + continue; + } + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)st + elm->memb_offset); + } else { + memb_ptr = (void *)((char *)st + elm->memb_offset); + memb_ptr2 = &memb_ptr; + } + + present = per_get_few_bits(&epmd, 1); + if(present <= 0) { + if(present < 0) break; /* No more extensions */ + continue; + } + + ASN_DEBUG("Decoding member %s in %s %p", elm->name, td->name, *memb_ptr2); + rv = uper_open_type_get(opt_codec_ctx, elm->type, + elm->per_constraints, memb_ptr2, pd); + if(rv.code != RC_OK) { + FREEMEM(epres); + return rv; + } + } + + /* Skip over overflow extensions which aren't present + * in this system's version of the protocol */ + for(;;) { + ASN_DEBUG("Getting overflow extensions"); + switch(per_get_few_bits(&epmd, 1)) { + case -1: break; + case 0: continue; + default: + if(uper_open_type_skip(opt_codec_ctx, pd)) { + FREEMEM(epres); + ASN__DECODE_STARVED; + } + } + break; + } + + FREEMEM(epres); + } + + /* Fill DEFAULT members in extensions */ + for(edx = specs->roms_count; edx < specs->roms_count + + specs->aoms_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void **memb_ptr2; /* Pointer to member pointer */ + + if(!elm->default_value) continue; + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)st + + elm->memb_offset); + if(*memb_ptr2) continue; + } else { + continue; /* Extensions are all optionals */ + } + + /* Set default value */ + if(elm->default_value(1, memb_ptr2)) { + ASN__DECODE_FAILED; + } + } + + rv.consumed = 0; + rv.code = RC_OK; + return rv; +} + static int SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr, asn_per_outp_t *po1, asn_per_outp_t *po2) { @@ -1285,7 +1498,7 @@ SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr, if(po1 && per_put_few_bits(po1, present, 1)) return -1; /* Encode as open type field */ - if(po2 && present && uper_open_type_put(elm->type, + if(po2 && present && aper_open_type_put(elm->type, elm->per_constraints, *memb_ptr2, po2)) return -1; @@ -1423,3 +1636,130 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, ASN__ENCODED_OK(er); } +asn_enc_rval_t +SEQUENCE_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_SEQUENCE_specifics_t *specs + = (asn_SEQUENCE_specifics_t *)td->specifics; + asn_enc_rval_t er; + int n_extensions; + int edx; + int i; + + (void)constraints; + + if(!sptr) + ASN__ENCODE_FAILED; + + er.encoded = 0; + + ASN_DEBUG("Encoding %s as SEQUENCE (APER)", td->name); + + /* + * X.691#18.1 Whether structure is extensible + * and whether to encode extensions + */ + if(specs->ext_before >= 0) { + n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0); + per_put_few_bits(po, n_extensions ? 1 : 0, 1); + } else { + n_extensions = 0; /* There are no extensions to encode */ + } + + /* Encode a presence bitmap */ + for(i = 0; i < specs->roms_count; i++) { + asn_TYPE_member_t *elm; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + edx = specs->oms[i]; + elm = &td->elements[edx]; + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + present = (*memb_ptr2 != 0); + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + present = 1; + } + + /* Eliminate default values */ + if(present && elm->default_value + && elm->default_value(0, memb_ptr2) == 1) + present = 0; + + ASN_DEBUG("Element %s %s %s->%s is %s", + elm->flags & ATF_POINTER ? "ptr" : "inline", + elm->default_value ? "def" : "wtv", + td->name, elm->name, present ? "present" : "absent"); + if(per_put_few_bits(po, present, 1)) + ASN__ENCODE_FAILED; + } + + /* + * Encode the sequence ROOT elements. + */ + ASN_DEBUG("ext_after = %d, ec = %d, eb = %d", specs->ext_after, td->elements_count, specs->ext_before); + for(edx = 0; edx < ((specs->ext_after < 0) + ? td->elements_count : specs->ext_before - 1); edx++) { + + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + if(IN_EXTENSION_GROUP(specs, edx)) + continue; + + ASN_DEBUG("About to encode %s", elm->type->name); + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + if(!*memb_ptr2) { + ASN_DEBUG("Element %s %d not present", + elm->name, edx); + if(elm->optional) + continue; + /* Mandatory element is missing */ + ASN__ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + } + + /* Eliminate default values */ + if(elm->default_value && elm->default_value(0, memb_ptr2) == 1) + continue; + + ASN_DEBUG("Encoding %s->%s", td->name, elm->name); + er = elm->type->aper_encoder(elm->type, elm->per_constraints, + *memb_ptr2, po); + if(er.encoded == -1) + return er; + } + + /* No extensions to encode */ + if(!n_extensions) ASN__ENCODED_OK(er); + + ASN_DEBUG("Length of %d bit-map", n_extensions); + /* #18.8. Write down the presence bit-map length. */ + if(aper_put_nslength(po, n_extensions)) + ASN__ENCODE_FAILED; + + ASN_DEBUG("Bit-map of %d elements", n_extensions); + /* #18.7. Encoding the extensions presence bit-map. */ + /* TODO: act upon NOTE in #18.7 for canonical PER */ + if(SEQUENCE_handle_extensions(td, sptr, po, 0) != n_extensions) + ASN__ENCODE_FAILED; + + ASN_DEBUG("Writing %d extensions", n_extensions); + /* #18.9. Encode extensions as open type fields. */ + if(SEQUENCE_handle_extensions(td, sptr, 0, po) != n_extensions) + ASN__ENCODE_FAILED; + + ASN__ENCODED_OK(er); +} diff --git a/skeletons/constr_SEQUENCE.h b/skeletons/constr_SEQUENCE.h index c2aeb6676..d1818484c 100644 --- a/skeletons/constr_SEQUENCE.h +++ b/skeletons/constr_SEQUENCE.h @@ -52,6 +52,8 @@ xer_type_decoder_f SEQUENCE_decode_xer; xer_type_encoder_f SEQUENCE_encode_xer; per_type_decoder_f SEQUENCE_decode_uper; per_type_encoder_f SEQUENCE_encode_uper; +per_type_decoder_f SEQUENCE_decode_aper; +per_type_encoder_f SEQUENCE_encode_aper; #ifdef __cplusplus } diff --git a/skeletons/constr_SEQUENCE_OF.c b/skeletons/constr_SEQUENCE_OF.c index 8a08ee8aa..faedf7bb0 100644 --- a/skeletons/constr_SEQUENCE_OF.c +++ b/skeletons/constr_SEQUENCE_OF.c @@ -164,7 +164,7 @@ SEQUENCE_OF_encode_uper(asn_TYPE_descriptor_t *td, if(ct) { int not_in_root = (list->count < ct->lower_bound || list->count > ct->upper_bound); - ASN_DEBUG("lb %ld ub %ld %s", + ASN_DEBUG("lb %lld ub %lld %s", ct->lower_bound, ct->upper_bound, ct->flags & APC_EXTENSIBLE ? "ext" : "fix"); if(ct->flags & APC_EXTENSIBLE) { @@ -206,3 +206,70 @@ SEQUENCE_OF_encode_uper(asn_TYPE_descriptor_t *td, ASN__ENCODED_OK(er); } +asn_enc_rval_t +SEQUENCE_OF_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + asn_anonymous_sequence_ *list; + asn_per_constraint_t *ct; + asn_enc_rval_t er; + asn_TYPE_member_t *elm = td->elements; + int seq; + + if(!sptr) ASN__ENCODE_FAILED; + list = _A_SEQUENCE_FROM_VOID(sptr); + + er.encoded = 0; + + ASN_DEBUG("Encoding %s as SEQUENCE OF size (%d) using ALIGNED PER", td->name, list->count); + + if(constraints) ct = &constraints->size; + else if(td->per_constraints) ct = &td->per_constraints->size; + else ct = 0; + + /* If extensible constraint, check if size is in root */ + if(ct) { + int not_in_root = (list->count < ct->lower_bound + || list->count > ct->upper_bound); + ASN_DEBUG("lb %lld ub %lld %s", + ct->lower_bound, ct->upper_bound, + ct->flags & APC_EXTENSIBLE ? "ext" : "fix"); + if(ct->flags & APC_EXTENSIBLE) { + /* Declare whether size is in extension root */ + if(per_put_few_bits(po, not_in_root, 1)) + ASN__ENCODE_FAILED; + if(not_in_root) ct = 0; + } else if(not_in_root && ct->effective_bits >= 0) + ASN__ENCODE_FAILED; + } + + if(ct && ct->effective_bits >= 0) { + /* X.691, #19.5: No length determinant */ +// if(per_put_few_bits(po, list->count - ct->lower_bound, +// ct->effective_bits)) +// ASN__ENCODE_FAILED; + if (aper_put_length(po, ct->upper_bound - ct->lower_bound + 1, list->count - ct->lower_bound) < 0) + ASN__ENCODE_FAILED; + } + + for(seq = -1; seq < list->count;) { + ssize_t mayEncode; + if(seq < 0) seq = 0; + if(ct && ct->effective_bits >= 0) { + mayEncode = list->count; + } else { + mayEncode = aper_put_length(po, -1, list->count - seq); + if(mayEncode < 0) ASN__ENCODE_FAILED; + } + + while(mayEncode--) { + void *memb_ptr = list->array[seq++]; + if(!memb_ptr) ASN__ENCODE_FAILED; + er = elm->type->aper_encoder(elm->type, + elm->per_constraints, memb_ptr, po); + if(er.encoded == -1) + ASN__ENCODE_FAILED; + } + } + + ASN__ENCODED_OK(er); +} diff --git a/skeletons/constr_SEQUENCE_OF.h b/skeletons/constr_SEQUENCE_OF.h index e2272f326..94a7cd543 100644 --- a/skeletons/constr_SEQUENCE_OF.h +++ b/skeletons/constr_SEQUENCE_OF.h @@ -22,9 +22,11 @@ extern "C" { #define SEQUENCE_OF_decode_ber SET_OF_decode_ber #define SEQUENCE_OF_decode_xer SET_OF_decode_xer #define SEQUENCE_OF_decode_uper SET_OF_decode_uper +#define SEQUENCE_OF_decode_aper SET_OF_decode_aper der_type_encoder_f SEQUENCE_OF_encode_der; xer_type_encoder_f SEQUENCE_OF_encode_xer; per_type_encoder_f SEQUENCE_OF_encode_uper; +per_type_encoder_f SEQUENCE_OF_encode_aper; #ifdef __cplusplus } diff --git a/skeletons/constr_SET.c b/skeletons/constr_SET.c index 55a0badc9..65e8c5086 100644 --- a/skeletons/constr_SET.c +++ b/skeletons/constr_SET.c @@ -573,6 +573,181 @@ SET_encode_der(asn_TYPE_descriptor_t *td, ASN__ENCODED_OK(er); } +asn_enc_rval_t +SET_encode_uper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, + asn_per_outp_t *po) { +} + +asn_dec_rval_t +SET_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { +} + +asn_enc_rval_t +SET_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *sptr, + asn_per_outp_t *po) { + asn_SET_specifics_t *specs = (asn_SET_specifics_t *)td->specifics; + asn_enc_rval_t er; + int edx, i; + int t2m_build_own = (specs->tag2el_count != td->elements_count); + asn_TYPE_tag2member_t *t2m; + int t2m_count; + + (void)constraints; + + if(!sptr) + ASN__ENCODE_FAILED; + + er.encoded = 0; + + ASN_DEBUG("Encoding %s as SET (APER) map %d", td->name, specs->_mandatory_elements[0]); + + /* + * Use existing, or build our own tags map. + */ + if(t2m_build_own) { + t2m = (asn_TYPE_tag2member_t *)alloca( + td->elements_count * sizeof(t2m[0])); + if(!t2m) ASN__ENCODE_FAILED; /* There are such platforms */ + t2m_count = 0; + } else { + /* + * There is no untagged CHOICE in this SET. + * Employ existing table. + */ + t2m = specs->tag2el; + t2m_count = specs->tag2el_count; + } + + /* + * Gather the length of the underlying members sequence. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + asn_enc_rval_t tmper; + void *memb_ptr; + + /* + * Compute the length of the encoding of this member. + */ + if(elm->flags & ATF_POINTER) { + memb_ptr = *(void **)((char *)sptr + elm->memb_offset); + if(!memb_ptr) { + if(!elm->optional) + /* Mandatory elements missing */ + ASN__ENCODE_FAILED; + if(t2m_build_own) { + t2m[t2m_count].el_no = edx; + t2m[t2m_count].el_tag = 0; + t2m_count++; + } + continue; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + } + + /* + * Remember the outmost tag of this member. + */ + if(t2m_build_own) { + t2m[t2m_count].el_no = edx; + t2m[t2m_count].el_tag = asn_TYPE_outmost_tag( + elm->type, memb_ptr, elm->tag_mode, elm->tag); + t2m_count++; + } else { + /* + * No dynamic sorting is necessary. + */ + } + } + + /* + * Finalize order of the components. + */ + assert(t2m_count == td->elements_count); + if(t2m_build_own) { + /* + * Sort the underlying members according to their + * canonical tags order. DER encoding mandates it. + */ + qsort(t2m, t2m_count, sizeof(specs->tag2el[0]), _t2e_cmp); + } else { + /* + * Tags are already sorted by the compiler. + */ + } + + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[t2m[edx].el_no]; + asn_enc_rval_t tmper; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + present = (*memb_ptr2 != 0); + } else { +// memb_ptr = (void *)((char *)sptr + elm->memb_offset); +// memb_ptr2 = &memb_ptr; + present = 1; + continue; + } + +// /* Eliminate default values */ +// if(present && elm->default_value +// && elm->default_value(0, memb_ptr2) == 1) +// present = 0; + + ASN_DEBUG("Element %s %s %s->%s is %s", + elm->flags & ATF_POINTER ? "ptr" : "inline", + elm->default_value ? "def" : "wtv", + td->name, elm->name, present ? "present" : "absent"); + if(per_put_few_bits(po, present << 7, 8)) + ASN__ENCODE_FAILED; + } + + /* + * Encode all members. + */ + for(edx = 0; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + asn_enc_rval_t tmper; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + + /* Encode according to the tag order */ +// elm = &td->elements[t2m[edx].el_no]; + + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + if(!*memb_ptr2) { + ASN_DEBUG("Element %s %d not present", + elm->name, edx); + if(elm->optional) + continue; + /* Mandatory element is missing */ + ASN__ENCODE_FAILED; + } + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + } + tmper = elm->type->aper_encoder(elm->type, elm->per_constraints, + *memb_ptr2, po); + if(tmper.encoded == -1) + return tmper; + } + + ASN__ENCODED_OK(er); +} + #undef XER_ADVANCE #define XER_ADVANCE(num_bytes) do { \ size_t num = num_bytes; \ diff --git a/skeletons/constr_SET.h b/skeletons/constr_SET.h index 6a3a1aa9f..11b7153e2 100644 --- a/skeletons/constr_SET.h +++ b/skeletons/constr_SET.h @@ -53,7 +53,9 @@ der_type_encoder_f SET_encode_der; xer_type_decoder_f SET_decode_xer; xer_type_encoder_f SET_encode_xer; per_type_decoder_f SET_decode_uper; +per_type_decoder_f SET_decode_aper; per_type_encoder_f SET_encode_uper; +per_type_encoder_f SET_encode_aper; /*********************** * Some handy helpers. * diff --git a/skeletons/constr_SET_OF.c b/skeletons/constr_SET_OF.c index 2dbc6e518..f09804885 100644 --- a/skeletons/constr_SET_OF.c +++ b/skeletons/constr_SET_OF.c @@ -885,7 +885,7 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, if(!st) { st = *sptr = CALLOC(1, specs->struct_size); if(!st) ASN__DECODE_FAILED; - } + } list = _A_SET_FROM_VOID(st); /* Figure out which constraints to use */ @@ -902,7 +902,7 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, if(ct && ct->effective_bits >= 0) { /* X.691, #19.5: No length determinant */ nelems = per_get_few_bits(pd, ct->effective_bits); - ASN_DEBUG("Preparing to fetch %ld+%ld elements from %s", + ASN_DEBUG("Preparing to fetch %ld+%lld elements from %s", (long)nelems, ct->lower_bound, td->name); if(nelems < 0) ASN__DECODE_STARVED; nelems += ct->lower_bound; @@ -952,3 +952,91 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, return rv; } +asn_dec_rval_t +SET_OF_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + asn_dec_rval_t rv; + asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics; + asn_TYPE_member_t *elm = td->elements; /* Single one */ + void *st = *sptr; + asn_anonymous_set_ *list; + asn_per_constraint_t *ct; + int repeat = 0; + ssize_t nelems; + + if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + ASN__DECODE_FAILED; + + /* + * Create the target structure if it is not present already. + */ + if(!st) { + st = *sptr = CALLOC(1, specs->struct_size); + if(!st) ASN__DECODE_FAILED; + } + list = _A_SET_FROM_VOID(st); + + /* Figure out which constraints to use */ + if(constraints) ct = &constraints->size; + else if(td->per_constraints) ct = &td->per_constraints->size; + else ct = 0; + + if(ct && ct->flags & APC_EXTENSIBLE) { + int value = per_get_few_bits(pd, 1); + if(value < 0) ASN__DECODE_STARVED; + if(value) ct = 0; /* Not restricted! */ + } + + if(ct && ct->effective_bits >= 0) { + /* X.691, #19.5: No length determinant */ +// nelems = per_get_few_bits(pd, ct->effective_bits); + nelems = aper_get_nsnnwn(pd, ct->upper_bound - ct->lower_bound); + ASN_DEBUG("Preparing to fetch %ld+%lld elements from %s", + (long)nelems, ct->lower_bound, td->name); + if(nelems < 0) ASN__DECODE_STARVED; + nelems += ct->lower_bound; + } else { + nelems = -1; + } + + do { + int i; + if(nelems < 0) { + nelems = aper_get_length(pd, ct ? ct->upper_bound - ct->lower_bound + 1 : -1, + ct ? ct->effective_bits : -1, &repeat); + ASN_DEBUG("Got to decode %d elements (eff %d)", + (int)nelems, (int)ct ? ct->effective_bits : -1); + if(nelems < 0) ASN__DECODE_STARVED; + } + + for(i = 0; i < nelems; i++) { + void *ptr = 0; + ASN_DEBUG("SET OF %s decoding", elm->type->name); + rv = elm->type->aper_decoder(opt_codec_ctx, elm->type, + elm->per_constraints, &ptr, pd); + ASN_DEBUG("%s SET OF %s decoded %d, %p", + td->name, elm->type->name, rv.code, ptr); + if(rv.code == RC_OK) { + if(ASN_SET_ADD(list, ptr) == 0) + continue; + ASN_DEBUG("Failed to add element into %s", + td->name); + /* Fall through */ + rv.code = RC_FAIL; + } else { + ASN_DEBUG("Failed decoding %s of %s (SET OF)", + elm->type->name, td->name); + } + if(ptr) ASN_STRUCT_FREE(*elm->type, ptr); + return rv; + } + + nelems = -1; /* Allow uper_get_length() */ + } while(repeat); + + ASN_DEBUG("Decoded %s as SET OF", td->name); + + rv.code = RC_OK; + rv.consumed = 0; + return rv; +} diff --git a/skeletons/constr_SET_OF.h b/skeletons/constr_SET_OF.h index 75e18cfa0..8ddd0e3ba 100644 --- a/skeletons/constr_SET_OF.h +++ b/skeletons/constr_SET_OF.h @@ -34,6 +34,8 @@ xer_type_decoder_f SET_OF_decode_xer; xer_type_encoder_f SET_OF_encode_xer; per_type_decoder_f SET_OF_decode_uper; per_type_encoder_f SET_OF_encode_uper; +per_type_decoder_f SET_OF_decode_aper; +per_type_encoder_f SET_OF_encode_aper; #ifdef __cplusplus } diff --git a/skeletons/constr_TYPE.h b/skeletons/constr_TYPE.h index a9cd86dc3..13c60f334 100644 --- a/skeletons/constr_TYPE.h +++ b/skeletons/constr_TYPE.h @@ -99,6 +99,8 @@ typedef struct asn_TYPE_descriptor_s { xer_type_encoder_f *xer_encoder; /* [Canonical] XER encoder */ per_type_decoder_f *uper_decoder; /* Unaligned PER decoder */ per_type_encoder_f *uper_encoder; /* Unaligned PER encoder */ + per_type_decoder_f *aper_decoder; /* Aligned PER decoder */ + per_type_encoder_f *aper_encoder; /* Aligned PER encoder */ /*********************************************************************** * Internally useful members. Not to be used by applications directly. * diff --git a/skeletons/per_decoder.c b/skeletons/per_decoder.c index 461b7262f..a3c0d0df4 100644 --- a/skeletons/per_decoder.c +++ b/skeletons/per_decoder.c @@ -36,6 +36,35 @@ uper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, return rval; } +asn_dec_rval_t +aper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size) { + asn_dec_rval_t rval; + + rval = aper_decode(opt_codec_ctx, td, sptr, buffer, size, 0, 0); + if(rval.consumed) { + /* + * We've always given 8-aligned data, + * so convert bits to integral bytes. + */ + rval.consumed += 7; + rval.consumed >>= 3; + } else if(rval.code == RC_OK) { + if(size) { + if(((uint8_t *)buffer)[0] == 0) { + rval.consumed = 1; /* 1 byte */ + } else { + ASN_DEBUG("Expecting single zeroed byte"); + rval.code = RC_FAIL; + } + } else { + /* Must contain at least 8 bits. */ + rval.code = RC_WMORE; + } + } + + return rval; +} + asn_dec_rval_t uper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size, int skip_bits, int unused_bits) { asn_codec_ctx_t s_codec_ctx; @@ -91,3 +120,57 @@ uper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sp return rval; } +asn_dec_rval_t +aper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buffer, size_t size, int skip_bits, int unused_bits) { + asn_codec_ctx_t s_codec_ctx; + asn_dec_rval_t rval; + asn_per_data_t pd; + + if(skip_bits < 0 || skip_bits > 7 + || unused_bits < 0 || unused_bits > 7 + || (unused_bits > 0 && !size)) + ASN__DECODE_FAILED; + + /* + * Stack checker requires that the codec context + * must be allocated on the stack. + */ + if(opt_codec_ctx) { + if(opt_codec_ctx->max_stack_size) { + s_codec_ctx = *opt_codec_ctx; + opt_codec_ctx = &s_codec_ctx; + } + } else { + /* If context is not given, be security-conscious anyway */ + memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); + s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; + opt_codec_ctx = &s_codec_ctx; + } + + /* Fill in the position indicator */ + memset(&pd, 0, sizeof(pd)); + pd.buffer = (const uint8_t *)buffer; + pd.nboff = skip_bits; + pd.nbits = 8 * size - unused_bits; /* 8 is CHAR_BIT from */ + if(pd.nboff > pd.nbits) + ASN__DECODE_FAILED; + + /* + * Invoke type-specific decoder. + */ + if(!td->aper_decoder) + ASN__DECODE_FAILED; /* PER is not compiled in */ + rval = td->aper_decoder(opt_codec_ctx, td, 0, sptr, &pd); + if(rval.code == RC_OK) { + /* Return the number of consumed bits */ + rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3) + + pd.nboff - skip_bits; + ASN_DEBUG("PER decoding consumed %d, counted %d", + rval.consumed, pd.moved); + assert(rval.consumed == pd.moved); + } else { + /* PER codec is not a restartable */ + rval.consumed = 0; + } + return rval; +} diff --git a/skeletons/per_decoder.h b/skeletons/per_decoder.h index 8397a545f..5541bae86 100644 --- a/skeletons/per_decoder.h +++ b/skeletons/per_decoder.h @@ -38,7 +38,29 @@ asn_dec_rval_t uper_decode(struct asn_codec_ctx_s *opt_codec_ctx, int unused_bits /* Number of unused tailing bits, 0..7 */ ); +/* + * Aligned PER decoder of a "complete encoding" as per X.691#10.1. + * On success, this call always returns (.consumed >= 1), as per X.691#10.1.3. + */ +asn_dec_rval_t aper_decode_complete(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size /* Size of data buffer */ + ); +/* + * Aligned PER decoder of any ASN.1 type. May be invoked by the application. + * WARNING: This call returns the number of BITS read from the stream. Beware. + */ +asn_dec_rval_t aper_decode(struct asn_codec_ctx_s *opt_codec_ctx, + struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ + void **struct_ptr, /* Pointer to a target structure's pointer */ + const void *buffer, /* Data to be decoded */ + size_t size, /* Size of data buffer */ + int skip_bits, /* Number of unused leading bits, 0..7 */ + int unused_bits /* Number of unused tailing bits, 0..7 */ + ); /* * Type of the type-specific PER decoder function. */ diff --git a/skeletons/per_encoder.c b/skeletons/per_encoder.c index 47f3c916d..6923cf008 100644 --- a/skeletons/per_encoder.c +++ b/skeletons/per_encoder.c @@ -4,6 +4,7 @@ static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *, void *sptr, asn_app_consume_bytes_f *cb, void *app_key); +static asn_enc_rval_t aper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *, void *sptr, asn_app_consume_bytes_f *cb, void *app_key); asn_enc_rval_t uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { return uper_encode_internal(td, 0, sptr, cb, app_key); @@ -41,6 +42,18 @@ uper_encode_to_buffer(asn_TYPE_descriptor_t *td, void *sptr, void *buffer, size_ return uper_encode_internal(td, 0, sptr, encode_to_buffer_cb, &key); } +asn_enc_rval_t +aper_encode_to_buffer(asn_TYPE_descriptor_t *td, void *sptr, void *buffer, size_t buffer_size) { + enc_to_buf_arg key; + + key.buffer = buffer; + key.left = buffer_size; + + if(td) ASN_DEBUG("Encoding \"%s\" using ALIGNED PER", td->name); + + return aper_encode_internal(td, 0, sptr, encode_to_buffer_cb, &key); +} + typedef struct enc_dyn_arg { void *buffer; size_t length; @@ -93,6 +106,35 @@ uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cons } } +ssize_t +aper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, void **buffer_r) { + asn_enc_rval_t er; + enc_dyn_arg key; + + memset(&key, 0, sizeof(key)); + + er = aper_encode_internal(td, constraints, sptr, encode_dyn_cb, &key); + switch(er.encoded) { + case -1: + FREEMEM(key.buffer); + return -1; + case 0: + FREEMEM(key.buffer); + key.buffer = MALLOC(1); + if(key.buffer) { + *(char *)key.buffer = '\0'; + *buffer_r = key.buffer; + return 1; + } else { + return -1; + } + default: + *buffer_r = key.buffer; + ASN_DEBUG("Complete encoded in %d bits", er.encoded); + return ((er.encoded + 7) >> 3); + } +} + /* * Internally useful functions. */ @@ -115,6 +157,23 @@ _uper_encode_flush_outp(asn_per_outp_t *po) { return po->outper(po->tmpspace, buf - po->tmpspace, po->op_key); } +static int +_aper_encode_flush_outp(asn_per_outp_t *po) { + uint8_t *buf; + + if(po->nboff == 0 && po->buffer == po->tmpspace) + return 0; + + buf = po->buffer + (po->nboff >> 3); + /* Make sure we account for the last, partially filled */ + if(po->nboff & 0x07) { + buf[0] &= 0xff << (8 - (po->nboff & 0x07)); + buf++; + } + + return po->outper(po->tmpspace, buf - po->tmpspace, po->op_key); +} + static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { asn_per_outp_t po; @@ -149,3 +208,37 @@ uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constrain return er; } +static asn_enc_rval_t +aper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) { + asn_per_outp_t po; + asn_enc_rval_t er; + + /* + * Invoke type-specific encoder. + */ + if(!td || !td->aper_encoder) + ASN__ENCODE_FAILED; /* PER is not compiled in */ + + po.buffer = po.tmpspace; + po.nboff = 0; + po.nbits = 8 * sizeof(po.tmpspace); + po.outper = cb; + po.op_key = app_key; + po.flushed_bytes = 0; + + er = td->aper_encoder(td, constraints, sptr, &po); + if(er.encoded != -1) { + size_t bits_to_flush; + + bits_to_flush = ((po.buffer - po.tmpspace) << 3) + po.nboff; + + /* Set number of bits encoded to a firm value */ + er.encoded = (po.flushed_bytes << 3) + bits_to_flush; + + if(_aper_encode_flush_outp(&po)) + ASN__ENCODE_FAILED; + } + + return er; +} + diff --git a/skeletons/per_encoder.h b/skeletons/per_encoder.h index 95a6506e4..e3b9190bf 100644 --- a/skeletons/per_encoder.h +++ b/skeletons/per_encoder.h @@ -38,6 +38,12 @@ asn_enc_rval_t uper_encode_to_buffer( size_t buffer_size /* Initial buffer size (max) */ ); +asn_enc_rval_t aper_encode_to_buffer( + struct asn_TYPE_descriptor_s *type_descriptor, + void *struct_ptr, /* Structure to be encoded */ + void *buffer, /* Pre-allocated buffer */ + size_t buffer_size /* Initial buffer size (max) */ +); /* * A variant of uper_encode_to_buffer() which allocates buffer itself. * Returns the number of bytes in the buffer or -1 in case of failure. @@ -52,6 +58,11 @@ ssize_t uper_encode_to_new_buffer( void **buffer_r /* Buffer allocated and returned */ ); +ssize_t +aper_encode_to_new_buffer(struct asn_TYPE_descriptor_s *td, + asn_per_constraints_t *constraints, + void *sptr, + void **buffer_r); /* * Type of the generic PER encoder function. */ diff --git a/skeletons/per_opentype.c b/skeletons/per_opentype.c index 404aa7264..eb82bbcd4 100644 --- a/skeletons/per_opentype.c +++ b/skeletons/per_opentype.c @@ -53,6 +53,35 @@ uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints return 0; } +int +aper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + void *buf; + void *bptr; + ssize_t size; + size_t toGo; + + ASN_DEBUG("Open type put %s ...", td->name); + + size = aper_encode_to_new_buffer(td, constraints, sptr, &buf); + if(size <= 0) return -1; + + for(bptr = buf, toGo = size; toGo;) { + ssize_t maySave = aper_put_length(po, -1, toGo); + if(maySave < 0) break; + if(per_put_many_bits(po, bptr, maySave * 8)) break; + bptr = (char *)bptr + maySave; + toGo -= maySave; + } + + FREEMEM(buf); + if(toGo) return -1; + + ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)", + td->name, size); + + return 0; +} + static asn_dec_rval_t uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { diff --git a/skeletons/per_opentype.h b/skeletons/per_opentype.h index facfaa637..2117efe64 100644 --- a/skeletons/per_opentype.h +++ b/skeletons/per_opentype.h @@ -15,6 +15,8 @@ int uper_open_type_skip(asn_codec_ctx_t *opt_codec_ctx, asn_per_data_t *pd); int uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po); +int aper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po); + #ifdef __cplusplus } #endif diff --git a/skeletons/per_support.c b/skeletons/per_support.c index 5ecdc2e07..21ea23950 100644 --- a/skeletons/per_support.c +++ b/skeletons/per_support.c @@ -31,6 +31,16 @@ per_get_undo(asn_per_data_t *pd, int nbits) { } } +int32_t +aper_get_align(asn_per_data_t *pd) { + + if(pd->nboff & 0x7) { + ASN_DEBUG("Aligning %d bits", 8 - (pd->nboff & 0x7)); + return per_get_few_bits(pd, 8 - (pd->nboff & 0x7)); + } + return 0; +} + /* * Extract a small number of bits (<= 31) from the specified PER data pointer. */ @@ -104,7 +114,7 @@ per_get_few_bits(asn_per_data_t *pd, int nbits) { accum &= (((uint32_t)1 << nbits) - 1); - ASN_DEBUG(" [PER got %2d<=%2d bits => span %d %+ld[%d..%d]:%02x (%d) => 0x%x]", + ASN_DEBUG(" [PER got %2d<=%2d bits => span %d %+ld[%d..%d]:%02x (%d) => 0x%02x]", (int)nbits, (int)nleft, (int)pd->moved, (((long)pd->buffer) & 0xf), @@ -123,6 +133,8 @@ int per_get_many_bits(asn_per_data_t *pd, uint8_t *dst, int alright, int nbits) { int32_t value; + ASN_DEBUG("align: %s, nbits %d", alright ? "YES":"NO", nbits); + if(alright && (nbits & 7)) { /* Perform right alignment of a first few bits */ value = per_get_few_bits(pd, nbits & 0x07); @@ -187,6 +199,36 @@ uper_get_length(asn_per_data_t *pd, int ebits, int *repeat) { return (16384 * value); } +ssize_t +aper_get_length(asn_per_data_t *pd, int range, int ebits, int *repeat) { + ssize_t value; + + *repeat = 0; + + if (range <= 65536 && range >= 0) + return aper_get_nsnnwn(pd, range); + + if (aper_get_align(pd) < 0) + return -1; + + if(ebits >= 0) return per_get_few_bits(pd, ebits); + + value = per_get_few_bits(pd, 8); + if(value < 0) return -1; + if((value & 128) == 0) /* #10.9.3.6 */ + return (value & 0x7F); + if((value & 64) == 0) { /* #10.9.3.7 */ + value = ((value & 63) << 8) | per_get_few_bits(pd, 8); + if(value < 0) return -1; + return value; + } + value &= 63; /* this is "m" from X.691, #10.9.3.8 */ + if(value < 1 || value > 4) + return -1; + *repeat = 1; + return (16384 * value); +} + /* * Get the normally small length "n". * This procedure used to decode length of extensions bit-maps @@ -211,6 +253,25 @@ uper_get_nslength(asn_per_data_t *pd) { } } +ssize_t +aper_get_nslength(asn_per_data_t *pd) { + ssize_t length; + + ASN_DEBUG("Getting normally small length"); + + if(per_get_few_bits(pd, 1) == 0) { + length = per_get_few_bits(pd, 6) + 1; + if(length <= 0) return -1; + ASN_DEBUG("l=%d", length); + return length; + } else { + int repeat; + length = aper_get_length(pd, -1, -1, &repeat); + if(length >= 0 && !repeat) return length; + return -1; /* Error, or do not support >16K extensions */ + } +} + /* * Get the normally small non-negative whole number. * X.691, #10.6 @@ -237,6 +298,40 @@ uper_get_nsnnwn(asn_per_data_t *pd) { return value; } +ssize_t +aper_get_nsnnwn(asn_per_data_t *pd, int range) { + ssize_t value; + int bytes = 0; + + ASN_DEBUG("getting nsnnwn with range %d", range); + + if(range <= 255) { + if (range < 0) return -1; + /* 1 -> 8 bits */ + int i; + for (i = 1; i <= 8; i++) { + int upper = 1 << i; + if (upper >= range) + break; + } + value = per_get_few_bits(pd, i); + return value; + } else if (range == 256){ + /* 1 byte */ + bytes = 1; + return -1; + } else if (range <= 65536) { + /* 2 bytes */ + bytes = 2; + } else { + return -1; + } + if (aper_get_align(pd) < 0) + return -1; + value = per_get_few_bits(pd, 8 * bytes); + return value; +} + /* * X.691-11/2008, #11.6 * Encoding of a normally small non-negative whole number @@ -245,6 +340,7 @@ int uper_put_nsnnwn(asn_per_outp_t *po, int n) { int bytes; + ASN_DEBUG("uper put nsnnwn n %d", n); if(n <= 63) { if(n < 0) return -1; return per_put_few_bits(po, n, 7); @@ -405,6 +501,61 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) { return 0; } +int +aper_put_nsnnwn(asn_per_outp_t *po, int range, int number) { + int bytes; + + ASN_DEBUG("aper put nsnnwn %d with range %d", number, range); + /* 10.5.7.1 X.691 */ + if(range < 0) { + int i; + for (i = 1; ; i++) { + int bits = 1 << (8 * i); + if (number <= bits) + break; + } + bytes = i; + assert(i <= 4); + } + if(range <= 255) { + int i; + for (i = 1; i <= 8; i++) { + int bits = 1 << i; + if (range <= bits) + break; + } + return per_put_few_bits(po, number, i); + } else if(range == 256) { + bytes = 1; + } else if(range <= 65536) { + bytes = 2; + } else { /* Ranges > 64K */ + int i; + for (i = 1; ; i++) { + int bits = 1 << (8 * i); + if (range <= bits) + break; + } + assert(i <= 4); + bytes = i; + } + if(aper_put_align(po) < 0) /* Aligning on octet */ + return -1; +// if(per_put_few_bits(po, bytes, 8)) +// return -1; + + return per_put_few_bits(po, number, 8 * bytes); +} + +int aper_put_align(asn_per_outp_t *po) { + + if(po->nboff & 0x7) { + ASN_DEBUG("Aligning %d bits", 8 - (po->nboff & 0x7)); + if(per_put_few_bits(po, 0x00, (8 - (po->nboff & 0x7)))) + return -1; + } + return 0; +} /* * Output a large number of bits. @@ -444,6 +595,8 @@ per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int nbits) { ssize_t uper_put_length(asn_per_outp_t *po, size_t length) { + ASN_DEBUG("UPER put length %d", length); + if(length <= 127) /* #10.9.3.6 */ return per_put_few_bits(po, length, 8) ? -1 : (ssize_t)length; @@ -458,6 +611,33 @@ uper_put_length(asn_per_outp_t *po, size_t length) { ? -1 : (ssize_t)(length << 14); } +ssize_t +aper_put_length(asn_per_outp_t *po, int range, size_t length) { + + ASN_DEBUG("APER put length %d with range %d", length, range); + + /* 10.9 X.691 Note 2 */ + if (range <= 65536 && range >= 0) + return aper_put_nsnnwn(po, range, length); + + if (aper_put_align(po) < 0) + return -1; + + if(length <= 127) /* #10.9.3.6 */{ + return per_put_few_bits(po, length, 8) + ? -1 : (ssize_t)length; + } + else if(length < 16384) /* #10.9.3.7 */ + return per_put_few_bits(po, length|0x8000, 16) + ? -1 : (ssize_t)length; + + length >>= 14; + if(length > 4) length = 4; + + return per_put_few_bits(po, 0xC0 | length, 8) + ? -1 : (ssize_t)(length << 14); +} + /* * Put the normally small length "n" into the stream. @@ -481,3 +661,19 @@ uper_put_nslength(asn_per_outp_t *po, size_t length) { return 0; } +int +aper_put_nslength(asn_per_outp_t *po, size_t length) { + + if(length <= 64) { + /* #10.9.3.4 */ + if(length == 0) return -1; + return per_put_few_bits(po, length-1, 7) ? -1 : 0; + } else { + if(aper_put_length(po, -1, length) != (ssize_t)length) { + /* This might happen in case of >16K extensions */ + return -1; + } + } + + return 0; +} diff --git a/skeletons/per_support.h b/skeletons/per_support.h index a75ac94fc..181fe248a 100644 --- a/skeletons/per_support.h +++ b/skeletons/per_support.h @@ -24,8 +24,8 @@ typedef const struct asn_per_constraint_s { } flags; int range_bits; /* Full number of bits in the range */ int effective_bits; /* Effective bits */ - long lower_bound; /* "lb" value */ - long upper_bound; /* "ub" value */ + int64_t lower_bound; /* "lb" value */ + int64_t upper_bound; /* "ub" value */ } asn_per_constraint_t; typedef const struct asn_per_constraints_s { struct asn_per_constraint_s value; @@ -39,9 +39,9 @@ typedef const struct asn_per_constraints_s { */ typedef struct asn_per_data_s { const uint8_t *buffer; /* Pointer to the octet stream */ - size_t nboff; /* Bit offset to the meaningful bit */ - size_t nbits; /* Number of bits in the stream */ - size_t moved; /* Number of bits moved through this bit stream */ + size_t nboff; /* Bit offset to the meaningful bit */ + size_t nbits; /* Number of bits in the stream */ + size_t moved; /* Number of bits moved through this bit stream */ int (*refill)(struct asn_per_data_s *); void *refill_key; } asn_per_data_t; @@ -71,15 +71,22 @@ ssize_t uper_get_length(asn_per_data_t *pd, int effective_bound_bits, int *repeat); +ssize_t aper_get_length(asn_per_data_t *pd, + int range, + int effective_bound_bits, + int *repeat); + /* * Get the normally small length "n". */ ssize_t uper_get_nslength(asn_per_data_t *pd); +ssize_t aper_get_nslength(asn_per_data_t *pd); /* * Get the normally small non-negative whole number. */ ssize_t uper_get_nsnnwn(asn_per_data_t *pd); +ssize_t aper_get_nsnnwn(asn_per_data_t *pd, int range); /* X.691-2008/11, #11.5.6 */ int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *v, int nbits); @@ -110,6 +117,10 @@ int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits); int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits); int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits); +/* Align the current bit position to octet bundary */ +int aper_put_align(asn_per_outp_t *po); +int32_t aper_get_align(asn_per_data_t *pd); + /* * Put the length "n" to the Unaligned PER stream. * This function returns the number of units which may be flushed @@ -117,17 +128,23 @@ int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int */ ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length); +ssize_t aper_put_length(asn_per_outp_t *po, int range, size_t length); + /* * Put the normally small length "n" to the Unaligned PER stream. * Returns 0 or -1. */ int uper_put_nslength(asn_per_outp_t *po, size_t length); +int aper_put_nslength(asn_per_outp_t *po, size_t length); + /* * Put the normally small non-negative whole number. */ int uper_put_nsnnwn(asn_per_outp_t *po, int n); +int aper_put_nsnnwn(asn_per_outp_t *po, int range, int number); + #ifdef __cplusplus } #endif From fe97dd4bcf953c7fb8e9a556ef84e434141b5224 Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Wed, 3 Aug 2016 09:36:44 +0300 Subject: [PATCH 05/28] aper: fixup after port --- skeletons/INTEGER.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/skeletons/INTEGER.c b/skeletons/INTEGER.c index d10057757..8f2ef0562 100644 --- a/skeletons/INTEGER.c +++ b/skeletons/INTEGER.c @@ -27,6 +27,8 @@ asn_TYPE_descriptor_t asn_DEF_INTEGER = { #ifdef ASN_DISABLE_PER_SUPPORT 0, 0, + 0, + 0, #else INTEGER_decode_uper, /* Unaligned PER decoder */ INTEGER_encode_uper, /* Unaligned PER encoder */ @@ -905,8 +907,6 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td, ASN__ENCODED_OK(er); } -#endif /* ASN_DISABLE_PER_SUPPORT */ - asn_enc_rval_t INTEGER_encode_aper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { @@ -1030,6 +1030,9 @@ INTEGER_encode_aper(asn_TYPE_descriptor_t *td, ASN__ENCODED_OK(er); } + +#endif /* ASN_DISABLE_PER_SUPPORT */ + int asn_INTEGER2int64(const INTEGER_t *iptr, int64_t *lptr) { uint8_t *b, *end; @@ -1090,7 +1093,6 @@ asn_INTEGER2int64(const INTEGER_t *iptr, int64_t *lptr) { return 0; } - int asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) { uint8_t *b, *end; From 77d70694ef6ac927f12201768b8a7dc588229c67 Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Wed, 3 Aug 2016 09:46:01 +0300 Subject: [PATCH 06/28] skeletons: Fix compiler warnings introduced by Eurecom aper patch --- skeletons/constr_SET.c | 33 +++++++++++++++++++-------------- skeletons/constr_SET_OF.c | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/skeletons/constr_SET.c b/skeletons/constr_SET.c index 65e8c5086..1b05bd2cb 100644 --- a/skeletons/constr_SET.c +++ b/skeletons/constr_SET.c @@ -578,11 +578,13 @@ SET_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + ASN__ENCODE_FAILED; } asn_dec_rval_t SET_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + ASN__ENCODE_FAILED; } asn_enc_rval_t @@ -592,9 +594,10 @@ SET_encode_aper(asn_TYPE_descriptor_t *td, asn_per_outp_t *po) { asn_SET_specifics_t *specs = (asn_SET_specifics_t *)td->specifics; asn_enc_rval_t er; - int edx, i; + int edx; int t2m_build_own = (specs->tag2el_count != td->elements_count); - asn_TYPE_tag2member_t *t2m; + const asn_TYPE_tag2member_t *t2m; + asn_TYPE_tag2member_t *t2m_build; int t2m_count; (void)constraints; @@ -610,17 +613,16 @@ SET_encode_aper(asn_TYPE_descriptor_t *td, * Use existing, or build our own tags map. */ if(t2m_build_own) { - t2m = (asn_TYPE_tag2member_t *)alloca( + t2m_build = (asn_TYPE_tag2member_t *)alloca( td->elements_count * sizeof(t2m[0])); - if(!t2m) ASN__ENCODE_FAILED; /* There are such platforms */ + if(!t2m_build) ASN__ENCODE_FAILED; /* There are such platforms */ t2m_count = 0; } else { + t2m_build = NULL; /* * There is no untagged CHOICE in this SET. * Employ existing table. */ - t2m = specs->tag2el; - t2m_count = specs->tag2el_count; } /* @@ -628,7 +630,6 @@ SET_encode_aper(asn_TYPE_descriptor_t *td, */ for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; - asn_enc_rval_t tmper; void *memb_ptr; /* @@ -641,8 +642,8 @@ SET_encode_aper(asn_TYPE_descriptor_t *td, /* Mandatory elements missing */ ASN__ENCODE_FAILED; if(t2m_build_own) { - t2m[t2m_count].el_no = edx; - t2m[t2m_count].el_tag = 0; + t2m_build[t2m_count].el_no = edx; + t2m_build[t2m_count].el_tag = 0; t2m_count++; } continue; @@ -655,8 +656,8 @@ SET_encode_aper(asn_TYPE_descriptor_t *td, * Remember the outmost tag of this member. */ if(t2m_build_own) { - t2m[t2m_count].el_no = edx; - t2m[t2m_count].el_tag = asn_TYPE_outmost_tag( + t2m_build[t2m_count].el_no = edx; + t2m_build[t2m_count].el_tag = asn_TYPE_outmost_tag( elm->type, memb_ptr, elm->tag_mode, elm->tag); t2m_count++; } else { @@ -675,17 +676,21 @@ SET_encode_aper(asn_TYPE_descriptor_t *td, * Sort the underlying members according to their * canonical tags order. DER encoding mandates it. */ - qsort(t2m, t2m_count, sizeof(specs->tag2el[0]), _t2e_cmp); + qsort(t2m_build, t2m_count, sizeof(specs->tag2el[0]), _t2e_cmp); + t2m = t2m_build; } else { /* * Tags are already sorted by the compiler. */ + t2m = specs->tag2el; + t2m_count = specs->tag2el_count; } + assert(t2m_count == td->elements_count); for(edx = 0; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[t2m[edx].el_no]; - asn_enc_rval_t tmper; - void *memb_ptr; /* Pointer to the member */ +// asn_enc_rval_t tmper; +// void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ int present; diff --git a/skeletons/constr_SET_OF.c b/skeletons/constr_SET_OF.c index f09804885..d246cbba7 100644 --- a/skeletons/constr_SET_OF.c +++ b/skeletons/constr_SET_OF.c @@ -1005,7 +1005,7 @@ SET_OF_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, nelems = aper_get_length(pd, ct ? ct->upper_bound - ct->lower_bound + 1 : -1, ct ? ct->effective_bits : -1, &repeat); ASN_DEBUG("Got to decode %d elements (eff %d)", - (int)nelems, (int)ct ? ct->effective_bits : -1); + (int)nelems, (int)(ct ? ct->effective_bits : -1)); if(nelems < 0) ASN__DECODE_STARVED; } From ca34636177779ec9c7cb208c09a46acad313ded7 Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Wed, 3 Aug 2016 09:48:35 +0300 Subject: [PATCH 07/28] APER: Fix encoding of INTEGER with lower_bound != 0 --- skeletons/INTEGER.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/skeletons/INTEGER.c b/skeletons/INTEGER.c index 8f2ef0562..88a020d21 100644 --- a/skeletons/INTEGER.c +++ b/skeletons/INTEGER.c @@ -973,28 +973,29 @@ INTEGER_encode_aper(asn_TYPE_descriptor_t *td, /* X.691, #12.2.2 */ if(ct && ct->range_bits >= 0) { /* #10.5.6 */ - ASN_DEBUG("Encoding integer with range %d bits", - ct->range_bits); + ASN_DEBUG("Encoding integer %ld (%lu) with range %d bits", + value, value - ct->lower_bound, ct->range_bits); + unsigned long v = value - ct->lower_bound; /* #12 <= 8 -> alignment ? */ if (ct->range_bits < 8) { - if(per_put_few_bits(po, 0x00 | value, ct->range_bits)) + if(per_put_few_bits(po, 0x00 | v, ct->range_bits)) ASN__ENCODE_FAILED; } else if (ct->range_bits == 8) { if(aper_put_align(po) < 0) ASN__ENCODE_FAILED; - if(per_put_few_bits(po, 0x00 | value, ct->range_bits)) + if(per_put_few_bits(po, 0x00 | v, ct->range_bits)) ASN__ENCODE_FAILED; } else if (ct->range_bits <= 16) { // Consume the bytes to align on octet if(aper_put_align(po) < 0) ASN__ENCODE_FAILED; - if(per_put_few_bits(po, 0x0000 | value, + if(per_put_few_bits(po, 0x0000 | v, 16)) ASN__ENCODE_FAILED; } else { /* TODO: extend to >64 bits */ - int64_t v = value; + int64_t v64 = v; int i; /* Putting length - 1 in the minimum number of bits ex: 5 = 3bits */ @@ -1006,7 +1007,7 @@ INTEGER_encode_aper(asn_TYPE_descriptor_t *td, ASN__ENCODE_FAILED; /* Put the value */ for (i = 0; i < st->size; i++) { - if(per_put_few_bits(po, (v >> (8 * (st->size - i - 1))) & 0xff, 8)) ASN__ENCODE_FAILED; + if(per_put_few_bits(po, (v64 >> (8 * (st->size - i - 1))) & 0xff, 8)) ASN__ENCODE_FAILED; } } ASN__ENCODED_OK(er); From 8407c2c5b3c10216602e5c2db114c084b563a42b Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Wed, 3 Aug 2016 09:50:41 +0300 Subject: [PATCH 08/28] fix APER encoding of integer (backport from openairinterface) --- skeletons/INTEGER.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/skeletons/INTEGER.c b/skeletons/INTEGER.c index 88a020d21..e5117ec6f 100644 --- a/skeletons/INTEGER.c +++ b/skeletons/INTEGER.c @@ -996,18 +996,34 @@ INTEGER_encode_aper(asn_TYPE_descriptor_t *td, } else { /* TODO: extend to >64 bits */ int64_t v64 = v; - int i; + int i, j; + int max_range_bytes = (ct->range_bits >> 3) + + (((ct->range_bits % 8) > 0) ? 1 : 0); + + for (i = 1; ; i++) { + int upper = 1 << i; + if (upper >= max_range_bytes) + break; + } + + for (j = sizeof(int64_t) -1; j != 0; j--) { + uint8_t val; + val = v64 >> (j * 8); + if (val != 0) + break; + } - /* Putting length - 1 in the minimum number of bits ex: 5 = 3bits */ - if (per_put_few_bits(po, st->size - 1, (ct->range_bits >> 3)-1)) + /* Putting length in the minimum number of bits ex: 5 = 3bits */ + if (per_put_few_bits(po, j, i)) ASN__ENCODE_FAILED; // Consume the bits to align on octet if (aper_put_align(po) < 0) ASN__ENCODE_FAILED; /* Put the value */ - for (i = 0; i < st->size; i++) { - if(per_put_few_bits(po, (v64 >> (8 * (st->size - i - 1))) & 0xff, 8)) ASN__ENCODE_FAILED; + for (i = 0; i <= j; i++) { + if(per_put_few_bits(po, (v64 >> (8 * (j - i))) & 0xff, 8)) + ASN__ENCODE_FAILED; } } ASN__ENCODED_OK(er); From c40bdea2b9d88e62b2457f413f9c90a5dab604c5 Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Wed, 3 Aug 2016 09:51:48 +0300 Subject: [PATCH 09/28] Fix a bug in asn1c PER code when skipping unknown extension --- skeletons/per_opentype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skeletons/per_opentype.c b/skeletons/per_opentype.c index eb82bbcd4..e5b64f4ea 100644 --- a/skeletons/per_opentype.c +++ b/skeletons/per_opentype.c @@ -306,7 +306,7 @@ uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, (void)constraints; (void)sptr; - while(per_get_few_bits(pd, 24) >= 0); + while(per_get_few_bits(pd, 1) >= 0); rv.code = RC_OK; rv.consumed = pd->moved; From 893d6254ebebcfde0ab9c24937e8c38621a76d3e Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Wed, 3 Aug 2016 09:59:03 +0300 Subject: [PATCH 10/28] prefixing of generated types using a ASN1C_PREFIX environment variable --- libasn1compiler/asn1c_misc.c | 36 ++++++++++++++++++++++++++++-------- libasn1compiler/asn1c_misc.h | 1 + libasn1fix/asn1fix.c | 8 ++++++++ 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c index 3f2cce8ca..81af9d2c9 100644 --- a/libasn1compiler/asn1c_misc.c +++ b/libasn1compiler/asn1c_misc.c @@ -50,6 +50,10 @@ asn1c_make_identifier(enum ami_flags_e flags, asn1p_expr_t *expr, ...) { char *second = 0; ssize_t size; char *p; + char *prefix = NULL; + + if (flags & AMI_USE_PREFIX) + prefix = getenv("ASN1C_PREFIX"); if(expr) { /* @@ -74,6 +78,8 @@ asn1c_make_identifier(enum ami_flags_e flags, asn1p_expr_t *expr, ...) { va_end(ap); if(size == -1) return NULL; + if(prefix) + size += 1 + strlen(prefix); /* * Make sure we have this amount of storage. */ @@ -93,8 +99,12 @@ asn1c_make_identifier(enum ami_flags_e flags, asn1p_expr_t *expr, ...) { */ va_start(ap, expr); p = storage; + if(prefix) { + strcpy(storage, prefix); + p += strlen(prefix); + } nextstr = ""; - for(p = storage, str = 0; str || nextstr; str = nextstr) { + for(str = 0; str || nextstr; str = nextstr) { int subst_made = 0; nextstr = second ? second : va_arg(ap, char *); @@ -262,23 +272,33 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) { switch(_format) { case TNF_UNMODIFIED: - return asn1c_make_identifier(AMI_MASK_ONLY_SPACES, + return asn1c_make_identifier(stdname ? AMI_MASK_ONLY_SPACES : + AMI_MASK_ONLY_SPACES | AMI_USE_PREFIX, 0, exprid ? exprid->Identifier : typename, 0); - case TNF_INCLUDE: + case TNF_INCLUDE: { + /* as we have the quote marks " or < preceding the type + * name, we cannot simply have asn1c_make_identifier + * generate the prefix. Then we would end up with + * strings like PREFIX_" */ + char *prefix = getenv("ASN1C_PREFIX"); + if (!prefix) + prefix = ""; return asn1c_make_identifier( AMI_MASK_ONLY_SPACES | AMI_NODELIMITER, 0, ((!stdname || (arg->flags & A1C_INCLUDES_QUOTED)) - ? "\"" : "<"), + ? "\"" : "<"), stdname ? "" : prefix, exprid ? exprid->Identifier : typename, ((!stdname || (arg->flags & A1C_INCLUDES_QUOTED)) ? ".h\"" : ".h>"), 0); case TNF_SAFE: - return asn1c_make_identifier(0, exprid, typename, 0); + return asn1c_make_identifier(stdname ? 0 : AMI_USE_PREFIX, + exprid, typename, 0); case TNF_CTYPE: /* C type */ - return asn1c_make_identifier(0, exprid, - exprid?"t":typename, exprid?0:"t", 0); + return asn1c_make_identifier(stdname ? 0 : AMI_USE_PREFIX, + exprid, exprid?"t":typename, exprid?0:"t", 0); case TNF_RSAFE: /* Recursion-safe type */ - return asn1c_make_identifier(AMI_CHECK_RESERVED, 0, + return asn1c_make_identifier(stdname ? AMI_CHECK_RESERVED : + AMI_CHECK_RESERVED | AMI_USE_PREFIX, 0, "struct", " ", typename, 0); } diff --git a/libasn1compiler/asn1c_misc.h b/libasn1compiler/asn1c_misc.h index ee88cb156..f69af1129 100644 --- a/libasn1compiler/asn1c_misc.h +++ b/libasn1compiler/asn1c_misc.h @@ -10,6 +10,7 @@ enum ami_flags_e { AMI_MASK_ONLY_SPACES = 1, /* Mask only spaces, everything else's safe */ AMI_CHECK_RESERVED = 2, /* Check against reserved keywords */ AMI_NODELIMITER = 4, /* Do not put delimiter, just concatenate */ + AMI_USE_PREFIX = 8, /* Use Prefix when generating identifier */ }; char *asn1c_make_identifier(enum ami_flags_e, asn1p_expr_t *expr, ...); diff --git a/libasn1fix/asn1fix.c b/libasn1fix/asn1fix.c index 8d2317f49..40df925bc 100644 --- a/libasn1fix/asn1fix.c +++ b/libasn1fix/asn1fix.c @@ -245,10 +245,18 @@ asn1f_fix_module__phase_2(arg_t *arg) { asn1p_expr_t *expr; int rvalue = 0; int ret; + char *prefix = getenv("ASN1C_PREFIX"); TQ_FOR(expr, &(arg->mod->members), next) { arg->expr = expr; + if (prefix) { + char *tmp = malloc(strlen(prefix)+strlen(expr->Identifier)+1); + sprintf(tmp, "%s%s", prefix, expr->Identifier); + expr->Identifier = tmp; + /* FIXME: what about old memory ? */ +#warning "Fix this memory leak" + } /* * Dereference DEFAULT values. */ From e6f1e700daeb95a0e5b39aa45454b2bf1ad1df79 Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Wed, 3 Aug 2016 10:05:21 +0300 Subject: [PATCH 11/28] aper fix for decoding constrained integer with lower boundary --- skeletons/INTEGER.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/skeletons/INTEGER.c b/skeletons/INTEGER.c index e5117ec6f..215a01ef1 100644 --- a/skeletons/INTEGER.c +++ b/skeletons/INTEGER.c @@ -716,34 +716,41 @@ INTEGER_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ASN_DEBUG("Integer with range %d bits", ct->range_bits); if(ct->range_bits >= 0) { if (ct->range_bits > 16) { - int max_range_bytes = (ct->range_bits >> 3) + 1; - int length, i; + int max_range_bytes = (ct->range_bits >> 3) + + (((ct->range_bits % 8) > 0) ? 1 : 0); + int length = 0, i; int64_t value = 0; - for (i = 0; i < max_range_bytes; i++) { - int upper = 1 << (i + 1); - if (upper > max_range_bytes) + for (i = 1; ; i++) { + int upper = 1 << i; + if (upper >= max_range_bytes) break; } - if ((length = per_get_few_bits(pd, i + 1)) < 0) + ASN_DEBUG("Can encode %d (%d bytes) in %d bits", ct->range_bits, + max_range_bytes, i); + + if ((length = per_get_few_bits(pd, i)) < 0) ASN__DECODE_FAILED; + + /* X.691 #12.2.6 length determinant + lb (1) */ + length += 1; + ASN_DEBUG("Got length %d", length); if (aper_get_align(pd) != 0) ASN__DECODE_FAILED; - ASN_DEBUG("Got length %d", length + 1); - for (i = 0; i < length + 1; i++) { + while (length--) { int buf = per_get_few_bits(pd, 8); if (buf < 0) ASN__DECODE_FAILED; - value += (((int64_t)buf) << (8 * i)); + value += (((int64_t)buf) << (8 * length)); } + value += ct->lower_bound; if((specs && specs->field_unsigned) ? asn_uint642INTEGER(st, value) : asn_int642INTEGER(st, value)) ASN__DECODE_FAILED; ASN_DEBUG("Got value %lld + low %lld", value, ct->lower_bound); - value += ct->lower_bound; } else { long value = 0; if (ct->range_bits < 8) { @@ -761,13 +768,13 @@ INTEGER_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, value = per_get_few_bits(pd, 16); if(value < 0) ASN__DECODE_STARVED; } + value += ct->lower_bound; if((specs && specs->field_unsigned) ? asn_ulong2INTEGER(st, value) : asn_long2INTEGER(st, value)) ASN__DECODE_FAILED; ASN_DEBUG("Got value %ld + low %lld", value, ct->lower_bound); - value += ct->lower_bound; } return rval; } else { From b2f3d8770ee412ecede38d46b97bf6854d0f2f76 Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Wed, 3 Aug 2016 15:58:16 +0300 Subject: [PATCH 12/28] Final fixes --- libasn1compiler/asn1c_misc.c | 5 +++-- skeletons/NativeEnumerated.c | 4 ++-- skeletons/asn_internal.h | 8 ++------ skeletons/constr_CHOICE.c | 2 +- skeletons/constr_SEQUENCE.c | 2 +- skeletons/constr_SET_OF.c | 2 +- skeletons/per_decoder.c | 2 +- 7 files changed, 11 insertions(+), 14 deletions(-) diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c index 81af9d2c9..0b95ed71d 100644 --- a/libasn1compiler/asn1c_misc.c +++ b/libasn1compiler/asn1c_misc.c @@ -84,7 +84,7 @@ asn1c_make_identifier(enum ami_flags_e flags, asn1p_expr_t *expr, ...) { * Make sure we have this amount of storage. */ if(storage_size <= size) { - free(storage); + if(storage) free(storage); storage = malloc(size + 1); if(storage) { storage_size = size; @@ -286,10 +286,11 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) { return asn1c_make_identifier( AMI_MASK_ONLY_SPACES | AMI_NODELIMITER, 0, ((!stdname || (arg->flags & A1C_INCLUDES_QUOTED)) - ? "\"" : "<"), stdname ? "" : prefix, + ? "\"" : "<"), exprid ? exprid->Identifier : typename, ((!stdname || (arg->flags & A1C_INCLUDES_QUOTED)) ? ".h\"" : ".h>"), 0); + } case TNF_SAFE: return asn1c_make_identifier(stdname ? 0 : AMI_USE_PREFIX, exprid, typename, 0); diff --git a/skeletons/NativeEnumerated.c b/skeletons/NativeEnumerated.c index 7fe735eaf..9e3f3b973 100644 --- a/skeletons/NativeEnumerated.c +++ b/skeletons/NativeEnumerated.c @@ -313,7 +313,7 @@ NativeEnumerated_encode_aper(asn_TYPE_descriptor_t *td, if(ct && ct->range_bits >= 0) { if(per_put_few_bits(po, value, ct->range_bits)) ASN__ENCODE_FAILED; - _ASN_ENCODED_OK(er); + ASN__ENCODED_OK(er); } if(!specs->extension) @@ -328,5 +328,5 @@ NativeEnumerated_encode_aper(asn_TYPE_descriptor_t *td, if(uper_put_nsnnwn(po, value - (inext ? (specs->extension - 1) : 0))) ASN__ENCODE_FAILED; - _ASN_ENCODED_OK(er); + ASN__ENCODED_OK(er); } diff --git a/skeletons/asn_internal.h b/skeletons/asn_internal.h index 56d4651b2..53f9583be 100644 --- a/skeletons/asn_internal.h +++ b/skeletons/asn_internal.h @@ -47,17 +47,13 @@ int get_asn1c_environment_version(void); /* Run-time version */ int asn_debug_indent; #define ASN_DEBUG_INDENT_ADD(i) do { asn_debug_indent += i; } while(0) #endif /* ASN_THREAD_SAFE */ -extern int asn_debug; /* Allow option on execution */ -#define ASN_DEBUG(fmt, args...) \ -if (asn_debug) { \ - do { \ +#define ASN_DEBUG(fmt, args...) do { \ int adi = asn_debug_indent; \ while(adi--) fprintf(stderr, " "); \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, " (%s:%d)\n", \ __FILE__, __LINE__); \ - } while(0); \ -} + } while(0) #else /* !__GNUC__ */ void ASN_DEBUG_f(const char *fmt, ...); #define ASN_DEBUG ASN_DEBUG_f diff --git a/skeletons/constr_CHOICE.c b/skeletons/constr_CHOICE.c index 943a0985e..4d7ec4c08 100644 --- a/skeletons/constr_CHOICE.c +++ b/skeletons/constr_CHOICE.c @@ -918,7 +918,7 @@ CHOICE_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void *st = *sptr; int value; - if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) ASN__DECODE_FAILED; /* diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c index 19897d37f..e552e9af4 100644 --- a/skeletons/constr_SEQUENCE.c +++ b/skeletons/constr_SEQUENCE.c @@ -1255,7 +1255,7 @@ SEQUENCE_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, (void)constraints; - if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) ASN__DECODE_FAILED; if(!st) { diff --git a/skeletons/constr_SET_OF.c b/skeletons/constr_SET_OF.c index d246cbba7..a091eec13 100644 --- a/skeletons/constr_SET_OF.c +++ b/skeletons/constr_SET_OF.c @@ -964,7 +964,7 @@ SET_OF_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, int repeat = 0; ssize_t nelems; - if(_ASN_STACK_OVERFLOW_CHECK(opt_codec_ctx)) + if(ASN__STACK_OVERFLOW_CHECK(opt_codec_ctx)) ASN__DECODE_FAILED; /* diff --git a/skeletons/per_decoder.c b/skeletons/per_decoder.c index a3c0d0df4..f84eeab41 100644 --- a/skeletons/per_decoder.c +++ b/skeletons/per_decoder.c @@ -143,7 +143,7 @@ aper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sp } else { /* If context is not given, be security-conscious anyway */ memset(&s_codec_ctx, 0, sizeof(s_codec_ctx)); - s_codec_ctx.max_stack_size = _ASN_DEFAULT_STACK_MAX; + s_codec_ctx.max_stack_size = ASN__DEFAULT_STACK_MAX; opt_codec_ctx = &s_codec_ctx; } From 5da982f48ad0e00115b8698179655bc3fff0023c Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Thu, 26 Jan 2017 16:31:40 +0300 Subject: [PATCH 13/28] Leak was fixed --- libasn1fix/asn1fix.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libasn1fix/asn1fix.c b/libasn1fix/asn1fix.c index 40df925bc..110417af8 100644 --- a/libasn1fix/asn1fix.c +++ b/libasn1fix/asn1fix.c @@ -253,9 +253,8 @@ asn1f_fix_module__phase_2(arg_t *arg) { if (prefix) { char *tmp = malloc(strlen(prefix)+strlen(expr->Identifier)+1); sprintf(tmp, "%s%s", prefix, expr->Identifier); + free(expr->Identifier); expr->Identifier = tmp; - /* FIXME: what about old memory ? */ -#warning "Fix this memory leak" } /* * Dereference DEFAULT values. From 271171dff2c9b32214c3cd9fbf2c7ef2d4fbbf90 Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Thu, 26 Jan 2017 17:06:12 +0300 Subject: [PATCH 14/28] c99 for skeletons --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 64a37a9cb..56b7a99ec 100644 --- a/configure.ac +++ b/configure.ac @@ -81,8 +81,8 @@ AC_SUBST(TESTSUITE_CFLAGS) dnl Skeletons should be very compatible with most of the compilers, hence dnl very strict backward compatibility flags. SKELETONS_CFLAGS="${ADD_CFLAGS} ${SKELETONS_CFLAGS}" -AX_CHECK_COMPILE_FLAG([-std=c89], - [SKELETONS_CFLAGS="$SKELETONS_CFLAGS -std=c89"]) +AX_CHECK_COMPILE_FLAG([-std=c99], + [SKELETONS_CFLAGS="$SKELETONS_CFLAGS -std=c99"]) AX_CHECK_COMPILE_FLAG([-Wpedantic], [SKELETONS_CFLAGS="$SKELETONS_CFLAGS -Wpedantic"]) AX_CHECK_COMPILE_FLAG([-Wno-duplicate-decl-specifier], From 9cb9e928d61b8f725ae50755f630f0515b8d3f55 Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Fri, 27 Jan 2017 17:26:47 +0300 Subject: [PATCH 15/28] compiler warnings in asn1c_out.h were fixed --- libasn1compiler/asn1c_out.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libasn1compiler/asn1c_out.h b/libasn1compiler/asn1c_out.h index 1d4522a8e..dee8cad43 100644 --- a/libasn1compiler/asn1c_out.h +++ b/libasn1compiler/asn1c_out.h @@ -119,9 +119,9 @@ int asn1c_compiled_output(arg_t *arg, const char *fmt, ...); #define OINT(iv) do { \ if(iv == (-2147483647L - 1)) \ OUT("(-2147483647L - 1)"); \ - else if (iv > 4294967296UL) \ + else if (iv > 0 && (unsigned long long)iv > 4294967296UL) \ OUT("%" PRIdASN "ull", iv); \ - else if (iv > 2147483647L) \ + else if (iv > 0 && (unsigned long)iv > 2147483647L) \ OUT("%" PRIdASN "ul", iv); \ else \ OUT("%" PRIdASN "l", iv); \ @@ -130,9 +130,9 @@ int asn1c_compiled_output(arg_t *arg, const char *fmt, ...); #define OINTS(iv) do { \ if(iv == (-2147483647L - 1)) \ OUT("(-2147483647L - 1)"); \ - else if (iv > 4294967296UL) \ + else if (iv > 0 && (unsigned long long)iv > 4294967296UL) \ OUT("%" PRIdASN "ull", iv); \ - else if (iv > 2147483647L) \ + else if (iv > 0 && (unsigned long)iv > 2147483647L) \ OUT("%" PRIdASN "ul", iv); \ else \ OUT("% " PRIdASN "l", iv); \ From 908cab5ade962a659a78587761d04260bf86542f Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Tue, 31 Jan 2017 12:33:50 +0300 Subject: [PATCH 16/28] some warnings were fixed --- skeletons/constr_SET.c | 10 +++++++++- skeletons/per_decoder.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/skeletons/constr_SET.c b/skeletons/constr_SET.c index 1b05bd2cb..f56c2e45f 100644 --- a/skeletons/constr_SET.c +++ b/skeletons/constr_SET.c @@ -578,13 +578,21 @@ SET_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { + int useless_test = (constraints && po); + if (useless_test) { + useless_test = 0; + } ASN__ENCODE_FAILED; } asn_dec_rval_t SET_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { - ASN__ENCODE_FAILED; + int useless_test = (opt_codec_ctx && constraints && sptr && pd); + if (useless_test) { + useless_test = 0; + } + ASN__DECODE_FAILED; } asn_enc_rval_t diff --git a/skeletons/per_decoder.c b/skeletons/per_decoder.c index f84eeab41..3ba8805ba 100644 --- a/skeletons/per_decoder.c +++ b/skeletons/per_decoder.c @@ -50,7 +50,7 @@ aper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, rval.consumed >>= 3; } else if(rval.code == RC_OK) { if(size) { - if(((uint8_t *)buffer)[0] == 0) { + if(((const uint8_t *)buffer)[0] == 0) { rval.consumed = 1; /* 1 byte */ } else { ASN_DEBUG("Expecting single zeroed byte"); From 15e455efd626dc5f3fbf125df760e92dfe652745 Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Wed, 1 Feb 2017 12:20:08 +0300 Subject: [PATCH 17/28] Larger constraints --- libasn1compiler/asn1c_constraint.c | 23 +++---- skeletons/ENUMERATED.c | 8 +-- skeletons/INTEGER.c | 102 ++++++++++++++-------------- skeletons/INTEGER.h | 16 ++--- skeletons/NativeInteger.c | 24 +++---- skeletons/OBJECT_IDENTIFIER.c | 2 +- skeletons/OCTET_STRING.c | 8 +-- skeletons/asn_system.h | 2 +- skeletons/constr_SEQUENCE.c | 6 +- skeletons/per_decoder.c | 2 +- skeletons/per_encoder.c | 2 +- skeletons/per_opentype.c | 4 +- skeletons/per_support.c | 28 ++++---- skeletons/per_support.h | 10 +-- skeletons/tests/check-INTEGER.c | 61 +++++++++-------- skeletons/tests/check-OIDs.c | 10 +-- skeletons/tests/check-PER-INTEGER.c | 4 +- skeletons/tests/check-REAL.c | 2 +- 18 files changed, 156 insertions(+), 158 deletions(-) diff --git a/libasn1compiler/asn1c_constraint.c b/libasn1compiler/asn1c_constraint.c index 477edf2df..2b3096e0e 100644 --- a/libasn1compiler/asn1c_constraint.c +++ b/libasn1compiler/asn1c_constraint.c @@ -106,10 +106,10 @@ asn1c_emit_constraint_checking_code(arg_t *arg) { if(native_long_sign(r_value) >= 0) { ulong_optimize = ulong_optimization(etype, r_size, r_value); if(!ulong_optimize) { - OUT("unsigned long value;\n"); + OUT("unsigned long long value;\n"); } } else { - OUT("long value;\n"); + OUT("long long value;\n"); } break; case ASN_BASIC_REAL: @@ -524,20 +524,15 @@ emit_range_comparison_code(arg_t *arg, asn1cnst_range_t *range, const char *varn } if(ignore_left) { - OUT("%s <= ", varname); - OINT(r->right.value); + OUT("%s <= %lldLL", varname, r->right.value); } else if(ignore_right) { - OUT("%s >= ", varname); - OINT(r->left.value); + OUT("%s >= %lldLL", varname, r->left.value); } else if(r->left.value == r->right.value) { - OUT("%s == ", varname); - OINT(r->right.value); + OUT("%s == %lldLL", varname, r->right.value); } else { - OUT("%s >= ", varname); - OINT(r->left.value); + OUT("%s >= %lldLL", varname, r->left.value); OUT(" && "); - OUT("%s <= ", varname); - OINT(r->right.value); + OUT("%s <= %lldLL", varname, r->right.value); } if(r != range) OUT(")"); generated_something = 1; @@ -608,9 +603,9 @@ emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype, asn1cnst_rang case ASN_BASIC_INTEGER: case ASN_BASIC_ENUMERATED: if(asn1c_type_fits_long(arg, arg->expr) == FL_FITS_UNSIGN) { - OUT("value = *(const unsigned long *)sptr;\n"); + OUT("value = *(const unsigned long long *)sptr;\n"); } else if(asn1c_type_fits_long(arg, arg->expr) != FL_NOTFIT) { - OUT("value = *(const long *)sptr;\n"); + OUT("value = *(const long long *)sptr;\n"); } else { /* * In some cases we can explore our knowledge of diff --git a/skeletons/ENUMERATED.c b/skeletons/ENUMERATED.c index be46e192d..ef22ee3c4 100644 --- a/skeletons/ENUMERATED.c +++ b/skeletons/ENUMERATED.c @@ -43,7 +43,7 @@ ENUMERATED_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rval; ENUMERATED_t *st = (ENUMERATED_t *)*sptr; - long value; + long long value; void *vptr = &value; if(!st) { @@ -64,7 +64,7 @@ ENUMERATED_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_dec_rval_t rval; ENUMERATED_t *st = (ENUMERATED_t *)*sptr; - long value; + long long value; void *vptr = &value; if(!st) { @@ -84,7 +84,7 @@ asn_enc_rval_t ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { ENUMERATED_t *st = (ENUMERATED_t *)sptr; - long value; + long long value; if(asn_INTEGER2long(st, &value)) ASN__ENCODE_FAILED; @@ -96,7 +96,7 @@ asn_enc_rval_t ENUMERATED_encode_aper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { ENUMERATED_t *st = (ENUMERATED_t *)sptr; - long value; + long long value; if(asn_INTEGER2long(st, &value)) ASN__ENCODE_FAILED; diff --git a/skeletons/INTEGER.c b/skeletons/INTEGER.c index 215a01ef1..a5fbc20b4 100644 --- a/skeletons/INTEGER.c +++ b/skeletons/INTEGER.c @@ -115,13 +115,13 @@ INTEGER__dump(const asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_cons char scratch[32]; /* Enough for 64-bit integer */ uint8_t *buf = st->buf; uint8_t *buf_end = st->buf + st->size; - signed long value; + signed long long value; ssize_t wrote = 0; char *p; int ret; if(specs && specs->field_unsigned) - ret = asn_INTEGER2ulong(st, (unsigned long *)&value); + ret = asn_INTEGER2ulong(st, (unsigned long long *)&value); else ret = asn_INTEGER2long(st, &value); @@ -138,7 +138,7 @@ INTEGER__dump(const asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_cons scr = (char *)alloca(scrsize); if(plainOrXER == 0) ret = snprintf(scr, scrsize, - "%ld (%s)", value, el->enum_name); + "%lld (%s)", value, el->enum_name); else ret = snprintf(scr, scrsize, "<%s/>", el->enum_name); @@ -152,7 +152,7 @@ INTEGER__dump(const asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_cons scr = scratch; ret = snprintf(scr, scrsize, (specs && specs->field_unsigned) - ?"%lu":"%ld", value); + ?"%llu":"%lld", value); } assert(ret > 0 && (size_t)ret < scrsize); return (cb(scr, ret, app_key) < 0) ? -1 : ret; @@ -274,16 +274,16 @@ INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const static int INTEGER__compar_value2enum(const void *kp, const void *am) { - long a = *(const long *)kp; + long long a = *(const long long *)kp; const asn_INTEGER_enum_map_t *el = (const asn_INTEGER_enum_map_t *)am; - long b = el->nat_value; + long long b = el->nat_value; if(a < b) return -1; else if(a == b) return 0; else return 1; } const asn_INTEGER_enum_map_t * -INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value) { +INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long long value) { int count = specs ? specs->map_count : 0; if(!count) return 0; return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum, @@ -311,7 +311,7 @@ INTEGER_st_prealloc(INTEGER_t *st, int min_size) { static enum xer_pbd_rval INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { INTEGER_t *st = (INTEGER_t *)sptr; - long dec_value; + long long dec_value; long hex_value = 0; const char *lp; const char *lstart = (const char *)chunk_buf; @@ -604,25 +604,25 @@ INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* #11.5.6 */ ASN_DEBUG("Integer with range %d bits", ct->range_bits); if(ct->range_bits >= 0) { - if((size_t)ct->range_bits > 8 * sizeof(unsigned long)) + if((size_t)ct->range_bits > 8 * sizeof(unsigned long long)) ASN__DECODE_FAILED; if(specs && specs->field_unsigned) { - unsigned long uvalue; + unsigned long long uvalue; if(uper_get_constrained_whole_number(pd, &uvalue, ct->range_bits)) ASN__DECODE_STARVED; - ASN_DEBUG("Got value %lu + low %lld", + ASN_DEBUG("Got value %llu + low %lld", uvalue, ct->lower_bound); uvalue += ct->lower_bound; if(asn_ulong2INTEGER(st, uvalue)) ASN__DECODE_FAILED; } else { - unsigned long svalue; + unsigned long long svalue; if(uper_get_constrained_whole_number(pd, &svalue, ct->range_bits)) ASN__DECODE_STARVED; - ASN_DEBUG("Got value %ld + low %ld", + ASN_DEBUG("Got value %lld + low %lld", svalue, ct->lower_bound); svalue += ct->lower_bound; if(asn_long2INTEGER(st, svalue)) @@ -659,7 +659,7 @@ INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * TODO: replace by in-place arithmetics. */ - long value; + long long value; if(asn_INTEGER2long(st, &value)) ASN__DECODE_FAILED; if(asn_long2INTEGER(st, value + ct->lower_bound)) @@ -719,7 +719,7 @@ INTEGER_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, int max_range_bytes = (ct->range_bits >> 3) + (((ct->range_bits % 8) > 0) ? 1 : 0); int length = 0, i; - int64_t value = 0; + long long value = 0; for (i = 1; ; i++) { int upper = 1 << i; @@ -741,7 +741,7 @@ INTEGER_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, int buf = per_get_few_bits(pd, 8); if (buf < 0) ASN__DECODE_FAILED; - value += (((int64_t)buf) << (8 * length)); + value += (((long long)buf) << (8 * length)); } value += ct->lower_bound; @@ -752,7 +752,7 @@ INTEGER_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ASN_DEBUG("Got value %lld + low %lld", value, ct->lower_bound); } else { - long value = 0; + long long value = 0; if (ct->range_bits < 8) { value = per_get_few_bits(pd, ct->range_bits); if(value < 0) ASN__DECODE_STARVED; @@ -773,7 +773,7 @@ INTEGER_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ? asn_ulong2INTEGER(st, value) : asn_long2INTEGER(st, value)) ASN__DECODE_FAILED; - ASN_DEBUG("Got value %ld + low %lld", + ASN_DEBUG("Got value %lld + low %lld", value, ct->lower_bound); } return rval; @@ -809,7 +809,7 @@ INTEGER_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* * TODO: replace by in-place arithmetics. */ - long value; + long long value; if(asn_INTEGER2long(st, &value)) ASN__DECODE_FAILED; if(asn_long2INTEGER(st, value + ct->lower_bound)) @@ -828,8 +828,8 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td, const uint8_t *buf; const uint8_t *end; asn_per_constraint_t *ct; - long value = 0; - unsigned long v = 0; + long long value = 0; + unsigned long long v = 0; if(!st || st->size == 0) ASN__ENCODE_FAILED; @@ -841,19 +841,19 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td, if(ct) { int inext = 0; if(specs && specs->field_unsigned) { - unsigned long uval; + unsigned long long uval; if(asn_INTEGER2ulong(st, &uval)) ASN__ENCODE_FAILED; /* Check proper range */ if(ct->flags & APC_SEMI_CONSTRAINED) { - if(uval < (unsigned long)ct->lower_bound) + if(uval < (unsigned long long)ct->lower_bound) inext = 1; } else if(ct->range_bits >= 0) { - if(uval < (unsigned long)ct->lower_bound - || uval > (unsigned long)ct->upper_bound) + if(uval < (unsigned long long)ct->lower_bound + || uval > (unsigned long long)ct->upper_bound) inext = 1; } - ASN_DEBUG("Value %lu (%02x/%d) lb %llu ub %llu %s", + ASN_DEBUG("Value %llu (%02x/%d) lb %llu ub %llu %s", uval, st->buf[0], st->size, ct->lower_bound, ct->upper_bound, inext ? "ext" : "fix"); @@ -870,7 +870,7 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td, || value > ct->upper_bound) inext = 1; } - ASN_DEBUG("Value %ld (%02x/%d) lb %lld ub %lld %s", + ASN_DEBUG("Value %lld (%02x/%d) lb %lld ub %lld %s", value, st->buf[0], st->size, ct->lower_bound, ct->upper_bound, inext ? "ext" : "fix"); @@ -888,7 +888,7 @@ INTEGER_encode_uper(asn_TYPE_descriptor_t *td, /* X.691-11/2008, #13.2.2, test if constrained whole number */ if(ct && ct->range_bits >= 0) { /* #11.5.6 -> #11.3 */ - ASN_DEBUG("Encoding integer %ld (%lu) with range %d bits", + ASN_DEBUG("Encoding integer %lld (%llu) with range %d bits", value, value - ct->lower_bound, ct->range_bits); v = value - ct->lower_bound; if(uper_put_constrained_whole_number_u(po, v, ct->range_bits)) @@ -923,7 +923,7 @@ INTEGER_encode_aper(asn_TYPE_descriptor_t *td, const uint8_t *buf; const uint8_t *end; asn_per_constraint_t *ct; - int64_t value = 0; + long long value = 0; if(!st || st->size == 0) ASN__ENCODE_FAILED; @@ -935,8 +935,8 @@ INTEGER_encode_aper(asn_TYPE_descriptor_t *td, if(ct) { int inext = 0; if(specs && specs->field_unsigned) { - uint64_t uval; - if(asn_INTEGER2uint64(st, &uval)) + unsigned long long uval; + if(asn_INTEGER2ulong(st, &uval)) ASN__ENCODE_FAILED; /* Check proper range */ if(ct->flags & APC_SEMI_CONSTRAINED) { @@ -953,7 +953,7 @@ INTEGER_encode_aper(asn_TYPE_descriptor_t *td, inext ? "ext" : "fix"); value = uval; } else { - if(asn_INTEGER2int64(st, &value)) ASN__ENCODE_FAILED; + if(asn_INTEGER2long(st, &value)) ASN__ENCODE_FAILED; /* Check proper range */ if(ct->flags & APC_SEMI_CONSTRAINED) { if(value < ct->lower_bound) @@ -980,9 +980,9 @@ INTEGER_encode_aper(asn_TYPE_descriptor_t *td, /* X.691, #12.2.2 */ if(ct && ct->range_bits >= 0) { /* #10.5.6 */ - ASN_DEBUG("Encoding integer %ld (%lu) with range %d bits", + ASN_DEBUG("Encoding integer %lld (%llu) with range %d bits", value, value - ct->lower_bound, ct->range_bits); - unsigned long v = value - ct->lower_bound; + unsigned long long v = value - ct->lower_bound; /* #12 <= 8 -> alignment ? */ if (ct->range_bits < 8) { @@ -1002,7 +1002,7 @@ INTEGER_encode_aper(asn_TYPE_descriptor_t *td, ASN__ENCODE_FAILED; } else { /* TODO: extend to >64 bits */ - int64_t v64 = v; + long long v64 = v; int i, j; int max_range_bytes = (ct->range_bits >> 3) + (((ct->range_bits % 8) > 0) ? 1 : 0); @@ -1118,10 +1118,10 @@ asn_INTEGER2int64(const INTEGER_t *iptr, int64_t *lptr) { } int -asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) { +asn_INTEGER2long(const INTEGER_t *iptr, long long *lptr) { uint8_t *b, *end; size_t size; - long l; + long long l; /* Sanity checking */ if(!iptr || !iptr->buf || !lptr) { @@ -1134,7 +1134,7 @@ asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) { size = iptr->size; end = b + size; /* Where to stop */ - if(size > sizeof(long)) { + if(size > sizeof(long long)) { uint8_t *end1 = end - 1; /* * Slightly more advanced processing, @@ -1152,7 +1152,7 @@ asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) { } size = end - b; - if(size > sizeof(long)) { + if(size > sizeof(long long)) { /* Still cannot fit the long */ errno = ERANGE; return -1; @@ -1178,9 +1178,9 @@ asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) { } int -asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) { +asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long long *lptr) { uint8_t *b, *end; - unsigned long l; + unsigned long long l; size_t size; if(!iptr || !iptr->buf || !lptr) { @@ -1193,7 +1193,7 @@ asn_INTEGER2ulong(const INTEGER_t *iptr, unsigned long *lptr) { end = b + size; /* If all extra leading bytes are zeroes, ignore them */ - for(; size > sizeof(unsigned long); b++, size--) { + for(; size > sizeof(unsigned long long); b++, size--) { if(*b) { /* Value won't fit unsigned long */ errno = ERANGE; @@ -1242,13 +1242,13 @@ asn_INTEGER2uint64(const INTEGER_t *iptr, uint64_t *lptr) { } int -asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) { +asn_ulong2INTEGER(INTEGER_t *st, unsigned long long value) { uint8_t *buf; uint8_t *end; uint8_t *b; int shr; - if(value <= LONG_MAX) + if(value <= LLONG_MAX) return asn_long2INTEGER(st, value); buf = (uint8_t *)MALLOC(1 + sizeof(value)); @@ -1256,7 +1256,7 @@ asn_ulong2INTEGER(INTEGER_t *st, unsigned long value) { end = buf + (sizeof(value) + 1); buf[0] = 0; - for(b = buf + 1, shr = (sizeof(long)-1)*8; b < end; shr -= 8, b++) + for(b = buf + 1, shr = (sizeof(long long)-1)*8; b < end; shr -= 8, b++) *b = (uint8_t)(value >> shr); if(st->buf) FREEMEM(st->buf); @@ -1347,7 +1347,7 @@ asn_int642INTEGER(INTEGER_t *st, int64_t value) { } int -asn_long2INTEGER(INTEGER_t *st, long value) { +asn_long2INTEGER(INTEGER_t *st, long long value) { uint8_t *buf, *bp; uint8_t *p; uint8_t *pstart; @@ -1405,7 +1405,7 @@ asn_long2INTEGER(INTEGER_t *st, long value) { * This function is going to be DEPRECATED soon. */ enum asn_strtol_result_e -asn_strtol(const char *str, const char *end, long *lp) { +asn_strtol(const char *str, const char *end, long long *lp) { const char *endp = end; switch(asn_strtol_lim(str, &endp, lp)) { @@ -1431,12 +1431,12 @@ asn_strtol(const char *str, const char *end, long *lp) { * WARNING: This behavior is different from the standard strtol(3). */ enum asn_strtol_result_e -asn_strtol_lim(const char *str, const char **end, long *lp) { +asn_strtol_lim(const char *str, const char **end, long long *lp) { int sign = 1; - long l; + long long l; - const long upper_boundary = LONG_MAX / 10; - long last_digit_max = LONG_MAX % 10; + const long long upper_boundary = LLONG_MAX / 10; + long long last_digit_max = LLONG_MAX % 10; if(str >= *end) return ASN_STRTOL_ERROR_INVAL; diff --git a/skeletons/INTEGER.h b/skeletons/INTEGER.h index 5e0d94ae2..a5eac0c24 100644 --- a/skeletons/INTEGER.h +++ b/skeletons/INTEGER.h @@ -18,7 +18,7 @@ extern asn_TYPE_descriptor_t asn_DEF_INTEGER; /* Map with to integer value association */ typedef struct asn_INTEGER_enum_map_s { - int64_t nat_value; /* associated native integer value */ + long long nat_value; /* associated native integer value */ size_t enum_len; /* strlen("tag") */ const char *enum_name; /* "tag" */ } asn_INTEGER_enum_map_t; @@ -56,12 +56,12 @@ per_type_encoder_f INTEGER_encode_aper; */ int asn_INTEGER2int64(const INTEGER_t *i, int64_t *l); int asn_INTEGER2uint64(const INTEGER_t *i, uint64_t *l); -int asn_INTEGER2long(const INTEGER_t *i, long *l); -int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l); +int asn_INTEGER2long(const INTEGER_t *i, long long *l); +int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long long *l); int asn_int642INTEGER(INTEGER_t *i, int64_t l); int asn_uint642INTEGER(INTEGER_t *i, uint64_t l); -int asn_long2INTEGER(INTEGER_t *i, long l); -int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l); +int asn_long2INTEGER(INTEGER_t *i, long long l); +int asn_ulong2INTEGER(INTEGER_t *i, unsigned long long l); /* A a reified version of strtol(3) with nicer error reporting. */ enum asn_strtol_result_e { @@ -71,15 +71,15 @@ enum asn_strtol_result_e { ASN_STRTOL_OK = 0, /* Conversion succeded, number ends at (*end) */ ASN_STRTOL_EXTRA_DATA = 1 /* Conversion succeded, but the string has extra stuff */ }; -enum asn_strtol_result_e asn_strtol_lim(const char *str, const char **end, long *l); +enum asn_strtol_result_e asn_strtol_lim(const char *str, const char **end, long long *l); /* The asn_strtol is going to be DEPRECATED soon */ -enum asn_strtol_result_e asn_strtol(const char *str, const char *end, long *l); +enum asn_strtol_result_e asn_strtol(const char *str, const char *end, long long *l); /* * Convert the integer value into the corresponding enumeration map entry. */ -const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value); +const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long long value); #ifdef __cplusplus } diff --git a/skeletons/NativeInteger.c b/skeletons/NativeInteger.c index 9fdc111e8..ea7c21bdb 100644 --- a/skeletons/NativeInteger.c +++ b/skeletons/NativeInteger.c @@ -102,14 +102,14 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, const void *constbuf; void *nonconstbuf; } unconst_buf; - long l; + long long l; unconst_buf.constbuf = buf_ptr; tmp.buf = (uint8_t *)unconst_buf.nonconstbuf; tmp.size = length; if((specs&&specs->field_unsigned) - ? asn_INTEGER2ulong(&tmp, (unsigned long *)&l) /* sic */ + ? asn_INTEGER2ulong(&tmp, (unsigned long long *)&l) /* sic */ : asn_INTEGER2long(&tmp, &l)) { rval.code = RC_FAIL; rval.consumed = 0; @@ -187,9 +187,9 @@ NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx, rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, opt_mname, buf_ptr, size); if(rval.code == RC_OK) { - long l; + long long l; if((specs&&specs->field_unsigned) - ? asn_INTEGER2ulong(&st, (unsigned long *)&l) /* sic */ + ? asn_INTEGER2ulong(&st, (unsigned long long *)&l) /* sic */ : asn_INTEGER2long(&st, &l)) { rval.code = RC_FAIL; rval.consumed = 0; @@ -240,7 +240,7 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; asn_dec_rval_t rval; - long *native = (long *)*sptr; + long long *native = (long long *)*sptr; INTEGER_t tmpint; void *tmpintptr = &tmpint; @@ -248,7 +248,7 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, ASN_DEBUG("Decoding NativeInteger %s (UPER)", td->name); if(!native) { - native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + native = (long long *)(*sptr = CALLOC(1, sizeof(*native))); if(!native) ASN__DECODE_FAILED; } @@ -257,11 +257,11 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, &tmpintptr, pd); if(rval.code == RC_OK) { if((specs&&specs->field_unsigned) - ? asn_INTEGER2ulong(&tmpint, (unsigned long *)native) + ? asn_INTEGER2ulong(&tmpint, (unsigned long long *)native) : asn_INTEGER2long(&tmpint, native)) rval.code = RC_FAIL; else - ASN_DEBUG("NativeInteger %s got value %ld", + ASN_DEBUG("NativeInteger %s got value %lld", td->name, *native); } ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); @@ -276,7 +276,7 @@ NativeInteger_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; asn_dec_rval_t rval; - long *native = (long *)*sptr; + long long *native = (long long *)*sptr; INTEGER_t tmpint; void *tmpintptr = &tmpint; @@ -284,7 +284,7 @@ NativeInteger_decode_aper(asn_codec_ctx_t *opt_codec_ctx, ASN_DEBUG("Decoding NativeInteger %s (APER)", td->name); if(!native) { - native = (long *)(*sptr = CALLOC(1, sizeof(*native))); + native = (long long *)(*sptr = CALLOC(1, sizeof(*native))); if(!native) ASN__DECODE_FAILED; } @@ -293,11 +293,11 @@ NativeInteger_decode_aper(asn_codec_ctx_t *opt_codec_ctx, &tmpintptr, pd); if(rval.code == RC_OK) { if((specs&&specs->field_unsigned) - ? asn_INTEGER2ulong(&tmpint, (unsigned long *)native) + ? asn_INTEGER2ulong(&tmpint, (unsigned long long *)native) : asn_INTEGER2long(&tmpint, native)) rval.code = RC_FAIL; else - ASN_DEBUG("NativeInteger %s got value %ld", + ASN_DEBUG("NativeInteger %s got value %lld", td->name, *native); } ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint); diff --git a/skeletons/OBJECT_IDENTIFIER.c b/skeletons/OBJECT_IDENTIFIER.c index 8a782653c..e109cf5c4 100644 --- a/skeletons/OBJECT_IDENTIFIER.c +++ b/skeletons/OBJECT_IDENTIFIER.c @@ -668,7 +668,7 @@ OBJECT_IDENTIFIER_parse_arcs(const char *oid_text, ssize_t oid_txt_length, #define _OID_CAPTURE_ARC(oid_text, oid_end) do { \ const char *endp = oid_end; \ - long value; \ + long long value; \ switch(asn_strtol_lim(oid_text, &endp, &value)) { \ case ASN_STRTOL_EXTRA_DATA: \ case ASN_STRTOL_OK: \ diff --git a/skeletons/OCTET_STRING.c b/skeletons/OCTET_STRING.c index 548c93117..506f6eaa1 100644 --- a/skeletons/OCTET_STRING.c +++ b/skeletons/OCTET_STRING.c @@ -1196,14 +1196,14 @@ OCTET_STRING_decode_xer_utf8(asn_codec_ctx_t *opt_codec_ctx, static int OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, size_t units, unsigned int bpc, unsigned int unit_bits, - int64_t lb, int64_t ub, asn_per_constraints_t *pc) { + long long lb, long long ub, asn_per_constraints_t *pc) { uint8_t *end = buf + units * bpc; ASN_DEBUG("Expanding %d characters into (%lld..%lld):%d", (int)units, lb, ub, unit_bits); /* X.691: 27.5.4 */ - if((uint64_t)ub <= ((uint64_t)2 << (unit_bits - 1))) { + if((unsigned long long)ub <= ((unsigned long long)2 << (unit_bits - 1))) { /* Decode without translation */ lb = 0; } else if(pc && pc->code2value) { @@ -1260,14 +1260,14 @@ OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf, static int OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf, size_t units, unsigned int bpc, unsigned int unit_bits, - int64_t lb, int64_t ub, asn_per_constraints_t *pc) { + long long lb, long long ub, asn_per_constraints_t *pc) { const uint8_t *end = buf + units * bpc; ASN_DEBUG("Squeezing %d characters into (%lld..%lld):%d (%d bpc)", (int)units, lb, ub, unit_bits, bpc); /* X.691: 27.5.4 */ - if((uint64_t)ub <= ((uint64_t)2 << (unit_bits - 1))) { + if((unsigned long long)ub <= ((unsigned long long)2 << (unit_bits - 1))) { /* Encode as is */ lb = 0; } else if(pc && pc->value2code) { diff --git a/skeletons/asn_system.h b/skeletons/asn_system.h index d19837edf..696a37c8a 100644 --- a/skeletons/asn_system.h +++ b/skeletons/asn_system.h @@ -21,7 +21,7 @@ #include /* For *alloc(3) */ #include /* For memcpy(3) */ #include /* For size_t */ -#include /* For LONG_MAX */ +#include /* For LLONG_MAX and ULLONG_MAX */ #include /* For va_start */ #include /* for offsetof and ptrdiff_t */ diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c index e552e9af4..57621fdbf 100644 --- a/skeletons/constr_SEQUENCE.c +++ b/skeletons/constr_SEQUENCE.c @@ -1358,7 +1358,7 @@ SEQUENCE_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, bmlength = uper_get_nslength(pd); if(bmlength < 0) ASN__DECODE_STARVED; - ASN_DEBUG("Extensions %d present in %s", bmlength, td->name); + ASN_DEBUG("Extensions %lld present in %s", (long long)bmlength, td->name); epres = (uint8_t *)MALLOC((bmlength + 15) >> 3); if(!epres) ASN__DECODE_STARVED; @@ -1370,8 +1370,8 @@ SEQUENCE_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, memset(&epmd, 0, sizeof(epmd)); epmd.buffer = epres; epmd.nbits = bmlength; - ASN_DEBUG("Read in extensions bitmap for %s of %d bits (%x..)", - td->name, bmlength, *epres); + ASN_DEBUG("Read in extensions bitmap for %s of %lld bits (%x..)", + td->name, (long long)bmlength, *epres); /* Go over extensions and read them in */ for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { diff --git a/skeletons/per_decoder.c b/skeletons/per_decoder.c index 3ba8805ba..4fc07c480 100644 --- a/skeletons/per_decoder.c +++ b/skeletons/per_decoder.c @@ -165,7 +165,7 @@ aper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sp /* Return the number of consumed bits */ rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3) + pd.nboff - skip_bits; - ASN_DEBUG("PER decoding consumed %d, counted %d", + ASN_DEBUG("PER decoding consumed %zu, counted %zu", rval.consumed, pd.moved); assert(rval.consumed == pd.moved); } else { diff --git a/skeletons/per_encoder.c b/skeletons/per_encoder.c index 6923cf008..f0823e394 100644 --- a/skeletons/per_encoder.c +++ b/skeletons/per_encoder.c @@ -130,7 +130,7 @@ aper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cons } default: *buffer_r = key.buffer; - ASN_DEBUG("Complete encoded in %d bits", er.encoded); + ASN_DEBUG("Complete encoded in %lld bits", (long long)er.encoded); return ((er.encoded + 7) >> 3); } } diff --git a/skeletons/per_opentype.c b/skeletons/per_opentype.c index e5b64f4ea..43d656e09 100644 --- a/skeletons/per_opentype.c +++ b/skeletons/per_opentype.c @@ -76,8 +76,8 @@ aper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints FREEMEM(buf); if(toGo) return -1; - ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)", - td->name, size); + ASN_DEBUG("Open type put %s of length %lld + overhead (1byte?)", + td->name, (long long)size); return 0; } diff --git a/skeletons/per_support.c b/skeletons/per_support.c index 21ea23950..42244ba6c 100644 --- a/skeletons/per_support.c +++ b/skeletons/per_support.c @@ -35,7 +35,7 @@ int32_t aper_get_align(asn_per_data_t *pd) { if(pd->nboff & 0x7) { - ASN_DEBUG("Aligning %d bits", 8 - (pd->nboff & 0x7)); + ASN_DEBUG("Aligning %ld bits", 8 - ((unsigned long)pd->nboff & 0x7)); return per_get_few_bits(pd, 8 - (pd->nboff & 0x7)); } return 0; @@ -262,7 +262,7 @@ aper_get_nslength(asn_per_data_t *pd) { if(per_get_few_bits(pd, 1) == 0) { length = per_get_few_bits(pd, 6) + 1; if(length <= 0) return -1; - ASN_DEBUG("l=%d", length); + ASN_DEBUG("l=%lld", (long long)length); return length; } else { int repeat; @@ -361,9 +361,9 @@ uper_put_nsnnwn(asn_per_outp_t *po, int n) { /* X.691-2008/11, #11.5.6 -> #11.3 */ -int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *out_value, int nbits) { - unsigned long lhalf; /* Lower half of the number*/ - long half; +int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long long *out_value, int nbits) { + unsigned long long lhalf; /* Lower half of the number*/ + long long half; if(nbits <= 31) { half = per_get_few_bits(pd, nbits); @@ -381,27 +381,27 @@ int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *out_val if(uper_get_constrained_whole_number(pd, &lhalf, nbits - 31)) return -1; - *out_value = ((unsigned long)half << (nbits - 31)) | lhalf; + *out_value = ((unsigned long long)half << (nbits - 31)) | lhalf; return 0; } /* X.691-2008/11, #11.5.6 -> #11.3 */ -int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits) { +int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long long v, int nbits) { /* * Assume signed number can be safely coerced into * unsigned of the same range. * The following testing code will likely be optimized out * by compiler if it is true. */ - unsigned long uvalue1 = ULONG_MAX; - long svalue = uvalue1; - unsigned long uvalue2 = svalue; + unsigned long long uvalue1 = ULONG_MAX; + long long svalue = uvalue1; + unsigned long long uvalue2 = svalue; assert(uvalue1 == uvalue2); return uper_put_constrained_whole_number_u(po, v, nbits); } -int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits) { +int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long long v, int nbits) { if(nbits <= 31) { return per_put_few_bits(po, v, nbits); } else { @@ -550,7 +550,7 @@ aper_put_nsnnwn(asn_per_outp_t *po, int range, int number) { int aper_put_align(asn_per_outp_t *po) { if(po->nboff & 0x7) { - ASN_DEBUG("Aligning %d bits", 8 - (po->nboff & 0x7)); + ASN_DEBUG("Aligning %ld bits", 8 - ((unsigned long)po->nboff & 0x7)); if(per_put_few_bits(po, 0x00, (8 - (po->nboff & 0x7)))) return -1; } @@ -595,7 +595,7 @@ per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int nbits) { ssize_t uper_put_length(asn_per_outp_t *po, size_t length) { - ASN_DEBUG("UPER put length %d", length); + ASN_DEBUG("UPER put length %zu", length); if(length <= 127) /* #10.9.3.6 */ return per_put_few_bits(po, length, 8) @@ -614,7 +614,7 @@ uper_put_length(asn_per_outp_t *po, size_t length) { ssize_t aper_put_length(asn_per_outp_t *po, int range, size_t length) { - ASN_DEBUG("APER put length %d with range %d", length, range); + ASN_DEBUG("APER put length %zu with range %d", length, range); /* 10.9 X.691 Note 2 */ if (range <= 65536 && range >= 0) diff --git a/skeletons/per_support.h b/skeletons/per_support.h index 181fe248a..54fdbb544 100644 --- a/skeletons/per_support.h +++ b/skeletons/per_support.h @@ -24,8 +24,8 @@ typedef const struct asn_per_constraint_s { } flags; int range_bits; /* Full number of bits in the range */ int effective_bits; /* Effective bits */ - int64_t lower_bound; /* "lb" value */ - int64_t upper_bound; /* "ub" value */ + long long lower_bound; /* "lb" value */ + long long upper_bound; /* "ub" value */ } asn_per_constraint_t; typedef const struct asn_per_constraints_s { struct asn_per_constraint_s value; @@ -89,7 +89,7 @@ ssize_t uper_get_nsnnwn(asn_per_data_t *pd); ssize_t aper_get_nsnnwn(asn_per_data_t *pd, int range); /* X.691-2008/11, #11.5.6 */ -int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *v, int nbits); +int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long long *v, int nbits); /* Non-thread-safe debugging function, don't use it */ char *per_data_string(asn_per_data_t *pd); @@ -114,8 +114,8 @@ int per_put_few_bits(asn_per_outp_t *per_data, uint32_t bits, int obits); int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits); /* X.691-2008/11, #11.5 */ -int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits); -int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits); +int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long long v, int nbits); +int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long long v, int nbits); /* Align the current bit position to octet bundary */ int aper_put_align(asn_per_outp_t *po); diff --git a/skeletons/tests/check-INTEGER.c b/skeletons/tests/check-INTEGER.c index 4ec9fd50c..31020557e 100644 --- a/skeletons/tests/check-INTEGER.c +++ b/skeletons/tests/check-INTEGER.c @@ -14,13 +14,13 @@ static int _print2buf(const void *buf, size_t size, void *key) { } static void -check(uint8_t *buf, int size, long check_long, int check_ret) { +check(uint8_t *buf, int size, long long check_long, int check_ret) { char scratch[128]; char verify[32]; INTEGER_t val; uint8_t *buf_end = buf + size; int ret; - long rlong = 123; + long long rlong = 123; assert(buf); assert(size >= 0); @@ -36,15 +36,15 @@ check(uint8_t *buf, int size, long check_long, int check_ret) { printf("]: "); ret = asn_INTEGER2long(&val, &rlong); - printf(" (%ld, %d) vs (%ld, %d)\n", + printf(" (%lld, %d) vs (%lld, %d)\n", rlong, ret, check_long, check_ret); assert(ret == check_ret); - printf("%ld %ld\n", rlong, check_long); + printf("%lld %lld\n", rlong, check_long); assert(rlong == check_long); if(check_ret == 0) { INTEGER_t val2; - long rlong2; + long long rlong2; val2.buf = 0; val2.size = 0; ret = asn_long2INTEGER(&val2, rlong); @@ -60,7 +60,7 @@ check(uint8_t *buf, int size, long check_long, int check_ret) { ret = INTEGER_print(&asn_DEF_INTEGER, &val, 0, _print2buf, scratch); assert(shared_scratch_start < scratch + sizeof(scratch)); assert(ret == 0); - ret = snprintf(verify, sizeof(verify), "%ld", check_long); + ret = snprintf(verify, sizeof(verify), "%lld", check_long); assert(ret < 0 || (size_t)ret < sizeof(verify)); ret = strcmp(scratch, verify); printf(" [%s] vs [%s]: %d%s\n", @@ -75,13 +75,13 @@ check(uint8_t *buf, int size, long check_long, int check_ret) { } static void -check_unsigned(uint8_t *buf, int size, unsigned long check_long, int check_ret) { +check_unsigned(uint8_t *buf, int size, unsigned long long check_long, int check_ret) { char scratch[128]; char verify[32]; INTEGER_t val; uint8_t *buf_end = buf + size; int ret; - unsigned long rlong = 123; + unsigned long long rlong = 123; assert(buf); assert(size >= 0); @@ -97,14 +97,14 @@ check_unsigned(uint8_t *buf, int size, unsigned long check_long, int check_ret) printf("]: "); ret = asn_INTEGER2ulong(&val, &rlong); - printf(" (%lu, %d) vs (%lu, %d)\n", + printf(" (%llu, %d) vs (%llu, %d)\n", rlong, ret, check_long, check_ret); assert(ret == check_ret); assert(rlong == check_long); if(check_ret == 0) { INTEGER_t val2; - unsigned long rlong2; + unsigned long long rlong2; val2.buf = 0; val2.size = 0; ret = asn_ulong2INTEGER(&val2, rlong); @@ -127,7 +127,7 @@ check_unsigned(uint8_t *buf, int size, unsigned long check_long, int check_ret) ret = INTEGER_print(&asn_DEF_INTEGER, &val, 0, _print2buf, scratch); assert(shared_scratch_start < scratch + sizeof(scratch)); assert(ret == 0); - ret = snprintf(verify, sizeof(verify), "%lu", check_long); + ret = snprintf(verify, sizeof(verify), "%llu", check_long); assert(ret < sizeof(verify)); ret = strcmp(scratch, verify); printf(" [%s] vs [%s]: %d%s\n", @@ -142,13 +142,13 @@ check_unsigned(uint8_t *buf, int size, unsigned long check_long, int check_ret) } static void -check_xer(int tofail, char *xmldata, long orig_value) { +check_xer(int tofail, char *xmldata, long long orig_value) { INTEGER_t *st = 0; asn_dec_rval_t rc; - long value; + long long value; int ret; - printf("[%s] vs %ld: ", xmldata, orig_value); + printf("[%s] vs %lld: ", xmldata, orig_value); rc = xer_decode(0, &asn_DEF_INTEGER, (void *)&st, xmldata, strlen(xmldata)); @@ -162,7 +162,7 @@ check_xer(int tofail, char *xmldata, long orig_value) { ret = asn_INTEGER2long(st, &value); assert(ret == 0); - printf("\t%ld\n", value); + printf("\t%lld\n", value); assert(value == orig_value); @@ -250,18 +250,25 @@ main() { check_xer(0, "+2147483647", 2147483647); check_xer(0, "2147483647", 2147483647); if(sizeof(long) == 4) { - check_xer( 0, "-2147483648", -2147483648); - check_xer(-1, "-2147483649", 0); - check_xer(-1, "2147483648", 0); - check_xer(-1, "2147483649", 0); - check_xer(-1, "3147483649", 0); - check_xer(-1, "4147483649", 0); - check_xer(-1, "5147483649", 0); /* special */ - check_xer(-1, "9147483649", 0); - check_xer(-1, "9999999999", 0); - check_xer(-1, "-5147483649", 0);/* special */ - check_xer(-1, "-9147483649", 0); - check_xer(-1, "-9999999999", 0); + check_xer(0, "2147483648", 2147483648); + check_xer(0, "2147483649", 2147483649); + check_xer(0, "3147483649", 3147483649); + check_xer(0, "4147483649", 4147483649); + check_xer(0, "5147483649", 5147483649); + check_xer(0, "9147483649", 9147483649); + check_xer(0, "9999999999", 9999999999); + check_xer(0, "9223372036854775807", 9223372036854775807); + check_xer(-1, "9223372036854775808", 0); + check_xer(-1, "10223372036854775807", 0); + check_xer(-1, "50223372036854775807", 0); + check_xer(-1, "100223372036854775807", 0); + check_xer(-1, "500223372036854775807", 0); + check_xer(0, "-9223372036854775808", -9223372036854775807-1); + check_xer(-1, "-9223372036854775809", 0); + check_xer(-1, "-10223372036854775807", 0); + check_xer(-1, "-50223372036854775807", 0); + check_xer(-1, "-100223372036854775807", 0); + check_xer(-1, "-500223372036854775807", 0); } if(sizeof(long) == 8) { check_xer(0, "2147483648", 2147483648); diff --git a/skeletons/tests/check-OIDs.c b/skeletons/tests/check-OIDs.c index 05b49932c..529c17fb9 100644 --- a/skeletons/tests/check-OIDs.c +++ b/skeletons/tests/check-OIDs.c @@ -416,13 +416,9 @@ main() { check_parse("1.2000000000.3", 3); check_parse("1.2147483647.3", 3); if(sizeof(long) == 4) { - check_parse("1.2147483648.3", -1); /* overflow on ILP32 */ - check_parse("1.2147483649.3", -1); /* overflow on ILP32 */ - check_parse("1.3000000000.3", -1); - check_parse("1.4000000000.3", -1); - check_parse("1.5000000000.3", -1); - check_parse("1.6000000000.3", -1); - check_parse("1.9000000000.3", -1); + check_parse("1.2147483648.3", 3); + check_parse("1.9223372036854775807.3", 3); + check_parse("1.9223372036854775808.3", -1); } else if(sizeof(long) == 8) { check_parse("1.2147483648.3", 3); check_parse("1.9223372036854775807.3", 3); diff --git a/skeletons/tests/check-PER-INTEGER.c b/skeletons/tests/check-PER-INTEGER.c index 640269b99..90cc1b914 100644 --- a/skeletons/tests/check-PER-INTEGER.c +++ b/skeletons/tests/check-PER-INTEGER.c @@ -104,11 +104,11 @@ check_per_encode_constrained(int lineno, int unsigned_, long value, long lbound, (void **)&reconstructed_st, &pd); assert(dec_rval.code == RC_OK); if(unsigned_) { - unsigned long reconstructed_value = 0; + unsigned long long reconstructed_value = 0; asn_INTEGER2ulong(reconstructed_st, &reconstructed_value); assert(reconstructed_value == (unsigned long)value); } else { - long reconstructed_value = 0; + long long reconstructed_value = 0; asn_INTEGER2long(reconstructed_st, &reconstructed_value); assert(reconstructed_value == value); } diff --git a/skeletons/tests/check-REAL.c b/skeletons/tests/check-REAL.c index f50bb8203..6919a9e5d 100644 --- a/skeletons/tests/check-REAL.c +++ b/skeletons/tests/check-REAL.c @@ -192,7 +192,7 @@ check_ber_buffer_twoway(double d, const char *sample, const char *canonical_samp ret = asn_double2REAL(&rn, d); assert(ret == 0); if((size_t)rn.size != outsize) { - printf("Encoded %f into %d expected %ld\n", + printf("Encoded %f into %d expected %zu\n", d, (int)rn.size, outsize); assert((size_t)rn.size == outsize); } From 461f3fa3eb603841ea4c90f8c01308af00816b64 Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Wed, 1 Feb 2017 16:53:11 +0300 Subject: [PATCH 18/28] Check without duplication --- libasn1fix/asn1fix_constraint.c | 2 +- libasn1fix/asn1fix_cws.c | 36 +++++++++++++++++++++++++++++++++ libasn1fix/asn1fix_cws.h | 1 + 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/libasn1fix/asn1fix_constraint.c b/libasn1fix/asn1fix_constraint.c index 8d436d904..97fa589b4 100644 --- a/libasn1fix/asn1fix_constraint.c +++ b/libasn1fix/asn1fix_constraint.c @@ -361,7 +361,7 @@ constraint_object_resolve(arg_t *arg, asn1p_value_t *value) { tmp_expr.value = value; arg->expr = &tmp_expr; - if (asn1f_parse_class_object(arg)) { + if (asn1f_check_class_object(arg)) { arg->expr = saved_expr; FATAL("Parsing ObjectSet %s failed at %d", arg->expr->Identifier, arg->expr->_lineno); diff --git a/libasn1fix/asn1fix_cws.c b/libasn1fix/asn1fix_cws.c index da9202815..2c8f24a0e 100644 --- a/libasn1fix/asn1fix_cws.c +++ b/libasn1fix/asn1fix_cws.c @@ -7,6 +7,42 @@ static int _asn1f_parse_class_object_data(arg_t *, asn1p_expr_t *eclass, int optional_mode, uint8_t **newpos); static int _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_row_s *row, struct asn1p_ioc_cell_s *cell, uint8_t *buf, const uint8_t *bend); +int +asn1f_check_class_object(arg_t *arg) { + asn1p_expr_t *expr = arg->expr; + asn1p_expr_t *eclass; + asn1p_ioc_row_t *row; + + if(expr->meta_type != AMT_VALUE + || expr->expr_type != A1TC_REFERENCE + || !expr->value + || expr->value->type != ATV_UNPARSED) + return 0; + + eclass = asn1f_find_terminal_type(arg, expr); + if(!eclass + || eclass->meta_type != AMT_OBJECTCLASS + || eclass->expr_type != A1TC_CLASSDEF) { + return 0; + } + + if(!eclass->with_syntax) { + DEBUG("Can't process classes without %s just yet", + "WITH SYNTAX"); + return 0; + } + + row = asn1p_ioc_row_new(eclass); + assert(row); + + return _asn1f_parse_class_object_data(arg, eclass, row, + eclass->with_syntax, + expr->value->value.string.buf + 1, + expr->value->value.string.buf + + expr->value->value.string.size - 1, + 0, 0); +} + int asn1f_parse_class_object(arg_t *arg) { asn1p_expr_t *expr = arg->expr; diff --git a/libasn1fix/asn1fix_cws.h b/libasn1fix/asn1fix_cws.h index 3d24f1637..e998a28ab 100644 --- a/libasn1fix/asn1fix_cws.h +++ b/libasn1fix/asn1fix_cws.h @@ -4,6 +4,7 @@ /* * Parse class objects */ +int asn1f_check_class_object(arg_t *arg); int asn1f_parse_class_object(arg_t *arg); #endif /* ASN1FIX_CLASS_WITH_SYNTAX_H */ From 22d686495e09850940c7752448a03279487a6125 Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Thu, 2 Feb 2017 16:37:22 +0300 Subject: [PATCH 19/28] spaces replaced by tabs --- skeletons/OCTET_STRING.c | 90 ++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/skeletons/OCTET_STRING.c b/skeletons/OCTET_STRING.c index 506f6eaa1..99b9da962 100644 --- a/skeletons/OCTET_STRING.c +++ b/skeletons/OCTET_STRING.c @@ -1846,51 +1846,51 @@ asn_enc_rval_t OCTET_STRING_encode_aper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { - asn_OCTET_STRING_specifics_t *specs = td->specifics - ? (asn_OCTET_STRING_specifics_t *)td->specifics - : &asn_DEF_OCTET_STRING_specs; - asn_per_constraints_t *pc = constraints ? constraints - : td->per_constraints; - asn_per_constraint_t *cval; - asn_per_constraint_t *csiz; - const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; - asn_enc_rval_t er = { 0, 0, 0 }; - int inext = 0; /* Lies not within extension root */ - unsigned int unit_bits; - unsigned int canonical_unit_bits; - unsigned int sizeinunits; - const uint8_t *buf; - int ret; - enum { - OS__BPC_BIT = 0, - OS__BPC_CHAR = 1, - OS__BPC_U16 = 2, - OS__BPC_U32 = 4 - } bpc; /* Bytes per character */ - int ct_extensible; - - if(!st || (!st->buf && st->size)) - ASN__ENCODE_FAILED; - - if(pc) { - cval = &pc->value; - csiz = &pc->size; - } else { - cval = &asn_DEF_OCTET_STRING_constraints.value; - csiz = &asn_DEF_OCTET_STRING_constraints.size; - } - ct_extensible = csiz->flags & APC_EXTENSIBLE; - - switch(specs->subvariant) { - default: -// case ASN_OSUBV_ANY: -// ASN__ENCODE_FAILED; - case ASN_OSUBV_BIT: - canonical_unit_bits = unit_bits = 1; - bpc = OS__BPC_BIT; - sizeinunits = st->size * 8 - (st->bits_unused & 0x07); - ASN_DEBUG("BIT STRING of %d bytes", - sizeinunits); + asn_OCTET_STRING_specifics_t *specs = td->specifics + ? (asn_OCTET_STRING_specifics_t *)td->specifics + : &asn_DEF_OCTET_STRING_specs; + asn_per_constraints_t *pc = constraints ? constraints + : td->per_constraints; + asn_per_constraint_t *cval; + asn_per_constraint_t *csiz; + const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; + asn_enc_rval_t er = { 0, 0, 0 }; + int inext = 0; /* Lies not within extension root */ + unsigned int unit_bits; + unsigned int canonical_unit_bits; + unsigned int sizeinunits; + const uint8_t *buf; + int ret; + enum { + OS__BPC_BIT = 0, + OS__BPC_CHAR = 1, + OS__BPC_U16 = 2, + OS__BPC_U32 = 4 + } bpc; /* Bytes per character */ + int ct_extensible; + + if(!st || (!st->buf && st->size)) + ASN__ENCODE_FAILED; + + if(pc) { + cval = &pc->value; + csiz = &pc->size; + } else { + cval = &asn_DEF_OCTET_STRING_constraints.value; + csiz = &asn_DEF_OCTET_STRING_constraints.size; + } + ct_extensible = csiz->flags & APC_EXTENSIBLE; + + switch(specs->subvariant) { + default: + // case ASN_OSUBV_ANY: + // ASN__ENCODE_FAILED; + case ASN_OSUBV_BIT: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + sizeinunits = st->size * 8 - (st->bits_unused & 0x07); + ASN_DEBUG("BIT STRING of %d bytes", + sizeinunits); break; case ASN_OSUBV_ANY: case ASN_OSUBV_STR: From 6d06ae18dd692ce844b0fd1a023b04b5f8991425 Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Thu, 2 Feb 2017 16:40:00 +0300 Subject: [PATCH 20/28] separate functions for APER and UPER --- skeletons/constr_SEQUENCE.c | 66 +++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 7 deletions(-) diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c index 57621fdbf..6e50facc9 100644 --- a/skeletons/constr_SEQUENCE.c +++ b/skeletons/constr_SEQUENCE.c @@ -1456,7 +1456,59 @@ SEQUENCE_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, } static int -SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr, +SEQUENCE_handle_extensions_uper(asn_TYPE_descriptor_t *td, void *sptr, + asn_per_outp_t *po1, asn_per_outp_t *po2) { + asn_SEQUENCE_specifics_t *specs + = (asn_SEQUENCE_specifics_t *)td->specifics; + int exts_present = 0; + int exts_count = 0; + int edx; + + if(specs->ext_before < 0) + return 0; + + /* Find out which extensions are present */ + for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { + asn_TYPE_member_t *elm = &td->elements[edx]; + void *memb_ptr; /* Pointer to the member */ + void **memb_ptr2; /* Pointer to that pointer */ + int present; + + if(!IN_EXTENSION_GROUP(specs, edx)) { + ASN_DEBUG("%s (@%d) is not extension", elm->type->name, edx); + continue; + } + + /* Fetch the pointer to this member */ + if(elm->flags & ATF_POINTER) { + memb_ptr2 = (void **)((char *)sptr + elm->memb_offset); + present = (*memb_ptr2 != 0); + } else { + memb_ptr = (void *)((char *)sptr + elm->memb_offset); + memb_ptr2 = &memb_ptr; + present = 1; + } + + ASN_DEBUG("checking %s (@%d) present => %d", + elm->type->name, edx, present); + exts_count++; + exts_present += present; + + /* Encode as presence marker */ + if(po1 && per_put_few_bits(po1, present, 1)) + return -1; + /* Encode as open type field */ + if(po2 && present && uper_open_type_put(elm->type, + elm->per_constraints, *memb_ptr2, po2)) + return -1; + + } + + return exts_present ? exts_count : 0; +} + +static int +SEQUENCE_handle_extensions_aper(asn_TYPE_descriptor_t *td, void *sptr, asn_per_outp_t *po1, asn_per_outp_t *po2) { asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics; @@ -1532,7 +1584,7 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, * and whether to encode extensions */ if(specs->ext_before >= 0) { - n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0); + n_extensions = SEQUENCE_handle_extensions_uper(td, sptr, 0, 0); per_put_few_bits(po, n_extensions ? 1 : 0, 1); } else { n_extensions = 0; /* There are no extensions to encode */ @@ -1625,12 +1677,12 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, ASN_DEBUG("Bit-map of %d elements", n_extensions); /* #18.7. Encoding the extensions presence bit-map. */ /* TODO: act upon NOTE in #18.7 for canonical PER */ - if(SEQUENCE_handle_extensions(td, sptr, po, 0) != n_extensions) + if(SEQUENCE_handle_extensions_uper(td, sptr, po, 0) != n_extensions) ASN__ENCODE_FAILED; ASN_DEBUG("Writing %d extensions", n_extensions); /* #18.9. Encode extensions as open type fields. */ - if(SEQUENCE_handle_extensions(td, sptr, 0, po) != n_extensions) + if(SEQUENCE_handle_extensions_uper(td, sptr, 0, po) != n_extensions) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); @@ -1660,7 +1712,7 @@ SEQUENCE_encode_aper(asn_TYPE_descriptor_t *td, * and whether to encode extensions */ if(specs->ext_before >= 0) { - n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0); + n_extensions = SEQUENCE_handle_extensions_aper(td, sptr, 0, 0); per_put_few_bits(po, n_extensions ? 1 : 0, 1); } else { n_extensions = 0; /* There are no extensions to encode */ @@ -1753,12 +1805,12 @@ SEQUENCE_encode_aper(asn_TYPE_descriptor_t *td, ASN_DEBUG("Bit-map of %d elements", n_extensions); /* #18.7. Encoding the extensions presence bit-map. */ /* TODO: act upon NOTE in #18.7 for canonical PER */ - if(SEQUENCE_handle_extensions(td, sptr, po, 0) != n_extensions) + if(SEQUENCE_handle_extensions_aper(td, sptr, po, 0) != n_extensions) ASN__ENCODE_FAILED; ASN_DEBUG("Writing %d extensions", n_extensions); /* #18.9. Encode extensions as open type fields. */ - if(SEQUENCE_handle_extensions(td, sptr, 0, po) != n_extensions) + if(SEQUENCE_handle_extensions_aper(td, sptr, 0, po) != n_extensions) ASN__ENCODE_FAILED; ASN__ENCODED_OK(er); From 0d6c91106feb94cc3c119619092a5f42b40d2716 Mon Sep 17 00:00:00 2001 From: kuzmin_m Date: Thu, 2 Feb 2017 16:43:15 +0300 Subject: [PATCH 21/28] tests were updated to fit new format --- asn1c/tests/check-assembly.sh | 2 +- asn1c/tests/check-src/check-03.-fwide-types.c | 2 +- tests/03-enum-OK.asn1.-Pfwide-types | 25 +- tests/104-param-1-OK.asn1.-Pfwide-types | 9 +- tests/105-param-2-OK.asn1.-Pfwide-types | 19 +- tests/106-param-constr-OK.asn1.-P | 28 +- .../108-param-constr-3-OK.asn1.-Pfwide-types | 18 +- tests/110-param-3-OK.asn1.-Pfwide-types | 25 +- tests/119-per-strings-OK.asn1.-Pgen-PER | 106 +-- tests/125-bitstring-constraint-OK.asn1.-P | 5 +- tests/125-bitstring-constraint-OK.asn1.-X | 2 +- tests/126-per-extensions-OK.asn1.-Pgen-PER | 8 +- tests/127-per-long-OK.asn1.-Pgen-PER | 76 +- tests/131-per-empty-OK.asn1.-Pgen-PER | 2 + tests/134-per-long-OK.asn1.-Pgen-PER | 26 +- tests/19-param-OK.asn1.-Pfwide-types | 19 +- tests/22-tags-OK.asn1.-Pfwide-types | 6 +- tests/30-set-OK.asn1.-Pfwide-types | 3 +- tests/31-set-of-OK.asn1.-Pfwide-types | 21 +- tests/32-sequence-of-OK.asn1.-P | 21 +- .../37-indirect-choice-OK.asn1.-Pfwide-types | 29 +- tests/39-sequence-of-OK.asn1.-Pfwide-types | 9 +- tests/42-real-life-OK.asn1.-PR | 39 +- tests/43-recursion-OK.asn1.-Pfwide-types | 21 +- tests/44-choice-in-sequence-OK.asn1.-P | 12 +- tests/46-redefine-OK.asn1.-PR | 13 +- tests/47-set-ext-OK.asn1.-Pfwide-types | 12 +- tests/50-constraint-OK.asn1.-Pfwide-types | 219 ++++-- tests/50-constraint-OK.asn1.-Pgen-PER | 729 ++++++++++++++++-- .../59-choice-extended-OK.asn1.-Pfwide-types | 3 +- tests/60-any-OK.asn1.-Pfwide-types | 9 +- tests/65-multi-tag-OK.asn1.-Pfnative-types | 38 +- tests/65-multi-tag-OK.asn1.-Pfwide-types | 38 +- tests/66-ref-simple-OK.asn1.-Pfwide-types | 8 +- tests/69-reserved-words-OK.asn1.-Pfwide-types | 8 +- tests/70-xer-test-OK.asn1.-Pfwide-types | 66 +- tests/72-same-names-OK.asn1.-Pfwide-types | 34 +- tests/73-circular-OK.asn1.-Pfwide-types | 34 +- tests/84-param-tags-OK.asn1.-Pfwide-types | 36 +- tests/88-integer-enum-OK.asn1.-Pfwide-types | 5 +- ...-bit-string-enum-OK.asn1.-Pfcompound-names | 3 +- .../89-bit-string-enum-OK.asn1.-Pfwide-types | 3 +- tests/90-cond-int-type-OK.asn1.-P | 162 ++-- tests/90-cond-int-type-OK.asn1.-Pfwide-types | 156 ++-- tests/90-cond-int-type-OK.asn1.-Pgen-PER | 474 ++++++++++-- ...1-cond-int-blessSize-OK.asn1.-Pfbless-SIZE | 25 +- ...-circular-loops-OK.asn1.-Pfindirect-choice | 53 +- tests/92-circular-loops-OK.asn1.-Pfwide-types | 53 +- tests/93-asn1c-controls-OK.asn1.-Pfwide-types | 12 +- tests/94-set-optionals-OK.asn1.-P | 3 +- .../95-choice-per-order-OK.asn1.-Pfwide-types | 9 +- tests/95-choice-per-order-OK.asn1.-Pgen-PER | 12 +- tests/98-attribute-class-OK.asn1.-P | 3 +- 53 files changed, 2127 insertions(+), 626 deletions(-) diff --git a/asn1c/tests/check-assembly.sh b/asn1c/tests/check-assembly.sh index d897f8970..22e2b6dd3 100755 --- a/asn1c/tests/check-assembly.sh +++ b/asn1c/tests/check-assembly.sh @@ -17,7 +17,7 @@ abs_top_srcdir="${abs_top_srcdir:-$(pwd)/../../}" abs_top_builddir="${abs_top_builddir:-$(pwd)/../../}" if echo "$*" | grep -q -- -- ; then - TEST_DRIVER=$(echo "$*" | sed -e 's/ -- .*/--/g') + TEST_DRIVER=$(echo "$*" | sed -e 's/ -- .*/ -- /g') source_full=$(echo "$*" | sed -e 's/.* //g') else TEST_DRIVER="" diff --git a/asn1c/tests/check-src/check-03.-fwide-types.c b/asn1c/tests/check-src/check-03.-fwide-types.c index 2c44d628d..205aa7c33 100644 --- a/asn1c/tests/check-src/check-03.-fwide-types.c +++ b/asn1c/tests/check-src/check-03.-fwide-types.c @@ -28,7 +28,7 @@ check_xer(e_Enum2 eval, char *xer_string) { asn_dec_rval_t rv; char buf2[128]; Enum2_t *e = 0; - long val; + long long val; rv = xer_decode(0, &asn_DEF_Enum2, (void **)&e, xer_string, strlen(xer_string)); diff --git a/tests/03-enum-OK.asn1.-Pfwide-types b/tests/03-enum-OK.asn1.-Pfwide-types index ee906c615..281ad16ca 100644 --- a/tests/03-enum-OK.asn1.-Pfwide-types +++ b/tests/03-enum-OK.asn1.-Pfwide-types @@ -55,6 +55,8 @@ Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + td->aper_decoder = asn_DEF_ENUMERATED.aper_decoder; + td->aper_encoder = asn_DEF_ENUMERATED.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; @@ -145,7 +147,8 @@ asn_TYPE_descriptor_t asn_DEF_Enum1 = { Enum1_encode_der, Enum1_decode_xer, Enum1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum1_tags_1, sizeof(asn_DEF_Enum1_tags_1) @@ -218,6 +221,8 @@ Enum2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + td->aper_decoder = asn_DEF_ENUMERATED.aper_decoder; + td->aper_encoder = asn_DEF_ENUMERATED.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; @@ -314,7 +319,8 @@ asn_TYPE_descriptor_t asn_DEF_Enum2 = { Enum2_encode_der, Enum2_decode_xer, Enum2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum2_tags_1, sizeof(asn_DEF_Enum2_tags_1) @@ -383,6 +389,8 @@ Enum3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + td->aper_decoder = asn_DEF_ENUMERATED.aper_decoder; + td->aper_encoder = asn_DEF_ENUMERATED.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; @@ -471,7 +479,8 @@ asn_TYPE_descriptor_t asn_DEF_Enum3 = { Enum3_encode_der, Enum3_decode_xer, Enum3_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum3_tags_1, sizeof(asn_DEF_Enum3_tags_1) @@ -541,6 +550,8 @@ Enum4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + td->aper_decoder = asn_DEF_ENUMERATED.aper_decoder; + td->aper_encoder = asn_DEF_ENUMERATED.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; @@ -631,7 +642,8 @@ asn_TYPE_descriptor_t asn_DEF_Enum4 = { Enum4_encode_der, Enum4_decode_xer, Enum4_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum4_tags_1, sizeof(asn_DEF_Enum4_tags_1) @@ -700,6 +712,8 @@ Enum5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + td->aper_decoder = asn_DEF_ENUMERATED.aper_decoder; + td->aper_encoder = asn_DEF_ENUMERATED.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; @@ -788,7 +802,8 @@ asn_TYPE_descriptor_t asn_DEF_Enum5 = { Enum5_encode_der, Enum5_decode_xer, Enum5_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum5_tags_1, sizeof(asn_DEF_Enum5_tags_1) diff --git a/tests/104-param-1-OK.asn1.-Pfwide-types b/tests/104-param-1-OK.asn1.-Pfwide-types index 1094f42d9..50e33bafd 100644 --- a/tests/104-param-1-OK.asn1.-Pfwide-types +++ b/tests/104-param-1-OK.asn1.-Pfwide-types @@ -57,7 +57,8 @@ asn_TYPE_descriptor_t asn_DEF_Collection_16P0 = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Collection_16P0_tags_1, sizeof(asn_DEF_Collection_16P0_tags_1) @@ -100,7 +101,8 @@ asn_TYPE_descriptor_t asn_DEF_Collection_16P1 = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Collection_16P1_tags_3, sizeof(asn_DEF_Collection_16P1_tags_3) @@ -182,7 +184,8 @@ asn_TYPE_descriptor_t asn_DEF_Bunch = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Bunch_tags_1, sizeof(asn_DEF_Bunch_tags_1) diff --git a/tests/105-param-2-OK.asn1.-Pfwide-types b/tests/105-param-2-OK.asn1.-Pfwide-types index 1145f1532..7ac005b3f 100644 --- a/tests/105-param-2-OK.asn1.-Pfwide-types +++ b/tests/105-param-2-OK.asn1.-Pfwide-types @@ -83,7 +83,8 @@ asn_TYPE_descriptor_t asn_DEF_SIGNED_16P0 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SIGNED_16P0_tags_1, sizeof(asn_DEF_SIGNED_16P0_tags_1) @@ -139,7 +140,8 @@ asn_TYPE_descriptor_t asn_DEF_signed_4 = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_signed_tags_4, sizeof(asn_DEF_signed_tags_4) @@ -189,7 +191,8 @@ asn_TYPE_descriptor_t asn_DEF_SIGNED_16P1 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SIGNED_16P1_tags_3, sizeof(asn_DEF_SIGNED_16P1_tags_3) @@ -248,6 +251,8 @@ SignedREAL_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_SIGNED_16P0.xer_encoder; td->uper_decoder = asn_DEF_SIGNED_16P0.uper_decoder; td->uper_encoder = asn_DEF_SIGNED_16P0.uper_encoder; + td->aper_decoder = asn_DEF_SIGNED_16P0.aper_decoder; + td->aper_encoder = asn_DEF_SIGNED_16P0.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_SIGNED_16P0.per_constraints; td->elements = asn_DEF_SIGNED_16P0.elements; @@ -315,7 +320,8 @@ asn_TYPE_descriptor_t asn_DEF_SignedREAL = { SignedREAL_encode_der, SignedREAL_decode_xer, SignedREAL_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SignedREAL_tags_1, sizeof(asn_DEF_SignedREAL_tags_1) @@ -373,6 +379,8 @@ SignedSET_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_SIGNED_16P1.xer_encoder; td->uper_decoder = asn_DEF_SIGNED_16P1.uper_decoder; td->uper_encoder = asn_DEF_SIGNED_16P1.uper_encoder; + td->aper_decoder = asn_DEF_SIGNED_16P1.aper_decoder; + td->aper_encoder = asn_DEF_SIGNED_16P1.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_SIGNED_16P1.per_constraints; td->elements = asn_DEF_SIGNED_16P1.elements; @@ -440,7 +448,8 @@ asn_TYPE_descriptor_t asn_DEF_SignedSET = { SignedSET_encode_der, SignedSET_decode_xer, SignedSET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SignedSET_tags_1, sizeof(asn_DEF_SignedSET_tags_1) diff --git a/tests/106-param-constr-OK.asn1.-P b/tests/106-param-constr-OK.asn1.-P index 9155bf6ae..ac9be6305 100644 --- a/tests/106-param-constr-OK.asn1.-P +++ b/tests/106-param-constr-OK.asn1.-P @@ -24,7 +24,7 @@ extern asn_TYPE_descriptor_t asn_DEF_Narrow_15P0; static int memb_narrow1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -33,9 +33,9 @@ memb_narrow1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= 1 && value <= 5)) { + if((value >= 1LL && value <= 5LL)) { /* Constraint check succeeded */ return 0; } else { @@ -49,7 +49,7 @@ memb_narrow1_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_narrow2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -58,9 +58,9 @@ memb_narrow2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= 2 && value <= 5)) { + if((value >= 2LL && value <= 5LL)) { /* Constraint check succeeded */ return 0; } else { @@ -74,7 +74,7 @@ memb_narrow2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_narrow3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -83,9 +83,9 @@ memb_narrow3_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= 3 && value <= 5)) { + if((value >= 3LL && value <= 5LL)) { /* Constraint check succeeded */ return 0; } else { @@ -110,7 +110,7 @@ static int asn_DFL_2_set_3(int set_value, void **sptr) { if(set_value) { /* Install default value 3 */ - *st = 3; + *st = 3l; return 0; } else { /* Test default value 3 */ @@ -173,7 +173,8 @@ asn_TYPE_descriptor_t asn_DEF_Narrow_15P0 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Narrow_15P0_tags_1, sizeof(asn_DEF_Narrow_15P0_tags_1) @@ -232,6 +233,8 @@ NarrowInteger_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Narrow_15P0.xer_encoder; td->uper_decoder = asn_DEF_Narrow_15P0.uper_decoder; td->uper_encoder = asn_DEF_Narrow_15P0.uper_encoder; + td->aper_decoder = asn_DEF_Narrow_15P0.aper_decoder; + td->aper_encoder = asn_DEF_Narrow_15P0.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Narrow_15P0.per_constraints; td->elements = asn_DEF_Narrow_15P0.elements; @@ -299,7 +302,8 @@ asn_TYPE_descriptor_t asn_DEF_NarrowInteger = { NarrowInteger_encode_der, NarrowInteger_decode_xer, NarrowInteger_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NarrowInteger_tags_1, sizeof(asn_DEF_NarrowInteger_tags_1) diff --git a/tests/108-param-constr-3-OK.asn1.-Pfwide-types b/tests/108-param-constr-3-OK.asn1.-Pfwide-types index 8599d4b63..017d2ec24 100644 --- a/tests/108-param-constr-3-OK.asn1.-Pfwide-types +++ b/tests/108-param-constr-3-OK.asn1.-Pfwide-types @@ -24,7 +24,7 @@ int MinMax_16P0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -40,7 +40,7 @@ MinMax_16P0_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= 3)) { + if((value >= 3LL)) { /* Constraint check succeeded */ return 0; } else { @@ -66,6 +66,8 @@ MinMax_16P0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -133,7 +135,8 @@ asn_TYPE_descriptor_t asn_DEF_MinMax_16P0 = { MinMax_16P0_encode_der, MinMax_16P0_decode_xer, MinMax_16P0_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_MinMax_16P0_tags_1, sizeof(asn_DEF_MinMax_16P0_tags_1) @@ -172,7 +175,7 @@ int ThreePlus_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const MinMax_16P0_t *st = (const MinMax_16P0_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -188,7 +191,7 @@ ThreePlus_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= 3)) { + if((value >= 3LL)) { /* Constraint check succeeded */ return 0; } else { @@ -214,6 +217,8 @@ ThreePlus_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_MinMax_16P0.xer_encoder; td->uper_decoder = asn_DEF_MinMax_16P0.uper_decoder; td->uper_encoder = asn_DEF_MinMax_16P0.uper_encoder; + td->aper_decoder = asn_DEF_MinMax_16P0.aper_decoder; + td->aper_encoder = asn_DEF_MinMax_16P0.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_MinMax_16P0.per_constraints; td->elements = asn_DEF_MinMax_16P0.elements; @@ -281,7 +286,8 @@ asn_TYPE_descriptor_t asn_DEF_ThreePlus = { ThreePlus_encode_der, ThreePlus_decode_xer, ThreePlus_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ThreePlus_tags_1, sizeof(asn_DEF_ThreePlus_tags_1) diff --git a/tests/110-param-3-OK.asn1.-Pfwide-types b/tests/110-param-3-OK.asn1.-Pfwide-types index a47c069ca..dd7df4c49 100644 --- a/tests/110-param-3-OK.asn1.-Pfwide-types +++ b/tests/110-param-3-OK.asn1.-Pfwide-types @@ -64,6 +64,8 @@ field_7_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + td->aper_decoder = asn_DEF_ENUMERATED.aper_decoder; + td->aper_encoder = asn_DEF_ENUMERATED.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; @@ -129,7 +131,7 @@ static int asn_DFL_2_set_5(int set_value, void **sptr) { if(set_value) { /* Install default value 5 */ - return asn_long2INTEGER(st, 5); + return asn_long2INTEGER(st, 5l); } else { /* Test default value 5 */ long value; @@ -174,7 +176,8 @@ asn_TYPE_descriptor_t asn_DEF_Flag_16P0 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Flag_16P0_tags_1, sizeof(asn_DEF_Flag_16P0_tags_1) @@ -199,7 +202,7 @@ static int asn_DFL_7_set_5(int set_value, void **sptr) { if(set_value) { /* Install default value 5 */ - return asn_long2INTEGER(st, 5); + return asn_long2INTEGER(st, 5l); } else { /* Test default value 5 */ long value; @@ -241,7 +244,8 @@ asn_TYPE_descriptor_t asn_DEF_field_7 = { field_7_encode_der, field_7_decode_xer, field_7_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_field_tags_7, sizeof(asn_DEF_field_tags_7) @@ -290,7 +294,8 @@ asn_TYPE_descriptor_t asn_DEF_Flag_16P1 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Flag_16P1_tags_6, sizeof(asn_DEF_Flag_16P1_tags_6) @@ -349,6 +354,8 @@ IntegerColorFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Flag_16P0.xer_encoder; td->uper_decoder = asn_DEF_Flag_16P0.uper_decoder; td->uper_encoder = asn_DEF_Flag_16P0.uper_encoder; + td->aper_decoder = asn_DEF_Flag_16P0.aper_decoder; + td->aper_encoder = asn_DEF_Flag_16P0.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Flag_16P0.per_constraints; td->elements = asn_DEF_Flag_16P0.elements; @@ -416,7 +423,8 @@ asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag = { IntegerColorFlag_encode_der, IntegerColorFlag_decode_xer, IntegerColorFlag_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_IntegerColorFlag_tags_1, sizeof(asn_DEF_IntegerColorFlag_tags_1) @@ -474,6 +482,8 @@ EnumeratedColorFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Flag_16P1.xer_encoder; td->uper_decoder = asn_DEF_Flag_16P1.uper_decoder; td->uper_encoder = asn_DEF_Flag_16P1.uper_encoder; + td->aper_decoder = asn_DEF_Flag_16P1.aper_decoder; + td->aper_encoder = asn_DEF_Flag_16P1.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Flag_16P1.per_constraints; td->elements = asn_DEF_Flag_16P1.elements; @@ -541,7 +551,8 @@ asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag = { EnumeratedColorFlag_encode_der, EnumeratedColorFlag_decode_xer, EnumeratedColorFlag_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_EnumeratedColorFlag_tags_1, sizeof(asn_DEF_EnumeratedColorFlag_tags_1) diff --git a/tests/119-per-strings-OK.asn1.-Pgen-PER b/tests/119-per-strings-OK.asn1.-Pgen-PER index f0d876eca..9dcacaf65 100644 --- a/tests/119-per-strings-OK.asn1.-Pgen-PER +++ b/tests/119-per-strings-OK.asn1.-Pgen-PER @@ -80,7 +80,7 @@ static int check_permitted_alphabet_5(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 90)) return -1; + if(!(cv >= 65LL && cv <= 90LL)) return -1; } return 0; } @@ -93,7 +93,7 @@ static int check_permitted_alphabet_6(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 90)) return -1; + if(!(cv >= 65LL && cv <= 90LL)) return -1; } return 0; } @@ -132,7 +132,7 @@ static int check_permitted_alphabet_9(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 90)) return -1; + if(!(cv >= 65LL && cv <= 90LL)) return -1; } return 0; } @@ -145,7 +145,7 @@ static int check_permitted_alphabet_10(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 90)) return -1; + if(!(cv >= 65LL && cv <= 90LL)) return -1; } return 0; } @@ -184,7 +184,7 @@ static int check_permitted_alphabet_13(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 90)) return -1; + if(!(cv >= 65LL && cv <= 90LL)) return -1; } return 0; } @@ -223,7 +223,7 @@ static int check_permitted_alphabet_16(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 53 && cv <= 57)) return -1; + if(!(cv >= 53LL && cv <= 57LL)) return -1; } return 0; } @@ -236,7 +236,7 @@ static int check_permitted_alphabet_17(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 53 && cv <= 57)) return -1; + if(!(cv >= 53LL && cv <= 57LL)) return -1; } return 0; } @@ -299,7 +299,7 @@ static int check_permitted_alphabet_23(const void *sptr) { for(; ch < end; ch += 2) { uint16_t cv = (ch[0] << 8) | ch[1]; - if(!(cv >= 65 && cv <= 90)) return -1; + if(!(cv >= 65LL && cv <= 90LL)) return -1; } return 0; } @@ -314,7 +314,7 @@ static int check_permitted_alphabet_24(const void *sptr) { for(; ch < end; ch += 2) { uint16_t cv = (ch[0] << 8) | ch[1]; - if(!(cv <= 65533)) return -1; + if(!(cv <= 65533LL)) return -1; } return 0; } @@ -329,7 +329,7 @@ static int check_permitted_alphabet_25(const void *sptr) { for(; ch < end; ch += 2) { uint16_t cv = (ch[0] << 8) | ch[1]; - if(!(cv >= 65 && cv <= 90)) return -1; + if(!(cv >= 65LL && cv <= 90LL)) return -1; } return 0; } @@ -375,7 +375,7 @@ static int check_permitted_alphabet_28(const void *sptr) { | (ch[1] << 16) | (ch[2] << 8) | ch[3]; - if(!(cv >= 65 && cv <= 90)) return -1; + if(!(cv >= 65LL && cv <= 90LL)) return -1; } return 0; } @@ -409,7 +409,7 @@ static int check_permitted_alphabet_30(const void *sptr) { | (ch[1] << 16) | (ch[2] << 8) | ch[3]; - if(!(cv >= 65 && cv <= 90)) return -1; + if(!(cv >= 65LL && cv <= 90LL)) return -1; } return 0; } @@ -773,7 +773,7 @@ memb_ut_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((size == 6)) { + if((size == 6LL)) { /* Constraint check succeeded */ return 0; } else { @@ -805,7 +805,7 @@ memb_ut_ce_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((size == 6)) { + if((size == 6LL)) { /* Constraint check succeeded */ return 0; } else { @@ -879,7 +879,7 @@ memb_bm_cs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size >> 1; /* 2 byte per character */ - if((size == 6) + if((size == 6LL) && !check_permitted_alphabet_24(st)) { /* Constraint check succeeded */ return 0; @@ -988,7 +988,7 @@ memb_us_cs_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size >> 2; /* 4 byte per character */ - if((size == 6) + if((size == 6LL) && !check_permitted_alphabet_29(st)) { /* Constraint check succeeded */ return 0; @@ -1062,61 +1062,61 @@ static int asn_PER_MAP_us_ir_31_c2v(unsigned int code) { /*** <<< CTDEFS [PDU] >>> ***/ static asn_per_constraints_t asn_PER_memb_ia5_c_constr_5 GCC_NOTUSED = { - { APC_CONSTRAINED, 5, 5, 65, 90 } /* (65..90) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 5, 5, 65l, 90l } /* (65..90) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_ia5_ce_constr_6 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_ia5_ir_constr_7 GCC_NOTUSED = { - { APC_CONSTRAINED, 3, 3, 65, 90 } /* (65..90) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 3, 3, 65l, 90l } /* (65..90) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, asn_PER_MAP_ia5_ir_7_v2c, /* Value to PER code map */ asn_PER_MAP_ia5_ir_7_c2v /* PER code to value map */ }; static asn_per_constraints_t asn_PER_memb_vs_c_constr_9 GCC_NOTUSED = { - { APC_CONSTRAINED, 5, 5, 65, 90 } /* (65..90) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 5, 5, 65l, 90l } /* (65..90) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_vs_ce_constr_10 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_vs_ir_constr_11 GCC_NOTUSED = { - { APC_CONSTRAINED, 3, 3, 65, 90 } /* (65..90) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 3, 3, 65l, 90l } /* (65..90) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, asn_PER_MAP_vs_ir_11_v2c, /* Value to PER code map */ asn_PER_MAP_vs_ir_11_c2v /* PER code to value map */ }; static asn_per_constraints_t asn_PER_memb_pr_c_constr_13 GCC_NOTUSED = { - { APC_CONSTRAINED, 5, 5, 65, 90 } /* (65..90) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 5, 5, 65l, 90l } /* (65..90) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_pr_ir_constr_14 GCC_NOTUSED = { - { APC_CONSTRAINED, 3, 3, 65, 90 } /* (65..90) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 3, 3, 65l, 90l } /* (65..90) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, asn_PER_MAP_pr_ir_14_v2c, /* Value to PER code map */ asn_PER_MAP_pr_ir_14_c2v /* PER code to value map */ }; static asn_per_constraints_t asn_PER_memb_ns_c_constr_16 GCC_NOTUSED = { - { APC_CONSTRAINED, 3, 3, 53, 57 } /* (53..57) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 3, 3, 53l, 57l } /* (53..57) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_ns_ce_constr_17 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_ns_ir_constr_18 GCC_NOTUSED = { - { APC_CONSTRAINED, 1, 1, 49, 57 } /* (49..57) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 1, 1, 49l, 57l } /* (49..57) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, asn_PER_MAP_ns_ir_18_v2c, /* Value to PER code map */ asn_PER_MAP_ns_ir_18_c2v /* PER code to value map */ }; @@ -1136,45 +1136,45 @@ static asn_per_constraints_t asn_PER_memb_ut_ir_constr_21 GCC_NOTUSED = { 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_bm_c_constr_23 GCC_NOTUSED = { - { APC_CONSTRAINED, 5, 5, 65, 90 } /* (65..90) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 5, 5, 65l, 90l } /* (65..90) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_bm_cs_constr_24 GCC_NOTUSED = { - { APC_CONSTRAINED, 16, 16, 0, 65533 } /* (0..65533) */, - { APC_CONSTRAINED, 0, 0, 6, 6 } /* (SIZE(6..6)) */, + { APC_CONSTRAINED, 16, 16, 0l, 65533l } /* (0..65533) */, + { APC_CONSTRAINED, 0, 0, 6l, 6l } /* (SIZE(6..6)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_bm_ce_constr_25 GCC_NOTUSED = { - { APC_CONSTRAINED, 16, 16, 0, 65535 } /* (0..65535) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 16, 16, 0l, 65535l } /* (0..65535) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_bm_ir_constr_26 GCC_NOTUSED = { - { APC_CONSTRAINED, 3, 3, 65, 90 } /* (65..90) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 3, 3, 65l, 90l } /* (65..90) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, asn_PER_MAP_bm_ir_26_v2c, /* Value to PER code map */ asn_PER_MAP_bm_ir_26_c2v /* PER code to value map */ }; static asn_per_constraints_t asn_PER_memb_us_c_constr_28 GCC_NOTUSED = { - { APC_CONSTRAINED, 5, 5, 65, 90 } /* (65..90) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 5, 5, 65l, 90l } /* (65..90) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_us_cs_constr_29 GCC_NOTUSED = { - { APC_CONSTRAINED, 32, 32, 0, 2147483647 } /* (0..4294967295) */, - { APC_CONSTRAINED, 0, 0, 6, 6 } /* (SIZE(6..6)) */, + { APC_CONSTRAINED, 32, 32, 0l, 2147483647l } /* (0..4294967295) */, + { APC_CONSTRAINED, 0, 0, 6l, 6l } /* (SIZE(6..6)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_us_ce_constr_30 GCC_NOTUSED = { - { APC_CONSTRAINED, 32, 32, 0, 2147483647 } /* special case 1 */ + { APC_CONSTRAINED, 32, 32, 0, 2147483647L } /* special case 1 */ , - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; static asn_per_constraints_t asn_PER_memb_us_ir_constr_31 GCC_NOTUSED = { - { APC_CONSTRAINED, 3, 3, 65, 90 } /* (65..90) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 3, 3, 65l, 90l } /* (65..90) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, asn_PER_MAP_us_ir_31_v2c, /* Value to PER code map */ asn_PER_MAP_us_ir_31_c2v /* PER code to value map */ }; @@ -1214,6 +1214,8 @@ asn_TYPE_descriptor_t asn_DEF_many_2 = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, + SEQUENCE_OF_decode_aper, + SEQUENCE_OF_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_many_tags_2, sizeof(asn_DEF_many_tags_2) @@ -1567,6 +1569,8 @@ asn_TYPE_descriptor_t asn_DEF_PDU = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_PDU_tags_1, sizeof(asn_DEF_PDU_tags_1) diff --git a/tests/125-bitstring-constraint-OK.asn1.-P b/tests/125-bitstring-constraint-OK.asn1.-P index 6b5c7621e..be32e0eb2 100644 --- a/tests/125-bitstring-constraint-OK.asn1.-P +++ b/tests/125-bitstring-constraint-OK.asn1.-P @@ -65,6 +65,8 @@ T_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_BIT_STRING.xer_encoder; td->uper_decoder = asn_DEF_BIT_STRING.uper_decoder; td->uper_encoder = asn_DEF_BIT_STRING.uper_encoder; + td->aper_decoder = asn_DEF_BIT_STRING.aper_decoder; + td->aper_encoder = asn_DEF_BIT_STRING.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_BIT_STRING.per_constraints; td->elements = asn_DEF_BIT_STRING.elements; @@ -132,7 +134,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { T_encode_der, T_decode_xer, T_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) diff --git a/tests/125-bitstring-constraint-OK.asn1.-X b/tests/125-bitstring-constraint-OK.asn1.-X index b33feccd6..2734e5c30 100644 --- a/tests/125-bitstring-constraint-OK.asn1.-X +++ b/tests/125-bitstring-constraint-OK.asn1.-X @@ -3,6 +3,6 @@ +found in ... diff --git a/tests/126-per-extensions-OK.asn1.-Pgen-PER b/tests/126-per-extensions-OK.asn1.-Pgen-PER index 0f53a295d..399b87559 100644 --- a/tests/126-per-extensions-OK.asn1.-Pgen-PER +++ b/tests/126-per-extensions-OK.asn1.-Pgen-PER @@ -106,6 +106,8 @@ asn_TYPE_descriptor_t asn_DEF_PDU = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_PDU_tags_1, sizeof(asn_DEF_PDU_tags_1) @@ -206,6 +208,8 @@ asn_TYPE_descriptor_t asn_DEF_Singleton = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Singleton_tags_1, sizeof(asn_DEF_Singleton_tags_1) @@ -260,7 +264,7 @@ extern asn_TYPE_descriptor_t asn_DEF_PDU_2; /*** <<< CTDEFS [PDU-2] >>> ***/ static asn_per_constraints_t asn_PER_type_PDU_2_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0, 0 } /* (0..0,...) */, + { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 0l, 0l } /* (0..0,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -324,6 +328,8 @@ asn_TYPE_descriptor_t asn_DEF_PDU_2 = { CHOICE_encode_xer, CHOICE_decode_uper, CHOICE_encode_uper, + CHOICE_decode_aper, + CHOICE_encode_aper, CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ diff --git a/tests/127-per-long-OK.asn1.-Pgen-PER b/tests/127-per-long-OK.asn1.-Pgen-PER index 86e350266..9ecad4791 100644 --- a/tests/127-per-long-OK.asn1.-Pgen-PER +++ b/tests/127-per-long-OK.asn1.-Pgen-PER @@ -55,6 +55,8 @@ unsigned32_4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -121,10 +123,25 @@ unsigned32_4_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +static asn_enc_rval_t +unsigned32_4_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + unsigned32_4_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +static asn_dec_rval_t +unsigned32_4_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + unsigned32_4_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + static int unsplit32_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - unsigned long value; + unsigned long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -133,9 +150,9 @@ unsplit32_5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const unsigned long *)sptr; + value = *(const unsigned long long *)sptr; - if(((value >= 5 && value <= 500) || (value >= 600 && value <= 4294967290))) { + if(((value >= 5LL && value <= 500LL) || (value >= 600LL && value <= 4294967290LL))) { /* Constraint check succeeded */ return 0; } else { @@ -161,6 +178,8 @@ unsplit32_5_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -227,10 +246,25 @@ unsplit32_5_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +static asn_enc_rval_t +unsplit32_5_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + unsplit32_5_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +static asn_dec_rval_t +unsplit32_5_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + unsplit32_5_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + static int memb_small32range_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -239,9 +273,9 @@ memb_small32range_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= -2000000000 && value <= 2000000000)) { + if((value >= -2000000000LL && value <= 2000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -255,7 +289,7 @@ memb_small32range_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_full32range_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -264,9 +298,9 @@ memb_full32range_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= (-2147483647L - 1) && value <= 2147483647)) { + if((value >= -2147483648LL && value <= 2147483647LL)) { /* Constraint check succeeded */ return 0; } else { @@ -296,7 +330,7 @@ memb_unsigned32_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_unsplit32_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - unsigned long value; + unsigned long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -305,9 +339,9 @@ memb_unsplit32_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const unsigned long *)sptr; + value = *(const unsigned long long *)sptr; - if(((value >= 5 && value <= 500) || (value >= 600 && value <= 4294967290))) { + if(((value >= 5LL && value <= 500LL) || (value >= 600LL && value <= 4294967290LL))) { /* Constraint check succeeded */ return 0; } else { @@ -322,32 +356,32 @@ memb_unsplit32_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, /*** <<< CTDEFS [T] >>> ***/ static asn_per_constraints_t asn_PER_type_unsigned32_constr_4 GCC_NOTUSED = { - { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, + { APC_CONSTRAINED, 32, -1, 0l, 4294967295ul } /* (0..4294967295) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_type_unsplit32_constr_5 GCC_NOTUSED = { - { APC_CONSTRAINED, 32, -1, 5, 4294967290 } /* (5..4294967290) */, + { APC_CONSTRAINED, 32, -1, 5l, 4294967290ul } /* (5..4294967290) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_small32range_constr_2 GCC_NOTUSED = { - { APC_CONSTRAINED, 32, -1, -2000000000, 2000000000 } /* (-2000000000..2000000000) */, + { APC_CONSTRAINED, 32, -1, -2000000000l, 2000000000l } /* (-2000000000..2000000000) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_full32range_constr_3 GCC_NOTUSED = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647l } /* (-2147483648..2147483647) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_unsigned32_constr_4 GCC_NOTUSED = { - { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, + { APC_CONSTRAINED, 32, -1, 0l, 4294967295ul } /* (0..4294967295) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_unsplit32_constr_5 GCC_NOTUSED = { - { APC_CONSTRAINED, 32, -1, 5, 4294967290 } /* (5..4294967290) */, + { APC_CONSTRAINED, 32, -1, 5l, 4294967290ul } /* (5..4294967290) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -376,6 +410,8 @@ asn_TYPE_descriptor_t asn_DEF_unsigned32_4 = { unsigned32_4_encode_xer, unsigned32_4_decode_uper, unsigned32_4_encode_uper, + unsigned32_4_decode_aper, + unsigned32_4_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_unsigned32_tags_4, sizeof(asn_DEF_unsigned32_tags_4) @@ -410,6 +446,8 @@ asn_TYPE_descriptor_t asn_DEF_unsplit32_5 = { unsplit32_5_encode_xer, unsplit32_5_decode_uper, unsplit32_5_encode_uper, + unsplit32_5_decode_aper, + unsplit32_5_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_unsplit32_tags_5, sizeof(asn_DEF_unsplit32_tags_5) @@ -490,6 +528,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) diff --git a/tests/131-per-empty-OK.asn1.-Pgen-PER b/tests/131-per-empty-OK.asn1.-Pgen-PER index aa6587eaf..8e706f0ad 100644 --- a/tests/131-per-empty-OK.asn1.-Pgen-PER +++ b/tests/131-per-empty-OK.asn1.-Pgen-PER @@ -41,6 +41,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) diff --git a/tests/134-per-long-OK.asn1.-Pgen-PER b/tests/134-per-long-OK.asn1.-Pgen-PER index da96a0674..4eed86b09 100644 --- a/tests/134-per-long-OK.asn1.-Pgen-PER +++ b/tests/134-per-long-OK.asn1.-Pgen-PER @@ -26,7 +26,7 @@ static int memb_unsigned33_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -42,7 +42,7 @@ memb_unsigned33_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= 0 && value <= 5000000000)) { + if((value >= 0LL && value <= 5000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -57,7 +57,7 @@ static int memb_unsigned42_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -73,7 +73,7 @@ memb_unsigned42_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= 0 && value <= 3153600000000)) { + if((value >= 0LL && value <= 3153600000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -88,7 +88,7 @@ static int memb_signed33_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -104,7 +104,7 @@ memb_signed33_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= -4000000000 && value <= 4000000000)) { + if((value >= -4000000000LL && value <= 4000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -119,7 +119,7 @@ static int memb_signed33ext_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -135,7 +135,7 @@ memb_signed33ext_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= -4000000000 && value <= 4000000000)) { + if((value >= -4000000000LL && value <= 4000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -150,22 +150,22 @@ memb_signed33ext_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, /*** <<< CTDEFS [T] >>> ***/ static asn_per_constraints_t asn_PER_memb_unsigned33_constr_2 GCC_NOTUSED = { - { APC_CONSTRAINED, 33, -1, 0, 5000000000 } /* (0..5000000000) */, + { APC_CONSTRAINED, 33, -1, 0l, 5000000000ull } /* (0..5000000000) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_unsigned42_constr_3 GCC_NOTUSED = { - { APC_CONSTRAINED, 42, -1, 0, 3153600000000 } /* (0..3153600000000) */, + { APC_CONSTRAINED, 42, -1, 0l, 3153600000000ull } /* (0..3153600000000) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_signed33_constr_4 GCC_NOTUSED = { - { APC_CONSTRAINED, 33, -1, -4000000000, 4000000000 } /* (-4000000000..4000000000) */, + { APC_CONSTRAINED, 33, -1, -4000000000l, 4000000000ul } /* (-4000000000..4000000000) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_signed33ext_constr_5 GCC_NOTUSED = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 33, -1, -4000000000, 4000000000 } /* (-4000000000..4000000000,...) */, + { APC_CONSTRAINED | APC_EXTENSIBLE, 33, -1, -4000000000l, 4000000000ul } /* (-4000000000..4000000000,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -240,6 +240,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) diff --git a/tests/19-param-OK.asn1.-Pfwide-types b/tests/19-param-OK.asn1.-Pfwide-types index 822c9933e..3937b11ca 100644 --- a/tests/19-param-OK.asn1.-Pfwide-types +++ b/tests/19-param-OK.asn1.-Pfwide-types @@ -51,7 +51,7 @@ memb_signature_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, size = 0; } - if((size <= 256)) { + if((size <= 256LL)) { /* Constraint check succeeded */ return 0; } else { @@ -122,7 +122,8 @@ asn_TYPE_descriptor_t asn_DEF_toBeSigned_2 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_toBeSigned_tags_2, sizeof(asn_DEF_toBeSigned_tags_2) @@ -192,7 +193,8 @@ asn_TYPE_descriptor_t asn_DEF_SIGNED_15P0 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SIGNED_15P0_tags_1, sizeof(asn_DEF_SIGNED_15P0_tags_1) @@ -251,6 +253,8 @@ Certificate_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_SIGNED_15P0.xer_encoder; td->uper_decoder = asn_DEF_SIGNED_15P0.uper_decoder; td->uper_encoder = asn_DEF_SIGNED_15P0.uper_encoder; + td->aper_decoder = asn_DEF_SIGNED_15P0.aper_decoder; + td->aper_encoder = asn_DEF_SIGNED_15P0.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_SIGNED_15P0.per_constraints; td->elements = asn_DEF_SIGNED_15P0.elements; @@ -318,7 +322,8 @@ asn_TYPE_descriptor_t asn_DEF_Certificate = { Certificate_encode_der, Certificate_decode_xer, Certificate_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Certificate_tags_1, sizeof(asn_DEF_Certificate_tags_1) @@ -389,7 +394,8 @@ asn_TYPE_descriptor_t asn_DEF_Name = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Name_tags_1, sizeof(asn_DEF_Name_tags_1) @@ -509,7 +515,8 @@ asn_TYPE_descriptor_t asn_DEF_RelativeDistinguishedName = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_RelativeDistinguishedName_tags_1, sizeof(asn_DEF_RelativeDistinguishedName_tags_1) diff --git a/tests/22-tags-OK.asn1.-Pfwide-types b/tests/22-tags-OK.asn1.-Pfwide-types index 50c0e017d..dcd881d3f 100644 --- a/tests/22-tags-OK.asn1.-Pfwide-types +++ b/tests/22-tags-OK.asn1.-Pfwide-types @@ -86,7 +86,8 @@ asn_TYPE_descriptor_t asn_DEF_b_3 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -154,7 +155,8 @@ asn_TYPE_descriptor_t asn_DEF_T1 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T1_tags_1, sizeof(asn_DEF_T1_tags_1) diff --git a/tests/30-set-OK.asn1.-Pfwide-types b/tests/30-set-OK.asn1.-Pfwide-types index e3de21dda..1ee3aeb28 100644 --- a/tests/30-set-OK.asn1.-Pfwide-types +++ b/tests/30-set-OK.asn1.-Pfwide-types @@ -104,7 +104,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) diff --git a/tests/31-set-of-OK.asn1.-Pfwide-types b/tests/31-set-of-OK.asn1.-Pfwide-types index 59bc7f9b5..0e02f823e 100644 --- a/tests/31-set-of-OK.asn1.-Pfwide-types +++ b/tests/31-set-of-OK.asn1.-Pfwide-types @@ -56,7 +56,8 @@ asn_TYPE_descriptor_t asn_DEF_Forest = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Forest_tags_1, sizeof(asn_DEF_Forest_tags_1) @@ -138,7 +139,8 @@ asn_TYPE_descriptor_t asn_DEF_Tree = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Tree_tags_1, sizeof(asn_DEF_Tree_tags_1) @@ -272,7 +274,8 @@ asn_TYPE_descriptor_t asn_DEF_trees_2 = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_trees_tags_2, sizeof(asn_DEF_trees_tags_2) @@ -323,7 +326,8 @@ asn_TYPE_descriptor_t asn_DEF_Member_5 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Member_tags_5, sizeof(asn_DEF_Member_tags_5) @@ -368,7 +372,8 @@ asn_TYPE_descriptor_t asn_DEF_anything_4 = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_anything_tags_4, sizeof(asn_DEF_anything_tags_4) @@ -427,7 +432,8 @@ asn_TYPE_descriptor_t asn_DEF_other_9 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -506,7 +512,8 @@ asn_TYPE_descriptor_t asn_DEF_Stuff = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Stuff_tags_1, sizeof(asn_DEF_Stuff_tags_1) diff --git a/tests/32-sequence-of-OK.asn1.-P b/tests/32-sequence-of-OK.asn1.-P index a6c310671..86e6e3c3d 100644 --- a/tests/32-sequence-of-OK.asn1.-P +++ b/tests/32-sequence-of-OK.asn1.-P @@ -56,7 +56,8 @@ asn_TYPE_descriptor_t asn_DEF_Programming = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Programming_tags_1, sizeof(asn_DEF_Programming_tags_1) @@ -128,7 +129,8 @@ asn_TYPE_descriptor_t asn_DEF_Fault = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Fault_tags_1, sizeof(asn_DEF_Fault_tags_1) @@ -187,7 +189,8 @@ asn_TYPE_descriptor_t asn_DEF_Error = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Error_tags_1, sizeof(asn_DEF_Error_tags_1) @@ -268,7 +271,8 @@ asn_TYPE_descriptor_t asn_DEF_seqOfMan_3 = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_seqOfMan_tags_3, sizeof(asn_DEF_seqOfMan_tags_3) @@ -328,7 +332,8 @@ asn_TYPE_descriptor_t asn_DEF_SeqWithMandatory = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqWithMandatory_tags_1, sizeof(asn_DEF_SeqWithMandatory_tags_1) @@ -410,7 +415,8 @@ asn_TYPE_descriptor_t asn_DEF_seqOfOpt_3 = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_seqOfOpt_tags_3, sizeof(asn_DEF_seqOfOpt_tags_3) @@ -470,7 +476,8 @@ asn_TYPE_descriptor_t asn_DEF_SeqWithOptional = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqWithOptional_tags_1, sizeof(asn_DEF_SeqWithOptional_tags_1) diff --git a/tests/37-indirect-choice-OK.asn1.-Pfwide-types b/tests/37-indirect-choice-OK.asn1.-Pfwide-types index 88b7ca661..db445d11a 100644 --- a/tests/37-indirect-choice-OK.asn1.-Pfwide-types +++ b/tests/37-indirect-choice-OK.asn1.-Pfwide-types @@ -102,7 +102,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -192,7 +193,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice1 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -310,7 +312,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice2 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, asn_DEF_Choice2_tags_1, sizeof(asn_DEF_Choice2_tags_1) @@ -369,6 +372,8 @@ Choice3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Choice2.xer_encoder; td->uper_decoder = asn_DEF_Choice2.uper_decoder; td->uper_encoder = asn_DEF_Choice2.uper_encoder; + td->aper_decoder = asn_DEF_Choice2.aper_decoder; + td->aper_encoder = asn_DEF_Choice2.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Choice2.per_constraints; td->elements = asn_DEF_Choice2.elements; @@ -437,7 +442,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice3 = { Choice3_encode_der, Choice3_decode_xer, Choice3_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, asn_DEF_Choice3_tags_1, sizeof(asn_DEF_Choice3_tags_1) @@ -495,6 +501,8 @@ Choice4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Choice2.xer_encoder; td->uper_decoder = asn_DEF_Choice2.uper_decoder; td->uper_encoder = asn_DEF_Choice2.uper_encoder; + td->aper_decoder = asn_DEF_Choice2.aper_decoder; + td->aper_encoder = asn_DEF_Choice2.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Choice2.per_constraints; td->elements = asn_DEF_Choice2.elements; @@ -563,7 +571,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice4 = { Choice4_encode_der, Choice4_decode_xer, Choice4_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, asn_DEF_Choice4_tags_1, sizeof(asn_DEF_Choice4_tags_1) @@ -621,6 +630,8 @@ Choice5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Choice2.xer_encoder; td->uper_decoder = asn_DEF_Choice2.uper_decoder; td->uper_encoder = asn_DEF_Choice2.uper_encoder; + td->aper_decoder = asn_DEF_Choice2.aper_decoder; + td->aper_encoder = asn_DEF_Choice2.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Choice2.per_constraints; td->elements = asn_DEF_Choice2.elements; @@ -688,7 +699,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice5 = { Choice5_encode_der, Choice5_decode_xer, Choice5_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, asn_DEF_Choice5_tags_1, sizeof(asn_DEF_Choice5_tags_1) @@ -746,6 +758,8 @@ Choice6_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Choice1.xer_encoder; td->uper_decoder = asn_DEF_Choice1.uper_decoder; td->uper_encoder = asn_DEF_Choice1.uper_encoder; + td->aper_decoder = asn_DEF_Choice1.aper_decoder; + td->aper_encoder = asn_DEF_Choice1.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Choice1.per_constraints; td->elements = asn_DEF_Choice1.elements; @@ -810,7 +824,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice6 = { Choice6_encode_der, Choice6_decode_xer, Choice6_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ diff --git a/tests/39-sequence-of-OK.asn1.-Pfwide-types b/tests/39-sequence-of-OK.asn1.-Pfwide-types index 1a47de9cd..7a645e782 100644 --- a/tests/39-sequence-of-OK.asn1.-Pfwide-types +++ b/tests/39-sequence-of-OK.asn1.-Pfwide-types @@ -65,7 +65,8 @@ asn_TYPE_descriptor_t asn_DEF_collection_3 = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_collection_tags_3, sizeof(asn_DEF_collection_tags_3) @@ -125,7 +126,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) @@ -208,7 +210,8 @@ asn_TYPE_descriptor_t asn_DEF_T2 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T2_tags_1, sizeof(asn_DEF_T2_tags_1) diff --git a/tests/42-real-life-OK.asn1.-PR b/tests/42-real-life-OK.asn1.-PR index d223133a1..7e2463c63 100644 --- a/tests/42-real-life-OK.asn1.-PR +++ b/tests/42-real-life-OK.asn1.-PR @@ -54,7 +54,7 @@ memb_varsets_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, /* Determine the number of elements */ size = _A_CSEQUENCE_FROM_VOID(sptr)->count; - if((size >= 1)) { + if((size >= 1LL)) { /* Perform validation of the inner elements */ return td->check_constraints(td, sptr, ctfailcb, app_key); } else { @@ -98,7 +98,8 @@ asn_TYPE_descriptor_t asn_DEF_varsets_3 = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_varsets_tags_3, sizeof(asn_DEF_varsets_tags_3) @@ -158,7 +159,8 @@ asn_TYPE_descriptor_t asn_DEF_LogLine = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_LogLine_tags_1, sizeof(asn_DEF_LogLine_tags_1) @@ -265,7 +267,8 @@ asn_TYPE_descriptor_t asn_DEF_vparts_2 = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_vparts_tags_2, sizeof(asn_DEF_vparts_tags_2) @@ -325,7 +328,8 @@ asn_TYPE_descriptor_t asn_DEF_VariablePartSet = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_VariablePartSet_tags_1, sizeof(asn_DEF_VariablePartSet_tags_1) @@ -411,7 +415,7 @@ memb_vset_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, /* Determine the number of elements */ size = _A_CSET_FROM_VOID(sptr)->count; - if((size >= 1)) { + if((size >= 1LL)) { /* Perform validation of the inner elements */ return td->check_constraints(td, sptr, ctfailcb, app_key); } else { @@ -455,7 +459,8 @@ asn_TYPE_descriptor_t asn_DEF_vset_2 = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_vset_tags_2, sizeof(asn_DEF_vset_tags_2) @@ -516,7 +521,8 @@ asn_TYPE_descriptor_t asn_DEF_vrange_4 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_vrange_tags_4, sizeof(asn_DEF_vrange_tags_4) @@ -574,7 +580,8 @@ asn_TYPE_descriptor_t asn_DEF_VariablePart = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -666,6 +673,8 @@ accept_as_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + td->aper_decoder = asn_DEF_NativeEnumerated.aper_decoder; + td->aper_encoder = asn_DEF_NativeEnumerated.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; td->elements = asn_DEF_NativeEnumerated.elements; @@ -755,7 +764,8 @@ asn_TYPE_descriptor_t asn_DEF_accept_as_2 = { accept_as_2_encode_der, accept_as_2_decode_xer, accept_as_2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_accept_as_tags_2, sizeof(asn_DEF_accept_as_tags_2) @@ -798,7 +808,8 @@ asn_TYPE_descriptor_t asn_DEF_email_9 = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_email_tags_9, sizeof(asn_DEF_email_tags_9) @@ -859,7 +870,8 @@ asn_TYPE_descriptor_t asn_DEF_notify_7 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_notify_tags_7, sizeof(asn_DEF_notify_tags_7) @@ -919,7 +931,8 @@ asn_TYPE_descriptor_t asn_DEF_ActionItem = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ActionItem_tags_1, sizeof(asn_DEF_ActionItem_tags_1) diff --git a/tests/43-recursion-OK.asn1.-Pfwide-types b/tests/43-recursion-OK.asn1.-Pfwide-types index 6ea4bb9d9..4376e0f58 100644 --- a/tests/43-recursion-OK.asn1.-Pfwide-types +++ b/tests/43-recursion-OK.asn1.-Pfwide-types @@ -74,7 +74,8 @@ asn_TYPE_descriptor_t asn_DEF_t_member1_2 = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_t_member1_tags_2, sizeof(asn_DEF_t_member1_tags_2) @@ -118,7 +119,8 @@ asn_TYPE_descriptor_t asn_DEF_t_member2_4 = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_t_member2_tags_4, sizeof(asn_DEF_t_member2_tags_4) @@ -198,7 +200,8 @@ asn_TYPE_descriptor_t asn_DEF_Test_structure_1 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Test_structure_1_tags_1, sizeof(asn_DEF_Test_structure_1_tags_1) @@ -295,7 +298,8 @@ asn_TYPE_descriptor_t asn_DEF_or_3 = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_or_tags_3, sizeof(asn_DEF_or_tags_3) @@ -373,7 +377,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice_1 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -468,7 +473,8 @@ asn_TYPE_descriptor_t asn_DEF_Test_structure_2 = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Test_structure_2_tags_1, sizeof(asn_DEF_Test_structure_2_tags_1) @@ -565,7 +571,8 @@ asn_TYPE_descriptor_t asn_DEF_Test_structure_3 = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Test_structure_3_tags_1, sizeof(asn_DEF_Test_structure_3_tags_1) diff --git a/tests/44-choice-in-sequence-OK.asn1.-P b/tests/44-choice-in-sequence-OK.asn1.-P index 1c5e4c224..c1a83dacf 100644 --- a/tests/44-choice-in-sequence-OK.asn1.-P +++ b/tests/44-choice-in-sequence-OK.asn1.-P @@ -115,7 +115,8 @@ asn_TYPE_descriptor_t asn_DEF_e_6 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -172,7 +173,8 @@ asn_TYPE_descriptor_t asn_DEF_h_9 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -250,7 +252,8 @@ asn_TYPE_descriptor_t asn_DEF_b_3 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -313,7 +316,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) diff --git a/tests/46-redefine-OK.asn1.-PR b/tests/46-redefine-OK.asn1.-PR index 23475b405..350654e3b 100644 --- a/tests/46-redefine-OK.asn1.-PR +++ b/tests/46-redefine-OK.asn1.-PR @@ -43,6 +43,8 @@ PrimitiveType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_OCTET_STRING.xer_encoder; td->uper_decoder = asn_DEF_OCTET_STRING.uper_decoder; td->uper_encoder = asn_DEF_OCTET_STRING.uper_encoder; + td->aper_decoder = asn_DEF_OCTET_STRING.aper_decoder; + td->aper_encoder = asn_DEF_OCTET_STRING.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_OCTET_STRING.per_constraints; td->elements = asn_DEF_OCTET_STRING.elements; @@ -110,7 +112,8 @@ asn_TYPE_descriptor_t asn_DEF_PrimitiveType = { PrimitiveType_encode_der, PrimitiveType_decode_xer, PrimitiveType_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_PrimitiveType_tags_1, sizeof(asn_DEF_PrimitiveType_tags_1) @@ -180,7 +183,8 @@ asn_TYPE_descriptor_t asn_DEF_ConstructedType = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ConstructedType_tags_1, sizeof(asn_DEF_ConstructedType_tags_1) @@ -239,6 +243,8 @@ T_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ConstructedType.xer_encoder; td->uper_decoder = asn_DEF_ConstructedType.uper_decoder; td->uper_encoder = asn_DEF_ConstructedType.uper_encoder; + td->aper_decoder = asn_DEF_ConstructedType.aper_decoder; + td->aper_encoder = asn_DEF_ConstructedType.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ConstructedType.per_constraints; td->elements = asn_DEF_ConstructedType.elements; @@ -307,7 +313,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { T_encode_der, T_decode_xer, T_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) diff --git a/tests/47-set-ext-OK.asn1.-Pfwide-types b/tests/47-set-ext-OK.asn1.-Pfwide-types index c2c9dfb76..01477b07c 100644 --- a/tests/47-set-ext-OK.asn1.-Pfwide-types +++ b/tests/47-set-ext-OK.asn1.-Pfwide-types @@ -78,7 +78,8 @@ asn_TYPE_descriptor_t asn_DEF_T1 = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T1_tags_1, sizeof(asn_DEF_T1_tags_1) @@ -172,7 +173,8 @@ asn_TYPE_descriptor_t asn_DEF_T2 = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T2_tags_1, sizeof(asn_DEF_T2_tags_1) @@ -257,7 +259,8 @@ asn_TYPE_descriptor_t asn_DEF_T3 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -340,7 +343,8 @@ asn_TYPE_descriptor_t asn_DEF_T4 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ diff --git a/tests/50-constraint-OK.asn1.-Pfwide-types b/tests/50-constraint-OK.asn1.-Pfwide-types index 15c709a78..bc2b50c20 100644 --- a/tests/50-constraint-OK.asn1.-Pfwide-types +++ b/tests/50-constraint-OK.asn1.-Pfwide-types @@ -43,6 +43,8 @@ Int1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -110,7 +112,8 @@ asn_TYPE_descriptor_t asn_DEF_Int1 = { Int1_encode_der, Int1_decode_xer, Int1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Int1_tags_1, sizeof(asn_DEF_Int1_tags_1) @@ -149,7 +152,7 @@ int Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int1_t *st = (const Int1_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -161,7 +164,7 @@ Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, /* Check if the sign bit is present */ value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0; - if((value >= 0)) { + if((value >= 0LL)) { /* Constraint check succeeded */ return 0; } else { @@ -187,6 +190,8 @@ Int2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Int1.xer_encoder; td->uper_decoder = asn_DEF_Int1.uper_decoder; td->uper_encoder = asn_DEF_Int1.uper_encoder; + td->aper_decoder = asn_DEF_Int1.aper_decoder; + td->aper_encoder = asn_DEF_Int1.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int1.per_constraints; td->elements = asn_DEF_Int1.elements; @@ -254,7 +259,8 @@ asn_TYPE_descriptor_t asn_DEF_Int2 = { Int2_encode_der, Int2_decode_xer, Int2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Int2_tags_1, sizeof(asn_DEF_Int2_tags_1) @@ -293,7 +299,7 @@ int Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int2_t *st = (const Int2_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -309,7 +315,7 @@ Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= 0 && value <= 10)) { + if((value >= 0LL && value <= 10LL)) { /* Constraint check succeeded */ return 0; } else { @@ -335,6 +341,8 @@ Int3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Int2.xer_encoder; td->uper_decoder = asn_DEF_Int2.uper_decoder; td->uper_encoder = asn_DEF_Int2.uper_encoder; + td->aper_decoder = asn_DEF_Int2.aper_decoder; + td->aper_encoder = asn_DEF_Int2.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int2.per_constraints; td->elements = asn_DEF_Int2.elements; @@ -402,7 +410,8 @@ asn_TYPE_descriptor_t asn_DEF_Int3 = { Int3_encode_der, Int3_decode_xer, Int3_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Int3_tags_1, sizeof(asn_DEF_Int3_tags_1) @@ -441,7 +450,7 @@ int Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int3_t *st = (const Int3_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -457,7 +466,7 @@ Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= 1 && value <= 10)) { + if((value >= 1LL && value <= 10LL)) { /* Constraint check succeeded */ return 0; } else { @@ -483,6 +492,8 @@ Int4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Int3.xer_encoder; td->uper_decoder = asn_DEF_Int3.uper_decoder; td->uper_encoder = asn_DEF_Int3.uper_encoder; + td->aper_decoder = asn_DEF_Int3.aper_decoder; + td->aper_encoder = asn_DEF_Int3.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int3.per_constraints; td->elements = asn_DEF_Int3.elements; @@ -550,7 +561,8 @@ asn_TYPE_descriptor_t asn_DEF_Int4 = { Int4_encode_der, Int4_decode_xer, Int4_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Int4_tags_1, sizeof(asn_DEF_Int4_tags_1) @@ -589,7 +601,7 @@ int Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int4_t *st = (const Int4_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -605,7 +617,7 @@ Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value == 5)) { + if((value == 5LL)) { /* Constraint check succeeded */ return 0; } else { @@ -631,6 +643,8 @@ Int5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Int4.xer_encoder; td->uper_decoder = asn_DEF_Int4.uper_decoder; td->uper_encoder = asn_DEF_Int4.uper_encoder; + td->aper_decoder = asn_DEF_Int4.aper_decoder; + td->aper_encoder = asn_DEF_Int4.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int4.per_constraints; td->elements = asn_DEF_Int4.elements; @@ -698,7 +712,8 @@ asn_TYPE_descriptor_t asn_DEF_Int5 = { Int5_encode_der, Int5_decode_xer, Int5_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Int5_tags_1, sizeof(asn_DEF_Int5_tags_1) @@ -737,7 +752,7 @@ int ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -753,7 +768,7 @@ ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= 1 && value <= 256)) { + if((value >= 1LL && value <= 256LL)) { /* Constraint check succeeded */ return 0; } else { @@ -779,6 +794,8 @@ ExtensibleExtensions_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -846,7 +863,8 @@ asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = { ExtensibleExtensions_encode_der, ExtensibleExtensions_decode_xer, ExtensibleExtensions_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ExtensibleExtensions_tags_1, sizeof(asn_DEF_ExtensibleExtensions_tags_1) @@ -904,6 +922,8 @@ Str1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_IA5String.xer_encoder; td->uper_decoder = asn_DEF_IA5String.uper_decoder; td->uper_encoder = asn_DEF_IA5String.uper_encoder; + td->aper_decoder = asn_DEF_IA5String.aper_decoder; + td->aper_encoder = asn_DEF_IA5String.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_IA5String.per_constraints; td->elements = asn_DEF_IA5String.elements; @@ -971,7 +991,8 @@ asn_TYPE_descriptor_t asn_DEF_Str1 = { Str1_encode_der, Str1_decode_xer, Str1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Str1_tags_1, sizeof(asn_DEF_Str1_tags_1) @@ -1014,7 +1035,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv <= 127)) return -1; + if(!(cv <= 127LL)) return -1; } return 0; } @@ -1037,7 +1058,7 @@ Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size; - if(((size <= 20) || (size >= 25 && size <= 30)) + if(((size <= 20LL) || (size >= 25LL && size <= 30LL)) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -1064,6 +1085,8 @@ Str2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Str1.xer_encoder; td->uper_decoder = asn_DEF_Str1.uper_decoder; td->uper_encoder = asn_DEF_Str1.uper_encoder; + td->aper_decoder = asn_DEF_Str1.aper_decoder; + td->aper_encoder = asn_DEF_Str1.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Str1.per_constraints; td->elements = asn_DEF_Str1.elements; @@ -1131,7 +1154,8 @@ asn_TYPE_descriptor_t asn_DEF_Str2 = { Str2_encode_der, Str2_decode_xer, Str2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Str2_tags_1, sizeof(asn_DEF_Str2_tags_1) @@ -1208,7 +1232,7 @@ Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size; - if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27)) + if(((size >= 10LL && size <= 20LL) || (size >= 25LL && size <= 27LL)) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -1235,6 +1259,8 @@ Str3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Str2.xer_encoder; td->uper_decoder = asn_DEF_Str2.uper_decoder; td->uper_encoder = asn_DEF_Str2.uper_encoder; + td->aper_decoder = asn_DEF_Str2.aper_decoder; + td->aper_encoder = asn_DEF_Str2.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Str2.per_constraints; td->elements = asn_DEF_Str2.elements; @@ -1302,7 +1328,8 @@ asn_TYPE_descriptor_t asn_DEF_Str3 = { Str3_encode_der, Str3_decode_xer, Str3_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Str3_tags_1, sizeof(asn_DEF_Str3_tags_1) @@ -1345,7 +1372,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv <= 127)) return -1; + if(!(cv <= 127LL)) return -1; } return 0; } @@ -1392,6 +1419,8 @@ Str4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_IA5String.xer_encoder; td->uper_decoder = asn_DEF_IA5String.uper_decoder; td->uper_encoder = asn_DEF_IA5String.uper_encoder; + td->aper_decoder = asn_DEF_IA5String.aper_decoder; + td->aper_encoder = asn_DEF_IA5String.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_IA5String.per_constraints; td->elements = asn_DEF_IA5String.elements; @@ -1459,7 +1488,8 @@ asn_TYPE_descriptor_t asn_DEF_Str4 = { Str4_encode_der, Str4_decode_xer, Str4_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Str4_tags_1, sizeof(asn_DEF_Str4_tags_1) @@ -1502,7 +1532,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 70)) return -1; + if(!(cv >= 65LL && cv <= 70LL)) return -1; } return 0; } @@ -1549,6 +1579,8 @@ PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_IA5String.xer_encoder; td->uper_decoder = asn_DEF_IA5String.uper_decoder; td->uper_encoder = asn_DEF_IA5String.uper_encoder; + td->aper_decoder = asn_DEF_IA5String.aper_decoder; + td->aper_encoder = asn_DEF_IA5String.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_IA5String.per_constraints; td->elements = asn_DEF_IA5String.elements; @@ -1616,7 +1648,8 @@ asn_TYPE_descriptor_t asn_DEF_PER_Visible = { PER_Visible_encode_der, PER_Visible_decode_xer, PER_Visible_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_PER_Visible_tags_1, sizeof(asn_DEF_PER_Visible_tags_1) @@ -1659,7 +1692,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 69 && cv <= 70)) return -1; + if(!(cv >= 69LL && cv <= 70LL)) return -1; } return 0; } @@ -1706,6 +1739,8 @@ PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -1773,7 +1808,8 @@ asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = { PER_Visible_2_encode_der, PER_Visible_2_decode_xer, PER_Visible_2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_PER_Visible_2_tags_1, sizeof(asn_DEF_PER_Visible_2_tags_1) @@ -1816,7 +1852,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 70)) return -1; + if(!(cv >= 65LL && cv <= 70LL)) return -1; } return 0; } @@ -1863,6 +1899,8 @@ Not_PER_Visible_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -1930,7 +1968,8 @@ asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = { Not_PER_Visible_1_encode_der, Not_PER_Visible_1_decode_xer, Not_PER_Visible_1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Not_PER_Visible_1_tags_1, sizeof(asn_DEF_Not_PER_Visible_1_tags_1) @@ -1973,7 +2012,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 66)) return -1; + if(!(cv >= 65LL && cv <= 66LL)) return -1; } return 0; } @@ -2020,6 +2059,8 @@ Not_PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -2087,7 +2128,8 @@ asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = { Not_PER_Visible_2_encode_der, Not_PER_Visible_2_decode_xer, Not_PER_Visible_2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Not_PER_Visible_2_tags_1, sizeof(asn_DEF_Not_PER_Visible_2_tags_1) @@ -2130,7 +2172,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 66)) return -1; + if(!(cv >= 65LL && cv <= 66LL)) return -1; } return 0; } @@ -2177,6 +2219,8 @@ Not_PER_Visible_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -2244,7 +2288,8 @@ asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = { Not_PER_Visible_3_encode_der, Not_PER_Visible_3_decode_xer, Not_PER_Visible_3_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Not_PER_Visible_3_tags_1, sizeof(asn_DEF_Not_PER_Visible_3_tags_1) @@ -2287,7 +2332,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 68)) return -1; + if(!(cv >= 65LL && cv <= 68LL)) return -1; } return 0; } @@ -2310,7 +2355,7 @@ SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size; - if((size >= 1 && size <= 4) + if((size >= 1LL && size <= 4LL) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -2337,6 +2382,8 @@ SIZE_but_not_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -2404,7 +2451,8 @@ asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = { SIZE_but_not_FROM_encode_der, SIZE_but_not_FROM_decode_xer, SIZE_but_not_FROM_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SIZE_but_not_FROM_tags_1, sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) @@ -2447,7 +2495,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 68)) return -1; + if(!(cv >= 65LL && cv <= 68LL)) return -1; } return 0; } @@ -2470,7 +2518,7 @@ SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size; - if((size >= 1 && size <= 4) + if((size >= 1LL && size <= 4LL) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -2497,6 +2545,8 @@ SIZE_and_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -2564,7 +2614,8 @@ asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = { SIZE_and_FROM_encode_der, SIZE_and_FROM_decode_xer, SIZE_and_FROM_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SIZE_and_FROM_tags_1, sizeof(asn_DEF_SIZE_and_FROM_tags_1) @@ -2607,7 +2658,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 70)) return -1; + if(!(cv >= 65LL && cv <= 70LL)) return -1; } return 0; } @@ -2654,6 +2705,8 @@ Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -2721,7 +2774,8 @@ asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = { Neither_SIZE_nor_FROM_encode_der, Neither_SIZE_nor_FROM_decode_xer, Neither_SIZE_nor_FROM_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Neither_SIZE_nor_FROM_tags_1, sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) @@ -2805,6 +2859,8 @@ Utf8_4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_UTF8String.xer_encoder; td->uper_decoder = asn_DEF_UTF8String.uper_decoder; td->uper_encoder = asn_DEF_UTF8String.uper_encoder; + td->aper_decoder = asn_DEF_UTF8String.aper_decoder; + td->aper_encoder = asn_DEF_UTF8String.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_UTF8String.per_constraints; td->elements = asn_DEF_UTF8String.elements; @@ -2872,7 +2928,8 @@ asn_TYPE_descriptor_t asn_DEF_Utf8_4 = { Utf8_4_encode_der, Utf8_4_decode_xer, Utf8_4_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_4_tags_1, sizeof(asn_DEF_Utf8_4_tags_1) @@ -2957,7 +3014,7 @@ Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((size >= 1 && size <= 2) + if((size >= 1LL && size <= 2LL) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -2984,6 +3041,8 @@ Utf8_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Utf8_2.xer_encoder; td->uper_decoder = asn_DEF_Utf8_2.uper_decoder; td->uper_encoder = asn_DEF_Utf8_2.uper_encoder; + td->aper_decoder = asn_DEF_Utf8_2.aper_decoder; + td->aper_encoder = asn_DEF_Utf8_2.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Utf8_2.per_constraints; td->elements = asn_DEF_Utf8_2.elements; @@ -3051,7 +3110,8 @@ asn_TYPE_descriptor_t asn_DEF_Utf8_3 = { Utf8_3_encode_der, Utf8_3_decode_xer, Utf8_3_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_3_tags_1, sizeof(asn_DEF_Utf8_3_tags_1) @@ -3107,7 +3167,7 @@ Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((size >= 1 && size <= 2)) { + if((size >= 1LL && size <= 2LL)) { /* Constraint check succeeded */ return 0; } else { @@ -3133,6 +3193,8 @@ Utf8_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Utf8_1.xer_encoder; td->uper_decoder = asn_DEF_Utf8_1.uper_decoder; td->uper_encoder = asn_DEF_Utf8_1.uper_encoder; + td->aper_decoder = asn_DEF_Utf8_1.aper_decoder; + td->aper_encoder = asn_DEF_Utf8_1.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Utf8_1.per_constraints; td->elements = asn_DEF_Utf8_1.elements; @@ -3200,7 +3262,8 @@ asn_TYPE_descriptor_t asn_DEF_Utf8_2 = { Utf8_2_encode_der, Utf8_2_decode_xer, Utf8_2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_2_tags_1, sizeof(asn_DEF_Utf8_2_tags_1) @@ -3258,6 +3321,8 @@ Utf8_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_UTF8String.xer_encoder; td->uper_decoder = asn_DEF_UTF8String.uper_decoder; td->uper_encoder = asn_DEF_UTF8String.uper_encoder; + td->aper_decoder = asn_DEF_UTF8String.aper_decoder; + td->aper_encoder = asn_DEF_UTF8String.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_UTF8String.per_constraints; td->elements = asn_DEF_UTF8String.elements; @@ -3325,7 +3390,8 @@ asn_TYPE_descriptor_t asn_DEF_Utf8_1 = { Utf8_1_encode_der, Utf8_1_decode_xer, Utf8_1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_1_tags_1, sizeof(asn_DEF_Utf8_1_tags_1) @@ -3403,7 +3469,7 @@ VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size; - if((size >= 1 && size <= 32) + if((size >= 1LL && size <= 32LL) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -3430,6 +3496,8 @@ VisibleIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Identifier.xer_encoder; td->uper_decoder = asn_DEF_Identifier.uper_decoder; td->uper_encoder = asn_DEF_Identifier.uper_encoder; + td->aper_decoder = asn_DEF_Identifier.aper_decoder; + td->aper_encoder = asn_DEF_Identifier.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Identifier.per_constraints; td->elements = asn_DEF_Identifier.elements; @@ -3497,7 +3565,8 @@ asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier = { VisibleIdentifier_encode_der, VisibleIdentifier_decode_xer, VisibleIdentifier_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_VisibleIdentifier_tags_1, sizeof(asn_DEF_VisibleIdentifier_tags_1) @@ -3581,6 +3650,8 @@ enum_c_6_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + td->aper_decoder = asn_DEF_ENUMERATED.aper_decoder; + td->aper_encoder = asn_DEF_ENUMERATED.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; @@ -3636,7 +3707,7 @@ static int memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int1_t *st = (const Int1_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -3652,7 +3723,7 @@ memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= -2)) { + if((value >= -2LL)) { /* Constraint check succeeded */ return 0; } else { @@ -3667,7 +3738,7 @@ static int memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int4_t *st = (const Int4_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -3683,7 +3754,7 @@ memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= 5 && value <= 7)) { + if((value >= 5LL && value <= 7LL)) { /* Constraint check succeeded */ return 0; } else { @@ -3698,7 +3769,7 @@ static int memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const Int5_t *st = (const Int5_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -3714,7 +3785,7 @@ memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value == 5)) { + if((value == 5LL)) { /* Constraint check succeeded */ return 0; } else { @@ -3739,7 +3810,7 @@ static int asn_DFL_2_set_3(int set_value, void **sptr) { if(set_value) { /* Install default value 3 */ - return asn_long2INTEGER(st, 3); + return asn_long2INTEGER(st, 3l); } else { /* Test default value 3 */ long value; @@ -3759,7 +3830,7 @@ static int asn_DFL_5_set_1(int set_value, void **sptr) { if(set_value) { /* Install default value 1 */ - *st = 1; + *st = 1l; return 0; } else { /* Test default value 1 */ @@ -3801,7 +3872,8 @@ asn_TYPE_descriptor_t asn_DEF_enum_c_6 = { enum_c_6_encode_der, enum_c_6_decode_xer, enum_c_6_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_enum_c_tags_6, sizeof(asn_DEF_enum_c_tags_6) @@ -3910,7 +3982,8 @@ asn_TYPE_descriptor_t asn_DEF_Sequence = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Sequence_tags_1, sizeof(asn_DEF_Sequence_tags_1) @@ -3982,7 +4055,8 @@ asn_TYPE_descriptor_t asn_DEF_SequenceOf = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SequenceOf_tags_1, sizeof(asn_DEF_SequenceOf_tags_1) @@ -4048,6 +4122,8 @@ Enum0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + td->aper_decoder = asn_DEF_ENUMERATED.aper_decoder; + td->aper_encoder = asn_DEF_ENUMERATED.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; @@ -4132,7 +4208,8 @@ asn_TYPE_descriptor_t asn_DEF_Enum0 = { Enum0_encode_der, Enum0_decode_xer, Enum0_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum0_tags_1, sizeof(asn_DEF_Enum0_tags_1) @@ -4177,7 +4254,7 @@ xer_type_encoder_f Enum1_encode_xer; int Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -4186,9 +4263,9 @@ Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value == 0)) { + if((value == 0LL)) { /* Constraint check succeeded */ return 0; } else { @@ -4214,6 +4291,8 @@ Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + td->aper_decoder = asn_DEF_NativeEnumerated.aper_decoder; + td->aper_encoder = asn_DEF_NativeEnumerated.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; td->elements = asn_DEF_NativeEnumerated.elements; @@ -4298,7 +4377,8 @@ asn_TYPE_descriptor_t asn_DEF_Enum1 = { Enum1_encode_der, Enum1_decode_xer, Enum1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum1_tags_1, sizeof(asn_DEF_Enum1_tags_1) @@ -4376,7 +4456,7 @@ Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size; - if((size >= 1 && size <= 32) + if((size >= 1LL && size <= 32LL) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -4403,6 +4483,8 @@ Identifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_VisibleString.xer_encoder; td->uper_decoder = asn_DEF_VisibleString.uper_decoder; td->uper_encoder = asn_DEF_VisibleString.uper_encoder; + td->aper_decoder = asn_DEF_VisibleString.aper_decoder; + td->aper_encoder = asn_DEF_VisibleString.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_VisibleString.per_constraints; td->elements = asn_DEF_VisibleString.elements; @@ -4470,7 +4552,8 @@ asn_TYPE_descriptor_t asn_DEF_Identifier = { Identifier_encode_der, Identifier_decode_xer, Identifier_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Identifier_tags_1, sizeof(asn_DEF_Identifier_tags_1) diff --git a/tests/50-constraint-OK.asn1.-Pgen-PER b/tests/50-constraint-OK.asn1.-Pgen-PER index 96a4c7507..725543465 100644 --- a/tests/50-constraint-OK.asn1.-Pgen-PER +++ b/tests/50-constraint-OK.asn1.-Pgen-PER @@ -19,6 +19,8 @@ xer_type_decoder_f Int1_decode_xer; xer_type_encoder_f Int1_encode_xer; per_type_decoder_f Int1_decode_uper; per_type_encoder_f Int1_encode_uper; +per_type_decoder_f Int1_decode_aper; +per_type_encoder_f Int1_encode_aper; /*** <<< CODE [Int1] >>> ***/ @@ -45,6 +47,8 @@ Int1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -111,6 +115,21 @@ Int1_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Int1_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Int1_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Int1_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Int1_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< STAT-DEFS [Int1] >>> ***/ @@ -129,6 +148,8 @@ asn_TYPE_descriptor_t asn_DEF_Int1 = { Int1_encode_xer, Int1_decode_uper, Int1_encode_uper, + Int1_decode_aper, + Int1_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Int1_tags_1, sizeof(asn_DEF_Int1_tags_1) @@ -162,13 +183,15 @@ xer_type_decoder_f Int2_decode_xer; xer_type_encoder_f Int2_encode_xer; per_type_decoder_f Int2_decode_uper; per_type_encoder_f Int2_encode_uper; +per_type_decoder_f Int2_decode_aper; +per_type_encoder_f Int2_encode_aper; /*** <<< CODE [Int2] >>> ***/ int Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -177,9 +200,9 @@ Int2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= 0)) { + if((value >= 0LL)) { /* Constraint check succeeded */ return 0; } else { @@ -205,6 +228,8 @@ Int2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Int1.xer_encoder; td->uper_decoder = asn_DEF_Int1.uper_decoder; td->uper_encoder = asn_DEF_Int1.uper_encoder; + td->aper_decoder = asn_DEF_Int1.aper_decoder; + td->aper_encoder = asn_DEF_Int1.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int1.per_constraints; td->elements = asn_DEF_Int1.elements; @@ -271,11 +296,26 @@ Int2_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Int2_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Int2_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Int2_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Int2_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Int2] >>> ***/ static asn_per_constraints_t asn_PER_type_Int2_constr_1 GCC_NOTUSED = { - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (0..MAX) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (0..MAX) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -297,6 +337,8 @@ asn_TYPE_descriptor_t asn_DEF_Int2 = { Int2_encode_xer, Int2_decode_uper, Int2_encode_uper, + Int2_decode_aper, + Int2_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Int2_tags_1, sizeof(asn_DEF_Int2_tags_1) @@ -330,13 +372,15 @@ xer_type_decoder_f Int3_decode_xer; xer_type_encoder_f Int3_encode_xer; per_type_decoder_f Int3_decode_uper; per_type_encoder_f Int3_encode_uper; +per_type_decoder_f Int3_decode_aper; +per_type_encoder_f Int3_encode_aper; /*** <<< CODE [Int3] >>> ***/ int Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -345,9 +389,9 @@ Int3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= 0 && value <= 10)) { + if((value >= 0LL && value <= 10LL)) { /* Constraint check succeeded */ return 0; } else { @@ -373,6 +417,8 @@ Int3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Int2.xer_encoder; td->uper_decoder = asn_DEF_Int2.uper_decoder; td->uper_encoder = asn_DEF_Int2.uper_encoder; + td->aper_decoder = asn_DEF_Int2.aper_decoder; + td->aper_encoder = asn_DEF_Int2.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int2.per_constraints; td->elements = asn_DEF_Int2.elements; @@ -439,11 +485,26 @@ Int3_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Int3_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Int3_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Int3_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Int3_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Int3] >>> ***/ static asn_per_constraints_t asn_PER_type_Int3_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 4, 4, 0, 10 } /* (0..10) */, + { APC_CONSTRAINED, 4, 4, 0l, 10l } /* (0..10) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -465,6 +526,8 @@ asn_TYPE_descriptor_t asn_DEF_Int3 = { Int3_encode_xer, Int3_decode_uper, Int3_encode_uper, + Int3_decode_aper, + Int3_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Int3_tags_1, sizeof(asn_DEF_Int3_tags_1) @@ -498,13 +561,15 @@ xer_type_decoder_f Int4_decode_xer; xer_type_encoder_f Int4_encode_xer; per_type_decoder_f Int4_decode_uper; per_type_encoder_f Int4_encode_uper; +per_type_decoder_f Int4_decode_aper; +per_type_encoder_f Int4_encode_aper; /*** <<< CODE [Int4] >>> ***/ int Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -513,9 +578,9 @@ Int4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= 1 && value <= 10)) { + if((value >= 1LL && value <= 10LL)) { /* Constraint check succeeded */ return 0; } else { @@ -541,6 +606,8 @@ Int4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Int3.xer_encoder; td->uper_decoder = asn_DEF_Int3.uper_decoder; td->uper_encoder = asn_DEF_Int3.uper_encoder; + td->aper_decoder = asn_DEF_Int3.aper_decoder; + td->aper_encoder = asn_DEF_Int3.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int3.per_constraints; td->elements = asn_DEF_Int3.elements; @@ -607,11 +674,26 @@ Int4_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Int4_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Int4_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Int4_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Int4_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Int4] >>> ***/ static asn_per_constraints_t asn_PER_type_Int4_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 4, 4, 1, 10 } /* (1..10,...) */, + { APC_CONSTRAINED | APC_EXTENSIBLE, 4, 4, 1l, 10l } /* (1..10,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -633,6 +715,8 @@ asn_TYPE_descriptor_t asn_DEF_Int4 = { Int4_encode_xer, Int4_decode_uper, Int4_encode_uper, + Int4_decode_aper, + Int4_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Int4_tags_1, sizeof(asn_DEF_Int4_tags_1) @@ -666,13 +750,15 @@ xer_type_decoder_f Int5_decode_xer; xer_type_encoder_f Int5_encode_xer; per_type_decoder_f Int5_decode_uper; per_type_encoder_f Int5_encode_uper; +per_type_decoder_f Int5_decode_aper; +per_type_encoder_f Int5_encode_aper; /*** <<< CODE [Int5] >>> ***/ int Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -681,9 +767,9 @@ Int5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value == 5)) { + if((value == 5LL)) { /* Constraint check succeeded */ return 0; } else { @@ -709,6 +795,8 @@ Int5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Int4.xer_encoder; td->uper_decoder = asn_DEF_Int4.uper_decoder; td->uper_encoder = asn_DEF_Int4.uper_encoder; + td->aper_decoder = asn_DEF_Int4.aper_decoder; + td->aper_encoder = asn_DEF_Int4.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Int4.per_constraints; td->elements = asn_DEF_Int4.elements; @@ -775,11 +863,26 @@ Int5_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Int5_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Int5_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Int5_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Int5_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Int5] >>> ***/ static asn_per_constraints_t asn_PER_type_Int5_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 0, 0, 5, 5 } /* (5..5) */, + { APC_CONSTRAINED, 0, 0, 5l, 5l } /* (5..5) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -801,6 +904,8 @@ asn_TYPE_descriptor_t asn_DEF_Int5 = { Int5_encode_xer, Int5_decode_uper, Int5_encode_uper, + Int5_decode_aper, + Int5_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Int5_tags_1, sizeof(asn_DEF_Int5_tags_1) @@ -834,13 +939,15 @@ xer_type_decoder_f ExtensibleExtensions_decode_xer; xer_type_encoder_f ExtensibleExtensions_encode_xer; per_type_decoder_f ExtensibleExtensions_decode_uper; per_type_encoder_f ExtensibleExtensions_encode_uper; +per_type_decoder_f ExtensibleExtensions_decode_aper; +per_type_encoder_f ExtensibleExtensions_encode_aper; /*** <<< CODE [ExtensibleExtensions] >>> ***/ int ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -849,9 +956,9 @@ ExtensibleExtensions_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= 1 && value <= 256)) { + if((value >= 1LL && value <= 256LL)) { /* Constraint check succeeded */ return 0; } else { @@ -877,6 +984,8 @@ ExtensibleExtensions_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -943,11 +1052,26 @@ ExtensibleExtensions_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +ExtensibleExtensions_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + ExtensibleExtensions_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +ExtensibleExtensions_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + ExtensibleExtensions_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [ExtensibleExtensions] >>> ***/ static asn_per_constraints_t asn_PER_type_ExtensibleExtensions_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1, 256 } /* (1..256,...) */, + { APC_CONSTRAINED | APC_EXTENSIBLE, 8, 8, 1l, 256l } /* (1..256,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -969,6 +1093,8 @@ asn_TYPE_descriptor_t asn_DEF_ExtensibleExtensions = { ExtensibleExtensions_encode_xer, ExtensibleExtensions_decode_uper, ExtensibleExtensions_encode_uper, + ExtensibleExtensions_decode_aper, + ExtensibleExtensions_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_ExtensibleExtensions_tags_1, sizeof(asn_DEF_ExtensibleExtensions_tags_1) @@ -1002,6 +1128,8 @@ xer_type_decoder_f Str1_decode_xer; xer_type_encoder_f Str1_encode_xer; per_type_decoder_f Str1_decode_uper; per_type_encoder_f Str1_encode_uper; +per_type_decoder_f Str1_decode_aper; +per_type_encoder_f Str1_encode_aper; /*** <<< CODE [Str1] >>> ***/ @@ -1028,6 +1156,8 @@ Str1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_IA5String.xer_encoder; td->uper_decoder = asn_DEF_IA5String.uper_decoder; td->uper_encoder = asn_DEF_IA5String.uper_encoder; + td->aper_decoder = asn_DEF_IA5String.aper_decoder; + td->aper_encoder = asn_DEF_IA5String.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_IA5String.per_constraints; td->elements = asn_DEF_IA5String.elements; @@ -1094,6 +1224,21 @@ Str1_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Str1_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Str1_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Str1_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Str1_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< STAT-DEFS [Str1] >>> ***/ @@ -1112,6 +1257,8 @@ asn_TYPE_descriptor_t asn_DEF_Str1 = { Str1_encode_xer, Str1_decode_uper, Str1_encode_uper, + Str1_decode_aper, + Str1_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Str1_tags_1, sizeof(asn_DEF_Str1_tags_1) @@ -1145,6 +1292,8 @@ xer_type_decoder_f Str2_decode_xer; xer_type_encoder_f Str2_encode_xer; per_type_decoder_f Str2_decode_uper; per_type_encoder_f Str2_encode_uper; +per_type_decoder_f Str2_decode_aper; +per_type_encoder_f Str2_encode_aper; /*** <<< CTABLES [Str2] >>> ***/ @@ -1156,7 +1305,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv <= 127)) return -1; + if(!(cv <= 127LL)) return -1; } return 0; } @@ -1179,7 +1328,7 @@ Str2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size; - if(((size <= 20) || (size >= 25 && size <= 30)) + if(((size <= 20LL) || (size >= 25LL && size <= 30LL)) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -1206,6 +1355,8 @@ Str2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Str1.xer_encoder; td->uper_decoder = asn_DEF_Str1.uper_decoder; td->uper_encoder = asn_DEF_Str1.uper_encoder; + td->aper_decoder = asn_DEF_Str1.aper_decoder; + td->aper_encoder = asn_DEF_Str1.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Str1.per_constraints; td->elements = asn_DEF_Str1.elements; @@ -1272,12 +1423,27 @@ Str2_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Str2_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Str2_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Str2_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Str2_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Str2] >>> ***/ static asn_per_constraints_t asn_PER_type_Str2_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_CONSTRAINED, 5, 5, 0, 30 } /* (SIZE(0..30)) */, + { APC_CONSTRAINED, 7, 7, 0l, 127l } /* (0..127) */, + { APC_CONSTRAINED, 5, 5, 0l, 30l } /* (SIZE(0..30)) */, 0, 0 /* No PER character map necessary */ }; @@ -1298,6 +1464,8 @@ asn_TYPE_descriptor_t asn_DEF_Str2 = { Str2_encode_xer, Str2_decode_uper, Str2_encode_uper, + Str2_decode_aper, + Str2_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Str2_tags_1, sizeof(asn_DEF_Str2_tags_1) @@ -1331,6 +1499,8 @@ xer_type_decoder_f Str3_decode_xer; xer_type_encoder_f Str3_encode_xer; per_type_decoder_f Str3_decode_uper; per_type_encoder_f Str3_encode_uper; +per_type_decoder_f Str3_decode_aper; +per_type_encoder_f Str3_encode_aper; /*** <<< CTABLES [Str3] >>> ***/ @@ -1379,7 +1549,7 @@ Str3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size; - if(((size >= 10 && size <= 20) || (size >= 25 && size <= 27)) + if(((size >= 10LL && size <= 20LL) || (size >= 25LL && size <= 27LL)) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -1416,6 +1586,8 @@ Str3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Str2.xer_encoder; td->uper_decoder = asn_DEF_Str2.uper_decoder; td->uper_encoder = asn_DEF_Str2.uper_encoder; + td->aper_decoder = asn_DEF_Str2.aper_decoder; + td->aper_encoder = asn_DEF_Str2.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Str2.per_constraints; td->elements = asn_DEF_Str2.elements; @@ -1482,12 +1654,27 @@ Str3_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Str3_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Str3_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Str3_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Str3_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Str3] >>> ***/ static asn_per_constraints_t asn_PER_type_Str3_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 3, 3, 65, 102 } /* (65..102) */, - { APC_CONSTRAINED, 5, 5, 10, 27 } /* (SIZE(10..27)) */, + { APC_CONSTRAINED, 3, 3, 65l, 102l } /* (65..102) */, + { APC_CONSTRAINED, 5, 5, 10l, 27l } /* (SIZE(10..27)) */, asn_PER_MAP_Str3_1_v2c, /* Value to PER code map */ asn_PER_MAP_Str3_1_c2v /* PER code to value map */ }; @@ -1509,6 +1696,8 @@ asn_TYPE_descriptor_t asn_DEF_Str3 = { Str3_encode_xer, Str3_decode_uper, Str3_encode_uper, + Str3_decode_aper, + Str3_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Str3_tags_1, sizeof(asn_DEF_Str3_tags_1) @@ -1542,6 +1731,8 @@ xer_type_decoder_f Str4_decode_xer; xer_type_encoder_f Str4_encode_xer; per_type_decoder_f Str4_decode_uper; per_type_encoder_f Str4_encode_uper; +per_type_decoder_f Str4_decode_aper; +per_type_encoder_f Str4_encode_aper; /*** <<< CTABLES [Str4] >>> ***/ @@ -1553,7 +1744,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv <= 127)) return -1; + if(!(cv <= 127LL)) return -1; } return 0; } @@ -1600,6 +1791,8 @@ Str4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_IA5String.xer_encoder; td->uper_decoder = asn_DEF_IA5String.uper_decoder; td->uper_encoder = asn_DEF_IA5String.uper_encoder; + td->aper_decoder = asn_DEF_IA5String.aper_decoder; + td->aper_encoder = asn_DEF_IA5String.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_IA5String.per_constraints; td->elements = asn_DEF_IA5String.elements; @@ -1666,12 +1859,27 @@ Str4_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Str4_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Str4_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Str4_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Str4_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Str4] >>> ***/ static asn_per_constraints_t asn_PER_type_Str4_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 7, 7, 0, 127 } /* (0..127) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 7, 7, 0l, 127l } /* (0..127) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; @@ -1692,6 +1900,8 @@ asn_TYPE_descriptor_t asn_DEF_Str4 = { Str4_encode_xer, Str4_decode_uper, Str4_encode_uper, + Str4_decode_aper, + Str4_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Str4_tags_1, sizeof(asn_DEF_Str4_tags_1) @@ -1725,6 +1935,8 @@ xer_type_decoder_f PER_Visible_decode_xer; xer_type_encoder_f PER_Visible_encode_xer; per_type_decoder_f PER_Visible_decode_uper; per_type_encoder_f PER_Visible_encode_uper; +per_type_decoder_f PER_Visible_decode_aper; +per_type_encoder_f PER_Visible_encode_aper; /*** <<< CTABLES [PER-Visible] >>> ***/ @@ -1736,7 +1948,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 70)) return -1; + if(!(cv >= 65LL && cv <= 70LL)) return -1; } return 0; } @@ -1783,6 +1995,8 @@ PER_Visible_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_IA5String.xer_encoder; td->uper_decoder = asn_DEF_IA5String.uper_decoder; td->uper_encoder = asn_DEF_IA5String.uper_encoder; + td->aper_decoder = asn_DEF_IA5String.aper_decoder; + td->aper_encoder = asn_DEF_IA5String.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_IA5String.per_constraints; td->elements = asn_DEF_IA5String.elements; @@ -1849,12 +2063,27 @@ PER_Visible_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +PER_Visible_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + PER_Visible_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +PER_Visible_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + PER_Visible_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [PER-Visible] >>> ***/ static asn_per_constraints_t asn_PER_type_PER_Visible_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 3, 3, 65, 70 } /* (65..70) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 3, 3, 65l, 70l } /* (65..70) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; @@ -1875,6 +2104,8 @@ asn_TYPE_descriptor_t asn_DEF_PER_Visible = { PER_Visible_encode_xer, PER_Visible_decode_uper, PER_Visible_encode_uper, + PER_Visible_decode_aper, + PER_Visible_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_PER_Visible_tags_1, sizeof(asn_DEF_PER_Visible_tags_1) @@ -1908,6 +2139,8 @@ xer_type_decoder_f PER_Visible_2_decode_xer; xer_type_encoder_f PER_Visible_2_encode_xer; per_type_decoder_f PER_Visible_2_decode_uper; per_type_encoder_f PER_Visible_2_encode_uper; +per_type_decoder_f PER_Visible_2_decode_aper; +per_type_encoder_f PER_Visible_2_encode_aper; /*** <<< CTABLES [PER-Visible-2] >>> ***/ @@ -1919,7 +2152,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 69 && cv <= 70)) return -1; + if(!(cv >= 69LL && cv <= 70LL)) return -1; } return 0; } @@ -1966,6 +2199,8 @@ PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -2032,12 +2267,27 @@ PER_Visible_2_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +PER_Visible_2_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + PER_Visible_2_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +PER_Visible_2_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + PER_Visible_2_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [PER-Visible-2] >>> ***/ static asn_per_constraints_t asn_PER_type_PER_Visible_2_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 1, 1, 69, 70 } /* (69..70) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 1, 1, 69l, 70l } /* (69..70) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; @@ -2058,6 +2308,8 @@ asn_TYPE_descriptor_t asn_DEF_PER_Visible_2 = { PER_Visible_2_encode_xer, PER_Visible_2_decode_uper, PER_Visible_2_encode_uper, + PER_Visible_2_decode_aper, + PER_Visible_2_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_PER_Visible_2_tags_1, sizeof(asn_DEF_PER_Visible_2_tags_1) @@ -2091,6 +2343,8 @@ xer_type_decoder_f Not_PER_Visible_1_decode_xer; xer_type_encoder_f Not_PER_Visible_1_encode_xer; per_type_decoder_f Not_PER_Visible_1_decode_uper; per_type_encoder_f Not_PER_Visible_1_encode_uper; +per_type_decoder_f Not_PER_Visible_1_decode_aper; +per_type_encoder_f Not_PER_Visible_1_encode_aper; /*** <<< CTABLES [Not-PER-Visible-1] >>> ***/ @@ -2102,7 +2356,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 70)) return -1; + if(!(cv >= 65LL && cv <= 70LL)) return -1; } return 0; } @@ -2149,6 +2403,8 @@ Not_PER_Visible_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -2215,12 +2471,27 @@ Not_PER_Visible_1_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Not_PER_Visible_1_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Not_PER_Visible_1_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Not_PER_Visible_1_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Not-PER-Visible-1] >>> ***/ static asn_per_constraints_t asn_PER_type_Not_PER_Visible_1_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 3, 3, 65, 70 } /* (65..70) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 3, 3, 65l, 70l } /* (65..70) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; @@ -2241,6 +2512,8 @@ asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_1 = { Not_PER_Visible_1_encode_xer, Not_PER_Visible_1_decode_uper, Not_PER_Visible_1_encode_uper, + Not_PER_Visible_1_decode_aper, + Not_PER_Visible_1_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Not_PER_Visible_1_tags_1, sizeof(asn_DEF_Not_PER_Visible_1_tags_1) @@ -2274,6 +2547,8 @@ xer_type_decoder_f Not_PER_Visible_2_decode_xer; xer_type_encoder_f Not_PER_Visible_2_encode_xer; per_type_decoder_f Not_PER_Visible_2_decode_uper; per_type_encoder_f Not_PER_Visible_2_encode_uper; +per_type_decoder_f Not_PER_Visible_2_decode_aper; +per_type_encoder_f Not_PER_Visible_2_encode_aper; /*** <<< CTABLES [Not-PER-Visible-2] >>> ***/ @@ -2285,7 +2560,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 66)) return -1; + if(!(cv >= 65LL && cv <= 66LL)) return -1; } return 0; } @@ -2332,6 +2607,8 @@ Not_PER_Visible_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -2398,12 +2675,27 @@ Not_PER_Visible_2_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Not_PER_Visible_2_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Not_PER_Visible_2_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Not_PER_Visible_2_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Not-PER-Visible-2] >>> ***/ static asn_per_constraints_t asn_PER_type_Not_PER_Visible_2_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; @@ -2424,6 +2716,8 @@ asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_2 = { Not_PER_Visible_2_encode_xer, Not_PER_Visible_2_decode_uper, Not_PER_Visible_2_encode_uper, + Not_PER_Visible_2_decode_aper, + Not_PER_Visible_2_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Not_PER_Visible_2_tags_1, sizeof(asn_DEF_Not_PER_Visible_2_tags_1) @@ -2457,6 +2751,8 @@ xer_type_decoder_f Not_PER_Visible_3_decode_xer; xer_type_encoder_f Not_PER_Visible_3_encode_xer; per_type_decoder_f Not_PER_Visible_3_decode_uper; per_type_encoder_f Not_PER_Visible_3_encode_uper; +per_type_decoder_f Not_PER_Visible_3_decode_aper; +per_type_encoder_f Not_PER_Visible_3_encode_aper; /*** <<< CTABLES [Not-PER-Visible-3] >>> ***/ @@ -2468,7 +2764,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 66)) return -1; + if(!(cv >= 65LL && cv <= 66LL)) return -1; } return 0; } @@ -2515,6 +2811,8 @@ Not_PER_Visible_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -2581,12 +2879,27 @@ Not_PER_Visible_3_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Not_PER_Visible_3_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Not_PER_Visible_3_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Not_PER_Visible_3_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Not-PER-Visible-3] >>> ***/ static asn_per_constraints_t asn_PER_type_Not_PER_Visible_3_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; @@ -2607,6 +2920,8 @@ asn_TYPE_descriptor_t asn_DEF_Not_PER_Visible_3 = { Not_PER_Visible_3_encode_xer, Not_PER_Visible_3_decode_uper, Not_PER_Visible_3_encode_uper, + Not_PER_Visible_3_decode_aper, + Not_PER_Visible_3_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Not_PER_Visible_3_tags_1, sizeof(asn_DEF_Not_PER_Visible_3_tags_1) @@ -2640,6 +2955,8 @@ xer_type_decoder_f SIZE_but_not_FROM_decode_xer; xer_type_encoder_f SIZE_but_not_FROM_encode_xer; per_type_decoder_f SIZE_but_not_FROM_decode_uper; per_type_encoder_f SIZE_but_not_FROM_encode_uper; +per_type_decoder_f SIZE_but_not_FROM_decode_aper; +per_type_encoder_f SIZE_but_not_FROM_encode_aper; /*** <<< CTABLES [SIZE-but-not-FROM] >>> ***/ @@ -2651,7 +2968,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 68)) return -1; + if(!(cv >= 65LL && cv <= 68LL)) return -1; } return 0; } @@ -2674,7 +2991,7 @@ SIZE_but_not_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size; - if((size >= 1 && size <= 4) + if((size >= 1LL && size <= 4LL) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -2701,6 +3018,8 @@ SIZE_but_not_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -2767,12 +3086,27 @@ SIZE_but_not_FROM_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +SIZE_but_not_FROM_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +SIZE_but_not_FROM_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + SIZE_but_not_FROM_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [SIZE-but-not-FROM] >>> ***/ static asn_per_constraints_t asn_PER_type_SIZE_but_not_FROM_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + { APC_CONSTRAINED, 2, 2, 1l, 4l } /* (SIZE(1..4)) */, 0, 0 /* No PER character map necessary */ }; @@ -2793,6 +3127,8 @@ asn_TYPE_descriptor_t asn_DEF_SIZE_but_not_FROM = { SIZE_but_not_FROM_encode_xer, SIZE_but_not_FROM_decode_uper, SIZE_but_not_FROM_encode_uper, + SIZE_but_not_FROM_decode_aper, + SIZE_but_not_FROM_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_SIZE_but_not_FROM_tags_1, sizeof(asn_DEF_SIZE_but_not_FROM_tags_1) @@ -2826,6 +3162,8 @@ xer_type_decoder_f SIZE_and_FROM_decode_xer; xer_type_encoder_f SIZE_and_FROM_encode_xer; per_type_decoder_f SIZE_and_FROM_decode_uper; per_type_encoder_f SIZE_and_FROM_encode_uper; +per_type_decoder_f SIZE_and_FROM_decode_aper; +per_type_encoder_f SIZE_and_FROM_encode_aper; /*** <<< CTABLES [SIZE-and-FROM] >>> ***/ @@ -2837,7 +3175,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 68)) return -1; + if(!(cv >= 65LL && cv <= 68LL)) return -1; } return 0; } @@ -2860,7 +3198,7 @@ SIZE_and_FROM_constraint(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size; - if((size >= 1 && size <= 4) + if((size >= 1LL && size <= 4LL) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -2887,6 +3225,8 @@ SIZE_and_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -2953,12 +3293,27 @@ SIZE_and_FROM_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +SIZE_and_FROM_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + SIZE_and_FROM_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +SIZE_and_FROM_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + SIZE_and_FROM_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [SIZE-and-FROM] >>> ***/ static asn_per_constraints_t asn_PER_type_SIZE_and_FROM_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 2, 2, 65, 68 } /* (65..68) */, - { APC_CONSTRAINED, 2, 2, 1, 4 } /* (SIZE(1..4)) */, + { APC_CONSTRAINED, 2, 2, 65l, 68l } /* (65..68) */, + { APC_CONSTRAINED, 2, 2, 1l, 4l } /* (SIZE(1..4)) */, 0, 0 /* No PER character map necessary */ }; @@ -2979,6 +3334,8 @@ asn_TYPE_descriptor_t asn_DEF_SIZE_and_FROM = { SIZE_and_FROM_encode_xer, SIZE_and_FROM_decode_uper, SIZE_and_FROM_encode_uper, + SIZE_and_FROM_decode_aper, + SIZE_and_FROM_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_SIZE_and_FROM_tags_1, sizeof(asn_DEF_SIZE_and_FROM_tags_1) @@ -3012,6 +3369,8 @@ xer_type_decoder_f Neither_SIZE_nor_FROM_decode_xer; xer_type_encoder_f Neither_SIZE_nor_FROM_encode_xer; per_type_decoder_f Neither_SIZE_nor_FROM_decode_uper; per_type_encoder_f Neither_SIZE_nor_FROM_encode_uper; +per_type_decoder_f Neither_SIZE_nor_FROM_decode_aper; +per_type_encoder_f Neither_SIZE_nor_FROM_encode_aper; /*** <<< CTABLES [Neither-SIZE-nor-FROM] >>> ***/ @@ -3023,7 +3382,7 @@ static int check_permitted_alphabet_1(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 70)) return -1; + if(!(cv >= 65LL && cv <= 70LL)) return -1; } return 0; } @@ -3070,6 +3429,8 @@ Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_PER_Visible.xer_encoder; td->uper_decoder = asn_DEF_PER_Visible.uper_decoder; td->uper_encoder = asn_DEF_PER_Visible.uper_encoder; + td->aper_decoder = asn_DEF_PER_Visible.aper_decoder; + td->aper_encoder = asn_DEF_PER_Visible.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_PER_Visible.per_constraints; td->elements = asn_DEF_PER_Visible.elements; @@ -3136,12 +3497,27 @@ Neither_SIZE_nor_FROM_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Neither_SIZE_nor_FROM_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Neither_SIZE_nor_FROM_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Neither_SIZE_nor_FROM_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Neither-SIZE-nor-FROM] >>> ***/ static asn_per_constraints_t asn_PER_type_Neither_SIZE_nor_FROM_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 3, 3, 65, 70 } /* (65..70) */, - { APC_SEMI_CONSTRAINED, -1, -1, 0, 0 } /* (SIZE(0..MAX)) */, + { APC_CONSTRAINED, 3, 3, 65l, 70l } /* (65..70) */, + { APC_SEMI_CONSTRAINED, -1, -1, 0l, 0l } /* (SIZE(0..MAX)) */, 0, 0 /* No PER character map necessary */ }; @@ -3162,6 +3538,8 @@ asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = { Neither_SIZE_nor_FROM_encode_xer, Neither_SIZE_nor_FROM_decode_uper, Neither_SIZE_nor_FROM_encode_uper, + Neither_SIZE_nor_FROM_decode_aper, + Neither_SIZE_nor_FROM_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Neither_SIZE_nor_FROM_tags_1, sizeof(asn_DEF_Neither_SIZE_nor_FROM_tags_1) @@ -3195,6 +3573,8 @@ xer_type_decoder_f Utf8_4_decode_xer; xer_type_encoder_f Utf8_4_encode_xer; per_type_decoder_f Utf8_4_decode_uper; per_type_encoder_f Utf8_4_encode_uper; +per_type_decoder_f Utf8_4_decode_aper; +per_type_encoder_f Utf8_4_encode_aper; /*** <<< CTABLES [Utf8-4] >>> ***/ @@ -3247,6 +3627,8 @@ Utf8_4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_UTF8String.xer_encoder; td->uper_decoder = asn_DEF_UTF8String.uper_decoder; td->uper_encoder = asn_DEF_UTF8String.uper_encoder; + td->aper_decoder = asn_DEF_UTF8String.aper_decoder; + td->aper_encoder = asn_DEF_UTF8String.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_UTF8String.per_constraints; td->elements = asn_DEF_UTF8String.elements; @@ -3313,6 +3695,21 @@ Utf8_4_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Utf8_4_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Utf8_4_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Utf8_4_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Utf8_4_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Utf8-4] >>> ***/ @@ -3339,6 +3736,8 @@ asn_TYPE_descriptor_t asn_DEF_Utf8_4 = { Utf8_4_encode_xer, Utf8_4_decode_uper, Utf8_4_encode_uper, + Utf8_4_decode_aper, + Utf8_4_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_4_tags_1, sizeof(asn_DEF_Utf8_4_tags_1) @@ -3372,6 +3771,8 @@ xer_type_decoder_f Utf8_3_decode_xer; xer_type_encoder_f Utf8_3_encode_xer; per_type_decoder_f Utf8_3_decode_uper; per_type_encoder_f Utf8_3_encode_uper; +per_type_decoder_f Utf8_3_decode_aper; +per_type_encoder_f Utf8_3_encode_aper; /*** <<< CTABLES [Utf8-3] >>> ***/ @@ -3425,7 +3826,7 @@ Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((size >= 1 && size <= 2) + if((size >= 1LL && size <= 2LL) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -3452,6 +3853,8 @@ Utf8_3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Utf8_2.xer_encoder; td->uper_decoder = asn_DEF_Utf8_2.uper_decoder; td->uper_encoder = asn_DEF_Utf8_2.uper_encoder; + td->aper_decoder = asn_DEF_Utf8_2.aper_decoder; + td->aper_encoder = asn_DEF_Utf8_2.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Utf8_2.per_constraints; td->elements = asn_DEF_Utf8_2.elements; @@ -3518,6 +3921,21 @@ Utf8_3_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Utf8_3_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Utf8_3_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Utf8_3_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Utf8_3_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Utf8-3] >>> ***/ @@ -3544,6 +3962,8 @@ asn_TYPE_descriptor_t asn_DEF_Utf8_3 = { Utf8_3_encode_xer, Utf8_3_decode_uper, Utf8_3_encode_uper, + Utf8_3_decode_aper, + Utf8_3_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_3_tags_1, sizeof(asn_DEF_Utf8_3_tags_1) @@ -3577,6 +3997,8 @@ xer_type_decoder_f Utf8_2_decode_xer; xer_type_encoder_f Utf8_2_encode_xer; per_type_decoder_f Utf8_2_decode_uper; per_type_encoder_f Utf8_2_encode_uper; +per_type_decoder_f Utf8_2_decode_aper; +per_type_encoder_f Utf8_2_encode_aper; /*** <<< CODE [Utf8-2] >>> ***/ @@ -3601,7 +4023,7 @@ Utf8_2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((size >= 1 && size <= 2)) { + if((size >= 1LL && size <= 2LL)) { /* Constraint check succeeded */ return 0; } else { @@ -3627,6 +4049,8 @@ Utf8_2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Utf8_1.xer_encoder; td->uper_decoder = asn_DEF_Utf8_1.uper_decoder; td->uper_encoder = asn_DEF_Utf8_1.uper_encoder; + td->aper_decoder = asn_DEF_Utf8_1.aper_decoder; + td->aper_encoder = asn_DEF_Utf8_1.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Utf8_1.per_constraints; td->elements = asn_DEF_Utf8_1.elements; @@ -3693,6 +4117,21 @@ Utf8_2_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Utf8_2_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Utf8_2_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Utf8_2_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Utf8_2_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Utf8-2] >>> ***/ @@ -3719,6 +4158,8 @@ asn_TYPE_descriptor_t asn_DEF_Utf8_2 = { Utf8_2_encode_xer, Utf8_2_decode_uper, Utf8_2_encode_uper, + Utf8_2_decode_aper, + Utf8_2_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_2_tags_1, sizeof(asn_DEF_Utf8_2_tags_1) @@ -3752,6 +4193,8 @@ xer_type_decoder_f Utf8_1_decode_xer; xer_type_encoder_f Utf8_1_encode_xer; per_type_decoder_f Utf8_1_decode_uper; per_type_encoder_f Utf8_1_encode_uper; +per_type_decoder_f Utf8_1_decode_aper; +per_type_encoder_f Utf8_1_encode_aper; /*** <<< CODE [Utf8-1] >>> ***/ @@ -3778,6 +4221,8 @@ Utf8_1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_UTF8String.xer_encoder; td->uper_decoder = asn_DEF_UTF8String.uper_decoder; td->uper_encoder = asn_DEF_UTF8String.uper_encoder; + td->aper_decoder = asn_DEF_UTF8String.aper_decoder; + td->aper_encoder = asn_DEF_UTF8String.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_UTF8String.per_constraints; td->elements = asn_DEF_UTF8String.elements; @@ -3844,6 +4289,21 @@ Utf8_1_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Utf8_1_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Utf8_1_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Utf8_1_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Utf8_1_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< STAT-DEFS [Utf8-1] >>> ***/ @@ -3862,6 +4322,8 @@ asn_TYPE_descriptor_t asn_DEF_Utf8_1 = { Utf8_1_encode_xer, Utf8_1_decode_uper, Utf8_1_encode_uper, + Utf8_1_decode_aper, + Utf8_1_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Utf8_1_tags_1, sizeof(asn_DEF_Utf8_1_tags_1) @@ -3895,6 +4357,8 @@ xer_type_decoder_f VisibleIdentifier_decode_xer; xer_type_encoder_f VisibleIdentifier_encode_xer; per_type_decoder_f VisibleIdentifier_decode_uper; per_type_encoder_f VisibleIdentifier_encode_uper; +per_type_decoder_f VisibleIdentifier_decode_aper; +per_type_encoder_f VisibleIdentifier_encode_aper; /*** <<< CTABLES [VisibleIdentifier] >>> ***/ @@ -3948,7 +4412,7 @@ VisibleIdentifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size; - if((size >= 1 && size <= 32) + if((size >= 1LL && size <= 32LL) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -3975,6 +4439,8 @@ VisibleIdentifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Identifier.xer_encoder; td->uper_decoder = asn_DEF_Identifier.uper_decoder; td->uper_encoder = asn_DEF_Identifier.uper_encoder; + td->aper_decoder = asn_DEF_Identifier.aper_decoder; + td->aper_encoder = asn_DEF_Identifier.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Identifier.per_constraints; td->elements = asn_DEF_Identifier.elements; @@ -4041,6 +4507,21 @@ VisibleIdentifier_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +VisibleIdentifier_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + VisibleIdentifier_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +VisibleIdentifier_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + VisibleIdentifier_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< STAT-DEFS [VisibleIdentifier] >>> ***/ @@ -4059,6 +4540,8 @@ asn_TYPE_descriptor_t asn_DEF_VisibleIdentifier = { VisibleIdentifier_encode_xer, VisibleIdentifier_decode_uper, VisibleIdentifier_encode_uper, + VisibleIdentifier_decode_aper, + VisibleIdentifier_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_VisibleIdentifier_tags_1, sizeof(asn_DEF_VisibleIdentifier_tags_1) @@ -4142,6 +4625,8 @@ enum_c_6_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + td->aper_decoder = asn_DEF_NativeEnumerated.aper_decoder; + td->aper_encoder = asn_DEF_NativeEnumerated.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; td->elements = asn_DEF_NativeEnumerated.elements; @@ -4208,10 +4693,25 @@ enum_c_6_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +static asn_enc_rval_t +enum_c_6_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + enum_c_6_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +static asn_dec_rval_t +enum_c_6_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + enum_c_6_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + static int memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -4220,9 +4720,9 @@ memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= -2)) { + if((value >= -2LL)) { /* Constraint check succeeded */ return 0; } else { @@ -4236,7 +4736,7 @@ memb_int1_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -4245,9 +4745,9 @@ memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= 5 && value <= 7)) { + if((value >= 5LL && value <= 7LL)) { /* Constraint check succeeded */ return 0; } else { @@ -4261,7 +4761,7 @@ memb_int4_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, static int memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -4270,9 +4770,9 @@ memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value == 5)) { + if((value == 5LL)) { /* Constraint check succeeded */ return 0; } else { @@ -4287,22 +4787,22 @@ memb_int5_c_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, /*** <<< CTDEFS [Sequence] >>> ***/ static asn_per_constraints_t asn_PER_type_enum_c_constr_6 GCC_NOTUSED = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0, 1 } /* (0..1,...) */, + { APC_CONSTRAINED | APC_EXTENSIBLE, 1, 1, 0l, 1l } /* (0..1,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_int1_c_constr_2 GCC_NOTUSED = { - { APC_SEMI_CONSTRAINED, -1, -1, -2, 0 } /* (-2..MAX) */, + { APC_SEMI_CONSTRAINED, -1, -1, -2l, 0l } /* (-2..MAX) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_int4_c_constr_4 GCC_NOTUSED = { - { APC_CONSTRAINED, 2, 2, 5, 7 } /* (5..7) */, + { APC_CONSTRAINED, 2, 2, 5l, 7l } /* (5..7) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_memb_int5_c_constr_13 GCC_NOTUSED = { - { APC_CONSTRAINED, 0, 0, 5, 5 } /* (5..5) */, + { APC_CONSTRAINED, 0, 0, 5l, 5l } /* (5..5) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -4320,7 +4820,7 @@ static int asn_DFL_2_set_3(int set_value, void **sptr) { if(set_value) { /* Install default value 3 */ - *st = 3; + *st = 3l; return 0; } else { /* Test default value 3 */ @@ -4338,7 +4838,7 @@ static int asn_DFL_5_set_1(int set_value, void **sptr) { if(set_value) { /* Install default value 1 */ - *st = 1; + *st = 1l; return 0; } else { /* Test default value 1 */ @@ -4382,6 +4882,8 @@ asn_TYPE_descriptor_t asn_DEF_enum_c_6 = { enum_c_6_encode_xer, enum_c_6_decode_uper, enum_c_6_encode_uper, + enum_c_6_decode_aper, + enum_c_6_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_enum_c_tags_6, sizeof(asn_DEF_enum_c_tags_6) @@ -4494,6 +4996,8 @@ asn_TYPE_descriptor_t asn_DEF_Sequence = { SEQUENCE_encode_xer, SEQUENCE_decode_uper, SEQUENCE_encode_uper, + SEQUENCE_decode_aper, + SEQUENCE_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Sequence_tags_1, sizeof(asn_DEF_Sequence_tags_1) @@ -4538,7 +5042,7 @@ extern asn_TYPE_descriptor_t asn_DEF_SequenceOf; static asn_per_constraints_t asn_PER_type_SequenceOf_constr_1 GCC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, - { APC_CONSTRAINED, 1, 1, 1, 2 } /* (SIZE(1..2)) */, + { APC_CONSTRAINED, 1, 1, 1l, 2l } /* (SIZE(1..2)) */, 0, 0 /* No PER value map */ }; @@ -4575,6 +5079,8 @@ asn_TYPE_descriptor_t asn_DEF_SequenceOf = { SEQUENCE_OF_encode_xer, SEQUENCE_OF_decode_uper, SEQUENCE_OF_encode_uper, + SEQUENCE_OF_decode_aper, + SEQUENCE_OF_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_SequenceOf_tags_1, sizeof(asn_DEF_SequenceOf_tags_1) @@ -4616,6 +5122,8 @@ xer_type_decoder_f Enum0_decode_xer; xer_type_encoder_f Enum0_encode_xer; per_type_decoder_f Enum0_decode_uper; per_type_encoder_f Enum0_encode_uper; +per_type_decoder_f Enum0_decode_aper; +per_type_encoder_f Enum0_encode_aper; /*** <<< CODE [Enum0] >>> ***/ @@ -4642,6 +5150,8 @@ Enum0_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + td->aper_decoder = asn_DEF_NativeEnumerated.aper_decoder; + td->aper_encoder = asn_DEF_NativeEnumerated.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; td->elements = asn_DEF_NativeEnumerated.elements; @@ -4708,11 +5218,26 @@ Enum0_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Enum0_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Enum0_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Enum0_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Enum0_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Enum0] >>> ***/ static asn_per_constraints_t asn_PER_type_Enum0_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_CONSTRAINED, 1, 1, 0l, 1l } /* (0..1) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -4751,6 +5276,8 @@ asn_TYPE_descriptor_t asn_DEF_Enum0 = { Enum0_encode_xer, Enum0_decode_uper, Enum0_encode_uper, + Enum0_decode_aper, + Enum0_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum0_tags_1, sizeof(asn_DEF_Enum0_tags_1) @@ -4791,13 +5318,15 @@ xer_type_decoder_f Enum1_decode_xer; xer_type_encoder_f Enum1_encode_xer; per_type_decoder_f Enum1_decode_uper; per_type_encoder_f Enum1_encode_uper; +per_type_decoder_f Enum1_decode_aper; +per_type_encoder_f Enum1_encode_aper; /*** <<< CODE [Enum1] >>> ***/ int Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -4806,9 +5335,9 @@ Enum1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value == 0)) { + if((value == 0LL)) { /* Constraint check succeeded */ return 0; } else { @@ -4834,6 +5363,8 @@ Enum1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder; td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder; td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder; + td->aper_decoder = asn_DEF_NativeEnumerated.aper_decoder; + td->aper_encoder = asn_DEF_NativeEnumerated.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeEnumerated.per_constraints; td->elements = asn_DEF_NativeEnumerated.elements; @@ -4900,11 +5431,26 @@ Enum1_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Enum1_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Enum1_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Enum1_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Enum1_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Enum1] >>> ***/ static asn_per_constraints_t asn_PER_type_Enum1_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_CONSTRAINED, 1, 1, 0l, 1l } /* (0..1) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -4943,6 +5489,8 @@ asn_TYPE_descriptor_t asn_DEF_Enum1 = { Enum1_encode_xer, Enum1_decode_uper, Enum1_encode_uper, + Enum1_decode_aper, + Enum1_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Enum1_tags_1, sizeof(asn_DEF_Enum1_tags_1) @@ -4976,6 +5524,8 @@ xer_type_decoder_f Identifier_decode_xer; xer_type_encoder_f Identifier_encode_xer; per_type_decoder_f Identifier_decode_uper; per_type_encoder_f Identifier_encode_uper; +per_type_decoder_f Identifier_decode_aper; +per_type_encoder_f Identifier_encode_aper; /*** <<< CTABLES [Identifier] >>> ***/ @@ -5029,7 +5579,7 @@ Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size; - if((size >= 1 && size <= 32) + if((size >= 1LL && size <= 32LL) && !check_permitted_alphabet_1(st)) { /* Constraint check succeeded */ return 0; @@ -5066,6 +5616,8 @@ Identifier_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_VisibleString.xer_encoder; td->uper_decoder = asn_DEF_VisibleString.uper_decoder; td->uper_encoder = asn_DEF_VisibleString.uper_encoder; + td->aper_decoder = asn_DEF_VisibleString.aper_decoder; + td->aper_encoder = asn_DEF_VisibleString.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_VisibleString.per_constraints; td->elements = asn_DEF_VisibleString.elements; @@ -5132,12 +5684,27 @@ Identifier_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +Identifier_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + Identifier_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +Identifier_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + Identifier_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [Identifier] >>> ***/ static asn_per_constraints_t asn_PER_type_Identifier_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 6, 6, 36, 122 } /* (36..122) */, - { APC_CONSTRAINED, 5, 5, 1, 32 } /* (SIZE(1..32)) */, + { APC_CONSTRAINED, 6, 6, 36l, 122l } /* (36..122) */, + { APC_CONSTRAINED, 5, 5, 1l, 32l } /* (SIZE(1..32)) */, asn_PER_MAP_Identifier_1_v2c, /* Value to PER code map */ asn_PER_MAP_Identifier_1_c2v /* PER code to value map */ }; @@ -5159,6 +5726,8 @@ asn_TYPE_descriptor_t asn_DEF_Identifier = { Identifier_encode_xer, Identifier_decode_uper, Identifier_encode_uper, + Identifier_decode_aper, + Identifier_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_Identifier_tags_1, sizeof(asn_DEF_Identifier_tags_1) diff --git a/tests/59-choice-extended-OK.asn1.-Pfwide-types b/tests/59-choice-extended-OK.asn1.-Pfwide-types index 246a0cdff..efe57a9ca 100644 --- a/tests/59-choice-extended-OK.asn1.-Pfwide-types +++ b/tests/59-choice-extended-OK.asn1.-Pfwide-types @@ -103,7 +103,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, asn_DEF_Choice_tags_1, sizeof(asn_DEF_Choice_tags_1) diff --git a/tests/60-any-OK.asn1.-Pfwide-types b/tests/60-any-OK.asn1.-Pfwide-types index ea10d2452..ac007c196 100644 --- a/tests/60-any-OK.asn1.-Pfwide-types +++ b/tests/60-any-OK.asn1.-Pfwide-types @@ -66,7 +66,8 @@ asn_TYPE_descriptor_t asn_DEF_T1 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T1_tags_1, sizeof(asn_DEF_T1_tags_1) @@ -149,7 +150,8 @@ asn_TYPE_descriptor_t asn_DEF_T2 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T2_tags_1, sizeof(asn_DEF_T2_tags_1) @@ -227,7 +229,8 @@ asn_TYPE_descriptor_t asn_DEF_T3 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T3_tags_1, sizeof(asn_DEF_T3_tags_1) diff --git a/tests/65-multi-tag-OK.asn1.-Pfnative-types b/tests/65-multi-tag-OK.asn1.-Pfnative-types index df1e4b7ff..cc2541748 100644 --- a/tests/65-multi-tag-OK.asn1.-Pfnative-types +++ b/tests/65-multi-tag-OK.asn1.-Pfnative-types @@ -43,6 +43,8 @@ T1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_T2.xer_encoder; td->uper_decoder = asn_DEF_T2.uper_decoder; td->uper_encoder = asn_DEF_T2.uper_encoder; + td->aper_decoder = asn_DEF_T2.aper_decoder; + td->aper_encoder = asn_DEF_T2.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T2.per_constraints; td->elements = asn_DEF_T2.elements; @@ -121,7 +123,8 @@ asn_TYPE_descriptor_t asn_DEF_T1 = { T1_encode_der, T1_decode_xer, T1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T1_tags_1, sizeof(asn_DEF_T1_tags_1) @@ -179,6 +182,8 @@ T2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_T3.xer_encoder; td->uper_decoder = asn_DEF_T3.uper_decoder; td->uper_encoder = asn_DEF_T3.uper_encoder; + td->aper_decoder = asn_DEF_T3.aper_decoder; + td->aper_encoder = asn_DEF_T3.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T3.per_constraints; td->elements = asn_DEF_T3.elements; @@ -255,7 +260,8 @@ asn_TYPE_descriptor_t asn_DEF_T2 = { T2_encode_der, T2_decode_xer, T2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T2_tags_1, sizeof(asn_DEF_T2_tags_1) @@ -313,6 +319,8 @@ T3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_T4.xer_encoder; td->uper_decoder = asn_DEF_T4.uper_decoder; td->uper_encoder = asn_DEF_T4.uper_encoder; + td->aper_decoder = asn_DEF_T4.aper_decoder; + td->aper_encoder = asn_DEF_T4.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T4.per_constraints; td->elements = asn_DEF_T4.elements; @@ -387,7 +395,8 @@ asn_TYPE_descriptor_t asn_DEF_T3 = { T3_encode_der, T3_decode_xer, T3_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T3_tags_1, sizeof(asn_DEF_T3_tags_1) @@ -445,6 +454,8 @@ T4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_T5.xer_encoder; td->uper_decoder = asn_DEF_T5.uper_decoder; td->uper_encoder = asn_DEF_T5.uper_encoder; + td->aper_decoder = asn_DEF_T5.aper_decoder; + td->aper_encoder = asn_DEF_T5.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T5.per_constraints; td->elements = asn_DEF_T5.elements; @@ -514,7 +525,8 @@ asn_TYPE_descriptor_t asn_DEF_T4 = { T4_encode_der, T4_decode_xer, T4_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T4_tags_1, sizeof(asn_DEF_T4_tags_1) @@ -572,6 +584,8 @@ T5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_T6.xer_encoder; td->uper_decoder = asn_DEF_T6.uper_decoder; td->uper_encoder = asn_DEF_T6.uper_encoder; + td->aper_decoder = asn_DEF_T6.aper_decoder; + td->aper_encoder = asn_DEF_T6.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T6.per_constraints; td->elements = asn_DEF_T6.elements; @@ -640,7 +654,8 @@ asn_TYPE_descriptor_t asn_DEF_T5 = { T5_encode_der, T5_decode_xer, T5_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T5_tags_1, sizeof(asn_DEF_T5_tags_1) @@ -698,6 +713,8 @@ T6_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeReal.xer_encoder; td->uper_decoder = asn_DEF_NativeReal.uper_decoder; td->uper_encoder = asn_DEF_NativeReal.uper_encoder; + td->aper_decoder = asn_DEF_NativeReal.aper_decoder; + td->aper_encoder = asn_DEF_NativeReal.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeReal.per_constraints; td->elements = asn_DEF_NativeReal.elements; @@ -765,7 +782,8 @@ asn_TYPE_descriptor_t asn_DEF_T6 = { T6_encode_der, T6_decode_xer, T6_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T6_tags_1, sizeof(asn_DEF_T6_tags_1) @@ -823,6 +841,8 @@ T_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Ts.xer_encoder; td->uper_decoder = asn_DEF_Ts.uper_decoder; td->uper_encoder = asn_DEF_Ts.uper_encoder; + td->aper_decoder = asn_DEF_Ts.aper_decoder; + td->aper_encoder = asn_DEF_Ts.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Ts.per_constraints; td->elements = asn_DEF_Ts.elements; @@ -892,7 +912,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { T_encode_der, T_decode_xer, T_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) @@ -986,7 +1007,8 @@ asn_TYPE_descriptor_t asn_DEF_Ts = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Ts_tags_1, sizeof(asn_DEF_Ts_tags_1) diff --git a/tests/65-multi-tag-OK.asn1.-Pfwide-types b/tests/65-multi-tag-OK.asn1.-Pfwide-types index 1ef1cd949..ae083179b 100644 --- a/tests/65-multi-tag-OK.asn1.-Pfwide-types +++ b/tests/65-multi-tag-OK.asn1.-Pfwide-types @@ -43,6 +43,8 @@ T1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_T2.xer_encoder; td->uper_decoder = asn_DEF_T2.uper_decoder; td->uper_encoder = asn_DEF_T2.uper_encoder; + td->aper_decoder = asn_DEF_T2.aper_decoder; + td->aper_encoder = asn_DEF_T2.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T2.per_constraints; td->elements = asn_DEF_T2.elements; @@ -121,7 +123,8 @@ asn_TYPE_descriptor_t asn_DEF_T1 = { T1_encode_der, T1_decode_xer, T1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T1_tags_1, sizeof(asn_DEF_T1_tags_1) @@ -179,6 +182,8 @@ T2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_T3.xer_encoder; td->uper_decoder = asn_DEF_T3.uper_decoder; td->uper_encoder = asn_DEF_T3.uper_encoder; + td->aper_decoder = asn_DEF_T3.aper_decoder; + td->aper_encoder = asn_DEF_T3.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T3.per_constraints; td->elements = asn_DEF_T3.elements; @@ -255,7 +260,8 @@ asn_TYPE_descriptor_t asn_DEF_T2 = { T2_encode_der, T2_decode_xer, T2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T2_tags_1, sizeof(asn_DEF_T2_tags_1) @@ -313,6 +319,8 @@ T3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_T4.xer_encoder; td->uper_decoder = asn_DEF_T4.uper_decoder; td->uper_encoder = asn_DEF_T4.uper_encoder; + td->aper_decoder = asn_DEF_T4.aper_decoder; + td->aper_encoder = asn_DEF_T4.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T4.per_constraints; td->elements = asn_DEF_T4.elements; @@ -387,7 +395,8 @@ asn_TYPE_descriptor_t asn_DEF_T3 = { T3_encode_der, T3_decode_xer, T3_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T3_tags_1, sizeof(asn_DEF_T3_tags_1) @@ -445,6 +454,8 @@ T4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_T5.xer_encoder; td->uper_decoder = asn_DEF_T5.uper_decoder; td->uper_encoder = asn_DEF_T5.uper_encoder; + td->aper_decoder = asn_DEF_T5.aper_decoder; + td->aper_encoder = asn_DEF_T5.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T5.per_constraints; td->elements = asn_DEF_T5.elements; @@ -514,7 +525,8 @@ asn_TYPE_descriptor_t asn_DEF_T4 = { T4_encode_der, T4_decode_xer, T4_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T4_tags_1, sizeof(asn_DEF_T4_tags_1) @@ -572,6 +584,8 @@ T5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_T6.xer_encoder; td->uper_decoder = asn_DEF_T6.uper_decoder; td->uper_encoder = asn_DEF_T6.uper_encoder; + td->aper_decoder = asn_DEF_T6.aper_decoder; + td->aper_encoder = asn_DEF_T6.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_T6.per_constraints; td->elements = asn_DEF_T6.elements; @@ -640,7 +654,8 @@ asn_TYPE_descriptor_t asn_DEF_T5 = { T5_encode_der, T5_decode_xer, T5_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T5_tags_1, sizeof(asn_DEF_T5_tags_1) @@ -698,6 +713,8 @@ T6_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_REAL.xer_encoder; td->uper_decoder = asn_DEF_REAL.uper_decoder; td->uper_encoder = asn_DEF_REAL.uper_encoder; + td->aper_decoder = asn_DEF_REAL.aper_decoder; + td->aper_encoder = asn_DEF_REAL.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_REAL.per_constraints; td->elements = asn_DEF_REAL.elements; @@ -765,7 +782,8 @@ asn_TYPE_descriptor_t asn_DEF_T6 = { T6_encode_der, T6_decode_xer, T6_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T6_tags_1, sizeof(asn_DEF_T6_tags_1) @@ -823,6 +841,8 @@ T_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Ts.xer_encoder; td->uper_decoder = asn_DEF_Ts.uper_decoder; td->uper_encoder = asn_DEF_Ts.uper_encoder; + td->aper_decoder = asn_DEF_Ts.aper_decoder; + td->aper_encoder = asn_DEF_Ts.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Ts.per_constraints; td->elements = asn_DEF_Ts.elements; @@ -892,7 +912,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { T_encode_der, T_decode_xer, T_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) @@ -986,7 +1007,8 @@ asn_TYPE_descriptor_t asn_DEF_Ts = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Ts_tags_1, sizeof(asn_DEF_Ts_tags_1) diff --git a/tests/66-ref-simple-OK.asn1.-Pfwide-types b/tests/66-ref-simple-OK.asn1.-Pfwide-types index c15eae2c0..f8c4f800d 100644 --- a/tests/66-ref-simple-OK.asn1.-Pfwide-types +++ b/tests/66-ref-simple-OK.asn1.-Pfwide-types @@ -49,7 +49,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) @@ -116,6 +117,8 @@ SimpleType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + td->aper_decoder = asn_DEF_ENUMERATED.aper_decoder; + td->aper_encoder = asn_DEF_ENUMERATED.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; @@ -202,7 +205,8 @@ asn_TYPE_descriptor_t asn_DEF_SimpleType = { SimpleType_encode_der, SimpleType_decode_xer, SimpleType_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SimpleType_tags_1, sizeof(asn_DEF_SimpleType_tags_1) diff --git a/tests/69-reserved-words-OK.asn1.-Pfwide-types b/tests/69-reserved-words-OK.asn1.-Pfwide-types index f7dad6fee..5e65ca492 100644 --- a/tests/69-reserved-words-OK.asn1.-Pfwide-types +++ b/tests/69-reserved-words-OK.asn1.-Pfwide-types @@ -61,7 +61,7 @@ memb_char_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, size = st->size; - if((size == 1)) { + if((size == 1LL)) { /* Constraint check succeeded */ return 0; } else { @@ -103,7 +103,8 @@ asn_TYPE_descriptor_t asn_DEF_class_4 = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_class_tags_4, sizeof(asn_DEF_class_tags_4) @@ -182,7 +183,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) diff --git a/tests/70-xer-test-OK.asn1.-Pfwide-types b/tests/70-xer-test-OK.asn1.-Pfwide-types index 4d29ae020..230d1ce46 100644 --- a/tests/70-xer-test-OK.asn1.-Pfwide-types +++ b/tests/70-xer-test-OK.asn1.-Pfwide-types @@ -251,7 +251,8 @@ asn_TYPE_descriptor_t asn_DEF_PDU = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -363,7 +364,8 @@ asn_TYPE_descriptor_t asn_DEF_Sequence = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Sequence_tags_1, sizeof(asn_DEF_Sequence_tags_1) @@ -466,7 +468,8 @@ asn_TYPE_descriptor_t asn_DEF_Set = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Set_tags_1, sizeof(asn_DEF_Set_tags_1) @@ -550,6 +553,8 @@ enum_4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + td->aper_decoder = asn_DEF_ENUMERATED.aper_decoder; + td->aper_encoder = asn_DEF_ENUMERATED.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; @@ -636,7 +641,8 @@ asn_TYPE_descriptor_t asn_DEF_enum_4 = { enum_4_encode_der, enum_4_decode_xer, enum_4_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_enum_tags_4, sizeof(asn_DEF_enum_tags_4) @@ -700,7 +706,8 @@ asn_TYPE_descriptor_t asn_DEF_ExtensibleSet = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ExtensibleSet_tags_1, sizeof(asn_DEF_ExtensibleSet_tags_1) @@ -799,7 +806,8 @@ asn_TYPE_descriptor_t asn_DEF_ExtensibleSequence = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ExtensibleSequence_tags_1, sizeof(asn_DEF_ExtensibleSequence_tags_1) @@ -886,7 +894,8 @@ asn_TYPE_descriptor_t asn_DEF_ExtensibleSequence2 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ExtensibleSequence2_tags_1, sizeof(asn_DEF_ExtensibleSequence2_tags_1) @@ -951,7 +960,8 @@ asn_TYPE_descriptor_t asn_DEF_SetOfNULL = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SetOfNULL_tags_1, sizeof(asn_DEF_SetOfNULL_tags_1) @@ -1016,7 +1026,8 @@ asn_TYPE_descriptor_t asn_DEF_SetOfREAL = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SetOfREAL_tags_1, sizeof(asn_DEF_SetOfREAL_tags_1) @@ -1083,6 +1094,8 @@ Member_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + td->aper_decoder = asn_DEF_ENUMERATED.aper_decoder; + td->aper_encoder = asn_DEF_ENUMERATED.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; @@ -1168,7 +1181,8 @@ asn_TYPE_descriptor_t asn_DEF_Member_2 = { Member_2_encode_der, Member_2_decode_xer, Member_2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Member_tags_2, sizeof(asn_DEF_Member_tags_2) @@ -1210,7 +1224,8 @@ asn_TYPE_descriptor_t asn_DEF_SetOfEnums = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SetOfEnums_tags_1, sizeof(asn_DEF_SetOfEnums_tags_1) @@ -1275,7 +1290,8 @@ asn_TYPE_descriptor_t asn_DEF_NamedSetOfNULL = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NamedSetOfNULL_tags_1, sizeof(asn_DEF_NamedSetOfNULL_tags_1) @@ -1340,7 +1356,8 @@ asn_TYPE_descriptor_t asn_DEF_NamedSetOfREAL = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NamedSetOfREAL_tags_1, sizeof(asn_DEF_NamedSetOfREAL_tags_1) @@ -1407,6 +1424,8 @@ name_2_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + td->aper_decoder = asn_DEF_ENUMERATED.aper_decoder; + td->aper_encoder = asn_DEF_ENUMERATED.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; @@ -1492,7 +1511,8 @@ asn_TYPE_descriptor_t asn_DEF_name_2 = { name_2_encode_der, name_2_decode_xer, name_2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_name_tags_2, sizeof(asn_DEF_name_tags_2) @@ -1534,7 +1554,8 @@ asn_TYPE_descriptor_t asn_DEF_NamedSetOfEnums = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NamedSetOfEnums_tags_1, sizeof(asn_DEF_NamedSetOfEnums_tags_1) @@ -1599,7 +1620,8 @@ asn_TYPE_descriptor_t asn_DEF_SequenceOf = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SequenceOf_tags_1, sizeof(asn_DEF_SequenceOf_tags_1) @@ -1664,7 +1686,8 @@ asn_TYPE_descriptor_t asn_DEF_SeqOfZuka = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SeqOfZuka_tags_1, sizeof(asn_DEF_SeqOfZuka_tags_1) @@ -1736,7 +1759,8 @@ asn_TYPE_descriptor_t asn_DEF_SetOfChoice = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_SetOfChoice_tags_1, sizeof(asn_DEF_SetOfChoice_tags_1) @@ -1808,7 +1832,8 @@ asn_TYPE_descriptor_t asn_DEF_NamedSetOfChoice = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NamedSetOfChoice_tags_1, sizeof(asn_DEF_NamedSetOfChoice_tags_1) @@ -1900,7 +1925,8 @@ asn_TYPE_descriptor_t asn_DEF_SimpleChoice = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ diff --git a/tests/72-same-names-OK.asn1.-Pfwide-types b/tests/72-same-names-OK.asn1.-Pfwide-types index 7560c6a3a..47923c3fe 100644 --- a/tests/72-same-names-OK.asn1.-Pfwide-types +++ b/tests/72-same-names-OK.asn1.-Pfwide-types @@ -76,7 +76,8 @@ asn_TYPE_descriptor_t asn_DEF_Member_2 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Member_tags_2, sizeof(asn_DEF_Member_tags_2) @@ -119,7 +120,8 @@ asn_TYPE_descriptor_t asn_DEF_Type = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Type_tags_1, sizeof(asn_DEF_Type_tags_1) @@ -223,7 +225,8 @@ asn_TYPE_descriptor_t asn_DEF_another_name_3 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_another_name_tags_3, sizeof(asn_DEF_another_name_tags_3) @@ -272,7 +275,8 @@ asn_TYPE_descriptor_t asn_DEF_one_name_2 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -320,7 +324,8 @@ asn_TYPE_descriptor_t asn_DEF_Type1 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Type1_tags_1, sizeof(asn_DEF_Type1_tags_1) @@ -429,7 +434,7 @@ memb_a_constraint_3(asn_TYPE_descriptor_t *td, const void *sptr, size = 0; } - if((size == 2)) { + if((size == 2LL)) { /* Constraint check succeeded */ return 0; } else { @@ -460,7 +465,7 @@ memb_a_constraint_8(asn_TYPE_descriptor_t *td, const void *sptr, size = 0; } - if((size == 2)) { + if((size == 2LL)) { /* Constraint check succeeded */ return 0; } else { @@ -521,7 +526,8 @@ asn_TYPE_descriptor_t asn_DEF_another_name_3 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_another_name_tags_3, sizeof(asn_DEF_another_name_tags_3) @@ -572,7 +578,8 @@ asn_TYPE_descriptor_t asn_DEF_one_name_2 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_one_name_tags_2, sizeof(asn_DEF_one_name_tags_2) @@ -633,7 +640,8 @@ asn_TYPE_descriptor_t asn_DEF_another_name_8 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_another_name_tags_8, sizeof(asn_DEF_another_name_tags_8) @@ -689,7 +697,8 @@ asn_TYPE_descriptor_t asn_DEF_two_name_7 = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_two_name_tags_7, sizeof(asn_DEF_two_name_tags_7) @@ -747,7 +756,8 @@ asn_TYPE_descriptor_t asn_DEF_Type2 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ diff --git a/tests/73-circular-OK.asn1.-Pfwide-types b/tests/73-circular-OK.asn1.-Pfwide-types index 7f5134fd7..bb42973f0 100644 --- a/tests/73-circular-OK.asn1.-Pfwide-types +++ b/tests/73-circular-OK.asn1.-Pfwide-types @@ -63,7 +63,8 @@ asn_TYPE_descriptor_t asn_DEF_data_2 = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_data_tags_2, sizeof(asn_DEF_data_tags_2) @@ -113,7 +114,8 @@ asn_TYPE_descriptor_t asn_DEF_Type = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Type_tags_1, sizeof(asn_DEF_Type_tags_1) @@ -172,6 +174,8 @@ EpytRef_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Epyt.xer_encoder; td->uper_decoder = asn_DEF_Epyt.uper_decoder; td->uper_encoder = asn_DEF_Epyt.uper_encoder; + td->aper_decoder = asn_DEF_Epyt.aper_decoder; + td->aper_encoder = asn_DEF_Epyt.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Epyt.per_constraints; td->elements = asn_DEF_Epyt.elements; @@ -239,7 +243,8 @@ asn_TYPE_descriptor_t asn_DEF_EpytRef = { EpytRef_encode_der, EpytRef_decode_xer, EpytRef_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_EpytRef_tags_1, sizeof(asn_DEF_EpytRef_tags_1) @@ -321,7 +326,8 @@ asn_TYPE_descriptor_t asn_DEF_stype_2 = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_stype_tags_2, sizeof(asn_DEF_stype_tags_2) @@ -391,7 +397,8 @@ asn_TYPE_descriptor_t asn_DEF_Epyt = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Epyt_tags_1, sizeof(asn_DEF_Epyt_tags_1) @@ -473,7 +480,7 @@ static int check_permitted_alphabet_6(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 65 && cv <= 90)) return -1; + if(!(cv >= 65LL && cv <= 90LL)) return -1; } return 0; } @@ -486,7 +493,7 @@ static int check_permitted_alphabet_7(const void *sptr) { for(; ch < end; ch++) { uint8_t cv = *ch; - if(!(cv >= 97 && cv <= 122)) return -1; + if(!(cv >= 97LL && cv <= 122LL)) return -1; } return 0; } @@ -556,7 +563,7 @@ static int asn_DFL_3_set_7(int set_value, void **sptr) { if(set_value) { /* Install default value 7 */ - return asn_long2INTEGER(st, 7); + return asn_long2INTEGER(st, 7l); } else { /* Test default value 7 */ long value; @@ -595,7 +602,8 @@ asn_TYPE_descriptor_t asn_DEF_senums_4 = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_senums_tags_4, sizeof(asn_DEF_senums_tags_4) @@ -690,7 +698,8 @@ asn_TYPE_descriptor_t asn_DEF_Ypet = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Ypet_tags_1, sizeof(asn_DEF_Ypet_tags_1) @@ -756,6 +765,8 @@ EnumType_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_ENUMERATED.xer_encoder; td->uper_decoder = asn_DEF_ENUMERATED.uper_decoder; td->uper_encoder = asn_DEF_ENUMERATED.uper_encoder; + td->aper_decoder = asn_DEF_ENUMERATED.aper_decoder; + td->aper_encoder = asn_DEF_ENUMERATED.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_ENUMERATED.per_constraints; td->elements = asn_DEF_ENUMERATED.elements; @@ -840,7 +851,8 @@ asn_TYPE_descriptor_t asn_DEF_EnumType = { EnumType_encode_der, EnumType_decode_xer, EnumType_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_EnumType_tags_1, sizeof(asn_DEF_EnumType_tags_1) diff --git a/tests/84-param-tags-OK.asn1.-Pfwide-types b/tests/84-param-tags-OK.asn1.-Pfwide-types index decc513c0..9efa77a89 100644 --- a/tests/84-param-tags-OK.asn1.-Pfwide-types +++ b/tests/84-param-tags-OK.asn1.-Pfwide-types @@ -30,7 +30,7 @@ extern asn_TYPE_descriptor_t asn_DEF_TestType_16P1; static int memb_common_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -39,9 +39,9 @@ memb_common_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= 1 && value <= 10)) { + if((value >= 1LL && value <= 10LL)) { /* Constraint check succeeded */ return 0; } else { @@ -66,7 +66,7 @@ static int asn_DFL_2_set_0(int set_value, void **sptr) { if(set_value) { /* Install default value 0 */ - *st = 0; + *st = 0l; return 0; } else { /* Test default value 0 */ @@ -109,7 +109,8 @@ asn_TYPE_descriptor_t asn_DEF_TestType_16P0 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TestType_16P0_tags_1, sizeof(asn_DEF_TestType_16P0_tags_1) @@ -134,7 +135,7 @@ static int asn_DFL_4_set_0(int set_value, void **sptr) { if(set_value) { /* Install default value 0 */ - *st = 0; + *st = 0l; return 0; } else { /* Test default value 0 */ @@ -177,7 +178,8 @@ asn_TYPE_descriptor_t asn_DEF_TestType_16P1 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TestType_16P1_tags_3, sizeof(asn_DEF_TestType_16P1_tags_3) @@ -268,7 +270,8 @@ asn_TYPE_descriptor_t asn_DEF_TestChoice = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -312,7 +315,7 @@ extern asn_TYPE_descriptor_t asn_DEF_AutoType_34P1; static int memb_common_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -321,9 +324,9 @@ memb_common_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value == 0)) { + if((value == 0LL)) { /* Constraint check succeeded */ return 0; } else { @@ -348,7 +351,7 @@ memb_common_constraint_3(asn_TYPE_descriptor_t *td, const void *sptr, value = (*(const long *)sptr) ? 1 : 0; - if((value <= 0)) { + if((value <= 0LL)) { /* Constraint check succeeded */ return 0; } else { @@ -398,7 +401,8 @@ asn_TYPE_descriptor_t asn_DEF_AutoType_34P0 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_AutoType_34P0_tags_1, sizeof(asn_DEF_AutoType_34P0_tags_1) @@ -448,7 +452,8 @@ asn_TYPE_descriptor_t asn_DEF_AutoType_34P1 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_AutoType_34P1_tags_3, sizeof(asn_DEF_AutoType_34P1_tags_3) @@ -539,7 +544,8 @@ asn_TYPE_descriptor_t asn_DEF_AutoChoice = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ diff --git a/tests/88-integer-enum-OK.asn1.-Pfwide-types b/tests/88-integer-enum-OK.asn1.-Pfwide-types index 9b19c1562..945ede0f8 100644 --- a/tests/88-integer-enum-OK.asn1.-Pfwide-types +++ b/tests/88-integer-enum-OK.asn1.-Pfwide-types @@ -50,6 +50,8 @@ T_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -117,7 +119,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { T_encode_der, T_decode_xer, T_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_T_tags_1, sizeof(asn_DEF_T_tags_1) diff --git a/tests/89-bit-string-enum-OK.asn1.-Pfcompound-names b/tests/89-bit-string-enum-OK.asn1.-Pfcompound-names index cbd2b96a2..adb8d81da 100644 --- a/tests/89-bit-string-enum-OK.asn1.-Pfcompound-names +++ b/tests/89-bit-string-enum-OK.asn1.-Pfcompound-names @@ -67,7 +67,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ diff --git a/tests/89-bit-string-enum-OK.asn1.-Pfwide-types b/tests/89-bit-string-enum-OK.asn1.-Pfwide-types index 3c4ea4047..3d38ecde2 100644 --- a/tests/89-bit-string-enum-OK.asn1.-Pfwide-types +++ b/tests/89-bit-string-enum-OK.asn1.-Pfwide-types @@ -67,7 +67,8 @@ asn_TYPE_descriptor_t asn_DEF_T = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ diff --git a/tests/90-cond-int-type-OK.asn1.-P b/tests/90-cond-int-type-OK.asn1.-P index c880941ce..661662281 100644 --- a/tests/90-cond-int-type-OK.asn1.-P +++ b/tests/90-cond-int-type-OK.asn1.-P @@ -43,6 +43,8 @@ CN_IntegerUnlimited_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -110,7 +112,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerUnlimited = { CN_IntegerUnlimited_encode_der, CN_IntegerUnlimited_decode_xer, CN_IntegerUnlimited_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerUnlimited_tags_1, sizeof(asn_DEF_CN_IntegerUnlimited_tags_1) @@ -181,6 +184,8 @@ CN_IntegerMinMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -248,7 +253,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinMax = { CN_IntegerMinMax_encode_der, CN_IntegerMinMax_decode_xer, CN_IntegerMinMax_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerMinMax_tags_1, sizeof(asn_DEF_CN_IntegerMinMax_tags_1) @@ -286,7 +292,7 @@ xer_type_encoder_f CN_IntegerMinLow_encode_xer; int CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -295,9 +301,9 @@ CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value <= 1)) { + if((value <= 1LL)) { /* Constraint check succeeded */ return 0; } else { @@ -323,6 +329,8 @@ CN_IntegerMinLow_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -390,7 +398,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinLow = { CN_IntegerMinLow_encode_der, CN_IntegerMinLow_decode_xer, CN_IntegerMinLow_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerMinLow_tags_1, sizeof(asn_DEF_CN_IntegerMinLow_tags_1) @@ -429,7 +438,7 @@ int NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -445,7 +454,7 @@ NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value <= 3000000000)) { + if((value <= 3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -471,6 +480,8 @@ NO_IntegerMinHigh_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -538,7 +549,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerMinHigh = { NO_IntegerMinHigh_encode_der, NO_IntegerMinHigh_decode_xer, NO_IntegerMinHigh_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerMinHigh_tags_1, sizeof(asn_DEF_NO_IntegerMinHigh_tags_1) @@ -576,7 +588,7 @@ xer_type_encoder_f NO_IntegerLowHigh_encode_xer; int NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - unsigned long value; + unsigned long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -585,9 +597,9 @@ NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const unsigned long *)sptr; + value = *(const unsigned long long *)sptr; - if((value >= 1 && value <= 3000000000)) { + if((value >= 1LL && value <= 3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -613,6 +625,8 @@ NO_IntegerLowHigh_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -685,7 +699,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowHigh = { NO_IntegerLowHigh_encode_der, NO_IntegerLowHigh_decode_xer, NO_IntegerLowHigh_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerLowHigh_tags_1, sizeof(asn_DEF_NO_IntegerLowHigh_tags_1) @@ -723,7 +738,7 @@ xer_type_encoder_f CN_IntegerLowMax_encode_xer; int CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -732,9 +747,9 @@ CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= 1)) { + if((value >= 1LL)) { /* Constraint check succeeded */ return 0; } else { @@ -760,6 +775,8 @@ CN_IntegerLowMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -827,7 +844,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerLowMax = { CN_IntegerLowMax_encode_der, CN_IntegerLowMax_decode_xer, CN_IntegerLowMax_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerLowMax_tags_1, sizeof(asn_DEF_CN_IntegerLowMax_tags_1) @@ -866,7 +884,7 @@ int NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -882,7 +900,7 @@ NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= 3000000000)) { + if((value >= 3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -908,6 +926,8 @@ NO_IntegerHighMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -975,7 +995,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerHighMax = { NO_IntegerHighMax_encode_der, NO_IntegerHighMax_decode_xer, NO_IntegerHighMax_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerHighMax_tags_1, sizeof(asn_DEF_NO_IntegerHighMax_tags_1) @@ -1014,7 +1035,7 @@ int NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1030,7 +1051,7 @@ NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= -3000000000)) { + if((value >= -3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1056,6 +1077,8 @@ NO_IntegerLowestMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -1123,7 +1146,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowestMax = { NO_IntegerLowestMax_encode_der, NO_IntegerLowestMax_decode_xer, NO_IntegerLowestMax_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerLowestMax_tags_1, sizeof(asn_DEF_NO_IntegerLowestMax_tags_1) @@ -1161,7 +1185,7 @@ xer_type_encoder_f NO_IntegerOutRange_encode_xer; int NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - unsigned long value; + unsigned long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1170,9 +1194,9 @@ NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const unsigned long *)sptr; + value = *(const unsigned long long *)sptr; - if((value >= 3000000000 && value <= 3000000001)) { + if((value >= 3000000000LL && value <= 3000000001LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1198,6 +1222,8 @@ NO_IntegerOutRange_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1270,7 +1296,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutRange = { NO_IntegerOutRange_encode_der, NO_IntegerOutRange_decode_xer, NO_IntegerOutRange_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerOutRange_tags_1, sizeof(asn_DEF_NO_IntegerOutRange_tags_1) @@ -1308,7 +1335,7 @@ xer_type_encoder_f NO_IntegerOutValue_encode_xer; int NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - unsigned long value; + unsigned long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1317,9 +1344,9 @@ NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const unsigned long *)sptr; + value = *(const unsigned long long *)sptr; - if((value == 3000000000)) { + if((value == 3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1345,6 +1372,8 @@ NO_IntegerOutValue_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1417,7 +1446,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutValue = { NO_IntegerOutValue_encode_der, NO_IntegerOutValue_decode_xer, NO_IntegerOutValue_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerOutValue_tags_1, sizeof(asn_DEF_NO_IntegerOutValue_tags_1) @@ -1455,7 +1485,7 @@ xer_type_encoder_f OK_IntegerInRange1_encode_xer; int OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1464,9 +1494,9 @@ OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= -100 && value <= 100)) { + if((value >= -100LL && value <= 100LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1492,6 +1522,8 @@ OK_IntegerInRange1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1559,7 +1591,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange1 = { OK_IntegerInRange1_encode_der, OK_IntegerInRange1_decode_xer, OK_IntegerInRange1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange1_tags_1, sizeof(asn_DEF_OK_IntegerInRange1_tags_1) @@ -1597,7 +1630,7 @@ xer_type_encoder_f OK_IntegerInRange2_encode_xer; int OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1606,9 +1639,9 @@ OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if(((value == -100) || (value == 100))) { + if(((value == -100LL) || (value == 100LL))) { /* Constraint check succeeded */ return 0; } else { @@ -1634,6 +1667,8 @@ OK_IntegerInRange2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1701,7 +1736,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange2 = { OK_IntegerInRange2_encode_der, OK_IntegerInRange2_decode_xer, OK_IntegerInRange2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange2_tags_1, sizeof(asn_DEF_OK_IntegerInRange2_tags_1) @@ -1739,7 +1775,7 @@ xer_type_encoder_f OK_IntegerInRange3_encode_xer; int OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1748,9 +1784,9 @@ OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= (-2147483647L - 1) && value <= 2147483647)) { + if((value >= -2147483648LL && value <= 2147483647LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1776,6 +1812,8 @@ OK_IntegerInRange3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1843,7 +1881,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange3 = { OK_IntegerInRange3_encode_der, OK_IntegerInRange3_decode_xer, OK_IntegerInRange3_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange3_tags_1, sizeof(asn_DEF_OK_IntegerInRange3_tags_1) @@ -1881,7 +1920,7 @@ xer_type_encoder_f OK_IntegerInRange4_encode_xer; int OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1890,9 +1929,9 @@ OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if(((value == (-2147483647L - 1)) || (value == 2147483647))) { + if(((value == -2147483648LL) || (value == 2147483647LL))) { /* Constraint check succeeded */ return 0; } else { @@ -1918,6 +1957,8 @@ OK_IntegerInRange4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1985,7 +2026,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange4 = { OK_IntegerInRange4_encode_der, OK_IntegerInRange4_decode_xer, OK_IntegerInRange4_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange4_tags_1, sizeof(asn_DEF_OK_IntegerInRange4_tags_1) @@ -2023,7 +2065,7 @@ xer_type_encoder_f OK_IntegerInRange5_encode_xer; int OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -2032,9 +2074,9 @@ OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if(((value == (-2147483647L - 1)) || (value == 2147483647))) { + if(((value == -2147483648LL) || (value == 2147483647LL))) { /* Constraint check succeeded */ return 0; } else { @@ -2060,6 +2102,8 @@ OK_IntegerInRange5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -2127,7 +2171,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange5 = { OK_IntegerInRange5_encode_der, OK_IntegerInRange5_decode_xer, OK_IntegerInRange5_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange5_tags_1, sizeof(asn_DEF_OK_IntegerInRange5_tags_1) @@ -2193,6 +2238,8 @@ NO_IntegerInRange6_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -2265,7 +2312,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerInRange6 = { NO_IntegerInRange6_encode_der, NO_IntegerInRange6_decode_xer, NO_IntegerInRange6_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerInRange6_tags_1, sizeof(asn_DEF_NO_IntegerInRange6_tags_1) @@ -2330,6 +2378,8 @@ CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -2397,7 +2447,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerEnumerated1 = { CN_IntegerEnumerated1_encode_der, CN_IntegerEnumerated1_decode_xer, CN_IntegerEnumerated1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerEnumerated1_tags_1, sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1) @@ -2462,6 +2513,8 @@ NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -2529,7 +2582,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerEnumerated2 = { NO_IntegerEnumerated2_encode_der, NO_IntegerEnumerated2_decode_xer, NO_IntegerEnumerated2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerEnumerated2_tags_1, sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1) diff --git a/tests/90-cond-int-type-OK.asn1.-Pfwide-types b/tests/90-cond-int-type-OK.asn1.-Pfwide-types index f170d99bd..7b91663a5 100644 --- a/tests/90-cond-int-type-OK.asn1.-Pfwide-types +++ b/tests/90-cond-int-type-OK.asn1.-Pfwide-types @@ -43,6 +43,8 @@ CN_IntegerUnlimited_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -110,7 +112,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerUnlimited = { CN_IntegerUnlimited_encode_der, CN_IntegerUnlimited_decode_xer, CN_IntegerUnlimited_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerUnlimited_tags_1, sizeof(asn_DEF_CN_IntegerUnlimited_tags_1) @@ -182,6 +185,8 @@ CN_IntegerMinMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -249,7 +254,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinMax = { CN_IntegerMinMax_encode_der, CN_IntegerMinMax_decode_xer, CN_IntegerMinMax_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerMinMax_tags_1, sizeof(asn_DEF_CN_IntegerMinMax_tags_1) @@ -288,7 +294,7 @@ int CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -304,7 +310,7 @@ CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value <= 1)) { + if((value <= 1LL)) { /* Constraint check succeeded */ return 0; } else { @@ -330,6 +336,8 @@ CN_IntegerMinLow_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -397,7 +405,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinLow = { CN_IntegerMinLow_encode_der, CN_IntegerMinLow_decode_xer, CN_IntegerMinLow_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerMinLow_tags_1, sizeof(asn_DEF_CN_IntegerMinLow_tags_1) @@ -436,7 +445,7 @@ int NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -452,7 +461,7 @@ NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value <= 3000000000)) { + if((value <= 3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -478,6 +487,8 @@ NO_IntegerMinHigh_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -545,7 +556,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerMinHigh = { NO_IntegerMinHigh_encode_der, NO_IntegerMinHigh_decode_xer, NO_IntegerMinHigh_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerMinHigh_tags_1, sizeof(asn_DEF_NO_IntegerMinHigh_tags_1) @@ -583,7 +595,7 @@ xer_type_encoder_f NO_IntegerLowHigh_encode_xer; int NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - unsigned long value; + unsigned long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -592,9 +604,9 @@ NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const unsigned long *)sptr; + value = *(const unsigned long long *)sptr; - if((value >= 1 && value <= 3000000000)) { + if((value >= 1LL && value <= 3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -620,6 +632,8 @@ NO_IntegerLowHigh_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -692,7 +706,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowHigh = { NO_IntegerLowHigh_encode_der, NO_IntegerLowHigh_decode_xer, NO_IntegerLowHigh_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerLowHigh_tags_1, sizeof(asn_DEF_NO_IntegerLowHigh_tags_1) @@ -731,7 +746,7 @@ int CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -747,7 +762,7 @@ CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= 1)) { + if((value >= 1LL)) { /* Constraint check succeeded */ return 0; } else { @@ -773,6 +788,8 @@ CN_IntegerLowMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -840,7 +857,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerLowMax = { CN_IntegerLowMax_encode_der, CN_IntegerLowMax_decode_xer, CN_IntegerLowMax_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerLowMax_tags_1, sizeof(asn_DEF_CN_IntegerLowMax_tags_1) @@ -879,7 +897,7 @@ int NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -895,7 +913,7 @@ NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= 3000000000)) { + if((value >= 3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -921,6 +939,8 @@ NO_IntegerHighMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -988,7 +1008,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerHighMax = { NO_IntegerHighMax_encode_der, NO_IntegerHighMax_decode_xer, NO_IntegerHighMax_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerHighMax_tags_1, sizeof(asn_DEF_NO_IntegerHighMax_tags_1) @@ -1027,7 +1048,7 @@ int NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1043,7 +1064,7 @@ NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= -3000000000)) { + if((value >= -3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1069,6 +1090,8 @@ NO_IntegerLowestMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -1136,7 +1159,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowestMax = { NO_IntegerLowestMax_encode_der, NO_IntegerLowestMax_decode_xer, NO_IntegerLowestMax_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerLowestMax_tags_1, sizeof(asn_DEF_NO_IntegerLowestMax_tags_1) @@ -1174,7 +1198,7 @@ xer_type_encoder_f NO_IntegerOutRange_encode_xer; int NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - unsigned long value; + unsigned long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1183,9 +1207,9 @@ NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const unsigned long *)sptr; + value = *(const unsigned long long *)sptr; - if((value >= 3000000000 && value <= 3000000001)) { + if((value >= 3000000000LL && value <= 3000000001LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1211,6 +1235,8 @@ NO_IntegerOutRange_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1283,7 +1309,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutRange = { NO_IntegerOutRange_encode_der, NO_IntegerOutRange_decode_xer, NO_IntegerOutRange_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerOutRange_tags_1, sizeof(asn_DEF_NO_IntegerOutRange_tags_1) @@ -1321,7 +1348,7 @@ xer_type_encoder_f NO_IntegerOutValue_encode_xer; int NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - unsigned long value; + unsigned long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1330,9 +1357,9 @@ NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const unsigned long *)sptr; + value = *(const unsigned long long *)sptr; - if((value == 3000000000)) { + if((value == 3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1358,6 +1385,8 @@ NO_IntegerOutValue_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1430,7 +1459,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutValue = { NO_IntegerOutValue_encode_der, NO_IntegerOutValue_decode_xer, NO_IntegerOutValue_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerOutValue_tags_1, sizeof(asn_DEF_NO_IntegerOutValue_tags_1) @@ -1468,7 +1498,7 @@ xer_type_encoder_f OK_IntegerInRange1_encode_xer; int OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1477,9 +1507,9 @@ OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= -100 && value <= 100)) { + if((value >= -100LL && value <= 100LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1505,6 +1535,8 @@ OK_IntegerInRange1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1572,7 +1604,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange1 = { OK_IntegerInRange1_encode_der, OK_IntegerInRange1_decode_xer, OK_IntegerInRange1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange1_tags_1, sizeof(asn_DEF_OK_IntegerInRange1_tags_1) @@ -1610,7 +1643,7 @@ xer_type_encoder_f OK_IntegerInRange2_encode_xer; int OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1619,9 +1652,9 @@ OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if(((value == -100) || (value == 100))) { + if(((value == -100LL) || (value == 100LL))) { /* Constraint check succeeded */ return 0; } else { @@ -1647,6 +1680,8 @@ OK_IntegerInRange2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1714,7 +1749,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange2 = { OK_IntegerInRange2_encode_der, OK_IntegerInRange2_decode_xer, OK_IntegerInRange2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange2_tags_1, sizeof(asn_DEF_OK_IntegerInRange2_tags_1) @@ -1752,7 +1788,7 @@ xer_type_encoder_f OK_IntegerInRange3_encode_xer; int OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1761,9 +1797,9 @@ OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= (-2147483647L - 1) && value <= 2147483647)) { + if((value >= -2147483648LL && value <= 2147483647LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1789,6 +1825,8 @@ OK_IntegerInRange3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1856,7 +1894,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange3 = { OK_IntegerInRange3_encode_der, OK_IntegerInRange3_decode_xer, OK_IntegerInRange3_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange3_tags_1, sizeof(asn_DEF_OK_IntegerInRange3_tags_1) @@ -1894,7 +1933,7 @@ xer_type_encoder_f OK_IntegerInRange4_encode_xer; int OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1903,9 +1942,9 @@ OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if(((value == (-2147483647L - 1)) || (value == 2147483647))) { + if(((value == -2147483648LL) || (value == 2147483647LL))) { /* Constraint check succeeded */ return 0; } else { @@ -1931,6 +1970,8 @@ OK_IntegerInRange4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1998,7 +2039,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange4 = { OK_IntegerInRange4_encode_der, OK_IntegerInRange4_decode_xer, OK_IntegerInRange4_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange4_tags_1, sizeof(asn_DEF_OK_IntegerInRange4_tags_1) @@ -2037,7 +2079,7 @@ int OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -2053,7 +2095,7 @@ OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if(((value == (-2147483647L - 1)) || (value == 2147483647))) { + if(((value == -2147483648LL) || (value == 2147483647LL))) { /* Constraint check succeeded */ return 0; } else { @@ -2079,6 +2121,8 @@ OK_IntegerInRange5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -2146,7 +2190,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange5 = { OK_IntegerInRange5_encode_der, OK_IntegerInRange5_decode_xer, OK_IntegerInRange5_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange5_tags_1, sizeof(asn_DEF_OK_IntegerInRange5_tags_1) @@ -2212,6 +2257,8 @@ NO_IntegerInRange6_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -2284,7 +2331,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerInRange6 = { NO_IntegerInRange6_encode_der, NO_IntegerInRange6_decode_xer, NO_IntegerInRange6_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerInRange6_tags_1, sizeof(asn_DEF_NO_IntegerInRange6_tags_1) @@ -2349,6 +2397,8 @@ CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -2416,7 +2466,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerEnumerated1 = { CN_IntegerEnumerated1_encode_der, CN_IntegerEnumerated1_decode_xer, CN_IntegerEnumerated1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerEnumerated1_tags_1, sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1) @@ -2481,6 +2532,8 @@ NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -2548,7 +2601,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerEnumerated2 = { NO_IntegerEnumerated2_encode_der, NO_IntegerEnumerated2_decode_xer, NO_IntegerEnumerated2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerEnumerated2_tags_1, sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1) diff --git a/tests/90-cond-int-type-OK.asn1.-Pgen-PER b/tests/90-cond-int-type-OK.asn1.-Pgen-PER index 0e4834e3d..1fb41ae24 100644 --- a/tests/90-cond-int-type-OK.asn1.-Pgen-PER +++ b/tests/90-cond-int-type-OK.asn1.-Pgen-PER @@ -19,6 +19,8 @@ xer_type_decoder_f CN_IntegerUnlimited_decode_xer; xer_type_encoder_f CN_IntegerUnlimited_encode_xer; per_type_decoder_f CN_IntegerUnlimited_decode_uper; per_type_encoder_f CN_IntegerUnlimited_encode_uper; +per_type_decoder_f CN_IntegerUnlimited_decode_aper; +per_type_encoder_f CN_IntegerUnlimited_encode_aper; /*** <<< CODE [CN-IntegerUnlimited] >>> ***/ @@ -45,6 +47,8 @@ CN_IntegerUnlimited_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -111,6 +115,21 @@ CN_IntegerUnlimited_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +CN_IntegerUnlimited_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +CN_IntegerUnlimited_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + CN_IntegerUnlimited_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< STAT-DEFS [CN-IntegerUnlimited] >>> ***/ @@ -129,6 +148,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerUnlimited = { CN_IntegerUnlimited_encode_xer, CN_IntegerUnlimited_decode_uper, CN_IntegerUnlimited_encode_uper, + CN_IntegerUnlimited_decode_aper, + CN_IntegerUnlimited_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerUnlimited_tags_1, sizeof(asn_DEF_CN_IntegerUnlimited_tags_1) @@ -162,6 +183,8 @@ xer_type_decoder_f CN_IntegerMinMax_decode_xer; xer_type_encoder_f CN_IntegerMinMax_encode_xer; per_type_decoder_f CN_IntegerMinMax_decode_uper; per_type_encoder_f CN_IntegerMinMax_encode_uper; +per_type_decoder_f CN_IntegerMinMax_decode_aper; +per_type_encoder_f CN_IntegerMinMax_encode_aper; /*** <<< CODE [CN-IntegerMinMax] >>> ***/ @@ -201,6 +224,8 @@ CN_IntegerMinMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -267,6 +292,21 @@ CN_IntegerMinMax_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +CN_IntegerMinMax_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +CN_IntegerMinMax_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + CN_IntegerMinMax_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [CN-IntegerMinMax] >>> ***/ @@ -293,6 +333,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinMax = { CN_IntegerMinMax_encode_xer, CN_IntegerMinMax_decode_uper, CN_IntegerMinMax_encode_uper, + CN_IntegerMinMax_decode_aper, + CN_IntegerMinMax_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerMinMax_tags_1, sizeof(asn_DEF_CN_IntegerMinMax_tags_1) @@ -326,13 +368,15 @@ xer_type_decoder_f CN_IntegerMinLow_decode_xer; xer_type_encoder_f CN_IntegerMinLow_encode_xer; per_type_decoder_f CN_IntegerMinLow_decode_uper; per_type_encoder_f CN_IntegerMinLow_encode_uper; +per_type_decoder_f CN_IntegerMinLow_decode_aper; +per_type_encoder_f CN_IntegerMinLow_encode_aper; /*** <<< CODE [CN-IntegerMinLow] >>> ***/ int CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -341,9 +385,9 @@ CN_IntegerMinLow_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value <= 1)) { + if((value <= 1LL)) { /* Constraint check succeeded */ return 0; } else { @@ -369,6 +413,8 @@ CN_IntegerMinLow_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -435,6 +481,21 @@ CN_IntegerMinLow_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +CN_IntegerMinLow_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +CN_IntegerMinLow_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + CN_IntegerMinLow_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [CN-IntegerMinLow] >>> ***/ @@ -461,6 +522,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerMinLow = { CN_IntegerMinLow_encode_xer, CN_IntegerMinLow_decode_uper, CN_IntegerMinLow_encode_uper, + CN_IntegerMinLow_decode_aper, + CN_IntegerMinLow_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerMinLow_tags_1, sizeof(asn_DEF_CN_IntegerMinLow_tags_1) @@ -494,6 +557,8 @@ xer_type_decoder_f NO_IntegerMinHigh_decode_xer; xer_type_encoder_f NO_IntegerMinHigh_encode_xer; per_type_decoder_f NO_IntegerMinHigh_decode_uper; per_type_encoder_f NO_IntegerMinHigh_encode_uper; +per_type_decoder_f NO_IntegerMinHigh_decode_aper; +per_type_encoder_f NO_IntegerMinHigh_encode_aper; /*** <<< CODE [NO-IntegerMinHigh] >>> ***/ @@ -501,7 +566,7 @@ int NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -517,7 +582,7 @@ NO_IntegerMinHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value <= 3000000000)) { + if((value <= 3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -543,6 +608,8 @@ NO_IntegerMinHigh_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -609,6 +676,21 @@ NO_IntegerMinHigh_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +NO_IntegerMinHigh_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +NO_IntegerMinHigh_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + NO_IntegerMinHigh_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [NO-IntegerMinHigh] >>> ***/ @@ -635,6 +717,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerMinHigh = { NO_IntegerMinHigh_encode_xer, NO_IntegerMinHigh_decode_uper, NO_IntegerMinHigh_encode_uper, + NO_IntegerMinHigh_decode_aper, + NO_IntegerMinHigh_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerMinHigh_tags_1, sizeof(asn_DEF_NO_IntegerMinHigh_tags_1) @@ -668,13 +752,15 @@ xer_type_decoder_f NO_IntegerLowHigh_decode_xer; xer_type_encoder_f NO_IntegerLowHigh_encode_xer; per_type_decoder_f NO_IntegerLowHigh_decode_uper; per_type_encoder_f NO_IntegerLowHigh_encode_uper; +per_type_decoder_f NO_IntegerLowHigh_decode_aper; +per_type_encoder_f NO_IntegerLowHigh_encode_aper; /*** <<< CODE [NO-IntegerLowHigh] >>> ***/ int NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - unsigned long value; + unsigned long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -683,9 +769,9 @@ NO_IntegerLowHigh_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const unsigned long *)sptr; + value = *(const unsigned long long *)sptr; - if((value >= 1 && value <= 3000000000)) { + if((value >= 1LL && value <= 3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -711,6 +797,8 @@ NO_IntegerLowHigh_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -777,11 +865,26 @@ NO_IntegerLowHigh_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +NO_IntegerLowHigh_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +NO_IntegerLowHigh_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + NO_IntegerLowHigh_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [NO-IntegerLowHigh] >>> ***/ static asn_per_constraints_t asn_PER_type_NO_IntegerLowHigh_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 32, -1, 1, 3000000000 } /* (1..3000000000) */, + { APC_CONSTRAINED, 32, -1, 1l, 3000000000ul } /* (1..3000000000) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -808,6 +911,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowHigh = { NO_IntegerLowHigh_encode_xer, NO_IntegerLowHigh_decode_uper, NO_IntegerLowHigh_encode_uper, + NO_IntegerLowHigh_decode_aper, + NO_IntegerLowHigh_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerLowHigh_tags_1, sizeof(asn_DEF_NO_IntegerLowHigh_tags_1) @@ -841,13 +946,15 @@ xer_type_decoder_f CN_IntegerLowMax_decode_xer; xer_type_encoder_f CN_IntegerLowMax_encode_xer; per_type_decoder_f CN_IntegerLowMax_decode_uper; per_type_encoder_f CN_IntegerLowMax_encode_uper; +per_type_decoder_f CN_IntegerLowMax_decode_aper; +per_type_encoder_f CN_IntegerLowMax_encode_aper; /*** <<< CODE [CN-IntegerLowMax] >>> ***/ int CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -856,9 +963,9 @@ CN_IntegerLowMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= 1)) { + if((value >= 1LL)) { /* Constraint check succeeded */ return 0; } else { @@ -884,6 +991,8 @@ CN_IntegerLowMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -950,11 +1059,26 @@ CN_IntegerLowMax_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +CN_IntegerLowMax_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +CN_IntegerLowMax_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + CN_IntegerLowMax_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [CN-IntegerLowMax] >>> ***/ static asn_per_constraints_t asn_PER_type_CN_IntegerLowMax_constr_1 GCC_NOTUSED = { - { APC_SEMI_CONSTRAINED, -1, -1, 1, 0 } /* (1..MAX) */, + { APC_SEMI_CONSTRAINED, -1, -1, 1l, 0l } /* (1..MAX) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -976,6 +1100,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerLowMax = { CN_IntegerLowMax_encode_xer, CN_IntegerLowMax_decode_uper, CN_IntegerLowMax_encode_uper, + CN_IntegerLowMax_decode_aper, + CN_IntegerLowMax_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerLowMax_tags_1, sizeof(asn_DEF_CN_IntegerLowMax_tags_1) @@ -1009,6 +1135,8 @@ xer_type_decoder_f NO_IntegerHighMax_decode_xer; xer_type_encoder_f NO_IntegerHighMax_encode_xer; per_type_decoder_f NO_IntegerHighMax_decode_uper; per_type_encoder_f NO_IntegerHighMax_encode_uper; +per_type_decoder_f NO_IntegerHighMax_decode_aper; +per_type_encoder_f NO_IntegerHighMax_encode_aper; /*** <<< CODE [NO-IntegerHighMax] >>> ***/ @@ -1016,7 +1144,7 @@ int NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1032,7 +1160,7 @@ NO_IntegerHighMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= 3000000000)) { + if((value >= 3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1058,6 +1186,8 @@ NO_IntegerHighMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -1124,11 +1254,26 @@ NO_IntegerHighMax_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +NO_IntegerHighMax_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +NO_IntegerHighMax_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + NO_IntegerHighMax_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [NO-IntegerHighMax] >>> ***/ static asn_per_constraints_t asn_PER_type_NO_IntegerHighMax_constr_1 GCC_NOTUSED = { - { APC_SEMI_CONSTRAINED, -1, -1, 3000000000, 0 } /* (3000000000..MAX) */, + { APC_SEMI_CONSTRAINED, -1, -1, 3000000000ul, 0l } /* (3000000000..MAX) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -1150,6 +1295,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerHighMax = { NO_IntegerHighMax_encode_xer, NO_IntegerHighMax_decode_uper, NO_IntegerHighMax_encode_uper, + NO_IntegerHighMax_decode_aper, + NO_IntegerHighMax_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerHighMax_tags_1, sizeof(asn_DEF_NO_IntegerHighMax_tags_1) @@ -1183,6 +1330,8 @@ xer_type_decoder_f NO_IntegerLowestMax_decode_xer; xer_type_encoder_f NO_IntegerLowestMax_encode_xer; per_type_decoder_f NO_IntegerLowestMax_decode_uper; per_type_encoder_f NO_IntegerLowestMax_encode_uper; +per_type_decoder_f NO_IntegerLowestMax_decode_aper; +per_type_encoder_f NO_IntegerLowestMax_encode_aper; /*** <<< CODE [NO-IntegerLowestMax] >>> ***/ @@ -1190,7 +1339,7 @@ int NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const INTEGER_t *st = (const INTEGER_t *)sptr; - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1206,7 +1355,7 @@ NO_IntegerLowestMax_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - if((value >= -3000000000)) { + if((value >= -3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1232,6 +1381,8 @@ NO_IntegerLowestMax_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -1298,11 +1449,26 @@ NO_IntegerLowestMax_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +NO_IntegerLowestMax_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +NO_IntegerLowestMax_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + NO_IntegerLowestMax_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [NO-IntegerLowestMax] >>> ***/ static asn_per_constraints_t asn_PER_type_NO_IntegerLowestMax_constr_1 GCC_NOTUSED = { - { APC_SEMI_CONSTRAINED, -1, -1, -3000000000, 0 } /* (-3000000000..MAX) */, + { APC_SEMI_CONSTRAINED, -1, -1, -3000000000l, 0l } /* (-3000000000..MAX) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -1324,6 +1490,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerLowestMax = { NO_IntegerLowestMax_encode_xer, NO_IntegerLowestMax_decode_uper, NO_IntegerLowestMax_encode_uper, + NO_IntegerLowestMax_decode_aper, + NO_IntegerLowestMax_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerLowestMax_tags_1, sizeof(asn_DEF_NO_IntegerLowestMax_tags_1) @@ -1357,13 +1525,15 @@ xer_type_decoder_f NO_IntegerOutRange_decode_xer; xer_type_encoder_f NO_IntegerOutRange_encode_xer; per_type_decoder_f NO_IntegerOutRange_decode_uper; per_type_encoder_f NO_IntegerOutRange_encode_uper; +per_type_decoder_f NO_IntegerOutRange_decode_aper; +per_type_encoder_f NO_IntegerOutRange_encode_aper; /*** <<< CODE [NO-IntegerOutRange] >>> ***/ int NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - unsigned long value; + unsigned long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1372,9 +1542,9 @@ NO_IntegerOutRange_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const unsigned long *)sptr; + value = *(const unsigned long long *)sptr; - if((value >= 3000000000 && value <= 3000000001)) { + if((value >= 3000000000LL && value <= 3000000001LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1400,6 +1570,8 @@ NO_IntegerOutRange_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1466,11 +1638,26 @@ NO_IntegerOutRange_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +NO_IntegerOutRange_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +NO_IntegerOutRange_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + NO_IntegerOutRange_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [NO-IntegerOutRange] >>> ***/ static asn_per_constraints_t asn_PER_type_NO_IntegerOutRange_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 1, -1, 3000000000, 3000000001 } /* (3000000000..3000000001) */, + { APC_CONSTRAINED, 1, -1, 3000000000ul, 3000000001ul } /* (3000000000..3000000001) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -1497,6 +1684,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutRange = { NO_IntegerOutRange_encode_xer, NO_IntegerOutRange_decode_uper, NO_IntegerOutRange_encode_uper, + NO_IntegerOutRange_decode_aper, + NO_IntegerOutRange_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerOutRange_tags_1, sizeof(asn_DEF_NO_IntegerOutRange_tags_1) @@ -1530,13 +1719,15 @@ xer_type_decoder_f NO_IntegerOutValue_decode_xer; xer_type_encoder_f NO_IntegerOutValue_encode_xer; per_type_decoder_f NO_IntegerOutValue_decode_uper; per_type_encoder_f NO_IntegerOutValue_encode_uper; +per_type_decoder_f NO_IntegerOutValue_decode_aper; +per_type_encoder_f NO_IntegerOutValue_encode_aper; /*** <<< CODE [NO-IntegerOutValue] >>> ***/ int NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - unsigned long value; + unsigned long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1545,9 +1736,9 @@ NO_IntegerOutValue_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const unsigned long *)sptr; + value = *(const unsigned long long *)sptr; - if((value == 3000000000)) { + if((value == 3000000000LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1573,6 +1764,8 @@ NO_IntegerOutValue_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1639,11 +1832,26 @@ NO_IntegerOutValue_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +NO_IntegerOutValue_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +NO_IntegerOutValue_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + NO_IntegerOutValue_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [NO-IntegerOutValue] >>> ***/ static asn_per_constraints_t asn_PER_type_NO_IntegerOutValue_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 0, -1, 3000000000, 3000000000 } /* (3000000000..3000000000) */, + { APC_CONSTRAINED, 0, -1, 3000000000ul, 3000000000ul } /* (3000000000..3000000000) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -1670,6 +1878,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerOutValue = { NO_IntegerOutValue_encode_xer, NO_IntegerOutValue_decode_uper, NO_IntegerOutValue_encode_uper, + NO_IntegerOutValue_decode_aper, + NO_IntegerOutValue_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerOutValue_tags_1, sizeof(asn_DEF_NO_IntegerOutValue_tags_1) @@ -1703,13 +1913,15 @@ xer_type_decoder_f OK_IntegerInRange1_decode_xer; xer_type_encoder_f OK_IntegerInRange1_encode_xer; per_type_decoder_f OK_IntegerInRange1_decode_uper; per_type_encoder_f OK_IntegerInRange1_encode_uper; +per_type_decoder_f OK_IntegerInRange1_decode_aper; +per_type_encoder_f OK_IntegerInRange1_encode_aper; /*** <<< CODE [OK-IntegerInRange1] >>> ***/ int OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1718,9 +1930,9 @@ OK_IntegerInRange1_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= -100 && value <= 100)) { + if((value >= -100LL && value <= 100LL)) { /* Constraint check succeeded */ return 0; } else { @@ -1746,6 +1958,8 @@ OK_IntegerInRange1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1812,11 +2026,26 @@ OK_IntegerInRange1_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +OK_IntegerInRange1_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +OK_IntegerInRange1_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + OK_IntegerInRange1_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [OK-IntegerInRange1] >>> ***/ static asn_per_constraints_t asn_PER_type_OK_IntegerInRange1_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 8, 8, -100, 100 } /* (-100..100) */, + { APC_CONSTRAINED, 8, 8, -100l, 100l } /* (-100..100) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -1838,6 +2067,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange1 = { OK_IntegerInRange1_encode_xer, OK_IntegerInRange1_decode_uper, OK_IntegerInRange1_encode_uper, + OK_IntegerInRange1_decode_aper, + OK_IntegerInRange1_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange1_tags_1, sizeof(asn_DEF_OK_IntegerInRange1_tags_1) @@ -1871,13 +2102,15 @@ xer_type_decoder_f OK_IntegerInRange2_decode_xer; xer_type_encoder_f OK_IntegerInRange2_encode_xer; per_type_decoder_f OK_IntegerInRange2_decode_uper; per_type_encoder_f OK_IntegerInRange2_encode_uper; +per_type_decoder_f OK_IntegerInRange2_decode_aper; +per_type_encoder_f OK_IntegerInRange2_encode_aper; /*** <<< CODE [OK-IntegerInRange2] >>> ***/ int OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -1886,9 +2119,9 @@ OK_IntegerInRange2_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if(((value == -100) || (value == 100))) { + if(((value == -100LL) || (value == 100LL))) { /* Constraint check succeeded */ return 0; } else { @@ -1914,6 +2147,8 @@ OK_IntegerInRange2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -1980,11 +2215,26 @@ OK_IntegerInRange2_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +OK_IntegerInRange2_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +OK_IntegerInRange2_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + OK_IntegerInRange2_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [OK-IntegerInRange2] >>> ***/ static asn_per_constraints_t asn_PER_type_OK_IntegerInRange2_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 8, 8, -100, 100 } /* (-100..100) */, + { APC_CONSTRAINED, 8, 8, -100l, 100l } /* (-100..100) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -2006,6 +2256,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange2 = { OK_IntegerInRange2_encode_xer, OK_IntegerInRange2_decode_uper, OK_IntegerInRange2_encode_uper, + OK_IntegerInRange2_decode_aper, + OK_IntegerInRange2_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange2_tags_1, sizeof(asn_DEF_OK_IntegerInRange2_tags_1) @@ -2039,13 +2291,15 @@ xer_type_decoder_f OK_IntegerInRange3_decode_xer; xer_type_encoder_f OK_IntegerInRange3_encode_xer; per_type_decoder_f OK_IntegerInRange3_decode_uper; per_type_encoder_f OK_IntegerInRange3_encode_uper; +per_type_decoder_f OK_IntegerInRange3_decode_aper; +per_type_encoder_f OK_IntegerInRange3_encode_aper; /*** <<< CODE [OK-IntegerInRange3] >>> ***/ int OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -2054,9 +2308,9 @@ OK_IntegerInRange3_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if((value >= (-2147483647L - 1) && value <= 2147483647)) { + if((value >= -2147483648LL && value <= 2147483647LL)) { /* Constraint check succeeded */ return 0; } else { @@ -2082,6 +2336,8 @@ OK_IntegerInRange3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -2148,11 +2404,26 @@ OK_IntegerInRange3_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +OK_IntegerInRange3_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +OK_IntegerInRange3_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + OK_IntegerInRange3_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [OK-IntegerInRange3] >>> ***/ static asn_per_constraints_t asn_PER_type_OK_IntegerInRange3_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647l } /* (-2147483648..2147483647) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -2174,6 +2445,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange3 = { OK_IntegerInRange3_encode_xer, OK_IntegerInRange3_decode_uper, OK_IntegerInRange3_encode_uper, + OK_IntegerInRange3_decode_aper, + OK_IntegerInRange3_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange3_tags_1, sizeof(asn_DEF_OK_IntegerInRange3_tags_1) @@ -2207,13 +2480,15 @@ xer_type_decoder_f OK_IntegerInRange4_decode_xer; xer_type_encoder_f OK_IntegerInRange4_encode_xer; per_type_decoder_f OK_IntegerInRange4_decode_uper; per_type_encoder_f OK_IntegerInRange4_encode_uper; +per_type_decoder_f OK_IntegerInRange4_decode_aper; +per_type_encoder_f OK_IntegerInRange4_encode_aper; /*** <<< CODE [OK-IntegerInRange4] >>> ***/ int OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -2222,9 +2497,9 @@ OK_IntegerInRange4_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if(((value == (-2147483647L - 1)) || (value == 2147483647))) { + if(((value == -2147483648LL) || (value == 2147483647LL))) { /* Constraint check succeeded */ return 0; } else { @@ -2250,6 +2525,8 @@ OK_IntegerInRange4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -2316,11 +2593,26 @@ OK_IntegerInRange4_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +OK_IntegerInRange4_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +OK_IntegerInRange4_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + OK_IntegerInRange4_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [OK-IntegerInRange4] >>> ***/ static asn_per_constraints_t asn_PER_type_OK_IntegerInRange4_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647) */, + { APC_CONSTRAINED, 32, -1, (-2147483647L - 1), 2147483647l } /* (-2147483648..2147483647) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -2342,6 +2634,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange4 = { OK_IntegerInRange4_encode_xer, OK_IntegerInRange4_decode_uper, OK_IntegerInRange4_encode_uper, + OK_IntegerInRange4_decode_aper, + OK_IntegerInRange4_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange4_tags_1, sizeof(asn_DEF_OK_IntegerInRange4_tags_1) @@ -2375,13 +2669,15 @@ xer_type_decoder_f OK_IntegerInRange5_decode_xer; xer_type_encoder_f OK_IntegerInRange5_encode_xer; per_type_decoder_f OK_IntegerInRange5_decode_uper; per_type_encoder_f OK_IntegerInRange5_encode_uper; +per_type_decoder_f OK_IntegerInRange5_decode_aper; +per_type_encoder_f OK_IntegerInRange5_encode_aper; /*** <<< CODE [OK-IntegerInRange5] >>> ***/ int OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { - long value; + long long value; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, @@ -2390,9 +2686,9 @@ OK_IntegerInRange5_constraint(asn_TYPE_descriptor_t *td, const void *sptr, return -1; } - value = *(const long *)sptr; + value = *(const long long *)sptr; - if(((value == (-2147483647L - 1)) || (value == 2147483647))) { + if(((value == -2147483648LL) || (value == 2147483647LL))) { /* Constraint check succeeded */ return 0; } else { @@ -2418,6 +2714,8 @@ OK_IntegerInRange5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -2484,11 +2782,26 @@ OK_IntegerInRange5_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +OK_IntegerInRange5_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +OK_IntegerInRange5_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + OK_IntegerInRange5_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [OK-IntegerInRange5] >>> ***/ static asn_per_constraints_t asn_PER_type_OK_IntegerInRange5_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 32, -1, (-2147483647L - 1), 2147483647 } /* (-2147483648..2147483647,...) */, + { APC_CONSTRAINED | APC_EXTENSIBLE, 32, -1, (-2147483647L - 1), 2147483647l } /* (-2147483648..2147483647,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -2510,6 +2823,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_IntegerInRange5 = { OK_IntegerInRange5_encode_xer, OK_IntegerInRange5_decode_uper, OK_IntegerInRange5_encode_uper, + OK_IntegerInRange5_decode_aper, + OK_IntegerInRange5_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_IntegerInRange5_tags_1, sizeof(asn_DEF_OK_IntegerInRange5_tags_1) @@ -2543,6 +2858,8 @@ xer_type_decoder_f NO_IntegerInRange6_decode_xer; xer_type_encoder_f NO_IntegerInRange6_encode_xer; per_type_decoder_f NO_IntegerInRange6_decode_uper; per_type_encoder_f NO_IntegerInRange6_encode_uper; +per_type_decoder_f NO_IntegerInRange6_decode_aper; +per_type_encoder_f NO_IntegerInRange6_encode_aper; /*** <<< CODE [NO-IntegerInRange6] >>> ***/ @@ -2577,6 +2894,8 @@ NO_IntegerInRange6_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -2643,11 +2962,26 @@ NO_IntegerInRange6_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +NO_IntegerInRange6_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +NO_IntegerInRange6_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + NO_IntegerInRange6_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< CTDEFS [NO-IntegerInRange6] >>> ***/ static asn_per_constraints_t asn_PER_type_NO_IntegerInRange6_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 32, -1, 0, 4294967295 } /* (0..4294967295) */, + { APC_CONSTRAINED, 32, -1, 0l, 4294967295ul } /* (0..4294967295) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -2674,6 +3008,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerInRange6 = { NO_IntegerInRange6_encode_xer, NO_IntegerInRange6_decode_uper, NO_IntegerInRange6_encode_uper, + NO_IntegerInRange6_decode_aper, + NO_IntegerInRange6_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerInRange6_tags_1, sizeof(asn_DEF_NO_IntegerInRange6_tags_1) @@ -2714,6 +3050,8 @@ xer_type_decoder_f CN_IntegerEnumerated1_decode_xer; xer_type_encoder_f CN_IntegerEnumerated1_encode_xer; per_type_decoder_f CN_IntegerEnumerated1_decode_uper; per_type_encoder_f CN_IntegerEnumerated1_encode_uper; +per_type_decoder_f CN_IntegerEnumerated1_decode_aper; +per_type_encoder_f CN_IntegerEnumerated1_encode_aper; /*** <<< CODE [CN-IntegerEnumerated1] >>> ***/ @@ -2740,6 +3078,8 @@ CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -2806,6 +3146,21 @@ CN_IntegerEnumerated1_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +CN_IntegerEnumerated1_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +CN_IntegerEnumerated1_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + CN_IntegerEnumerated1_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< STAT-DEFS [CN-IntegerEnumerated1] >>> ***/ @@ -2824,6 +3179,8 @@ asn_TYPE_descriptor_t asn_DEF_CN_IntegerEnumerated1 = { CN_IntegerEnumerated1_encode_xer, CN_IntegerEnumerated1_decode_uper, CN_IntegerEnumerated1_encode_uper, + CN_IntegerEnumerated1_decode_aper, + CN_IntegerEnumerated1_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_CN_IntegerEnumerated1_tags_1, sizeof(asn_DEF_CN_IntegerEnumerated1_tags_1) @@ -2864,6 +3221,8 @@ xer_type_decoder_f NO_IntegerEnumerated2_decode_xer; xer_type_encoder_f NO_IntegerEnumerated2_encode_xer; per_type_decoder_f NO_IntegerEnumerated2_decode_uper; per_type_encoder_f NO_IntegerEnumerated2_encode_uper; +per_type_decoder_f NO_IntegerEnumerated2_decode_aper; +per_type_encoder_f NO_IntegerEnumerated2_encode_aper; /*** <<< CODE [NO-IntegerEnumerated2] >>> ***/ @@ -2890,6 +3249,8 @@ NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_INTEGER.xer_encoder; td->uper_decoder = asn_DEF_INTEGER.uper_decoder; td->uper_encoder = asn_DEF_INTEGER.uper_encoder; + td->aper_decoder = asn_DEF_INTEGER.aper_decoder; + td->aper_encoder = asn_DEF_INTEGER.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_INTEGER.per_constraints; td->elements = asn_DEF_INTEGER.elements; @@ -2956,6 +3317,21 @@ NO_IntegerEnumerated2_encode_uper(asn_TYPE_descriptor_t *td, return td->uper_encoder(td, constraints, structure, per_out); } +asn_enc_rval_t +NO_IntegerEnumerated2_encode_aper(asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, + void *structure, asn_per_outp_t *per_out) { + NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); + return td->aper_encoder(td, constraints, structure, per_out); +} + +asn_dec_rval_t +NO_IntegerEnumerated2_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) { + NO_IntegerEnumerated2_1_inherit_TYPE_descriptor(td); + return td->aper_decoder(opt_codec_ctx, td, constraints, structure, per_data); +} + /*** <<< STAT-DEFS [NO-IntegerEnumerated2] >>> ***/ @@ -2974,6 +3350,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_IntegerEnumerated2 = { NO_IntegerEnumerated2_encode_xer, NO_IntegerEnumerated2_decode_uper, NO_IntegerEnumerated2_encode_uper, + NO_IntegerEnumerated2_decode_aper, + NO_IntegerEnumerated2_encode_aper, 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_IntegerEnumerated2_tags_1, sizeof(asn_DEF_NO_IntegerEnumerated2_tags_1) diff --git a/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE b/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE index 4870f8cde..220076c35 100644 --- a/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE +++ b/tests/91-cond-int-blessSize-OK.asn1.-Pfbless-SIZE @@ -56,6 +56,8 @@ OK_Integer1_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -123,7 +125,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_Integer1 = { OK_Integer1_encode_der, OK_Integer1_decode_xer, OK_Integer1_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_Integer1_tags_1, sizeof(asn_DEF_OK_Integer1_tags_1) @@ -194,6 +197,8 @@ OK_Integer2_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -261,7 +266,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_Integer2 = { OK_Integer2_encode_der, OK_Integer2_decode_xer, OK_Integer2_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_Integer2_tags_1, sizeof(asn_DEF_OK_Integer2_tags_1) @@ -332,6 +338,8 @@ OK_Integer3_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -399,7 +407,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_Integer3 = { OK_Integer3_encode_der, OK_Integer3_decode_xer, OK_Integer3_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_Integer3_tags_1, sizeof(asn_DEF_OK_Integer3_tags_1) @@ -470,6 +479,8 @@ OK_Integer4_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -537,7 +548,8 @@ asn_TYPE_descriptor_t asn_DEF_OK_Integer4 = { OK_Integer4_encode_der, OK_Integer4_decode_xer, OK_Integer4_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OK_Integer4_tags_1, sizeof(asn_DEF_OK_Integer4_tags_1) @@ -608,6 +620,8 @@ NO_Integer5_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_NativeInteger.xer_encoder; td->uper_decoder = asn_DEF_NativeInteger.uper_decoder; td->uper_encoder = asn_DEF_NativeInteger.uper_encoder; + td->aper_decoder = asn_DEF_NativeInteger.aper_decoder; + td->aper_encoder = asn_DEF_NativeInteger.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_NativeInteger.per_constraints; td->elements = asn_DEF_NativeInteger.elements; @@ -675,7 +689,8 @@ asn_TYPE_descriptor_t asn_DEF_NO_Integer5 = { NO_Integer5_encode_der, NO_Integer5_decode_xer, NO_Integer5_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_NO_Integer5_tags_1, sizeof(asn_DEF_NO_Integer5_tags_1) diff --git a/tests/92-circular-loops-OK.asn1.-Pfindirect-choice b/tests/92-circular-loops-OK.asn1.-Pfindirect-choice index 6695a4111..b986dfdbb 100644 --- a/tests/92-circular-loops-OK.asn1.-Pfindirect-choice +++ b/tests/92-circular-loops-OK.asn1.-Pfindirect-choice @@ -172,7 +172,8 @@ asn_TYPE_descriptor_t asn_DEF_Everything = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Everything_tags_1, sizeof(asn_DEF_Everything_tags_1) @@ -275,7 +276,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice1 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -378,7 +380,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice2 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -485,7 +488,8 @@ asn_TYPE_descriptor_t asn_DEF_a_2 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_a_tags_2, sizeof(asn_DEF_a_tags_2) @@ -530,7 +534,8 @@ asn_TYPE_descriptor_t asn_DEF_c_5 = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_c_tags_5, sizeof(asn_DEF_c_tags_5) @@ -598,7 +603,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice3 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -733,7 +739,8 @@ asn_TYPE_descriptor_t asn_DEF_Member_2 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Member_tags_2, sizeof(asn_DEF_Member_tags_2) @@ -776,7 +783,8 @@ asn_TYPE_descriptor_t asn_DEF_Set = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Set_tags_1, sizeof(asn_DEF_Set_tags_1) @@ -894,7 +902,8 @@ asn_TYPE_descriptor_t asn_DEF_Sequence = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Sequence_tags_1, sizeof(asn_DEF_Sequence_tags_1) @@ -953,6 +962,8 @@ TypeRef_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Sequence.xer_encoder; td->uper_decoder = asn_DEF_Sequence.uper_decoder; td->uper_encoder = asn_DEF_Sequence.uper_encoder; + td->aper_decoder = asn_DEF_Sequence.aper_decoder; + td->aper_encoder = asn_DEF_Sequence.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Sequence.per_constraints; td->elements = asn_DEF_Sequence.elements; @@ -1020,7 +1031,8 @@ asn_TYPE_descriptor_t asn_DEF_TypeRef = { TypeRef_encode_der, TypeRef_decode_xer, TypeRef_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TypeRef_tags_1, sizeof(asn_DEF_TypeRef_tags_1) @@ -1105,7 +1117,8 @@ asn_TYPE_descriptor_t asn_DEF_b_3 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_b_tags_3, sizeof(asn_DEF_b_tags_3) @@ -1165,7 +1178,8 @@ asn_TYPE_descriptor_t asn_DEF_Alpha = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Alpha_tags_1, sizeof(asn_DEF_Alpha_tags_1) @@ -1256,7 +1270,8 @@ asn_TYPE_descriptor_t asn_DEF_Beta = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Beta_tags_1, sizeof(asn_DEF_Beta_tags_1) @@ -1360,7 +1375,8 @@ asn_TYPE_descriptor_t asn_DEF_Gamma = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Gamma_tags_1, sizeof(asn_DEF_Gamma_tags_1) @@ -1457,7 +1473,8 @@ asn_TYPE_descriptor_t asn_DEF_OneTwo = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OneTwo_tags_1, sizeof(asn_DEF_OneTwo_tags_1) @@ -1554,7 +1571,8 @@ asn_TYPE_descriptor_t asn_DEF_TwoThree = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TwoThree_tags_1, sizeof(asn_DEF_TwoThree_tags_1) @@ -1665,7 +1683,8 @@ asn_TYPE_descriptor_t asn_DEF_ThreeOne = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ThreeOne_tags_1, sizeof(asn_DEF_ThreeOne_tags_1) diff --git a/tests/92-circular-loops-OK.asn1.-Pfwide-types b/tests/92-circular-loops-OK.asn1.-Pfwide-types index 21918d914..6d45e55f6 100644 --- a/tests/92-circular-loops-OK.asn1.-Pfwide-types +++ b/tests/92-circular-loops-OK.asn1.-Pfwide-types @@ -172,7 +172,8 @@ asn_TYPE_descriptor_t asn_DEF_Everything = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Everything_tags_1, sizeof(asn_DEF_Everything_tags_1) @@ -275,7 +276,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice1 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -377,7 +379,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice2 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -484,7 +487,8 @@ asn_TYPE_descriptor_t asn_DEF_a_2 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_a_tags_2, sizeof(asn_DEF_a_tags_2) @@ -529,7 +533,8 @@ asn_TYPE_descriptor_t asn_DEF_c_5 = { SEQUENCE_OF_encode_der, SEQUENCE_OF_decode_xer, SEQUENCE_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_c_tags_5, sizeof(asn_DEF_c_tags_5) @@ -597,7 +602,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice3 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -732,7 +738,8 @@ asn_TYPE_descriptor_t asn_DEF_Member_2 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Member_tags_2, sizeof(asn_DEF_Member_tags_2) @@ -775,7 +782,8 @@ asn_TYPE_descriptor_t asn_DEF_Set = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Set_tags_1, sizeof(asn_DEF_Set_tags_1) @@ -893,7 +901,8 @@ asn_TYPE_descriptor_t asn_DEF_Sequence = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Sequence_tags_1, sizeof(asn_DEF_Sequence_tags_1) @@ -952,6 +961,8 @@ TypeRef_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) { td->xer_encoder = asn_DEF_Sequence.xer_encoder; td->uper_decoder = asn_DEF_Sequence.uper_decoder; td->uper_encoder = asn_DEF_Sequence.uper_encoder; + td->aper_decoder = asn_DEF_Sequence.aper_decoder; + td->aper_encoder = asn_DEF_Sequence.aper_encoder; if(!td->per_constraints) td->per_constraints = asn_DEF_Sequence.per_constraints; td->elements = asn_DEF_Sequence.elements; @@ -1019,7 +1030,8 @@ asn_TYPE_descriptor_t asn_DEF_TypeRef = { TypeRef_encode_der, TypeRef_decode_xer, TypeRef_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TypeRef_tags_1, sizeof(asn_DEF_TypeRef_tags_1) @@ -1104,7 +1116,8 @@ asn_TYPE_descriptor_t asn_DEF_b_3 = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_b_tags_3, sizeof(asn_DEF_b_tags_3) @@ -1164,7 +1177,8 @@ asn_TYPE_descriptor_t asn_DEF_Alpha = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Alpha_tags_1, sizeof(asn_DEF_Alpha_tags_1) @@ -1255,7 +1269,8 @@ asn_TYPE_descriptor_t asn_DEF_Beta = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Beta_tags_1, sizeof(asn_DEF_Beta_tags_1) @@ -1359,7 +1374,8 @@ asn_TYPE_descriptor_t asn_DEF_Gamma = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Gamma_tags_1, sizeof(asn_DEF_Gamma_tags_1) @@ -1456,7 +1472,8 @@ asn_TYPE_descriptor_t asn_DEF_OneTwo = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_OneTwo_tags_1, sizeof(asn_DEF_OneTwo_tags_1) @@ -1553,7 +1570,8 @@ asn_TYPE_descriptor_t asn_DEF_TwoThree = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TwoThree_tags_1, sizeof(asn_DEF_TwoThree_tags_1) @@ -1664,7 +1682,8 @@ asn_TYPE_descriptor_t asn_DEF_ThreeOne = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_ThreeOne_tags_1, sizeof(asn_DEF_ThreeOne_tags_1) diff --git a/tests/93-asn1c-controls-OK.asn1.-Pfwide-types b/tests/93-asn1c-controls-OK.asn1.-Pfwide-types index 41c92044d..7b20d16db 100644 --- a/tests/93-asn1c-controls-OK.asn1.-Pfwide-types +++ b/tests/93-asn1c-controls-OK.asn1.-Pfwide-types @@ -66,7 +66,8 @@ asn_TYPE_descriptor_t asn_DEF_Sequence = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Sequence_tags_1, sizeof(asn_DEF_Sequence_tags_1) @@ -176,7 +177,8 @@ asn_TYPE_descriptor_t asn_DEF_Set = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Set_tags_1, sizeof(asn_DEF_Set_tags_1) @@ -272,7 +274,8 @@ asn_TYPE_descriptor_t asn_DEF_setof_2 = { SET_OF_encode_der, SET_OF_decode_xer, SET_OF_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_setof_tags_2, sizeof(asn_DEF_setof_tags_2) @@ -340,7 +343,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ diff --git a/tests/94-set-optionals-OK.asn1.-P b/tests/94-set-optionals-OK.asn1.-P index cd099c08f..483d77021 100644 --- a/tests/94-set-optionals-OK.asn1.-P +++ b/tests/94-set-optionals-OK.asn1.-P @@ -187,7 +187,8 @@ asn_TYPE_descriptor_t asn_DEF_TestSet = { SET_encode_der, SET_decode_xer, SET_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_TestSet_tags_1, sizeof(asn_DEF_TestSet_tags_1) diff --git a/tests/95-choice-per-order-OK.asn1.-Pfwide-types b/tests/95-choice-per-order-OK.asn1.-Pfwide-types index c4c2d6bbb..a1884c4a0 100644 --- a/tests/95-choice-per-order-OK.asn1.-Pfwide-types +++ b/tests/95-choice-per-order-OK.asn1.-Pfwide-types @@ -103,7 +103,8 @@ asn_TYPE_descriptor_t asn_DEF_ch_4 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -180,7 +181,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -270,7 +272,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice2 = { CHOICE_encode_der, CHOICE_decode_xer, CHOICE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ diff --git a/tests/95-choice-per-order-OK.asn1.-Pgen-PER b/tests/95-choice-per-order-OK.asn1.-Pgen-PER index c658e4c3d..d6f123daa 100644 --- a/tests/95-choice-per-order-OK.asn1.-Pgen-PER +++ b/tests/95-choice-per-order-OK.asn1.-Pgen-PER @@ -59,12 +59,12 @@ extern asn_TYPE_descriptor_t asn_DEF_Choice; /*** <<< CTDEFS [Choice] >>> ***/ static asn_per_constraints_t asn_PER_type_ch_constr_4 GCC_NOTUSED = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_CONSTRAINED, 1, 1, 0l, 1l } /* (0..1) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; static asn_per_constraints_t asn_PER_type_Choice_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0, 2 } /* (0..2,...) */, + { APC_CONSTRAINED | APC_EXTENSIBLE, 2, 2, 0l, 2l } /* (0..2,...) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -119,6 +119,8 @@ asn_TYPE_descriptor_t asn_DEF_ch_4 = { CHOICE_encode_xer, CHOICE_decode_uper, CHOICE_encode_uper, + CHOICE_decode_aper, + CHOICE_encode_aper, CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -198,6 +200,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice = { CHOICE_encode_xer, CHOICE_decode_uper, CHOICE_encode_uper, + CHOICE_decode_aper, + CHOICE_encode_aper, CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ @@ -244,7 +248,7 @@ extern asn_TYPE_descriptor_t asn_DEF_Choice2; /*** <<< CTDEFS [Choice2] >>> ***/ static asn_per_constraints_t asn_PER_type_Choice2_constr_1 GCC_NOTUSED = { - { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, + { APC_CONSTRAINED, 1, 1, 0l, 1l } /* (0..1) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; @@ -297,6 +301,8 @@ asn_TYPE_descriptor_t asn_DEF_Choice2 = { CHOICE_encode_xer, CHOICE_decode_uper, CHOICE_encode_uper, + CHOICE_decode_aper, + CHOICE_encode_aper, CHOICE_outmost_tag, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ diff --git a/tests/98-attribute-class-OK.asn1.-P b/tests/98-attribute-class-OK.asn1.-P index cf2f5b792..547fc4ed9 100644 --- a/tests/98-attribute-class-OK.asn1.-P +++ b/tests/98-attribute-class-OK.asn1.-P @@ -89,7 +89,8 @@ asn_TYPE_descriptor_t asn_DEF_Attribute = { SEQUENCE_encode_der, SEQUENCE_decode_xer, SEQUENCE_encode_xer, - 0, 0, /* No PER support, use "-gen-PER" to enable */ + 0, 0, /* No UPER support, use "-gen-PER" to enable */ + 0, 0, /* No APER support, use "-gen-PER" to enable */ 0, /* Use generic outmost tag fetcher */ asn_DEF_Attribute_tags_1, sizeof(asn_DEF_Attribute_tags_1) From f49ee68bcb469dfdab46f4fc8e58a8b836bad66f Mon Sep 17 00:00:00 2001 From: Krzysztof Witek Date: Tue, 9 Jun 2020 14:25:53 +0200 Subject: [PATCH 22/28] work in 128-bit integer values while compiling This patch adds support of big integers. Cherry-picked from original vlm/asn1c master branch da997b1ea17f2bf45281d94cb876b3b71a3bdf20 Signed-off-by: Krzysztof Witek --- asn1c/unber.c | 31 +++--- configure.ac | 2 + examples/sample.source.RRC/Makefile | 2 +- libasn1compiler/asn1c_C.c | 51 ++++----- libasn1compiler/asn1c_out.h | 12 +- libasn1fix/asn1fix_crange.c | 6 +- libasn1fix/asn1fix_enum.c | 17 +-- libasn1fix/asn1fix_misc.c | 3 +- libasn1parser/Makefile.am | 1 + libasn1parser/asn1p_expr.c | 2 +- libasn1parser/asn1p_integer.c | 165 ++++++++++++++++++++++++++++ libasn1parser/asn1p_integer.h | 45 ++++++++ libasn1parser/asn1parser.c | 20 ---- libasn1parser/asn1parser.h | 33 +----- libasn1print/asn1print.c | 10 +- 15 files changed, 282 insertions(+), 118 deletions(-) create mode 100644 libasn1parser/asn1p_integer.c create mode 100644 libasn1parser/asn1p_integer.h diff --git a/asn1c/unber.c b/asn1c/unber.c index d628ceba9..689ef7b4a 100644 --- a/asn1c/unber.c +++ b/asn1c/unber.c @@ -39,6 +39,7 @@ #include #include #include +#include #undef COPYRIGHT #define COPYRIGHT "Copyright (c) 2004, 2005 Lev Walkin \n" @@ -163,10 +164,10 @@ typedef enum pd_code { PD_EOF = 1, } pd_code_e; static pd_code_e process_deeper(const char *fname, FILE *fp, - asn1c_integer_t *offset, int level, + size_t *offset, int level, ssize_t limit, ber_tlv_len_t *frame_size, ber_tlv_len_t effective_size, int expect_eoc); -static void print_TL(int fin, asn1c_integer_t offset, int level, int constr, +static void print_TL(int fin, size_t offset, int level, int constr, ssize_t tlen, ber_tlv_tag_t, ber_tlv_len_t, ber_tlv_len_t effective_frame_size); static int print_V(const char *fname, FILE *fp, ber_tlv_tag_t, ber_tlv_len_t); @@ -178,7 +179,7 @@ static int process(const char *fname) { FILE *fp; pd_code_e pdc; - asn1c_integer_t offset = 0; /* Stream decoding position */ + size_t offset = 0; /* Stream decoding position */ ber_tlv_len_t frame_size = 0; /* Single frame size */ if(strcmp(fname, "-")) { @@ -196,8 +197,7 @@ process(const char *fname) { */ for(; offset < skip_bytes; offset++) { if(fgetc(fp) == -1) { - fprintf(stderr, "%s: input source (%" PRIdASN - " bytes) " + fprintf(stderr, "%s: input source (%zu bytes) " "has less data than \"-s %d\" switch " "wants to skip\n", fname, offset, skip_bytes); @@ -223,7 +223,7 @@ process(const char *fname) { * Process the TLV recursively. */ static pd_code_e -process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level, +process_deeper(const char *fname, FILE *fp, size_t *offset, int level, ssize_t limit, ber_tlv_len_t *frame_size, ber_tlv_len_t effective_size, int expect_eoc) { unsigned char tagbuf[32]; @@ -244,8 +244,7 @@ process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level, if(limit >= 0 && tblen >= limit) { fprintf(stderr, "%s: Too long TL sequence (%ld >= %ld)" - " at %" PRIdASN - ". " + " at %zu. " "Broken or maliciously constructed file\n", fname, (long)tblen, (long)limit, *offset); return PD_FAILED; @@ -257,7 +256,7 @@ process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level, if(limit > 0 || expect_eoc) { fprintf(stderr, "%s: Unexpected end of file (TL)" - " at %" PRIdASN "\n", + " at %zu\n", fname, *offset); return PD_FAILED; } else { @@ -275,7 +274,7 @@ process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level, case -1: fprintf(stderr, "%s: Fatal error decoding tag" - " at %" PRIdASN "+%ld\n", + " at %zu+%ld\n", fname, *offset, (long)tblen); return PD_FAILED; case 0: @@ -293,7 +292,7 @@ process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level, case -1: fprintf(stderr, "%s: Fatal error decoding value length" - " at %" PRIdASN "\n", + " at %zu\n", fname, *offset + t_len); return PD_FAILED; case 0: @@ -385,7 +384,7 @@ process_deeper(const char *fname, FILE *fp, asn1c_integer_t *offset, int level, } static void -print_TL(int fin, asn1c_integer_t offset, int level, int constr, ssize_t tlen, +print_TL(int fin, size_t offset, int level, int constr, ssize_t tlen, ber_tlv_tag_t tlv_tag, ber_tlv_len_t tlv_len, ber_tlv_len_t effective_size) { if(fin && !constr) { @@ -399,7 +398,7 @@ print_TL(int fin, asn1c_integer_t offset, int level, int constr, ssize_t tlen, printf(constr ? ((tlv_len == -1) ? "I" : "C") : "P"); /* Print out the offset of this boundary, even if closing tag */ - if(!minimalistic) printf(" O=\"%" PRIdASN "\"", offset); + if(!minimalistic) printf(" O=\"%zu\"", offset); printf(" T=\""); ber_tlv_tag_fwrite(tlv_tag, stdout); @@ -572,7 +571,7 @@ print_V(const char *fname, FILE *fp, ber_tlv_tag_t tlv_tag, switch(etype) { case ASN_BASIC_INTEGER: case ASN_BASIC_ENUMERATED: - printf("%" PRIdASN, collector); + printf("%s", asn1p_itoa(collector)); break; case ASN_BASIC_OBJECT_IDENTIFIER: if(vbuf) { @@ -589,7 +588,7 @@ print_V(const char *fname, FILE *fp, ber_tlv_tag_t tlv_tag, printf(" F>"); for(i = 0; i < arcno; i++) { if(i) printf("."); - printf("%" PRIuASN, arcs[i]); + printf("%s", asn1p_itoa(arcs[i])); } FREEMEM(vbuf); vbuf = 0; @@ -610,7 +609,7 @@ print_V(const char *fname, FILE *fp, ber_tlv_tag_t tlv_tag, printf(" F>"); for(i = 0; i < arcno; i++) { if(i) printf("."); - printf("%" PRIuASN, arcs[i]); + printf("%s", asn1p_itoa(arcs[i])); } FREEMEM(vbuf); vbuf = 0; diff --git a/configure.ac b/configure.ac index 56b7a99ec..51f4d09a2 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,8 @@ AC_C_BIGENDIAN AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_STRUCT_TM +AC_CHECK_TYPE([__int128], + [AC_DEFINE(HAVE_128_BIT_INT, 1, [Have 128-bit integer])]) AC_CHECK_TYPE(intmax_t, int64_t) dnl Test if we should check features that depend on 64-bitness. diff --git a/examples/sample.source.RRC/Makefile b/examples/sample.source.RRC/Makefile index f59f0a1ae..d6f1d0d63 100644 --- a/examples/sample.source.RRC/Makefile +++ b/examples/sample.source.RRC/Makefile @@ -4825,7 +4825,7 @@ check-per: done; done; fi @if test -f sample-DL-DCCH-Message-1.per ; then \ for f in sample-*-[1-9].per; do \ - pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*/\1/"`; \ + pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z-]+)-[0-9].*//"`; \ for b in 1 17 33 980 8192; do \ echo "Recoding $$f into DER into XER and back ($$b)..."; \ ./${TARGET} -b $$b -p $$pdu -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \ diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c index ecbf9bbe2..d9a075132 100644 --- a/libasn1compiler/asn1c_C.c +++ b/libasn1compiler/asn1c_C.c @@ -9,6 +9,7 @@ #include "asn1c_misc.h" #include /* constraint groker from libasn1fix */ #include /* other exportables from libasn1fix */ +#include typedef struct tag2el_s { struct asn1p_type_tag_s el_tag; @@ -139,8 +140,8 @@ asn1c_lang_C_type_common_INTEGER(arg_t *arg) { OUT("\t"); out_name_chain(arg, ONC_noflags); OUT("_%s", MKID(v)); - OUT("\t= %" PRIdASN "%s\n", - v->value->value.v_integer, + OUT("\t= %s%s\n", + asn1p_itoa(v->value->value.v_integer), (eidx+1 < el_count) ? "," : ""); v2e[eidx].name = v->Identifier; v2e[eidx].value = v->value->value.v_integer; @@ -180,8 +181,8 @@ asn1c_lang_C_type_common_INTEGER(arg_t *arg) { qsort(v2e, el_count, sizeof(v2e[0]), compar_enumMap_byValue); for(eidx = 0; eidx < el_count; eidx++) { v2e[eidx].idx = eidx; - OUT("\t{ %" PRIdASN ",\t%ld,\t\"%s\" }%s\n", - v2e[eidx].value, + OUT("\t{ %s,\t%ld,\t\"%s\" }%s\n", + asn1p_itoa(v2e[eidx].value), (long)strlen(v2e[eidx].name), v2e[eidx].name, (eidx + 1 < el_count) ? "," : ""); } @@ -193,10 +194,10 @@ asn1c_lang_C_type_common_INTEGER(arg_t *arg) { MKID(expr), expr->_type_unique_index); qsort(v2e, el_count, sizeof(v2e[0]), compar_enumMap_byName); for(eidx = 0; eidx < el_count; eidx++) { - OUT("\t%d%s\t/* %s(%" PRIdASN ") */\n", + OUT("\t%d%s\t/* %s(%s) */\n", v2e[eidx].idx, (eidx + 1 < el_count) ? "," : "", - v2e[eidx].name, v2e[eidx].value); + v2e[eidx].name, asn1p_itoa(v2e[eidx].value)); } if(map_extensions) OUT("\t/* This list is extensible */\n"); @@ -273,8 +274,8 @@ asn1c_lang_C_type_BIT_STRING(arg_t *arg) { OUT("\t"); out_name_chain(arg, ONC_noflags); OUT("_%s", MKID(v)); - OUT("\t= %" PRIdASN "%s\n", - v->value->value.v_integer, + OUT("\t= %s%s\n", + asn1p_itoa(v->value->value.v_integer), (eidx < el_count) ? "," : ""); } OUT("} e_"); @@ -1494,7 +1495,7 @@ _print_tag(arg_t *arg, struct asn1p_type_tag_s *tag) { case TC_NOCLASS: break; } - OUT(" | (%" PRIdASN " << 2))", tag->tag_value); + OUT(" | (%s << 2))", asn1p_itoa(tag->tag_value)); return 0; } @@ -1948,12 +1949,12 @@ emit_single_member_PER_constraint(arg_t *arg, asn1cnst_range_t *range, int alpha if(type) OUT("(%s", type); OUT("("); if(range->left.type == ARE_VALUE) - OUT("%" PRIdASN, range->left.value); + OUT("%s", asn1p_itoa(range->left.value)); else OUT("MIN"); OUT(".."); if(range->right.type == ARE_VALUE) - OUT("%" PRIdASN, range->right.value); + OUT("%s", asn1p_itoa(range->right.value)); else OUT("MAX"); if(range->extensible) OUT(",..."); @@ -2163,17 +2164,17 @@ try_inline_default(arg_t *arg, asn1p_expr_t *expr, int out) { if(fits_long && !expr->marker.default_value->value.v_integer) expr->marker.flags &= ~EM_INDIRECT; if(!out) { - OUT("asn_DFL_%d_set_%" PRIdASN - ",\t/* DEFAULT %" PRIdASN " */\n", + OUT("asn_DFL_%d_set_%s,", expr->_type_unique_index, - expr->marker.default_value->value.v_integer, - expr->marker.default_value->value.v_integer); + asn1p_itoa(expr->marker.default_value->value.v_integer)); + OUT("\t/* DEFAULT %s */\n", + asn1p_itoa(expr->marker.default_value->value.v_integer)); return 1; } REDIR(OT_STAT_DEFS); - OUT("static int asn_DFL_%d_set_%" PRIdASN "(int set_value, void **sptr) {\n", + OUT("static int asn_DFL_%d_set_%s(int set_value, void **sptr) {\n", expr->_type_unique_index, - expr->marker.default_value->value.v_integer); + asn1p_itoa(expr->marker.default_value->value.v_integer)); INDENT(+1); OUT("%s *st = *sptr;\n", asn1c_type_name(arg, expr, TNF_CTYPE)); OUT("\n"); @@ -2185,8 +2186,8 @@ try_inline_default(arg_t *arg, asn1p_expr_t *expr, int out) { OUT("\n"); OUT("if(set_value) {\n"); INDENT(+1); - OUT("/* Install default value %" PRIdASN " */\n", - expr->marker.default_value->value.v_integer); + OUT("/* Install default value %s */\n", + asn1p_itoa(expr->marker.default_value->value.v_integer)); if(fits_long) { OUT("*st = "); OINT(expr->marker.default_value->value.v_integer); @@ -2200,17 +2201,17 @@ try_inline_default(arg_t *arg, asn1p_expr_t *expr, int out) { INDENT(-1); OUT("} else {\n"); INDENT(+1); - OUT("/* Test default value %" PRIdASN " */\n", - expr->marker.default_value->value.v_integer); + OUT("/* Test default value %s */\n", + asn1p_itoa(expr->marker.default_value->value.v_integer)); if(fits_long) { - OUT("return (*st == %" PRIdASN ");\n", - expr->marker.default_value->value.v_integer); + OUT("return (*st == %s);\n", + asn1p_itoa(expr->marker.default_value->value.v_integer)); } else { OUT("long value;\n"); OUT("if(asn_INTEGER2long(st, &value))\n"); OUT("\treturn -1;\n"); - OUT("return (value == %" PRIdASN ");\n", - expr->marker.default_value->value.v_integer); + OUT("return (value == %s);\n", + asn1p_itoa(expr->marker.default_value->value.v_integer)); } INDENT(-1); OUT("}\n"); diff --git a/libasn1compiler/asn1c_out.h b/libasn1compiler/asn1c_out.h index dee8cad43..c5e2c92a0 100644 --- a/libasn1compiler/asn1c_out.h +++ b/libasn1compiler/asn1c_out.h @@ -120,22 +120,22 @@ int asn1c_compiled_output(arg_t *arg, const char *fmt, ...); if(iv == (-2147483647L - 1)) \ OUT("(-2147483647L - 1)"); \ else if (iv > 0 && (unsigned long long)iv > 4294967296UL) \ - OUT("%" PRIdASN "ull", iv); \ + OUT("%s", asn1p_itoa(iv)); \ else if (iv > 0 && (unsigned long)iv > 2147483647L) \ - OUT("%" PRIdASN "ul", iv); \ + OUT("%s", asn1p_itoa(iv)); \ else \ - OUT("%" PRIdASN "l", iv); \ + OUT("%s", asn1p_itoa(iv)); \ } while(0) #define OINTS(iv) do { \ if(iv == (-2147483647L - 1)) \ OUT("(-2147483647L - 1)"); \ else if (iv > 0 && (unsigned long long)iv > 4294967296UL) \ - OUT("%" PRIdASN "ull", iv); \ + OUT("%s", asn1p_itoa(iv)); \ else if (iv > 0 && (unsigned long)iv > 2147483647L) \ - OUT("%" PRIdASN "ul", iv); \ + OUT("%s", asn1p_itoa(iv)); \ else \ - OUT("% " PRIdASN "l", iv); \ + OUT("%s", asn1p_itoa(iv)); \ } while(0) #endif /* ASN1_COMPILED_OUTPUT_H */ diff --git a/libasn1fix/asn1fix_crange.c b/libasn1fix/asn1fix_crange.c index 311c727c0..e153cc3d9 100644 --- a/libasn1fix/asn1fix_crange.c +++ b/libasn1fix/asn1fix_crange.c @@ -157,7 +157,7 @@ _edge_value(const asn1cnst_edge_t *edge) { case ARE_MIN: strcpy(buf, "MIN"); break; case ARE_MAX: strcpy(buf, "MAX"); break; case ARE_VALUE: - snprintf(buf, sizeof(buf), "%" PRIdASN, edge->value); + snprintf(buf, sizeof(buf), "%s", asn1p_itoa(edge->value)); break; default: assert(!"edge->type"); @@ -255,9 +255,9 @@ static int _range_fill(asn1p_value_t *val, const asn1cnst_range_t *minmax, asn1c switch(val->type) { case ATV_INTEGER: if(type != ACT_EL_RANGE && type != ACT_CT_SIZE) { - FATAL("Integer %" PRIdASN " value invalid " + FATAL("Integer %s value invalid " "for %s constraint at line %d", - val->value.v_integer, + asn1p_itoa(val->value.v_integer), asn1p_constraint_type2str(type), lineno); return -1; } diff --git a/libasn1fix/asn1fix_enum.c b/libasn1fix/asn1fix_enum.c index 399cb625a..ac543f203 100644 --- a/libasn1fix/asn1fix_enum.c +++ b/libasn1fix/asn1fix_enum.c @@ -115,16 +115,19 @@ asn1f_fix_enum(arg_t *arg) { if (eval > max_value_ext) { max_value_ext = eval; } else { - FATAL( + char max_value_buf[128]; + asn1p_itoa_s(max_value_buf, sizeof(max_value_buf), + max_value_ext); + FATAL( "Enumeration %s at line %d: " - "Explicit value \"%s(%" PRIdASN ")\" " + "Explicit value \"%s(%s)\" " "is not greater " - "than previous values (max %" PRIdASN ")", + "than previous values (max %s)", expr->Identifier, ev->_lineno, ev->Identifier, - eval, - max_value_ext); + asn1p_itoa(eval), + max_value_buf); rvalue = -1; } } @@ -143,12 +146,12 @@ asn1f_fix_enum(arg_t *arg) { if (used_vals[uv_idx] == eval) { FATAL( "Enumeration %s at line %d: " - "Explicit value \"%s(%" PRIdASN ")\" " + "Explicit value \"%s(%s)\" " "collides with previous values", expr->Identifier, ev->_lineno, ev->Identifier, - eval); + asn1p_itoa(eval)); rvalue = -1; unique = 0; } diff --git a/libasn1fix/asn1fix_misc.c b/libasn1fix/asn1fix_misc.c index 23005b951..c4531e2ea 100644 --- a/libasn1fix/asn1fix_misc.c +++ b/libasn1fix/asn1fix_misc.c @@ -50,8 +50,7 @@ asn1f_printable_value(asn1p_value_t *v) { memcpy(buf + sizeof(buf) - 4, "...", 4); return buf; case ATV_INTEGER: - ret = snprintf(buf, sizeof(buf), "%" PRIdASN, - v->value.v_integer); + ret = snprintf(buf, sizeof(buf), "%s", asn1p_itoa(v->value.v_integer)); if(ret >= (ssize_t)sizeof(buf)) memcpy(buf + sizeof(buf) - 4, "...", 4); return buf; diff --git a/libasn1parser/Makefile.am b/libasn1parser/Makefile.am index 65a4f3ebd..bf9127df1 100644 --- a/libasn1parser/Makefile.am +++ b/libasn1parser/Makefile.am @@ -19,6 +19,7 @@ libasn1parser_la_SOURCES = \ asn1p_param.c asn1p_param.h \ asn1p_class.c asn1p_class.h \ asn1p_ref.c asn1p_ref.h \ + asn1p_integer.c asn1p_integer.h \ asn1p_list.h asn1parser.h: asn1p_expr_str.h diff --git a/libasn1parser/asn1p_expr.c b/libasn1parser/asn1p_expr.c index b7a03ecb0..34756281c 100644 --- a/libasn1parser/asn1p_expr.c +++ b/libasn1parser/asn1p_expr.c @@ -296,7 +296,7 @@ char *asn1p_tag2string(struct asn1p_type_tag_s *tag, char *buf) { break; } buf += snprintf(buf + strlen(buf), end - buf, - "%" PRIdASN "]", tag->tag_value); + "%s]", asn1p_itoa(tag->tag_value)); assert((unsigned int)(buf - end) > sizeof(" IMPLICIT ")); switch(tag->tag_mode) { diff --git a/libasn1parser/asn1p_integer.c b/libasn1parser/asn1p_integer.c new file mode 100644 index 000000000..98cfe0849 --- /dev/null +++ b/libasn1parser/asn1p_integer.c @@ -0,0 +1,165 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "asn1p_integer.h" + +#define ASN_INTEGER_MAX \ + (~((asn1c_integer_t)0) \ + & ~((asn1c_integer_t)1 << (8 * sizeof(asn1c_integer_t) - 1))) +#define ASN_INTEGER_MIN (-(ASN_INTEGER_MAX)-1) + +/* + * Parse the number in the given string until the given *end position, + * returning the position after the last parsed character back using the + * same (*end) pointer. + * WARNING: This behavior is different from the standard strtol/strtoimax(3). + */ +enum strtox_result_e { + STRTOX_ERROR_RANGE = -3, /* Input outside of supported numeric range */ + STRTOX_ERROR_INVAL = -2, /* Invalid data encountered (e.g., "+-") */ + STRTOX_EXPECT_MORE = -1, /* More data expected (e.g. "+") */ + STRTOX_OK = 0, /* Conversion succeded, number ends at (*end) */ + STRTOX_EXTRA_DATA = + 1 /* Conversion succeded, but the string has extra stuff */ +}; + +static enum strtox_result_e +strtoaint_lim(const char *str, const char **end, asn1c_integer_t *intp) { + const asn1c_integer_t upper_boundary = ASN_INTEGER_MAX / 10; + int last_digit_max = ASN_INTEGER_MAX % 10; + int sign = 1; + asn1c_integer_t value; + + if(str >= *end) return STRTOX_ERROR_INVAL; + + switch(*str) { + case '-': + last_digit_max++; + sign = -1; + /* FALL THROUGH */ + case '+': + str++; + if(str >= *end) { + *end = str; + return STRTOX_EXPECT_MORE; + } + } + + for(value = 0; str < (*end); str++) { + switch(*str) { + case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: + case 0x35: case 0x36: case 0x37: case 0x38: case 0x39: { + int d = *str - '0'; + if(value < upper_boundary) { + value = value * 10 + d; + } else if(value == upper_boundary) { + if(d <= last_digit_max) { + if(sign > 0) { + value = value * 10 + d; + } else { + sign = 1; + value = -value * 10 - d; + } + } else { + *end = str; + return STRTOX_ERROR_RANGE; + } + } else { + *end = str; + return STRTOX_ERROR_RANGE; + } + } + continue; + default: + *end = str; + *intp = sign * value; + return STRTOX_EXTRA_DATA; + } + } + + *end = str; + *intp = sign * value; + return STRTOX_OK; +} + +int +asn1p_atoi(const char *ptr, asn1c_integer_t *value) { + const char *end = ptr + strlen(ptr); + if(strtoaint_lim(ptr, &end, value) == STRTOX_OK) { + return 0; + } else { + return -1; + } +} + +const char *asn1p_itoa(asn1c_integer_t v) { + static char static_buf[128]; + int ret = asn1p_itoa_s(static_buf, sizeof(static_buf), v); + if(ret > 0) { + assert(ret < sizeof(static_buf)); + return static_buf; + } else { + return NULL; + } +} + +int asn1p_itoa_s(char *buf, size_t size, asn1c_integer_t v) { + char tmp_buf[128]; + + if(v >= LONG_MIN && v < LONG_MAX) { + int ret = snprintf(buf, size, "%ld", (long)v); + if(ret < 0 || ret >= size) { + return -1; + } + return ret; + } + + int sign = 0; + if(v < 0) { + if(v == ASN_INTEGER_MIN) { + switch(sizeof(v)) { + case 16: + if(size < 41) + return -1; + memcpy(buf, "-170141183460469231731687303715884105729", 41); + return 41; + case 8: + if(size < 21) + return -1; + memcpy(buf, "-9223372036854775809", 21); + return 21; + default: + assert(!"unreachable"); + } + } + + sign = -1; + v = -v; /* Ditch the sign */ + } + + assert(v > 1000000000L); + char restbuf[10] = "000000000\0"; + const char *rest = asn1p_itoa((long)(v % 1000000000L)); + size_t restlen = strlen(rest); + assert(restlen <= 9); + memcpy(restbuf + (9 - restlen), rest, restlen); + rest = restbuf; + + const char *head = asn1p_itoa(v / 1000000000L); + assert(head); + int ret = snprintf(tmp_buf, sizeof(tmp_buf), "%s%s%s", sign ? "-" : "", + head, rest); + assert(ret > 0 && ret < sizeof(tmp_buf)); + if(size <= ret) + return -1; + memcpy(buf, tmp_buf, ret); + buf[ret] = '\0'; + return ret; +} + diff --git a/libasn1parser/asn1p_integer.h b/libasn1parser/asn1p_integer.h new file mode 100644 index 000000000..7cd605827 --- /dev/null +++ b/libasn1parser/asn1p_integer.h @@ -0,0 +1,45 @@ +#ifndef ASN1P_INTEGER_H +#define ASN1P_INTEGER_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif /* HAVE_CONFIG_H */ + +#ifdef HAVE_SYS_TYPES_H +#include +#endif /* HAVE_SYS_TYPES_H */ +#ifdef HAVE_INTTYPES_H +#include /* POSIX 1003.1-2001, C99 */ +#else /* HAVE_INTTYPES_H */ +#ifdef HAVE_STDINT_H +#include /* SUSv2+ */ +#endif /* HAVE_STDINT_H */ +#endif /* HAVE_INTTYPES_H */ + +/* + * Basic integer type used in numerous places. + * ASN.1 does not define any limits on this number, so it must be sufficiently + * large to accomodate typical inputs. It does not have to be a dynamically + * allocated type with potentially unlimited width: consider the width of + * an integer defined here as one of the "compiler limitations". + * NOTE: this is NOT a type for ASN.1 "INTEGER" type representation, this + * type is used by the compiler itself to handle large integer values + * specified inside ASN.1 grammar. + */ +#ifdef HAVE_128_BIT_INT +typedef __int128 asn1c_integer_t; +#else +typedef intmax_t asn1c_integer_t; +#endif + +int asn1p_atoi(const char *ptr, asn1c_integer_t *r_value); +const char *asn1p_itoa(asn1c_integer_t value); /* Ptr to a static buf */ +/* + * Return values: + * -1: The value did not fit in the buffer. + * >0: The length in bytes of the stringified numeric value. + */ +int asn1p_itoa_s(char *buf, size_t size, + asn1c_integer_t value); /* Return -1 on error, or length. */ + +#endif /* ASN1P_INTEGER_H */ diff --git a/libasn1parser/asn1parser.c b/libasn1parser/asn1parser.c index 2ade9e972..8b03a3c56 100644 --- a/libasn1parser/asn1parser.c +++ b/libasn1parser/asn1parser.c @@ -161,23 +161,3 @@ _asn1p_fix_modules(asn1p_t *a, const char *fname) { } return 0; } - - -int -asn1p_atoi(const char *ptr, asn1c_integer_t *value) { - errno = 0; /* Clear the error code */ - - if(sizeof(*value) <= sizeof(int)) { - *value = strtol(ptr, 0, 10); - } else { -#ifdef HAVE_STRTOIMAX - *value = strtoimax(ptr, 0, 10); -#elif HAVE_STRTOLL - *value = strtoll(ptr, 0, 10); -#else - *value = strtol(ptr, 0, 10); -#endif - } - - return errno == 0 ? 0 : -1; -} diff --git a/libasn1parser/asn1parser.h b/libasn1parser/asn1parser.h index e83b747ff..076fa7d4e 100644 --- a/libasn1parser/asn1parser.h +++ b/libasn1parser/asn1parser.h @@ -8,36 +8,7 @@ #include "config.h" #endif /* HAVE_CONFIG_H */ -#ifdef HAVE_SYS_TYPES_H -#include -#endif /* HAVE_SYS_TYPES_H */ -#ifdef HAVE_INTTYPES_H -#include /* POSIX 1003.1-2001, C99 */ -#else /* HAVE_INTTYPES_H */ -#ifdef HAVE_STDINT_H -#include /* SUSv2+ */ -#endif /* HAVE_STDINT_H */ -#endif /* HAVE_INTTYPES_H */ - -/* - * Basic integer type used in numerous places. - * ASN.1 does not define any limits on this number, so it must be sufficiently - * large to accomodate typical inputs. It does not have to be a dynamically - * allocated type with potentially unlimited width: consider the width of - * an integer defined here as one of the "compiler limitations". - * NOTE: this is NOT a type for ASN.1 "INTEGER" type representation, this - * type is used by the compiler itself to handle large integer values - * specified inside ASN.1 grammar. - */ -typedef intmax_t asn1c_integer_t; -#ifdef PRIdMAX -#define PRIdASN PRIdMAX -#define PRIuASN PRIuMAX -#else -#define PRIdASN "lld" /* Or j? */ -#define PRIuASN "llu" /* Or j? */ -#endif - +#include "asn1p_integer.h" #include "asn1p_list.h" #include "asn1p_oid.h" /* Object identifiers (OIDs) */ #include "asn1p_ref.h" /* References to custom types */ @@ -69,6 +40,4 @@ asn1p_t *asn1p_parse_file(const char *filename, asn1p_t *asn1p_parse_buffer(const char *buffer, int size /* = -1 */, enum asn1p_flags); -int asn1p_atoi(const char *ptr, asn1c_integer_t *r_value); - #endif /* ASN1PARSER_H */ diff --git a/libasn1print/asn1print.c b/libasn1print/asn1print.c index 0cbf9646f..0c9456504 100644 --- a/libasn1print/asn1print.c +++ b/libasn1print/asn1print.c @@ -156,11 +156,11 @@ asn1print_oid(int prior_len, asn1p_oid_t *oid, enum asn1print_flags flags) { if(arcname) { accum += safe_printf("%s", arcname); if(oid->arcs[ac].number >= 0) { - accum += safe_printf("(%" PRIdASN ")", - oid->arcs[ac].number); + accum += safe_printf("(%s)", + asn1p_itoa(oid->arcs[ac].number)); } } else { - accum += safe_printf("%" PRIdASN, oid->arcs[ac].number); + accum += safe_printf("%s", asn1p_itoa(oid->arcs[ac].number)); } } safe_printf(" }"); @@ -214,7 +214,7 @@ asn1print_value(asn1p_value_t *val, enum asn1print_flags flags) { val->value.v_type, flags, 0); return 0; case ATV_INTEGER: - safe_printf("%" PRIdASN, val->value.v_integer); + safe_printf("%s", asn1p_itoa(val->value.v_integer)); return 0; case ATV_MIN: safe_printf("MIN"); return 0; case ATV_MAX: safe_printf("MAX"); return 0; @@ -476,7 +476,7 @@ asn1print_crange_value(asn1cnst_edge_t *edge, int as_char) { if(as_char) { safe_printf("\"%c\"", (unsigned char)edge->value); } else { - safe_printf("%" PRIdASN, edge->value); + safe_printf("%s", asn1p_itoa(edge->value)); } } return 0; From 0abceb4382fee19c4e5d2488b6041985c7f92c17 Mon Sep 17 00:00:00 2001 From: Krzysztof Witek Date: Tue, 9 Jun 2020 14:34:32 +0200 Subject: [PATCH 23/28] aper: use correct function for APER decoder Signed-off-by: Krzysztof Witek --- skeletons/constr_CHOICE.c | 2 +- skeletons/constr_SEQUENCE.c | 2 +- skeletons/per_opentype.c | 19 +++++++++++++++---- skeletons/per_opentype.h | 3 +++ 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/skeletons/constr_CHOICE.c b/skeletons/constr_CHOICE.c index 4d7ec4c08..0e67196a0 100644 --- a/skeletons/constr_CHOICE.c +++ b/skeletons/constr_CHOICE.c @@ -977,7 +977,7 @@ CHOICE_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, rv = elm->type->aper_decoder(opt_codec_ctx, elm->type, elm->per_constraints, memb_ptr2, pd); } else { - rv = uper_open_type_get(opt_codec_ctx, elm->type, + rv = aper_open_type_get(opt_codec_ctx, elm->type, elm->per_constraints, memb_ptr2, pd); } diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c index 6e50facc9..8a77bc988 100644 --- a/skeletons/constr_SEQUENCE.c +++ b/skeletons/constr_SEQUENCE.c @@ -1400,7 +1400,7 @@ SEQUENCE_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, } ASN_DEBUG("Decoding member %s in %s %p", elm->name, td->name, *memb_ptr2); - rv = uper_open_type_get(opt_codec_ctx, elm->type, + rv = aper_open_type_get(opt_codec_ctx, elm->type, elm->per_constraints, memb_ptr2, pd); if(rv.code != RC_OK) { FREEMEM(epres); diff --git a/skeletons/per_opentype.c b/skeletons/per_opentype.c index 43d656e09..d103de5bf 100644 --- a/skeletons/per_opentype.c +++ b/skeletons/per_opentype.c @@ -83,8 +83,9 @@ aper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints } static asn_dec_rval_t -uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, - asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { +per_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd, + uint8_t is_uper) { asn_dec_rval_t rv; ssize_t chunk_bytes; int repeat; @@ -129,7 +130,10 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, spd.nbits = bufLen << 3; ASN_DEBUG_INDENT_ADD(+4); - rv = td->uper_decoder(ctx, td, constraints, sptr, &spd); + if (is_uper) + rv = td->uper_decoder(ctx, td, constraints, sptr, &spd); + else + rv = td->aper_decoder(ctx, td, constraints, sptr, &spd); ASN_DEBUG_INDENT_ADD(-4); if(rv.code == RC_OK) { @@ -274,7 +278,14 @@ asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { - return uper_open_type_get_simple(ctx, td, constraints, sptr, pd); + return per_open_type_get_simple(ctx, td, constraints, sptr, pd, 1); +} + +asn_dec_rval_t +aper_open_type_get(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { + + return per_open_type_get_simple(ctx, td, constraints, sptr, pd, 0); } int diff --git a/skeletons/per_opentype.h b/skeletons/per_opentype.h index 2117efe64..b2c78fdc8 100644 --- a/skeletons/per_opentype.h +++ b/skeletons/per_opentype.h @@ -10,6 +10,9 @@ extern "C" { #endif asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); +asn_dec_rval_t +aper_open_type_get(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, + asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd); int uper_open_type_skip(asn_codec_ctx_t *opt_codec_ctx, asn_per_data_t *pd); From e9e346064b67a0946d6d56597db1b2e836cd67d0 Mon Sep 17 00:00:00 2001 From: Krzysztof Witek Date: Tue, 9 Jun 2020 14:43:44 +0200 Subject: [PATCH 24/28] aper: deal with byte paddings APER encoded entities are padded on one byte boundaries. This patch skips the padding bits in order to point to the correct byte in the stream. Signed-off-by: Krzysztof Witek --- skeletons/constr_SEQUENCE.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c index 8a77bc988..e372f167f 100644 --- a/skeletons/constr_SEQUENCE.c +++ b/skeletons/constr_SEQUENCE.c @@ -1373,6 +1373,10 @@ SEQUENCE_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ASN_DEBUG("Read in extensions bitmap for %s of %lld bits (%x..)", td->name, (long long)bmlength, *epres); + /* Deal with padding */ + if (aper_get_align(pd) < 0) + ASN__DECODE_STARVED; + /* Go over extensions and read them in */ for(edx = specs->ext_after + 1; edx < td->elements_count; edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; From d158c573fb762857aba9077723ebedd77a56671e Mon Sep 17 00:00:00 2001 From: Krzysztof Witek Date: Tue, 9 Jun 2020 14:49:33 +0200 Subject: [PATCH 25/28] aper: fix invalid read If there is nothing to read we should not access the data buffer. Signed-off-by: Krzysztof Witek --- skeletons/per_support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skeletons/per_support.c b/skeletons/per_support.c index 42244ba6c..3a0fc2b32 100644 --- a/skeletons/per_support.c +++ b/skeletons/per_support.c @@ -119,7 +119,7 @@ per_get_few_bits(asn_per_data_t *pd, int nbits) { (int)pd->moved, (((long)pd->buffer) & 0xf), (int)pd->nboff, (int)pd->nbits, - pd->buffer[0], + nbits ? pd->buffer[0] : 0, (int)(pd->nbits - pd->nboff), (int)accum); From a12c7fa47901bf6dee4cc21702efa6e7ecc1bb4f Mon Sep 17 00:00:00 2001 From: Krzysztof Witek Date: Tue, 9 Jun 2020 14:52:04 +0200 Subject: [PATCH 26/28] aper: workaround for undefined enumeration indexes This patch provides a workaround in case of an extensible enumaration with a huge undefined index. Signed-off-by: Krzysztof Witek --- skeletons/NativeEnumerated.c | 11 ++++++++--- skeletons/per_support.c | 19 ++++++++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/skeletons/NativeEnumerated.c b/skeletons/NativeEnumerated.c index 9e3f3b973..e47d21e34 100644 --- a/skeletons/NativeEnumerated.c +++ b/skeletons/NativeEnumerated.c @@ -169,11 +169,16 @@ NativeEnumerated_decode_aper(asn_codec_ctx_t *opt_codec_ctx, /* * X.691, #10.6: normally small non-negative whole number; */ - value = uper_get_nsnnwn(pd); + /* XXX handle indefinite index length > 64k */ + value = aper_get_nsnnwn(pd, 65537); if(value < 0) ASN__DECODE_STARVED; value += specs->extension - 1; - if(value >= specs->map_count) - ASN__DECODE_FAILED; + if(value >= specs->map_count) { + ASN_DEBUG("Decoded unknown index value %s = %ld", td->name, value); + /* unknown index. Workaround => set the first enumeration value */ + *native = specs->value2enum[0].nat_value; + return rval; + } } *native = specs->value2enum[value].nat_value; diff --git a/skeletons/per_support.c b/skeletons/per_support.c index 3a0fc2b32..0a3d53c00 100644 --- a/skeletons/per_support.c +++ b/skeletons/per_support.c @@ -324,7 +324,24 @@ aper_get_nsnnwn(asn_per_data_t *pd, int range) { /* 2 bytes */ bytes = 2; } else { - return -1; + int length; + + /* handle indefinite range */ + length = per_get_few_bits(pd, 1); + if (length == 0) + return per_get_few_bits(pd, 6); + + if (aper_get_align(pd) < 0) + return -1; + + length = per_get_few_bits(pd, 8); + /* the length is not likely to be that big */ + if (length > 4) + return -1; + value = 0; + if (per_get_many_bits(pd, &value, 0, length * 8) < 0) + return -1; + return value; } if (aper_get_align(pd) < 0) return -1; From d3dbe60400f80c91fe725eb574399a50090ff0ff Mon Sep 17 00:00:00 2001 From: Krzysztof Witek Date: Tue, 9 Jun 2020 14:53:25 +0200 Subject: [PATCH 27/28] aper: fix alignment of octet strings of length less than 3 bytes The X.691 specs state that: "Bitstrings constrained to a _fixed length_ less than or equal to 16 bits do not cause octet alignment. Larger bitstrings are octet-aligned in the ALIGNED variant." This patch takes into account the above statement that only applyes to fixed length strings. Signed-off-by: Krzysztof Witek --- skeletons/OCTET_STRING.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/skeletons/OCTET_STRING.c b/skeletons/OCTET_STRING.c index 99b9da962..131542d17 100644 --- a/skeletons/OCTET_STRING.c +++ b/skeletons/OCTET_STRING.c @@ -1597,7 +1597,9 @@ OCTET_STRING_decode_aper(asn_codec_ctx_t *opt_codec_ctx, /* X.691, #16.7: long fixed length encoding (up to 64K octets) */ if(csiz->effective_bits == 0) { int ret; - if (st->size > 2) { /* X.691 #16 NOTE 1 */ + + /* X.691 #16 NOTE 1 for fixed length (<=16 bits) strings */ + if (st->size > 2 || csiz->range_bits != 0) { if (aper_get_align(pd) < 0) RETURN(RC_FAIL); } @@ -1646,7 +1648,8 @@ OCTET_STRING_decode_aper(asn_codec_ctx_t *opt_codec_ctx, (long)csiz->effective_bits, (long)raw_len, repeat ? "repeat" : "once", td->name); - if (raw_len > 2) { /* X.691 #16 NOTE 1 */ + /* X.691 #16 NOTE 1 for fixed length (<=16 bits) strings */ + if (raw_len > 2 || csiz->range_bits != 0) { if (aper_get_align(pd) < 0) RETURN(RC_FAIL); } @@ -1956,7 +1959,8 @@ OCTET_STRING_encode_aper(asn_TYPE_descriptor_t *td, ret = per_put_few_bits(po, sizeinunits - csiz->lower_bound, csiz->effective_bits); if(ret) ASN__ENCODE_FAILED; - if (st->size > 2) { /* X.691 #16 NOTE 1 */ + /* X.691 #16 NOTE 1 for fixed length (<=16 bits) strings */ + if (st->size > 2 || csiz->range_bits != 0) { if (aper_put_align(po) < 0) ASN__ENCODE_FAILED; } From af89519f56297ee478056ece9cec60610155132a Mon Sep 17 00:00:00 2001 From: Maxim Kuzmin Date: Wed, 11 Sep 2024 18:25:44 +0300 Subject: [PATCH 28/28] Fixed some warnings --- skeletons/INTEGER.c | 4 ++-- skeletons/per_decoder.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/skeletons/INTEGER.c b/skeletons/INTEGER.c index a5fbc20b4..392a4065d 100644 --- a/skeletons/INTEGER.c +++ b/skeletons/INTEGER.c @@ -773,8 +773,8 @@ INTEGER_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ? asn_ulong2INTEGER(st, value) : asn_long2INTEGER(st, value)) ASN__DECODE_FAILED; - ASN_DEBUG("Got value %lld + low %lld", - value, ct->lower_bound); + ASN_DEBUG("Got value %lld + low %lld", + value, ct->lower_bound); } return rval; } else { diff --git a/skeletons/per_decoder.c b/skeletons/per_decoder.c index 4fc07c480..0dce8e874 100644 --- a/skeletons/per_decoder.c +++ b/skeletons/per_decoder.c @@ -160,7 +160,7 @@ aper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sp */ if(!td->aper_decoder) ASN__DECODE_FAILED; /* PER is not compiled in */ - rval = td->aper_decoder(opt_codec_ctx, td, 0, sptr, &pd); + rval = td->aper_decoder(opt_codec_ctx, td, 0, sptr, &pd); if(rval.code == RC_OK) { /* Return the number of consumed bits */ rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3)