libcdio  0.83
iso9660.h
Go to the documentation of this file.
1 /*
2  $Id: iso9660.h,v 1.102 2008/07/16 00:28:54 rocky Exp $
3 
4  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
5  Rocky Bernstein <rocky@gnu.org>
6  Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
7 
8  See also iso9660.h by Eric Youngdale (1993).
9 
10  Copyright 1993 Yggdrasil Computing, Incorporated
11 
12  This program is free software: you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation, either version 3 of the License, or
15  (at your option) any later version.
16 
17  This program is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this program. If not, see <http://www.gnu.org/licenses/>.
24 */
35 
36 #ifndef __CDIO_ISO9660_H__
37 #define __CDIO_ISO9660_H__
38 
39 #include <time.h>
40 
41 #include <cdio/cdio.h>
42 #include <cdio/ds.h>
43 #include <cdio/posix.h>
44 
51 typedef uint8_t iso711_t;
52 typedef int8_t iso712_t;
53 typedef uint16_t iso721_t;
54 typedef uint16_t iso722_t;
55 typedef uint32_t iso723_t;
56 typedef uint32_t iso731_t;
57 typedef uint32_t iso732_t;
58 typedef uint64_t iso733_t;
60 typedef char achar_t;
61 typedef char dchar_t;
63 #ifndef EMPTY_ARRAY_SIZE
64 #define EMPTY_ARRAY_SIZE 0
65 #endif
66 
67 #include <cdio/types.h>
68 #include <cdio/xa.h>
69 
70 #ifdef ISODCL
71 #undef ISODCL
72 #endif
73 /* This part borrowed from the bsd386 isofs */
74 #define ISODCL(from, to) ((to) - (from) + 1)
75 
76 #define MIN_TRACK_SIZE 4*75
77 #define MIN_ISO_SIZE MIN_TRACK_SIZE
78 
85 extern enum iso_enum1_s {
88  LEN_ISONAME = 31,
92  MAX_ISONAME = 37,
98  ISO_BLOCKSIZE = 2048
100 } iso_enums1;
101 
109 extern enum iso_flag_enum_s {
110  ISO_FILE = 0,
120 
122 extern enum iso_vd_enum_s {
128 } iso_vd_enums;
129 
130 
150 #define ISO_MAX_PUBLISHER_ID 128
151 
153 #define ISO_MAX_APPLICATION_ID 128
154 
156 #define ISO_MAX_VOLUME_ID 32
157 
159 #define ISO_MAX_VOLUMESET_ID 128
160 
164 extern const char ISO_STANDARD_ID[sizeof("CD001")-1];
165 
166 #define ISO_STANDARD_ID "CD001"
167 
168 #ifdef __cplusplus
169 extern "C" {
170 #endif /* __cplusplus */
171 
172 typedef enum strncpy_pad_check {
178 
180 
196 } GNUC_PACKED;
197 
199 
210  char lt_year [ISODCL( 1, 4)];
213  char lt_month [ISODCL( 5, 6)];
217  char lt_day [ISODCL( 7, 8)];
218  char lt_hour [ISODCL( 9, 10)];
219  char lt_minute [ISODCL( 11, 12)];
220  char lt_second [ISODCL( 13, 14)];
221  char lt_hsecond [ISODCL( 15, 16)];
228 } GNUC_PACKED;
229 
233 
234 #include <cdio/rock.h>
235 
260  uint8_t file_flags;
278 } GNUC_PACKED;
279 
285  char id[5];
288  char unused1[1];
291  uint8_t unused2[8];
294  uint8_t unused3[32];
377  uint8_t unused4[1];
378  char application_data[512];
380  uint8_t unused5[653];
381 } GNUC_PACKED;
382 
384 
395  char id[5];
398  char flags;
403  char unused2[8];
406  char escape_sequences[32];
491  uint8_t unused4[1];
492  char application_data[512];
494  uint8_t unused5[653];
495 } GNUC_PACKED;
496 
498 
500 
510 struct iso9660_stat_s { /* big endian!! */
511 
514  struct tm tm;
517  uint32_t size;
518  uint32_t secsize;
520  enum { _STAT_FILE = 1, _STAT_DIR = 2 } type;
521  bool b_xa;
523 };
524 
527 typedef uint8_t iso_extension_mask_t;
528 
534 extern enum iso_extension_enum_s {
541 
542 
543 #define ISO_EXTENSION_ALL 0xFF
544 #define ISO_EXTENSION_NONE 0x00
545 #define ISO_EXTENSION_JOLIET \
546  (ISO_EXTENSION_JOLIET_LEVEL1 | \
547  ISO_EXTENSION_JOLIET_LEVEL2 | \
548  ISO_EXTENSION_JOLIET_LEVEL3 )
549 
550 
552 typedef struct _iso9660_s iso9660_t;
553 
561  bool iso9660_close (iso9660_t * p_iso);
562 
563 
568  iso9660_t *iso9660_open (const char *psz_path /*flags, mode */);
569 
577  iso9660_t *iso9660_open_ext (const char *psz_path,
578  iso_extension_mask_t iso_extension_mask);
579 
594  iso9660_t *iso9660_open_fuzzy (const char *psz_path /*flags, mode */,
595  uint16_t i_fuzz);
596 
606  iso9660_t *iso9660_open_fuzzy_ext (const char *psz_path,
607  iso_extension_mask_t iso_extension_mask,
608  uint16_t i_fuzz
609  /*flags, mode */);
610 
618  iso_extension_mask_t iso_extension_mask,
619  uint16_t i_fuzz);
620 
637  long int iso9660_iso_seek_read (const iso9660_t *p_iso, /*out*/ void *ptr,
638  lsn_t start, long int i_size);
639 
644  bool iso9660_fs_read_pvd ( const CdIo_t *p_cdio,
645  /*out*/ iso9660_pvd_t *p_pvd );
646 
651  bool iso9660_ifs_read_pvd (const iso9660_t *p_iso,
652  /*out*/ iso9660_pvd_t *p_pvd);
653 
659  bool iso9660_fs_read_superblock (CdIo_t *p_cdio,
660  iso_extension_mask_t iso_extension_mask);
661 
668  iso_extension_mask_t iso_extension_mask);
669 
670 
671 /*====================================================
672  Time conversion
673  ====================================================*/
674 
679  void iso9660_set_dtime (const struct tm *tm,
680  /*out*/ iso9660_dtime_t *idr_date);
681 
682 
688  void iso9660_set_dtime_with_timezone (const struct tm *p_tm,
689  int timezone,
690  /*out*/ iso9660_dtime_t *p_idr_date);
691 
695  void iso9660_set_ltime (const struct tm *_tm,
696  /*out*/ iso9660_ltime_t *p_pvd_date);
697 
701  void iso9660_set_ltime_with_timezone (const struct tm *_tm,
702  int timezone,
703  /*out*/ iso9660_ltime_t *p_pvd_date);
704 
713  bool iso9660_get_dtime (const iso9660_dtime_t *idr_date, bool b_localtime,
714  /*out*/ struct tm *tm);
715 
716 
721  bool iso9660_get_ltime (const iso9660_ltime_t *p_ldate,
722  /*out*/ struct tm *p_tm);
723 
724  /*====================================================
725  Character Classification and String Manipulation
726  ====================================================*/
732  bool iso9660_is_dchar (int c);
733 
739  bool iso9660_is_achar (int c);
740 
752  int iso9660_name_translate(const char *psz_oldname,
753  /*out*/ char *psz_newname);
754 
770  int iso9660_name_translate_ext(const char *psz_oldname, char *psz_newname,
771  uint8_t i_joliet_level);
772 
784  char *iso9660_strncpy_pad(char dst[], const char src[], size_t len,
785  enum strncpy_pad_check _check);
786 
787  /*=====================================================================
788  File and Directory Names
789  ======================================================================*/
790 
801  bool iso9660_dirname_valid_p (const char psz_path[]);
802 
809  char *iso9660_pathname_isofy (const char psz_path[], uint16_t i_version);
810 
822  bool iso9660_pathname_valid_p (const char psz_path[]);
823 
824 /*=====================================================================
825  directory tree
826 ======================================================================*/
827 
828 void
829 iso9660_dir_init_new (void *dir, uint32_t self, uint32_t ssize,
830  uint32_t parent, uint32_t psize,
831  const time_t *dir_time);
832 
833 void
834 iso9660_dir_init_new_su (void *dir, uint32_t self, uint32_t ssize,
835  const void *ssu_data, unsigned int ssu_size,
836  uint32_t parent, uint32_t psize,
837  const void *psu_data, unsigned int psu_size,
838  const time_t *dir_time);
839 
840 void
841 iso9660_dir_add_entry_su (void *dir, const char filename[], uint32_t extent,
842  uint32_t size, uint8_t file_flags,
843  const void *su_data,
844  unsigned int su_size, const time_t *entry_time);
845 
846 unsigned int
847 iso9660_dir_calc_record_size (unsigned int namelen, unsigned int su_len);
848 
856 #define iso9660_fs_find_lsn iso9660_find_fs_lsn
858 
859 
868  /*out*/ char **ppsz_path);
869 
878 
879 
895  lsn_t i_lsn,
896  /*out*/ char **ppsz_path);
897 
898 
917 iso9660_stat_t *iso9660_fs_stat (CdIo_t *p_cdio, const char psz_path[]);
918 
919 
928  const char psz_path[],
929  bool b_mode2);
930 
934 iso9660_stat_t *iso9660_ifs_stat (iso9660_t *p_iso, const char psz_path[]);
935 
936 
942  const char psz_path[]);
943 
950 CdioList_t * iso9660_fs_readdir (CdIo_t *p_cdio, const char psz_path[],
951  bool b_mode2);
952 
957 CdioList_t * iso9660_ifs_readdir (iso9660_t *p_iso, const char psz_path[]);
958 
964 
970  /*out*/ cdio_utf8_t **p_psz_app_id);
971 
976 
977 uint8_t iso9660_get_dir_len(const iso9660_dir_t *p_idr);
978 
979 #if FIXME
980 uint8_t iso9660_get_dir_size(const iso9660_dir_t *p_idr);
981 
982 lsn_t iso9660_get_dir_extent(const iso9660_dir_t *p_idr);
983 #endif
984 
991  char * iso9660_dir_to_name (const iso9660_dir_t *p_iso9660_dir);
992 
996  mode_t iso9660_get_posix_filemode(const iso9660_stat_t *p_iso_dirent);
997 
1002  char *iso9660_get_preparer_id(const iso9660_pvd_t *p_pvd);
1003 
1009  /*out*/ cdio_utf8_t **p_psz_preparer_id);
1010 
1015  char *iso9660_get_publisher_id(const iso9660_pvd_t *p_pvd);
1016 
1022  /*out*/ cdio_utf8_t **p_psz_publisher_id);
1023 
1024  uint8_t iso9660_get_pvd_type(const iso9660_pvd_t *p_pvd);
1025 
1026  const char * iso9660_get_pvd_id(const iso9660_pvd_t *p_pvd);
1027 
1028  int iso9660_get_pvd_space_size(const iso9660_pvd_t *p_pvd);
1029 
1030  int iso9660_get_pvd_block_size(const iso9660_pvd_t *p_pvd) ;
1031 
1035  int iso9660_get_pvd_version(const iso9660_pvd_t *pvd) ;
1036 
1041  char *iso9660_get_system_id(const iso9660_pvd_t *p_pvd);
1042 
1048  /*out*/ cdio_utf8_t **p_psz_system_id);
1049 
1050 
1055 
1060  char *iso9660_get_volume_id(const iso9660_pvd_t *p_pvd);
1061 
1067  /*out*/ cdio_utf8_t **p_psz_volume_id);
1068 
1073  char *iso9660_get_volumeset_id(const iso9660_pvd_t *p_pvd);
1074 
1080  /*out*/ cdio_utf8_t **p_psz_volumeset_id);
1081 
1082  /* pathtable */
1083 
1085  void iso9660_pathtable_init (void *pt);
1086 
1087  unsigned int iso9660_pathtable_get_size (const void *pt);
1088 
1089  uint16_t iso9660_pathtable_l_add_entry (void *pt, const char name[],
1090  uint32_t extent, uint16_t parent);
1091 
1092  uint16_t iso9660_pathtable_m_add_entry (void *pt, const char name[],
1093  uint32_t extent, uint16_t parent);
1094 
1099  void iso9660_set_pvd (void *pd, const char volume_id[],
1100  const char application_id[],
1101  const char publisher_id[], const char preparer_id[],
1102  uint32_t iso_size, const void *root_dir,
1103  uint32_t path_table_l_extent,
1104  uint32_t path_table_m_extent,
1105  uint32_t path_table_size, const time_t *pvd_time);
1106 
1107  void iso9660_set_evd (void *pd);
1108 
1112  bool iso9660_ifs_is_xa (const iso9660_t * p_iso);
1113 
1114 
1115 #ifndef DO_NOT_WANT_COMPATIBILITY
1116 
1117 #define iso9660_isdchar iso9660_is_dchar
1118 #define iso9660_isachar iso9660_is_achar
1119 #endif /*DO_NOT_WANT_COMPATIBILITY*/
1120 
1121 #ifdef __cplusplus
1122 }
1123 #endif /* __cplusplus */
1124 
1125 #undef ISODCL
1126 #endif /* __CDIO_ISO9660_H__ */
1127 
1128 /*
1129  * Local variables:
1130  * c-file-style: "gnu"
1131  * tab-width: 8
1132  * indent-tabs-mode: nil
1133  * End:
1134  */

Generated for libcdio by doxygen 1.8.1.1