]> git.ipfire.org Git - thirdparty/squid.git/blob - src/mem/forward.h
Merge from trunk
[thirdparty/squid.git] / src / mem / forward.h
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 /* DEBUG: section 13 High Level Memory Pool Management */
10
11 #ifndef _SQUID_SRC_MEM_FORWARD_H
12 #define _SQUID_SRC_MEM_FORWARD_H
13
14 #include "mem/AllocatorProxy.h"
15
16 #include <iosfwd>
17
18 class StoreEntry;
19 class MemPoolStats;
20 class MemPoolMeter;
21
22 /// Memory Management
23 namespace Mem
24 {
25 void Init();
26 void Report();
27 void Stats(StoreEntry *);
28 void CleanIdlePools(void *unused);
29 void Report(std::ostream &);
30 void PoolReport(const MemPoolStats * mp_st, const MemPoolMeter * AllMeter, std::ostream &);
31 };
32
33 extern const size_t squidSystemPageSize;
34
35 /// \deprecated use MEMPROXY_CLASS instead.
36 typedef void FREE(void *);
37
38 /// Types of memory pool which do not yet use MEMPROXY_CLASS() API
39 typedef enum {
40 MEM_NONE,
41 MEM_2K_BUF,
42 MEM_4K_BUF,
43 MEM_8K_BUF,
44 MEM_16K_BUF,
45 MEM_32K_BUF,
46 MEM_64K_BUF,
47 MEM_ACL_DENY_INFO_LIST,
48 MEM_ACL_NAME_LIST,
49 #if USE_CACHE_DIGESTS
50 MEM_CACHE_DIGEST,
51 #endif
52 MEM_CLIENT_INFO,
53 MEM_LINK_LIST,
54 MEM_DLINK_NODE,
55 MEM_DREAD_CTRL,
56 MEM_DWRITE_Q,
57 MEM_HTTP_HDR_CONTENT_RANGE,
58 MEM_MD5_DIGEST,
59 MEM_NETDBENTRY,
60 MEM_NET_DB_NAME,
61 // IMPORTANT: leave this here. pools above are initialized early with memInit()
62 MEM_DONTFREE,
63 // following pools are initialized late by their component if needed (or never)
64 MEM_FQDNCACHE_ENTRY,
65 MEM_FWD_SERVER,
66 MEM_IDNS_QUERY,
67 MEM_IPCACHE_ENTRY,
68 MEM_MAX
69 } mem_type;
70
71 void memClean(void);
72 void memInitModule(void);
73 void memCleanModule(void);
74 void memConfigure(void);
75 void *memAllocate(mem_type);
76 void *memAllocString(size_t net_size, size_t * gross_size);
77 void *memAllocBuf(size_t net_size, size_t * gross_size);
78 void *memReallocBuf(void *buf, size_t net_size, size_t * gross_size);
79 void memFree(void *, int type);
80 void memFreeString(size_t size, void *);
81 void memFreeBuf(size_t size, void *);
82 FREE *memFreeBufFunc(size_t size);
83 int memInUse(mem_type);
84 void memDataInit(mem_type, const char *, size_t, int, bool doZero = true);
85 void memCheckInit(void);
86
87 #endif /* _SQUID_SRC_MEM_FORWARD_H */
88