libdarc.h File Reference
Principal library functions and constants. More...
#include "translations.h"
#include "mask.h"
#include "user_interaction.h"
#include "path.h"
#include "statistics.h"
#include "tools.h"
Go to the source code of this file.
Data Structures | |
struct | dar_sup_exception |
Container for exceptions that occur during operations. More... | |
struct | dar_sup_flags |
A collection of flags toogling various types of operations. More... | |
struct | dar_sup_libfeature |
Used to hold results when querying for available library features. More... | |
struct | dar_sup_libversion |
Used to assist runtime version verification during library initialization. More... | |
struct | dar_sup_spec |
A collection of options regarding archive location and contents. More... | |
struct | dar_sup_storage |
A collection of options regarding archive storage options. More... | |
Error status | |
Internally, libdar uses a family of exceptions for error handling.
The C++ library also has wrapper libraries that return numeric status codes representing caught exceptions. The libdarc binding makes use of these wrapper functions and passes the error codes directly. | |
#define | LIBDAR_XXXXXXXX |
The constants of this form represent various error values. | |
#define | LIBDAR_NOEXCEPT 0 |
Succesful operation. | |
#define | LIBDAR_EMEMORY 1 |
Memory has been exhausted. | |
#define | LIBDAR_EBUG 2 |
Internal bug error. | |
#define | LIBDAR_EINFININT 3 |
Division by zero or other arithmetic error. | |
#define | LIBDAR_ELIMITINT 4 |
Limitint overflow. | |
#define | LIBDAR_ERANGE 5 |
Range error. | |
#define | LIBDAR_EDECI 6 |
Decimal representation error. | |
#define | LIBDAR_EFEATURE 7 |
Feature not (yet) implemented. | |
#define | LIBDAR_EHARDWARE 8 |
Hardware failure. | |
#define | LIBDAR_EUSER_ABORT 9 |
User has aborted the operation. | |
#define | LIBDAR_EDATA 10 |
Data inconsistency or checksum error. | |
#define | LIBDAR_ESCRIPT 11 |
Inter-slice script failure. | |
#define | LIBDAR_ELIBCALL 12 |
Invalid library call (wrong arguments or related error). | |
#define | LIBDAR_UNKNOWN 13 |
Unknown error. | |
#define | LIBDAR_ECOMPILATION 14 |
Feature not activated at compilation time. | |
External error status | |
Applications that implement additional functionality that is closely related to the dar library may optionally use any of the following error status codes when applicable. | |
#define | LIBDAR_X_EINPUTSPEC 55 |
Input specification or configuration file is invalid. | |
Library initialization | |
Calling dar_op_library_init_macro is the easiest way to verify and initialize the library, but care must be taken to free the returned memory.
Initialization may be performed manually as well. | |
#define | DAR_LIBRARY_INIT_MACRO(ref) |
Convenience macro for library initialization. | |
DLLIMPORT void | dar_sup_libversion_destroy (dar_sup_libversion *ref) |
Frees any memory allocated for the members of the struct. | |
DLLIMPORT bool | dar_op_library_init (dar_sup_libversion *inout) |
Initializes library and performs version verification. | |
DLLIMPORT void | dar_sup_libfeature_destroy (dar_sup_libfeature *ref) |
Frees any memory allocated for the members of the struct. | |
DLLIMPORT void | dar_op_libfeature_query (dar_sup_libfeature *ref) |
Provides complete information regarding the compiled options of the backing dar library. | |
Enumerations | |
Libdar setting selection enumerations.
These are C style enums created to match the C++ enums defined in libdar. | |
enum | dar_compression_algorithm { dar_compression_none = 'n', dar_compression_zip = 'p', dar_compression_gzip = 'z', dar_compression_bzip2 = 'y' } |
Compression algorithms available. More... | |
enum | dar_encryption_algorithm { dar_crypto_none = 0, dar_crypto_scrambling = 1, dar_crypto_blowfish = 2 } |
Cypher algorithms available for data encryption. More... | |
Support structure helpers | |
Convenience functions for initialization and destruction of support structures. | |
DLLIMPORT bool | dar_sup_spec_defaults (dar_sup_spec *ref) |
Initializes a dar_sup_spec struct with default values. | |
DLLIMPORT void | dar_sup_spec_destroy (dar_sup_spec *ref) |
Frees any memory allocated for the members of the struct. | |
DLLIMPORT bool | dar_sup_storage_defaults (dar_sup_storage *ref) |
Initializes a dar_sup_storage struct with default values. | |
DLLIMPORT void | dar_sup_storage_destroy (dar_sup_storage *ref) |
Frees any memory allocated for the members of the struct. | |
DLLIMPORT void | dar_sup_flags_defaults (dar_sup_flags *ref) |
Initializes a dar_sup_flags struct with default values. | |
DLLIMPORT void | dar_sup_exception_destroy (dar_sup_exception *ref) |
Frees any memory allocated for the members of the struct. | |
Operations | |
Archive operation functions. | |
DLLIMPORT dar_archive * | dar_op_archive_create (dar_user_interaction_struct dialog, dar_archive *ref_archive, dar_sup_spec archive_options, dar_sup_storage format_options, dar_sup_flags option_flags, dar_statistics *operation_stats, dar_sup_exception *exception) |
Create a new archive. | |
DLLIMPORT bool | dar_op_archive_get_children_of (dar_user_interaction_struct dialog, dar_archive *archive, char *directory, dar_sup_exception *exception) |
Obtain a listing of any children of a given path of a file in an archive. | |
DLLIMPORT dar_archive * | dar_op_archive_isolate (dar_user_interaction_struct dialog, dar_archive *ref_archive, dar_sup_spec archive_options, dar_sup_storage format_options, dar_sup_flags option_flags, dar_sup_exception *exception) |
Isolates a catalog from a given archive and places it in a new empty archive. | |
DLLIMPORT bool | dar_op_archive_diff (dar_user_interaction_struct dialog, dar_archive *archive, dar_sup_spec archive_options, dar_sup_flags option_flags, dar_statistics *operation_stats, dar_sup_exception *exception) |
Compares an archive with the filesystem. | |
DLLIMPORT bool | dar_op_archive_extract (dar_user_interaction_struct dialog, dar_archive *archive, dar_sup_spec archive_options, dar_sup_storage format_options, dar_sup_flags option_flags, dar_statistics *operation_stats, dar_sup_exception *exception) |
Extracts data from an archive, restoring it onto the file system. | |
DLLIMPORT bool | dar_op_archive_list (dar_user_interaction_struct dialog, dar_archive *archive, dar_sup_spec archive_options, dar_sup_flags option_flags, dar_sup_exception *exception) |
Lists files in the archive according to a selection filter. | |
DLLIMPORT bool | dar_op_archive_test (dar_user_interaction_struct dialog, dar_archive *archive, dar_sup_spec archive_options, dar_statistics *operation_stats, dar_sup_exception *exception) |
Tests an archive's integrity. | |
DLLIMPORT bool | dar_op_archive_close (dar_archive *archive, dar_sup_exception *exception) |
Closes an open archive. | |
DLLIMPORT dar_archive * | dar_op_archive_open (dar_user_interaction_struct dialog, dar_sup_spec archive_options, dar_sup_storage format_options, dar_sup_exception *exception) |
Opens an archive, reading its catalog into memory. | |
Functions | |
DLLIMPORT void | dar_archive_destroy (dar_archive *ref) |
Frees memory used by dar_archive object. |
Detailed Description
Principal library functions and constants.
Definition in file libdarc.h.
Function Documentation
|
Closes an open archive. Field usage:
Field name Used ARCHIVE OPTIONS (dar_sup_spec) Root path Archive path Archive name Archive extension Input pipe Output pipe Selection mask Subtree mask FORMAT OPTIONS (dar_sup_storage) Compression algorithm Compression level Compression mask Compression min. size Encryption algorithm Encryption block size Encryption passphrase File size First file size Slice excecute command Hourshift OPTION FLAGS (dar_sup_flags) Allow overwrite Warn overwrite Slice pause Create empty stubs System EA User EA No dump Ignore owner Test run Alter atime Same file system Delete marked Restore flat Warn rem. non-matching Only restore more recent Tar format listing Filter unsaved
Definition at line 1029 of file libdarc.cpp. References LIBDAR_NOEXCEPT, and LIBDARC_EXCEPTION. |
|
Create a new archive.
The library will archive files from the given file system paths into one or more slice files. The slices, inserted in the indicated directory, will be named Field usage:
Field name Used ARCHIVE OPTIONS (dar_sup_spec) Root path X Archive path X Archive name X Archive extension X Input pipe Output pipe Selection mask X Subtree mask X FORMAT OPTIONS (dar_sup_storage) Compression algorithm X Compression level X Compression mask X Compression min. size X Encryption algorithm X Encryption block size X Encryption passphrase X File size X First file size X Slice excecute command X Hourshift X OPTION FLAGS (dar_sup_flags) Allow overwrite X Warn overwrite X Slice pause X Create empty stubs X System EA X User EA X No dump X Ignore owner X Test run X Alter atime X Same file system X Delete marked Restore flat Warn rem. non-matching Only restore more recent Tar format listing Filter unsaved
Definition at line 467 of file libdarc.cpp. References dar_sup_flags::allow_overwrite, dar_sup_flags::alter_atime, dar_sup_spec::arc_ext, dar_sup_spec::arc_name, dar_sup_spec::arc_path, dar_sup_storage::compress_algo, dar_sup_storage::compress_level, dar_sup_storage::compress_mask, dar_sup_storage::compress_min_size, dar_sup_flags::create_empty_stubs, dar_sup_storage::crypto_algo, dar_sup_storage::crypto_pass, dar_sup_storage::crypto_size, dar_user_interaction_struct_is_valid(), dar_sup_flags::ea_system, dar_sup_flags::ea_user, dar_sup_storage::file_size, dar_sup_storage::first_file_size, dar_sup_storage::hourshift, dar_sup_flags::ignore_owner, LIBDAR_ELIBCALL, LIBDAR_EMEMORY, LIBDAR_NOEXCEPT, LIBDARC_EXCEPTION, dar_sup_flags::no_dump, dar_sup_spec::root_path, dar_sup_flags::same_fs, dar_sup_spec::selection, dar_sup_storage::slice_execute, dar_sup_flags::slice_pause, dar_sup_spec::subtree, dar_sup_flags::test_run, dar_user_interaction_struct::verbose, and dar_sup_flags::warn_overwrite. |
|
Compares an archive with the filesystem. FIXME: (1) how are differences indicated in callbacks? (2) how exactly are statistics returned? Field usage:
Field name Used ARCHIVE OPTIONS (dar_sup_spec) Root path X Archive path Archive name Archive extension Input pipe Output pipe Selection mask X Subtree mask X FORMAT OPTIONS (dar_sup_storage) Compression algorithm Compression level Compression mask Compression min. size Encryption algorithm Encryption block size Encryption passphrase File size First file size Slice excecute command Hourshift OPTION FLAGS (dar_sup_flags) Allow overwrite Warn overwrite Slice pause Create empty stubs System EA X User EA X No dump Ignore owner X Test run Alter atime X Same file system Delete marked Restore flat Warn rem. non-matching Only restore more recent Tar format listing Filter unsaved
Definition at line 753 of file libdarc.cpp. References dar_sup_flags::alter_atime, dar_user_interaction_struct_is_valid(), dar_sup_flags::ea_system, dar_sup_flags::ea_user, dar_sup_flags::ignore_owner, LIBDAR_ELIBCALL, LIBDAR_NOEXCEPT, LIBDARC_EXCEPTION, dar_sup_spec::root_path, dar_sup_spec::selection, dar_sup_spec::subtree, and dar_user_interaction_struct::verbose. |
|
Extracts data from an archive, restoring it onto the file system. Field usage:
Field name Used ARCHIVE OPTIONS (dar_sup_spec) Root path X Archive path Archive name Archive extension Input pipe Output pipe Selection mask X Subtree mask X FORMAT OPTIONS (dar_sup_storage) Compression algorithm Compression level Compression mask Compression min. size Encryption algorithm Encryption block size Encryption passphrase File size First file size Slice excecute command Hourshift X OPTION FLAGS (dar_sup_flags) Allow overwrite X Warn overwrite X Slice pause Create empty stubs System EA X User EA X No dump Ignore owner Test run X Alter atime Same file system Delete marked X Restore flat X Warn rem. non-matching X Only restore more recent X Tar format listing Filter unsaved
Definition at line 828 of file libdarc.cpp. References dar_sup_flags::allow_overwrite, dar_user_interaction_struct_is_valid(), dar_sup_flags::delete_marked, dar_sup_flags::ea_system, dar_sup_flags::ea_user, dar_sup_storage::hourshift, dar_sup_flags::ignore_owner, LIBDAR_ELIBCALL, LIBDAR_EMEMORY, LIBDAR_NOEXCEPT, LIBDARC_EXCEPTION, dar_sup_flags::only_more_recent, dar_sup_flags::restore_flat, dar_sup_spec::root_path, dar_sup_spec::selection, dar_sup_spec::subtree, dar_sup_flags::test_run, dar_user_interaction_struct::verbose, dar_sup_flags::warn_overwrite, and dar_sup_flags::warn_remove_no_match. |
|
Obtain a listing of any children of a given path of a file in an archive. Field usage:
Field name Used ARCHIVE OPTIONS (dar_sup_spec) Root path Archive path Archive name Archive extension Input pipe Output pipe Selection mask Subtree mask FORMAT OPTIONS (dar_sup_storage) Compression algorithm Compression level Compression mask Compression min. size Encryption algorithm Encryption block size Encryption passphrase File size First file size Slice excecute command Hourshift OPTION FLAGS (dar_sup_flags) Allow overwrite Warn overwrite Slice pause Create empty stubs System EA User EA No dump Ignore owner Test run Alter atime Same file system Delete marked Restore flat Warn rem. non-matching Only restore more recent Tar format listing Filter unsaved
Definition at line 613 of file libdarc.cpp. References dar_user_interaction_struct_is_valid(), LIBDAR_ELIBCALL, LIBDAR_NOEXCEPT, and LIBDARC_EXCEPTION. |
|
Isolates a catalog from a given archive and places it in a new empty archive. Field usage:
Field name Used ARCHIVE OPTIONS (dar_sup_spec) Root path Archive path X Archive name X Archive extension X Input pipe Output pipe Selection mask Subtree mask FORMAT OPTIONS (dar_sup_storage) Compression algorithm X Compression level X Compression mask Compression min. size Encryption algorithm X Encryption block size X Encryption passphrase X File size X First file size X Slice excecute command X Hourshift OPTION FLAGS (dar_sup_flags) Allow overwrite X Warn overwrite X Slice pause X Create empty stubs System EA User EA No dump Ignore owner Test run X Alter atime Same file system Delete marked Restore flat Warn rem. non-matching Only restore more recent Tar format listing Filter unsaved
Definition at line 653 of file libdarc.cpp. References dar_sup_flags::allow_overwrite, dar_sup_spec::arc_ext, dar_sup_spec::arc_name, dar_sup_spec::arc_path, dar_sup_storage::compress_algo, dar_sup_storage::compress_level, dar_sup_flags::create_empty_stubs, dar_sup_storage::crypto_algo, dar_sup_storage::crypto_pass, dar_sup_storage::crypto_size, dar_user_interaction_struct_is_valid(), dar_sup_storage::file_size, dar_sup_storage::first_file_size, LIBDAR_ELIBCALL, LIBDAR_EMEMORY, LIBDAR_NOEXCEPT, LIBDARC_EXCEPTION, dar_sup_storage::slice_execute, dar_sup_flags::slice_pause, dar_sup_flags::test_run, and dar_user_interaction_struct::verbose. |
|
Lists files in the archive according to a selection filter. Field usage:
Field name Used ARCHIVE OPTIONS (dar_sup_spec) Root path Archive path Archive name Archive extension Input pipe Output pipe Selection mask X Subtree mask FORMAT OPTIONS (dar_sup_storage) Compression algorithm Compression level Compression mask Compression min. size Encryption algorithm Encryption block size Encryption passphrase File size First file size Slice excecute command Hourshift OPTION FLAGS (dar_sup_flags) Allow overwrite Warn overwrite Slice pause Create empty stubs System EA User EA No dump Ignore owner Test run Alter atime Same file system Delete marked Restore flat Warn rem. non-matching Only restore more recent Tar format listing X Filter unsaved X
Definition at line 930 of file libdarc.cpp. References dar_user_interaction_struct_is_valid(), dar_sup_flags::filter_unsaved, LIBDAR_ELIBCALL, LIBDAR_NOEXCEPT, LIBDARC_EXCEPTION, dar_sup_spec::selection, dar_sup_flags::tar_format, and dar_user_interaction_struct::verbose. |
|
Opens an archive, reading its catalog into memory. Field usage:
Field name Used ARCHIVE OPTIONS (dar_sup_spec) Root path Archive path X Archive name X Archive extension X Input pipe X Output pipe X Selection mask Subtree mask FORMAT OPTIONS (dar_sup_storage) Compression algorithm Compression level Compression mask Compression min. size Encryption algorithm X Encryption block size X Encryption passphrase X File size First file size Slice excecute command X Hourshift OPTION FLAGS (dar_sup_flags) Allow overwrite Warn overwrite Slice pause Create empty stubs System EA User EA No dump Ignore owner Test run Alter atime Same file system Delete marked Restore flat Warn rem. non-matching Only restore more recent Tar format listing Filter unsaved
Definition at line 1055 of file libdarc.cpp. References dar_sup_spec::arc_ext, dar_sup_spec::arc_name, dar_sup_spec::arc_path, dar_sup_storage::crypto_algo, dar_sup_storage::crypto_pass, dar_sup_storage::crypto_size, dar_user_interaction_struct_is_valid(), dar_sup_spec::input_pipe, LIBDAR_ELIBCALL, LIBDAR_EMEMORY, LIBDAR_NOEXCEPT, LIBDARC_EXCEPTION, dar_sup_spec::output_pipe, dar_sup_storage::slice_execute, and dar_user_interaction_struct::verbose. Referenced by dar_drc_open_reference(). |
|
Tests an archive's integrity. This function may not be called with an archive object recieved directly from the isolation or creation functions. Because those objects will not reflect any actual on disk write errors they must be destroyed after creation. The archive must then be freshly read in from disk and then tested. Field usage:
Field name Used ARCHIVE OPTIONS (dar_sup_spec) Root path Archive path Archive name Archive extension Input pipe Output pipe Selection mask X Subtree mask X FORMAT OPTIONS (dar_sup_storage) Compression algorithm Compression level Compression mask Compression min. size Encryption algorithm Encryption block size Encryption passphrase File size First file size Slice excecute command Hourshift OPTION FLAGS (dar_sup_flags) Allow overwrite Warn overwrite Slice pause Create empty stubs System EA User EA No dump Ignore owner Test run Alter atime Same file system Delete marked Restore flat Warn rem. non-matching Only restore more recent Tar format listing Filter unsaved
Definition at line 978 of file libdarc.cpp. References dar_user_interaction_struct_is_valid(), LIBDAR_ELIBCALL, LIBDAR_NOEXCEPT, LIBDARC_EXCEPTION, dar_sup_spec::selection, dar_sup_spec::subtree, and dar_user_interaction_struct::verbose. |
|
Frees any memory allocated for the members of the struct.
Definition at line 444 of file libdarc.cpp. References dar_sup_exception::message. |
|
Initializes a
Definition at line 422 of file libdarc.cpp. References dar_sup_flags::allow_overwrite, dar_sup_flags::alter_atime, dar_sup_flags::create_empty_stubs, dar_sup_flags::delete_marked, dar_sup_flags::ea_system, dar_sup_flags::ea_user, dar_sup_flags::filter_unsaved, dar_sup_flags::ignore_owner, dar_sup_flags::no_dump, dar_sup_flags::only_more_recent, dar_sup_flags::restore_flat, dar_sup_flags::same_fs, dar_sup_flags::slice_pause, dar_sup_flags::tar_format, dar_sup_flags::test_run, dar_sup_flags::warn_overwrite, and dar_sup_flags::warn_remove_no_match. |
|
Initializes a
Because there are currently no default values for this struct, this function only initializes members as zero or
Definition at line 162 of file libdarc.cpp. References dar_sup_spec::arc_ext, dar_sup_spec::arc_name, dar_sup_spec::arc_path, dar_sup_spec::input_pipe, dar_sup_spec::output_pipe, dar_sup_spec::root_path, dar_sup_spec::selection, and dar_sup_spec::subtree. |
|
Frees any memory allocated for the members of the struct.
Definition at line 176 of file libdarc.cpp. References dar_sup_spec::arc_ext, dar_sup_spec::arc_name, dar_sup_spec::arc_path, dar_mask_destroy(), dar_sup_spec::input_pipe, dar_sup_spec::output_pipe, dar_sup_spec::root_path, dar_sup_spec::selection, and dar_sup_spec::subtree. Referenced by dar_drc_destroy(). |
|
Initializes a
All pointers will be set to
Definition at line 234 of file libdarc.cpp. References dar_sup_storage::compress_algo, dar_sup_storage::compress_level, dar_sup_storage::compress_mask, dar_sup_storage::compress_min_size, dar_sup_storage::crypto_algo, dar_sup_storage::crypto_pass, dar_sup_storage::crypto_size, dar_compression_none, dar_crypto_none, dar_sup_storage::file_size, dar_sup_storage::first_file_size, dar_sup_storage::hourshift, and dar_sup_storage::slice_execute. |
|
Frees any memory allocated for the members of the struct.
Definition at line 396 of file libdarc.cpp. References dar_sup_storage::compress_mask, dar_sup_storage::compress_min_size, dar_sup_storage::crypto_pass, dar_infinint_destroy(), dar_mask_destroy(), dar_sup_storage::file_size, dar_sup_storage::first_file_size, dar_sup_storage::hourshift, and dar_sup_storage::slice_execute. Referenced by dar_drc_destroy(). |