libsyncml 0.5.4

- Main Page
- Modules
- Data Structures
- Files

Functions
SyncML Parser
Low Level API

Interfaces to parse syncml messages. More...

Collaboration diagram for SyncML Parser:

## Functions

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

## Detailed Description

Interfaces to parse syncml messages.

## Function Documentation

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

Creates a new parser.

Parameters:

  type | The type of the parser
  error | A 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:

  parser | The 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:

  parser | The parser
  data | The data that should be parsed
  size | The size of the data
  error | A 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:

  parser | The parser
  header | The return location of the header
  error | A 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:

  parser | The parser
  cmd | The return location of the command
  error | A 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:

  parser | The parser
  status | The return location of the status
  error | A 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:

  parser | The parser
  final | Return location to see if this was the final message
  end | Return location to see if this message was a end message (only statuses)
  error | A 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: