Fix use of deprecated types, for now and the future.
[gnutls.git] / lib / minitasn1 / int.h
blob5b42af53442fc48e696e2d17ef693216fb172e92
1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 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>
42 #define ASN1_SMALL_VALUE_SIZE 16
44 /* This structure is also in libtasn1.h, but then contains less
45 fields. You cannot make any modifications to these first fields
46 without breaking ABI. */
47 struct node_asn_struct
49 /* public fields: */
50 char *name; /* Node name */
51 unsigned int type; /* Node type */
52 unsigned char *value; /* Node value */
53 int value_len;
54 ASN1_TYPE down; /* Pointer to the son node */
55 ASN1_TYPE right; /* Pointer to the brother node */
56 ASN1_TYPE left; /* Pointer to the next list element */
57 /* private fields: */
58 unsigned char small_value[ASN1_SMALL_VALUE_SIZE]; /* For small values */
61 #define _asn1_malloc malloc
62 #define _asn1_free free
63 #define _asn1_calloc calloc
64 #define _asn1_realloc realloc
65 #define _asn1_strdup strdup
67 #define MAX_LOG_SIZE 1024 /* maximum number of characters of a log message */
69 /* Define used for visiting trees. */
70 #define UP 1
71 #define RIGHT 2
72 #define DOWN 3
74 /****************************************/
75 /* Returns the first 8 bits. */
76 /* Used with the field type of node_asn */
77 /****************************************/
78 #define type_field(x) (x&0xFF)
80 /* List of constants for field type of typedef node_asn */
81 #define TYPE_CONSTANT 1
82 #define TYPE_IDENTIFIER 2
83 #define TYPE_INTEGER 3
84 #define TYPE_BOOLEAN 4
85 #define TYPE_SEQUENCE 5
86 #define TYPE_BIT_STRING 6
87 #define TYPE_OCTET_STRING 7
88 #define TYPE_TAG 8
89 #define TYPE_DEFAULT 9
90 #define TYPE_SIZE 10
91 #define TYPE_SEQUENCE_OF 11
92 #define TYPE_OBJECT_ID 12
93 #define TYPE_ANY 13
94 #define TYPE_SET 14
95 #define TYPE_SET_OF 15
96 #define TYPE_DEFINITIONS 16
97 #define TYPE_TIME 17
98 #define TYPE_CHOICE 18
99 #define TYPE_IMPORTS 19
100 #define TYPE_NULL 20
101 #define TYPE_ENUMERATED 21
102 #define TYPE_GENERALSTRING 27
105 /***********************************************************************/
106 /* List of constants to better specify the type of typedef node_asn. */
107 /***********************************************************************/
108 /* Used with TYPE_TAG */
109 #define CONST_UNIVERSAL (1<<8)
110 #define CONST_PRIVATE (1<<9)
111 #define CONST_APPLICATION (1<<10)
112 #define CONST_EXPLICIT (1<<11)
113 #define CONST_IMPLICIT (1<<12)
115 #define CONST_TAG (1<<13) /* Used in ASN.1 assignement */
116 #define CONST_OPTION (1<<14)
117 #define CONST_DEFAULT (1<<15)
118 #define CONST_TRUE (1<<16)
119 #define CONST_FALSE (1<<17)
121 #define CONST_LIST (1<<18) /* Used with TYPE_INTEGER and TYPE_BIT_STRING */
122 #define CONST_MIN_MAX (1<<19)
124 #define CONST_1_PARAM (1<<20)
126 #define CONST_SIZE (1<<21)
128 #define CONST_DEFINED_BY (1<<22)
130 #define CONST_GENERALIZED (1<<23)
131 #define CONST_UTC (1<<24)
133 /* #define CONST_IMPORTS (1<<25) */
135 #define CONST_NOT_USED (1<<26)
136 #define CONST_SET (1<<27)
137 #define CONST_ASSIGN (1<<28)
139 #define CONST_DOWN (1<<29)
140 #define CONST_RIGHT (1<<30)
142 #endif /* INT_H */