aa7133@att.com | 84bd334 | 2020-03-16 18:04:57 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 AT&T Intellectual Property |
| 3 | * Copyright 2019 Nokia |
| 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 | * This source code is part of the near-RT RIC (RAN Intelligent Controller) |
| 20 | * platform project (RICP). |
| 21 | */ |
| 22 | |
| 23 | // |
| 24 | // Created by adi ENZEL on 6/19/19. |
| 25 | // |
| 26 | |
| 27 | #ifndef ASN_DISABLE_OER_SUPPORT |
| 28 | #define ASN_DISABLE_OER_SUPPORT // this is to remove the OER do not remove it |
| 29 | #endif |
| 30 | |
| 31 | |
| 32 | #ifdef __cplusplus |
| 33 | extern "C" |
| 34 | { |
| 35 | #endif |
| 36 | |
| 37 | |
| 38 | #ifndef E2_E2SM_H |
| 39 | #define E2_E2SM_H |
| 40 | |
| 41 | #include <stdlib.h> |
| 42 | #include <sys/types.h> |
| 43 | #include <string.h> |
| 44 | #include <error.h> |
| 45 | #include <errno.h> |
| 46 | #include <mdclog/mdclog.h> |
| 47 | #include <time.h> |
| 48 | #include <math.h> |
| 49 | |
| 50 | |
| 51 | #include "asn1cFiles/ENB-ID.h" |
| 52 | |
| 53 | #include "asn1cFiles/E2SM-gNB-X2-actionDefinition.h" |
| 54 | |
| 55 | #include "asn1cFiles/E2SM-gNB-X2-callProcessID.h" |
| 56 | #include "asn1cFiles/E2SM-gNB-X2-controlHeader.h" |
| 57 | #include "asn1cFiles/E2SM-gNB-X2-controlMessage.h" |
| 58 | #include "asn1cFiles/E2SM-gNB-X2-indicationHeader.h" |
| 59 | #include "asn1cFiles/E2SM-gNB-X2-indicationMessage.h" |
| 60 | #include "asn1cFiles/E2SM-gNB-X2-eventTriggerDefinition.h" |
| 61 | |
| 62 | |
| 63 | #include "asn1cFiles/ActionParameter-Item.h" |
| 64 | #include "asn1cFiles/ActionParameter-Value.h" |
| 65 | #include "asn1cFiles/PLMN-Identity.h" |
| 66 | #include "asn1cFiles/GlobalENB-ID.h" |
| 67 | #include "asn1cFiles/GlobalGNB-ID.h" |
| 68 | #include "asn1cFiles/Interface-ID.h" |
| 69 | #include "asn1cFiles/InterfaceMessageType.h" |
| 70 | #include "asn1cFiles/InterfaceProtocolIE-Item.h" |
| 71 | |
| 72 | /** |
| 73 | * |
| 74 | * @param data |
| 75 | * @return |
| 76 | */ |
| 77 | PLMN_Identity_t *createPLMN_ID(const unsigned char *data); |
| 78 | /** |
| 79 | * |
| 80 | * @param enbType |
| 81 | * @param data |
| 82 | * @return |
| 83 | */ |
| 84 | ENB_ID_t *createENB_ID(ENB_ID_PR enbType, unsigned char *data); |
| 85 | /** |
| 86 | * |
| 87 | * @param data |
| 88 | * @param numOfBits |
| 89 | * @return |
| 90 | */ |
| 91 | GNB_ID_t *createGnb_id(const unsigned char *data, int numOfBits); |
| 92 | /** |
| 93 | * |
| 94 | * @param plmnIdentity |
| 95 | * @param enbId |
| 96 | * @return |
| 97 | */ |
| 98 | GlobalENB_ID_t *createGlobalENB_ID(PLMN_Identity_t *plmnIdentity, ENB_ID_t *enbId); |
| 99 | /** |
| 100 | * |
| 101 | * @param plmnIdent#ifdef __cplusplus |
| 102 | } |
| 103 | #endif |
| 104 | ity |
| 105 | * @param gnb |
| 106 | * @return |
| 107 | */ |
| 108 | GlobalGNB_ID_t *createGlobalGNB_ID(PLMN_Identity_t *plmnIdentity, GNB_ID_t *gnb); |
| 109 | |
| 110 | /** |
| 111 | * |
| 112 | * @param gnb |
| 113 | * @return |
| 114 | */ |
| 115 | Interface_ID_t *createInterfaceIDForGnb(GlobalGNB_ID_t *gnb); |
| 116 | /** |
| 117 | * |
| 118 | * @param enb |
| 119 | * @return |
| 120 | */ |
| 121 | Interface_ID_t *createInterfaceIDForEnb(GlobalENB_ID_t *enb); |
| 122 | |
| 123 | /** |
| 124 | * |
| 125 | * @param procedureCode |
| 126 | * @return |
| 127 | */ |
| 128 | InterfaceMessageType_t *createInterfaceMessageInitiating(ProcedureCode_t procedureCode); |
| 129 | /** |
| 130 | * |
| 131 | * @param procedureCode |
| 132 | * @return |
| 133 | */ |
| 134 | InterfaceMessageType_t *createInterfaceMessageSuccsesful(ProcedureCode_t procedureCode); |
| 135 | |
| 136 | /** |
| 137 | * |
| 138 | * @param procedureCode |
| 139 | * @return |
| 140 | */ |
| 141 | InterfaceMessageType_t *createInterfaceMessageUnsuccessful(ProcedureCode_t procedureCode); |
| 142 | |
| 143 | |
| 144 | /** |
| 145 | * |
| 146 | * @param number |
| 147 | * @return |
| 148 | */ |
| 149 | InterfaceProtocolIE_Value_t *createInterfaceProtocolValueInt(long number); |
| 150 | /** |
| 151 | * |
| 152 | * @param number |
| 153 | * @return |
| 154 | */ |
| 155 | InterfaceProtocolIE_Value_t *createInterfaceProtocolValueEnum(long number); |
| 156 | /** |
| 157 | * |
| 158 | * @param val |
| 159 | * @return |
| 160 | */ |
| 161 | InterfaceProtocolIE_Value_t *createInterfaceProtocolValueBool(int val); |
| 162 | |
| 163 | /** |
| 164 | * |
| 165 | * @param buf |
| 166 | * @param numOfBits |
| 167 | * @return |
| 168 | */ |
| 169 | InterfaceProtocolIE_Value_t *createInterfaceProtocolValueBitString(unsigned char *buf, int numOfBits); |
| 170 | |
| 171 | /** |
| 172 | * |
| 173 | * @param buf |
| 174 | * @param size |
| 175 | * @return |
| 176 | */ |
| 177 | InterfaceProtocolIE_Value_t *createInterfaceProtocolValueOCTETS(uint8_t *buf); |
| 178 | /** |
| 179 | * |
| 180 | * @param id |
| 181 | * @param test |
| 182 | * @param value |
| 183 | * @return |
| 184 | */ |
| 185 | InterfaceProtocolIE_Item_t *createInterfaceProtocolIE_Item(long id, long test, InterfaceProtocolIE_Value_t *value); |
| 186 | |
| 187 | /** |
| 188 | * |
| 189 | * @param number |
| 190 | * @return |
| 191 | */ |
| 192 | ActionParameter_Value_t *createActionParameterValue_Int(long number); |
| 193 | |
| 194 | /** |
| 195 | * |
| 196 | * @param number |
| 197 | * @return |
| 198 | */ |
| 199 | ActionParameter_Value_t *createActionParameterValue_Enum(long number); |
| 200 | |
| 201 | /** |
| 202 | * |
| 203 | * @param val |
| 204 | * @return |
| 205 | */ |
| 206 | ActionParameter_Value_t *createActionParameterValue_Bool(int val); |
| 207 | |
| 208 | /** |
| 209 | * |
| 210 | * @param buf |
| 211 | * @param numOfBits |
| 212 | * @return |
| 213 | */ |
| 214 | ActionParameter_Value_t *createActionParameterValue_Bit_String(unsigned char *buf, int numOfBits); |
| 215 | |
| 216 | /** |
| 217 | * |
| 218 | * @param buf |
| 219 | * @param size |
| 220 | * @return |
| 221 | */ |
| 222 | ActionParameter_Value_t *createActionParameterValue_OCTETS(uint8_t *buf); |
| 223 | |
| 224 | /** |
| 225 | * |
| 226 | * @param buf |
| 227 | * @param size |
| 228 | * @return |
| 229 | */ |
| 230 | ActionParameter_Value_t *createActionParameterValue_PRINTS(char *buf); |
| 231 | |
| 232 | /** |
| 233 | * |
| 234 | * @param id |
| 235 | * @param val |
| 236 | * @return |
| 237 | */ |
| 238 | ActionParameter_Item_t *creatActionParameter_Item(long id, ActionParameter_Value_t *val); |
| 239 | |
| 240 | /** |
| 241 | * |
| 242 | * @param interfaceId |
| 243 | * @param direction |
| 244 | * @param messageType |
| 245 | * @param interfaceProtocolItemList |
| 246 | * @param listSize |
| 247 | * @param buffer |
| 248 | * @param buffer_size |
| 249 | * @return |
| 250 | */ |
| 251 | size_t createEventTrigger(Interface_ID_t *interfaceId, long direction, |
| 252 | InterfaceMessageType_t *messageType, |
| 253 | InterfaceProtocolIE_Item_t interfaceProtocolItemList[], |
| 254 | int listSize, |
| 255 | uint8_t *buffer, |
| 256 | size_t buffer_size); |
| 257 | |
| 258 | |
| 259 | /** |
| 260 | * |
| 261 | * @param styleId |
| 262 | * @param actionParamList |
| 263 | * @param listSize |
| 264 | * @param buffer |
| 265 | * @param buffer_size |
| 266 | * @return |
| 267 | */ |
| 268 | size_t createActionDefinition(long styleId, ActionParameter_Item_t actionParamList[], int listSize, |
| 269 | uint8_t *buffer, |
| 270 | size_t buffer_size); |
| 271 | /** |
| 272 | * |
| 273 | * @param interfaceDirection |
| 274 | * @param interfaceId |
| 275 | * @param timestamp |
| 276 | * @param size |
| 277 | * @param buffer |
| 278 | * @param buffer_size |
| 279 | * @return |
| 280 | */ |
| 281 | size_t createE2SM_gNB_X2_indicationHeader(long interfaceDirection, |
| 282 | Interface_ID_t *interfaceId, |
| 283 | uint8_t *timestamp, //can put NULL if size == 0 |
| 284 | int size, |
| 285 | uint8_t *buffer, |
| 286 | size_t buffer_size); |
| 287 | |
| 288 | /** |
| 289 | * |
| 290 | * @param message |
| 291 | * @param msgSize |
| 292 | * @param buffer |
| 293 | * @param buffer_size |
| 294 | * @return |
| 295 | */ |
| 296 | size_t createE2SM_gNB_X2_indicationMessage(uint8_t *message, uint msgSize, |
| 297 | uint8_t *buffer, |
| 298 | size_t buffer_size); |
| 299 | |
| 300 | /** |
| 301 | * |
| 302 | * @param callProcess_Id |
| 303 | * @param buffer |
| 304 | * @param buffer_size |
| 305 | * @return |
| 306 | */ |
| 307 | size_t createE2SM_gNB_X2_callProcessID(long callProcess_Id, |
| 308 | uint8_t *buffer, |
| 309 | size_t buffer_size); |
| 310 | |
| 311 | size_t createE2SM_gNB_X2_controlHeader(Interface_ID_t *interfaceId, long direction, |
| 312 | uint8_t *buffer, |
| 313 | size_t buffer_size); |
| 314 | |
| 315 | size_t createE2SM_gNB_X2_controlMessage(uint8_t *message, uint msgSize, |
| 316 | uint8_t *buffer, |
| 317 | size_t buffer_size); |
| 318 | #endif //E2_E2SM_H |
| 319 | |
| 320 | #ifdef __cplusplus |
| 321 | } |
| 322 | #endif |