1228753Smm/*- 2228753Smm * Copyright (c) 2003-2007 Tim Kientzle 3228753Smm * All rights reserved. 4228753Smm * 5228753Smm * Redistribution and use in source and binary forms, with or without 6228753Smm * modification, are permitted provided that the following conditions 7228753Smm * are met: 8228753Smm * 1. Redistributions of source code must retain the above copyright 9228753Smm * notice, this list of conditions and the following disclaimer. 10228753Smm * 2. Redistributions in binary form must reproduce the above copyright 11228753Smm * notice, this list of conditions and the following disclaimer in the 12228753Smm * documentation and/or other materials provided with the distribution. 13228753Smm * 14228753Smm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 15228753Smm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16228753Smm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17228753Smm * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 18228753Smm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19228753Smm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20228753Smm * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21228753Smm * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22228753Smm * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23228753Smm * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24228753Smm */ 25228753Smm 26228753Smm#include "archive_platform.h" 27228763Smm__FBSDID("$FreeBSD$"); 28228753Smm 29228753Smm#include "archive.h" 30228753Smm#include "archive_entry.h" 31228753Smm#include "archive_private.h" 32228753Smm 33228753Smmint 34232153Smmarchive_filter_code(struct archive *a, int n) 35232153Smm{ 36232153Smm return ((a->vtable->archive_filter_code)(a, n)); 37232153Smm} 38232153Smm 39232153Smmint 40232153Smmarchive_filter_count(struct archive *a) 41232153Smm{ 42232153Smm return ((a->vtable->archive_filter_count)(a)); 43232153Smm} 44232153Smm 45232153Smmconst char * 46232153Smmarchive_filter_name(struct archive *a, int n) 47232153Smm{ 48232153Smm return ((a->vtable->archive_filter_name)(a, n)); 49232153Smm} 50232153Smm 51232153Smmint64_t 52232153Smmarchive_filter_bytes(struct archive *a, int n) 53232153Smm{ 54232153Smm return ((a->vtable->archive_filter_bytes)(a, n)); 55232153Smm} 56232153Smm 57232153Smmint 58228753Smmarchive_write_close(struct archive *a) 59228753Smm{ 60228753Smm return ((a->vtable->archive_close)(a)); 61228753Smm} 62228753Smm 63228753Smmint 64228753Smmarchive_read_close(struct archive *a) 65228753Smm{ 66228753Smm return ((a->vtable->archive_close)(a)); 67228753Smm} 68228753Smm 69228753Smmint 70248616Smmarchive_write_fail(struct archive *a) 71248616Smm{ 72248616Smm a->state = ARCHIVE_STATE_FATAL; 73248616Smm return a->state; 74248616Smm} 75248616Smm 76248616Smmint 77228773Smmarchive_write_free(struct archive *a) 78228753Smm{ 79232153Smm if (a == NULL) 80232153Smm return (ARCHIVE_OK); 81228773Smm return ((a->vtable->archive_free)(a)); 82228753Smm} 83228773Smm 84228773Smm#if ARCHIVE_VERSION_NUMBER < 4000000 85228773Smm/* For backwards compatibility; will be removed with libarchive 4.0. */ 86228773Smmint 87228753Smmarchive_write_finish(struct archive *a) 88228753Smm{ 89232153Smm return archive_write_free(a); 90228753Smm} 91228753Smm#endif 92228753Smm 93228753Smmint 94228773Smmarchive_read_free(struct archive *a) 95228773Smm{ 96232153Smm if (a == NULL) 97232153Smm return (ARCHIVE_OK); 98228773Smm return ((a->vtable->archive_free)(a)); 99228773Smm} 100228773Smm 101228773Smm#if ARCHIVE_VERSION_NUMBER < 4000000 102228773Smm/* For backwards compatibility; will be removed with libarchive 4.0. */ 103228773Smmint 104228753Smmarchive_read_finish(struct archive *a) 105228753Smm{ 106232153Smm return archive_read_free(a); 107228753Smm} 108228773Smm#endif 109228753Smm 110228753Smmint 111228753Smmarchive_write_header(struct archive *a, struct archive_entry *entry) 112228753Smm{ 113228753Smm ++a->file_count; 114228753Smm return ((a->vtable->archive_write_header)(a, entry)); 115228753Smm} 116228753Smm 117228753Smmint 118228753Smmarchive_write_finish_entry(struct archive *a) 119228753Smm{ 120228753Smm return ((a->vtable->archive_write_finish_entry)(a)); 121228753Smm} 122228753Smm 123228753Smmssize_t 124228753Smmarchive_write_data(struct archive *a, const void *buff, size_t s) 125228753Smm{ 126228753Smm return ((a->vtable->archive_write_data)(a, buff, s)); 127228753Smm} 128228753Smm 129228753Smmssize_t 130232153Smmarchive_write_data_block(struct archive *a, const void *buff, size_t s, int64_t o) 131228753Smm{ 132232153Smm if (a->vtable->archive_write_data_block == NULL) { 133232153Smm archive_set_error(a, ARCHIVE_ERRNO_MISC, 134232153Smm "archive_write_data_block not supported"); 135232153Smm a->state = ARCHIVE_STATE_FATAL; 136232153Smm return (ARCHIVE_FATAL); 137232153Smm } 138228753Smm return ((a->vtable->archive_write_data_block)(a, buff, s, o)); 139228753Smm} 140232153Smm 141232153Smmint 142232153Smmarchive_read_next_header(struct archive *a, struct archive_entry **entry) 143232153Smm{ 144232153Smm return ((a->vtable->archive_read_next_header)(a, entry)); 145232153Smm} 146232153Smm 147232153Smmint 148232153Smmarchive_read_next_header2(struct archive *a, struct archive_entry *entry) 149232153Smm{ 150232153Smm return ((a->vtable->archive_read_next_header2)(a, entry)); 151232153Smm} 152232153Smm 153232153Smmint 154232153Smmarchive_read_data_block(struct archive *a, 155232153Smm const void **buff, size_t *s, int64_t *o) 156232153Smm{ 157232153Smm return ((a->vtable->archive_read_data_block)(a, buff, s, o)); 158232153Smm} 159