cscvs to tla changeset 86
[onak.git] / keystructs.h
1 /*
2  * keystructs.h - Structures for OpenPGP keys
3  *
4  * Jonathan McDowell <noodles@earth.li>
5  *
6  * Copyright 2002 Project Purple
7  *
8  * $Id: keystructs.h,v 1.7 2003/06/08 21:11:01 noodles Exp $
9  */
10
11 #ifndef __KEYSTRUCTS_H__
12 #define __KEYSTRUCTS_H__
13
14 #include <inttypes.h>
15 #include <stdbool.h>
16 #include <stdlib.h>
17
18 #include "ll.h"
19
20 /**
21  *      struct openpgp_packet - Stores an OpenPGP packet.
22  *      @tag: The packet tag (ie type).
23  *      @newformat: Indicates if this is a new format packet.
24  *      @length: The length of the packet.
25  *      @data: The actual packet
26  *
27  *      This structure holds any form of OpenPGP packet with minimum common
28  *      details decoded out.
29  */
30 struct openpgp_packet {
31         unsigned int tag;
32         bool newformat;
33         size_t length;
34         unsigned char *data;
35 };
36
37 /**
38  *      struct openpgp_packet_list - A linked list of OpenPGP packets.
39  *      @packet: The actual packet structure.
40  *      @next: A pointer to the next packet in the list.
41  *
42  *      This structure is used to hold a linked list of packets, for example
43  *      all the signatures of a public key's UID.
44  */
45 struct openpgp_packet_list {
46         struct openpgp_packet *packet;
47         struct openpgp_packet_list *next;
48 };
49
50 /**
51  *      struct openpgp_signedpacket_list - A packet with signatures.
52  *      @uid: The OpenPGP packet that's signed.
53  *      @sigs: A list of sigs for the packet.
54  *      @next: A pointer to the next packet with signatures.
55  *
56  *      This structure holds an OpenPGP packet along with signatures that are
57  *      over this packet. It also links to the next signed packet. It's usually
58  *      used to hold a UID or subkey with their associated signatures.
59  */
60 struct openpgp_signedpacket_list {
61         struct openpgp_packet *packet;
62         struct openpgp_packet_list *sigs;
63         struct openpgp_packet_list *last_sig;
64         struct openpgp_signedpacket_list *next;
65 };
66
67 /**
68  *      struct openpgp_publickey - An OpenPGP public key complete with sigs.
69  *      @publickey: The OpenPGP packet for the public key.
70  *      @revocation: The OpenPGP packet for the revocation [optional]
71  *      @uids: The list of UIDs with signatures for this key.
72  *      @subkeys: The list of subkeys with signatures for this key.
73  *      @next: The next public key.
74  */
75 struct openpgp_publickey {
76         struct openpgp_packet                   *publickey;
77         struct openpgp_packet_list              *revocations;
78         struct openpgp_packet_list              *last_revocation;
79         struct openpgp_signedpacket_list        *uids;
80         struct openpgp_signedpacket_list        *last_uid;
81         struct openpgp_signedpacket_list        *subkeys;
82         struct openpgp_signedpacket_list        *last_subkey;
83         struct openpgp_publickey                *next;
84 };
85
86 /**
87  *      struct stats_key - holds key details suitable for doing stats on.
88  *      @keyid: The keyid.
89  *      @colour: Used for marking during DFS/BFS.
90  *      @parent: The key that lead us to this one for DFS/BFS.
91  *      @sigs: A linked list of the signatures on this key.
92  *      @gotsigs: A bool indicating if we've initialized the sigs element yet.
93  *      @disabled: If we shouldn't consider the key in calculations.
94  *      @revoked: If the key is revoked (and shouldn't be considered).
95  */
96 struct stats_key {
97         uint64_t keyid;
98         int colour;
99         uint64_t parent;
100         struct ll *sigs;
101         struct ll *signs;
102         bool gotsigs;
103         bool disabled;
104         bool revoked;
105 };
106
107 #endif /* __KEYSTRUCTS_H__ */