OpenSync  0.22
Data Structures | Typedefs | Enumerations
OpenSync Message Internals

A Message used by the inter thread messaging library. More...

Data Structures

struct  OSyncMessage
 A OSyncMessage. More...
 

Typedefs

typedef void(* OSyncMessageHandler) (OSyncMessage *message, void *user_data)
 Function which can receive messages. More...
 

Enumerations

enum  OSyncMessageCommand {
  OSYNC_MESSAGE_NOOP, OSYNC_MESSAGE_CONNECT, OSYNC_MESSAGE_DISCONNECT, OSYNC_MESSAGE_GET_CHANGES,
  OSYNC_MESSAGE_GET_CHANGEDATA, OSYNC_MESSAGE_COMMIT_CHANGE, OSYNC_MESSAGE_COMMITTED_ALL, OSYNC_MESSAGE_SYNC_DONE,
  OSYNC_MESSAGE_CALL_PLUGIN, OSYNC_MESSAGE_NEW_CHANGE, OSYNC_MESSAGE_REPLY, OSYNC_MESSAGE_ERRORREPLY,
  OSYNC_MESSAGE_INITIALIZE, OSYNC_MESSAGE_FINALIZE, OSYNC_MESSAGE_SYNCHRONIZE, OSYNC_MESSAGE_ENGINE_CHANGED,
  OSYNC_MESSAGE_MAPPING_CHANGED, OSYNC_MESSAGE_MAPPINGENTRY_CHANGED, OSYNC_MESSAGE_ERROR, OSYNC_MESSAGE_QUEUE_ERROR,
  OSYNC_MESSAGE_QUEUE_HUP, OSYNC_MESSAGE_SYNC_ALERT
}
 The Type of the message. More...
 
OSyncMessageosync_message_new (OSyncMessageCommand cmd, int size, OSyncError **error)
 A Message used by the inter thread messaging library. More...
 
void osync_message_ref (OSyncMessage *message)
 
void osync_message_unref (OSyncMessage *message)
 
void osync_message_set_handler (OSyncMessage *message, OSyncMessageHandler handler, gpointer user_data)
 Sets the handler that will receive the reply. More...
 
OSyncMessageosync_message_new_reply (OSyncMessage *message, OSyncError **error)
 Creates a new reply. More...
 
OSyncMessageosync_message_new_errorreply (OSyncMessage *message, OSyncError **error)
 Creates a new error reply. More...
 
OSyncMessageosync_message_new_error (OSyncError *error, OSyncError **loc_error)
 
gboolean osync_message_is_error (OSyncMessage *message)
 Checks if the message is a error. More...
 
osync_bool osync_message_is_answered (OSyncMessage *message)
 
void osync_message_set_answered (OSyncMessage *message)
 
OSyncMessageCommand osync_message_get_command (OSyncMessage *message)
 Gets the command from a message. More...
 

Detailed Description

A Message used by the inter thread messaging library.

Typedef Documentation

typedef void(* OSyncMessageHandler) (OSyncMessage *message, void *user_data)

Function which can receive messages.

Parameters
senderThe sender of the received reply
messageThe reply that is being received.
user_dataThe userdata which was set previously

Definition at line 48 of file opensync_message_internals.h.

Enumeration Type Documentation

The Type of the message.

Definition at line 16 of file opensync_message_internals.h.

Function Documentation

OSyncMessage* osync_message_new ( OSyncMessageCommand  cmd,
int  size,
OSyncError **  error 
)

A Message used by the inter thread messaging library.

Creates a new message of the given type

This function will create a new message of the given type, with the given parent and signal name. The parent will be passed to the OSyncMessageHandler

Parameters
parentWho send this message. Can be any pointer.
msgnameThe name of the message
typeThe type of this message
Returns
Pointer to a newly allocated message

Definition at line 43 of file opensync_message.c.

Referenced by _new_change_receiver(), osengine_synchronize(), osync_message_new_errorreply(), osync_message_new_reply(), and osync_queue_get_message().

void osync_message_set_handler ( OSyncMessage message,
OSyncMessageHandler  handler,
gpointer  user_data 
)

Sets the handler that will receive the reply.

Parameters
messageThe message to work on
replyqueueWhich queue should receive the reply
handlerWhich handler should be called when the reply is received
user_dataWhich user data should be passed to the handler

Definition at line 82 of file opensync_message.c.

OSyncMessage* osync_message_new_reply ( OSyncMessage message,
OSyncError **  error 
)

Creates a new reply.

Parameters
parentWho send this message. Can be any pointer.
messageThe message to which you wish to reply
Returns
Pointer to a newly allocated message

Definition at line 96 of file opensync_message.c.

OSyncMessage* osync_message_new_errorreply ( OSyncMessage message,
OSyncError **  error 
)

Creates a new error reply.

Parameters
parentWho send this message. Can be any pointer.
messageThe message to which you wish to reply
Returns
Pointer to a newly allocated message

Definition at line 113 of file opensync_message.c.

gboolean osync_message_is_error ( OSyncMessage message)

Checks if the message is a error.

Parameters
messageThe message to check
Returns
#TRUE if the message is a error, #FALSE otherwise

Definition at line 141 of file opensync_message.c.

OSyncMessageCommand osync_message_get_command ( OSyncMessage message)

Gets the command from a message.

This function will return the command of a message

Parameters
messageThe message
Returns
the command

Definition at line 165 of file opensync_message.c.

Referenced by _new_change_receiver().