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"
13 #include "security/ErrorDetail.h"
14 #include "security/forward.h"
15 
16 namespace Security {
17 
19 class IoResult: public RefCountable {
20 public:
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 
47 inline std::ostream &
48 operator <<(std::ostream &os, const IoResult &result)
49 {
50  result.print(os);
51  return os;
52 }
53 
55 IoResult Accept(Comm::Connection &transport);
56 
59 
61 void ForgetErrors();
62 
63 } // namespace Security
64 
65 #endif /* SQUID_SRC_SECURITY_IO_H */
66 
ErrorDetailPointer errorDetail
ioError case details (or nil)
Definition: Io.h:38
a summary a TLS I/O operation outcome
Definition: Io.h:19
IoResult(const ErrorDetailPointer &anErrorDetail)
Definition: Io.h:27
bool successful() const
convenience wrapper to detect successful I/O outcome; implies !wantsIo()
Definition: Io.h:31
RefCount< IoResult > Pointer
Definition: Io.h:21
Category category
primary outcome classification
Definition: Io.h:40
void ForgetErrors()
clear any errors that a TLS library has accumulated in its global storage
Definition: Io.cc:57
bool wantsIo() const
convenience wrapper to detect whether more I/O is needed
Definition: Io.h:34
std::ostream & operator<<(std::ostream &, const Security::EncryptorAnswer &)
Category
all possible outcome cases
Definition: Io.h:24
const char * errorDescription
a brief description of an error
Definition: Io.h:43
IoResult Connect(Comm::Connection &transport)
establish a TLS connection over the specified from-Squid transport connection
Definition: Io.cc:212
IoResult Accept(Comm::Connection &transport)
accept a TLS connection over the specified to-Squid transport connection
Definition: Io.cc:197
bool important
whether the error was serious/unusual
Definition: Io.h:44
Network/connection security abstraction layer.
Definition: Connection.h:34
IoResult(const Category aCategory)
Definition: Io.h:26
IoResult(const IoResult &aRes)=default
void print(std::ostream &os) const
Definition: Io.cc:28

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors