GNetworkTcpConnection

GNetworkTcpConnection — A TCP/IP connection object.

Synopsis




enum        GNetworkTcpConnectionStatus;
struct      GNetworkTcpConnection;
struct      GNetworkTcpConnectionClass;


Object Hierarchy


  GObject
   +----GNetworkTcpConnection

Implemented Interfaces

GNetworkTcpConnection implements GNetworkConnection.

Properties


  "address"              gchararray            : Read / Write
  "authentication-type"  GNetworkSslAuthType   : Read / Write
  "authority-file"       gchararray            : Read / Write
  "certificate-file"     gchararray            : Read / Write
  "ip-address"           GNetworkIpAddress     : Read
  "key-file"             gchararray            : Read / Write
  "local-address"        GNetworkIpAddress     : Read
  "local-port"           guint                 : Read
  "port"                 guint                 : Read / Write
  "proxy-type"           GNetworkTcpProxyType  : Read / Write
  "socket"               gpointer              : Read / Write
  "ssl-enabled"          gboolean              : Read / Write
  "tcp-status"           GNetworkTcpConnectionStatus  : Read

Signal Prototypes


"certificate-error"
            void        user_function      (GNetworkTcpConnection *gnetworktcpconnection,
                                            GNetworkSslCert *arg1,
                                            GNetworkSslCertErrorFlags arg2,
                                            gpointer user_data);

Description

The GNetworkTcpConnection object and associated functions provide the easiest way to create a TCP/IP networking connection. Simply start the Glib main loop, create a new object, connect to the signals, and open it. Properties of this object and the GNetworkConnection interface can be set via g_object_set().

The "error" signal for GnetworkTcpConnection objects use the following error domains: GNETWORK_CONNECTION_ERROR, GNETWORK_SSL_ERROR, GNETWORK_SSL_CERT_ERROR, G_IO_CHANNEL_ERROR, GNETWORK_TCP_PROXY_ERROR.

Details

enum GNetworkTcpConnectionStatus

typedef enum /* <prefix=GNETWORK_TCP_CONNECTION_STATUS> */
{
  GNETWORK_TCP_CONNECTION_CLOSING,
  GNETWORK_TCP_CONNECTION_CLOSED,
  GNETWORK_TCP_CONNECTION_LOOKUP,
  GNETWORK_TCP_CONNECTION_OPENING,
  GNETWORK_TCP_CONNECTION_PROXYING,
  GNETWORK_TCP_CONNECTION_AUTHENTICATING,
  GNETWORK_TCP_CONNECTION_OPEN
}
GNetworkTcpConnectionStatus;

An enumeration of the possible states a GNetworkTcpConnection can be in.

GNETWORK_TCP_CONNECTION_CLOSINGthe object is closing.
GNETWORK_TCP_CONNECTION_CLOSEDthe object is closed.
GNETWORK_TCP_CONNECTION_LOOKUPthe object is waiting for a DNS return.
GNETWORK_TCP_CONNECTION_OPENINGthe object is opening the connection from this computer.
GNETWORK_TCP_CONNECTION_PROXYINGthe object is attempting to access the proxy server.
GNETWORK_TCP_CONNECTION_AUTHENTICATINGthe object is authenticating with the SSL server.
GNETWORK_TCP_CONNECTION_OPENthe object is open and ready to receive data.

struct GNetworkTcpConnection

struct GNetworkTcpConnection;

This structure contains no public data.


struct GNetworkTcpConnectionClass

struct GNetworkTcpConnectionClass {

  void (*certificate_error)  (GNetworkTcpConnection * connection,
			      GNetworkSslCert * certificate,
			      GNetworkSslCertErrorFlags errors);

};

The class structure for GNetworkTcpConnection objects.

void (*certificate_error) (GNetworkTcpConnection * connection, GNetworkSslCert * certificate, GNetworkSslCertErrorFlags errors)the object callback stub for the "certificate-error" signal.

Properties

The "address" property

  "address"              gchararray            : Read / Write

The hostname or IP address to connect to.

Default value: NULL


The "authentication-type" property

  "authentication-type"  GNetworkSslAuthType   : Read / Write

What type of SSL authentication should be performed with this connection.

Default value: GNETWORK_SSL_AUTH_ANONYMOUS


The "authority-file" property

  "authority-file"       gchararray            : Read / Write

The path to a file which contains the X.509 certificates of trusted signers.

Default value: NULL


The "certificate-file" property

  "certificate-file"     gchararray            : Read / Write

The path to a file which contains X.509 certificates to distribute to clients.

Default value: NULL


The "ip-address" property

  "ip-address"           GNetworkIpAddress     : Read

The IP address to connect to.


The "key-file" property

  "key-file"             gchararray            : Read / Write

The path to a file which contains X.509 keys to distribute to clients.

Default value: NULL


The "local-address" property

  "local-address"        GNetworkIpAddress     : Read

The IP address of this computer.


The "local-port" property

  "local-port"           guint                 : Read

The local port number we are connected through.

Allowed values: <= 65535

Default value: 0


The "port" property

  "port"                 guint                 : Read / Write

The port number to connect to.

Allowed values: <= 65535

Default value: 0


The "proxy-type" property

  "proxy-type"           GNetworkTcpProxyType  : Read / Write

The type of proxy to use, depending on the protocol.

Default value: GNETWORK_TCP_PROXY_HTTP


The "socket" property

  "socket"               gpointer              : Read / Write

The socket file descriptor.


The "ssl-enabled" property

  "ssl-enabled"          gboolean              : Read / Write

Whether or not SSL will be used with this connection.

Default value: FALSE


The "tcp-status" property

  "tcp-status"           GNetworkTcpConnectionStatus  : Read

The current status of the TCP/IP connection.

Default value: GNETWORK_TCP_CONNECTION_CLOSED

Signals

The "certificate-error" signal

void        user_function                  (GNetworkTcpConnection *gnetworktcpconnection,
                                            GNetworkSslCert *arg1,
                                            GNetworkSslCertErrorFlags arg2,
                                            gpointer user_data);

This signal is emitted when an SSL-enabled connection encounters an error while attempting to verify the certificate in arg1.

gnetworktcpconnection :the object which received the signal.
arg1 :the certificate which has problems.
arg2 :a bitmask of the problems with arg1.
user_data :user data set when the signal handler was connected.