blob: d9d7897b698b91d5b59177c67b03a028cc028b8f [file] [log] [blame]
anjana_sreekumar@infosys.com991c2062020-01-08 11:42:57 +05301/*
2 * Copyright (c) 2019, Infosys Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <stdio.h>
18#include <stdlib.h>
19#include <arpa/inet.h>
20#include <unistd.h>
21#include <string.h>
22#include <pthread.h>
23
24#include "err_codes.h"
25#include "options.h"
26#include "ipc_api.h"
27#include "message_queues.h"
28#include "s11.h"
29#include "s11_config.h"
30#include "msgType.h"
31//#include "stage8_info.h"
32#include "../../gtpV2Codec/gtpV2StackWrappers.h"
33
34/*Globals and externs*/
35extern int g_resp_fd;
36extern struct GtpV2Stack* gtpStack_gp;
37
38/*End : globals and externs*/
39
40int
41s11_RB_resp_handler(MsgBuffer* message, GtpV2MessageHeader* hdr)
42{
43 struct gtp_incoming_msg_data_t rbr_info;
44
45 /*****Message structure***
46 */
47 log_msg(LOG_INFO, "Parse S11 RB resp message\n");
48
49 //TODO : check cause for the result verification
50
51 rbr_info.ue_idx = hdr->teid;
52 rbr_info.msg_type = release_bearer_response;
53
54 ReleaseAccessBearersResponseMsgData msgData;
55 memset(&msgData, 0, sizeof(ReleaseAccessBearersResponseMsgData));
56
57 bool rc = GtpV2Stack_decodeMessage(gtpStack_gp, hdr, message, &msgData);
58 if(rc == false)
59 {
60 log_msg(LOG_ERROR, "s11_RB_resp_handler: "
61 "Failed to decode Release Access Bearer Response Msg %d\n",
62 hdr->teid);
63 return E_PARSING_FAILED;
64 }
65
66
67 rbr_info.destInstAddr = htonl(mmeAppInstanceNum_c);
68 rbr_info.srcInstAddr = htonl(s11AppInstanceNum_c);
69
70 /*Send CS response msg*/
71 send_tipc_message(g_resp_fd, mmeAppInstanceNum_c, (char *)&rbr_info, GTP_READ_MSG_BUF_SIZE);
72 log_msg(LOG_INFO, "Send RB resp to mme-app stage2.\n");
73
74 return SUCCESS;
75}