--- /dev/null
+/*-\r
+ * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.\r
+ * Redistribution and modifications are permitted subject to BSD license.\r
+ */\r
+#ifndef _XER_DECODER_H_\r
+#define _XER_DECODER_H_\r
+\r
+#include <asn_application.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+struct asn_TYPE_descriptor_s; /* Forward declaration */\r
+\r
+/*\r
+ * The XER decoder of any ASN.1 type. May be invoked by the application.\r
+ * Decodes CANONICAL-XER and BASIC-XER.\r
+ */\r
+asn_dec_rval_t xer_decode(\r
+ const struct asn_codec_ctx_s *opt_codec_ctx,\r
+ const struct asn_TYPE_descriptor_s *type_descriptor,\r
+ void **struct_ptr, /* Pointer to a target structure's pointer */\r
+ const void *buffer, /* Data to be decoded */\r
+ size_t size /* Size of data buffer */\r
+);\r
+\r
+/*\r
+ * Type of the type-specific XER decoder function.\r
+ */\r
+typedef asn_dec_rval_t(xer_type_decoder_f)(\r
+ const asn_codec_ctx_t *opt_codec_ctx,\r
+ const struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr,\r
+ const char *opt_mname, /* Member name */\r
+ const void *buf_ptr, size_t size);\r
+\r
+/*******************************\r
+ * INTERNALLY USEFUL FUNCTIONS *\r
+ *******************************/\r
+\r
+/*\r
+ * Generalized function for decoding the primitive values.\r
+ * Used by more specialized functions, such as OCTET_STRING_decode_xer_utf8\r
+ * and others. This function should not be used by applications, as its API\r
+ * is subject to changes.\r
+ */\r
+asn_dec_rval_t xer_decode_general(\r
+ const asn_codec_ctx_t *opt_codec_ctx,\r
+ asn_struct_ctx_t *ctx, /* Type decoder context */\r
+ void *struct_key, /* Treated as opaque pointer */\r
+ const char *xml_tag, /* Expected XML tag name */\r
+ const void *buf_ptr, size_t size,\r
+ int (*opt_unexpected_tag_decoder)(void *struct_key, const void *chunk_buf,\r
+ size_t chunk_size),\r
+ ssize_t (*body_receiver)(void *struct_key, const void *chunk_buf,\r
+ size_t chunk_size, int have_more));\r
+\r
+\r
+/*\r
+ * Fetch the next XER (XML) token from the stream.\r
+ * The function returns the number of bytes occupied by the chunk type,\r
+ * returned in the _ch_type. The _ch_type is only set (and valid) when\r
+ * the return value is >= 0.\r
+ */\r
+ typedef enum pxer_chunk_type {\r
+ PXER_WMORE, /* Chunk type is not clear, more data expected. */\r
+ PXER_TAG, /* Complete XER tag */\r
+ PXER_TEXT, /* Plain text between XER tags */\r
+ PXER_COMMENT /* A comment, may be part of */\r
+ } pxer_chunk_type_e;\r
+ssize_t xer_next_token(int *stateContext,\r
+ const void *buffer, size_t size, pxer_chunk_type_e *_ch_type);\r
+\r
+/*\r
+ * This function checks the buffer against the tag name is expected to occur.\r
+ */\r
+ typedef enum xer_check_tag {\r
+ XCT_BROKEN = 0, /* The tag is broken */\r
+ XCT_OPENING = 1, /* This is the <opening> tag */\r
+ XCT_CLOSING = 2, /* This is the </closing> tag */\r
+ XCT_BOTH = 3, /* This is the <modified/> tag */\r
+ XCT__UNK__MASK = 4, /* Mask of everything unexpected */\r
+ XCT_UNKNOWN_OP = 5, /* Unexpected <opening> tag */\r
+ XCT_UNKNOWN_CL = 6, /* Unexpected </closing> tag */\r
+ XCT_UNKNOWN_BO = 7 /* Unexpected <modified/> tag */\r
+ } xer_check_tag_e;\r
+xer_check_tag_e xer_check_tag(const void *buf_ptr, int size,\r
+ const char *need_tag);\r
+\r
+/*\r
+ * Get the number of bytes consisting entirely of XER whitespace characters.\r
+ * RETURN VALUES:\r
+ * >=0: Number of whitespace characters in the string.\r
+ */\r
+size_t xer_whitespace_span(const void *chunk_buf, size_t chunk_size);\r
+\r
+/*\r
+ * Skip the series of anticipated extensions.\r
+ */\r
+int xer_skip_unknown(xer_check_tag_e tcv, ber_tlv_len_t *depth);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* _XER_DECODER_H_ */\r