Top | ![]() |
![]() |
![]() |
![]() |
NMActiveConnection * | activating-connection | Read |
NMObjectArray * | active-connections | Read |
NMObjectArray * | all-devices | Read |
guint | connectivity | Read |
NMObjectArray * | devices | Read |
gboolean | manager-running | Read |
gboolean | networking-enabled | Read / Write |
NMActiveConnection * | primary-connection | Read |
gboolean | startup | Read |
guint | state | Read |
gchar * | version | Read |
gboolean | wimax-enabled | Read / Write |
gboolean | wimax-hardware-enabled | Read |
gboolean | wireless-enabled | Read / Write |
gboolean | wireless-hardware-enabled | Read |
gboolean | wwan-enabled | Read / Write |
gboolean | wwan-hardware-enabled | Read |
void | any-device-added | Run First |
void | any-device-removed | Run First |
void | device-added | Run First |
void | device-removed | Run First |
void | permission-changed | Run First |
#define | NM_CLIENT_VERSION |
#define | NM_CLIENT_STATE |
#define | NM_CLIENT_STARTUP |
#define | NM_CLIENT_MANAGER_RUNNING |
#define | NM_CLIENT_NETWORKING_ENABLED |
#define | NM_CLIENT_WIRELESS_ENABLED |
#define | NM_CLIENT_WIRELESS_HARDWARE_ENABLED |
#define | NM_CLIENT_WWAN_ENABLED |
#define | NM_CLIENT_WWAN_HARDWARE_ENABLED |
#define | NM_CLIENT_WIMAX_ENABLED |
#define | NM_CLIENT_WIMAX_HARDWARE_ENABLED |
#define | NM_CLIENT_ACTIVE_CONNECTIONS |
#define | NM_CLIENT_CONNECTIVITY |
#define | NM_CLIENT_PRIMARY_CONNECTION |
#define | NM_CLIENT_ACTIVATING_CONNECTION |
#define | NM_CLIENT_DEVICES |
#define | NM_CLIENT_ALL_DEVICES |
enum | NMClientPermission |
enum | NMClientPermissionResult |
enum | NMClientError |
#define | NM_CLIENT_ERROR |
GQuark
nm_client_error_quark (void
);
Registers an error quark for NMClient if necessary.
Since: 0.9.10
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.
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.
cancellable |
a GCancellable, or |
|
callback |
callback to call when the client is created |
|
user_data |
data for |
NMClient * nm_client_new_finish (GAsyncResult *result
,GError **error
);
Gets the result of an nm_client_new_async()
call.
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()
.
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()
.
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
NMDevice * nm_client_get_device_by_path (NMClient *client
,const char *object_path
);
NMDevice * nm_client_get_device_by_iface (NMClient *client
,const char *iface
);
void (*NMClientActivateFn) (NMClient *client
,NMActiveConnection *active_connection
,GError *error
,gpointer user_data
);
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.
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 |
[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] |
void (*NMClientAddActivateFn) (NMClient *client
,NMActiveConnection *connection
,const char *new_connection_path
,GError *error
,gpointer user_data
);
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.
client |
a NMClient |
|
partial |
an NMConnection to add; the connection may be
partially filled (or even |
[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 |
[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] |
void nm_client_deactivate_connection (NMClient *client
,NMActiveConnection *active
);
Deactivates an active NMActiveConnection.
gboolean
nm_client_networking_get_enabled (NMClient *client
);
Whether networking is enabled or disabled.
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.
gboolean
nm_client_wireless_get_enabled (NMClient *client
);
Determines whether the wireless is enabled.
void nm_client_wireless_set_enabled (NMClient *client
,gboolean enabled
);
Enables or disables wireless devices.
gboolean
nm_client_wireless_hardware_get_enabled
(NMClient *client
);
Determines whether the wireless hardware is enabled.
gboolean
nm_client_wwan_get_enabled (NMClient *client
);
Determines whether WWAN is enabled.
void nm_client_wwan_set_enabled (NMClient *client
,gboolean enabled
);
Enables or disables WWAN devices.
gboolean
nm_client_wwan_hardware_get_enabled (NMClient *client
);
Determines whether the WWAN hardware is enabled.
gboolean
nm_client_wimax_get_enabled (NMClient *client
);
Determines whether WiMAX is enabled.
void nm_client_wimax_set_enabled (NMClient *client
,gboolean enabled
);
Enables or disables WiMAX devices.
gboolean
nm_client_wimax_hardware_get_enabled (NMClient *client
);
Determines whether the WiMAX hardware is enabled.
const char *
nm_client_get_version (NMClient *client
);
Gets NetworkManager version.
NMState
nm_client_get_state (NMClient *client
);
Gets the current daemon state.
gboolean
nm_client_get_startup (NMClient *client
);
Tests whether the daemon is still in the process of activating connections at startup.
Since: 0.9.10
gboolean
nm_client_get_manager_running (NMClient *client
);
Determines whether the daemon is running.
const GPtrArray *
nm_client_get_active_connections (NMClient *client
);
Gets the active connections.
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]
void nm_client_sleep (NMClient *client
,gboolean sleep_
);
Deprecated; use nm_client_networking_set_enabled()
instead.
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
client |
a NMClient |
|
permission |
the permission for which to return the result, one of NMClientPermission |
gboolean nm_client_get_logging (NMClient *client
,char **level
,char **domains
,GError **error
);
Gets NetworkManager current logging level and domains.
Since: 0.9.8
gboolean nm_client_set_logging (NMClient *client
,const char *level
,const char *domains
,GError **error
);
Sets NetworkManager logging level and/or domains.
Since: 0.9.8
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.
Since: 0.9.8.6
NMConnectivityState nm_client_check_connectivity (NMClient *client
,GCancellable *cancellable
,GError **error
);
Updates the network connectivity state and returns the (new)
current state. Contrast nm_client_get_connectivity()
, which returns
the most recent known state without re-checking.
This is a blocking call; use nm_client_check_connectivity_async()
if you do not want to block.
Since: 0.9.8.6
void nm_client_check_connectivity_async (NMClient *client
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Asynchronously updates the network connectivity state and invokes
callback
when complete. Contrast nm_client_get_connectivity()
,
which (immediately) returns the most recent known state without
re-checking, and nm_client_check_connectivity()
, which blocks.
client |
an NMClient |
|
cancellable |
||
callback |
callback to call with the result |
|
user_data |
data for |
Since: 0.9.8.6
NMConnectivityState nm_client_check_connectivity_finish (NMClient *client
,GAsyncResult *result
,GError **error
);
Retrieves the result of an nm_client_check_connectivity_async()
call.
Since: 0.9.8.6
NMActiveConnection *
nm_client_get_primary_connection (NMClient *client
);
Gets the NMActiveConnection corresponding to the primary active network device.
In particular, when there is no VPN active, or the VPN does not have the default route, this returns the active connection that has the default route. If there is a VPN active with the default route, then this function returns the active connection that contains the route to the VPN endpoint.
If there is no default route, or the default route is over a
non-NetworkManager-recognized device, this will return NULL
.
Since: 0.9.8.6
NMActiveConnection *
nm_client_get_activating_connection (NMClient *client
);
Gets the NMActiveConnection corresponding to a currently-activating connection that is expected to become the new “primary-connection” upon successful activation.
Since: 0.9.8.6
#define NM_CLIENT_WIRELESS_HARDWARE_ENABLED "wireless-hardware-enabled"
NMClientPermission values indicate various permissions that NetworkManager clients can obtain to perform certain tasks on behalf of the current user.
unknown or no permission |
||
controls whether networking can be globally enabled or disabled |
||
controls whether Wi-Fi can be globally enabled or disabled |
||
controls whether WWAN (3G) can be globally enabled or disabled |
||
controls whether WiMAX can be globally enabled or disabled |
||
controls whether the client can ask NetworkManager to sleep and wake |
||
controls whether networking connections can be started, stopped, and changed |
||
controls whether a password protected Wi-Fi hotspot can be created |
||
controls whether an open Wi-Fi hotspot can be created |
||
controls whether connections that are available to all users can be modified |
||
controls whether connections owned by the current user can be modified |
||
controls whether the persistent hostname can be changed |
||
modify persistent global DNS configuration |
||
controls access to Reload. persistent hostname can be changed |
||
permission to create checkpoints. |
||
controls whether device statistics can be globally enabled or disabled |
||
a reserved boundary value |
NMClientPermissionResult values indicate what authorizations and permissions the user requires to obtain a given NMClientPermission
“activating-connection”
property“activating-connection” NMActiveConnection *
The NMActiveConnection of the activating connection that is likely to become the new “primary-connection”.
Flags: Read
Since: 0.9.8.6
“all-devices”
property “all-devices” NMObjectArray *
List of both real devices and device placeholders.
Flags: Read
Since: 1.2
“connectivity”
property“connectivity” guint
The network connectivity state.
Flags: Read
Allowed values: <= 4
Default value: 0
Since: 0.9.8.6
“devices”
property “devices” NMObjectArray *
List of real network devices. Does not include placeholder devices.
Flags: Read
Since: 0.9.10
“manager-running”
property“manager-running” gboolean
Whether the daemon is running.
Flags: Read
Default value: FALSE
“networking-enabled”
property“networking-enabled” gboolean
Whether networking is enabled.
Flags: Read / Write
Default value: TRUE
“primary-connection”
property“primary-connection” NMActiveConnection *
The NMActiveConnection of the device with the default route;
see nm_client_get_primary_connection()
for more details.
Flags: Read
Since: 0.9.8.6
“startup”
property“startup” gboolean
Whether the daemon is still starting up.
Flags: Read
Default value: FALSE
Since: 0.9.10
“state”
property“state” guint
The current daemon state.
Flags: Read
Allowed values: <= 70
Default value: 0
“version”
property“version” gchar *
The NetworkManager version.
Flags: Read
Default value: NULL
“wimax-enabled”
property“wimax-enabled” gboolean
Whether WiMAX functionality is enabled.
Flags: Read / Write
Default value: FALSE
“wimax-hardware-enabled”
property“wimax-hardware-enabled” gboolean
Whether the WiMAX hardware is enabled.
Flags: Read
Default value: FALSE
“wireless-enabled”
property“wireless-enabled” gboolean
Whether wireless is enabled.
Flags: Read / Write
Default value: FALSE
“wireless-hardware-enabled”
property“wireless-hardware-enabled” gboolean
Whether the wireless hardware is enabled.
Flags: Read
Default value: TRUE
“wwan-enabled”
property“wwan-enabled” gboolean
Whether WWAN functionality is enabled.
Flags: Read / Write
Default value: FALSE
“wwan-hardware-enabled”
property“wwan-hardware-enabled” gboolean
Whether the WWAN hardware is enabled.
Flags: Read
Default value: FALSE
“any-device-added”
signalvoid user_function (NMClient *client, GObject *device, gpointer user_data)
Notifies that a NMDevice is added. This signal is emitted for both regular devices and placeholder devices.
client |
the client that received the signal |
|
device |
the new device. |
[type NMDevice] |
user_data |
user data set when the signal handler was connected. |
Flags: Run First
“any-device-removed”
signalvoid user_function (NMClient *client, GObject *device, gpointer user_data)
Notifies that a NMDevice is removed. This signal is emitted for both regular devices and placeholder devices.
client |
the client that received the signal |
|
device |
the removed device. |
[type NMDevice] |
user_data |
user data set when the signal handler was connected. |
Flags: Run First
“device-added”
signalvoid user_function (NMClient *client, GObject *device, gpointer user_data)
Notifies that a NMDevice is added. This signal is not emitted for placeholder devices.
client |
the client that received the signal |
|
device |
the new device. |
[type NMDevice] |
user_data |
user data set when the signal handler was connected. |
Flags: Run First
“device-removed”
signalvoid user_function (NMClient *client, GObject *device, gpointer user_data)
Notifies that a NMDevice is removed. This signal is not emitted for placeholder devices.
client |
the client that received the signal |
|
device |
the removed device. |
[type NMDevice] |
user_data |
user data set when the signal handler was connected. |
Flags: Run First
“permission-changed”
signalvoid user_function (NMClient *client, guint permission, guint result, gpointer user_data)
Notifies that a permission has changed
client |
the client that received the signal |
|
permission |
a permission from NMClientPermission |
|
result |
the permission's result, one of NMClientPermissionResult |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First