Squid Web Cache master
Loading...
Searching...
No Matches
Io.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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_SRC_SECURITY_IO_H
10#define SQUID_SRC_SECURITY_IO_H
11
12#include "comm/forward.h"
14#include "security/forward.h"
15
16namespace Security {
17
19class IoResult: public RefCountable {
20public:
22
25
26 explicit IoResult(const Category aCategory): category(aCategory) {}
27 explicit IoResult(const ErrorDetailPointer &anErrorDetail): errorDetail(anErrorDetail) {}
28 IoResult(const IoResult &aRes) = default;
29
31 bool successful() const { return category == ioSuccess; }
32
34 bool wantsIo() const { return category == ioWantRead || category == ioWantWrite; }
35
37 void printGist(std::ostream &) const;
38
41 void printWithExtras(std::ostream &) const;
42
44
46
47 /* the data members below facilitate human-friendly debugging */
48 const char *errorDescription = nullptr;
49 bool important = false;
50
51private:
52 void printDescription(std::ostream &) const;
53};
54
55inline std::ostream &
56operator <<(std::ostream &os, const IoResult &result)
57{
58 result.printGist(os);
59 return os;
60}
61
64
67
69void ForgetErrors();
70
73void PrepForIo();
74
75} // namespace Security
76
77#endif /* SQUID_SRC_SECURITY_IO_H */
78
#define RefCountable
The locking interface for use on Reference-Counted classes.
Definition Lock.h:66
a summary a TLS I/O operation outcome
Definition Io.h:19
IoResult(const IoResult &aRes)=default
void printDescription(std::ostream &) const
common part of printGist() and printWithExtras()
Definition Io.cc:28
ErrorDetailPointer errorDetail
ioError case details (or nil)
Definition Io.h:43
bool successful() const
convenience wrapper to detect successful I/O outcome; implies !wantsIo()
Definition Io.h:31
Category category
primary outcome classification
Definition Io.h:45
IoResult(const Category aCategory)
Definition Io.h:26
Category
all possible outcome cases
Definition Io.h:24
bool important
whether the error was serious/unusual
Definition Io.h:49
IoResult(const ErrorDetailPointer &anErrorDetail)
Definition Io.h:27
void printWithExtras(std::ostream &) const
Definition Io.cc:58
bool wantsIo() const
convenience wrapper to detect whether more I/O is needed
Definition Io.h:34
const char * errorDescription
a brief description of an error
Definition Io.h:48
void printGist(std::ostream &) const
reports brief summary (on one line) suitable for low-level debugging
Definition Io.cc:49
RefCount< IoResult > Pointer
Definition Io.h:21
Network/connection security abstraction layer.
Definition Connection.h:34
void PrepForIo()
Definition Io.cc:78
IoResult Accept(Comm::Connection &transport)
accept a TLS connection over the specified to-Squid transport connection
Definition Io.cc:208
IoResult Connect(Comm::Connection &transport)
establish a TLS connection over the specified from-Squid transport connection
Definition Io.cc:223
std::ostream & operator<<(std::ostream &, const EncryptorAnswer &)
void ForgetErrors()
clear any errors that a TLS library has accumulated in its global storage
Definition Io.cc:70