libisdn
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <ctype.h>
#include "asn1.h"
#include "asn1_common.h"
#include "asn1_log.h"
#include "asn1_types.h"
#include "asn1_list.h"
#include "asn1_codec_ber.h"
Go to the source code of this file.
Data Structures | |
struct | asn1_level_ref |
Defines | |
#define | ASN1_CANARIES 1 |
#define | ASN1_CANARY { 0xde, 0xad, 0xbe, 0xef } |
Functions | |
void * | _asn1_malloc (const long size) |
void | ____asn1_ptr_check (const char *file, const int line, void *obj) |
void | _asn1_free (void *obj) |
int | asn1_set_add (struct asn1_set *set, struct asn1_object *elem) |
int | asn1_encode (const struct asn1_tree *tree, char *output, int *size) |
int | asn1_decode (struct asn1_tree *tree, const char *input, const int size) |
struct asn1_tree * | asn1_create (void) |
int | asn1_destroy (struct asn1_tree *tree) |
int | asn1_print (struct asn1_tree *tree, FILE *fp) |
#define ASN1_CANARIES 1 |
#define ASN1_CANARY { 0xde, 0xad, 0xbe, 0xef } |
void ____asn1_ptr_check | ( | const char * | file, |
const int | line, | ||
void * | obj | ||
) |
Definition at line 68 of file asn1.c.
References ARRAY_SIZE, asn1_class_name(), asn1_error(), asn1_get_class(), asn1_get_type(), and asn1_type_name().
void _asn1_free | ( | void * | obj | ) |
Definition at line 100 of file asn1.c.
References ARRAY_SIZE, asn1_debug(), and asn1_error().
void* _asn1_malloc | ( | const long | size | ) |
Definition at line 47 of file asn1.c.
References ARRAY_SIZE, and asn1_debug().
struct asn1_tree* asn1_create | ( | void | ) | [read] |
Create new empty ASN.1 tree object
Definition at line 597 of file asn1.c.
References ASN1_CODEC_BER, ASN1_INIT_HEAD, asn1_set_codec_by_id(), and asn1_tree::root.
int asn1_decode | ( | struct asn1_tree * | tree, |
const char * | input, | ||
const int | size | ||
) |
Decode binary ASN.1 into tree structure
[out] | tree | ASN.1 tree to encode |
[in] | input | Input buffer |
[in] | size | Size of input in bytes |
Definition at line 418 of file asn1.c.
References __asn1_ptr_check, ASN1_CLASS_UNIVERSAL, asn1_debug(), asn1_eq_type(), asn1_error(), ASN1_INIT_HEAD, ASN1_MINSIZE, asn1_trace(), ASN1_TYPE_BIT_STRING, ASN1_TYPE_BOOLEAN, ASN1_TYPE_ENUMERATED, ASN1_TYPE_EOC, ASN1_TYPE_IA5_STRING, ASN1_TYPE_INTEGER, asn1_type_name(), ASN1_TYPE_NUMERIC_STRING, ASN1_TYPE_OCTET_STRING, ASN1_TYPE_OID, ASN1_TYPE_REAL, ASN1_TYPE_UTF8_STRING, asn1_header::asn_class, asn1_header::asn_complex, asn1_header::asn_type, asn1_complex::children, asn1_tree::codec, asn1_buffer::data, asn1_codec::decode_header, asn1_codec::decode_value, MAX, asn1_codec::name, asn1_buffer::offset, asn1_level_ref::offset, asn1_level_ref::ptr, asn1_tree::root, asn1_object::siblings, asn1_header::size, asn1_buffer::size, and asn1_level_ref::size.
int asn1_destroy | ( | struct asn1_tree * | tree | ) |
Free tree structure (recursively)
[in] | tree | ASN.1 tree to release |
Definition at line 611 of file asn1.c.
References __asn1_ptr_check, asn1_free, asn1_header::asn_complex, container_of, asn1_object::hdr, asn1_list::next, asn1_tree::root, and asn1_object::siblings.
int asn1_encode | ( | const struct asn1_tree * | tree, |
char * | output, | ||
int * | size | ||
) |
Encode ASN.1 tree to binary
[in] | tree | ASN.1 tree to encode |
[out] | output | Output buffer |
size | Size of output buffer, number of encoded bytes |
Definition at line 207 of file asn1.c.
References __asn1_ptr_check, ASN1_CLASS_UNIVERSAL, asn1_debug(), asn1_error(), asn1_trace(), ASN1_TYPE_BIT_STRING, ASN1_TYPE_BOOLEAN, ASN1_TYPE_ENUMERATED, ASN1_TYPE_IA5_STRING, ASN1_TYPE_INTEGER, ASN1_TYPE_NUMERIC_STRING, ASN1_TYPE_OCTET_STRING, ASN1_TYPE_OID, ASN1_TYPE_REAL, ASN1_TYPE_UTF8_STRING, asn1_header::asn_class, asn1_header::asn_complex, asn1_header::asn_type, asn1_tree::codec, container_of, asn1_buffer::data, asn1_codec::encode_header, asn1_codec::encode_value, asn1_object::hdr, asn1_codec::header_size, asn1_codec::name, asn1_buffer::offset, asn1_level_ref::offset, asn1_level_ref::ptr, asn1_tree::root, asn1_header::size, asn1_buffer::size, and asn1_level_ref::size.
int asn1_print | ( | struct asn1_tree * | tree, |
FILE * | fp | ||
) |
Dump tree on file handle
[in] | tree | ASN.1 tree |
[in] | fp | File handle to dump tree to |
Definition at line 654 of file asn1.c.
References __asn1_ptr_check, asn1_class_name(), ASN1_CLASS_UNIVERSAL, asn1_error(), asn1_get_class(), asn1_get_type(), ASN1_MAXDEPTH, asn1_trace(), ASN1_TYPE_BIT_STRING, ASN1_TYPE_BOOLEAN, ASN1_TYPE_ENUMERATED, ASN1_TYPE_EOC, ASN1_TYPE_IA5_STRING, ASN1_TYPE_INTEGER, asn1_type_name(), ASN1_TYPE_NUMERIC_STRING, ASN1_TYPE_OCTET_STRING, ASN1_TYPE_OID, ASN1_TYPE_SEQUENCE, ASN1_TYPE_SET, ASN1_TYPE_UTF8_STRING, asn1_header::asn_class, asn1_header::asn_complex, asn1_header::asn_type, container_of, asn1_object::hdr, HEX_INT8_FMT, asn1_oid::length, asn1_tree::root, asn1_object::siblings, asn1_string::siblings, asn1_header::size, asn1_boolean::value, asn1_string::value, asn1_integer::value, asn1_oid::value, and asn1_enumerated::value.
int asn1_set_add | ( | struct asn1_set * | set, |
struct asn1_object * | elem | ||
) |