2004-09-02 12:11:47 +00:00
|
|
|
/*-
|
|
|
|
* 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
|
|
|
|
|
2004-10-12 05:57:23 +00:00
|
|
|
#include <OCTET_STRING.h> /* Implemented via OCTET STRING type */
|
2004-09-02 12:11:47 +00:00
|
|
|
|
2005-07-24 09:03:44 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2004-09-02 12:11:47 +00:00
|
|
|
typedef struct ANY {
|
|
|
|
uint8_t *buf; /* BER-encoded ANY contents */
|
|
|
|
int size; /* Size of the above buffer */
|
|
|
|
|
2004-09-29 13:26:15 +00:00
|
|
|
asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
|
2004-09-02 12:11:47 +00:00
|
|
|
} ANY_t;
|
|
|
|
|
2004-09-29 13:26:15 +00:00
|
|
|
extern asn_TYPE_descriptor_t asn_DEF_ANY;
|
2004-09-02 12:11:47 +00:00
|
|
|
|
2004-09-22 16:06:28 +00:00
|
|
|
asn_struct_free_f ANY_free;
|
|
|
|
asn_struct_print_f ANY_print;
|
2004-09-02 12:11:47 +00:00
|
|
|
ber_type_decoder_f ANY_decode_ber;
|
|
|
|
der_type_encoder_f ANY_encode_der;
|
2004-09-22 16:06:28 +00:00
|
|
|
xer_type_encoder_f ANY_encode_xer;
|
2004-09-02 12:11:47 +00:00
|
|
|
|
|
|
|
/******************************
|
|
|
|
* Handy conversion routines. *
|
|
|
|
******************************/
|
|
|
|
|
2004-09-13 08:26:57 +00:00
|
|
|
/* Convert another ASN.1 type into the ANY. This implies DER encoding. */
|
2004-09-29 13:26:15 +00:00
|
|
|
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);
|
2004-09-13 08:26:57 +00:00
|
|
|
|
|
|
|
/* Convert the contents of the ANY type into the specified type. */
|
2004-09-29 13:26:15 +00:00
|
|
|
int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
|
2004-09-13 08:26:57 +00:00
|
|
|
|
2004-09-02 12:11:47 +00:00
|
|
|
#define ANY_fromBuf(s, buf, size) OCTET_STRING_fromBuf((s), (buf), (size))
|
2006-01-25 01:56:58 +00:00
|
|
|
#define ANY_new_fromBuf(buf, size) OCTET_STRING_new_fromBuf( \
|
|
|
|
&asn_DEF_ANY, (buf), (size))
|
2004-09-02 12:11:47 +00:00
|
|
|
|
2005-07-24 09:03:44 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-09-02 12:11:47 +00:00
|
|
|
#endif /* ASN_TYPE_ANY_H */
|