1 /*****************************************************************************
3 # Copyright 2019 AT&T Intellectual Property *
5 # Licensed under the Apache License, Version 2.0 (the "License"); *
6 # you may not use this file except in compliance with the License. *
7 # You may obtain a copy of the License at *
9 # http://www.apache.org/licenses/LICENSE-2.0 *
11 # Unless required by applicable law or agreed to in writing, software *
12 # distributed under the License is distributed on an "AS IS" BASIS, *
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14 # See the License for the specific language governing permissions and *
15 # limitations under the License. *
17 ******************************************************************************/
20 * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
21 * Redistribution and modifications are permitted subject to BSD license.
23 #ifndef ASN_CODECS_PRIM_H
24 #define ASN_CODECS_PRIM_H
26 #include <asn_application.h>
32 typedef struct ASN__PRIMITIVE_TYPE_s {
33 uint8_t *buf; /* Buffer with consecutive primitive encoding bytes */
34 size_t size; /* Size of the buffer */
35 } ASN__PRIMITIVE_TYPE_t; /* Do not use this type directly! */
37 asn_struct_free_f ASN__PRIMITIVE_TYPE_free;
38 ber_type_decoder_f ber_decode_primitive;
39 der_type_encoder_f der_encode_primitive;
42 * A callback specification for the xer_decode_primitive() function below.
45 XPBD_SYSTEM_FAILURE, /* System failure (memory shortage, etc) */
46 XPBD_DECODER_LIMIT, /* Hit some decoder limitation or deficiency */
47 XPBD_BROKEN_ENCODING, /* Encoding of a primitive body is broken */
48 XPBD_NOT_BODY_IGNORE, /* Not a body format, but safe to ignore */
49 XPBD_BODY_CONSUMED /* Body is recognized and consumed */
51 typedef enum xer_pbd_rval(xer_primitive_body_decoder_f)(
52 const asn_TYPE_descriptor_t *td, void *struct_ptr, const void *chunk_buf,
56 * Specific function to decode simple primitive types.
57 * Also see xer_decode_general() in xer_decoder.h
59 asn_dec_rval_t xer_decode_primitive(
60 const asn_codec_ctx_t *opt_codec_ctx,
61 const asn_TYPE_descriptor_t *type_descriptor, void **struct_ptr,
62 size_t struct_size, const char *opt_mname, const void *buf_ptr, size_t size,
63 xer_primitive_body_decoder_f *prim_body_decoder);
69 #endif /* ASN_CODECS_PRIM_H */