Read and traverse the index.

This commit is contained in:
2019-03-17 21:14:40 +00:00
parent 0c9044f290
commit 2b2834f30c
6 changed files with 105 additions and 20 deletions

View File

@@ -10,11 +10,21 @@
typedef struct dicformatContext
{
uint64_t magic;
uint8_t libraryMajorVersion;
uint8_t libraryMinorVersion;
FILE *imageStream;
DicHeader header;
uint64_t magic;
uint8_t libraryMajorVersion;
uint8_t libraryMinorVersion;
FILE *imageStream;
DicHeader header;
struct dataLinkedList *mediaTagsHead;
struct dataLinkedList *mediaTagsTail;
} dicformatContext;
typedef struct dataLinkedList
{
struct dataLinkedList *previous;
struct dataLinkedList *next;
unsigned char *data;
int type;
} dataLinkedList;
#endif //LIBDICFORMAT_CONTEXT_H

View File

@@ -183,21 +183,21 @@ typedef enum
typedef enum
{
/** Block containing data */
DataBlock = 0x4B4C4244,
DataBlock = 0x4B4C4244,
/** Block containing a deduplication table */
DeDuplicationTable = 0X2A544444,
DeDuplicationTable = 0X2A544444,
/** Block containing the index */
Index = 0X58444E49,
IndexBlock = 0X58444E49,
/** Block containing logical geometry */
GeometryBlock = 0x4D4F4547,
GeometryBlock = 0x4D4F4547,
/** Block containing metadata */
MetadataBlock = 0x4154454D,
MetadataBlock = 0x4154454D,
/** Block containing optical disc tracks */
TracksBlock = 0x534B5254,
TracksBlock = 0x534B5254,
/** Block containing CICM XML metadata */
CicmBlock = 0x4D434943,
CicmBlock = 0x4D434943,
/** Block containing contents checksums */
ChecksumBlock = 0x4D534B43,
ChecksumBlock = 0x4D534B43,
/** TODO: Block containing data position measurements */
DataPositionMeasurementBlock = 0x2A4D5044,
/** TODO: Block containing a snapshot index */

View File

@@ -7,6 +7,7 @@
#define DICF_ERROR_NOT_DICFORMAT -1
#define DICF_ERROR_FILE_TOO_SMALL -2
#define DICF_ERROR_INCOMPATIBLE_VERSION -2
#define DICF_ERROR_INCOMPATIBLE_VERSION -3
#define DICF_ERROR_CANNOT_READ_INDEX -4
#endif //LIBDICFORMAT_ERRORS_H

View File

@@ -104,7 +104,7 @@ typedef struct IndexHeader
typedef struct IndexEntry
{
/**Type of item pointed by this entry */
uint32_t uint32_t;
uint32_t blockType;
/**Type of data contained by the block pointed by this entry */
uint16_t dataType;
/**Offset in file where item is stored */