Blame include/cdio/xa.h

Packit dd8086
/*
Packit dd8086
    Copyright (C) 2003, 2004, 2005, 2006, 2008, 2012
Packit dd8086
    Rocky Bernstein <rocky@gnu.org>
Packit dd8086
    Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Packit dd8086
Packit dd8086
    See also iso9660.h by Eric Youngdale (1993) and in cdrtools. These are 
Packit dd8086
Packit dd8086
    Copyright 1993 Yggdrasil Computing, Incorporated
Packit dd8086
    Copyright (c) 1999,2000 J. Schilling
Packit dd8086
Packit dd8086
    This program is free software: you can redistribute it and/or modify
Packit dd8086
    it under the terms of the GNU General Public License as published by
Packit dd8086
    the Free Software Foundation, either version 3 of the License, or
Packit dd8086
    (at your option) any later version.
Packit dd8086
Packit dd8086
    This program is distributed in the hope that it will be useful,
Packit dd8086
    but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit dd8086
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit dd8086
    GNU General Public License for more details.
Packit dd8086
Packit dd8086
    You should have received a copy of the GNU General Public License
Packit dd8086
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit dd8086
*/
Packit dd8086
/*!
Packit dd8086
   \file xa.h 
Packit dd8086
   \brief Things related to the ISO-9660 XA (Extended Attributes) format
Packit dd8086
Packit dd8086
   Applications will probably not include this directly but via 
Packit dd8086
   the iso9660.h header.
Packit dd8086
*/
Packit dd8086
Packit dd8086

Packit dd8086
#ifndef CDIO_XA_H_
Packit dd8086
#define CDIO_XA_H_
Packit dd8086
Packit dd8086
#ifdef __cplusplus
Packit dd8086
extern "C" {
Packit dd8086
#endif /* __cplusplus */
Packit dd8086
Packit dd8086
  /*! An enumeration for some of the XA_* \#defines below. This isn't
Packit dd8086
    really an enumeration one would really use in a program it is to
Packit dd8086
    be helpful in debuggers where wants just to refer to the XA_*
Packit dd8086
    names and get something.
Packit dd8086
  */
Packit dd8086
  typedef enum {
Packit dd8086
    ISO_XA_MARKER_OFFSET =   1024,
Packit dd8086
    XA_PERM_RSYS =         0x0001,  /**< System Group Read */
Packit dd8086
    XA_PERM_XSYS =         0x0004,  /**< System Group Execute */
Packit dd8086
    
Packit dd8086
    XA_PERM_RUSR =         0x0010,  /**< User (owner) Read */
Packit dd8086
    XA_PERM_XUSR =         0x0040,  /**< User (owner) Execute */
Packit dd8086
    
Packit dd8086
    XA_PERM_RGRP =         0x0100,  /**< Group Read */
Packit dd8086
    XA_PERM_XGRP =         0x0400,  /**< Group Execute */
Packit dd8086
    
Packit dd8086
    XA_PERM_ROTH =         0x1000,  /**< Other (world) Read */
Packit dd8086
    XA_PERM_XOTH =         0x4000,  /**< Other (world) Execute */
Packit dd8086
    
Packit dd8086
    XA_ATTR_MODE2FORM1  =   (1 << 11),
Packit dd8086
    XA_ATTR_MODE2FORM2  =   (1 << 12),
Packit dd8086
    XA_ATTR_INTERLEAVED =   (1 << 13),
Packit dd8086
    XA_ATTR_CDDA        =   (1 << 14),
Packit dd8086
    XA_ATTR_DIRECTORY   =   (1 << 15),
Packit dd8086
    
Packit dd8086
    XA_PERM_ALL_READ    =   (XA_PERM_RUSR | XA_PERM_RSYS | XA_PERM_RGRP),
Packit dd8086
    XA_PERM_ALL_EXEC    =   (XA_PERM_XUSR | XA_PERM_XSYS | XA_PERM_XGRP),
Packit dd8086
    XA_PERM_ALL_ALL     =   (XA_PERM_ALL_READ | XA_PERM_ALL_EXEC),
Packit dd8086
    
Packit dd8086
    XA_FORM1_DIR  = (XA_ATTR_DIRECTORY | XA_ATTR_MODE2FORM1 | XA_PERM_ALL_ALL),
Packit dd8086
    XA_FORM1_FILE =  (XA_ATTR_MODE2FORM1 | XA_PERM_ALL_ALL),
Packit dd8086
    XA_FORM2_FILE =  (XA_ATTR_MODE2FORM2 | XA_PERM_ALL_ALL)
Packit dd8086
  } xa_misc_enum_t;
Packit dd8086
  
Packit dd8086
extern const char ISO_XA_MARKER_STRING[sizeof("CD-XA001")-1];
Packit dd8086
Packit dd8086
#define ISO_XA_MARKER_STRING    "CD-XA001"
Packit dd8086
Packit dd8086
/*! \brief "Extended Architecture" according to the Philips Yellow Book.
Packit dd8086
 
Packit dd8086
CD-ROM EXtended Architecture is a modification to the CD-ROM
Packit dd8086
specification that defines two new types of sectors.  CD-ROM XA was
Packit dd8086
developed jointly by Sony, Philips, and Microsoft, and announced in
Packit dd8086
August 1988. Its specifications were published in an extension to the
Packit dd8086
Yellow Book.  CD-i, Photo CD, Video CD and CD-EXTRA have all
Packit dd8086
subsequently been based on CD-ROM XA.
Packit dd8086
Packit dd8086
CD-XA defines another way of formatting sectors on a CD-ROM, including
Packit dd8086
headers in the sectors that describe the type (audio, video, data) and
Packit dd8086
some additional info (markers, resolution in case of a video or audio
Packit dd8086
sector, file numbers, etc).
Packit dd8086
Packit dd8086
The data written on a CD-XA is consistent with and can be in ISO-9660
Packit dd8086
file system format and therefore be readable by ISO-9660 file system
Packit dd8086
translators. But also a CD-I player can also read CD-XA discs even if
Packit dd8086
its own `Green Book' file system only resembles ISO 9660 and isn't
Packit dd8086
fully compatible. 
Packit dd8086
Packit dd8086
 Note structure is big-endian.
Packit dd8086
*/
Packit dd8086
typedef struct iso9660_xa_s
Packit dd8086
{
Packit dd8086
  uint16_t group_id;      /**< 0 */
Packit dd8086
  uint16_t user_id;       /**< 0 */
Packit dd8086
  uint16_t attributes;    /**< XA_ATTR_ */ 
Packit dd8086
  char     signature[2];  /**< { 'X', 'A' } */
Packit dd8086
  uint8_t  filenum;       /**< file number, see also XA subheader */
Packit dd8086
  uint8_t  reserved[5];   /**< zero */
Packit dd8086
} GNUC_PACKED iso9660_xa_t;
Packit dd8086
  
Packit dd8086
  
Packit dd8086
  /*!
Packit dd8086
    Returns POSIX mode bitstring for a given file.
Packit dd8086
  */
Packit dd8086
  posix_mode_t iso9660_get_posix_filemode_from_xa(uint16_t i_perms);
Packit dd8086
Packit dd8086
/*!
Packit dd8086
  Returns a string interpreting the extended attribute xa_attr. 
Packit dd8086
  For example:
Packit dd8086
  \verbatim
Packit dd8086
  d---1xrxrxr
Packit dd8086
  ---2--r-r-r
Packit dd8086
  -a--1xrxrxr
Packit dd8086
  \endverbatim
Packit dd8086
  
Packit dd8086
  A description of the characters in the string follows.
Packit dd8086
  The 1st character is either "d" if the entry is a directory, or "-" if not
Packit dd8086
  The 2nd character is either "a" if the entry is CDDA (audio), or "-" if not
Packit dd8086
  The 3rd character is either "i" if the entry is interleaved, or "-" if not
Packit dd8086
  The 4th character is either "2" if the entry is mode2 form2 or "-" if not
Packit dd8086
  The 5th character is either "1" if the entry is mode2 form1 or "-" if not
Packit dd8086
  Note that an entry will either be in mode2 form1 or mode form2. That
Packit dd8086
  is you will either see "2-" or "-1" in the 4th & 5th positions.
Packit dd8086
  
Packit dd8086
  The 6th and 7th characters refer to permissions for a user while the
Packit dd8086
  the 8th and 9th characters refer to permissions for a group while, and 
Packit dd8086
  the 10th and 11th characters refer to permissions for everyone. 
Packit dd8086
  
Packit dd8086
  In each of these pairs the first character (6, 8, 10) is "x" if the 
Packit dd8086
  entry is executable. For a directory this means the directory is
Packit dd8086
  allowed to be listed or "searched".
Packit dd8086
  The second character of a pair (7, 9, 11) is "r" if the entry is allowed
Packit dd8086
  to be read. 
Packit dd8086
*/
Packit dd8086
const char *
Packit dd8086
iso9660_get_xa_attr_str (uint16_t xa_attr);
Packit dd8086
  
Packit dd8086
/*! 
Packit dd8086
  Allocates and initalizes a new iso9600_xa_t variable and returns
Packit dd8086
  it. The caller must free the returned result using iso9660_xa_free().
Packit dd8086
Packit dd8086
  @see iso9660_xa
Packit dd8086
*/
Packit dd8086
iso9660_xa_t *
Packit dd8086
iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr, 
Packit dd8086
                 uint8_t filenum);
Packit dd8086
Packit dd8086
/*! 
Packit dd8086
  Frees the passed iso9600_xa_t structure.
Packit dd8086
Packit dd8086
  @see iso9660_xa
Packit dd8086
*/
Packit dd8086
void
Packit dd8086
iso9660_xa_free (iso9660_xa_t *_xa);
Packit dd8086
Packit dd8086
#ifdef __cplusplus
Packit dd8086
}
Packit dd8086
Packit dd8086
/** The below variables are trickery to force the above enum symbol
Packit dd8086
    values to be recorded in debug symbol tables. They are used to
Packit dd8086
    allow one to refer to the enumeration value names in the typedefs
Packit dd8086
    above in a debugger and debugger expressions.
Packit dd8086
*/
Packit dd8086
extern xa_misc_enum_t debugger_xa_misc_enum;
Packit dd8086
Packit dd8086
  
Packit dd8086
#endif /* __cplusplus */
Packit dd8086
Packit dd8086
#endif /* CDIO_XA_H_ */
Packit dd8086

Packit dd8086
/* 
Packit dd8086
 * Local variables:
Packit dd8086
 *  c-file-style: "gnu"
Packit dd8086
 *  tab-width: 8
Packit dd8086
 *  indent-tabs-mode: nil
Packit dd8086
 * End:
Packit dd8086
 */