source: appstream-generator/src/asgen/bindings/libarchive.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 3.9 KB
Line 
1/*
2 * Copyright (C) 2016 Matthias Klumpp <matthias@tenstral.net>
3 *
4 * Licensed under the GNU Lesser General Public License Version 3
5 *
6 * This library is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the license, or
9 * (at your option) any later version.
10 *
11 * This software is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20module asgen.bindings.libarchive;
21
22import core.stdc.stdio;
23import std.conv : octal;
24
25extern(C):
26nothrow:
27@nogc:
28static if (!is(typeof(usize))) private alias usize = size_t;
29
30struct archive {}
31struct archive_entry {}
32
33immutable ARCHIVE_EOF = 1;     /* Found end of archive. */
34immutable ARCHIVE_OK  = 0;         /* Operation was successful. */
35immutable ARCHIVE_RETRY = -10; /* Retry might succeed. */
36immutable ARCHIVE_WARN  = -20; /* Partial success. */
37immutable ARCHIVE_FAILED = -25; /* Current operation cannot complete. */
38immutable ARCHIVE_FATAL = -30;  /* No more operations are possible. */
39
40immutable AE_IFMT   = octal!170000;
41immutable AE_IFREG  = octal!100000;
42immutable AE_IFLNK  = octal!120000;
43immutable AE_IFSOCK = octal!140000;
44immutable AE_IFCHR  = octal!20000;
45immutable AE_IFBLK  = octal!60000;
46immutable AE_IFDIR  = octal!40000;
47immutable AE_IFIFO  = octal!10000;
48
49const(char) *archive_error_string (archive*);
50int archive_errno (archive*);
51
52archive *archive_read_new ();
53int archive_read_free (archive*);
54
55int archive_read_support_filter_all (archive*);
56int archive_read_support_filter_gzip (archive*);
57int archive_read_support_filter_lzma (archive*);
58
59int archive_read_support_format_raw (archive*);
60int archive_read_support_format_empty (archive*);
61int archive_read_support_format_all (archive*);
62int archive_read_support_format_ar (archive*);
63int archive_read_support_format_gnutar (archive*);
64
65int archive_write_set_filter_option (archive *a, const(char) *m, const(char) *o, const(char) *v);
66
67int archive_read_open_filename (archive*, const(char) *filename, usize block_size);
68int archive_read_open_FILE (archive*, FILE *file);
69int archive_read_open_memory (archive*, void *buff, size_t size);
70
71ptrdiff_t archive_read_data (archive*, void*, usize);
72int archive_read_next_header (archive*, archive_entry**);
73int archive_read_data_skip (archive*);
74int archive_read_data_block (archive *a, const(void*) *buff, size_t *size, long *offset);
75
76archive_entry *archive_entry_new ();
77void archive_entry_free (archive_entry*);
78
79const(char) *archive_entry_pathname (archive_entry*);
80void archive_entry_set_pathname (archive_entry*, const(char) *);
81uint archive_entry_filetype (archive_entry*);
82void archive_entry_set_size (archive_entry*, long);
83void archive_entry_set_filetype (archive_entry*, uint);
84void archive_entry_set_perm (archive_entry*, uint);
85void archive_entry_set_mtime (archive_entry*, ulong sec, long nsec);
86const(char)     *archive_entry_symlink (archive_entry*);
87
88archive *archive_write_new ();
89int archive_write_free (archive*);
90int archive_write_close (archive*);
91
92int archive_write_add_filter_gzip (archive*);
93int archive_write_add_filter_xz (archive*);
94int archive_write_set_format_pax (archive*);
95int archive_write_set_format_pax_restricted (archive*);
96int archive_write_set_format_raw (archive*);
97//int archive_write_set_format_raw (archive *a); /// Will be available in the next version of libarchive (to be released in 2016)
98int archive_write_set_format_by_name (archive*, const(char) *name);
99
100int archive_write_open_filename (archive*, const(char) *file);
101int archive_write_header (archive*, archive_entry*);
102size_t archive_write_data(archive*, const(void)*, size_t);
Note: See TracBrowser for help on using the repository browser.