| libinfinity-0.5 Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Prerequisites | Known Implementations | Signals | ||||
#include <libinfinity/communication/inf-communication-method.h>
InfCommunicationMethod;
struct InfCommunicationMethodIface;
void inf_communication_method_add_member (InfCommunicationMethod *method,
InfXmlConnection *connection);
void inf_communication_method_remove_member
(InfCommunicationMethod *method,
InfXmlConnection *connection);
gboolean inf_communication_method_is_member (InfCommunicationMethod *method,
InfXmlConnection *connection);
void inf_communication_method_send_single
(InfCommunicationMethod *method,
InfXmlConnection *connection,
xmlNodePtr xml);
void inf_communication_method_send_all (InfCommunicationMethod *method,
xmlNodePtr xml);
void inf_communication_method_cancel_messages
(InfCommunicationMethod *method,
InfXmlConnection *connection);
InfCommunicationScope inf_communication_method_received (InfCommunicationMethod *method,
InfXmlConnection *connection,
xmlNodePtr xml);
void inf_communication_method_enqueued (InfCommunicationMethod *method,
InfXmlConnection *connection,
xmlNodePtr xml);
void inf_communication_method_sent (InfCommunicationMethod *method,
InfXmlConnection *connection,
xmlNodePtr xml);
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.
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
xml. |
|
Sends a message to all group members, except except. Takes
ownership of xml. |
|
| 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. |
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()).
|
A InfCommunicationMethod. |
|
The InfXmlConnection to add. |
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()).
|
A InfCommunicationMethod. |
|
The InfXmlConnection to remove. |
gboolean inf_communication_method_is_member (InfCommunicationMethod *method,InfXmlConnection *connection);
Returns whether connection was added to the group via
inf_communication_method_add_member().
|
A InfCommunicationMethod. |
|
A InfXmlConnection. |
Returns : |
Whether connection is a member of the group. |
void inf_communication_method_send_single (InfCommunicationMethod *method,InfXmlConnection *connection,xmlNodePtr xml);
Sends an XML message to connection. This function takes ownership of xml.
|
A InfCommunicationMethod. |
|
A InfXmlConnection that is a group member. |
|
The message to send. |
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.
|
A InfCommunicationMethod. |
|
The message to send. |
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.
|
A InfCommunicationMethod. |
|
A InfXmlConnection that is a group member. |
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).
|
A InfCommunicationMethod. |
|
A InfXmlConnection that is a group member. |
|
The received message. |
Returns : |
The scope of the message. |
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()).
|
A InfCommunicationMethod. |
|
A InfXmlConnection. |
|
The enqueued message. |
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()).
|
A InfCommunicationMethod. |
|
A InfXmlConnection. |
|
The sent message. |
"add-member" signalvoid user_function (InfCommunicationMethod *method,
InfXmlConnection *connection,
gpointer user_data) : Run Last
This signal is emitted whenever a new connection has been added to the group on the network this method handles.
|
The InfCommunicationMethod emitting the signal. |
|
The InfXmlConnection that was added. |
|
user data set when the signal handler was connected. |
"remove-member" signalvoid user_function (InfCommunicationMethod *method,
InfXmlConnection *connection,
gpointer user_data) : Run Last
This signal is emitted whenever a connection has been removed from the group on the network this method handles.
|
The InfCommunicationMethod emitting the signal. |
|
The InfXmlConnection that was removed. |
|
user data set when the signal handler was connected. |