libaaruformat 1.0 Aaru Data Preservation Suite - Format Library

Loading...
Searching...
No Matches
internal.h
Go to the documentation of this file.
1/*
2 * This file is part of the Aaru Data Preservation Suite.
3 * Copyright (c) 2019-2025 Natalia Portillo.
4 *
5 * This library is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2.1 of the
8 * License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef LIBAARUFORMAT_INTERNAL_H
20#define LIBAARUFORMAT_INTERNAL_H
21
22#include "utarray.h"
23
24UT_array *process_index_v1(aaruformat_context *ctx);
25int32_t verify_index_v1(aaruformat_context *ctx);
26UT_array *process_index_v2(aaruformat_context *ctx);
27int32_t verify_index_v2(aaruformat_context *ctx);
28UT_array *process_index_v3(aaruformat_context *ctx);
29int32_t verify_index_v3(aaruformat_context *ctx);
30int32_t process_data_block(aaruformat_context *ctx, IndexEntry *entry);
31int32_t process_ddt_v1(aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt);
32int32_t process_ddt_v2(aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt);
33 void process_metadata_block(aaruformat_context *ctx, const IndexEntry *entry);
34 void process_geometry_block(aaruformat_context *ctx, const IndexEntry *entry);
35 void process_tracks_block(aaruformat_context *ctx, const IndexEntry *entry);
36 void process_cicm_block(aaruformat_context *ctx, const IndexEntry *entry);
37 void process_aaru_metadata_json_block(aaruformat_context *ctx, const IndexEntry *entry);
38 void process_dumphw_block(aaruformat_context *ctx, const IndexEntry *entry);
39 void process_checksum_block(aaruformat_context *ctx, const IndexEntry *entry);
40 void process_tape_files_block(aaruformat_context *ctx, const IndexEntry *entry);
41 void process_tape_partitions_block(aaruformat_context *ctx, const IndexEntry *entry);
42int32_t decode_ddt_entry_v1(aaruformat_context *ctx, uint64_t sector_address, uint64_t *offset, uint64_t *block_offset,
43 uint8_t *sector_status);
44int32_t decode_ddt_entry_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset,
45 uint64_t *block_offset, uint8_t *sector_status);
46int32_t decode_ddt_single_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset,
47 uint64_t *block_offset, uint8_t *sector_status);
48int32_t decode_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset,
49 uint64_t *block_offset, uint8_t *sector_status);
50 bool set_ddt_entry_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset,
51 uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry);
52 bool set_ddt_single_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset,
53 uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry);
54 bool set_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset,
55 uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry);
56 bool set_ddt_tape(aaruformat_context *ctx, uint64_t sector_address, uint64_t offset, uint64_t block_offset,
57 uint8_t sector_status, uint64_t *ddt_entry);
58 aaru_options parse_options(const char *options);
59uint64_t get_filetime_uint64();
60int32_t aaruf_close_current_block(aaruformat_context *ctx);
61 int compare_extents(const void *a, const void *b);
62 void generate_random_bytes(uint8_t *buffer, size_t length);
63
64#endif // LIBAARUFORMAT_INTERNAL_H
process_dumphw_block
void process_dumphw_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a dump hardware block from the image stream.
Definition dump.c:107
set_ddt_entry_v2
bool set_ddt_entry_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
Sets a DDT v2 entry for a given sector address.
Definition ddt_v2.c:988
process_index_v2
UT_array * process_index_v2(aaruformat_context *ctx)
Processes an index block (version 2) from the image stream.
Definition index_v2.c:81
process_ddt_v2
int32_t process_ddt_v2(aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt)
Processes a DDT v2 block from the image stream.
Definition ddt_v2.c:96
aaruf_close_current_block
int32_t aaruf_close_current_block(aaruformat_context *ctx)
Finalizes and writes the current data block to the AaruFormat image file.
Definition write.c:1403
decode_ddt_entry_v1
int32_t decode_ddt_entry_v1(aaruformat_context *ctx, uint64_t sector_address, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
Decodes a DDT v1 entry for a given sector address.
Definition ddt_v1.c:405
process_data_block
int32_t process_data_block(aaruformat_context *ctx, IndexEntry *entry)
Processes a data block from the image stream.
Definition data.c:71
get_filetime_uint64
uint64_t get_filetime_uint64()
Gets the current time as a 64-bit FILETIME value.
Definition time.c:45
process_tracks_block
void process_tracks_block(aaruformat_context *ctx, const IndexEntry *entry)
Parse and integrate a Tracks block from the image stream into the context.
Definition optical.c:111
decode_ddt_single_level_v2
int32_t decode_ddt_single_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
Decodes a single-level DDT v2 entry for a given sector address.
Definition ddt_v2.c:581
process_metadata_block
void process_metadata_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a metadata block from the image stream.
Definition metadata.c:35
process_checksum_block
void process_checksum_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a checksum block from the image stream.
Definition checksum.c:39
process_index_v1
UT_array * process_index_v1(aaruformat_context *ctx)
Processes an index block (version 1) from the image stream.
Definition index_v1.c:79
process_cicm_block
void process_cicm_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a CICM XML metadata block from the image stream.
Definition metadata.c:306
set_ddt_multi_level_v2
bool set_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
Sets a multi-level DDT v2 entry for a given sector address.
Definition ddt_v2.c:1092
set_ddt_single_level_v2
bool set_ddt_single_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
Sets a single-level DDT v2 entry for a given sector address.
Definition ddt_v2.c:1023
generate_random_bytes
void generate_random_bytes(uint8_t *buffer, size_t length)
Generates cryptographically strong random bytes.
Definition helpers.c:480
decode_ddt_entry_v2
int32_t decode_ddt_entry_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
Decodes a DDT v2 entry for a given sector address.
Definition ddt_v2.c:507
process_geometry_block
void process_geometry_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a logical geometry block from the image stream.
Definition metadata.c:246
set_ddt_tape
bool set_ddt_tape(aaruformat_context *ctx, uint64_t sector_address, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
Sets a DDT entry for tape media using a hash-based lookup table.
Definition ddt_v2.c:1768
process_tape_files_block
void process_tape_files_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a tape file metadata block from the image stream.
Definition tape.c:126
decode_ddt_multi_level_v2
int32_t decode_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
Decodes a multi-level DDT v2 entry for a given sector address.
Definition ddt_v2.c:724
process_aaru_metadata_json_block
void process_aaru_metadata_json_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes an Aaru metadata JSON block from the image stream during image opening.
Definition metadata.c:470
verify_index_v1
int32_t verify_index_v1(aaruformat_context *ctx)
Verifies the integrity of an index block (version 1) in the image stream.
Definition index_v1.c:225
process_tape_partitions_block
void process_tape_partitions_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a tape partition metadata block from the image stream.
Definition tape.c:346
parse_options
aaru_options parse_options(const char *options)
Parses the options string for AaruFormat image creation/opening.
Definition options.c:38
process_ddt_v1
int32_t process_ddt_v1(aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt)
Processes a DDT v1 block from the image stream.
Definition ddt_v1.c:85
compare_extents
int compare_extents(const void *a, const void *b)
Comparison function for sorting DumpExtent arrays by start sector.
Definition helpers.c:459
verify_index_v3
int32_t verify_index_v3(aaruformat_context *ctx)
Verifies the integrity of an index block (version 3) in the image stream.
Definition index_v3.c:408
verify_index_v2
int32_t verify_index_v2(aaruformat_context *ctx)
Verifies the integrity of an index block (version 2) in the image stream.
Definition index_v2.c:227
process_index_v3
UT_array * process_index_v3(aaruformat_context *ctx)
Processes an index block (version 3) from the image stream.
Definition index_v3.c:98
IndexEntry
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
aaru_options
Parsed user-specified tunables controlling compression, deduplication, hashing and DDT geometry.
Definition options.h:217
aaruformat_context
Master context representing an open or in‑creation Aaru image.
Definition context.h:172