Top | ![]() |
![]() |
![]() |
![]() |
InfIo * | io | Read / Write / Construct Only |
InfSimulatedConnectionMode | mode | Read / Write / Construct |
InfSimulatedConnection * | target | Read / Write |
struct | InfSimulatedConnection |
struct | InfSimulatedConnectionClass |
enum | InfSimulatedConnectionMode |
InfSimulatedConnection simulates a connection and can be used everywhere
where a InfXmlConnection is expected. Use
inf_simulated_connection_connect()
to connect two such connections so that
data sent through one is received by the other.
InfSimulatedConnection *
inf_simulated_connection_new (void
);
Creates a new InfSimulatedConnection. A connection created this way cannot
be switched to INF_SIMULATED_CONNECTION_IO_CONTROLLED
mode. Use
inf_simulated_connection_new_with_io()
instead if you intend to do that.
[constructor]
InfSimulatedConnection *
inf_simulated_connection_new_with_io (InfIo *io
);
Creates a new InfSimulatedConnection with the given InfIo. This
connection can be used with INF_SIMULATED_CONNECTION_IO_CONTROLLED
mode.
If you don't intend to use that mode then using
inf_simulated_connection_new()
is also good enough since the InfIo object
is not required in that case.
[constructor]
void inf_simulated_connection_connect (InfSimulatedConnection *connection
,InfSimulatedConnection *to
);
Connects two simulated connections, so that data sent through one of them is received by the other one and vice versa. So one call to this function connects both InfSimulatedConnections to each other. There is no need to call this function once for each connection.
If one or both of the connections already have another target, then the simulated connection between those is closed first.
void inf_simulated_connection_set_mode (InfSimulatedConnection *connection
,InfSimulatedConnectionMode mode
);
Sets the mode of the simulated connection.
In INF_SIMULATED_CONNECTION_IMMEDIATE
mode, messages sent through the
connection are received by the target during the call to
inf_xml_connection_send()
.
In INF_SIMULATED_CONNECTION_DELAYED
mode, messages sent are queued and
received by the target when inf_simulated_connection_flush()
is called.
In INF_SIMULATED_CONNECTION_IO_CONTROLLED
mode, messages are queued and
received by the target as soon as a dispatch handler (see
inf_io_add_dispatch()
) installed on the main loop is called.
When changing the mode from INF_SIMULATED_CONNECTION_DELAYED
or
INF_SIMULATED_CONNECTION_IO_CONTROLLED
to
INF_SIMULATED_CONNECTION_IMMEDIATE
, then the queue is flushed, too.
void
inf_simulated_connection_flush (InfSimulatedConnection *connection
);
When connection
's mode is INF_SIMULATED_CONNECTION_DELAYED
or
INF_SIMULATED_CONNECTION_IO_CONTROLLED
, then calling this function makes
the target connection receive all the queued messages.
struct InfSimulatedConnection;
InfSimulatedConnection is an opaque data type. You should only access it via the public API functions.
struct InfSimulatedConnectionClass { };
This structure does not contain any public fields.
The mode of a simulated connection defines when sent messages arrive at the target connection.
Messages are received directly by the
target site when calling |
||
Messages are queued, and delivered to
the target site when |
||
Messages are queued and delivered
once the application main loop regains control. This requires the simulated
connection to have been created with
|
“io”
property“io” InfIo *
The main loop to be used for IO_CONTROLLED mode.
Owner: InfSimulatedConnection
Flags: Read / Write / Construct Only
“mode”
property“mode” InfSimulatedConnectionMode
The mode of the simulated connection.
Owner: InfSimulatedConnection
Flags: Read / Write / Construct
Default value: INF_SIMULATED_CONNECTION_IMMEDIATE
“target”
property“target” InfSimulatedConnection *
The simulated connection receiving data sent through this connection.
Owner: InfSimulatedConnection
Flags: Read / Write