• Main Page
  • Data Structures
  • Files
  • File List
  • Globals

libisoburn-0.5.6.pl00/libisoburn/libisoburn.h

Go to the documentation of this file.
00001 
00002 /*
00003   API definition of libisoburn.
00004 
00005   Copyright 2007-2010 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
00006                   and Thomas Schmitt <scdbackup@gmx.net>
00007    Provided under GPL version 2 or later.
00008 */
00009 
00010 /**                           Overview
00011 
00012 libisoburn is a frontend for libraries libburn and libisofs which enables
00013 creation and expansion of ISO-9660 filesystems on all CD/DVD media supported
00014 by libburn. This includes media like DVD+RW, which do not support multi-session
00015 management on media level and even plain disk files or block devices.
00016 
00017 The price for that is thorough specialization on data files in ISO-9660
00018 filesystem images. So libisoburn is not suitable for audio (CD-DA) or any
00019 other CD layout which does not entirely consist of ISO-9660 sessions.
00020 
00021 
00022                           Connector functions
00023 
00024 libisofs and libburn do not depend on each other but share some interfaces
00025 by which they can cooperate.
00026 libisoburn establishes the connection between both modules by creating the
00027 necessary interface objects and attaching them to the right places.
00028 
00029 
00030                           Wrapper functions 
00031 
00032 The priciple of this frontend is that you may use any call of libisofs or
00033 libburn unless it has a  isoburn_*()  wrapper listed in the following function
00034 documentation.
00035 
00036 E.g. call isoburn_initialize() rather than iso_init(); burn_initialize();
00037 and call isoburn_drive_scan_and_grab() rather than burn_drive_scan_and_grab().
00038 But you may call  burn_disc_get_profile()  directly if you want to display
00039 the media type.
00040 
00041 The wrappers will transparently provide the necessary emulations which
00042 are appropriate for particular target drives and media states.
00043 To learn about them you have to read both API descriptions: the one of
00044 the wrapper and the one of the underlying libburn or libisofs call.
00045 
00046 Macros BURN_* and functions burn_*() are documented in <libburn/libburn.h>
00047 Macros ISO_* and functions iso_*() are documented in <libisofs/libisofs.h>
00048 
00049 
00050                              Usage model
00051 
00052 There may be an input drive and an output drive. Either of them may be missing
00053 with the consequence that no reading resp. writing is possible.
00054 Both drive roles can be fulfilled by the same drive.
00055 
00056 Input can be a random access readable libburn drive:
00057   optical media, regular files, block devices.
00058 Output can be any writeable libburn drive:
00059   writeable optical media in burner, writeable file objects (no directories).
00060 
00061 libburn demands rw-permissions to drive device file resp. file object.
00062 
00063 If the input drive provides a suitable ISO RockRidge image, then its tree
00064 may be loaded into memory and can then be manipulated by libisofs API calls.
00065 The loading is done by isoburn_read_image() under control of
00066 struct isoburn_read_opts which the application obtains from libisoburn
00067 and manipulates by the family of isoburn_ropt_set_*() functions.
00068 
00069 Writing of result images is controlled by libisofs related parameters
00070 in a struct isoburn_imgen_opts which the application obtains from libisoburn
00071 and manipulates by the family of isoburn_igopt_set_*() functions.
00072 
00073 All multi-session aspects are handled by libisoburn according to these
00074 settings. The application does not have to analyze media state and write
00075 job parameters. It rather states its desires which libisoburn tries to
00076 fulfill, or else will refuse to start the write run.
00077 
00078 
00079               Setup for Growing, Modifying or Blind Growing
00080 
00081 The connector function family offers alternative API calls for performing
00082 the setup for several alternative image generation strategies.
00083 
00084 Growing:
00085 If input and output drive are the same, then isoburn_prepare_disc() is to
00086 be used. It will lead to an add-on session on appendable or overwriteable
00087 media with existing ISO image. With blank media it will produce a first
00088 session.
00089 
00090 Modifying:
00091 If the output drive is not the input drive, and if it bears blank media
00092 or overwriteable without a valid ISO image, then one may produce a consolidated
00093 image with old and new data. This will copy file data from an eventual input
00094 drive with valid image, add any newly introduced data from the local
00095 filesystem, and produce a first session on output media.
00096 To prepare for such an image generation run, use isoburn_prepare_new_image().
00097 
00098 Blind Growing:
00099 This method reads the old image from one drive and writes the add-on session
00100 to a different drive. That output drive is nevertheless supposed to
00101 finally lead to the same media from where the session was loaded. Usually it
00102 will be stdio:/dev/fd/1 (i.e. stdout) being piped into some burn program
00103 like with this classic gesture:
00104   mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev
00105 Blind growing is prepared by the call isoburn_prepare_blind_grow().
00106 The input drive should be released immediately after this call in order
00107 to allow the consumer of the output stream to access that drive for writing.
00108 
00109 After either of these setups, some peripheral libburn drive parameter settings
00110 like  burn_write_opts_set_simulate(),  burn_write_opts_set_multi(),
00111  burn_drive_set_speed(),  burn_write_opts_set_underrun_proof()  should be made.
00112 Do not set the write mode. It will be chosen by libisoburn so it matches job
00113 and media state.
00114 
00115                            Writing the image
00116 
00117 Then one may start image generation and write threads by isoburn_disc_write().
00118 Progress may be watched at the output drive by burn_drive_get_status() and
00119 isoburn_get_fifo_status().
00120 
00121 At some time, the output drive will be BURN_DRIVE_IDLE indicating that
00122 writing has ended.
00123 One should inquire isoburn_drive_wrote_well() to learn about overall success.
00124 
00125 Finally one must call isoburn_activate_session() which will complete any
00126 eventual multi-session emulation.
00127 
00128 
00129                          Application Constraints
00130 
00131 Applications shall include libisofs/libisofs.h , libburn/libburn.h and this
00132 file itself: libisoburn/libisoburn.h .
00133 They shall link with -lisofs -lburn -lisoburn or with the .o files emerging
00134 from building those libraries from their sources.
00135 
00136 Applications must use 64 bit off_t, e.g. on 32-bit GNU/Linux by defining
00137   #define _LARGEFILE_SOURCE
00138   #define _FILE_OFFSET_BITS 64
00139 or take special precautions to interface with the library by 64 bit integers
00140 where above .h files prescribe off_t. Not to use 64 bit file i/o will keep 
00141 the application from producing and processing ISO images of more than 2 GB 
00142 size.
00143 
00144 */
00145 
00146 
00147                           /* API functions */
00148 
00149 
00150 /** Initialize libisoburn, libisofs and libburn.
00151     Wrapper for : iso_init() and burn_initialize()
00152     @since 0.1.0
00153     @param msg  A character array for eventual messages (e.g. with errors)
00154     @param flag Bitfield for control purposes (unused yet, submit 0) 
00155     @return 1 indicates success, 0 is failure
00156 */
00157 int isoburn_initialize(char msg[1024], int flag);
00158 
00159 
00160 /** Check whether all features of header file libisoburn.h from the given
00161     major.minor.micro revision triple can be delivered by the library version
00162     which is performing this call.
00163     An application of libisoburn can easily memorize the version of the
00164     libisofs.h header in its own code. Immediately after isoburn_initialize()
00165     it should simply do this check:
00166         if (! isoburn_is_compatible(isoburn_header_version_major,
00167                                     isoburn_header_version_minor,
00168                                     isoburn_header_version_micro, 0))
00169            ...refuse to start the program with this dynamic library version...
00170     @since 0.1.0
00171     @param major obtained at build time
00172     @param minor obtained at build time
00173     @param micro obtained at build time
00174     @param flag Bitfield for control purposes. Unused yet. Submit 0.
00175     @return 1= library can work for caller
00176             0= library is not usable in some aspects. Caller must restrict
00177                itself to an earlier API version or must not use this libray
00178                at all.
00179 */
00180 int isoburn_is_compatible(int major, int minor, int micro, int flag);
00181 
00182 
00183 /** Obtain the three release version numbers of the library. These are the
00184     numbers encountered by the application when linking with libisoburn,
00185     i.e. possibly not before run time.
00186     Better do not base the fundamental compatibility decision of an application
00187     on these numbers. For a reliable check use isoburn_is_compatible().
00188     @since 0.1.0
00189     @param major The maturity version (0 for now, as we are still learning)
00190     @param minor The development goal version.
00191     @param micro The development step version. This has an additional meaning:
00192 
00193                  Pare numbers indicate a version with frozen API. I.e. you can
00194                  rely on the same set of features to be present in all
00195                  published releases with that major.minor.micro combination.
00196                  Features of a pare release will stay available and ABI
00197                  compatible as long as the SONAME of libisoburn stays "1".
00198                  Currently there are no plans to ever change the SONAME.
00199                  
00200                  Odd numbers indicate that API upgrades are in progress.
00201                  I.e. new features might be already present or they might
00202                  be still missing. Newly introduced features may be changed
00203                  incompatibly or even be revoked before release of a pare
00204                  version.
00205                  So micro revisions {1,3,5,7,9} should never be used for
00206                  dynamic linking unless the proper library match can be
00207                  guaranteed by external circumstances.
00208 
00209     @return 1 success, <=0 might in future become an error indication
00210 */
00211 void isoburn_version(int *major, int *minor, int *micro);
00212 
00213 
00214 /** The minimum version of libisofs to be used with this version of libisoburn
00215     at compile time.
00216     @since 0.1.0
00217 */
00218 #define isoburn_libisofs_req_major  0
00219 #define isoburn_libisofs_req_minor  6
00220 #define isoburn_libisofs_req_micro 32 
00221 
00222 /** The minimum version of libburn to be used with this version of libisoburn
00223     at compile time.
00224     @since 0.1.0
00225 */
00226 #define isoburn_libburn_req_major  0
00227 #define isoburn_libburn_req_minor  7
00228 #define isoburn_libburn_req_micro  8
00229 
00230 
00231 /** The minimum version of libisofs to be used with this version of libisoburn
00232     at runtime. This is checked already in isoburn_initialize() which will
00233     refuse on outdated version. So this call is for information purposes after
00234     successful startup only.
00235     @since 0.1.0
00236     @param major isoburn_libisofs_req_major as seen at build time
00237     @param minor as seen at build time
00238     @param micro as seen at build time
00239     @return 1 success, <=0 might in future become an error indication
00240 */
00241 int isoburn_libisofs_req(int *major, int *minor, int *micro);
00242 
00243 
00244 /** The minimum version of libburn to be used with this version of libisoburn
00245     at runtime. This is checked already in isoburn_initialize() which will
00246     refuse on outdated version. So this call is for information purposes after
00247     successful startup only.
00248     @since 0.1.0
00249     @param major isoburn_libburn_req_major as seen at build time
00250     @param minor as seen at build time
00251     @param micro as seen at build time
00252     @return 1 success, <=0 might in future become an error indication
00253 */
00254 int isoburn_libburn_req(int *major, int *minor, int *micro);
00255 
00256 
00257 /** These three release version numbers tell the revision of this header file
00258     and of the API it describes. They are memorized by applications at build
00259     time.
00260     @since 0.1.0
00261 */
00262 #define isoburn_header_version_major  0
00263 #define isoburn_header_version_minor  5
00264 #define isoburn_header_version_micro  6
00265 /** Note:
00266     Above version numbers are also recorded in configure.ac because libtool
00267     wants them as parameters at build time.
00268     For the library compatibility check, ISOBURN_*_VERSION in configure.ac
00269     are not decisive. Only the three numbers here do matter.
00270 */
00271 /** Usage discussion:
00272 
00273 Some developers of the libburnia project have differing
00274 opinions how to ensure the compatibility of libaries
00275 and applications.
00276 
00277 It is about whether to use at compile time and at runtime
00278 the version numbers isoburn_header_version_* provided here.
00279 Thomas Schmitt advises to use them.
00280 Vreixo Formoso advises to use other means.
00281 
00282 At compile time:
00283 
00284 Vreixo Formoso advises to leave proper version matching
00285 to properly programmed checks in the the application's
00286 build system, which will eventually refuse compilation.
00287 
00288 Thomas Schmitt advises to use the macros defined here
00289 for comparison with the application's requirements of
00290 library revisions and to eventually break compilation.
00291 
00292 Both advises are combinable. I.e. be master of your
00293 build system and have #if checks in the source code
00294 of your application, nevertheless.
00295 
00296 At runtime (via *_is_compatible()):
00297 
00298 Vreixo Formoso advises to compare the application's
00299 requirements of library revisions with the runtime
00300 library. This is to allow runtime libraries which are
00301 young enough for the application but too old for
00302 the lib*.h files seen at compile time.
00303 
00304 Thomas Schmitt advises to compare the header
00305 revisions defined here with the runtime library.
00306 This is to enforce a strictly monotonous chain
00307 of revisions from app to header to library,
00308 at the cost of excluding some older libraries.
00309 
00310 These two advises are mutually exclusive.
00311 
00312 -----------------------------------------------------
00313 
00314 For an implementation of the Thomas Schmitt approach,
00315 see libisoburn/burn_wrap.c : isoburn_initialize()
00316 This connects libisoburn as "application" with libisofs
00317 as "library".
00318 
00319 The compatible part of Vreixo Formoso's approach is implemented
00320 in configure.ac LIBBURN_REQUIRED, LIBISOFS_REQUIRED.
00321 In isoburn_initialize() it would rather test by
00322   iso_lib_is_compatible(isoburn_libisofs_req_major,...
00323 than by
00324   iso_lib_is_compatible(iso_lib_header_version_major,...
00325 and would leave out the ugly compile time traps.
00326 
00327 */
00328 
00329 
00330 /** Announce to the library an application provided method for immediate
00331     delivery of messages. It is used when no drive is affected directly or
00332     if the drive has no own msgs_submit() method attached by
00333     isoburn_drive_set_msgs_submit.
00334     If no method is preset or if the method is set to NULL then libisoburn
00335     delivers its messages through the message queue of libburn.
00336     @param msgs_submit   The function call which implements the method
00337     @param submit_handle Handle to be used as first argument of msgs_submit
00338     @param submit_flag   Flag to be used as last argument of msgs_submit
00339     @param flag          Unused yet, submit 0
00340     @since 0.2.0
00341 */
00342 int isoburn_set_msgs_submit(int (*msgs_submit)(void *handle, int error_code,
00343                                                   char msg_text[], int os_errno,
00344                                                   char severity[], int flag),
00345                                void *submit_handle, int submit_flag, int flag);
00346 
00347 
00348 /** Aquire a target drive by its filesystem path resp. libburn persistent
00349     address.
00350     Wrapper for: burn_drive_scan_and_grab()
00351     @since 0.1.0
00352     @param drive_infos On success returns a one element array with the drive
00353                   (cdrom/burner). Thus use with driveno 0 only. On failure
00354                   the array has no valid elements at all.
00355                   The returned array should be freed via burn_drive_info_free()
00356                   when the drive is no longer needed. But before this is done
00357                   one has to call isoburn_drive_release(drive_infos[0].drive).
00358     @param adr    The persistent address of the desired drive.
00359     @param load   1 attempt to load the disc tray. 0 no attempt,rather failure.
00360     @return       1 = success , 0 = drive not found , <0 = other error
00361 */
00362 int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[],
00363                                 char* adr, int load);
00364 
00365 
00366 /** Aquire a target drive by its filesystem path resp. libburn persistent
00367     address. This is a modern successor of isoburn_drive_scan_and_grab().  
00368     Wrapper for: burn_drive_scan_and_grab()
00369     @since 0.1.2
00370     @param drive_infos On success returns a one element array with the drive
00371                   (cdrom/burner). Thus use with driveno 0 only. On failure
00372                   the array has no valid elements at all.
00373                   The returned array should be freed via burn_drive_info_free()
00374                   when the drive is no longer needed. But before this is done
00375                   one has to call isoburn_drive_release(drive_infos[0].drive).
00376     @param adr    The persistent address of the desired drive.
00377     @param flag   bit0= attempt to load the disc tray.
00378                         Else: failure if not loaded.
00379                   bit1= regard overwriteable media as blank
00380                   bit2= if the drive is a regular disk file: truncate it to
00381                         the write start address
00382                   bit3= if the drive reports a read-only profile try to read
00383                         table of content by scanning for ISO image headers.
00384                         (depending on media type and drive this might
00385                          help or it might make the resulting toc even worse)
00386                   bit4= do not emulate table of content on overwriteable media
00387                   bit5= ignore ACL from external filesystems
00388                   bit6= ignore POSIX Extended Attributes from external
00389                         filesystems
00390                   bit7= pretend read-only profile and scan for table of content
00391     @return       1 = success , 0 = drive not found , <0 = other error
00392 */
00393 int isoburn_drive_aquire(struct burn_drive_info *drive_infos[],
00394                          char* adr, int flag);
00395 
00396 /** Aquire a drive from the burn_drive_info[] array which was obtained by
00397     a previous call of burn_drive_scan(). 
00398     Wrapper for: burn_drive_grab()
00399     @since 0.1.0
00400     @param drive The drive to grab. E.g. drive_infos[1].drive .
00401                  Call isoburn_drive_release(drive) when it it no longer needed.
00402     @param load  1 attempt to load the disc tray. 0 no attempt, rather failure.
00403     @return      1 success, <=0 failure
00404 */
00405 int isoburn_drive_grab(struct burn_drive *drive, int load);
00406 
00407 
00408 /** Attach to a drive an application provided method for immediate
00409     delivery of messages.
00410     If no method is set or if the method is set to NULL then libisoburn
00411     delivers messages of the drive through the global msgs_submit() method
00412     set by isoburn_set_msgs_submiti() or by the message queue of libburn.
00413     @since 0.2.0
00414     @param d     The drive to which this function, handle and flag shall apply
00415     @param msgs_submit   The function call which implements the method
00416     @param submit_handle Handle to be used as first argument of msgs_submit
00417     @param submit_flag   Flag to be used as last argument of msgs_submit
00418     @param flag          Unused yet, submit 0
00419 */
00420 int isoburn_drive_set_msgs_submit(struct burn_drive *d,
00421                             int (*msgs_submit)(void *handle, int error_code,
00422                                                char msg_text[], int os_errno,
00423                                                char severity[], int flag),
00424                             void *submit_handle, int submit_flag, int flag);
00425 
00426 
00427 /** Inquire the media status. Expect the whole spectrum of libburn BURN_DISC_*
00428     with multi-session media. Emulated states with random access media are
00429     BURN_DISC_BLANK and BURN_DISC_APPENDABLE.
00430     Wrapper for: burn_disc_get_status()
00431     @since 0.1.0
00432     @param drive The drive to inquire.
00433     @return The status of the drive, or what kind of disc is in it.
00434             Note: BURN_DISC_UNGRABBED indicates wrong API usage
00435 */
00436 enum burn_disc_status isoburn_disc_get_status(struct burn_drive *drive);
00437 
00438 
00439 /** Tells whether the media can be treated by isoburn_disc_erase().
00440     Wrapper for: burn_disc_erasable()
00441     @since 0.1.0
00442     @param d     The drive to inquire.
00443     @return      0=not erasable , else erasable
00444 */
00445 int isoburn_disc_erasable(struct burn_drive *d);
00446 
00447 
00448 /** Mark the media as blank. With multi-session media this will call
00449     burn_disc_erase(). With random access media, an eventual ISO-9660
00450     filesystem will get invalidated by altering its start blocks on media.
00451     In case of success, the media is in status BURN_DISC_BLANK afterwards.
00452     Wrapper for: burn_disc_erase()
00453     @since 0.1.0
00454     @param drive The drive with the media to erase.
00455     @param fast 1=fast erase, 0=thorough erase
00456                With DVD-RW, fast erase yields media incapable of multi-session.
00457 */
00458 void isoburn_disc_erase(struct burn_drive *drive, int fast);
00459 
00460 
00461 /** Set up isoburn_disc_get_msc1() to return a fabricated value.
00462     This makes only sense between aquiring the drive and reading the
00463     image. After isoburn_read_image() it will confuse the coordination
00464     of libisoburn and libisofs.
00465     Note: Sessions and tracks are counted beginning with 1, not with 0.
00466     @since 0.1.6
00467     @param d        The drive where msc1 is to be set
00468     @param adr_mode Determines how to interpret adr_value and to set msc1.
00469                     If adr_value shall represent a number then decimal ASCII
00470                     digits are expected.
00471                     0= start lba of last session in TOC, ignore adr_value
00472                     1= start lba of session number given by adr_value
00473                     2= start lba of track given number by adr_value
00474                     3= adr_value itself is the lba to be used
00475                     4= start lba of last session with volume id
00476                        given by adr_value
00477     @param adr_value A string describing the value to be eventually used.
00478     @param flag Bitfield for control purposes.
00479                 bit0= @since 0.2.2
00480                       with adr_mode 3: adr_value might be 16 blocks too high
00481                       (e.g. -C stemming from growisofs). Probe for ISO head
00482                       at adr_value-16 and eventually adjust setting. 
00483                 bit1= insist in seeing a disc object with at least one session
00484                 bit2= with adr_mode 4: use adr_value as regular expression
00485 */
00486 int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value,
00487                      int flag);
00488 
00489 
00490 /* ----------------------------------------------------------------------- */
00491 /* 
00492 
00493   Wrappers for emulation of TOC on overwriteable media
00494 
00495   Media which match the overwriteable usage model lack of a history of sessions
00496   and tracks. libburn will not even hand out a burn_disc object for them and
00497   always declare them blank. libisoburn checks for a valid ISO filesystem
00498   header at LBA 0 and eventually declares them appendable.
00499   Nevertheless one can only determine an upper limit of the size of the overall
00500   image (by isoburn_get_min_start_byte()) but not a list of stored sessions
00501   and their LBAs, as it is possible with true multi-session media.
00502 
00503   The following wrappers add the capability to obtain a session and track TOC
00504   from emulated multi-session images on overwriteables if the first session
00505   was written by libisoburn-0.1.6 or later (i.e. with a header copy at LBA 32).
00506 
00507   Be aware that the structs emitted by these isoburn calls are not compatible
00508   with the libburn structs. I.e. you may use them only with isoburn_toc_*
00509   calls. 
00510   isoburn_toc_disc needs to be freed after use. isoburn_toc_session and
00511   isoburn_toc_track vanish together with their isoburn_toc_disc.
00512 */
00513 
00514 /* Opaque handles to media, session, track */
00515 struct isoburn_toc_disc;
00516 struct isoburn_toc_session;
00517 struct isoburn_toc_track;
00518 
00519 
00520 /** Obtain a master handle for the table of content.
00521     This handle governs allocated resources which have to be released by
00522     isoburn_toc_disc_free() when no longer needed.
00523     Wrapper for: burn_drive_get_disc()
00524     @since 0.1.6
00525     @param d   The drive with the media to inspect
00526     @return    NULL in case there is no content info, else it is a valid handle
00527 */
00528 struct isoburn_toc_disc *isoburn_toc_drive_get_disc(struct burn_drive *d);
00529 
00530 
00531 /** Tell the number of 2048 byte blocks covered by the table of content.
00532     This number includes the eventual gaps between sessions and tracks.
00533     So this call is not really a wrapper for burn_disc_get_sectors().
00534     @since 0.1.6
00535     @param disc  The master handle of the media
00536     @return      Number of blocks, <=0 indicates unknown or unreadable state
00537 */
00538 int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc);
00539 
00540 
00541 /** Get the array of session handles from the table of content.
00542     Wrapper for: burn_disc_get_sessions()
00543     @since 0.1.6
00544     @param disc The master handle of the media
00545     @param num returns the number of sessions in the array
00546     @return the address of the array of session handles
00547 */
00548 struct isoburn_toc_session **isoburn_toc_disc_get_sessions(
00549                                       struct isoburn_toc_disc *disc, int *num);
00550 
00551 
00552 /** Tell the number of 2048 byte blocks covered by a particular session.
00553     Wrapper for: burn_session_get_sectors()
00554     @since 0.1.6
00555     @param s The session handle
00556     @return number of blocks, <=0 indicates unknown or unreadable state
00557 */
00558 int isoburn_toc_session_get_sectors(struct isoburn_toc_session *s);
00559 
00560 
00561 /** Obtain a copy of the entry which describes the end of a particular session.
00562     Wrapper for: burn_session_get_leadout_entry()
00563     @since 0.1.6
00564     @param s The session handle
00565     @param entry A pointer to memory provided by the caller. It will be filled
00566                  with info according to struct burn_toc_entry as defined
00567                  in libburn.h
00568 */
00569 void isoburn_toc_session_get_leadout_entry(struct isoburn_toc_session *s,
00570                                        struct burn_toc_entry *entry);
00571 
00572 
00573 /** Get the array of track handles from a particular session.
00574     Wrapper for: burn_session_get_tracks()
00575     @since 0.1.6
00576     @param s The session handle
00577     @param num returns the number of tracks in the array
00578     @return the address of the array of track handles
00579 */
00580 struct isoburn_toc_track **isoburn_toc_session_get_tracks(
00581                                       struct isoburn_toc_session *s, int *num);
00582 
00583 
00584 /** Obtain a copy of the entry which describes a particular track.
00585     Wrapper for: burn_track_get_entry()
00586     @since 0.1.6
00587     @param t The track handle
00588     @param entry A pointer to memory provided by the caller. It will be filled
00589                  with info according to struct burn_toc_entry as defined
00590                  in libburn.h
00591 */
00592 void isoburn_toc_track_get_entry(struct isoburn_toc_track *t,
00593                                  struct burn_toc_entry *entry);
00594 
00595 
00596 /** Obtain eventual ISO image parameters of an emulated track. This info was
00597     gained with much effort and thus gets cached in the track object.
00598     If this call returns 1 then one can save a call of isoburn_read_iso_head()
00599     with return mode 1 which could cause an expensive read operation.
00600     @since 0.4.0
00601     @param t            The track handle
00602     @param start_lba    Returns the start address of the ISO session
00603     @param image_blocks Returns the number of 2048 bytes blocks
00604     @param volid        Caller provided memory for the volume id
00605     @param flag         unused yet, submit 0
00606     @return             0= not an emulated ISO session , 1= reply is valid
00607 */
00608 int isoburn_toc_track_get_emul(struct isoburn_toc_track *t, int *start_lba,
00609                                int *image_blocks, char volid[33], int flag);
00610 
00611 
00612 
00613 /** Release the memory associated with a master handle of media.
00614     The handle is invalid afterwards and may not be used any more.
00615     Wrapper for: burn_disc_free()
00616     @since 0.1.6
00617     @param disc The master handle of the media
00618 */
00619 void isoburn_toc_disc_free(struct isoburn_toc_disc *disc);
00620 
00621 
00622 /** Try whether the data at the given address look like a ISO 9660
00623     image header and obtain its alleged size. Depending on the info mode
00624     one other string of text information can be retrieved too.
00625     @since 0.1.6
00626     @param d     The drive with the media to inspect
00627     @param lba   The block number from where to read
00628     @param image_blocks  The number of 2048 bytes blocks
00629     @param info  Caller provided memory, enough to take eventual info reply
00630     @param flag bit0-7: info return mode
00631                  0= do not return anything in info (do not even touch it)
00632                  1= copy volume id to info (info needs 33 bytes)
00633                  2= @since 0.2.2 :
00634                     copy 64 kB header to info (needs 65536 bytes) 
00635                 bit13= @since 0.2.2:
00636                       do not read head from media but use first 64 kB from info
00637                 bit14= check both half buffers (not only second)
00638                        return 2 if found in first block
00639                 bit15= return -1 on read error
00640     @return >0 seems to be a valid ISO image, 0 format not recognized, <0 error
00641 */
00642 int isoburn_read_iso_head(struct burn_drive *d, int lba,
00643                           int *image_blocks, char *info, int flag);
00644 
00645 
00646 /** Try to convert the given entity address into various entity addresses
00647     which would describe it.
00648     Note: Sessions and tracks are counted beginning with 1, not with 0.
00649     @since 0.3.2
00650     @param d        The drive where msc1 is to be set
00651     @param adr_mode Determines how to interpret the input adr_value.
00652                     If adr_value shall represent a number then decimal ASCII
00653                     digits are expected.
00654                     0= start lba of last session in TOC, ignore adr_value
00655                     1= start lba of session number given by adr_value
00656                     2= start lba of track given number by adr_value
00657                     3= adr_value itself is the lba to be used
00658                     4= start lba of last session with volume id
00659                        given by adr_value
00660     @param adr_value A string describing the value to be eventually used.
00661     @param lba       returns the block address of the entity, -1 means invalid
00662     @param track     returns the track number of the entity, -1 means invalid
00663     @param session   returns the session number of the entity, -1 means invalid
00664     @param volid     returns the volume id of the entity if it is a ISO session
00665     @param flag      Bitfield for control purposes.
00666                      bit2= with adr_mode 4: use adr_value as regular expression
00667     @return          <=0 error , 1 ok, ISO session, 2 ok, not an ISO session
00668 */
00669 int isoburn_get_mount_params(struct burn_drive *d,
00670                              int adr_mode, char *adr_value,
00671                              int *lba, int *track, int *session,
00672                              char volid[33], int flag);
00673 
00674 
00675 /* ----------------------------------------------------------------------- */
00676 /*
00677 
00678   Options for image reading.
00679 
00680   An application shall create an option set object by isoburn_ropt_new(),
00681   program it by isoburn_ropt_set_*(), use it with isoburn_read_image(),
00682   and finally delete it by isoburn_ropt_destroy().
00683 
00684 */
00685 /* ----------------------------------------------------------------------- */
00686 
00687 struct isoburn_read_opts;
00688 
00689 /** Produces a set of image read options, initialized with default values.
00690     @since 0.1.0
00691     @param o the newly created option set object
00692     @param flag  Bitfield for control purposes. Submit 0 for now.
00693     @return 1=ok , <0 = failure
00694 */
00695 int isoburn_ropt_new(struct isoburn_read_opts **o, int flag);
00696 
00697 
00698 /** Deletes an option set which was created by isoburn_ropt_new().
00699     @since 0.1.0
00700     @param o The option set to work on
00701     @param flag  Bitfield for control purposes. Submit 0 for now.
00702     @return 1= **o destroyed , 0= *o was already NULL (harmless)
00703 */
00704 int isoburn_ropt_destroy(struct isoburn_read_opts **o, int flag);
00705 
00706 
00707 /** Which existing ISO 9660 extensions in the image to read or not to read.
00708     Whether to read the content of an existing image at all.
00709     The bits can be combined by | resp. inquired by &.
00710     @since 0.1.0
00711     @param ext Bitfield:
00712                bit0= norock
00713                      Do not read Rock Ridge extensions
00714                bit1= nojoliet
00715                      Do not read Joliet extensions
00716                bit2= noiso1999
00717                      Do not read ISO 9660:1999 enhanced tree
00718                bit3= preferjoliet
00719                      When both Joliet and RR extensions are present, the RR
00720                      tree is used. If you prefer using Joliet, set this to 1.
00721                bit4= pretend_blank
00722                      Always create empty image.Ignore any image on input drive.
00723                bit5= noaaip
00724                      @since 0.3.4
00725                      Do not load AAIP information from image. This information
00726                      eventually contains ACL or XFS-style Extended Attributes.
00727                bit6= noacl
00728                      @since 0.3.4
00729                      Do not obtain ACL from external filesystem objects (e.g.
00730                      local filesystem files).
00731                bit7= noea
00732                      @since 0.3.4
00733                      Do not obtain XFS-style Extended Attributes from external
00734                      filesystem objects (e.g.  local filesystem files).
00735                bit8= noino
00736                      @since 0.4.0
00737                      Do not load eventual inode numbers from RRIP entry PX,
00738                      but generate a new unique inode number for each imported
00739                      IsoNode object.
00740                      PX inode numbers allow to mark families of hardlinks by
00741                      giving all family members the same inode number. libisofs
00742                      keeps the PX inode numbers unaltered when IsoNode objects
00743                      get written into an ISO image.
00744                bit9= nomd5
00745                      @since 0.4.2
00746                      Do not load the eventual MD5 checksum array.
00747     @return    1 success, <=0 failure
00748 */
00749 #define isoburn_ropt_norock         1
00750 #define isoburn_ropt_nojoliet       2
00751 #define isoburn_ropt_noiso1999      4
00752 #define isoburn_ropt_preferjoliet   8
00753 #define isoburn_ropt_pretend_blank 16
00754 #define isoburn_ropt_noaaip        32
00755 #define isoburn_ropt_noacl         64
00756 #define isoburn_ropt_noea         128
00757 #define isoburn_ropt_noino        256
00758 #define isoburn_ropt_nomd5        512
00759 
00760 int isoburn_ropt_set_extensions(struct isoburn_read_opts *o, int ext);
00761 int isoburn_ropt_get_extensions(struct isoburn_read_opts *o, int *ext);
00762 
00763 
00764 /** Default attributes to use if no RockRidge extension gets loaded.
00765     @since 0.1.0
00766     @param o    The option set to work on
00767     @param uid  user id number (see /etc/passwd)
00768     @param gid  group id number (see /etc/group)
00769     @param mode  permissions (not file type) as of man 2 stat.
00770                  With directories, r-permissions will automatically imply
00771                  x-permissions. See isoburn_ropt_set_default_dirperms() below.
00772     @return      1 success, <=0 failure
00773 */
00774 int isoburn_ropt_set_default_perms(struct isoburn_read_opts *o,
00775                                    uid_t uid, gid_t gid, mode_t mode);
00776 int isoburn_ropt_get_default_perms(struct isoburn_read_opts *o,
00777                                    uid_t *uid, gid_t *gid, mode_t *mode);
00778 
00779 /** Default attributes to use on directories if no RockRidge extension
00780     gets loaded.
00781     Above call isoburn_ropt_set_default_perms() automatically adds
00782     x-permissions to r-permissions for directories. This call here may
00783     be done afterwards to set independend permissions for directories,
00784     especially to override the automatically added x-permissions.
00785     @since 0.1.0
00786     @param o    The option set to work on
00787     @param mode permissions (not file type) as of man 2 stat.
00788     @return     1 success, <=0 failure
00789 */
00790 int isoburn_ropt_set_default_dirperms(struct isoburn_read_opts *o,
00791                                       mode_t mode);
00792 int isoburn_ropt_get_default_dirperms(struct isoburn_read_opts *o,
00793                                       mode_t *mode);
00794 
00795 
00796 
00797 /** Set the character set for reading RR file names from ISO images.
00798     @since 0.1.0
00799     @param o             The option set to work on
00800     @param input_charset Set this to NULL to use the default locale charset
00801                          For selecting a particular character set, submit its
00802                          name, e.g. as listed by program iconv -l.
00803                          Example: "UTF-8". 
00804     @return              1 success, <=0 failure
00805 */
00806 int isoburn_ropt_set_input_charset(struct isoburn_read_opts *o,
00807                                    char *input_charset);
00808 int isoburn_ropt_get_input_charset(struct isoburn_read_opts *o,
00809                                    char **input_charset);
00810 
00811 /**
00812     Enable or disable methods to automatically choose an input charset.
00813     This eventually overrides the name set via isoburn_ropt_set_input_charset()
00814     @since 0.3.8
00815     @param o      The option set to work on
00816     @param mode   Bitfield for control purposes:
00817                   bit0= allow to set the input character set automatically from
00818                         attribute "isofs.cs" of root directory.
00819                   Submit any other bits with value 0.
00820     @return       1 success, <=0 failure
00821  */
00822 int isoburn_ropt_set_auto_incharset(struct isoburn_read_opts *o, int mode);
00823 int isoburn_ropt_get_auto_incharset(struct isoburn_read_opts *o, int *mode);
00824 
00825 
00826 /** After calling function isoburn_read_image() there are informations
00827     available in the option set.
00828     This info can be obtained as bits in parameter has_what. Like:
00829       joliet_available = (has_what & isoburn_ropt_has_joliet);
00830     @since 0.1.0
00831     @param o     The option set to work on
00832     @param size  Number of image data blocks, 2048 bytes each.
00833     @param has_what Bitfield:
00834            bit0= has_rockridge
00835                  RockRidge extension info is available (POSIX filesystem)
00836            bit1= has_joliet
00837                  Joliet extension info is available (suitable for MS-Windows)
00838            bit2= has_iso1999
00839                  ISO version 2 Enhanced Volume Descriptor is available.
00840                  This is rather exotic.
00841            bit3= has_el_torito
00842                  El-Torito boot record is present
00843     @return  1 success, <=0 failure
00844 */
00845 #define isoburn_ropt_has_rockridge 1
00846 #define isoburn_ropt_has_joliet    2
00847 #define isoburn_ropt_has_iso1999   4
00848 #define isoburn_ropt_has_el_torito 8
00849 
00850 /* ts A90122 */
00851 /* >>> to be implemented:
00852 #define isoburn_ropt_has_acl          64
00853 #define isoburn_ropt_has_ea          128
00854 */
00855 
00856 int isoburn_ropt_get_size_what(struct isoburn_read_opts *o,
00857                                uint32_t *size, int *has_what);
00858 
00859 
00860 /* ----------------------------------------------------------------------- */
00861 /*                      End of Options for image reading                   */
00862 /* ----------------------------------------------------------------------- */
00863 
00864 /* ----------------------------------------------------------------------- */
00865 /*
00866 
00867   Options for image generation by libisofs and image transport to libburn.
00868 
00869   An application shall create an option set by isoburn_igopt_new(),
00870   program it by isoburn_igopt_set_*(), use it with either
00871   isoburn_prepare_new_image() or isoburn_prepare_disc(), and finally delete
00872   it by isoburn_igopt_destroy().
00873 
00874 */
00875 /* ----------------------------------------------------------------------- */
00876 
00877 struct isoburn_imgen_opts;
00878 
00879 /** Produces a set of generation and transfer options, initialized with default
00880     values.
00881     @since 0.1.0
00882     @param o the newly created option set object
00883     @param flag  Bitfield for control purposes. Submit 0 for now.
00884     @return 1=ok , <0 = failure
00885 */
00886 int isoburn_igopt_new(struct isoburn_imgen_opts **o, int flag);
00887 
00888 
00889 /** Deletes an option set which was created by isoburn_igopt_new().
00890     @since 0.1.0
00891     @param o     The option set to give up
00892     @param flag  Bitfield for control purposes. Submit 0 for now.
00893     @return 1= **o destroyed , 0= *o was already NULL (harmless)
00894 */
00895 int isoburn_igopt_destroy(struct isoburn_imgen_opts **o, int flag);
00896 
00897 
00898 /** ISO level to write at.
00899     @since 0.1.0
00900     @param o     The option set to work on
00901     @param level is a term of the ISO 9660 standard. It should be one of:
00902                  1= filenames restricted to form 8.3
00903                  2= filenames allowed up to 31 characters
00904     @return      1 success, <=0 failure
00905 */
00906 int isoburn_igopt_set_level(struct isoburn_imgen_opts *o, int level);
00907 int isoburn_igopt_get_level(struct isoburn_imgen_opts *o, int *level);
00908 
00909 
00910 /** Which extensions to support.
00911     @since 0.1.0
00912     @param o     The option set to work on
00913     @param ext Bitfield:
00914            bit0= rockridge
00915                  Rock Ridge extensions add POSIX file attributes like
00916                  owner, group, access permissions, long filenames. Very
00917                  advisable if the designed audience has Unix style systems.
00918            bit1= joliet
00919                  Longer filenames for Windows systems.
00920                  Weaker than RockRidge, but also readable with GNU/Linux.
00921            bit2= iso1999
00922                  This is rather exotic. Better do not surprise the readers.
00923            bit3= hardlinks
00924                  Enable hardlink consolidation. IsoNodes which refer to the
00925                  same source object and have the same properties will get
00926                  the same ISO image inode numbers.
00927                  If combined with isoburn_igopt_rrip_version_1_10 below,
00928                  then the PX entry layout of RRIP-1.12 will be used within
00929                  RRIP-1.10 (mkisofs does this without causing visible trouble).
00930            bit5= aaip
00931                  The libisofs specific SUSP based extension of ECMA-119 which
00932                  can encode ACL and XFS-style Extended Attributes.
00933            bit6= session_md5
00934                  @since 0.4.2
00935                  Produce and write a MD5 checksum of the whole session stream.
00936            bit7= file_md5
00937                  @since 0.4.2
00938                  Produce and write MD5 checksums for each single IsoFile.
00939            bit8= file_stability (only together with file_md5)
00940                  @since 0.4.2
00941                  Compute MD5 of each file before copying it into the image and
00942                  compare this with the MD5 of the actual copying. If they do
00943                  not match then issue MISHAP event.
00944                  See also libisofs.h  iso_write_opts_set_record_md5()
00945     @return 1 success, <=0 failure
00946 */
00947 #define isoburn_igopt_rockridge         1
00948 #define isoburn_igopt_joliet            2
00949 #define isoburn_igopt_iso1999           4
00950 #define isoburn_igopt_hardlinks         8
00951 #define isoburn_igopt_aaip             32
00952 #define isoburn_igopt_session_md5      64
00953 #define isoburn_igopt_file_md5        128
00954 #define isoburn_igopt_file_stability  256
00955 int isoburn_igopt_set_extensions(struct isoburn_imgen_opts *o, int ext);
00956 int isoburn_igopt_get_extensions(struct isoburn_imgen_opts *o, int *ext);
00957 
00958 /** Relaxed constraints. Setting any of the bits to 1 break the specifications,
00959     but it is supposed to work on most moderns systems. Use with caution.
00960     @since 0.1.0
00961     @param o     The option set to work on
00962     @param relax Bitfield:
00963            bit0= omit_version_numbers
00964                  Omit the version number (";1") at the end of the
00965                  ISO-9660 and Joliet identifiers.
00966                  Version numbers are usually not used by readers.
00967            bit1= allow_deep_paths
00968                  Allow ISO-9660 directory hierarchy to be deeper
00969                  than 8 levels.
00970            bit2= allow_longer_paths
00971                  Allow path in the ISO-9660 tree to have more than
00972                  255 characters.
00973            bit3= max_37_char_filenames
00974                  Allow a single file or directory hierarchy to have
00975                  up to 37 characters. This is larger than the 31
00976                  characters allowed by ISO level 2, and the extra space
00977                  is taken from the version number, so this also forces
00978                  omit_version_numbers.
00979            bit4= no_force_dots
00980                  ISO-9660 forces filenames to have a ".", that separates
00981                  file name from extension. libisofs adds it if original
00982                  filename has none. Set this to 1 to prevent this
00983                  behavior.
00984            bit5= allow_lowercase 
00985                  Allow lowercase characters in ISO-9660 filenames.
00986                  By default, only uppercase characters, numbers and
00987                  a few other characters are allowed.
00988            bit6= allow_full_ascii
00989                  Allow all ASCII characters to be appear on an ISO-9660
00990                  filename. Note * that "/" and "\0" characters are never
00991                  allowed, even in RR names.
00992            bit7= joliet_longer_paths
00993                  Allow paths in the Joliet tree to have more than
00994                  240 characters.
00995            bit8= always_gmt
00996                  Write timestamps as GMT although the specs prescribe local
00997                  time with eventual non-zero timezone offset. Negative
00998                  timezones (west of GMT) can trigger bugs in some operating
00999                  systems which typically appear in mounted ISO images as if
01000                  the timezone shift from GMT was applied twice
01001                  (e.g. in New York 22:36 becomes 17:36).
01002            bit9= rrip_version_1_10
01003                  Write Rock Ridge info as of specification RRIP-1.10 rather
01004                  than RRIP-1.12: signature "RRIP_1991A" rather than
01005                  "IEEE_1282", field PX without file serial number.
01006           bit10= dir_rec_mtime
01007                  Store as ECMA-119 Directory Record timestamp the mtime
01008                  of the source rather than the image creation time.
01009           bit11= aaip_susp_1_10
01010                  Write AAIP fields without announcing AAIP by an ER field and
01011                  without distinguishing RRIP fields from the AAIP field by
01012                  prefixed ES fields. This saves 5 to 10 bytes per file and
01013                  might avoid problems with readers which only accept RRIP.
01014                  SUSP-1.10 allows it, SUSP-1.12 frowns on it.
01015           bit12= only_iso_numbers
01016                  Same as bit1 omit_version_number but restricted to the names
01017                  in the eventual Joliet tree.
01018                  @since 0.5.4
01019                  For reasons of backward compatibility it is not possible yet
01020                  to disable version numbers for ISO 9660 while enabling them
01021                  for Joliet. 
01022           bit13= no_j_force_dots
01023                  Same as no_force_dots but affecting the names in the eventual
01024                  Joliet tree rather than the ISO 9660 / ECMA-119 names.
01025                  @since 0.5.4
01026                  Previous versions added dots to Joliet names unconditionally.
01027     @return 1 success, <=0 failure
01028 */
01029 #define isoburn_igopt_omit_version_numbers       1
01030 #define isoburn_igopt_allow_deep_paths           2
01031 #define isoburn_igopt_allow_longer_paths         4
01032 #define isoburn_igopt_max_37_char_filenames      8
01033 #define isoburn_igopt_no_force_dots             16
01034 #define isoburn_igopt_allow_lowercase           32
01035 #define isoburn_igopt_allow_full_ascii          64
01036 #define isoburn_igopt_joliet_longer_paths      128
01037 #define isoburn_igopt_always_gmt               256
01038 #define isoburn_igopt_rrip_version_1_10        512
01039 #define isoburn_igopt_dir_rec_mtime           1024
01040 #define isoburn_igopt_aaip_susp_1_10          2048
01041 #define isoburn_igopt_only_iso_versions       4096
01042 #define isoburn_igopt_no_j_force_dots         8192
01043 int isoburn_igopt_set_relaxed(struct isoburn_imgen_opts *o, int relax);
01044 int isoburn_igopt_get_relaxed(struct isoburn_imgen_opts *o, int *relax);
01045 
01046 
01047 /** Whether and how files should be sorted.
01048     @since 0.1.0
01049     @param o     The option set to work on
01050     @param value Bitfield: bit0= sort_files_by_weight
01051                                  files should be sorted based on their weight.
01052                                  Weight is attributed to files in the image
01053                                  by libisofs call iso_node_set_sort_weight().
01054     @return 1 success, <=0 failure
01055 */
01056 #define isoburn_igopt_sort_files_by_weight        1
01057 int isoburn_igopt_set_sort_files(struct isoburn_imgen_opts *o, int value);
01058 int isoburn_igopt_get_sort_files(struct isoburn_imgen_opts *o, int *value);
01059 
01060 
01061 /** Set the override values for files and directory permissions.
01062     The parameters replace_* these take one of three values: 0, 1 or 2.
01063     If 0, the corresponding attribute will be kept as set in the IsoNode
01064     at the time of image generation.
01065     If set to 1, the corresponding attrib. will be changed by a default
01066     suitable value.
01067     With value 2, the attrib. will be changed with the value specified
01068     in the corresponding *_mode options. Note that only the permissions
01069     are set, the file type remains unchanged.
01070     @since 0.1.0
01071     @param o                 The option set to work on
01072     @param replace_dir_mode  whether and how to override directories
01073     @param replace_file_mode whether and how to override files of other type
01074     @param dir_mode          Mode to use on dirs with replace_dir_mode == 2.
01075     @param file_mode;        Mode to use on files with replace_file_mode == 2.
01076     @return 1 success, <=0 failure
01077 */
01078 int isoburn_igopt_set_over_mode(struct isoburn_imgen_opts *o,
01079                                int replace_dir_mode, int replace_file_mode,
01080                                mode_t dir_mode, mode_t file_mode);
01081 int isoburn_igopt_get_over_mode(struct isoburn_imgen_opts *o,
01082                                int *replace_dir_mode, int *replace_file_mode,
01083                                mode_t *dir_mode, mode_t *file_mode);
01084 
01085 /** Set the override values values for group id and user id.
01086     The rules are like with above overriding of mode values. replace_* controls
01087     whether and how. The other two parameters provide values for eventual use.
01088     @since 0.1.0
01089     @param o                 The option set to work on
01090     @param replace_uid       whether and how to override user ids
01091     @param replace_gid       whether and how to override group ids
01092     @param uid               User id to use with replace_uid == 2.
01093     @param gid               Group id to use on files with replace_gid == 2.
01094     @return 1 success, <=0 failure
01095 */
01096 int isoburn_igopt_set_over_ugid(struct isoburn_imgen_opts *o,
01097                                int replace_uid, int replace_gid,
01098                                uid_t uid, gid_t gid);
01099 int isoburn_igopt_get_over_ugid(struct isoburn_imgen_opts *o,
01100                                int *replace_uid, int *replace_gid,
01101                                uid_t *uid, gid_t *gid);
01102 
01103 /** Set the charcter set to use for representing filenames in the image.
01104     @since 0.1.0
01105     @param o              The option set to work on
01106     @param output_charset Set this to NULL to use the default output charset.
01107                           For selecting a particular character set, submit its
01108                           name, e.g. as listed by program iconv -l.
01109                           Example: "UTF-8". 
01110     @return 1 success, <=0 failure
01111 */
01112 int isoburn_igopt_set_out_charset(struct isoburn_imgen_opts *o,
01113                                  char *output_charset);
01114 int isoburn_igopt_get_out_charset(struct isoburn_imgen_opts *o,
01115                                  char **output_charset);
01116 
01117 
01118 /** The number of bytes to be used for the fifo which decouples libisofs
01119     and libburn for better throughput and for reducing the risk of
01120     interrupting signals hitting the libburn thread which operates the
01121     MMC drive.
01122     The size will be rounded up to the next full 2048.
01123     Minimum is 64kiB, maximum is 1 GiB (but that is too much anyway).
01124     @since 0.1.0
01125     @param o          The option set to work on
01126     @param fifo_size  Number of bytes to use
01127     @return 1 success, <=0 failure
01128 */
01129 int isoburn_igopt_set_fifo_size(struct isoburn_imgen_opts *o, int fifo_size);
01130 int isoburn_igopt_get_fifo_size(struct isoburn_imgen_opts *o, int *fifo_size);
01131 
01132 
01133 /** Obtain after image preparation the block address where the session will
01134     start on media.
01135     This value cannot be set by the application but only be inquired.
01136     @since 0.1.4
01137     @param o          The option set to work on
01138     @param lba        The block number of the session start on media.
01139                       <0 means that no address has been determined yet.
01140     @return 1 success, <=0 failure
01141 */
01142 int isoburn_igopt_get_effective_lba(struct isoburn_imgen_opts *o, int *lba);
01143 
01144 
01145 /** Obtain after image preparation the lowest block address of file content
01146     data. Failure can occur if libisofs is too old to provide this information,
01147     if the result exceeds 31 bit, or if the call is made before image
01148     preparation.
01149     This value cannot be set by the application but only be inquired.
01150     @since 0.3.6
01151     @param o          The option set to work on
01152     @param lba        The block number of the session start on media.
01153                       <0 means that no address has been determined yet.
01154     @return 1 success, <=0 failure
01155 */
01156 int isoburn_igopt_get_data_start(struct isoburn_imgen_opts *o, int *lba);
01157 
01158 
01159 /** Set resp. get parameters "name" and "timestamp" for a scdbackup checksum
01160     tag. It will be appended to the libisofs session tag if the image starts at
01161     LBA 0. See isoburn_disc_track_lba_nwa. The scdbackup tag can be used
01162     to verify the image by command scdbackup_verify <device> -auto_end.
01163     See scdbackup/README appendix VERIFY for its inner details.
01164     @since 0.4.4
01165     @param o          The option set to work on
01166     @param name       The tag name. 80 characters max.
01167     @param timestamp  A string of up to 13 characters YYMMDD.hhmmss
01168                       A9 = 2009, B0 = 2010, B1 = 2011, ... C0 = 2020, ...
01169     @param tag_written Either NULL or the address of an array with at least 512
01170                       characters. In the latter case the eventually produced
01171                       scdbackup tag will be copied to this array when the image
01172                       gets written. This call sets scdbackup_tag_written[0] = 0
01173                       to mark its preliminary invalidity.
01174     @return 1 success, <=0 failure
01175  */
01176 int isoburn_igopt_set_scdbackup_tag(struct isoburn_imgen_opts *o, char *name,
01177                                     char *timestamp, char *tag_written);
01178 int isoburn_igopt_get_scdbackup_tag(struct isoburn_imgen_opts *o,
01179                                     char name[81], char timestamp[19],
01180                                     char **tag_written);
01181 
01182 
01183 /** Attach 32 kB of binary data which shall get written to the first 32 kB
01184     of the ISO image, the System Area.
01185     options can cause manipulations of these data before writing happens.
01186     If system area data are giveni or options bit0 is set, then bit1 of
01187     el_torito_set_isolinux_options() is automatically disabled.
01188     @since 0.5.4
01189     @param o        The option set to work on
01190     @param data     Either NULL or 32 kB of data. Do not submit less bytes !
01191     @param options  Can cause manipulations of submitted data before they
01192                     get written:
01193                     bit0= apply a --protective-msdos-label as of grub-mkisofs.
01194                           This means to patch bytes 446 to 512 of the system
01195                           area so that one partition is defined which begins
01196                           at the second 512-byte block of the image and ends
01197                           where the image ends.
01198                           This works with and without system_area_data.
01199                     bit1= apply isohybrid MBR patching to the system area.
01200                           This works only with system area data from
01201                           SYSLINUX plus an ISOLINUX boot image (see
01202                           iso_image_set_boot_image()) and only if not bit0
01203                           is set.
01204     @return 1 success, 0 no data to get, <0 failure
01205 */
01206 int isoburn_igopt_set_system_area(struct isoburn_imgen_opts *o,
01207                                   char data[32768], int options);
01208 int isoburn_igopt_get_system_area(struct isoburn_imgen_opts *o,
01209                                   char data[32768], int *options);
01210 
01211 /** Explicitely set the four timestamps of the emerging ISO image.
01212     Default with all parameters is 0.
01213     @since 0.5.4
01214     ECMA-119 defines the timestamps in the Primary Volume Descriptor as:
01215     @param creation_time
01216            When "the information in the volume was created."
01217            A value of 0 means that the timepoint of write start is to be used.
01218     @param modification_time
01219            When "the informationin the volume was last modified."
01220            A value of 0 means that the timepoint of write start is to be used.
01221     @param expiration_time
01222            When "the information in the volume may be regarded as obsolete."
01223            A value of 0 means that the information never shall expire.
01224     @param effective_time
01225            When "the information in the volume may be used."
01226            A value of 0 means that not such retention is intended.
01227     @param uuid
01228            If this text is not empty, then it overrides vol_modification_time
01229            by copying the first 16 decimal digits from uuid, eventually
01230            padding up with decimal '1', and writing a NUL-byte as timezone GMT.
01231            It should express a reasonable time in form  YYYYMMDDhhmmsscc
01232            E.g.:  2010040711405800 = 7 Apr 2010 11:40:58 (+0 centiseconds)
01233     @return 1 success, <=0 failure
01234  */
01235 int isoburn_igopt_set_pvd_times(struct isoburn_imgen_opts *opts,
01236                         time_t creation_time, time_t modification_time,
01237                         time_t expiration_time, time_t effective_time,
01238                         char *uuid);
01239 int isoburn_igopt_get_pvd_times(struct isoburn_imgen_opts *opts,
01240                       time_t *creation_time, time_t *modification_time,
01241                       time_t *expiration_time, time_t *effective_time,
01242                       char uuid[17]);
01243 
01244 /* ----------------------------------------------------------------------- */
01245 /*                      End of Options for image generation                */
01246 /* ----------------------------------------------------------------------- */
01247 
01248 
01249 /** Get the image attached to a drive, if any.
01250     @since 0.1.0
01251     @param d The drive to inquire
01252     @return A reference to attached image, or NULL if the drive has no image
01253             attached. This reference needs to be released via iso_image_unref()
01254             when it is not longer needed.
01255 */
01256 IsoImage *isoburn_get_attached_image(struct burn_drive *d);
01257 
01258 
01259 /** Load the ISO filesystem directory tree from the media in the given drive.
01260     This will give libisoburn the base on which it can let libisofs perform
01261     image growing or image modification. The loaded volset gets attached
01262     to the drive object and handed out to the application.
01263     Not a wrapper, but peculiar to libisoburn.
01264     @since 0.1.0
01265     @param d The drive which holds an existing ISO filesystem or blank media.
01266              d is allowed to be NULL which produces an empty ISO image. In
01267              this case one has to call before writing isoburn_attach_volset()
01268              with the volset from this call and with the intended output
01269              drive.
01270     @param read_opts The read options which can be chosen by the application
01271     @param image the image read, if the disc is blank it will have no files.
01272              This reference needs to be released via iso_image_unref() when
01273              it is not longer needed. The drive, if not NULL, will hold an
01274              own reference which it will release when it gets a new volset
01275              or when it gets released via isoburn_drive_release().
01276              You can pass NULL if you already have a reference or you plan to
01277              obtain it later with isoburn_get_attached_image(). Of course, if
01278              you haven't specified a valid drive (i.e., if d == NULL), this
01279              parameter can't be NULL.
01280     @return <=0 error , 1 = success
01281 */
01282 int isoburn_read_image(struct burn_drive *d,
01283                        struct isoburn_read_opts *read_opts,
01284                        IsoImage **image);
01285 
01286 /** Set a callback function for producing pacifier messages during the lengthy
01287     process of image reading. The callback function and the application handle
01288     are stored until they are needed for the underlying call to libisofs.
01289     Other than with libisofs the handle is managed entirely by the application.
01290     An idle .free() function is exposed to libisofs. The handle has to stay
01291     valid until isoburn_read_image() is done. It has to be detached by
01292       isoburn_set_read_pacifier(drive, NULL, NULL);
01293     before it may be removed from memory.
01294     @since 0.1.0
01295     @param drive  The drive which will be used with isoburn_read_image()
01296                   It has to be aquired by an isoburn_* wrapper call.
01297     @param read_pacifier  The callback function
01298     @param app_handle  The app handle which the callback function can obtain
01299                        via iso_image_get_attached_data() from its IsoImage*
01300     @return 1 success, <=0 failure
01301 */
01302 int isoburn_set_read_pacifier(struct burn_drive *drive,
01303                               int (*read_pacifier)(IsoImage*, IsoFileSource*),
01304                               void *app_handle);
01305 
01306 
01307 /** Set the IsoImage to be used with a drive. This eventually releases
01308     the reference to the old IsoImage attached to the drive.
01309     Caution: Use with care. It hardly makes sense to replace an image that
01310              reflects a valid ISO image on media.
01311     This call is rather intended for writing a newly created and populated
01312     image to blank media. The use case in xorriso is to let an image survive
01313     the change or demise of the outdev target drive. 
01314     @since 0.1.0
01315     @param d The drive which shall be write target of the volset.
01316     @param image The image that represents the image to be written.
01317              This image pointer MUST already be a valid reference suitable
01318              for iso_image_unref().
01319              It may have been obtained by appropriate libisofs calls or by
01320              isoburn_read_image() with d==NULL.
01321     @return <=0 error , 1 = success
01322 */ 
01323 int isoburn_attach_image(struct burn_drive *d, IsoImage *image);
01324 
01325 
01326 /** Return the best possible estimation of the currently available capacity of
01327     the media. This might depend on particular write option settings and on
01328     drive state.
01329     An eventual start address for emulated multi-session will be subtracted
01330     from the capacity estimation given by burn_disc_available_space().
01331     Negative results get defaulted to 0.
01332     Wrapper for: burn_disc_available_space()
01333     @since 0.1.0
01334     @param d The drive to query.
01335     @param o If not NULL: write parameters to be set on drive before query
01336     @return number of most probably available free bytes
01337 */
01338 off_t isoburn_disc_available_space(struct burn_drive *d,
01339                                    struct burn_write_opts *o);
01340 
01341 
01342 /** Obtain the start block number of the most recent session on media. In
01343     case of random access media this will normally be 0. Successfull return is
01344     not a guarantee that there is a ISO-9660 image at all. The call will fail,
01345     nevertheless,if isoburn_disc_get_status() returns not BURN_DISC_APPENDABLE
01346     or BURN_DISC_FULL.
01347     Note: The result of this call may be fabricated by a previous call of
01348     isoburn_set_msc1() which can override the rule to load the most recent
01349     session.
01350     Wrapper for: burn_disc_get_msc1()
01351     @since 0.1.0
01352     @param d         The drive to inquire
01353     @param start_lba Contains on success the start address in 2048 byte blocks
01354     @return <=0 error , 1 = success
01355 */
01356 int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba);
01357 
01358 
01359 /** Use this with trackno==0 to obtain the predicted start block number of the
01360     new session. The interesting number is returned in parameter nwa.
01361     Wrapper for: burn_disc_track_lba_nwa()
01362     @since 0.1.0
01363     @param d         The drive to inquire
01364     @param o If not NULL: write parameters to be set on drive before query
01365     @param trackno Submit 0.
01366     @param lba return value: start lba
01367     @param nwa return value: Next Writeable Address
01368     @return 1=nwa is valid , 0=nwa is not valid , -1=error
01369 */
01370 int isoburn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o,
01371                                int trackno, int *lba, int *nwa);
01372 
01373 
01374 /** Obtain the size which was attributed to an emulated appendable on actually
01375     overwriteable media. This value is supposed to be <= 2048 * nwa as of
01376     isoburn_disc_track_lba_nwa().
01377     @since 0.1.0
01378     @param d     The drive holding the media.
01379     @param start_byte The reply value counted in bytes, not in sectors.
01380     @param flag  Unused yet. Submit 0.
01381     @return 1=stat_byte is valid, 0=not an emulated appendable, -1=error 
01382 */
01383 int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte,
01384                                int flag);
01385 
01386 
01387 /** To choose the expansion method of Growing:
01388     Create a disc object for writing the new session from the created or loaded
01389     iso_volset which has been manipulated via libisofs, to the same media from
01390     where the image was eventually loaded. This struct burn_disc is ready for
01391     use by a subsequent call to isoburn_disc_write().
01392     After this asynchronous writing has ended and the drive is BURN_DRIVE_IDLE
01393     again, the burn_disc object has to be disposed by burn_disc_free().
01394     @since 0.1.0
01395     @param drive The combined source and target drive, grabbed with
01396                  isoburn_drive_scan_and_grab(). .
01397     @param disc Returns the newly created burn_disc object.
01398     @param opts Image generation options, see isoburn_igopt_*()
01399     @return <=0 error , 1 = success
01400 */
01401 int isoburn_prepare_disc(struct burn_drive *drive, struct burn_disc **disc,
01402                          struct isoburn_imgen_opts *opts);
01403 
01404 
01405 /** To choose the expansion method of Modifying:
01406     Create a disc object for producing a new image from a previous image
01407     plus the changes made by user. The generated burn_disc is suitable
01408     to be written to a grabbed drive with blank writeable media.
01409     But you must not use the same drive for input and output, because data
01410     will be read from the source drive while at the same time the target
01411     drive is already writing.
01412     The resulting burn_disc object has to be disposed when all its writing
01413     is done and the drive is BURN_DRIVE_IDLE again after asynchronous
01414     burn_disc_write().
01415     @since 0.1.0
01416     @param in_drive The input drive, grabbed with isoburn_drive_aquire() or
01417                     one of its alternatives.
01418     @param disc     Returns the newly created burn_disc object.
01419     @param opts     Options for image generation and data transport to media.
01420     @param out_drive The output drive, from isoburn_drive_aquire() et.al..
01421     @return <=0 error , 1 = success
01422 */
01423 int isoburn_prepare_new_image(struct burn_drive *in_drive,
01424                               struct burn_disc **disc,
01425                               struct isoburn_imgen_opts *opts,
01426                               struct burn_drive *out_drive);
01427 
01428 
01429 /** To choose the expansion method of Blind Growing:
01430     Create a disc object for writing an add-on session from the created or
01431     loaded IsoImage which has been manipulated via libisofs, to a different
01432     drive than the one from where it was loaded.
01433     Usually output will be stdio:/dev/fd/1 (i.e. stdout) being piped
01434     into some burn program like with this classic gesture:
01435       mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev
01436     Parameter translation into libisoburn:
01437       $dev  is the address by which parameter in_drive of this call was aquired
01438       $msc1 was set by isoburn_set_msc1() before image reading
01439             or was detected from the in_drive media
01440       $nwa  is a parameter of this call
01441             or can be used as detected from the in_drive media
01442 
01443     This call waits for libisofs output to become available and then detaches
01444     the input drive object from the data source object by which libisofs was
01445     reading from the input drive.
01446     So, as far as libisofs is concerned, that drive may be released immediately
01447     after this call in order to allow the consumer to access the drive for
01448     writing.
01449     The consumer should wait for input to become available and only then open
01450     its burn drive. With cdrecord this is caused by option -waiti.
01451   
01452     The resulting burn_disc object has to be disposed when all its writing
01453     is done and the drive is BURN_DRIVE_IDLE again after asynchronous
01454     burn_disc_write().
01455     @since 0.2.2
01456     @param in_drive The input drive,grabbed with isoburn_drive_scan_and_grab().
01457     @param disc     Returns the newly created burn_disc object.
01458     @param opts     Options for image generation and data transport to media.
01459     @param out_drive The output drive, from isoburn_drive_aquire() et.al..
01460                     typically stdio:/dev/fd/1 .
01461     @param nwa      The address (2048 byte block count) where the add-on
01462                     session will be finally stored on a mountable media
01463                     or in a mountable file.
01464                     If nwa is -1 then the address is used as determined from
01465                     the in_drive media.
01466     @return <=0 error , 1 = success
01467 */
01468 int isoburn_prepare_blind_grow(struct burn_drive *in_drive,
01469                                struct burn_disc **disc,
01470                                struct isoburn_imgen_opts *opts,
01471                                struct burn_drive *out_drive, int nwa);
01472 
01473 
01474 /**
01475     Revoke isoburn_prepare_*() instead of running isoburn_disc_write().
01476     libisofs reserves resources and maybe already starts generating the
01477     image stream when one of above three calls is performed. It is mandatory to
01478     either run isoburn_disc_write() or to revoke the preparations by the
01479     call described here.
01480     @since 0.1.0
01481     @param input_drive   The drive resp. in_drive which was used with the
01482                          preparation call.
01483     @param output_drive  The out_drive used with isoburn_prepare_new_image(),
01484                          NULL if none.
01485     @param flag Bitfield, submit 0 for now.
01486                 bit0= -reserved for internal use-
01487     @return     <0 error, 0= no pending preparations detectable, 1 = canceled
01488 */
01489 int isoburn_cancel_prepared_write(struct burn_drive *input_drive,
01490                                   struct burn_drive *output_drive, int flag);
01491 
01492 
01493 /** Start writing of the new session.
01494     This call is asynchrounous. I.e. it returns quite soon and the progress has
01495     to be watched by a loop with call burn_drive_get_status() until
01496     BURN_DRIVE_IDLE is returned.
01497     Wrapper for: burn_disc_write()
01498     @since 0.1.0
01499     @param o    Options which control the burn process. See burnwrite_opts_*()
01500                 in libburn.h.
01501     @param disc Disc object created either by isoburn_prepare_disc() or by
01502                 isoburn_prepare_new_image().
01503 */
01504 void isoburn_disc_write(struct burn_write_opts *o, struct burn_disc *disc);
01505 
01506 
01507 /** Inquire state and fill parameters of the fifo which is attached to
01508     the emerging track. This should be done in the pacifier loop while
01509     isoburn_disc_write() or burn_disc_write() are active.
01510     This works only with drives obtained by isoburn_drive_scan_and_grab()
01511     or isoburn_drive_grab(). If isoburn_prepare_new_image() was used, then
01512     parameter out_drive must have announced the track output drive.
01513     Hint: If only burn_write_opts and not burn_drive is known, then the drive
01514           can be obtained by burn_write_opts_get_drive().
01515     @since 0.1.0
01516     @param d     The drive to which the track with the fifo gets burned.
01517     @param size  The total size of the fifo
01518     @param free_bytes  The current free capacity of the fifo
01519     @param status_text  Returns a pointer to a constant text, see below
01520     @return  <0 reply invalid, >=0 fifo status code:
01521              bit0+1=input status, bit2=consumption status, i.e:
01522              0="standby"   : data processing not started yet
01523              1="active"    : input and consumption are active
01524              2="ending"    : input has ended without error
01525              3="failing"   : input had error and ended,
01526              4="unused"    : ( consumption has ended before processing start )
01527              5="abandoned" : consumption has ended prematurely
01528              6="ended"     : consumption has ended without input error
01529              7="aborted"   : consumption has ended after input error
01530 */
01531 int isoburn_get_fifo_status(struct burn_drive *d, int *size, int *free_bytes,
01532                             char **status_text);
01533 
01534 
01535 /** Inquire whether the most recent write run was successful.
01536     Wrapper for: burn_drive_wrote_well()
01537     @since 0.1.0
01538     @param d  The drive to inquire
01539     @return   1=burn seems to have went well, 0=burn failed
01540 */
01541 int isoburn_drive_wrote_well(struct burn_drive *d);
01542 
01543 
01544 /** Call this after isoburn_disc_write has finished and burn_drive_wrote_well()
01545     indicates success. It will eventually complete the emulation of
01546     multi-session functionality, if needed at all. Let libisoburn decide.
01547     Not a wrapper, but peculiar to libisoburn.
01548     @since 0.1.0
01549     @param d  The output drive to which the session was written
01550     @return   1 success , <=0 failure
01551 */
01552 int isoburn_activate_session(struct burn_drive *d);
01553 
01554 
01555 /** Wait after normal end of operations until libisofs ended all write
01556     threads and freed resource reservations.
01557     This call is not mandatory. But without it, messages from the ending
01558     threads might appear after the application ended its write procedure.
01559     @since 0.1.0
01560     @param input_drive   The drive resp. in_drive which was used with the
01561                          preparation call.
01562     @param output_drive  The out_drive used with isoburn_prepare_new_image(),
01563                          NULL if none.
01564     @param flag Bitfield, submit 0 for now.
01565     @return     <=0 error , 1 = success
01566 */
01567 int isoburn_sync_after_write(struct burn_drive *input_drive,
01568                              struct burn_drive *output_drive, int flag);
01569 
01570 
01571 /** Release an aquired drive.
01572     Wrapper for: burn_drive_release()
01573     @since 0.1.0
01574     @param drive The drive to be released
01575     @param eject 1= eject media from drive , 0= do not eject
01576 */
01577 void isoburn_drive_release(struct burn_drive *drive, int eject);
01578 
01579 
01580 /** Shutdown all three libraries.
01581     Wrapper for : iso_finish() and burn_finish().
01582     @since 0.1.0
01583 */
01584 void isoburn_finish(void);
01585 
01586 
01587 /*
01588     The following calls are for expert applications only.
01589     An application should have a special reason to use them.
01590 */
01591 
01592 
01593 /** Inquire wether the media needs emulation or would be suitable for
01594     generic multi-session via libburn.
01595     @since 0.1.0
01596     @param d  The drive to inquire
01597     @return 0 is generic multi-session 
01598             1 is emulated multi-session
01599            -1 is not suitable for isoburn
01600 */
01601 int isoburn_needs_emulation(struct burn_drive *d);
01602  
01603 

Generated on Tue Aug 17 2010 13:01:43 for libisoburn by  doxygen 1.7.1