Replace use of alloca with malloc.
[libtasn1.git] / lib / int.h
blob0c9c06f979f4b83e55b92909b41381d939739d41
1 /*
2 * Copyright (C) 2004, 2006, 2008 Free Software Foundation, Inc.
3 * Copyright (C) 2002 Fabio Fiorina
5 * This file is part of LIBTASN1.
7 * The LIBTASN1 library is free software; you can redistribute it
8 * and/or modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA
23 #ifndef INT_H
24 #define INT_H
26 #ifdef HAVE_CONFIG_H
27 # include <config.h>
28 #endif
30 #include <string.h>
31 #include <stdlib.h>
32 #include <stdio.h>
33 #include <ctype.h>
34 #include <stdint.h>
36 #ifdef HAVE_SYS_TYPES_H
37 # include <sys/types.h>
38 #endif
40 #include <libtasn1.h>
43 #define LIBTASN1_DEBUG
44 #define LIBTASN1_DEBUG_PARSER
45 #define LIBTASN1_DEBUG_INTEGER
48 #define _asn1_malloc malloc
49 #define _asn1_free free
50 #define _asn1_calloc calloc
51 #define _asn1_realloc realloc
52 #define _asn1_strdup strdup
54 #define MAX_LOG_SIZE 1024 /* maximum number of characters of a log message */
56 /* Define used for visiting trees. */
57 #define UP 1
58 #define RIGHT 2
59 #define DOWN 3
61 /****************************************/
62 /* Returns the first 8 bits. */
63 /* Used with the field type of node_asn */
64 /****************************************/
65 #define type_field(x) (x&0xFF)
67 /* List of constants for field type of typedef node_asn */
68 #define TYPE_CONSTANT 1
69 #define TYPE_IDENTIFIER 2
70 #define TYPE_INTEGER 3
71 #define TYPE_BOOLEAN 4
72 #define TYPE_SEQUENCE 5
73 #define TYPE_BIT_STRING 6
74 #define TYPE_OCTET_STRING 7
75 #define TYPE_TAG 8
76 #define TYPE_DEFAULT 9
77 #define TYPE_SIZE 10
78 #define TYPE_SEQUENCE_OF 11
79 #define TYPE_OBJECT_ID 12
80 #define TYPE_ANY 13
81 #define TYPE_SET 14
82 #define TYPE_SET_OF 15
83 #define TYPE_DEFINITIONS 16
84 #define TYPE_TIME 17
85 #define TYPE_CHOICE 18
86 #define TYPE_IMPORTS 19
87 #define TYPE_NULL 20
88 #define TYPE_ENUMERATED 21
89 #define TYPE_GENERALSTRING 27
92 /***********************************************************************/
93 /* List of constants to better specify the type of typedef node_asn. */
94 /***********************************************************************/
95 /* Used with TYPE_TAG */
96 #define CONST_UNIVERSAL (1<<8)
97 #define CONST_PRIVATE (1<<9)
98 #define CONST_APPLICATION (1<<10)
99 #define CONST_EXPLICIT (1<<11)
100 #define CONST_IMPLICIT (1<<12)
102 #define CONST_TAG (1<<13) /* Used in ASN.1 assignement */
103 #define CONST_OPTION (1<<14)
104 #define CONST_DEFAULT (1<<15)
105 #define CONST_TRUE (1<<16)
106 #define CONST_FALSE (1<<17)
108 #define CONST_LIST (1<<18) /* Used with TYPE_INTEGER and TYPE_BIT_STRING */
109 #define CONST_MIN_MAX (1<<19)
111 #define CONST_1_PARAM (1<<20)
113 #define CONST_SIZE (1<<21)
115 #define CONST_DEFINED_BY (1<<22)
117 #define CONST_GENERALIZED (1<<23)
118 #define CONST_UTC (1<<24)
120 /* #define CONST_IMPORTS (1<<25) */
122 #define CONST_NOT_USED (1<<26)
123 #define CONST_SET (1<<27)
124 #define CONST_ASSIGN (1<<28)
126 #define CONST_DOWN (1<<29)
127 #define CONST_RIGHT (1<<30)
129 #endif /* INT_H */