libsyncml  0.5.4
Functions
SyncML Assembler

Interfaces to assemble syncml messages. More...

Collaboration diagram for SyncML Assembler:

Functions

SmlAssemblersmlAssemblerNew (SmlMimeType type, unsigned int limit, SmlError **error)
 Creates a new assembler. More...
 
void smlAssemblerFree (SmlAssembler *assm)
 Frees a assembler. More...
 
SmlBool smlAssemblerStart (SmlAssembler *assm, SmlSession *session, SmlError **error)
 Starts a new message. More...
 
SmlBool smlAssemblerRun (SmlAssembler *assm, char **data, unsigned int *size, SmlBool *end, SmlBool final, SmlError **error)
 Assembles the complete message and returns the result. More...
 
unsigned int smlAssemblerCheckSize (SmlAssembler *assm, SmlBool headeronly, SmlError **error)
 Assembles the complete message and returns the result. More...
 
unsigned int smlAssemblerFlush (SmlAssembler *assm)
 Flushes the already parsed commands. More...
 
void smlAssemblerRestoreCommands (SmlAssembler *assm)
 
SmlBool smlAssemblerGetSpace (SmlAssembler *assm, int *space, SmlCommand *parent, SmlCommand *cmd, SmlError **error)
 Gets the available space in the assembler. More...
 
SmlAssemblerResult smlAssemblerStartCommand (SmlAssembler *assm, SmlCommand *parent, SmlCommand *cmd, SmlError **error)
 Starts a parent command. More...
 
SmlBool smlAssemblerEndCommand (SmlAssembler *assm, SmlCommand *parent, SmlError **error)
 Ends a parent command. More...
 
SmlBool smlAssemblerAddHeader (SmlAssembler *assm, SmlSession *session, SmlError **error)
 Assembles the header. More...
 
SmlAssemblerResult smlAssemblerReserveStatus (SmlAssembler *assm, unsigned int cmdRef, unsigned int msgRef, unsigned int cmdID, SmlError **error)
 Reserves a place for a status with this assembler. More...
 
SmlAssemblerResult smlAssemblerAddStatusFull (SmlAssembler *assm, SmlStatus *status, SmlBool force, SmlError **error)
 Assembles a status. More...
 
SmlAssemblerResult smlAssemblerAddStatus (SmlAssembler *assm, SmlStatus *status, SmlError **error)
 
void smlAssemblerSetOption (SmlAssembler *assm, const char *optionname, const char *value)
 Sets a option on the assembler. More...
 
const char * smlAssemblerGetOption (SmlAssembler *assm, const char *optionname)
 Gets a option from the assembler. More...
 
unsigned int smlAssemblerGetLimit (SmlAssembler *assm)
 
unsigned int smlAssemblerGetRemoteMaxMsgSize (SmlAssembler *assm)
 
void smlAssemblerSetRequestedLimit (SmlAssembler *assm, unsigned int limit)
 
void smlAssemblerSetLimit (SmlAssembler *assm, unsigned int limit)
 
unsigned int smlAssemblerSetRemoteMaxMsgSize (SmlAssembler *assm, unsigned int limit)
 
int smlAssemblerGetSendingMaxObjSize (SmlAssembler *assm)
 
int smlAssemblerGetRequestedMaxObjSize (SmlAssembler *assm)
 
unsigned int smlAssemblerGetRemoteMaxObjSize (SmlAssembler *assm)
 
void smlAssemblerSetRequestedMaxObjSize (SmlAssembler *assm, int limit)
 
void smlAssemblerSetSendingMaxObjSize (SmlAssembler *assm, int limit)
 
unsigned int smlAssemblerSetRemoteMaxObjSize (SmlAssembler *assm, unsigned int limit)
 
SmlBool smlAssemblerIsEmpty (SmlAssembler *assm)
 
SmlBool smlAssemblerIsStatusMissing (SmlAssembler *assm)
 Checks if there are reserved statuses missing. More...
 
SmlBool smlAssemblerGetNextCmdRef (SmlAssembler *assm, unsigned int *cmdRef, unsigned int *msgRef)
 

Detailed Description

Interfaces to assemble syncml messages.

Function Documentation

SmlAssembler* smlAssemblerNew ( SmlMimeType  type,
unsigned int  limit,
SmlError **  error 
)

Creates a new assembler.

Parameters
typeThe type of the assembler
limitThe maximum size that can be assembled
errorA pointer to an error struct
Returns
The new assembler or NULL in the case of an error

Definition at line 352 of file sml_parse.c.

Referenced by smlSessionNew().

Here is the call graph for this function:

void smlAssemblerFree ( SmlAssembler assm)

Frees a assembler.

Parameters
assmThe assembler to free

Definition at line 402 of file sml_parse.c.

Here is the call graph for this function:

SmlBool smlAssemblerStart ( SmlAssembler assm,
SmlSession session,
SmlError **  error 
)

Starts a new message.

Note that the size already includes what will be needed to close the opened tags (like SyncML) and already includes the remaining needed tags (like Final)

Parameters
assmThe assembler
sessionThe session for which to start a message
errorA pointer to an error struct
Returns
TRUE if the package container was assembled successfully, FALSE otherwise

Definition at line 428 of file sml_parse.c.

Referenced by smlSessionNew().

Here is the call graph for this function:

SmlBool smlAssemblerRun ( SmlAssembler assm,
char **  data,
unsigned int *  size,
SmlBool *  end,
SmlBool  final,
SmlError **  error 
)

Assembles the complete message and returns the result.

Parameters
assmThe assembler
dataPlace that will receive the data
sizePlace that will receive the size
errorA pointer to an error struct
Returns
TRUE if the package container was assembled successfully, FALSE otherwise

Definition at line 456 of file sml_parse.c.

Here is the call graph for this function:

unsigned int smlAssemblerCheckSize ( SmlAssembler assm,
SmlBool  headeronly,
SmlError **  error 
)

Assembles the complete message and returns the result.

Parameters
assmThe assembler
dataPlace that will receive the data
sizePlace that will receive the size
errorA pointer to an error struct
Returns
TRUE if the package container was assembled successfully, FALSE otherwise

Definition at line 485 of file sml_parse.c.

Referenced by smlAssemblerAddHeader(), smlAssemblerAddStatusFull(), smlAssemblerGetSpace(), and smlAssemblerStartCommand().

Here is the call graph for this function:

unsigned int smlAssemblerFlush ( SmlAssembler assm)

Flushes the already parsed commands.

This command can be used to flush the already parsed commands. You can use this to flush the assembler after you pull part of the data using smlAssemblerRun()

Parameters
assmThe assembler
errorA pointer to an error struct
Returns
TRUE if the flushing was successful, FALSE otherwise

Definition at line 514 of file sml_parse.c.

Here is the call graph for this function:

SmlBool smlAssemblerGetSpace ( SmlAssembler assm,
int *  space,
SmlCommand parent,
SmlCommand cmd,
SmlError **  error 
)

Gets the available space in the assembler.

This command tries to add the given command to the assembler without the item data. Then it returns how big the item data could be without violating the limits. If there is not limit set, -1 is returned. This command only makes sense for change commands

Definition at line 545 of file sml_parse.c.

Here is the call graph for this function:

SmlAssemblerResult smlAssemblerStartCommand ( SmlAssembler assm,
SmlCommand parent,
SmlCommand cmd,
SmlError **  error 
)

Starts a parent command.

This command starts a parent command. All commands added after this one will be added as subcommands. This functions also take care if the parent command would spawn 2 messages. This function can nest.

Parameters
assmThe assembler
parentThe parent to the command to add. NULL if none
cmdThe command to add
errorA pointer to an error struct
Returns
SML_ASSEMBLER_RESULT_OK if the command was added ok, SML_ASSEMBLER_RESULT_MISMATCH if the parent command did not fit, SML_ASSEMBLER_RESULT_ERROR if some error occured.

Definition at line 659 of file sml_parse.c.

Here is the call graph for this function:

SmlBool smlAssemblerEndCommand ( SmlAssembler assm,
SmlCommand parent,
SmlError **  error 
)

Ends a parent command.

Ends the last previously started parent command. All commands added afterwards wont be subcommands any more.

Parameters
assmThe assembler
parentThe parent of the child to end. NULL if none
errorA pointer to an error struct
Returns
TRUE if the command was added successfully, FALSE otherwise

Definition at line 722 of file sml_parse.c.

Here is the call graph for this function:

SmlBool smlAssemblerAddHeader ( SmlAssembler assm,
SmlSession session,
SmlError **  error 
)

Assembles the header.

This command adds the header to the assembler.

Parameters
assmThe assembler
sessionThe session header to add
errorA pointer to an error struct
Returns
TRUE if the header was added ok, FALSE if some error occured.

Definition at line 762 of file sml_parse.c.

Here is the call graph for this function:

SmlAssemblerResult smlAssemblerReserveStatus ( SmlAssembler assm,
unsigned int  cmdRef,
unsigned int  msgRef,
unsigned int  cmdID,
SmlError **  error 
)

Reserves a place for a status with this assembler.

This command reserves a place for a status. Call this function to make sure that the statuses are added in the correct order. You dont have to reserve for cmdRef=0 . This one is always reserved

Parameters
assmThe assembler
cmdRefThe cmdRef of the status to reserve
cmdIDThe cmdID for this status
errorA pointer to an error struct
Returns
TRUE if successful, FALSE otherwise

Definition at line 806 of file sml_parse.c.

Here is the call graph for this function:

SmlAssemblerResult smlAssemblerAddStatusFull ( SmlAssembler assm,
SmlStatus status,
SmlBool  force,
SmlError **  error 
)

Assembles a status.

This command adds a status to the assembler. The complete package is assembled afterwards to see if the status fits inside the current message. If the status does not fit, SML_ASSEMBLER_RESULT_MISMATCH is returned

Parameters
assmThe assembler
statusThe command to add
forceIf set to TRUE, libsyncml will ignore if the outgoing limit has been reached
errorA pointer to an error struct
Returns
SML_ASSEMBLER_RESULT_OK if the status was added ok, SML_ASSEMBLER_RESULT_MISMATCH if the status did not fit, SML_ASSEMBLER_RESULT_ERROR if some error occured.

Definition at line 839 of file sml_parse.c.

Here is the call graph for this function:

void smlAssemblerSetOption ( SmlAssembler assm,
const char *  optionname,
const char *  value 
)

Sets a option on the assembler.

Parameters
assmThe assembler
optionnameThe name of the option to set
valueThe new value

Definition at line 896 of file sml_parse.c.

Referenced by smlSessionNew().

Here is the call graph for this function:

const char* smlAssemblerGetOption ( SmlAssembler assm,
const char *  optionname 
)

Gets a option from the assembler.

Parameters
assmThe assembler
optionnameThe name of the option to get
Returns
The value

Definition at line 914 of file sml_parse.c.

Here is the call graph for this function:

SmlBool smlAssemblerIsStatusMissing ( SmlAssembler assm)

Checks if there are reserved statuses missing.

Parameters
assmThe assembler to check
Returns
TRUE if statuses are missing, FALSE if all statuses had been added

Definition at line 1053 of file sml_parse.c.