cscvs to tla changeset 138
[onak.git] / merge.h
1 /*
2  * merge.h - Routines to merge OpenPGP public keys.
3  *
4  * Jonathan McDowell <noodles@earth.li>
5  *
6  * Copyright 2002 Project Purple
7  *
8  * $Id: merge.h,v 1.6 2004/05/31 14:16:49 noodles Exp $
9  */
10
11 #ifndef __MERGE_H__
12
13 #include "keystructs.h"
14
15 /**
16  *      merge_keys - Takes 2 public keys and merges them.
17  *      @a: The old key. The merged key is returned in this structure.
18  *      @b: The new key. The changed from old to new keys are returned in this
19  *              structure.
20  *
21  *      This function takes 2 keys and merges them. It then returns the merged
22  *      key in a and the difference between this new key and the original a
23  *      in b (ie newb contains the minimum amount of detail necessary to
24  *      convert olda to newa). The intention is that olda is provided from
25  *      internal storage and oldb from the remote user. newa is then stored in
26  *      internal storage and newb is sent to all our keysync peers.
27  */
28 int merge_keys(struct openpgp_publickey *a, struct openpgp_publickey *b);
29
30 /**
31  *      update_keys - Takes a list of public keys and updates them in the DB.
32  *      @keys: The keys to update in the DB.
33  *
34  *      Takes a list of keys and adds them to the database, merging them with
35  *      the key in the database if it's already present there. The key list is
36  *      update to contain the minimum set of updates required to get from what
37  *      we had before to what we have now (ie the set of data that was added to
38  *      the DB). Returns the number of entirely new keys added.
39  */
40 int update_keys(struct openpgp_publickey **keys);
41
42 /**
43  *      get_signed_packet - Gets a signed packet from a list.
44  *      @packet_list: The list of packets to look in.
45  *      @packet: The packet to look for.
46  *
47  *      Walks through the signedpacket_list looking for the supplied packet and
48  *      returns it if found. Otherwise returns NULL.
49  */
50 struct openpgp_signedpacket_list *find_signed_packet(
51                 struct openpgp_signedpacket_list *packet_list,
52                 struct openpgp_packet *packet);
53
54 /**
55  *      merge_packet_sigs - Takes 2 signed packets and merges their sigs.
56  *      @old: The old signed packet.
57  *      @new: The new signed packet.
58  *
59  *      Takes 2 signed packet list structures and the sigs of the packets on
60  *      the head of these structures. These packets must both be the same and
61  *      the fully merged structure is returned in old and the minimal
62  *      difference to get from old to new in new.
63  */
64 int merge_packet_sigs(struct openpgp_signedpacket_list *old,
65                         struct openpgp_signedpacket_list *new);
66
67 #endif