SIM-115: update simulator to use latest E2SM KPM version 3
[sim/e2-interface.git] / e2sim / asn1c / asn_codecs_prim.h
1 /*-
2  * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
3  * Redistribution and modifications are permitted subject to BSD license.
4  */
5 #ifndef ASN_CODECS_PRIM_H
6 #define ASN_CODECS_PRIM_H
7
8 #include <asn_application.h>
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13
14 typedef struct ASN__PRIMITIVE_TYPE_s {
15     uint8_t *buf;  /* Buffer with consecutive primitive encoding bytes */
16     size_t size;   /* Size of the buffer */
17 } ASN__PRIMITIVE_TYPE_t;  /* Do not use this type directly! */
18
19 asn_struct_free_f ASN__PRIMITIVE_TYPE_free;
20
21 #if !defined(ASN_DISABLE_BER_SUPPORT)
22 ber_type_decoder_f ber_decode_primitive;
23 der_type_encoder_f der_encode_primitive;
24 #endif  /* !defined(ASN_DISABLE_BER_SUPPORT) */
25
26 #if !defined(ASN_DISABLE_XER_SUPPORT)
27 /*
28  * A callback specification for the xer_decode_primitive() function below.
29  */
30 enum xer_pbd_rval {
31     XPBD_SYSTEM_FAILURE,   /* System failure (memory shortage, etc) */
32     XPBD_DECODER_LIMIT,    /* Hit some decoder limitation or deficiency */
33     XPBD_BROKEN_ENCODING,  /* Encoding of a primitive body is broken */
34     XPBD_NOT_BODY_IGNORE,  /* Not a body format, but safe to ignore */
35     XPBD_BODY_CONSUMED     /* Body is recognized and consumed */
36 };
37 typedef enum xer_pbd_rval(xer_primitive_body_decoder_f)(
38     const asn_TYPE_descriptor_t *td, void *struct_ptr, const void *chunk_buf,
39     size_t chunk_size);
40
41 /*
42  * Specific function to decode simple primitive types.
43  * Also see xer_decode_general() in xer_decoder.h
44  */
45 asn_dec_rval_t xer_decode_primitive(
46     const asn_codec_ctx_t *opt_codec_ctx,
47     const asn_TYPE_descriptor_t *type_descriptor, void **struct_ptr,
48     size_t struct_size, const char *opt_mname, const void *buf_ptr, size_t size,
49     xer_primitive_body_decoder_f *prim_body_decoder);
50 #endif  /* !defined(ASN_DISABLE_XER_SUPPORT) */
51
52 #ifdef __cplusplus
53 }
54 #endif
55
56 #endif  /* ASN_CODECS_PRIM_H */