| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_CORE_SPDY_FRAMER_H_ | 5 #ifndef NET_SPDY_CORE_SPDY_FRAMER_H_ |
| 6 #define NET_SPDY_CORE_SPDY_FRAMER_H_ | 6 #define NET_SPDY_CORE_SPDY_FRAMER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <cstdint> | 10 #include <cstdint> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // of SpdyHeadersHandlerInterface that will receive the header key-value | 62 // of SpdyHeadersHandlerInterface that will receive the header key-value |
| 63 // pairs. | 63 // pairs. |
| 64 // 3. OnHeaderFrameEnd is called, indicating that the full header block has | 64 // 3. OnHeaderFrameEnd is called, indicating that the full header block has |
| 65 // been delivered for the control frame. | 65 // been delivered for the control frame. |
| 66 // During step 2, if the visitor is not interested in accepting the header data, | 66 // During step 2, if the visitor is not interested in accepting the header data, |
| 67 // it should return a no-op implementation of SpdyHeadersHandlerInterface. | 67 // it should return a no-op implementation of SpdyHeadersHandlerInterface. |
| 68 class SPDY_EXPORT_PRIVATE SpdyFramerVisitorInterface { | 68 class SPDY_EXPORT_PRIVATE SpdyFramerVisitorInterface { |
| 69 public: | 69 public: |
| 70 virtual ~SpdyFramerVisitorInterface() {} | 70 virtual ~SpdyFramerVisitorInterface() {} |
| 71 | 71 |
| 72 // Called if an error is detected in the SpdySerializedFrame protocol. | 72 // Called if an error is detected in the SpdyFrame protocol. |
| 73 virtual void OnError(SpdyFramer* framer) = 0; | 73 virtual void OnError(SpdyFramer* framer) = 0; |
| 74 | 74 |
| 75 // Called when the common header for a frame is received. Validating the | 75 // Called when the common header for a frame is received. Validating the |
| 76 // common header occurs in later processing. | 76 // common header occurs in later processing. |
| 77 virtual void OnCommonHeader(SpdyStreamId stream_id, | 77 virtual void OnCommonHeader(SpdyStreamId stream_id, |
| 78 size_t length, | 78 size_t length, |
| 79 uint8_t type, | 79 uint8_t type, |
| 80 uint8_t flags) {} | 80 uint8_t flags) {} |
| 81 | 81 |
| 82 // Called when a data frame header is received. The frame's data | 82 // Called when a data frame header is received. The frame's data |
| 83 // payload will be provided via subsequent calls to | 83 // payload will be provided via subsequent calls to |
| 84 // OnStreamFrameData(). | 84 // OnStreamFrameData(). |
| 85 virtual void OnDataFrameHeader(SpdyStreamId stream_id, | 85 virtual void OnDataFrameHeader(SpdyStreamId stream_id, |
| 86 size_t length, | 86 size_t length, |
| 87 bool fin) = 0; | 87 bool fin) = 0; |
| 88 | 88 |
| 89 // Called when data is received. | 89 // Called when data is received. |
| 90 // |stream_id| The stream receiving data. | 90 // |stream_id| The stream receiving data. |
| 91 // |data| A buffer containing the data received. | 91 // |data| A buffer containing the data received. |
| 92 // |len| The length of the data buffer. | 92 // |len| The length of the data buffer. |
| 93 virtual void OnStreamFrameData(SpdyStreamId stream_id, | 93 virtual void OnStreamFrameData(SpdyStreamId stream_id, |
| 94 const char* data, | 94 const char* data, |
| 95 size_t len) = 0; | 95 size_t len) = 0; |
| 96 | 96 |
| 97 // Called when the other side has finished sending data on this stream. | 97 // Called when the other side has finished sending data on this stream. |
| 98 // |stream_id| The stream that was receivin data. | 98 // |stream_id| The stream that was receiving data. |
| 99 virtual void OnStreamEnd(SpdyStreamId stream_id) = 0; | 99 virtual void OnStreamEnd(SpdyStreamId stream_id) = 0; |
| 100 | 100 |
| 101 // Called when padding is received (padding length field or padding octets). | 101 // Called when padding is received (padding length field or padding octets). |
| 102 // |stream_id| The stream receiving data. | 102 // |stream_id| The stream receiving data. |
| 103 // |len| The number of padding octets. | 103 // |len| The number of padding octets. |
| 104 virtual void OnStreamPadding(SpdyStreamId stream_id, size_t len) = 0; | 104 virtual void OnStreamPadding(SpdyStreamId stream_id, size_t len) = 0; |
| 105 | 105 |
| 106 // Called just before processing the payload of a frame containing header | 106 // Called just before processing the payload of a frame containing header |
| 107 // data. Should return an implementation of SpdyHeadersHandlerInterface that | 107 // data. Should return an implementation of SpdyHeadersHandlerInterface that |
| 108 // will receive headers for stream |stream_id|. The caller will not take | 108 // will receive headers for stream |stream_id|. The caller will not take |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 // pass the last frame info in the arguments. | 988 // pass the last frame info in the arguments. |
| 989 bool overwrite_last_frame_ = false; | 989 bool overwrite_last_frame_ = false; |
| 990 // If the current frame to be serialized is the last frame. Will be valid iff | 990 // If the current frame to be serialized is the last frame. Will be valid iff |
| 991 // overwrite_last_frame_ is true. | 991 // overwrite_last_frame_ is true. |
| 992 bool is_last_frame_ = false; | 992 bool is_last_frame_ = false; |
| 993 }; | 993 }; |
| 994 | 994 |
| 995 } // namespace net | 995 } // namespace net |
| 996 | 996 |
| 997 #endif // NET_SPDY_CORE_SPDY_FRAMER_H_ | 997 #endif // NET_SPDY_CORE_SPDY_FRAMER_H_ |
| OLD | NEW |