Xoxa-c
0.3.1
Normalizer/Parser for XML
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Pages
pgp_types.h
1
#ifndef PGP_TYPES_H_READ
2
#define PGP_TYPES_H_READ 1
3
4
#include <sys/select.h>
5
6
#include "util_types.h"
7
8
// This header contains types which are used in pgp.h, and which are
9
// also used in xml_expat.h, which pgp.h includes. Separate them out
10
// here to avoid an import loop.
11
12
#if XOXA_PRIVATE_INTERFACE
13
// A channel for communicating with the subprocess. Note that the
14
// Channel is a read or write channel _from the point of view of the
15
// parent process_ rather than the child.
16
//
17
// Creating a writing channel (non-zero argument to new_channel)
18
// creates a Buf within the channel; creating a reading channel does
19
// not, and one must be added to the channel subsequently.
20
typedef
struct
{
21
int
fd[2];
// fd[0]=read end; fd[1]=write end
22
Buf* buf;
// the content to be written, or into which the pipe will be read
23
ssize_t nwritten;
// negative if this channel is to be read from
24
} Channel;
25
#define CHANNEL_FOR_WRITING_P(ch) ((ch)->nwritten >= 0)
26
// Retrieve the FD associated with this Channel; this will be open for
27
// reading (respectively writing) if the Channel is a read (write) one.
28
#define CHANNEL_GET_FD(ch) (CHANNEL_FOR_WRITING_P(ch) ? (ch)->fd[1] : (ch)->fd[0])
29
// Get the _other_ FD, which is the FD associated with the other
30
// end of the Channel's pipe, in the child.
31
#define CHANNEL_GET_CHILD_FD(ch) (CHANNEL_FOR_WRITING_P(ch) ? (ch)->fd[0] : (ch)->fd[1])
32
33
typedef
struct
process_manager_s {
34
int
in;
// the write end of a pipe, which goes to the subprocess stdin
35
char
nchan;
// the number of extra channels (including the subprocess stdout/stderr)
36
Channel** ch;
// the other channels
37
pid_t child;
// the PID of the subprocess
38
fd_set readable;
// a mask of the readable channels
39
} ProcessManager;
40
#endif
/* XOXA_PRIVATE_INTERFACE */
41
43
typedef
enum
{ good_sig, bad_sig, unknown }
GPGResult
;
44
51
typedef
struct
gpg_result_s
{
53
GPGResult
status
;
55
union
{
57
struct
{
59
char
*
keyid
;
61
char
*
username
;
62
} goodsig;
64
struct
{
66
char
*
keyid
;
68
char
*
username
;
69
} badsig;
70
} detail;
72
const
char
*
stderr
;
// content of GPG stderr, or NULL if unavailable
73
}
SignatureDetail
;
74
75
76
#endif
/* PGP_TYPES_H_READ */
Generated on Sun May 17 2015 19:45:42 for Xoxa-c by
1.8.2