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 | #ifndef __S1AP_H_ |
| 19 | #define __S1AP_H_ |
| 20 | |
| 21 | #include <stdbool.h> |
| 22 | |
| 23 | #include "s1ap_structs.h" |
| 24 | #include "log.h" |
| 25 | #include "s1ap_ie.h" |
| 26 | #include "InitiatingMessage.h" |
| 27 | #include "SuccessfulOutcome.h" |
| 28 | #include "UnsuccessfulOutcome.h" |
| 29 | #include "common_proc_info.h" |
| 30 | |
| 31 | int |
| 32 | s1_init_ctx_resp_handler(SuccessfulOutcome_t *msg); |
| 33 | |
| 34 | int |
| 35 | parse_IEs(char *msg, struct proto_IE *proto_ies, unsigned short proc_code); |
| 36 | |
| 37 | int convertToInitUeProtoIe(InitiatingMessage_t *msg, struct proto_IE* proto_ies); |
| 38 | int convertUplinkNasToProtoIe(InitiatingMessage_t *msg, struct proto_IE* proto_ies); |
| 39 | int convertUeCtxRelReqToProtoIe(InitiatingMessage_t *msg, struct proto_IE* proto_ies); |
| 40 | int convertInitCtxRspToProtoIe(SuccessfulOutcome_t *msg, struct proto_IE* proto_ies); |
| 41 | int convertUeCtxRelComplToProtoIe(SuccessfulOutcome_t *msg, struct proto_IE* proto_ies); |
| 42 | |
| 43 | int |
| 44 | s1_setup_handler(InitiatingMessage_t *msg, int enb_fd); |
| 45 | |
| 46 | int |
| 47 | s1_init_ue_handler(struct proto_IE *s1_init_ies, int enb_fd); |
| 48 | |
| 49 | void |
| 50 | handle_s1ap_message(void *message); |
| 51 | |
| 52 | int |
| 53 | init_s1ap(); |
| 54 | |
| 55 | void |
| 56 | read_config(); |
| 57 | |
| 58 | void* |
| 59 | IAM_handler(void *data); |
| 60 | |
| 61 | int s1_esm_resp_handler(struct proto_IE *s1_esm_resp_ies); |
| 62 | |
| 63 | int s1_secmode_resp_handler(struct proto_IE *s1_sec_resp_ies); |
| 64 | |
| 65 | int s1_auth_resp_handler(struct proto_IE *s1_auth_resp_ies); |
| 66 | |
| 67 | int s1_auth_fail_handler(struct proto_IE *s1_auth_resp_ies); |
| 68 | |
| 69 | int s1_identity_resp_handler(struct proto_IE *s1_id_resp_ies); |
| 70 | |
| 71 | int s1_attach_complete_handler(struct proto_IE *s1_esm_resp_ies); |
| 72 | |
| 73 | int |
| 74 | detach_stage1_handler(struct proto_IE *detach_ies, bool retransmit); |
| 75 | |
| 76 | int |
| 77 | s1_init_ue_service_req_handler(struct proto_IE *service_req_ies, int enb_fd); |
| 78 | |
| 79 | int |
| 80 | tau_request_handler(struct proto_IE *s1_tau_req_ies, int enb_fd); |
| 81 | |
| 82 | int |
| 83 | s1_ctx_release_resp_handler(SuccessfulOutcome_t *msg); |
| 84 | |
| 85 | int |
| 86 | s1_ctx_release_request_handler(InitiatingMessage_t *msg); |
| 87 | |
| 88 | int |
| 89 | s1_ctx_release_complete_handler(SuccessfulOutcome_t *msg); |
| 90 | |
| 91 | int |
| 92 | detach_accept_from_ue_handler(struct proto_IE *detach_ies, bool retransmit); |
| 93 | |
| 94 | int s1ap_mme_encode_ue_context_release_command( |
| 95 | struct s1ap_common_req_Q_msg *s1apPDU, |
| 96 | uint8_t **buffer, uint32_t *length); |
| 97 | |
| 98 | int s1ap_mme_encode_paging_request( |
| 99 | struct s1ap_common_req_Q_msg *s1apPDU, |
| 100 | uint8_t **buffer, uint32_t *length); |
| 101 | |
| 102 | int s1ap_mme_encode_initiating( |
| 103 | struct s1ap_common_req_Q_msg *s1apPDU, |
| 104 | uint8_t **buffer, uint32_t *length); |
| 105 | |
| 106 | int s1ap_mme_encode_initial_context_setup_request( |
| 107 | struct s1ap_common_req_Q_msg *s1apPDU, |
| 108 | uint8_t **buffer, uint32_t *length); |
| 109 | |
| 110 | int |
| 111 | s1ap_mme_decode_initiating (InitiatingMessage_t *initiating_p, int enb_fd); |
| 112 | |
| 113 | int |
| 114 | s1ap_mme_decode_successfull_outcome (SuccessfulOutcome_t *initiating_p); |
| 115 | |
| 116 | int |
| 117 | s1ap_mme_decode_unsuccessfull_outcome (UnsuccessfulOutcome_t *initiating_p); |
| 118 | |
| 119 | int |
| 120 | copyU16(unsigned char *buffer, uint32_t val); |
| 121 | |
| 122 | int |
| 123 | send_sctp_msg(int connSock, unsigned char *buffer, size_t len, uint16_t stream_no); |
| 124 | |
| 125 | void |
| 126 | buffer_copy(struct Buffer *buffer, void *value, size_t size); |
| 127 | |
| 128 | /** |
| 129 | * @brief Decode int value from the byte array received in the s1ap incoming |
| 130 | * packet. |
| 131 | * @param[in] bytes - Array of bytes in packet |
| 132 | * @param[in] len - Length of the bytes array from which to extract the int |
| 133 | * @return Integer value extracted out of bytes array. 0 if failed. |
| 134 | */ |
| 135 | int |
| 136 | decode_int_val(unsigned char *bytes, short len); |
| 137 | |
| 138 | char* |
| 139 | msg_to_hex_str(const char *msg, int len, char **buffer); |
| 140 | |
| 141 | unsigned short |
| 142 | get_length(char **msg); |
| 143 | #endif /*__S1AP_H_*/ |