blob: cabc411b680d8406eb3f5a884090af40036d4d76 [file] [log] [blame]
vlm7e66aa82004-09-02 12:11:47 +00001/*-
2 * Copyright (c) 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
3 * Redistribution and modifications are permitted subject to BSD license.
4 */
5#ifndef ASN_TYPE_ANY_H
6#define ASN_TYPE_ANY_H
7
vlm0f1ab762004-10-12 05:57:23 +00008#include <OCTET_STRING.h> /* Implemented via OCTET STRING type */
vlm7e66aa82004-09-02 12:11:47 +00009
10typedef struct ANY {
11 uint8_t *buf; /* BER-encoded ANY contents */
12 int size; /* Size of the above buffer */
13
vlmef6355b2004-09-29 13:26:15 +000014 asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
vlm7e66aa82004-09-02 12:11:47 +000015} ANY_t;
16
vlmef6355b2004-09-29 13:26:15 +000017extern asn_TYPE_descriptor_t asn_DEF_ANY;
vlm7e66aa82004-09-02 12:11:47 +000018
vlm39ba4c42004-09-22 16:06:28 +000019asn_struct_free_f ANY_free;
20asn_struct_print_f ANY_print;
vlm7e66aa82004-09-02 12:11:47 +000021ber_type_decoder_f ANY_decode_ber;
22der_type_encoder_f ANY_encode_der;
vlm39ba4c42004-09-22 16:06:28 +000023xer_type_encoder_f ANY_encode_xer;
vlm7e66aa82004-09-02 12:11:47 +000024
25/******************************
26 * Handy conversion routines. *
27 ******************************/
28
vlm83204112004-09-13 08:26:57 +000029/* Convert another ASN.1 type into the ANY. This implies DER encoding. */
vlmef6355b2004-09-29 13:26:15 +000030int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr);
31ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr);
vlm83204112004-09-13 08:26:57 +000032
33/* Convert the contents of the ANY type into the specified type. */
vlmef6355b2004-09-29 13:26:15 +000034int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
vlm83204112004-09-13 08:26:57 +000035
vlm7e66aa82004-09-02 12:11:47 +000036#define ANY_fromBuf(s, buf, size) OCTET_STRING_fromBuf((s), (buf), (size))
37#define ANY_new_fromBuf(buf, size) OCTET_STRING_new_fromBuf((buf), (size))
38
39#endif /* ASN_TYPE_ANY_H */