mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-20 04:28:12 +02:00
* libnm-glib/Makefile.am: Add NMObject to build, remove nm-utils.[ch]. * nm-utils.[ch]: Remove. * libnm-glib/nm-object.c: Implement a base class for all libnm-glib dbus-aware objects for easy property access and dbus connection handling. * libnm-glib/nm-client.c: Derive from NMObject. * libnm-glib/nm-device.c: Ditto. * libnm-glib/nm-device-802-3-ethernet.c: Changes for being based on NMObject. * libnm-glib/nm-device-802-11-wireless.c: Ditto. * libnm-glib/nm-ip4-config.c: Ditto. * libnm-glib/nm-access-point.c: Ditto. * libnm-util/nm-connection.c (nm_connection_compare): Add a stub for connection comparision. Currently used by the device activation code to determine if the new activation is the same as the old one. * src/nm-dbus-nmi.c (nm_dbus_get_user_key_for_network): Don't use the obsolete and wrong way of getting the dbus path for AP. Fixes the issue where the applet isn't able to ask password for the AP. * src/nm-device.c (nm_device_activate): Change the logic here - instead of giving up if the device is already connected, tear down it's connection (if it isn't the same as new one) and start the activation. * src/nm-manager.c: Add the beginnings of NMConnection storage and signals. * src/NetworkManagerAP.c (nm_ap_init): Set the default values to AP memebers, fixes the issue where all APs are always listed as encrypted. * src/NetworkManagerDbus.c (nm_dbus_get_object_path_for_network): Remove. APs have their own registered paths. * test/nm-tool.c (detail_device): Don't try to get active network from wireless device if it's not connected - dbus-glib will happily crash trying to marshal NULL. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2615 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
133 lines
2.8 KiB
C
133 lines
2.8 KiB
C
#include "nm-ip4-config.h"
|
|
#include "NetworkManager.h"
|
|
|
|
#define INTERFACE NM_DBUS_INTERFACE ".IP4Config"
|
|
|
|
G_DEFINE_TYPE (NMIP4Config, nm_ip4_config, NM_TYPE_OBJECT)
|
|
|
|
static void
|
|
nm_ip4_config_init (NMIP4Config *config)
|
|
{
|
|
}
|
|
|
|
static void
|
|
nm_ip4_config_class_init (NMIP4ConfigClass *config_class)
|
|
{
|
|
}
|
|
|
|
NMIP4Config *
|
|
nm_ip4_config_new (DBusGConnection *connection, const char *object_path)
|
|
{
|
|
return (NMIP4Config *) g_object_new (NM_TYPE_IP4_CONFIG,
|
|
NM_OBJECT_CONNECTION, connection,
|
|
NM_OBJECT_PATH, object_path,
|
|
NULL);
|
|
}
|
|
|
|
guint32
|
|
nm_ip4_config_get_address (NMIP4Config *config)
|
|
{
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
|
|
|
return nm_object_get_uint_property (NM_OBJECT (config), INTERFACE, "Address");
|
|
}
|
|
|
|
guint32
|
|
nm_ip4_config_get_gateway (NMIP4Config *config)
|
|
{
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
|
|
|
return nm_object_get_uint_property (NM_OBJECT (config), INTERFACE, "Gateway");
|
|
}
|
|
|
|
guint32
|
|
nm_ip4_config_get_netmask (NMIP4Config *config)
|
|
{
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
|
|
|
return nm_object_get_uint_property (NM_OBJECT (config), INTERFACE, "Netmask");
|
|
}
|
|
|
|
guint32
|
|
nm_ip4_config_get_broadcast (NMIP4Config *config)
|
|
{
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
|
|
|
return nm_object_get_uint_property (NM_OBJECT (config), INTERFACE, "Broadcast");
|
|
}
|
|
|
|
char *
|
|
nm_ip4_config_get_hostname (NMIP4Config *config)
|
|
{
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
|
|
|
return nm_object_get_string_property (NM_OBJECT (config), INTERFACE, "Hostname");
|
|
}
|
|
|
|
GArray *
|
|
nm_ip4_config_get_nameservers (NMIP4Config *config)
|
|
{
|
|
GArray *array = NULL;
|
|
GValue value = {0,};
|
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
|
|
|
if (nm_object_get_property (NM_OBJECT (config),
|
|
INTERFACE,
|
|
"Nameservers",
|
|
&value))
|
|
array = (GArray *) g_value_get_boxed (&value);
|
|
|
|
return array;
|
|
}
|
|
|
|
char **
|
|
nm_ip4_config_get_domains (NMIP4Config *config)
|
|
{
|
|
char **array = NULL;
|
|
GValue value = {0,};
|
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
|
|
|
if (nm_object_get_property (NM_OBJECT (config),
|
|
INTERFACE,
|
|
"Domains",
|
|
&value))
|
|
array = (char **) g_value_get_boxed (&value);
|
|
|
|
return array;
|
|
}
|
|
|
|
char *
|
|
nm_ip4_config_get_nis_domain (NMIP4Config *config)
|
|
{
|
|
char *address = NULL;
|
|
GValue value = {0,};
|
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
|
|
|
if (nm_object_get_property (NM_OBJECT (config),
|
|
INTERFACE,
|
|
"NisDomain",
|
|
&value))
|
|
address = g_strdup (g_value_get_string (&value));
|
|
|
|
return address;
|
|
}
|
|
|
|
GArray *
|
|
nm_ip4_config_get_nis_servers (NMIP4Config *config)
|
|
{
|
|
GArray *array = NULL;
|
|
GValue value = {0,};
|
|
|
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
|
|
|
if (nm_object_get_property (NM_OBJECT (config),
|
|
INTERFACE,
|
|
"NisServers",
|
|
&value))
|
|
array = (GArray *) g_value_get_boxed (&value);
|
|
|
|
return array;
|
|
}
|