Main Page | Data Structures | Directories | File List | Data Fields | Globals

libisofs.h

Go to the documentation of this file.
00001 /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
00002 /* vim: set noet ts=8 sts=8 sw=8 : */
00003 
00004 /**
00005  * Create an ISO-9660 data volume with Rock Ridge and Joliet extensions.
00006  * Usage is easy:
00007  *  - Create a new volume.
00008  *  - Add files and directories.
00009  *  - Write the volume to a file or create a burn source for use with Libburn.
00010  */
00011 
00012 #ifndef __LIBISOFS
00013 #define __LIBISOFS
00014 
00015 #include "libburn/libburn.h"
00016 
00017 /**
00018  * Data volume.
00019  * @see volume.h for details.
00020  */
00021 struct iso_volume;
00022 
00023 /**
00024  * A set of data volumes.
00025  * @see volume.h for details.
00026  */
00027 struct iso_volset;
00028 
00029 /**
00030  * Directory on a volume.
00031  * @see tree.h for details.
00032  */
00033 struct iso_tree_dir;
00034 
00035 /**
00036  * File on a volume.
00037  * @see tree.h for details.
00038  */
00039 struct iso_tree_file;
00040 
00041 /**
00042  * Either a file or a directory.
00043  * \see tree.h
00044  */
00045 struct iso_tree_node;
00046 
00047 /**
00048  * Possible versions of a file or directory name or identifier.
00049  */
00050 enum iso_name_version {
00051     ISO_NAME_FULL,      /**< In the current locale. */
00052     ISO_NAME_ISO,       /**< Current ISO level identifier. */
00053     ISO_NAME_ISO_L1,    /**< ISO level 1 identifier. */
00054     ISO_NAME_ISO_L2,    /**< ISO level 2 identifier. */
00055     ISO_NAME_ROCKRIDGE, /**< Rock Ridge file or directory name. */
00056     ISO_NAME_JOLIET     /**< Joliet identifier. */
00057 };
00058 
00059 enum ecma119_extension_flag {
00060     ECMA119_ROCKRIDGE   = (1<<0),
00061     ECMA119_JOLIET      = (1<<1)
00062 };
00063 
00064 /**
00065  * Create a new volume.
00066  * The parameters can be set to NULL if you wish to set them later.
00067  */
00068 struct iso_volume *iso_volume_new(const char *volume_id,
00069                   const char *publisher_id,
00070                   const char *data_preparer_id);
00071 
00072 /**
00073  * Free a volume.
00074  */
00075 void iso_volume_free(struct iso_volume *volume);
00076 
00077 /**
00078  * Get the root directory for a volume.
00079  */
00080 struct iso_tree_dir *iso_volume_get_root(const struct iso_volume *volume);
00081 
00082 /**
00083  * Fill in the volume identifier for a volume.
00084  */
00085 void iso_volume_set_volume_id(struct iso_volume *volume,
00086                   const char *volume_id);
00087 
00088 /**
00089  * Fill in the publisher for a volume.
00090  */
00091 void iso_volume_set_publisher_id(struct iso_volume *volume,
00092                  const char *publisher_id);
00093 
00094 /**
00095  * Fill in the data preparer for a volume.
00096  */
00097 void iso_volume_set_data_preparer_id(struct iso_volume *volume,
00098                      const char *data_preparer_id);
00099 
00100 /**
00101  * Get the current ISO level for a volume.
00102  */
00103 int iso_volume_get_iso_level(const struct iso_volume *volume);
00104 
00105 /**
00106  * Set the current ISO level for a volume.
00107  * ISO level must be 1 or 2.
00108  */
00109 void iso_volume_set_iso_level(struct iso_volume *volume, int level);
00110 
00111 /**
00112  * See if Rock Ridge (POSIX) is enabled for a volume.
00113  */
00114 int iso_volume_get_rockridge(const struct iso_volume *volume);
00115 
00116 /**
00117  * Enable or disable Rock Ridge (POSIX) for a volume.
00118  */
00119 void iso_volume_set_rockridge(struct iso_volume *volume, int rockridge);
00120 
00121 /**
00122  * See if Joliet (Unicode) is enabled for a volume.
00123  */
00124 int iso_volume_get_joliet(const struct iso_volume *volume);
00125 
00126 /**
00127  * Enable or disable Joliet (Unicode) for a volume.
00128  */
00129 void iso_volume_set_joliet(struct iso_volume *volume, int joliet);
00130 
00131 /**
00132  * Create a new Volume Set consisting of only one volume.
00133  * @param volume The first and only volume for the volset to contain.
00134  * @param volset_id The Volume Set ID.
00135  * @return A new iso_volset.
00136  */
00137 struct iso_volset *iso_volset_new(struct iso_volume *volume,
00138                                   const char *volset_id);
00139 
00140 /**
00141  * Add a file to a directory.
00142  *
00143  * \param path The path, on the local filesystem, of the file.
00144  *
00145  * \pre \p parent is non-NULL
00146  * \pre \p path is non-NULL and is a valid path to a non-directory on the local
00147  *  filesystem.
00148  * \return An iso_tree_file whose path is \p path and whose parent is \p parent.
00149  */
00150 struct iso_tree_file *iso_tree_add_file(struct iso_tree_dir *parent,
00151                     const char *path);
00152 
00153 /**
00154  * Add a directory from the local filesystem to the tree.
00155  * Warning: this only adds the directory itself, no files or subdirectories.
00156  *
00157  * \param path The path, on the local filesystem, of the directory.
00158  *
00159  * \pre \p parent is non-NULL
00160  * \pre \p path is non-NULL and is a valid path to a directory on the local
00161  *  filesystem.
00162  * \return a pointer to the newly created directory.
00163  */
00164 struct iso_tree_dir *iso_tree_add_dir(struct iso_tree_dir *parent,
00165                       const char *path);
00166 
00167 /**
00168  * Recursively add an existing directory to the tree.
00169  * Warning: when using this, you'll lose pointers to files or subdirectories.
00170  * If you want to have pointers to all files and directories,
00171  * use iso_tree_add_file and iso_tree_add_dir.
00172  *
00173  * \param path The path, on the local filesystem, of the directory to add.
00174  *
00175  * \pre \p parent is non-NULL
00176  * \pre \p path is non-NULL and is a valid path to a directory on the local
00177  *  filesystem.
00178  * \return a pointer to the newly created directory.
00179  */
00180 struct iso_tree_dir *iso_tree_radd_dir(struct iso_tree_dir *parent,
00181                        const char *path);
00182 
00183 /**
00184  * Creates a new, empty directory on the volume.
00185  *
00186  * \pre \p parent is non-NULL
00187  * \pre \p name is unique among the children and files belonging to \p parent.
00188  *  Also, it doesn't contain '/' characters.
00189  *
00190  * \post \p parent contains a child directory whose name is \p name and whose
00191  *  POSIX attributes are the same as \p parent's.
00192  * \return a pointer to the newly created directory.
00193  */
00194 struct iso_tree_dir *iso_tree_add_new_dir(struct iso_tree_dir *parent,
00195                       const char *name);
00196 
00197 /**
00198  * Get the name of a node.
00199  */
00200 const char *iso_tree_node_get_name(const struct iso_tree_node *node,
00201                    enum iso_name_version ver);
00202 
00203 /**
00204  * Set the name of a file.
00205  * The name you input here will be the full name and will be used to derive the
00206  * ISO, RockRidge and Joliet names.
00207  */
00208 void iso_tree_file_set_name(struct iso_tree_file *file, const char *name);
00209 
00210 /**
00211  * Set the name of a directory.
00212  * The name you input here will be the full name and will be used to derive the
00213  * ISO, RockRidge and Joliet names.
00214  */
00215 void iso_tree_dir_set_name(struct iso_tree_dir *dir, const char *name);
00216 
00217 /**
00218  * Recursively print a directory to stdout.
00219  * \param spaces The initial number of spaces on the left. Set to 0 if you
00220  *  supply a root directory.
00221  */
00222 void iso_tree_print(const struct iso_tree_dir *root, int spaces);
00223 
00224 /** Create a burn_source which can be used as a data source for a track
00225  *
00226  * The volume set used to create the libburn_source can _not_ be modified
00227  * until the libburn_source is freed.
00228  *
00229  * \param volumeset The volume set from which you want to write
00230  * \param volnum The volume in the set which you want to write (usually 0)
00231  * \param level ISO level to write at.
00232  * \param flags Which extensions to support.
00233  *
00234  * \pre \p volumeset is non-NULL
00235  * \pre \p volnum is less than \p volset->volset_size.
00236  * \return A burn_source to be used for the data source for a track
00237  */
00238 struct burn_source* iso_source_new_ecma119 (struct iso_volset *volumeset,
00239                         int volnum,
00240                         int level,
00241                         int flags);
00242 
00243 #endif /* __LIBISOFS */

Generated on Mon Feb 13 18:31:19 2006 for libburn by  doxygen 1.4.2