<!-- SPDX-License-Identifier: CC-BY-4.0 -->

# Example runs of nfapi_hex_parser
## 1 - An invalid DL_TTI.request
```
./nfapi/open-nFAPI/utils/nfapi_hex_parser 0x00 0x00 0x00 0x80 0x00 0x00 0x01 0x7e 0x00 0x62 0x00 0x00 0x03 0x01 0x00 0x03 0x00 0x15 0x00 0x01 0x00 0x00 0x00 0x00 0x18 0x01 0x06 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x34 0x01 0x11 0x00 0x00 0x00 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0xe0 0x01 0x01 0x06 0x02 0x00 0x00 0x01 0x00 0x00 0x01 0xff 0xff 0x00 0x01 0x00 0x00 0x00 0x04 0x00 0x01 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x1c 0x00 0x00 0x00 0x80 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x71 0x00 0x00 0xff 0xff 0x00 0x00 0x01 0x11 0x00 0x00 0x00 0x00 0x01 0x01 0x34 0x02 0x04 0x00 0x00 0x00 0x00 0x00 0x7b 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x04 0x00 0x00 0x01 0x00 0x01 0x00 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x2d 0x00 0x0e 0x00 0x03 0x0b 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Parsed 382 bytes:
00 00 00 80 00 00 01 7e   00 62 00 00 03 01 00 03
00 15 00 01 00 00 00 00   18 01 06 00 0d 00 00 00
00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 34 01   11 00 00 00 00 00 02 00
00 00 00 e0 01 01 06 02   00 00 01 00 00 01 ff ff
00 01 00 00 00 04 00 01   00 01 00 00 00 00 00 00
00 00 1c 00 00 00 80 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00   00 01 00 71 00 00 ff ff
00 00 01 11 00 00 00 00   01 01 34 02 04 00 00 00
00 00 7b 00 00 00 00 00   00 00 00 00 00 00 01 01
00 00 00 04 00 00 01 00   01 00 01 01 00 00 00 00
00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 2d 00 0e 00 03 0b 00   00 00 00 00 00 01 00 01
00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00   00 00 00 00 00 00
Decoded message NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST message length 0x17e
Message ID = 0x80
Message Length = 0x17e
  SFN = 98
  Slot = 0
  nPDUs = 3
  nGroup = 1
    PDU #0
    PDUType = 0x03 (NFAPI_NR_DL_TTI_SSB_PDU_TYPE)
    PDUSize = 0x15
      physCellId = 1
      BetaPss = 0
      SSBBlockIndex = 0
      SSBSubcarrierOffset = 0
      SSBOffsetPointA = 24
      bchPayloadFlag = 1
      bchPayload = 6000d
        numPRGs = 0
        prgSize = 0
        digBFInterfaces = 0
    PDU #1
    PDUType = 0x00 (NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE)
    PDUSize = 0x00
      BWPSize = 0
      BWPStart = 0
      Subcarrier Spacing = 0
      Ciclic Prefix = 0
      StartSymbolIndex = 0
      DurationSymbols = 0
      FrequencyDomainResource : 0 0 0 0 0 0
      CCE Reg Mapping Type = 0
      Reg Bundle Size = 0
      Interleaver Size = 0
      CoreSetType = 0
      ShiftIndex = 0
      precoderGranularity = 0
      numDLDCI = 0
    PDU #2
    PDUType = 0x00 (NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE)
    PDUSize = 0x00
      BWPSize = 0
      BWPStart = 0
      Subcarrier Spacing = 0
      Ciclic Prefix = 0
      StartSymbolIndex = 0
      DurationSymbols = 0
      FrequencyDomainResource : 0 0 0 0 0 0
      CCE Reg Mapping Type = 0
      Reg Bundle Size = 0
      Interleaver Size = 0
      CoreSetType = 0
      ShiftIndex = 0
      precoderGranularity = 0
      numDLDCI = 0
    Group #0
    nUe[0] = 0x00
```

## 2 - A valid ERROR.indication
```
./nfapi/open-nFAPI/utils/nfapi_hex_parser 0x00 0x00 0x00 0x07 0x00 0x00 0x00 0x06 0x00 0x0a 0x00 0x10 0x80 0x06
Parsed values:
00 00 00 07 00 00 00 06   00 0a 00 10 80 06
Processing message NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION
Message ID = 0x07
Message Length = 0x06
SFN = 0x0a
Slot = 0x10
Message ID = 0x80
Error Code = 0x06 (NFAPI_NR_PHY_API_MSG_INVALID_SFN)
```

## 3 - A valid SLOT.indication
```
./nfapi/open-nFAPI/utils/nfapi_hex_parser 0x00 0x01 0x00 0x82 0x00 0x00 0x00 0x04 0x00 0x05 0x00 0x06
Parsed values:
00 01 00 82 00 00 00 04   00 05 00 06
Processing message NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION
Message ID = 0x82
Message Length = 0x04
SFN = 5
Slot = 6
```

## 4 - A valid ERROR.indication, with diverging formats for the hexdump passed as a parameter
```
user@user-PC:~/nfapi_parser/cmake_targets/ran_build/build$ ./nfapi/open-nFAPI/utils/nfapi_hex_parser "00 0 0x00 7 0x00 0x00 0x00" 0x06 0x00 "a 0x00 0x10 0x80 7"
Parsed 14 bytes:
00 00 00 07 00 00 00 06   00 0a 00 10 80 07
Decoded message NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION message length 0x06
Message ID = 0x07
Message Length = 0x06
  SFN = 0x0a (10)
  Slot = 0x10 (16)
  Message ID = 0x80
  Error Code = 0x07 (NFAPI_NR_PHY_API_MSG_UL_DCI_ERR)
```

## 5 - An invalid message, passing less bytes than the minimum required to encode a FAPI message header
```
user@user-PC:~/nfapi_parser/cmake_targets/ran_build/build$ ./nfapi/open-nFAPI/utils/nfapi_hex_parser 1
Parsed 1 bytes:
01

Assertion (byte_count >= sizeof(fapi_message_header_t)) failed!
In main() /home/user/nfapi_parser/nfapi/open-nFAPI/utils/nfapi_hex_parser.c:293
Read byte amount not enough to encode the header. Should have a minimum of 8 bytes, aborting...
Exiting execution
/home/user/nfapi_parser/nfapi/open-nFAPI/utils/nfapi_hex_parser.c:293 main() Exiting OAI (n)FAPI Hex Parser: _Assert_Exit_
Aborted (core dumped)
```

## 7 - A valid DL_TTI.request
```
./nfapi/open-nFAPI/utils/nfapi_hex_parser 0x00 0x01 0x00 0x80 0x00 0x00 0x00 0xc3 0x00 0x02 0x00 0x00 0x03 0x00 0x00 0x03 0x00 0x19 0x00 0x00 0x00 0x00 0x0c 0x00 0xfc 0x01 0x06 0xc6 0x01 0x00 0x00 0x01 0x01 0x13 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x31 0x00 0x30 0x00 0x6e 0x01 0x00 0x00 0x01 0xff 0x00 0x00 0x00 0x00 0x00 0x01 0x06 0x02 0x00 0x00 0x00 0x00 0x00 0x01 0xff 0xff 0x00 0x00 0x00 0x00 0x00 0x04 0x00 0x00 0x00 0x00 0x01 0x00 0x01 0x00 0x27 0x00 0x00 0x14 0x01 0x2d 0x00 0x01 0x00 0x61 0x00 0x00 0xff 0xff 0x00 0x00 0x00 0x30 0x00 0x6e 0x01 0x00 0x01 0x0e 0xce 0x02 0x05 0x00 0x00 0x00 0x00 0x00 0x81 0x00 0x00 0x01 0x00 0x01 0x02 0x44 0x00 0x00 0x00 0x00 0x02 0x00 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x10 0x00 0x02 0x0a 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x02 0x00 0x00 0xe0 0x20 0x10 0x29 0x00 0x01 0x62 0x00 0x00 0x00
Parsed 193 bytes:
00 01 00 80 00 00 00 c3   00 02 00 00 03 00 00 03
00 19 00 00 00 00 0c 00   fc 01 06 c6 01 00 00 01
01 13 01 00 00 00 00 00   00 00 31 00 30 00 6e 01
00 00 01 ff 00 00 00 00   00 01 06 02 00 00 00 00
00 01 ff ff 00 00 00 00   00 04 00 00 00 00 01 00
01 00 27 00 00 14 01 2d   00 01 00 61 00 00 ff ff
00 00 00 30 00 6e 01 00   01 0e ce 02 05 00 00 00
00 00 81 00 00 01 00 01   02 44 00 00 00 00 02 00
01 01 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00   00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00   00 10 00 02 0a 00 00 00
00 01 00 00 02 00 00 e0   20 10 29 00 01 62 00 00
00
Decoded message NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST message length 0xc3
Message ID = 0x80
Message Length = 0xc3
  SFN = 2
  Slot = 0
  nPDUs = 3
  nGroup = 0
    PDU #0
    PDUType = 0x03 (NFAPI_NR_DL_TTI_SSB_PDU_TYPE)
    PDUSize = 0x19
      physCellId = 0
      BetaPss = 0
      SSBBlockIndex = 0
      SSBSubcarrierOffset = 12
      SSBOffsetPointA = 252
      bchPayloadFlag = 1
      bchPayload = 6c601
        numPRGs = 1
        prgSize = 275
        digBFInterfaces = 1
          PMIdx = 0
            beamIDX = 0
    PDU #1
    PDUType = 0x00 (NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE)
    PDUSize = 0x31
      BWPSize = 48
      BWPStart = 110
      Subcarrier Spacing = 1
      Ciclic Prefix = 0
      StartSymbolIndex = 0
      DurationSymbols = 1
      FrequencyDomainResource : 255 0 0 0 0 0
      CCE Reg Mapping Type = 1
      Reg Bundle Size = 6
      Interleaver Size = 2
      CoreSetType = 0
      ShiftIndex = 0
      precoderGranularity = 0
      numDLDCI = 1
        RNTI = 0xffff
        ScramblingId = 0
        ScramblingRNTI = 0x0
        CCEIndex = 0
        AggregationLevel = 4
          numPRGs = 0
          prgSize = 0
          digBFInterfaces = 1
        beta_PDCCH_1_0 = 0
        powerControlOffsetSS = 1
        PayloadSizeBits = 39
        Payload = 0x00 0x00 0x14 0x01 0x2d
    PDU #2
    PDUType = 0x01 (NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE)
    PDUSize = 0x61
      pduBitmap = 0
      RNTI = ffff
      pduIndex = 0
      BWPSize = 48
      BWPStart = 110
      SubcarrierSpacing = 1
      CyclicPrefix = 0
      NrOfCodewords = 1
        Codeword #0
          targetCoderate = 3790
          qamModOrder = 2
          mcsIndex = 5
          mcsTable = 0
          rvIndex = 0
          TBSize = 129
      dataScramblingId = 0
      nrOfLayers = 1
      transmissionScheme = 0
      refPoint = 1
      dlDmrsSymbPos = 580
      dmrsConfigType = 0
      dlDmrsScramblingId = 0
      SCID = 0
      numDmrsCdmGrpsNoData = 2
      dmrsPorts = 1
      resourceAlloc = 1
      rbBitmap = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
      rbStart = 0
      rbSize = 16
      VRBtoPRBMapping = 0
      StartSymbolIndex = 2
      NrOfSymbols = 10
      PTRSPortIndex = 0
      PTRSTimeDensity = 0
      PTRSFreqDensity = 0
      PTRSReOffset = 0
      nEpreRatioOfPDSCHToPTRS = 0
        numPRGs = 0
        prgSize = 0
        digBFInterfaces = 1
      powerControlOffset = 0
      powerControlOffsetSS = 0
      isLastCbPresent = 0
      isInlineTbCrc = 0
      dlTbCrc = 0
```

## 7 - A Valid UL_TTI.request

```
./nfapi/open-nFAPI/utils/nfapi_hex_parser 0x00 0x01 0x00 0x81 0x00 0x00 0x00 0x98 0x02 0xd0 0x00 0x04 0x02 0x00 0x00 0x01 0x00 0x00 0x03 0x00 0x45 0x30 0x39 0x00 0x00 0x00 0x00 0x01 0x11 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x0c 0x3d 0x00 0x28 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x00 0x50 0x00 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x10 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x01 0x00 0x01 0x00 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x02 0x00 0x38 0x30 0x39 0x00 0x00 0x00 0x00 0x01 0x11 0x00 0x00 0x01 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x03 0x0d 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x28 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Parsed 150 bytes:
00 01 00 81 00 00 00 98   02 d0 00 04 02 00 00 01 
00 00 03 00 45 30 39 00   00 00 00 01 11 00 00 01 
00 00 00 00 0c 3d 00 28   00 00 00 00 00 00 00 00 
00 02 00 50 00 04 00 00   00 00 00 00 01 10 00 00 
00 00 00 00 00 02 01 00   01 00 01 01 00 00 00 00 
00 00 00 00 00 00 00 02   00 38 30 39 00 00 00 00 
01 11 00 00 01 00 02 00   00 00 00 00 03 0d 01 00 
00 00 00 00 00 28 00 00   00 00 00 00 00 00 00 00 
00 00 00 00 00 07 00 00   00 00 00 00 00 00 00 00 
00 00 00 00 00 00 
Decoded message NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST message length 0x98
Message ID = 0x81
Message Length = 0x98
  SFN = 720
  Slot = 4
  nPDUs = 2
  RachPresent = 0
  nULSCH = 0
  nULCCH = 1
  nGroup = 0
    PDU #0
    PDUType = 0x03 (NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE)
    PDUSize = 0x45
      RNTI = 3039
      Handle = 0
      BWPSize = 273
      BWPStart = 0
      SubcarrierSpacing = 1
      CyclicPrefix = 0
      numAntPorts = 0
      numSymbols = 0
      numRepetitions = 0
      timeStartPosition = 12
      configIndex = 61
      sequenceId = 40
      bandwidthIndex = 0
      combSize = 0
      combOffset = 0
      cyclicShift = 0
      frequencyPosition = 0
      frequencyShift = 0
      frequencyHopping = 0
      groupOrSequenceHopping = 0
      resourceType = 2
      Tsrs = 80
      Toffset = 4
        TRP Scheme = 0
        numPRGs = 0
        prgSize = 0
        digBFInterface = 0
        srsBandwidthSize = 272
        Symbol #0
          srsBandwidthStart = 0
          sequenceGroup = 0
          sequenceNumber = 0
        Usage = 2 (nUsage = 1)
          ReportType[0] = 1
        singular Value Representation = 0
        iq Representation = 1
        prgSize = 1
        numTotalUeAntennas = 1
        ueAntennasInThisSrsResourceSet = 0
        sampledUeAntennas = 0
        reportScope = 0
        NumULSpatialStreamsPorts = 0
    PDU #1
    PDUType = 0x02 (NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE)
    PDUSize = 0x38
      RNTI = 3039
      Handle = 0
      BWPSize = 273
      BWPStart = 0
      SubcarrierSpacing = 1
      CyclicPrefix = 0
      FormatType = 2
      multiSlotTxIndicator = 0
      pi2Bpsk = 0
      prbStart = 0
      prbSize = 3
      StartSymbolIndex = 13
      NrOfSymbols = 1
      freqHopFlag = 0
      secondHopPRB = 0
      groupHopFlag = 0
      sequenceHopFlag = 0
      hoppingId = 40
      InitialCyclicShift = 0
      dataScramblingId = 0
      TimeDomainOccIdx = 0
      PreDftOccIdx = 0
      PreDftOccLen = 0
      AddDmrsFlag = 0
      DmrsScramblingId = 0
      DMRScyclicshift = 0
      SRFlag = 0
      BitLenHarq = 0
      BitLenCsiPart1 = 7
      BitLenCsiPart2 = 0
        TRP Scheme = 0
        numPRGs = 0
        prgSize = 0
        digBFInterface = 0

```

## 8 - A valid UL_TTI.request with a PRACH PDU

```
./nfapi/open-nFAPI/utils/nfapi_hex_parser  0x00 0x01 0x00 0x81 0x00 0x00 0x00 0x2d 0x02 0xd1 0x00 0x13 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x12 0x00 0x00 0x03 0x05 0x00 0x00 0x00 0x1b 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x08 0x00 0x01 0x0d 0x01 0x00 
Parsed 43 bytes:
00 01 00 81 00 00 00 2d   02 d1 00 13 01 01 00 00 
00 00 00 00 12 00 00 03   05 00 00 00 1b 00 00 00 
00 00 01 00 00 08 00 01   0d 01 00 
Decoded message NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST message length 0x2d
Message ID = 0x81
Message Length = 0x2d
  SFN = 721
  Slot = 19
  nPDUs = 1
  RachPresent = 1
  nULSCH = 0
  nULCCH = 0
  nGroup = 0
    PDU #0
    PDUType = 0x00 (NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE)
    PDUSize = 0x12
      physCellID = 0
      NumPrachOcas = 3
      prachFormat = 5 (A2)
      numRa = 0
      prachStartSymbol = 0
      numCs = 27
        TRP Scheme = 0
        numPRGs = 0
        prgSize = 0
        digBFInterface = 1
```
