Move struct node_asn_struct to int.h.
authorSimon Josefsson <simon@josefsson.org>
Tue, 4 Nov 2008 10:58:27 +0000 (11:58 +0100)
committerSimon Josefsson <simon@josefsson.org>
Tue, 4 Nov 2008 10:58:27 +0000 (11:58 +0100)
15 files changed:
NEWS
examples/CertificateExample.c
examples/CrlExample.c
lib/ASN1.c
lib/ASN1.y
lib/coding.c
lib/decoding.c
lib/element.c
lib/element.h
lib/int.h
lib/libtasn1.h
lib/parser_aux.c
lib/parser_aux.h
lib/structure.c
lib/structure.h

diff --git a/NEWS b/NEWS
index 0ec8c70..b60bfb6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,7 +11,7 @@ Version 2.0 (unreleased)
   use standard AC_CHECK_FUNCS autoconf tests or pkg-config instead.
 - API and ABI changes since last version:
   asn1_get_length_ber: New function
-  struct node_asn_struct: New member, small_value.
+  struct node_asn_struct: Removed, was never documented nor meant for export
 
 Version 1.5 (released 2008-07-29)
 - Update gnulib files.
index 7debe73..a00511b 100644 (file)
@@ -68,7 +68,7 @@ my_ltostr(long v,char *str)
 /*                 "C=US O=gov"                       */ 
 /******************************************************/
 static void
-get_Name_type(node_asn *cert_def,node_asn *cert,char *root, char *answer)
+get_Name_type(ASN1_TYPE cert_def,ASN1_TYPE cert,char *root, char *answer)
 {
   int k,k2,result,len;
   char name[128],str[1024],str2[1024],name2[128],counter[5],name3[128];
@@ -178,7 +178,7 @@ get_Name_type(node_asn *cert_def,node_asn *cert,char *root, char *answer)
 /*   int *der_len: number of bytes of der string      */ 
 /******************************************************/
 static void
-create_certificate(node_asn *cert_def,unsigned char *der,int *der_len)
+create_certificate(ASN1_TYPE cert_def,unsigned char *der,int *der_len)
 {
   int result,k,len;
   unsigned char str[1024],*str2;
@@ -425,7 +425,7 @@ create_certificate(node_asn *cert_def,unsigned char *der,int *der_len)
 /*   int der_len: number of bytes of der string      */ 
 /******************************************************/
 static void
-get_certificate(node_asn *cert_def,unsigned char *der,int der_len)
+get_certificate(ASN1_TYPE cert_def,unsigned char *der,int der_len)
 {
   int result,len,start,end;
   unsigned char str[1024],str2[1024];
index 725d5c3..332d84d 100644 (file)
@@ -70,7 +70,7 @@ my_ltostr(long v,char *str)
 /*                 "C=US O=gov"                       */ 
 /******************************************************/
 static void
-get_Name_type(node_asn *cert_def,node_asn *cert,char *root, char *answer)
+get_Name_type(ASN1_TYPE cert_def,ASN1_TYPE cert,char *root, char *answer)
 {
   int k,k2,result,len;
   char name[128],str[1024],str2[1024],name2[128],counter[5],name3[128];
@@ -188,7 +188,7 @@ get_Name_type(node_asn *cert_def,node_asn *cert,char *root, char *answer)
 /*   int *der_len: number of bytes of der string      */ 
 /******************************************************/
 static void
-create_CRL(node_asn *cert_def, unsigned char *der,int *der_len)
+create_CRL(ASN1_TYPE cert_def, unsigned char *der,int *der_len)
 {
   int result,k,len;
   unsigned char str[1024],*str2;
@@ -349,7 +349,7 @@ create_CRL(node_asn *cert_def, unsigned char *der,int *der_len)
 /*   int der_len: number of bytes of der string      */ 
 /******************************************************/
 static void
-get_CRL(node_asn *cert_def,unsigned char *der,int der_len)
+get_CRL(ASN1_TYPE cert_def,unsigned char *der,int der_len)
 {
   int result,len,start,end;
   unsigned char str[1024],str2[1024];
index 6ddb65c..52cd6c6 100644 (file)
 #include <structure.h>
 
 
- static FILE *file_asn1;               /* Pointer to file to parse */
+static FILE *file_asn1;                        /* Pointer to file to parse */
 static asn1_retCode result_parse;      /* result of the parser
                                           algorithm */
-static node_asn *p_tree;               /* pointer to the root of the
+static ASN1_TYPE p_tree;               /* pointer to the root of the
                                           structure created by the
                                           parser*/
  static unsigned long lineNumber;      /* line number describing the
@@ -210,7 +210,7 @@ typedef union YYSTYPE
 {
   unsigned int constant;
   char str[ASN1_MAX_NAME_SIZE+1];
-  node_asn* node;
+  ASN1_TYPE node;
 }
 /* Line 187 of yacc.c.  */
 #line 217 "ASN1.c"
index 43840ca..050f2ab 100644 (file)
 #include <structure.h>
 
 
- static FILE *file_asn1;               /* Pointer to file to parse */
+static FILE *file_asn1;                        /* Pointer to file to parse */
 static asn1_retCode result_parse;      /* result of the parser
                                           algorithm */
-static node_asn *p_tree;               /* pointer to the root of the
+static ASN1_TYPE p_tree;               /* pointer to the root of the
                                           structure created by the
                                           parser*/
  static unsigned long lineNumber;      /* line number describing the
@@ -62,7 +62,7 @@ int _asn1_yylex(void);
 %union {
   unsigned int constant;
   char str[ASN1_MAX_NAME_SIZE+1];
-  node_asn* node;
+  ASN1_TYPE node;
 }
 
 
index e9fb91a..63d38a7 100644 (file)
@@ -46,7 +46,7 @@
 /* Return:                                            */
 /******************************************************/
 void
-_asn1_error_description_value_not_found (node_asn * node,
+_asn1_error_description_value_not_found (ASN1_TYPE  node,
                                         char *ErrorDescription)
 {
 
@@ -371,10 +371,10 @@ asn1_bit_der (const unsigned char *str, int bit_len,
 /*   otherwise ASN1_SUCCESS.                          */
 /******************************************************/
 asn1_retCode
-_asn1_complete_explicit_tag (node_asn * node, unsigned char *der,
+_asn1_complete_explicit_tag (ASN1_TYPE  node, unsigned char *der,
                             int *counter, int *max_len)
 {
-  node_asn *p;
+  ASN1_TYPE p;
   int is_tag_implicit, len2, len3;
   unsigned char temp[SIZEOF_UNSIGNED_INT];
 
@@ -444,10 +444,10 @@ _asn1_complete_explicit_tag (node_asn * node, unsigned char *der,
 /*   otherwise ASN1_SUCCESS.                          */
 /******************************************************/
 asn1_retCode
-_asn1_insert_tag_der (node_asn * node, unsigned char *der, int *counter,
+_asn1_insert_tag_der (ASN1_TYPE  node, unsigned char *der, int *counter,
                      int *max_len)
 {
-  node_asn *p;
+  ASN1_TYPE p;
   int tag_len, is_tag_implicit;
   unsigned char class, class_implicit = 0, temp[SIZEOF_UNSIGNED_INT * 3 + 1];
   unsigned long tag_implicit = 0;
@@ -605,7 +605,7 @@ _asn1_insert_tag_der (node_asn * node, unsigned char *der, int *counter,
 /* Return:                                            */
 /******************************************************/
 void
-_asn1_ordering_set (unsigned char *der, int der_len, node_asn * node)
+_asn1_ordering_set (unsigned char *der, int der_len, ASN1_TYPE  node)
 {
   struct vet
   {
@@ -616,7 +616,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, node_asn * node)
 
   int counter, len, len2;
   struct vet *first, *last, *p_vet, *p2_vet;
-  node_asn *p;
+  ASN1_TYPE p;
   unsigned char class, *temp;
   unsigned long tag;
 
@@ -719,7 +719,7 @@ _asn1_ordering_set (unsigned char *der, int der_len, node_asn * node)
 /* Return:                                            */
 /******************************************************/
 void
-_asn1_ordering_set_of (unsigned char *der, int der_len, node_asn * node)
+_asn1_ordering_set_of (unsigned char *der, int der_len, ASN1_TYPE  node)
 {
   struct vet
   {
@@ -729,7 +729,7 @@ _asn1_ordering_set_of (unsigned char *der, int der_len, node_asn * node)
 
   int counter, len, len2, change;
   struct vet *first, *last, *p_vet, *p2_vet;
-  node_asn *p;
+  ASN1_TYPE p;
   unsigned char *temp, class;
   unsigned long k, max;
 
@@ -874,7 +874,7 @@ asn1_retCode
 asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len,
                 char *ErrorDescription)
 {
-  node_asn *node, *p, *p2;
+  ASN1_TYPE node, p, p2;
   char temp[SIZEOF_UNSIGNED_LONG_INT * 3 + 1];
   int counter, counter_old, len2, len3, tlen, move, max_len, max_len_old;
   asn1_retCode err;
index 6a1c979..9e162e5 100644 (file)
@@ -37,7 +37,7 @@ static asn1_retCode
 _asn1_get_indefinite_length_string (const unsigned char *der, int *len);
 
 static void
-_asn1_error_description_tag_error (node_asn * node, char *ErrorDescription)
+_asn1_error_description_tag_error (ASN1_TYPE node, char *ErrorDescription)
 {
 
   Estrcpy (ErrorDescription, ":: tag error near element '");
@@ -341,10 +341,10 @@ asn1_get_bit_der (const unsigned char *der, int der_len,
 
 
 int
-_asn1_extract_tag_der (node_asn * node, const unsigned char *der, int der_len,
+_asn1_extract_tag_der (ASN1_TYPE node, const unsigned char *der, int der_len,
                       int *ret_len)
 {
-  node_asn *p;
+  ASN1_TYPE p;
   int counter, len2, len3, is_tag_implicit;
   unsigned long tag, tag_implicit = 0;
   unsigned char class, class2, class_implicit = 0;
@@ -540,9 +540,9 @@ _asn1_extract_tag_der (node_asn * node, const unsigned char *der, int der_len,
 
 
 int
-_asn1_delete_not_used (node_asn * node)
+_asn1_delete_not_used (ASN1_TYPE node)
 {
-  node_asn *p, *p2;
+  ASN1_TYPE p, p2;
 
   if (node == NULL)
     return ASN1_ELEMENT_NOT_FOUND;
@@ -598,7 +598,7 @@ _asn1_delete_not_used (node_asn * node)
   return ASN1_SUCCESS;
 }
 
-asn1_retCode _asn1_extract_der_octet(node_asn * node, const unsigned char *der, int der_len)
+asn1_retCode _asn1_extract_der_octet(ASN1_TYPE node, const unsigned char *der, int der_len)
 {
 int len2, len3;
 int counter2, counter_end;
@@ -641,7 +641,7 @@ int counter2, counter_end;
 
 
 asn1_retCode
-_asn1_get_octet_string (const unsigned char *der, node_asn * node, int *len)
+_asn1_get_octet_string (const unsigned char *der, ASN1_TYPE node, int *len)
 {
   int len2, len3, counter, tot_len, indefinite;
 
@@ -802,7 +802,7 @@ asn1_retCode
 asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
                   char *errorDescription)
 {
-  node_asn *node, *p, *p2, *p3;
+  ASN1_TYPE node, p, p2, p3;
   char temp[128];
   int counter, len2, len3, len4, move, ris, tlen;
   unsigned char class;
@@ -1356,7 +1356,7 @@ asn1_retCode
 asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
                           const void *ider, int len, char *errorDescription)
 {
-  node_asn *node, *p, *p2, *p3, *nodeFound = ASN1_TYPE_EMPTY;
+  ASN1_TYPE node, p, p2, p3, nodeFound = ASN1_TYPE_EMPTY;
   char temp[128], currentName[ASN1_MAX_NAME_SIZE * 10], *dot_p, *char_p;
   int nameLen = ASN1_MAX_NAME_SIZE * 10 - 1, state;
   int counter, len2, len3, len4, move, ris, tlen;
@@ -2127,7 +2127,7 @@ asn1_retCode
 asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
                            const char *name_element, int *start, int *end)
 {
-  node_asn *node, *node_to_find, *p, *p2, *p3;
+  ASN1_TYPE node, node_to_find, p, p2, p3;
   int counter, len2, len3, len4, move, ris;
   unsigned char class;
   unsigned long tag;
index 25ecd5a..f9cd3c7 100644 (file)
@@ -34,9 +34,9 @@
 #include "structure.h"
 
 void
-_asn1_hierarchical_name (node_asn * node, char *name, int name_size)
+_asn1_hierarchical_name (ASN1_TYPE  node, char *name, int name_size)
 {
-  node_asn *p;
+  ASN1_TYPE p;
   char tmp_name[64];
 
   p = node;
@@ -129,9 +129,9 @@ _asn1_convert_integer (const char *value, unsigned char *value_out,
 
 
 int
-_asn1_append_sequence_set (node_asn * node)
+_asn1_append_sequence_set (ASN1_TYPE  node)
 {
-  node_asn *p, *p2;
+  ASN1_TYPE p, p2;
   char temp[10];
   long n;
 
@@ -278,7 +278,7 @@ asn1_retCode
 asn1_write_value (ASN1_TYPE node_root, const char *name,
                  const void *ivalue, int len)
 {
-  node_asn *node, *p, *p2;
+  ASN1_TYPE node, p, p2;
   unsigned char *temp, *value_temp = NULL, *default_temp = NULL;
   int len2, k, k2, negative;
   const unsigned char *value = ivalue;
@@ -713,7 +713,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
 asn1_retCode
 asn1_read_value (ASN1_TYPE root, const char *name, void *ivalue, int *len)
 {
-  node_asn *node, *p, *p2;
+  ASN1_TYPE node, p, p2;
   int len2, len3;
   int value_size = *len;
   unsigned char *value = ivalue;
@@ -893,10 +893,10 @@ asn1_read_value (ASN1_TYPE root, const char *name, void *ivalue, int *len)
   *
   **/
 asn1_retCode
-asn1_read_tag (node_asn * root, const char *name, int *tagValue,
+asn1_read_tag (ASN1_TYPE root, const char *name, int *tagValue,
               int *classValue)
 {
-  node_asn *node, *p, *pTag;
+  ASN1_TYPE node, p, pTag;
 
   node = asn1_find_node (root, name);
   if (node == NULL)
index 3db9529..f0314d2 100644 (file)
@@ -3,11 +3,11 @@
 #define _ELEMENT_H
 
 
-asn1_retCode _asn1_append_sequence_set(node_asn *node);
+asn1_retCode _asn1_append_sequence_set(ASN1_TYPE node);
 
 asn1_retCode _asn1_convert_integer(const char *value,unsigned char *value_out,
                          int value_out_size, int *len);
 
-void _asn1_hierarchical_name(node_asn *node,char *name,int name_size);
+void _asn1_hierarchical_name(ASN1_TYPE node,char *name,int name_size);
 
 #endif
index 0c9c06f..f7a4a32 100644 (file)
--- a/lib/int.h
+++ b/lib/int.h
 
 #include <libtasn1.h>
 
+#define ASN1_SMALL_VALUE_SIZE 16
+
+struct node_asn
+{
+  char *name;                  /* Node name */
+  unsigned int type;           /* Node type */
+  unsigned char *value;        /* Node value */
+  int value_len;
+  ASN1_TYPE down;      /* Pointer to the son node */
+  ASN1_TYPE right;     /* Pointer to the brother node */
+  ASN1_TYPE left;      /* Pointer to the next list element */
+  unsigned char small_value[ASN1_SMALL_VALUE_SIZE];    /* For small values */
+};
+
 /*
 #define LIBTASN1_DEBUG
 #define LIBTASN1_DEBUG_PARSER
index 15d863c..81418f2 100644 (file)
@@ -98,23 +98,7 @@ extern "C"
 /* that represent an ASN.1 DEFINITION.                */
 /******************************************************/
 
-#define ASN1_SMALL_VALUE_SIZE 16
-
-  struct node_asn_struct
-  {
-    char *name;                        /* Node name */
-    unsigned int type;         /* Node type */
-    unsigned char *value;      /* Node value */
-    int value_len;
-    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 */
-    unsigned char small_value[ASN1_SMALL_VALUE_SIZE];  /* For small values */
-  };
-
-  typedef struct node_asn_struct node_asn;
-
-  typedef node_asn *ASN1_TYPE;
+  typedef struct node_asn *ASN1_TYPE;
 
 #define ASN1_TYPE_EMPTY  NULL
 
@@ -211,7 +195,7 @@ extern "C"
                                         const char *octetName,
                                         const char *objectName);
 
-  asn1_retCode asn1_read_tag (node_asn * root, const char *name,
+  asn1_retCode asn1_read_tag (ASN1_TYPE root, const char *name,
                              int *tagValue, int *classValue);
 
   const char *asn1_find_structure_from_oid (ASN1_TYPE definitions,
index ca615a0..0f0f651 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *      Copyright (C) 2004, 2006, 2007 Free Software Foundation
+ *      Copyright (C) 2004, 2006, 2007, 2008 Free Software Foundation
  *      Copyright (C) 2000,2001 Fabio Fiorina
  *
  * This file is part of LIBTASN1.
@@ -36,7 +36,7 @@ char _asn1_identifierMissing[ASN1_MAX_NAME_SIZE + 1]; /* identifier name not fou
 /***********************************************/
 typedef struct list_struct
 {
-  node_asn *node;
+  ASN1_TYPE node;
   struct list_struct *next;
 } list_type;
 
@@ -53,13 +53,13 @@ list_type *firstElement = NULL;
 /*         and CONST_ constants).                     */
 /* Return: pointer to the new element.                */
 /******************************************************/
-node_asn *
+ASN1_TYPE 
 _asn1_add_node (unsigned int type)
 {
   list_type *listElement;
-  node_asn *punt;
+  ASN1_TYPE punt;
 
-  punt = (node_asn *) _asn1_calloc (1, sizeof (node_asn));
+  punt = (ASN1_TYPE ) _asn1_calloc (1, sizeof (struct node_asn));
   if (punt == NULL)
     return NULL;
 
@@ -94,7 +94,7 @@ _asn1_add_node (unsigned int type)
 ASN1_TYPE
 asn1_find_node (ASN1_TYPE pointer, const char *name)
 {
-  node_asn *p;
+  ASN1_TYPE p;
   char *n_end, n[ASN1_MAX_NAME_SIZE + 1];
   const char *n_start;
 
@@ -198,8 +198,8 @@ asn1_find_node (ASN1_TYPE pointer, const char *name)
 /*   len: character number of value.                              */
 /* Return: pointer to the NODE_ASN element.                       */
 /******************************************************************/
-node_asn *
-_asn1_set_value (node_asn * node, const void *value, unsigned int len)
+ASN1_TYPE 
+_asn1_set_value (ASN1_TYPE  node, const void *value, unsigned int len)
 {
   if (node == NULL)
     return node;
@@ -237,8 +237,8 @@ _asn1_set_value (node_asn * node, const void *value, unsigned int len)
 /*   len: character number of value.                              */
 /* Return: pointer to the NODE_ASN element.                       */
 /******************************************************************/
-node_asn *
-_asn1_set_value_octet (node_asn * node, const void *value, unsigned int len)
+ASN1_TYPE 
+_asn1_set_value_octet (ASN1_TYPE  node, const void *value, unsigned int len)
 {
 int len2;
 void* temp;
@@ -258,8 +258,8 @@ void* temp;
 /* the same as _asn1_set_value except that it sets an already malloc'ed
  * value.
  */
-node_asn *
-_asn1_set_value_m (node_asn * node, void *value, unsigned int len)
+ASN1_TYPE 
+_asn1_set_value_m (ASN1_TYPE  node, void *value, unsigned int len)
 {
   if (node == NULL)
     return node;
@@ -290,8 +290,8 @@ _asn1_set_value_m (node_asn * node, void *value, unsigned int len)
 /*   len: character number of value.                              */
 /* Return: pointer to the NODE_ASN element.                       */
 /******************************************************************/
-node_asn *
-_asn1_append_value (node_asn * node, const void *value, unsigned int len)
+ASN1_TYPE 
+_asn1_append_value (ASN1_TYPE  node, const void *value, unsigned int len)
 {
   if (node == NULL)
     return node;
@@ -336,8 +336,8 @@ _asn1_append_value (node_asn * node, const void *value, unsigned int len)
 /*         to set.                                                */
 /* Return: pointer to the NODE_ASN element.                       */
 /******************************************************************/
-node_asn *
-_asn1_set_name (node_asn * node, const char *name)
+ASN1_TYPE 
+_asn1_set_name (ASN1_TYPE  node, const char *name)
 {
   if (node == NULL)
     return node;
@@ -371,8 +371,8 @@ _asn1_set_name (node_asn * node, const char *name)
 /*          by NODE.                                              */
 /* Return: pointer to *NODE.                                      */
 /******************************************************************/
-node_asn *
-_asn1_set_right (node_asn * node, node_asn * right)
+ASN1_TYPE 
+_asn1_set_right (ASN1_TYPE  node, ASN1_TYPE  right)
 {
   if (node == NULL)
     return node;
@@ -390,8 +390,8 @@ _asn1_set_right (node_asn * node, node_asn * right)
 /*   node: NODE_ASN element pointer.                              */
 /* Return: field RIGHT of NODE.                                   */
 /******************************************************************/
-node_asn *
-_asn1_get_right (node_asn * node)
+ASN1_TYPE 
+_asn1_get_right (ASN1_TYPE  node)
 {
   if (node == NULL)
     return NULL;
@@ -405,10 +405,10 @@ _asn1_get_right (node_asn * node)
 /*   node: starting element pointer.                              */
 /* Return: pointer to the last element along the right chain.     */
 /******************************************************************/
-node_asn *
-_asn1_get_last_right (node_asn * node)
+ASN1_TYPE 
+_asn1_get_last_right (ASN1_TYPE  node)
 {
-  node_asn *p;
+  ASN1_TYPE p;
 
   if (node == NULL)
     return NULL;
@@ -427,8 +427,8 @@ _asn1_get_last_right (node_asn * node)
 /*          by NODE.                                              */
 /* Return: pointer to *NODE.                                      */
 /******************************************************************/
-node_asn *
-_asn1_set_down (node_asn * node, node_asn * down)
+ASN1_TYPE 
+_asn1_set_down (ASN1_TYPE  node, ASN1_TYPE  down)
 {
   if (node == NULL)
     return node;
@@ -446,8 +446,8 @@ _asn1_set_down (node_asn * node, node_asn * down)
 /*   node: NODE_ASN element pointer.                              */
 /* Return: field DOWN of NODE.                                    */
 /******************************************************************/
-node_asn *
-_asn1_get_down (node_asn * node)
+ASN1_TYPE 
+_asn1_get_down (ASN1_TYPE  node)
 {
   if (node == NULL)
     return NULL;
@@ -462,7 +462,7 @@ _asn1_get_down (node_asn * node)
 /* Return: a null terminated string.                              */
 /******************************************************************/
 char *
-_asn1_get_name (node_asn * node)
+_asn1_get_name (ASN1_TYPE  node)
 {
   if (node == NULL)
     return NULL;
@@ -480,8 +480,8 @@ _asn1_get_name (node_asn * node)
 /*          value of field TYPE.                                  */
 /* Return: NODE pointer.                                          */
 /******************************************************************/
-node_asn *
-_asn1_mod_type (node_asn * node, unsigned int value)
+ASN1_TYPE 
+_asn1_mod_type (ASN1_TYPE  node, unsigned int value)
 {
   if (node == NULL)
     return node;
@@ -498,7 +498,7 @@ _asn1_mod_type (node_asn * node, unsigned int value)
 /*   node: NODE_ASN element pointer.                              */
 /******************************************************************/
 void
-_asn1_remove_node (node_asn * node)
+_asn1_remove_node (ASN1_TYPE  node)
 {
   if (node == NULL)
     return;
@@ -517,10 +517,10 @@ _asn1_remove_node (node_asn * node)
 /*   node: NODE_ASN element pointer.                              */
 /* Return: Null if not found.                                     */
 /******************************************************************/
-node_asn *
-_asn1_find_up (node_asn * node)
+ASN1_TYPE 
+_asn1_find_up (ASN1_TYPE  node)
 {
-  node_asn *p;
+  ASN1_TYPE p;
 
   if (node == NULL)
     return NULL;
@@ -618,7 +618,7 @@ _asn1_ltostr (long v, char *str)
 asn1_retCode
 _asn1_change_integer_value (ASN1_TYPE node)
 {
-  node_asn *p;
+  ASN1_TYPE p;
   unsigned char val[SIZEOF_UNSIGNED_LONG_INT];
   unsigned char val2[SIZEOF_UNSIGNED_LONG_INT + 1];
   int len;
@@ -685,7 +685,7 @@ _asn1_change_integer_value (ASN1_TYPE node)
 asn1_retCode
 _asn1_expand_object_id (ASN1_TYPE node)
 {
-  node_asn *p, *p2, *p3, *p4, *p5;
+  ASN1_TYPE p, p2, p3, p4, p5;
   char name_root[ASN1_MAX_NAME_SIZE], name2[2 * ASN1_MAX_NAME_SIZE + 1];
   int move, tlen;
 
@@ -866,7 +866,7 @@ _asn1_expand_object_id (ASN1_TYPE node)
 asn1_retCode
 _asn1_type_set_config (ASN1_TYPE node)
 {
-  node_asn *p, *p2;
+  ASN1_TYPE p, p2;
   int move;
 
   if (node == NULL)
@@ -939,7 +939,7 @@ _asn1_type_set_config (ASN1_TYPE node)
 asn1_retCode
 _asn1_check_identifier (ASN1_TYPE node)
 {
-  node_asn *p, *p2;
+  ASN1_TYPE p, p2;
   char name2[ASN1_MAX_NAME_SIZE * 2 + 2];
 
   if (node == NULL)
@@ -1043,7 +1043,7 @@ _asn1_check_identifier (ASN1_TYPE node)
 asn1_retCode
 _asn1_set_default_tag (ASN1_TYPE node)
 {
-  node_asn *p;
+  ASN1_TYPE p;
 
   if ((node == NULL) || (type_field (node->type) != TYPE_DEFINITIONS))
     return ASN1_ELEMENT_NOT_FOUND;
index 6e18bb6..d30a34c 100644 (file)
@@ -7,47 +7,47 @@
 /***************************************/
 /*  Functions used by ASN.1 parser     */
 /***************************************/
-node_asn *
+ASN1_TYPE
 _asn1_add_node(unsigned int type);
 
-node_asn *
-_asn1_set_value(node_asn *node,const void *value,unsigned int len);
+ASN1_TYPE
+_asn1_set_value(ASN1_TYPE node,const void *value,unsigned int len);
 
-node_asn *
-_asn1_set_value_m(node_asn *node,void *value,unsigned int len);
+ASN1_TYPE
+_asn1_set_value_m(ASN1_TYPE node,void *value,unsigned int len);
 
-node_asn *
-_asn1_set_value_octet(node_asn *node,const void *value,unsigned int len);
+ASN1_TYPE
+_asn1_set_value_octet(ASN1_TYPE node,const void *value,unsigned int len);
 
-node_asn *
-_asn1_append_value(node_asn *node,const void *value,unsigned int len);
+ASN1_TYPE
+_asn1_append_value(ASN1_TYPE node,const void *value,unsigned int len);
 
-node_asn *
-_asn1_set_name(node_asn *node,const char *name);
+ASN1_TYPE
+_asn1_set_name(ASN1_TYPE node,const char *name);
 
-node_asn *
-_asn1_set_right(node_asn *node,node_asn *right);
+ASN1_TYPE
+_asn1_set_right(ASN1_TYPE node, ASN1_TYPE right);
 
-node_asn *
-_asn1_get_right(node_asn *node);
+ASN1_TYPE
+_asn1_get_right(ASN1_TYPE node);
 
-node_asn *
-_asn1_get_last_right(node_asn *node);
+ASN1_TYPE
+_asn1_get_last_right(ASN1_TYPE node);
 
-node_asn *
-_asn1_set_down(node_asn *node,node_asn *down);
+ASN1_TYPE
+_asn1_set_down(ASN1_TYPE node, ASN1_TYPE down);
 
 char *
-_asn1_get_name(node_asn *node);
+_asn1_get_name(ASN1_TYPE node);
 
-node_asn *
-_asn1_get_down(node_asn *node);
+ASN1_TYPE
+_asn1_get_down(ASN1_TYPE node);
 
-node_asn *
-_asn1_mod_type(node_asn *node,unsigned int value);
+ASN1_TYPE
+_asn1_mod_type(ASN1_TYPE node,unsigned int value);
 
 void
-_asn1_remove_node(node_asn *node);
+_asn1_remove_node(ASN1_TYPE node);
 
 void _asn1_delete_list(void);
 
@@ -55,7 +55,7 @@ void _asn1_delete_list_and_nodes(void);
 
 char * _asn1_ltostr(long v,char *str);
 
-node_asn * _asn1_find_up(node_asn *node);
+ASN1_TYPE _asn1_find_up(ASN1_TYPE node);
 
 asn1_retCode _asn1_change_integer_value(ASN1_TYPE node);
 
index 8876e72..982f951 100644 (file)
@@ -46,12 +46,12 @@ extern char _asn1_identifierMissing[];
 /*         and CONST_ constants).                     */
 /* Return: pointer to the new element.                */
 /******************************************************/
-node_asn *
+ASN1_TYPE
 _asn1_add_node_only (unsigned int type)
 {
-  node_asn *punt;
+  ASN1_TYPE punt;
 
-  punt = (node_asn *) _asn1_calloc (1, sizeof (node_asn));
+  punt = (ASN1_TYPE ) _asn1_calloc (1, sizeof (struct node_asn));
   if (punt == NULL)
     return NULL;
 
@@ -69,8 +69,8 @@ _asn1_add_node_only (unsigned int type)
 /*   node: NODE_ASN element pointer.                              */
 /* Return: NULL if not found.                                     */
 /******************************************************************/
-node_asn *
-_asn1_find_left (node_asn * node)
+ASN1_TYPE
+_asn1_find_left (ASN1_TYPE  node)
 {
   if ((node == NULL) || (node->left == NULL) || (node->left->down == node))
     return NULL;
@@ -84,7 +84,7 @@ _asn1_create_static_structure (ASN1_TYPE pointer, char *output_file_name,
                               char *vector_name)
 {
   FILE *file;
-  node_asn *p;
+  ASN1_TYPE p;
   unsigned long t;
 
   file = fopen (output_file_name, "w");
@@ -184,7 +184,7 @@ asn1_retCode
 asn1_array2tree (const ASN1_ARRAY_TYPE * array, ASN1_TYPE * definitions,
                 char *errorDescription)
 {
-  node_asn *p, *p_last = NULL;
+  ASN1_TYPE p, p_last = NULL;
   unsigned long k;
   int move;
   asn1_retCode result;
@@ -295,7 +295,7 @@ asn1_array2tree (const ASN1_ARRAY_TYPE * array, ASN1_TYPE * definitions,
 asn1_retCode
 asn1_delete_structure (ASN1_TYPE * structure)
 {
-  node_asn *p, *p2, *p3;
+  ASN1_TYPE p, p2, p3;
 
   if (*structure == ASN1_TYPE_EMPTY)
     return ASN1_ELEMENT_NOT_FOUND;
@@ -363,7 +363,7 @@ asn1_delete_structure (ASN1_TYPE * structure)
 asn1_retCode
 asn1_delete_element (ASN1_TYPE structure, const char *element_name)
 {
-  node_asn *p2, *p3, *source_node;
+  ASN1_TYPE p2, p3, source_node;
 
   source_node = asn1_find_node (structure, element_name);
 
@@ -386,10 +386,10 @@ asn1_delete_element (ASN1_TYPE structure, const char *element_name)
   return asn1_delete_structure (&source_node);
 }
 
-node_asn *
-_asn1_copy_structure3 (node_asn * source_node)
+ASN1_TYPE
+_asn1_copy_structure3 (ASN1_TYPE  source_node)
 {
-  node_asn *dest_node, *p_s, *p_d, *p_d_prev;
+  ASN1_TYPE dest_node, p_s, p_d, p_d_prev;
   int move;
 
   if (source_node == NULL)
@@ -455,10 +455,10 @@ _asn1_copy_structure3 (node_asn * source_node)
 }
 
 
-node_asn *
-_asn1_copy_structure2 (node_asn * root, const char *source_name)
+ASN1_TYPE 
+_asn1_copy_structure2 (ASN1_TYPE  root, const char *source_name)
 {
-  node_asn *source_node;
+  ASN1_TYPE source_node;
 
   source_node = asn1_find_node (root, source_name);
 
@@ -468,9 +468,9 @@ _asn1_copy_structure2 (node_asn * root, const char *source_name)
 
 
 asn1_retCode
-_asn1_type_choice_config (node_asn * node)
+_asn1_type_choice_config (ASN1_TYPE  node)
 {
-  node_asn *p, *p2, *p3, *p4;
+  ASN1_TYPE p, p2, p3, p4;
   int move, tlen;
 
   if (node == NULL)
@@ -553,9 +553,9 @@ _asn1_type_choice_config (node_asn * node)
 
 
 asn1_retCode
-_asn1_expand_identifier (node_asn ** node, node_asn * root)
+_asn1_expand_identifier (ASN1_TYPE * node, ASN1_TYPE  root)
 {
-  node_asn *p, *p2, *p3;
+  ASN1_TYPE p, p2, p3;
   char name2[ASN1_MAX_NAME_SIZE + 2];
   int move;
 
@@ -684,7 +684,7 @@ asn1_retCode
 asn1_create_element (ASN1_TYPE definitions, const char *source_name,
                     ASN1_TYPE * element)
 {
-  node_asn *dest_node;
+  ASN1_TYPE dest_node;
   int res;
 
   dest_node = _asn1_copy_structure2 (definitions, source_name);
@@ -719,7 +719,7 @@ void
 asn1_print_structure (FILE * out, ASN1_TYPE structure, const char *name,
                      int mode)
 {
-  node_asn *p, *root;
+  ASN1_TYPE p, root;
   int k, indent = 0, len, len2, len3;
 
   if (out == NULL)
@@ -1088,7 +1088,7 @@ asn1_print_structure (FILE * out, ASN1_TYPE structure, const char *name,
 asn1_retCode
 asn1_number_of_elements (ASN1_TYPE element, const char *name, int *num)
 {
-  node_asn *node, *p;
+  ASN1_TYPE node, p;
 
   if (num == NULL)
     return ASN1_GENERIC_ERROR;
index 4c78391..f074e14 100644 (file)
@@ -8,16 +8,16 @@
 #ifndef _STRUCTURE_H
 #define _STRUCTURE_H
 
-asn1_retCode _asn1_create_static_structure(node_asn *pointer,
+asn1_retCode _asn1_create_static_structure(ASN1_TYPE pointer,
        char* output_file_name,char *vector_name);
 
-node_asn* _asn1_copy_structure3(node_asn *source_node);
+ASN1_TYPE _asn1_copy_structure3(ASN1_TYPE source_node);
 
-node_asn* _asn1_copy_structure2(node_asn *root,const char *source_name);
+ASN1_TYPE _asn1_copy_structure2(ASN1_TYPE root,const char *source_name);
 
-node_asn * _asn1_add_node_only(unsigned int type);
+ASN1_TYPE  _asn1_add_node_only(unsigned int type);
 
-node_asn * _asn1_find_left(node_asn *node);
+ASN1_TYPE  _asn1_find_left(ASN1_TYPE node);
 
 #endif