MSC_ConnectionHandler: Fix E1 timeslots to be monotonically incrementing

This commit is contained in:
Harald Welte 2017-11-24 23:53:23 +01:00
parent 8ac9f022d7
commit 66fecd46a8
2 changed files with 8 additions and 8 deletions

View File

@ -15,8 +15,6 @@ import from SDP_Types all;
* There is a 1:1 mapping between SCCP connections and BSSAP_ConnHdlr components.
* We inherit all component variables, ports, functions, ... from BSSAP_ConnHdlr */
type component MSC_ConnHdlr extends BSSAP_ConnHdlr {
/* E1 timeslot that is allocated to this component/connection */
var uint5_t g_e1_timeslot;
/* SCCP Connecction Identifier for the underlying SCCP connection */
var integer g_sccp_conn_id;
@ -36,7 +34,9 @@ runs on BSSMAP_Emulation_CT return BSSAP_ConnHdlr {
/* connect it to the port */
connect(vc_conn:BSSAP, self:CLIENT);
/* start it */
vc_conn.start(MSC_ConnectionHandler.main(conn_ind.connectionId, conn_ind.connectionId));
vc_conn.start(MSC_ConnectionHandler.main(conn_ind.connectionId, g_next_e1_ts));
/* increment next E1 timeslot */
g_next_e1_ts := g_next_e1_ts + 1;
return vc_conn;
}
@ -68,14 +68,12 @@ type enumerated MSC_State {
}
/* main function processing various incoming events */
function main(integer connection_id, integer timeslot) runs on MSC_ConnHdlr {
function main(integer connection_id, integer e1_timeslot) runs on MSC_ConnHdlr {
var MgcpResponse mgcp_rsp;
g_e1_timeslot := 1; /* FIXME */
g_sccp_conn_id := connection_id;
g_call_id := f_mgcp_alloc_call_id();
g_ep_name := hex2str(int2hex(g_e1_timeslot, 1)) & "@mgw";
g_ep_name := hex2str(int2hex(e1_timeslot, 1)) & "@mgw";
while (true) {
var PDU_BSSAP bssap;
@ -84,7 +82,7 @@ function main(integer connection_id, integer timeslot) runs on MSC_ConnHdlr {
[g_state == MSC_STATE_NONE] BSSAP.receive(tr_BSSMAP_ComplL3) -> value bssap {
/* respond with ASSIGNMENT CMD */
g_state := MSC_STATE_WAIT_ASS_COMPL;
BSSAP.send(ts_BSSMAP_AssignmentReq(0, g_e1_timeslot));
BSSAP.send(ts_BSSMAP_AssignmentReq(0, e1_timeslot));
}
[g_state == MSC_STATE_WAIT_ASS_COMPL] BSSAP.receive(tr_BSSMAP_AssignmentComplete) {
/* FIXME: Send MGCP CRCX */

View File

@ -56,6 +56,8 @@ type component BSSMAP_Emulation_CT {
/* use 16 as this is also the number of SCCP connections that SCCP_Emulation can handle */
var ConnectionData ConnectionTable[16];
var integer g_next_e1_ts := 1;
};
private function f_conn_id_known(integer sccp_conn_id)