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 LIBISO_LIBISOFS_H 00013 #define LIBISO_LIBISOFS_H 00014 00015 /* #include <libburn.h> */ 00016 struct burn_source; 00017 00018 /** 00019 * Data volume. 00020 * @see volume.h for details. 00021 */ 00022 struct iso_volume; 00023 00024 /** 00025 * A set of data volumes. 00026 * @see volume.h for details. 00027 */ 00028 struct iso_volset; 00029 00030 /** 00031 * A node in the filesystem tree. 00032 * \see tree.h 00033 */ 00034 struct iso_tree_node; 00035 00036 enum ecma119_extension_flag { 00037 ECMA119_ROCKRIDGE = (1<<0), 00038 ECMA119_JOLIET = (1<<1) 00039 }; 00040 00041 /** 00042 * Create a new volume. 00043 * The parameters can be set to NULL if you wish to set them later. 00044 */ 00045 struct iso_volume *iso_volume_new(const char *volume_id, 00046 const char *publisher_id, 00047 const char *data_preparer_id); 00048 00049 struct iso_volume *iso_volume_new_with_root(const char *volume_id, 00050 const char *publisher_id, 00051 const char *data_preparer_id, 00052 struct iso_tree_node *root); 00053 00054 /** 00055 * Free a volume. 00056 */ 00057 void iso_volume_free(struct iso_volume *volume); 00058 00059 /** 00060 * Free a set of data volumes. 00061 */ 00062 void iso_volset_free(struct iso_volset *volume); 00063 00064 /** 00065 * Get the root directory for a volume. 00066 */ 00067 struct iso_tree_node *iso_volume_get_root(const struct iso_volume *volume); 00068 00069 /** 00070 * Fill in the volume identifier for a volume. 00071 */ 00072 void iso_volume_set_volume_id(struct iso_volume *volume, 00073 const char *volume_id); 00074 00075 /** 00076 * Fill in the publisher for a volume. 00077 */ 00078 void iso_volume_set_publisher_id(struct iso_volume *volume, 00079 const char *publisher_id); 00080 00081 /** 00082 * Fill in the data preparer for a volume. 00083 */ 00084 void iso_volume_set_data_preparer_id(struct iso_volume *volume, 00085 const char *data_preparer_id); 00086 00087 /** 00088 * Locate a node by its path on disc. 00089 * 00090 * \param volume The volume to search in. 00091 * \param path The path, in the image, of the file. 00092 * 00093 * \return The node found or NULL. 00094 * 00095 */ 00096 struct iso_tree_node *iso_tree_volume_path_to_node(struct iso_volume *volume, const char *path); 00097 00098 /** 00099 * Add a file or a directory (recursively) to a volume by specifying its path on the volume. 00100 * 00101 * \param volume The volume to add the file to. 00102 * \param disc_path The path on the disc at which to add the disc. 00103 * \param path The path, on the local filesystem, of the file. 00104 * 00105 * \return The node for the file or NULL if the parent doesn't exists on the disc. 00106 */ 00107 struct iso_tree_node *iso_tree_volume_add_path(struct iso_volume *volume, 00108 const char *disc_path, 00109 const char *path); 00110 00111 /** 00112 * Creates a new, empty directory on the volume. 00113 * 00114 * \param volume The volume to add the directory to. 00115 * \param disc_path The path on the volume at which to add the directory. 00116 * 00117 * \return A pointer to the newly created directory. 00118 */ 00119 struct iso_tree_node *iso_tree_volume_add_new_dir(struct iso_volume *volume, 00120 const char *disc_path); 00121 00122 /** 00123 * Create a new Volume Set consisting of only one volume. 00124 * @param volume The first and only volume for the volset to contain. 00125 * @param volset_id The Volume Set ID. 00126 * @return A new iso_volset. 00127 */ 00128 struct iso_volset *iso_volset_new(struct iso_volume *volume, 00129 const char *volset_id); 00130 00131 /** 00132 * Add a file to a directory. 00133 * 00134 * \param path The path, on the local filesystem, of the file. 00135 * 00136 * \pre \p parent is NULL or is a directory. 00137 * \pre \p path is non-NULL and is a valid path to a non-directory on the local 00138 * filesystem. 00139 * \return An iso_tree_node whose path is \p path and whose parent is \p parent. 00140 */ 00141 struct iso_tree_node *iso_tree_add_node(struct iso_tree_node *parent, 00142 const char *path); 00143 00144 /** 00145 * Recursively add an existing directory to the tree. 00146 * Warning: when using this, you'll lose pointers to files or subdirectories. 00147 * If you want to have pointers to all files and directories, 00148 * use iso_tree_add_file and iso_tree_add_dir. 00149 * 00150 * \param path The path, on the local filesystem, of the directory to add. 00151 * 00152 * \pre \p parent is NULL or is a directory. 00153 * \pre \p path is non-NULL and is a valid path to a directory on the local 00154 * filesystem. 00155 * \return a pointer to the newly created directory. 00156 */ 00157 struct iso_tree_node *iso_tree_radd_dir(struct iso_tree_node *parent, 00158 const char *path); 00159 00160 00161 /** 00162 * Add the path of a file or directory to ignore when adding a directory recursively. 00163 * 00164 * \param path The path, on the local filesystem, of the file. 00165 */ 00166 void iso_exclude_add_path(const char *path); 00167 00168 /** 00169 * Remove a path that was set to be ignored when adding a directory recusively. 00170 * 00171 * \param path The path, on the local filesystem, of the file. 00172 */ 00173 void iso_exclude_remove_path(const char *path); 00174 00175 /** 00176 * Remove all paths that were set to be ignored when adding a directory recusively. 00177 */ 00178 void iso_exclude_empty(void); 00179 00180 /** 00181 * Creates a new, empty directory on the volume. 00182 * 00183 * \pre \p parent is NULL or is a directory. 00184 * \pre \p name is unique among the children and files belonging to \p parent. 00185 * Also, it doesn't contain '/' characters. 00186 * 00187 * \post \p parent contains a child directory whose name is \p name and whose 00188 * POSIX attributes are the same as \p parent's. 00189 * \return a pointer to the newly created directory. 00190 */ 00191 struct iso_tree_node *iso_tree_add_new_dir(struct iso_tree_node *parent, 00192 const char *name); 00193 00194 /** 00195 * Set the name of a file (using the current locale). 00196 */ 00197 void iso_tree_node_set_name(struct iso_tree_node *file, const char *name); 00198 00199 /** 00200 * Recursively print a directory to stdout. 00201 * \param spaces The initial number of spaces on the left. Set to 0 if you 00202 * supply a root directory. 00203 */ 00204 void iso_tree_print(const struct iso_tree_node *root, int spaces); 00205 00206 /** Create a burn_source which can be used as a data source for a track 00207 * 00208 * The volume set used to create the libburn_source can _not_ be modified 00209 * until the libburn_source is freed. 00210 * 00211 * \param volumeset The volume set from which you want to write 00212 * \param volnum The volume in the set which you want to write (usually 0) 00213 * \param level ISO level to write at. 00214 * \param flags Which extensions to support. 00215 * 00216 * \pre \p volumeset is non-NULL 00217 * \pre \p volnum is less than \p volset->volset_size. 00218 * \return A burn_source to be used for the data source for a track 00219 */ 00220 struct burn_source* iso_source_new_ecma119 (struct iso_volset *volumeset, 00221 int volnum, 00222 int level, 00223 int flags); 00224 00225 #endif /* LIBISO_LIBISOFS_H */