Top | ![]() |
![]() |
![]() |
![]() |
InfXmppManager stores InfXmppConnection objects and allows to look them up by the IP address and port number of their underlaying InfTcpConnections. This can be used to reuse existing network connections instead of creating new ones.
Each object which needs to make connections should be passed a
InfXmppManager. Then, when making a connection to a certain address/port
pair, it should first look in the XMPP manager whether there is already
an existing connection to the destination host, via
inf_xmpp_manager_lookup_connection_by_address()
. If there is, it should
use it (maybe reopen it if it is closed). Otherwise, it should create a
new connection and it to the XMPP manager via
inf_xmpp_manager_add_connection()
for others to use.
InfXmppConnection * inf_xmpp_manager_lookup_connection_by_address (InfXmppManager *manager
,InfIpAddress *address
,guint port
);
Looks for a InfXmppConnection contained in manager
whose underlaying
InfTcpConnection has the given address and port set. Returns NULL
if
there is no such connection.
This function may also return a closed connection. You can then attempt to
reopen it, or remove it from the manager using
inf_xmpp_manager_remove_connection()
when that fails.
manager |
||
address |
The remote InfIpAddress of the connection to look for. |
|
port |
The remote port number of the connection to look for. |
gboolean inf_xmpp_manager_contains_connection (InfXmppManager *manager
,InfXmppConnection *connection
);
Returns whether connection
is contained in manager
.
void inf_xmpp_manager_add_connection (InfXmppManager *manager
,InfXmppConnection *connection
);
Adds the given connection to manager
so that it is found by
inf_xmpp_manager_lookup_connection_by_address()
and
inf_xmpp_manager_contains_connection()
.
void inf_xmpp_manager_remove_connection (InfXmppManager *manager
,InfXmppConnection *connection
);
Removes the given connection from manager
.
struct InfXmppManager;
InfXmppManager is an opaque data type. You should only access it via the public API functions.
struct InfXmppManagerClass { void(*add_connection)(InfXmppManager* manager, InfXmppConnection* connection); void(*remove_connection)(InfXmppManager* manager, InfXmppConnection* connection); };
This structure contains the default signal handlers for InfXmppManager.
Default signal handler for the “add-connection” signal. It adds the connection to the manager's internal storage. |
||
Default signal handler for the “remove-connection” signal. It removes the connection from the manager's internal storage. |
“add-connection”
signalvoid user_function (InfXmppManager *xmpp_manager, InfXmppConnection *connection, gpointer user_data)
This signal is emitted whenever a new connection has been added to the
InfXmppManager, via inf_xmpp_manager_add_connection()
.
xmpp_manager |
The InfXmppManager emitting the signal. |
|
connection |
The InfXmppConnection that was added to |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“remove-connection”
signalvoid user_function (InfXmppManager *xmpp_manager, InfXmppConnection *connection, gpointer user_data)
This signal is emitted whenever a connection has been removed from the
InfXmppManager, via inf_xmpp_manager_remove_connection()
.
xmpp_manager |
The InfXmppManager emitting the signal. |
|
connection |
The InfXmppConnection that was removed from |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last