1 /* gpgtar.h - Global definitions for gpgtar
2 * Copyright (C) 2010 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU 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.
11 * GnuPG 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 General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <https://www.gnu.org/licenses/>.
23 #include "../common/util.h"
24 #include "../common/strlist.h"
26 /* We keep all global options in the structure OPT. */
30 unsigned int debug_level;
33 const char *gpg_program;
34 strlist_t gpg_arguments;
40 const char *directory;
44 /* The size of a tar record. All IO is done in chunks of this size.
45 Note that we don't care about blocking because this version of tar
46 is not expected to be used directly on a tape drive in fact it is
47 used in a pipeline with GPG and thus any blocking would be
49 #define RECORDSIZE 512
52 /* Description of the USTAR header format. */
53 struct ustar_raw_header
75 /* Filetypes as defined by USTAR. */
86 TF_UNKNOWN, /* Needs to be treated as regular file. */
87 TF_NOTSUP /* Not supported (used with --create). */
91 /* The internal represenation of a TAR header. */
93 typedef struct tar_header_s *tar_header_t;
96 tar_header_t next; /* Used to build a linked list iof entries. */
98 unsigned long mode; /* The file mode. */
99 unsigned long nlink; /* Number of hard links. */
100 unsigned long uid; /* The user id of the file. */
101 unsigned long gid; /* The group id of the file. */
102 unsigned long long size; /* The size of the file. */
103 unsigned long long mtime; /* Modification time since Epoch. Note
104 that we don't use time_t here but a
105 type which is more likely to be larger
106 that 32 bit and thus allows tracking
107 times beyond 2106. */
108 typeflag_t typeflag; /* The type of the file. */
111 unsigned long long nrecords; /* Number of data records. */
113 char name[1]; /* Filename (dynamically extended). */
118 gpg_error_t read_record (estream_t stream, void *record);
119 gpg_error_t write_record (estream_t stream, const void *record);
121 /*-- gpgtar-create.c --*/
122 gpg_error_t gpgtar_create (char **inpattern, int encrypt, int sign);
124 /*-- gpgtar-extract.c --*/
125 gpg_error_t gpgtar_extract (const char *filename, int decrypt);
127 /*-- gpgtar-list.c --*/
128 gpg_error_t gpgtar_list (const char *filename, int decrypt);
129 gpg_error_t gpgtar_read_header (estream_t stream, tar_header_t *r_header);
130 void gpgtar_print_header (tar_header_t header, estream_t out);