InfXmlConnection

InfXmlConnection

Functions

Properties

gchar * local-id Read
gchar * network Read
gchar * remote-id Read
InfXmlConnectionStatus status Read

Signals

void error Run Last
void received Run Last
void sent Run Last

Types and Values

Object Hierarchy

    GEnum
    ╰── InfXmlConnectionStatus
    GInterface
    ╰── InfXmlConnection

Prerequisites

InfXmlConnection requires GObject.

Known Implementations

InfXmlConnection is implemented by InfSimulatedConnection and InfXmppConnection.

Description

Functions

inf_xml_connection_open ()

gboolean
inf_xml_connection_open (InfXmlConnection *connection,
                         GError **error);

Attempts to open the given XML connection. If the process fails, error will be set. The connection needs to be in status INF_XML_CONNECTION_CLOSED for this function to be called. Even if this function succeeds, the connection process can fail later. In that case the status of connection will be reset to INF_XML_CONNECTION_CLOSED and the “error” signal will be emitted.

Parameters

connection

A infXmlConnection.

 

error

Location to store error information, if any.

 

Returns

TRUE on succes, or FALSE on error.


inf_xml_connection_close ()

void
inf_xml_connection_close (InfXmlConnection *connection);

Closes the given connection.

Parameters

connection

A InfXmlConnection.

 

inf_xml_connection_send ()

void
inf_xml_connection_send (InfXmlConnection *connection,
                         xmlNodePtr xml);

Sends the given XML message to the remote host.

Parameters

connection

A InfXmlConnection.

 

xml

A XML message to send. The function takes ownership of the XML node.

 

inf_xml_connection_sent ()

void
inf_xml_connection_sent (InfXmlConnection *connection,
                         const xmlNodePtr xml);

Emits the "sent" signal on connection . This will most likely only be useful to implementors.

Parameters

connection

A InfXmlConnection.

 

xml

The XML message that has been sent.

 

inf_xml_connection_received ()

void
inf_xml_connection_received (InfXmlConnection *connection,
                             const xmlNodePtr xml);

Emits the "received" signal on connection . This will most likely only be useful to implementors.

Parameters

connection

A InfXmlConnection.

 

xml

The XML message that has been received.

 

inf_xml_connection_error ()

void
inf_xml_connection_error (InfXmlConnection *connection,
                          const GError *error);

Emits the "error" signal on connection . This will most likely only be useful to implementors.

Note that the error may or may not be fatal for the connection. If it is fatal, then a status notify to INF_XML_CONNECTION_CLOSING or INF_XML_CONNECTION_CLOSED will follow. If you are implementing a custom class implementing InfXmlConnection, make sure to always emit the "error" signal before doing the status notify because many users of the connection will release their reference when the connection is no longer connected.

Parameters

connection

A InfXmlConnection.

 

error

The error that occured.

 

Types and Values

InfXmlConnection

typedef struct _InfXmlConnection InfXmlConnection;


struct InfXmlConnectionIface

struct InfXmlConnectionIface {
  GTypeInterface parent;

  /* Virtual table */
  gboolean (*open)(InfXmlConnection* connection,
                   GError** error);
  void (*close)(InfXmlConnection* connection);
  void (*send)(InfXmlConnection* connection,
               xmlNodePtr xml);

  /* Signals */
  void (*sent)(InfXmlConnection* connection,
               const xmlNodePtr xml);
  void (*received)(InfXmlConnection* connection,
                   const xmlNodePtr xml);
  void (*error)(InfXmlConnection* connection,
                const GError* error);
};


enum InfXmlConnectionStatus

Members

INF_XML_CONNECTION_CLOSED

   

INF_XML_CONNECTION_CLOSING

   

INF_XML_CONNECTION_OPEN

   

INF_XML_CONNECTION_OPENING

   

Property Details

The “local-id” property

  “local-id”                 gchar *

A unique identification on the network for the local site.

Flags: Read

Default value: NULL


The “network” property

  “network”                  gchar *

An identifier for the type of network this connection is on.

Flags: Read

Default value: NULL


The “remote-id” property

  “remote-id”                gchar *

A unique identification on the network for the remote site.

Flags: Read

Default value: NULL


The “status” property

  “status”                   InfXmlConnectionStatus

The status of the connection.

Flags: Read

Default value: INF_XML_CONNECTION_CLOSED

Signal Details

The “error” signal

void
user_function (InfXmlConnection *connection,
               gpointer          error,
               gpointer          user_data)

Parameters

connection

The erroneous InfXmlConnection

 

error

A pointer to a GError object with details on the error

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “received” signal

void
user_function (InfXmlConnection *connection,
               gpointer          node,
               gpointer          user_data)

Parameters

connection

The InfXmlConnection through which node has been received

 

node

An xmlNodePtr refering to the XML node that has been received

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “sent” signal

void
user_function (InfXmlConnection *connection,
               gpointer          node,
               gpointer          user_data)

Parameters

connection

The InfXmlConnection through which node has been sent

 

node

An xmlNodePtr refering to the XML node that has been sent

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last