// File: dguglielmi[P]dlan-linux-software/common/dlanmonitor.cpp
// Function: CDlanMonitor::OnTurboChannelCapacitiesResponse(CMACAddress const&, HomePlugMMEs::TurboChannelCapacities::CResponse const&)
void CDlanMonitor::OnTurboChannelCapacitiesResponse(
  const CMACAddress& adapter, 
  const HomePlugMMEs::TurboChannelCapacities::CResponse& mme)
{
  std::map<CMACAddress,NetwAdapter>::iterator itNIC;
  std::map<CMACAddress,LocalDevice>::iterator itDevice; 
  
  if(((itNIC = m_mapNICs.find(adapter)) != m_mapNICs.end()) &&
    ((itDevice = itNIC->second.mapLocalDevices.find(mme.GetAddress())) != itNIC->second.mapLocalDevices.end()))
  {
    bool bUpdate = false;

    std::list<HomePlugMMEs::TurboChannelCapacities::TxCap> listCaps = mme.GetTxCapacities();
    for(std::list<HomePlugMMEs::TurboChannelCapacities::TxCap>::iterator itCap = listCaps.begin(); 
      (itCap != listCaps.end()); itCap++)
    {
      bool bUnknown =
        itNIC->second.setParamsAndStatsResponses.find(itCap->GetAddress()) != itNIC->second.setParamsAndStatsResponses.end();

      bool bTurbo =
        itNIC->second.setRemoteTurboResponses.find(itCap->GetAddress()) != itNIC->second.setRemoteTurboResponses.end();

      if(bUnknown || bTurbo)
      {
        UpdateRemoteDevice(itDevice->second, itCap->GetAddress(), true,
          bTurbo ? CDlanDevice::eTurbo : CDlanDevice::eHP1, !bTurbo, "", false, UserDataResponse(), true, 
          itCap->GetTxRate(), 0.0, false, 
          std::map<CMACAddress, CDlanDataRates>(), true, CMACAddress(), true, bUpdate);
      }
      else
      {
        itNIC->second.setDevicesToTrigger.insert(itCap->GetAddress());
      }
    }
    
    if(bUpdate)
      OnUpdate();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2d0, %rsp            # imm = 0x2D0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1e8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x193b0
leaq -0x28(%rbp), %rdi
callq 0x19bf0
movq -0x1e8(%rbp), %rdi
addq $0xa8, %rdi
movq -0x10(%rbp), %rsi
callq 0x17a40
movq -0x1e8(%rbp), %rdi
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
addq $0xa8, %rdi
callq 0x17a70
movq %rax, -0x38(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x17cb0
movb %al, %cl
movb $0x0, -0x47(%rbp)
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x1d9(%rbp)
jne 0x14d93
jmp 0x14e23
leaq -0x20(%rbp), %rdi
callq 0x17d40
addq $0x168, %rax            # imm = 0x168
movq %rax, -0x200(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x46(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x19c10
movq -0x200(%rbp), %rdi
movq -0x1f8(%rbp), %rsi
movb $0x1, -0x47(%rbp)
callq 0x185e0
movq %rax, -0x1f0(%rbp)
jmp 0x14ddd
movq -0x1f0(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x17fc0
movq %rax, -0x60(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x17f90
movb %al, -0x1d9(%rbp)
movb -0x1d9(%rbp), %al
movb %al, -0x201(%rbp)
testb $0x1, -0x47(%rbp)
jne 0x14e37
jmp 0x14e40
leaq -0x46(%rbp), %rdi
callq 0x6b70
movb -0x201(%rbp), %al
testb $0x1, %al
jne 0x14e4f
jmp 0x153cb
movb $0x0, -0x61(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x19c40
leaq -0x80(%rbp), %rdi
callq 0x19ce0
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x19d40
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x19d10
testb $0x1, %al
jne 0x14e9c
jmp 0x1539f
leaq -0x20(%rbp), %rdi
callq 0x17d40
addq $0x18, %rax
movq %rax, -0x210(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x19d70
movq %rax, %rsi
leaq -0xa6(%rbp), %rdi
callq 0x19d90
jmp 0x14ecd
movq -0x210(%rbp), %rdi
leaq -0xa6(%rbp), %rsi
callq 0x197a0
movq %rax, -0x218(%rbp)
jmp 0x14ee9
movq -0x218(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0x20(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x17d40
movq %rax, %rdi
addq $0x18, %rdi
callq 0x179e0
movq %rax, -0xb0(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0xe190
movb %al, -0x229(%rbp)
leaq -0xa6(%rbp), %rdi
callq 0x6b70
movb -0x229(%rbp), %al
movq -0x228(%rbp), %rdi
movb %al, -0x91(%rbp)
callq 0x17d40
addq $0x48, %rax
movq %rax, -0x220(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x19d70
movq %rax, %rsi
leaq -0xc6(%rbp), %rdi
callq 0x19d90
jmp 0x14f7f
movq -0x220(%rbp), %rdi
leaq -0xc6(%rbp), %rsi
callq 0x197a0
movq %rax, -0x238(%rbp)
jmp 0x14f9b
movq -0x238(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x17d40
movq %rax, %rdi
addq $0x8, %rdi
addq $0x40, %rdi
callq 0x179e0
movq %rax, -0xd0(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xe190
movb %al, -0x239(%rbp)
leaq -0xc6(%rbp), %rdi
callq 0x6b70
movb -0x239(%rbp), %al
andb $0x1, %al
movb %al, -0xb1(%rbp)
testb $0x1, -0x91(%rbp)
jne 0x15012
testb $0x1, -0xb1(%rbp)
je 0x152ee
leaq -0x28(%rbp), %rdi
callq 0x17e00
addq $0x8, %rax
movq %rax, -0x248(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x19d70
movq %rax, %rsi
leaq -0xd6(%rbp), %rdi
callq 0x19d90
jmp 0x15043
movzbl -0xb1(%rbp), %ecx
movb %cl, %al
andl $0x1, %ecx
movl %ecx, -0x258(%rbp)
xorb $0x1, %al
movb %al, -0x251(%rbp)
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x250(%rbp)
callq 0x5540
movq -0x250(%rbp), %rdx
leaq 0x230e3(%rip), %rsi     # 0x38161
leaq -0xf8(%rbp), %rdi
callq 0x62a0
jmp 0x1508c
leaq -0x180(%rbp), %rdi
callq 0x18100
jmp 0x1509a
leaq -0x88(%rbp), %rdi
callq 0x19d70
movq %rax, %rdi
callq 0x19dc0
movsd %xmm0, -0x260(%rbp)
jmp 0x150b8
xorps %xmm0, %xmm0
movaps %xmm0, -0x190(%rbp)
movaps %xmm0, -0x1a0(%rbp)
movaps %xmm0, -0x1b0(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x18220
movq %rsp, %rax
movl $0x0, (%rax)
leaq -0x1b6(%rbp), %rdi
xorl %r9d, %r9d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %r9d, %r8d
callq 0x6230
jmp 0x15102
movsd -0x260(%rbp), %xmm0
movl -0x258(%rbp), %r8d
movq -0x248(%rbp), %rsi
movq -0x1e8(%rbp), %rdi
movb -0x251(%rbp), %al
movq %rsp, %rcx
movq %rcx, -0x268(%rbp)
leaq -0x61(%rbp), %rdx
movq %rdx, 0x48(%rcx)
leaq -0x1b6(%rbp), %rdx
movq %rdx, 0x38(%rcx)
leaq -0x1b0(%rbp), %rdx
movq %rdx, 0x28(%rcx)
leaq -0x180(%rbp), %rdx
movq %rdx, 0x10(%rcx)
leaq -0xf8(%rbp), %rdx
movq %rdx, (%rcx)
movl $0x1, 0x40(%rcx)
movl $0x1, 0x30(%rcx)
movl $0x0, 0x20(%rcx)
movl $0x1, 0x18(%rcx)
movl $0x0, 0x8(%rcx)
movzbl %al, %r9d
andl $0x1, %r9d
leaq -0xd6(%rbp), %rdx
movl $0x1, %ecx
xorps %xmm1, %xmm1
callq 0x120e0
jmp 0x151a3
leaq -0x1b6(%rbp), %rdi
callq 0x6b70
leaq -0x1b0(%rbp), %rdi
callq 0xacb0
leaq -0x180(%rbp), %rdi
callq 0x9d10
leaq -0xf8(%rbp), %rdi
callq 0x5240
leaq -0xf9(%rbp), %rdi
callq 0x5380
leaq -0xd6(%rbp), %rdi
callq 0x6b70
jmp 0x15383
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
testb $0x1, -0x47(%rbp)
jne 0x15204
jmp 0x1520d
leaq -0x46(%rbp), %rdi
callq 0x6b70
jmp 0x153d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x153c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa6(%rbp), %rdi
callq 0x6b70
jmp 0x153c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc6(%rbp), %rdi
callq 0x6b70
jmp 0x153c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x152d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x152c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x152b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x152ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x1b6(%rbp), %rdi
callq 0x6b70
leaq -0x1b0(%rbp), %rdi
callq 0xacb0
leaq -0x180(%rbp), %rdi
callq 0x9d10
leaq -0xf8(%rbp), %rdi
callq 0x5240
leaq -0xf9(%rbp), %rdi
callq 0x5380
leaq -0xd6(%rbp), %rdi
callq 0x6b70
jmp 0x153c0
leaq -0x20(%rbp), %rdi
callq 0x17d40
addq $0x78, %rax
movq %rax, -0x270(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x19d70
movq %rax, %rsi
leaq -0x1bc(%rbp), %rdi
callq 0x19d90
jmp 0x1531f
movq -0x270(%rbp), %rdi
leaq -0x1bc(%rbp), %rsi
callq 0x193d0
movb %dl, -0x279(%rbp)
movq %rax, -0x278(%rbp)
jmp 0x15341
movb -0x279(%rbp), %al
movq -0x278(%rbp), %rcx
movq %rcx, -0x1d0(%rbp)
movb %al, -0x1c8(%rbp)
leaq -0x1bc(%rbp), %rdi
callq 0x6b70
jmp 0x15383
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x1bc(%rbp), %rdi
callq 0x6b70
jmp 0x153c0
jmp 0x15385
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
callq 0x19df0
movq %rax, -0x1d8(%rbp)
jmp 0x14e70
testb $0x1, -0x61(%rbp)
je 0x153b5
movq -0x1e8(%rbp), %rdi
callq 0x17980
jmp 0x153b3
jmp 0x153b5
leaq -0x80(%rbp), %rdi
callq 0x19e20
jmp 0x153cb
leaq -0x80(%rbp), %rdi
callq 0x19e20
jmp 0x153d4
addq $0x2d0, %rsp            # imm = 0x2D0
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x5530
nopl (%rax)