From 3a85aab40b2a866b8ba7d0b32c74e4f3fe13ba7e Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Thu, 13 Sep 2012 21:34:46 +0200 Subject: _asn1_add_node -> _asn1_add_static_node --- lib/ASN1.c | 96 +++++++++++++++++++++++++------------------------- lib/ASN1.y | 104 +++++++++++++++++++++++++++---------------------------- lib/parser_aux.c | 4 +-- lib/parser_aux.h | 2 +- lib/structure.c | 2 +- 5 files changed, 104 insertions(+), 104 deletions(-) (limited to 'lib') diff --git a/lib/ASN1.c b/lib/ASN1.c index d9b9133..5289e6a 100644 --- a/lib/ASN1.c +++ b/lib/ASN1.c @@ -1669,7 +1669,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 121 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_DEFINITIONS|(yyvsp[(3) - (8)].constant)); + {(yyval.node)=_asn1_add_static_node(TYPE_DEFINITIONS|(yyvsp[(3) - (8)].constant)); _asn1_set_name((yyval.node),_asn1_get_name((yyvsp[(1) - (8)].node))); _asn1_set_name((yyvsp[(1) - (8)].node),""); _asn1_set_right((yyvsp[(1) - (8)].node),(yyvsp[(7) - (8)].node)); @@ -1747,7 +1747,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 151 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_CONSTANT); + {(yyval.node)=_asn1_add_static_node(TYPE_CONSTANT); _asn1_set_value((yyval.node),(yyvsp[(2) - (3)].str),strlen((yyvsp[(2) - (3)].str))+1);} break; @@ -1755,7 +1755,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 153 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_CONSTANT); + {(yyval.node)=_asn1_add_static_node(TYPE_CONSTANT); _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str)); _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);} break; @@ -1779,7 +1779,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 163 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_CONSTANT); + {(yyval.node)=_asn1_add_static_node(TYPE_CONSTANT); _asn1_set_value((yyval.node),(yyvsp[(1) - (1)].str),strlen((yyvsp[(1) - (1)].str))+1);} break; @@ -1787,7 +1787,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 165 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_CONSTANT); + {(yyval.node)=_asn1_add_static_node(TYPE_CONSTANT); _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str)); _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);} break; @@ -1832,7 +1832,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 180 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_TAG); + {(yyval.node)=_asn1_add_static_node(TYPE_TAG); _asn1_set_value((yyval.node),(yyvsp[(2) - (3)].str),strlen((yyvsp[(2) - (3)].str))+1);} break; @@ -1840,7 +1840,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 182 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_TAG | (yyvsp[(2) - (4)].constant)); + {(yyval.node)=_asn1_add_static_node(TYPE_TAG | (yyvsp[(2) - (4)].constant)); _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);} break; @@ -1869,7 +1869,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 191 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_DEFAULT); + {(yyval.node)=_asn1_add_static_node(TYPE_DEFAULT); _asn1_set_value((yyval.node),(yyvsp[(2) - (2)].str),strlen((yyvsp[(2) - (2)].str))+1);} break; @@ -1877,28 +1877,28 @@ yyreduce: /* Line 1806 of yacc.c */ #line 193 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_DEFAULT|CONST_TRUE);} + {(yyval.node)=_asn1_add_static_node(TYPE_DEFAULT|CONST_TRUE);} break; case 30: /* Line 1806 of yacc.c */ #line 194 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_DEFAULT|CONST_FALSE);} + {(yyval.node)=_asn1_add_static_node(TYPE_DEFAULT|CONST_FALSE);} break; case 33: /* Line 1806 of yacc.c */ #line 203 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_INTEGER);} + {(yyval.node)=_asn1_add_static_node(TYPE_INTEGER);} break; case 34: /* Line 1806 of yacc.c */ #line 204 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_INTEGER|CONST_LIST); + {(yyval.node)=_asn1_add_static_node(TYPE_INTEGER|CONST_LIST); _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));} break; @@ -1906,15 +1906,15 @@ yyreduce: /* Line 1806 of yacc.c */ #line 206 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_INTEGER);} + {(yyval.node)=_asn1_add_static_node(TYPE_INTEGER);} break; case 36: /* Line 1806 of yacc.c */ #line 208 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_INTEGER|CONST_MIN_MAX); - _asn1_set_down((yyval.node),_asn1_add_node(TYPE_SIZE)); + {(yyval.node)=_asn1_add_static_node(TYPE_INTEGER|CONST_MIN_MAX); + _asn1_set_down((yyval.node),_asn1_add_static_node(TYPE_SIZE)); _asn1_set_value(_asn1_get_down((yyval.node)),(yyvsp[(6) - (7)].str),strlen((yyvsp[(6) - (7)].str))+1); _asn1_set_name(_asn1_get_down((yyval.node)),(yyvsp[(3) - (7)].str));} break; @@ -1923,28 +1923,28 @@ yyreduce: /* Line 1806 of yacc.c */ #line 214 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_BOOLEAN);} + {(yyval.node)=_asn1_add_static_node(TYPE_BOOLEAN);} break; case 38: /* Line 1806 of yacc.c */ #line 217 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_TIME|CONST_UTC);} + {(yyval.node)=_asn1_add_static_node(TYPE_TIME|CONST_UTC);} break; case 39: /* Line 1806 of yacc.c */ #line 218 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_TIME|CONST_GENERALIZED);} + {(yyval.node)=_asn1_add_static_node(TYPE_TIME|CONST_GENERALIZED);} break; case 40: /* Line 1806 of yacc.c */ #line 221 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_SIZE|CONST_1_PARAM); + {(yyval.node)=_asn1_add_static_node(TYPE_SIZE|CONST_1_PARAM); _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);} break; @@ -1952,7 +1952,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 224 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_SIZE|CONST_MIN_MAX); + {(yyval.node)=_asn1_add_static_node(TYPE_SIZE|CONST_MIN_MAX); _asn1_set_value((yyval.node),(yyvsp[(3) - (7)].str),strlen((yyvsp[(3) - (7)].str))+1); _asn1_set_name((yyval.node),(yyvsp[(6) - (7)].str));} break; @@ -1975,14 +1975,14 @@ yyreduce: /* Line 1806 of yacc.c */ #line 233 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_GENERALSTRING);} + {(yyval.node)=_asn1_add_static_node(TYPE_GENERALSTRING);} break; case 45: /* Line 1806 of yacc.c */ #line 234 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_GENERALSTRING|CONST_SIZE); + {(yyval.node)=_asn1_add_static_node(TYPE_GENERALSTRING|CONST_SIZE); _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));} break; @@ -1990,14 +1990,14 @@ yyreduce: /* Line 1806 of yacc.c */ #line 238 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_OCTET_STRING);} + {(yyval.node)=_asn1_add_static_node(TYPE_OCTET_STRING);} break; case 47: /* Line 1806 of yacc.c */ #line 239 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_OCTET_STRING|CONST_SIZE); + {(yyval.node)=_asn1_add_static_node(TYPE_OCTET_STRING|CONST_SIZE); _asn1_set_down((yyval.node),(yyvsp[(3) - (3)].node));} break; @@ -2005,7 +2005,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 243 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_CONSTANT); + {(yyval.node)=_asn1_add_static_node(TYPE_CONSTANT); _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str)); _asn1_set_value((yyval.node),(yyvsp[(3) - (4)].str),strlen((yyvsp[(3) - (4)].str))+1);} break; @@ -2029,21 +2029,21 @@ yyreduce: /* Line 1806 of yacc.c */ #line 253 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_BIT_STRING);} + {(yyval.node)=_asn1_add_static_node(TYPE_BIT_STRING);} break; case 52: /* Line 1806 of yacc.c */ #line 254 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_BIT_STRING|CONST_SIZE);} + {(yyval.node)=_asn1_add_static_node(TYPE_BIT_STRING|CONST_SIZE);} break; case 53: /* Line 1806 of yacc.c */ #line 256 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_BIT_STRING|CONST_LIST); + {(yyval.node)=_asn1_add_static_node(TYPE_BIT_STRING|CONST_LIST); _asn1_set_down((yyval.node),(yyvsp[(4) - (5)].node));} break; @@ -2051,7 +2051,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 261 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_ENUMERATED|CONST_LIST); + {(yyval.node)=_asn1_add_static_node(TYPE_ENUMERATED|CONST_LIST); _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));} break; @@ -2059,14 +2059,14 @@ yyreduce: /* Line 1806 of yacc.c */ #line 266 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_OBJECT_ID);} + {(yyval.node)=_asn1_add_static_node(TYPE_OBJECT_ID);} break; case 56: /* Line 1806 of yacc.c */ #line 269 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_IDENTIFIER); + {(yyval.node)=_asn1_add_static_node(TYPE_IDENTIFIER); _asn1_set_value((yyval.node),(yyvsp[(1) - (1)].str),strlen((yyvsp[(1) - (1)].str))+1);} break; @@ -2074,7 +2074,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 271 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_IDENTIFIER|CONST_SIZE); + {(yyval.node)=_asn1_add_static_node(TYPE_IDENTIFIER|CONST_SIZE); _asn1_set_value((yyval.node),(yyvsp[(1) - (2)].str),strlen((yyvsp[(1) - (2)].str))+1); _asn1_set_down((yyval.node),(yyvsp[(2) - (2)].node));} break; @@ -2160,7 +2160,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 286 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_NULL);} + {(yyval.node)=_asn1_add_static_node(TYPE_NULL);} break; case 71: @@ -2228,7 +2228,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 310 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_SEQUENCE); + {(yyval.node)=_asn1_add_static_node(TYPE_SEQUENCE); _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));} break; @@ -2236,7 +2236,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 312 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_SEQUENCE_OF); + {(yyval.node)=_asn1_add_static_node(TYPE_SEQUENCE_OF); _asn1_set_down((yyval.node),(yyvsp[(3) - (3)].node));} break; @@ -2244,7 +2244,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 314 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_SEQUENCE_OF|CONST_SIZE); + {(yyval.node)=_asn1_add_static_node(TYPE_SEQUENCE_OF|CONST_SIZE); _asn1_set_right((yyvsp[(2) - (4)].node),(yyvsp[(4) - (4)].node)); _asn1_set_down((yyval.node),(yyvsp[(2) - (4)].node));} break; @@ -2253,7 +2253,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 319 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_SET); + {(yyval.node)=_asn1_add_static_node(TYPE_SET); _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));} break; @@ -2261,7 +2261,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 321 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_SET_OF); + {(yyval.node)=_asn1_add_static_node(TYPE_SET_OF); _asn1_set_down((yyval.node),(yyvsp[(3) - (3)].node));} break; @@ -2269,7 +2269,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 323 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_SET_OF|CONST_SIZE); + {(yyval.node)=_asn1_add_static_node(TYPE_SET_OF|CONST_SIZE); _asn1_set_right((yyvsp[(2) - (4)].node),(yyvsp[(4) - (4)].node)); _asn1_set_down((yyval.node),(yyvsp[(2) - (4)].node));} break; @@ -2278,7 +2278,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 328 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_CHOICE); + {(yyval.node)=_asn1_add_static_node(TYPE_CHOICE); _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node));} break; @@ -2286,15 +2286,15 @@ yyreduce: /* Line 1806 of yacc.c */ #line 332 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_ANY);} + {(yyval.node)=_asn1_add_static_node(TYPE_ANY);} break; case 87: /* Line 1806 of yacc.c */ #line 333 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_ANY|CONST_DEFINED_BY); - _asn1_set_down((yyval.node),_asn1_add_node(TYPE_CONSTANT)); + {(yyval.node)=_asn1_add_static_node(TYPE_ANY|CONST_DEFINED_BY); + _asn1_set_down((yyval.node),_asn1_add_static_node(TYPE_CONSTANT)); _asn1_set_name(_asn1_get_down((yyval.node)),(yyvsp[(4) - (4)].str));} break; @@ -2309,7 +2309,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 342 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_OBJECT_ID|CONST_ASSIGN); + {(yyval.node)=_asn1_add_static_node(TYPE_OBJECT_ID|CONST_ASSIGN); _asn1_set_name((yyval.node),(yyvsp[(1) - (7)].str)); _asn1_set_down((yyval.node),(yyvsp[(6) - (7)].node));} break; @@ -2318,7 +2318,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 346 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_OBJECT_ID|CONST_ASSIGN|CONST_1_PARAM); + {(yyval.node)=_asn1_add_static_node(TYPE_OBJECT_ID|CONST_ASSIGN|CONST_1_PARAM); _asn1_set_name((yyval.node),(yyvsp[(1) - (6)].str)); _asn1_set_value((yyval.node),(yyvsp[(2) - (6)].str),strlen((yyvsp[(2) - (6)].str))+1); _asn1_set_down((yyval.node),(yyvsp[(5) - (6)].node));} @@ -2328,7 +2328,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 351 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_INTEGER|CONST_ASSIGN); + {(yyval.node)=_asn1_add_static_node(TYPE_INTEGER|CONST_ASSIGN); _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str)); _asn1_set_value((yyval.node),(yyvsp[(4) - (4)].str),strlen((yyvsp[(4) - (4)].str))+1);} break; @@ -2366,7 +2366,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 365 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_OBJECT_ID); + {(yyval.node)=_asn1_add_static_node(TYPE_OBJECT_ID); _asn1_set_down((yyval.node),(yyvsp[(3) - (4)].node)); _asn1_set_name((yyval.node),(yyvsp[(1) - (4)].str));} break; @@ -2375,7 +2375,7 @@ yyreduce: /* Line 1806 of yacc.c */ #line 368 "ASN1.y" - {(yyval.node)=_asn1_add_node(TYPE_OBJECT_ID); + {(yyval.node)=_asn1_add_static_node(TYPE_OBJECT_ID); _asn1_set_name((yyval.node),(yyvsp[(1) - (3)].str));} break; diff --git a/lib/ASN1.y b/lib/ASN1.y index 80a68cc..0611e85 100644 --- a/lib/ASN1.y +++ b/lib/ASN1.y @@ -118,7 +118,7 @@ static int _asn1_yylex(void); definitions: definitions_id DEFINITIONS explicit_implicit TAGS "::=" BEGIN /* imports_def */ type_constant_list END - {$$=_asn1_add_node(TYPE_DEFINITIONS|$3); + {$$=_asn1_add_static_node(TYPE_DEFINITIONS|$3); _asn1_set_name($$,_asn1_get_name($1)); _asn1_set_name($1,""); _asn1_set_right($1,$7); @@ -148,9 +148,9 @@ pos_neg_identifier : pos_neg_num {strcpy($$,$1);} | IDENTIFIER {strcpy($$,$1);} ; -constant: '(' pos_neg_num ')' {$$=_asn1_add_node(TYPE_CONSTANT); +constant: '(' pos_neg_num ')' {$$=_asn1_add_static_node(TYPE_CONSTANT); _asn1_set_value($$,$2,strlen($2)+1);} - | IDENTIFIER'('pos_neg_num')' {$$=_asn1_add_node(TYPE_CONSTANT); + | IDENTIFIER'('pos_neg_num')' {$$=_asn1_add_static_node(TYPE_CONSTANT); _asn1_set_name($$,$1); _asn1_set_value($$,$3,strlen($3)+1);} ; @@ -160,9 +160,9 @@ constant_list: constant {$$=$1;} _asn1_set_right(_asn1_get_last_right($1),$3);} ; -obj_constant: num_identifier {$$=_asn1_add_node(TYPE_CONSTANT); +obj_constant: num_identifier {$$=_asn1_add_static_node(TYPE_CONSTANT); _asn1_set_value($$,$1,strlen($1)+1);} - | IDENTIFIER'('NUM')' {$$=_asn1_add_node(TYPE_CONSTANT); + | IDENTIFIER'('NUM')' {$$=_asn1_add_static_node(TYPE_CONSTANT); _asn1_set_name($$,$1); _asn1_set_value($$,$3,strlen($3)+1);} ; @@ -177,9 +177,9 @@ class : UNIVERSAL {$$=CONST_UNIVERSAL;} | APPLICATION {$$=CONST_APPLICATION;} ; -tag_type : '[' NUM ']' {$$=_asn1_add_node(TYPE_TAG); +tag_type : '[' NUM ']' {$$=_asn1_add_static_node(TYPE_TAG); _asn1_set_value($$,$2,strlen($2)+1);} - | '[' class NUM ']' {$$=_asn1_add_node(TYPE_TAG | $2); + | '[' class NUM ']' {$$=_asn1_add_static_node(TYPE_TAG | $2); _asn1_set_value($$,$3,strlen($3)+1);} ; @@ -188,10 +188,10 @@ tag : tag_type {$$=$1;} | tag_type IMPLICIT {$$=_asn1_mod_type($1,CONST_IMPLICIT);} ; -default : DEFAULT pos_neg_identifier {$$=_asn1_add_node(TYPE_DEFAULT); +default : DEFAULT pos_neg_identifier {$$=_asn1_add_static_node(TYPE_DEFAULT); _asn1_set_value($$,$2,strlen($2)+1);} - | DEFAULT ASN1_TRUE {$$=_asn1_add_node(TYPE_DEFAULT|CONST_TRUE);} - | DEFAULT ASN1_FALSE {$$=_asn1_add_node(TYPE_DEFAULT|CONST_FALSE);} + | DEFAULT ASN1_TRUE {$$=_asn1_add_static_node(TYPE_DEFAULT|CONST_TRUE);} + | DEFAULT ASN1_FALSE {$$=_asn1_add_static_node(TYPE_DEFAULT|CONST_FALSE);} ; @@ -200,28 +200,28 @@ pos_neg_list: pos_neg_num ; -integer_def: INTEGER {$$=_asn1_add_node(TYPE_INTEGER);} - | INTEGER'{'constant_list'}' {$$=_asn1_add_node(TYPE_INTEGER|CONST_LIST); +integer_def: INTEGER {$$=_asn1_add_static_node(TYPE_INTEGER);} + | INTEGER'{'constant_list'}' {$$=_asn1_add_static_node(TYPE_INTEGER|CONST_LIST); _asn1_set_down($$,$3);} - | integer_def'(' pos_neg_list ')' {$$=_asn1_add_node(TYPE_INTEGER);} + | integer_def'(' pos_neg_list ')' {$$=_asn1_add_static_node(TYPE_INTEGER);} | integer_def'('num_identifier'.''.'num_identifier')' - {$$=_asn1_add_node(TYPE_INTEGER|CONST_MIN_MAX); - _asn1_set_down($$,_asn1_add_node(TYPE_SIZE)); + {$$=_asn1_add_static_node(TYPE_INTEGER|CONST_MIN_MAX); + _asn1_set_down($$,_asn1_add_static_node(TYPE_SIZE)); _asn1_set_value(_asn1_get_down($$),$6,strlen($6)+1); _asn1_set_name(_asn1_get_down($$),$3);} ; -boolean_def: BOOLEAN {$$=_asn1_add_node(TYPE_BOOLEAN);} +boolean_def: BOOLEAN {$$=_asn1_add_static_node(TYPE_BOOLEAN);} ; -Time: UTCTime {$$=_asn1_add_node(TYPE_TIME|CONST_UTC);} - | GeneralizedTime {$$=_asn1_add_node(TYPE_TIME|CONST_GENERALIZED);} +Time: UTCTime {$$=_asn1_add_static_node(TYPE_TIME|CONST_UTC);} + | GeneralizedTime {$$=_asn1_add_static_node(TYPE_TIME|CONST_GENERALIZED);} ; -size_def2: SIZE'('num_identifier')' {$$=_asn1_add_node(TYPE_SIZE|CONST_1_PARAM); +size_def2: SIZE'('num_identifier')' {$$=_asn1_add_static_node(TYPE_SIZE|CONST_1_PARAM); _asn1_set_value($$,$3,strlen($3)+1);} | SIZE'('num_identifier'.''.'num_identifier')' - {$$=_asn1_add_node(TYPE_SIZE|CONST_MIN_MAX); + {$$=_asn1_add_static_node(TYPE_SIZE|CONST_MIN_MAX); _asn1_set_value($$,$3,strlen($3)+1); _asn1_set_name($$,$6);} ; @@ -230,17 +230,17 @@ size_def: size_def2 {$$=$1;} | '(' size_def2 ')' {$$=$2;} ; -generalstring_def: GeneralString {$$=_asn1_add_node(TYPE_GENERALSTRING);} - | GeneralString size_def {$$=_asn1_add_node(TYPE_GENERALSTRING|CONST_SIZE); +generalstring_def: GeneralString {$$=_asn1_add_static_node(TYPE_GENERALSTRING);} + | GeneralString size_def {$$=_asn1_add_static_node(TYPE_GENERALSTRING|CONST_SIZE); _asn1_set_down($$,$2);} ; -octet_string_def : OCTET STRING {$$=_asn1_add_node(TYPE_OCTET_STRING);} - | OCTET STRING size_def {$$=_asn1_add_node(TYPE_OCTET_STRING|CONST_SIZE); +octet_string_def : OCTET STRING {$$=_asn1_add_static_node(TYPE_OCTET_STRING);} + | OCTET STRING size_def {$$=_asn1_add_static_node(TYPE_OCTET_STRING|CONST_SIZE); _asn1_set_down($$,$3);} ; -bit_element : IDENTIFIER'('NUM')' {$$=_asn1_add_node(TYPE_CONSTANT); +bit_element : IDENTIFIER'('NUM')' {$$=_asn1_add_static_node(TYPE_CONSTANT); _asn1_set_name($$,$1); _asn1_set_value($$,$3,strlen($3)+1);} ; @@ -250,25 +250,25 @@ bit_element_list : bit_element {$$=$1;} _asn1_set_right(_asn1_get_last_right($1),$3);} ; -bit_string_def : BIT STRING {$$=_asn1_add_node(TYPE_BIT_STRING);} - | BIT STRING size_def {$$=_asn1_add_node(TYPE_BIT_STRING|CONST_SIZE);} +bit_string_def : BIT STRING {$$=_asn1_add_static_node(TYPE_BIT_STRING);} + | BIT STRING size_def {$$=_asn1_add_static_node(TYPE_BIT_STRING|CONST_SIZE);} | BIT STRING'{'bit_element_list'}' - {$$=_asn1_add_node(TYPE_BIT_STRING|CONST_LIST); + {$$=_asn1_add_static_node(TYPE_BIT_STRING|CONST_LIST); _asn1_set_down($$,$4);} ; enumerated_def : ENUMERATED'{'bit_element_list'}' - {$$=_asn1_add_node(TYPE_ENUMERATED|CONST_LIST); + {$$=_asn1_add_static_node(TYPE_ENUMERATED|CONST_LIST); _asn1_set_down($$,$3);} ; -object_def : OBJECT STR_IDENTIFIER {$$=_asn1_add_node(TYPE_OBJECT_ID);} +object_def : OBJECT STR_IDENTIFIER {$$=_asn1_add_static_node(TYPE_OBJECT_ID);} ; -type_assig_right: IDENTIFIER {$$=_asn1_add_node(TYPE_IDENTIFIER); +type_assig_right: IDENTIFIER {$$=_asn1_add_static_node(TYPE_IDENTIFIER); _asn1_set_value($$,$1,strlen($1)+1);} - | IDENTIFIER size_def {$$=_asn1_add_node(TYPE_IDENTIFIER|CONST_SIZE); + | IDENTIFIER size_def {$$=_asn1_add_static_node(TYPE_IDENTIFIER|CONST_SIZE); _asn1_set_value($$,$1,strlen($1)+1); _asn1_set_down($$,$2);} | integer_def {$$=$1;} @@ -283,7 +283,7 @@ type_assig_right: IDENTIFIER {$$=_asn1_add_node(TYPE_IDENTIFIER); | choise_def {$$=$1;} | any_def {$$=$1;} | set_def {$$=$1;} - | TOKEN_NULL {$$=_asn1_add_node(TYPE_NULL);} + | TOKEN_NULL {$$=_asn1_add_static_node(TYPE_NULL);} ; type_assig_right_tag : type_assig_right {$$=$1;} @@ -307,31 +307,31 @@ type_assig_list : type_assig {$$=$1;} _asn1_set_right(_asn1_get_last_right($1),$3);} ; -sequence_def : SEQUENCE'{'type_assig_list'}' {$$=_asn1_add_node(TYPE_SEQUENCE); +sequence_def : SEQUENCE'{'type_assig_list'}' {$$=_asn1_add_static_node(TYPE_SEQUENCE); _asn1_set_down($$,$3);} - | SEQUENCE OF type_assig_right {$$=_asn1_add_node(TYPE_SEQUENCE_OF); + | SEQUENCE OF type_assig_right {$$=_asn1_add_static_node(TYPE_SEQUENCE_OF); _asn1_set_down($$,$3);} - | SEQUENCE size_def OF type_assig_right {$$=_asn1_add_node(TYPE_SEQUENCE_OF|CONST_SIZE); + | SEQUENCE size_def OF type_assig_right {$$=_asn1_add_static_node(TYPE_SEQUENCE_OF|CONST_SIZE); _asn1_set_right($2,$4); _asn1_set_down($$,$2);} ; -set_def : SET'{'type_assig_list'}' {$$=_asn1_add_node(TYPE_SET); +set_def : SET'{'type_assig_list'}' {$$=_asn1_add_static_node(TYPE_SET); _asn1_set_down($$,$3);} - | SET OF type_assig_right {$$=_asn1_add_node(TYPE_SET_OF); + | SET OF type_assig_right {$$=_asn1_add_static_node(TYPE_SET_OF); _asn1_set_down($$,$3);} - | SET size_def OF type_assig_right {$$=_asn1_add_node(TYPE_SET_OF|CONST_SIZE); + | SET size_def OF type_assig_right {$$=_asn1_add_static_node(TYPE_SET_OF|CONST_SIZE); _asn1_set_right($2,$4); _asn1_set_down($$,$2);} ; -choise_def : CHOICE'{'type_assig_list'}' {$$=_asn1_add_node(TYPE_CHOICE); +choise_def : CHOICE'{'type_assig_list'}' {$$=_asn1_add_static_node(TYPE_CHOICE); _asn1_set_down($$,$3);} ; -any_def : ANY {$$=_asn1_add_node(TYPE_ANY);} - | ANY DEFINED BY IDENTIFIER {$$=_asn1_add_node(TYPE_ANY|CONST_DEFINED_BY); - _asn1_set_down($$,_asn1_add_node(TYPE_CONSTANT)); +any_def : ANY {$$=_asn1_add_static_node(TYPE_ANY);} + | ANY DEFINED BY IDENTIFIER {$$=_asn1_add_static_node(TYPE_ANY|CONST_DEFINED_BY); + _asn1_set_down($$,_asn1_add_static_node(TYPE_CONSTANT)); _asn1_set_name(_asn1_get_down($$),$4);} ; @@ -339,16 +339,16 @@ type_def : IDENTIFIER "::=" type_assig_right_tag {$$=_asn1_set_name($3,$1);} ; constant_def : IDENTIFIER OBJECT STR_IDENTIFIER "::=" '{'obj_constant_list'}' - {$$=_asn1_add_node(TYPE_OBJECT_ID|CONST_ASSIGN); + {$$=_asn1_add_static_node(TYPE_OBJECT_ID|CONST_ASSIGN); _asn1_set_name($$,$1); _asn1_set_down($$,$6);} | IDENTIFIER IDENTIFIER "::=" '{' obj_constant_list '}' - {$$=_asn1_add_node(TYPE_OBJECT_ID|CONST_ASSIGN|CONST_1_PARAM); + {$$=_asn1_add_static_node(TYPE_OBJECT_ID|CONST_ASSIGN|CONST_1_PARAM); _asn1_set_name($$,$1); _asn1_set_value($$,$2,strlen($2)+1); _asn1_set_down($$,$5);} | IDENTIFIER INTEGER "::=" pos_neg_num - {$$=_asn1_add_node(TYPE_INTEGER|CONST_ASSIGN); + {$$=_asn1_add_static_node(TYPE_INTEGER|CONST_ASSIGN); _asn1_set_name($$,$1); _asn1_set_value($$,$4,strlen($4)+1);} ; @@ -362,27 +362,27 @@ type_constant_list : type_constant {$$=$1;} _asn1_set_right(_asn1_get_last_right($1),$2);} ; -definitions_id : IDENTIFIER '{' obj_constant_list '}' {$$=_asn1_add_node(TYPE_OBJECT_ID); +definitions_id : IDENTIFIER '{' obj_constant_list '}' {$$=_asn1_add_static_node(TYPE_OBJECT_ID); _asn1_set_down($$,$3); _asn1_set_name($$,$1);} - | IDENTIFIER '{' '}' {$$=_asn1_add_node(TYPE_OBJECT_ID); + | IDENTIFIER '{' '}' {$$=_asn1_add_static_node(TYPE_OBJECT_ID); _asn1_set_name($$,$1);} ; /* -identifier_list : IDENTIFIER {$$=_asn1_add_node(TYPE_IDENTIFIER); +identifier_list : IDENTIFIER {$$=_asn1_add_static_node(TYPE_IDENTIFIER); _asn1_set_name($$,$1);} | identifier_list IDENTIFIER {$$=$1; - _asn1_set_right(_asn1_get_last_right($$),_asn1_add_node(TYPE_IDENTIFIER)); + _asn1_set_right(_asn1_get_last_right($$),_asn1_add_static_node(TYPE_IDENTIFIER)); _asn1_set_name(_asn1_get_last_right($$),$2);} ; imports_def : empty {$$=NULL;} | IMPORTS identifier_list FROM IDENTIFIER obj_constant_list - {$$=_asn1_add_node(TYPE_IMPORTS); - _asn1_set_down($$,_asn1_add_node(TYPE_OBJECT_ID)); + {$$=_asn1_add_static_node(TYPE_IMPORTS); + _asn1_set_down($$,_asn1_add_static_node(TYPE_OBJECT_ID)); _asn1_set_name(_asn1_get_down($$),$4); _asn1_set_down(_asn1_get_down($$),$5); _asn1_set_right($$,$2);} diff --git a/lib/parser_aux.c b/lib/parser_aux.c index d5f3166..50bc146 100644 --- a/lib/parser_aux.c +++ b/lib/parser_aux.c @@ -43,7 +43,7 @@ typedef struct list_struct list_type *firstElement = NULL; /******************************************************/ -/* Function : _asn1_add_node */ +/* Function : _asn1_add_static_node */ /* Description: creates a new NODE_ASN element and */ /* puts it in the list pointed by firstElement. */ /* Parameters: */ @@ -52,7 +52,7 @@ list_type *firstElement = NULL; /* Return: pointer to the new element. */ /******************************************************/ ASN1_TYPE -_asn1_add_node (unsigned int type) +_asn1_add_static_node (unsigned int type) { list_type *listElement; ASN1_TYPE punt; diff --git a/lib/parser_aux.h b/lib/parser_aux.h index 7156088..0fc5f0d 100644 --- a/lib/parser_aux.h +++ b/lib/parser_aux.h @@ -27,7 +27,7 @@ /***************************************/ /* Functions used by ASN.1 parser */ /***************************************/ -ASN1_TYPE _asn1_add_node (unsigned int type); +ASN1_TYPE _asn1_add_static_node (unsigned int type); ASN1_TYPE _asn1_set_value (ASN1_TYPE node, const void *value, unsigned int len); diff --git a/lib/structure.c b/lib/structure.c index b520048..c02b732 100644 --- a/lib/structure.c +++ b/lib/structure.c @@ -191,7 +191,7 @@ asn1_array2tree (const ASN1_ARRAY_TYPE * array, ASN1_TYPE * definitions, k = 0; while (array[k].value || array[k].type || array[k].name) { - p = _asn1_add_node (array[k].type & (~CONST_DOWN)); + p = _asn1_add_static_node (array[k].type & (~CONST_DOWN)); if (array[k].name) _asn1_set_name (p, array[k].name); if (array[k].value) -- cgit v1.2.3