~ubuntu-branches/ubuntu/quantal/gnupg2/quantal-updates

« back to all changes in this revision

Viewing changes to tools/gpgtar.h

  • Committer: Bazaar Package Importer
  • Author(s): Marc Deslauriers
  • Date: 2011-05-25 14:27:35 UTC
  • mfrom: (1.1.15 upstream) (7.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110525142735-jccyw0fopnyv728q
Tags: 2.0.17-2ubuntu1
* Merge from debian unstable. Remaining changes:
  - Add udev rules to give gpg access to some smartcard readers;
    Debian #543217.
    . debian/gnupg2.dev: udev rules to set ACLs on SCM smartcard readers.
    . debian/rules: Call dh_installudev.
  - debian/control: Rename Vcs-* to XS-Debian-Vcs-*.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* gpgtar.h - Global definitions for gpgtar
 
2
 * Copyright (C) 2010 Free Software Foundation, Inc.
 
3
 *
 
4
 * This file is part of GnuPG.
 
5
 *
 
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.
 
10
 *
 
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.
 
15
 *
 
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/>.
 
18
 */
 
19
 
 
20
#ifndef GPGTAR_H
 
21
#define GPGTAR_H
 
22
 
 
23
#include "../common/util.h"
 
24
#include "../common/estream.h"
 
25
 
 
26
/* We keep all global options in the structure OPT.  */
 
27
struct
 
28
{
 
29
  int verbose;
 
30
  int quiet;
 
31
  const char *outfile;
 
32
  int symmetric;
 
33
  const char *filename;
 
34
} opt;
 
35
 
 
36
 
 
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
 
41
   useless.  */
 
42
#define RECORDSIZE 512 
 
43
 
 
44
 
 
45
/* Description of the USTAR header format.  */
 
46
struct ustar_raw_header
 
47
{
 
48
  char name[100];
 
49
  char mode[8];
 
50
  char uid[8];
 
51
  char gid[8];
 
52
  char size[12];
 
53
  char mtime[12];
 
54
  char checksum[8];
 
55
  char typeflag[1];
 
56
  char linkname[100];
 
57
  char magic[6];
 
58
  char version[2];
 
59
  char uname[32];
 
60
  char gname[32];   
 
61
  char devmajor[8]; 
 
62
  char devminor[8];
 
63
  char prefix[155]; 
 
64
  char pad[12];
 
65
};
 
66
 
 
67
 
 
68
/* Filetypes as defined by USTAR.  */
 
69
typedef enum 
 
70
  {
 
71
    TF_REGULAR,
 
72
    TF_HARDLINK,
 
73
    TF_SYMLINK,
 
74
    TF_CHARDEV,
 
75
    TF_BLOCKDEV,
 
76
    TF_DIRECTORY,
 
77
    TF_FIFO,
 
78
    TF_RESERVED,
 
79
    TF_UNKNOWN,    /* Needs to be treated as regular file.  */
 
80
    TF_NOTSUP      /* Not supported (used with --create).  */
 
81
  } typeflag_t;
 
82
 
 
83
 
 
84
/* The internal represenation of a TAR header.  */
 
85
struct tar_header_s;
 
86
typedef struct tar_header_s *tar_header_t;
 
87
struct tar_header_s
 
88
{
 
89
  tar_header_t next;        /* Used to build a linked list iof entries.  */
 
90
 
 
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.  */
 
102
  
 
103
 
 
104
  unsigned long long nrecords; /* Number of data records.  */
 
105
 
 
106
  char name[1];             /* Filename (dynamically extended).  */
 
107
};
 
108
 
 
109
 
 
110
/*-- gpgtar.c --*/
 
111
gpg_error_t read_record (estream_t stream, void *record);
 
112
gpg_error_t write_record (estream_t stream, const void *record);
 
113
 
 
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);
 
118
#endif
 
119
 
 
120
/*-- gpgtar-create.c --*/
 
121
void gpgtar_create (char **inpattern);
 
122
 
 
123
/*-- gpgtar-extract.c --*/
 
124
void gpgtar_extract (const char *filename);
 
125
 
 
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);
 
130
 
 
131
 
 
132
#endif /*GPGTAR_H*/