The public part. More...
Typedefs | |
typedef void(* | SmlManagerEventCb )(SmlManager *manager, SmlManagerEventType type, SmlSession *session, SmlError *error, void *userdata) |
typedef void(* | SmlCommandCb )(SmlSession *session, SmlCommand *cmd, void *userdata) |
typedef void(* | SmlHeaderCb )(SmlSession *session, SmlHeader *header, SmlCred *cred, void *userdata) |
typedef void(* | SmlStatusReplyCb )(SmlSession *session, SmlStatus *status, void *userdata) |
Enumerations | |
enum | SmlManagerEventType { SML_MANAGER_CONNECT_DONE, SML_MANAGER_DISCONNECT_DONE, SML_MANAGER_TRANSPORT_ERROR, SML_MANAGER_SESSION_NEW, SML_MANAGER_SESSION_FINAL, SML_MANAGER_SESSION_END, SML_MANAGER_SESSION_FLUSH, SML_MANAGER_SESSION_WARNING, SML_MANAGER_SESSION_ERROR, SML_MANAGER_SESSION_ESTABLISHED } |
Functions | |
SmlManager * | smlManagerNew (SmlTransport *tsp, SmlError **error) |
void | smlManagerFree (SmlManager *manager) |
SmlBool | smlManagerReceive (SmlManager *manager, SmlError **error) |
void | smlManagerSetEventCallback (SmlManager *manager, SmlManagerEventCb callback, void *userdata) |
SmlSession * | smlManagerSessionFind (SmlManager *manager, const char *sessionID) |
SmlBool | smlManagerSessionAdd (SmlManager *manager, SmlSession *session, SmlLink *link, SmlError **error) |
void | smlManagerSessionRemove (SmlManager *manager, SmlSession *session) |
SmlBool | smlManagerObjectRegister (SmlManager *manager, SmlCommandType type, SmlSession *session, SmlLocation *location, SmlLocation *source, const char *contentType, SmlCommandCb callback, SmlCommandCb childCallback, void *userdata, SmlError **error) |
Register an object with a session. | |
void | smlManagerRegisterHeaderHandler (SmlManager *manager, SmlHeaderCb callback, SmlStatusReplyCb statuscb, void *userdata) |
void | smlManagerObjectFree (SmlObject *object) |
SmlObject * | smlManagerObjectFind (SmlManager *manager, SmlSession *session, SmlCommand *cmd) |
SmlBool | smlManagerDispatchChildCommand (SmlManager *manager, SmlSession *session, SmlCommand *parent, SmlCommand *cmd, SmlError **error) |
SmlBool | smlManagerDispatchHeader (SmlManager *manager, SmlSession *session, SmlHeader *header, SmlCred *cred, SmlError **error) |
SmlBool | smlManagerDispatchCommand (SmlManager *manager, SmlSession *session, SmlCommand *cmd, SmlError **error) |
SmlBool | smlManagerStart (SmlManager *manager, SmlError **error) |
void | smlManagerStop (SmlManager *manager) |
Stops the active manager part. | |
void | smlManagerRun (SmlManager *manager) |
void | smlManagerQuit (SmlManager *manager) |
void | smlManagerDispatch (SmlManager *manager) |
SmlBool | smlManagerCheck (SmlManager *manager) |
void | smlManagerSetLocalMaxMsgSize (SmlManager *manager, unsigned int size) |
void | smlManagerSetLocalMaxObjSize (SmlManager *manager, unsigned int size) |
char * | smlManagerGetNewSessionID (SmlManager *manager) |
The public part.
SmlBool smlManagerObjectRegister | ( | SmlManager * | manager, | |
SmlCommandType | type, | |||
SmlSession * | session, | |||
SmlLocation * | location, | |||
SmlLocation * | source, | |||
const char * | contentType, | |||
SmlCommandCb | callback, | |||
SmlCommandCb | childCallback, | |||
void * | userdata, | |||
SmlError ** | error | |||
) |
Register an object with a session.
A object waits at a certain location for incoming commands. So you can for example register a object that listens for Get commands on the /test location.
Note that you cannot deregister an object from a already running session
session | The session on which to listen | |
type | The command type to listen to or SML_COMMAND_TYPE_UNKNOWN to listen for all | |
session | If given, only listens for the commands on the given session. NULL for all | |
location | The location where the object listens (This must match the Target of the command). NULL to listen for all targets | |
source | The source of the command we want (This must match the Source of the command). NULL to listen for all sources | |
callback | The callback that will receive the incoming commands. | |
childCallback | The call that will receive the commands from the child commands. Set to NULL if the expected command has no childs | |
userdata | The userdata for the callbacks | |
error | A error struct |
Definition at line 926 of file sml_manager.c.
void smlManagerStop | ( | SmlManager * | manager | ) |
Stops the active manager part.
The active part of the manager is the automatic dispatching of the SmlSession objects. The session dispatching consists of the status and command dispatching. If the commands and status are no longer dispatched then the session is no longer in an active state.
If this happens the manager should shoulds down the external communication. In fact the manager disconnects all active transport connections.
You must still call smlManagerDispatch until you got all required SML_MANAGER_DISCONNECT_DONE events. After this you can safely call smlManagerFree without getting warnings or errors from the transport layer because of forgotten connections.
Errors especially from the transport layer are ignored because it is not possible to react on these errors. Therefore it is correct to ignore the errors. Actually it is a problem that one or more failed disconnects result in a deadlock if somebody waits correctly for all disconnect events. Additionally it is impossible to signal a user the number of failed disconnect via a clean way.
If a disconnect fails then g_warning is called with an appropriate message. If there is a (G)UI which reconfigures the glib to display warnings and errors to the user then this is the only chance to communicate such errors.
manager | The manager |
Definition at line 565 of file sml_manager.c.