ConIcConnection class can be used to request for Internet connections. Also it can be used retrieve current statistics, proxies and settings for Internet Access Points (IAPs).
The different signals are listed below as function prototypes for informational purposes. They are implemented as gobject signals.
"connection-event" signal
void user_function(ConIcConnection *connection, ConIcConnectionEvent *event, gpointer user_data);
When there's a new connection event for the application (eg. a connection is opened as requested), it sent as connection-event signal. ConIcConnectionEvent contains the status, for example CON_IC_STATUS_CONNECTED or CON_IC_STATUS_DISCONNECTED.
"statistics" signal
void user_function(ConIcConnection *connection, ConIcStatisticsEvent *event, gpointer user_data);
All statistics are sent using this signal as ConIcStatistics event.
"automatic-connection-events" gboolean : Read / Write
If set to true, application will receive connection-events automatically as connections are established and tore down. Normally events are only sent when applications request for a connection, with this all events are received constantly. This makes it possible, for example, to create an application which executes something from the network every time a connection is established.
#include <glib.h>
#include <glib-object.h>
#include <coniciap.h>
typedef struct _ConIcConnection ConIcConnection |
ConIcConnection object.
The contents of the object is private, use only the functions provided by conicconnection.h.
enum ConIcConnectFlags |
Connection request flags.
With these flags special connection requests can be made. The flags can be ORred.
Normally just use CON_IC_CONNECT_FLAG_NONE.
enum ConIcProxyMode |
enum ConIcProxyProtocol |
gboolean con_ic_connection_connect | ( | ConIcConnection * | connection, | |
ConIcConnectFlags | flags | |||
) |
Request for a connection.
The Internet Connectivity subsystem will choose the best connection based on user settings and input provided by the user.
Answer is sent using the connection-event signal from a ConIcConnection object. If the connection establishment succeeded, or there was already a connection established, a CON_IC_STATUS_CONNECTED inside ConIcConnectionEvent is sent. If connection establishment failed, a CON_IC_STATUS_DISCONNECTED inside ConIcConnectionEvent is sent and error is set accordingly.
Normally this one should be used.
connection | ConIcConnection object. | |
flags | Flags for the request. |
TRUE | If no DBUS errors. | |
FALSE | If a DBUS message couldn't be sent. |
gboolean con_ic_connection_connect_by_id | ( | ConIcConnection * | connection, | |
const gchar * | id, | |||
ConIcConnectFlags | flags | |||
) |
Request for a connection using the IAP id.
The Internet Connectivity subsystem will choose the best connection based on user settings and input provided by the user.
Answer is sent using the connection-event signal from a ConIcConnection object. If the connection establishment succeeded, or there was already a connection established, a CON_IC_STATUS_CONNECTED inside ConIcConnectionEvent is sent. If connection establishment failed, a CON_IC_STATUS_DISCONNECTED inside ConIcConnectionEvent is sent and error is set accordingly.
Normally con_ic_connection_connect() should be used. Use this one if you want to use a specific connection.
connection | ConIcConnection object. | |
flags | Flags for the request. | |
id | Id of the requested IAP. |
TRUE | If no DBUS errors. | |
FALSE | If a DBUS message couldn't be sent. |
gboolean con_ic_connection_disconnect | ( | ConIcConnection * | connection | ) |
Disconnects all IAPs associated with the connection.
Normally use this one.
connection | ConIcConnection object. |
TRUE | If no DBUS errors. | |
FALSE | If a DBUS message couldn't be sent. |
gboolean con_ic_connection_disconnect_by_id | ( | ConIcConnection * | connection, | |
const gchar * | id | |||
) |
Disconnects specific IAP associated with the application.
Normally use con_ic_connection_disconnect().
connection | ConIcConnection object. | |
id | Id of the IAP to disconnected. |
TRUE | If no DBUS errors. | |
FALSE | If a DBUS message couldn't be sent. |
GSList* con_ic_connection_get_all_iaps | ( | ConIcConnection * | connection | ) |
Get a list of all configured IAPs.
connection | ConIcConnection object |
ConIcIap* con_ic_connection_get_iap | ( | ConIcConnection * | connection, | |
const gchar * | id | |||
) |
Retrieve an IAP by id.
const gchar* con_ic_connection_get_proxy_autoconfig_url | ( | ConIcConnection * | connection | ) |
Get the URL of Auto-Config Proxy.
It is guaranteed that this function always returns the current and up-to-date settings.
connection | ConIcConnection object |
const gchar* con_ic_connection_get_proxy_host | ( | ConIcConnection * | connection, | |
ConIcProxyProtocol | protocol | |||
) |
Get proxy host.
connection | ConIcConnection object | |
protocol | Protocol, for which the proxy host should be returned |
GSList* con_ic_connection_get_proxy_ignore_hosts | ( | ConIcConnection * | connection | ) |
Get a list of hosts to be ignored.
Connections to these hosts shouldn't use proxies.
It is guaranteed that this function always returns the current and up-to-date settings.
connection | ConIcConnection object |
ConIcProxyMode con_ic_connection_get_proxy_mode | ( | ConIcConnection * | connection | ) |
Get current proxy mode.
If proxy mode is CON_IC_PROXY_MODE_NONE, do not use proxies at all.
If proxy mode is CON_IC_PROXY_MODE_MANUAL, use proxies and only use these functions to get the proxy settings:
If proxy mode is CON_IC_PROXY_MODE_AUTO, then only use Proxy Auto-config file specified in <http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html>. To get the URL for the file, use this function:
gint con_ic_connection_get_proxy_port | ( | ConIcConnection * | connection, | |
ConIcProxyProtocol | protocol | |||
) |
Get proxy port.
connection | ConIcConnection object | |
protocol | Protocol, for which the proxy port should be returned |
ConIcConnection* con_ic_connection_new | ( | void | ) |
Creates new ConIcConnection.
When not needed anymore, release with g_object_unref().
Creating the object does not yet open the connection. Use, for example, con_ic_connection_connect() to do that.
gboolean con_ic_connection_statistics | ( | ConIcConnection * | connection, | |
const gchar * | id | |||
) |
Requests statistics for a IAP.
The answer is sent as ConIcStatistics in statistics signal.
connection | ConIcConnection object. | |
id | Id of the IAP |
TRUE | If no DBUS errors. | |
FALSE | If a DBUS message couldn't be sent. No statistics events will be emitted. |