StoreSwapLogData.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 
96  bool sane() const;
97 
99  void finalize();
100 
105  uint8_t op;
106 
110  SwapChecksum24 checksum; // follows "op" because compiler will pad anyway
111 
120 
129 
134 
145 
152 
157  uint64_t swap_file_sz;
158 
164  uint16_t refcount;
165 
171  uint16_t flags;
172 
176  unsigned char key[SQUID_MD5_DIGEST_LENGTH];
177 };
178 
182 {
183 public:
184  // sets default values for this Squid version; loaded values may differ
186 
188  bool sane() const;
189 
191  size_t gapSize() const;
192 
193  uint8_t op;
194  SwapChecksum24 checksum; // follows "op" because compiler will pad anyway
195  int32_t version;
196  int32_t record_size;
197 };
198 
199 #endif /* SQUID_STORESWAPLOGDATA_H */
200 
void finalize()
call this before storing the log entry
bool sane() const
consistency self-check: whether the data appears to make sense
int64_t SwappedTime
type to use for storing time-related members; must be signed
SwapChecksum24 checksum
maintains a 24-bit checksum over integer fields
std::ostream & operator<<(std::ostream &os, const SwapChecksum24 &sum)
unsigned char key[SQUID_MD5_DIGEST_LENGTH]
MEMPROXY_CLASS(StoreSwapLogData)
#define SQUID_MD5_DIGEST_LENGTH
Definition: md5.h:66
SwappedTime timestamp
SwapChecksum24 checksum
bool operator==(const SwapChecksum24 &o) const
signed_int32_t sfileno
Definition: forward.h:22
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
void set(uint32_t f1, uint32_t f2, uint32_t f3)
compute and store checksum based on three 32bit integers
std::ostream & print(std::ostream &os) const
bool operator!=(const SwapChecksum24 &o) const

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors