]>
Commit | Line | Data |
---|---|---|
528b2c61 | 1 | |
2 | /* | |
3 | * $Id: MemObject.h,v 1.1 2003/01/23 00:37:14 robertc Exp $ | |
4 | * | |
5 | * | |
6 | * SQUID Web Proxy Cache http://www.squid-cache.org/ | |
7 | * ---------------------------------------------------------- | |
8 | * | |
9 | * Squid is the result of efforts by numerous individuals from | |
10 | * the Internet community; see the CONTRIBUTORS file for full | |
11 | * details. Many organizations have provided support for Squid's | |
12 | * development; see the SPONSORS file for full details. Squid is | |
13 | * Copyrighted (C) 2001 by the Regents of the University of | |
14 | * California; see the COPYRIGHT file for full details. Squid | |
15 | * incorporates software developed and/or copyrighted by other | |
16 | * sources; see the CREDITS file for full details. | |
17 | * | |
18 | * This program is free software; you can redistribute it and/or modify | |
19 | * it under the terms of the GNU General Public License as published by | |
20 | * the Free Software Foundation; either version 2 of the License, or | |
21 | * (at your option) any later version. | |
22 | * | |
23 | * This program is distributed in the hope that it will be useful, | |
24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
26 | * GNU General Public License for more details. | |
27 | * | |
28 | * You should have received a copy of the GNU General Public License | |
29 | * along with this program; if not, write to the Free Software | |
30 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. | |
31 | * | |
32 | */ | |
33 | ||
34 | #ifndef SQUID_MEMOBJECT_H | |
35 | #define SQUID_MEMOBJECT_H | |
36 | ||
37 | #include "StoreIOBuffer.h" | |
38 | #include "stmem.h" | |
39 | ||
40 | typedef void STMCB (void *data, StoreIOBuffer wroteBuffer); | |
41 | ||
42 | class store_client; | |
43 | ||
44 | class MemObject { | |
45 | public: | |
46 | static size_t inUseCount(); | |
47 | ||
48 | void dump() const; | |
49 | void *operator new (size_t); | |
50 | void operator delete (void *); | |
51 | MemObject(char const *, char const *); | |
52 | ~MemObject(); | |
53 | ||
54 | void write(StoreIOBuffer, STMCB *, void *); | |
55 | void unlinkRequest(); | |
56 | HttpReply const *getReply() const; | |
57 | void stat (StoreEntry *s) const; | |
58 | off_t endOffset () const; | |
59 | size_t size() const; | |
60 | void reset(); | |
61 | off_t lowestMemReaderOffset() const; | |
62 | bool readAheadPolicyCanRead() const; | |
63 | void addClient(store_client *); | |
64 | /* XXX belongs in MemObject::swapout, once swaphdrsz is managed | |
65 | * better | |
66 | */ | |
67 | size_t objectBytesOnDisk() const; | |
68 | off_t policyLowestOffsetToKeep() const; | |
69 | void trimSwappable(); | |
70 | void trimUnSwappable(); | |
71 | bool isContiguous() const; | |
72 | ||
73 | ||
74 | #if URL_CHECKSUM_DEBUG | |
75 | void checkUrlChecksum() const; | |
76 | #endif | |
77 | ||
78 | method_t method; | |
79 | char *url; | |
80 | mem_hdr data_hdr; | |
81 | off_t inmem_lo; | |
82 | dlink_list clients; | |
83 | int nclients; | |
84 | struct { | |
85 | off_t queue_offset; /* relative to in-mem data */ | |
86 | mem_node *memnode; /* which node we're currently paging out */ | |
87 | StoreIOState::Pointer sio; | |
88 | } swapout; | |
89 | /* Read only - this reply must be preserved by store clients */ | |
90 | /* The original reply. possibly with updated metadata. */ | |
91 | request_t *request; | |
92 | struct timeval start_ping; | |
93 | IRCB *ping_reply_callback; | |
94 | void *ircb_data; | |
95 | int fd; /* FD of client creating this entry */ | |
96 | struct { | |
97 | STABH *callback; | |
98 | void *data; | |
99 | } abort; | |
100 | char *log_url; | |
101 | RemovalPolicyNode repl; | |
102 | int id; | |
103 | ssize_t object_sz; | |
104 | size_t swap_hdr_sz; | |
105 | #if URL_CHECKSUM_DEBUG | |
106 | unsigned int chksum; | |
107 | #endif | |
108 | const char *vary_headers; | |
109 | private: | |
110 | static MemPool *pool; | |
111 | ||
112 | /* Read only - this reply must be preserved by store clients */ | |
113 | /* The original reply. possibly with updated metadata. */ | |
114 | HttpReply const *_reply; | |
115 | }; | |
116 | ||
117 | #endif /* SQUID_MEMOBJECT_H */ |