xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/core/crypto/crypto_message_parser.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef QUICHE_QUIC_CORE_CRYPTO_CRYPTO_MESSAGE_PARSER_H_
6 #define QUICHE_QUIC_CORE_CRYPTO_CRYPTO_MESSAGE_PARSER_H_
7 
8 #include <string>
9 
10 #include "absl/strings/string_view.h"
11 #include "quiche/quic/core/quic_error_codes.h"
12 #include "quiche/quic/core/quic_types.h"
13 
14 namespace quic {
15 
16 class QUICHE_EXPORT CryptoMessageParser {
17  public:
~CryptoMessageParser()18   virtual ~CryptoMessageParser() {}
19 
20   virtual QuicErrorCode error() const = 0;
21   virtual const std::string& error_detail() const = 0;
22 
23   // Processes input data, which must be delivered in order. The input data
24   // being processed was received at encryption level |level|. Returns
25   // false if there was an error, and true otherwise.
26   virtual bool ProcessInput(absl::string_view input, EncryptionLevel level) = 0;
27 
28   // Returns the number of bytes of buffered input data remaining to be
29   // parsed.
30   virtual size_t InputBytesRemaining() const = 0;
31 };
32 
33 }  // namespace quic
34 
35 #endif  // QUICHE_QUIC_CORE_CRYPTO_CRYPTO_MESSAGE_PARSER_H_
36