2 * Copyright (C) 2004 Simon Josefsson
3 * Copyright (C) 2002 Fabio Fiorina
5 * This file is part of LIBASN1.
7 * GNUTLS is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * GNUTLS is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
30 #define LIBTASN1_DEBUG
31 #define LIBTASN1_DEBUG_PARSER
32 #define LIBTASN1_DEBUG_INTEGER
37 #define MAX32 4294967295
38 #define MAX24 16777215
41 #define MAX_LOG_SIZE 1024 /* maximum number of characters of a log message */
42 #define MAX_NAME_SIZE 128 /* maximum number of characters of a name inside an ASN1 file definiton */
43 #define MAX_ERROR_DESCRIPTION_SIZE 128 /* maximum number of characters of a description message */
45 /* define used for visiting trees */
50 /****************************************/
51 /* Returns the first 8 bits. */
52 /* Used with the field type of node_asn */
53 /****************************************/
54 #define type_field(x) (x&0xFF)
56 /* List of constants for field type of typedef node_asn */
57 #define TYPE_CONSTANT 1
58 #define TYPE_IDENTIFIER 2
59 #define TYPE_INTEGER 3
60 #define TYPE_BOOLEAN 4
61 #define TYPE_SEQUENCE 5
62 #define TYPE_BIT_STRING 6
63 #define TYPE_OCTET_STRING 7
65 #define TYPE_DEFAULT 9
67 #define TYPE_SEQUENCE_OF 11
68 #define TYPE_OBJECT_ID 12
71 #define TYPE_SET_OF 15
72 #define TYPE_DEFINITIONS 16
74 #define TYPE_CHOICE 18
75 #define TYPE_IMPORTS 19
77 #define TYPE_ENUMERATED 21
78 #define TYPE_GENERALSTRING 27
81 /***********************************************************************/
82 /* List of constants to better specify the type of typedef node_asn. */
83 /***********************************************************************/
84 /* Used with TYPE_TAG */
85 #define CONST_UNIVERSAL (1<<8)
86 #define CONST_PRIVATE (1<<9)
87 #define CONST_APPLICATION (1<<10)
88 #define CONST_EXPLICIT (1<<11)
89 #define CONST_IMPLICIT (1<<12)
91 #define CONST_TAG (1<<13) /* Used in ASN.1 assignement */
92 #define CONST_OPTION (1<<14)
93 #define CONST_DEFAULT (1<<15)
94 #define CONST_TRUE (1<<16)
95 #define CONST_FALSE (1<<17)
97 #define CONST_LIST (1<<18) /* Used with TYPE_INTEGER and TYPE_BIT_STRING */
98 #define CONST_MIN_MAX (1<<19)
100 #define CONST_1_PARAM (1<<20)
102 #define CONST_SIZE (1<<21)
104 #define CONST_DEFINED_BY (1<<22)
106 #define CONST_GENERALIZED (1<<23)
107 #define CONST_UTC (1<<24)
109 /* #define CONST_IMPORTS (1<<25) */
111 #define CONST_NOT_USED (1<<26)
112 #define CONST_SET (1<<27)
113 #define CONST_ASSIGN (1<<28)
115 #define CONST_DOWN (1<<29)
116 #define CONST_RIGHT (1<<30)