anjana_sreekumar@infosys.com | 991c206 | 2020-01-08 11:42:57 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2019-present Infosys Limited |
| 3 | * |
| 4 | * SPDX-License-Identifier: Apache-2.0 |
| 5 | */ |
| 6 | |
| 7 | /****************************************************************************** |
| 8 | * |
| 9 | * This file has both generated and manual code. |
| 10 | * |
| 11 | * File template used for code generation: |
| 12 | * <TOP-DIR/scripts/SMCodeGen/templates/stateMachineTmpls/actionHandlers.cpp.tt> |
| 13 | * |
| 14 | ******************************************************************************/ |
| 15 | |
| 16 | #include <typeinfo> |
| 17 | #include "actionHandlers/actionHandlers.h" |
| 18 | #include "controlBlock.h" |
| 19 | #include "msgType.h" |
| 20 | #include "contextManager/dataBlocks.h" |
| 21 | #include "procedureStats.h" |
| 22 | #include "log.h" |
| 23 | #include "secUtils.h" |
| 24 | #include "state.h" |
| 25 | #include <string.h> |
| 26 | #include <sstream> |
| 27 | #include <smTypes.h> |
| 28 | #include "common_proc_info.h" |
| 29 | #include <ipcTypes.h> |
| 30 | #include <tipcTypes.h> |
| 31 | #include <msgBuffer.h> |
| 32 | #include <interfaces/mmeIpcInterface.h> |
| 33 | #include <event.h> |
| 34 | #include <stateMachineEngine.h> |
| 35 | #include <utils/mmeContextManagerUtils.h> |
| 36 | |
| 37 | using namespace mme; |
| 38 | using namespace SM; |
| 39 | using namespace cmn::utils; |
| 40 | |
| 41 | extern MmeIpcInterface* mmeIpcIf_g; |
| 42 | |
| 43 | /*************************************** |
| 44 | * Action handler : send_tau_response_to_ue |
| 45 | ***************************************/ |
| 46 | ActStatus ActionHandlers::send_tau_response_to_ue(ControlBlock& cb) |
| 47 | { |
| 48 | log_msg(LOG_INFO,"Inside send_tau_response_to_ue\n"); |
| 49 | |
| 50 | UEContext *ue_ctxt = static_cast<UEContext*>(cb.getPermDataBlock()); |
| 51 | if (ue_ctxt == NULL) |
| 52 | { |
| 53 | log_msg(LOG_ERROR, "send_tau_response_to_ue: ue context is NULL\n",cb.getCBIndex()); |
| 54 | return ActStatus::HALT; |
| 55 | } |
| 56 | |
| 57 | MmeTauProcedureCtxt* tauPrcdCtxt_p = dynamic_cast<MmeTauProcedureCtxt*>(cb.getTempDataBlock()); |
| 58 | if (tauPrcdCtxt_p == NULL) |
| 59 | { |
| 60 | log_msg(LOG_DEBUG, "send_tau_response_to_ue: MmeTauProcedureCtxt is NULL\n"); |
| 61 | return ActStatus::HALT; |
| 62 | } |
| 63 | |
| 64 | struct tauResp_Q_msg tau_resp; |
| 65 | |
| 66 | tau_resp.msg_type = tau_response; |
| 67 | tau_resp.status = 0; |
| 68 | tau_resp.ue_idx = ue_ctxt->getContextID(); |
| 69 | tau_resp.enb_fd = tauPrcdCtxt_p->getEnbFd(); |
| 70 | tau_resp.s1ap_enb_ue_id = tauPrcdCtxt_p->getS1apEnbUeId(); |
| 71 | tau_resp.dl_seq_no = ue_ctxt->getDwnLnkSeqNo(); |
| 72 | memcpy(&(tau_resp.int_key), &(ue_ctxt->getUeSecInfo().secinfo_m.int_key), |
| 73 | NAS_INT_KEY_SIZE); |
| 74 | memcpy(&tau_resp.tai, &(ue_ctxt->getTai().tai_m), sizeof(struct TAI)); |
| 75 | tau_resp.m_tmsi = ue_ctxt->getMtmsi(); |
| 76 | |
| 77 | cmn::ipc::IpcAddress destAddr; |
| 78 | destAddr.u32 = TipcServiceInstance::s1apAppInstanceNum_c; |
| 79 | mmeIpcIf_g->dispatchIpcMsg((char *) &tau_resp, sizeof(tau_resp), destAddr); |
| 80 | |
| 81 | MmeContextManagerUtils::deallocateProcedureCtxt(cb, tau_c ); |
| 82 | ProcedureStats::num_of_tau_response_to_ue_sent++; |
| 83 | |
| 84 | log_msg(LOG_INFO,"Leaving send_tau_response_to_ue\n"); |
| 85 | return ActStatus::PROCEED; |
| 86 | } |
| 87 | |