summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/supplicant/nm-supplicant-interface.c43
-rw-r--r--src/supplicant/nm-supplicant-interface.h2
2 files changed, 18 insertions, 27 deletions
diff --git a/src/supplicant/nm-supplicant-interface.c b/src/supplicant/nm-supplicant-interface.c
index d7cb4728a..ca3b09e17 100644
--- a/src/supplicant/nm-supplicant-interface.c
+++ b/src/supplicant/nm-supplicant-interface.c
@@ -198,6 +198,22 @@ NM_UTILS_LOOKUP_STR_DEFINE (nm_supplicant_interface_state_to_string, NMSupplican
NM_UTILS_LOOKUP_STR_ITEM (NM_SUPPLICANT_INTERFACE_STATE_DOWN, "down"),
);
+NM_UTILS_STRING_TABLE_LOOKUP_DEFINE_STATIC (
+ wpas_state_string_to_enum,
+ NMSupplicantInterfaceState,
+ { return NM_SUPPLICANT_INTERFACE_STATE_INVALID; },
+ { "4way_handshake", NM_SUPPLICANT_INTERFACE_STATE_4WAY_HANDSHAKE },
+ { "associated", NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATED },
+ { "associating", NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATING },
+ { "authenticating", NM_SUPPLICANT_INTERFACE_STATE_AUTHENTICATING },
+ { "completed", NM_SUPPLICANT_INTERFACE_STATE_COMPLETED },
+ { "disconnected", NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED },
+ { "group_handshake", NM_SUPPLICANT_INTERFACE_STATE_GROUP_HANDSHAKE },
+ { "inactive", NM_SUPPLICANT_INTERFACE_STATE_INACTIVE },
+ { "interface_disabled", NM_SUPPLICANT_INTERFACE_STATE_DISABLED },
+ { "scanning", NM_SUPPLICANT_INTERFACE_STATE_SCANNING },
+);
+
/*****************************************************************************/
static void
@@ -483,33 +499,6 @@ set_state (NMSupplicantInterface *self, NMSupplicantInterfaceState new_state)
(int) priv->disconnect_reason);
}
-static NMSupplicantInterfaceState
-wpas_state_string_to_enum (const char *str_state)
-{
- if (!strcmp (str_state, "interface_disabled"))
- return NM_SUPPLICANT_INTERFACE_STATE_DISABLED;
- else if (!strcmp (str_state, "disconnected"))
- return NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED;
- else if (!strcmp (str_state, "inactive"))
- return NM_SUPPLICANT_INTERFACE_STATE_INACTIVE;
- else if (!strcmp (str_state, "scanning"))
- return NM_SUPPLICANT_INTERFACE_STATE_SCANNING;
- else if (!strcmp (str_state, "authenticating"))
- return NM_SUPPLICANT_INTERFACE_STATE_AUTHENTICATING;
- else if (!strcmp (str_state, "associating"))
- return NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATING;
- else if (!strcmp (str_state, "associated"))
- return NM_SUPPLICANT_INTERFACE_STATE_ASSOCIATED;
- else if (!strcmp (str_state, "4way_handshake"))
- return NM_SUPPLICANT_INTERFACE_STATE_4WAY_HANDSHAKE;
- else if (!strcmp (str_state, "group_handshake"))
- return NM_SUPPLICANT_INTERFACE_STATE_GROUP_HANDSHAKE;
- else if (!strcmp (str_state, "completed"))
- return NM_SUPPLICANT_INTERFACE_STATE_COMPLETED;
-
- return NM_SUPPLICANT_INTERFACE_STATE_INVALID;
-}
-
static void
set_state_from_string (NMSupplicantInterface *self, const char *new_state)
{
diff --git a/src/supplicant/nm-supplicant-interface.h b/src/supplicant/nm-supplicant-interface.h
index 769863bb9..8056b0d9d 100644
--- a/src/supplicant/nm-supplicant-interface.h
+++ b/src/supplicant/nm-supplicant-interface.h
@@ -20,6 +20,7 @@ typedef enum {
NM_SUPPLICANT_INTERFACE_STATE_INIT = 0,
NM_SUPPLICANT_INTERFACE_STATE_STARTING,
NM_SUPPLICANT_INTERFACE_STATE_READY,
+
NM_SUPPLICANT_INTERFACE_STATE_DISABLED,
NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED,
NM_SUPPLICANT_INTERFACE_STATE_INACTIVE,
@@ -30,6 +31,7 @@ typedef enum {
NM_SUPPLICANT_INTERFACE_STATE_4WAY_HANDSHAKE,
NM_SUPPLICANT_INTERFACE_STATE_GROUP_HANDSHAKE,
NM_SUPPLICANT_INTERFACE_STATE_COMPLETED,
+
NM_SUPPLICANT_INTERFACE_STATE_DOWN,
} NMSupplicantInterfaceState;