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