blob: ae93f88f459d3e444746166b2042af4a6926306a [file] [log] [blame]
anjana_sreekumar@infosys.com991c2062020-01-08 11:42:57 +05301/*
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
26extern int g_enb_fd;
27extern ipc_handle ipc_S1ap_Hndl;
28
29int
30tau_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