summaryrefslogtreecommitdiff
path: root/include/cdio/cd_types.h
blob: bc1f16c050fb457a24d3cda40cf84b4f5d1bc666 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
    $Id: cd_types.h,v 1.18 2008/03/25 15:59:08 karl Exp $

    Copyright (C) 2003, 2006, 2008 Rocky Bernstein <rocky@cpan.org>
    Copyright (C) 1996,1997,1998  Gerd Knorr <kraxel@bytesex.org>
         and       Heiko Eißfeldt <heiko@hexco.de>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/** \file cd_types.h 
 *  \brief Header for routines which automatically determine the Compact Disc
 *  format and possibly filesystem on the CD.
 *         
 */

#ifndef __CDIO_CD_TYPES_H__
#define __CDIO_CD_TYPES_H__

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/**
 * Filesystem types we understand. The highest-numbered fs type should
 *  be less than CDIO_FS_MASK defined below.
 */
  typedef enum {
    CDIO_FS_AUDIO                = 1, /**< audio only - not really a 
                                         filesystem */
    CDIO_FS_HIGH_SIERRA	         = 2, /**< High-Sierra Filesystem */
    CDIO_FS_ISO_9660	         = 3, /**< ISO 9660 filesystem */
    CDIO_FS_INTERACTIVE	         = 4,
    CDIO_FS_HFS		         = 5, /**< file system used on the Macintosh 
                                         system in MacOS 6 through MacOS 9
                                         and deprecated in OSX. */
    CDIO_FS_UFS		         = 6, /**< Generic Unix file system derived
                                         from the Berkeley fast file 
                                         system. */
    
    /**<
     * EXT2 was the GNU/Linux native filesystem for early kernels. Newer
     * GNU/Linux OS's may use EXT3 which is EXT2 with a journal. 
     */
    CDIO_FS_EXT2		 = 7,

    CDIO_FS_ISO_HFS              = 8,  /**< both HFS & ISO-9660 filesystem */
    CDIO_FS_ISO_9660_INTERACTIVE = 9,  /**< both CD-RTOS and ISO filesystem */


    /**<
     * The 3DO is, technically, a set of specifications created by the 3DO
     * company.  These specs are for making a 3DO Interactive Multiplayer
     * which uses a CD-player. Panasonic in the early 90's was the first
     * company to manufacture and market a 3DO player. 
     */
    CDIO_FS_3DO		        = 10,


    /**<
       Microsoft X-BOX CD.
    */
    CDIO_FS_XISO 		= 11,
    CDIO_FS_UDFX 		= 12,
    CDIO_FS_UDF 		= 13,
    CDIO_FS_ISO_UDF             = 14
  } cdio_fs_t;


/** 
 * Macro to extract just the FS type portion defined above 
*/
#define CDIO_FSTYPE(fs) (fs & CDIO_FS_MASK)

/**
 *  Bit masks for the classes of CD-images. These are generally
 *  higher-level than the fs-type information above and may be determined
 *  based of the fs type information. This 
 */
  typedef enum {
    CDIO_FS_MASK	      =	  0x000f, /**< Note: this should be 2**n-1 and
                                               and greater than the highest 
                                               CDIO_FS number above */
    CDIO_FS_ANAL_XA           =	  0x00010, /**< eXtended Architecture format */
    CDIO_FS_ANAL_MULTISESSION =   0x00020, /**< CD has multisesion */
    CDIO_FS_ANAL_PHOTO_CD     =	  0x00040, /**< Is a Kodak Photo CD */
    CDIO_FS_ANAL_HIDDEN_TRACK =   0x00080, /**< Hidden track at the 
                                               beginning of the CD */
    CDIO_FS_ANAL_CDTV         =	  0x00100,
    CDIO_FS_ANAL_BOOTABLE     =   0x00200, /**< CD is bootable */
    CDIO_FS_ANAL_VIDEOCD      =   0x00400, /**< VCD 1.1 */
    CDIO_FS_ANAL_ROCKRIDGE    =   0x00800, /**< Has Rock Ridge Extensions to
                                               ISO 9660, */
    CDIO_FS_ANAL_JOLIET       =   0x01000, /**< Microsoft Joliet extensions 
                                                to ISO 9660, */
    CDIO_FS_ANAL_SVCD         =   0x02000, /**< Super VCD or Choiji Video CD */
    CDIO_FS_ANAL_CVD          =   0x04000, /**< Choiji Video CD */
    CDIO_FS_ANAL_XISO         =   0x08000, /**< XBOX CD */
    CDIO_FS_ANAL_ISO9660_ANY  =   0x10000, /**< Any sort fo ISO9660 FS */
    CDIO_FS_ANAL_VCD_ANY      =   (CDIO_FS_ANAL_VIDEOCD|CDIO_FS_ANAL_SVCD|
                                   CDIO_FS_ANAL_CVD),
    CDIO_FS_MATCH_ALL         =  ~CDIO_FS_MASK /**< bitmask which can
                                                 be used by
                                                 cdio_get_devices to
                                                 specify matching any
                                                 sort of CD. */
  } cdio_fs_cap_t;
    

#define CDIO_FS_UNKNOWN	            CDIO_FS_MASK

/**
 * 
 */
#define CDIO_FS_MATCH_ALL            (cdio_fs_anal_t) (~CDIO_FS_MASK)


/*!
  \brief The type used to return analysis information from
  cdio_guess_cd_type. 

  These fields make sense only for when an ISO-9660 filesystem is used.
 */
typedef struct 
{
  unsigned int  joliet_level;  /**< If has Joliet extensions, this is the
                                  associated level number (i.e. 1, 2, or 3). */
  char          iso_label[33]; /**< This is 32 + 1 for null byte at the end in 
				    formatting the string */
  unsigned int  isofs_size;
  uint8_t       UDFVerMinor;   /**< For UDF filesystems only */
  uint8_t       UDFVerMajor;   /**< For UDF filesystems only */
} cdio_iso_analysis_t;

/**
 *  Try to determine what kind of CD-image and/or filesystem we
 *  have at track track_num. Return information about the CD image
 *  is returned in iso_analysis and the return value.
 */
cdio_fs_anal_t cdio_guess_cd_type(const CdIo_t *cdio, int start_session, 
				  track_t track_num, 
				  /*out*/ cdio_iso_analysis_t *iso_analysis);

#ifdef __cplusplus
}
#endif /* __cplusplus */

/** The below variables are trickery to force the above enum symbol
    values to be recorded in debug symbol tables. They are used to
    allow one to refer to the enumeration value names in the typedefs
    above in a debugger and debugger expressions.
*/
extern cdio_fs_cap_t debug_cdio_fs_cap;
extern cdio_fs_t     debug_cdio_fs;

#endif /* __CDIO_CD_TYPES_H__ */

/* 
 * Local variables:
 *  c-file-style: "gnu"
 *  tab-width: 8
 *  indent-tabs-mode: nil
 * End:
 */