2 * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
3 * Redistribution and modifications are permitted subject to BSD license.
8 #include <asn_application.h>
9 #include <oer_support.h>
15 struct asn_TYPE_descriptor_s; /* Forward declaration */
16 struct asn_codec_ctx_s; /* Forward declaration */
19 * The Octet Encoding Rules (OER, X.696 08/2015) decoder for any given type.
20 * This function may be invoked directly by the application.
21 * Parses CANONICAL-OER and BASIC-OER.
23 asn_dec_rval_t oer_decode(const struct asn_codec_ctx_s *opt_codec_ctx,
24 const struct asn_TYPE_descriptor_s *type_descriptor,
25 void **struct_ptr, /* Pointer to a target structure's pointer */
26 const void *buffer, /* Data to be decoded */
27 size_t size /* Size of that buffer */
31 * Type of generic function which decodes the byte stream into the structure.
33 typedef asn_dec_rval_t(oer_type_decoder_f)(
34 const struct asn_codec_ctx_s *opt_codec_ctx,
35 const struct asn_TYPE_descriptor_s *type_descriptor,
36 const asn_oer_constraints_t *constraints,
42 * Swallow the Open Type (X.696 (08/2015), #30) into /dev/null.
44 * -1: Fatal error deciphering length.
45 * 0: More data expected than bufptr contains.
46 * >0: Number of bytes used from bufptr.
48 ssize_t oer_open_type_skip(const void *bufptr, size_t size);
51 * Read the Open Type (X.696 (08/2015), #30).
53 * 0: More data expected than bufptr contains.
54 * -1: Fatal error deciphering length.
55 * >0: Number of bytes used from bufptr.
57 ssize_t oer_open_type_get(const asn_codec_ctx_t *opt_codec_ctx,
58 const struct asn_TYPE_descriptor_s *td,
59 const asn_oer_constraints_t *constraints,
60 void **struct_ptr, const void *bufptr, size_t size);
63 * Length-prefixed buffer decoding for primitive types.
65 oer_type_decoder_f oer_decode_primitive;
72 #endif /* OER_DECODER_H */