libsyncml  0.5.4
Functions

Interfaces to parse syncml messages. More...

Collaboration diagram for SyncML Parser:

Functions

SmlParsersmlParserNew (SmlMimeType type, unsigned int limit, SmlError **error)
 Creates a new parser. More...
 
void smlParserSetManager (SmlParser *parser, SmlManager *manager)
 
void smlParserFree (SmlParser *parser)
 Frees a parser. More...
 
SmlBool smlParserStart (SmlParser *parser, const char *data, unsigned int size, SmlError **error)
 Starts the parser on a given data buffer. More...
 
SmlBool smlParserGetHeader (SmlParser *parser, SmlHeader **header, SmlCred **cred, SmlError **error)
 Parses the SyncHdr. More...
 
SmlParserResult smlParserGetCommand (SmlParser *parser, SmlCommand **cmd, SmlError **error)
 Parses the next command. More...
 
SmlBool smlParserGetStatus (SmlParser *parser, SmlStatus **status, SmlError **error)
 Parses the next status. More...
 
SmlBool smlParserEnd (SmlParser *parser, SmlBool *final, SmlBool *end, SmlError **error)
 Ends the parsing. More...
 

Detailed Description

Interfaces to parse syncml messages.

Function Documentation

SmlParser* smlParserNew ( SmlMimeType  type,
unsigned int  limit,
SmlError **  error 
)

Creates a new parser.

Parameters
typeThe type of the parser
errorA pointer to an error struct
Returns
The new parser or NULL in the case of an error

Definition at line 50 of file sml_parse.c.

Here is the call graph for this function:

void smlParserFree ( SmlParser parser)

Frees a parser.

Parameters
parserThe parser to free

Definition at line 108 of file sml_parse.c.

Here is the call graph for this function:

SmlBool smlParserStart ( SmlParser parser,
const char *  data,
unsigned int  size,
SmlError **  error 
)

Starts the parser on a given data buffer.

This function will parse the data up to the SyncHdr tag

Parameters
parserThe parser
dataThe data that should be parsed
sizeThe size of the data
errorA pointer to an error struct
Returns
TRUE if the parser started successfully, FALSE otherwise

Definition at line 132 of file sml_parse.c.

Here is the call graph for this function:

SmlBool smlParserGetHeader ( SmlParser parser,
SmlHeader **  header,
SmlCred **  cred,
SmlError **  error 
)

Parses the SyncHdr.

This function will parse the data inside the SyncHdr Tag. Possible error case are:

  • No header was found
  • The header is missing necessary information
  • OOM
Parameters
parserThe parser
headerThe return location of the header
errorA pointer to an error struct
Returns
TRUE if the parser retrieved the header successfully, FALSE otherwise

Definition at line 216 of file sml_parse.c.

Here is the call graph for this function:

SmlParserResult smlParserGetCommand ( SmlParser parser,
SmlCommand **  cmd,
SmlError **  error 
)

Parses the next command.

This function will parse the next command found in the syncbody. Note that if you call this function too early (before the synchdr is parsed this function will return an error.) The correct order is: getHeader, getStatus until NULL, then getCommand until NULL and then End to end parsing.

Parameters
parserThe parser
cmdThe return location of the command
errorA pointer to an error struct
Returns
TRUE if the parser retrieved the next command successfully or there were no more commands available (in which case *cmd is NULL). FALSE in the case of an error

Definition at line 250 of file sml_parse.c.

Here is the call graph for this function:

SmlBool smlParserGetStatus ( SmlParser parser,
SmlStatus **  status,
SmlError **  error 
)

Parses the next status.

This function will parse the next status found in the syncbody. Note that if you call this function too early (before the synchdr is parsed this function will return an error.) The correct order is: getHeader, getStatus until NULL, then getCommand until NULL and then End to end parsing.

Parameters
parserThe parser
statusThe return location of the status
errorA pointer to an error struct
Returns
TRUE if the parser retrieved the next status successfully or there were no more statuses available (in which case *status is NULL). FALSE in the case of an error

Definition at line 284 of file sml_parse.c.

Here is the call graph for this function:

SmlBool smlParserEnd ( SmlParser parser,
SmlBool *  final,
SmlBool *  end,
SmlError **  error 
)

Ends the parsing.

This function will check that all needed closing tags are in place

Parameters
parserThe parser
finalReturn location to see if this was the final message
endReturn location to see if this message was a end message (only statuses)
errorA pointer to an error struct
Returns
TRUE if the parser ended successfully, FALSE otherwise

Definition at line 314 of file sml_parse.c.

Here is the call graph for this function: