Added asn1_read_node_value()
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 12 Sep 2012 20:32:20 +0000 (22:32 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 12 Sep 2012 20:45:28 +0000 (22:45 +0200)
NEWS
lib/element.c
lib/libtasn1.h
lib/libtasn1.map

diff --git a/NEWS b/NEWS
index 7cc4a10..cb4dfd9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
 GNU Libtasn1 NEWS                                     -*- outline -*-
 
-* Noteworthy changes in release 2.14 (unreleased) [stable]
+* Noteworthy changes in release 3.0 (unreleased) [stable]
+- Added asn1_read_node_value() to obtain a node's value.
 
 * Noteworthy changes in release 2.13 (2012-05-31) [stable]
 - Updated fix for DER decoding issue to not depend on specific compilers.
index 70b272b..a0f841f 100644 (file)
@@ -976,3 +976,22 @@ asn1_read_tag (ASN1_TYPE root, const char *name, int *tagValue,
 
   return ASN1_SUCCESS;
 }
+
+/**
+ * asn1_read_node_value:
+ * @node: pointer to a node.
+ * @data: a point to a node_data_struct
+ *
+ * Returns the value a data node inside a ASN1_TYPE structure.
+ * The data returned should be handled as constant values.
+ *
+ * Returns: %ASN1_SUCCESS if the node exists.
+ **/
+asn1_retCode asn1_read_node_value (ASN1_TYPE node, ASN1_DATA_NODE* data)
+{
+  data->name = node->name;
+  data->value = node->value;
+  data->value_len = node->value_len;
+  
+  return ASN1_SUCCESS;
+}
index 30154ae..01030df 100644 (file)
@@ -112,7 +112,6 @@ extern "C"
 
   typedef node_asn *ASN1_TYPE;
 
-
   /* maximum number of characters of a name */
   /* inside a file with ASN1 definitons     */
 #define ASN1_MAX_NAME_SIZE 128
@@ -130,6 +129,15 @@ extern "C"
   };
   typedef struct static_struct_asn ASN1_ARRAY_TYPE;
 
+  struct node_data_struct
+  {
+    const char *name;          /* Node name */
+    const void *value;         /* Node value */
+    unsigned int value_len;     /* Node value size */
+    unsigned int vals[4];      /* reserved for future use */
+  };
+  typedef struct node_data_struct ASN1_DATA_NODE;
+
   /***********************************/
   /*  Fixed constants                */
   /***********************************/
@@ -179,6 +187,9 @@ extern "C"
                     void *ivalue, int *len);
 
   extern ASN1_API asn1_retCode
+    asn1_read_node_value (ASN1_TYPE node, ASN1_DATA_NODE* data);
+
+  extern ASN1_API asn1_retCode
     asn1_number_of_elements (ASN1_TYPE element, const char *name, int *num);
 
   extern ASN1_API asn1_retCode
index 1906cd5..f4c3253 100644 (file)
@@ -57,3 +57,10 @@ LIBTASN1_0_3
   local:
     *;
 };
+
+LIBTASN1_0_4
+{
+  global:
+    asn1_read_node_value;
+} LIBTASN1_0_3;
+