|
Packit |
728676 |
/*
|
|
Packit |
728676 |
* Copyright (c) 2003, 2004 X/IO Labs, xiolabs.com.
|
|
Packit |
728676 |
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
|
|
Packit |
728676 |
* Redistribution and modifications are permitted subject to BSD license.
|
|
Packit |
728676 |
*/
|
|
Packit |
728676 |
#ifndef _XER_SUPPORT_H_
|
|
Packit |
728676 |
#define _XER_SUPPORT_H_
|
|
Packit |
728676 |
|
|
Packit |
728676 |
#include <asn_system.h> /* Platform-specific types */
|
|
Packit |
728676 |
|
|
Packit |
728676 |
#ifdef __cplusplus
|
|
Packit |
728676 |
extern "C" {
|
|
Packit |
728676 |
#endif
|
|
Packit |
728676 |
|
|
Packit |
728676 |
/*
|
|
Packit |
728676 |
* Types of data transferred to the application.
|
|
Packit |
728676 |
*/
|
|
Packit |
728676 |
typedef enum {
|
|
Packit |
728676 |
PXML_TEXT, /* Plain text between XML tags. */
|
|
Packit |
728676 |
PXML_TAG, /* A tag, starting with '<'. */
|
|
Packit |
728676 |
PXML_COMMENT, /* An XML comment, including "". */
|
|
Packit |
728676 |
/*
|
|
Packit |
728676 |
* The following chunk types are reported if the chunk
|
|
Packit |
728676 |
* terminates the specified XML element.
|
|
Packit |
728676 |
*/
|
|
Packit |
728676 |
PXML_TAG_END, /* Tag ended */
|
|
Packit |
728676 |
PXML_COMMENT_END /* Comment ended */
|
|
Packit |
728676 |
} pxml_chunk_type_e;
|
|
Packit |
728676 |
|
|
Packit |
728676 |
/*
|
|
Packit |
728676 |
* Callback function that is called by the parser when parsed data is
|
|
Packit |
728676 |
* available. The _opaque is the pointer to a field containing opaque user
|
|
Packit |
728676 |
* data specified in pxml_create() call. The chunk type is _type and the text
|
|
Packit |
728676 |
* data is the piece of buffer identified by _bufid (as supplied to
|
|
Packit |
728676 |
* pxml_feed() call) starting at offset _offset and of _size bytes size.
|
|
Packit |
728676 |
* The chunk is NOT '\0'-terminated.
|
|
Packit |
728676 |
*/
|
|
Packit |
728676 |
typedef int (pxml_callback_f)(pxml_chunk_type_e _type,
|
|
Packit |
728676 |
const void *_chunk_data, size_t _chunk_size, void *_key);
|
|
Packit |
728676 |
|
|
Packit |
728676 |
/*
|
|
Packit |
728676 |
* Parse the given buffer as it were a chunk of XML data.
|
|
Packit |
728676 |
* Invoke the specified callback each time the meaninful data is found.
|
|
Packit |
728676 |
* This function returns number of bytes consumed from the bufer.
|
|
Packit |
728676 |
* It will always be lesser than or equal to the specified _size.
|
|
Packit |
728676 |
* The next invocation of this function must account the difference.
|
|
Packit |
728676 |
*/
|
|
Packit |
728676 |
ssize_t pxml_parse(int *_stateContext, const void *_buf, size_t _size,
|
|
Packit |
728676 |
pxml_callback_f *cb, void *_key);
|
|
Packit |
728676 |
|
|
Packit |
728676 |
#ifdef __cplusplus
|
|
Packit |
728676 |
}
|
|
Packit |
728676 |
#endif
|
|
Packit |
728676 |
|
|
Packit |
728676 |
#endif /* _XER_SUPPORT_H_ */
|