ZIP_SOURCE_LAYERED(3) | Library Functions Manual | ZIP_SOURCE_LAYERED(3) |
zip_source_layered
,
zip_source_layered_create
—
#include <zip.h>
zip_source_t *
zip_source_layered
(zip_t
*archive, zip_source_t
*source,
zip_source_layered_callback
fn, void
*userdata);
zip_source_t *
zip_source_layered_create
(zip_source_t
*source,
zip_source_layered_callback
fn, void *userdata,
zip_error_t *error);
zip_source_layered
() and
zip_source_layered_create
() create a layered zip
source from the user-provided function fn, which must be
of the following type:
typedef zip_int64_t
(*p_source_layered_callback)
(zip_source_t
*source, void *userdata, void
*data, zip_uint64_t length,
zip_source_cmd_t cmd);
archive or error are
used for reporting errors and can be NULL
.
When called by the library, the first argument is the
source of the lower layer, the second argument is the
userdata argument supplied to the function. The next
two arguments are a buffer data of size
length when data is passed in or expected to be
returned, or else NULL
and 0. The last argument,
cmd, specifies which action the function should
perform.
See zip_source_function(3) for a description of the commands.
A layered source transforms the data or metadata of the source below in some way. Layered sources can't support writing and are not sufficient to cleanly add support for additional compression or encryption methods. This may be revised in a later release of libzip.
On success, the layered source takes ownership of source. The caller should not free it.
The interaction with the lower layer depends on the command:
ZIP_SOURCE_ACCEPT_EMPTY
ZIP_SOURCE_CLOSE
ZIP_SOURCE_ERROR
ZIP_SOURCE_FREE
ZIP_SOURCE_GET_FILE_ATTRIBUTES
ZIP_SOURCE_OPEN
ZIP_SOURCE_READ
ZIP_SOURCE_SEEK
ZIP_SOURCE_STAT
ZIP_SOURCE_SUPPORTS
ZIP_SOURCE_TELL
NULL
is returned and the error code in
archive or error is set to
indicate the error (unless it is NULL
).
zip_source_layered
() fails if:
ZIP_ER_MEMORY
]zip_source_layered
() and
zip_source_layered_create
() were added in libzip 1.10.
January 20, 2023 | NiH |