NMClient

NMClient

Functions

GQuark nm_client_error_quark ()
NMClient * nm_client_new ()
void nm_client_new_async ()
NMClient * nm_client_new_finish ()
const GPtrArray * nm_client_get_devices ()
const GPtrArray * nm_client_get_all_devices ()
NMDevice * nm_client_get_device_by_path ()
NMDevice * nm_client_get_device_by_iface ()
void (*NMClientActivateFn) ()
void nm_client_activate_connection ()
void (*NMClientAddActivateFn) ()
void nm_client_add_and_activate_connection ()
void nm_client_deactivate_connection ()
gboolean nm_client_networking_get_enabled ()
void nm_client_networking_set_enabled ()
gboolean nm_client_wireless_get_enabled ()
void nm_client_wireless_set_enabled ()
gboolean nm_client_wireless_hardware_get_enabled ()
gboolean nm_client_wwan_get_enabled ()
void nm_client_wwan_set_enabled ()
gboolean nm_client_wwan_hardware_get_enabled ()
gboolean nm_client_wimax_get_enabled ()
void nm_client_wimax_set_enabled ()
gboolean nm_client_wimax_hardware_get_enabled ()
const char * nm_client_get_version ()
NMState nm_client_get_state ()
gboolean nm_client_get_startup ()
gboolean nm_client_get_manager_running ()
const GPtrArray * nm_client_get_active_connections ()
void nm_client_sleep ()
NMClientPermissionResult nm_client_get_permission_result ()
gboolean nm_client_get_logging ()
gboolean nm_client_set_logging ()
NMConnectivityState nm_client_get_connectivity ()
NMConnectivityState nm_client_check_connectivity ()
void nm_client_check_connectivity_async ()
NMConnectivityState nm_client_check_connectivity_finish ()
NMActiveConnection * nm_client_get_primary_connection ()
NMActiveConnection * nm_client_get_activating_connection ()

Properties

Signals

Types and Values

Object Hierarchy

    GObject
    ╰── NMObject
        ╰── NMClient

Description

Functions

nm_client_error_quark ()

GQuark
nm_client_error_quark (void);

Registers an error quark for NMClient if necessary.

Returns

the error quark used for NMClient errors.

Since: 0.9.10


nm_client_new ()

NMClient *
nm_client_new (void);

Creates a new NMClient.

Note that this will do blocking D-Bus calls to initialize the client. You can use nm_client_new_async() if you want to avoid that.

NOTE: NMClient provides information about devices and a mechanism to control them. To access and modify network configuration data, use the NMRemoteSettings object.

Returns

a new NMClient or NULL on an error


nm_client_new_async ()

void
nm_client_new_async (GCancellable *cancellable,
                     GAsyncReadyCallback callback,
                     gpointer user_data);

Creates a new NMClient and begins asynchronously initializing it. callback will be called when it is done; use nm_client_new_finish() to get the result. Note that on an error, the callback can be invoked with two first parameters as NULL.

NOTE: NMClient provides information about devices and a mechanism to control them. To access and modify network configuration data, use the NMRemoteSettings object.

Parameters

cancellable

a GCancellable, or NULL

 

callback

callback to call when the client is created

 

user_data

data for callback

 

nm_client_new_finish ()

NMClient *
nm_client_new_finish (GAsyncResult *result,
                      GError **error);

Gets the result of an nm_client_new_async() call.

Parameters

result

a GAsyncResult

 

error

location for a GError, or NULL

 

Returns

a new NMClient, or NULL on error


nm_client_get_devices ()

const GPtrArray *
nm_client_get_devices (NMClient *client);

Gets all the known network devices. Use nm_device_get_type() or the NM_IS_DEVICE_XXXX functions to determine what kind of device member of the returned array is, and then you may use device-specific methods such as nm_device_ethernet_get_hw_address().

Parameters

client

a NMClient

 

Returns

a GPtrArray containing all the NMDevices. The returned array is owned by the NMClient object and should not be modified.

[transfer none][element-type NMDevice]


nm_client_get_all_devices ()

const GPtrArray *
nm_client_get_all_devices (NMClient *client);

Gets both real devices and device placeholders (eg, software devices which do not currently exist, but could be created automatically by NetworkManager if one of their NMDevice::ActivatableConnections was activated). Use nm_device_is_real() to determine whether each device is a real device or a placeholder.

Use nm_device_get_type() or the NM_IS_DEVICE_XXXX() functions to determine what kind of device each member of the returned array is, and then you may use device-specific methods such as nm_device_ethernet_get_hw_address().

Parameters

client

a NMClient

 

Returns

a GPtrArray containing all the NMDevices. The returned array is owned by the NMClient object and should not be modified.

[transfer none][element-type NMDevice]

Since: 1.2


nm_client_get_device_by_path ()

NMDevice *
nm_client_get_device_by_path (NMClient *client,
                              const char *object_path);

Gets a NMDevice from a NMClient.

Parameters

client

a NMClient

 

object_path

the object path to search for

 

Returns

the NMDevice for the given object_path or NULL if none is found.

[transfer none]


nm_client_get_device_by_iface ()

NMDevice *
nm_client_get_device_by_iface (NMClient *client,
                               const char *iface);

Gets a NMDevice from a NMClient.

Parameters

client

a NMClient

 

iface

the interface name to search for

 

Returns

the NMDevice for the given iface or NULL if none is found.

[transfer none]


NMClientActivateFn ()

void
(*NMClientActivateFn) (NMClient *client,
                       NMActiveConnection *active_connection,
                       GError *error,
                       gpointer user_data);

nm_client_activate_connection ()

void
nm_client_activate_connection (NMClient *client,
                               NMConnection *connection,
                               NMDevice *device,
                               const char *specific_object,
                               NMClientActivateFn callback,
                               gpointer user_data);

Starts a connection to a particular network using the configuration settings from connection and the network device device . Certain connection types also take a "specific object" which is the object path of a connection- specific object, like an NMAccessPoint for Wi-Fi connections, or an NMWimaxNsp for WiMAX connections, to which you wish to connect. If the specific object is not given, NetworkManager can, in some cases, automatically determine which network to connect to given the settings in connection .

If connection is not given for a device-based activation, NetworkManager picks the best available connection for the device and activates it.

Note that the callback is invoked when NetworkManager has started activating the new connection, not when it finishes. You can used the returned NMActiveConnection object (in particular, “state”) to track the activation to its completion.

Parameters

client

a NMClient

 

connection

an NMConnection.

[allow-none]

device

the NMDevice.

[allow-none]

specific_object

the object path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of NULL should be used (ie, no specific object). For Wi-Fi or WiMAX connections, pass the object path of a NMAccessPoint or NMWimaxNsp owned by device , which you can get using nm_object_get_path(), and which will be used to complete the details of the newly added connection.

[allow-none]

callback

the function to call when the call is done.

[scope async][allow-none]

user_data

user data to pass to the callback function.

[closure]

NMClientAddActivateFn ()

void
(*NMClientAddActivateFn) (NMClient *client,
                          NMActiveConnection *connection,
                          const char *new_connection_path,
                          GError *error,
                          gpointer user_data);

nm_client_add_and_activate_connection ()

void
nm_client_add_and_activate_connection (NMClient *client,
                                       NMConnection *partial,
                                       NMDevice *device,
                                       const char *specific_object,
                                       NMClientAddActivateFn callback,
                                       gpointer user_data);

Adds a new connection using the given details (if any) as a template, automatically filling in missing settings with the capabilities of the given device and specific object. The new connection is then activated. Cannot be used for VPN connections at this time.

Note that the callback is invoked when NetworkManager has started activating the new connection, not when it finishes. You can used the returned NMActiveConnection object (in particular, “state”) to track the activation to its completion.

Parameters

client

a NMClient

 

partial

an NMConnection to add; the connection may be partially filled (or even NULL) and will be completed by NetworkManager using the given device and specific_object before being added.

[allow-none]

device

the NMDevice

 

specific_object

the object path of a connection-type-specific object this activation should use. This parameter is currently ignored for wired and mobile broadband connections, and the value of NULL should be used (ie, no specific object). For Wi-Fi or WiMAX connections, pass the object path of a NMAccessPoint or NMWimaxNsp owned by device , which you can get using nm_object_get_path(), and which will be used to complete the details of the newly added connection.

[allow-none]

callback

the function to call when the call is done.

[scope async][allow-none]

user_data

user data to pass to the callback function.

[closure]

nm_client_deactivate_connection ()

void
nm_client_deactivate_connection (NMClient *client,
                                 NMActiveConnection *active);

Deactivates an active NMActiveConnection.

Parameters

client

a NMClient

 

active

the NMActiveConnection to deactivate

 

nm_client_networking_get_enabled ()

gboolean
nm_client_networking_get_enabled (NMClient *client);

Whether networking is enabled or disabled.

Parameters

client

a NMClient

 

Returns

TRUE if networking is enabled, FALSE if networking is disabled


nm_client_networking_set_enabled ()

void
nm_client_networking_set_enabled (NMClient *client,
                                  gboolean enabled);

Enables or disables networking. When networking is disabled, all controlled interfaces are disconnected and deactivated. When networking is enabled, all controlled interfaces are available for activation.

Parameters

client

a NMClient

 

enabled

TRUE to set networking enabled, FALSE to set networking disabled

 

nm_client_wireless_get_enabled ()

gboolean
nm_client_wireless_get_enabled (NMClient *client);

Determines whether the wireless is enabled.

Parameters

client

a NMClient

 

Returns

TRUE if wireless is enabled


nm_client_wireless_set_enabled ()

void
nm_client_wireless_set_enabled (NMClient *client,
                                gboolean enabled);

Enables or disables wireless devices.

Parameters

client

a NMClient

 

enabled

TRUE to enable wireless

 

nm_client_wireless_hardware_get_enabled ()

gboolean
nm_client_wireless_hardware_get_enabled
                               (NMClient *client);

Determines whether the wireless hardware is enabled.

Parameters

client

a NMClient

 

Returns

TRUE if the wireless hardware is enabled


nm_client_wwan_get_enabled ()

gboolean
nm_client_wwan_get_enabled (NMClient *client);

Determines whether WWAN is enabled.

Parameters

client

a NMClient

 

Returns

TRUE if WWAN is enabled


nm_client_wwan_set_enabled ()

void
nm_client_wwan_set_enabled (NMClient *client,
                            gboolean enabled);

Enables or disables WWAN devices.

Parameters

client

a NMClient

 

enabled

TRUE to enable WWAN

 

nm_client_wwan_hardware_get_enabled ()

gboolean
nm_client_wwan_hardware_get_enabled (NMClient *client);

Determines whether the WWAN hardware is enabled.

Parameters

client

a NMClient

 

Returns

TRUE if the WWAN hardware is enabled


nm_client_wimax_get_enabled ()

gboolean
nm_client_wimax_get_enabled (NMClient *client);

Determines whether WiMAX is enabled.

Parameters

client

a NMClient

 

Returns

TRUE if WiMAX is enabled


nm_client_wimax_set_enabled ()

void
nm_client_wimax_set_enabled (NMClient *client,
                             gboolean enabled);

Enables or disables WiMAX devices.

Parameters

client

a NMClient

 

enabled

TRUE to enable WiMAX

 

nm_client_wimax_hardware_get_enabled ()

gboolean
nm_client_wimax_hardware_get_enabled (NMClient *client);

Determines whether the WiMAX hardware is enabled.

Parameters

client

a NMClient

 

Returns

TRUE if the WiMAX hardware is enabled


nm_client_get_version ()

const char *
nm_client_get_version (NMClient *client);

Gets NetworkManager version.

Parameters

client

a NMClient

 

Returns

string with the version


nm_client_get_state ()

NMState
nm_client_get_state (NMClient *client);

Gets the current daemon state.

Parameters

client

a NMClient

 

Returns

the current NMState


nm_client_get_startup ()

gboolean
nm_client_get_startup (NMClient *client);

Tests whether the daemon is still in the process of activating connections at startup.

Parameters

client

a NMClient

 

Returns

whether the daemon is still starting up

Since: 0.9.10


nm_client_get_manager_running ()

gboolean
nm_client_get_manager_running (NMClient *client);

Determines whether the daemon is running.

Parameters

client

a NMClient

 

Returns

TRUE if the daemon is running


nm_client_get_active_connections ()

const GPtrArray *
nm_client_get_active_connections (NMClient *client);

Gets the active connections.

Parameters

client

a NMClient

 

Returns

a GPtrArray containing all the active NMActiveConnections. The returned array is owned by the client and should not be modified.

[transfer none][element-type NMActiveConnection]


nm_client_sleep ()

void
nm_client_sleep (NMClient *client,
                 gboolean sleep_);

Deprecated; use nm_client_networking_set_enabled() instead.

Parameters

client

a NMClient

 

sleep_

TRUE to put the daemon to sleep

 

nm_client_get_permission_result ()

NMClientPermissionResult
nm_client_get_permission_result (NMClient *client,
                                 NMClientPermission permission);

Requests the result of a specific permission, which indicates whether the client can or cannot perform the action the permission represents

Parameters

client

a NMClient

 

permission

the permission for which to return the result, one of NMClientPermission

 

Returns

the permission's result, one of NMClientPermissionResult


nm_client_get_logging ()

gboolean
nm_client_get_logging (NMClient *client,
                       char **level,
                       char **domains,
                       GError **error);

Gets NetworkManager current logging level and domains.

Parameters

client

a NMClient

 

level

return location for logging level string.

[allow-none]

domains

return location for log domains string. The string is a list of domains separated by ",".

[allow-none]

error

return location for a GError, or NULL.

[allow-none]

Returns

TRUE on success, FALSE otherwise

Since: 0.9.8


nm_client_set_logging ()

gboolean
nm_client_set_logging (NMClient *client,
                       const char *level,
                       const char *domains,
                       GError **error);

Sets NetworkManager logging level and/or domains.

Parameters

client

a NMClient

 

level

logging level to set (NULL or an empty string for no change).

[allow-none]

domains

logging domains to set. The string should be a list of log domains separated by ",". (NULL or an empty string for no change).

[allow-none]

error

return location for a GError, or NULL.

[allow-none]

Returns

TRUE on success, FALSE otherwise

Since: 0.9.8


nm_client_get_connectivity ()

NMConnectivityState
nm_client_get_connectivity (NMClient *client);

Gets the current network connectivity state. Contrast nm_client_check_connectivity() and nm_client_check_connectivity_async(), which re-check the connectivity state first before returning any information.

Parameters

client

an NMClient

 

Returns

the current connectivity state

Since: 0.9.8.6


nm_client_check_connectivity ()

NMConnectivityState
nm_client_check_connectivity (