file.

Packet Queue and Queue Entry Classes {#sec:packetqueue}
------------------------------------

The Packet Queue Class manages a node’s message buffer. The Routing Protocol class interacts with the Packet Queue class to manage messages and generate control packets. The Packet Queue class implements a protocol’s buffer management scheme, something which is much more significant in other DTN protocols. The `m_BufferSize` attribute defines the maximum size of the message buffer in bytes. `Enqueue` adds messages to the buffer, and `Dequeue` removes messages from the buffer. After a node adds a message to the message buffer, `DropExpiredMessages` removes expired messages. If the message buffer is full, `Purge` removes messages according to the protocol’s queue management scheme. `FindDisjointMessages` generates the list of messages to replicate according to a protocol’s message priority. The `Drop` function removes a selected message from the buffer. The `GetSize` function returns the number of messages in the buffer.

Since messages are groups of packets, the message buffer requires a data structure to group packets. The `m_queue` is a map matching a message ID to a queue entry defined by the Queue Entry class. A queue entry is a data structure that stores the packets belonging to a message, the header, expiration time, 