|
libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
|
#include <stdint.h>#include <stdlib.h>#include <string.h>#include "aaruformat.h"#include "internal.h"#include "log.h"Go to the source code of this file.
Functions | |
| int32_t | aaruf_get_dpm (const void *context, uint8_t *buffer, size_t *length) |
| Retrieves the Data Position Measurement block. | |
| int32_t | aaruf_set_dpm (void *context, const uint8_t *data, size_t length) |
| Sets the Data Position Measurement block. | |
| int32_t | aaruf_clear_dpm (void *context) |
| Removes the Data Position Measurement block. | |
| int32_t aaruf_clear_dpm | ( | void * | context | ) |
Removes the Data Position Measurement block.
Discards the DPM kept in the context. When the image is closed, the DPM block is removed from the index, so a resumed image loses the DPM it had.
| context | Pointer to the aaruformat context, opened for writing. |
Definition at line 172 of file dpm.c.
References AARU_CALL, AARU_EXPORT, AARU_MAGIC, aaruf_clear_dpm(), AARUF_ERROR_NOT_AARUFORMAT, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::dirty_dpm_block, aaruformat_context::dpm_block, aaruformat_context::dpm_block_length, FATAL, aaruformat_context::is_writing, aaruformat_context::magic, and TRACE.
Referenced by aaruf_clear_dpm().
| int32_t aaruf_get_dpm | ( | const void * | context, |
| uint8_t * | buffer, | ||
| size_t * | length ) |
Retrieves the Data Position Measurement block.
Copies the serialized block, a DpmHeader followed by its payload exactly as stored in the image, to buffer. When buffer is NULL or too small, length is set to the required size and AARUF_ERROR_BUFFER_TOO_SMALL is returned, so the caller can allocate and call again.
Works on images opened for reading and on images being created or resumed.
| context | Pointer to the aaruformat context. |
| buffer | Buffer that receives the block, may be NULL to query the size. |
| length | On input the size of buffer, on output the size of the block. |
buffer is too small. Definition at line 43 of file dpm.c.
References AARU_CALL, AARU_EXPORT, AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, aaruf_get_dpm(), AARUF_STATUS_OK, aaruformat_context::dpm_block, aaruformat_context::dpm_block_length, FATAL, aaruformat_context::magic, and TRACE.
Referenced by aaruf_get_dpm().
| int32_t aaruf_set_dpm | ( | void * | context, |
| const uint8_t * | data, | ||
| size_t | length ) |
Sets the Data Position Measurement block.
Takes the serialized block, a DpmHeader followed by its payload, validates its identifier, sizes and CRC64, and keeps a copy that is written when the image is closed, replacing any DPM the image already had.
| context | Pointer to the aaruformat context, opened for writing. |
| data | Serialized block. |
| length | Length of data in bytes. |
Definition at line 102 of file dpm.c.
References AARU_CALL, AARU_EXPORT, AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, aaruf_set_dpm(), AARUF_STATUS_OK, aaruformat_context::dirty_dpm_block, aaruformat_context::dpm_block, aaruformat_context::dpm_block_length, FATAL, aaruformat_context::is_writing, aaruformat_context::magic, TRACE, and validate_dpm_block().
Referenced by aaruf_set_dpm().