Add more C++ ISO 9660 methods and some classes (for C structs).
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/* -*- C++ -*-
|
/* -*- C++ -*-
|
||||||
$Id: iso9660.hpp,v 1.1 2006/03/05 06:52:15 rocky Exp $
|
$Id: iso9660.hpp,v 1.2 2006/03/05 08:31:03 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2006 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2006 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
#define __ISO9660_HPP__
|
#define __ISO9660_HPP__
|
||||||
|
|
||||||
#include <cdio/iso9660.h>
|
#include <cdio/iso9660.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/** ISO 9660 class.
|
/** ISO 9660 class.
|
||||||
*/
|
*/
|
||||||
@@ -36,9 +37,32 @@ class ISO9660
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
class PVD
|
||||||
|
{
|
||||||
|
PVD(iso9660_pvd_t *p_new_pvd)
|
||||||
|
{
|
||||||
|
p_pvd = p_new_pvd;
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
iso9660_pvd_t *p_pvd;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Stat
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Stat(iso9660_stat_t *p_new_stat)
|
||||||
|
{
|
||||||
|
p_stat = p_new_stat;
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
iso9660_stat_t * p_stat;
|
||||||
|
};
|
||||||
|
|
||||||
class IFS
|
class IFS
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
IFS()
|
IFS()
|
||||||
{
|
{
|
||||||
p_iso9660=NULL;
|
p_iso9660=NULL;
|
||||||
@@ -65,6 +89,89 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Given a directory pointer, find the filesystem entry that contains
|
||||||
|
lsn and return information about it.
|
||||||
|
|
||||||
|
Returns stat_t of entry if we found lsn, or NULL otherwise.
|
||||||
|
*/
|
||||||
|
Stat *find_lsn(lsn_t i_lsn)
|
||||||
|
{
|
||||||
|
iso9660_stat_t *p_stat = iso9660_find_ifs_lsn(p_iso9660, i_lsn);
|
||||||
|
if (!p_stat) return (Stat *) NULL;
|
||||||
|
return new Stat(p_stat);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Get the application ID. psz_app_id is set to NULL if there
|
||||||
|
is some problem in getting this and false is returned.
|
||||||
|
*/
|
||||||
|
bool get_application_id(/*out*/ char * &psz_app_id)
|
||||||
|
{
|
||||||
|
return iso9660_ifs_get_application_id(p_iso9660, &psz_app_id);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return the Joliet level recognized.
|
||||||
|
*/
|
||||||
|
uint8_t get_joliet_level()
|
||||||
|
{
|
||||||
|
return iso9660_ifs_get_joliet_level(p_iso9660);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Get the preparer ID. psz_preparer_id is set to NULL if there
|
||||||
|
is some problem in getting this and false is returned.
|
||||||
|
*/
|
||||||
|
bool get_preparer_id(/*out*/ char * &psz_preparer_id)
|
||||||
|
{
|
||||||
|
return iso9660_ifs_get_preparer_id(p_iso9660, &psz_preparer_id);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Get the publisher ID. psz_publisher_id is set to NULL if there
|
||||||
|
is some problem in getting this and false is returned.
|
||||||
|
*/
|
||||||
|
bool get_publisher_id(/*out*/ char * &psz_publisher_id)
|
||||||
|
{
|
||||||
|
return iso9660_ifs_get_publisher_id(p_iso9660, &psz_publisher_id);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Get the system ID. psz_system_id is set to NULL if there
|
||||||
|
is some problem in getting this and false is returned.
|
||||||
|
*/
|
||||||
|
bool get_system_id(/*out*/ char * &psz_system_id)
|
||||||
|
{
|
||||||
|
return iso9660_ifs_get_system_id(p_iso9660, &psz_system_id);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*! Return the volume ID in the PVD. psz_volume_id is set to
|
||||||
|
NULL if there is some problem in getting this and false is
|
||||||
|
returned.
|
||||||
|
*/
|
||||||
|
bool get_volume_id(/*out*/ char * &psz_volume_id)
|
||||||
|
{
|
||||||
|
return iso9660_ifs_get_volume_id(p_iso9660, &psz_volume_id);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*! Return the volumeset ID in the PVD. psz_volumeset_id is set to
|
||||||
|
NULL if there is some problem in getting this and false is
|
||||||
|
returned.
|
||||||
|
*/
|
||||||
|
bool get_volumeset_id(/*out*/ char * &psz_volumeset_id)
|
||||||
|
{
|
||||||
|
return iso9660_ifs_get_volumeset_id(p_iso9660, &psz_volumeset_id);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return true if ISO 9660 image has extended attrributes (XA).
|
||||||
|
*/
|
||||||
|
bool is_xa ()
|
||||||
|
{
|
||||||
|
return iso9660_ifs_is_xa (p_iso9660);
|
||||||
|
};
|
||||||
|
|
||||||
/*! Open an ISO 9660 image for reading. Maybe in the future we will
|
/*! Open an ISO 9660 image for reading. Maybe in the future we will
|
||||||
have a mode. NULL is returned on error. An open routine should be
|
have a mode. NULL is returned on error. An open routine should be
|
||||||
called before using any read routine. If device object was
|
called before using any read routine. If device object was
|
||||||
@@ -113,9 +220,28 @@ public:
|
|||||||
and datastart and a possible additional offset. Generally here we are
|
and datastart and a possible additional offset. Generally here we are
|
||||||
not reading an ISO 9660 image but a CD-Image which contains an ISO 9660
|
not reading an ISO 9660 image but a CD-Image which contains an ISO 9660
|
||||||
filesystem.
|
filesystem.
|
||||||
|
|
||||||
|
@see read_superblock
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
fuzzy_read_superblock (iso_extension_mask_t iso_extension_mask=
|
read_superblock (iso_extension_mask_t iso_extension_mask=
|
||||||
|
ISO_EXTENSION_NONE,
|
||||||
|
uint16_t i_fuzz=20)
|
||||||
|
{
|
||||||
|
return iso9660_ifs_read_superblock (p_iso9660, iso_extension_mask);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Read the Super block of an ISO 9660 image but determine framesize
|
||||||
|
and datastart and a possible additional offset. Generally here we are
|
||||||
|
not reading an ISO 9660 image but a CD-Image which contains an ISO 9660
|
||||||
|
filesystem.
|
||||||
|
|
||||||
|
@see read_superblock
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
read_superblock_fuzzy (iso_extension_mask_t iso_extension_mask=
|
||||||
ISO_EXTENSION_NONE,
|
ISO_EXTENSION_NONE,
|
||||||
uint16_t i_fuzz=20)
|
uint16_t i_fuzz=20)
|
||||||
{
|
{
|
||||||
@@ -132,10 +258,25 @@ public:
|
|||||||
return iso9660_iso_seek_read (p_iso9660, ptr, start, i_size);
|
return iso9660_iso_seek_read (p_iso9660, ptr, start, i_size);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return file status for pathname. NULL is returned on error.
|
||||||
|
*/
|
||||||
|
Stat *stat (const char psz_path[], bool b_translate=false)
|
||||||
|
{
|
||||||
|
iso9660_stat_t *p_stat;
|
||||||
|
|
||||||
|
if (b_translate)
|
||||||
|
p_stat = iso9660_ifs_stat_translate (p_iso9660, psz_path);
|
||||||
|
else
|
||||||
|
p_stat = iso9660_ifs_stat (p_iso9660, psz_path);
|
||||||
|
if (!p_stat) return (Stat *) NULL;
|
||||||
|
return new Stat(p_stat);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
iso9660_t *p_iso9660;
|
iso9660_t *p_iso9660;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: iso9660.h,v 1.84 2006/03/05 06:52:15 rocky Exp $
|
$Id: iso9660.h,v 1.85 2006/03/05 08:31:03 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
|
||||||
@@ -800,7 +800,8 @@ iso9660_dir_calc_record_size (unsigned int namelen, unsigned int su_len);
|
|||||||
Given a directory pointer, find the filesystem entry that contains
|
Given a directory pointer, find the filesystem entry that contains
|
||||||
lsn and return information about it.
|
lsn and return information about it.
|
||||||
|
|
||||||
Returns stat_t of entry if we found lsn, or NULL otherwise.
|
@return stat_t of entry if we found lsn, or NULL otherwise.
|
||||||
|
Caller must free return value.
|
||||||
*/
|
*/
|
||||||
iso9660_stat_t *iso9660_find_fs_lsn(CdIo_t *p_cdio, lsn_t i_lsn);
|
iso9660_stat_t *iso9660_find_fs_lsn(CdIo_t *p_cdio, lsn_t i_lsn);
|
||||||
|
|
||||||
@@ -809,7 +810,8 @@ iso9660_stat_t *iso9660_find_fs_lsn(CdIo_t *p_cdio, lsn_t i_lsn);
|
|||||||
Given a directory pointer, find the filesystem entry that contains
|
Given a directory pointer, find the filesystem entry that contains
|
||||||
lsn and return information about it.
|
lsn and return information about it.
|
||||||
|
|
||||||
Returns stat_t of entry if we found lsn, or NULL otherwise.
|
@return stat_t of entry if we found lsn, or NULL otherwise.
|
||||||
|
Caller must free return value.
|
||||||
*/
|
*/
|
||||||
iso9660_stat_t *iso9660_find_ifs_lsn(const iso9660_t *p_iso, lsn_t i_lsn);
|
iso9660_stat_t *iso9660_find_ifs_lsn(const iso9660_t *p_iso, lsn_t i_lsn);
|
||||||
|
|
||||||
@@ -952,25 +954,26 @@ lsn_t iso9660_get_dir_extent(const iso9660_dir_t *p_idr);
|
|||||||
lsn_t iso9660_get_root_lsn(const iso9660_pvd_t *p_pvd);
|
lsn_t iso9660_get_root_lsn(const iso9660_pvd_t *p_pvd);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the PVD's volume ID.
|
Get the volume ID in the PVD. psz_volume_id is set to NULL if there
|
||||||
|
is some problem in getting this and false is returned.
|
||||||
*/
|
*/
|
||||||
char *iso9660_get_volume_id(const iso9660_pvd_t *p_pvd);
|
char *iso9660_get_volume_id(const iso9660_pvd_t *p_pvd);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Get the system ID. psz_system_id is set to NULL if there
|
Get the volume ID in the PVD. psz_volume_id is set to NULL if there
|
||||||
is some problem in getting this and false is returned.
|
is some problem in getting this and false is returned.
|
||||||
*/
|
*/
|
||||||
bool iso9660_ifs_get_volume_id(iso9660_t *p_iso,
|
bool iso9660_ifs_get_volume_id(iso9660_t *p_iso,
|
||||||
/*out*/ char **p_psz_volume_id);
|
/*out*/ char **p_psz_volume_id);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the PVD's volumeset ID.
|
Return the volumeset ID in the PVD.
|
||||||
NULL is returned if there is some problem in getting this.
|
NULL is returned if there is some problem in getting this.
|
||||||
*/
|
*/
|
||||||
char *iso9660_get_volumeset_id(const iso9660_pvd_t *p_pvd);
|
char *iso9660_get_volumeset_id(const iso9660_pvd_t *p_pvd);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Get the systemset ID. psz_systemset_id is set to NULL if there
|
Get the volumeset ID. psz_systemset_id is set to NULL if there
|
||||||
is some problem in getting this and false is returned.
|
is some problem in getting this and false is returned.
|
||||||
*/
|
*/
|
||||||
bool iso9660_ifs_get_volumeset_id(iso9660_t *p_iso,
|
bool iso9660_ifs_get_volumeset_id(iso9660_t *p_iso,
|
||||||
|
|||||||
Reference in New Issue
Block a user