ftp.h

Go to the documentation of this file.
00001 #ifndef ftp_header_included
00002 #define ftp_header_included
00003 
00004 
00005 //
00006 // Copyright 2002, Lowell Boggs Jr.
00007 //
00008 // This file or directory, containing source code for a computer program,
00009 // is Copyrighted by Lowell Boggs, Jr.  987 Regency Drive, Lewisville
00010 // TX (USA), 75067.  You may use, copy, modify, and distribute this
00011 // source file without charge or obligation so long as you agree to
00012 // the following:
00013 //
00014 //  1.  You must indemnify Lowell Boggs against any and all financial
00015 //      obligations caused by its use, misuse, function, or malfunction.
00016 //      Further, you acknowledge that there is no warranty of any kind,
00017 //      whatsoever.
00018 //
00019 //  2.  You agree not to attempt to patent any portion of this original
00020 //      work -- though you may attempt to patent your own extensions to
00021 //      it if you so choose.
00022 //
00023 //  3.  You keep this copyright notice with the file and all copies
00024 //      of the file and do not change it anyway except language translation.
00025 //
00026 // You are responsible for enforcing your own compliance with these
00027 // conditions and may not use this source file if you cannot agree to the
00028 // above terms and conditions.
00029 
00030 
00033 
00034 #include <cxxtls/file.h>
00035 
00036 namespace cxxtls
00037 {
00038 
00039 class FTP
00045 {
00046 public:
00047 
00048     typedef std::string string;
00049 
00050     enum constants
00051     {
00052        max_ftp_line_length=2048    
00053     };
00054 
00055 
00056     static string error();
00058 
00059 
00060     static bool parse_ftp_dir_text(char const*  buffer,
00061                                    FileStatus*  statbuf,
00062                                    FileName*    filename
00063                                   );
00076         
00077         
00078     struct FileInfo
00081     {
00082         FileName    name_;
00083         FileStatus  status_;
00084         
00085         FileInfo(FileName const &name, FileStatus const& status)
00086         : name_(name),
00087           status_(status)
00088         {
00090         }
00091         
00092         FileInfo()
00093         {
00094         }
00095         
00096         
00097     };
00098 
00099 
00100     static int stat_matching(char const *host,
00101                              char const *user,
00102                              char const *password,
00103                              char const *pattern,
00104                              std::list<FileInfo> *output);
00119 
00120     static int stat_matching(string          host,
00121                              string          user,
00122                              string          password,
00123                              string          pattern,
00124                              std::list<FileInfo>* l)
00139     {
00140       return stat_matching(host.c_str(),
00141                            user.c_str(),
00142                            password.c_str(),
00143                            pattern.c_str(),
00144                            l
00145                           );
00146     }
00147 
00148 
00149     static bool get(string   host,
00150                     string   user,
00151                     string   password,
00152                     FileName pathname,
00153                     string   to_file=""
00154                    );
00165 
00166     static bool put(string   host,
00167                     string   user,
00168                     string   password,
00169                     FileName pathname,
00170                     string   from_file=""
00171                    );
00183 
00184     static bool del(string   host,
00185                     string   user,
00186                     string   password,
00187                     FileName pathname
00188                    );
00189 
00196 
00197 };
00198 } // namespace cxxtls
00199 #endif
Generated on Wed Feb 29 22:50:04 2012 for CXXUtilities by  doxygen 1.6.3