summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-05-24 22:26:54 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-05-26 18:00:26 +0700
commit11edf3cdba833960e9e08c5082e4e87431186be6 (patch)
treeba618c70666280032660c5baec0674f8cc5e269f /library
parent40ee56cbac9cac1c774224e20bd970d5c26a8d87 (diff)
library/IPA_Emulation: server mode: expose IPA IDENTITY RESPONSE
Diffstat (limited to 'library')
-rw-r--r--library/IPA_Emulation.ttcnpp39
1 files changed, 33 insertions, 6 deletions
diff --git a/library/IPA_Emulation.ttcnpp b/library/IPA_Emulation.ttcnpp
index 3762449..60c6061 100644
--- a/library/IPA_Emulation.ttcnpp
+++ b/library/IPA_Emulation.ttcnpp
@@ -79,25 +79,33 @@ type record ASP_IPA_Unitdata {
type enumerated ASP_IPA_EventType {
ASP_IPA_EVENT_DOWN,
ASP_IPA_EVENT_UP,
+ ASP_IPA_EVENT_ID_RESP,
ASP_IPA_EVENT_ID_ACK
}
/* an event indicating us whether or not a connection is physically up or down,
- * and whether we have received an ID_ACK */
+ * and whether we have received an ID_RESP or ID_ACK */
type record ASP_IPA_Event {
ASP_IPA_EventType ev_type,
- integer conn_id
+ integer conn_id,
+
+ /* Presence of these fields depends on event type */
+ IpaCcmIdResp id_resp optional // ASP_IPA_EVENT_ID_RESP
}
-template (value) ASP_IPA_Event ts_ASP_IPA_EV(ASP_IPA_EventType ev_type, integer conn_id) := {
+template (value) ASP_IPA_Event ts_ASP_IPA_EV(ASP_IPA_EventType ev_type, integer conn_id,
+ template (omit) IpaCcmIdResp id_resp := omit) := {
ev_type := ev_type,
- conn_id := conn_id
+ conn_id := conn_id,
+ id_resp := id_resp
}
template ASP_IPA_Event tr_ASP_IPA_EV(template ASP_IPA_EventType ev_type,
- template integer conn_id := ?) := {
+ template integer conn_id := ?,
+ template IpaCcmIdResp id_resp := *) := {
ev_type := ev_type,
- conn_id := conn_id
+ conn_id := conn_id,
+ id_resp := id_resp
}
template ASP_IPA_Unitdata t_ASP_IPA_UD(IpaStreamId sid, octetstring pl,
@@ -424,6 +432,16 @@ template PDU_IPA_CCM ts_IPA_ID_GET := {
}
}
+template PDU_IPA_CCM tr_IPA_ID_RESP := {
+ msg_type := IPAC_MSGT_ID_RESP,
+ u := {
+ resp := {
+ { ?, IPAC_IDTAG_UNITNAME, ? },
+ { ?, IPAC_IDTAG_UNITID, ? }
+ }
+ }
+}
+
/* receive IPA CCM message */
private function f_ccm_rx_client(PDU_IPA_CCM ccm) runs on IPA_Emulation_CT {
select (ccm.msg_type) {
@@ -458,6 +476,15 @@ runs on IPA_Emulation_CT {
}
case (IPAC_MSGT_ID_RESP) {
log("IPA ID RESP: ", ccm.u.resp);
+
+ /* make sure that the response contains all fields we requested */
+ if (not match(ccm, tr_IPA_ID_RESP)) {
+ log("IPA identity response ", ccm.u.resp, " mismatch");
+ return;
+ }
+
+ /* forward to the upper layers, so they can map conn_id with unit_id */
+ f_send_IPA_EVT(ts_ASP_IPA_EV(ASP_IPA_EVENT_ID_RESP, conn_id, ccm.u.resp));
/* acknowledge any identity that the client may have sent */
f_ccm_tx(valueof(ts_IPA_ACK), conn_id);
}