diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-04-15 10:57:10 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-04-15 10:57:10 +0000 |
commit | f72ace13f7340934bb02a72212ee6521fa7ab55c (patch) | |
tree | 6187679330d994d2f2530071a622898fff8e3edc /lib | |
parent | cdbfb60fb5011fc45d2f6176c11bc3adcbd70b7a (diff) | |
download | gnutls-f72ace13f7340934bb02a72212ee6521fa7ab55c.tar.gz |
added the new libtasn1.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/minitasn1/int.h | 2 | ||||
-rw-r--r-- | lib/minitasn1/libtasn1.h | 4 | ||||
-rw-r--r-- | lib/minitasn1/structure.c | 38 |
3 files changed, 42 insertions, 2 deletions
diff --git a/lib/minitasn1/int.h b/lib/minitasn1/int.h index 088cc9897a..4af32d35f8 100644 --- a/lib/minitasn1/int.h +++ b/lib/minitasn1/int.h @@ -32,7 +32,7 @@ #include <mem.h> -#define LIBTASN1_VERSION "0.2.7" +#define LIBTASN1_VERSION "0.2.8" #define MAX32 4294967295 #define MAX24 16777215 diff --git a/lib/minitasn1/libtasn1.h b/lib/minitasn1/libtasn1.h index 65faa47605..02c1cfc2ee 100644 --- a/lib/minitasn1/libtasn1.h +++ b/lib/minitasn1/libtasn1.h @@ -28,7 +28,7 @@ extern "C" { #endif -#define LIBTASN1_VERSION "0.2.7" +#define LIBTASN1_VERSION "0.2.8" #include <sys/types.h> #include <time.h> @@ -145,6 +145,8 @@ asn1_retCode asn1_create_element(ASN1_TYPE definitions,const char *source_name, asn1_retCode asn1_delete_structure(ASN1_TYPE *structure); +asn1_retCode asn1_delete_element(ASN1_TYPE structure,const char *element_name); + asn1_retCode asn1_write_value(ASN1_TYPE element,const char *name, const void *value,int len); diff --git a/lib/minitasn1/structure.c b/lib/minitasn1/structure.c index 97834e9e77..f33665476d 100644 --- a/lib/minitasn1/structure.c +++ b/lib/minitasn1/structure.c @@ -299,6 +299,44 @@ asn1_delete_structure(ASN1_TYPE *structure) } +/** + * asn1_delete_element - Deletes the element of a structure. + * @structure: pointer to the structure that contains the element you want to delete. + * @element_name: element's name you want to delete. + * Description: + * + * Deletes the element named *element_name inside *structure. + * + * Returns: + * + * ASN1_SUCCESS\: everything OK + * + * ASN1_ELEMENT_NOT_FOUND + * + **/ +asn1_retCode +asn1_delete_element(ASN1_TYPE structure,const char *element_name) +{ + node_asn *p2,*p3,*source_node; + + source_node=_asn1_find_node(structure,element_name); + + if(source_node==ASN1_TYPE_EMPTY) return ASN1_ELEMENT_NOT_FOUND; + + p2=source_node->right; + p3=_asn1_find_left(source_node); + if(!p3){ + p3=_asn1_find_up(source_node); + if(p3) + _asn1_set_down(p3,p2); + else + if(source_node->right) source_node->right->left=NULL; + } + else _asn1_set_right(p3,p2); + + return asn1_delete_structure(&source_node); +} + node_asn * _asn1_copy_structure3(node_asn *source_node) |