1 /*
2     Copyright (C) 2003, 2006, 2008, 2012 Rocky Bernstein <rocky@gnu.org>
3     Copyright (C) 1996,1997,1998  Gerd Knorr <kraxel@bytesex.org>
4          and       Heiko Ei�feldt <heiko@hexco.de>
5 
6     This program is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 /** \file cd_types.h
21  *  \brief Header for routines which automatically determine the Compact Disc
22  *  format and possibly filesystem on the CD.
23  *
24  */
25 
26 #ifndef CDIO_CD_TYPES_H_
27 #define CDIO_CD_TYPES_H_
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32 
33 /**
34  * Filesystem types we understand. The highest-numbered fs type should
35  *  be less than CDIO_FS_MASK defined below.
36  */
37   typedef enum {
38     CDIO_FS_AUDIO                = 1, /**< audio only - not really a
39                                          filesystem */
40     CDIO_FS_HIGH_SIERRA          = 2, /**< High-Sierra Filesystem */
41     CDIO_FS_ISO_9660             = 3, /**< ISO 9660 filesystem */
42     CDIO_FS_INTERACTIVE          = 4,
43     CDIO_FS_HFS                  = 5, /**< file system used on the Macintosh
44                                          system in MacOS 6 through MacOS 9
45                                          and deprecated in OSX. */
46     CDIO_FS_UFS                  = 6, /**< Generic Unix file system derived
47                                          from the Berkeley fast file
48                                          system. */
49 
50     /**<
51      * EXT2 was the GNU/Linux native filesystem for early kernels. Newer
52      * GNU/Linux OS's may use EXT3 which is EXT2 with a journal.
53      */
54     CDIO_FS_EXT2                 = 7,
55 
56     CDIO_FS_ISO_HFS              = 8,  /**< both HFS & ISO-9660 filesystem */
57     CDIO_FS_ISO_9660_INTERACTIVE = 9,  /**< both CD-RTOS and ISO filesystem */
58 
59 
60     /**<
61      * The 3DO is, technically, a set of specifications created by the 3DO
62      * company.  These specs are for making a 3DO Interactive Multiplayer
63      * which uses a CD-player. Panasonic in the early 90's was the first
64      * company to manufacture and market a 3DO player.
65      */
66     CDIO_FS_3DO                 = 10,
67 
68 
69     /**<
70        Microsoft X-BOX CD.
71     */
72     CDIO_FS_XISO                = 11,
73     CDIO_FS_UDFX                = 12,
74     CDIO_FS_UDF                 = 13,
75     CDIO_FS_ISO_UDF             = 14
76   } cdio_fs_t;
77 
78 
79 /**
80  * Macro to extract just the FS type portion defined above
81 */
82 #define CDIO_FSTYPE(fs) (fs & CDIO_FS_MASK)
83 
84 /**
85  *  Bit masks for the classes of CD-images. These are generally
86  *  higher-level than the fs-type information above and may be determined
87  *  based of the fs type information. This
88  */
89   typedef enum {
90     CDIO_FS_MASK              =   0x000f, /**< Note: this should be 2**n-1 and
91                                                and greater than the highest
92                                                CDIO_FS number above */
93     CDIO_FS_ANAL_XA           =   0x00010, /**< eXtended Architecture format */
94     CDIO_FS_ANAL_MULTISESSION =   0x00020, /**< CD has multisesion */
95     CDIO_FS_ANAL_PHOTO_CD     =   0x00040, /**< Is a Kodak Photo CD */
96     CDIO_FS_ANAL_HIDDEN_TRACK =   0x00080, /**< Hidden track at the
97                                                beginning of the CD */
98     CDIO_FS_ANAL_CDTV         =   0x00100,
99     CDIO_FS_ANAL_BOOTABLE     =   0x00200, /**< CD is bootable */
100     CDIO_FS_ANAL_VIDEOCD      =   0x00400, /**< VCD 1.1 */
101     CDIO_FS_ANAL_ROCKRIDGE    =   0x00800, /**< Has Rock Ridge Extensions to
102                                                ISO 9660, */
103     CDIO_FS_ANAL_JOLIET       =   0x01000, /**< Microsoft Joliet extensions
104                                                 to ISO 9660, */
105     CDIO_FS_ANAL_SVCD         =   0x02000, /**< Super VCD or Choiji Video CD */
106     CDIO_FS_ANAL_CVD          =   0x04000, /**< Choiji Video CD */
107     CDIO_FS_ANAL_XISO         =   0x08000, /**< XBOX CD */
108     CDIO_FS_ANAL_ISO9660_ANY  =   0x10000, /**< Any sort fo ISO9660 FS */
109     CDIO_FS_ANAL_VCD_ANY      =   (CDIO_FS_ANAL_VIDEOCD|CDIO_FS_ANAL_SVCD|
110                                    CDIO_FS_ANAL_CVD),
111     CDIO_FS_MATCH_ALL         =  ~CDIO_FS_MASK /**< bitmask which can
112                                                  be used by
113                                                  cdio_get_devices to
114                                                  specify matching any
115                                                  sort of CD. */
116   } cdio_fs_cap_t;
117 
118 
119 #define CDIO_FS_UNKNOWN             CDIO_FS_MASK
120 
121 /**
122  *
123  */
124 #define CDIO_FS_MATCH_ALL            (cdio_fs_anal_t) (~CDIO_FS_MASK)
125 
126 
127 /*!
128   \brief The type used to return analysis information from
129   cdio_guess_cd_type.
130 
131   These fields make sense only for when an ISO-9660 filesystem is used.
132  */
133 typedef struct
134 {
135   unsigned int  joliet_level;  /**< If has Joliet extensions, this is the
136                                   associated level number (i.e. 1, 2, or 3). */
137   char          iso_label[33]; /**< This is 32 + 1 for null byte at the end in
138                                     formatting the string */
139   unsigned int  isofs_size;
140   uint8_t       UDFVerMinor;   /**< For UDF filesystems only */
141   uint8_t       UDFVerMajor;   /**< For UDF filesystems only */
142 } cdio_iso_analysis_t;
143 
144 /**
145  *  Try to determine what kind of CD-image and/or filesystem we
146  *  have at track track_num. Return information about the CD image
147  *  is returned in iso_analysis and the return value.
148  */
149 cdio_fs_anal_t cdio_guess_cd_type(const CdIo_t *cdio, int start_session,
150                                   track_t track_num,
151                                   /*out*/ cdio_iso_analysis_t *iso_analysis);
152 
153 #ifdef __cplusplus
154 }
155 #endif /* __cplusplus */
156 
157 /** The below variables are trickery to force the above enum symbol
158     values to be recorded in debug symbol tables. They are used to
159     allow one to refer to the enumeration value names in the typedefs
160     above in a debugger and debugger expressions.
161 */
162 extern cdio_fs_cap_t debug_cdio_fs_cap;
163 extern cdio_fs_t     debug_cdio_fs;
164 
165 #endif /* CDIO_CD_TYPES_H_ */
166 
167 /*
168  * Local variables:
169  *  c-file-style: "gnu"
170  *  tab-width: 8
171  *  indent-tabs-mode: nil
172  * End:
173  */
174