move 'struct value_string' and 'get_value_string()' to gsm_data
This commit is contained in:
parent
5727cf4ea7
commit
ccda96517c
|
@ -3,6 +3,13 @@
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct value_string {
|
||||||
|
unsigned int value;
|
||||||
|
const char *str;
|
||||||
|
};
|
||||||
|
|
||||||
|
const char *get_value_string(const struct value_string *vs, u_int32_t val);
|
||||||
|
|
||||||
enum gsm_band {
|
enum gsm_band {
|
||||||
GSM_BAND_400,
|
GSM_BAND_400,
|
||||||
GSM_BAND_850,
|
GSM_BAND_850,
|
||||||
|
|
|
@ -56,11 +56,6 @@
|
||||||
void *tall_gsms_ctx;
|
void *tall_gsms_ctx;
|
||||||
static u_int32_t new_callref = 0x40000001;
|
static u_int32_t new_callref = 0x40000001;
|
||||||
|
|
||||||
struct value_string {
|
|
||||||
u_int32_t value;
|
|
||||||
const char *str;
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct value_string cp_cause_strs[] = {
|
static const struct value_string cp_cause_strs[] = {
|
||||||
{ GSM411_CP_CAUSE_NET_FAIL, "Network Failure" },
|
{ GSM411_CP_CAUSE_NET_FAIL, "Network Failure" },
|
||||||
{ GSM411_CP_CAUSE_CONGESTION, "Congestion" },
|
{ GSM411_CP_CAUSE_CONGESTION, "Congestion" },
|
||||||
|
@ -104,19 +99,6 @@ static const struct value_string rp_cause_strs[] = {
|
||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *get_value_string(const struct value_string *vs, u_int32_t val)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0;; i++) {
|
|
||||||
if (vs[i].value == 0 && vs[i].str == NULL)
|
|
||||||
break;
|
|
||||||
if (vs[i].value == val)
|
|
||||||
return vs[i].str;
|
|
||||||
}
|
|
||||||
return "unknown";
|
|
||||||
}
|
|
||||||
|
|
||||||
struct gsm_sms *sms_alloc(void)
|
struct gsm_sms *sms_alloc(void)
|
||||||
{
|
{
|
||||||
return talloc_zero(tall_gsms_ctx, struct gsm_sms);
|
return talloc_zero(tall_gsms_ctx, struct gsm_sms);
|
||||||
|
|
|
@ -30,6 +30,19 @@
|
||||||
|
|
||||||
void *tall_bsc_ctx;
|
void *tall_bsc_ctx;
|
||||||
|
|
||||||
|
const char *get_value_string(const struct value_string *vs, u_int32_t val)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0;; i++) {
|
||||||
|
if (vs[i].value == 0 && vs[i].str == NULL)
|
||||||
|
break;
|
||||||
|
if (vs[i].value == val)
|
||||||
|
return vs[i].str;
|
||||||
|
}
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
void set_ts_e1link(struct gsm_bts_trx_ts *ts, u_int8_t e1_nr,
|
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)
|
u_int8_t e1_ts, u_int8_t e1_ts_ss)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue