]> git.ipfire.org Git - thirdparty/squid.git/blame - src/proxyp/Parser.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / proxyp / Parser.h
CommitLineData
36c774f7 1/*
b8ae064d 2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
36c774f7
EB
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_PROXYP_PARSER_H
10#define SQUID_PROXYP_PARSER_H
11
12#include "proxyp/forward.h"
13#include "sbuf/forward.h"
14
15namespace ProxyProtocol {
16
17/// successful parsing result
18class Parsed
19{
20public:
21 Parsed(const HeaderPointer &parsedHeader, const size_t parsedSize);
22
23 HeaderPointer header; ///< successfully parsed header; not nil
24 size_t size; ///< raw bytes parsed, including any magic/delimiters
25};
26
27/// Parses a PROXY protocol header from the buffer, determining
28/// the protocol version (v1 or v2) by the leading magic string.
29/// \throws Parser::BinaryTokenizer::InsufficientInput to ask for more data
30/// \returns the successfully parsed header
31Parsed Parse(const SBuf &);
32
33} // namespace ProxyProtocol
34
35#endif
36