mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
Kernel+Userland: Expose list of network adapters through /proc/netadapters.
Added a simple /bin/ifconfig program that just pretty-prints that file. :^)
This commit is contained in:
parent
264890bfc3
commit
9e0f7acfe5
6 changed files with 69 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/SinglyLinkedList.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Alarm.h>
|
||||
|
@ -26,10 +27,13 @@ private:
|
|||
|
||||
class NetworkAdapter {
|
||||
public:
|
||||
static void for_each(Function<void(NetworkAdapter&)>);
|
||||
static NetworkAdapter* from_ipv4_address(const IPv4Address&);
|
||||
virtual ~NetworkAdapter();
|
||||
|
||||
virtual const char* class_name() const = 0;
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
MACAddress mac_address() { return m_mac_address; }
|
||||
IPv4Address ipv4_address() const { return m_ipv4_address; }
|
||||
|
||||
|
@ -46,6 +50,7 @@ public:
|
|||
|
||||
protected:
|
||||
NetworkAdapter();
|
||||
void set_interface_name(const StringView& basename);
|
||||
void set_mac_address(const MACAddress& mac_address) { m_mac_address = mac_address; }
|
||||
virtual void send_raw(const byte*, int) = 0;
|
||||
void did_receive(const byte*, int);
|
||||
|
@ -55,4 +60,5 @@ private:
|
|||
IPv4Address m_ipv4_address;
|
||||
PacketQueueAlarm m_packet_queue_alarm;
|
||||
SinglyLinkedList<ByteBuffer> m_packet_queue;
|
||||
String m_name;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue