1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 2 /* 3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License version 2 as 7 * published by the Free Software Foundation; 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * 18 * Author: Manuel Requena <manuel.requena@cttc.es> 19 */ 20 21 #ifndef FF_MAC_COMMON_H 22 #define FF_MAC_COMMON_H 23 24 #include <ns3/simple-ref-count.h> 25 #include <ns3/ptr.h> 26 #include <vector> 27 28 29 /** 30 * Constants. See section 4.4 31 */ 32 #define MAX_SCHED_CFG_LIST 10 33 #define MAX_LC_LIST 10 34 35 #define MAX_RACH_LIST 30 36 #define MAX_DL_INFO_LIST 30 37 #define MAX_BUILD_DATA_LIST 30 38 #define MAX_BUILD_RAR_LIST 10 39 #define MAX_BUILD_BC_LIST 3 40 #define MAX_UL_INFO_LIST 30 41 #define MAX_DCI_LIST 30 42 #define MAX_PHICH_LIST 30 43 #define MAX_TB_LIST 2 44 #define MAX_RLC_PDU_LIST 30 45 #define MAX_NR_LCG 4 46 #define MAX_MBSFN_CONFIG 5 47 #define MAX_SI_MSG_LIST 32 48 #define MAX_SI_MSG_SIZE 65535 49 50 #define MAX_CQI_LIST 30 51 #define MAX_UE_SELECTED_SB 6 52 #define MAX_HL_SB 25 53 #define MAX_SINR_RB_LIST 100 54 #define MAX_SR_LIST 30 55 #define MAX_MAC_CE_LIST 30 56 57 namespace ns3 { 58 59 /// Result_e enumeration 60 enum Result_e 61 { 62 SUCCESS, 63 FAILURE 64 }; 65 66 /// SetupRelease_e enumeration 67 enum SetupRelease_e 68 { 69 setup, 70 release 71 }; 72 73 /// CeBitmap_e 74 enum CeBitmap_e 75 { 76 TA, 77 DRX, 78 CR 79 }; 80 81 /// NormalExtended_e enumeration 82 enum NormalExtended_e 83 { 84 normal, 85 extended 86 }; 87 88 89 /** 90 * \brief See section 4.3.1 dlDciListElement 91 * \struct DlDciListElement_s 92 */ 93 struct DlDciListElement_s 94 { 95 uint16_t m_rnti {UINT16_MAX}; ///< RNTI 96 uint32_t m_rbBitmap {UINT8_MAX}; ///< RB bitmap 97 uint8_t m_rbShift {UINT8_MAX}; ///< RB shift 98 uint8_t m_resAlloc {UINT8_MAX}; ///< The type of resource allocation 99 std::vector <uint16_t> m_tbsSize; ///< The TBs size 100 std::vector <uint8_t> m_mcs; ///< MCS 101 std::vector <uint8_t> m_ndi; ///< New data indicator 102 std::vector <uint8_t> m_rv; ///< Redundancy version 103 uint8_t m_cceIndex {UINT8_MAX}; ///< Control Channel Element index 104 uint8_t m_aggrLevel {UINT8_MAX}; ///< The aggregation level 105 uint8_t m_precodingInfo {UINT8_MAX}; ///< precoding info 106 /// Format enumeration 107 enum Format_e 108 { 109 ONE, ONE_A, ONE_B, ONE_C, ONE_D, TWO, TWO_A, TWO_B, NotValid_Dci_Format 110 } m_format {NotValid_Dci_Format}; ///< the format 111 uint8_t m_tpc {UINT8_MAX}; ///< Tx power control command 112 uint8_t m_harqProcess {UINT8_MAX}; ///< HARQ process 113 uint8_t m_dai {UINT8_MAX}; ///< DL assignment index 114 /// Vrb Format enum 115 enum VrbFormat_e 116 { 117 VRB_DISTRIBUTED, 118 VRB_LOCALIZED, 119 NotValid_VRB_Format 120 } m_vrbFormat {NotValid_VRB_Format}; ///< the format 121 bool m_tbSwap {false}; ///< swap? 122 bool m_spsRelease {false}; ///< release? 123 bool m_pdcchOrder {false}; ///< cch order? 124 uint8_t m_preambleIndex {UINT8_MAX}; ///< preamble index 125 uint8_t m_prachMaskIndex {UINT8_MAX}; ///< RACH mask index 126 /// Ngap enum 127 enum Ngap_e 128 { 129 GAP1, GAP2, NotValid_Ngap 130 } m_nGap {NotValid_Ngap}; ///< the gap 131 uint8_t m_tbsIdx {UINT8_MAX}; ///< tbs index 132 uint8_t m_dlPowerOffset {UINT8_MAX}; ///< DL power offset 133 uint8_t m_pdcchPowerOffset {UINT8_MAX}; ///< CCH power offset 134 }; 135 136 /** 137 * \brief See section 4.3.2 ulDciListElement 138 * \struct UlDciListElement_s 139 */ 140 struct UlDciListElement_s 141 { 142 uint16_t m_rnti {UINT16_MAX}; ///< RNTI 143 uint8_t m_rbStart {UINT8_MAX}; ///< start 144 uint8_t m_rbLen {UINT8_MAX}; ///< length 145 uint16_t m_tbSize {UINT16_MAX}; ///< size 146 uint8_t m_mcs {UINT8_MAX}; ///< MCS 147 uint8_t m_ndi {UINT8_MAX}; ///< NDI 148 uint8_t m_cceIndex {UINT8_MAX}; ///< Control Channel Element index 149 uint8_t m_aggrLevel {UINT8_MAX}; ///< The aggregation level 150 uint8_t m_ueTxAntennaSelection {UINT8_MAX}; ///< UE antenna selection 151 bool m_hopping {false}; ///< hopping? 152 uint8_t m_n2Dmrs {UINT8_MAX}; ///< n2 DMRS 153 int8_t m_tpc {INT8_MIN}; ///< Tx power control command 154 bool m_cqiRequest {false}; ///< CQI request 155 uint8_t m_ulIndex {UINT8_MAX}; ///< UL index 156 uint8_t m_dai {UINT8_MAX}; ///< DL assignment index 157 uint8_t m_freqHopping {UINT8_MAX}; ///< freq hopping 158 int8_t m_pdcchPowerOffset {INT8_MIN}; ///< CCH power offset 159 }; 160 161 /** 162 * \brief Base class for storing the values of vendor specific parameters 163 */ 164 struct VendorSpecificValue : public SimpleRefCount<VendorSpecificValue> 165 { 166 virtual ~VendorSpecificValue (); 167 168 }; 169 170 /** 171 * \brief See section 4.3.3 vendorSpecifiListElement 172 * \struct VendorSpecificListElement_s 173 */ 174 struct VendorSpecificListElement_s 175 { 176 uint32_t m_type {UINT32_MAX}; ///< type 177 uint32_t m_length {UINT32_MAX}; ///< length 178 Ptr<VendorSpecificValue> m_value; ///< value 179 }; 180 181 /** 182 * \brief See section 4.3.4 logicalChannelConfigListElement 183 * \struct LogicalChannelConfigListElement_s 184 */ 185 struct LogicalChannelConfigListElement_s 186 { 187 uint8_t m_logicalChannelIdentity {UINT8_MAX}; ///< logical channel identity 188 uint8_t m_logicalChannelGroup {UINT8_MAX}; ///< logical channel group 189 190 /// Direction enum 191 enum Direction_e 192 { 193 DIR_UL, 194 DIR_DL, 195 DIR_BOTH, 196 NotValid 197 } m_direction {NotValid}; ///< the direction 198 199 /// QosBearerType enum 200 enum QosBearerType_e 201 { 202 QBT_NON_GBR, 203 QBT_GBR, 204 NotValid_QosBearerType 205 } m_qosBearerType {NotValid_QosBearerType}; ///< the QOS bearer type 206 207 uint8_t m_qci {UINT8_MAX}; ///< QCI 208 uint64_t m_eRabMaximulBitrateUl {UINT64_MAX}; ///< ERAB maximum bit rate UL 209 uint64_t m_eRabMaximulBitrateDl {UINT64_MAX}; ///< ERAB maximum bit rate DL 210 uint64_t m_eRabGuaranteedBitrateUl {UINT64_MAX}; ///< ERAB guaranteed bit rate UL 211 uint64_t m_eRabGuaranteedBitrateDl {UINT64_MAX}; ///< ERAB guaranteed bit rate DL 212 }; 213 214 /** 215 * \brief See section 4.3.6 rachListElement 216 * \struct RachListElement_s 217 */ 218 struct RachListElement_s 219 { 220 uint16_t m_rnti {UINT16_MAX}; ///< RNTI 221 uint16_t m_estimatedSize {UINT16_MAX}; ///< estimated size 222 }; 223 224 /** 225 * \brief See section 4.3.7 phichListElement 226 * \struct PhichListElement_s 227 */ 228 struct PhichListElement_s 229 { 230 uint16_t m_rnti {UINT16_MAX}; ///< RNTI 231 /// Phich enum 232 enum Phich_e 233 { 234 ACK, NACK, NotValid 235 } m_phich {NotValid}; ///< the phich 236 }; 237 238 /** 239 * \brief See section 4.3.9 rlcPDU_ListElement 240 */ 241 struct RlcPduListElement_s 242 { 243 uint8_t m_logicalChannelIdentity {UINT8_MAX}; ///< logical channel identity 244 uint16_t m_size {UINT16_MAX}; ///< size 245 }; 246 247 /** 248 * \brief See section 4.3.8 builDataListElement 249 * \struct BuildDataListElement_s 250 */ 251 struct BuildDataListElement_s 252 { 253 uint16_t m_rnti {UINT16_MAX}; ///< RNTI 254 struct DlDciListElement_s m_dci; ///< DCI 255 std::vector <enum CeBitmap_e> m_ceBitmap; ///< CE bitmap 256 std::vector < std::vector <struct RlcPduListElement_s> > m_rlcPduList; ///< RLC PDU list 257 }; 258 259 /** 260 * \brief Substitutive structure for specifying BuildRarListElement_s::m_grant field 261 */ 262 struct UlGrant_s 263 { 264 uint16_t m_rnti {UINT16_MAX}; ///< RNTI 265 uint8_t m_rbStart {UINT8_MAX}; ///< start 266 uint8_t m_rbLen {UINT8_MAX}; ///< length 267 uint16_t m_tbSize {UINT16_MAX}; ///< size 268 uint8_t m_mcs {UINT8_MAX}; ///< MCS 269 bool m_hopping {false}; ///< hopping? 270 int8_t m_tpc {INT8_MIN}; ///< Tx power control command 271 bool m_cqiRequest {false}; ///< CQI request? 272 bool m_ulDelay {false}; ///< UL delay? 273 }; 274 275 /** 276 * \brief See section 4.3.10 buildRARListElement 277 */ 278 struct BuildRarListElement_s 279 { 280 uint16_t m_rnti {UINT16_MAX}; ///< RNTI 281 //uint32_t m_grant; // Substituted with type UlGrant_s 282 UlGrant_s m_grant; ///< grant 283 struct DlDciListElement_s m_dci; ///< DCI 284 }; 285 286 /** 287 * \brief See section 4.3.11 buildBroadcastListElement 288 */ 289 struct BuildBroadcastListElement_s 290 { 291 /// Type enum 292 enum Type_e 293 { 294 BCCH, PCCH, NotValid 295 } m_type {NotValid}; ///< the type 296 uint8_t m_index {UINT8_MAX}; ///< index 297 struct DlDciListElement_s m_dci; ///< DCI 298 }; 299 300 /** 301 * \brief See section 4.3.12 ulInfoListElement 302 */ 303 struct UlInfoListElement_s 304 { 305 uint16_t m_rnti {UINT16_MAX}; ///< RNTI 306 std::vector <uint16_t> m_ulReception; ///< UL reception 307 /// Reception status enum 308 enum ReceptionStatus_e 309 { 310 Ok, NotOk, NotValid 311 } m_receptionStatus {NotValid}; ///< the status 312 uint8_t m_tpc {UINT8_MAX}; ///< Tx power control command 313 }; 314 315 /** 316 * \brief See section 4.3.13 srListElement 317 */ 318 struct SrListElement_s 319 { 320 uint16_t m_rnti {UINT16_MAX}; ///< RNTI 321 }; 322 323 /** 324 * \brief See section 4.3.15 macCEValue 325 */ 326 struct MacCeValue_u 327 { 328 uint8_t m_phr {UINT8_MAX}; ///< phr 329 uint8_t m_crnti {UINT8_MAX}; ///< NRTI 330 std::vector <uint8_t> m_bufferStatus; ///< buffer status 331 }; 332 333 /** 334 * \brief See section 4.3.14 macCEListElement 335 */ 336 struct MacCeListElement_s 337 { 338 uint16_t m_rnti {UINT16_MAX}; ///< RNTI 339 /// MAC CE type enum 340 enum MacCeType_e 341 { 342 BSR, PHR, CRNTI, NotValid 343 } m_macCeType {NotValid}; ///< MAC CE type 344 struct MacCeValue_u m_macCeValue; ///< MAC CE value 345 }; 346 347 /** 348 * \brief See section 4.3.16 drxConfig 349 */ 350 struct DrxConfig_s 351 { 352 uint8_t m_onDurationTimer {UINT8_MAX}; ///< on duration timer 353 uint16_t m_drxInactivityTimer {UINT16_MAX}; ///< inactivity timer 354 uint16_t m_drxRetransmissionTimer {UINT16_MAX}; ///< retransmission timer 355 uint16_t m_longDrxCycle {UINT16_MAX}; ///< long DRX cycle 356 uint16_t m_longDrxCycleStartOffset {UINT16_MAX}; ///< long DRX cycle start offset 357 uint16_t m_shortDrxCycle {UINT16_MAX}; ///< short DRX cycle 358 uint8_t m_drxShortCycleTimer {UINT8_MAX}; ///< short DRX cycle timer 359 }; 360 361 /** 362 * \brief See section 4.3.17 spsConfig 363 */ 364 struct SpsConfig_s 365 { 366 uint16_t m_semiPersistSchedIntervalUl {UINT16_MAX}; ///< UL semi persist schedule interval 367 uint16_t m_semiPersistSchedIntervalDl {UINT16_MAX}; ///< DL semi persist schedule interval 368 uint8_t m_numberOfConfSpsProcesses {UINT8_MAX}; ///< number of conf SPS process 369 uint8_t m_n1PucchAnPersistentListSize {UINT8_MAX}; ///< N1pu CCH persistent list size 370 std::vector <uint16_t> m_n1PucchAnPersistentList; ///< N1pu CCH persistent list 371 uint8_t m_implicitReleaseAfter {UINT8_MAX}; ///< implicit release after 372 }; 373 374 /** 375 * \brief See section 4.3.18 srConfig 376 */ 377 struct SrConfig_s 378 { 379 enum SetupRelease_e m_action {setup}; ///< action 380 uint8_t m_schedInterval {UINT8_MAX}; ///< sched interval 381 uint8_t m_dsrTransMax {UINT8_MAX}; ///< trans max 382 }; 383 384 /** 385 * \brief See section 4.3.19 cqiConfig 386 */ 387 struct CqiConfig_s 388 { 389 enum SetupRelease_e m_action {setup}; ///< action 390 uint16_t m_cqiSchedInterval {UINT16_MAX}; ///< CQI schedule interval 391 uint8_t m_riSchedInterval {UINT8_MAX}; ///< RI schedule interval 392 }; 393 394 /** 395 * \brief See section 4.3.20 ueCapabilities 396 */ 397 struct UeCapabilities_s 398 { 399 bool m_halfDuplex {false}; ///< half duplex 400 bool m_intraSfHopping {false}; ///< intra SF hopping 401 bool m_type2Sb1 {false}; ///< type 2Sb1 402 uint8_t m_ueCategory {UINT8_MAX}; ///< UE category 403 bool m_resAllocType1 {false}; ///< alloc type 1 404 }; 405 406 /** 407 * \brief See section 4.3.22 siMessageListElement 408 */ 409 struct SiMessageListElement_s 410 { 411 uint16_t m_periodicity {UINT16_MAX}; ///< periodicity 412 uint16_t m_length {UINT16_MAX}; ///< length 413 }; 414 415 /** 416 * \brief See section 4.3.21 siConfiguration 417 */ 418 struct SiConfiguration_s 419 { 420 uint16_t m_sfn {UINT16_MAX}; ///< sfn 421 uint16_t m_sib1Length {UINT16_MAX}; ///< sib1 length 422 uint8_t m_siWindowLength {UINT8_MAX}; ///< window length 423 std::vector <struct SiMessageListElement_s> m_siMessageList; ///< message list 424 }; 425 426 /** 427 * \brief See section 4.3.23 dlInfoListElement 428 */ 429 struct DlInfoListElement_s 430 { 431 uint16_t m_rnti {UINT16_MAX}; ///< RNTI 432 uint8_t m_harqProcessId {UINT8_MAX}; ///< HARQ process ID 433 /// HARQ status enum 434 enum HarqStatus_e 435 { 436 ACK, NACK, DTX 437 }; 438 std::vector <enum HarqStatus_e> m_harqStatus; ///< HARQ status 439 }; 440 441 /** 442 * \brief See section 4.3.28 bwPart 443 */ 444 struct BwPart_s 445 { 446 uint8_t m_bwPartIndex {UINT8_MAX}; ///< bw part index 447 uint8_t m_sb {UINT8_MAX}; ///< sb 448 uint8_t m_cqi {UINT8_MAX}; ///< CQI 449 }; 450 451 /** 452 * \brief See section 4.3.27 higherLayerSelected 453 */ 454 struct HigherLayerSelected_s 455 { 456 uint8_t m_sbPmi {UINT8_MAX}; ///< sb PMI 457 std::vector <uint8_t> m_sbCqi; ///< sb CQI 458 }; 459 460 /** 461 * \brief See section 4.3.26 ueSelected 462 */ 463 struct UeSelected_s 464 { 465 std::vector <uint8_t> m_sbList; ///< sb list 466 uint8_t m_sbPmi {UINT8_MAX}; ///< sb PMI 467 std::vector <uint8_t> m_sbCqi; ///< sb CQI 468 }; 469 470 /** 471 * \brief See section 4.3.25 sbMeasResult 472 */ 473 struct SbMeasResult_s 474 { 475 struct UeSelected_s m_ueSelected; ///< UE selected 476 std::vector <struct HigherLayerSelected_s> m_higherLayerSelected; ///< higher layer selected 477 struct BwPart_s m_bwPart; ///< bw part 478 }; 479 480 /** 481 * \brief See section 4.3.24 cqiListElement 482 */ 483 struct CqiListElement_s 484 { 485 uint16_t m_rnti {UINT16_MAX}; ///< RNTI 486 uint8_t m_ri {UINT8_MAX}; ///< RI 487 /// CqiType_e enumeration 488 enum CqiType_e 489 { 490 P10, P11, P20, P21, A12, A22, A20, A30, A31, NotValid 491 } m_cqiType {NotValid}; ///< CQI type 492 std::vector <uint8_t> m_wbCqi; ///< wb CQI 493 uint8_t m_wbPmi {UINT8_MAX}; ///< wb PMI 494 495 struct SbMeasResult_s m_sbMeasResult; ///< sb measure result 496 }; 497 498 /** 499 * \brief See section 4.3.29 ulCQI 500 */ 501 struct UlCqi_s 502 { 503 std::vector <uint16_t> m_sinr; ///< SINR 504 /// Type_e enumeration 505 enum Type_e 506 { 507 SRS, 508 PUSCH, 509 PUCCH_1, 510 PUCCH_2, 511 PRACH, 512 NotValid 513 } m_type {NotValid}; ///< type 514 }; 515 516 /** 517 * \brief See section 4.3.30 pagingInfoListElement 518 */ 519 struct PagingInfoListElement_s 520 { 521 uint8_t m_pagingIndex {UINT8_MAX}; ///< paging index 522 uint16_t m_pagingMessageSize {UINT16_MAX}; ///< paging message size 523 uint8_t m_pagingSubframe {UINT8_MAX}; ///< paging subframe 524 }; 525 526 } // namespace ns3 527 528 #endif /* FF_MAC_COMMON_H */ 529