library/IPA_Emulation: server mode: expose IPA IDENTITY RESPONSE

Change-Id: I685c2697cdbe932572e1839420d0c74c8fa94ee2
Related: OS#4546
This commit is contained in:
Vadim Yanitskiy 2020-05-24 22:26:54 +07:00
parent 40ee56cbac
commit 11edf3cdba
1 changed files with 33 additions and 6 deletions

View File

@ -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);
}