2 * Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com.
\r
3 * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
\r
4 * Redistribution and modifications are permitted subject to BSD license.
\r
6 #ifndef _XER_SUPPORT_H_
\r
7 #define _XER_SUPPORT_H_
\r
9 #include <asn_system.h> /* Platform-specific types */
\r
16 * Types of data transferred to the application.
\r
19 PXML_TEXT, /* Plain text between XML tags. */
\r
20 PXML_TAG, /* A tag, starting with '<'. */
\r
21 PXML_COMMENT, /* An XML comment, including "<!--" and "-->". */
\r
23 * The following chunk types are reported if the chunk
\r
24 * terminates the specified XML element.
\r
26 PXML_TAG_END, /* Tag ended */
\r
27 PXML_COMMENT_END /* Comment ended */
\r
28 } pxml_chunk_type_e;
\r
31 * Callback function that is called by the parser when parsed data is
\r
32 * available. The _opaque is the pointer to a field containing opaque user
\r
33 * data specified in pxml_create() call. The chunk type is _type and the text
\r
34 * data is the piece of buffer identified by _bufid (as supplied to
\r
35 * pxml_feed() call) starting at offset _offset and of _size bytes size.
\r
36 * The chunk is NOT '\0'-terminated.
\r
38 typedef int (pxml_callback_f)(pxml_chunk_type_e _type,
\r
39 const void *_chunk_data, size_t _chunk_size, void *_key);
\r
42 * Parse the given buffer as it were a chunk of XML data.
\r
43 * Invoke the specified callback each time the meaninful data is found.
\r
44 * This function returns number of bytes consumed from the bufer.
\r
45 * It will always be lesser than or equal to the specified _size.
\r
46 * The next invocation of this function must account the difference.
\r
48 ssize_t pxml_parse(int *_stateContext, const void *_buf, size_t _size,
\r
49 pxml_callback_f *cb, void *_key);
\r
55 #endif /* _XER_SUPPORT_H_ */
\r