libcdio  0.90
iso9660.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2012
3  Rocky Bernstein <rocky@gnu.org>
4  Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
5 
6  See also iso9660.h by Eric Youngdale (1993).
7 
8  Copyright 1993 Yggdrasil Computing, Incorporated
9 
10  This program is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
33 
34 #ifndef CDIO_ISO9660_H_
35 #define CDIO_ISO9660_H_
36 
37 #include <time.h>
38 
39 #include <cdio/cdio.h>
40 #include <cdio/ds.h>
41 #include <cdio/posix.h>
42 
49 typedef uint8_t iso711_t;
50 typedef int8_t iso712_t;
51 typedef uint16_t iso721_t;
52 typedef uint16_t iso722_t;
53 typedef uint32_t iso723_t;
54 typedef uint32_t iso731_t;
55 typedef uint32_t iso732_t;
56 typedef uint64_t iso733_t;
58 typedef char achar_t;
59 typedef char dchar_t;
61 #ifndef EMPTY_ARRAY_SIZE
62 #define EMPTY_ARRAY_SIZE 0
63 #endif
64 
65 #include <cdio/types.h>
66 #include <cdio/xa.h>
67 
68 #ifdef ISODCL
69 #undef ISODCL
70 #endif
71 /* This part borrowed from the bsd386 isofs */
72 #define ISODCL(from, to) ((to) - (from) + 1)
73 
74 #define MIN_TRACK_SIZE 4*75
75 #define MIN_ISO_SIZE MIN_TRACK_SIZE
76 
83 extern enum iso_enum1_s {
86  LEN_ISONAME = 31,
90  MAX_ISONAME = 37,
96  ISO_BLOCKSIZE = 2048
98 } iso_enums1;
99 
107 extern enum iso_flag_enum_s {
108  ISO_FILE = 0,
118 
120 extern enum iso_vd_enum_s {
126 } iso_vd_enums;
127 
128 
148 #define ISO_MAX_PUBLISHER_ID 128
149 
151 #define ISO_MAX_APPLICATION_ID 128
152 
154 #define ISO_MAX_VOLUME_ID 32
155 
157 #define ISO_MAX_VOLUMESET_ID 128
158 
162 extern const char ISO_STANDARD_ID[sizeof("CD001")-1];
163 
164 #define ISO_STANDARD_ID "CD001"
165 
166 #ifdef __cplusplus
167 extern "C" {
168 #endif /* __cplusplus */
169 
170 typedef enum strncpy_pad_check {
176 
178 
194 } GNUC_PACKED;
195 
197 
208  char lt_year [ISODCL( 1, 4)];
211  char lt_month [ISODCL( 5, 6)];
215  char lt_day [ISODCL( 7, 8)];
216  char lt_hour [ISODCL( 9, 10)];
217  char lt_minute [ISODCL( 11, 12)];
218  char lt_second [ISODCL( 13, 14)];
219  char lt_hsecond [ISODCL( 15, 16)];
226 } GNUC_PACKED;
227 
231 
232 #include <cdio/rock.h>
233 
258  uint8_t file_flags;
282  union {
284  char str[1];
285  } filename;
286 } GNUC_PACKED;
287 
293  char id[5];
296  char unused1[1];
299  uint8_t unused2[8];
302  uint8_t unused3[32];
385  uint8_t unused4[1];
386  char application_data[512];
388  uint8_t unused5[653];
389 } GNUC_PACKED;
390 
392 
403  char id[5];
406  char flags;
411  char unused2[8];
414  char escape_sequences[32];
499  uint8_t unused4[1];
500  char application_data[512];
502  uint8_t unused5[653];
503 } GNUC_PACKED;
504 
506 
508 
518 struct iso9660_stat_s { /* big endian!! */
519 
522  struct tm tm;
525  uint32_t size;
526  uint32_t secsize;
528  enum { _STAT_FILE = 1, _STAT_DIR = 2 } type;
529  bool b_xa;
531 };
532 
535 typedef uint8_t iso_extension_mask_t;
536 
542 extern enum iso_extension_enum_s {
549 
550 
551 #define ISO_EXTENSION_ALL 0xFF
552 #define ISO_EXTENSION_NONE 0x00
553 #define ISO_EXTENSION_JOLIET \
554  (ISO_EXTENSION_JOLIET_LEVEL1 | \
555  ISO_EXTENSION_JOLIET_LEVEL2 | \
556  ISO_EXTENSION_JOLIET_LEVEL3 )
557 
558 
560 typedef struct _iso9660_s iso9660_t;
561 
569  bool iso9660_close (iso9660_t * p_iso);
570 
571 
576  iso9660_t *iso9660_open (const char *psz_path /*flags, mode */);
577 
585  iso9660_t *iso9660_open_ext (const char *psz_path,
586  iso_extension_mask_t iso_extension_mask);
587 
602  iso9660_t *iso9660_open_fuzzy (const char *psz_path /*flags, mode */,
603  uint16_t i_fuzz);
604 
614  iso9660_t *iso9660_open_fuzzy_ext (const char *psz_path,
615  iso_extension_mask_t iso_extension_mask,
616  uint16_t i_fuzz
617  /*flags, mode */);
618 
626  iso_extension_mask_t iso_extension_mask,
627  uint16_t i_fuzz);
628 
645  long int iso9660_iso_seek_read (const iso9660_t *p_iso, /*out*/ void *ptr,
646  lsn_t start, long int i_size);
647 
652  bool iso9660_fs_read_pvd ( const CdIo_t *p_cdio,
653  /*out*/ iso9660_pvd_t *p_pvd );
654 
659  bool iso9660_ifs_read_pvd (const iso9660_t *p_iso,
660  /*out*/ iso9660_pvd_t *p_pvd);
661 
667  bool iso9660_fs_read_superblock (CdIo_t *p_cdio,
668  iso_extension_mask_t iso_extension_mask);
669 
676  iso_extension_mask_t iso_extension_mask);
677 
678 
679 /*====================================================
680  Time conversion
681  ====================================================*/
682 
687  void iso9660_set_dtime (const struct tm *tm,
688  /*out*/ iso9660_dtime_t *idr_date);
689 
690 
696  void iso9660_set_dtime_with_timezone (const struct tm *p_tm,
697  int timezone,
698  /*out*/ iso9660_dtime_t *p_idr_date);
699 
703  void iso9660_set_ltime (const struct tm *_tm,
704  /*out*/ iso9660_ltime_t *p_pvd_date);
705 
709  void iso9660_set_ltime_with_timezone (const struct tm *_tm,
710  int timezone,
711  /*out*/ iso9660_ltime_t *p_pvd_date);
712 
721  bool iso9660_get_dtime (const iso9660_dtime_t *idr_date, bool b_localtime,
722  /*out*/ struct tm *tm);
723 
724 
729  bool iso9660_get_ltime (const iso9660_ltime_t *p_ldate,
730  /*out*/ struct tm *p_tm);
731 
732  /*====================================================
733  Character Classification and String Manipulation
734  ====================================================*/
740  bool iso9660_is_dchar (int c);
741 
747  bool iso9660_is_achar (int c);
748 
760  int iso9660_name_translate(const char *psz_oldname,
761  /*out*/ char *psz_newname);
762 
778  int iso9660_name_translate_ext(const char *psz_oldname, char *psz_newname,
779  uint8_t i_joliet_level);
780 
792  char *iso9660_strncpy_pad(char dst[], const char src[], size_t len,
793  enum strncpy_pad_check _check);
794 
795  /*=====================================================================
796  File and Directory Names
797  ======================================================================*/
798 
809  bool iso9660_dirname_valid_p (const char psz_path[]);
810 
817  char *iso9660_pathname_isofy (const char psz_path[], uint16_t i_version);
818 
830  bool iso9660_pathname_valid_p (const char psz_path[]);
831 
832 /*=====================================================================
833  directory tree
834 ======================================================================*/
835 
836 void
837 iso9660_dir_init_new (void *dir, uint32_t self, uint32_t ssize,
838  uint32_t parent, uint32_t psize,
839  const time_t *dir_time);
840 
841 void
842 iso9660_dir_init_new_su (void *dir, uint32_t self, uint32_t ssize,
843  const void *ssu_data, unsigned int ssu_size,
844  uint32_t parent, uint32_t psize,
845  const void *psu_data, unsigned int psu_size,
846  const time_t *dir_time);
847 
848 void
849 iso9660_dir_add_entry_su (void *dir, const char filename[], uint32_t extent,
850  uint32_t size, uint8_t file_flags,
851  const void *su_data,
852  unsigned int su_size, const time_t *entry_time);
853 
854 unsigned int
855 iso9660_dir_calc_record_size (unsigned int namelen, unsigned int su_len);
856 
864 #define iso9660_fs_find_lsn iso9660_find_fs_lsn
866 
867 
876  /*out*/ char **ppsz_path);
877 
886 
887 
903  lsn_t i_lsn,
904  /*out*/ char **ppsz_path);
905 
906 
925 iso9660_stat_t *iso9660_fs_stat (CdIo_t *p_cdio, const char psz_path[]);
926 
927 
936  const char psz_path[],
937  bool b_mode2);
938 
942 iso9660_stat_t *iso9660_ifs_stat (iso9660_t *p_iso, const char psz_path[]);
943 
944 
950  const char psz_path[]);
951 
958 CdioList_t * iso9660_fs_readdir (CdIo_t *p_cdio, const char psz_path[],
959  bool b_mode2);
960 
965 CdioList_t * iso9660_ifs_readdir (iso9660_t *p_iso, const char psz_path[]);
966 
972 
978  /*out*/ cdio_utf8_t **p_psz_app_id);
979 
984 
985 uint8_t iso9660_get_dir_len(const iso9660_dir_t *p_idr);
986 
987 #ifdef FIXME
988 uint8_t iso9660_get_dir_size(const iso9660_dir_t *p_idr);
989 
990 lsn_t iso9660_get_dir_extent(const iso9660_dir_t *p_idr);
991 #endif
992 
999  char * iso9660_dir_to_name (const iso9660_dir_t *p_iso9660_dir);
1000 
1004  mode_t iso9660_get_posix_filemode(const iso9660_stat_t *p_iso_dirent);
1005 
1010  char *iso9660_get_preparer_id(const iso9660_pvd_t *p_pvd);
1011 
1017  /*out*/ cdio_utf8_t **p_psz_preparer_id);
1018 
1023  char *iso9660_get_publisher_id(const iso9660_pvd_t *p_pvd);
1024 
1030  /*out*/ cdio_utf8_t **p_psz_publisher_id);
1031 
1032  uint8_t iso9660_get_pvd_type(const iso9660_pvd_t *p_pvd);
1033 
1034  const char * iso9660_get_pvd_id(const iso9660_pvd_t *p_pvd);
1035 
1036  int iso9660_get_pvd_space_size(const iso9660_pvd_t *p_pvd);
1037 
1038  int iso9660_get_pvd_block_size(const iso9660_pvd_t *p_pvd) ;
1039 
1043  int iso9660_get_pvd_version(const iso9660_pvd_t *pvd) ;
1044 
1049  char *iso9660_get_system_id(const iso9660_pvd_t *p_pvd);
1050 
1056  /*out*/ cdio_utf8_t **p_psz_system_id);
1057 
1058 
1063 
1068  char *iso9660_get_volume_id(const iso9660_pvd_t *p_pvd);
1069 
1075  /*out*/ cdio_utf8_t **p_psz_volume_id);
1076 
1081  char *iso9660_get_volumeset_id(const iso9660_pvd_t *p_pvd);
1082 
1088  /*out*/ cdio_utf8_t **p_psz_volumeset_id);
1089 
1090  /* pathtable */
1091 
1093  void iso9660_pathtable_init (void *pt);
1094 
1095  unsigned int iso9660_pathtable_get_size (const void *pt);
1096 
1097  uint16_t iso9660_pathtable_l_add_entry (void *pt, const char name[],
1098  uint32_t extent, uint16_t parent);
1099 
1100  uint16_t iso9660_pathtable_m_add_entry (void *pt, const char name[],
1101  uint32_t extent, uint16_t parent);
1102 
1107  void iso9660_set_pvd (void *pd, const char volume_id[],
1108  const char application_id[],
1109  const char publisher_id[], const char preparer_id[],
1110  uint32_t iso_size, const void *root_dir,
1111  uint32_t path_table_l_extent,
1112  uint32_t path_table_m_extent,
1113  uint32_t path_table_size, const time_t *pvd_time);
1114 
1115  void iso9660_set_evd (void *pd);
1116 
1120  bool iso9660_ifs_is_xa (const iso9660_t * p_iso);
1121 
1122 
1123 #ifndef DO_NOT_WANT_COMPATIBILITY
1124 
1125 #define iso9660_isdchar iso9660_is_dchar
1126 #define iso9660_isachar iso9660_is_achar
1127 #endif /*DO_NOT_WANT_COMPATIBILITY*/
1128 
1129 #ifdef __cplusplus
1130 }
1131 #endif /* __cplusplus */
1132 
1133 #undef ISODCL
1134 #endif /* CDIO_ISO9660_H_ */
1135 
1136 /*
1137  * Local variables:
1138  * c-file-style: "gnu"
1139  * tab-width: 8
1140  * indent-tabs-mode: nil
1141  * End:
1142  */

Generated for libcdio by doxygen 1.8.4