diff options
author | Antti Kaijanmäki <antti@kaijanmaki.net> | 2008-08-18 08:30:28 +0000 |
---|---|---|
committer | Antti Kaijanmäki <antti@kaijanmaki.net> | 2008-08-18 08:30:28 +0000 |
commit | 2c21a2fe6b0498585fba0beb003ac8aa6351803c (patch) | |
tree | 9544edfe2ed9a6c96eda933c35fb5110f1d666c6 /libnm-glib/libnm-glib-test.c | |
parent | e04934d93efba622123809cc767488af673b2967 (diff) | |
download | NetworkManager-mbca.tar.gz |
keep up with trunkmbca
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/branches/mbca@3981 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Diffstat (limited to 'libnm-glib/libnm-glib-test.c')
-rw-r--r-- | libnm-glib/libnm-glib-test.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/libnm-glib/libnm-glib-test.c b/libnm-glib/libnm-glib-test.c index 80844f4950..daa3abf832 100644 --- a/libnm-glib/libnm-glib-test.c +++ b/libnm-glib/libnm-glib-test.c @@ -106,18 +106,30 @@ dump_ip4_config (NMIP4Config *cfg) for (i = 0; i < ptr_array->len; i++) g_print ("\t%s\n", (const char *) g_ptr_array_index (ptr_array, i)); } +} - g_print ("IP4 NIS domain: %s\n", nm_ip4_config_get_nis_domain (cfg)); +static void +print_one_dhcp4_option (gpointer key, gpointer data, gpointer user_data) +{ + const char *option = (const char *) key; + const char *value = (const char *) data; - array = nm_ip4_config_get_nis_servers (cfg); - if (array) { - g_print ("IP4 NIS servers:\n"); - for (i = 0; i < array->len; i++) { - tmp = ip4_address_as_string (g_array_index (array, guint32, i)); - g_print ("\t%s\n", tmp); - g_free (tmp); - } - } + g_print (" %s: %s\n", option, value); +} + +static void +dump_dhcp4_config (NMDHCP4Config *config) +{ + GHashTable *options = NULL; + + if (!config) + return; + + g_print ("\nDHCP4 Options:\n"); + g_print ("-------------------------------------\n"); + + g_object_get (G_OBJECT (config), NM_DHCP4_CONFIG_OPTIONS, &options, NULL); + g_hash_table_foreach (options, print_one_dhcp4_option, NULL); } static void @@ -206,6 +218,8 @@ dump_device (NMDevice *device) dump_wired (NM_DEVICE_ETHERNET (device)); else if (NM_IS_DEVICE_WIFI (device)) dump_wireless (NM_DEVICE_WIFI (device)); + + dump_dhcp4_config (nm_device_get_dhcp4_config (device)); } static gboolean @@ -238,7 +252,7 @@ active_connections_changed (NMClient *client, GParamSpec *pspec, gpointer user_d g_print ("Active connections changed:\n"); connections = nm_client_get_active_connections (client); - for (i = 0; i < connections->len; i++) { + for (i = 0; connections && (i < connections->len); i++) { NMActiveConnection *connection; const GPtrArray *devices; @@ -266,7 +280,7 @@ test_get_active_connections (NMClient *client) g_print ("Active connections:\n"); connections = nm_client_get_active_connections (client); - for (i = 0; i < connections->len; i++) { + for (i = 0; connections && (i < connections->len); i++) { const GPtrArray *devices; g_print (" %s\n", nm_object_get_path (g_ptr_array_index (connections, i))); |