blob: 4489ae4d69ad5fc42b7e2897276df41f80ebc34e [file] [log] [blame]
anjana_sreekumar@infosys.com991c2062020-01-08 11:42:57 +05301/*
2 * Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd.
3 * Copyright (c) 2017 Intel Corporation
4 * Copyright (c) 2019, Infosys Ltd.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#include <stdio.h>
20#include <stdlib.h>
21#include <unistd.h>
22#include <string.h>
23#include <pthread.h>
24
25#include "err_codes.h"
26#include "options.h"
27#include "ipc_api.h"
28#include "main.h"
29#include "s1ap.h"
30#include "s1ap_config.h"
31#include "sctp_conn.h"
32#include "s1ap_structs.h"
33#include "s1ap_msg_codes.h"
34#include "msgType.h"
35
36
37extern int g_enb_fd;
38extern ipc_handle ipc_S1ap_Hndl;
39
40int
41s1_ctx_release_resp_handler(SuccessfulOutcome_t *msg)
42{
43 struct s1_incoming_msg_data_t release_complete= {0};
44 struct proto_IE s1_ctx_release_ies;
45
46 log_msg(LOG_INFO, "Parse s1ap context release complete message:--\n");
47
48 convertUeCtxRelComplToProtoIe(msg, &s1_ctx_release_ies);
49
50 /*TODO: Validate all eNB info*/
51 for(int i = 0; i < s1_ctx_release_ies.no_of_IEs; i++)
52 {
53 switch(s1_ctx_release_ies.data[i].IE_type)
54 {
55 case S1AP_IE_MME_UE_ID:
56 {
57 release_complete.ue_idx = s1_ctx_release_ies.data[i].val.mme_ue_s1ap_id;
58 }break;
59 default:
60 log_msg(LOG_WARNING,"Unhandled IE");
61 }
62 }
63
64 release_complete.msg_type = s1_release_complete;
65 release_complete.destInstAddr = htonl(mmeAppInstanceNum_c);
66 release_complete.srcInstAddr = htonl(s1apAppInstanceNum_c);
67 int i = 0;
68 i = send_tipc_message(ipc_S1ap_Hndl,mmeAppInstanceNum_c,
69 (char *)&release_complete,
70 S1_READ_MSG_BUF_SIZE);
71 if (i < 0) {
72
73 log_msg(LOG_ERROR,"Error To write in s1_ctx_release_code_handler\n");
74 }
75
76 log_msg(LOG_INFO, "Ctx Release complete sent to mme-app."
77 "Bytes sent %d\n", i);
78
79 //TODO: free IEs
80 return SUCCESS;
81}
82