StoreSwapLogData.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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#ifndef SQUID_STORESWAPLOGDATA_H
10#define SQUID_STORESWAPLOGDATA_H
11
35#include "md5.h"
36#include "mem/forward.h"
37#include "store/forward.h"
38
41{
42public:
43 SwapChecksum24() { raw[0] = raw[1] = raw[2] = 0; }
44
45 bool operator ==(const SwapChecksum24 &o) const {
46 return raw[0] == o.raw[0] && raw[1] == o.raw[1] && raw[2] == o.raw[2];
47 }
48
49 bool operator !=(const SwapChecksum24 &o) const {
50 return !(*this == o);
51 }
52
54 void set(uint32_t f1, uint32_t f2, uint32_t f3);
55
57 void set(int32_t f1, uint64_t f2);
58
59 // printing for debugging
60 std::ostream &print(std::ostream &os) const;
61
62private:
63 uint8_t raw[3]; // designed to follow "op" members, in padding space
64};
65
66inline std::ostream &
67operator <<(std::ostream &os, const SwapChecksum24 &sum)
68{
69 return sum.print(os);
70}
71
83{
85
86public:
88 typedef int64_t SwappedTime;
89
91 bool sane() const;
92
94 void finalize();
95
100 uint8_t op = 0;
101
105 SwapChecksum24 checksum; // follows "op" because compiler will pad anyway
106
115
124
129
140
147
152 uint64_t swap_file_sz = 0;
153
159 uint16_t refcount;
160
166 uint16_t flags = 0;
167
171 unsigned char key[SQUID_MD5_DIGEST_LENGTH] = {};
172};
173
177{
178public:
179 // sets default values for this Squid version; loaded values may differ
181
183 bool sane() const;
184
186 size_t gapSize() const;
187
188 uint8_t op;
189 SwapChecksum24 checksum; // follows "op" because compiler will pad anyway
190 int32_t version;
191 int32_t record_size;
192};
193
194#endif /* SQUID_STORESWAPLOGDATA_H */
195
std::ostream & operator<<(std::ostream &os, const SwapChecksum24 &sum)
unsigned char key[SQUID_MD5_DIGEST_LENGTH]
MEMPROXY_CLASS(StoreSwapLogData)
int64_t SwappedTime
type to use for storing time-related members; must be signed
SwappedTime timestamp
bool sane() const
consistency self-check: whether the data appears to make sense
void finalize()
call this before storing the log entry
SwapChecksum24 checksum
size_t gapSize() const
number of bytes after the log header before the first log entry
bool sane() const
consistency self-check: whether the data appears to make sense
SwapChecksum24 checksum
maintains a 24-bit checksum over integer fields
void set(uint32_t f1, uint32_t f2, uint32_t f3)
compute and store checksum based on three 32bit integers
bool operator!=(const SwapChecksum24 &o) const
bool operator==(const SwapChecksum24 &o) const
std::ostream & print(std::ostream &os) const
#define SQUID_MD5_DIGEST_LENGTH
Definition: md5.h:66
signed_int32_t sfileno
Definition: forward.h:22

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors