summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/shared/libosmocore/.gitignore3
-rw-r--r--src/shared/libosmocore/Makefile.am7
-rw-r--r--src/shared/libosmocore/configure.in10
-rwxr-xr-xsrc/shared/libosmocore/git-version-gen151
-rw-r--r--src/shared/libosmocore/include/osmocore/gsm48.h4
-rw-r--r--src/shared/libosmocore/include/osmocore/msgb.h1
-rw-r--r--src/shared/libosmocore/include/osmocore/rsl.h3
-rw-r--r--src/shared/libosmocore/m4/DUMMY1
-rw-r--r--src/shared/libosmocore/src/gsm48.c164
-rw-r--r--src/shared/libosmocore/src/rsl.c80
-rw-r--r--src/shared/libosmocore/src/utils.c6
11 files changed, 291 insertions, 139 deletions
diff --git a/src/shared/libosmocore/.gitignore b/src/shared/libosmocore/.gitignore
index c292a611..d61cdc58 100644
--- a/src/shared/libosmocore/.gitignore
+++ b/src/shared/libosmocore/.gitignore
@@ -20,3 +20,6 @@ ltmain.sh
install-sh
stamp-h1
libtool
+
+.tarball-version
+.version
diff --git a/src/shared/libosmocore/Makefile.am b/src/shared/libosmocore/Makefile.am
index 8007b745..2adf5023 100644
--- a/src/shared/libosmocore/Makefile.am
+++ b/src/shared/libosmocore/Makefile.am
@@ -1,7 +1,14 @@
AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6
+ACLOCAL_AMFLAGS = -I m4
INCLUDES = $(all_includes) -I$(top_srcdir)/include
SUBDIRS = include src tests
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libosmocore.pc
+
+BUILT_SOURCES = $(top_srcdir)/.version
+$(top_srcdir)/.version:
+ echo $(VERSION) > $@-t && mv $@-t $@
+dist-hook:
+ echo $(VERSION) > $(distdir)/.tarball-version
diff --git a/src/shared/libosmocore/configure.in b/src/shared/libosmocore/configure.in
index abf7bf47..9879ebc0 100644
--- a/src/shared/libosmocore/configure.in
+++ b/src/shared/libosmocore/configure.in
@@ -1,6 +1,8 @@
-AC_INIT
+AC_INIT([libosmocore],
+ m4_esyscmd([./git-version-gen .tarball-version]),
+ [openbsc-devel@lists.openbsc.org])
-AM_INIT_AUTOMAKE(libosmocore, 0.0alpha1)
+AM_INIT_AUTOMAKE([dist-bzip2])
dnl kernel style compile messages
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -9,9 +11,11 @@ dnl checks for programs
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_INSTALL
-AC_PROG_RANLIB
+LT_INIT
AC_PROG_LIBTOOL
+AC_CONFIG_MACRO_DIR([m4])
+
dnl checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS(execinfo.h sys/select.h)
diff --git a/src/shared/libosmocore/git-version-gen b/src/shared/libosmocore/git-version-gen
new file mode 100755
index 00000000..42cf3d2b
--- /dev/null
+++ b/src/shared/libosmocore/git-version-gen
@@ -0,0 +1,151 @@
+#!/bin/sh
+# Print a version string.
+scriptversion=2010-01-28.01
+
+# Copyright (C) 2007-2010 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/.
+# It may be run two ways:
+# - from a git repository in which the "git describe" command below
+# produces useful output (thus requiring at least one signed tag)
+# - from a non-git-repo directory containing a .tarball-version file, which
+# presumes this script is invoked like "./git-version-gen .tarball-version".
+
+# In order to use intra-version strings in your project, you will need two
+# separate generated version string files:
+#
+# .tarball-version - present only in a distribution tarball, and not in
+# a checked-out repository. Created with contents that were learned at
+# the last time autoconf was run, and used by git-version-gen. Must not
+# be present in either $(srcdir) or $(builddir) for git-version-gen to
+# give accurate answers during normal development with a checked out tree,
+# but must be present in a tarball when there is no version control system.
+# Therefore, it cannot be used in any dependencies. GNUmakefile has
+# hooks to force a reconfigure at distribution time to get the value
+# correct, without penalizing normal development with extra reconfigures.
+#
+# .version - present in a checked-out repository and in a distribution
+# tarball. Usable in dependencies, particularly for files that don't
+# want to depend on config.h but do want to track version changes.
+# Delete this file prior to any autoconf run where you want to rebuild
+# files to pick up a version string change; and leave it stale to
+# minimize rebuild time after unrelated changes to configure sources.
+#
+# It is probably wise to add these two files to .gitignore, so that you
+# don't accidentally commit either generated file.
+#
+# Use the following line in your configure.ac, so that $(VERSION) will
+# automatically be up-to-date each time configure is run (and note that
+# since configure.ac no longer includes a version string, Makefile rules
+# should not depend on configure.ac for version updates).
+#
+# AC_INIT([GNU project],
+# m4_esyscmd([build-aux/git-version-gen .tarball-version]),
+# [bug-project@example])
+#
+# Then use the following lines in your Makefile.am, so that .version
+# will be present for dependencies, and so that .tarball-version will
+# exist in distribution tarballs.
+#
+# BUILT_SOURCES = $(top_srcdir)/.version
+# $(top_srcdir)/.version:
+# echo $(VERSION) > $@-t && mv $@-t $@
+# dist-hook:
+# echo $(VERSION) > $(distdir)/.tarball-version
+
+case $# in
+ 1) ;;
+ *) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version"; exit 1;;
+esac
+
+tarball_version_file=$1
+nl='
+'
+
+# First see if there is a tarball-only version file.
+# then try "git describe", then default.
+if test -f $tarball_version_file
+then
+ v=`cat $tarball_version_file` || exit 1
+ case $v in
+ *$nl*) v= ;; # reject multi-line output
+ [0-9]*) ;;
+ *) v= ;;
+ esac
+ test -z "$v" \
+ && echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2
+fi
+
+if test -n "$v"
+then
+ : # use $v
+elif
+ v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \
+ || git describe --abbrev=4 HEAD 2>/dev/null` \
+ && case $v in
+ [0-9]*) ;;
+ v[0-9]*) ;;
+ *) (exit 1) ;;
+ esac
+then
+ # Is this a new git that lists number of commits since the last
+ # tag or the previous older version that did not?
+ # Newer: v6.10-77-g0f8faeb
+ # Older: v6.10-g0f8faeb
+ case $v in
+ *-*-*) : git describe is okay three part flavor ;;
+ *-*)
+ : git describe is older two part flavor
+ # Recreate the number of commits and rewrite such that the
+ # result is the same as if we were using the newer version
+ # of git describe.
+ vtag=`echo "$v" | sed 's/-.*//'`
+ numcommits=`git rev-list "$vtag"..HEAD | wc -l`
+ v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;
+ ;;
+ esac
+
+ # Change the first '-' to a '.', so version-comparing tools work properly.
+ # Remove the "g" in git describe's output string, to save a byte.
+ v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
+else
+ v=UNKNOWN
+fi
+
+v=`echo "$v" |sed 's/^v//'`
+
+# Don't declare a version "dirty" merely because a time stamp has changed.
+git status > /dev/null 2>&1
+
+dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty=
+case "$dirty" in
+ '') ;;
+ *) # Append the suffix only if there isn't one already.
+ case $v in
+ *-dirty) ;;
+ *) v="$v-dirty" ;;
+ esac ;;
+esac
+
+# Omit the trailing newline, so that m4_esyscmd can use the result directly.
+echo "$v" | tr -d '\012'
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/src/shared/libosmocore/include/osmocore/gsm48.h b/src/shared/libosmocore/include/osmocore/gsm48.h
index 787cdd0d..1e963573 100644
--- a/src/shared/libosmocore/include/osmocore/gsm48.h
+++ b/src/shared/libosmocore/include/osmocore/gsm48.h
@@ -5,8 +5,8 @@
#include <osmocore/gsm48_ie.h>
extern const struct tlv_definition gsm48_att_tlvdef;
-extern const char *cc_state_names[32];
-extern const char *gsm48_cc_msg_names[0x40];
+const char *gsm48_cc_state_name(uint8_t state);
+const char *gsm48_cc_msg_name(uint8_t msgtype);
const char *rr_cause_name(uint8_t cause);
void gsm48_generate_lai(struct gsm48_loc_area_id *lai48, uint16_t mcc,
diff --git a/src/shared/libosmocore/include/osmocore/msgb.h b/src/shared/libosmocore/include/osmocore/msgb.h
index 754918e1..31db7194 100644
--- a/src/shared/libosmocore/include/osmocore/msgb.h
+++ b/src/shared/libosmocore/include/osmocore/msgb.h
@@ -46,6 +46,7 @@ struct msgb {
union {
unsigned char *smsh;
unsigned char *llch;
+ unsigned char *l4h;
};
/* the layer 5 header, GPRS: GMM header */
diff --git a/src/shared/libosmocore/include/osmocore/rsl.h b/src/shared/libosmocore/include/osmocore/rsl.h
index c1080812..99b90d68 100644
--- a/src/shared/libosmocore/include/osmocore/rsl.h
+++ b/src/shared/libosmocore/include/osmocore/rsl.h
@@ -16,9 +16,8 @@ uint8_t rsl_enc_chan_nr(uint8_t type, uint8_t subch, uint8_t timeslot);
/* decode channel number as per Section 9.3.1 */
int rsl_dec_chan_nr(uint8_t chan_nr, uint8_t *type, uint8_t *subch, uint8_t *timeslot);
-extern const struct value_string rsl_rlm_cause_strs[];
-
const char *rsl_err_name(uint8_t err);
+const char *rsl_rlm_cause_name(uint8_t err);
/* Section 3.3.2.3 TS 05.02. I think this looks like a table */
int rsl_ccch_conf_to_bs_cc_chans(int ccch_conf);
diff --git a/src/shared/libosmocore/m4/DUMMY b/src/shared/libosmocore/m4/DUMMY
new file mode 100644
index 00000000..fda557ad
--- /dev/null
+++ b/src/shared/libosmocore/m4/DUMMY
@@ -0,0 +1 @@
+Dummply placeholder.
diff --git a/src/shared/libosmocore/src/gsm48.c b/src/shared/libosmocore/src/gsm48.c
index ff989eaf..5761c67b 100644
--- a/src/shared/libosmocore/src/gsm48.c
+++ b/src/shared/libosmocore/src/gsm48.c
@@ -1,7 +1,7 @@
/* GSM Mobile Radio Interface Layer 3 messages
* 3GPP TS 04.08 version 7.21.0 Release 1998 / ETSI TS 100 940 V7.21.0 */
-/* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org>
+/* (C) 2008-2010 by Harald Welte <laforge@gnumonks.org>
* (C) 2008, 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
*
* All Rights Reserved
@@ -75,27 +75,29 @@ const struct tlv_definition gsm48_att_tlvdef = {
},
};
-static const char *rr_cause_names[] = {
- [GSM48_RR_CAUSE_NORMAL] = "Normal event",
- [GSM48_RR_CAUSE_ABNORMAL_UNSPEC] = "Abnormal release, unspecified",
- [GSM48_RR_CAUSE_ABNORMAL_UNACCT] = "Abnormal release, channel unacceptable",
- [GSM48_RR_CAUSE_ABNORMAL_TIMER] = "Abnormal release, timer expired",
- [GSM48_RR_CAUSE_ABNORMAL_NOACT] = "Abnormal release, no activity on radio path",
- [GSM48_RR_CAUSE_PREMPTIVE_REL] = "Preemptive release",
- [GSM48_RR_CAUSE_HNDOVER_IMP] = "Handover impossible, timing advance out of range",
- [GSM48_RR_CAUSE_CHAN_MODE_UNACCT] = "Channel mode unacceptable",
- [GSM48_RR_CAUSE_FREQ_NOT_IMPL] = "Frequency not implemented",
- [GSM48_RR_CAUSE_CALL_CLEARED] = "Call already cleared",
- [GSM48_RR_CAUSE_SEMANT_INCORR] = "Semantically incorrect message",
- [GSM48_RR_CAUSE_INVALID_MAND_INF] = "Invalid mandatory information",
- [GSM48_RR_CAUSE_MSG_TYPE_N] = "Message type non-existant or not implemented",
- [GSM48_RR_CAUSE_MSG_TYPE_N_COMPAT] = "Message type not compatible with protocol state",
- [GSM48_RR_CAUSE_COND_IE_ERROR] = "Conditional IE error",
- [GSM48_RR_CAUSE_NO_CELL_ALLOC_A] = "No cell allocation available",
- [GSM48_RR_CAUSE_PROT_ERROR_UNSPC] = "Protocol error unspecified",
+static const struct value_string rr_cause_names[] = {
+ { GSM48_RR_CAUSE_NORMAL, "Normal event" },
+ { GSM48_RR_CAUSE_ABNORMAL_UNSPEC, "Abnormal release, unspecified" },
+ { GSM48_RR_CAUSE_ABNORMAL_UNACCT, "Abnormal release, channel unacceptable" },
+ { GSM48_RR_CAUSE_ABNORMAL_TIMER, "Abnormal release, timer expired" },
+ { GSM48_RR_CAUSE_ABNORMAL_NOACT, "Abnormal release, no activity on radio path" },
+ { GSM48_RR_CAUSE_PREMPTIVE_REL, "Preemptive release" },
+ { GSM48_RR_CAUSE_HNDOVER_IMP, "Handover impossible, timing advance out of range" },
+ { GSM48_RR_CAUSE_CHAN_MODE_UNACCT, "Channel mode unacceptable" },
+ { GSM48_RR_CAUSE_FREQ_NOT_IMPL, "Frequency not implemented" },
+ { GSM48_RR_CAUSE_CALL_CLEARED, "Call already cleared" },
+ { GSM48_RR_CAUSE_SEMANT_INCORR, "Semantically incorrect message" },
+ { GSM48_RR_CAUSE_INVALID_MAND_INF, "Invalid mandatory information" },
+ { GSM48_RR_CAUSE_MSG_TYPE_N, "Message type non-existant or not implemented" },
+ { GSM48_RR_CAUSE_MSG_TYPE_N_COMPAT, "Message type not compatible with protocol state" },
+ { GSM48_RR_CAUSE_COND_IE_ERROR, "Conditional IE error" },
+ { GSM48_RR_CAUSE_NO_CELL_ALLOC_A, "No cell allocation available" },
+ { GSM48_RR_CAUSE_PROT_ERROR_UNSPC, "Protocol error unspecified" },
+ { 0, NULL },
};
-const char *cc_state_names[32] = {
+/* FIXME: convert to value_string */
+static const char *cc_state_names[32] = {
"NULL",
"INITIATED",
"illegal state 2",
@@ -130,83 +132,61 @@ const char *cc_state_names[32] = {
"illegal state 31",
};
-const char *gsm48_cc_msg_names[0x40] = {
- "unknown 0x00",
- "ALERTING",
- "CALL_PROC",
- "PROGRESS",
- "ESTAB",
- "SETUP",
- "ESTAB_CONF",
- "CONNECT",
- "CALL_CONF",
- "START_CC",
- "unknown 0x0a",
- "RECALL",
- "unknown 0x0c",
- "unknown 0x0d",
- "EMERG_SETUP",
- "CONNECT_ACK",
- "USER_INFO",
- "unknown 0x11",
- "unknown 0x12",
- "MODIFY_REJECT",
- "unknown 0x14",
- "unknown 0x15",
- "unknown 0x16",
- "MODIFY",
- "HOLD",
- "HOLD_ACK",
- "HOLD_REJ",
- "unknown 0x1b",
- "RETR",
- "RETR_ACK",
- "RETR_REJ",
- "MODIFY_COMPL",
- "unknown 0x20",
- "unknown 0x21",
- "unknown 0x22",
- "unknown 0x23",
- "unknown 0x24",
- "DISCONNECT",
- "unknown 0x26",
- "unknown 0x27",
- "unknown 0x28",
- "unknown 0x29",
- "RELEASE_COMPL",
- "unknown 0x2b",
- "unknown 0x2c",
- "RELEASE",
- "unknown 0x2e",
- "unknown 0x2f",
- "unknown 0x30",
- "STOP_DTMF",
- "STOP_DTMF_ACK",
- "unknown 0x33",
- "STATUS_ENQ",
- "START_DTMF",
- "START_DTMF_ACK",
- "START_DTMF_REJ",
- "unknown 0x38",
- "CONG_CTRL",
- "FACILITY",
- "unknown 0x3b",
- "STATUS",
- "unknown 0x3d",
- "NOTIFY",
- "unknown 0x3f",
+const char *gsm48_cc_state_name(uint8_t state)
+{
+ if (state < ARRAY_SIZE(cc_state_names))
+ return cc_state_names[state];
+
+ return "invalid";
+}
+
+static const struct value_string cc_msg_names[] = {
+ { GSM48_MT_CC_ALERTING, "ALERTING" },
+ { GSM48_MT_CC_CALL_PROC, "CALL_PROC" },
+ { GSM48_MT_CC_PROGRESS, "PROGRESS" },
+ { GSM48_MT_CC_ESTAB, "ESTAB" },
+ { GSM48_MT_CC_SETUP, "SETUP" },
+ { GSM48_MT_CC_ESTAB_CONF, "ESTAB_CONF" },
+ { GSM48_MT_CC_CONNECT, "CONNECT" },
+ { GSM48_MT_CC_CALL_CONF, "CALL_CONF" },
+ { GSM48_MT_CC_START_CC, "START_CC" },
+ { GSM48_MT_CC_RECALL, "RECALL" },
+ { GSM48_MT_CC_EMERG_SETUP, "EMERG_SETUP" },
+ { GSM48_MT_CC_CONNECT_ACK, "CONNECT_ACK" },
+ { GSM48_MT_CC_USER_INFO, "USER_INFO" },
+ { GSM48_MT_CC_MODIFY_REJECT, "MODIFY_REJECT" },
+ { GSM48_MT_CC_MODIFY, "MODIFY" },
+ { GSM48_MT_CC_HOLD, "HOLD" },
+ { GSM48_MT_CC_HOLD_ACK, "HOLD_ACK" },
+ { GSM48_MT_CC_HOLD_REJ, "HOLD_REJ" },
+ { GSM48_MT_CC_RETR, "RETR" },
+ { GSM48_MT_CC_RETR_ACK, "RETR_ACK" },
+ { GSM48_MT_CC_RETR_REJ, "RETR_REJ" },
+ { GSM48_MT_CC_MODIFY_COMPL, "MODIFY_COMPL" },
+ { GSM48_MT_CC_DISCONNECT, "DISCONNECT" },
+ { GSM48_MT_CC_RELEASE_COMPL, "RELEASE_COMPL" },
+ { GSM48_MT_CC_RELEASE, "RELEASE" },
+ { GSM48_MT_CC_STOP_DTMF, "STOP_DTMF" },
+ { GSM48_MT_CC_STOP_DTMF_ACK, "STOP_DTMF_ACK" },
+ { GSM48_MT_CC_STATUS_ENQ, "STATUS_ENQ" },
+ { GSM48_MT_CC_START_DTMF, "START_DTMF" },
+ { GSM48_MT_CC_START_DTMF_ACK, "START_DTMF_ACK" },
+ { GSM48_MT_CC_START_DTMF_REJ, "START_DTMF_REJ" },
+ { GSM48_MT_CC_CONG_CTRL, "CONG_CTRL" },
+ { GSM48_MT_CC_FACILITY, "FACILITY" },
+ { GSM48_MT_CC_STATUS, "STATUS" },
+ { GSM48_MT_CC_NOTIFY, "NOTFIY" },
+ { 0, NULL }
};
-static char strbuf[64];
+const char *gsm48_cc_msg_name(uint8_t msgtype)
+{
+ return get_value_string(cc_msg_names, msgtype);
+}
const char *rr_cause_name(uint8_t cause)
{
- if (cause < ARRAY_SIZE(rr_cause_names) &&
- rr_cause_names[cause])
- return rr_cause_names[cause];
-
- snprintf(strbuf, sizeof(strbuf), "0x%02x", cause);
- return strbuf;
+ return get_value_string(rr_cause_names, cause);
}
static void to_bcd(uint8_t *bcd, uint16_t val)
diff --git a/src/shared/libosmocore/src/rsl.c b/src/shared/libosmocore/src/rsl.c
index c864b12f..c002d33e 100644
--- a/src/shared/libosmocore/src/rsl.c
+++ b/src/shared/libosmocore/src/rsl.c
@@ -176,42 +176,47 @@ int rsl_dec_chan_nr(uint8_t chan_nr, uint8_t *type, uint8_t *subch, uint8_t *tim
return 0;
}
-/* FIXME: convert to value_string */
-static const char *rsl_err_vals[0xff] = {
- [RSL_ERR_RADIO_IF_FAIL] = "Radio Interface Failure",
- [RSL_ERR_RADIO_LINK_FAIL] = "Radio Link Failure",
- [RSL_ERR_HANDOVER_ACC_FAIL] = "Handover Access Failure",
- [RSL_ERR_TALKER_ACC_FAIL] = "Talker Access Failure",
- [RSL_ERR_OM_INTERVENTION] = "O&M Intervention",
- [RSL_ERR_NORMAL_UNSPEC] = "Normal event, unspecified",
- [RSL_ERR_T_MSRFPCI_EXP] = "Siemens: T_MSRFPCI Expired",
- [RSL_ERR_EQUIPMENT_FAIL] = "Equipment Failure",
- [RSL_ERR_RR_UNAVAIL] = "Radio Resource not available",
- [RSL_ERR_TERR_CH_FAIL] = "Terrestrial Channel Failure",
- [RSL_ERR_CCCH_OVERLOAD] = "CCCH Overload",
- [RSL_ERR_ACCH_OVERLOAD] = "ACCH Overload",
- [RSL_ERR_PROCESSOR_OVERLOAD] = "Processor Overload",
- [RSL_ERR_RES_UNAVAIL] = "Resource not available, unspecified",
- [RSL_ERR_TRANSC_UNAVAIL] = "Transcoding not available",
- [RSL_ERR_SERV_OPT_UNAVAIL] = "Service or Option not available",
- [RSL_ERR_ENCR_UNIMPL] = "Encryption algorithm not implemented",
- [RSL_ERR_SERV_OPT_UNIMPL] = "Service or Option not implemented",
- [RSL_ERR_RCH_ALR_ACTV_ALLOC] = "Radio channel already activated",
- [RSL_ERR_INVALID_MESSAGE] = "Invalid Message, unspecified",
- [RSL_ERR_MSG_DISCR] = "Message Discriminator Error",
- [RSL_ERR_MSG_TYPE] = "Message Type Error",
- [RSL_ERR_MSG_SEQ] = "Message Sequence Error",
- [RSL_ERR_IE_ERROR] = "General IE error",
- [RSL_ERR_MAND_IE_ERROR] = "Mandatory IE error",
- [RSL_ERR_OPT_IE_ERROR] = "Optional IE error",
- [RSL_ERR_IE_NONEXIST] = "IE non-existent",
- [RSL_ERR_IE_LENGTH] = "IE length error",
- [RSL_ERR_IE_CONTENT] = "IE content error",
- [RSL_ERR_PROTO] = "Protocol error, unspecified",
- [RSL_ERR_INTERWORKING] = "Interworking error, unspecified",
+static const struct value_string rsl_err_vals[] = {
+ { RSL_ERR_RADIO_IF_FAIL, "Radio Interface Failure" },
+ { RSL_ERR_RADIO_LINK_FAIL, "Radio Link Failure" },
+ { RSL_ERR_HANDOVER_ACC_FAIL, "Handover Access Failure" },
+ { RSL_ERR_TALKER_ACC_FAIL, "Talker Access Failure" },
+ { RSL_ERR_OM_INTERVENTION, "O&M Intervention" },
+ { RSL_ERR_NORMAL_UNSPEC, "Normal event, unspecified" },
+ { RSL_ERR_T_MSRFPCI_EXP, "Siemens: T_MSRFPCI Expired" },
+ { RSL_ERR_EQUIPMENT_FAIL, "Equipment Failure" },
+ { RSL_ERR_RR_UNAVAIL, "Radio Resource not available" },
+ { RSL_ERR_TERR_CH_FAIL, "Terrestrial Channel Failure" },
+ { RSL_ERR_CCCH_OVERLOAD, "CCCH Overload" },
+ { RSL_ERR_ACCH_OVERLOAD, "ACCH Overload" },
+ { RSL_ERR_PROCESSOR_OVERLOAD, "Processor Overload" },
+ { RSL_ERR_RES_UNAVAIL, "Resource not available, unspecified" },
+ { RSL_ERR_TRANSC_UNAVAIL, "Transcoding not available" },
+ { RSL_ERR_SERV_OPT_UNAVAIL, "Service or Option not available" },
+ { RSL_ERR_ENCR_UNIMPL, "Encryption algorithm not implemented" },
+ { RSL_ERR_SERV_OPT_UNIMPL, "Service or Option not implemented" },
+ { RSL_ERR_RCH_ALR_ACTV_ALLOC, "Radio channel already activated" },
+ { RSL_ERR_INVALID_MESSAGE, "Invalid Message, unspecified" },
+ { RSL_ERR_MSG_DISCR, "Message Discriminator Error" },
+ { RSL_ERR_MSG_TYPE, "Message Type Error" },
+ { RSL_ERR_MSG_SEQ, "Message Sequence Error" },
+ { RSL_ERR_IE_ERROR, "General IE error" },
+ { RSL_ERR_MAND_IE_ERROR, "Mandatory IE error" },
+ { RSL_ERR_OPT_IE_ERROR, "Optional IE error" },
+ { RSL_ERR_IE_NONEXIST, "IE non-existent" },
+ { RSL_ERR_IE_LENGTH, "IE length error" },
+ { RSL_ERR_IE_CONTENT, "IE content error" },
+ { RSL_ERR_PROTO, "Protocol error, unspecified" },
+ { RSL_ERR_INTERWORKING, "Interworking error, unspecified" },
+ { 0, NULL }
};
-const struct value_string rsl_rlm_cause_strs[] = {
+const char *rsl_err_name(uint8_t err)
+{
+ return get_value_string(rsl_err_vals, err);
+}
+
+static const struct value_string rsl_rlm_cause_strs[] = {
{ RLL_CAUSE_T200_EXPIRED, "Timer T200 expired (N200+1) times" },
{ RLL_CAUSE_REEST_REQ, "Re-establishment request" },
{ RLL_CAUSE_UNSOL_UA_RESP, "Unsolicited UA response" },
@@ -229,12 +234,9 @@ const struct value_string rsl_rlm_cause_strs[] = {
{ 0, NULL },
};
-const char *rsl_err_name(uint8_t err)
+const char *rsl_rlm_cause_name(uint8_t err)
{
- if (rsl_err_vals[err])
- return rsl_err_vals[err];
- else
- return "unknown";
+ return get_value_string(rsl_rlm_cause_strs, err);
}
/* Section 3.3.2.3 TS 05.02. I think this looks like a table */
diff --git a/src/shared/libosmocore/src/utils.c b/src/shared/libosmocore/src/utils.c
index 5efb1747..aca5cf0a 100644
--- a/src/shared/libosmocore/src/utils.c
+++ b/src/shared/libosmocore/src/utils.c
@@ -3,9 +3,11 @@
#include <stdint.h>
#include <errno.h>
#include <stdlib.h>
+#include <stdio.h>
#include <osmocore/utils.h>
+static char namebuf[255];
const char *get_value_string(const struct value_string *vs, uint32_t val)
{
int i;
@@ -16,7 +18,9 @@ const char *get_value_string(const struct value_string *vs, uint32_t val)
if (vs[i].value == val)
return vs[i].str;
}
- return "unknown";
+
+ snprintf(namebuf, sizeof(namebuf), "unknown 0x%x", val);
+ return namebuf;
}
int get_string_value(const struct value_string *vs, const char *str)