ladybird/Kernel/Net/LoopbackAdapter.h
Thomas Wagenveld 59fdeec7f5 Kernel: Add interface to read link speed and duplex for NetworkAdapter
Read the appropriate registers for RTL8139, RTL8168 and E1000.
For NE2000 just assume 10mbit full duplex as there is no indicator
for it in the pure NE2000 spec. Mock values for loopback.
2021-08-03 10:20:51 +02:00

30 lines
706 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 RefPtr<LoopbackAdapter> try_create();
virtual ~LoopbackAdapter() override;
virtual void send_raw(ReadonlyBytes) override;
virtual StringView class_name() const override { return "LoopbackAdapter"; }
virtual bool link_up() override { return true; }
virtual bool link_full_duplex() override { return true; }
virtual int link_speed() override { return 1000; }
};
}