fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/35584?usp=email )


Change subject: [WIP] mobile: check Bearer Capability
......................................................................

[WIP] mobile: check Bearer Capability

Change-Id: I6ddbe49f453134d08578e35a015f2fd605705987
---
M src/host/layer23/src/mobile/tch_data.c
1 file changed, 54 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/84/35584/1

diff --git a/src/host/layer23/src/mobile/tch_data.c 
b/src/host/layer23/src/mobile/tch_data.c
index 21ed1c2..995e491 100644
--- a/src/host/layer23/src/mobile/tch_data.c
+++ b/src/host/layer23/src/mobile/tch_data.c
@@ -305,11 +305,56 @@
        return 0;
 }

+static int tch_data_check_bcap(const struct gsm_mncc_bearer_cap *bcap)
+{
+       if (bcap == NULL) {
+               LOGP(DL1C, LOGL_ERROR,
+                    "%s(): CC transaction without BCap\n",
+                    __func__);
+               return -ENODEV;
+       }
+
+       if (bcap->mode != GSM48_BCAP_TMOD_CIRCUIT) {
+               LOGP(DMNCC, LOGL_ERROR,
+                    "%s(): Transfer mode 0x%02x is not supported\n",
+                    __func__, bcap->mode);
+               return -ENOTSUP;
+       }
+       if (bcap->coding != GSM48_BCAP_CODING_GSM_STD) {
+               LOGP(DMNCC, LOGL_ERROR,
+                    "%s(): Coding standard 0x%02x is not supported\n",
+                    __func__, bcap->coding);
+               return -ENOTSUP;
+       }
+
+       switch (bcap->transfer) {
+       case GSM48_BCAP_ITCAP_UNR_DIG_INF:
+       case GSM48_BCAP_ITCAP_3k1_AUDIO:
+               /* XXX: sync/async: bcap->data.async */
+               break;
+       case GSM48_BCAP_ITCAP_FAX_G3:
+               /* XXX: sync, transparent */
+               break;
+       default:
+               LOGP(DMNCC, LOGL_ERROR,
+                    "%s(): Information transfer capability 0x%02x is not 
supported\n",
+                    __func__, bcap->transfer);
+               return -ENOTSUP;
+       }
+
+       return 0;
+}
+
 int tch_data_state_init(struct gsm_trans *trans,
                        struct tch_data_state *state)
 {
        struct osmocom_ms *ms = trans->ms;
        const struct gsm_settings *set = &ms->settings;
+       const struct gsm_mncc_bearer_cap *bcap = trans->cc.bcap;
+       int rc;
+
+       if ((rc = tch_data_check_bcap(bcap)) != 0)
+               return rc;

        switch (state->handler) {
        case TCH_DATA_IOH_UNIX_SOCK:

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35584?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I6ddbe49f453134d08578e35a015f2fd605705987
Gerrit-Change-Number: 35584
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to