libdar.hpp

Go to the documentation of this file.
00001 //*********************************************************************/
00002 // dar - disk archive - a backup/restoration program
00003 // Copyright (C) 2002-2052 Denis Corbin
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 //
00019 // to contact the author : dar.linux@free.fr
00020 /*********************************************************************/
00021 // $Id: libdar.hpp,v 1.53.2.14 2010/04/09 16:10:09 edrusb Rel $
00022 //
00023 /*********************************************************************/
00024 //
00025 
00028 
00036 
00045 
00046 
00047 #ifndef LIBDAR_HPP
00048 #define LIBDAR_HPP
00049 
00050 #include "../my_config.h"
00051 
00052 extern "C"
00053 {
00054 #if MUTEX_WORKS
00055 #if HAVE_PTHREAD_H
00056 #include <pthread.h>
00057 #endif
00058 #endif
00059 }
00060 
00061 
00062 #include <string>
00063 #include "compressor.hpp"
00064 #include "path.hpp"
00065 #include "mask.hpp"
00066 #include "integers.hpp"
00067 #include "infinint.hpp"
00068 #include "statistics.hpp"
00069 #include "user_interaction.hpp"
00070 #include "deci.hpp"
00071 #include "archive.hpp"
00072 #include "crypto.hpp"
00073 #include "thread_cancellation.hpp"
00074 
00077 
00079 #define LIBDAR_XXXXXXXX
00080 
00082 #define LIBDAR_NOEXCEPT 0
00083 
00084 #define LIBDAR_EMEMORY 1
00085 
00086 #define LIBDAR_EBUG 2
00087 
00088 #define LIBDAR_EINFININT 3
00089 
00090 #define LIBDAR_ELIMITINT 4
00091 
00092 #define LIBDAR_ERANGE 5
00093 
00094 #define LIBDAR_EDECI 6
00095 
00096 #define LIBDAR_EFEATURE 7
00097 
00098 #define LIBDAR_EHARDWARE 8
00099 
00100 #define LIBDAR_EUSER_ABORT 9
00101 
00102 #define LIBDAR_EDATA 10
00103 
00104 #define LIBDAR_ESCRIPT 11
00105 
00106 #define LIBDAR_ELIBCALL 12
00107 
00108 #define LIBDAR_UNKNOWN 13
00109 
00110 #define LIBDAR_ECOMPILATION 14
00111 
00112 #define LIBDAR_THREAD_CANCEL 15
00113 
00114 
00116 namespace libdar
00117 {
00120 
00121 
00123     const U_I LIBDAR_COMPILE_TIME_MAJOR = 4;
00125     const U_I LIBDAR_COMPILE_TIME_MEDIUM = 4;
00127     const U_I LIBDAR_COMPILE_TIME_MINOR = 5;
00128 
00130         // LIBDAR INITIALIZATION METHODS                                      //
00131         //                                                                    //
00132         //      A FUNCTION OF THE get_version*() FAMILY *MUST* BE CALLED      //
00133         //            BEFORE ANY OTHER FUNCTION OF THIS LIBRARY               //
00134         //                                                                    //
00135         // CLIENT PROGRAM MUST CHECK THAT THE MAJOR NUMBER RETURNED           //
00136         // BY THIS CALL IS NOT GREATER THAN THE VERSION USED AT COMPILATION   //
00137         // TIME. IF SO, THE PROGRAM MUST ABORT AND RETURN A WARNING TO THE    //
00138         // USER TELLING THE DYNAMICALLY LINKED VERSION IS TOO RECENT AND NOT  //
00139         // COMPATIBLE WITH THIS SOFTWARE. THE MESSAGE MUST INVITE THE USER    //
00140         // TO UPGRADE HIS SOFTWARE WITH A MORE RECENT VERSION COMPATIBLE WITH //
00141         // THIS LIBDAR RELEASE.                                               //
00143 
00144     extern void get_version(U_I & major, U_I & minor);
00145     extern void get_version_noexcept(U_I & major, U_I & minor, U_16 & exception, std::string & except_msg);
00146 
00148 
00156     extern void get_version(U_I & major, U_I & medium, U_I & minor);
00157 
00159 
00170     extern void get_version_noexcept(U_I & major, U_I & medium, U_I & minor, U_16 & exception, std::string & except_msg);
00171 
00172 
00174 
00187     extern void get_compile_time_features(bool & ea, bool & largefile, bool & nodump, bool & special_alloc, U_I & bits,
00188                                           bool & thread_safe,
00189                                           bool & libz, bool & libbz2, bool & libcrypto,
00190                                           bool & new_blowfish);
00191 
00193         // WRAPPER FUNCTIONS AROUND archive class methods to trap exceptions and convert them in error code and message
00194         // these are intended for C program/programmers not enough confident with C++.
00195         //
00196         // FOR LIBDAR C++ APPLICATIONS, YOU WOULD RATHER USE THE archive C++ CLASS THAN THESE FOLLOWING WRAPPERS
00197         //
00199 
00200 
00202 
00206     extern archive* open_archive_noexcept(user_interaction & dialog,
00207                                           const path & chem, const std::string & basename,
00208                                           const std::string & extension,
00209                                           crypto_algo crypto, const std::string &pass, U_32 crypto_size,
00210                                           const std::string & input_pipe, const std::string & output_pipe,
00211                                           const std::string & execute, bool info_details,
00212                                           U_16 & exception,
00213                                           std::string & except_msg);
00214 
00215 
00217 
00221     extern archive *create_archive_noexcept(user_interaction & dialog,
00222                                             const path & fs_root,
00223                                             const path & sauv_path,
00224                                             archive *ref_arch,
00225                                             const mask & selection,
00226                                             const mask & subtree,
00227                                             const std::string & filename,
00228                                             const std::string & extension,
00229                                             bool allow_over,
00230                                             bool warn_over,
00231                                             bool info_details,
00232                                             const infinint & pause,
00233                                             bool empty_dir,
00234                                             compression algo,
00235                                             U_I compression_level,
00236                                             const infinint &file_size,
00237                                             const infinint &first_file_size,
00238                                             const mask & ea_mask,
00239                                             const std::string & execute,
00240                                             crypto_algo crypto,
00241                                             const std::string & pass,
00242                                             U_32 crypto_size,
00243                                             const mask & compr_mask,
00244                                             const infinint & min_compr_size,
00245                                             bool nodump,
00246                                             inode::comparison_fields what_to_check,
00247                                             const infinint & hourshift,
00248                                             bool empty,
00249                                             bool alter_atime,
00250                                             bool same_fs,
00251                                             bool snapshot,
00252                                             bool cache_directory_tagging,
00253                                             bool display_skipped,
00254                                             const infinint & fixed_date,
00255                                             statistics * progressive_report,
00256                                             U_16 & exception,
00257                                             std::string & except_msg);
00258 
00259 
00261 
00265     extern archive *isolate_archive_noexcept(user_interaction & dialog,
00266                                              const path &sauv_path,
00267                                              archive *ref_arch,
00268                                              const std::string & filename,
00269                                              const std::string & extension,
00270                                              bool allow_over,
00271                                              bool warn_over,
00272                                              bool info_details,
00273                                              const infinint & pause,
00274                                              compression algo,
00275                                              U_I compression_level,
00276                                              const infinint &file_size,
00277                                              const infinint &first_file_size,
00278                                              const std::string & execute,
00279                                              crypto_algo crypto,
00280                                              const std::string & pass,
00281                                              U_32 crypto_size,
00282                                              bool empty,
00283                                              U_16 & exception,
00284                                              std::string & except_msg);
00285 
00287 
00291     extern archive *merge_archive_noexcept(user_interaction & dialog,
00292                                            const path & sauv_path,
00293                                            archive *ref_arch1,
00294                                            archive *ref_arch2,
00295                                            const mask & selection,
00296                                            const mask & subtree,
00297                                            const std::string & filename,
00298                                            const std::string & extension,
00299                                            bool allow_over,
00300                                            bool warn_over,
00301                                            bool info_details,
00302                                            const infinint & pause,
00303                                            bool empty_dir,
00304                                            compression algo,
00305                                            U_I compression_level,
00306                                            const infinint & file_size,
00307                                            const infinint & first_file_size,
00308                                            const mask & ea_mask,
00309                                            const std::string & execute,
00310                                            crypto_algo crypto,
00311                                            const std::string & pass,
00312                                            U_32 crypto_size,
00313                                            const mask & compr_mask,
00314                                            const infinint & min_compr_size,
00315                                            bool empty,
00316                                            bool display_skipped,
00317                                            bool keep_compressed,
00318                                            statistics * progressive_report,
00319                                            U_16 & exception,
00320                                            std::string & except_msg);
00321 
00322 
00324 
00328     extern void close_archive_noexcept(archive *ptr,
00329                                        U_16 & exception,
00330                                        std::string & except_msg);
00331 
00332 
00334 
00338     extern statistics op_extract_noexcept(user_interaction & dialog,
00339                                           archive *ptr,
00340                                           const path &fs_root,
00341                                           const mask &selection,
00342                                           const mask &subtree,
00343                                           bool allow_over,
00344                                           bool warn_over,
00345                                           bool info_details,
00346                                           bool detruire,
00347                                           bool only_more_recent,
00348                                           const mask & ea_mask,
00349                                           bool flat,
00350                                           inode::comparison_fields what_to_check,
00351                                           bool warn_remove_no_match,
00352                                           const infinint & hourshift,
00353                                           bool empty,
00354                                           bool ea_erase,
00355                                           bool display_skipped,
00356                                           statistics * progressive_report,
00357                                           U_16 & exception,
00358                                           std::string & except_msg);
00359 
00360 
00362 
00366     extern void op_listing_noexcept(user_interaction & dialog,
00367                                     archive *ptr,
00368                                     bool info_details,
00369                                     archive::listformat list_mode,
00370                                     const mask &selection,
00371                                     bool filter_unsaved,
00372                                     U_16 & exception,
00373                                     std::string & except_msg);
00374 
00375 
00377 
00381     extern statistics op_diff_noexcept(user_interaction & dialog,
00382                                        archive *ptr,
00383                                        const path & fs_root,
00384                                        const mask &selection,
00385                                        const mask &subtree,
00386                                        bool info_details,
00387                                        const mask & ea_mask,
00388                                        inode::comparison_fields what_to_check,
00389                                        bool alter_atime,
00390                                        bool display_skipped,
00391                                        statistics * progressive_report,
00392                                        U_16 & exception,
00393                                        std::string & except_msg);
00394 
00395 
00397 
00401     extern statistics op_test_noexcept(user_interaction & dialog,
00402                                        archive *ptr,
00403                                        const mask &selection,
00404                                        const mask &subtree,
00405                                        bool info_details,
00406                                        bool display_skipped,
00407                                        statistics * progressive_report,
00408                                        U_16 & exception,
00409                                        std::string & except_msg);
00410 
00411 
00413 
00417     extern bool get_children_of_noexcept(user_interaction & dialog,
00418                                          archive *ptr,
00419                                          const std::string & dir,
00420                                          U_16 & exception,
00421                                          std::string & except_msg);
00422 
00423 
00424 
00426         // TOOLS ROUTINES                            //
00428 
00429 
00431 
00441     extern char *libdar_str2charptr_noexcept(const std::string & x, U_16 & exception, std::string & except_msg);
00442 
00444         // THREAD CANCELLATION ROUTINES              //
00446 
00447 #if MUTEX_WORKS
00448 
00449 
00455     inline extern void cancel_thread(pthread_t tid, bool immediate = true, U_64 flag = 0) { thread_cancellation::cancel(tid, immediate, flag); }
00456 
00458 
00461     inline extern bool cancel_status(pthread_t tid) { return thread_cancellation::cancel_status(tid); }
00462 
00464 
00468     inline extern bool cancel_clear(pthread_t tid) { return thread_cancellation::clear_pending_request(tid); }
00469 #endif
00470 
00472 
00473 } // end of namespace
00474 
00475 #endif
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines
Generated on Wed Apr 14 22:12:21 2010 for Disk ARchive by  doxygen 1.6.3