OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ |
6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ | 6 #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "extensions/common/api/cast_channel.h" | 15 #include "components/cast_channel/cast_channel_enum.h" |
16 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 namespace api { | 19 namespace api { |
20 namespace cast_channel { | 20 namespace cast_channel { |
21 class CastMessage; | 21 class CastMessage; |
22 | 22 |
23 // Class for constructing and parsing CastMessage packet data. | 23 // Class for constructing and parsing CastMessage packet data. |
24 class MessageFramer { | 24 class MessageFramer { |
25 public: | 25 public: |
| 26 using ChannelError = ::cast_channel::ChannelError; |
| 27 |
26 // |input_buffer|: The input buffer used by all socket read operations that | 28 // |input_buffer|: The input buffer used by all socket read operations that |
27 // feed data into the framer. | 29 // feed data into the framer. |
28 explicit MessageFramer(scoped_refptr<net::GrowableIOBuffer> input_buffer); | 30 explicit MessageFramer(scoped_refptr<net::GrowableIOBuffer> input_buffer); |
29 ~MessageFramer(); | 31 ~MessageFramer(); |
30 | 32 |
31 // The number of bytes required from |input_buffer| to complete the | 33 // The number of bytes required from |input_buffer| to complete the |
32 // CastMessage being read. | 34 // CastMessage being read. |
33 // Returns zero if |error_| is true (framer is in an invalid state.) | 35 // Returns zero if |error_| is true (framer is in an invalid state.) |
34 size_t BytesRequested(); | 36 size_t BytesRequested(); |
35 | 37 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 96 |
95 // Disables Ingest functionality is the parser receives invalid data. | 97 // Disables Ingest functionality is the parser receives invalid data. |
96 bool error_; | 98 bool error_; |
97 | 99 |
98 DISALLOW_COPY_AND_ASSIGN(MessageFramer); | 100 DISALLOW_COPY_AND_ASSIGN(MessageFramer); |
99 }; | 101 }; |
100 } // namespace cast_channel | 102 } // namespace cast_channel |
101 } // namespace api | 103 } // namespace api |
102 } // namespace extensions | 104 } // namespace extensions |
103 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ | 105 #endif // EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_FRAMER_H_ |
OLD | NEW |