Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: net/http2/hpack/decoder/hpack_entry_decoder_listener.h

Issue 2554683003: Revert of Add new HTTP/2 and HPACK decoder in net/http2/. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 NET_HTTP2_HPACK_DECODER_HPACK_ENTRY_DECODER_LISTENER_H_
6 #define NET_HTTP2_HPACK_DECODER_HPACK_ENTRY_DECODER_LISTENER_H_
7
8 // Defines HpackEntryDecoderListener, the base class of listeners that
9 // HpackEntryDecoder calls. Also defines HpackEntryDecoderVLoggingListener
10 // which logs before calling another HpackEntryDecoderListener implementation.
11
12 #include <stddef.h>
13
14 #include "net/base/net_export.h"
15 #include "net/http2/hpack/http2_hpack_constants.h"
16
17 namespace net {
18
19 class NET_EXPORT_PRIVATE HpackEntryDecoderListener {
20 public:
21 virtual ~HpackEntryDecoderListener() {}
22
23 // Called when an indexed header (i.e. one in the static or dynamic table) has
24 // been decoded from an HPACK block. index is supposed to be non-zero, but
25 // that has not been checked by the caller.
26 virtual void OnIndexedHeader(size_t index) = 0;
27
28 // Called when the start of a header with a literal value, and maybe a literal
29 // name, has been decoded. maybe_name_index is zero if the header has a
30 // literal name, else it is a reference into the static or dynamic table, from
31 // which the name should be determined. When the name is literal, the next
32 // call will be to OnNameStart; else it will be to OnValueStart. entry_type
33 // indicates whether the peer has added the entry to its dynamic table, and
34 // whether a proxy is permitted to do so when forwarding the entry.
35 virtual void OnStartLiteralHeader(HpackEntryType entry_type,
36 size_t maybe_name_index) = 0;
37
38 // Called when the encoding (Huffman compressed or plain text) and the encoded
39 // length of a literal name has been decoded. OnNameData will be called next,
40 // and repeatedly until the sum of lengths passed to OnNameData is len.
41 virtual void OnNameStart(bool huffman_encoded, size_t len) = 0;
42
43 // Called when len bytes of an encoded header name have been decoded.
44 virtual void OnNameData(const char* data, size_t len) = 0;
45
46 // Called after the entire name has been passed to OnNameData.
47 // OnValueStart will be called next.
48 virtual void OnNameEnd() = 0;
49
50 // Called when the encoding (Huffman compressed or plain text) and the encoded
51 // length of a literal value has been decoded. OnValueData will be called
52 // next, and repeatedly until the sum of lengths passed to OnValueData is len.
53 virtual void OnValueStart(bool huffman_encoded, size_t len) = 0;
54
55 // Called when len bytes of an encoded header value have been decoded.
56 virtual void OnValueData(const char* data, size_t len) = 0;
57
58 // Called after the entire value has been passed to OnValueData, marking the
59 // end of a header entry with a literal value, and maybe a literal name.
60 virtual void OnValueEnd() = 0;
61
62 // Called when an update to the size of the peer's dynamic table has been
63 // decoded.
64 virtual void OnDynamicTableSizeUpdate(size_t size) = 0;
65 };
66
67 class NET_EXPORT_PRIVATE HpackEntryDecoderVLoggingListener
68 : public HpackEntryDecoderListener {
69 public:
70 HpackEntryDecoderVLoggingListener() : wrapped_(nullptr) {}
71 explicit HpackEntryDecoderVLoggingListener(HpackEntryDecoderListener* wrapped)
72 : wrapped_(wrapped) {}
73 ~HpackEntryDecoderVLoggingListener() override {}
74
75 void OnIndexedHeader(size_t index) override;
76 void OnStartLiteralHeader(HpackEntryType entry_type,
77 size_t maybe_name_index) override;
78 void OnNameStart(bool huffman_encoded, size_t len) override;
79 void OnNameData(const char* data, size_t len) override;
80 void OnNameEnd() override;
81 void OnValueStart(bool huffman_encoded, size_t len) override;
82 void OnValueData(const char* data, size_t len) override;
83 void OnValueEnd() override;
84 void OnDynamicTableSizeUpdate(size_t size) override;
85
86 private:
87 HpackEntryDecoderListener* const wrapped_;
88 };
89
90 // A no-op implementation of HpackEntryDecoderListener.
91 class NET_EXPORT_PRIVATE HpackEntryDecoderNoOpListener
92 : public HpackEntryDecoderListener {
93 public:
94 ~HpackEntryDecoderNoOpListener() override {}
95
96 void OnIndexedHeader(size_t index) override {}
97 void OnStartLiteralHeader(HpackEntryType entry_type,
98 size_t maybe_name_index) override {}
99 void OnNameStart(bool huffman_encoded, size_t len) override {}
100 void OnNameData(const char* data, size_t len) override {}
101 void OnNameEnd() override {}
102 void OnValueStart(bool huffman_encoded, size_t len) override {}
103 void OnValueData(const char* data, size_t len) override {}
104 void OnValueEnd() override {}
105 void OnDynamicTableSizeUpdate(size_t size) override {}
106 };
107
108 } // namespace net
109
110 #endif // NET_HTTP2_HPACK_DECODER_HPACK_ENTRY_DECODER_LISTENER_H_
OLDNEW
« no previous file with comments | « net/http2/hpack/decoder/hpack_entry_decoder.cc ('k') | net/http2/hpack/decoder/hpack_entry_decoder_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698