Click
Loading...
Searching...
No Matches
bufferpool.hh
1/*
2 * bufferpool.hh - Class used to provide a pool of buffers that can have a dynamic size
3 * and be resized at any moment.
4 *
5 * Romain Gaillard.
6 */
7
8#ifndef MIDDLEBOX_BUFFERPOOL_HH
9#define MIDDLEBOX_BUFFERPOOL_HH
10
11#include "bufferpoolnode.hh"
12
13CLICK_DECLS
14
25{
26public:
31 BufferPool(uint32_t initialNumber, uint32_t initialSize);
32
36
42
46 void releaseBuffer(BufferPoolNode* buffer);
47
48private:
49 BufferPoolNode *head;
50 uint32_t initialSize;
55 void allocateMoreBuffers(uint32_t n);
56
57};
58
59CLICK_ENDDECLS
60
61#endif
Class used to provide a pool of buffers that can have a dynamic size and be resized at any moment.
Definition bufferpool.hh:25
~BufferPool()
Destruct a BufferPool and free the memory.
Definition bufferpool.cc:21
BufferPoolNode * getBuffer()
Return a buffer from the pool. Note that the size of the buffer is random, so be sure to resize it to...
Definition bufferpool.cc:54
void releaseBuffer(BufferPoolNode *buffer)
Put back a buffer into the pool.
Definition bufferpool.cc:48
Class used to manage a buffer obtained via a BufferPool.
Definition bufferpoolnode.hh:21