Io.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_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
36 void print(std::ostream &os) const;
37
39
41
42 /* the data members below facilitate human-friendly debugging */
43 const char *errorDescription = nullptr;
44 bool important = false;
45};
46
47inline std::ostream &
48operator <<(std::ostream &os, const IoResult &result)
49{
50 result.print(os);
51 return os;
52}
53
56
59
61void ForgetErrors();
62
63} // namespace Security
64
65#endif /* SQUID_SRC_SECURITY_IO_H */
66
#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
ErrorDetailPointer errorDetail
ioError case details (or nil)
Definition: Io.h:38
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:40
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:44
IoResult(const ErrorDetailPointer &anErrorDetail)
Definition: Io.h:27
void print(std::ostream &os) const
Definition: Io.cc:28
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:43
RefCount< IoResult > Pointer
Definition: Io.h:21
Network/connection security abstraction layer.
Definition: Connection.h:34
IoResult Accept(Comm::Connection &transport)
accept a TLS connection over the specified to-Squid transport connection
Definition: Io.cc:197
IoResult Connect(Comm::Connection &transport)
establish a TLS connection over the specified from-Squid transport connection
Definition: Io.cc:212
std::ostream & operator<<(std::ostream &, const Security::EncryptorAnswer &)
void ForgetErrors()
clear any errors that a TLS library has accumulated in its global storage
Definition: Io.cc:57

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors