int.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef INT_H
00022
00023 #define INT_H
00024
00025 #include <defines.h>
00026
00027
00028
00029
00030
00031
00032
00033 #include <mem.h>
00034
00035 #define LIBTASN1_VERSION "0.2.10"
00036
00037 #define MAX32 4294967295
00038 #define MAX24 16777215
00039 #define MAX16 65535
00040
00041 #define MAX_LOG_SIZE 1024
00042 #define MAX_NAME_SIZE 128
00043 #define MAX_ERROR_DESCRIPTION_SIZE 128
00044
00045
00046
00047
00048 #define ASN1_CLASS_UNIVERSAL 1
00049 #define ASN1_CLASS_APPLICATION 2
00050 #define ASN1_CLASS_CONTEXT_SPECIFIC 3
00051 #define ASN1_CLASS_PRIVATE 4
00052
00053
00054
00055
00056
00057 #define ASN1_TAG_BOOLEAN 0x01
00058 #define ASN1_TAG_INTEGER 0x02
00059 #define ASN1_TAG_SEQUENCE 0x10
00060 #define ASN1_TAG_SET 0x11
00061 #define ASN1_TAG_OCTET_STRING 0x04
00062 #define ASN1_TAG_BIT_STRING 0x03
00063 #define ASN1_TAG_UTCTime 0x17
00064 #define ASN1_TAG_GENERALIZEDTime 0x18
00065 #define ASN1_TAG_OBJECT_ID 0x06
00066 #define ASN1_TAG_ENUMERATED 0x0A
00067 #define ASN1_TAG_NULL 0x05
00068 #define ASN1_TAG_GENERALSTRING 0x1B
00069
00070
00071
00072 #define UP 1
00073 #define RIGHT 2
00074 #define DOWN 3
00075
00076
00077 typedef int asn1_retCode;
00078
00079
00080
00081
00082
00083
00084 typedef struct node_asn_struct{
00085 char *name;
00086 unsigned int type;
00087 unsigned char *value;
00088 int value_len;
00089 struct node_asn_struct *down;
00090 struct node_asn_struct *right;
00091 struct node_asn_struct *left;
00092 } node_asn;
00093
00094 typedef node_asn* ASN1_TYPE;
00095
00096 #define ASN1_TYPE_EMPTY NULL
00097
00098 struct static_struct_asn{
00099 char *name;
00100 unsigned int type;
00101 unsigned char *value;
00102 };
00103
00104 typedef struct static_struct_asn ASN1_ARRAY_TYPE;
00105
00106
00107
00108
00109
00110
00111 #define type_field(x) (x&0xFF)
00112
00113
00114
00115 #define TYPE_CONSTANT 1
00116 #define TYPE_IDENTIFIER 2
00117 #define TYPE_INTEGER 3
00118 #define TYPE_BOOLEAN 4
00119 #define TYPE_SEQUENCE 5
00120 #define TYPE_BIT_STRING 6
00121 #define TYPE_OCTET_STRING 7
00122 #define TYPE_TAG 8
00123 #define TYPE_DEFAULT 9
00124 #define TYPE_SIZE 10
00125 #define TYPE_SEQUENCE_OF 11
00126 #define TYPE_OBJECT_ID 12
00127 #define TYPE_ANY 13
00128 #define TYPE_SET 14
00129 #define TYPE_SET_OF 15
00130 #define TYPE_DEFINITIONS 16
00131 #define TYPE_TIME 17
00132 #define TYPE_CHOICE 18
00133 #define TYPE_IMPORTS 19
00134 #define TYPE_NULL 20
00135 #define TYPE_ENUMERATED 21
00136 #define TYPE_GENERALSTRING 27
00137
00138
00139
00140
00141
00142
00143 #define CONST_UNIVERSAL (1<<8)
00144 #define CONST_PRIVATE (1<<9)
00145 #define CONST_APPLICATION (1<<10)
00146 #define CONST_EXPLICIT (1<<11)
00147 #define CONST_IMPLICIT (1<<12)
00148
00149 #define CONST_TAG (1<<13)
00150 #define CONST_OPTION (1<<14)
00151 #define CONST_DEFAULT (1<<15)
00152 #define CONST_TRUE (1<<16)
00153 #define CONST_FALSE (1<<17)
00154
00155 #define CONST_LIST (1<<18)
00156 #define CONST_MIN_MAX (1<<19)
00157
00158 #define CONST_1_PARAM (1<<20)
00159
00160 #define CONST_SIZE (1<<21)
00161
00162 #define CONST_DEFINED_BY (1<<22)
00163
00164 #define CONST_GENERALIZED (1<<23)
00165 #define CONST_UTC (1<<24)
00166
00167
00168
00169 #define CONST_NOT_USED (1<<26)
00170 #define CONST_SET (1<<27)
00171 #define CONST_ASSIGN (1<<28)
00172
00173 #define CONST_DOWN (1<<29)
00174 #define CONST_RIGHT (1<<30)
00175
00176
00177
00178 asn1_retCode asn1_delete_structure(ASN1_TYPE *structure);
00179
00180 asn1_retCode asn1_create_element(ASN1_TYPE definitions,const char *source_name,
00181 ASN1_TYPE *element);
00182
00183 asn1_retCode asn1_read_value(ASN1_TYPE element,const char *name,
00184 void *value,int *len);
00185
00186 asn1_retCode
00187 asn1_expand_octet_string(ASN1_TYPE definitions,ASN1_TYPE *element,
00188 const char *octetName,const char *objectName);
00189
00190 asn1_retCode
00191 asn1_expand_any_defined_by(ASN1_TYPE definitions,ASN1_TYPE *element);
00192
00193 asn1_retCode
00194 asn1_der_decoding(ASN1_TYPE *element,const void *ider,int len,
00195 char *errorDescription);
00196
00197
00198 #endif
00199
00200