OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_SPDY_SPDY_HEADERS_HANDLER_INTERFACE_H_ | 5 #ifndef NET_SPDY_SPDY_HEADERS_HANDLER_INTERFACE_H_ |
6 #define NET_SPDY_SPDY_HEADERS_HANDLER_INTERFACE_H_ | 6 #define NET_SPDY_SPDY_HEADERS_HANDLER_INTERFACE_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 |
8 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
9 | 11 |
10 namespace net { | 12 namespace net { |
11 | 13 |
12 // This interface defines how an object that accepts header data should behave. | 14 // This interface defines how an object that accepts header data should behave. |
13 // It is used by both SpdyHeadersBlockParser and HpackDecoder. | 15 // It is used by both SpdyHeadersBlockParser and HpackDecoder. |
14 class SpdyHeadersHandlerInterface { | 16 class SpdyHeadersHandlerInterface { |
15 public: | 17 public: |
16 virtual ~SpdyHeadersHandlerInterface() {} | 18 virtual ~SpdyHeadersHandlerInterface() {} |
17 | 19 |
18 // A callback method which notifies when the parser starts handling a new | 20 // A callback method which notifies when the parser starts handling a new |
19 // header block fragment. | 21 // header block fragment. |
20 virtual void OnHeaderBlockStart() = 0; | 22 virtual void OnHeaderBlockStart() = 0; |
21 | 23 |
22 // A callback method which notifies on a header key value pair. Multiple | 24 // A callback method which notifies on a header key value pair. Multiple |
23 // values for a given key will be emitted as multiple calls to OnHeader. | 25 // values for a given key will be emitted as multiple calls to OnHeader. |
24 virtual void OnHeader(base::StringPiece key, base::StringPiece value) = 0; | 26 virtual void OnHeader(base::StringPiece key, base::StringPiece value) = 0; |
25 | 27 |
26 // A callback method which notifies when the parser finishes handling a | 28 // A callback method which notifies when the parser finishes handling a |
27 // header block fragment. Also indicates the total number of bytes in this | 29 // header block fragment. Also indicates the total number of bytes in this |
28 // block. | 30 // block. |
29 virtual void OnHeaderBlockEnd(size_t header_bytes_parsed) = 0; | 31 virtual void OnHeaderBlockEnd(size_t header_bytes_parsed) = 0; |
30 }; | 32 }; |
31 | 33 |
32 } // namespace net | 34 } // namespace net |
33 | 35 |
34 #endif // NET_SPDY_SPDY_HEADERS_HANDLER_INTERFACE_H_ | 36 #endif // NET_SPDY_SPDY_HEADERS_HANDLER_INTERFACE_H_ |
OLD | NEW |