void CGUIDialogAccessPoints::UpdateConnectionList() { m_connectionsFileList->Clear(); CGUIMessage msgReset(GUI_MSG_LABEL_RESET, GetID(), ACCESS_POINT_LIST); OnMessage(msgReset); int connectedItem = 0; ConnectionList connections = g_application.getNetworkManager().GetConnections(); std::string connection_name; for (size_t i = 0; i < connections.size(); i++) { connection_name = connections[i]->GetName(); CFileItemPtr item(new CFileItem(connection_name)); if (m_use_ipconfig) { if (connection_name.find(m_ipname) != std::string::npos) connectedItem = i; } else { if (connections[i]->GetState() == NETWORK_CONNECTION_STATE_CONNECTED) connectedItem = i; } if (connections[i]->GetType() == NETWORK_CONNECTION_TYPE_WIFI) { int signal, strength = connections[i]->GetStrength(); if (strength == 0 || strength < 20) signal = 1; else if (strength == 20 || strength < 40) signal = 2; else if (strength == 40 || strength < 60) signal = 3; else if (strength == 60 || strength < 80) signal = 4; else signal = 5; if (strength <= 20) item->SetArt("thumb", "ap-signal1.png"); else if (strength <= 40) item->SetArt("thumb", "ap-signal2.png"); else if (strength <= 60) item->SetArt("thumb", "ap-signal3.png"); else if (strength <= 80) item->SetArt("thumb", "ap-signal4.png"); else if (strength <= 100) item->SetArt("thumb", "ap-signal5.png"); item->SetProperty("signal", signal); item->SetProperty("encryption", EncryptionToString(connections[i]->GetEncryption())); } item->SetProperty("type", ConnectionTypeToString(connections[i]->GetType())); item->SetProperty("state", ConnectionStateToString(connections[i]->GetState())); m_connectionsFileList->Add(item); } CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), ACCESS_POINT_LIST, connectedItem, 0, m_connectionsFileList); OnMessage(msg); }
void CNetworkManager::OnConnectionStateChange(ConnectionState state) { ConnectionState oldState = m_state; m_state = state; if (m_state != oldState) CLog::Log(LOGDEBUG, "NetworkManager: State changed to %s", ConnectionStateToString(m_state)); if (oldState != NETWORK_CONNECTION_STATE_CONNECTED && m_state == NETWORK_CONNECTION_STATE_CONNECTED) StartServices(); else if (oldState == NETWORK_CONNECTION_STATE_CONNECTED && oldState != m_state) StopServices(); }
VOID DumpAfdConnection( PAFD_CONNECTION Connection, DWORD ActualAddress ) /*++ Routine Description: Dumps the specified AFD_CONNECTION structures. Arguments: Connection - Points to the AFD_CONNECTION structure to dump. ActualAddress - The actual address where the structure resides on the debugee. Return Value: None. --*/ { UCHAR address[MAX_TRANSPORT_ADDR]; ULONG result; dprintf( "AFD_CONNECTION @ %08lx:\n", ActualAddress ); dprintf( " Type = %04X (%s)\n", Connection->Type, StructureTypeToString( Connection->Type ) ); dprintf( " ReferenceCount = %d\n", Connection->ReferenceCount ); dprintf( " State = %08X (%s)\n", Connection->State, ConnectionStateToString( Connection->State ) ); dprintf( " Handle = %08lx\n", Connection->Handle ); dprintf( " FileObject = %08lx\n", Connection->FileObject ); dprintf( " ConnectTime = %s\n", SystemTimeToString( Connection->ConnectTime ) ); if( Connection->TdiBufferring ) { dprintf( " ReceiveBytesIndicated = %s\n", LongLongToString( Connection->Common.Bufferring.ReceiveBytesIndicated.QuadPart ) ); dprintf( " ReceiveBytesTaken = %s\n", LongLongToString( Connection->Common.Bufferring.ReceiveBytesTaken.QuadPart ) ); dprintf( " ReceiveBytesOutstanding = %s\n", LongLongToString( Connection->Common.Bufferring.ReceiveBytesOutstanding.QuadPart ) ); dprintf( " ReceiveExpeditedBytesIndicated = %s\n", LongLongToString( Connection->Common.Bufferring.ReceiveExpeditedBytesIndicated.QuadPart ) ); dprintf( " ReceiveExpeditedBytesTaken = %s\n", LongLongToString( Connection->Common.Bufferring.ReceiveExpeditedBytesTaken.QuadPart ) ); dprintf( " ReceiveExpeditedBytesOutstanding = %s\n", LongLongToString( Connection->Common.Bufferring.ReceiveExpeditedBytesOutstanding.QuadPart ) ); dprintf( " NonBlockingSendPossible = %s\n", BooleanToString( Connection->Common.Bufferring.NonBlockingSendPossible ) ); dprintf( " ZeroByteReceiveIndicated = %s\n", BooleanToString( Connection->Common.Bufferring.ZeroByteReceiveIndicated ) ); } else { if( IS_LIST_EMPTY( ActualAddress, Connection, Common.NonBufferring.ReceiveIrpListHead ) ) { dprintf( " ReceiveIrpListHead = EMPTY\n" ); } else { dprintf( " ReceiveIrpListHead @ %08lx\n", ACTUAL_ADDRESS( ActualAddress, Connection, Common.NonBufferring.ReceiveIrpListHead ) ); } if( IS_LIST_EMPTY( ActualAddress, Connection, Common.NonBufferring.ReceiveBufferListHead ) ) { dprintf( " ReceiveBufferListHead = EMPTY\n" ); } else { dprintf( " ReceiveBufferListHead @ %08lx\n", ACTUAL_ADDRESS( ActualAddress, Connection, Common.NonBufferring.ReceiveBufferListHead ) ); } if( IS_LIST_EMPTY( ActualAddress, Connection, Common.NonBufferring.SendIrpListHead ) ) { dprintf( " SendIrpListHead = EMPTY\n" ); } else { dprintf( " SendIrpListHead @ %08lx\n", ACTUAL_ADDRESS( ActualAddress, Connection, Common.NonBufferring.SendIrpListHead ) ); } dprintf( " BufferredReceiveBytes = %lu\n", Connection->Common.NonBufferring.BufferredReceiveBytes ); dprintf( " BufferredExpeditedBytes = %lu\n", Connection->Common.NonBufferring.BufferredExpeditedBytes ); dprintf( " BufferredReceiveCount = %u\n", Connection->Common.NonBufferring.BufferredReceiveCount ); dprintf( " BufferredExpeditedCount = %u\n", Connection->Common.NonBufferring.BufferredExpeditedCount ); dprintf( " ReceiveBytesInTransport = %lu\n", Connection->Common.NonBufferring.ReceiveBytesInTransport ); dprintf( " BufferredSendBytes = %lu\n", Connection->Common.NonBufferring.BufferredSendBytes ); dprintf( " ReceiveCountInTransport = %u\n", Connection->Common.NonBufferring.ReceiveCountInTransport ); dprintf( " BufferredSendCount = %u\n", Connection->Common.NonBufferring.BufferredSendCount ); dprintf( " DisconnectIrp = %08lx\n", Connection->Common.NonBufferring.DisconnectIrp ); } dprintf( " Endpoint = %08lx\n", Connection->Endpoint ); dprintf( " MaxBufferredReceiveBytes = %lu\n", Connection->MaxBufferredReceiveBytes ); dprintf( " MaxBufferredSendBytes = %lu\n", Connection->MaxBufferredSendBytes ); dprintf( " MaxBufferredReceiveCount = %u\n", Connection->MaxBufferredReceiveCount ); dprintf( " MaxBufferredSendCount = %u\n", Connection->MaxBufferredSendCount ); dprintf( " ConnectDataBuffers = %08lx\n", Connection->ConnectDataBuffers ); dprintf( " OwningProcess = %08lx\n", Connection->OwningProcess ); dprintf( " DeviceObject = %08lx\n", Connection->DeviceObject ); dprintf( " RemoteAddress = %08lx\n", Connection->RemoteAddress ); dprintf( " RemoteAddressLength = %lu\n", Connection->RemoteAddressLength ); if( Connection->RemoteAddressLength <= sizeof(address) && Connection->RemoteAddress != NULL ) { if( ReadMemory( (DWORD)Connection->RemoteAddress, address, sizeof(address), &result ) ) { DumpTransportAddress( " ", (PTRANSPORT_ADDRESS)address, (DWORD)Connection->RemoteAddress ); } } dprintf( " DisconnectIndicated = %s\n", BooleanToString( Connection->DisconnectIndicated ) ); dprintf( " AbortIndicated = %s\n", BooleanToString( Connection->AbortIndicated ) ); dprintf( " TdiBufferring = %s\n", BooleanToString( Connection->TdiBufferring ) ); dprintf( " ConnectedReferenceAdded = %s\n", BooleanToString( Connection->ConnectedReferenceAdded ) ); dprintf( " SpecialCondition = %s\n", BooleanToString( Connection->SpecialCondition ) ); dprintf( " CleanupBegun = %s\n", BooleanToString( Connection->CleanupBegun ) ); dprintf( " ClosePendedTransmit = %s\n", BooleanToString( Connection->ClosePendedTransmit ) ); if( IsCheckedAfd ) { dprintf( " CurrentReferenceSlot = %lu\n", Connection->CurrentReferenceSlot % MAX_REFERENCE ); dprintf( " ReferenceDebug = %08lx\n", ACTUAL_ADDRESS( ActualAddress, Connection, ReferenceDebug ) ); } dprintf( "\n" ); } // DumpAfdConnection