26 SML_PARSER_RESULT_ERROR = 0,
27 SML_PARSER_RESULT_OPEN = 1,
28 SML_PARSER_RESULT_CLOSE = 2,
29 SML_PARSER_RESULT_NORMAL = 3,
30 SML_PARSER_RESULT_STATUS = 4,
31 SML_PARSER_RESULT_OTHER = 5
34 typedef void (* SmlParserFreeFunction) (
void *userdata);
35 typedef SmlBool (* SmlParserStartFunction) (
void *userdata,
const char *data,
unsigned int size,
SmlError **error);
36 typedef SmlBool (* SmlParserEndFunction) (
void *userdata, SmlBool *
final, SmlBool *end,
SmlError **error);
38 typedef SmlBool (* SmlParserStatusFunction) (
void *userdata,
SmlStatus **status,
SmlError **error);
39 typedef SmlParserResult (* SmlParserCommandFunction) (
void *userdata,
SmlCommand **cmd,
SmlError **error);
42 SmlParserFreeFunction free;
43 SmlParserStartFunction start;
44 SmlParserEndFunction end;
45 SmlParserHeaderFunction get_header;
46 SmlParserStatusFunction get_status;
47 SmlParserCommandFunction get_cmd;
50 typedef void (* SmlAssemblerFreeFunction) (
void *userdata);
51 typedef SmlBool (* SmlAssemblerStartFunction) (
void *userdata,
SmlSession *session,
SmlError **error);
52 typedef SmlBool (* SmlAssemblerEndFunction) (
void *userdata,
SmlError **error);
53 typedef SmlBool (* SmlAssemblerRunFunction) (
void *userdata,
char **data,
unsigned int *size, SmlBool *end, SmlBool
final,
unsigned int maxsize,
SmlError **error);
54 typedef unsigned int (* SmlAssemblerFlushFunction) (
void *userdata);
55 typedef SmlBool (* SmlAssemblerStatusFunction) (
void *userdata,
SmlStatus *status,
SmlError **error);
56 typedef SmlBool (* SmlAssemblerRemStatusFunction) (
void *userdata,
SmlError **error);
57 typedef SmlBool (* SmlAssemblerReserveStatusFunction) (
void *userdata,
unsigned int cmdRef,
unsigned int msgRef,
unsigned int cmdID,
SmlError **error);
58 typedef SmlBool (* SmlAssemblerStatusMissingFunction) (
void *userdata);
59 typedef SmlBool (* SmlAssemblerStartCommandFunction) (
void *userdata,
unsigned int parentID,
SmlCommand *cmd,
SmlError **error);
60 typedef SmlBool (* SmlAssemblerEndCommandFunction) (
void *userdata,
unsigned int parentID,
SmlError **error);
61 typedef SmlBool (* SmlAssemblerRemCommandFunction) (
void *userdata,
unsigned int parentID,
SmlError **error);
62 typedef SmlBool (* SmlAssemblerHeaderFunction) (
void *userdata,
SmlSession *session,
SmlError **error);
63 typedef unsigned int (* SmlAssemblerCheckFunction) (
void *userdata, SmlBool headeronly,
SmlError **error);
64 typedef SmlBool (* SmlAssemblerNextCmdRefFunction) (
void *userdata,
unsigned int *cmdRef,
unsigned int *msgRef);
65 typedef void (* SmlAssemblerRestoreCommandsFunction) (
void *userdata);
68 SmlAssemblerFreeFunction free;
69 SmlAssemblerStartFunction start;
70 SmlAssemblerEndFunction end;
71 SmlAssemblerRunFunction run;
72 SmlAssemblerFlushFunction flush;
73 SmlAssemblerStatusFunction add_status;
74 SmlAssemblerRemStatusFunction rem_status;
75 SmlAssemblerReserveStatusFunction reserve_status;
76 SmlAssemblerStatusMissingFunction missing_status;
77 SmlAssemblerStartCommandFunction start_cmd;
78 SmlAssemblerEndCommandFunction end_cmd;
79 SmlAssemblerRemCommandFunction rem_cmd;
80 SmlAssemblerHeaderFunction add_header;
81 SmlAssemblerCheckFunction check_size;
82 SmlAssemblerNextCmdRefFunction next_cmdref;
83 SmlAssemblerRestoreCommandsFunction restore_cmds;
87 SML_ASSEMBLER_RESULT_ERROR = 0,
88 SML_ASSEMBLER_RESULT_OK = 1,
89 SML_ASSEMBLER_RESULT_MISMATCH =2
116 unsigned int smlAssemblerSetRemoteMaxMsgSize(
SmlAssembler *assm,
unsigned int limit);
117 unsigned int smlAssemblerGetRemoteMaxMsgSize(
SmlAssembler *assm);
120 unsigned int smlAssemblerGetRemoteMaxObjSize(
SmlAssembler *assm);
121 unsigned int smlAssemblerSetRemoteMaxObjSize(
SmlAssembler *assm,
unsigned int limit);
125 SmlBool smlAssemblerGetNextCmdRef(
SmlAssembler *assm,
unsigned int *cmdRef,
unsigned int *msgRef);
128 void smlAssemblerSetRequestedLimit(
SmlAssembler *assm,
unsigned int limit) LIBSYNCML_DEPRECATED;
129 void smlAssemblerSetLimit(
SmlAssembler *assm,
unsigned int limit) LIBSYNCML_DEPRECATED;
130 unsigned int smlAssemblerGetLimit(
SmlAssembler *assm) LIBSYNCML_DEPRECATED;
131 void smlAssemblerSetRequestedMaxObjSize(
SmlAssembler *assm,
int limit) LIBSYNCML_DEPRECATED;
132 void smlAssemblerSetSendingMaxObjSize(
SmlAssembler *assm,
int limit) LIBSYNCML_DEPRECATED;
133 int smlAssemblerGetSendingMaxObjSize(
SmlAssembler *assm) LIBSYNCML_DEPRECATED;
134 int smlAssemblerGetRequestedMaxObjSize(
SmlAssembler *assm) LIBSYNCML_DEPRECATED;
139 #endif //_SML_PARSE_H_
void smlAssemblerSetOption(SmlAssembler *assm, const char *optionname, const char *value)
Sets a option on the assembler.
SmlBool smlAssemblerAddHeader(SmlAssembler *assm, SmlSession *session, SmlError **error)
Assembles the header.
const char * smlAssemblerGetOption(SmlAssembler *assm, const char *optionname)
Gets a option from the assembler.
SmlBool smlParserGetHeader(SmlParser *parser, SmlHeader **header, SmlCred **cred, SmlError **error)
Parses the SyncHdr.
void smlParserFree(SmlParser *parser)
Frees a parser.
SmlAssemblerResult smlAssemblerStartCommand(SmlAssembler *assm, SmlCommand *parent, SmlCommand *cmd, SmlError **error)
Starts a parent command.
SmlAssemblerResult smlAssemblerAddStatusFull(SmlAssembler *assm, SmlStatus *status, SmlBool force, SmlError **error)
Assembles a status.
SmlAssemblerResult smlAssemblerReserveStatus(SmlAssembler *assm, unsigned int cmdRef, unsigned int msgRef, unsigned int cmdID, SmlError **error)
Reserves a place for a status with this assembler.
SmlBool smlParserEnd(SmlParser *parser, SmlBool *final, SmlBool *end, SmlError **error)
Ends the parsing.
SmlBool smlAssemblerRun(SmlAssembler *assm, char **data, unsigned int *size, SmlBool *end, SmlBool final, SmlError **error)
Assembles the complete message and returns the result.
unsigned int smlAssemblerFlush(SmlAssembler *assm)
Flushes the already parsed commands.
SmlBool smlAssemblerStart(SmlAssembler *assm, SmlSession *session, SmlError **error)
Starts a new message.
SmlBool smlAssemblerIsStatusMissing(SmlAssembler *assm)
Checks if there are reserved statuses missing.
SmlParser * smlParserNew(SmlMimeType type, unsigned int limit, SmlError **error)
Creates a new parser.
void smlAssemblerFree(SmlAssembler *assm)
Frees a assembler.
SmlBool smlAssemblerEndCommand(SmlAssembler *assm, SmlCommand *parent, SmlError **error)
Ends a parent command.
SmlBool smlParserStart(SmlParser *parser, const char *data, unsigned int size, SmlError **error)
Starts the parser on a given data buffer.
SmlBool smlParserGetStatus(SmlParser *parser, SmlStatus **status, SmlError **error)
Parses the next status.
SmlAssembler * smlAssemblerNew(SmlMimeType type, unsigned int limit, SmlError **error)
Creates a new assembler.
SmlParserResult smlParserGetCommand(SmlParser *parser, SmlCommand **cmd, SmlError **error)
Parses the next command.
unsigned int smlAssemblerCheckSize(SmlAssembler *assm, SmlBool headeronly, SmlError **error)
Assembles the complete message and returns the result.
SmlBool smlAssemblerGetSpace(SmlAssembler *assm, int *space, SmlCommand *parent, SmlCommand *cmd, SmlError **error)
Gets the available space in the assembler.