18#include <FreeNOS/User.h>
43 ERROR(
"failed to allocate payload buffer: result = " << (
int) result);
48 for (
Size i = 0; i < queueSize; i++)
53 m_free.insertAt(i, packet);
114 return m_data.count() > 0;
Result
Enumeration of generic kernel API result codes.
void append(const char *str)
Append to buffered output.
Packet * pop()
Retrieve packet with data.
NetworkQueue(const Size packetSize, const Size queueSize=MaxPackets)
Constructor.
virtual ~NetworkQueue()
Destructor.
Index< Packet, MaxPackets > m_data
Contains packets with data.
Index< Packet, MaxPackets > m_free
Contains unused packets.
Memory::Range m_payloadRange
Defines the memory range of mapped payload data.
static const Size PayloadBufferSize
Size of payload memory buffer.
bool hasData() const
Check if data packets are available.
Packet * get()
Get unused packet.
void release(Packet *packet)
Put unused packet back.
void push(Packet *packet)
Enqueue packet with data.
static const Size MaxPackets
Maximum number of packets available.
API::Result VMCtl(const ProcessID procID, const MemoryOperation op, Memory::Range *range=ZERO)
Prototype for user applications.
#define PAGESIZE
ARM uses 4K pages.
Log & operator<<(Log &log, const NetworkQueue::Packet &pkt)
#define assert(exp)
Insert program diagnostics.
#define ERROR(msg)
Output an error message.
unsigned int uint
Unsigned integer number.
unsigned int Size
Any sane size indicator cannot go negative.
unsigned char u8
Unsigned 8-bit number.
Size size
Size in number of bytes.
Address phys
Physical address.
Address virt
Virtual address.
Access access
Page access flags.
Represents a network packet.