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 | 5 |
6 #ifndef NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ | 6 #ifndef NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ |
7 #define NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ | 7 #define NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ |
8 #pragma once | 8 #pragma once |
9 | 9 |
10 #include <queue> | 10 #include <queue> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "net/base/net_api.h" | 15 #include "net/base/net_export.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 struct NET_TEST FtpCtrlResponse { | 19 struct NET_EXPORT_PRIVATE FtpCtrlResponse { |
20 static const int kInvalidStatusCode; | 20 static const int kInvalidStatusCode; |
21 | 21 |
22 FtpCtrlResponse(); | 22 FtpCtrlResponse(); |
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_TEST FtpCtrlResponseBuffer { | 29 class NET_EXPORT_PRIVATE FtpCtrlResponseBuffer { |
30 public: | 30 public: |
31 FtpCtrlResponseBuffer(); | 31 FtpCtrlResponseBuffer(); |
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 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 // As we read full responses (possibly multiline), we add them to the queue. | 91 // As we read full responses (possibly multiline), we add them to the queue. |
92 std::queue<FtpCtrlResponse> responses_; | 92 std::queue<FtpCtrlResponse> responses_; |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(FtpCtrlResponseBuffer); | 94 DISALLOW_COPY_AND_ASSIGN(FtpCtrlResponseBuffer); |
95 }; | 95 }; |
96 | 96 |
97 } // namespace net | 97 } // namespace net |
98 | 98 |
99 #endif // NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ | 99 #endif // NET_FTP_FTP_CTRL_RESPONSE_BUFFER_H_ |
OLD | NEW |