move gsm_band_name() and gsm_band_parse() to libosmocore

This commit is contained in:
Harald Welte 2010-03-04 10:39:50 +01:00
parent 3c9c5f941d
commit fbc5ca080b
1 changed files with 2 additions and 54 deletions

View File

@ -1,4 +1,4 @@
/* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org>
/* (C) 2008-2010 by Harald Welte <laforge@gnumonks.org>
*
* All Rights Reserved
*
@ -27,6 +27,7 @@
#include <openbsc/gsm_data.h>
#include <osmocore/talloc.h>
#include <osmocore/gsm_utils.h>
#include <openbsc/abis_nm.h>
#include <osmocore/statistics.h>
@ -435,59 +436,6 @@ struct gsm_bts *gsm_bts_by_lac(struct gsm_network *net, unsigned int lac,
return NULL;
}
char *gsm_band_name(enum gsm_band band)
{
switch (band) {
case GSM_BAND_450:
return "GSM450";
case GSM_BAND_480:
return "GSM450";
case GSM_BAND_750:
return "GSM750";
case GSM_BAND_810:
return "GSM810";
case GSM_BAND_850:
return "GSM850";
case GSM_BAND_900:
return "GSM900";
case GSM_BAND_1800:
return "DCS1800";
case GSM_BAND_1900:
return "PCS1900";
}
return "invalid";
}
enum gsm_band gsm_band_parse(const char* mhz)
{
while (*mhz && !isdigit(*mhz))
mhz++;
if (*mhz == '\0')
return -EINVAL;
switch (atoi(mhz)) {
case 450:
return GSM_BAND_450;
case 480:
return GSM_BAND_480;
case 750:
return GSM_BAND_750;
case 810:
return GSM_BAND_810;
case 850:
return GSM_BAND_850;
case 900:
return GSM_BAND_900;
case 1800:
return GSM_BAND_1800;
case 1900:
return GSM_BAND_1900;
default:
return -EINVAL;
}
}
static const char *gsm_auth_policy_names[] = {
[GSM_AUTH_POLICY_CLOSED] = "closed",
[GSM_AUTH_POLICY_ACCEPT_ALL] = "accept-all",