summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-11-12 19:48:31 +0100
committerdaniel <dwillmann@sysmocom.de>2020-11-16 19:13:26 +0000
commit4d112c926c9981517b26a320ab33e1f3460d4f2e (patch)
tree597985c40174633ab5f795d1a883c1be6649a639 /library
parente582f20aa3018ff133d863807bdc3ffbb255e62c (diff)
BSSGP_Emulation: Allow a "CreateCb" to handle unknown inbound TLLI
The existing BSSGP Code assumed that the TLLIs were always known "a priori" by the test case. With the newly-introduced create_cb, the user can provide a function to handle any incoming messages for an unknown TLLL. The default handler behaves like before: fail + terminate. Change-Id: Ice0e145f5a6518ff79547dd851042b7965f38e00
Diffstat (limited to 'library')
-rw-r--r--library/BSSGP_Emulation.ttcnpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/library/BSSGP_Emulation.ttcnpp b/library/BSSGP_Emulation.ttcnpp
index cb0c82c..63e11f2 100644
--- a/library/BSSGP_Emulation.ttcnpp
+++ b/library/BSSGP_Emulation.ttcnpp
@@ -681,7 +681,8 @@ type record BssgpConfig {
type record BssgpBvcConfig {
BssgpBvci bvci,
BssgpCellId cell_id,
- BssgpDecodeDepth depth
+ BssgpDecodeDepth depth,
+ BssgpCreateCallback create_cb
};
type record of BssgpBvcConfig BssgpBvcConfigs;
type enumerated BssgpDecodeDepth {
@@ -693,6 +694,14 @@ type enumerated BssgpDecodeDepth {
BSSGP_DECODE_DEPTH_L3
#endif
};
+/* call-back function type: Called for inbound BSSGP for unknown TLLIs; could create BSSGP_ClienT_CT */
+type function BssgpCreateCallback(BssgpBvci bvci, BssgpCellId cell_id, OCT4 tlli, BssgpDecoded dec) runs on BSSGP_BVC_CT;
+
+/* Default Create Callback function: Fail and terminate */
+function DefaultCreateCallback(BssgpBvci bvci, BssgpCellId cell_id, OCT4 tlli, BssgpDecoded dec) runs on BSSGP_BVC_CT {
+ setverdict(fail, "Couldn't find Component for TLLI ", tlli);
+ mtc.stop;
+}
/*
private function f_tbl_init() runs on BSSGP_BVC_CT {
@@ -792,8 +801,7 @@ private function f_tbl_comp_by_tlli(OCT4 tlli) runs on BSSGP_BVC_CT return BSSGP
return ClientTable[i].comp_ref;
}
}
- setverdict(fail, "Couldn't find Component for TLLI ", tlli);
- mtc.stop;
+ return null;
}
private function f_tbl_idx_by_comp(BSSGP_Client_CT comp_ref) runs on BSSGP_BVC_CT return integer {
@@ -987,7 +995,11 @@ private altstep as_ptp_unblocked() runs on BSSGP_BVC_CT {
var template OCT4 tlli := f_bssgp_get_tlli(udi.bssgp);
if (isvalue(tlli)) {
vc_conn := f_tbl_comp_by_tlli(valueof(tlli));
- f_send_bssgp_dec(dec, vc_conn, BSSGP_SP);
+ if (vc_conn == null) {
+ g_cfg.create_cb.apply(g_cfg.bvci, g_cfg.cell_id, valueof(tlli), dec);
+ } else {
+ f_send_bssgp_dec(dec, vc_conn, BSSGP_SP);
+ }
} else {
log("No TLLI: Broadcasting ", dec);
/* broadcast this message to all components */
@@ -1006,7 +1018,11 @@ private altstep as_ptp_unblocked() runs on BSSGP_BVC_CT {
var template OCT4 tlli := f_bssgp_get_tlli(udi.bssgp);
if (isvalue(tlli)) {
vc_conn := f_tbl_comp_by_tlli(valueof(tlli));
- f_send_bssgp_dec(dec, vc_conn, BSSGP_SP_SIG);
+ if (vc_conn == null) {
+ g_cfg.create_cb.apply(g_cfg.bvci, g_cfg.cell_id, valueof(tlli), dec);
+ } else {
+ f_send_bssgp_dec(dec, vc_conn, BSSGP_SP_SIG);
+ }
} else {
log("No TLLI: Broadcasting ", dec);
/* broadcast this message to all components */