anjana_sreekumar@infosys.com | 991c206 | 2020-01-08 11:42:57 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd. |
| 3 | * Copyright (c) 2017 Intel Corporation |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | /* |
| 19 | * main.h |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | #ifndef MAIN_H_ |
| 24 | #define MAIN_H_ |
| 25 | |
| 26 | #include <time.h> |
| 27 | #include <stdint.h> |
| 28 | |
| 29 | #include "stimer.h" |
| 30 | |
| 31 | #define THREADPOOL_SIZE 10 |
| 32 | |
| 33 | #define SCTP_BUF_SIZE 1024 |
| 34 | |
| 35 | /*Timer and stat calculations*/ |
| 36 | struct time_stat { |
| 37 | stimer_t init_ue; |
| 38 | stimer_t esm_in; |
| 39 | stimer_t esm_out; |
| 40 | stimer_t auth_in; |
| 41 | stimer_t auth_to_mme; |
| 42 | stimer_t secreq_in; |
| 43 | stimer_t secreq_out; |
| 44 | stimer_t secresp_in; |
| 45 | stimer_t secresp_to_mme; |
| 46 | stimer_t esmreq_in; |
| 47 | stimer_t esmreq_out; |
| 48 | stimer_t espresp_in; |
| 49 | stimer_t espresp_to_mme; |
| 50 | stimer_t initctx_out; |
| 51 | stimer_t initctx_resp; |
| 52 | stimer_t att_done; |
| 53 | }; |
| 54 | |
| 55 | void |
| 56 | *authreq_handler(void *); |
| 57 | |
| 58 | void |
| 59 | *attach_reject_handler(void *); |
| 60 | |
| 61 | void |
| 62 | *idreq_handler(void *); |
| 63 | |
| 64 | void |
| 65 | *secreq_handler(void *); |
| 66 | |
| 67 | void |
| 68 | *esmreq_handler(void *); |
| 69 | |
| 70 | void |
| 71 | *icsreq_handler(void *); |
| 72 | |
| 73 | void |
| 74 | *detach_accept_handler(void *); |
| 75 | |
| 76 | void |
| 77 | *s1_release_command_handler(void *); |
| 78 | |
| 79 | void |
| 80 | *paging_handler(void *); |
| 81 | |
| 82 | void |
| 83 | *ics_req_paging_handler(void *); |
| 84 | |
| 85 | void |
| 86 | *tau_response_handler(void *); |
| 87 | |
| 88 | void |
| 89 | calculate_mac(uint8_t *int_key, uint32_t seq_no, uint8_t direction, |
| 90 | uint8_t bearer, uint8_t *data, uint16_t data_len, |
| 91 | uint8_t *mac); |
| 92 | |
| 93 | typedef long long int stimer_t; |
| 94 | |
| 95 | #define STIMER_GET_CURRENT_TP(__now__) \ |
| 96 | ({ \ |
| 97 | struct timespec __ts__; \ |
| 98 | __now__ = clock_gettime(CLOCK_REALTIME,&__ts__) ? \ |
| 99 | -1 : (((stimer_t)__ts__.tv_sec) * 1000000000) + ((stimer_t)__ts__.tv_nsec); \ |
| 100 | __now__; \ |
| 101 | }) |
| 102 | |
| 103 | #define STIMER_GET_ELAPSED_NS(_start_) \ |
| 104 | ({ \ |
| 105 | stimer_t __ns__; \ |
| 106 | STIMER_GET_CURRENT_TP(__ns__); \ |
| 107 | if (__ns__ != -1) \ |
| 108 | __ns__ -= _start_; \ |
| 109 | __ns__; \ |
| 110 | }) |
| 111 | |
| 112 | #endif /* MAIN_H_ */ |