2 * Definitions for the Wireshark Memory Manager Allocator
3 * Copyright 2012, Evan Huus <eapache@gmail.com>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #ifndef __WMEM_ALLOCATOR_H__
27 #define __WMEM_ALLOCATOR_H__
34 #endif /* __cplusplus */
36 enum _wmem_allocator_type_t
;
37 struct _wmem_user_cb_container_t
;
39 /* See section "4. Internal Design" of doc/README.wmem for details
40 * on this structure */
41 struct _wmem_allocator_t
{
42 /* Consumer functions */
43 void *(*alloc
)(void *private_data
, const size_t size
);
44 void (*free
)(void *private_data
, void *ptr
);
45 void *(*realloc
)(void *private_data
, void *ptr
, const size_t size
);
47 /* Producer/Manager functions */
48 void (*free_all
)(void *private_data
);
49 void (*gc
)(void *private_data
);
50 void (*cleanup
)(void *private_data
);
53 struct _wmem_user_cb_container_t
*callbacks
;
55 /* Implementation details */
57 enum _wmem_allocator_type_t type
;
63 #endif /* __cplusplus */
65 #endif /* __WMEM_ALLOCATOR_H__ */
68 * Editor modelines - http://www.wireshark.org/tools/modelines.html
73 * indent-tabs-mode: nil
76 * vi: set shiftwidth=4 tabstop=8 expandtab:
77 * :indentSize=4:tabSize=8:noTabs=true: