diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-06-12 19:15:51 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-06-12 19:15:51 +0200 |
commit | 98cb83615d9b813dbb1f1199b9c52a00af2eb973 (patch) | |
tree | 6c6c15231efec86b35317403ea76f2e30d54ad88 /include/asn1c/ANY.h | |
parent | bdff5e63096fd9c2ff503cdc7da338286699ef1a (diff) |
move header files to 'include' directory and install them
Diffstat (limited to 'include/asn1c/ANY.h')
-rw-r--r-- | include/asn1c/ANY.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/include/asn1c/ANY.h b/include/asn1c/ANY.h new file mode 100644 index 0000000..b7d92fa --- /dev/null +++ b/include/asn1c/ANY.h @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved. + * Redistribution and modifications are permitted subject to BSD license. + */ +#ifndef ASN_TYPE_ANY_H +#define ASN_TYPE_ANY_H + +#include <OCTET_STRING.h> /* Implemented via OCTET STRING type */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ANY { + uint8_t *buf; /* BER-encoded ANY contents */ + int size; /* Size of the above buffer */ + + asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */ +} ANY_t; + +extern asn_TYPE_descriptor_t asn_DEF_ANY; + +asn_struct_free_f ANY_free; +asn_struct_print_f ANY_print; +ber_type_decoder_f ANY_decode_ber; +der_type_encoder_f ANY_encode_der; +xer_type_encoder_f ANY_encode_xer; + +/****************************** + * Handy conversion routines. * + ******************************/ + +/* Convert another ASN.1 type into the ANY. This implies DER encoding. */ +int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr); +ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr); + +/* Convert the contents of the ANY type into the specified type. */ +int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr); + +#define ANY_fromBuf(s, buf, size) OCTET_STRING_fromBuf((s), (buf), (size)) +#define ANY_new_fromBuf(buf, size) OCTET_STRING_new_fromBuf( \ + &asn_DEF_ANY, (buf), (size)) + +#ifdef __cplusplus +} +#endif + +#endif /* ASN_TYPE_ANY_H */ |