Files
libaaruformat/include/aaruformat/context.h

121 lines
4.0 KiB
C
Raw Normal View History

2022-05-28 12:57:21 +01:00
/*
* This file is part of the Aaru Data Preservation Suite.
* Copyright (c) 2019-2022 Natalia Portillo.
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
2020-03-01 19:53:05 +00:00
#ifndef LIBAARUFORMAT_CONTEXT_H
#define LIBAARUFORMAT_CONTEXT_H
2022-10-02 16:05:25 +01:00
#include "lru.h"
2022-05-28 12:10:04 +01:00
#include "structs.h"
2022-10-04 19:44:34 +01:00
#ifndef MD5_DIGEST_LENGTH
#define MD5_DIGEST_LENGTH 16
#endif
#ifndef SHA1_DIGEST_LENGTH
#define SHA1_DIGEST_LENGTH 20
#endif
#ifndef SHA256_DIGEST_LENGTH
#define SHA256_DIGEST_LENGTH 32
#endif
typedef struct Checksums
{
bool hasMd5;
bool hasSha1;
bool hasSha256;
bool hasSpamSum;
uint8_t md5[MD5_DIGEST_LENGTH];
uint8_t sha1[SHA1_DIGEST_LENGTH];
uint8_t sha256[SHA256_DIGEST_LENGTH];
2024-04-30 15:51:32 +01:00
uint8_t *spamsum;
2022-10-04 19:44:34 +01:00
} Checksums;
2022-10-04 20:32:26 +01:00
typedef struct mediaTagEntry
{
2024-04-30 15:51:32 +01:00
uint8_t *data;
2022-10-04 20:32:26 +01:00
int32_t type;
uint32_t length;
UT_hash_handle hh;
} mediaTagEntry;
2020-03-01 19:51:13 +00:00
typedef struct aaruformatContext
{
2019-03-31 20:52:06 +01:00
uint64_t magic;
uint8_t libraryMajorVersion;
uint8_t libraryMinorVersion;
2024-04-30 15:51:32 +01:00
FILE *imageStream;
2020-03-01 19:55:22 +00:00
AaruHeader header;
2024-04-30 15:51:32 +01:00
uint8_t *sectorPrefix;
uint8_t *sectorPrefixCorrected;
uint8_t *sectorSuffix;
uint8_t *sectorSuffixCorrected;
uint8_t *sectorSubchannel;
uint8_t *mode2Subheaders;
2019-03-31 20:52:06 +01:00
uint8_t shift;
bool inMemoryDdt;
2024-04-30 15:51:32 +01:00
uint64_t *userDataDdt;
2019-03-31 20:52:06 +01:00
size_t mappedMemoryDdtSize;
2024-04-30 15:51:32 +01:00
uint32_t *sectorPrefixDdt;
uint32_t *sectorSuffixDdt;
2019-03-31 20:52:06 +01:00
GeometryBlockHeader geometryBlock;
MetadataBlockHeader metadataBlockHeader;
2024-04-30 15:51:32 +01:00
uint8_t *metadataBlock;
2019-03-31 20:52:06 +01:00
TracksHeader tracksHeader;
2024-04-30 15:51:32 +01:00
TrackEntry *trackEntries;
2019-03-31 20:52:06 +01:00
CicmMetadataBlock cicmBlockHeader;
2024-04-30 15:51:32 +01:00
uint8_t *cicmBlock;
2019-03-31 20:52:06 +01:00
DumpHardwareHeader dumpHardwareHeader;
2024-04-30 15:51:32 +01:00
struct DumpHardwareEntriesWithData *dumpHardwareEntriesWithData;
2019-03-31 20:52:06 +01:00
struct ImageInfo imageInfo;
2024-04-30 15:51:32 +01:00
CdEccContext *eccCdContext;
2019-03-31 20:52:06 +01:00
uint8_t numberOfDataTracks;
2024-04-30 15:51:32 +01:00
TrackEntry *dataTracks;
bool *readableSectorTags;
2022-10-02 16:05:25 +01:00
struct CacheHeader blockHeaderCache;
struct CacheHeader blockCache;
2022-10-04 19:44:34 +01:00
struct Checksums checksums;
2024-04-30 15:51:32 +01:00
struct mediaTagEntry *mediaTags;
2020-03-01 19:51:13 +00:00
} aaruformatContext;
2019-03-20 00:23:30 +00:00
typedef struct DumpHardwareEntriesWithData
{
2019-03-31 20:52:06 +01:00
DumpHardwareEntry entry;
2024-04-30 15:51:32 +01:00
struct DumpExtent *extents;
uint8_t *manufacturer;
uint8_t *model;
uint8_t *revision;
uint8_t *firmware;
uint8_t *serial;
uint8_t *softwareName;
uint8_t *softwareVersion;
uint8_t *softwareOperatingSystem;
2019-03-20 00:23:30 +00:00
} DumpHardwareEntriesWithData;
#pragma pack(push, 1)
typedef struct DumpExtent
{
uint64_t start;
uint64_t end;
} DumpExtent;
#pragma pack(pop)
2024-04-30 15:51:32 +01:00
#endif // LIBAARUFORMAT_CONTEXT_H