library/MNCC: implement MNCCv8 encoding/decoding support

Change-Id: I5488c5a4cc671e1d6a0d35b2ff4bdda0b0b48c00
Related: OS#5164, OS#5282
This commit is contained in:
Vadim Yanitskiy 2021-10-28 14:55:58 +03:00
parent f39627432c
commit 9ff4780505
4 changed files with 74 additions and 5 deletions

View File

@ -38,7 +38,7 @@ import from MNCC_Types all;
import from UD_Types all;
modulepar {
int mp_mncc_version := 7;
int mp_mncc_version := 8;
}
/* General "base class" component definition, of which specific implementations

View File

@ -9,7 +9,7 @@ static int mncc_sock_version = MNCC_SOCK_VERSION;
BOOLEAN set__MNCC__version(INTEGER const& version)
{
if (version != 7)
if (version != 7 && version != 8)
return false;
mncc_sock_version = version;
return true;
@ -184,9 +184,19 @@ OCTETSTRING enc__MNCC__PDU(const MNCC__PDU& in)
strncpy(mncc.imsi, in_sig.imsi(), sizeof(mncc.imsi));
mncc.lchan_type = in_sig.lchan__type();
mncc.lchan_mode = in_sig.lchan__mode();
if (in_sig.gcr().is_value()) {
const OCTETSTRING &gcr = in_sig.gcr();
if (mncc_sock_version < 8)
TTCN_error("GCR is only available since MNCCv8");
memcpy(&mncc.v8.gcr[0], gcr, sizeof(mncc.v8.gcr));
mncc.fields |= MNCC_F_GCR;
}
if (in_sig.sdp().is_value()) {
const CHARSTRING &sdp = in_sig.sdp();
strncpy(&mncc.sdp[0], sdp, sizeof(mncc.sdp));
if (mncc_sock_version > 7)
strncpy(&mncc.v8.sdp[0], sdp, sizeof(mncc.v8.sdp));
else
strncpy(&mncc.v7.sdp[0], sdp, sizeof(mncc.v7.sdp));
}
ret_val = OCTETSTRING(sizeof(mncc), (uint8_t *)&mncc);
}
@ -361,7 +371,13 @@ MNCC__PDU dec__MNCC__PDU(const OCTETSTRING& in)
sign.imsi() = CHARSTRING(in_mncc->imsi);
sign.lchan__type() = in_mncc->lchan_type;
sign.lchan__mode() = in_mncc->lchan_mode;
sign.sdp() = in_mncc->sdp;
if (mncc_sock_version > 7) {
if (in_mncc->fields & MNCC_F_GCR)
sign.gcr() = OCTETSTRING(sizeof(in_mncc->v8.gcr), in_mncc->v8.gcr);
sign.sdp() = in_mncc->v8.sdp;
} else {
sign.sdp() = in_mncc->v7.sdp;
}
u.signal() = sign;
break;
}

View File

@ -362,6 +362,7 @@ type record MNCC_PDU_Signal {
uint8_t lchan_type, /* empty in OSmoMSC */
uint8_t lchan_mode, /* empty in OsmoMSC */
octetstring gcr optional,
charstring sdp optional
};
@ -472,6 +473,7 @@ template MNCC_PDU ts_MNCC_SIMPLE(MNCC_MsgType msg_type, uint32_t call_id) := {
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -503,6 +505,7 @@ template MNCC_PDU tr_MNCC_SIMPLE(template MNCC_MsgType msg_type, template uint32
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -537,6 +540,7 @@ template MNCC_PDU ts_MNCC_SETUP_req(uint32_t call_id, charstring called, charstr
imsi := imsi,
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -570,6 +574,7 @@ template MNCC_PDU tr_MNCC_SETUP_req(template uint32_t call_id := ?,
imsi := imsi,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -604,6 +609,7 @@ template MNCC_PDU ts_MNCC_SETUP_rsp(uint32_t call_id, charstring imsi := "",
imsi := imsi,
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -636,6 +642,7 @@ template MNCC_PDU tr_MNCC_SETUP_rsp(template uint32_t call_id,
imsi := imsi,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -670,6 +677,7 @@ template MNCC_PDU tr_MNCC_SETUP_ind(template uint32_t call_id := ?, template MNC
imsi := imsi,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -703,6 +711,7 @@ template (value) MNCC_PDU ts_MNCC_SETUP_ind(uint32_t call_id, MNCC_number called
imsi := imsi,
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -735,6 +744,7 @@ template MNCC_PDU ts_MNCC_SETUP_CNF(uint32_t call_id, template MNCC_number conne
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -767,6 +777,7 @@ template MNCC_PDU tr_MNCC_SETUP_cnf(uint32_t call_id, template MNCC_number conne
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -809,6 +820,7 @@ template MNCC_PDU tr_MNCC_REJ_req(template uint32_t call_id, template MNCC_cause
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -841,6 +853,7 @@ template MNCC_PDU ts_MNCC_REJ_ind(uint32_t call_id, template MNCC_cause cause :=
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -875,6 +888,7 @@ template MNCC_PDU tr_MNCC_CALL_CONF_ind(template uint32_t call_id, template MNCC
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -908,6 +922,7 @@ template MNCC_PDU ts_MNCC_CALL_CONF_ind(uint32_t call_id,
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -944,6 +959,7 @@ template MNCC_PDU ts_MNCC_CALL_PROC_req(uint32_t call_id, template MNCC_bearer_c
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -978,6 +994,7 @@ template MNCC_PDU tr_MNCC_CALL_PROC_req(template uint32_t call_id,
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -1012,6 +1029,7 @@ template MNCC_PDU ts_MNCC_PROGRESS_req(uint32_t call_id, MNCC_progress prog,
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1046,6 +1064,7 @@ template MNCC_PDU ts_MNCC_ALERT_req(uint32_t call_id, template MNCC_progress pro
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1079,6 +1098,7 @@ template MNCC_PDU tr_MNCC_ALERT_req(template uint32_t call_id,
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -1115,6 +1135,7 @@ template MNCC_PDU tr_MNCC_ALERT_ind(template uint32_t call_id, template MNCC_pro
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -1148,6 +1169,7 @@ template (value) MNCC_PDU ts_MNCC_ALERT_ind(uint32_t call_id,
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1181,6 +1203,7 @@ template MNCC_PDU ts_MNCC_NOTIFY_req(uint32_t call_id, MNCC_notify notify) := {
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1213,6 +1236,7 @@ template MNCC_PDU tr_MNCC_NOTIFY_ind(template uint32_t call_id, template MNCC_no
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -1248,6 +1272,7 @@ template MNCC_PDU tr_MNCC_DISC_ind(template uint32_t call_id := ?, template MNCC
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -1281,6 +1306,7 @@ template (value) MNCC_PDU ts_MNCC_DISC_ind(uint32_t call_id, template (value) MN
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1316,6 +1342,7 @@ template MNCC_PDU ts_MNCC_DISC_req(uint32_t call_id, MNCC_cause cause,
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1350,6 +1377,7 @@ template MNCC_PDU tr_MNCC_DISC_req(template uint32_t call_id,
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -1384,6 +1412,7 @@ template MNCC_PDU tr_MNCC_REL_ind(template uint32_t call_id := ?, template MNCC_
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -1417,6 +1446,7 @@ template (value) MNCC_PDU ts_MNCC_REL_ind(uint32_t call_id,
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1450,6 +1480,7 @@ template MNCC_PDU ts_MNCC_REL_req(uint32_t call_id, MNCC_cause cause,
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1481,6 +1512,7 @@ template MNCC_PDU tr_MNCC_REL_req(template uint32_t call_id, template MNCC_cause
imsi := ?,
lchan_type := 0,
lchan_mode := 0,
gcr := *,
sdp := *
}
}
@ -1529,6 +1561,7 @@ template MNCC_PDU ts_MNCC_FACILITY_req(uint32_t call_id, charstring fac) := {
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1561,6 +1594,7 @@ template MNCC_PDU tr_MNCC_FACILITY_ind(template uint32_t call_id := ?, template
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -1593,6 +1627,7 @@ template MNCC_PDU tr_MNCC_START_DTMF_ind(template uint32_t call_id := ?, templat
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -1625,6 +1660,7 @@ template MNCC_PDU ts_MNCC_START_DTMF_rsp(uint32_t call_id, MNCC_keypad keypad) :
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1657,6 +1693,7 @@ template MNCC_PDU ts_MNCC_START_DTMF_rej(uint32_t call_id, MNCC_cause cause) :=
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1697,6 +1734,7 @@ template MNCC_PDU tr_MNCC_MODIFY_ind(template uint32_t call_id := ?, template MN
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -1729,6 +1767,7 @@ template MNCC_PDU ts_MNCC_MODIFY_rsp(uint32_t call_id, MNCC_bearer_cap bcap) :=
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1761,6 +1800,7 @@ template MNCC_PDU ts_MNCC_MODIFY_req(uint32_t call_id, MNCC_bearer_cap bcap) :=
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1794,6 +1834,7 @@ template MNCC_PDU tr_MNCC_MODIFY_cnf(template uint32_t call_id := ?,
imsi := ?,
lchan_type := ?,
lchan_mode := ?,
gcr := *,
sdp := *
}
}
@ -1826,6 +1867,7 @@ template MNCC_PDU ts_MNCC_USERINFO_req(uint32_t call_id, MNCC_useruser uu, integ
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}
@ -1859,6 +1901,7 @@ template MNCC_PDU tr_MNCC_USERINFO_ind(template uint32_t call_id := ?, template
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := *,
sdp := *
}
}
@ -1899,6 +1942,7 @@ template MNCC_PDU ts_MNCC_HOLD_rej(uint32_t call_id, MNCC_cause cause) := {
imsi := "",
lchan_type := 0,
lchan_mode := 0,
gcr := omit,
sdp := omit
}
}

View File

@ -230,6 +230,7 @@ enum {
#define MNCC_F_CCCAP 0x0800
#define MNCC_F_KEYPAD 0x1000
#define MNCC_F_SIGNAL 0x2000
#define MNCC_F_GCR 0x4000
struct gsm_mncc {
/* context based information */
@ -267,7 +268,15 @@ struct gsm_mncc {
unsigned char lchan_type;
unsigned char lchan_mode;
char sdp[1024];
union {
struct {
char sdp[1024];
} v7;
struct {
uint8_t gcr[16];
char sdp[1024];
} v8;
};
};
struct gsm_data_frame {