NetworkManager r4213 - in trunk: . src src/supplicant-manager
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r4213 - in trunk: . src src/supplicant-manager
- Date: Sun, 26 Oct 2008 16:32:30 +0000 (UTC)
Author: dcbw
Date: Sun Oct 26 16:32:29 2008
New Revision: 4213
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4213&view=rev
Log:
2008-10-26 Dan Williams <dcbw redhat com>
* src/supplicant-manager/nm-supplicant-interface.c
src/supplicant-manager/nm-supplicant-interface.h
src/supplicant-manager/nm-supplicant-manager.c
src/supplicant-manager/nm-supplicant-manager.h
- Add state-to-string conversion functions
* src/nm-device-wifi.c
src/nm-device-ethernet.c
- Normalize state info logging and use strings instead of numbers
Modified:
trunk/ChangeLog
trunk/src/nm-device-ethernet.c
trunk/src/nm-device-wifi.c
trunk/src/supplicant-manager/nm-supplicant-interface.c
trunk/src/supplicant-manager/nm-supplicant-interface.h
trunk/src/supplicant-manager/nm-supplicant-manager.c
trunk/src/supplicant-manager/nm-supplicant-manager.h
Modified: trunk/src/nm-device-ethernet.c
==============================================================================
--- trunk/src/nm-device-ethernet.c (original)
+++ trunk/src/nm-device-ethernet.c Sun Oct 26 16:32:29 2008
@@ -858,10 +858,10 @@
guint32 old_state,
gpointer user_data)
{
- nm_info ("(%s) supplicant manager is now in state %d (from %d).",
- nm_device_get_iface (NM_DEVICE (user_data)),
- new_state,
- old_state);
+ nm_info ("(%s): supplicant manager state: %s -> %s",
+ nm_device_get_iface (NM_DEVICE (user_data)),
+ nm_supplicant_manager_state_to_string (old_state),
+ nm_supplicant_manager_state_to_string (new_state));
schedule_state_handler (NM_DEVICE_ETHERNET (user_data),
supplicant_mgr_state_cb_handler,
@@ -943,10 +943,10 @@
gpointer user_data)
{
- nm_info ("(%s) supplicant interface is now in state %d (from %d).",
- nm_device_get_iface (NM_DEVICE (user_data)),
- new_state,
- old_state);
+ nm_info ("(%s): supplicant interface state: %s -> %s",
+ nm_device_get_iface (NM_DEVICE (user_data)),
+ nm_supplicant_interface_state_to_string (old_state),
+ nm_supplicant_interface_state_to_string (new_state));
schedule_state_handler (NM_DEVICE_ETHERNET (user_data),
supplicant_iface_state_cb_handler,
@@ -993,8 +993,10 @@
guint32 old_state,
gpointer user_data)
{
- nm_info ("(%s) Supplicant interface state change: %d -> %d",
- nm_device_get_iface (NM_DEVICE (user_data)), old_state, new_state);
+ nm_info ("(%s) supplicant connection state: %s -> %s",
+ nm_device_get_iface (NM_DEVICE (user_data)),
+ nm_supplicant_interface_connection_state_to_string (old_state),
+ nm_supplicant_interface_connection_state_to_string (new_state));
schedule_state_handler (NM_DEVICE_ETHERNET (user_data),
supplicant_iface_connection_state_cb_handler,
Modified: trunk/src/nm-device-wifi.c
==============================================================================
--- trunk/src/nm-device-wifi.c (original)
+++ trunk/src/nm-device-wifi.c Sun Oct 26 16:32:29 2008
@@ -2191,10 +2191,10 @@
self = task->self;
priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
- nm_info ("(%s): supplicant interface state change: %d -> %d.",
- nm_device_get_iface (NM_DEVICE (self)),
- task->old_state,
- task->new_state);
+ nm_info ("(%s): supplicant interface state: %s -> %s",
+ nm_device_get_iface (NM_DEVICE (self)),
+ nm_supplicant_interface_state_to_string (task->old_state),
+ nm_supplicant_interface_state_to_string (task->new_state));
if (task->new_state == NM_SUPPLICANT_INTERFACE_STATE_READY) {
priv->scan_interval = SCAN_INTERVAL_MIN;
@@ -2243,8 +2243,10 @@
goto out;
}
- nm_info ("(%s): supplicant connection state change: %d -> %d",
- nm_device_get_iface (dev), task->old_state, task->new_state);
+ nm_info ("(%s): supplicant connection state: %s -> %s",
+ nm_device_get_iface (dev),
+ nm_supplicant_interface_connection_state_to_string (task->old_state),
+ nm_supplicant_interface_connection_state_to_string (task->new_state));
priv->scanning = (task->new_state == NM_SUPPLICANT_INTERFACE_CON_STATE_SCANNING);
@@ -2315,9 +2317,10 @@
priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
dev = NM_DEVICE (self);
- nm_info ("(%s): supplicant manager is now in state %d (from %d).",
- nm_device_get_iface (NM_DEVICE (self)),
- task->new_state, task->old_state);
+ nm_info ("(%s): supplicant manager state: %s -> %s",
+ nm_device_get_iface (NM_DEVICE (self)),
+ nm_supplicant_manager_state_to_string (task->old_state),
+ nm_supplicant_manager_state_to_string (task->new_state));
/* If the supplicant went away, release the supplicant interface */
if (task->new_state == NM_SUPPLICANT_MANAGER_STATE_DOWN) {
Modified: trunk/src/supplicant-manager/nm-supplicant-interface.c
==============================================================================
--- trunk/src/supplicant-manager/nm-supplicant-interface.c (original)
+++ trunk/src/supplicant-manager/nm-supplicant-interface.c Sun Oct 26 16:32:29 2008
@@ -1250,3 +1250,48 @@
return NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->con_state;
}
+
+const char *
+nm_supplicant_interface_state_to_string (guint32 state)
+{
+ switch (state) {
+ case NM_SUPPLICANT_INTERFACE_STATE_INIT:
+ return "init";
+ case NM_SUPPLICANT_INTERFACE_STATE_STARTING:
+ return "starting";
+ case NM_SUPPLICANT_INTERFACE_STATE_READY:
+ return "ready";
+ case NM_SUPPLICANT_INTERFACE_STATE_DOWN:
+ return "down";
+ default:
+ break;
+ }
+ return "unknown";
+}
+
+const char *
+nm_supplicant_interface_connection_state_to_string (guint32 state)
+{
+ switch (state) {
+ case NM_SUPPLICANT_INTERFACE_CON_STATE_DISCONNECTED:
+ return "disconnected";
+ case NM_SUPPLICANT_INTERFACE_CON_STATE_INACTIVE:
+ return "inactive";
+ case NM_SUPPLICANT_INTERFACE_CON_STATE_SCANNING:
+ return "scanning";
+ case NM_SUPPLICANT_INTERFACE_CON_STATE_ASSOCIATING:
+ return "associating";
+ case NM_SUPPLICANT_INTERFACE_CON_STATE_ASSOCIATED:
+ return "associated";
+ case NM_SUPPLICANT_INTERFACE_CON_STATE_4WAY_HANDSHAKE:
+ return "4-way handshake";
+ case NM_SUPPLICANT_INTERFACE_CON_STATE_GROUP_HANDSHAKE:
+ return "group handshake";
+ case NM_SUPPLICANT_INTERFACE_CON_STATE_COMPLETED:
+ return "completed";
+ default:
+ break;
+ }
+ return "unknown";
+}
+
Modified: trunk/src/supplicant-manager/nm-supplicant-interface.h
==============================================================================
--- trunk/src/supplicant-manager/nm-supplicant-interface.h (original)
+++ trunk/src/supplicant-manager/nm-supplicant-interface.h Sun Oct 26 16:32:29 2008
@@ -124,6 +124,10 @@
guint32 nm_supplicant_interface_get_connection_state (NMSupplicantInterface * self);
+const char *nm_supplicant_interface_state_to_string (guint32 state);
+
+const char *nm_supplicant_interface_connection_state_to_string (guint32 state);
+
G_END_DECLS
#endif /* NM_SUPPLICANT_INTERFACE_H */
Modified: trunk/src/supplicant-manager/nm-supplicant-manager.c
==============================================================================
--- trunk/src/supplicant-manager/nm-supplicant-manager.c (original)
+++ trunk/src/supplicant-manager/nm-supplicant-manager.c Sun Oct 26 16:32:29 2008
@@ -321,3 +321,19 @@
}
}
}
+
+const char *
+nm_supplicant_manager_state_to_string (guint32 state)
+{
+ switch (state) {
+ case NM_SUPPLICANT_MANAGER_STATE_DOWN:
+ return "down";
+ case NM_SUPPLICANT_MANAGER_STATE_IDLE:
+ return "idle";
+ default:
+ break;
+ }
+ return "unknown";
+}
+
+
Modified: trunk/src/supplicant-manager/nm-supplicant-manager.h
==============================================================================
--- trunk/src/supplicant-manager/nm-supplicant-manager.h (original)
+++ trunk/src/supplicant-manager/nm-supplicant-manager.h Sun Oct 26 16:32:29 2008
@@ -83,4 +83,6 @@
void nm_supplicant_manager_release_iface (NMSupplicantManager * mgr,
NMSupplicantInterface * iface);
+const char *nm_supplicant_manager_state_to_string (guint32 state);
+
#endif /* NM_SUPPLICANT_MANAGER_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]