OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 REMOTING_PROTOCOL_MESSAGES_DECODER_H_ | 5 #ifndef REMOTING_PROTOCOL_MESSAGES_DECODER_H_ |
6 #define REMOTING_PROTOCOL_MESSAGES_DECODER_H_ | 6 #define REMOTING_PROTOCOL_MESSAGES_DECODER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <list> | 9 #include <list> |
10 | 10 |
11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
13 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
14 #include "remoting/base/compound_buffer.h" | 14 #include "remoting/base/compound_buffer.h" |
15 #include "third_party/protobuf/src/google/protobuf/message_lite.h" | 15 #include "third_party/protobuf/src/google/protobuf/message_lite.h" |
16 | 16 |
17 namespace remoting { | 17 namespace remoting { |
| 18 namespace protocol { |
18 | 19 |
19 // MessageDecoder uses CompoundBuffer to decode bytes into protocol | 20 // MessageDecoder uses CompoundBuffer to decode bytes into protocol |
20 // buffer messages. This can be used to decode bytes received from the | 21 // buffer messages. This can be used to decode bytes received from the |
21 // network. | 22 // network. |
22 // | 23 // |
23 // It provides ParseMessages() which accepts an IOBuffer. If enough bytes | 24 // It provides ParseMessages() which accepts an IOBuffer. If enough bytes |
24 // are collected to produce protocol buffer messages then the bytes will be | 25 // are collected to produce protocol buffer messages then the bytes will be |
25 // consumed and the generated protocol buffer messages are added to the output | 26 // consumed and the generated protocol buffer messages are added to the output |
26 // list. | 27 // list. |
27 // | 28 // |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 81 |
81 CompoundBuffer buffer_; | 82 CompoundBuffer buffer_; |
82 | 83 |
83 // |next_payload_| stores the size of the next payload if known. | 84 // |next_payload_| stores the size of the next payload if known. |
84 // |next_payload_known_| is true if the size of the next payload is known. | 85 // |next_payload_known_| is true if the size of the next payload is known. |
85 // After one payload is read this is reset to false. | 86 // After one payload is read this is reset to false. |
86 int next_payload_; | 87 int next_payload_; |
87 bool next_payload_known_; | 88 bool next_payload_known_; |
88 }; | 89 }; |
89 | 90 |
| 91 } // namespace protocol |
90 } // namespace remoting | 92 } // namespace remoting |
91 | 93 |
92 #endif // REMOTING_PROTOCOL_MESSAGES_DECODER_H_ | 94 #endif // REMOTING_PROTOCOL_MESSAGES_DECODER_H_ |
OLD | NEW |