exip  Alpha 0.5.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Functions | Variables
bin/headers/EXIParser.h File Reference
#include "contentHandler.h"

Go to the source code of this file.

Data Structures

struct  Parser
 Parses an EXI document. More...
 
struct  EXIParser
 

Typedefs

typedef struct Parser Parser
 
typedef struct EXIParser EXIParser
 

Functions

errorCode initParser (Parser *parser, BinaryBuffer buffer, void *app_data)
 Initialize a parser object. More...
 
errorCode parseHeader (Parser *parser, boolean outOfBandOpts)
 Parse the header on the EXI stream contained in the parser object. More...
 
errorCode setSchema (Parser *parser, EXIPSchema *schema)
 Initialize the schema information to be used for parsing. More...
 
errorCode parseNext (Parser *parser)
 Parse the next content item from the EXI stream contained in the parser object. More...
 
errorCode pushEXIData (char *inBuf, unsigned int bufSize, unsigned int *bytesRead, Parser *parser)
 Pushes more data to the parsing buffer to parse. More...
 
void destroyParser (Parser *parser)
 Free any memroy allocated by parser object. More...
 

Variables

const EXIParser parse
 Used during parsing for easy access to the EXIP parsing API. More...
 

Typedef Documentation

typedef struct EXIParser EXIParser

Definition at line 48 of file bin/headers/EXIParser.h.

typedef struct Parser Parser

Definition at line 36 of file bin/headers/EXIParser.h.

Function Documentation

void destroyParser ( Parser parser)
Parameters
[in]parserthe parser object

Definition at line 240 of file EXIParser.c.

errorCode initParser ( Parser parser,
BinaryBuffer  buffer,
void *  app_data 
)
Parameters
[out]parserthe parser object
[in]bufferan input buffer holding (part of) the representation of EXI stream
[in]app_dataApplication data to be passed to the content handler callbacks
Returns
Error handling code

Definition at line 37 of file EXIParser.c.

errorCode parseHeader ( Parser parser,
boolean  outOfBandOpts 
)
Parameters
[in]parserthe parser object
[in]outOfBandOptsTRUE if there are out-of-band options set in parser->strm.header FALSE otherwise
Returns
Error handling code

Definition at line 66 of file EXIParser.c.

errorCode parseNext ( Parser parser)
Parameters
[in]parserthe parser object
Returns
Error handling code; EXIP_PARSING_COMPLETE when the parsing is completed succesfully, EXIP_BUFFER_END_REACHED when the whole content of the buffer is parsed but there is more events in the EXI stream. In case of EXIP_BUFFER_END_REACHED, pushEXIData() must be used to fill the buffer with the next chunk of the EXI stream before calling parseNext() again.

Definition at line 182 of file EXIParser.c.

errorCode pushEXIData ( char *  inBuf,
unsigned int  bufSize,
unsigned int *  bytesRead,
Parser parser 
)

This function is used to implement push-parsing interface. After parseNext() returns EXIP_BUFFER_END_REACHED use this function to add more data to the parsing buffer. Currently this non-blocking parsing interface works only in EXI schema mode without any deviations. Otherwise the grammars and the string tables needs also to be backuped and then restored in case of EXIP_BUFFER_END_REACHED which is very complicated procedure.

Warning
Padding bits to fill a byte when in bit-packed mode should not be used as they will be interpreted as if being part of the EXI stream. This can be a concern when streaming EXI data which is not byte-aligned.
Parameters
[in]inBufthe next EXI stream chunk to be parsed
[in]bufSizethe size in bytes of the inBuf
[out]bytesReadhow many bytes have been read from inBuf and written to the Parser internal binary buffer.
[in,out]parserthe parser object
Returns
Error handling code

Definition at line 214 of file EXIParser.c.

errorCode setSchema ( Parser parser,
EXIPSchema schema 
)
Parameters
[in]parserthe parser object
[in]schemaobject; if parser.strm.header.opts.schemaIDMode == SCHEMA_ID_NIL or parser.strm.header.opts.schemaIDMode == SCHEMA_ID_EMPTY the schema object is ignored; if parser.strm.header.opts.schemaIDMode == SCHEMA_ID_ABSENT and schema == NULL then schema-less mode, schema != NULL schema enabled; if parser.strm.header.opts.schemaIDMode == SCHEMA_ID_SET and schema == NULL is an error parser.strm.header.opts.schemaID contains the identifier of the schema if any
Returns
Error handling code

Definition at line 87 of file EXIParser.c.

Variable Documentation

const EXIParser parse

Definition at line 30 of file EXIParser.c.