InfSimulatedConnection

InfSimulatedConnection — Simulated network connection

Stability Level

Unstable, unless otherwise indicated

Synopsis

#include <libinfinity/common/inf-simulated-connection.h>

                    InfSimulatedConnection;
                    InfSimulatedConnectionClass;
enum                InfSimulatedConnectionMode;
InfSimulatedConnection * inf_simulated_connection_new   (void);
void                inf_simulated_connection_connect    (InfSimulatedConnection *connection,
                                                         InfSimulatedConnection *to);
void                inf_simulated_connection_set_mode   (InfSimulatedConnection *connection,
                                                         InfSimulatedConnectionMode mode);
void                inf_simulated_connection_flush      (InfSimulatedConnection *connection);

Object Hierarchy

  GObject
   +----InfSimulatedConnection

Implemented Interfaces

InfSimulatedConnection implements InfXmlConnection.

Properties

  "mode"                     InfSimulatedConnectionMode  : Read / Write / Construct
  "target"                   InfSimulatedConnection*  : Read / Write

Description

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.

Details

InfSimulatedConnection

typedef struct _InfSimulatedConnection InfSimulatedConnection;

InfSimulatedConnection is an opaque data type. You should only access it via the public API functions.


InfSimulatedConnectionClass

typedef struct {
} InfSimulatedConnectionClass;

This structure does not contain any public fields.


enum InfSimulatedConnectionMode

typedef enum _InfSimulatedConnectionMode {
  INF_SIMULATED_CONNECTION_IMMEDIATE,
  INF_SIMULATED_CONNECTION_DELAYED
} InfSimulatedConnectionMode;

The mode of a simulated connection defines when sent messages arrive at the target connection.

INF_SIMULATED_CONNECTION_IMMEDIATE

Messages are received directly by the target site when calling inf_xml_connection_send().

INF_SIMULATED_CONNECTION_DELAYED

Messages are queued, and delivered to the target site when inf_simulated_connection_flush() is called.

inf_simulated_connection_new ()

InfSimulatedConnection * inf_simulated_connection_new   (void);

Creates a new InfSimulatedConnection.

Returns :

A new InfSimulatedConnection.

inf_simulated_connection_connect ()

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. If one or both of the connections already have another target, then the simulated connection between those is closed first.

connection :

A InfSimulatedConnection.

to :

The target connection.

inf_simulated_connection_set_mode ()

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.

When changing the mode from INF_SIMULATED_CONNECTION_DELAYED to INF_SIMULATED_CONNECTION_IMMEDIATE, then the queue is flushed, too.

connection :

A InfSimulatedConnection.

mode :

The new mode to set.

inf_simulated_connection_flush ()

void                inf_simulated_connection_flush      (InfSimulatedConnection *connection);

When connection's mode is INF_SIMULATED_CONNECTION_DELAYED, then calling this function makes the target connection receive all the queued messages.

connection :

A InfSimulatedConnection.

Property Details

The "mode" property

  "mode"                     InfSimulatedConnectionMode  : Read / Write / Construct

The mode of the simulated connection.

Default value: INF_SIMULATED_CONNECTION_IMMEDIATE


The "target" property

  "target"                   InfSimulatedConnection*  : Read / Write

The simulated connection receiving data sent through this connection.