x2ap_common.h 11.2 KB
Newer Older
Lionel Gauthier's avatar
 
Lionel Gauthier committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
/*******************************************************************************

  Eurecom OpenAirInterface
  Copyright(c) 1999 - 2012 Eurecom

  This program is free software; you can redistribute it and/or modify it
  under the terms and conditions of the GNU General Public License,
  version 2, as published by the Free Software Foundation.

  This program is distributed in the hope it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  more details.

  You should have received a copy of the GNU General Public License along with
  this program; if not, write to the Free Software Foundation, Inc.,
  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.

  The full GNU General Public License is included in this distribution in
  the file called "COPYING".

  Contact Information
  Openair Admin: openair_admin@eurecom.fr
  Openair Tech : openair_tech@eurecom.fr
  Forums       : http://forums.eurecom.fr/openairinterface
  Address      : EURECOM, Campus SophiaTech, 450 Route des Chappes
                 06410 Biot FRANCE

*******************************************************************************/

#if HAVE_CONFIG_H_
# include "config.h"
#endif

#include "Criticality.h"
#include "Presence.h"
#include "PrivateIE-ID.h"
#include "ProcedureCode.h"
#include "ProtocolIE-ID.h"
#include "TriggeringMessage.h"
#include "IE-Extensions.h"
#include "ActivatedCellList.h"
#include "AS-SecurityInformation.h"
#include "AllocationAndRetentionPriority.h"
#include "BitRate.h"
#include "BroadcastPLMNs-Item.h"
#include "CapacityValue.h"
#include "CellCapacityClassValue.h"
#include "Cause.h"
#include "CauseMisc.h"
#include "CauseProtocol.h"
#include "CauseRadioNetwork.h"
#include "CauseTransport.h"
#include "Cell-Size.h"
#include "CellToReport-List.h"
#include "CellToReport-Item.h"
#include "CellMeasurementResult-List.h"
#include "CellMeasurementResult-Item.h"
//#include "CellInformation.h"
#include "CellInformation-List.h"
#include "CellInformation-Item.h"
#include "CellType.h"
#include "CompositeAvailableCapacityGroup.h"
#include "CompositeAvailableCapacity.h"
#include "COUNTvalue.h"
#include "CriticalityDiagnostics.h"
#include "CriticalityDiagnostics-IE-List.h"
#include "CRNTI.h"
#include "CyclicPrefixDL.h"
#include "CyclicPrefixUL.h"
#include "DeactivationIndication.h"
#include "DL-Forwarding.h"
#include "E-RAB-Item.h"
#include "E-RABs-Admitted-List.h"
#include "E-RABs-Admitted-Item.h"
//#include "E-RABNotAdmittedItem.h"
#include "E-RABs-ToBeSetup-List.h"
#include "E-RABs-ToBeSetup-Item.h"
#include "E-RABs-SubjectToStatusTransfer-List.h"
#include "E-RABs-SubjectToStatusTransfer-Item.h"
#include "EARFCN.h"
#include "FDD-Info.h"
#include "TDD-Info.h"
#include "EUTRA-Mode-Info.h"
#include "ECGI.h"
#include "ENB-ID.h"
#include "EncryptionAlgorithms.h"
#include "EPLMNs.h"
#include "E-RAB-ID.h"
#include "E-RAB-Level-QoS-Parameters.h"
#include "E-RAB-List.h"
//#include "E-RAB-ItemIEs.h"
#include "EUTRANCellIdentifier.h"
#include "EUTRANTraceID.h"
#include "EventType.h"
#include "ForbiddenInterRATs.h"
#include "ForbiddenTAs.h"
#include "ForbiddenTAs-Item.h"
#include "ForbiddenTACs.h"
#include "ForbiddenLAs.h"
#include "ForbiddenLAs-Item.h"
#include "ForbiddenLACs.h"
#include "Fourframes.h"
#include "GBR-QosInformation.h"
#include "GlobalENB-ID.h"
#include "GTPtunnelEndpoint.h"
#include "GTP-TEI.h"
#include "GUGroupIDList.h"
#include "GU-Group-ID.h"
#include "GUMMEI.h"
#include "HandoverReportType.h"
#include "HandoverRestrictionList.h"
#include "HFN.h"
#include "HWLoadIndicator.h"
#include "IntegrityProtectionAlgorithms.h"
#include "InterfacesToTrace.h"
#include "Key-eNodeB-Star.h"
#include "LAC.h"
#include "LastVisitedCell-Item.h"
#include "LastVisitedEUTRANCellInformation.h"
#include "LastVisitedUTRANCellInformation.h"
#include "LastVisitedGERANCellInformation.h"
#include "LoadIndicator.h"
#include "LocationReportingInformation.h"
#include "MME-Group-ID.h"
#include "MME-Code.h"
#include "Measurement-ID.h"
#include "MBSFN-Subframe-Infolist.h"
#include "MBSFN-Subframe-Info.h"
#include "MobilityParametersModificationRange.h"
#include "MobilityParametersInformation.h"
#include "Neighbour-Information.h"
#include "Neighbour-Information.h"
#include "NextHopChainingCount.h"
#include "Number-of-Antennaports.h"
#include "Oneframe.h"
#include "PDCP-SN.h"
#include "PCI.h"
#include "PLMN-Identity.h"
#include "PRACH-Configuration.h"
#include "Pre-emptionCapability.h"
#include "Pre-emptionVulnerability.h"
#include "PriorityLevel.h"
#include "QCI.h"
#include "ReceiveStatusofULPDCPSDUs.h"
#include "Registration-Request.h"
#include "RelativeNarrowbandTxPower.h"
#include "ReportArea.h"
#include "ReportingPeriodicity.h"
#include "ReportCharacteristics.h"
#include "RNTP-Threshold.h"
#include "RRC-Context.h"
#include "RadioResourceStatus.h"
#include "DL-GBR-PRB-usage.h"
#include "UL-GBR-PRB-usage.h"
#include "DL-non-GBR-PRB-usage.h"
#include "UL-non-GBR-PRB-usage.h"
#include "DL-Total-PRB-usage.h"
#include "UL-Total-PRB-usage.h"
#include "RadioframeAllocationPeriod.h"
#include "RadioframeAllocationOffset.h"
#include "S1TNLLoadIndicator.h"
#include "ServedCellsToActivate.h"
#include "ServedCellsToActivate-Item.h"
#include "ServedCellsToModify.h"
#include "ServedCellsToModify-Item.h"
#include "Old-ECGIs.h"
#include "ServedCells.h"
#include "ServedCell-Information.h"
#include "ShortMAC-I.h"
#include "SRVCCOperationPossible.h"
#include "SubframeAssignment.h"
#include "SpecialSubframe-Info.h"
#include "SpecialSubframePatterns.h"
#include "SubscriberProfileIDforRFP.h"
#include "SubframeAllocation.h"
#include "TAC.h"
#include "TargeteNBtoSource-eNBTransparentContainer.h"
#include "TimeToWait.h"
#include "Time-UE-StayedInCell.h"
#include "TraceActivation.h"
#include "TraceCollectionEntityIPAddress.h"
#include "TraceDepth.h"
#include "Transmission-Bandwidth.h"
#include "TransportLayerAddress.h"
#include "TypeOfError.h"
#include "UE-HistoryInformation.h"
#include "UE-S1AP-ID.h"
#include "UE-X2AP-ID.h"
#include "UEAggregateMaximumBitRate.h"
#include "UESecurityCapabilities.h"
#include "UE-ContextInformation.h"
#include "UL-InterferenceOverloadIndication.h"
#include "UL-InterferenceOverloadIndication-Item.h"
#include "UL-HighInterferenceIndicationInfo.h"
#include "UL-HighInterferenceIndicationInfo-Item.h"
#include "UL-HighInterferenceIndication.h"
#include "UE-RLF-Report-Container.h"
#include "IE.h"
#include "X2AP-PDU.h"
#include "InitiatingMessage.h"
#include "SuccessfulOutcome.h"
#include "UnsuccessfulOutcome.h"
#include "HandoverRequest.h"
#include "HandoverRequestAcknowledge.h"
//#include "HandoverPreparation.h"
#include "HandoverPreparationFailure.h"
#include "SNStatusTransfer.h"
#include "UEContextRelease.h"
#include "HandoverCancel.h"
#include "HandoverReport.h"
#include "ErrorIndication.h"
#include "ResetRequest.h"
#include "ResetResponse.h"
#include "X2SetupRequest.h"
#include "X2SetupResponse.h"
#include "X2SetupFailure.h"
#include "LoadInformation.h"
#include "ENBConfigurationUpdate.h"
#include "ENBConfigurationUpdateAcknowledge.h"
#include "ENBConfigurationUpdateFailure.h"
#include "ResourceStatusRequest.h"
#include "ResourceStatusResponse.h"
#include "ResourceStatusFailure.h"
#include "ResourceStatusUpdate.h"
#include "RLFIndication.h"
#include "PrivateMessage.h"
#include "MobilityChangeRequest.h"
#include "MobilityChangeAcknowledge.h"
#include "MobilityChangeFailure.h"
#include "CellActivationRequest.h"
#include "CellActivationResponse.h"
#include "CellActivationFailure.h"

#ifndef X2AP_COMMON_H_
#define X2AP_COMMON_H_

/** @defgroup _x2ap_impl_ X2AP Layer Reference Implementation
 * @ingroup _ref_implementation_
 * @{
 */

/* Checking version of ASN1C compiler */
#if (ASN1C_ENVIRONMENT_VERSION < 923)
# error "You are compiling x2ap with the wrong version of ASN1C"
#endif

#ifndef X2AP_PORT
# define X2AP_PORT 36422
#endif

#define TRUE 1
#define FALSE 0

extern int asn_debug;
extern int asn1_xer_print;

#if defined(ENB_MODE)
# include "log.h"
# define X2AP_ERROR(x, args...) LOG_E(X2AP, x, ##args)
# define X2AP_WARN(x, args...)  LOG_W(X2AP, x, ##args)
# define X2AP_DEBUG(x, args...) LOG_D(X2AP, x, ##args)
#else
# define X2AP_ERROR(x, args...) do { fprintf(stdout, "[X2AP][E]"x, ##args); } while(0)
# define X2AP_WARN(x, args...)  do { fprintf(stdout, "[X2AP][W]"x, ##args); } while(0)
# define X2AP_DEBUG(x, args...) do { fprintf(stdout, "[X2AP][D]"x, ##args); } while(0)
#endif

//Forward declaration
struct x2ap_message_s;

/** \brief Function callback prototype.
 **/
typedef int (*x2ap_message_decoded_callback)(
    uint32_t assocId,
    uint32_t stream,
    struct x2ap_message_s *message);

/** \brief Encode a successfull outcome message
 \param buffer pointer to buffer in which data will be encoded
 \param length pointer to the length of buffer
 \param procedureCode Procedure code for the message
 \param criticality Criticality of the message
 \param td ASN1C type descriptor of the sptr
 \param sptr Deferenced pointer to the structure to encode
 @returns size in bytes encded on success or 0 on failure
 **/
ssize_t x2ap_generate_successfull_outcome(
    uint8_t               **buffer,
    uint32_t               *length,
Lionel Gauthier's avatar
 
Lionel Gauthier committed
291 292
    e_X2ap_ProcedureCode         procedureCode,
    X2ap_Criticality_t           criticality,
Lionel Gauthier's avatar
 
Lionel Gauthier committed
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
    asn_TYPE_descriptor_t  *td,
    void                   *sptr);

/** \brief Encode an initiating message
 \param buffer pointer to buffer in which data will be encoded
 \param length pointer to the length of buffer
 \param procedureCode Procedure code for the message
 \param criticality Criticality of the message
 \param td ASN1C type descriptor of the sptr
 \param sptr Deferenced pointer to the structure to encode
 @returns size in bytes encded on success or 0 on failure
 **/
ssize_t x2ap_generate_initiating_message(
    uint8_t               **buffer,
    uint32_t               *length,
Lionel Gauthier's avatar
 
Lionel Gauthier committed
308 309
    e_X2ap_ProcedureCode    procedureCode,
    X2ap_Criticality_t      criticality,
Lionel Gauthier's avatar
 
Lionel Gauthier committed
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
    asn_TYPE_descriptor_t  *td,
    void                   *sptr);

/** \brief Encode an unsuccessfull outcome message
 \param buffer pointer to buffer in which data will be encoded
 \param length pointer to the length of buffer
 \param procedureCode Procedure code for the message
 \param criticality Criticality of the message
 \param td ASN1C type descriptor of the sptr
 \param sptr Deferenced pointer to the structure to encode
 @returns size in bytes encded on success or 0 on failure
 **/
ssize_t x2ap_generate_unsuccessfull_outcome(
    uint8_t               **buffer,
    uint32_t               *length,
Lionel Gauthier's avatar
 
Lionel Gauthier committed
325 326
    e_X2ap_ProcedureCode         procedureCode,
    X2ap_Criticality_t           criticality,
Lionel Gauthier's avatar
 
Lionel Gauthier committed
327 328 329 330 331 332 333 334 335 336
    asn_TYPE_descriptor_t  *td,
    void                   *sptr);

/** \brief Generate a new IE
 \param id Protocol ie id of the IE
 \param criticality Criticality of the IE
 \param type ASN1 type descriptor of the IE value
 \param sptr Structure to be encoded in the value field
 @returns a pointer to the newly created IE structure or NULL in case of failure
 **/
Lionel Gauthier's avatar
 
Lionel Gauthier committed
337 338 339 340 341
X2ap_IE_t *x2ap_new_ie(
    X2ap_ProtocolIE_ID_t   id,
    X2ap_Criticality_t     criticality,
    asn_TYPE_descriptor_t *type,
    void                  *sptr);
Lionel Gauthier's avatar
 
Lionel Gauthier committed
342 343 344 345 346

/** \brief Handle criticality
 \param criticality Criticality of the IE
 @returns void
 **/
Lionel Gauthier's avatar
 
Lionel Gauthier committed
347
void x2ap_handle_criticality(X2ap_Criticality_t criticality);
Lionel Gauthier's avatar
 
Lionel Gauthier committed
348 349

#endif /* X2AP_COMMON_H_ */