~ubuntu-branches/ubuntu/oneiric/gnupg2/oneiric-updates

« back to all changes in this revision

Viewing changes to include/gpga-prot.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* gpga-prot.h  - GnuPG Agent protocol definition
2
 
 *      Copyright (C) 2000 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 2 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, write to the Free Software
18
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19
 
 */
20
 
 
21
 
/*
22
 
 * The gpg-agent protocol:
23
 
 * The protocol is connection based and runs over a Unix Domain socket.
24
 
 * The client requests a service from the server and waits for the result.
25
 
 * A connection request starts with a magic string to transfer the
26
 
 * version number the followed by the regular traffic.  All numbers
27
 
 * are transfered in network-byte-order, strings are prefixed with a
28
 
 * 32 bit length and NOT 0 terminated.
29
 
 * The magic string is:
30
 
 *  0x47, 0x50, 0x47, 0x41, 0x00, 0x00, 0x00, 0x01
31
 
 * which nicely fits into 2 32 bit words.
32
 
 * The server does not respond to this magic string if the protocol
33
 
   is supported; otherwise it will return an error packet and close
34
 
   the connection.
35
 
   Standard request and reply packets are composed like this
36
 
   u32     Length of following packet ( 4 <= n < 2048 )
37
 
   u32     Request/Reply type or error code
38
 
   n-bytes Data specific to the request/reply
39
 
 
40
 
   Request codes are just the given number,
41
 
   Reply codes are all to be ORed with 0x00010000,
42
 
   Error codes are all to be ORer with 0x00020000.
43
 
 
44
 
   Requests:
45
 
   =========
46
 
   GET_VERSION 
47
 
 
48
 
   GET_PASSPHRASE, expected data:
49
 
       20 Bytes fingerprint of the key 
50
 
                (use all zeroes to get a passphrase not associated with a key)
51
 
        n Bytes with the text to be displayed in case the
52
 
          passphrase is not cached or the fingerprint was all zero.
53
 
 
54
 
   CLEAR_PASSPHRASE, expected data:
55
 
       20 Bytes fingerprint of the key
56
 
 
57
 
       Returns either OKAY or NO_PASSPHRASE
58
 
 
59
 
   HAVE_PASSPHRASE, expected data:
60
 
       20 Bytes fingerprint of the key
61
 
 
62
 
       Returns either OKAY or NO_PASSPHRASE
63
 
 
64
 
 
65
 
   Replies:
66
 
   ========
67
 
   OKAY (reply code 1)
68
 
      Data may be interpreted as the version string
69
 
 
70
 
   GOT_PASSPHRASE (reply code 2)
71
 
       u32     Length of passphrase 
72
 
       n bytes passphrase
73
 
       m bytes padding so that the packets have some standard length
74
 
 
75
 
  
76
 
   Error Replies:
77
 
   ==============
78
 
   PROTOCOL_ERROR 
79
 
       no data yes specified
80
 
 
81
 
   CANCELED  
82
 
       User canceled the input
83
 
 
84
 
   NO_PASSPHRASE 
85
 
       No user intercation possible and passphrase not available.
86
 
       Also return as answer on HAVE_PASSPHRASE etc.
87
 
       
88
 
   BAD_PASSPHRASE 
89
 
       Returned when the user does not repeat the passphrase correctly
90
 
 
91
 
   INVALID_DATA 
92
 
 
93
 
 */
94
 
 
95
 
 
96
 
 
97
 
#ifndef GPG_GPGA_PROT_H
98
 
#define GPG_GPGA_PROT_H 1
99
 
 
100
 
enum gpga_protocol_codes {
101
 
    /* Request codes */
102
 
    GPGA_PROT_GET_VERSION     = 1,
103
 
    GPGA_PROT_GET_PASSPHRASE  = 2,
104
 
    GPGA_PROT_CLEAR_PASSPHRASE= 3,
105
 
    GPGA_PROT_SHUTDOWN        = 4,
106
 
    GPGA_PROT_FLUSH           = 5,
107
 
 
108
 
    /* Reply codes */
109
 
    GPGA_PROT_REPLY_BASE     = 0x10000,
110
 
    GPGA_PROT_OKAY           = 0x10001,
111
 
    GPGA_PROT_GOT_PASSPHRASE = 0x10002,
112
 
 
113
 
    /* Error codes */
114
 
    GPGA_PROT_ERROR_BASE     = 0x20000,
115
 
    GPGA_PROT_PROTOCOL_ERROR = 0x20001,
116
 
    GPGA_PROT_INVALID_REQUEST= 0x20002,
117
 
    GPGA_PROT_CANCELED       = 0x20003,    
118
 
    GPGA_PROT_NO_PASSPHRASE  = 0x20004,    
119
 
    GPGA_PROT_BAD_PASSPHRASE = 0x20005,
120
 
    GPGA_PROT_INVALID_DATA   = 0x20006,
121
 
    GPGA_PROT_NOT_IMPLEMENTED= 0x20007,
122
 
    GPGA_PROT_UI_PROBLEM     = 0x20008,
123
 
};
124
 
 
125
 
 
126
 
 
127
 
#endif /*GPG_GPGA_PROT_H*/