wimax: log connection progress information
authorDan Williams <dcbw@redhat.com>
Wed, 21 Sep 2011 05:30:51 +0000 (00:30 -0500)
committerDan Williams <dcbw@redhat.com>
Wed, 21 Sep 2011 05:30:51 +0000 (00:30 -0500)
We don't do anything with it yet, but it's nice to know for debugging.

src/wimax/iwmxsdk.c
src/wimax/iwmxsdk.h
src/wimax/nm-device-wimax.c

index dd78d5a..ff6b553 100644 (file)
@@ -190,6 +190,7 @@ typedef struct {
        WIMAX_API_DEVICE_STATUS new_status;
        WIMAX_API_DEVICE_STATUS old_status;
        WIMAX_API_STATUS_REASON reason;
+       WIMAX_API_CONNECTION_PROGRESS_INFO progress;
 } StateChangeInfo;
 
 static gboolean
@@ -202,6 +203,7 @@ state_change_handler(gpointer user_data)
                                              info->new_status,
                                              info->old_status,
                                              info->reason,
+                                             info->progress,
                                              info->wmxsdk->callback_data);
        }
        wmxsdk_unref(info->wmxsdk);
@@ -214,7 +216,8 @@ static void
 _schedule_state_change(struct wmxsdk *wmxsdk,
                        WIMAX_API_DEVICE_STATUS new_status,
                        WIMAX_API_DEVICE_STATUS old_status,
-                       WIMAX_API_STATUS_REASON reason)
+                       WIMAX_API_STATUS_REASON reason,
+                       WIMAX_API_CONNECTION_PROGRESS_INFO progress)
 {
        StateChangeInfo *info;
 
@@ -227,6 +230,7 @@ _schedule_state_change(struct wmxsdk *wmxsdk,
        info->new_status = new_status;
        info->old_status = old_status;
        info->reason = reason;
+       info->progress = progress;
 
        wmxsdk_ref(wmxsdk);
        g_idle_add(state_change_handler, info);
@@ -476,6 +480,48 @@ const char *iwmx_sdk_media_status_to_str(WIMAX_API_MEDIA_STATUS status)
        }
 }
 
+const char *
+iwmx_sdk_con_progress_to_str(WIMAX_API_CONNECTION_PROGRESS_INFO progress)
+{
+       switch (progress) {
+
+       /**< Device is in Ranging */
+       case WIMAX_API_DEVICE_CONNECTION_PROGRESS_Ranging:
+               return "ranging";
+
+       /**< Device is in SBC */
+       case WIMAX_API_DEVICE_CONNECTION_PROGRESS_SBC:
+               return "sbc";
+
+       /**< Device is in EAP authentication Device */
+       case WIMAX_API_DEVICE_CONNECTION_PROGRESS_EAP_authentication_Device:
+               return "eap-auth-device";
+
+       /**< Device is in EAP authentication User */
+       case WIMAX_API_DEVICE_CONNECTION_PROGRESS_EAP_authentication_User:
+               return "eap-auth-user";
+
+       /**< Device is in 3-way-handshake */
+       case WIMAX_API_DEVICE_CONNECTION_PROGRESS_3_way_handshake:
+               return "3way-handshake";
+
+       /**< Device is in Registration */
+       case WIMAX_API_DEVICE_CONNECTION_PROGRESS_Registration:
+               return "registration";
+
+       /**< Device is in De-registration */
+       case WIMAX_API_DEVICE_CONNECTION_PROGRESS_De_registration:
+               return "deregistration";
+
+       /**< Device is registered (operational) */
+       case WIMAX_API_DEVICE_CONNECTION_PROGRESS_Registered:
+               return "registered";
+
+       default:
+               return "unknown";
+       }
+}
+
 /*
  * Get the device's status from the device
  *
@@ -982,7 +1028,7 @@ static void __iwmx_sdk_state_change_cb(WIMAX_API_DEVICE_ID *device_id,
        wmxsdk->status = status;
        g_mutex_unlock(wmxsdk->status_mutex);
 
-       _schedule_state_change(wmxsdk, status, old_status, reason);
+       _schedule_state_change(wmxsdk, status, old_status, reason, pi);
 }
 
 /*
@@ -1170,7 +1216,8 @@ static int iwmx_sdk_setup(struct wmxsdk *wmxsdk)
        _schedule_state_change(wmxsdk,
                               status,
                               WIMAX_API_DEVICE_STATUS_UnInitialized,
-                              WIMAX_API_STATUS_REASON_Normal);
+                              WIMAX_API_STATUS_REASON_Normal,
+                              WIMAX_API_DEVICE_CONNECTION_PROGRESS_Ranging);
 
        return 0;
 
index bd55679..1888b70 100644 (file)
@@ -34,6 +34,7 @@ typedef void (*WimaxStateChangeFunc) (struct wmxsdk *wmxsdk,
                                       WIMAX_API_DEVICE_STATUS new_status,
                                       WIMAX_API_DEVICE_STATUS old_status,
                                       WIMAX_API_STATUS_REASON reason,
+                                      WIMAX_API_CONNECTION_PROGRESS_INFO info,
                                       void *user_data);
 
 typedef void (*WimaxMediaStatusFunc) (struct wmxsdk *wmxsdk,
@@ -101,6 +102,7 @@ WIMAX_API_LINK_STATUS_INFO_EX *iwmx_sdk_get_link_status_info(struct wmxsdk *wmxs
 const char *iwmx_sdk_dev_status_to_str(WIMAX_API_DEVICE_STATUS status);
 const char *iwmx_sdk_reason_to_str(WIMAX_API_STATUS_REASON reason);
 const char *iwmx_sdk_media_status_to_str(WIMAX_API_MEDIA_STATUS status);
+const char *iwmx_sdk_con_progress_to_str(WIMAX_API_CONNECTION_PROGRESS_INFO progress);
 int iwmx_sdk_rf_state_set(struct wmxsdk *wmxsdk, WIMAX_API_RF_STATE rf_state);
 int iwmx_sdk_get_networks(struct wmxsdk *wmxsdk);
 int iwmx_sdk_api_init(void);
index 78651c3..b6afc27 100644 (file)
@@ -856,6 +856,7 @@ wmx_state_change_cb (struct wmxsdk *wmxsdk,
                      WIMAX_API_DEVICE_STATUS new_status,
                      WIMAX_API_DEVICE_STATUS old_status,
                      WIMAX_API_STATUS_REASON reason,
+                     WIMAX_API_CONNECTION_PROGRESS_INFO progress,
                      void *user_data)
 {
        NMDeviceWimax *self = NM_DEVICE_WIMAX (user_data);
@@ -865,10 +866,17 @@ wmx_state_change_cb (struct wmxsdk *wmxsdk,
        gboolean old_available = FALSE;
        const char *nsp_name = NULL;
 
+       iface = nm_device_get_iface (NM_DEVICE (self));
+       nm_log_info (LOGD_WIMAX, "(%s): wimax state change %s -> %s (%s (%d))",
+                    iface,
+                    iwmx_sdk_dev_status_to_str (old_status),
+                    iwmx_sdk_dev_status_to_str (new_status),
+                    iwmx_sdk_con_progress_to_str (progress),
+                    progress);
+
        if (new_status == old_status)
                return;
 
-       iface = nm_device_get_iface (NM_DEVICE (self));
        state = nm_device_interface_get_state (NM_DEVICE_INTERFACE (self));
        old_available = nm_device_is_available (NM_DEVICE (self));
 
@@ -876,12 +884,6 @@ wmx_state_change_cb (struct wmxsdk *wmxsdk,
        if (priv->current_nsp)
                nsp_name = nm_wimax_nsp_get_name (priv->current_nsp);
 
-       nm_log_info (LOGD_WIMAX, "(%s): wimax state change %s -> %s (reason %d)",
-                    iface,
-                    iwmx_sdk_dev_status_to_str (old_status),
-                    iwmx_sdk_dev_status_to_str (new_status),
-                    reason);
-
        switch (new_status) {
        case WIMAX_API_DEVICE_STATUS_UnInitialized:
        case WIMAX_API_DEVICE_STATUS_RF_OFF_HW_SW: