From f5c98ff356060d5a523d488ef3f18a69b3bedba4 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Fri, 10 Dec 2004 14:54:45 +0000 Subject: [PATCH] Include libtasn1.h, to make sure we are using the same prototypes that are exported. Avoids duplication of code. --- lib/int.h | 87 +++------------------------------------------------------------ 1 file changed, 4 insertions(+), 83 deletions(-) diff --git a/lib/int.h b/lib/int.h index 3c9179f..9625267 100644 --- a/lib/int.h +++ b/lib/int.h @@ -1,4 +1,5 @@ /* + * Copyright (C) 2004 Simon Josefsson * Copyright (C) 2002 Fabio Fiorina * * This file is part of LIBASN1. @@ -19,9 +20,10 @@ */ #ifndef INT_H - #define INT_H +#include + #include /* @@ -32,8 +34,6 @@ #include -#define LIBTASN1_VERSION "0.2.11" - #define MAX32 4294967295 #define MAX24 16777215 #define MAX16 65535 @@ -42,73 +42,16 @@ #define MAX_NAME_SIZE 128 /* maximum number of characters of a name inside an ASN1 file definiton */ #define MAX_ERROR_DESCRIPTION_SIZE 128 /* maximum number of characters of a description message */ -/*****************************************/ -/* Constants returned by asn1_read_tag */ -/*****************************************/ -#define ASN1_CLASS_UNIVERSAL 1 -#define ASN1_CLASS_APPLICATION 2 -#define ASN1_CLASS_CONTEXT_SPECIFIC 3 -#define ASN1_CLASS_PRIVATE 4 - - -/*****************************************/ -/* Constants returned by asn1_read_tag */ -/*****************************************/ -#define ASN1_TAG_BOOLEAN 0x01 -#define ASN1_TAG_INTEGER 0x02 -#define ASN1_TAG_SEQUENCE 0x10 -#define ASN1_TAG_SET 0x11 -#define ASN1_TAG_OCTET_STRING 0x04 -#define ASN1_TAG_BIT_STRING 0x03 -#define ASN1_TAG_UTCTime 0x17 -#define ASN1_TAG_GENERALIZEDTime 0x18 -#define ASN1_TAG_OBJECT_ID 0x06 -#define ASN1_TAG_ENUMERATED 0x0A -#define ASN1_TAG_NULL 0x05 -#define ASN1_TAG_GENERALSTRING 0x1B - - /* define used for visiting trees */ #define UP 1 #define RIGHT 2 #define DOWN 3 - -typedef int asn1_retCode; /* type returned by libasn1 functions */ - - -/******************************************************/ -/* Structure definition used for the node of the tree */ -/* that represent an ASN.1 DEFINITION. */ -/******************************************************/ -typedef struct node_asn_struct{ - char *name; /* Node name */ - unsigned int type; /* Node type */ - unsigned char *value; /* Node value */ - struct node_asn_struct *down; /* Pointer to the son node */ - struct node_asn_struct *right; /* Pointer to the brother node */ - struct node_asn_struct *left; /* Pointer to the next list element */ -} node_asn; - -typedef node_asn* ASN1_TYPE; - -#define ASN1_TYPE_EMPTY NULL - -struct static_struct_asn{ - char *name; /* Node name */ - unsigned int type; /* Node type */ - unsigned char *value; /* Node value */ -}; - -typedef struct static_struct_asn ASN1_ARRAY_TYPE; - - /****************************************/ /* Returns the first 8 bits. */ /* Used with the field type of node_asn */ /****************************************/ -#define type_field(x) (x&0xFF) - +#define type_field(x) (x&0xFF) /* List of constants for field type of typedef node_asn */ #define TYPE_CONSTANT 1 @@ -172,26 +115,4 @@ typedef struct static_struct_asn ASN1_ARRAY_TYPE; #define CONST_DOWN (1<<29) #define CONST_RIGHT (1<<30) - -/* functions */ -asn1_retCode asn1_delete_structure(ASN1_TYPE *structure); - -asn1_retCode asn1_create_element(ASN1_TYPE definitions,const char *source_name, - ASN1_TYPE *element); - -asn1_retCode asn1_read_value(ASN1_TYPE element,const char *name, - void *value,int *len); - -asn1_retCode -asn1_expand_octet_string(ASN1_TYPE definitions,ASN1_TYPE *element, - const char *octetName,const char *objectName); - -asn1_retCode -asn1_expand_any_defined_by(ASN1_TYPE definitions,ASN1_TYPE *element); - -asn1_retCode -asn1_der_decoding(ASN1_TYPE *element,const void *ider,int len, - char *errorDescription); - - #endif /* INT_H */ -- 2.11.4.GIT