Add.
[libtasn1.git] / lib / libtasn1-dont.h
blob6e0d33e9d17d902f93fc8ae1bf226059022ce13a
1 /*
2 * Copyright (C) 2004, 2005, 2006 Free Software Foundation
3 * Copyright (C) 2002 Fabio Fiorina
5 * This file is part of LIBTASN1.
7 * LIBTASN1 is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
12 * LIBTASN1 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 LIBTASN1; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA
24 #ifndef LIBTASN1_DONT_H
25 # define LIBTASN1_DONT_H
27 #ifdef __cplusplus
28 extern "C"
30 #endif
32 #include <libtasn1.h>
34 /******************************************************/
35 /* List of constants for field type of typedef node_asn */
36 /********************************************************/
37 #define ASN1_TYPE_CONSTANT 1
38 #define ASN1_TYPE_IDENTIFIER 2
39 #define ASN1_TYPE_INTEGER 3
40 #define ASN1_TYPE_BOOLEAN 4
41 #define ASN1_TYPE_SEQUENCE 5
42 #define ASN1_TYPE_BIT_STRING 6
43 #define ASN1_TYPE_OCTET_STRING 7
44 #define ASN1_TYPE_TAG 8
45 #define ASN1_TYPE_DEFAULT 9
46 #define ASN1_TYPE_SIZE 10
47 #define ASN1_TYPE_SEQUENCE_OF 11
48 #define ASN1_TYPE_OBJECT_ID 12
49 #define ASN1_TYPE_ANY 13
50 #define ASN1_TYPE_SET 14
51 #define ASN1_TYPE_SET_OF 15
52 #define ASN1_TYPE_DEFINITIONS 16
53 #define ASN1_TYPE_TIME 17
54 #define ASN1_TYPE_CHOICE 18
55 #define ASN1_TYPE_IMPORTS 19
56 #define ASN1_TYPE_NULL 20
57 #define ASN1_TYPE_ENUMERATED 21
58 #define ASN1_TYPE_GENERALSTRING 27
60 /***********************************************************************/
61 /* List of constants to better specify the type of typedef node_asn. */
62 /* Used with TYPE_TAG. */
63 /***********************************************************************/
64 #define ASN1_CONST_UNIVERSAL (1<<8)
65 #define ASN1_CONST_PRIVATE (1<<9)
66 #define ASN1_CONST_APPLICATION (1<<10)
67 #define ASN1_CONST_EXPLICIT (1<<11)
68 #define ASN1_CONST_IMPLICIT (1<<12)
69 #define ASN1_CONST_TAG (1<<13) /* Used in ASN.1 assignement */
70 #define ASN1_CONST_OPTION (1<<14)
71 #define ASN1_CONST_DEFAULT (1<<15)
72 #define ASN1_CONST_TRUE (1<<16)
73 #define ASN1_CONST_FALSE (1<<17)
74 #define ASN1_CONST_LIST (1<<18) /* Used with TYPE_INTEGER and TYPE_BIT_STRING */
75 #define ASN1_CONST_MIN_MAX (1<<19)
76 #define ASN1_CONST_1_PARAM (1<<20)
77 #define ASN1_CONST_SIZE (1<<21)
78 #define ASN1_CONST_DEFINED_BY (1<<22)
79 #define ASN1_CONST_GENERALIZED (1<<23)
80 #define ASN1_CONST_UTC (1<<24)
81 /* #define ASN1_CONST_IMPORTS (1<<25) */
82 #define ASN1_CONST_NOT_USED (1<<26)
83 #define ASN1_CONST_SET (1<<27)
84 #define ASN1_CONST_ASSIGN (1<<28)
85 #define ASN1_CONST_DOWN (1<<29)
86 #define ASN1_CONST_RIGHT (1<<30)
88 /****************************************/
89 /* Returns the first 8 bits. */
90 /* Used with the field type of node_asn */
91 /****************************************/
92 #define ASN1_TYPE_FIELD(x) (x&0xFF)
94 /* DER utility functions. */
96 int asn1_get_tag_der (const unsigned char *der, int der_len,
97 unsigned char *class, int *len, unsigned long *tag);
99 void asn1_octet_der (const unsigned char *str, int str_len,
100 unsigned char *der, int *der_len);
102 asn1_retCode asn1_get_octet_der (const unsigned char *der, int der_len,
103 int *ret_len, unsigned char *str,
104 int str_size, int *str_len);
106 void asn1_bit_der (const unsigned char *str, int bit_len,
107 unsigned char *der, int *der_len);
109 asn1_retCode asn1_get_bit_der (const unsigned char *der, int der_len,
110 int *ret_len, unsigned char *str,
111 int str_size, int *bit_len);
113 signed long asn1_get_length_der (const unsigned char *der, int der_len,
114 int *len);
116 void asn1_length_der (unsigned long len, unsigned char *ans, int *ans_len);
118 /* Other utility functions. */
120 ASN1_TYPE asn1_find_up (ASN1_TYPE node);
122 ASN1_TYPE asn1_find_node (ASN1_TYPE pointer, const char *name);
124 #ifdef __cplusplus
126 #endif
128 #endif /* LIBTASN1_DONT_H */