10#ifndef MIDDLEBOX_RBT_HH
11#define MIDDLEBOX_RBT_HH
14#include <clicknet/tcp.h>
15#include "memorypool.hh"
160#define BS_TREE_POOL_SIZE 10
161#define BS_POOL_SIZE 5000
162#define BS_PRUNE_THRESHOLD 10
176 poolKeys(BS_POOL_SIZE),
177 poolInfos(BS_POOL_SIZE),
178 poolTrees(BS_TREE_POOL_SIZE)
183 inline int compareKeys(
const void* first,
const void* second)
185 if(SEQ_GT(*(uint32_t*)first, *(uint32_t*)second))
187 if(SEQ_LT(*(uint32_t*)first, *(uint32_t*)second))
193 void printKey(
const void* first)
195 click_chatter(
"%u", *(uint32_t*)first);
198 void printInfo(
void* first)
200 click_chatter(
"%d", *(
int*)first);
218 void freeKey(
void* key)
223 void freeInfo(
void* info)
233 uint32_t* allocateKey(
void)
238 int* allocateInfo(
void)
Template for memory pools.
Definition memorypool.hh:20
void releaseMemory(T *p)
Release memory and put it back in the pool.
Definition memorypool.hh:94
T * getMemory()
Obtain memory from the memory pool.
Definition memorypool.hh:76
RBTManager that uses memory pools to allocate memory and compares the keys as sequence numbers.
Definition rbt.hh:173