aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-10-07 04:41:22 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-10-09 16:30:45 +0200
commit26e30b1309517183db0ae56620195707f748ced4 (patch)
tree17e8e86cafeec7f00948a757c824173088a15a5a
parent4b2b0cc15d51d7916a939de06a7e83d8042211dc (diff)
auth: add value_strings for osmo_sub_auth_type, comment on osmo_auth_alg_name()
Add osmo_sub_auth_type_names[] and osmo_sub_auth_type_name(). Also add a hint to enum osmo_auth_algo's API doc that osmo_auth_alg_name() already exists (it is defined further below). Change-Id: I652a929bcd11c694d86812fb03d0a1cbd985efda
-rw-r--r--include/osmocom/crypt/auth.h8
-rw-r--r--src/gsm/auth_core.c7
-rw-r--r--src/gsm/libosmogsm.map1
3 files changed, 15 insertions, 1 deletions
diff --git a/include/osmocom/crypt/auth.h b/include/osmocom/crypt/auth.h
index 2f2a8d33..7064c999 100644
--- a/include/osmocom/crypt/auth.h
+++ b/include/osmocom/crypt/auth.h
@@ -7,6 +7,7 @@
#include <stdint.h>
#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/utils.h>
#define OSMO_A5_MAX_KEY_LEN_BYTES (128/8)
@@ -17,7 +18,12 @@ enum osmo_sub_auth_type {
OSMO_AUTH_TYPE_UMTS = 0x02,
};
-/*! Authentication Algorithm */
+extern const struct value_string osmo_sub_auth_type_names[];
+static inline const char *osmo_sub_auth_type_name(enum osmo_sub_auth_type val)
+{ return get_value_string(osmo_sub_auth_type_names, val); }
+
+/*! Authentication Algorithm.
+ * See also osmo_auth_alg_name() and osmo_auth_alg_parse(). */
enum osmo_auth_algo {
OSMO_AUTH_ALG_NONE,
OSMO_AUTH_ALG_COMP128v1,
diff --git a/src/gsm/auth_core.c b/src/gsm/auth_core.c
index 41566959..738e8609 100644
--- a/src/gsm/auth_core.c
+++ b/src/gsm/auth_core.c
@@ -221,4 +221,11 @@ enum osmo_auth_algo osmo_auth_alg_parse(const char *name)
return get_string_value(auth_alg_vals, name);
}
+const struct value_string osmo_sub_auth_type_names[] = {
+ { OSMO_AUTH_TYPE_NONE, "None" },
+ { OSMO_AUTH_TYPE_GSM, "GSM" },
+ { OSMO_AUTH_TYPE_UMTS, "UMTS" },
+ { 0, NULL }
+};
+
/*! @} */
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index 5598859a..a72db524 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -339,6 +339,7 @@ osmo_auth_3g_from_2g;
osmo_auth_load;
osmo_auth_register;
osmo_auth_supported;
+osmo_sub_auth_type_names;
osmo_rsl2sitype;
osmo_sitype2rsl;