mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
59 lines
1.6 KiB
Plaintext
59 lines
1.6 KiB
Plaintext
/**
|
|
* @defgroup pkg_tinyvcdiff Tiny VCDIFF
|
|
* @ingroup pkg
|
|
* @brief Decoder for interleaved VCDIFF deltas
|
|
*
|
|
* # Introduction
|
|
*
|
|
* tiny-vcdiff is a decoder for binary delta files that have been generated by
|
|
* [open-vcdiff](https://github.com/google/open-vcdiff) in the interleaved format.
|
|
*
|
|
* # Usage
|
|
*
|
|
* Every delta requires a source (the known data) and a target (the reconstructed
|
|
* data). This implementation provides backends for the @ref drivers_mtd and
|
|
* @ref sys_vfs storage drivers.
|
|
*
|
|
* # Example
|
|
*
|
|
* The example down below uses a @ref drivers_mtd device as known source data and
|
|
* writes the resulting target data into a @ref sys_vfs file.
|
|
*
|
|
* ```c
|
|
* #include "vcdiff.h"
|
|
* #include "vcdiff_mtd.h"
|
|
* #include "vcdiff_vfs.h"
|
|
*
|
|
* int apply_delta (const uint8_t *data, size_t data_len,
|
|
* mtd_dev_t *source_mtd,
|
|
* int traget_fd)
|
|
* {
|
|
* int rc;
|
|
* vcdiff_t vcdiff;
|
|
* vcdiff_init(&vcdiff);
|
|
*
|
|
* /* make sure source_mtd is already powered on */
|
|
* vcdiff_mtd_t source = VCDIFF_MTD_INIT(source_mtd);
|
|
* vcdiff_set_source_driver(&vcdiff, &vcdiff_mtd_driver, &source);
|
|
*
|
|
* /* make sure the vfs file is already opened for writing */
|
|
* vcdiff_vfs_t target = VCDIFF_VFS_INIT(fd_target);
|
|
* vcdiff_set_target_driver(&vcdiff, &vcdiff_vfs_driver, &target);
|
|
*
|
|
* rc = vcdiff_apply_delta(&vcdiff, data, data_len);
|
|
* if (rc != 0) {
|
|
* return rc;
|
|
* }
|
|
*
|
|
* rc = vcdiff_finish(&vcdiff);
|
|
* return rc;
|
|
* }
|
|
* ```
|
|
*
|
|
* # License
|
|
*
|
|
* Licensed under MIT.
|
|
*
|
|
* @see https://github.com/jue89/tiny-vcdiff.git
|
|
*/
|