mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 17:45:09 +00:00
Kernel: Add a LoopbackAdapter for talking to yourself via 127.0.0.1.
Choosing adapter for transmit is done by adapter_for_route_to(IPv4Address). This is just hard-coded logic right now but can be expanded to support a proper routing table. Also start moving kernel networking code into Kernel/Net/.
This commit is contained in:
parent
f8a1d2746e
commit
718bea73b3
11 changed files with 95 additions and 25 deletions
24
Kernel/Net/LoopbackAdapter.cpp
Normal file
24
Kernel/Net/LoopbackAdapter.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include <Kernel/Net/LoopbackAdapter.h>
|
||||
|
||||
LoopbackAdapter& LoopbackAdapter::the()
|
||||
{
|
||||
static LoopbackAdapter* the;
|
||||
if (!the)
|
||||
the = new LoopbackAdapter;
|
||||
return *the;
|
||||
}
|
||||
|
||||
LoopbackAdapter::LoopbackAdapter()
|
||||
{
|
||||
set_ipv4_address({ 127, 0, 0, 1 });
|
||||
}
|
||||
|
||||
LoopbackAdapter::~LoopbackAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
void LoopbackAdapter::send_raw(const byte* data, int size)
|
||||
{
|
||||
dbgprintf("LoopbackAdapter: Sending %d byte(s) to myself.\n", size);
|
||||
did_receive(data, size);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue