Update Debian Vcs-* fields to point to git repository
[onak.git] / parsekey.h
index 682629c9fc8e0e8e3c70f326e47624d11d66bcd3..bc208d2a66cd912c8ee5485ea2821566617f2d30 100644 (file)
@@ -1,29 +1,27 @@
 /*
  * parsekey.h - Routines to parse an OpenPGP key.
  *
- * Jonathan McDowell <noodles@earth.li>
+ * Copyright 2002-2004,2007-2008,2011 Jonathan McDowell <noodles@earth.li>
  *
- * Copyright 2002 Project Purple
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; version 2 of the License.
  *
- * $Id: parsekey.h,v 1.4 2003/06/04 20:57:12 noodles Exp $
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #ifndef __PARSEKEY_H__
 #define __PARSEKEY_H__
 
 #include "keystructs.h"
-
-/**
- *     add_key - Takes a key and adds it to the keyserver.
- *     @key: The public key to add.
- *
- *     This function takes a public key and adds it to the keyserver.
- *     It first of all sees if we already have the key locally. If we do then
- *     we retrieve it and merge the two keys. We then store the resulting key
- *     (or just the original we received if we don't already have it). We then
- *     send out the appropriate updates to our keyserver peers.
- */
-int add_key(struct openpgp_publickey *key);
+#include "onak.h"
 
 /**
  *     parse_keys - Process a stream of packets for public keys + sigs.
@@ -53,15 +51,20 @@ int debug_packet(struct openpgp_packet *packet);
  *     @getchar_func: The function to get the next character from the stream.
  *     @ctx: A pointer to the context structure for getchar_func.
  *     @packets: The outputted list of packets.
+ *     @maxnum: The maximum number of keys to read. 0 means unlimited.
  *
  *     This function uses getchar_func to read characters from an OpenPGP
  *     packet stream and reads the packets into a linked list of packets
- *     ready for parsing as a public key or whatever.
+ *     ready for parsing as a public key or whatever. maxnum allows you to
+ *     specify the maximum number of keys to read. Note that if this is used
+ *     then only the public key component of the last key will be returned,
+ *     none of the other packets of the key will be read.
  */
-int read_openpgp_stream(int (*getchar_func)(void *ctx, size_t count,
-                               unsigned char *c),
+onak_status_t read_openpgp_stream(int (*getchar_func)(void *ctx, size_t count,
+                               void *c),
                                void *ctx,
-                               struct openpgp_packet_list **packets);
+                               struct openpgp_packet_list **packets,
+                               int maxnum);
 
 /**
  *     write_openpgp_stream - Reads a stream of OpenPGP packets.
@@ -72,8 +75,8 @@ int read_openpgp_stream(int (*getchar_func)(void *ctx, size_t count,
  *     This function uses putchar_func to write characters to an OpenPGP
  *     packet stream from a linked list of packets.
  */
-int write_openpgp_stream(int (*putchar_func)(void *ctx, size_t count,
-                                               unsigned char *c),
+onak_status_t write_openpgp_stream(int (*putchar_func)(void *ctx, size_t count,
+                                               void *c),
                                void *ctx,
                                struct openpgp_packet_list *packets);