15 void **sptr,
const void *buf_ptr,
size_t size,
int tag_mode) {
29 ASN_DEBUG(
"Decoding %s as plain primitive (tm=%d)",
36 tag_mode, 0, &length, 0);
45 buf_ptr = ((
const char *)buf_ptr) + rval.
consumed;
53 st->
size = (int)length;
55 if(
sizeof(st->
size) !=
sizeof(length)
67 memcpy(st->
buf, buf_ptr, length);
68 st->
buf[length] =
'\0';
73 ASN_DEBUG(
"Took %ld/%ld bytes to encode %s",
75 (
long)length, td->
name);
90 ASN_DEBUG(
"%s %s as a primitive type (tm=%d)",
91 cb?
"Encoding":
"Estimating", td->
name, tag_mode);
103 if(cb(st->
buf, st->
size, app_key) < 0) {
110 assert(st->
buf || st->
size == 0);
159 assert(chunk_size && ((
const char *)chunk_buf)[0] == 0x3c);
189 size_t lead_wsp_size;
220 chunk_buf = (
const char *)chunk_buf + lead_wsp_size;
221 chunk_size -= lead_wsp_size;
235 return lead_wsp_size + chunk_size;
247 const char *opt_mname,
248 const void *buf_ptr,
size_t size,
251 const char *xml_tag = opt_mname ? opt_mname : td->
xml_tag;
260 *sptr =
CALLOC(1, struct_size);
264 memset(&s_ctx, 0,
sizeof(s_ctx));
272 xml_tag, buf_ptr, size,
278 ASN_DEBUG(
"Primitive body is not recognized, " 279 "supplying empty one");
ssize_t der_write_tags(struct asn_TYPE_descriptor_s *type_descriptor, size_t struct_length, int tag_mode, int last_tag_form, ber_tlv_tag_t tag, asn_app_consume_bytes_f *consume_bytes_cb, void *app_key)
struct asn_TYPE_descriptor_s * failed_type
asn_enc_rval_t der_encode_primitive(asn_TYPE_descriptor_t *td, void *sptr, int tag_mode, ber_tlv_tag_t tag, asn_app_consume_bytes_f *cb, void *app_key)
#define CALLOC(nmemb, size)
void ASN__PRIMITIVE_TYPE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only)
static ssize_t xer_decode__primitive_body(void *key, const void *chunk_buf, size_t chunk_size, int have_more)
#define _ASN_ENCODED_OK(rval)
asn_dec_rval_t ber_check_tags(struct asn_codec_ctx_s *opt_codec_ctx, struct asn_TYPE_descriptor_s *type_descriptor, asn_struct_ctx_t *opt_ctx, const void *ptr, size_t size, int tag_mode, int last_tag_form, ber_tlv_len_t *last_length, int *opt_tlv_form)
enum xer_pbd_rval() xer_primitive_body_decoder_f(asn_TYPE_descriptor_t *td, void *struct_ptr, const void *chunk_buf, size_t chunk_size)
int() asn_app_consume_bytes_f(const void *buffer, size_t size, void *application_specific_key)
size_t xer_whitespace_span(const void *chunk_buf, size_t chunk_size)
xer_primitive_body_decoder_f * prim_body_decoder
enum asn_dec_rval_code_e code
static void ASN_DEBUG(const char *fmt,...)
asn_dec_rval_t ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, const void *buf_ptr, size_t size, int tag_mode)
static int xer_decode__unexpected_tag(void *key, const void *chunk_buf, size_t chunk_size)
asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sptr, size_t struct_size, const char *opt_mname, const void *buf_ptr, size_t size, xer_primitive_body_decoder_f *prim_body_decoder)
asn_TYPE_descriptor_t * type_descriptor
#define _ASN_DECODE_FAILED
asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, asn_struct_ctx_t *ctx, void *struct_key, const char *xml_tag, const void *buf_ptr, size_t size, int(*opt_unexpected_tag_decoder)(void *struct_key, const void *chunk_buf, size_t chunk_size), ssize_t(*body_receiver)(void *struct_key, const void *chunk_buf, size_t chunk_size, int have_more))