libisoburn-1.4.6/libisoburn/libisoburn.h

Go to the documentation of this file.
00001 
00002 #ifndef LIBISOBURN_LIBISOBURN_H_
00003 #define LIBISOBURN_LIBISOBURN_H_
00004 
00005 /*
00006   Lower level API definition of libisoburn.
00007 
00008   Copyright 2007-2016 Vreixo Formoso Lopes <metalpain2002@yahoo.es>
00009                   and Thomas Schmitt <scdbackup@gmx.net>
00010   Provided under GPL version 2 or later.
00011 */
00012 
00013 #ifdef __cplusplus
00014 extern "C" {
00015 #endif
00016 
00017 /**                           Overview
00018 
00019 libisoburn is a frontend for libraries libburn and libisofs which enables
00020 creation and expansion of ISO-9660 filesystems on all CD/DVD/BD media supported
00021 by libburn. This includes media like DVD+RW, which do not support multi-session
00022 management on media level and even plain disk files or block devices.
00023 
00024 The price for that is thorough specialization on data files in ISO-9660
00025 filesystem images. So libisoburn is not suitable for audio (CD-DA) or any
00026 other CD layout which does not entirely consist of ISO-9660 sessions.
00027 
00028 Note that there is a higher level of API: xorriso.h. One should not mix it
00029 with the API calls of libisoburn.h, libisofs.h, and libburn.h.
00030 
00031 
00032                           Connector functions
00033 
00034 libisofs and libburn do not depend on each other but share some interfaces
00035 by which they can cooperate.
00036 libisoburn establishes the connection between both modules by creating the
00037 necessary interface objects and attaching them to the right places.
00038 
00039 
00040                           Wrapper functions 
00041 
00042 The principle of this frontend is that you may use any call of libisofs or
00043 libburn unless it has a  isoburn_*()  wrapper listed in the following function
00044 documentation.
00045 
00046 E.g. call isoburn_initialize() rather than iso_init(); burn_initialize();
00047 and call isoburn_drive_scan_and_grab() rather than burn_drive_scan_and_grab().
00048 But you may call  burn_disc_get_profile()  directly if you want to display
00049 the media type.
00050 
00051 The wrappers will transparently provide the necessary emulations which
00052 are appropriate for particular target drives and media states.
00053 To learn about them you have to read both API descriptions: the one of
00054 the wrapper and the one of the underlying libburn or libisofs call.
00055 
00056 Macros BURN_* and functions burn_*() are documented in <libburn/libburn.h>
00057 Macros ISO_* and functions iso_*() are documented in <libisofs/libisofs.h>
00058 
00059 
00060                              Usage model
00061 
00062 There may be an input drive and an output drive. Either of them may be missing
00063 with the consequence that no reading or no writing is possible.
00064 Both drive roles can be fulfilled by the same drive.
00065 
00066 Input can be a random access readable libburn drive:
00067   optical media, regular files, block devices.
00068 Output can be any writeable libburn drive:
00069   writeable optical media in burner, writeable file objects (no directories).
00070 
00071 libburn demands rw-permissions to drive device file or file object.
00072 
00073 If the input drive provides a suitable ISO RockRidge image, then its tree
00074 may be loaded into memory and can then be manipulated by libisofs API calls.
00075 The loading is done by isoburn_read_image() under control of
00076 struct isoburn_read_opts which the application obtains from libisoburn
00077 and manipulates by the family of isoburn_ropt_set_*() functions.
00078 
00079 Writing of result images is controlled by libisofs related parameters
00080 in a struct isoburn_imgen_opts which the application obtains from libisoburn
00081 and manipulates by the family of isoburn_igopt_set_*() functions.
00082 
00083 All multi-session aspects are handled by libisoburn according to these
00084 settings. The application does not have to analyze media state and write
00085 job parameters. It rather states its desires which libisoburn tries to
00086 fulfill, or else will refuse to start the write run.
00087 
00088 
00089               Setup for Growing, Modifying or Blind Growing
00090 
00091 The connector function family offers alternative API calls for performing
00092 the setup for several alternative image generation strategies.
00093 
00094 Growing:
00095 If input and output drive are the same, then isoburn_prepare_disc() is to
00096 be used. It will lead to an add-on session on appendable or overwriteable
00097 media with existing ISO image. With blank media it will produce a first
00098 session.
00099 
00100 Modifying:
00101 If the output drive is not the input drive, and if it bears blank media
00102 or overwriteable without a valid ISO image, then one may produce a consolidated
00103 image with old and new data. This will copy file data from an eventual input
00104 drive with valid image, add any newly introduced data from the local
00105 filesystem, and produce a first session on output media.
00106 To prepare for such an image generation run, use isoburn_prepare_new_image().
00107 
00108 Blind Growing:
00109 This method reads the old image from one drive and writes the add-on session
00110 to a different drive. That output drive is nevertheless supposed to
00111 finally lead to the same medium from where the session was loaded. Usually it
00112 will be stdio:/dev/fd/1 (i.e. stdout) being piped into some burn program
00113 like with this classic gesture:
00114   mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev
00115 Blind growing is prepared by the call isoburn_prepare_blind_grow().
00116 The input drive should be released immediately after this call in order
00117 to allow the consumer of the output stream to access that drive for writing.
00118 
00119 After either of these setups, some peripheral libburn drive parameter settings
00120 like  burn_write_opts_set_simulate(),  burn_write_opts_set_multi(),
00121  burn_drive_set_speed(),  burn_write_opts_set_underrun_proof()  should be made.
00122 Do not set the write mode. It will be chosen by libisoburn so it matches job
00123 and media state.
00124 
00125                            Writing the image
00126 
00127 Then one may start image generation and write threads by isoburn_disc_write().
00128 Progress may be watched at the output drive by burn_drive_get_status() and
00129 isoburn_get_fifo_status().
00130 
00131 At some time, the output drive will be BURN_DRIVE_IDLE indicating that
00132 writing has ended.
00133 One should inquire isoburn_drive_wrote_well() to learn about overall success.
00134 
00135 Finally one must call isoburn_activate_session() which will complete any
00136 eventual multi-session emulation.
00137 
00138 
00139                          Application Constraints
00140 
00141 Applications shall include libisofs/libisofs.h , libburn/libburn.h and this
00142 file itself: libisoburn/libisoburn.h .
00143 They shall link with -lisofs -lburn -lisoburn or with the .o files emerging
00144 from building those libraries from their sources.
00145 
00146 Applications must use 64 bit off_t.
00147 E.g. on 32-bit GNU/Linux by defining
00148   #define _LARGEFILE_SOURCE
00149   #define _FILE_OFFSET_BITS 64
00150 The minimum requirement is to interface with the library by 64 bit signed
00151 integers where libisofs.h or libisoburn.h prescribe off_t.
00152 Failure to do so may result in surprising malfunction or memory faults.
00153 
00154 Application files which include libisofs/libisofs.h or libisoburn/libisoburn.h
00155 must provide definitions for uint32_t and uint8_t.
00156 This can be achieved either:
00157 - by using autotools which will define HAVE_STDINT_H or HAVE_INTTYPES_H 
00158   according to its ./configure tests,
00159 - or by defining the macros HAVE_STDINT_H or HAVE_INTTYPES_H according
00160   to the local situation,
00161 - or by appropriately defining uint32_t and uint8_t by other means,
00162   e.g. by including inttypes.h before including libisofs.h and libisoburn.h
00163 
00164 */
00165 #ifdef HAVE_STDINT_H
00166 #include <stdint.h>
00167 #else
00168 #ifdef HAVE_INTTYPES_H
00169 #include <inttypes.h>
00170 #endif
00171 #endif
00172 
00173 
00174 /* Important: If you add a public API function then add its name to file
00175                   libisoburn/libisoburn.ver
00176 */
00177 
00178 
00179                           /* API functions */
00180 
00181 
00182 /** Initialize libisoburn, libisofs and libburn.
00183     Wrapper for : iso_init() and burn_initialize()
00184     @since 0.1.0
00185     @param msg  A character array for eventual messages (e.g. with errors)
00186     @param flag Bitfield for control purposes (unused yet, submit 0) 
00187     @return 1 indicates success, 0 is failure
00188 */
00189 int isoburn_initialize(char msg[1024], int flag);
00190 
00191 
00192 /** Check whether all features of header file libisoburn.h from the given
00193     major.minor.micro revision triple can be delivered by the library version
00194     which is performing this call.
00195     An application of libisoburn can easily memorize the version of the
00196     libisoburn.h header in its own code. Immediately after isoburn_initialize()
00197     it should simply do this check:
00198         if (! isoburn_is_compatible(isoburn_header_version_major,
00199                                     isoburn_header_version_minor,
00200                                     isoburn_header_version_micro, 0))
00201            ...refuse to start the program with this dynamic library version...
00202     @since 0.1.0
00203     @param major obtained at build time
00204     @param minor obtained at build time
00205     @param micro obtained at build time
00206     @param flag Bitfield for control purposes. Unused yet. Submit 0.
00207     @return 1= library can work for caller
00208             0= library is not usable in some aspects. Caller must restrict
00209                itself to an earlier API version or must not use this libray
00210                at all.
00211 */
00212 int isoburn_is_compatible(int major, int minor, int micro, int flag);
00213 
00214 
00215 /** Obtain the three release version numbers of the library. These are the
00216     numbers encountered by the application when linking with libisoburn,
00217     i.e. possibly not before run time.
00218     Better do not base the fundamental compatibility decision of an application
00219     on these numbers. For a reliable check use isoburn_is_compatible().
00220     @since 0.1.0
00221     @param major The maturity version (0 for now, as we are still learning)
00222     @param minor The development goal version.
00223     @param micro The development step version. This has an additional meaning:
00224 
00225                  Pare numbers indicate a version with frozen API. I.e. you can
00226                  rely on the same set of features to be present in all
00227                  published releases with that major.minor.micro combination.
00228                  Features of a pare release will stay available and ABI
00229                  compatible as long as the SONAME of libisoburn stays "1".
00230                  Currently there are no plans to ever change the SONAME.
00231                  
00232                  Odd numbers indicate that API upgrades are in progress.
00233                  I.e. new features might be already present or they might
00234                  be still missing. Newly introduced features may be changed
00235                  incompatibly or even be revoked before release of a pare
00236                  version.
00237                  So micro revisions {1,3,5,7,9} should never be used for
00238                  dynamic linking unless the proper library match can be
00239                  guaranteed by external circumstances.
00240 
00241     @return 1 success, <=0 might in future become an error indication
00242 */
00243 void isoburn_version(int *major, int *minor, int *micro);
00244 
00245 
00246 /** The minimum version of libisofs to be used with this version of libisoburn
00247     at compile time.
00248     @since 0.1.0
00249 */
00250 #define isoburn_libisofs_req_major  1
00251 #define isoburn_libisofs_req_minor  4
00252 #define isoburn_libisofs_req_micro  6
00253 
00254 /** The minimum version of libburn to be used with this version of libisoburn
00255     at compile time.
00256     @since 0.1.0
00257 */
00258 #define isoburn_libburn_req_major  1
00259 #define isoburn_libburn_req_minor  4
00260 #define isoburn_libburn_req_micro  6
00261 
00262 /** The minimum compile time requirements of libisoburn towards libjte are
00263     the same as of a suitable libisofs towards libjte.
00264     So use these macros from libisofs.h :
00265       iso_libjte_req_major
00266       iso_libjte_req_minor
00267       iso_libjte_req_micro
00268     @since 0.6.4
00269 */
00270 
00271 /** The minimum version of libisofs to be used with this version of libisoburn
00272     at runtime. This is checked already in isoburn_initialize() which will
00273     refuse on outdated version. So this call is for information purposes after
00274     successful startup only.
00275     @since 0.1.0
00276     @param major isoburn_libisofs_req_major as seen at build time
00277     @param minor as seen at build time
00278     @param micro as seen at build time
00279     @return 1 success, <=0 might in future become an error indication
00280 */
00281 int isoburn_libisofs_req(int *major, int *minor, int *micro);
00282 
00283 
00284 /** The minimum version of libjte to be used with this version of libisoburn
00285     at runtime. The use of libjte is optional and depends on configure
00286     tests. It can be prevented by ./configure option --disable-libjte .
00287     This is checked already in isoburn_initialize() which will refuse on
00288     outdated version. So this call is for information purposes after
00289     successful startup only.
00290     @since 0.6.4
00291 */
00292 int isoburn_libjte_req(int *major, int *minor, int *micro);
00293 
00294 
00295 /** The minimum version of libburn to be used with this version of libisoburn
00296     at runtime. This is checked already in isoburn_initialize() which will
00297     refuse on outdated version. So this call is for information purposes after
00298     successful startup only.
00299     @since 0.1.0
00300     @param major isoburn_libburn_req_major as seen at build time
00301     @param minor as seen at build time
00302     @param micro as seen at build time
00303     @return 1 success, <=0 might in future become an error indication
00304 */
00305 int isoburn_libburn_req(int *major, int *minor, int *micro);
00306 
00307 
00308 /** These three release version numbers tell the revision of this header file
00309     and of the API it describes. They are memorized by applications at build
00310     time.
00311     @since 0.1.0
00312 */
00313 #define isoburn_header_version_major  1
00314 #define isoburn_header_version_minor  4
00315 #define isoburn_header_version_micro  6
00316 /** Note:
00317     Above version numbers are also recorded in configure.ac because libtool
00318     wants them as parameters at build time.
00319     For the library compatibility check, ISOBURN_*_VERSION in configure.ac
00320     are not decisive. Only the three numbers here do matter.
00321 */
00322 /** Usage discussion:
00323 
00324 Some developers of the libburnia project have differing
00325 opinions how to ensure the compatibility of libaries
00326 and applications.
00327 
00328 It is about whether to use at compile time and at runtime
00329 the version numbers isoburn_header_version_* provided here.
00330 Thomas Schmitt advises to use them.
00331 Vreixo Formoso advises to use other means.
00332 
00333 At compile time:
00334 
00335 Vreixo Formoso advises to leave proper version matching
00336 to properly programmed checks in the the application's
00337 build system, which will eventually refuse compilation.
00338 
00339 Thomas Schmitt advises to use the macros defined here
00340 for comparison with the application's requirements of
00341 library revisions and to eventually break compilation.
00342 
00343 Both advises are combinable. I.e. be master of your
00344 build system and have #if checks in the source code
00345 of your application, nevertheless.
00346 
00347 At runtime (via *_is_compatible()):
00348 
00349 Vreixo Formoso advises to compare the application's
00350 requirements of library revisions with the runtime
00351 library. This is to allow runtime libraries which are
00352 young enough for the application but too old for
00353 the lib*.h files seen at compile time.
00354 
00355 Thomas Schmitt advises to compare the header
00356 revisions defined here with the runtime library.
00357 This is to enforce a strictly monotonous chain
00358 of revisions from app to header to library,
00359 at the cost of excluding some older libraries.
00360 
00361 These two advises are mutually exclusive.
00362 
00363 -----------------------------------------------------
00364 
00365 For an implementation of the Thomas Schmitt approach,
00366 see libisoburn/burn_wrap.c : isoburn_initialize()
00367 This connects libisoburn as "application" with libisofs
00368 as "library".
00369 
00370 The compatible part of Vreixo Formoso's approach is implemented
00371 in configure.ac LIBBURN_REQUIRED, LIBISOFS_REQUIRED.
00372 In isoburn_initialize() it would rather test by
00373   iso_lib_is_compatible(isoburn_libisofs_req_major,...
00374 than by
00375   iso_lib_is_compatible(iso_lib_header_version_major,...
00376 and would leave out the ugly compile time traps.
00377 
00378 */
00379 
00380 
00381 /** Announce to the library an application provided method for immediate
00382     delivery of messages. It is used when no drive is affected directly or
00383     if the drive has no own msgs_submit() method attached by
00384     isoburn_drive_set_msgs_submit.
00385     If no method is preset or if the method is set to NULL then libisoburn
00386     delivers its messages through the message queue of libburn.
00387     @param msgs_submit   The function call which implements the method
00388     @param submit_handle Handle to be used as first argument of msgs_submit
00389     @param submit_flag   Flag to be used as last argument of msgs_submit
00390     @param flag          Unused yet, submit 0
00391     @since 0.2.0
00392 */
00393 int isoburn_set_msgs_submit(int (*msgs_submit)(void *handle, int error_code,
00394                                                   char msg_text[], int os_errno,
00395                                                   char severity[], int flag),
00396                                void *submit_handle, int submit_flag, int flag);
00397 
00398 
00399 /** Acquire a target drive by its filesystem path or libburn persistent
00400     address.
00401     Wrapper for: burn_drive_scan_and_grab()
00402     @since 0.1.0
00403     @param drive_infos On success returns a one element array with the drive
00404                   (cdrom/burner). Thus use with driveno 0 only. On failure
00405                   the array has no valid elements at all.
00406                   The returned array should be freed via burn_drive_info_free()
00407                   when the drive is no longer needed. But before this is done
00408                   one has to call isoburn_drive_release(drive_infos[0].drive).
00409     @param adr    The persistent address of the desired drive or the path
00410                   to a file object.
00411     @param load   1 attempt to load the disc tray. 0 no attempt,rather failure.
00412     @return       1 = success , 0 = drive not found , <0 = other error
00413 */
00414 int isoburn_drive_scan_and_grab(struct burn_drive_info *drive_infos[],
00415                                 char* adr, int load);
00416 
00417 
00418 /** Acquire a target drive by its filesystem path or libburn persistent
00419     address. This is a modern successor of isoburn_drive_scan_and_grab().  
00420     Wrapper for: burn_drive_scan_and_grab()
00421     @since 0.1.2
00422     @param drive_infos On success returns a one element array with the drive
00423                   (cdrom/burner). Thus use with driveno 0 only. On failure
00424                   the array has no valid elements at all.
00425                   The returned array should be freed via burn_drive_info_free()
00426                   when the drive is no longer needed. But before this is done
00427                   one has to call isoburn_drive_release(drive_infos[0].drive).
00428     @param adr    The persistent address of the desired drive or the path
00429                   to a file object.
00430     @param flag   bit0= attempt to load the disc tray.
00431                         Else: failure if not loaded.
00432                   bit1= regard overwriteable media as blank
00433                   bit2= if the drive is a regular disk file:
00434                         truncate it to the write start address when writing
00435                         begins
00436                   bit3= if the drive reports a read-only profile try to read
00437                         table of content by scanning for ISO image headers.
00438                         (depending on media type and drive this might
00439                          help or it might make the resulting toc even worse)
00440                   bit4= do not emulate table of content on overwriteable media
00441                   bit5= ignore ACL from external filesystems
00442                   bit6= ignore POSIX Extended Attributes from external
00443                         filesystems
00444                   bit7= pretend read-only profile and scan for table of content
00445                   bit8= re-assess already acquired (*drive_infos)[0] rather
00446                         than acquiring adr
00447                         @since 1.1.8
00448                   bit9= when scanning for ISO 9660 sessions  by bit3:
00449                         Do not demand a valid superblock at LBA 0, ignore it in
00450                         favor of one at LBA 32, and scan until end of medium.
00451                         @since 1.2.6
00452     @return       1 = success , 0 = drive not found , <0 = other error
00453 
00454     Please excuse the typo "aquire" in the function name.
00455 */
00456 int isoburn_drive_aquire(struct burn_drive_info *drive_infos[],
00457                          char* adr, int flag);
00458 
00459 /** Acquire a drive from the burn_drive_info[] array which was obtained by
00460     a previous call of burn_drive_scan(). 
00461     Wrapper for: burn_drive_grab()
00462     @since 0.1.0
00463     @param drive The drive to grab. E.g. drive_infos[1].drive .
00464                  Call isoburn_drive_release(drive) when it it no longer needed.
00465     @param load  1 attempt to load the disc tray. 0 no attempt, rather failure.
00466     @return      1 success, <=0 failure
00467 */
00468 int isoburn_drive_grab(struct burn_drive *drive, int load);
00469 
00470 
00471 /** Attach to a drive an application provided method for immediate
00472     delivery of messages.
00473     If no method is set or if the method is set to NULL then libisoburn
00474     delivers messages of the drive through the global msgs_submit() method
00475     set by isoburn_set_msgs_submiti() or by the message queue of libburn.
00476     @since 0.2.0
00477     @param d     The drive to which this function, handle and flag shall apply
00478     @param msgs_submit   The function call which implements the method
00479     @param submit_handle Handle to be used as first argument of msgs_submit
00480     @param submit_flag   Flag to be used as last argument of msgs_submit
00481     @param flag          Unused yet, submit 0
00482 */
00483 int isoburn_drive_set_msgs_submit(struct burn_drive *d,
00484                             int (*msgs_submit)(void *handle, int error_code,
00485                                                char msg_text[], int os_errno,
00486                                                char severity[], int flag),
00487                             void *submit_handle, int submit_flag, int flag);
00488 
00489 
00490 /** Inquire the medium status. Expect the whole spectrum of libburn BURN_DISC_*
00491     with multi-session media. Emulated states with random access media are
00492     BURN_DISC_BLANK and BURN_DISC_APPENDABLE.
00493     Wrapper for: burn_disc_get_status()
00494     @since 0.1.0
00495     @param drive The drive to inquire.
00496     @return The status of the drive, or what kind of disc is in it.
00497             Note: BURN_DISC_UNGRABBED indicates wrong API usage
00498 */
00499 #ifdef __cplusplus
00500 enum burn::burn_disc_status isoburn_disc_get_status(struct burn_drive *drive);
00501 #else
00502 enum burn_disc_status isoburn_disc_get_status(struct burn_drive *drive);
00503 #endif
00504 
00505 
00506 /** Sets the medium status to BURN_DISC_FULL unconditionally.
00507     @since 1.3.8 
00508     @param drive The drive with the medium to be handled as if it was closed.
00509     @
00510 */  
00511 int isoburn_disc_pretend_full_uncond(struct burn_drive *drive);
00512 
00513 
00514 /** Tells whether the medium can be treated by isoburn_disc_erase().
00515     Wrapper for: burn_disc_erasable()
00516     @since 0.1.0
00517     @param d     The drive to inquire.
00518     @return      0=not erasable , else erasable
00519 */
00520 int isoburn_disc_erasable(struct burn_drive *d);
00521 
00522 
00523 /** Mark the medium as blank. With multi-session media this will call
00524     burn_disc_erase(). With random access media, an eventual ISO-9660
00525     filesystem will get invalidated by altering its start blocks on the medium.
00526     In case of success, the medium is in status BURN_DISC_BLANK afterwards.
00527     Wrapper for: burn_disc_erase()
00528     @since 0.1.0
00529     @param drive The drive with the medium to erase.
00530     @param fast 1=fast erase, 0=thorough erase
00531                With DVD-RW, fast erase yields media incapable of multi-session.
00532 */
00533 void isoburn_disc_erase(struct burn_drive *drive, int fast);
00534 
00535 
00536 /** Set up isoburn_disc_get_msc1() to return a fabricated value.
00537     This makes only sense between acquiring the drive and reading the
00538     image. After isoburn_read_image() it will confuse the coordination
00539     of libisoburn and libisofs.
00540     Note: Sessions and tracks are counted beginning with 1, not with 0.
00541     @since 0.1.6
00542     @param d        The drive where msc1 is to be set
00543     @param adr_mode Determines how to interpret adr_value and to set msc1.
00544                     If adr_value shall represent a number then decimal ASCII
00545                     digits are expected.
00546                     0= start lba of last session in TOC, ignore adr_value
00547                     1= start lba of session number given by adr_value
00548                     2= start lba of track given number by adr_value
00549                     3= adr_value itself is the lba to be used
00550                     4= start lba of last session with volume id
00551                        given by adr_value
00552     @param adr_value A string describing the value to be eventually used.
00553     @param flag Bitfield for control purposes.
00554                 bit0= @since 0.2.2
00555                       with adr_mode 3: adr_value might be 16 blocks too high
00556                       (e.g. -C stemming from growisofs). Probe for ISO head
00557                       at adr_value-16 and eventually adjust setting. 
00558                 bit1= insist in seeing a disc object with at least one session
00559                 bit2= with adr_mode 4: use adr_value as regular expression
00560 */
00561 int isoburn_set_msc1(struct burn_drive *d, int adr_mode, char *adr_value,
00562                      int flag);
00563 
00564 
00565 /* ----------------------------------------------------------------------- */
00566 /* 
00567 
00568   Wrappers for emulation of TOC on overwriteable media
00569 
00570   Media which match the overwriteable usage model lack of a history of sessions
00571   and tracks. libburn will not even hand out a burn_disc object for them and
00572   always declare them blank. libisoburn checks for a valid ISO filesystem
00573   header at LBA 0 and eventually declares them appendable.
00574   Nevertheless one can only determine an upper limit of the size of the overall
00575   image (by isoburn_get_min_start_byte()) but not a list of stored sessions
00576   and their LBAs, as it is possible with true multi-session media.
00577 
00578   The following wrappers add the capability to obtain a session and track TOC
00579   from emulated multi-session images on overwriteables if the first session
00580   was written by libisoburn-0.1.6 or later (i.e. with a header copy at LBA 32).
00581 
00582   Be aware that the structs emitted by these isoburn calls are not compatible
00583   with the libburn structs. I.e. you may use them only with isoburn_toc_*
00584   calls. 
00585   isoburn_toc_disc needs to be freed after use. isoburn_toc_session and
00586   isoburn_toc_track vanish together with their isoburn_toc_disc.
00587 */
00588 
00589 /* Opaque handles to media, session, track */
00590 struct isoburn_toc_disc;
00591 struct isoburn_toc_session;
00592 struct isoburn_toc_track;
00593 
00594 
00595 /** Obtain a master handle for the table of content.
00596     This handle governs allocated resources which have to be released by
00597     isoburn_toc_disc_free() when no longer needed.
00598     Wrapper for: burn_drive_get_disc()
00599     @since 0.1.6
00600     @param d   The drive with the medium to inspect
00601     @return    NULL in case there is no content info, else it is a valid handle
00602 */
00603 struct isoburn_toc_disc *isoburn_toc_drive_get_disc(struct burn_drive *d);
00604 
00605 
00606 /** Tell the number of 2048 byte blocks covered by the table of content.
00607     This number includes the eventual gaps between sessions and tracks.
00608     So this call is not really a wrapper for burn_disc_get_sectors().
00609     @since 0.1.6
00610     @param disc  The master handle of the medium
00611     @return      Number of blocks, <=0 indicates unknown or unreadable state
00612 */
00613 int isoburn_toc_disc_get_sectors(struct isoburn_toc_disc *disc);
00614 
00615 
00616 /** Get the array of session handles and the number of complete sessions
00617     from the table of content.
00618     The result array contains *num + isoburn_toc_disc_get_incmpl_sess()
00619     elements. All above *num are incomplete sessions.
00620     Typically there is at most one incomplete session with no track.
00621     Wrapper for: burn_disc_get_sessions()
00622     @since 0.1.6
00623     @param disc The master handle of the medium
00624     @param num returns the number of sessions in the array
00625     @return the address of the array of session handles
00626 */
00627 struct isoburn_toc_session **isoburn_toc_disc_get_sessions(
00628                                       struct isoburn_toc_disc *disc, int *num);
00629 
00630 
00631 /** Obtain the number of incomplete sessions which are recorded in the
00632     result array of isoburn_toc_disc_get_sessions() after the complete
00633     sessions. See above.
00634     @since 1.2.8
00635     @param disc The master handle of the medium
00636     @return  the number of incomplete sessions
00637 */
00638 int isoburn_toc_disc_get_incmpl_sess(struct isoburn_toc_disc *disc);
00639 
00640 
00641 /** Tell the number of 2048 byte blocks covered by a particular session.
00642     Wrapper for: burn_session_get_sectors()
00643     @since 0.1.6
00644     @param s The session handle
00645     @return number of blocks, <=0 indicates unknown or unreadable state
00646 */
00647 int isoburn_toc_session_get_sectors(struct isoburn_toc_session *s);
00648 
00649 
00650 /** Obtain a copy of the entry which describes the end of a particular session.
00651     Wrapper for: burn_session_get_leadout_entry()
00652     @since 0.1.6
00653     @param s The session handle
00654     @param entry A pointer to memory provided by the caller. It will be filled
00655                  with info according to struct burn_toc_entry as defined
00656                  in libburn.h
00657 */
00658 void isoburn_toc_session_get_leadout_entry(struct isoburn_toc_session *s,
00659                                        struct burn_toc_entry *entry);
00660 
00661 
00662 /** Get the array of track handles from a particular session.
00663     Wrapper for: burn_session_get_tracks()
00664     @since 0.1.6
00665     @param s The session handle
00666     @param num returns the number of tracks in the array
00667     @return the address of the array of track handles,
00668             NULL if no tracks are registered with session s
00669 */
00670 struct isoburn_toc_track **isoburn_toc_session_get_tracks(
00671                                       struct isoburn_toc_session *s, int *num);
00672 
00673 
00674 /** Obtain a copy of the entry which describes a particular track.
00675     Wrapper for: burn_track_get_entry()
00676     @since 0.1.6
00677     @param t The track handle
00678     @param entry A pointer to memory provided by the caller. It will be filled
00679                  with info according to struct burn_toc_entry as defined
00680                  in libburn.h
00681 */
00682 void isoburn_toc_track_get_entry(struct isoburn_toc_track *t,
00683                                  struct burn_toc_entry *entry);
00684 
00685 
00686 /** Obtain eventual ISO image parameters of an emulated track. This info was
00687     gained with much effort and thus gets cached in the track object.
00688     If this call returns 1 then one can save a call of isoburn_read_iso_head()
00689     with return mode 1 which could cause an expensive read operation.
00690     @since 0.4.0
00691     @param t            The track handle
00692     @param start_lba    Returns the start address of the ISO session
00693     @param image_blocks Returns the number of 2048 bytes blocks
00694     @param volid        Caller provided memory for the volume id
00695     @param flag         unused yet, submit 0
00696     @return             0= not an emulated ISO session , 1= reply is valid
00697 */
00698 int isoburn_toc_track_get_emul(struct isoburn_toc_track *t, int *start_lba,
00699                                int *image_blocks, char volid[33], int flag);
00700 
00701 
00702 
00703 /** Release the memory associated with a master handle of a medium.
00704     The handle is invalid afterwards and may not be used any more.
00705     Wrapper for: burn_disc_free()
00706     @since 0.1.6
00707     @param disc The master handle of the medium
00708 */
00709 void isoburn_toc_disc_free(struct isoburn_toc_disc *disc);
00710 
00711 
00712 /** Try whether the data at the given address look like a ISO 9660
00713     image header and obtain its alleged size. Depending on the info mode
00714     one other string of text information can be retrieved too.
00715     @since 0.1.6
00716     @param d     The drive with the medium to inspect
00717     @param lba   The block number from where to read
00718     @param image_blocks  Returns the number of 2048 bytes blocks in the session
00719     @param info  Caller provided memory, enough to take eventual info reply
00720     @param flag bit0-7: info return mode
00721                  0= do not return anything in info (do not even touch it)
00722                  1= copy volume id to info (info needs 33 bytes)
00723                  2= @since 0.2.2 :
00724                     copy 64 kB header to info (needs 65536 bytes) 
00725                 bit13= @since 0.2.2:
00726                        Do not read head from medium but use first 64 kB from
00727                        info.
00728                        In this case it is permissible to submit d == NULL.
00729                 bit14= check both half buffers (not only second)
00730                        return 2 if found in first block
00731                 bit15= return -1 on read error
00732     @return >0 seems to be a valid ISO image, 0 format not recognized, <0 error
00733 */
00734 int isoburn_read_iso_head(struct burn_drive *d, int lba,
00735                           int *image_blocks, char *info, int flag);
00736 
00737 
00738 /** Try to convert the given entity address into various entity addresses
00739     which would describe it.
00740     Note: Sessions and tracks are counted beginning with 1, not with 0.
00741     @since 0.3.2
00742     @param d        The drive where msc1 is to be set
00743     @param adr_mode Determines how to interpret the input adr_value.
00744                     If adr_value shall represent a number then decimal ASCII
00745                     digits are expected.
00746                     0= start lba of last session in TOC, ignore adr_value
00747                     1= start lba of session number given by adr_value
00748                     2= start lba of track given number by adr_value
00749                     3= adr_value itself is the lba to be used
00750                     4= start lba of last session with volume id
00751                        given by adr_value
00752     @param adr_value A string describing the value to be eventually used.
00753     @param lba       returns the block address of the entity, -1 means invalid
00754     @param track     returns the track number of the entity, -1 means invalid
00755     @param session   returns the session number of the entity, -1 means invalid
00756     @param volid     returns the volume id of the entity if it is a ISO session
00757     @param flag      Bitfield for control purposes.
00758                      bit2= with adr_mode 4: use adr_value as regular expression
00759     @return          <=0 error , 1 ok, ISO session, 2 ok, not an ISO session
00760 */
00761 int isoburn_get_mount_params(struct burn_drive *d,
00762                              int adr_mode, char *adr_value,
00763                              int *lba, int *track, int *session,
00764                              char volid[33], int flag);
00765 
00766 
00767 /* ----------------------------------------------------------------------- */
00768 /*
00769 
00770   Options for image reading.
00771 
00772   An application shall create an option set object by isoburn_ropt_new(),
00773   program it by isoburn_ropt_set_*(), use it with isoburn_read_image(),
00774   and finally delete it by isoburn_ropt_destroy().
00775 
00776 */
00777 /* ----------------------------------------------------------------------- */
00778 
00779 struct isoburn_read_opts;
00780 
00781 /** Produces a set of image read options, initialized with default values.
00782     @since 0.1.0
00783     @param o the newly created option set object
00784     @param flag  Bitfield for control purposes. Submit 0 for now.
00785     @return 1=ok , <0 = failure
00786 */
00787 int isoburn_ropt_new(struct isoburn_read_opts **o, int flag);
00788 
00789 
00790 /** Deletes an option set which was created by isoburn_ropt_new().
00791     @since 0.1.0
00792     @param o The option set to work on
00793     @param flag  Bitfield for control purposes. Submit 0 for now.
00794     @return 1= **o destroyed , 0= *o was already NULL (harmless)
00795 */
00796 int isoburn_ropt_destroy(struct isoburn_read_opts **o, int flag);
00797 
00798 /** Sets the size and granularity of the cache which libisoburn provides to
00799     libisofs for reading of ISO image data. This cache consists of several
00800     tiles which are buffers of a given size. The ISO image is divided into
00801     virtual tiles of that size. A cache tile may hold an in-memory copy
00802     of such a virtual image tile.
00803     When libisofs requests to read a block, then first the cache is inquired
00804     whether it holds that block. If not, then the block is read via libburn
00805     together with its neighbors in their virtual image tile into a free
00806     cache tile. If no cache tile is free, then the one will be re-used which
00807     has the longest time of not being hit by a read attempt.
00808 
00809     A larger cache might speed up image loading by reducing the number of
00810     libburn read calls on the directory tree. It might also help with
00811     reading the content of many small files, if for some reason it is not an
00812     option to sort access by LBA.
00813     Caching will not provide much benefit with libburn "stdio:" drives,
00814     because the operating system is supposed to provide the same speed-up
00815     in a more flexible way.
00816 
00817     @since 1.2.2
00818     @param o            The option set to work on.
00819                         It is permissible to submit NULL in order to just
00820                         have the parameters tested.
00821     @param cache_tiles  Number of tiles in the cache. Not less than 1.
00822                         Default is 32.
00823     @param tile_blocks  Number of blocks per tile. Must be a power of 2.
00824                         Default is 32.
00825                         cache_tiles * tile_blocks * 2048 must not exceed
00826                         1073741824 (= 1 GiB).
00827     @param flag         Bitfield for control purposes. Unused yet. Submit 0.
00828     @return             <=0 error , >0 ok
00829 */ 
00830 int isoburn_ropt_set_data_cache(struct isoburn_read_opts *o,
00831                                 int cache_tiles, int tile_blocks, int flag);
00832 
00833 /** Inquire the current settings of isoburn_set_data_cache().
00834     @since 1.2.2
00835     @param o            The option set to work on.
00836                         NULL has the same effect as flag bit0.
00837     @param cache_tiles  Will return the number of tiles in the cache.
00838     @param tile_blocks  Will return the number of blocks per tile.
00839     @param set_flag     Will return control bits. None are defined yet.
00840     @param flag         Bitfield for control purposes
00841                         bit0= return default values rather than current ones
00842     @return             <=0 error , >0 reply is valid
00843 */
00844 int isoburn_ropt_get_data_cache(struct isoburn_read_opts *o,
00845                                 int *cache_tiles, int *tile_blocks,
00846                                 int *set_flag, int flag);
00847 
00848 
00849 /** Which existing ISO 9660 extensions in the image to read or not to read.
00850     Whether to read the content of an existing image at all.
00851     The bits can be combined by | and inquired by &.
00852     @since 0.1.0
00853     @param ext Bitfield:
00854                bit0= norock
00855                      Do not read Rock Ridge extensions
00856                bit1= nojoliet
00857                      Do not read Joliet extensions
00858                bit2= noiso1999
00859                      Do not read ISO 9660:1999 enhanced tree
00860                bit3= preferjoliet
00861                      When both Joliet and RR extensions are present, the RR
00862                      tree is used. If you prefer using Joliet, set this to 1.
00863                bit4= pretend_blank
00864                      Always create empty image.Ignore any image on input drive.
00865                bit5= noaaip
00866                      @since 0.3.4
00867                      Do not load AAIP information from image. This information
00868                      eventually contains ACL or XFS-style Extended Attributes.
00869                bit6= noacl
00870                      @since 0.3.4
00871                      Do not obtain ACL from external filesystem objects (e.g.
00872                      local filesystem files).
00873                bit7= noea
00874                      @since 0.3.4
00875                      Do not obtain XFS-style Extended Attributes from external
00876                      filesystem objects (e.g.  local filesystem files).
00877                bit8= noino
00878                      @since 0.4.0
00879                      Do not load eventual inode numbers from RRIP entry PX,
00880                      but generate a new unique inode number for each imported
00881                      IsoNode object.
00882                      PX inode numbers mark families of hardlinks by giving all
00883                      family members the same inode number. libisofs keeps the
00884                      PX inode numbers unaltered when IsoNode objects get
00885                      written into an ISO image.
00886                bit9= nomd5
00887                      @since 0.4.2
00888                      Do not load the eventual MD5 checksum array.
00889                      Do not check eventual session_md5 tags.
00890               bit10= nomd5tag
00891                      @since 1.0.4
00892                      Do not check eventual session_md5 tags although bit9
00893                      is not set.
00894               bit11= do_ecma119_map
00895                      @since 1.4.2
00896                      Set iso_read_opts_set_ecma119_map() to map_mode rather
00897                      than relying on the default setting of libisofs.
00898               bit12 - bit13= map_mode
00899                      @since 1.4.2
00900                      How to convert file names if neither Rock Ridge nor
00901                      Joliet names are present and acceptable.
00902                      0 = unmapped:  Take name as recorded in ECMA-119 directory
00903                                     record (not suitable for writing them to
00904                                     a new ISO filesystem)
00905                      1 = stripped:  Like unmapped, but strip off trailing ";1"
00906                                     or ".;1"
00907                      2 = uppercase: Like stripped, but map {a-z} to {A-Z}
00908                      3 = lowercase: Like stripped, but map {A-Z} to {a-z}
00909     @return    1 success, <=0 failure
00910 */
00911 #define isoburn_ropt_norock         1
00912 #define isoburn_ropt_nojoliet       2
00913 #define isoburn_ropt_noiso1999      4
00914 #define isoburn_ropt_preferjoliet   8
00915 #define isoburn_ropt_pretend_blank 16
00916 #define isoburn_ropt_noaaip        32
00917 #define isoburn_ropt_noacl         64
00918 #define isoburn_ropt_noea         128
00919 #define isoburn_ropt_noino        256
00920 #define isoburn_ropt_nomd5        512
00921 #define isoburn_ropt_nomd5tag    1024
00922 #define isoburn_ropt_map_unmapped  ( 2048 | 0 )
00923 #define isoburn_ropt_map_stripped  ( 2048 | 4096 )
00924 #define isoburn_ropt_map_uppercase ( 2048 | 8192 ) 
00925 #define isoburn_ropt_map_lowercase ( 2048 | 12288 )
00926 
00927 int isoburn_ropt_set_extensions(struct isoburn_read_opts *o, int ext);
00928 int isoburn_ropt_get_extensions(struct isoburn_read_opts *o, int *ext);
00929 
00930 
00931 /** Default attributes to use if no RockRidge extension gets loaded.
00932     @since 0.1.0
00933     @param o    The option set to work on
00934     @param uid  user id number (see /etc/passwd)
00935     @param gid  group id number (see /etc/group)
00936     @param mode  permissions (not file type) as of man 2 stat.
00937                  With directories, r-permissions will automatically imply
00938                  x-permissions. See isoburn_ropt_set_default_dirperms() below.
00939     @return      1 success, <=0 failure
00940 */
00941 int isoburn_ropt_set_default_perms(struct isoburn_read_opts *o,
00942                                    uid_t uid, gid_t gid, mode_t mode);
00943 int isoburn_ropt_get_default_perms(struct isoburn_read_opts *o,
00944                                    uid_t *uid, gid_t *gid, mode_t *mode);
00945 
00946 /** Default attributes to use on directories if no RockRidge extension
00947     gets loaded.
00948     Above call isoburn_ropt_set_default_perms() automatically adds
00949     x-permissions to r-permissions for directories. This call here may
00950     be done afterwards to set independend permissions for directories,
00951     especially to override the automatically added x-permissions.
00952     @since 0.1.0
00953     @param o    The option set to work on
00954     @param mode permissions (not file type) as of man 2 stat.
00955     @return     1 success, <=0 failure
00956 */
00957 int isoburn_ropt_set_default_dirperms(struct isoburn_read_opts *o,
00958                                       mode_t mode);
00959 int isoburn_ropt_get_default_dirperms(struct isoburn_read_opts *o,
00960                                       mode_t *mode);
00961 
00962 
00963 /** Set the character set for reading RR file names from ISO images.
00964     @since 0.1.0
00965     @param o             The option set to work on
00966     @param input_charset Set this to NULL to use the default locale charset
00967                          For selecting a particular character set, submit its
00968                          name, e.g. as listed by program iconv -l.
00969                          Example: "UTF-8". 
00970     @return              1 success, <=0 failure
00971 */
00972 int isoburn_ropt_set_input_charset(struct isoburn_read_opts *o,
00973                                    char *input_charset);
00974 int isoburn_ropt_get_input_charset(struct isoburn_read_opts *o,
00975                                    char **input_charset);
00976 
00977 
00978 /**
00979     Enable or disable methods to automatically choose an input charset.
00980     This eventually overrides the name set via isoburn_ropt_set_input_charset()
00981     @since 0.3.8
00982     @param o      The option set to work on
00983     @param mode   Bitfield for control purposes:
00984                   bit0= set the input character set automatically from
00985                         attribute "isofs.cs" of root directory.
00986                   Submit any other bits with value 0.
00987     @return       1 success, <=0 failure
00988  */
00989 int isoburn_ropt_set_auto_incharset(struct isoburn_read_opts *o, int mode);
00990 int isoburn_ropt_get_auto_incharset(struct isoburn_read_opts *o, int *mode);
00991 
00992 
00993 /** Control an offset to be applied to all block address pointers in the ISO
00994     image in order to compensate for an eventual displacement of the image
00995     relative to the start block address for which it was produced.
00996     E.g. if track number 2 from CD gets copied into a disk file and shall then
00997     be loaded as ISO filesystem, then the directory tree and all data file
00998     content of the track copy will become readable by setting the track start
00999     address as displacement and -1 as displacement_sign.
01000     Data file content outside the track will of course not be accessible and
01001     eventually produce read errors.
01002     @since 0.6.6
01003     @param o                  The option set to work on
01004     @param displacement       0 or a positive number
01005     @param displacement_sign  Determines wether to add or subtract displacement
01006                               to block addresses before applying them to the
01007                               storage object for reading:
01008                               +1 = add , -1= subtract , else keep unaltered
01009 */
01010 int isoburn_ropt_set_displacement(struct isoburn_read_opts *o,
01011                                uint32_t displacement, int displacement_sign);
01012 int isoburn_ropt_get_displacement(struct isoburn_read_opts *o,
01013                                uint32_t *displacement, int *displacement_sign);
01014 
01015 /* If you get here because of a compilation error like
01016 
01017        /usr/include/libisoburn/libisoburn.h:895: error:
01018        expected declaration specifiers or '...' before 'uint32_t'
01019 
01020    then see above paragraph "Application Constraints" about the definition
01021    of uint32_t.
01022 */
01023 
01024 /** Set the name truncation mode and the maximum name length for imported
01025     file objects.
01026     @since 1.4.2
01027     @param o                  The option set to work on
01028     @param mode               0= Do not truncate but throw error
01029                                  ISO_RR_NAME_TOO_LONG if a file name
01030                                  is longer than parameter length.
01031                               1= Truncate to length and overwrite the last
01032                                  32 bytes of that length by the hex
01033                                  representation of ithe MD5 of the whole
01034                                  oversized name.
01035                                  Potential incomplete UTF-8 characters will
01036                                  get their leading bytes replaced by '_'.
01037                                  This is the default.
01038     @param length             Maximum byte count of a file name. Permissible
01039                               values are 64 to 255. Default is 255.
01040 
01041 */
01042 int isoburn_ropt_set_truncate_mode(struct isoburn_read_opts *o,
01043                                    int mode, int length);
01044 int isoburn_ropt_get_truncate_mode(struct isoburn_read_opts *o,
01045                                    int *mode, int *length);
01046 
01047 
01048 /** After calling function isoburn_read_image() there are informations
01049     available in the option set.
01050     This info can be obtained as bits in parameter has_what. Like:
01051       joliet_available = (has_what & isoburn_ropt_has_joliet);
01052     @since 0.1.0
01053     @param o     The option set to work on
01054     @param size  Number of image data blocks, 2048 bytes each.
01055     @param has_what Bitfield:
01056            bit0= has_rockridge
01057                  RockRidge extension info is available (POSIX filesystem)
01058            bit1= has_joliet
01059                  Joliet extension info is available (suitable for MS-Windows)
01060            bit2= has_iso1999
01061                  ISO version 2 Enhanced Volume Descriptor is available.
01062                  This is rather exotic.
01063            bit3= has_el_torito
01064                  El-Torito boot record is present
01065     @return  1 success, <=0 failure
01066 */
01067 #define isoburn_ropt_has_rockridge 1
01068 #define isoburn_ropt_has_joliet    2
01069 #define isoburn_ropt_has_iso1999   4
01070 #define isoburn_ropt_has_el_torito 8
01071 
01072 int isoburn_ropt_get_size_what(struct isoburn_read_opts *o,
01073                                uint32_t *size, int *has_what);
01074 
01075 /* ts A90122 */
01076 /* >>> to be implemented:
01077 #define isoburn_ropt_has_acl          64
01078 #define isoburn_ropt_has_ea          128
01079 */
01080 
01081 
01082 
01083 /* ----------------------------------------------------------------------- */
01084 /*                      End of Options for image reading                   */
01085 /* ----------------------------------------------------------------------- */
01086 
01087 /* ----------------------------------------------------------------------- */
01088 /*
01089 
01090   Options for image generation by libisofs and image transport to libburn.
01091 
01092   An application shall create an option set by isoburn_igopt_new(),
01093   program it by isoburn_igopt_set_*(), use it with either
01094   isoburn_prepare_new_image() or isoburn_prepare_disc(), and finally delete
01095   it by isoburn_igopt_destroy().
01096 
01097 */
01098 /* ----------------------------------------------------------------------- */
01099 
01100 struct isoburn_imgen_opts;
01101 
01102 /** Produces a set of generation and transfer options, initialized with default
01103     values.
01104     @since 0.1.0
01105     @param o the newly created option set object
01106     @param flag  Bitfield for control purposes. Submit 0 for now.
01107     @return 1=ok , <0 = failure
01108 */
01109 int isoburn_igopt_new(struct isoburn_imgen_opts **o, int flag);
01110 
01111 
01112 /** Deletes an option set which was created by isoburn_igopt_new().
01113     @since 0.1.0
01114     @param o     The option set to give up
01115     @param flag  Bitfield for control purposes. Submit 0 for now.
01116     @return 1= **o destroyed , 0= *o was already NULL (harmless)
01117 */
01118 int isoburn_igopt_destroy(struct isoburn_imgen_opts **o, int flag);
01119 
01120 
01121 /** ISO level to write at.
01122     @since 0.1.0
01123     @param o     The option set to work on
01124     @param level is a term of the ISO 9660 standard. It should be one of:
01125                  1= filenames restricted to form 8.3
01126                  2= filenames allowed up to 31 characters
01127                  3= file content may be larger than 4 GB - 1.
01128     @return      1 success, <=0 failure
01129 */
01130 int isoburn_igopt_set_level(struct isoburn_imgen_opts *o, int level);
01131 int isoburn_igopt_get_level(struct isoburn_imgen_opts *o, int *level);
01132 
01133 
01134 /** Which extensions to support.
01135     @since 0.1.0
01136     @param o     The option set to work on
01137     @param ext Bitfield:
01138            bit0= rockridge
01139                  Rock Ridge extensions add POSIX file attributes like
01140                  owner, group, access permissions, long filenames. Very
01141                  advisable if the designed audience has Unix style systems.
01142            bit1= joliet
01143                  Longer filenames for Windows systems.
01144                  Weaker than RockRidge, but also readable with GNU/Linux.
01145            bit2= iso1999
01146                  This is rather exotic. Better do not surprise the readers.
01147            bit3= hardlinks
01148                  Enable hardlink consolidation. IsoNodes which refer to the
01149                  same source object and have the same properties will get
01150                  the same ISO image inode numbers.
01151                  If combined with isoburn_igopt_rrip_version_1_10 below,
01152                  then the PX entry layout of RRIP-1.12 will be used within
01153                  RRIP-1.10 (mkisofs does this without causing visible trouble).
01154            bit5= aaip
01155                  The libisofs specific SUSP based extension of ECMA-119 which
01156                  can encode ACL and XFS-style Extended Attributes.
01157            bit6= session_md5
01158                  @since 0.4.2
01159                  Produce and write MD5 checksum tags of superblock, directory
01160                  tree, and the whole session stream.
01161            bit7= file_md5
01162                  @since 0.4.2
01163                  Produce and write MD5 checksums for each single IsoFile.
01164            bit8= file_stability (only together with file_md5)
01165                  @since 0.4.2
01166                  Compute MD5 of each file before copying it into the image and
01167                  compare this with the MD5 of the actual copying. If they do
01168                  not match then issue MISHAP event.
01169                  See also libisofs.h  iso_write_opts_set_record_md5()
01170            bit9= no_emul_toc
01171                  @since 0.5.8
01172                  On overwriteable media or random access files do not write
01173                  the first session to LBA 32 and do not copy the first 64kB
01174                  of the first session to LBA 0, but rather write the first
01175                  session to LBA 0 directly.
01176           bit10= will_cancel
01177                  @since 0.6.6
01178                  Announce to libisofs that only the image size is desired
01179                  and that the write thread will be cancelled by
01180                  isoburn_cancel_prepared_write() before actual image writing
01181                  occurs. Without this, cancellation can cause a MISHAP event.
01182           bit11= old_empty
01183                  @since 1.0.2
01184                  Let symbolic links and device files point to block 0, and let
01185                  empty data files point to the address of the Volume Descriptor
01186                  Set Terminator. This was done by libisofs in the past.
01187                  By default there is now a single dedicated block of zero bytes
01188                  after the end of the directory trees, of which the address
01189                  is used for all files without own content.
01190           bit12= hfsplus
01191                  @since 1.2.4
01192                  Produce a HFS+ partition inside the ISO image and announce it
01193                  by an Apple Partition Map in the System Area.
01194                  >>> GPT production ?
01195                  Caution: Interferes with isoburn_igopt_set_system_area() by
01196                           overwriting the first 8 bytes of the data, and
01197                           several blocks of 2 KiB after the first one.
01198           bit13= fat
01199                  @since 1.2.4
01200                  >>> Not yet implemented. Planned to co-exist with hfsplus.
01201                  Produce a FAT32 partition inside the ISO image and announce it
01202                  by an MBR partition entry in the System Area.
01203                  Caution: Interferes with isoburn_igopt_set_system_area() by
01204                           >>> what impact ?
01205 
01206     @return 1 success, <=0 failure
01207 */
01208 #define isoburn_igopt_rockridge         1
01209 #define isoburn_igopt_joliet            2
01210 #define isoburn_igopt_iso1999           4
01211 #define isoburn_igopt_hardlinks         8
01212 #define isoburn_igopt_aaip             32
01213 #define isoburn_igopt_session_md5      64
01214 #define isoburn_igopt_file_md5        128
01215 #define isoburn_igopt_file_stability  256
01216 #define isoburn_igopt_no_emul_toc     512
01217 #define isoburn_igopt_will_cancel    1024
01218 #define isoburn_igopt_old_empty      2048
01219 #define isoburn_igopt_hfsplus        4096
01220 #define isoburn_igopt_fat            8192
01221 int isoburn_igopt_set_extensions(struct isoburn_imgen_opts *o, int ext);
01222 int isoburn_igopt_get_extensions(struct isoburn_imgen_opts *o, int *ext);
01223 
01224 /** Relaxed constraints. Setting any of the bits to 1 break the specifications,
01225     but it is supposed to work on most moderns systems. Use with caution.
01226     @since 0.1.0
01227     @param o     The option set to work on
01228     @param relax Bitfield:
01229            bit0= omit_version_numbers
01230                  Omit the version number (";1") at the end of the
01231                  ISO-9660 and Joliet identifiers.
01232                  Version numbers are usually not used by readers.
01233            bit1= allow_deep_paths
01234                  Allow ISO-9660 directory hierarchy to be deeper
01235                  than 8 levels.
01236            bit2= allow_longer_paths
01237                  Allow path in the ISO-9660 tree to have more than
01238                  255 characters.
01239            bit3= max_37_char_filenames
01240                  Allow a single file or directory hierarchy to have
01241                  up to 37 characters. This is larger than the 31
01242                  characters allowed by ISO level 2, and the extra space
01243                  is taken from the version number, so this also forces
01244                  omit_version_numbers.
01245            bit4= no_force_dots
01246                  ISO-9660 forces filenames to have a ".", that separates
01247                  file name from extension. libisofs adds it if original
01248                  filename has none. Set this to 1 to prevent this
01249                  behavior.
01250            bit5= allow_lowercase 
01251                  Allow lowercase characters in ISO-9660 filenames.
01252                  By default, only uppercase characters, numbers and
01253                  a few other characters are allowed.
01254            bit6= allow_full_ascii
01255                  Allow all ASCII characters to be appear on an ISO-9660
01256                  filename. Note that "/" and "\0" characters are never
01257                  allowed, even in RR names.
01258            bit7= joliet_longer_paths
01259                  Allow paths in the Joliet tree to have more than
01260                  240 characters.
01261            bit8= always_gmt
01262                  Write timestamps as GMT although the specs prescribe local
01263                  time with eventual non-zero timezone offset. Negative
01264                  timezones (west of GMT) can trigger bugs in some operating
01265                  systems which typically appear in mounted ISO images as if
01266                  the timezone shift from GMT was applied twice
01267                  (e.g. in New York 22:36 becomes 17:36).
01268            bit9= rrip_version_1_10
01269                  Write Rock Ridge info as of specification RRIP-1.10 rather
01270                  than RRIP-1.12: signature "RRIP_1991A" rather than
01271                  "IEEE_1282", field PX without file serial number.
01272           bit10= dir_rec_mtime
01273                  Store as ECMA-119 Directory Record timestamp the mtime
01274                  of the source rather than the image creation time.
01275           bit11= aaip_susp_1_10
01276                  Write AAIP fields without announcing AAIP by an ER field and
01277                  without distinguishing RRIP fields from the AAIP field by
01278                  prefixed ES fields. This saves 5 to 10 bytes per file and
01279                  might avoid problems with readers which only accept RRIP.
01280                  SUSP-1.10 allows it, SUSP-1.12 frowns on it.
01281           bit12= only_iso_numbers
01282                  Same as bit1 omit_version_number but restricted to the names
01283                  in the eventual Joliet tree.
01284                  @since 0.5.4
01285                  For reasons of backward compatibility it is not possible yet
01286                  to disable version numbers for ISO 9660 while enabling them
01287                  for Joliet. 
01288           bit13= no_j_force_dots
01289                  Same as no_force_dots but affecting the names in the eventual
01290                  Joliet tree rather than the ISO 9660 / ECMA-119 names.
01291                  @since 0.5.4
01292                  Previous versions added dots to Joliet names unconditionally.
01293           bit14= allow_dir_id_ext
01294                  Convert directory names for ECMA-119 similar to other file
01295                  names, but do not force a dot or add a version number.
01296                  This violates ECMA-119 by allowing one "." and especially
01297                  ISO level 1 by allowing DOS style 8.3 names rather than
01298                  only 8 characters.
01299                  (mkisofs and its clones obviously do this violation.)
01300                  @since 1.0.0
01301           bit15= joliet_long_names
01302                  Allow for Joliet leaf names up to 103 characters rather than
01303                  up to 64.
01304                  @since 1.0.6
01305           bit16= joliet_rec_mtime
01306                  Like dir_rec_mtime, but for the Joliet tree.
01307                  @since 1.2.0
01308           bit17= iso1999_rec_mtime
01309                  Like dir_rec_mtime, but for the ISO 9660:1999 tree.
01310                  @since 1.2.0
01311           bit18= allow_7bit_ascii
01312                  Like allow_full_ascii, but only allowing 7-bit characters.
01313                  Lowercase letters get mapped to uppercase if not
01314                  allow_lowercase is set.
01315                  Gets overridden if allow_full_ascii is enabled.
01316           bit19= joliet_utf16
01317                  Encode Joliet names by character set UTF-16BE rather than
01318                  UCS-2. The difference is with characters which are not present
01319                  in UCS-2 and get encoded in UTF-16 by 2 words of 16 bit each.
01320                  Both words then stem from a reserved subset of UCS-2. 
01321                  @since 1.3.6
01322     @return 1 success, <=0 failure
01323 */
01324 #define isoburn_igopt_omit_version_numbers       1
01325 #define isoburn_igopt_allow_deep_paths           2
01326 #define isoburn_igopt_allow_longer_paths         4
01327 #define isoburn_igopt_max_37_char_filenames      8
01328 #define isoburn_igopt_no_force_dots             16
01329 #define isoburn_igopt_allow_lowercase           32
01330 #define isoburn_igopt_allow_full_ascii          64
01331 #define isoburn_igopt_joliet_longer_paths      128
01332 #define isoburn_igopt_always_gmt               256
01333 #define isoburn_igopt_rrip_version_1_10        512
01334 #define isoburn_igopt_dir_rec_mtime           1024
01335 #define isoburn_igopt_aaip_susp_1_10          2048
01336 #define isoburn_igopt_only_iso_versions       4096
01337 #define isoburn_igopt_no_j_force_dots         8192
01338 #define isoburn_igopt_allow_dir_id_ext       16384
01339 #define isoburn_igopt_joliet_long_names      32768
01340 #define isoburn_igopt_joliet_rec_mtime     0x10000
01341 #define isoburn_igopt_iso1999_rec_mtime    0x20000
01342 #define isoburn_igopt_allow_7bit_ascii     0x40000
01343 #define isoburn_igopt_joliet_utf16         0x80000
01344 int isoburn_igopt_set_relaxed(struct isoburn_imgen_opts *o, int relax);
01345 int isoburn_igopt_get_relaxed(struct isoburn_imgen_opts *o, int *relax);
01346 
01347 
01348 /** If not isoburn_igopt_allow_deep_paths is in effect, then it may become
01349     necessary to relocate directories so that no ECMA-119 file path
01350     has more than 8 components. These directories are grafted into either
01351     the root directory of the ISO image or into a dedicated relocation
01352     directory. For details see libisofs.h.
01353     Wrapper for: iso_write_opts_set_rr_reloc()
01354     @since 1.2.2
01355     @param o     The option set to work on
01356     @param name  The name of the relocation directory in the root directory.
01357                  Do not prepend "/". An empty name or NULL will direct
01358                  relocated directories into the root directory. This is the
01359                  default.
01360                  If the given name does not exist in the root directory when
01361                  isoburn_disc_write() is called, and if there are directories
01362                  at path level 8, then directory /name will be created
01363                  automatically.
01364     @param flags Bitfield for control purposes.
01365                  bit0= Mark the relocation directory by a Rock Ridge RE entry,
01366                        if it gets created during isoburn_disc_write(). This
01367                        will make it invisible for most Rock Ridge readers.
01368                  bit1= not settable via API (used internally)
01369     @return      > 0 success, <= 0 failure
01370 */
01371 int isoburn_igopt_set_rr_reloc(struct isoburn_imgen_opts *o, char *name,
01372                                int flags);
01373 
01374 /** Obtain the settings of isoburn_igopt_set_rr_reloc().
01375     @since 1.2.2
01376     @param o     The option set to work on
01377     @param name  Will return NULL or a pointer to the name of the relocation
01378                  directory in the root directory. Do not alter or dispose the
01379                  memory which holds this name.
01380     @param flags Will return the flags bitfield.
01381     @return      > 0 success, <= 0 failure
01382 */
01383 int isoburn_igopt_get_rr_reloc(struct isoburn_imgen_opts *o, char **name,
01384                                int *flags);
01385 
01386 
01387 /** Caution: This option breaks any assumptions about names that
01388              are supported by ECMA-119 specifications.
01389     Try to omit any translation which would make a file name compliant to the
01390     ECMA-119 rules. This includes and exceeds omit_version_numbers,
01391     max_37_char_filenames, no_force_dots bit0, allow_full_ascii. Further it
01392     prevents the conversion from local character set to ASCII.
01393     The maximum name length is given by this call. If a filename exceeds
01394     this length or cannot be recorded untranslated for other reasons, then
01395     image production gets aborted.
01396     Currently the length limit is 96 characters, because an ECMA-119 directory
01397     record may at most have 254 bytes and up to 158 other bytes must fit into
01398     the record. Probably 96 more bytes can be made free for the name in future.
01399     @since 1.0.0
01400     @param o    The option set to work on
01401     @param len  0 = disable this feature and perform name translation
01402                     according to other settings.
01403                >0 = Omit any translation. Eventually abort image production
01404                     if a name is longer than the given value.
01405                -1 = Like >0. Allow maximum possible length.
01406                     isoburn_igopt_get_untranslated_name_len() will tell the
01407                     effectively resulting value.
01408     @return >0 success, <=0 failure
01409 */
01410 int isoburn_igopt_set_untranslated_name_len(struct isoburn_imgen_opts *o,
01411                                             int len);
01412 int isoburn_igopt_get_untranslated_name_len(struct isoburn_imgen_opts *o,
01413                                             int *len);
01414 
01415 
01416 /** Whether and how files should be sorted.
01417     @since 0.1.0
01418     @param o     The option set to work on
01419     @param value Bitfield: bit0= sort_files_by_weight
01420                                  files should be sorted based on their weight.
01421                                  Weight is attributed to files in the image
01422                                  by libisofs call iso_node_set_sort_weight().
01423     @return 1 success, <=0 failure
01424 */
01425 #define isoburn_igopt_sort_files_by_weight        1
01426 int isoburn_igopt_set_sort_files(struct isoburn_imgen_opts *o, int value);
01427 int isoburn_igopt_get_sort_files(struct isoburn_imgen_opts *o, int *value);
01428 
01429 
01430 /** Set the override values for files and directory permissions.
01431     The parameters replace_* these take one of three values: 0, 1 or 2.
01432     If 0, the corresponding attribute will be kept as set in the IsoNode
01433     at the time of image generation.
01434     If set to 1, the corresponding attrib. will be changed by a default
01435     suitable value.
01436     With value 2, the attrib. will be changed with the value specified
01437     in the corresponding *_mode options. Note that only the permissions
01438     are set, the file type remains unchanged.
01439     @since 0.1.0
01440     @param o                 The option set to work on
01441     @param replace_dir_mode  whether and how to override directories
01442     @param replace_file_mode whether and how to override files of other type
01443     @param dir_mode          Mode to use on dirs with replace_dir_mode == 2.
01444     @param file_mode;        Mode to use on files with replace_file_mode == 2.
01445     @return 1 success, <=0 failure
01446 */
01447 int isoburn_igopt_set_over_mode(struct isoburn_imgen_opts *o,
01448                                int replace_dir_mode, int replace_file_mode,
01449                                mode_t dir_mode, mode_t file_mode);
01450 int isoburn_igopt_get_over_mode(struct isoburn_imgen_opts *o,
01451                                int *replace_dir_mode, int *replace_file_mode,
01452                                mode_t *dir_mode, mode_t *file_mode);
01453 
01454 /** Set the override values values for group id and user id.
01455     The rules are like with above overriding of mode values. replace_* controls
01456     whether and how. The other two parameters provide values for eventual use.
01457     @since 0.1.0
01458     @param o                 The option set to work on
01459     @param replace_uid       whether and how to override user ids
01460     @param replace_gid       whether and how to override group ids
01461     @param uid               User id to use with replace_uid == 2.
01462     @param gid               Group id to use on files with replace_gid == 2.
01463     @return 1 success, <=0 failure
01464 */
01465 int isoburn_igopt_set_over_ugid(struct isoburn_imgen_opts *o,
01466                                int replace_uid, int replace_gid,
01467                                uid_t uid, gid_t gid);
01468 int isoburn_igopt_get_over_ugid(struct isoburn_imgen_opts *o,
01469                                int *replace_uid, int *replace_gid,
01470                                uid_t *uid, gid_t *gid);
01471 
01472 /** Set the charcter set to use for representing RR filenames in the image.
01473     @since 0.1.0
01474     @param o              The option set to work on
01475     @param output_charset Set this to NULL to use the default output charset.
01476                           For selecting a particular character set, submit its
01477                           name, e.g. as listed by program iconv -l.
01478                           Example: "UTF-8". 
01479     @return 1 success, <=0 failure
01480 */
01481 int isoburn_igopt_set_out_charset(struct isoburn_imgen_opts *o,
01482                                  char *output_charset);
01483 int isoburn_igopt_get_out_charset(struct isoburn_imgen_opts *o,
01484                                  char **output_charset);
01485 
01486 
01487 /** The number of bytes to be used for the fifo which decouples libisofs
01488     and libburn for better throughput and for reducing the risk of
01489     interrupting signals hitting the libburn thread which operates the
01490     MMC drive.
01491     The size will be rounded up to the next full 2048.
01492     Minimum is 64kiB, maximum is 1 GiB (but that is too much anyway).
01493     @since 0.1.0
01494     @param o          The option set to work on
01495     @param fifo_size  Number of bytes to use
01496     @return 1 success, <=0 failure
01497 */
01498 int isoburn_igopt_set_fifo_size(struct isoburn_imgen_opts *o, int fifo_size);
01499 int isoburn_igopt_get_fifo_size(struct isoburn_imgen_opts *o, int *fifo_size);
01500 
01501 
01502 /** Obtain after image preparation the block address where the session will
01503     start on the medium.
01504     This value cannot be set by the application but only be inquired.
01505     @since 0.1.4
01506     @param o          The option set to work on
01507     @param lba        The block number of the session start on the medium.
01508                       <0 means that no address has been determined yet.
01509     @return 1 success, <=0 failure
01510 */
01511 int isoburn_igopt_get_effective_lba(struct isoburn_imgen_opts *o, int *lba);
01512 
01513 
01514 /** Obtain after image preparation the lowest block address of file content
01515     data. Failure can occur if libisofs is too old to provide this information,
01516     if the result exceeds 31 bit, or if the call is made before image
01517     preparation.
01518     This value cannot be set by the application but only be inquired.
01519     @since 0.3.6
01520     @param o          The option set to work on
01521     @param lba        The block number of the session start on the medium.
01522                       <0 means that no address has been determined yet.
01523     @return 1 success, <=0 failure
01524 */
01525 int isoburn_igopt_get_data_start(struct isoburn_imgen_opts *o, int *lba);
01526 
01527 
01528 /** Set or get parameters "name" and "timestamp" for a scdbackup checksum
01529     tag. It will be appended to the libisofs session tag if the image starts at
01530     LBA 0. See isoburn_disc_track_lba_nwa. The scdbackup tag can be used
01531     to verify the image by command scdbackup_verify $device -auto_end.
01532     See scdbackup/README appendix VERIFY for its inner details.
01533     @since 0.4.4
01534     @param o          The option set to work on
01535     @param name       The tag name. 80 characters max.
01536                       An empty name disables production of an scdbackup tag.
01537     @param timestamp  A string of up to 13 characters YYMMDD.hhmmss
01538                       A9 = 2009, B0 = 2010, B1 = 2011, ... C0 = 2020, ...
01539     @param tag_written Either NULL or the address of an array with at least 512
01540                       characters. In the latter case the eventually produced
01541                       scdbackup tag will be copied to this array when the image
01542                       gets written. This call sets scdbackup_tag_written[0] = 0
01543                       to mark its preliminary invalidity.
01544     @return 1 success, <=0 failure
01545  */
01546 int isoburn_igopt_set_scdbackup_tag(struct isoburn_imgen_opts *o, char *name,
01547                                     char *timestamp, char *tag_written);
01548 int isoburn_igopt_get_scdbackup_tag(struct isoburn_imgen_opts *o,
01549                                     char name[81], char timestamp[19],
01550                                     char **tag_written);
01551 
01552 
01553 /** Attach 32 kB of binary data which shall get written to the first 32 kB
01554     of the ISO image, the System Area.
01555     options can cause manipulations of these data before writing happens.
01556     If system area data are giveni or options bit0 is set, then bit1 of
01557     el_torito_set_isolinux_options() is automatically disabled.
01558     @since 0.5.4
01559     @param o        The option set to work on
01560     @param data     Either NULL or 32 kB of data. Do not submit less bytes !
01561     @param options  Can cause manipulations of submitted data before they
01562                     get written:
01563                     bit0= apply a --protective-msdos-label as of grub-mkisofs.
01564                           This means to patch bytes 446 to 512 of the system
01565                           area so that one partition is defined which begins
01566                           at the second 512-byte block of the image and ends
01567                           where the image ends.
01568                           This works with and without system_area_data.
01569                     bit1= apply isohybrid MBR patching to the system area.
01570                           This works only with system area data from
01571                           SYSLINUX plus an ISOLINUX boot image (see
01572                           iso_image_set_boot_image()) and only if not bit0
01573                           is set.
01574                     bit2-7= System area type
01575                           0= with bit0 or bit1: MBR
01576                              else: unspecified type 
01577                           @since 0.6.4
01578                           1= MIPS Big Endian Volume Header
01579                              Submit up to 15 MIPS Big Endian boot files by
01580                              iso_image_add_mips_boot_file() of libisofs.
01581                              This will overwrite the first 512 bytes of
01582                              the submitted data.
01583                           2= DEC Boot Block for MIPS Little Endian
01584                              The first boot file submitted by
01585                              iso_image_add_mips_boot_file() will be activated.
01586                              This will overwrite the first 512 bytes of
01587                              the submitted data.
01588                           @since 0.6.6
01589                           3= SUN Disk Label for SUN SPARC
01590                              Submit up to 7 SPARC boot images by
01591                              isoburn_igopt_set_partition_img() for partition
01592                              numbers 2 to 8.
01593                              This will overwrite the first 512 bytes of
01594                              the submitted data.
01595                           @since 1.3.8
01596                           4= HP-PA PALO boot sector header version 4
01597                              Submit all five parameters of 
01598                              iso_image_set_hppa_palo() as non-NULL texts.
01599                           5= HP-PA PALO boot sector header version 5
01600                              Submit all five parameters of 
01601                              iso_image_set_hppa_palo() as non-NULL texts.
01602                     bit8-9= Only with System area type 0 = MBR
01603                           @since 1.0.4
01604                           Cylinder alignment mode eventually pads the image
01605                           to make it end at a cylinder boundary.
01606                           0 = auto (align if bit1)
01607                           1 = always align to cylinder boundary
01608                           2 = never align to cylinder boundary
01609                     bit10-13= System area sub type
01610                           @since 1.2.4 
01611                           With type 0 = MBR:
01612                             Gets overridden by bit0 and bit1. 
01613                             0 = no particular sub type
01614                             1 = CHRP: A single MBR partition of type 0x96
01615                                 covers the ISO image. Not compatible with
01616                                 any other feature which needs to have own
01617                                 MBR partition entries.
01618                     bit14= Only with System area type 0 = MBR
01619                           GRUB2 boot provisions:
01620                           @since 1.3.0
01621                           Patch system area at byte 0x1b0 to 0x1b7 with 
01622                           (512-block address + 4) of the first boot image file.
01623                           Little-endian 8-byte.
01624                           Should be combined with options bit0.
01625                           Will not be in effect if options bit1 is set.
01626     @return 1 success, 0 no data to get, <0 failure
01627 */
01628 int isoburn_igopt_set_system_area(struct isoburn_imgen_opts *o,
01629                                   char data[32768], int options);
01630 int isoburn_igopt_get_system_area(struct isoburn_imgen_opts *o,
01631                                   char data[32768], int *options);
01632 
01633 /** Control production of a second set of volume descriptors (superblock)
01634     and directory trees, together with a partition table in the MBR where the
01635     first partition has non-zero start address and the others are zeroed.
01636     The first partition stretches to the end of the whole ISO image.
01637     The additional volume descriptor set and trees can be used to mount the
01638     ISO image at the start of the first partition, while it is still possible
01639     to mount it via the normal first volume descriptor set and tree at the
01640     start of the image or storage device.
01641     This makes few sense on optical media. But on USB sticks it creates a
01642     conventional partition table which makes it mountable on e.g. Linux via
01643     /dev/sdb and /dev/sdb1 alike.
01644     @since 0.6.2
01645     @param opts
01646            The option set to be manipulated.
01647     @param block_offset_2k
01648            The offset of the partition start relative to device start.
01649            This is counted in 2 kB blocks. The partition table will show the
01650            according number of 512 byte sectors.
01651            Default is 0 which causes no second set and trees.
01652            If it is not 0 then it must not be smaller than 16.
01653     @param secs_512_per_head
01654            Number of 512 byte sectors per head. 1 to 63. 0=automatic.
01655     @param heads_per_cyl
01656            Number of heads per cylinder. 1 to 255. 0=automatic.
01657     @return 1 success, <=0 failure
01658  */
01659 int isoburn_igopt_set_part_offset(struct isoburn_imgen_opts  *opts,
01660                                   uint32_t block_offset_2k,
01661                                   int secs_512_per_head, int heads_per_cyl);
01662 int isoburn_igopt_get_part_offset(struct isoburn_imgen_opts *opts,
01663                                   uint32_t *block_offset_2k,
01664                                   int *secs_512_per_head, int *heads_per_cyl);
01665 
01666 
01667 /** Explicitly set the four timestamps of the emerging ISO image.
01668     Default with all parameters is 0.
01669     @since 0.5.4
01670     @param opts
01671            The option set to work on
01672     @param creation_time
01673            ECMA-119 Volume Creation Date and Time
01674            When "the information in the volume was created."
01675            A value of 0 means that the timepoint of write start is to be used.
01676     @param modification_time
01677            ECMA-119 Volume Modification Date and Time
01678            When "the informationin the volume was last modified."
01679            A value of 0 means that the timepoint of write start is to be used.
01680     @param expiration_time
01681            ECMA-119 Volume Expiration Date and Time
01682            When "the information in the volume may be regarded as obsolete."
01683            A value of 0 means that the information never shall expire.
01684     @param effective_time
01685            ECMA-119 Volume Effective Date and Time
01686            When "the information in the volume may be used."
01687            A value of 0 means that not such retention is intended.
01688     @param uuid
01689            If this text is not empty, then it overrides vol_modification_time
01690            by copying the first 16 decimal digits from uuid, eventually
01691            padding up with decimal '1', and writing a NUL-byte as timezone GMT.
01692            It should express a reasonable time in form  YYYYMMDDhhmmsscc
01693            E.g.:  2010040711405800 = 7 Apr 2010 11:40:58 (+0 centiseconds)
01694     @return 1 success, <=0 failure
01695  */
01696 int isoburn_igopt_set_pvd_times(struct isoburn_imgen_opts *opts,
01697                         time_t creation_time, time_t modification_time,
01698                         time_t expiration_time, time_t effective_time,
01699                         char *uuid);
01700 int isoburn_igopt_get_pvd_times(struct isoburn_imgen_opts *opts,
01701                       time_t *creation_time, time_t *modification_time,
01702                       time_t *expiration_time, time_t *effective_time,
01703                       char uuid[17]);
01704 
01705 
01706 /** Associate a libjte environment object to the upcoming write run.
01707     libjte implements Jigdo Template Extraction as of Steve McIntyre and
01708     Richard Atterer.
01709     A non-NULL libjte_handle will cause failure to write if libjte was not
01710     enabled in libisofs at compile time.
01711     @since 0.6.4
01712     @param opts
01713            The option set to work on
01714     @param libjte_handle
01715            Pointer to a struct libjte_env e.g. created by libjte_new().
01716            It must stay existent from the start of image writing by
01717            isoburn_prepare_*() until the write thread has ended.
01718            E.g. until libburn indicates the end of its write run.
01719     @return 1 success, <=0 failure
01720 */
01721 int isoburn_igopt_attach_jte(struct isoburn_imgen_opts *opts,
01722                              void *libjte_handle);
01723 
01724 /** Remove eventual association to a libjte environment handle.
01725     @since 0.6.4
01726     @param opts
01727            The option set to work on
01728     @param libjte_handle
01729            If not submitted as NULL, this will return the previously set
01730            libjte handle. 
01731     @return 1 success, <=0 failure
01732 */
01733 int isoburn_igopt_detach_jte(struct isoburn_imgen_opts *opts,
01734                              void **libjte_handle);
01735 
01736 
01737 /** Set or get the number of trailing zero byte blocks to be written by
01738     libisofs. The image size counter of the emerging ISO image will include
01739     them. Eventual checksums will take them into respect.
01740     They will be written immediately before the eventual image checksum area
01741     which is at the very end of the image.
01742     For a motivation see iso_write_opts_set_tail_blocks() in libisofs.h .
01743     @since 0.6.4
01744     @param opts
01745            The option set to work on
01746     @param num_blocks
01747            Number of extra 2 kB blocks to be written by libisofs.
01748     @return 1 success, <=0 failure
01749 */
01750 int isoburn_igopt_set_tail_blocks(struct isoburn_imgen_opts *opts,
01751                                   uint32_t num_blocks);
01752 int isoburn_igopt_get_tail_blocks(struct isoburn_imgen_opts *opts,
01753                                   uint32_t *num_blocks);
01754 
01755 
01756 /** Copy a data file from the local filesystem into the emerging ISO image.
01757     Mark it by an MBR partition entry as PreP partition and also cause
01758     protective MBR partition entries before and after this partition.
01759     See libisofs.h iso_write_opts_set_prep_img().
01760     @since 1.2.4
01761     @param opts
01762            The option set to be manipulated.
01763     @param path 
01764            File address in the local file system.
01765     @param flag
01766            With isoburn_igopt_set_prep_partition():
01767            Control bits as of iso_write_opts_set_efi_bootp()
01768            bit0= The path contains instructions for the interval libisofs
01769                  reader. See libisofs.h.
01770                  @since 1.4.0
01771            With isoburn_igopt_get_prep_partition():
01772            bit0= add the current flag setting & 0x3fffffff to return value 1.
01773     @return 1 success, <=0 failure
01774 */
01775 int isoburn_igopt_set_prep_partition(struct isoburn_imgen_opts *opts,
01776                                      char *path, int flag);
01777 int isoburn_igopt_get_prep_partition(struct isoburn_imgen_opts *opts,
01778                                      char **path, int flag);
01779 
01780 /** Copy a data file from the local filesystem into the emerging ISO image
01781     and mark it by a GPT entry as EFI system partition.
01782     @since 1.2.4
01783     @param opts
01784            The option set to be manipulated.
01785     @param path 
01786            File address in the local file system.
01787            Instead  of a disk path, the word --efi-boot-image may be given.
01788            It exposes in GPT the content of the first El Torito EFI boot image
01789            as EFI system partition.
01790     @param flag
01791            With isoburn_igopt_get_efi_bootp():
01792            Control bits as of iso_write_opts_set_efi_bootp()
01793            bit0= The path contains instructions for the interval libisofs
01794                  reader. See libisofs.h.
01795                  @since 1.4.0
01796            With isoburn_igopt_set_efi_bootp():
01797            bit0= add the current flag setting & 0x3fffffff to return value 1.
01798     @return 1 success, <=0 failure
01799 */
01800 int isoburn_igopt_set_efi_bootp(struct isoburn_imgen_opts *opts,
01801                                 char *path, int flag);
01802 int isoburn_igopt_get_efi_bootp(struct isoburn_imgen_opts *opts,
01803                                 char **path, int flag);
01804 
01805 
01806 /** Cause an arbitrary data file to be appended to the ISO image and to be
01807     described by a partition table entry in an MBR or SUN Disk Label at the
01808     start of the ISO image.
01809     The partition entry will bear the size of the image file rounded up to
01810     the next multiple of 2048 bytes.
01811     MBR or SUN Disk Label are selected by isoburn_igopt_set_system_area()
01812     system area type: 0 selects MBR partition table. 3 selects a SUN partition
01813     table with 320 kB start alignment.
01814     @since 0.6.4
01815     @param opts
01816            The option set to be manipulated.
01817     @param partition_number
01818            Depicts the partition table entry which shall describe the
01819            appended image.
01820            Range with MBR: 1 to 4. 1 will cause the whole ISO image to be
01821                            unclaimable space before partition 1.
01822            @since 0.6.6
01823            Range with SUN Disk Label: 2 to 8.
01824     @param image_path 
01825            File address in the local file system.
01826            With SUN Disk Label: an empty name causes the partition to become
01827            a copy of the next lower partition.
01828     @param partition_type
01829            The MBR partition type. E.g. FAT12 = 0x01 , FAT16 = 0x06,
01830            Linux Native Partition = 0x83. See fdisk command L.
01831            This parameter is ignored with SUN Disk Label.
01832     @return
01833            <=0 = error, 1 = success
01834 */
01835 int isoburn_igopt_set_partition_img(struct isoburn_imgen_opts *opts,
01836                                   int partition_number, uint8_t partition_type,
01837                                   char *image_path);
01838 
01839 /** Inquire the current settings made by isoburn_igopt_set_partition_img().
01840     @since 0.6.4
01841     @param opts
01842            The option set to be inquired.
01843     @param num_entries
01844            Number of array elements in partition_types[] and image_paths[].
01845     @param partition_types
01846            The partition type associated with the partition. Valid only if
01847            image_paths[] of the same index is not NULL.
01848     @param image_paths
01849            Its elements get filled with either NULL or a pointer to a string
01850            with a file address or an empty text.
01851     @return
01852            <0 = error
01853             0 = no partition image set
01854            >0 highest used partition number
01855 */
01856 int isoburn_igopt_get_partition_img(struct isoburn_imgen_opts *opts,
01857                                     int num_entries,
01858                                     uint8_t partition_types[],
01859                                     char *image_paths[]);
01860 
01861 
01862 /** Set flag bits for a partition defined by isoburn_igopt_set_partition_img().
01863     The bits will be forwarded to libisofs iso_write_opts_set_partition_img().
01864     @since 1.4.0
01865     @param opts
01866            The option set to be manipulated.
01867     @param partition_number
01868            Depicts the partition table entry to which shall the flags bits
01869            shall apply.
01870     @param flag
01871            Control bits as of iso_write_opts_set_partition_img()
01872            bit0= The path contains instructions for the interval libisofs
01873                  reader. See libisofs.h.
01874                  @since 1.4.0
01875     @return
01876            <=0 = error, 1 = success
01877 */
01878 int isoburn_igopt_set_part_flag(struct isoburn_imgen_opts *opts,
01879                                 int partition_number, int flag);
01880 
01881 /** Inquire the current settings made by isoburn_igopt_set_part_flags().
01882     @since 1.4.0
01883     @param opts
01884            The option set to be inquired.
01885     @param num_entries
01886            Number of array elements in part_flags[].
01887     @param part_flags
01888            The array elements 0 to num_entries - 1 will get filled by the
01889            flag bits of the images of the corresponding partition.
01890     @return
01891            <0 = error
01892             0 = no partition image set
01893            >0 highest used partition number
01894 */
01895 int isoburn_igopt_get_part_flags(struct isoburn_imgen_opts *opts,
01896                                  int num_entries, int part_flags[]);
01897 
01898 
01899 /** Control whether partitions created by iso_write_opts_set_partition_img()
01900     are to be represented in MBR or as GPT partitions.
01901     @since 1.4.0
01902     @param opts
01903            The option set to be manipulated.
01904     @param gpt
01905            0= represent as MBR partition; as GPT only if other GPT partitions
01906               are present
01907            1= represent as GPT partition and cause protective MBR with a single
01908               partition which covers the whole output data.
01909               This may fail if other settings demand MBR partitions.
01910            Do not use other values for now.
01911     @return
01912            <=0 = error, 1 = success
01913 */
01914 int isoburn_igopt_set_appended_as_gpt(struct isoburn_imgen_opts *opts,
01915                                       int gpt);
01916 
01917 /** Inquire the current setting made by isoburn_igopt_set_appended_as_gpt().
01918     @since 1.4.0
01919     @param opts
01920            The option set to be inquired.
01921     @param gpt
01922            Returns the current value.
01923     @return
01924            <=0 = error, 1 = success
01925 */
01926 int isoburn_igopt_get_appended_as_gpt(struct isoburn_imgen_opts *opts,
01927                                       int *gpt);
01928 
01929 
01930 /** Control whether partitions created by iso_write_opts_set_partition_img()
01931     are to be represented in Apple Partition Map.
01932     @since 1.4.4
01933     @param opts
01934            The option set to be manipulated.
01935     @param apm
01936            0= do not represent appended partitions in APM
01937            1= represent in APM, even if not
01938               iso_write_opts_set_part_like_isohybrid() enables it and no
01939               other APM partitions emerge.
01940            Do not use other values for now.
01941     @return
01942            <=0 = error, 1 = success
01943 */
01944 int isoburn_igopt_set_appended_as_apm(struct isoburn_imgen_opts *opts,
01945                                       int apm);
01946 
01947 /** Inquire the current setting made by isoburn_igopt_set_appended_as_apm().
01948     @since 1.4.4
01949     @param opts
01950            The option set to be inquired.
01951     @param apm
01952            Returns the current value.
01953     @return
01954            <=0 = error, 1 = success
01955 */
01956 int isoburn_igopt_get_appended_as_apm(struct isoburn_imgen_opts *opts,
01957                                       int *apm);
01958 
01959 
01960 /** Control whether bits 2 to 8 of el_torito_set_isolinux_options()
01961     shall apply even if not isohybrid MBR patching is enabled (bit1 of
01962     parameter options of isoburn_igopt_set_system_area()).
01963     For details see iso_write_opts_set_part_like_isohybrid() in libisofs.h.
01964     @since 1.4.4
01965     @param opts
01966            The option set to be manipulated.
01967     @param alike
01968            0= Apply isohybrid behavior only with ISOLINUX isohybrid.
01969               Do not mention appended partitions in APM unless
01970               isoburn_igopt_set_appended_as_apm() is enabled.
01971            1= Apply isohybrid behavior even without ISOLINUX isohybrid.
01972     @return
01973            <=0 = error, 1 = success
01974 */
01975 int isoburn_igopt_set_part_like_isohybrid(struct isoburn_imgen_opts *opts,
01976                                         int alike);
01977 
01978 /** Inquire the current setting of isoburn_igopt_set_part_like_isohybrid().
01979     @since 1.4.4
01980     @param opts
01981            The option set to be inquired.
01982     @param alike
01983            Returns the current value.
01984     @return
01985            <=0 = error, 1 = success
01986 */
01987 int isoburn_igopt_get_part_like_isohybrid(struct isoburn_imgen_opts *opts,
01988                                           int *alike);
01989 
01990 /** Control whether the emerging GPT gets a pseudo-randomly generated disk GUID
01991     or whether it gets a user supplied GUID.
01992     The partition GUIDs will be generated in a reproducible way by exoring a
01993     little-endian 32 bit counter with the disk GUID beginning at byte offset 9.
01994     @since 1.4.6
01995     @param opts
01996            The option set to be manipulated.
01997     @param guid
01998            16 bytes of user supplied GUID.
01999            The upper 4 bit of guid[6] and guid[7] should bear the value 4 to
02000            express the version 4 in both endiannesses. Bit 7 of byte[8] should
02001            be set to 1 and bit 6 be set to 0, in order to express the RFC 4122
02002            variant of GUID, where version 4 means "random".
02003     @param mode
02004            0 = ignore parameter guid and produce the GPT disk GUID by a
02005                pseudo-random algorithm. This is the default setting.
02006            1 = use parameter guid as GPT disk GUID
02007            2 = ignore parameter guid and derive the GPT disk GUID from
02008                parameter uuid of isoburn_igopt_set_pvd_times().
02009                The 16 bytes of uuid get copied and bytes 6, 7, 8 get their
02010                upper bits changed to comply to RFC 4122.
02011                If no such uuid is given when ISO production starts, then
02012                mode 2 defaults to mode 0.
02013 */ 
02014 int isoburn_igopt_set_gpt_guid(struct isoburn_imgen_opts *opts,
02015                                uint8_t guid[16], int mode);
02016 
02017 /** Inquire the current setting of isoburn_igopt_set_gpt_guid().
02018     @since 1.4.6
02019     @param opts
02020            The option set to be inquired.
02021     @param guid
02022            Returns the current guid if current mode is 1.
02023     @param mode
02024            Returns the current value.
02025     @return
02026            <=0 = error, 1 = success
02027 */
02028 int isoburn_igopt_get_gpt_guid(struct isoburn_imgen_opts *opts,
02029                                uint8_t guid[16], int *mode);
02030 
02031 
02032 /** Set a name for the system area. This setting is ignored unless system area
02033     type 3 "SUN Disk Label" is in effect by iso_write_opts_set_system_area().
02034     In this case it will replace the default text at the start of the image:
02035       "CD-ROM Disc with Sun sparc boot created by libisofs"
02036     @since 0.6.6
02037     @param opts
02038            The option set to be manipulated.
02039     @param label
02040            A text of up to 128 characters.
02041     @return
02042            <=0 = error, 1 = success
02043 */ 
02044 int isoburn_igopt_set_disc_label(struct isoburn_imgen_opts *opts, char *label);
02045 
02046 /** Inquire the current setting made by isoburn_igopt_set_disc_label().
02047     @since 0.6.6
02048     @param opts
02049            The option set to be inquired.
02050     @param label
02051            Returns a pointer to the currently set label string.
02052            Do not alter this string.
02053            Use only as long as the opts object exists.
02054     @return
02055            <=0 = error, 1 = success
02056 */
02057 int isoburn_igopt_get_disc_label(struct isoburn_imgen_opts *opts,
02058                                  char **label);
02059 
02060 /** Set a serial number for the HFS+ extension of the emerging ISO image.
02061     @since 1.2.4
02062     @param opts
02063            The option set to be manipulated.
02064     @param serial_number
02065            8 bytes which should be unique to the image.
02066            If all bytes are 0, then the serial number will be generated as
02067            random number by libisofs. This is the default setting.
02068     @return
02069            <=0 = error, 1 = success
02070 */  
02071 int isoburn_igopt_set_hfsp_serial_number(struct isoburn_imgen_opts *opts,
02072                                          uint8_t serial_number[8]);
02073 
02074 
02075 /** Inquire the current setting made by isoburn_igopt_set_disc_label()
02076     @since 1.2.4
02077     @param opts
02078            The option set to be inquired.
02079     @param serial_number
02080            Will get filled with the current setting.
02081     @return
02082            <=0 = error, 1 = success
02083 */
02084 int isoburn_igopt_get_hfsp_serial_number(struct isoburn_imgen_opts *opts,
02085                                          uint8_t serial_number[8]);
02086 
02087 /** Set the allocation block size for HFS+ production and the block size
02088     for layout and address unit of Apple Partition map.
02089     @since 1.2.4
02090     @param opts
02091            The option set to be manipulated.
02092     @param hfsp_block_size
02093            -1 means that this setting shall be left unchanged
02094            0 allows the automatic default setting
02095            512 and 2048 enforce a size.
02096     @param apm_block_size
02097            -1 means that this setting shall be left unchanged
02098            0 allows the automatic default setting
02099            512 and 2048 enforce a size.
02100            Size 512 cannot be combined with GPT production.
02101            Size 2048 cannot be mounted -t hfsplus by Linux kernels at least up
02102            to 2.6.32.
02103     @return
02104            <=0 = error, 1 = success
02105 */
02106 int isoburn_igopt_set_hfsp_block_size(struct isoburn_imgen_opts *opts,
02107                                       int hfsp_block_size, int apm_block_size);
02108 
02109 /** Inquire the current setting made by isoburn_igopt_set_hfsp_block_size
02110     @since 1.2.4
02111     @param opts
02112            The option set to be inquired.
02113     @param hfsp_block_size
02114            Will be set to a value as described above. Except -1.
02115     @param apm_block_size
02116            Will be set to a value as described above. Except -1.
02117     @return
02118            <=0 = error, 1 = success
02119 */
02120 int isoburn_igopt_get_hfsp_block_size(struct isoburn_imgen_opts *opts,
02121                                     int *hfsp_block_size, int *apm_block_size);
02122 
02123 
02124 /** Set or inquire the write type for the next write run on optical media.
02125     @since 1.2.4
02126     @param opts
02127            The option set to be manipulated or inquired.
02128     @param do_tao
02129            The value to be set or the variable where to return the current
02130            setting:
02131             0 = Let libburn choose according to other write parameters.
02132                 This is advisable unless there are particular reasons not to
02133                 use one of the two write types. Be aware that 1 and -1 can
02134                 lead to failure if the write type is not appropriate for
02135                 the given media situation.
02136             1 = Use BURN_WRITE_TAO which does
02137                 TAO on CD, Incremental on DVD-R,
02138                 no track reservation on DVD+R and BD-R
02139            -1 = Use BURN_WRITE_SAO which does
02140                 SAO on CD, DAO on DVD-R,
02141                 track reservation on DVD+R and BD-R
02142     @return
02143            <=0 = error, 1 = success
02144 */
02145 int isoburn_igopt_set_write_type(struct isoburn_imgen_opts *opts, int do_tao);
02146 int isoburn_igopt_get_write_type(struct isoburn_imgen_opts *opts, int *do_tao);
02147 
02148 /** Set or inquire whether a final fsync(2) is performed when updating the
02149     multi-session information of libburn stdio pseudo-drives by
02150     isoburn_activate_session().
02151     Note:
02152     fsync(2) calls during and at the end of isoburn_disc_write() are controlled
02153     by libburn call burn_write_opts_set_stdio_fsync().
02154     @since 1.2.4
02155     @param opts
02156            The option set to be manipulated or inquired.
02157     @param do_sync
02158            1= call fsync(2) with stdio drives in isoburn_activate_session()
02159            0= do not
02160     @return
02161            <=0 = error, 1 = success
02162  */
02163 int isoburn_igopt_set_stdio_endsync(struct isoburn_imgen_opts *opts,
02164                                     int do_sync);
02165 int isoburn_igopt_get_stdio_endsync(struct isoburn_imgen_opts *opts,
02166                                     int *do_sync);
02167 
02168 /* ----------------------------------------------------------------------- */
02169 /*                      End of Options for image generation                */
02170 /* ----------------------------------------------------------------------- */
02171 
02172 
02173 /** Frontend of libisofs call iso_conv_name_chars() controlled by
02174     struct isoburn_imgen_opts rather than IsoWriteOpts.
02175     See libisofs.h for a more detailed description.
02176     @since 1.3.6
02177     @param opts
02178          Defines options like output charset, UCS-2 versus UTF-16 for Joliet,
02179          and naming restrictions.
02180     @param name
02181          The input text which shall be converted.
02182     @param name_len
02183          The number of bytes in input text.
02184     @param result
02185          Will return the conversion result in case of success. Terminated by 
02186          a trailing zero byte.
02187          Use free() to dispose it when no longer needed.
02188     @param result_len
02189          Will return the number of bytes in result (excluding trailing zero)
02190     @param flag
02191          Bitfield for control purposes.
02192            bit0-bit7= Name space
02193                       0= generic (to_charset is valid,
02194                                   no reserved characters, no length limits)
02195                       1= Rock Ridge (to_charset is valid)
02196                       2= Joliet (to_charset gets overridden by UCS-2 or UTF-16)
02197                       3= ECMA-119 (to_charset gets overridden by the
02198                                    dull ISO 9660 subset of ASCII)
02199                       4= HFS+ (to_charset gets overridden by UTF-16BE)
02200            bit8=  Treat input text as directory name
02201                   (matters for Joliet and ECMA-119)
02202            bit9=  Do not issue error messages
02203            bit15= Reverse operation (best to be done only with results of
02204                   previous conversions)
02205     @return
02206           1 means success, <=0 means error
02207 */
02208 int isoburn_conv_name_chars(struct isoburn_imgen_opts *opts,
02209                             char *name, size_t name_len,
02210                             char **result, size_t *result_len, int flag);
02211 
02212 
02213 /** Get the image attached to a drive, if any.
02214     @since 0.1.0
02215     @param d The drive to inquire
02216     @return A reference to attached image, or NULL if the drive has no image
02217             attached. This reference needs to be released via iso_image_unref()
02218             when it is not longer needed.
02219 */
02220 IsoImage *isoburn_get_attached_image(struct burn_drive *d);
02221 
02222 /** Get the start address of the image that is attached to the drive, if any.
02223     @since 1.2.2
02224     @param d The drive to inquire
02225     @return  The logical block address where the System Area of the image
02226              starts. <0 means that the address is invalid.
02227 */
02228 int isoburn_get_attached_start_lba(struct burn_drive *d);
02229 
02230 
02231 /** Load the ISO filesystem directory tree from the medium in the given drive.
02232     This will give libisoburn the base on which it can let libisofs perform
02233     image growing or image modification. The loaded volset gets attached
02234     to the drive object and handed out to the application.
02235     Not a wrapper, but peculiar to libisoburn.
02236     @since 0.1.0
02237     @param d The drive which holds an existing ISO filesystem or blank media.
02238              d is allowed to be NULL which produces an empty ISO image. In
02239              this case one has to call before writing isoburn_attach_volset()
02240              with the volset from this call and with the intended output
02241              drive.
02242     @param read_opts The read options which can be chosen by the application
02243     @param image the image read, if the disc is blank it will have no files.
02244              This reference needs to be released via iso_image_unref() when
02245              it is not longer needed. The drive, if not NULL, will hold an
02246              own reference which it will release when it gets a new volset
02247              or when it gets released via isoburn_drive_release().
02248              You can pass NULL if you already have a reference or you plan to
02249              obtain it later with isoburn_get_attached_image(). Of course, if
02250              you haven't specified a valid drive (i.e., if d == NULL), this
02251              parameter can't be NULL.
02252     @return <=0 error , 1 = success
02253 */
02254 int isoburn_read_image(struct burn_drive *d,
02255                        struct isoburn_read_opts *read_opts,
02256                        IsoImage **image);
02257 
02258 /** Set a callback function for producing pacifier messages during the lengthy
02259     process of image reading. The callback function and the application handle
02260     are stored until they are needed for the underlying call to libisofs.
02261     Other than with libisofs the handle is managed entirely by the application.
02262     An idle .free() function is exposed to libisofs. The handle has to stay
02263     valid until isoburn_read_image() is done. It has to be detached by
02264       isoburn_set_read_pacifier(drive, NULL, NULL);
02265     before it may be removed from memory.
02266     @since 0.1.0
02267     @param drive  The drive which will be used with isoburn_read_image()
02268                   It has to be acquired by an isoburn_* wrapper call.
02269     @param read_pacifier  The callback function
02270     @param app_handle  The app handle which the callback function can obtain
02271                        via iso_image_get_attached_data() from its IsoImage*
02272     @return 1 success, <=0 failure
02273 */
02274 int isoburn_set_read_pacifier(struct burn_drive *drive,
02275                               int (*read_pacifier)(IsoImage*, IsoFileSource*),
02276                               void *app_handle);
02277 
02278 /** Inquire the partition offset of the loaded image. The first 512 bytes of
02279     the image get examined whether they bear an MBR signature and a first
02280     partition table entry which matches the size of the image. In this case
02281     the start address is recorded as partition offset and internal buffers
02282     get adjusted.
02283     See also isoburn_igopt_set_part_offset().
02284     @since 0.6.2
02285     @param drive           The drive with the loaded image
02286     @param block_offset_2k returns the recognized partition offset
02287     @return <0 = error
02288              0 = no partition offset recognized
02289              1 = acceptable non-zero offset, buffers are adjusted
02290              2 = offset is credible but not acceptable for buffer size
02291 */ 
02292 int isoburn_get_img_partition_offset(struct burn_drive *drive,
02293                                      uint32_t *block_offset_2k);
02294 
02295 
02296 /** Set the IsoImage to be used with a drive. This eventually releases
02297     the reference to the old IsoImage attached to the drive.
02298     Caution: Use with care. It hardly makes sense to replace an image that
02299              reflects a valid ISO image on the medium.
02300     This call is rather intended for writing a newly created and populated
02301     image to blank media. The use case in xorriso is to let an image survive
02302     the change or demise of the outdev target drive. 
02303     @since 0.1.0
02304     @param d The drive which shall be write target of the volset.
02305     @param image The image that represents the image to be written.
02306              This image pointer MUST already be a valid reference suitable
02307              for iso_image_unref().
02308              It may have been obtained by appropriate libisofs calls or by
02309              isoburn_read_image() with d==NULL.
02310     @return <=0 error , 1 = success
02311 */ 
02312 int isoburn_attach_image(struct burn_drive *d, IsoImage *image);
02313 
02314 
02315 /** Set the start address of the image that is attached to the drive, if any.
02316     @since 1.2.2
02317     @param d    The drive to inquire
02318     @param lba  The logical block address where the System Area of the image
02319                 starts. <0 means that the address is invalid.
02320     @param flag Bitfield, submit 0 for now.
02321     @return     <=0 error (e.g. because no image is attached), 1 = success
02322 */
02323 int isoburn_attach_start_lba(struct burn_drive *d, int lba, int flag);
02324 
02325 
02326 /** Return the best possible estimation of the currently available capacity of
02327     the medium. This might depend on particular write option settings and on
02328     drive state.
02329     An eventual start address for emulated multi-session will be subtracted
02330     from the capacity estimation given by burn_disc_available_space().
02331     Negative results get defaulted to 0.
02332     Wrapper for: burn_disc_available_space()
02333     @since 0.1.0
02334     @param d The drive to query.
02335     @param o If not NULL: write parameters to be set on drive before query
02336     @return number of most probably available free bytes
02337 */
02338 off_t isoburn_disc_available_space(struct burn_drive *d,
02339                                    struct burn_write_opts *o);
02340 
02341 
02342 /** Obtain the start block number of the most recent session on the medium. In
02343     case of random access media this will normally be 0. Successful return is
02344     not a guarantee that there is a ISO-9660 image at all. The call will fail,
02345     nevertheless,if isoburn_disc_get_status() returns not BURN_DISC_APPENDABLE
02346     or BURN_DISC_FULL.
02347     Note: The result of this call may be fabricated by a previous call of
02348     isoburn_set_msc1() which can override the rule to load the most recent
02349     session.
02350     Wrapper for: burn_disc_get_msc1()
02351     @since 0.1.0
02352     @param d         The drive to inquire
02353     @param start_lba Contains on success the start address in 2048 byte blocks
02354     @return <=0 error , 1 = success
02355 */
02356 int isoburn_disc_get_msc1(struct burn_drive *d, int *start_lba);
02357 
02358 
02359 /** Use this with trackno==0 to obtain the predicted start block number of the
02360     new session. The interesting number is returned in parameter nwa.
02361     Wrapper for: burn_disc_track_lba_nwa()
02362     @since 0.1.0
02363     @param d         The drive to inquire
02364     @param o If not NULL: write parameters to be set on drive before query
02365     @param trackno Submit 0.
02366     @param lba return value: start lba
02367     @param nwa return value: Next Writeable Address
02368     @return 1=nwa is valid , 0=nwa is not valid , -1=error
02369 */
02370 int isoburn_disc_track_lba_nwa(struct burn_drive *d, struct burn_write_opts *o,
02371                                int trackno, int *lba, int *nwa);
02372 
02373 
02374 /** Obtain the size which was attributed to an emulated appendable on actually
02375     overwriteable media. This value is supposed to be <= 2048 * nwa as of
02376     isoburn_disc_track_lba_nwa().
02377     @since 0.1.0
02378     @param d     The drive holding the medium.
02379     @param start_byte The reply value counted in bytes, not in sectors.
02380     @param flag  Unused yet. Submit 0.
02381     @return 1=stat_byte is valid, 0=not an emulated appendable, -1=error 
02382 */
02383 int isoburn_get_min_start_byte(struct burn_drive *d, off_t *start_byte,
02384                                int flag);
02385 
02386 
02387 /** Start production of an ISO 9660 image using the method of Growing:
02388     Create a disc object for writing the new session from the created or loaded
02389     iso_volset which has been manipulated via libisofs, to the same medium from
02390     where the image was eventually loaded.
02391     This call starts a libisofs thread which begins to produce the image.
02392     It has to be revoked by isoburn_cancel_prepared_write() if for some reason
02393     this image data stream shall not be consumed.
02394     The returned struct burn_disc is ready for use by a subsequent call to
02395     isoburn_disc_write(). After this asynchronous writing has ended and the
02396     drive is BURN_DRIVE_IDLE again, the burn_disc object has to be disposed
02397     by burn_disc_free().
02398     @since 0.1.0
02399     @param drive The combined source and target drive, grabbed with
02400                  isoburn_drive_scan_and_grab(). .
02401     @param disc Returns the newly created burn_disc object.
02402     @param opts Image generation options, see isoburn_igopt_*()
02403     @return <=0 error , 1 = success
02404 */
02405 int isoburn_prepare_disc(struct burn_drive *drive, struct burn_disc **disc,
02406                          struct isoburn_imgen_opts *opts);
02407 
02408 
02409 /** Start production of an ISO 9660 image using the method of Modifying:
02410     Create a disc object for producing a new image from a previous image
02411     plus the changes made by user. The generated burn_disc is suitable
02412     to be written to a grabbed drive with blank writeable medium.
02413     But you must not use the same drive for input and output, because data
02414     will be read from the source drive while at the same time the target
02415     drive is already writing.
02416     This call starts a libisofs thread which begins to produce the image.
02417     It has to be revoked by isoburn_cancel_prepared_write() if for some reason
02418     this image data stream shall not be consumed.
02419     The resulting burn_disc object has to be disposed when all its writing
02420     is done and the drive is BURN_DRIVE_IDLE again after asynchronous
02421     burn_disc_write().
02422     @since 0.1.0
02423     @param in_drive The input drive, grabbed with isoburn_drive_aquire() or
02424                     one of its alternatives.
02425     @param disc     Returns the newly created burn_disc object.
02426     @param opts     Options for image generation and data transport to the
02427                     medium.
02428     @param out_drive The output drive, from isoburn_drive_aquire() et.al..
02429     @return <=0 error , 1 = success
02430 */
02431 int isoburn_prepare_new_image(struct burn_drive *in_drive,
02432                               struct burn_disc **disc,
02433                               struct isoburn_imgen_opts *opts,
02434                               struct burn_drive *out_drive);
02435 
02436 
02437 /** Start production of an ISO 9660 image using the method of Blind Growing:
02438     Create a disc object for writing an add-on session from the created or
02439     loaded IsoImage which has been manipulated via libisofs, to a different
02440     drive than the one from where it was loaded.
02441     Usually output will be stdio:/dev/fd/1 (i.e. stdout) being piped
02442     into some burn program like with this classic gesture:
02443       mkisofs -M $dev -C $msc1,$nwa | cdrecord -waiti dev=$dev
02444     Parameter translation into libisoburn:
02445       $dev  is the address by which parameter in_drive of this call was
02446             acquired $msc1 was set by isoburn_set_msc1() before image reading
02447             or was detected from the in_drive medium
02448       $nwa  is a parameter of this call
02449             or can be used as detected from the in_drive medium
02450 
02451     This call starts a libisofs thread which begins to produce the image.
02452     It has to be revoked by isoburn_cancel_prepared_write() if for some reason
02453     this image data stream shall not be consumed.
02454     This call waits for libisofs output to become available and then detaches
02455     the input drive object from the data source object by which libisofs was
02456     reading from the input drive.
02457     So, as far as libisofs is concerned, that drive may be released immediately
02458     after this call in order to allow the consumer to access the drive for
02459     writing.
02460     The consumer should wait for input to become available and only then open
02461     its burn drive. With cdrecord this is caused by option -waiti.
02462   
02463     The resulting burn_disc object has to be disposed when all its writing
02464     is done and the drive is BURN_DRIVE_IDLE again after asynchronous
02465     burn_disc_write().
02466     @since 0.2.2
02467     @param in_drive The input drive,grabbed with isoburn_drive_scan_and_grab().
02468     @param disc     Returns the newly created burn_disc object.
02469     @param opts     Options for image generation and data transport to media.
02470     @param out_drive The output drive, from isoburn_drive_aquire() et.al..
02471                     typically stdio:/dev/fd/1 .
02472     @param nwa      The address (2048 byte block count) where the add-on
02473                     session will be finally stored on a mountable medium
02474                     or in a mountable file.
02475                     If nwa is -1 then the address is used as determined from
02476                     the in_drive medium.
02477     @return <=0 error , 1 = success
02478 */
02479 int isoburn_prepare_blind_grow(struct burn_drive *in_drive,
02480                                struct burn_disc **disc,
02481                                struct isoburn_imgen_opts *opts,
02482                                struct burn_drive *out_drive, int nwa);
02483 
02484 
02485 /**
02486     Revoke isoburn_prepare_*() instead of running isoburn_disc_write().
02487     libisofs reserves resources and maybe already starts generating the
02488     image stream when one of above three calls is performed. It is mandatory to
02489     either run isoburn_disc_write() or to revoke the preparations by the
02490     call described here.
02491     If this call returns 0 or 1 then the write thread of libisofs has ended.
02492     @since 0.1.0
02493     @param input_drive   The drive or in_drive which was used with the
02494                          preparation call.
02495     @param output_drive  The out_drive used with isoburn_prepare_new_image(),
02496                          NULL if none.
02497     @param flag Bitfield, submit 0 for now.
02498                 bit0= -reserved for internal use-
02499     @return     <0 error, 0= no pending preparations detectable, 1 = canceled
02500 */
02501 int isoburn_cancel_prepared_write(struct burn_drive *input_drive,
02502                                   struct burn_drive *output_drive, int flag);
02503 
02504 
02505 /**
02506     Override the truncation setting that was made with flag bit2 during the
02507     call of isoburn_drive_aquire. This applies only to stdio pseudo drives.
02508     @since 0.1.6
02509     @param drive The drive which was acquired and shall be used for writing.
02510     @param flag Bitfield controlling the setting:
02511                 bit0= truncate (else do not truncate)
02512                 bit1= do not warn if call is inappropriate to drive
02513                 bit2= only set if truncation is currently enabled
02514                       do not warn if call is inappropriate to drive
02515     @return     1 success, 0 inappropriate drive, <0 severe error
02516 */
02517 int isoburn_set_truncate(struct burn_drive *drive, int flag);
02518 
02519 
02520 /** Start writing of the new session.
02521     This call is asynchrounous. I.e. it returns quite soon and the progress has
02522     to be watched by a loop with call burn_drive_get_status() until
02523     BURN_DRIVE_IDLE is returned.
02524     Wrapper for: burn_disc_write()
02525     @since 0.1.0
02526     @param o    Options which control the burn process. See burnwrite_opts_*()
02527                 in libburn.h.
02528     @param disc Disc object created either by isoburn_prepare_disc() or by
02529                 isoburn_prepare_new_image().
02530 */
02531 void isoburn_disc_write(struct burn_write_opts *o, struct burn_disc *disc);
02532 
02533 
02534 /** Inquire state and fill parameters of the fifo which is attached to
02535     the emerging track. This should be done in the pacifier loop while
02536     isoburn_disc_write() or burn_disc_write() are active.
02537     This works only with drives obtained by isoburn_drive_scan_and_grab()
02538     or isoburn_drive_grab(). If isoburn_prepare_new_image() was used, then
02539     parameter out_drive must have announced the track output drive.
02540     Hint: If only burn_write_opts and not burn_drive is known, then the drive
02541           can be obtained by burn_write_opts_get_drive().
02542     @since 0.1.0
02543     @param d     The drive to which the track with the fifo gets burned.
02544     @param size  The total size of the fifo
02545     @param free_bytes  The current free capacity of the fifo
02546     @param status_text  Returns a pointer to a constant text, see below
02547     @return  <0 reply invalid, >=0 fifo status code:
02548              bit0+1=input status, bit2=consumption status, i.e:
02549              0="standby"   : data processing not started yet
02550              1="active"    : input and consumption are active
02551              2="ending"    : input has ended without error
02552              3="failing"   : input had error and ended,
02553              4="unused"    : ( consumption has ended before processing start )
02554              5="abandoned" : consumption has ended prematurely
02555              6="ended"     : consumption has ended without input error
02556              7="aborted"   : consumption has ended after input error
02557 */
02558 int isoburn_get_fifo_status(struct burn_drive *d, int *size, int *free_bytes,
02559                             char **status_text);
02560 
02561 
02562 /** Inquire whether the most recent write run was successful.
02563     Wrapper for: burn_drive_wrote_well()
02564     @since 0.1.0
02565     @param d  The drive to inquire
02566     @return   1=burn seems to have went well, 0=burn failed
02567 */
02568 int isoburn_drive_wrote_well(struct burn_drive *d);
02569 
02570 
02571 /** Call this after isoburn_disc_write has finished and burn_drive_wrote_well()
02572     indicates success. It will eventually complete the emulation of
02573     multi-session functionality, if needed at all. Let libisoburn decide.
02574     Not a wrapper, but peculiar to libisoburn.
02575     @since 0.1.0
02576     @param d  The output drive to which the session was written
02577     @return   1 success , <=0 failure
02578 */
02579 int isoburn_activate_session(struct burn_drive *d);
02580 
02581 
02582 /** Wait after normal end of operations until libisofs ended all write
02583     threads and freed resource reservations.
02584     This call is not mandatory. But without it, messages from the ending
02585     threads might appear after the application ended its write procedure.
02586     @since 0.1.0
02587     @param input_drive   The drive or in_drive which was used with the
02588                          preparation call.
02589     @param output_drive  The out_drive used with isoburn_prepare_new_image(),
02590                          NULL if none.
02591     @param flag Bitfield, submit 0 for now.
02592     @return     <=0 error , 1 = success
02593 */
02594 int isoburn_sync_after_write(struct burn_drive *input_drive,
02595                              struct burn_drive *output_drive, int flag);
02596 
02597 
02598 /** Release an acquired drive.
02599     Wrapper for: burn_drive_release()
02600     @since 0.1.0
02601     @param drive The drive to be released
02602     @param eject 1= eject medium from drive , 0= do not eject
02603 */
02604 void isoburn_drive_release(struct burn_drive *drive, int eject);
02605 
02606 
02607 /** Shutdown all three libraries.
02608     Wrapper for : iso_finish() and burn_finish().
02609     @since 0.1.0
02610 */
02611 void isoburn_finish(void);
02612 
02613 
02614 /*
02615     The following calls are for expert applications only.
02616     An application should have a special reason to use them.
02617 */
02618 
02619 
02620 /** Inquire wether the medium needs emulation or would be suitable for
02621     generic multi-session via libburn.
02622     @since 0.1.0
02623     @param d  The drive to inquire
02624     @return 0 is generic multi-session 
02625             1 is emulated multi-session
02626            -1 is not suitable for isoburn
02627 */
02628 int isoburn_needs_emulation(struct burn_drive *d);
02629  
02630 
02631 /* ---------------------------- Test area ----------------------------- */
02632 
02633 /* no tests active, currently */
02634 
02635 #ifdef __cplusplus
02636 } /* extern "C" */
02637 #endif
02638 
02639 #endif /* LIBISOBURN_LIBISOBURN_H_ */
02640 

Generated for libisoburn by  doxygen 1.4.7