2019-03-16 18:38:57 +00:00
|
|
|
// /***************************************************************************
|
2020-03-01 19:50:12 +00:00
|
|
|
// Aaru Data Preservation Suite
|
2019-03-16 18:38:57 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
2019-03-23 23:31:04 +00:00
|
|
|
// Filename : decls.h
|
2019-03-16 18:38:57 +00:00
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
2020-03-01 19:51:13 +00:00
|
|
|
// Component : libaaruformat.
|
2019-03-16 18:38:57 +00:00
|
|
|
//
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Declares exportable functions.
|
|
|
|
|
//
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// 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-01-03 17:47:47 +00:00
|
|
|
// Copyright © 2011-2020 Natalia Portillo
|
2019-03-16 18:38:57 +00:00
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
2020-03-01 19:53:05 +00:00
|
|
|
#ifndef LIBAARUFORMAT_DECLS_H
|
|
|
|
|
#define LIBAARUFORMAT_DECLS_H
|
2019-03-16 18:38:57 +00:00
|
|
|
|
2019-03-31 20:52:06 +01:00
|
|
|
#include <stdbool.h>
|
2019-03-20 22:34:21 +00:00
|
|
|
#include <stdint.h>
|
2019-03-20 23:38:58 +00:00
|
|
|
#include <stdio.h>
|
2019-03-20 22:34:21 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
int identify(const char* filename);
|
2019-03-17 19:07:57 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
int identifyStream(FILE* imageStream);
|
2019-03-17 19:07:57 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
void* open(const char* filepath);
|
2019-03-17 20:39:40 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
int close(void* context);
|
2019-03-17 20:39:40 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
int32_t read_media_tag(void* context, uint8_t* data, int32_t tag, uint32_t* length);
|
2019-03-20 00:45:47 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
void* crc64_init(uint64_t polynomial, uint64_t seed);
|
2019-03-20 23:41:16 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
void* crc64_init_ecma(void);
|
2019-03-20 23:41:16 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
void crc64_update(void* context, const uint8_t* data, size_t len);
|
2019-03-20 23:41:16 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
uint64_t crc64_final(void* context);
|
2019-03-20 23:41:16 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
uint64_t crc64_data(const uint8_t* data, size_t len, uint64_t polynomial, uint64_t seed);
|
2019-03-20 23:41:16 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
uint64_t crc64_data_ecma(const uint8_t* data, size_t len);
|
2019-03-17 20:39:40 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
int32_t read_sector(void* context, uint64_t sectorAddress, uint8_t* data, uint32_t* length);
|
2019-03-21 01:06:21 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
int32_t cst_transform(const uint8_t* interleaved, uint8_t* sequential, size_t length);
|
2019-03-23 22:02:28 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
int32_t cst_untransform(const uint8_t* sequential, uint8_t* interleaved, size_t length);
|
2019-03-23 22:02:28 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
void* ecc_cd_init();
|
2019-03-23 22:59:36 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
bool ecc_cd_is_suffix_correct(void* context, const uint8_t* sector);
|
2019-03-23 22:59:36 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
bool ecc_cd_is_suffix_correct_mode2(void* context, const uint8_t* sector);
|
2019-03-23 22:59:36 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
bool ecc_cd_check(void* context,
|
|
|
|
|
const uint8_t* address,
|
|
|
|
|
const uint8_t* data,
|
2019-03-31 20:52:06 +01:00
|
|
|
uint32_t majorCount,
|
|
|
|
|
uint32_t minorCount,
|
|
|
|
|
uint32_t majorMult,
|
|
|
|
|
uint32_t minorInc,
|
2019-08-03 01:58:19 +01:00
|
|
|
const uint8_t* ecc,
|
2019-03-31 20:52:06 +01:00
|
|
|
int32_t addressOffset,
|
|
|
|
|
int32_t dataOffset,
|
|
|
|
|
int32_t eccOffset);
|
2019-03-23 22:59:36 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
void ecc_cd_write(void* context,
|
|
|
|
|
const uint8_t* address,
|
|
|
|
|
const uint8_t* data,
|
2019-03-31 20:52:06 +01:00
|
|
|
uint32_t majorCount,
|
|
|
|
|
uint32_t minorCount,
|
|
|
|
|
uint32_t majorMult,
|
|
|
|
|
uint32_t minorInc,
|
2019-08-03 01:58:19 +01:00
|
|
|
uint8_t* ecc,
|
2019-03-31 20:52:06 +01:00
|
|
|
int32_t addressOffset,
|
|
|
|
|
int32_t dataOffset,
|
|
|
|
|
int32_t eccOffset);
|
|
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
void ecc_cd_write_sector(void* context,
|
|
|
|
|
const uint8_t* address,
|
|
|
|
|
const uint8_t* data,
|
|
|
|
|
uint8_t* ecc,
|
2019-03-31 20:52:06 +01:00
|
|
|
int32_t addressOffset,
|
|
|
|
|
int32_t dataOffset,
|
|
|
|
|
int32_t eccOffset);
|
2019-03-23 22:59:36 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
void cd_lba_to_msf(int64_t pos, uint8_t* minute, uint8_t* second, uint8_t* frame);
|
2019-03-23 22:59:36 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
void ecc_cd_reconstruct_prefix(uint8_t* sector, uint8_t type, int64_t lba);
|
2019-03-23 22:59:36 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
void ecc_cd_reconstruct(void* context, uint8_t* sector, uint8_t type);
|
2019-03-23 22:59:36 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
uint32_t edc_cd_compute(void* context, uint32_t edc, const uint8_t* src, int size, int pos);
|
2019-03-23 22:59:36 +00:00
|
|
|
|
2019-08-03 01:58:19 +01:00
|
|
|
int32_t read_track_sector(void* context, uint8_t* data, uint64_t sectorAddress, uint32_t* length, uint8_t track);
|
2019-03-23 23:31:04 +00:00
|
|
|
|
2019-03-31 20:30:27 +01:00
|
|
|
int32_t GetMediaTagTypeForDataType(int32_t type);
|
|
|
|
|
|
|
|
|
|
int32_t GetXmlMediaType(int32_t type);
|
2019-03-31 15:37:07 +01:00
|
|
|
|
2020-03-01 19:53:05 +00:00
|
|
|
#endif // LIBAARUFORMAT_DECLS_H
|