mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-09 20:52:54 +00:00
Instead of initializing network adapters in init.cpp, let's move that logic into a separate class to handle this. Also, it seems like a good idea to shift responsiblity on enumeration of network adapters after the boot process, so this singleton will take care of finding the appropriate network adapter when asked to with an IPv4 address or interface name. With this change being merged, we simplify the creation logic of NetworkAdapter derived classes, so we enumerate the PCI bus only once, searching for driver candidates when doing so, and we let each driver to test if it is resposible for the specified PCI device.
27 lines
540 B
C++
27 lines
540 B
C++
/*
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <Kernel/Net/NetworkAdapter.h>
|
|
|
|
namespace Kernel {
|
|
|
|
class LoopbackAdapter final : public NetworkAdapter {
|
|
AK_MAKE_ETERNAL
|
|
|
|
private:
|
|
LoopbackAdapter();
|
|
|
|
public:
|
|
static NonnullRefPtr<LoopbackAdapter> create();
|
|
virtual ~LoopbackAdapter() override;
|
|
|
|
virtual void send_raw(ReadonlyBytes) override;
|
|
virtual const char* class_name() const override { return "LoopbackAdapter"; }
|
|
};
|
|
|
|
}
|