⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iso9660.h

📁 linux下的MPEG1
💻 H
📖 第 1 页 / 共 2 页
字号:
/*    $Id: iso9660.h,v 1.3 2005/01/01 02:43:58 rockyb Exp $    Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>    Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>    See also iso9660.h by Eric Youngdale (1993).    Copyright 1993 Yggdrasil Computing, Incorporated    Copyright (c) 1999,2000 J. Schilling    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 2 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, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*//*! * \file iso9660.h  * \brief Header for libiso9660: the ISO-9660 filesystem library.*/#ifndef __CDIO_ISO9660_H__#define __CDIO_ISO9660_H__#include <cdio/cdio.h>#include <cdio/ds.h>#include <cdio/xa.h>#include <time.h>#define	_delta(from, to)	((to) - (from) + 1)#define MIN_TRACK_SIZE 4*75#define MIN_ISO_SIZE MIN_TRACK_SIZE/*!   An ISO filename is: "abcde.eee;1" -> <filename> '.' <ext> ';' <version #>    For ISO-9660 Level 1, the maximum needed string length is:\verbatim    	 30 chars (filename + ext)    +	  2 chars ('.' + ';')    +	  5 chars (strlen("32767"))    +	  1 null byte   ================================    =	 38 chars\endverbatim *//*! size in bytes of the filename portion + null byte */#define LEN_ISONAME      31/*! Max # characters in the entire ISO 9660 filename. */#define MAX_ISONAME      37/*! Max # characters in the entire ISO 9660 filename. */#define MAX_ISOPATHNAME 255/*! Max # characters in an perparer id. */#define ISO_MAX_PREPARER_ID 128/*! Max # characters in an publisher id. */#define ISO_MAX_PUBLISHER_ID 128/*! Max # characters in an application id. */#define ISO_MAX_APPLICATION_ID 128/*! Max # characters in an system id. */#define ISO_MAX_SYSTEM_ID 32/*! Max # characters in an volume id. */#define ISO_MAX_VOLUME_ID 32/*! Max # characters in an volume-set id. */#define ISO_MAX_VOLUMESET_ID 128/**! ISO 9660 directory flags. */#define	ISO_FILE	  0	/**< Not really a flag...		  */#define	ISO_EXISTENCE	  1	/**< Do not make existence known (hidden) */#define	ISO_DIRECTORY	  2	/**< This file is a directory		  */#define	ISO_ASSOCIATED	  4	/**< This file is an associated file	  */#define	ISO_RECORD	  8	/**< Record format in extended attr. != 0 */#define	ISO_PROTECTION	 16	/**< No read/execute perm. in ext. attr.  */#define	ISO_DRESERVED1	 32	/**< Reserved bit 5			  */#define	ISO_DRESERVED2	 64	/**< Reserved bit 6			  */#define	ISO_MULTIEXTENT	128	/**< Not final entry of a mult. ext. file *//**! Volume descriptor types */#define ISO_VD_PRIMARY             1#define ISO_VD_SUPPLEMENTARY	   2  /**< Used by Joliet */#define ISO_VD_END	         255/*! Sector of Primary Volume Descriptor */#define ISO_PVD_SECTOR  16/*! Sector of End Volume Descriptor */#define ISO_EVD_SECTOR  17  /*! String inside track identifying an ISO 9660 filesystem. */#define ISO_STANDARD_ID      "CD001" /*! Number of bytes in an ISO 9660 block */#define ISO_BLOCKSIZE           2048 #ifdef __cplusplusextern "C" {#endif /* __cplusplus */enum strncpy_pad_check {  ISO9660_NOCHECK = 0,  ISO9660_7BIT,  ISO9660_ACHARS,  ISO9660_DCHARS};#ifndef  EMPTY_ARRAY_SIZE#define EMPTY_ARRAY_SIZE 0#endifPRAGMA_BEGIN_PACKED/*!   \brief ISO-9660 shorter-format time structure.    @see iso9660_dtime */struct	iso9660_dtime {  uint8_t 	dt_year;  uint8_t 	dt_month;  /**< Has value in range 1..12. Note starts                              at 1, not 0 like a tm struct. */  uint8_t	dt_day;  uint8_t	dt_hour;  uint8_t	dt_minute;  uint8_t	dt_second;  int8_t	dt_gmtoff; /**< GMT values -48 .. + 52 in 15 minute                              intervals */} GNUC_PACKED;typedef struct iso9660_dtime  iso9660_dtime_t;/*!   \brief ISO-9660 longer-format time structure.    @see iso9660_ltime */struct	iso9660_ltime {  char	 lt_year	[_delta(   1,	4)];   /**< Add 1900 to value                                                    for the Julian                                                    year */  char	 lt_month	[_delta(   5,	6)];   /**< Has value in range                                                  1..12. Note starts                                                  at 1, not 0 like a                                                  tm struct. */  char	 lt_day		[_delta(   7,	8)];  char	 lt_hour	[_delta(   9,	10)];  char	 lt_minute	[_delta(  11,	12)];  char	 lt_second	[_delta(  13,	14)];  char	 lt_hsecond	[_delta(  15,	16)];  /**<! The value is in                                                  units of 1/100's of                                                  a second */  int8_t lt_gmtoff	[_delta(  17,	17)];} GNUC_PACKED;typedef struct iso9660_ltime  iso9660_ltime_t;/*! \brief Format of an ISO-9660 directory record  This structure may have an odd length depending on how many characters there are in the filename!  Some compilers (e.g. on Sun3/mc68020) pad the structures to an even length.  For this reason, we cannot use sizeof (struct iso_path_table) or sizeof (struct iso_directory_record) to compute on disk sizes.  Instead, we use offsetof(..., name) and add the name size.  See mkisofs.h of the  cdrtools package.  @see iso9660_stat*/struct iso9660_dir {  uint8_t          length;            /*! 711 encoded */  uint8_t          xa_length;         /*! 711 encoded */  uint64_t         extent;            /*! 733 encoded */  uint64_t         size;              /*! 733 encoded */  iso9660_dtime_t  recording_time;    /*! 7 711-encoded units */  uint8_t          file_flags;  uint8_t          file_unit_size;    /*! 711 encoded */  uint8_t          interleave_gap;    /*! 711 encoded */  uint32_t volume_sequence_number;    /*! 723 encoded */  uint8_t          filename_len;      /*! 711 encoded */  char             filename[EMPTY_ARRAY_SIZE];} GNUC_PACKED;typedef struct iso9660_dir  iso9660_dir_t;/*!   \brief ISO-9660 Primary Volume Descriptor. */struct iso9660_pvd {  uint8_t          type;                         /**< 711 encoded */  char             id[5];  uint8_t          version;                      /**< 711 encoded */  char             unused1[1];  char             system_id[ISO_MAX_SYSTEM_ID]; /**< each char is an achar */  char             volume_id[ISO_MAX_VOLUME_ID]; /**< each char is a dchar */  char             unused2[8];  uint64_t         volume_space_size;            /**< 733 encoded */  char             unused3[32];  uint32_t         volume_set_size;              /**< 723 encoded */  uint32_t         volume_sequence_number;       /**< 723 encoded */  uint32_t         logical_block_size;           /**< 723 encoded */  uint64_t         path_table_size;              /**< 733 encoded */  uint32_t         type_l_path_table;            /**< 731 encoded */  uint32_t         opt_type_l_path_table;        /**< 731 encoded */  uint32_t         type_m_path_table;            /**< 732 encoded */  uint32_t         opt_type_m_path_table;        /**< 732 encoded */  iso9660_dir_t    root_directory_record;        /**< See section 9.1 of                                                    ISO 9660 spec. */  char             root_directory_filename;      /**< Is \0 */  char             volume_set_id[ISO_MAX_VOLUMESET_ID];    /**< dchars */  char             publisher_id[ISO_MAX_PUBLISHER_ID];     /**< achars */  char             preparer_id[ISO_MAX_PREPARER_ID];       /**< achars */  char             application_id[ISO_MAX_APPLICATION_ID]; /**< achars */  char             copyright_file_id[37];     /**< See section 7.5 of                                                 ISO 9660 spec. Each char is                                                  a dchar */  char             abstract_file_id[37];      /**< See section 7.5 of                                                  ISO 9660 spec. Each char is                                                  a dchar */  char             bibliographic_file_id[37]; /**< See section 7.5 of                                                  ISO 9660 spec. Each char is                                                 a dchar. */  iso9660_ltime_t  creation_date;             /**< See section 8.4.26.1 of                                                 ISO 9660 spec. */  iso9660_ltime_t  modification_date;         /**< See section 8.4.26.1 of                                                  ISO 9660 spec. */  iso9660_ltime_t  expiration_date;           /**< See section 8.4.26.1 of                                                 ISO 9660 spec. */  iso9660_ltime_t  effective_date;            /**< See section 8.4.26.1 of                                                 ISO 9660 spec. */  uint8_t          file_structure_version;    /**< 711 encoded */  char             unused4[1];  char             application_data[512];  char             unused5[653];} GNUC_PACKED;typedef struct iso9660_pvd  iso9660_pvd_t;/*!   \brief ISO-9660 Supplementary Volume Descriptor.   This is used for Joliet Extentions and is almost the same as the  the primary descriptor but two unused fields, "unused1" and "unused3  become "flags and "escape_sequences" respectively.*/struct iso9660_svd {  uint8_t          type;                         /**< 711 encoded */  char             id[5];  uint8_t          version;                      /**< 711 encoded */  char             flags;			 /**< 853 */  char             system_id[ISO_MAX_SYSTEM_ID]; /**< each char is an achar */  char             volume_id[ISO_MAX_VOLUME_ID]; /**< each char is a dchar */  char             unused2[8];  uint64_t         volume_space_size;            /**< 733 encoded */  char             escape_sequences[32];         /**< 856 */  uint32_t         volume_set_size;              /**< 723 encoded */  uint32_t         volume_sequence_number;       /**< 723 encoded */  uint32_t         logical_block_size;           /**< 723 encoded */  uint64_t         path_table_size;              /**< 733 encoded */  uint32_t         type_l_path_table;            /**< 731 encoded */  uint32_t         opt_type_l_path_table;        /**< 731 encoded */  uint32_t         type_m_path_table;            /**< 732 encoded */  uint32_t         opt_type_m_path_table;        /**< 732 encoded */  iso9660_dir_t    root_directory_record;        /**< See section 9.1 of                                                    ISO 9660 spec. */  char             volume_set_id[ISO_MAX_VOLUMESET_ID];    /**< dchars */  char             publisher_id[ISO_MAX_PUBLISHER_ID];     /**< achars */  char             preparer_id[ISO_MAX_PREPARER_ID];       /**< achars */  char             application_id[ISO_MAX_APPLICATION_ID]; /**< achars */  char             copyright_file_id[37];     /**< See section 7.5 of                                                 ISO 9660 spec. Each char is                                                  a dchar */  char             abstract_file_id[37];      /**< See section 7.5 of                                                  ISO 9660 spec. Each char is                                                  a dchar */  char             bibliographic_file_id[37]; /**< See section 7.5 of                                                  ISO 9660 spec. Each char is                                                 a dchar. */  iso9660_ltime_t  creation_date;             /**< See section 8.4.26.1 of                                                 ISO 9660 spec. */  iso9660_ltime_t  modification_date;         /**< See section 8.4.26.1 of                                                  ISO 9660 spec. */  iso9660_ltime_t  expiration_date;           /**< See section 8.4.26.1 of                                                 ISO 9660 spec. */  iso9660_ltime_t  effective_date;            /**< See section 8.4.26.1 of                                                 ISO 9660 spec. */  uint8_t          file_structure_version;    /**< 711 encoded */  char             unused4[1];  char             application_data[512];  char             unused5[653];} GNUC_PACKED;typedef struct iso9660_svd  iso9660_svd_t;PRAGMA_END_PACKED/*! \brief Unix stat-like version of iso9660_dir   The iso9660_stat structure is not part of the ISO-9660   specification. We use it for our to communicate information   in a C-library friendly way, e.g struct tm time structures and   a C-style filename string.   @see iso9660_dir*/struct iso9660_stat { /* big endian!! */  struct tm    tm;                    /**< time on entry */  lsn_t        lsn;                   /**< start logical sector number */  uint32_t     size;                  /**< total size in bytes */  uint32_t     secsize;               /**< number of sectors allocated */  iso9660_xa_t xa;                    /**< XA attributes */  enum { _STAT_FILE = 1, _STAT_DIR = 2 } type;  char         filename[EMPTY_ARRAY_SIZE]; /**< filename */};typedef struct iso9660_stat iso9660_stat_t;/** A mask used in iso9660_ifs_read_vd which allows what kinds     of extensions we allow, eg. Joliet, Rock Ridge, etc. */typedef uint8_t iso_extension_mask_t;#define ISO_EXTENSION_JOLIET_LEVEL1 0x01#define ISO_EXTENSION_JOLIET_LEVEL2 0x02#define ISO_EXTENSION_JOLIET_LEVEL3 0x04#define ISO_EXTENSION_ROCK_RIDGE    0x08#define ISO_EXTENSION_HIGH_SIERRA   0x10#define ISO_EXTENSION_ALL           0xFF#define ISO_EXTENSION_NONE          0x00#define ISO_EXTENSION_JOLIET     \  (ISO_EXTENSION_JOLIET_LEVEL1 | \   ISO_EXTENSION_JOLIET_LEVEL2 | \   ISO_EXTENSION_JOLIET_LEVEL3 )  /** This is an opaque structure. */typedef struct _iso9660 iso9660_t; /*!  Open an ISO 9660 image for reading. Maybe in the future we will have  a mode. NULL is returned on error.*/  iso9660_t *iso9660_open (const char *psz_pathname /*flags, mode */);/*!  Open an ISO 9660 image for reading allowing various ISO 9660  extensions.  Maybe in the future we will have a mode. NULL is  returned on error.*/  iso9660_t *iso9660_open_ext (const char *psz_pathname,                                iso_extension_mask_t iso_extension_mask);/*!  Close previously opened ISO 9660 image.  True is unconditionally returned. If there was an error false would  be returned.*/  bool iso9660_close (iso9660_t * p_iso);/*!  Seek to a position and then read n bytes. Size read is returned.*/  long int iso9660_iso_seek_read (const iso9660_t *p_iso, void *ptr,                                   lsn_t start, long int i_size);/*!  Read the Primary Volume Descriptor for a CD.  True is returned if read, and false if there was an error.*/  bool iso9660_fs_read_pvd ( const CdIo *p_cdio,                              /*out*/ iso9660_pvd_t *p_pvd );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -