]> git.ipfire.org Git - thirdparty/dhcp.git/blame - includes/omapip/alloc.h
Fix compilation errors introduced in the last set of checkins.
[thirdparty/dhcp.git] / includes / omapip / alloc.h
CommitLineData
a40cbc2b
TL
1/* alloc.h
2
3 Definitions for the object management API protocol memory allocation... */
4
5/*
6 * Copyright (c) 1996-1999 Internet Software Consortium.
7 * Use is subject to license terms which appear in the file named
8 * ISC-LICENSE that should have accompanied this file when you
9 * received it. If a file named ISC-LICENSE did not accompany this
10 * file, or you are not sure the one you have is correct, you may
11 * obtain an applicable copy of the license at:
12 *
13 * http://www.isc.org/isc-license-1.0.html.
14 *
15 * This file is part of the ISC DHCP distribution. The documentation
16 * associated with this file is listed in the file DOCUMENTATION,
17 * included in the top-level directory of this release.
18 *
19 * Support and other services are available for ISC products - see
20 * http://www.isc.org for more information.
21 */
22
4bd8800e 23isc_result_t omapi_buffer_new (omapi_buffer_t **, const char *, int);
a40cbc2b 24isc_result_t omapi_buffer_reference (omapi_buffer_t **,
4bd8800e
TL
25 omapi_buffer_t *, const char *, int);
26isc_result_t omapi_buffer_dereference (omapi_buffer_t **, const char *, int);
27
28#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
29#define DMDOFFSET (sizeof (struct dmalloc_preamble))
30#define DMLFSIZE 16
31#define DMUFSIZE 16
32#define DMDSIZE (DMDOFFSET + DMLFSIZE + DMUFSIZE)
33
34struct dmalloc_preamble {
35 struct dmalloc_preamble *prev, *next;
36 const char *file;
37 int line;
38 size_t size;
39 unsigned long generation;
40 unsigned char low_fence [DMLFSIZE];
41};
42#else
43#define DMDOFFSET 0
44#define DMDSIZE 0
45#endif
46
47#if defined (DEBUG_RC_HISTORY)
48#if !defined (RC_HISTORY_MAX)
49# define RC_HISTORY_MAX 256
50#endif
51
52struct rc_history_entry {
53 const char *file;
54 int line;
55 VOIDPTR addr;
56 int refcnt;
57};
58
59#define rc_register(x, l, y, z) do { \
60 rc_history [rc_history_index].file = (x); \
61 rc_history [rc_history_index].line = (l); \
62 rc_history [rc_history_index].addr = (y); \
63 rc_history [rc_history_index].refcnt = (z); \
64 if (++rc_history_index == RC_HISTORY_MAX) \
65 rc_history_index = 0;\
66 } while (0)
67#define rc_register_mdl(y, z) \
68 rc_register (__FILE__, __LINE__, y, z)
69#else
70#define rc_register(file, line, addr, refcnt)
71#define rc_register_mdl(addr, refcnt)
72#endif
73
74#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)
75extern struct dmalloc_preamble *dmalloc_list;
76extern unsigned long dmalloc_outstanding;
77extern unsigned long dmalloc_longterm;
78extern unsigned long dmalloc_generation;
79extern unsigned long dmalloc_cutoff_generation;
80#endif
81
82#if defined (DEBUG_RC_HISTORY)
83extern struct rc_history_entry rc_history [RC_HISTORY_MAX];
84extern int rc_history_index;
85#endif