]> git.ipfire.org Git - thirdparty/squid.git/blame - src/ssl/ErrorDetail.h
Maintenance: automate header guards 2/3 (#1655)
[thirdparty/squid.git] / src / ssl / ErrorDetail.h
CommitLineData
bbc27441 1/*
b8ae064d 2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
bbc27441
AJ
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
ff9d9458
FC
9#ifndef SQUID_SRC_SSL_ERRORDETAIL_H
10#define SQUID_SRC_SSL_ERRORDETAIL_H
4d16918e 11
83b053a0
CT
12#include "security/ErrorDetail.h"
13
4e143970
FC
14#include <optional>
15
83b053a0
CT
16// TODO: Remove Security::X wrappers and move the remaining configurable error
17// details (i.e. templates/error-details.txt) code to src/security/ErrorDetail.
4d16918e 18
e34763f4 19namespace Ssl
4d16918e 20{
4d16918e 21/**
83f8d8f9
AJ
22 * Converts user-friendly error "name" into an Security::ErrorCode
23 * and adds it to the provided container (using emplace).
7a957a93 24 * This function can handle numeric error numbers as well as names.
4d16918e 25 */
83f8d8f9 26bool ParseErrorString(const char *name, Security::Errors &);
4d16918e 27
13cd7dee 28/// The Security::ErrorCode code of the error described by "name".
83b053a0
CT
29inline Security::ErrorCode
30GetErrorCode(const char *name)
31{
32 return Security::ErrorCodeFromName(name);
33}
02259ff8 34
1dcb1d49
CT
35/// \return string representation of a known TLS error (or a raw error code)
36/// \param prefixRawCode whether to prefix raw codes with "SSL_ERR="
83b053a0
CT
37inline const char *
38GetErrorName(const Security::ErrorCode code, const bool prefixRawCode = false)
39{
40 return Security::ErrorNameFromCode(code, prefixRawCode);
41}
4d16918e 42
4e143970
FC
43/// a short description of the given TLS error known to Squid (or, if the error
44/// is unknown, nothing)
45std::optional<SBuf> GetErrorDescr(Security::ErrorCode);
cf09bec7 46
83f8d8f9 47/// \return true if the TLS error is optional and may not be supported by current squid version
645deacc
CT
48bool ErrorIsOptional(const char *name);
49
4d16918e 50}//namespace Ssl
ff9d9458 51#endif /* SQUID_SRC_SSL_ERRORDETAIL_H */
f53969cc 52