add 'get_string_value()' as inverse function of 'get_value_string()'
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index af72e47..103466c 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -9,6 +9,7 @@
 };
 
 const char *get_value_string(const struct value_string *vs, u_int32_t val);
+int get_string_value(const struct value_string *vs, const char *str);
 
 enum gsm_band {
 	GSM_BAND_400,
diff --git a/openbsc/src/gsm_data.c b/openbsc/src/gsm_data.c
index e2f56d5..774a1ce 100644
--- a/openbsc/src/gsm_data.c
+++ b/openbsc/src/gsm_data.c
@@ -45,6 +45,19 @@
 	return "unknown";
 }
 
+int get_string_value(const struct value_string *vs, const char *str)
+{
+	int i;
+
+	for (i = 0;; i++) {
+		if (vs[i].value == 0 && vs[i].str == NULL)
+			break;
+		if (!strcasecmp(vs[i].str, str))
+			return vs[i].value;
+	}
+	return -EINVAL;
+}
+
 void set_ts_e1link(struct gsm_bts_trx_ts *ts, u_int8_t e1_nr,
 		   u_int8_t e1_ts, u_int8_t e1_ts_ss)
 {