~ubuntu-branches/ubuntu/vivid/libdevice-cdio-perl/vivid-proposed

« back to all changes in this revision

Viewing changes to .pc/04_wrong_handling_of_output_parameters.patch/swig/perliso9660.swg

  • Committer: Package Import Robot
  • Author(s): intrigeri
  • Date: 2014-12-15 07:37:16 UTC
  • Revision ID: package-import@ubuntu.com-20141215073716-p1ed3txfo2ujlu3f
Tags: 0.3.0-3
* Team upload.
* Drop 04_wrong_handling_of_output_parameters.patch: we've not been
  able to find out what it was good for back in 2007, and it now causes
  at least one bug (Closes: #772005).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- c -*-
2
 
  See end for copyright and license.
3
 
*/
4
 
%define DOCSTRING 
5
 
"A Perl wrapper for The CD Input and Control library's ISO-9660 library
6
 
See also the ISO-9660 specification. The freely available European
7
 
equivalant standard is called ECMA-119."
8
 
%enddef
9
 
%module(docstring=DOCSTRING) perliso9660
10
 
 
11
 
%{
12
 
/* Includes the header in the wrapper code */
13
 
#include <time.h>
14
 
#include <cdio/iso9660.h>
15
 
#include <cdio/version.h>
16
 
%}
17
 
 
18
 
#include <time.h>
19
 
#include <cdio/iso9660.h>
20
 
#include <cdio/version.h>
21
 
 
22
 
/* Various libcdio constants and typedefs */
23
 
%include "types.swg"
24
 
 
25
 
%include "typemaps.i"
26
 
 
27
 
typedef uint8_t iso_extension_mask_t;
28
 
 
29
 
%constant long int ISO_BLOCKSIZE        = CDIO_CD_FRAMESIZE;
30
 
%constant long int PVD_SECTOR           = ISO_PVD_SECTOR ;
31
 
%constant long int EVD_SECTOR           = ISO_EVD_SECTOR ;
32
 
%constant long int LEN_ISONAME          = LEN_ISONAME;
33
 
%constant long int MAX_SYSTEM_ID        = ISO_MAX_SYSTEM_ID ;
34
 
%constant long int MAX_ISONAME          = MAX_ISONAME;
35
 
%constant long int MAX_PREPARER_ID      = ISO_MAX_PREPARER_ID ;
36
 
%constant long int MAX_ISOPATHNAME      = MAX_ISOPATHNAME;
37
 
 
38
 
%constant long int FILE                 = ISO_FILE;
39
 
%constant long int EXISTENCE            = ISO_EXISTENCE;
40
 
%constant long int DIRECTORY            = ISO_DIRECTORY;
41
 
%constant long int ASSOCIATED           = ISO_ASSOCIATED;
42
 
%constant long int RECORD               = ISO_RECORD;
43
 
 
44
 
/* When version 0.77 comes out, require it and fix this fix this. */
45
 
#if LIBCDIO_VERSION_NUM >= 77
46
 
%constant long int PROTECTION           = ISO_PROTECTION;
47
 
#else 
48
 
%constant long int PROTECTION           = 16;
49
 
#endif
50
 
 
51
 
%constant long int DRESERVED1           = ISO_DRESERVED1;
52
 
%constant long int DRESERVED2           = ISO_DRESERVED2;
53
 
%constant long int MULTIEXTENT          = ISO_MULTIEXTENT;
54
 
 
55
 
%constant long int VD_BOOT_RECORD       = ISO_VD_BOOT_RECORD;
56
 
%constant long int VD_PRIMARY           = ISO_VD_PRIMARY;
57
 
%constant long int VD_SUPPLEMENTARY     = ISO_VD_SUPPLEMENTARY;
58
 
%constant long int VD_PARITION          = ISO_VD_PARITION;
59
 
%constant long int VD_END               = ISO_VD_END;
60
 
 
61
 
%constant long int MAX_PUBLISHER_ID     = ISO_MAX_PUBLISHER_ID;
62
 
%constant long int MAX_APPLICATION_ID   = ISO_MAX_APPLICATION_ID;
63
 
%constant long int MAX_VOLUME_ID        = ISO_MAX_VOLUME_ID;
64
 
%constant long int MAX_VOLUMESET_ID     = ISO_MAX_VOLUMESET_ID;
65
 
%constant long int STANDARD_ID          = ISO_STANDARD_ID;
66
 
 
67
 
%constant long int NOCHECK              = ISO9660_NOCHECK;
68
 
%constant long int SEVEN_BIT            = ISO9660_7BIT;
69
 
%constant long int ACHARS               = ISO9660_ACHARS;
70
 
%constant long int DCHARS               = ISO9660_DCHARS;
71
 
 
72
 
%constant long int EXTENSION_JOLIET_LEVEL1 = ISO_EXTENSION_JOLIET_LEVEL1;
73
 
%constant long int EXTENSION_JOLIET_LEVEL2 = ISO_EXTENSION_JOLIET_LEVEL2;
74
 
%constant long int EXTENSION_JOLIET_LEVEL3 = ISO_EXTENSION_JOLIET_LEVEL3;
75
 
%constant long int EXTENSION_ROCK_RIDGE    = ISO_EXTENSION_ROCK_RIDGE;
76
 
%constant long int EXTENSION_HIGH_SIERRA   = ISO_EXTENSION_HIGH_SIERRA;
77
 
 
78
 
%constant long int EXTENSION_ALL           = ISO_EXTENSION_ALL;
79
 
%constant long int EXTENSION_NONE          = ISO_EXTENSION_NONE;
80
 
%constant long int EXTENSION_JOLIET        = ISO_EXTENSION_JOLIET;
81
 
 
82
 
/* Set up to allow functions to return stat lists of type "stat
83
 
   *". We'll use a typedef so we can make sure to isolate this. 
84
 
*/
85
 
%inline %{
86
 
typedef CdioList_t IsoStatList_t;
87
 
typedef iso9660_stat_t IsoStat_t;
88
 
%}
89
 
typedef CdioList_t IsoStatList_t;
90
 
typedef iso9660_stat_t IsoStat_t;
91
 
 
92
 
%typemap(out) IsoStat_t *{   
93
 
    // $1 is of type IsoStatList_t
94
 
    iso9660_stat_t *p_statbuf = result;
95
 
 
96
 
    if (!result) goto out;
97
 
 
98
 
 PPCODE:
99
 
    /* Have perl compute the length of the string using strlen() */
100
 
    XPUSHs(sv_2mortal(newSVpv(p_statbuf->filename, 0)));
101
 
    XPUSHs(sv_2mortal(newSViv(p_statbuf->lsn)));
102
 
    XPUSHs(sv_2mortal(newSViv(p_statbuf->size)));
103
 
    XPUSHs(sv_2mortal(newSViv(p_statbuf->secsize)));
104
 
    XPUSHs(sv_2mortal(newSViv(p_statbuf->type)));
105
 
    argvi += 7;
106
 
    free (p_statbuf);
107
 
 out: ;
108
 
}
109
 
 
110
 
%typemap(out) IsoStatList_t *{   
111
 
    // $1 is of type IsoStatList_t
112
 
    CdioList_t *p_entlist   = result;
113
 
    CdioListNode_t *p_entnode;
114
 
    unsigned int num = 0;
115
 
 
116
 
    if (!result) goto out;
117
 
 
118
 
 PPCODE:
119
 
    /* Figure out how many items in the array */
120
 
    _CDIO_LIST_FOREACH (p_entnode, p_entlist) {
121
 
      num +=5;
122
 
    }
123
 
 
124
 
    /* For each element in the array of strings, create a new
125
 
     * mortalscalar, and stuff it into the above array. */
126
 
    _CDIO_LIST_FOREACH (p_entnode, p_entlist) {
127
 
      iso9660_stat_t *p_statbuf = 
128
 
        (iso9660_stat_t *) _cdio_list_node_data (p_entnode);
129
 
      /* Have perl compute the length of the string using strlen() */
130
 
      XPUSHs(sv_2mortal(newSVpv(p_statbuf->filename, 0)));
131
 
      XPUSHs(sv_2mortal(newSViv(p_statbuf->lsn)));
132
 
      XPUSHs(sv_2mortal(newSViv(p_statbuf->size)));
133
 
      XPUSHs(sv_2mortal(newSViv(p_statbuf->secsize)));
134
 
      XPUSHs(sv_2mortal(newSViv(p_statbuf->type)));
135
 
    }
136
 
    _cdio_list_free (p_entlist, true);
137
 
    argvi += num + 2;
138
 
 out: ;
139
 
}
140
 
 
141
 
/*!
142
 
  Open an ISO 9660 image for reading. Maybe in the future we will have
143
 
  a mode. NULL is returned on error.
144
 
*/
145
 
%rename iso9660_open open_iso;
146
 
iso9660_t *iso9660_open (const char *psz_path /*flags, mode */);
147
 
 
148
 
/*!
149
 
  Open an ISO 9660 image for reading allowing various ISO 9660
150
 
  extensions.  Maybe in the future we will have a mode. NULL is
151
 
  returned on error.
152
 
*/
153
 
%rename iso9660_open_ext open_ext;
154
 
iso9660_t *iso9660_open_ext (const char *psz_path, 
155
 
                             iso_extension_mask_t iso_extension_mask);
156
 
 
157
 
/*!
158
 
  Open an ISO 9660 image for reading with some tolerence for positioning
159
 
  of the ISO9660 image. We scan for ISO_STANDARD_ID and use that to set
160
 
  the eventual offset to adjust by (as long as that is <= i_fuzz).
161
 
 
162
 
  Maybe in the future we will have a mode. NULL is returned on error.
163
 
 
164
 
  @see iso9660_open
165
 
*/
166
 
%rename iso9660_open_fuzzy open_fuzzy;
167
 
iso9660_t *iso9660_open_fuzzy (const char *psz_path /*flags, mode */,
168
 
                               uint16_t i_fuzz);
169
 
 
170
 
/*!
171
 
  Open an ISO 9660 image for reading with some tolerence for positioning
172
 
  of the ISO9660 image. We scan for ISO_STANDARD_ID and use that to set
173
 
  the eventual offset to adjust by (as long as that is <= i_fuzz).
174
 
 
175
 
  Maybe in the future we will have a mode. NULL is returned on error.
176
 
 
177
 
  @see iso9660_open
178
 
*/
179
 
%rename iso9660_open_fuzzy open_fuzzy_ext;
180
 
iso9660_t *iso9660_open_fuzzy_ext (const char *psz_path,
181
 
                                   iso_extension_mask_t iso_extension_mask,
182
 
                                   uint16_t i_fuzz
183
 
                                   /*flags, mode */);
184
 
/*!
185
 
  Read the Super block of an ISO 9660 image but determine framesize
186
 
  and datastart and a possible additional offset. Generally here we are
187
 
  not reading an ISO 9660 image but a CD-Image which contains an ISO 9660
188
 
  filesystem.
189
 
*/
190
 
%rename iso9660_ifs_fuzzy_read_superblock ifs_fuzzy_read_superblock;
191
 
bool iso9660_ifs_fuzzy_read_superblock (iso9660_t *p_iso, 
192
 
                                        iso_extension_mask_t iso_extension_mask,
193
 
                                        uint16_t i_fuzz);
194
 
/*!
195
 
  Close previously opened ISO 9660 image.
196
 
  True is unconditionally returned. If there was an error false would
197
 
  be returned.
198
 
*/
199
 
%rename iso9660_close close;
200
 
bool iso9660_close (iso9660_t * p_iso);
201
 
 
202
 
%typemap(out) buf_t {   
203
 
  /* $1 is of type buf_t */
204
 
  ST(argvi) = sv_newmortal();
205
 
  if (result) {
206
 
    /* I don't yet know how to pick up arg4 another way.
207
 
       THIS MEANS ARG3 MUST ALWAYS BE THE SIZE.  */
208
 
    sv_setpvn((SV*)ST(argvi++), (char *) result, *arg4);
209
 
    /* Don't leak memory. return value was malloc'd by libcdio. */
210
 
    /* free(result);   */
211
 
  } else {
212
 
    sv_setsv((SV*)ST(argvi++), &PL_sv_undef);
213
 
  }
214
 
}
215
 
%inline %{
216
 
  typedef long int my_ssize_t;
217
 
%}
218
 
%apply my_ssize_t *OUTPUT { my_ssize_t *pi_size };
219
 
 
220
 
/*!  Seek to a position and then read n bytes. (buffer, size) are
221
 
  returned.
222
 
*/
223
 
%newobject seek_read; // free malloc'd return value
224
 
typedef char *buf_t;
225
 
buf_t seek_read (const iso9660_t *p_iso, 
226
 
                 lsn_t start, long int i_size, 
227
 
                 /*out*/ my_ssize_t *pi_size);
228
 
%inline %{
229
 
typedef char *buf_t;
230
 
buf_t seek_read (const iso9660_t *p_iso, 
231
 
                 lsn_t start, long int i_size,
232
 
                 /*out*/ my_ssize_t *pi_size) {
233
 
  
234
 
  char *p_buf = calloc(ISO_BLOCKSIZE, i_size);
235
 
  *pi_size = iso9660_iso_seek_read(p_iso, p_buf, start, i_size);
236
 
  return p_buf;
237
 
 }
238
 
%}
239
 
 
240
 
 
241
 
/*!
242
 
  Read the Primary Volume Descriptor for a CD.
243
 
  True is returned if read, and false if there was an error.
244
 
*/
245
 
iso9660_pvd_t *fs_read_pvd ( const CdIo_t *p_cdio );
246
 
%inline %{
247
 
iso9660_pvd_t *fs_read_pvd ( const CdIo_t *p_cdio ) {
248
 
  static iso9660_pvd_t pvd;
249
 
  bool b_ok = iso9660_fs_read_pvd ( p_cdio, &pvd );
250
 
  if (!b_ok) return NULL;
251
 
  return &pvd;
252
 
 }
253
 
%}
254
 
 
255
 
/*!
256
 
  Read the Primary Volume Descriptor for an ISO 9660 image.
257
 
  True is returned if read, and false if there was an error.
258
 
*/
259
 
iso9660_pvd_t *ifs_read_pvd ( const iso9660_t *p_iso );
260
 
%inline %{
261
 
iso9660_pvd_t *ifs_read_pvd ( const iso9660_t *p_iso ) {
262
 
  static iso9660_pvd_t pvd;
263
 
  bool b_ok = iso9660_ifs_read_pvd ( p_iso, &pvd );
264
 
  if (!b_ok) return NULL;
265
 
  return &pvd;
266
 
 }
267
 
%}
268
 
 
269
 
/*!
270
 
  Read the Super block of an ISO 9660 image. This is the 
271
 
  Primary Volume Descriptor (PVD) and perhaps a Supplemental Volume 
272
 
  Descriptor if (Joliet) extensions are acceptable.
273
 
*/
274
 
%rename iso9660_fs_read_superblock fs_read_superblock;
275
 
bool iso9660_fs_read_superblock (CdIo_t *p_cdio, 
276
 
                                 iso_extension_mask_t iso_extension_mask);
277
 
 
278
 
/*!
279
 
  Read the Super block of an ISO 9660 image. This is the 
280
 
  Primary Volume Descriptor (PVD) and perhaps a Supplemental Volume 
281
 
  Descriptor if (Joliet) extensions are acceptable.
282
 
*/
283
 
%rename iso9660_ifs_read_superblock ifs_read_superblock;
284
 
bool iso9660_ifs_read_superblock (iso9660_t *p_iso,
285
 
                                  iso_extension_mask_t iso_extension_mask);
286
 
 
287
 
 
288
 
/*====================================================
289
 
  Time conversion 
290
 
 ====================================================*/
291
 
/*!
292
 
  Set time in format used in ISO 9660 directory index record
293
 
  from a Unix time structure. */
294
 
iso9660_dtime_t *
295
 
set_dtime ( int tm_sec, int tm_min, int tm_hour, int tm_mday, int tm_mon, 
296
 
            int tm_year);
297
 
%inline %{
298
 
iso9660_dtime_t *
299
 
set_dtime ( int tm_sec, int tm_min, int tm_hour, int tm_mday, int tm_mon, 
300
 
            int tm_year)
301
 
{
302
 
  struct tm tm = { tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year, 0, 0, 0 };
303
 
  static iso9660_dtime_t dtime;
304
 
  iso9660_set_dtime (&tm, &dtime);
305
 
  return &dtime;
306
 
}
307
 
%}
308
 
 
309
 
/*!
310
 
  Set "long" time in format used in ISO 9660 primary volume descriptor
311
 
  from a Unix time structure. */
312
 
iso9660_ltime_t *
313
 
set_ltime ( int tm_sec, int tm_min, int tm_hour, int tm_mday, int tm_mon, 
314
 
            int tm_year);
315
 
 
316
 
%inline %{
317
 
iso9660_ltime_t *
318
 
set_ltime ( int tm_sec, int tm_min, int tm_hour, int tm_mday, int tm_mon, 
319
 
            int tm_year)
320
 
 
321
 
{
322
 
  struct tm tm = { tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year, 0, 0, 0 };
323
 
  static iso9660_ltime_t ldate;
324
 
  iso9660_set_ltime (&tm, &ldate);
325
 
  return &ldate;
326
 
}
327
 
%}
328
 
 
329
 
/*!
330
 
  Get Unix time structure from format use in an ISO 9660 directory index 
331
 
  record. Even though tm_wday and tm_yday fields are not explicitly in
332
 
  dtime, they are calculated from the other fields.
333
 
 
334
 
  If tm is to reflect the localtime, set "use_localtime" true, otherwise
335
 
  tm will reported in GMT.
336
 
*/
337
 
%apply int *OUTPUT { int *tm_sec, int *tm_min,  int *tm_hour, int *tm_mday,
338
 
                     int *tm_mon, int *tm_year, int *tm_wday, int *tm_yday,
339
 
                     int *tm_isdst };
340
 
 
341
 
bool get_dtime (const iso9660_dtime_t *dtime, bool use_localtime,
342
 
                int *tm_sec, int *tm_min,  int *tm_hour, int *tm_mday,
343
 
                int *tm_mon, int *tm_year, int *tm_wday, int *tm_yday,
344
 
                int *tm_isdst);
345
 
 
346
 
%inline %{
347
 
bool get_dtime (const iso9660_dtime_t *dtime, bool use_localtime,
348
 
                int *tm_sec, int *tm_min,  int *tm_hour, int *tm_mday,
349
 
                int *tm_mon, int *tm_year, int *tm_wday, int *tm_yday,
350
 
                int *tm_isdst) 
351
 
{
352
 
  struct tm tm;
353
 
  bool b_okay = iso9660_get_dtime (dtime, use_localtime, &tm);
354
 
  if (b_okay) {
355
 
    *tm_sec   = tm.tm_sec;
356
 
    *tm_min   = tm.tm_min;
357
 
    *tm_hour  = tm.tm_hour;
358
 
    *tm_mon   = tm.tm_mon;
359
 
    *tm_mday  = tm.tm_mday;
360
 
    *tm_year  = tm.tm_year;
361
 
    *tm_wday  = tm.tm_wday;
362
 
    *tm_yday  = tm.tm_yday;
363
 
    *tm_isdst = tm.tm_isdst;
364
 
  }
365
 
  return b_okay;
366
 
}
367
 
%}
368
 
 
369
 
/*!
370
 
  Get "long" time in format used in ISO 9660 primary volume descriptor
371
 
  from a Unix time structure. 
372
 
*/
373
 
bool get_ltime (const iso9660_ltime_t *dtime, 
374
 
                int *tm_sec, int *tm_min,  int *tm_hour, int *tm_mday,
375
 
                int *tm_mon, int *tm_year, int *tm_wday, int *tm_yday,
376
 
                int *tm_isdst);
377
 
 
378
 
%inline %{
379
 
bool get_ltime (const iso9660_ltime_t *p_ldate, 
380
 
                int *tm_sec, int *tm_min,  int *tm_hour, int *tm_mday,
381
 
                int *tm_mon, int *tm_year, int *tm_wday, int *tm_yday,
382
 
                int *tm_isdst) 
383
 
{
384
 
  struct tm tm;
385
 
  bool b_okay = iso9660_get_ltime (p_ldate, &tm);
386
 
  if (b_okay) {
387
 
    *tm_sec   = tm.tm_sec;
388
 
    *tm_min   = tm.tm_min;
389
 
    *tm_hour  = tm.tm_hour;
390
 
    *tm_mon   = tm.tm_mon;
391
 
    *tm_mday  = tm.tm_mday;
392
 
    *tm_year  = tm.tm_year;
393
 
    *tm_wday  = tm.tm_wday;
394
 
    *tm_yday  = tm.tm_yday;
395
 
    *tm_isdst = tm.tm_isdst;
396
 
  }
397
 
  return b_okay;
398
 
}
399
 
%}
400
 
 
401
 
 
402
 
/*========================================================
403
 
  Characters used in file and directory and manipulation
404
 
 =======================================================*/
405
 
/*!
406
 
   Return true if c is a DCHAR - a character that can appear in an an
407
 
   ISO-9600 level 1 directory name. These are the ASCII capital
408
 
   letters A-Z, the digits 0-9 and an underscore.
409
 
*/
410
 
%rename iso9660_isdchar is_dchar;
411
 
bool iso9660_isdchar (int c);
412
 
 
413
 
/*!
414
 
   Return true if c is an ACHAR - 
415
 
   These are the DCHAR's plus some ASCII symbols including the space 
416
 
   symbol.   
417
 
*/
418
 
%rename iso9660_isachar is_achar;
419
 
bool iso9660_isachar (int c);
420
 
 
421
 
/*!
422
 
   Convert an ISO-9660 file name that stored in a directory entry into 
423
 
   what's usually listed as the file name in a listing.
424
 
   Lowercase name, and remove trailing ;1's or .;1's and
425
 
   turn the other ;'s into version numbers.
426
 
 
427
 
   @param psz_oldname the ISO-9660 filename to be translated.
428
 
   @param psz_newname returned string. The caller allocates this and
429
 
   it should be at least the size of psz_oldname.
430
 
   @return length of the translated string is returned.
431
 
*/
432
 
%newobject name_translate;
433
 
char * name_translate(const char *psz_oldname);
434
 
%inline %{
435
 
char *
436
 
name_translate(const char *psz_oldname) {
437
 
  char *psz_newname=calloc(sizeof(char), strlen(psz_oldname)+1);
438
 
  iso9660_name_translate(psz_oldname, psz_newname);
439
 
  return psz_newname;
440
 
}
441
 
%}
442
 
 
443
 
/*!
444
 
   Convert an ISO-9660 file name that stored in a directory entry into
445
 
   what's usually listed as the file name in a listing.  Lowercase
446
 
   name if no Joliet Extension interpretation. Remove trailing ;1's or
447
 
   .;1's and turn the other ;'s into version numbers.
448
 
 
449
 
   @param psz_oldname the ISO-9660 filename to be translated.
450
 
   @param psz_newname returned string. The caller allocates this and
451
 
   it should be at least the size of psz_oldname.
452
 
   @param i_joliet_level 0 if not using Joliet Extension. Otherwise the
453
 
   Joliet level.
454
 
   @return length of the translated string is returned. It will be no greater
455
 
   than the length of psz_oldname.
456
 
*/
457
 
%newobject name_translate_ext;
458
 
char * name_translate_ext(const char *psz_oldname, uint8_t i_joliet_level);
459
 
%inline %{
460
 
char * 
461
 
name_translate_ext(const char *psz_oldname, uint8_t i_joliet_level) {
462
 
  char *psz_newname=calloc(sizeof(char), strlen(psz_oldname)+1);
463
 
  iso9660_name_translate_ext(psz_oldname, psz_newname, i_joliet_level);
464
 
  return psz_newname;
465
 
}
466
 
%}
467
 
 
468
 
/*!  
469
 
  Pad string src with spaces to size len and copy this to dst. If
470
 
  len is less than the length of src, dst will be truncated to the
471
 
  first len characters of src.
472
 
 
473
 
  src can also be scanned to see if it contains only ACHARs, DCHARs, 
474
 
  7-bit ASCII chars depending on the enumeration _check.
475
 
 
476
 
  In addition to getting changed, dst is the return value.
477
 
  Note: this string might not be NULL terminated.
478
 
 */
479
 
%newobject strncpy_pad; // free malloc'd return value
480
 
char *strncpy_pad(const char src[], size_t len, enum strncpy_pad_check _check);
481
 
%inline %{
482
 
char *
483
 
strncpy_pad(const char src[], size_t len, enum strncpy_pad_check _check) {
484
 
  char *dst = calloc(sizeof(char), len+1);
485
 
  return iso9660_strncpy_pad(dst, src, len, _check);
486
 
}
487
 
%}
488
 
 
489
 
/*=====================================================================
490
 
  Files and Directory Names 
491
 
======================================================================*/
492
 
 
493
 
/*!
494
 
  Check that psz_path is a valid ISO-9660 directory name.
495
 
 
496
 
  A valid directory name should not start out with a slash (/), 
497
 
  dot (.) or null byte, should be less than 37 characters long, 
498
 
  have no more than 8 characters in a directory component 
499
 
  which is separated by a /, and consist of only DCHARs. 
500
 
 
501
 
  True is returned if psz_path is valid.
502
 
 */
503
 
%rename iso9660_dirname_valid_p dirname_valid_p;
504
 
bool iso9660_dirname_valid_p (const char psz_path[]);
505
 
 
506
 
/*!  
507
 
  Take psz_path and a version number and turn that into a ISO-9660
508
 
  pathname.  (That's just the pathname followed by ";" and the version
509
 
  number. For example, mydir/file.ext -> MYDIR/FILE.EXT;1 for version
510
 
  1. The resulting ISO-9660 pathname is returned.
511
 
*/
512
 
%rename iso9660_pathname_isofy pathname_isofy;
513
 
%newobject iso9660_pathname_isofy; // free malloc'd return value
514
 
char *iso9660_pathname_isofy (const char psz_path[], uint16_t i_version);
515
 
 
516
 
/*!
517
 
  Check that psz_path is a valid ISO-9660 pathname.  
518
 
 
519
 
  A valid pathname contains a valid directory name, if one appears and
520
 
  the filename portion should be no more than 8 characters for the
521
 
  file prefix and 3 characters in the extension (or portion after a
522
 
  dot). There should be exactly one dot somewhere in the filename
523
 
  portion and the filename should be composed of only DCHARs.
524
 
  
525
 
  True is returned if psz_path is valid.
526
 
 */
527
 
%rename iso9660_pathname_valid_p pathname_valid_p;
528
 
bool iso9660_pathname_valid_p (const char psz_path[]);
529
 
 
530
 
/* ... */
531
 
 
532
 
/*!
533
 
   Given a directory pointer, find the filesystem entry that contains
534
 
   lsn and return information about it.
535
 
 
536
 
   Returns stat_t of entry if we found lsn, or NULL otherwise.
537
 
 */
538
 
%rename iso9660_find_fs_lsn fs_find_lsn;
539
 
IsoStat_t *iso9660_find_fs_lsn(CdIo_t *p_cdio, lsn_t i_lsn);
540
 
 
541
 
 
542
 
#if LIBCDIO_VERSION_NUM > 76
543
 
/*!
544
 
   Given a directory pointer, find the filesystem entry that contains
545
 
   lsn and return information about it.
546
 
 
547
 
   Returns stat_t of entry if we found lsn, or NULL otherwise.
548
 
 */
549
 
%rename iso9660_ifs_find_lsn ifs_find_lsn;
550
 
IsoStat_t *iso9660_ifs_find_lsn(const iso9660_t *p_iso, lsn_t i_lsn);
551
 
#endif
552
 
 
553
 
 
554
 
/*!
555
 
  Return file status for psz_path. NULL is returned on error.
556
 
 */
557
 
%rename iso9660_fs_stat fs_stat;
558
 
IsoStat_t *iso9660_fs_stat (CdIo_t *p_cdio, const char psz_path[]);
559
 
  
560
 
 
561
 
/*!  
562
 
  Return file status for path name psz_path. NULL is returned on error.
563
 
  pathname version numbers in the ISO 9660 name are dropped, i.e. ;1
564
 
  is removed and if level 1 ISO-9660 names are lowercased.
565
 
 
566
 
  The b_mode2 parameter is not used.
567
 
 */
568
 
%rename iso9660_fs_stat_translate fs_stat_translate;
569
 
IsoStat_t *iso9660_fs_stat_translate (CdIo_t *p_cdio, 
570
 
                                      const char psz_path[], 
571
 
                                      bool b_mode2=false);
572
 
 
573
 
/*!  
574
 
  Return file status for pathname. NULL is returned on error.
575
 
 */
576
 
%rename iso9660_ifs_stat ifs_stat;
577
 
IsoStat_t *iso9660_ifs_stat (iso9660_t *p_iso, const char psz_path[]);
578
 
 
579
 
 
580
 
/*!  Return file status for path name psz_path. NULL is returned on
581
 
  error.  pathname version numbers in the ISO 9660 name are dropped,
582
 
  i.e. ;1 is removed and if level 1 ISO-9660 names are lowercased.
583
 
 */
584
 
%rename iso9660_ifs_stat_translate ifs_stat_translate;
585
 
IsoStat_t *iso9660_ifs_stat_translate (iso9660_t *p_iso, 
586
 
                                       const char psz_path[]);
587
 
 
588
 
/*!  Read psz_path (a directory) and return a list of iso9660_stat_t
589
 
  pointers for the files inside that directory. The caller must free the
590
 
  returned result.
591
 
*/
592
 
%newobject fs_readdir; // free malloc'd return value
593
 
IsoStatList_t *fs_readdir (CdIo_t *p_cdio, const char psz_path[]);
594
 
 
595
 
%inline %{
596
 
IsoStatList_t *fs_readdir (CdIo_t *p_cdio, const char psz_path[])
597
 
{
598
 
  CdioList_t *p_statlist = iso9660_fs_readdir (p_cdio, psz_path, false);
599
 
  return p_statlist;
600
 
}
601
 
%}
602
 
 
603
 
/*!  Read psz_path (a directory) and return a list of iso9660_stat_t
604
 
  pointers for the files inside that directory. The caller must free
605
 
  the returned result.
606
 
*/
607
 
%newobject ifs_readdir; // free malloc'd return value
608
 
IsoStatList_t *ifs_readdir (iso9660_t *p_iso, const char psz_path[]);
609
 
 
610
 
%inline %{
611
 
IsoStatList_t *ifs_readdir (iso9660_t *p_iso, const char psz_path[])
612
 
{
613
 
  CdioList_t *p_statlist = iso9660_ifs_readdir (p_iso, psz_path);
614
 
  return p_statlist;
615
 
}
616
 
%}
617
 
 
618
 
/*!
619
 
  Return the PVD's application ID.
620
 
  NULL is returned if there is some problem in getting this. 
621
 
*/
622
 
%rename iso9660_get_application_id get_application_id;
623
 
char * iso9660_get_application_id(iso9660_pvd_t *p_pvd);
624
 
  
625
 
/*!  
626
 
  Get the application ID.  Return NULL if there
627
 
  is some problem in getting this.
628
 
*/
629
 
%newobject get_application_id; // free malloc'd return value
630
 
char *ifs_get_application_id(iso9660_t *p_iso);
631
 
%inline %{
632
 
char *
633
 
ifs_get_application_id(iso9660_t *p_iso) {
634
 
  char *psz;
635
 
  bool ok = iso9660_ifs_get_application_id(p_iso, &psz);
636
 
  if (!ok) return NULL;
637
 
  return psz;
638
 
}
639
 
%}
640
 
 
641
 
 
642
 
/*!  
643
 
  Return the Joliet level recognized for p_iso.
644
 
*/
645
 
%rename iso9660_ifs_get_joliet_level get_joliet_level;
646
 
uint8_t iso9660_ifs_get_joliet_level(iso9660_t *p_iso);
647
 
 
648
 
%rename iso9660_get_dir_len get_dir_len;
649
 
uint8_t iso9660_get_dir_len(const iso9660_dir_t *p_idr);
650
 
 
651
 
/*!
652
 
  Return the directory name stored in the iso9660_dir_t
653
 
*/
654
 
%rename iso9660_get_to_name get_to_name;
655
 
%newobject iso9660_dir_to_name; // free malloc'd return value
656
 
char * iso9660_dir_to_name (const iso9660_dir_t *p_iso9660_dir);
657
 
  
658
 
#if LIBCDIO_VERSION_NUM > 76
659
 
/*!  
660
 
  Returns a POSIX mode for a given p_iso_dirent.
661
 
*/
662
 
%rename iso9660_get_posix_filemode get_posix_filemode;
663
 
mode_t iso9660_get_posix_filemode(const iso9660_stat_t *p_iso_dirent);
664
 
#endif
665
 
 
666
 
/*!
667
 
  Return a string containing the preparer id with trailing
668
 
  blanks removed.
669
 
*/
670
 
%rename iso9660_get_preparer_id get_preparer_id;
671
 
char *iso9660_get_preparer_id(const iso9660_pvd_t *p_pvd);
672
 
 
673
 
/*!  Get the preparer ID.  Return NULL if there is some problem in
674
 
  getting this.
675
 
*/
676
 
%newobject ifs_get_preparer_id; // free malloc'd return value
677
 
char *ifs_get_preparer_id(iso9660_t *p_iso);
678
 
%inline %{
679
 
char *
680
 
ifs_get_preparer_id(iso9660_t *p_iso) {
681
 
  char *psz;
682
 
  bool ok = iso9660_ifs_get_preparer_id(p_iso, &psz);
683
 
  if (!ok) return NULL;
684
 
  return psz;
685
 
}
686
 
%}
687
 
 
688
 
/*!
689
 
  Return a string containing the PVD's publisher id with trailing
690
 
  blanks removed.
691
 
*/
692
 
%rename iso9660_get_publisher_id get_publisher_id;
693
 
char *iso9660_get_publisher_id(const iso9660_pvd_t *p_pvd);
694
 
 
695
 
/*!  
696
 
  Get the publisher ID.  return NULL if there
697
 
  is some problem in getting this.
698
 
*/
699
 
%newobject ifs_get_publisher_id; // free malloc'd return value
700
 
char *ifs_get_publisher_id(iso9660_t *p_iso);
701
 
%inline %{
702
 
char *
703
 
ifs_get_publisher_id(iso9660_t *p_iso) {
704
 
  char *psz;
705
 
  bool ok = iso9660_ifs_get_publisher_id(p_iso, &psz);
706
 
  if (!ok) return NULL;
707
 
  return psz;
708
 
}
709
 
%}
710
 
 
711
 
%rename iso9660_get_pvd_type get_pvd_type;
712
 
uint8_t iso9660_get_pvd_type(const iso9660_pvd_t *p_pvd);
713
 
  
714
 
%rename iso9660_get_pvd_id get_pvd_id;
715
 
const char * iso9660_get_pvd_id(const iso9660_pvd_t *p_pvd);
716
 
 
717
 
%rename iso9660_get_pvd_space_size get_pvd_space_size;
718
 
int iso9660_get_pvd_space_size(const iso9660_pvd_t *p_pvd);
719
 
 
720
 
%rename iso9660_get_pvd_block_size get_pvd_block_size;
721
 
int iso9660_get_pvd_block_size(const iso9660_pvd_t *p_pvd) ;
722
 
 
723
 
/*! Return the primary volume id version number (of pvd).
724
 
  If there is an error 0 is returned. 
725
 
*/
726
 
%rename iso9660_get_pvd_version get_pvd_version;
727
 
int iso9660_get_pvd_version(const iso9660_pvd_t *pvd) ;
728
 
 
729
 
/*!
730
 
  Return a string containing the PVD's system id with trailing
731
 
  blanks removed.
732
 
*/
733
 
%rename iso9660_get_system_id get_system_id;
734
 
char *iso9660_get_system_id(const iso9660_pvd_t *p_pvd);
735
 
 
736
 
/*!  
737
 
  Get the system ID.  return NULL if there
738
 
  is some problem in getting this.
739
 
*/
740
 
%newobject ifs_get_system_id; // free malloc'd return value
741
 
char *ifs_get_system_id(iso9660_t *p_iso);
742
 
%inline %{
743
 
char *
744
 
ifs_get_system_id(iso9660_t *p_iso) {
745
 
  char *psz;
746
 
  bool ok = iso9660_ifs_get_system_id(p_iso, &psz);
747
 
  if (!ok) return NULL;
748
 
  return psz;
749
 
}
750
 
%}
751
 
 
752
 
/*! Return the LSN of the root directory for pvd.
753
 
  If there is an error CDIO_INVALID_LSN is returned. 
754
 
*/
755
 
%rename iso9660_get_root_lsn get_root_lsn;
756
 
lsn_t iso9660_get_root_lsn(const iso9660_pvd_t *p_pvd);
757
 
 
758
 
/*!
759
 
  Return the PVD's volume ID.
760
 
*/
761
 
%rename iso9660_get_volume_id get_volume_id;
762
 
char *iso9660_get_volume_id(const iso9660_pvd_t *p_pvd);
763
 
 
764
 
/*!  
765
 
  Get the system ID.  return NULL if there
766
 
  is some problem in getting this.
767
 
*/
768
 
%newobject ifs_get_volume_id; // free malloc'd return value
769
 
char *ifs_get_volume_id(iso9660_t *p_iso);
770
 
%inline %{
771
 
char *
772
 
ifs_get_volume_id(iso9660_t *p_iso) {
773
 
  char *psz;
774
 
  bool ok = iso9660_ifs_get_volume_id(p_iso, &psz);
775
 
  if (!ok) return NULL;
776
 
  return psz;
777
 
}
778
 
%}
779
 
 
780
 
/*!
781
 
  Return the PVD's volumeset ID.
782
 
  NULL is returned if there is some problem in getting this. 
783
 
*/
784
 
%rename iso9660_get_volumeset_id get_volumeset_id;
785
 
char *iso9660_get_volumeset_id(const iso9660_pvd_t *p_pvd);
786
 
 
787
 
/*!  
788
 
  Get the volumeset ID.  return NULL if there
789
 
  is some problem in getting this.
790
 
*/
791
 
%newobject ifs_get_volumeset_id; // free malloc'd return value
792
 
char *ifs_get_volumeset_id(iso9660_t *p_iso);
793
 
%inline %{
794
 
char *
795
 
ifs_get_volumeset_id(iso9660_t *p_iso) {
796
 
  char *psz;
797
 
  bool ok = iso9660_ifs_get_volumeset_id(p_iso, &psz);
798
 
  if (!ok) return NULL;
799
 
  return psz;
800
 
}
801
 
%}
802
 
 
803
 
/* ================= pathtable  ================== */
804
 
  
805
 
/*! Zero's out pathable. Do this first. */
806
 
%rename iso9660_pathtable_init pathtable_init;
807
 
void iso9660_pathtable_init (void *pt);
808
 
  
809
 
%rename iso9660_pathtable_get_size pathtable_get_size;
810
 
unsigned int iso9660_pathtable_get_size (const void *pt);
811
 
  
812
 
%rename iso9660_pathtable_l_add_entry pathtable_l_add_entry;
813
 
uint16_t iso9660_pathtable_l_add_entry (void *pt, const char name[], 
814
 
                                        uint32_t extent, uint16_t parent);
815
 
  
816
 
%rename iso9660_pathtable_m_add_entry pathtable_m_add_entry;
817
 
uint16_t iso9660_pathtable_m_add_entry (void *pt, const char name[], 
818
 
                                        uint32_t extent, uint16_t parent);
819
 
  
820
 
/*======================================================================
821
 
   Volume Descriptors
822
 
========================================================================*/
823
 
 
824
 
#ifdef FINSHED
825
 
void iso9660_set_pvd (void *pd, const char volume_id[], 
826
 
                      const char application_id[], 
827
 
                      const char publisher_id[], const char preparer_id[],
828
 
                      uint32_t iso_size, const void *root_dir, 
829
 
                      uint32_t path_table_l_extent, 
830
 
                      uint32_t path_table_m_extent,
831
 
                      uint32_t path_table_size, const time_t *pvd_time);
832
 
#endif /*FINISHED*/
833
 
 
834
 
%rename iso9660_set_evd set_evd;
835
 
void iso9660_set_evd (void *pd);
836
 
 
837
 
/*!
838
 
  Return true if ISO 9660 image has extended attrributes (XA).
839
 
*/
840
 
%rename iso9660_ifs_is_xa is_xa;
841
 
bool iso9660_ifs_is_xa (const iso9660_t * p_iso);
842
 
 
843
 
%perlcode %{
844
 
 
845
 
import Device::Cdio::VERSION;
846
 
$VERSION = $Device::Cdio::VERSION;
847
 
use strict;
848
 
=pod
849
 
 
850
 
=head1 NAME
851
 
 
852
 
perliso9660 - lower-level wrapper to libiso9660, the ISO 9660 library of the CD Input and Control package
853
 
 
854
 
=head1 SYNOPSIS
855
 
 
856
 
This is fairly straight-forward wrapper around the C library libiso9660
857
 
Although this is perfectly usable on its own, it is expected that the
858
 
Object-Oriented interface L<Device::Cdio::ISO9660> is what most people will
859
 
want to use. 
860
 
 
861
 
There are various constants that are defined here.
862
 
 
863
 
=head1 DESCRIPTION
864
 
 
865
 
Encapsulation is done in two parts. The lower-level Perl
866
 
interface is called perliso9660 (this file) and is generated via SWIG.
867
 
 
868
 
=head1 CONSTANTS
869
 
 
870
 
=over 4
871
 
 
872
 
=item ISO_BLOCKSIZE
873
 
 
874
 
Number of bytes in an ISO 9660 block (2048)
875
 
 
876
 
=item PVD_SECTOR
877
 
 
878
 
"Primary Volume Descriptor" sector (16)
879
 
 
880
 
=item EVD_SECTOR
881
 
 
882
 
"End Volume Descriptor" sector (17)
883
 
 
884
 
=item LEN_ISONAME
885
 
 
886
 
Size in bytes of the filename  portion + null byte (31)
887
 
 
888
 
=item MAX_SYSTEM_ID
889
 
 
890
 
Maximum number of characters in a system id (32)
891
 
 
892
 
=item MAX_ISONAME
893
 
 
894
 
Size in bytes of the filename portion + null byte. (37)
895
 
 
896
 
=item MAX_PREPARER_ID
897
 
 
898
 
Maximum number of characters in a preparer id. (128)
899
 
 
900
 
=item MAX_ISOPATHNAME
901
 
 
902
 
Maximum number of characters in the entire ISO 9660 filename. (255)
903
 
 
904
 
=item MAX_PUBLISHER_ID
905
 
 
906
 
Maximum number of characters in a publisher id.
907
 
 
908
 
=item MAX_APPLICATION_ID
909
 
 
910
 
Maximum number of characters in an application id.
911
 
 
912
 
=item MAX_VOLUME_ID
913
 
 
914
 
Maximum number of characters in a volume id.
915
 
 
916
 
=item MAX_VOLUMESET_ID
917
 
 
918
 
Maximum number of characters in a volume-set id.
919
 
 
920
 
=item STANDARD_ID
921
 
 
922
 
String inside frame which identifies an ISO 9660 filesystem. This
923
 
string is the "id" field of an iso9660_pvd_t or an iso9660_svd_t.
924
 
 
925
 
=item EXTENSION_JOLIET_LEVEL1
926
 
 
927
 
Use Joliet Level 1.
928
 
 
929
 
=item EXTENSION_JOLIET_LEVEL2
930
 
 
931
 
Use Joliet Level 2.
932
 
 
933
 
=item EXTENSION_JOLIET_LEVEL3
934
 
 
935
 
Use Joliet Level 3
936
 
 
937
 
=item EXTENSION_ROCK_RIDGE
938
 
 
939
 
Use Rock-Ridge Extensions.
940
 
 
941
 
=item EXTENSION_HIGH_SIERRA
942
 
 
943
 
Use High-Sierra Extensions.
944
 
 
945
 
=item EXTENSION_ALL
946
 
 
947
 
Use any of the above extensions.
948
 
 
949
 
=item EXTENSION_NONE
950
 
 
951
 
Use none of the above extensions.
952
 
 
953
 
=item EXTENSION_JOLIET
954
 
 
955
 
Use any Joliet Extension available.
956
 
 
957
 
=back
958
 
 
959
 
=head2 Directory Flags
960
 
 
961
 
=over 4
962
 
 
963
 
=item FILE
964
 
 
965
 
Not really a flag but the lack of one.
966
 
 
967
 
=item EXISTENCE
968
 
 
969
 
Do not make existence known (hidden).
970
 
 
971
 
=item DIRECTORY
972
 
 
973
 
This file is a directory.
974
 
 
975
 
=item ASSOCIATED
976
 
 
977
 
This file is an associated file
978
 
 
979
 
=item RECORD
980
 
 
981
 
Record format is in extended attribute if not set.
982
 
 
983
 
=item PROTECTION
984
 
 
985
 
No read/execute permission in extended attribute.
986
 
 
987
 
=item DRESERVED1
988
 
 
989
 
Reserved bit 5.
990
 
 
991
 
=item DRESERVED2
992
 
 
993
 
Reserved bit 6
994
 
 
995
 
=item MULTIEXTENT
996
 
 
997
 
Not the final entry of a multi-extent file.
998
 
 
999
 
=back 
1000
 
 
1001
 
=head2 Volume Descriptor Types
1002
 
 
1003
 
=over 4
1004
 
 
1005
 
=item VD_BOOT_RECORD
1006
 
 
1007
 
CD is bootable
1008
 
 
1009
 
=item VD_PRIMARY
1010
 
 
1011
 
Primary Volume descriptor which must be in any ISO-9660
1012
 
 
1013
 
=item VD_SUPPLEMENTARY
1014
 
 
1015
 
(optional) Supplimentary Volume Descriptor. But used by Joliet, for
1016
 
example.
1017
 
 
1018
 
=item VD_PARITION
1019
 
 
1020
 
Indicates a partition of a CD.
1021
 
 
1022
 
=item VD_END
1023
 
 
1024
 
=back 
1025
 
 
1026
 
=head2 Flags for strncpy
1027
 
 
1028
 
=over 4 
1029
 
 
1030
 
=item NOCHECK
1031
 
 
1032
 
Enumeration meaning don not check in strncpy_pad.
1033
 
 
1034
 
=item SEVEN_BIT
1035
 
 
1036
 
Enumeration in strncpy_pad for checking entry has only 7-bit characters.
1037
 
 
1038
 
 
1039
 
=item ACHARS
1040
 
 
1041
 
Enumeration in strncpy_pad for checking entry has only ACHARs.
1042
 
 
1043
 
=item DCHARS
1044
 
 
1045
 
Enumeration in strncpy_pad for checking entry has only DCHARs.
1046
 
 
1047
 
=back 
1048
 
 
1049
 
=head1 SUBROUTINES
1050
 
 
1051
 
=head2 Input Output
1052
 
 
1053
 
=head3 open_iso
1054
 
 
1055
 
Open an ISO 9660 image for reading. Maybe in the future we will have
1056
 
mode. undef is returned on error.
1057
 
 
1058
 
=head3 open_ext
1059
 
 
1060
 
Open an ISO 9660 image for reading allowing various ISO 9660
1061
 
extensions.  Maybe in the future we will have a mode. undef is
1062
 
eturned on error.
1063
 
 
1064
 
=head3 open_fuzzy
1065
 
 
1066
 
Open an ISO 9660 image for reading with some tolerence for positioning
1067
 
of the ISO9660 image. We scan for $perliso9660::ISO_STANDARD_ID and
1068
 
use that to set he eventual offset to adjust by (as long as that is <=
1069
 
i_fuzz).
1070
 
 
1071
 
Maybe in the future we will have a mode. undef is returned on error.
1072
 
 
1073
 
See also open_iso
1074
 
 
1075
 
=head3 open_fuzzy_ext
1076
 
 
1077
 
Open an ISO 9660 image for reading with some tolerence for positioning
1078
 
of the ISO9660 image. We scan for ISO_STANDARD_ID and use that to set
1079
 
the eventual offset to adjust by (as long as that is <= i_fuzz).
1080
 
 
1081
 
Maybe in the future we will have a mode. undef is returned on error.
1082
 
 
1083
 
=head3 ifs_fuzzy_read_superblock
1084
 
 
1085
 
Read the Super block of an ISO 9660 image but determine framesize
1086
 
and datastart and a possible additional offset. Generally here we are
1087
 
not reading an ISO 9660 image but a CD-Image which contains an ISO 9660
1088
 
filesystem.
1089
 
 
1090
 
=head3 close
1091
 
 
1092
 
Close previously opened ISO 9660 image.
1093
 
1 is unconditionally returned. If there was an error 0 would
1094
 
be returned.
1095
 
 
1096
 
=head3 seek_read
1097
 
 
1098
 
Seek to a position and then read n bytes. (buffer, size) are is returned.
1099
 
 
1100
 
=head3 fs_read_pvd
1101
 
 
1102
 
Read the Primary Volume Descriptor for a CD.
1103
 
1 is returned if read, and 0 if there was an error.
1104
 
 
1105
 
=head3 ifs_read_pvd
1106
 
 
1107
 
Read the Primary Volume Descriptor for an ISO 9660 image.
1108
 
1 is returned if read, and 0 if there was an error.
1109
 
 
1110
 
=head3 _fs_read_superblock
1111
 
 
1112
 
Read the Super block of an ISO 9660 image. This is the 
1113
 
Primary Volume Descriptor (PVD) and perhaps a Supplemental Volume 
1114
 
Descriptor if (Joliet) extensions are acceptable.
1115
 
 
1116
 
=head3 ifs_read_superblock
1117
 
 
1118
 
Read the Super block of an ISO 9660 image. This is the 
1119
 
Primary Volume Descriptor (PVD) and perhaps a Supplemental Volume 
1120
 
Descriptor if (Joliet) extensions are acceptable.
1121
 
 
1122
 
=head2 Time Conversion
1123
 
 
1124
 
=head3 set_dtime
1125
 
 
1126
 
Set time in format used in ISO 9660 directory index record
1127
 
from a Unix time structure.
1128
 
 
1129
 
 
1130
 
=head3 set_ltime
1131
 
 
1132
 
Set "long" time in format used in ISO 9660 primary volume descriptor
1133
 
from a Unix time structure.
1134
 
 
1135
 
=head3 get_dtime 
1136
 
 
1137
 
Get Unix time structure from format use in an ISO 9660 directory index 
1138
 
record. Even though tm_wday and tm_yday fields are not explicitly in
1139
 
dtime, they are calculated from the other fields.
1140
 
 
1141
 
If tm is to reflect the localtime, set "use_localtime" 1, otherwise
1142
 
tm will reported in GMT.
1143
 
 
1144
 
=head3 get_ltime
1145
 
 
1146
 
Get "long" time in format used in ISO 9660 primary volume descriptor
1147
 
from a Unix time structure. 
1148
 
 
1149
 
=head2 Character Classification and String Manipulation
1150
 
 
1151
 
=head3 is_dchar
1152
 
 
1153
 
Return 1 if c (an int) is a DCHAR - a character that can appear in an an
1154
 
ISO-9600 level 1 directory name. These are the ASCII capital
1155
 
letters A-Z, the digits 0-9 and an underscore.
1156
 
 
1157
 
=head3 is_achar
1158
 
 
1159
 
=head3 name_translate
1160
 
 
1161
 
Convert an ISO-9660 file name that stored in a directory entry into 
1162
 
what is usually listed as the file name in a listing.
1163
 
wercase name, and remove trailing ;1's or .;1's and
1164
 
turn the others into version numbers.
1165
 
 
1166
 
=head3 name_translate_ext
1167
 
 
1168
 
Convert an ISO-9660 file name that stored in a directory entry into
1169
 
what is usually listed as the file name in a listing.  Lowercase
1170
 
name if no Joliet Extension interpretation. Remove trailing ;1's or
1171
 
.;1's and turn the others into version numbers.
1172
 
 
1173
 
=head3 strncpy_pad 
1174
 
 
1175
 
Pad string src with spaces to size len and copy this to dst. If len is
1176
 
less than the length of src, dst will be truncated to the first len
1177
 
characters of src.
1178
 
 
1179
 
src can also be scanned to see if it contains only ACHARs, DCHARs,
1180
 
7-bit ASCII chars depending on the enumeration _check.
1181
 
 
1182
 
In addition to getting changed, dst is the return value.  Note: this
1183
 
string might not be undef terminated.
1184
 
 
1185
 
=head2 File and Directory Names 
1186
 
 
1187
 
=head3 dirname_valid_p
1188
 
 
1189
 
Check that psz_path is a valid ISO-9660 directory name.
1190
 
 
1191
 
A valid directory name should not start out with a slash (/), 
1192
 
dot (.) or null byte, should be less than 37 characters long, 
1193
 
have no more than 8 characters in a directory component 
1194
 
which is separated by a /, and consist of only DCHARs. 
1195
 
 
1196
 
1 is returned if psz_path is valid.
1197
 
 
1198
 
=head3 pathname_isofy
1199
 
 
1200
 
Take psz_path and a version number and turn that into a ISO-9660
1201
 
pathname.  (That is just the pathname followed by ";" and the version
1202
 
number. For example, mydir/file.ext -> MYDIR/FILE.EXT;1 for version
1203
 
1. The resulting ISO-9660 pathname is returned.
1204
 
 
1205
 
=head3 pathname_valid_p
1206
 
 
1207
 
Check that psz_path is a valid ISO-9660 pathname.  
1208
 
 
1209
 
A valid pathname contains a valid directory name, if one appears and
1210
 
the filename portion should be no more than 8 characters for the
1211
 
file prefix and 3 characters in the extension (or portion after a
1212
 
dot). There should be exactly one dot somewhere in the filename
1213
 
portion and the filename should be composed of only DCHARs.
1214
 
  
1215
 
1 is returned if psz_path is valid.
1216
 
 
1217
 
=head3 fs_find_lsn
1218
 
 
1219
 
Given a directory pointer, find the filesystem entry that contains
1220
 
lsn and return information about it.
1221
 
 
1222
 
Returns stat_t of entry if we found lsn, or undef otherwise.
1223
 
 
1224
 
=head3 ifs_find_lsn
1225
 
 
1226
 
Given a directory pointer, find the filesystem entry that contains
1227
 
lsn and return information about it.
1228
 
 
1229
 
Returns stat_t of entry if we found lsn, or undef otherwise.
1230
 
 
1231
 
=head3 fs_stat
1232
 
 
1233
 
Return file status for psz_path. undef is returned on error.
1234
 
 
1235
 
=head3 fs_stat_translate
1236
 
 
1237
 
Return file status for path name psz_path. undef is returned on error.
1238
 
pathname version numbers in the ISO 9660 name are dropped, i.e. ;1
1239
 
is removed and if level 1 ISO-9660 names are lowercased.
1240
 
 
1241
 
=head3 ifs_stat
1242
 
 
1243
 
Return file status for pathname. undef is returned on error.
1244
 
 
1245
 
=head3 ifs_stat_translate
1246
 
 
1247
 
Return file status for path name psz_path. undef is returned on
1248
 
error.  pathname version numbers in the ISO 9660 name are dropped,
1249
 
i.e. ;1 is removed and if level 1 ISO-9660 names are lowercased.
1250
 
 
1251
 
 
1252
 
=head3 fs_readdir
1253
 
 
1254
 
Read psz_path (a directory) and return a list of iso9660_stat_t
1255
 
pointers for the files inside that directory. The caller must free the
1256
 
returned result.
1257
 
 
1258
 
=head3 ifs_readdir
1259
 
 
1260
 
Read psz_path (a directory) and return a list of iso9660_stat_t
1261
 
pointers for the files inside that directory. The caller must free
1262
 
the returned result.
1263
 
 
1264
 
=head3 get_dir_len
1265
 
 
1266
 
Return the directory name stored in the iso9660_dir_t
1267
 
  
1268
 
A string is allocated: the caller must deallocate.
1269
 
 
1270
 
=head3 dir_to_name
1271
 
  
1272
 
=head3 get_posix_filemode
1273
 
 
1274
 
Returns a POSIX mode for a given p_iso_dirent.
1275
 
 
1276
 
=head2 Primary Volume Descriptor Routines
1277
 
 
1278
 
=head3 get_application_id
1279
 
 
1280
 
Return the PVD's application ID.
1281
 
 
1282
 
undef is returned if there is some problem in getting this. 
1283
 
 
1284
 
=head3 ifs_get_application_id
1285
 
 
1286
 
Get the application ID.  psz_app_id is set to undef if there
1287
 
is some problem in getting this and 0 is returned.
1288
 
 
1289
 
=head3 get_preparer_id
1290
 
 
1291
 
Return a string containing the preparer id with trailing
1292
 
blanks removed.
1293
 
 
1294
 
=head3 ifs_get_preparer_id
1295
 
 
1296
 
Get the preparer ID.  psz_preparer_id is set to undef if there
1297
 
is some problem in getting this and 0 is returned.
1298
 
  
1299
 
=head3 get_publisher_id
1300
 
 
1301
 
Return a string containing the PVD's publisher id with trailing
1302
 
blanks removed.
1303
 
 
1304
 
=head3 ifs_get_publisher_id
1305
 
 
1306
 
Get the publisher ID.  psz_publisher_id is set to undef if there
1307
 
is some problem in getting this and 0 is returned.
1308
 
 
1309
 
=head3 get_pvd_type
1310
 
  
1311
 
=head3 get_pvd_id
1312
 
 
1313
 
=head3 get_pvd_space_size
1314
 
 
1315
 
=head3 get_pvd_block_size
1316
 
 
1317
 
=head3 get_pvd_version
1318
 
 
1319
 
Return the primary volume id version number (of pvd).
1320
 
If there is an error 0 is returned. 
1321
 
 
1322
 
=head3 get_system_id
1323
 
 
1324
 
Return a string containing the PVD's system id with trailing
1325
 
blanks removed.
1326
 
 
1327
 
=head3 ifs_get_system_id
1328
 
 
1329
 
Get the system ID.  psz_system_id is set to undef if there
1330
 
is some problem in getting this and 0 is returned.
1331
 
 
1332
 
=head3 get_root_lsn
1333
 
 
1334
 
Return the LSN of the root directory for pvd.
1335
 
If there is an error CDIO_INVALID_LSN is returned. 
1336
 
 
1337
 
=head3 get_volume_id
1338
 
 
1339
 
Return the PVD's volume ID.
1340
 
 
1341
 
=head3 ifs_get_volume_id
1342
 
 
1343
 
Get the system ID.  psz_system_id is set to undef if there
1344
 
s some problem in getting this and 0 is returned.
1345
 
 
1346
 
=head3 get_volumeset_id
1347
 
 
1348
 
Return the PVD's volumeset ID.
1349
 
undef is returned if there is some problem in getting this. 
1350
 
 
1351
 
=head3 ifs_get_volumeset_id
1352
 
 
1353
 
Get the systemset ID.  psz_systemset_id is set to undef if there
1354
 
is some problem in getting this and 0 is returned.
1355
 
 
1356
 
=head2 Path Table Routines
1357
 
  
1358
 
=head3 iso9660_pathtable_init
1359
 
 
1360
 
Zero out pathable. Do this first.
1361
 
  
1362
 
=head3 pathtable_get_size 
1363
 
  
1364
 
=head3 pathtable_l_add_entry
1365
 
  
1366
 
=head3 pathtable_m_add_entry 
1367
 
  
1368
 
=head3 set_evd
1369
 
 
1370
 
=head2 Miscellaneous
1371
 
 
1372
 
=head3 get_joliet_level
1373
 
 
1374
 
Return the Joliet level recognized for p_iso.
1375
 
 
1376
 
=head3 ifs_is_xa
1377
 
 
1378
 
Return 1 if ISO 9660 image has extended attrributes (XA).
1379
 
 
1380
 
=head1 METHODS
1381
 
 
1382
 
=head2 this
1383
 
 
1384
 
This seems to be an artifact of SWIG. 
1385
 
 
1386
 
=head1 SEE ALSO
1387
 
 
1388
 
L<http://www.gnu.org/software/libcdio> has documentation on
1389
 
libcdio including the a manual and the API via doxygen.
1390
 
 
1391
 
=head1 AUTHORS
1392
 
 
1393
 
Rocky Bernstein C<< <rocky at cpan.org> >>.
1394
 
 
1395
 
=head1 COPYRIGHT
1396
 
 
1397
 
Copyright (C) 2006, 2008, 2011 Rocky Bernstein <rocky@cpan.org>
1398
 
 
1399
 
This program is free software: you can redistribute it and/or modify
1400
 
it under the terms of the GNU General Public License as published by
1401
 
the Free Software Foundation, either version 3 of the License, or
1402
 
(at your option) any later version.
1403
 
 
1404
 
This program is distributed in the hope that it will be useful,
1405
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
1406
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1407
 
GNU General Public License for more details.
1408
 
 
1409
 
You should have received a copy of the GNU General Public License
1410
 
along with this program.  If not, see <http://www.gnu.org/licenses/>.
1411
 
 
1412
 
=cut
1413
 
%}