mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-06 13:35:03 +00:00
Kernel: Add a NetworkTask and a received network packet queue.
It will be easier to deal with incoming packets in a separate task.
This commit is contained in:
@@ -21,3 +21,17 @@ void NetworkAdapter::send(const MACAddress& destination, const ARPPacket& packet
|
||||
send_raw((byte*)eth, size_in_bytes);
|
||||
kfree(eth);
|
||||
}
|
||||
|
||||
void NetworkAdapter::did_receive(const byte* data, int length)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
m_packet_queue.append(ByteBuffer::copy(data, length));
|
||||
}
|
||||
|
||||
ByteBuffer NetworkAdapter::dequeue_packet()
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
if (m_packet_queue.is_empty())
|
||||
return { };
|
||||
return m_packet_queue.take_first();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user