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