1 // Copyright 2015 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_SPDY_CORE_SPDY_HEADERS_HANDLER_INTERFACE_H_ 6 #define QUICHE_SPDY_CORE_SPDY_HEADERS_HANDLER_INTERFACE_H_ 7 8 #include <stddef.h> 9 10 #include "absl/strings/string_view.h" 11 #include "quiche/common/platform/api/quiche_export.h" 12 13 namespace spdy { 14 15 // This interface defines how an object that accepts header data should behave. 16 // It is used by both SpdyHeadersBlockParser and HpackDecoder. 17 class QUICHE_EXPORT SpdyHeadersHandlerInterface { 18 public: ~SpdyHeadersHandlerInterface()19 virtual ~SpdyHeadersHandlerInterface() {} 20 21 // A callback method which notifies when the parser starts handling a new 22 // header block. Will only be called once per block, even if it extends into 23 // CONTINUATION frames. 24 virtual void OnHeaderBlockStart() = 0; 25 26 // A callback method which notifies on a header key value pair. Multiple 27 // values for a given key will be emitted as multiple calls to OnHeader. 28 virtual void OnHeader(absl::string_view key, absl::string_view value) = 0; 29 30 // A callback method which notifies when the parser finishes handling a 31 // header block (i.e. the containing frame has the END_HEADERS flag set). 32 // Also indicates the total number of bytes in this block. 33 virtual void OnHeaderBlockEnd(size_t uncompressed_header_bytes, 34 size_t compressed_header_bytes) = 0; 35 }; 36 37 } // namespace spdy 38 39 #endif // QUICHE_SPDY_CORE_SPDY_HEADERS_HANDLER_INTERFACE_H_ 40