mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
4314c25cf2
All users which relied on the default constructor use a None lock rank for now. This will make it easier to in the future remove LockRank and actually annotate the ranks by searching for None.
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Function.h>
|
|
#include <AK/NonnullOwnPtr.h>
|
|
#include <AK/NonnullRefPtr.h>
|
|
#include <AK/NonnullRefPtrVector.h>
|
|
#include <AK/Types.h>
|
|
#include <Kernel/Bus/PCI/Definitions.h>
|
|
#include <Kernel/Locking/SpinlockProtected.h>
|
|
#include <Kernel/Memory/Region.h>
|
|
#include <Kernel/Net/NetworkAdapter.h>
|
|
|
|
namespace Kernel {
|
|
|
|
class NetworkAdapter;
|
|
class NetworkingManagement {
|
|
friend class NetworkAdapter;
|
|
|
|
public:
|
|
static NetworkingManagement& the();
|
|
static bool is_initialized();
|
|
bool initialize();
|
|
|
|
static ErrorOr<NonnullOwnPtr<KString>> generate_interface_name_from_pci_address(PCI::DeviceIdentifier const&);
|
|
|
|
NetworkingManagement();
|
|
|
|
void for_each(Function<void(NetworkAdapter&)>);
|
|
ErrorOr<void> try_for_each(Function<ErrorOr<void>(NetworkAdapter&)>);
|
|
|
|
RefPtr<NetworkAdapter> from_ipv4_address(IPv4Address const&) const;
|
|
RefPtr<NetworkAdapter> lookup_by_name(StringView) const;
|
|
|
|
NonnullRefPtr<NetworkAdapter> loopback_adapter() const;
|
|
|
|
private:
|
|
RefPtr<NetworkAdapter> determine_network_device(PCI::DeviceIdentifier const&) const;
|
|
|
|
SpinlockProtected<NonnullRefPtrVector<NetworkAdapter>> m_adapters { LockRank::None };
|
|
RefPtr<NetworkAdapter> m_loopback_adapter;
|
|
};
|
|
|
|
}
|