ITS
xer_decoder.c File Reference
#include <asn_application.h>
#include <asn_internal.h>
#include <xer_support.h>
Include dependency graph for xer_decoder.c:

Go to the source code of this file.

Classes

struct  xer__cb_arg
 

Macros

#define CSLASH   0x2f /* '/' */
 
#define LANGLE   0x3c /* '<' */
 
#define RANGLE   0x3e /* '>' */
 
#define ADVANCE(num_bytes)
 
#define RETURN(_code)
 
#define XER_GOT_BODY(chunk_buf, chunk_size, size)
 
#define XER_GOT_EMPTY()
 

Functions

asn_dec_rval_t xer_decode (asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **struct_ptr, const void *buffer, size_t size)
 
static int xer__token_cb (pxml_chunk_type_e type, const void *_chunk_data, size_t _chunk_size, void *key)
 
ssize_t xer_next_token (int *stateContext, const void *buffer, size_t size, pxer_chunk_type_e *ch_type)
 
xer_check_tag_e xer_check_tag (const void *buf_ptr, int size, const char *need_tag)
 
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))
 
size_t xer_whitespace_span (const void *chunk_buf, size_t chunk_size)
 
int xer_skip_unknown (xer_check_tag_e tcv, ber_tlv_len_t *depth)
 

Macro Definition Documentation

◆ ADVANCE

#define ADVANCE (   num_bytes)
Value:
do { \
size_t num = (num_bytes); \
buf_ptr = ((const char *)buf_ptr) + num; \
size -= num; \
consumed_myself += num; \
} while(0)

Definition at line 166 of file xer_decoder.c.

Referenced by xer_decode_general().

◆ CSLASH

#define CSLASH   0x2f /* '/' */

Definition at line 100 of file xer_decoder.c.

Referenced by xer_check_tag().

◆ LANGLE

#define LANGLE   0x3c /* '<' */

Definition at line 101 of file xer_decoder.c.

Referenced by xer_check_tag().

◆ RANGLE

#define RANGLE   0x3e /* '>' */

Definition at line 102 of file xer_decoder.c.

Referenced by xer_check_tag().

◆ RETURN

#define RETURN (   _code)
Value:
do { \
rval.code = _code; \
rval.consumed = consumed_myself; \
if(rval.code != RC_OK) \
ASN_DEBUG("Failed with %d", rval.code); \
return rval; \
} while(0)

Definition at line 174 of file xer_decoder.c.

Referenced by xer_decode_general().

◆ XER_GOT_BODY

#define XER_GOT_BODY (   chunk_buf,
  chunk_size,
  size 
)
Value:
do { \
ssize_t converted_size = body_receiver \
(struct_key, chunk_buf, chunk_size, \
(size_t)chunk_size < size); \
if(converted_size == -1) RETURN(RC_FAIL); \
if(converted_size == 0 \
&& size == (size_t)chunk_size) \
chunk_size = converted_size; \
} while(0)
#define RETURN(_code)
Definition: xer_decoder.c:174

Definition at line 182 of file xer_decoder.c.

Referenced by xer_decode_general().

◆ XER_GOT_EMPTY

#define XER_GOT_EMPTY ( )
Value:
do { \
if(body_receiver(struct_key, 0, 0, size > 0) == -1) \
RETURN(RC_FAIL); \
} while(0)

Definition at line 192 of file xer_decoder.c.

Referenced by xer_decode_general().

Function Documentation

◆ xer__token_cb()

static int xer__token_cb ( pxml_chunk_type_e  type,
const void *  _chunk_data,
size_t  _chunk_size,
void *  key 
)
static

Definition at line 50 of file xer_decoder.c.

References xer__cb_arg::callback_not_invoked, xer__cb_arg::chunk_buf, xer__cb_arg::chunk_size, and xer__cb_arg::chunk_type.

Referenced by xer_next_token().

Here is the caller graph for this function:

◆ xer_check_tag()

xer_check_tag_e xer_check_tag ( const void *  buf_ptr,
int  size,
const char *  need_tag 
)

Definition at line 105 of file xer_decoder.c.

References ASN_DEBUG(), CSLASH, LANGLE, RANGLE, XCT__UNK__MASK, XCT_BOTH, XCT_BROKEN, XCT_CLOSING, and XCT_OPENING.

Referenced by xer_decode_general().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xer_decode()

asn_dec_rval_t xer_decode ( asn_codec_ctx_t opt_codec_ctx,
asn_TYPE_descriptor_t td,
void **  struct_ptr,
const void *  buffer,
size_t  size 
)

◆ xer_decode_general()

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(*)(void *struct_key, const void *chunk_buf, size_t chunk_size)  opt_unexpected_tag_decoder,
ssize_t(*)(void *struct_key, const void *chunk_buf, size_t chunk_size, int have_more)  body_receiver 
)

Definition at line 201 of file xer_decoder.c.

References ADVANCE, ASN_DEBUG(), asn_struct_ctx_s::context, asn_struct_ctx_s::phase, PXER_COMMENT, PXER_TAG, PXER_TEXT, RC_FAIL, RC_OK, RC_WMORE, RETURN, XCT_BOTH, XCT_CLOSING, XCT_OPENING, XCT_UNKNOWN_BO, xer_check_tag(), XER_GOT_BODY, XER_GOT_EMPTY, and xer_next_token().

Referenced by OCTET_STRING__decode_xer(), and xer_decode_primitive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xer_next_token()

ssize_t xer_next_token ( int *  stateContext,
const void *  buffer,
size_t  size,
pxer_chunk_type_e ch_type 
)

Definition at line 63 of file xer_decoder.c.

References xer__cb_arg::callback_not_invoked, xer__cb_arg::chunk_buf, xer__cb_arg::chunk_size, xer__cb_arg::chunk_type, PXER_COMMENT, PXER_TAG, PXER_TEXT, PXML_COMMENT, PXML_COMMENT_END, pxml_parse(), PXML_TAG, PXML_TAG_END, PXML_TEXT, and xer__token_cb().

Referenced by CHOICE_decode_xer(), SEQUENCE_decode_xer(), SET_OF_decode_xer(), and xer_decode_general().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xer_skip_unknown()

int xer_skip_unknown ( xer_check_tag_e  tcv,
ber_tlv_len_t depth 
)

Definition at line 346 of file xer_decoder.c.

References XCT_BOTH, XCT_CLOSING, XCT_OPENING, XCT_UNKNOWN_BO, XCT_UNKNOWN_CL, and XCT_UNKNOWN_OP.

Referenced by CHOICE_decode_xer(), and SEQUENCE_decode_xer().

Here is the caller graph for this function:

◆ xer_whitespace_span()

size_t xer_whitespace_span ( const void *  chunk_buf,
size_t  chunk_size 
)

Definition at line 320 of file xer_decoder.c.

References xer__cb_arg::chunk_buf, and xer__cb_arg::chunk_size.

Referenced by xer_decode__primitive_body().

Here is the caller graph for this function: