summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-12-16 17:54:40 +0100
committerHarald Welte <laforge@gnumonks.org>2017-12-17 11:04:32 +0100
commit004f5fbca3dd61bb5766505aca885abff51457b1 (patch)
tree6a48d999d2a54e06ea9c652597257a27aff842d7
parent05f378a956c6e07e9db8982276bdcf7c25f5e886 (diff)
BSSMAP_Emulation: use BSSAP_CodecPort
So far, BSSMAP_Emulation used the SCCPasp_SP_PORT directly, explicitly calling BSSAP encode/decode functions while processing the primitives. Let's clean this up and use the BSSAP_CodecPort which has meanwhile been developed as a dual-faced port that can be stacked between SCCPasp and the user to avoid any manual encode/decode function calls. Change-Id: Icded789d18f3469f74e16f552df2c7ac44ac4294
-rw-r--r--bsc-nat/BSC_MS_ConnectionHandler.ttcn3
-rw-r--r--bsc-nat/BSC_MS_Simulation.ttcn3
-rw-r--r--bsc-nat/MSC_ConnectionHandler.ttcn3
-rwxr-xr-xbsc-nat/MSC_Simulation.ttcn2
-rwxr-xr-xbsc-nat/gen_links.sh2
-rw-r--r--bsc/MSC_ConnectionHandler.ttcn3
-rw-r--r--library/BSSMAP_Emulation.ttcn55
7 files changed, 35 insertions, 36 deletions
diff --git a/bsc-nat/BSC_MS_ConnectionHandler.ttcn b/bsc-nat/BSC_MS_ConnectionHandler.ttcn
index a3855253..876d2ec1 100644
--- a/bsc-nat/BSC_MS_ConnectionHandler.ttcn
+++ b/bsc-nat/BSC_MS_ConnectionHandler.ttcn
@@ -4,6 +4,7 @@ import from General_Types all;
import from Osmocom_Types all;
import from SCCPasp_Types all;
import from BSSAP_Types all;
+import from BSSAP_CodecPort all;
import from BSSMAP_Emulation all;
import from BSSMAP_Templates all;
@@ -28,7 +29,7 @@ type component BSC_MS_ConnHdlr extends BSSAP_ConnHdlr {
/* Callback function from general BSSMAP_Emulation whenever a new incoming
* SCCP connection arrivces. Must create + start a new component */
-private function CreateCallback(ASP_SCCP_N_CONNECT_ind conn_ind, charstring id)
+private function CreateCallback(BSSAP_N_CONNECT_ind conn_ind, charstring id)
runs on BSSMAP_Emulation_CT return BSSAP_ConnHdlr {
log("Incoming SCCP Connection on BSC ?!?");
self.stop;
diff --git a/bsc-nat/BSC_MS_Simulation.ttcn b/bsc-nat/BSC_MS_Simulation.ttcn
index eab7fe9d..b9414a3b 100644
--- a/bsc-nat/BSC_MS_Simulation.ttcn
+++ b/bsc-nat/BSC_MS_Simulation.ttcn
@@ -8,6 +8,7 @@ import from SCCP_Types all;
import from SCCPasp_Types all;
import from SCCP_Emulation all;
+import from BSSAP_CodecPort all;
import from BSSMAP_Emulation all;
import from BSC_MS_ConnectionHandler all;
@@ -53,7 +54,7 @@ function main(charstring remote_ip, PortNumber remote_port,
connect(vc_IPA:MTP3_SP_PORT, vc_SCCP:MTP3_SCCP_PORT);
/* connect BSSMAP dispatcher to upper side of SCCP */
- connect(vc_BSSMAP:SCCP, vc_SCCP:SCCP_SP_PORT);
+ connect(vc_BSSMAP:BSSAP, vc_SCCP:SCCP_SP_PORT);
/* connect BSSMAP dispatcher to IPA_Emulation MGCP */
connect(vc_BSSMAP:MGCP, vc_IPA:IPA_MGCP_PORT);
diff --git a/bsc-nat/MSC_ConnectionHandler.ttcn b/bsc-nat/MSC_ConnectionHandler.ttcn
index 3fc11e9b..b038ce5b 100644
--- a/bsc-nat/MSC_ConnectionHandler.ttcn
+++ b/bsc-nat/MSC_ConnectionHandler.ttcn
@@ -4,6 +4,7 @@ import from General_Types all;
import from Osmocom_Types all;
import from SCCPasp_Types all;
import from BSSAP_Types all;
+import from BSSAP_CodecPort all;
import from BSSMAP_Emulation all;
import from BSSMAP_Templates all;
@@ -26,7 +27,7 @@ type component MSC_ConnHdlr extends BSSAP_ConnHdlr {
/* Callback function from general BSSMAP_Emulation whenever a new incoming
* SCCP connection arrivces. Must create + start a new component */
-private function CreateCallback(ASP_SCCP_N_CONNECT_ind conn_ind, charstring id)
+private function CreateCallback(BSSAP_N_CONNECT_ind conn_ind, charstring id)
runs on BSSMAP_Emulation_CT return BSSAP_ConnHdlr {
var MSC_ConnHdlr vc_conn;
/* Create a new BSSAP_ConnHdlr component */
diff --git a/bsc-nat/MSC_Simulation.ttcn b/bsc-nat/MSC_Simulation.ttcn
index f9fb0d42..7e39ca13 100755
--- a/bsc-nat/MSC_Simulation.ttcn
+++ b/bsc-nat/MSC_Simulation.ttcn
@@ -51,7 +51,7 @@ function main(charstring local_ip, PortNumber local_port,
connect(vc_IPA:MTP3_SP_PORT, vc_SCCP:MTP3_SCCP_PORT);
/* connect BSSNAP dispatcher to upper side of SCCP */
- connect(vc_BSSMAP:SCCP, vc_SCCP:SCCP_SP_PORT);
+ connect(vc_BSSMAP:BSSAP, vc_SCCP:SCCP_SP_PORT);
if (mp_mgcp_uses_udp == false) {
/* connect BSSMAP dispatcher to IPA_Emulation MGCP */
diff --git a/bsc-nat/gen_links.sh b/bsc-nat/gen_links.sh
index 9846d9a3..9a45c890 100755
--- a/bsc-nat/gen_links.sh
+++ b/bsc-nat/gen_links.sh
@@ -55,5 +55,5 @@ FILES="RTP_EncDec.cc RTP_Types.ttcn"
gen_links $DIR $FILES
DIR=../library
-FILES="General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcn L3_Templates.ttcn BSSMAP_Templates.ttcn BSSMAP_Emulation.ttcn MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc RSL_Types.ttcn Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn"
+FILES="General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcn L3_Templates.ttcn BSSMAP_Templates.ttcn BSSMAP_Emulation.ttcn MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc RSL_Types.ttcn Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn BSSAP_CodecPort.ttcn"
gen_links $DIR $FILES
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 8fa71fba..f47417ff 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -4,6 +4,7 @@ import from General_Types all;
import from Osmocom_Types all;
import from SCCPasp_Types all;
import from BSSAP_Types all;
+import from BSSAP_CodecPort all;
import from BSSMAP_Emulation all;
import from BSSMAP_Templates all;
@@ -26,7 +27,7 @@ type component MSC_ConnHdlr extends BSSAP_ConnHdlr {
/* Callback function from general BSSMAP_Emulation whenever a new incoming
* SCCP connection arrivces. Must create + start a new component */
-private function CreateCallback(ASP_SCCP_N_CONNECT_ind conn_ind, charstring id)
+private function CreateCallback(BSSAP_N_CONNECT_ind conn_ind, charstring id)
runs on BSSMAP_Emulation_CT return BSSAP_ConnHdlr {
var MSC_ConnHdlr vc_conn;
/* Create a new BSSAP_ConnHdlr component */
diff --git a/library/BSSMAP_Emulation.ttcn b/library/BSSMAP_Emulation.ttcn
index 42f7739c..14bf238b 100644
--- a/library/BSSMAP_Emulation.ttcn
+++ b/library/BSSMAP_Emulation.ttcn
@@ -3,6 +3,7 @@ module BSSMAP_Emulation {
import from SCCP_Emulation all;
import from SCCPasp_Types all;
import from BSSAP_Types all;
+import from BSSAP_CodecPort all;
import from BSSMAP_Templates all;
import from MGCP_Types all;
import from MGCP_Templates all;
@@ -48,7 +49,7 @@ type record ConnectionData {
type component BSSMAP_Emulation_CT {
/* SCCP port on the bottom side, using ASP primitives */
- port SCCPasp_PT SCCP;
+ port BSSAP_CODEC_PT BSSAP;
/* BSSAP port to the per-connection clients */
port BSSAP_Conn_PT CLIENT;
/* MGCP port */
@@ -228,10 +229,9 @@ runs on BSSMAP_Emulation_CT {
}
/* handle (optional) userData portion of various primitives and dispatch it to the client */
-private function f_handle_userData(BSSAP_ConnHdlr client, octetstring userdata)
+private function f_handle_userData(BSSAP_ConnHdlr client, PDU_BSSAP bssap)
runs on BSSMAP_Emulation_CT {
/* decode + send decoded BSSAP to client */
- var PDU_BSSAP bssap := dec_PDU_BSSAP(valueof(userdata));
/* BSC Side: If this is an assignment command, store CIC */
if (ischosen(bssap.pdu.bssmap.assignmentRequest) and
@@ -247,7 +247,7 @@ runs on BSSMAP_Emulation_CT {
/* call-back type, to be provided by specific implementation; called when new SCCP connection
* arrives */
-type function BssmapCreateCallback(ASP_SCCP_N_CONNECT_ind conn_ind, charstring id)
+type function BssmapCreateCallback(BSSAP_N_CONNECT_ind conn_ind, charstring id)
runs on BSSMAP_Emulation_CT return BSSAP_ConnHdlr;
type function BssmapUnitdataCallback(PDU_BSSAP bssap)
@@ -264,11 +264,11 @@ function main(BssmapOps ops, charstring id) runs on BSSMAP_Emulation_CT {
f_conn_table_init();
while (true) {
- var ASP_SCCP_N_UNITDATA_ind ud_ind;
- var ASP_SCCP_N_CONNECT_ind conn_ind;
- var ASP_SCCP_N_CONNECT_cfm conn_cfm;
- var ASP_SCCP_N_DATA_ind data_ind;
- var ASP_SCCP_N_DISCONNECT_ind disc_ind;
+ var BSSAP_N_UNITDATA_ind ud_ind;
+ var BSSAP_N_CONNECT_ind conn_ind;
+ var BSSAP_N_CONNECT_cfm conn_cfm;
+ var BSSAP_N_DATA_ind data_ind;
+ var BSSAP_N_DISCONNECT_ind disc_ind;
var BSSAP_Conn_Req creq;
var BSSAP_ConnHdlr vc_conn;
var PDU_BSSAP bssap;
@@ -277,32 +277,29 @@ function main(BssmapOps ops, charstring id) runs on BSSMAP_Emulation_CT {
alt {
/* SCCP -> Client: UNIT-DATA (connectionless SCCP) from a BSC */
- [] SCCP.receive(ASP_SCCP_N_UNITDATA_ind:?) -> value ud_ind {
+ [] BSSAP.receive(BSSAP_N_UNITDATA_ind:?) -> value ud_ind {
/* Connectionless Procedures like RESET */
var template PDU_BSSAP resp;
- bssap := dec_PDU_BSSAP(ud_ind.userData);
- resp := ops.unitdata_cb.apply(bssap);
+ resp := ops.unitdata_cb.apply(ud_ind.userData);
if (isvalue(resp)) {
- var octetstring resp_ud := enc_PDU_BSSAP(valueof(resp));
- SCCP.send(t_ASP_N_UNITDATA_req(ud_ind.callingAddress,
- ud_ind.calledAddress, omit,
- omit, resp_ud, omit));
+ BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress,
+ ud_ind.calledAddress, resp));
}
}
/* SCCP -> Client: new connection from BSC */
- [] SCCP.receive(ASP_SCCP_N_CONNECT_ind:?) -> value conn_ind {
+ [] BSSAP.receive(BSSAP_N_CONNECT_ind:?) -> value conn_ind {
vc_conn := ops.create_cb.apply(conn_ind, id);
/* store mapping between client components and SCCP connectionId */
f_conn_table_add(vc_conn, conn_ind.connectionId);
/* handle user payload */
f_handle_userData(vc_conn, conn_ind.userData);
/* confirm connection establishment */
- SCCP.send(t_ASP_N_CONNECT_res(omit, omit, omit, omit, conn_ind.connectionId, omit));
+ BSSAP.send(ts_BSSAP_CONNECT_res(conn_ind.connectionId, omit));
}
/* SCCP -> Client: connection-oriented data in existing connection */
- [] SCCP.receive(ASP_SCCP_N_DATA_ind:?) -> value data_ind {
+ [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value data_ind {
vc_conn := f_comp_by_conn_id(data_ind.connectionId);
if (ispresent(data_ind.userData)) {
f_handle_userData(vc_conn, data_ind.userData);
@@ -310,7 +307,7 @@ function main(BssmapOps ops, charstring id) runs on BSSMAP_Emulation_CT {
}
/* SCCP -> Client: disconnect of an existing connection */
- [] SCCP.receive(ASP_SCCP_N_DISCONNECT_ind:?) -> value disc_ind {
+ [] BSSAP.receive(BSSAP_N_DISCONNECT_ind:?) -> value disc_ind {
vc_conn := f_comp_by_conn_id(disc_ind.connectionId);
if (ispresent(disc_ind.userData)) {
f_handle_userData(vc_conn, disc_ind.userData);
@@ -323,7 +320,7 @@ function main(BssmapOps ops, charstring id) runs on BSSMAP_Emulation_CT {
}
/* SCCP -> Client: connection confirm for outbound connection */
- [] SCCP.receive(ASP_SCCP_N_CONNECT_cfm:?) -> value conn_cfm {
+ [] BSSAP.receive(BSSAP_N_CONNECT_cfm:?) -> value conn_cfm {
/* handle user payload */
if (ispresent(conn_cfm.userData)) {
f_handle_userData(vc_conn, conn_cfm.userData);
@@ -333,15 +330,14 @@ function main(BssmapOps ops, charstring id) runs on BSSMAP_Emulation_CT {
/* Disconnect request client -> SCCP */
[] CLIENT.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_REQ) -> sender vc_conn {
var integer conn_id := f_conn_id_by_comp(vc_conn);
- SCCP.send(t_ASP_N_DISCONNECT_req(omit, 0, omit, conn_id, omit));
+ BSSAP.send(ts_BSSAP_DISC_req(conn_id, 0));
f_conn_table_del(conn_id);
}
/* BSSAP from client -> SCCP */
[] CLIENT.receive(BSSAP_Conn_Req:?) -> value creq sender vc_conn {
var integer conn_id;
- /* encode + send to dispatcher */
- var octetstring userdata := enc_PDU_BSSAP(creq.bssap);
+ /* send to dispatcher */
if (f_comp_known(vc_conn) == false) {
/* unknown client, create new connection */
@@ -350,21 +346,20 @@ function main(BssmapOps ops, charstring id) runs on BSSMAP_Emulation_CT {
/* store mapping between client components and SCCP connectionId */
f_conn_table_add(vc_conn, conn_id);
- SCCP.send(t_ASP_N_CONNECT_req(creq.addr_peer, creq.addr_own, omit, omit,
- userdata, conn_id, omit));
+ BSSAP.send(ts_BSSAP_CONNECT_req(creq.addr_peer, creq.addr_own, conn_id,
+ creq.bssap));
} else {
/* known client, send via existing connection */
conn_id := f_conn_id_by_comp(vc_conn);
- SCCP.send(t_ASP_N_DATA_req(userdata, conn_id, omit));
+ BSSAP.send(ts_BSSAP_DATA_req(conn_id, creq.bssap));
}
}
[] CLIENT.receive(PDU_BSSAP:?) -> value bssap sender vc_conn {
var integer conn_id := f_conn_id_by_comp(vc_conn);
- /* encode + send it to dispatcher */
- var octetstring userdata := enc_PDU_BSSAP(bssap);
- SCCP.send(t_ASP_N_DATA_req(userdata, conn_id, omit));
+ /* send it to dispatcher */
+ BSSAP.send(ts_BSSAP_DATA_req(conn_id, bssap));
}
/* Handling of MGCP in IPA SCCPLite case. This predates 3GPP AoIP