mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:27:45 +00:00
Kernel: Make KBuffer a value-type wrapper around a KBufferImpl
A KBuffer always contains a valid KBufferImpl. If you need a "null" state buffer, use Optional<KBuffer>. This makes KBuffer very easy to work with and pass around, just like ByteBuffer before it.
This commit is contained in:
parent
52cfe9ebae
commit
605975adb5
6 changed files with 50 additions and 22 deletions
|
@ -29,7 +29,7 @@ public:
|
|||
void send(const MACAddress&, const ARPPacket&);
|
||||
void send_ipv4(const MACAddress&, const IPv4Address&, IPv4Protocol, const u8* payload, size_t payload_size);
|
||||
|
||||
RefPtr<KBuffer> dequeue_packet();
|
||||
Optional<KBuffer> dequeue_packet();
|
||||
|
||||
bool has_queued_packets() const { return !m_packet_queue.is_empty(); }
|
||||
|
||||
|
@ -43,6 +43,6 @@ protected:
|
|||
private:
|
||||
MACAddress m_mac_address;
|
||||
IPv4Address m_ipv4_address;
|
||||
SinglyLinkedList<NonnullRefPtr<KBuffer>> m_packet_queue;
|
||||
SinglyLinkedList<KBuffer> m_packet_queue;
|
||||
String m_name;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue