blob: 6ba0162370cf7306cca7cb575c27a78d28eaddaa [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 <unistd.h>
20#include <string.h>
21#include <pthread.h>
22
23#include "options.h"
24#include "ipc_api.h"
25#include "main.h"
26#include "s1ap.h"
27#include "s1ap_config.h"
28#include "sctp_conn.h"
29#include "s1ap_structs.h"
30#include "s1ap_msg_codes.h"
31#include "s1ap_ie.h"
32#include "err_codes.h"
33#include "msgType.h"
34
35extern void* authreq_handler(void *data);
36extern void* secreq_handler(void *data);
37extern void* icsreq_handler(void *data);
38extern void* detach_accept_handler(void *data);
39extern void* ni_detach_request_handler(void *data);
40extern void* paging_handler(void *data);
41extern void* ics_req_paging_handler(void *data);
42extern void* tau_response_handler(void *data);
43
44void
45handle_mmeapp_message(void * data)
46{
47 log_msg(LOG_INFO, "handle mme-app message ");
48
49 char *msg = ((char *) data) + (sizeof(uint32_t)*2);
50
51 msg_type_t* msg_type = (msg_type_t*)(msg);
52
53 switch(*msg_type)
54 {
55 case id_request:
56 idreq_handler(msg);
57 break;
58 case auth_request:
59 authreq_handler(msg);
60 break;
61 case sec_mode_command:
62 secreq_handler(msg);
63 break;
64 case esm_info_request:
65 esmreq_handler(msg);
66 break;
67 case init_ctxt_request:
68 icsreq_handler(msg);
69 break;
70 case detach_accept:
71 detach_accept_handler(msg);
72 break;
73 case s1_release_command:
74 s1_release_command_handler(msg);
75 break;
76 case ni_detach_request:
77 ni_detach_request_handler(msg);
78 break;
79 case paging_request:
80 paging_handler(msg);
81 break;
82 case ics_req_paging:
83 ics_req_paging_handler(msg);
84 break;
85 case tau_response:
86 tau_response_handler(msg);
87 break;
88 default:
89 log_msg(LOG_ERROR,"Unhandled mme-app message\n");
90 break;
91 }
92 free(data);
93}