TaPAS  0.2
ccl-pool.h
Go to the documentation of this file.
1 /*
2  * ccl-pool.h -- A by-packet allocator
3  *
4  * This file is a part of the C Common Library (CCL) project.
5  *
6  * Copyright (C) 2010 CNRS UMR 5800 & Université Bordeaux I (see AUTHORS file).
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the AltaRica Public License that comes with this
10  * package.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  */
16 
21 #ifndef __CCL_POOL_H__
22 # define __CCL_POOL_H__
23 
24 # include <ccl/ccl-common.h>
25 # include <ccl/ccl-log.h>
26 
27 BEGIN_C_DECLS
28 
32 typedef struct ccl_pool_st ccl_pool;
33 
46 extern ccl_pool *
47 ccl_pool_create (const char *poolname, size_t object_size, int nb_elements);
48 
59 extern void
61 
75 extern void *
76 ccl_pool_alloc (ccl_pool *pool);
77 
89 extern void
90 ccl_pool_release (ccl_pool *pool, void *ptr);
91 
101 extern void
102 ccl_pool_collect (ccl_pool *pool);
103 
110 extern void
112 
118 extern void
119 ccl_pools_collect (void);
120 
129 extern void
131 
132 END_C_DECLS
133 
134 #endif /* ! __CCL_POOL_H__ */
void ccl_pools_display_info(ccl_log_type lt)
Display statistics about all pools.
void ccl_pool_release(ccl_pool *pool, void *ptr)
Releases the block pointed by ptr.
void ccl_pool_collect(ccl_pool *pool)
Tries to collect completely free packets.
void ccl_pool_display_info(ccl_log_type lt, ccl_pool *pool)
Display statictics about pool.
void ccl_pools_collect(void)
Collect packets in all pools.
void ccl_pool_delete(ccl_pool *pool)
Deletion of pool.
void * ccl_pool_alloc(ccl_pool *pool)
Allocates a new object.
Some useful and common macros.
ccl_pool * ccl_pool_create(const char *poolname, size_t object_size, int nb_elements)
Creates a pool named by poolname that allocates packets of nb_elements objects each one having a size...
struct ccl_pool_st ccl_pool
Abstract type of a Pool.
Definition: ccl-pool.h:32
enum ccl_log_type_enum ccl_log_type
Enum that indicates which kind of message has to be displayed. Each kind of message can be displayed ...
Definition: ccl-log.h:50
Message displayer.