StoreSwapLogData.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2019 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 
38 #include "md5.h"
39 #include "mem/forward.h"
40 #include "store/forward.h"
41 
44 {
45 public:
46  SwapChecksum24() { raw[0] = raw[1] = raw[2] = 0; }
47 
48  bool operator ==(const SwapChecksum24 &o) const {
49  return raw[0] == o.raw[0] && raw[1] == o.raw[1] && raw[2] == o.raw[2];
50  }
51 
52  bool operator !=(const SwapChecksum24 &o) const {
53  return !(*this == o);
54  }
55 
57  void set(uint32_t f1, uint32_t f2, uint32_t f3);
58 
60  void set(int32_t f1, uint64_t f2);
61 
62  // printing for debugging
63  std::ostream &print(std::ostream &os) const;
64 
65 private:
66  uint8_t raw[3]; // designed to follow "op" members, in pading space
67 };
68 
69 inline std::ostream &
70 operator <<(std::ostream &os, const SwapChecksum24 &sum)
71 {
72  return sum.print(os);
73 }
74 
86 {
88 
89 public:
91  typedef int64_t SwappedTime;
92 
94  bool sane() const;
95 
97  void finalize();
98 
103  uint8_t op = 0;
104 
108  SwapChecksum24 checksum; // follows "op" because compiler will pad anyway
109 
117  sfileno swap_filen = 0;
118 
126  SwappedTime timestamp = 0;
127 
131  SwappedTime lastref = 0;
132 
142  SwappedTime expires = 0;
143 
149  SwappedTime lastmod = 0;
150 
155  uint64_t swap_file_sz = 0;
156 
162  uint16_t refcount;
163 
169  uint16_t flags = 0;
170 
174  unsigned char key[SQUID_MD5_DIGEST_LENGTH] = {};
175 };
176 
180 {
181 public:
182  // sets default values for this Squid version; loaded values may differ
184 
186  bool sane() const;
187 
189  size_t gapSize() const;
190 
191  uint8_t op;
192  SwapChecksum24 checksum; // follows "op" because compiler will pad anyway
193  int32_t version;
194  int32_t record_size;
195 };
196 
197 #endif /* SQUID_STORESWAPLOGDATA_H */
198 
#define MEMPROXY_CLASS(CLASS)
int64_t SwappedTime
type to use for storing time-related members; must be signed
bool operator==(const SwapChecksum24 &o) const
SwapChecksum24 checksum
bool operator!=(const SwapChecksum24 &o) const
maintains a 24-bit checksum over integer fields
std::ostream & operator<<(std::ostream &os, const SwapChecksum24 &sum)
#define SQUID_MD5_DIGEST_LENGTH
Definition: md5.h:66
SwapChecksum24 checksum
signed_int32_t sfileno
Definition: forward.h:22
std::ostream & print(std::ostream &os) const

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors