From patchwork Wed Mar 30 19:14:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraev X-Patchwork-Id: 603576 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 3qZy5c3VlLz9sC4 for ; Thu, 31 Mar 2016 06:15:16 +1100 (AEDT) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 94EAE1C0CE; Wed, 30 Mar 2016 19:15:11 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from hylle05.itea.ntnu.no (hylle05.itea.ntnu.no [129.241.56.225]) by lists.osmocom.org (Postfix) with ESMTP id 4648D1C0BE for ; Wed, 30 Mar 2016 19:15:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hylle05.itea.ntnu.no (Postfix) with ESMTP id 2C9BD9067B6; Wed, 30 Mar 2016 21:15:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at hylle05.itea.ntnu.no Received: from alumnimail01.it.ntnu.no (unknown [IPv6:2001:700:300:4::54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by hylle05.itea.ntnu.no (Postfix) with ESMTPS id 612FC90674E; Wed, 30 Mar 2016 21:14:58 +0200 (CEST) Received: from localhost (dslb-178-000-217-252.178.000.pools.vodafone-ip.de [178.0.217.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: suraev) by alumnimail01.it.ntnu.no (Postfix) with ESMTPSA id 85AE15E9CA; Wed, 30 Mar 2016 21:14:57 +0200 (CEST) From: suraev@alumni.ntnu.no To: openbsc@lists.osmocom.org Subject: [PATCH] Export names for gsm_chan_t and gsm48_chan_mode Date: Wed, 30 Mar 2016 21:14:53 +0200 Message-Id: <1459365293-18224-1-git-send-email-suraev@alumni.ntnu.no> X-Mailer: git-send-email 2.5.0 X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From: Max This can be used with get_value_string() to improve debugging output. --- include/osmocom/gsm/gsm_utils.h | 3 +++ include/osmocom/gsm/protocol/gsm_04_08.h | 4 ++++ src/gsm/gsm48.c | 26 +++++++++++++++++++++++++- src/gsm/libosmogsm.map | 2 ++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/include/osmocom/gsm/gsm_utils.h b/include/osmocom/gsm/gsm_utils.h index 6458447..99aae65 100644 --- a/include/osmocom/gsm/gsm_utils.h +++ b/include/osmocom/gsm/gsm_utils.h @@ -28,6 +28,7 @@ #include #include +#include #define ADD_MODULO(sum, delta, modulo) do { \ if ((sum += delta) >= modulo) \ @@ -199,6 +200,8 @@ enum gsm_chan_t { _GSM_LCHAN_MAX }; +extern const struct value_string gsm_chan_t_names[]; + /* Deprectated functions */ /* Limit encoding and decoding to use no more than this amount of buffer bytes */ #define GSM_7BIT_LEGACY_MAX_BUFFER_SIZE 0x10000 diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index d49b77f..3282bc1 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -2,6 +2,8 @@ #include +#include + /* GSM TS 04.08 definitions */ struct gsm_lchan; @@ -347,6 +349,8 @@ enum gsm48_chan_mode { GSM48_CMODE_DATA_3k6 = 0x13, }; +extern const struct value_string gsm48_chan_mode_names[]; + /* Chapter 9.1.2 */ struct gsm48_ass_cmd { /* Semantic is from 10.5.2.5a */ diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c index d0a2286..ab62605 100644 --- a/src/gsm/gsm48.c +++ b/src/gsm/gsm48.c @@ -32,7 +32,7 @@ #include #include #include - +#include #include #include @@ -254,6 +254,30 @@ const char *rr_cause_name(uint8_t cause) return get_value_string(rr_cause_names, cause); } +const struct value_string gsm48_chan_mode_names[] = { + { GSM48_CMODE_SIGN, "SIGNALLING" }, + { GSM48_CMODE_SPEECH_V1, "SPEECH_V1" }, + { GSM48_CMODE_SPEECH_EFR, "SPEECH_EFR" }, + { GSM48_CMODE_SPEECH_AMR, "SPEECH_AMR" }, + { GSM48_CMODE_DATA_14k5, "DATA_14k5" }, + { GSM48_CMODE_DATA_12k0, "DATA_12k0" }, + { GSM48_CMODE_DATA_6k0, "DATA_6k0" }, + { GSM48_CMODE_DATA_3k6, "DATA_3k6" }, + { 0, NULL }, +}; + +const struct value_string gsm_chan_t_names[] = { + { GSM_LCHAN_NONE, "NONE" }, + { GSM_LCHAN_SDCCH, "SDCCH" }, + { GSM_LCHAN_TCH_F, "TCH_F" }, + { GSM_LCHAN_TCH_H, "TCH_H" }, + { GSM_LCHAN_UNKNOWN, "UNKNOWN" }, + { GSM_LCHAN_CCCH, "CCCH" }, + { GSM_LCHAN_PDTCH, "PDTCH" }, + { GSM_LCHAN_CBCH, "CBCH" }, + { 0, NULL }, +}; + static const struct value_string mi_type_names[] = { { GSM_MI_TYPE_NONE, "NONE" }, { GSM_MI_TYPE_IMSI, "IMSI" }, diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map index a6908a2..a3e4e14 100644 --- a/src/gsm/libosmogsm.map +++ b/src/gsm/libosmogsm.map @@ -144,6 +144,8 @@ gsm48_rr_att_tlvdef; gsm48_mi_type_name; gsm48_mcc_mnc_to_bcd; gsm48_mcc_mnc_from_bcd; +gsm48_chan_mode_names; +gsm_chan_t_names; gsm_7bit_decode; gsm_7bit_decode_ussd;