OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ | 5 #ifndef NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ |
6 #define NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ | 6 #define NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 10 matching lines...) Expand all Loading... |
21 FtpCtrlResponse(); | 21 FtpCtrlResponse(); |
22 FtpCtrlResponse(const FtpCtrlResponse& other); | 22 FtpCtrlResponse(const FtpCtrlResponse& other); |
23 ~FtpCtrlResponse(); | 23 ~FtpCtrlResponse(); |
24 | 24 |
25 int status_code; // Three-digit status code. | 25 int status_code; // Three-digit status code. |
26 std::vector<std::string> lines; // Response lines, without CRLFs. | 26 std::vector<std::string> lines; // Response lines, without CRLFs. |
27 }; | 27 }; |
28 | 28 |
29 class NET_EXPORT_PRIVATE FtpCtrlResponseBuffer { | 29 class NET_EXPORT_PRIVATE FtpCtrlResponseBuffer { |
30 public: | 30 public: |
31 FtpCtrlResponseBuffer(const BoundNetLog& net_log); | 31 FtpCtrlResponseBuffer(const NetLogWithSource& net_log); |
32 ~FtpCtrlResponseBuffer(); | 32 ~FtpCtrlResponseBuffer(); |
33 | 33 |
34 // Called when data is received from the control socket. Returns error code. | 34 // Called when data is received from the control socket. Returns error code. |
35 int ConsumeData(const char* data, int data_length); | 35 int ConsumeData(const char* data, int data_length); |
36 | 36 |
37 bool ResponseAvailable() const { | 37 bool ResponseAvailable() const { |
38 return !responses_.empty(); | 38 return !responses_.empty(); |
39 } | 39 } |
40 | 40 |
41 // Returns the next response. It is an error to call this function | 41 // Returns the next response. It is an error to call this function |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // will have a continuation. So always store last line of multiline response | 85 // will have a continuation. So always store last line of multiline response |
86 // so we can append the continuation to it. | 86 // so we can append the continuation to it. |
87 std::string line_buf_; | 87 std::string line_buf_; |
88 | 88 |
89 // Keep the response data while we add all lines to it. | 89 // Keep the response data while we add all lines to it. |
90 FtpCtrlResponse response_buf_; | 90 FtpCtrlResponse response_buf_; |
91 | 91 |
92 // As we read full responses (possibly multiline), we add them to the queue. | 92 // As we read full responses (possibly multiline), we add them to the queue. |
93 std::queue<FtpCtrlResponse> responses_; | 93 std::queue<FtpCtrlResponse> responses_; |
94 | 94 |
95 BoundNetLog net_log_; | 95 NetLogWithSource net_log_; |
96 | 96 |
97 DISALLOW_COPY_AND_ASSIGN(FtpCtrlResponseBuffer); | 97 DISALLOW_COPY_AND_ASSIGN(FtpCtrlResponseBuffer); |
98 }; | 98 }; |
99 | 99 |
100 } // namespace net | 100 } // namespace net |
101 | 101 |
102 #endif // NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ | 102 #endif // NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ |
OLD | NEW |