• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_
6 #define NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_
7 #pragma once
8 
9 #include <string>
10 #include <vector>
11 
12 #include "base/basictypes.h"
13 #include "base/string16.h"
14 #include "base/time.h"
15 
16 namespace net {
17 
18 struct FtpDirectoryListingEntry {
19   enum Type {
20     FILE,
21     DIRECTORY,
22     SYMLINK,
23   };
24 
25   FtpDirectoryListingEntry();
26 
27   Type type;
28   string16 name;  // Name (UTF-16-encoded).
29   std::string raw_name;  // Name in original character encoding.
30   int64 size;  // File size, in bytes. -1 if not applicable.
31 
32   // Last modified time, in local time zone.
33   base::Time last_modified;
34 };
35 
36 // Parses an FTP directory listing |text|. On success fills in |entries|.
37 // Returns network error code.
38 int ParseFtpDirectoryListing(const std::string& text,
39                              const base::Time& current_time,
40                              std::vector<FtpDirectoryListingEntry>* entries);
41 
42 }  // namespace net
43 
44 #endif  // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_H_
45