libcdio  0.90
ecma_167.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2005, 2006, 2008, 2012 Rocky Bernstein <rocky@cpan.org>
3  Copyright (c) 2001-2002 Ben Fennema <bfennema@falcon.csc.calpoly.edu>
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 /*
19  * Some portions taken from FreeBSD ecma167-udf.h which states:
20  * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>
21  * All rights reserved.
22  *
23  * Redistribution and use in source and binary forms, with or without
24  * modification, are permitted provided that the following conditions
25  * are met:
26  * 1. Redistributions of source code must retain the above copyright
27  * notice, this list of conditions and the following disclaimer.
28  * 2. Redistributions in binary form must reproduce the above copyright
29  * notice, this list of conditions and the following disclaimer in the
30  * documentation and/or other materials provided with the distribution.
31  *
32  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
33  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
36  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
40  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
41  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42  * SUCH DAMAGE.
43  */
44 
52 #ifndef CDIO_ECMA_167_H
53 #define CDIO_ECMA_167_H 1
54 
55 #include <cdio/types.h>
56 
61 typedef enum {
69 
72 typedef enum {
73  TAGID_PRI_VOL = 0x0001,
74  TAGID_ANCHOR = 0x0002,
75  TAGID_VOL = 0x0003,
76  TAGID_IMP_VOL = 0x0004,
77  TAGID_PARTITION = 0x0005,
78  TAGID_LOGVOL = 0x0006,
80  TAGID_TERM = 0x0008,
82  TAGID_FSD = 0x0100,
83  TAGID_FID = 0x0101,
84  TAGID_AED = 0x0102,
85  TAGID_IE = 0x0103,
86  TAGID_TE = 0x0104,
87  TAGID_FILE_ENTRY = 0x0105,
88  TAGID_EAHD = 0x0106,
89  TAGID_USE = 0x0107,
90  TAGID_SBD = 0x0108,
91  TAGID_PIE = 0x0109,
92  TAGID_EFE = 0x010A,
93 } tag_id_t ;
94 
96 typedef enum {
108 
109 typedef uint8_t udf_Uint8_t;
110 typedef uint16_t udf_Uint16_t;
111 typedef uint32_t udf_Uint32_t;
112 typedef uint64_t udf_Uint64_t;
113 typedef char udf_dstring;
115 #define UDF_LENGTH_MASK 0x3fffffff
116 
118 
121 {
124 } GNUC_PACKED;
125 
127 
130 {
141 } GNUC_PACKED;
142 
144 
150 typedef enum {
157 
158 
159 #define TIMESTAMP_TYPE_MASK 0xF000
160 #define TIMESTAMP_TYPE_CUT 0x0000
161 #define TIMESTAMP_TYPE_LOCAL 0x1000
162 #define TIMESTAMP_TYPE_AGREEMENT 0x2000
163 #define TIMESTAMP_TIMEZONE_MASK 0x0FFF
164 
166 {
171 } GNUC_PACKED;
172 
174 
177 {
181 } GNUC_PACKED;
182 
183 typedef struct udf_regid_s udf_regid_t;
184 
186 #define ENTITYID_FLAGS_DIRTY 0x00
187 #define ENTITYID_FLAGS_PROTECTED 0x01
188 
191 {
196 } GNUC_PACKED;
197 
199 #define VSD_STD_ID_NSR02 "NSR02" /* (3/9.1) */
200 
203 /* The below const definitions are to faciltate debugging of the
204  values #define'd below. */
205 extern const char VSD_STD_ID_BEA01[sizeof("BEA01")-1];
206 extern const char VSD_STD_ID_BOOT2[sizeof("BOOT2")-1];
207 extern const char VSD_STD_ID_CD001[sizeof("CD001")-1];
208 extern const char VSD_STD_ID_CDW01[sizeof("CDW02")-1];
209 extern const char VSD_STD_ID_NSR03[sizeof("NSR03")-1];
210 extern const char VSD_STD_ID_TEA01[sizeof("TEA01")-1];
211 
212 #define VSD_STD_ID_BEA01 "BEA01"
213 #define VSD_STD_ID_BOOT2 "BOOT2"
214 #define VSD_STD_ID_CD001 "CD001"
215 #define VSD_STD_ID_CDW02 "CDW02"
216 #define VSD_STD_ID_NSR02 "NSR02"
218 #define VSD_STD_ID_NSR03 "NSR03"
219 #define VSD_STD_ID_TEA01 "TEA01"
222 struct beginning_extended_area_desc_s
223 {
224  udf_Uint8_t struct_type;
226  udf_Uint8_t struct_version;
227  udf_Uint8_t struct_data[2041];
229 
232 {
238 
240 struct boot_desc_s
241 {
257 
259 #define BOOT_FLAGS_ERASE 0x01
262 struct udf_extent_ad_s
263 {
267 
268 typedef struct udf_extent_ad_s udf_extent_ad_t;
271 struct udf_tag_s
272 {
282 
283 typedef struct udf_tag_s udf_tag_t;
286 struct NSR_desc_s
287 {
294 
296 struct udf_pvd_s
297 {
298  udf_tag_t tag;
321 
322 typedef struct udf_pvd_s udf_pvd_t;
325 #define PVD_FLAGS_VSID_COMMON 0x0001
329 {
330  udf_tag_t tag;
335 
339 struct vol_desc_ptr_s
340 {
341  udf_tag_t tag;
346 
348 struct imp_use_vol_desc_s
349 {
350  udf_tag_t tag;
355 
357 struct partition_desc_s
358 {
359  udf_tag_t tag;
372 
373 typedef struct partition_desc_s partition_desc_t;
376 #define PD_PARTITION_FLAGS_ALLOC 0x0001
379 #define PD_PARTITION_CONTENTS_NSR02 "+NSR02"
382 #define PD_PARTITION_CONTENTS_FDC01 "+FDC01"
383 #define PD_PARTITION_CONTENTS_CD001 "+CD001"
384 #define PD_PARTITION_CONTENTS_CDW02 "+CDW02"
385 #define PD_PARTITION_CONTENTS_NSR03 "+NSR03"
388 #define PD_ACCESS_TYPE_NONE 0x00000000
389 #define PD_ACCESS_TYPE_READ_ONLY 0x00000001
390 #define PD_ACCESS_TYPE_WRITE_ONCE 0x00000002
391 #define PD_ACCESS_TYPE_REWRITABLE 0x00000003
392 #define PD_ACCESS_TYPE_OVERWRITABLE 0x00000004
395 struct udf_lb_addr_s
396 {
400 
401 typedef struct udf_lb_addr_s udf_lb_addr_t;
404 struct udf_short_ad_s
405 {
409 
410 typedef struct udf_short_ad_s udf_short_ad_t;
413 struct udf_long_ad_s
414 {
419 
420 typedef struct udf_long_ad_s udf_long_ad_t;
423 struct logical_vol_desc_s
424 {
425  udf_tag_t tag;
431  union {
443 
448 {
453 
455 #define GP_PARTITION_MAP_TYPE_UNDEF 0x00
456 #define GP_PARTIITON_MAP_TYPE_1 0x01
457 #define GP_PARTITION_MAP_TYPE_2 0x02
461 {
467 
470 {
475 
478 {
479  udf_tag_t tag;
484 
486 struct terminating_desc_s
487 {
488  udf_tag_t tag;
491 
494 {
495  udf_tag_t tag;
501  union { /* Same MSVC workaround as with struct udf_fileid_desc_s */
503  struct {
507  struct {
509  udf_Uint32_t data[0];
510  } size_table;
511  struct {
513  udf_Uint32_t data[0];
514  } imp_use;
515  } u;
516 } GNUC_PACKED;
517 
519 #define LVID_INTEGRITY_TYPE_OPEN 0x00000000
520 #define LVID_INTEGRITY_TYPE_CLOSE 0x00000001
523 struct udf_ext_ad_s
524 {
530 
531 typedef struct udf_ext_ad_s udf_ext_ad_t;
538 struct udf_fsd_s
539 {
540  udf_tag_t tag;
560 
561 typedef struct udf_fsd_s udf_fsd_t;
565 {
573 
577 struct udf_fileid_desc_s
578 {
579  udf_tag_t tag;
584  /* MSVC workaround for multiple zero sized arrays
585  Unlike what is the case with GNU, and against logic, an union of zero
586  sized arrays in the Microsoft world is not zero bytes but one byte!
587  Thus, for sizeof() to be consistent across platforms, we must use an
588  ugly workaround that attaches the union to the last non-zero member. */
589  union {
591  struct {
595  struct {
597  udf_Uint8_t data[0];
598  } file_id;
599  struct {
601  udf_Uint8_t data[0];
602  } padding;
603  } u;
604 } GNUC_PACKED;
605 
606 typedef struct udf_fileid_desc_s udf_fileid_desc_t;
613 typedef enum {
614  UDF_FILE_HIDDEN = (1 << 0),
615  UDF_FILE_DIRECTORY = (1 << 1),
616  UDF_FILE_DELETED = (1 << 2),
617  UDF_FILE_PARENT = (1 << 3),
618  UDF_FILE_METADATA = (1 << 4)
620 
622 struct allocExtDesc
623 {
624  udf_tag_t tag;
628 
630 struct udf_icbtag_s
631 {
641 
642 typedef struct udf_icbtag_s udf_icbtag_t;
644 #define UDF_ICB_TAG_FLAGS_SETUID 0x40
645 #define UDF_ICB_TAG_FLAGS_SETGID 0x80
646 #define UDF_ICB_TAG_FLAGS_STICKY 0x100
650 #define ICBTAG_STRATEGY_TYPE_UNDEF 0x0000
651 #define ICBTAG_STRATEGY_TYPE_1 0x0001
652 #define ICBTAG_STRATEGY_TYPE_2 0x0002
653 #define ICBTAG_STRATEGY_TYPE_3 0x0003
654 #define ICBTAG_STRATEGY_TYPE_4 0x0004
664 typedef enum {
665  ICBTAG_FILE_TYPE_UNDEF = 0x00,
666  ICBTAG_FILE_TYPE_USE = 0x01,
667  ICBTAG_FILE_TYPE_PIE = 0x02,
682 typedef enum {
683  ICBTAG_FLAG_AD_MASK = 0x0007,
685  ICBTAG_FLAG_AD_SHORT = 0x0000,
691  ICBTAG_FLAG_AD_LONG = 0x0001,
697  ICBTAG_FLAG_AD_EXTENDED = 0x0002,
698  ICBTAG_FLAG_AD_IN_ICB = 0x0003,
704  ICBTAG_FLAG_ARCHIVE = 0x0020,
705  ICBTAG_FLAG_SETUID = 0x0040,
714 
717 {
718  udf_tag_t tag;
721 } GNUC_PACKED;
725 {
726  udf_tag_t tag;
729 
732 {
733  udf_tag_t tag;
736  udf_Uint32_t gid;
757  /* The following union allows file entry reuse without worrying
758  about overflows, by ensuring the struct is always the
759  maximum possible size allowed by the specs: one UDF block. */
760  union {
763  udf_Uint8_t pad_to_one_block[2048-176];
764  } u;
768 
769 #define UDF_FENTRY_SIZE 176
770 #define UDF_FENTRY_PERM_USER_MASK 0x07
771 #define UDF_FENTRY_PERM_GRP_MASK 0xE0
772 #define UDF_FENTRY_PERM_OWNER_MASK 0x1C00
775 #define FE_PERM_O_EXEC 0x00000001U
776 #define FE_PERM_O_WRITE 0x00000002U
777 #define FE_PERM_O_READ 0x00000004U
778 #define FE_PERM_O_CHATTR 0x00000008U
779 #define FE_PERM_O_DELETE 0x00000010U
780 #define FE_PERM_G_EXEC 0x00000020U
781 #define FE_PERM_G_WRITE 0x00000040U
782 #define FE_PERM_G_READ 0x00000080U
783 #define FE_PERM_G_CHATTR 0x00000100U
784 #define FE_PERM_G_DELETE 0x00000200U
785 #define FE_PERM_U_EXEC 0x00000400U
786 #define FE_PERM_U_WRITE 0x00000800U
787 #define FE_PERM_U_READ 0x00001000U
788 #define FE_PERM_U_CHATTR 0x00002000U
789 #define FE_PERM_U_DELETE 0x00004000U
792 #define FE_RECORD_FMT_UNDEF 0x00
793 #define FE_RECORD_FMT_FIXED_PAD 0x01
794 #define FE_RECORD_FMT_FIXED 0x02
795 #define FE_RECORD_FMT_VARIABLE8 0x03
796 #define FE_RECORD_FMT_VARIABLE16 0x04
797 #define FE_RECORD_FMT_VARIABLE16_MSB 0x05
798 #define FE_RECORD_FMT_VARIABLE32 0x06
799 #define FE_RECORD_FMT_PRINT 0x07
800 #define FE_RECORD_FMT_LF 0x08
801 #define FE_RECORD_FMT_CR 0x09
802 #define FE_RECORD_FMT_CRLF 0x0A
803 #define FE_RECORD_FMT_LFCR 0x0B
806 #define FE_RECORD_DISPLAY_ATTR_UNDEF 0x00
807 #define FE_RECORD_DISPLAY_ATTR_1 0x01
808 #define FE_RECORD_DISPLAY_ATTR_2 0x02
809 #define FE_RECORD_DISPLAY_ATTR_3 0x03
813 {
814  udf_tag_t tag;
817 } GNUC_PACKED;
821 {
831 {
841 /* Alternate Permissions (ECMA 167r3 4/14.10.4) */
843 {
855 {
866 #define FTE_CREATION 0x00000001
867 #define FTE_DELETION 0x00000004
868 #define FTE_EFFECTIVE 0x00000008
869 #define FTE_BACKUP 0x00000002
873 {
885 {
898 {
910 {
920 #define EXTATTR_CHAR_SET 1
921 #define EXTATTR_ALT_PERMS 3
922 #define EXTATTR_FILE_TIMES 5
923 #define EXTATTR_INFO_TIMES 6
924 #define EXTATTR_DEV_SPEC 12
925 #define EXTATTR_IMP_USE 2048
926 #define EXTATTR_APP_USE 65536
931 {
932  udf_tag_t tag;
940 {
941  udf_tag_t tag;
944  udf_Uint8_t bitmap[0];
949 {
950  udf_tag_t tag;
962 #define EXT_RECORDED_ALLOCATED 0x00000000
963 #define EXT_NOT_RECORDED_ALLOCATED 0x40000000
964 #define EXT_NOT_RECORDED_NOT_ALLOCATED 0x80000000
965 #define EXT_NEXT_EXTENT_ALLOCDECS 0xC0000000
973 {
975  udf_Uint8_t reserved[24];
977 
981 struct pathComponent
982 {
991 {
992  udf_tag_t tag;
995  udf_Uint32_t gid;
1021  union { /* MSVC workaround for multiple zero sized arrays */
1025  } u;
1029 
1035 extern tag_id_t debug_tagid;
1041 
1042 #endif /* CDIO_ECMA_167_H */

Generated for libcdio by doxygen 1.8.3.1