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.3 2007/02/24 17:43:02 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
00084 #define LIBDAR_EMEMORY 1
00086 #define LIBDAR_EBUG 2
00088 #define LIBDAR_EINFININT 3
00090 #define LIBDAR_ELIMITINT 4
00092 #define LIBDAR_ERANGE 5
00094 #define LIBDAR_EDECI 6
00096 #define LIBDAR_EFEATURE 7
00098 #define LIBDAR_EHARDWARE 8
00100 #define LIBDAR_EUSER_ABORT 9
00102 #define LIBDAR_EDATA 10
00104 #define LIBDAR_ESCRIPT 11
00106 #define LIBDAR_ELIBCALL 12
00108 #define LIBDAR_UNKNOWN 13
00110 #define LIBDAR_ECOMPILATION 14
00112 #define LIBDAR_THREAD_CANCEL 15
00114 
00116 namespace libdar
00117 {
00120 
00121 
00123     const U_I LIBDAR_COMPILE_TIME_MAJOR = 4;
00125     const U_I LIBDAR_COMPILE_TIME_MEDIUM = 1;
00127     const U_I LIBDAR_COMPILE_TIME_MINOR = 0;
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 
00186     extern void get_compile_time_features(bool & ea, bool & largefile, bool & nodump, bool & special_alloc, U_I & bits, bool & thread_safe,
00187                                           bool & libz, bool & libbz2, bool & libcrypto);
00188 
00190         // WRAPPER FUNCTIONS AROUND archive class methods to trap exceptions and convert them in error code and message
00191         // theses are intended for C program/programmers not enough confident with C++.
00192         //
00193         // FOR LIBDAR C++ APPLICATIONS, YOU WOULD RATHER USE THE archive C++ CLASS THAN THESES FOLLOWING WRAPPERS
00194         //
00196 
00197 
00199 
00203     extern archive* open_archive_noexcept(user_interaction & dialog,
00204                                           const path & chem, const std::string & basename,
00205                                           const std::string & extension,
00206                                           crypto_algo crypto, const std::string &pass, U_32 crypto_size,
00207                                           const std::string & input_pipe, const std::string & output_pipe,
00208                                           const std::string & execute, bool info_details,
00209                                           U_16 & exception,
00210                                           std::string & except_msg);
00211 
00212 
00214 
00218     extern archive *create_archive_noexcept(user_interaction & dialog,
00219                                             const path & fs_root,
00220                                             const path & sauv_path,
00221                                             archive *ref_arch,
00222                                             const mask & selection,
00223                                             const mask & subtree,
00224                                             const std::string & filename,
00225                                             const std::string & extension,
00226                                             bool allow_over,
00227                                             bool warn_over,
00228                                             bool info_details,
00229                                             const infinint & pause,
00230                                             bool empty_dir,
00231                                             compression algo,
00232                                             U_I compression_level,
00233                                             const infinint &file_size,
00234                                             const infinint &first_file_size,
00235                                             const mask & ea_mask,
00236                                             const std::string & execute,
00237                                             crypto_algo crypto,
00238                                             const std::string & pass,
00239                                             U_32 crypto_size,
00240                                             const mask & compr_mask,
00241                                             const infinint & min_compr_size,
00242                                             bool nodump,
00243                                             inode::comparison_fields what_to_check,
00244                                             const infinint & hourshift,
00245                                             bool empty,
00246                                             bool alter_atime,
00247                                             bool same_fs,
00248                                             bool snapshot,
00249                                             bool cache_directory_tagging,
00250                                             bool display_skipped,
00251                                             const infinint & fixed_date,
00252                                             statistics * progressive_report,
00253                                             U_16 & exception,
00254                                             std::string & except_msg);
00255 
00256 
00258 
00262     extern archive *isolate_archive_noexcept(user_interaction & dialog,
00263                                              const path &sauv_path,
00264                                              archive *ref_arch,
00265                                              const std::string & filename,
00266                                              const std::string & extension,
00267                                              bool allow_over,
00268                                              bool warn_over,
00269                                              bool info_details,
00270                                              const infinint & pause,
00271                                              compression algo,
00272                                              U_I compression_level,
00273                                              const infinint &file_size,
00274                                              const infinint &first_file_size,
00275                                              const std::string & execute,
00276                                              crypto_algo crypto,
00277                                              const std::string & pass,
00278                                              U_32 crypto_size,
00279                                              bool empty,
00280                                              U_16 & exception,
00281                                              std::string & except_msg);
00282 
00284 
00288     extern archive *merge_archive_noexcept(user_interaction & dialog,
00289                                            const path & sauv_path,
00290                                            archive *ref_arch1,
00291                                            archive *ref_arch2,
00292                                            const mask & selection,
00293                                            const mask & subtree,
00294                                            const std::string & filename,
00295                                            const std::string & extension,
00296                                            bool allow_over,
00297                                            bool warn_over,
00298                                            bool info_details,
00299                                            const infinint & pause,
00300                                            bool empty_dir,
00301                                            compression algo,
00302                                            U_I compression_level,
00303                                            const infinint & file_size,
00304                                            const infinint & first_file_size,
00305                                            const mask & ea_mask,
00306                                            const std::string & execute,
00307                                            crypto_algo crypto,
00308                                            const std::string & pass,
00309                                            U_32 crypto_size,
00310                                            const mask & compr_mask,
00311                                            const infinint & min_compr_size,
00312                                            bool empty,
00313                                            bool display_skipped,
00314                                            bool keep_compressed,
00315                                            statistics * progressive_report,
00316                                            U_16 & exception,
00317                                            std::string & except_msg);
00318 
00319 
00321 
00325     extern void close_archive_noexcept(archive *ptr,
00326                                        U_16 & exception,
00327                                        std::string & except_msg);
00328 
00329 
00331 
00335     extern statistics op_extract_noexcept(user_interaction & dialog,
00336                                           archive *ptr,
00337                                           const path &fs_root,
00338                                           const mask &selection,
00339                                           const mask &subtree,
00340                                           bool allow_over,
00341                                           bool warn_over,
00342                                           bool info_details,
00343                                           bool detruire,
00344                                           bool only_more_recent,
00345                                           const mask & ea_mask,
00346                                           bool flat,
00347                                           inode::comparison_fields what_to_check,
00348                                           bool warn_remove_no_match,
00349                                           const infinint & hourshift,
00350                                           bool empty,
00351                                           bool ea_erase,
00352                                           bool display_skipped,
00353                                           statistics * progressive_report,
00354                                           U_16 & exception,
00355                                           std::string & except_msg);
00356 
00357 
00359 
00363     extern void op_listing_noexcept(user_interaction & dialog,
00364                                     archive *ptr,
00365                                     bool info_details,
00366                                     archive::listformat list_mode,
00367                                     const mask &selection,
00368                                     bool filter_unsaved,
00369                                     U_16 & exception,
00370                                     std::string & except_msg);
00371 
00372 
00374 
00378     extern statistics op_diff_noexcept(user_interaction & dialog,
00379                                        archive *ptr,
00380                                        const path & fs_root,
00381                                        const mask &selection,
00382                                        const mask &subtree,
00383                                        bool info_details,
00384                                        const mask & ea_mask,
00385                                        inode::comparison_fields what_to_check,
00386                                        bool alter_atime,
00387                                        bool display_skipped,
00388                                        statistics * progressive_report,
00389                                        U_16 & exception,
00390                                        std::string & except_msg);
00391 
00392 
00394 
00398     extern statistics op_test_noexcept(user_interaction & dialog,
00399                                        archive *ptr,
00400                                        const mask &selection,
00401                                        const mask &subtree,
00402                                        bool info_details,
00403                                        bool display_skipped,
00404                                        statistics * progressive_report,
00405                                        U_16 & exception,
00406                                        std::string & except_msg);
00407 
00408 
00410 
00414     extern bool get_children_of_noexcept(user_interaction & dialog,
00415                                          archive *ptr,
00416                                          const std::string & dir,
00417                                          U_16 & exception,
00418                                          std::string & except_msg);
00419 
00420 
00421 
00423         // TOOLS ROUTINES                            //
00425 
00426 
00428 
00438     extern char *libdar_str2charptr_noexcept(const std::string & x, U_16 & exception, std::string & except_msg);
00439 
00441         // THREAD CANCELLATION ROUTINES              //
00443 
00444 #if MUTEX_WORKS
00446 
00450     inline extern void cancel_thread(pthread_t tid, bool immediate = true, U_64 flag = 0) { thread_cancellation::cancel(tid, immediate, flag); }
00451 
00453 
00456     inline extern bool cancel_status(pthread_t tid) { return thread_cancellation::cancel_status(tid); }
00457 
00459 
00463     inline extern bool cancel_clear(pthread_t tid) { return thread_cancellation::clear_pending_request(tid); }
00464 #endif
00465 
00467 
00468 } // end of namespace
00469 
00470 #endif

Generated on Wed Feb 28 02:41:07 2007 for Disk ARchive by  doxygen 1.5.1