anjana_sreekumar@infosys.com | 991c206 | 2020-01-08 11:42:57 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2019-present Open Networking Foundation |
| 3 | * |
| 4 | * SPDX-License-Identifier: Apache-2.0 |
| 5 | * |
| 6 | */ |
| 7 | #include <stdio.h> |
| 8 | #include <stdlib.h> |
| 9 | #include <unistd.h> |
| 10 | #include <string.h> |
| 11 | #include <pthread.h> |
| 12 | |
| 13 | |
| 14 | #include "err_codes.h" |
| 15 | #include "options.h" |
| 16 | #include "ipc_api.h" |
| 17 | #include "main.h" |
| 18 | #include "s1ap.h" |
| 19 | #include "s1ap_config.h" |
| 20 | #include "sctp_conn.h" |
| 21 | #include "s1ap_structs.h" |
| 22 | #include "s1ap_msg_codes.h" |
| 23 | #include "msgType.h" |
| 24 | |
| 25 | |
| 26 | extern int g_enb_fd; |
| 27 | extern ipc_handle ipc_S1ap_Hndl; |
| 28 | |
| 29 | int |
| 30 | tau_request_handler(struct proto_IE *s1_tau_req_ies, int enb_fd) |
| 31 | { |
| 32 | struct s1_incoming_msg_data_t req= {0}; |
| 33 | |
| 34 | log_msg(LOG_INFO, "S1ap received tau Request:--\n"); |
| 35 | |
| 36 | req.msg_type = tau_request; |
| 37 | req.msg_data.tauReq_Q_msg_m.enb_fd = enb_fd; |
| 38 | |
| 39 | for(int i = 0; i < s1_tau_req_ies->no_of_IEs; i++) |
| 40 | { |
| 41 | switch(s1_tau_req_ies->data[i].IE_type) |
| 42 | { |
| 43 | case S1AP_IE_ENB_UE_ID: |
| 44 | { |
| 45 | req.s1ap_enb_ue_id = s1_tau_req_ies->data[i].val.enb_ue_s1ap_id; |
| 46 | }break; |
| 47 | |
| 48 | case S1AP_IE_MME_UE_ID: |
| 49 | { |
| 50 | req.ue_idx = s1_tau_req_ies->data[i].val.mme_ue_s1ap_id; |
| 51 | }break; |
| 52 | |
| 53 | case S1AP_IE_NAS_PDU: |
| 54 | { |
| 55 | nas_pdu_header *hdr = &s1_tau_req_ies->data[i].val.nas.header; |
| 56 | req.msg_data.tauReq_Q_msg_m.seq_num = hdr->seq_no; |
| 57 | }break; |
| 58 | default: |
| 59 | // Once MME starts handlign this request we can parse and send the content |
| 60 | log_msg(LOG_WARNING,"Unhandled IE In tau request %d",s1_tau_req_ies->data[i].IE_type); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | req.destInstAddr = htonl(mmeAppInstanceNum_c); |
| 65 | req.srcInstAddr = htonl(s1apAppInstanceNum_c); |
| 66 | send_tipc_message(ipc_S1ap_Hndl, mmeAppInstanceNum_c, (char *)&req, S1_READ_MSG_BUF_SIZE); |
| 67 | |
| 68 | |
| 69 | log_msg(LOG_INFO, "Sent TAU request to mme-app\n"); |
| 70 | return SUCCESS; |
| 71 | } |
| 72 | |