libsyncml
0.5.4
|
Interfaces to create, manipulate and delete sessions. More...
![]() |
Functions | |
SmlBool | smlSessionSendCommand (SmlSession *session, SmlCommand *cmd, SmlCommand *parent, SmlStatusReplyCb callback, void *userdata, SmlError **error) |
Sends a command with a parent. | |
SmlBool | smlSessionStartCommand (SmlSession *session, SmlCommand *cmd, SmlCommand *parent, SmlStatusReplyCb callback, void *userdata, SmlError **error) |
starts a command with a parent | |
SmlBool | smlSessionEndCommand (SmlSession *session, SmlCommand *parent, SmlError **error) |
ends a command | |
SmlBool | smlSessionSendReply (SmlSession *session, SmlStatus *status, SmlError **error) |
Sends a reply to a command. |
Session Management | |
SmlSession * | smlSessionNew (SmlSessionType sessionType, SmlMimeType mimetype, SmlProtocolVersion version, SmlProtocolType protocol, SmlLocation *target, SmlLocation *source, const char *sessionID, unsigned int messageID, SmlError **error) |
Creates a new session. | |
SmlSession * | smlSessionRef (SmlSession *session) |
void | smlSessionUnref (SmlSession *session) |
Session Control | |
SmlBool | smlSessionFlush (SmlSession *session, SmlBool final, SmlError **error) |
Flushes a session. | |
SmlBool | smlSessionEnd (SmlSession *session, SmlError **error) |
Ends the session. | |
void | smlSessionRestoreTargetURI (SmlSession *session) |
SmlBool | smlSessionSetResponseURI (SmlSession *session, const char *responseURI, SmlError **error) |
void | smlSessionUseStringTable (SmlSession *session, SmlBool useStringtable) |
void | smlSessionUseNumberOfChanges (SmlSession *session, SmlBool support) |
void | smlSessionUseLargeObjects (SmlSession *session, SmlBool support) |
void | smlSessionUseOnlyReplace (SmlSession *session, SmlBool onlyReplace) |
void | smlSessionSetSendingLimit (SmlSession *session, unsigned int limit) |
unsigned int | smlSessionGetSendingLimit (SmlSession *session) |
void | smlSessionSetReceivingLimit (SmlSession *session, unsigned int limit) |
void | smlSessionSetSendingMaxMsgSize (SmlSession *session, unsigned int size) |
unsigned int | smlSessionGetSendingMaxMsgSize (SmlSession *session) |
void | smlSessionSetReceivingMaxMsgSize (SmlSession *session, unsigned int size) |
void | smlSessionSetRemoteMaxMsgSize (SmlSession *session, unsigned int size) |
unsigned int | smlSessionGetRemoteMaxMsgSize (SmlSession *session) |
void | smlSessionSetLocalMaxMsgSize (SmlSession *session, unsigned int size) |
unsigned int | smlSessionGetLocalMaxMsgSize (SmlSession *session) |
void | smlSessionSetSendingMaxObjSize (SmlSession *session, int limit) |
void | smlSessionSetRequestedMaxObjSize (SmlSession *session, int limit) |
int | smlSessionGetSendingMaxObjSize (SmlSession *session) |
void | smlSessionSetReceivingMaxObjSize (SmlSession *session, unsigned int limit) |
unsigned int | smlSessionGetReceivingMaxObjSize (SmlSession *session) |
void | smlSessionSetRemoteMaxObjSize (SmlSession *session, unsigned int limit) |
unsigned int | smlSessionGetRemoteMaxObjSize (SmlSession *session) |
void | smlSessionSetLocalMaxObjSize (SmlSession *session, unsigned int limit) |
unsigned int | smlSessionGetLocalMaxObjSize (SmlSession *session) |
Interfaces to create, manipulate and delete sessions.
A session has a unique id and consists of several packages which again contain several commands.
SmlSession* smlSessionNew | ( | SmlSessionType | sessionType, |
SmlMimeType | mimetype, | ||
SmlProtocolVersion | version, | ||
SmlProtocolType | protocol, | ||
SmlLocation * | target, | ||
SmlLocation * | source, | ||
const char * | sessionID, | ||
unsigned int | messageID, | ||
SmlError ** | error | ||
) |
Creates a new session.
Note that if you set the new session callback on the transport, you will get a callback that this session was created (so that it gets easier to register objects at a central place)
sessionType | If the session is a server or a client. |
mimetype | The desired mime type. Choose if you want xml or wbxml |
version | What version of the protocol do you want to use? |
protocol | Which syncml protocol do you want to use? |
target | The remote target of this session. This is used in the header |
source | The source of this session. Used in the header |
sessionID | If you already have a sessionID, you can enter it here. Set it to NULL if you want to generate a new ID |
messageID | The message Id where this session should start. set to 0 to take the default |
error | A pointer to a error struct |
Definition at line 1832 of file sml_session.c.
SmlBool smlSessionFlush | ( | SmlSession * | session, |
SmlBool | final, | ||
SmlError ** | error | ||
) |
Flushes a session.
This flushes the already added statuses and/or commands. Note that if the session has a size limitation, it will get flushed automatically if the size of the already added commands exceeds the limit. Use this function if you want for some reason to flush manually.
session | The session to flush |
final | Set to TRUE if you want to have the final flag added. Otherwise it will just flush the already added statuses and commands |
error | A error struct |
Definition at line 2010 of file sml_session.c.
SmlBool smlSessionEnd | ( | SmlSession * | session, |
SmlError ** | error | ||
) |
Ends the session.
This function will end the session. This means that no more commands will be sent. If there are replies waiting they will be sent. if there are commands waiting from the remote side which have not yet been answered, they will get a error reply. If you already sent commands in this session, you will receive error replies for your callbacks.
If you registered a session end handler it will get called. if the session is a server type and it receives a command from the remote side for the ended session libsyncml will automatically send an error reply.
Sessions will be deleted from the server session after a timeout.
session | The session to flush |
error | A error struct |
Definition at line 2057 of file sml_session.c.
void smlSessionSetRemoteMaxObjSize | ( | SmlSession * | session, |
unsigned int | limit | ||
) |
Sets the maximum obj size for the remote peer. If we try to send an item to the remote side which is larger than this limit we return an error
Possible values for limit are
0 means that we can send objects of any size
0 means that a limit is set
Definition at line 2325 of file sml_session.c.
unsigned int smlSessionGetRemoteMaxObjSize | ( | SmlSession * | session | ) |
Returns the maximum obj size that we can send. If both the sending and the requested limit are set, this function will return the smaller one of both.
Otherwise it will return the larger number.
Definition at line 2339 of file sml_session.c.
Referenced by smlSessionSetLocalMaxObjSize().
void smlSessionSetLocalMaxObjSize | ( | SmlSession * | session, |
unsigned int | limit | ||
) |
Sets the obj size that will get transmitted to the remote side in the <MaxObjSize> tag. So this sets the maximum size of the object we want to receive. If an item is larger, we return an error
In this function, 0 means that no limit is set. a value > 0 means that a limit is set. note that this is required if large object handling has to be supported.
The value is stored in the session since it has to be used by the assembler (to fill the MaxObjSize tag) as well as by the session (to determine when to send an error if the limit is violated)
Definition at line 2363 of file sml_session.c.
SmlBool smlSessionSendCommand | ( | SmlSession * | session, |
SmlCommand * | cmd, | ||
SmlCommand * | parent, | ||
SmlStatusReplyCb | callback, | ||
void * | userdata, | ||
SmlError ** | error | ||
) |
Sends a command with a parent.
This function can be used to send subcommands (for example a "Add" inside a "Sync"). You are guaranteed that you will get a callback if this function returns TRUE. So either this function returns FALSE (might occur if the command is not complete or if a OOM occured) or you will later get a reply or an error in the callback.
Note that if you dont set a callback function, libsyncml will automatically add a "NoResp".
session | The session |
cmd | The command to send |
parent | The parent of this command. NULL for syncbody |
callback | The callback that will receive the reply. Set to NULL if you dont want any replies. |
userdata | The userdata to pass to the callback |
error | A error struct |
Definition at line 2422 of file sml_session.c.
Referenced by smlDevInfAgentRequestDevInf(), smlDsSessionCloseMap(), and smlDsSessionSendAlert().
SmlBool smlSessionStartCommand | ( | SmlSession * | session, |
SmlCommand * | cmd, | ||
SmlCommand * | parent, | ||
SmlStatusReplyCb | callback, | ||
void * | userdata, | ||
SmlError ** | error | ||
) |
starts a command with a parent
session | The session |
cmd | The command to send |
parent | The parent of this command |
callback | The callback that will receive the reply. Set to NULL if you dont want any replies. |
userdata | The userdata to pass to the callback |
error | A error struct |
Definition at line 2454 of file sml_session.c.
Referenced by smlDsSessionSendSync(), and smlSessionSendCommand().
SmlBool smlSessionEndCommand | ( | SmlSession * | session, |
SmlCommand * | parent, | ||
SmlError ** | error | ||
) |
ends a command
session | The session |
parent | The parent of this command, NULL for syncbody |
error | A error struct |
Definition at line 2495 of file sml_session.c.
Referenced by smlDsSessionCloseSync(), and smlSessionSendCommand().
SmlBool smlSessionSendReply | ( | SmlSession * | session, |
SmlStatus * | status, | ||
SmlError ** | error | ||
) |
Sends a reply to a command.
This function sends a status reply to a command.
This function might return an error in the case of an OOM situation or if you forgot to fill in parts of the reply
session | The session |
status | The status to send |
error | A error struct |
Definition at line 2536 of file sml_session.c.