#
---
_namespace: wfa_map

tlvTidToLinkMappingPolicy:
  _type: class
  _is_tlv_class : True
  type:
    _type: eTlvTypeMap
    _value_const: TLV_TID_TO_LINK_MAPPING_POLICY
  length: uint16_t
  is_bsta_config: sIsBStaConfig
  mld_mac_addr:
    _type: sMacAddr
  tid_to_link_mapping_negotiation: sTidToLinkMappingNegotiation
  reserved:
    _type: uint8_t
    _length: [22]
  num_mapping:
    _type: uint16_t
    _length_var: True
  mapping: 
    _type: cMapping
    _length: [ num_mapping ]

sIsBStaConfig:
  _type: struct
  _bit_field: uint8_t
  is_bsta_mld:
    _bit_range: [7,7]
    _comment: |
      0: AP MLD
      1: bSTA MLD
  reserved:
    _bit_range: [6,0]

sTidToLinkMappingNegotiation:
  _type: struct
  _bit_field: uint8_t
  is_enabled:
    _bit_range: [7,7]
    _comment: |
      0: disabled
      1: enabled
  reserved:
    _bit_range: [6,0]

cMapping:
  _type: class
  add_remove: sAddRemove
  sta_mld_mac_addr:
    _type: sMacAddr  
  tid_to_link_control_field: cTidToLinkControlField
  tid_to_link_mapping: sTidToLinkMapping
  reserved:
    _type: uint8_t
    _length: [7]

sAddRemove:
  _type: struct
  _bit_field: uint8_t
  should_be_removed:
    _bit_range: [7,7]
    _comment: |
      0: remove mapping
      1: add mapping
  reserved:
    _bit_range: [6,0]

sTidToLinkMapping:
  _type: struct
  _bit_field: uint8_t
  bit7:
    _bit_range: [7,7]
  bit6:
    _bit_range: [6,6]
  bit5:
    _bit_range: [5,5]
  bit4:
    _bit_range: [4,4]
  bit3:
    _bit_range: [3,3]
  bit2:
    _bit_range: [2,2]
  bit1:
    _bit_range: [1,1]
  bit0:
    _bit_range: [0,0]
  _length: [ 2*(tid_to_link_control_field.link_mapping_presence_indicator.bit7 + tid_to_link_control_field.link_mapping_presence_indicator.bit6 + tid_to_link_control_field.link_mapping_presence_indicator.bit5 + tid_to_link_control_field.link_mapping_presence_indicator.bit4 + tid_to_link_control_field.link_mapping_presence_indicator.bit3 + tid_to_link_control_field.link_mapping_presence_indicator.bit2 + tid_to_link_control_field.link_mapping_presence_indicator.bit1 + tid_to_link_control_field.link_mapping_presence_indicator.bit0) ]
  _condition:
    _using_members: tid_to_link_control_field
    _phrase: ! tid_to_link_control_field.tid_to_link_control.bit6
  _comment: |
      2 bytes by TID indentified by link_mapping_presence_indicator

cTidToLinkControlField:
  _type: class
  tid_to_link_control:
    _type: sTidToLinkControl
  link_mapping_presence_indicator:
    _type: uint8_t
  expected_duration:
    _type: uint8_t
    _length: [3]

sTidToLinkControl:
  _type: struct
  _bit_field: uint8_t
  direction:
    _bit_range: [7,6]
  default_link_mapping:
    _bit_range: [5,5]
  mapping_switch_time_present:
    _bit_range: [4,4]
  expected_duration_present:
    _bit_range: [3,3]
  link_mapping_size:
    _bit_range: [2,2]
  reserved:
    _bit_range: [1,0]
