serenity/Kernel/Net/LoopbackAdapter.h
Arda Cinar 037744e62a Kernel/Net: Get the correct interface type in SIOCGIFHWADDR ioctl
When calling ioctl on a socket with SIOCGIFHWADDR, return the correct
physical interface type. This value was previously hardcoded to
ARPHRD_ETHER (Ethernet), and now can also return ARPHRD_LOOPBACK for the
loopback adapter.
2023-01-13 15:44:04 +01:00

31 lines
889 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 {
private:
LoopbackAdapter(NonnullOwnPtr<KString>);
public:
static LockRefPtr<LoopbackAdapter> try_create();
virtual ~LoopbackAdapter() override;
virtual ErrorOr<void> initialize(Badge<NetworkingManagement>) override { VERIFY_NOT_REACHED(); }
virtual void send_raw(ReadonlyBytes) override;
virtual StringView class_name() const override { return "LoopbackAdapter"sv; }
virtual Type adapter_type() const override { return Type::Loopback; }
virtual bool link_up() override { return true; }
virtual bool link_full_duplex() override { return true; }
virtual int link_speed() override { return 1000; }
};
}