// File: dguglielmi[P]dlan-linux-software/common/dlanmonitor.cpp
// Function: CDlanMonitor::OnThunderReadModuleDataConfirm(CMACAddress const&, HomePlugAvMMEs::ThunderReadModuleData::CConfirm const&)
void CDlanMonitor::OnThunderReadModuleDataConfirm(
  const CMACAddress& adapter, 
  const HomePlugAvMMEs::ThunderReadModuleData::CConfirm& mme)
{
  std::map<CMACAddress,NetwAdapter>::iterator itNIC;

  if(((itNIC = m_mapNICs.find(adapter)) != m_mapNICs.end()) &&
    (mme.GetStatus() == HomePlugAvMMEs::ThunderReadModuleData::eSuccess) &&
    (mme.GetModuleID() == HomePlugAvMMEs::ThunderReadModuleData::ePib))
  {
    bool bUpdate = false;

    if((mme.GetLength() == 64) && (mme.GetOffset() == 36))
    {
      itNIC->second.setReadModDataResponses.insert(mme.GetAddress());

      std::map<CMACAddress,UserDataResponse>::iterator itUserData = itNIC->second.mapUserDataResponses.find(mme.GetAddress());
      bool bKeepUserData = (itUserData == itNIC->second.mapUserDataResponses.end());

      std::map<CMACAddress,std::string>::const_iterator itVersion;
      if((itVersion = itNIC->second.mapGetVersionResponses.find(mme.GetAddress())) != itNIC->second.mapGetVersionResponses.end())
      {
        UpdateLocalDevice(itNIC, mme.GetAddress(), true, CDlanDevice::eThunderbolt, false,
          itVersion->second, false, bKeepUserData ? UserDataResponse() : itUserData->second, bKeepUserData, 
          CMACAddress::Null(), true, bUpdate);
      }
    }
    else if((mme.GetLength() == 208) && (mme.GetOffset() == 36))
    {
      UserDataResponse userData(mme.GetData());

      itNIC->second.mapUserDataResponses[mme.GetAddress()] = userData;

      if(itNIC->second.mapLocalDevices.find(mme.GetAddress()) != itNIC->second.mapLocalDevices.end())
      {
        UpdateLocalDevice(itNIC, mme.GetAddress(), false,
          CDlanDevice::eThunderbolt, true, "", true, userData, false, CMACAddress::Null(), true, bUpdate);
      }
      else
      {
        for(std::map<CMACAddress,LocalDevice>::iterator itLocalDevice = itNIC->second.mapLocalDevices.begin();
          (itLocalDevice != itNIC->second.mapLocalDevices.end()); ++itLocalDevice)
        {
          if(itLocalDevice->second.mapRemoteDeviceAges.find(mme.GetAddress()) != itLocalDevice->second.mapRemoteDeviceAges.end())
          {
            UpdateRemoteDevice(itLocalDevice->second, mme.GetAddress(), false,
              CDlanDevice::eThunderbolt, true, "", true, userData, false, 0.0, 0.0, true,
              std::map<CMACAddress, CDlanDataRates>(), true, CMACAddress(), true, bUpdate);
            break;
          }
        }
      }
    }

    if(bUpdate)
      OnUpdate();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x400, %rsp            # imm = 0x400
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2d0(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x193b0
movq -0x2d0(%rbp), %rdi
addq $0xa8, %rdi
movq -0x10(%rbp), %rsi
callq 0x17a40
movq -0x2d0(%rbp), %rdi
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
addq $0xa8, %rdi
callq 0x17a70
movq %rax, -0x30(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x17cb0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x2c7(%rbp)
jne 0x15493
jmp 0x154c4
movq -0x18(%rbp), %rdi
callq 0x19e40
movzbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2c7(%rbp)
jne 0x154c4
movq -0x18(%rbp), %rdi
callq 0x19e60
movzbl %al, %eax
cmpl $0x2, %eax
sete %al
movb %al, -0x2c7(%rbp)
movb -0x2c7(%rbp), %al
testb $0x1, %al
jne 0x154d3
jmp 0x15f0a
movb $0x0, -0x31(%rbp)
movq -0x18(%rbp), %rdi
callq 0x19e80
movzwl %ax, %eax
cmpl $0x40, %eax
jne 0x15894
movq -0x18(%rbp), %rdi
callq 0x19ea0
cmpl $0x24, %eax
jne 0x15894
leaq -0x20(%rbp), %rdi
callq 0x17d40
addq $0xa8, %rax
movq %rax, -0x2f0(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x37(%rbp), %rdi
movq %rdi, -0x2e8(%rbp)
callq 0x19ec0
movq -0x2f0(%rbp), %rdi
movq -0x2e8(%rbp), %rsi
callq 0x193d0
movb %dl, -0x2d9(%rbp)
movq %rax, -0x2d8(%rbp)
jmp 0x1554a
movb -0x2d9(%rbp), %al
movq -0x2d8(%rbp), %rcx
movq %rcx, -0x58(%rbp)
movb %al, -0x50(%rbp)
leaq -0x37(%rbp), %rdi
callq 0x6b70
leaq -0x20(%rbp), %rdi
callq 0x17d40
addq $0x108, %rax            # imm = 0x108
movq %rax, -0x308(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x66(%rbp), %rdi
movq %rdi, -0x300(%rbp)
callq 0x19ec0
movq -0x308(%rbp), %rdi
movq -0x300(%rbp), %rsi
callq 0x188d0
movq %rax, -0x2f8(%rbp)
jmp 0x155ad
movq -0x2f8(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x66(%rbp), %rdi
callq 0x6b70
leaq -0x20(%rbp), %rdi
movq %rdi, -0x328(%rbp)
callq 0x17d40
movq %rax, %rdi
addq $0x108, %rdi            # imm = 0x108
callq 0x18900
movq %rax, -0x70(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x188a0
movb %al, -0x67(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x19ef0
movq -0x328(%rbp), %rdi
callq 0x17d40
addq $0xd8, %rax
movq %rax, -0x320(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x8e(%rbp), %rdi
movq %rdi, -0x318(%rbp)
callq 0x19ec0
movq -0x320(%rbp), %rdi
movq -0x318(%rbp), %rsi
callq 0x18840
movq %rax, -0x310(%rbp)
jmp 0x15649
movq -0x310(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x19f40
movq -0x80(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0xd0, %rdi
callq 0x18870
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x19f40
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x19f10
movb %al, -0x329(%rbp)
leaq -0x8e(%rbp), %rdi
callq 0x6b70
movb -0x329(%rbp), %al
testb $0x1, %al
jne 0x156d6
jmp 0x1588f
movq -0x20(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x18(%rbp), %rsi
leaq -0xae(%rbp), %rdi
callq 0x19ec0
leaq -0x78(%rbp), %rdi
callq 0x19f60
addq $0x8, %rax
movq %rax, -0x338(%rbp)
testb $0x1, -0x67(%rbp)
je 0x1571b
leaq -0x130(%rbp), %rdi
callq 0x18100
jmp 0x15719
jmp 0x1573b
leaq -0x60(%rbp), %rdi
callq 0x19f80
movq %rax, %rsi
addq $0x8, %rsi
leaq -0x130(%rbp), %rdi
callq 0x19fa0
jmp 0x15739
jmp 0x1573b
movb -0x67(%rbp), %al
movb %al, -0x339(%rbp)
leaq -0x136(%rbp), %rdi
callq 0xb750
jmp 0x15752
movq -0x2d0(%rbp), %rdi
movq -0x338(%rbp), %rcx
movb -0x339(%rbp), %dl
movq -0xa8(%rbp), %rsi
movq %rsp, %rax
leaq -0x31(%rbp), %r8
movq %r8, 0x30(%rax)
leaq -0x136(%rbp), %r8
movq %r8, 0x20(%rax)
movzbl %dl, %edx
andl $0x1, %edx
movl %edx, 0x18(%rax)
leaq -0x130(%rbp), %rdx
movq %rdx, 0x10(%rax)
movq %rcx, (%rax)
movl $0x1, 0x28(%rax)
movl $0x0, 0x8(%rax)
leaq -0xae(%rbp), %rdx
movl $0x1, %ecx
movl $0x2, %r8d
xorl %r9d, %r9d
callq 0x11920
jmp 0x157c4
leaq -0x136(%rbp), %rdi
callq 0x6b70
leaq -0x130(%rbp), %rdi
callq 0x9d10
leaq -0xae(%rbp), %rdi
callq 0x6b70
jmp 0x1588f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x37(%rbp), %rdi
callq 0x6b70
jmp 0x15f13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x66(%rbp), %rdi
callq 0x6b70
jmp 0x15f13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x8e(%rbp), %rdi
callq 0x6b70
jmp 0x15f13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x1587e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x15872
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x136(%rbp), %rdi
callq 0x6b70
leaq -0x130(%rbp), %rdi
callq 0x9d10
leaq -0xae(%rbp), %rdi
callq 0x6b70
jmp 0x15f13
jmp 0x15ef6
movq -0x18(%rbp), %rdi
callq 0x19e80
movzwl %ax, %eax
cmpl $0xd0, %eax
jne 0x15ef4
movq -0x18(%rbp), %rdi
callq 0x19ea0
cmpl $0x24, %eax
jne 0x15ef4
movq -0x18(%rbp), %rsi
leaq -0x1d8(%rbp), %rdi
movq %rdi, -0x348(%rbp)
callq 0x1a070
movq -0x348(%rbp), %rsi
leaq -0x1b8(%rbp), %rdi
callq 0x1a130
jmp 0x158e9
leaq -0x1d8(%rbp), %rdi
callq 0x9d60
leaq -0x20(%rbp), %rdi
callq 0x17d40
addq $0x108, %rax            # imm = 0x108
movq %rax, -0x350(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x1de(%rbp), %rdi
callq 0x19ec0
jmp 0x1591d
movq -0x350(%rbp), %rdi
leaq -0x1de(%rbp), %rsi
callq 0x1a3c0
movq %rax, -0x358(%rbp)
jmp 0x15939
movq -0x358(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x1a4a0
jmp 0x1594e
leaq -0x1de(%rbp), %rdi
callq 0x6b70
leaq -0x20(%rbp), %rdi
callq 0x17d40
addq $0x168, %rax            # imm = 0x168
movq %rax, -0x360(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x1ee(%rbp), %rdi
callq 0x19ec0
jmp 0x15982
movq -0x360(%rbp), %rdi
leaq -0x1ee(%rbp), %rsi
callq 0x185e0
movq %rax, -0x368(%rbp)
jmp 0x1599e
movq -0x368(%rbp), %rax
movq %rax, -0x1e8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x17fc0
movq %rax, -0x1f8(%rbp)
leaq -0x1e8(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x17f90
movb %al, -0x369(%rbp)
leaq -0x1ee(%rbp), %rdi
callq 0x6b70
movb -0x369(%rbp), %al
testb $0x1, %al
jne 0x15a03
jmp 0x15bc1
movq -0x20(%rbp), %rax
movq %rax, -0x200(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x206(%rbp), %rdi
callq 0x19ec0
jmp 0x15a20
leaq -0x229(%rbp), %rdi
movq %rdi, -0x378(%rbp)
callq 0x5540
movq -0x378(%rbp), %rdx
leaq 0x22720(%rip), %rsi     # 0x38161
leaq -0x228(%rbp), %rdi
callq 0x62a0
jmp 0x15a4f
leaq -0x22f(%rbp), %rdi
callq 0xb750
jmp 0x15a5d
movq -0x2d0(%rbp), %rdi
movq -0x200(%rbp), %rsi
movq %rsp, %rax
leaq -0x31(%rbp), %rcx
movq %rcx, 0x30(%rax)
leaq -0x22f(%rbp), %rcx
movq %rcx, 0x20(%rax)
leaq -0x1b8(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq -0x228(%rbp), %rcx
movq %rcx, (%rax)
movl $0x1, 0x28(%rax)
movl $0x0, 0x18(%rax)
movl $0x1, 0x8(%rax)
leaq -0x206(%rbp), %rdx
xorl %ecx, %ecx
movl $0x2, %r8d
movl $0x1, %r9d
callq 0x11920
jmp 0x15ac7
leaq -0x22f(%rbp), %rdi
callq 0x6b70
leaq -0x228(%rbp), %rdi
callq 0x5240
leaq -0x229(%rbp), %rdi
callq 0x5380
leaq -0x206(%rbp), %rdi
callq 0x6b70
jmp 0x15ed8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x9d60
jmp 0x15f13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x15ee6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1de(%rbp), %rdi
callq 0x6b70
jmp 0x15ee6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x1ee(%rbp), %rdi
callq 0x6b70
jmp 0x15ee6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x15ba4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x15b98
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x22f(%rbp), %rdi
callq 0x6b70
leaq -0x228(%rbp), %rdi
callq 0x5240
leaq -0x229(%rbp), %rdi
callq 0x5380
leaq -0x206(%rbp), %rdi
callq 0x6b70
jmp 0x15ee6
leaq -0x20(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x17dd0
movq %rax, -0x238(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x17fc0
movq %rax, -0x240(%rbp)
leaq -0x238(%rbp), %rdi
leaq -0x240(%rbp), %rsi
callq 0x17f90
testb $0x1, %al
jne 0x15c23
jmp 0x15ed6
leaq -0x238(%rbp), %rdi
callq 0x17e00
addq $0x18, %rax
movq %rax, -0x380(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x24e(%rbp), %rdi
callq 0x19ec0
jmp 0x15c4c
movq -0x380(%rbp), %rdi
leaq -0x24e(%rbp), %rsi
callq 0x18080
movq %rax, -0x388(%rbp)
jmp 0x15c68
movq -0x388(%rbp), %rax
movq %rax, -0x248(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x17e00
movq %rax, %rdi
addq $0x8, %rdi
addq $0x10, %rdi
callq 0x180b0
movq %rax, -0x258(%rbp)
leaq -0x248(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x18050
movb %al, -0x389(%rbp)
leaq -0x24e(%rbp), %rdi
callq 0x6b70
movb -0x389(%rbp), %al
testb $0x1, %al
jne 0x15ccd
jmp 0x15ec3
leaq -0x238(%rbp), %rdi
callq 0x17e00
addq $0x8, %rax
movq %rax, -0x398(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x25e(%rbp), %rdi
callq 0x19ec0
jmp 0x15cf6
leaq -0x281(%rbp), %rdi
movq %rdi, -0x3a0(%rbp)
callq 0x5540
movq -0x3a0(%rbp), %rdx
leaq 0x2244a(%rip), %rsi     # 0x38161
leaq -0x280(%rbp), %rdi
callq 0x62a0
jmp 0x15d25
xorps %xmm0, %xmm0
movaps %xmm0, -0x2a0(%rbp)
movaps %xmm0, -0x2b0(%rbp)
movaps %xmm0, -0x2c0(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x18220
movq %rsp, %rax
movl $0x0, (%rax)
leaq -0x2c6(%rbp), %rdi
xorl %r9d, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x6230
jmp 0x15d6f
movq -0x398(%rbp), %rsi
movq -0x2d0(%rbp), %rdi
movq %rsp, %rax
movq %rax, -0x3a8(%rbp)
leaq -0x31(%rbp), %rcx
movq %rcx, 0x48(%rax)
leaq -0x2c6(%rbp), %rcx
movq %rcx, 0x38(%rax)
leaq -0x2c0(%rbp), %rcx
movq %rcx, 0x28(%rax)
leaq -0x1b8(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq -0x280(%rbp), %rcx
movq %rcx, (%rax)
movl $0x1, 0x40(%rax)
movl $0x1, 0x30(%rax)
movl $0x1, 0x20(%rax)
movl $0x0, 0x18(%rax)
movl $0x1, 0x8(%rax)
leaq -0x25e(%rbp), %rdx
xorl %ecx, %ecx
movl $0x2, %r8d
movl $0x1, %r9d
xorps %xmm1, %xmm1
movaps %xmm1, %xmm0
callq 0x120e0
jmp 0x15dff
leaq -0x2c6(%rbp), %rdi
callq 0x6b70
leaq -0x2c0(%rbp), %rdi
callq 0xacb0
leaq -0x280(%rbp), %rdi
callq 0x5240
leaq -0x281(%rbp), %rdi
callq 0x5380
leaq -0x25e(%rbp), %rdi
callq 0x6b70
jmp 0x15ed6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x24e(%rbp), %rdi
callq 0x6b70
jmp 0x15ee6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x15ea9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x15e91
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x2c6(%rbp), %rdi
callq 0x6b70
leaq -0x2c0(%rbp), %rdi
callq 0xacb0
leaq -0x280(%rbp), %rdi
callq 0x5240
leaq -0x281(%rbp), %rdi
callq 0x5380
leaq -0x25e(%rbp), %rdi
callq 0x6b70
jmp 0x15ee6
jmp 0x15ec5
leaq -0x238(%rbp), %rdi
callq 0x18270
jmp 0x15be4
jmp 0x15ed8
leaq -0x1b8(%rbp), %rdi
callq 0x9d10
jmp 0x15ef4
leaq -0x1b8(%rbp), %rdi
callq 0x9d10
jmp 0x15f13
jmp 0x15ef6
testb $0x1, -0x31(%rbp)
je 0x15f08
movq -0x2d0(%rbp), %rdi
callq 0x17980
jmp 0x15f0a
addq $0x400, %rsp            # imm = 0x400
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x5530
nopl (%rax)