| Top |
A InfCommunicationMethod specifies how messages are transferred between group members on the same network. So one method handles all connections on a specific network for the group.
void inf_communication_method_add_member (InfCommunicationMethod *method,InfXmlConnection *connection);
Adds a new connection to the group. The network of connection
must match
the network the method is handling, and connection
must not already be
a member of the group (see inf_communication_method_is_member()).
void inf_communication_method_remove_member (InfCommunicationMethod *method,InfXmlConnection *connection);
Removes a connection from the group. connection
needs to be a member of
the group (see inf_communication_method_is_member()).
gboolean inf_communication_method_is_member (InfCommunicationMethod *method,InfXmlConnection *connection);
Returns whether connection
was added to the group via
inf_communication_method_add_member().
void inf_communication_method_send_single (InfCommunicationMethod *method,InfXmlConnection *connection,xmlNodePtr xml);
Sends an XML message to connection
. This function takes ownership of xml
.
void inf_communication_method_send_all (InfCommunicationMethod *method,xmlNodePtr xml);
Sends an XML message to all group members on this network. This function
takes ownership of xml
.
void inf_communication_method_cancel_messages (InfCommunicationMethod *method,InfXmlConnection *connection);
This function stops all messages to be sent to connection
that have not
yet been sent.
InfCommunicationScope inf_communication_method_received (InfCommunicationMethod *method,InfXmlConnection *connection,xmlNodePtr xml);
This function is called by the InfCommunicationRegistry if data has been
received on registered connections
(see inf_communication_registry_register()).
This function returns the scope of the message. If the scope is
INF_COMMUNICATION_SCOPE_GROUP then the registry relays the message to
other connections on different networks (if any).
void inf_communication_method_enqueued (InfCommunicationMethod *method,InfXmlConnection *connection,xmlNodePtr xml);
This function is called by the InfCommunicationRegistry if data has been
enqueued on registered connections
(see inf_communication_registry_register()).
void inf_communication_method_sent (InfCommunicationMethod *method,InfXmlConnection *connection,xmlNodePtr xml);
This function is called by the InfCommunicationRegistry if data has been
sent on registered connections (see inf_communication_registry_register()).
typedef struct _InfCommunicationMethod InfCommunicationMethod;
InfCommunicationMethod is an opaque data type. You should only access it via the public API functions.
struct InfCommunicationMethodIface {
/* Signals */
void (*add_member)(InfCommunicationMethod* method,
InfXmlConnection* connection);
void (*remove_member)(InfCommunicationMethod* method,
InfXmlConnection* connection);
/* Virtual functions */
gboolean (*is_member)(InfCommunicationMethod* method,
InfXmlConnection* connection);
void (*send_single)(InfCommunicationMethod* method,
InfXmlConnection* connection,
xmlNodePtr xml);
void (*send_all)(InfCommunicationMethod* method,
xmlNodePtr xml);
void (*cancel_messages)(InfCommunicationMethod* method,
InfXmlConnection* connection);
InfCommunicationScope (*received)(InfCommunicationMethod* method,
InfXmlConnection* connection,
xmlNodePtr xml);
void (*enqueued)(InfCommunicationMethod* method,
InfXmlConnection* connection,
xmlNodePtr xml);
void (*sent)(InfCommunicationMethod* method,
InfXmlConnection* connection,
xmlNodePtr xml);
};
The default signal handlers of virtual methods of InfCommunicationMethod. These implement communication within a InfCommunicationGroup.
Default signal handler of the “add-member” signal. |
||
Default signal handler of the “remove-member” signal. |
||
Returns whether the given connection is a member of the group. |
||
Sends a message to a single connection. Takes ownership of
|
||
Sends a message to all group members, except |
||
Cancel sending messages that have not yet been sent to the given connection. |
||
Handles reception of a message from a registered connection. This normally includes informing a group's NetObject and forwarding the message to other group members. |
||
Handles when a message has been enqueued to be sent on a registered connection. |
||
Handles when a message has been sent to a registered connection. |
“add-member” signalvoid user_function (InfCommunicationMethod *method, InfXmlConnection *connection, gpointer user_data)
This signal is emitted whenever a new connection has been added to the group on the network this method handles.
method |
The InfCommunicationMethod emitting the signal. |
|
connection |
The InfXmlConnection that was added. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“remove-member” signalvoid user_function (InfCommunicationMethod *method, InfXmlConnection *connection, gpointer user_data)
This signal is emitted whenever a connection has been removed from the group on the network this method handles.
method |
The InfCommunicationMethod emitting the signal. |
|
connection |
The InfXmlConnection that was removed. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last