aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-08-24 15:21:35 +0200
committerHarald Welte <laforge@gnumonks.org>2012-08-24 15:38:15 +0200
commit60f9ba3bb929b766d9949f75f8052ec270ce3713 (patch)
tree0f4f18573229904fbc33215a8a0338f3f11db381
parent0f89de4be86a4978b4a6fb6681b9340fd5a345ea (diff)
reimplement chan_compat_with_mode() to take care of CSD
-rw-r--r--openbsc/src/libbsc/bsc_api.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c
index f660be906..e0ba6063f 100644
--- a/openbsc/src/libbsc/bsc_api.c
+++ b/openbsc/src/libbsc/bsc_api.c
@@ -313,19 +313,44 @@ int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn,
/*
* \brief Check if the given channel is compatible with the mode/fullrate
- *
- * NOTE: This code is only written with TCH/F and TCH/H in mind. This means
- * that it will not work for CSD, handover, etc. This also assumes that the
- * type of the lchan is either a TCH or a SDCCH.
*/
static int chan_compat_with_mode(struct gsm_lchan *lchan, int chan_mode, int full_rate)
{
- if (lchan->type == GSM_LCHAN_SDCCH)
- return 0;
- if (full_rate && lchan->type != GSM_LCHAN_TCH_F)
- return 0;
+ switch (chan_mode) {
+ case GSM48_CMODE_SIGN:
+ /* signalling is always possible */
+ return 1;
+ case GSM48_CMODE_SPEECH_V1:
+ case GSM48_CMODE_SPEECH_AMR:
+ case GSM48_CMODE_DATA_3k6:
+ case GSM48_CMODE_DATA_6k0:
+ /* these services can all run on TCH/H, but we may have
+ * an explicit override by the 'full_rate' argument */
+ switch (lchan->type) {
+ case GSM_LCHAN_TCH_F:
+ return 1;
+ case GSM_LCHAN_TCH_H:
+ if (full_rate)
+ return 0;
+ else
+ return 1;
+ break;
+ default:
+ return 0;
+ }
+ break;
+ case GSM48_CMODE_DATA_12k0:
+ case GSM48_CMODE_DATA_14k5:
+ case GSM48_CMODE_SPEECH_EFR:
+ /* these services all explicitly require a TCH/F */
+ if (lchan->type == GSM_LCHAN_TCH_F)
+ return 1;
+ else
+ return 0;
+ break;
+ }
- return 1;
+ return 0;
}
/**