1 /* Memory management routine
2 Copyright (C) 1998 Kunihiro Ishiguro
4 This file is part of GNU Zebra.
6 GNU Zebra is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 GNU Zebra is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Zebra; see the file COPYING. If not, write to the Free
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 #ifndef _ZEBRA_MEMORY_H
22 #define _ZEBRA_MEMORY_H
24 /* #define MEMORY_LOG */
26 /* For tagging memory, below is the type of the memory. */
64 MTYPE_ACCESS_LIST_STR
,
67 MTYPE_PREFIX_LIST_STR
,
68 MTYPE_PREFIX_LIST_ENTRY
,
71 MTYPE_ROUTE_MAP_INDEX
,
73 MTYPE_ROUTE_MAP_RULE_STR
,
74 MTYPE_ROUTE_MAP_COMPILED
,
90 MTYPE_OSPF_AREA_RANGE
,
92 MTYPE_OSPF_NEIGHBOR_STATIC
,
106 MTYPE_OSPF_CRYPT_KEY
,
107 MTYPE_OSPF_EXTERNAL_INFO
,
111 MTYPE_OSPF_IF_PARAMS
,
116 MTYPE_OSPF6_NEIGHBOR
,
121 MTYPE_OSPF6_LSA_SUMMARY
,
126 MTYPE_OSPF6_EXTERNAL_INFO
,
133 MTYPE_PEER_UPDATE_SOURCE
,
136 MTYPE_BGP_CONFED_LIST
,
137 MTYPE_BGP_NEXTHOP_CACHE
,
139 MTYPE_BGP_DAMP_ARRAY
,
141 MTYPE_BGP_ATTR_QUEUE
,
142 MTYPE_BGP_ROUTE_QUEUE
,
147 MTYPE_BGP_ADVERTISE_ATTR
,
161 MTYPE_ECOMMUNITY_VAL
,
162 MTYPE_ECOMMUNITY_STR
,
164 /* community-list and extcommunity-list. */
165 MTYPE_COMMUNITY_LIST_HANDLER
,
166 MTYPE_COMMUNITY_LIST
,
167 MTYPE_COMMUNITY_LIST_NAME
,
168 MTYPE_COMMUNITY_LIST_ENTRY
,
169 MTYPE_COMMUNITY_LIST_CONFIG
,
174 MTYPE_RIP_OFFSET_LIST
,
182 MTYPE_RIPNG_AGGREGATE
,
184 MTYPE_RIPNG_OFFSET_LIST
,
185 MTYPE_RIPNG_RTE_DATA
,
188 MTYPE_VTYSH_CONFIG_LINE
,
199 #define XMALLOC(mtype, size) \
200 mtype_zmalloc (__FILE__, __LINE__, (mtype), (size))
201 #define XCALLOC(mtype, size) \
202 mtype_zcalloc (__FILE__, __LINE__, (mtype), (size))
203 #define XREALLOC(mtype, ptr, size) \
204 mtype_zrealloc (__FILE__, __LINE__, (mtype), (ptr), (size))
205 #define XFREE(mtype, ptr) \
206 mtype_zfree (__FILE__, __LINE__, (mtype), (ptr))
207 #define XSTRDUP(mtype, str) \
208 mtype_zstrdup (__FILE__, __LINE__, (mtype), (str))
210 #define XMALLOC(mtype, size) zmalloc ((mtype), (size))
211 #define XCALLOC(mtype, size) zcalloc ((mtype), (size))
212 #define XREALLOC(mtype, ptr, size) zrealloc ((mtype), (ptr), (size))
213 #define XFREE(mtype, ptr) zfree ((mtype), (ptr))
214 #define XSTRDUP(mtype, str) zstrdup ((mtype), (str))
215 #endif /* MEMORY_LOG */
217 /* Prototypes of memory function. */
218 void *zmalloc (int type
, size_t size
);
219 void *zcalloc (int type
, size_t size
);
220 void *zrealloc (int type
, void *ptr
, size_t size
);
221 void zfree (int type
, void *ptr
);
222 char *zstrdup (int type
, char *str
);
224 void *mtype_zmalloc (const char *file
,
229 void *mtype_zcalloc (const char *file
,
235 void *mtype_zrealloc (const char *file
,
241 void mtype_zfree (const char *file
,
246 char *mtype_zstrdup (const char *file
,
252 #endif /* _ZEBRA_MEMORY_H */