cbc: Support mme/bsc sctp/tcp server mode

Related: OS#4945
Change-Id: I9fa4ddfa18ac85644f219874e6b2166e1795e3a9
diff --git a/library/CBSP_Adapter.ttcn b/library/CBSP_Adapter.ttcn
index de89d58..278a2f2 100644
--- a/library/CBSP_Adapter.ttcn
+++ b/library/CBSP_Adapter.ttcn
@@ -77,6 +77,16 @@
 	f_set_tcp_segmentation(idx);
 }
 
+function f_wait_client_connect(integer idx := 0) runs on CBSP_Adapter_CT {
+	var IPL4asp_Types.PortEvent rx_event;
+	CBSP[idx].receive(IPL4asp_Types.PortEvent:{connOpened:=?}) -> value rx_event {
+		log("Connection from ", rx_event.connOpened.remName, ":", rx_event.connOpened.remPort);
+		/* we want to store the client's connId, not the 'bind socket' one */
+		g_cbsp_conn_id[idx] := rx_event.connOpened.connId;
+	}
+	f_set_tcp_segmentation(idx);
+}
+
 function f_cbsp_send(template (value) CBSP_PDU pdu, integer idx := 0) runs on CBSP_Adapter_CT {
 	CBSP[idx].send(ts_CBSP_Send(g_cbsp_conn_id[idx], pdu));
 }