Added functions to parse the certificate policies extention.
[gnutls.git] / lib / minitasn1 / int.h
blob09082845ac606157dd887987a40529ced753f912
1 /*
2 * Copyright (C) 2002-2012 Free Software Foundation, Inc.
4 * This file is part of LIBTASN1.
6 * The LIBTASN1 library is free software; you can redistribute it
7 * and/or modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301, USA
22 #ifndef INT_H
23 #define INT_H
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
29 #include <string.h>
30 #include <stdlib.h>
31 #include <stdio.h>
32 #include <ctype.h>
33 #include <stdint.h>
35 #ifdef HAVE_SYS_TYPES_H
36 #include <sys/types.h>
37 #endif
39 #include <libtasn1.h>
41 #define ASN1_SMALL_VALUE_SIZE 16
43 /* This structure is also in libtasn1.h, but then contains less
44 fields. You cannot make any modifications to these first fields
45 without breaking ABI. */
46 struct asn1_node_st
48 /* public fields: */
49 char name[ASN1_MAX_NAME_SIZE+1]; /* Node name */
50 unsigned int name_hash;
51 unsigned int type; /* Node type */
52 unsigned char *value; /* Node value */
53 int value_len;
54 asn1_node down; /* Pointer to the son node */
55 asn1_node right; /* Pointer to the brother node */
56 asn1_node 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_strlen(s) strlen((const char *) s)
62 #define _asn1_strtol(n,e,b) strtol((const char *) n, e, b)
63 #define _asn1_strtoul(n,e,b) strtoul((const char *) n, e, b)
64 #define _asn1_strcmp(a,b) strcmp((const char *)a, (const char *)b)
65 #define _asn1_strcpy(a,b) strcpy((char *)a, (const char *)b)
66 #define _asn1_strcat(a,b) strcat((char *)a, (const char *)b)
68 #define MAX_LOG_SIZE 1024 /* maximum number of characters of a log message */
70 /* Define used for visiting trees. */
71 #define UP 1
72 #define RIGHT 2
73 #define DOWN 3
75 /****************************************/
76 /* Returns the first 8 bits. */
77 /* Used with the field type of asn1_node_st */
78 /****************************************/
79 #define type_field(x) (x&0xFF)
81 /* List of constants for field type of typedef asn1_node_st */
82 #define TYPE_CONSTANT ASN1_ETYPE_CONSTANT
83 #define TYPE_IDENTIFIER ASN1_ETYPE_IDENTIFIER
84 #define TYPE_INTEGER ASN1_ETYPE_INTEGER
85 #define TYPE_BOOLEAN ASN1_ETYPE_BOOLEAN
86 #define TYPE_SEQUENCE ASN1_ETYPE_SEQUENCE
87 #define TYPE_BIT_STRING ASN1_ETYPE_BIT_STRING
88 #define TYPE_OCTET_STRING ASN1_ETYPE_OCTET_STRING
89 #define TYPE_TAG ASN1_ETYPE_TAG
90 #define TYPE_DEFAULT ASN1_ETYPE_DEFAULT
91 #define TYPE_SIZE ASN1_ETYPE_SIZE
92 #define TYPE_SEQUENCE_OF ASN1_ETYPE_SEQUENCE_OF
93 #define TYPE_OBJECT_ID ASN1_ETYPE_OBJECT_ID
94 #define TYPE_ANY ASN1_ETYPE_ANY
95 #define TYPE_SET ASN1_ETYPE_SET
96 #define TYPE_SET_OF ASN1_ETYPE_SET_OF
97 #define TYPE_DEFINITIONS ASN1_ETYPE_DEFINITIONS
98 #define TYPE_TIME ASN1_ETYPE_TIME
99 #define TYPE_CHOICE ASN1_ETYPE_CHOICE
100 #define TYPE_IMPORTS ASN1_ETYPE_IMPORTS
101 #define TYPE_NULL ASN1_ETYPE_NULL
102 #define TYPE_ENUMERATED ASN1_ETYPE_ENUMERATED
103 #define TYPE_GENERALSTRING ASN1_ETYPE_GENERALSTRING
106 /***********************************************************************/
107 /* List of constants to better specify the type of typedef asn1_node_st. */
108 /***********************************************************************/
109 /* Used with TYPE_TAG */
110 #define CONST_UNIVERSAL (1<<8)
111 #define CONST_PRIVATE (1<<9)
112 #define CONST_APPLICATION (1<<10)
113 #define CONST_EXPLICIT (1<<11)
114 #define CONST_IMPLICIT (1<<12)
116 #define CONST_TAG (1<<13) /* Used in ASN.1 assignement */
117 #define CONST_OPTION (1<<14)
118 #define CONST_DEFAULT (1<<15)
119 #define CONST_TRUE (1<<16)
120 #define CONST_FALSE (1<<17)
122 #define CONST_LIST (1<<18) /* Used with TYPE_INTEGER and TYPE_BIT_STRING */
123 #define CONST_MIN_MAX (1<<19)
125 #define CONST_1_PARAM (1<<20)
127 #define CONST_SIZE (1<<21)
129 #define CONST_DEFINED_BY (1<<22)
131 #define CONST_GENERALIZED (1<<23)
132 #define CONST_UTC (1<<24)
134 /* #define CONST_IMPORTS (1<<25) */
136 #define CONST_NOT_USED (1<<26)
137 #define CONST_SET (1<<27)
138 #define CONST_ASSIGN (1<<28)
140 #define CONST_DOWN (1<<29)
141 #define CONST_RIGHT (1<<30)
143 #endif /* INT_H */