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 <http://www.gnu.org/licenses/>.
23
#include "../common/util.h"
24
#include "../common/estream.h"
26
/* We keep all global options in the structure OPT. */
37
/* The size of a tar record. All IO is done in chunks of this size.
38
Note that we don't care about blocking because this version of tar
39
is not expected to be used directly on a tape drive in fact it is
40
used in a pipeline with GPG and thus any blocking would be
42
#define RECORDSIZE 512
45
/* Description of the USTAR header format. */
46
struct ustar_raw_header
68
/* Filetypes as defined by USTAR. */
79
TF_UNKNOWN, /* Needs to be treated as regular file. */
80
TF_NOTSUP /* Not supported (used with --create). */
84
/* The internal represenation of a TAR header. */
86
typedef struct tar_header_s *tar_header_t;
89
tar_header_t next; /* Used to build a linked list iof entries. */
91
unsigned long mode; /* The file mode. */
92
unsigned long nlink; /* Number of hard links. */
93
unsigned long uid; /* The user id of the file. */
94
unsigned long gid; /* The group id of the file. */
95
unsigned long long size; /* The size of the file. */
96
unsigned long long mtime; /* Modification time since Epoch. Note
97
that we don't use time_t here but a
98
type which is more likely to be larger
99
that 32 bit and thus allows to track
100
times beyond 2106. */
101
typeflag_t typeflag; /* The type of the file. */
104
unsigned long long nrecords; /* Number of data records. */
106
char name[1]; /* Filename (dynamically extended). */
111
gpg_error_t read_record (estream_t stream, void *record);
112
gpg_error_t write_record (estream_t stream, const void *record);
114
int gnupg_mkdir (const char *name, const char *modestr);
115
#ifdef HAVE_W32_SYSTEM
116
char *wchar_to_utf8 (const wchar_t *string);
117
wchar_t *utf8_to_wchar (const char *string);
120
/*-- gpgtar-create.c --*/
121
void gpgtar_create (char **inpattern);
123
/*-- gpgtar-extract.c --*/
124
void gpgtar_extract (const char *filename);
126
/*-- gpgtar-list.c --*/
127
void gpgtar_list (const char *filename);
128
tar_header_t gpgtar_read_header (estream_t stream);
129
void gpgtar_print_header (tar_header_t header, estream_t out);