aboutsummaryrefslogtreecommitdiffstats
path: root/common/membuf.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2003-06-05 07:14:21 +0000
committerWerner Koch <[email protected]>2003-06-05 07:14:21 +0000
commitbd820bad4faf5a2c644a3a087f477429c4d2e451 (patch)
tree6930e204fa47048dbe7c9d09440cf38c47d5b405 /common/membuf.h
parent* options.skel: Use new hkp://subkeys.pgp.net as sample keyserver since (diff)
downloadgnupg-bd820bad4faf5a2c644a3a087f477429c4d2e451.tar.gz
gnupg-bd820bad4faf5a2c644a3a087f477429c4d2e451.zip
A small step for GnuPG but a huge leap for error codes.
(Sorry, it does not build currently - I need to check it in to avoid duplicate work.)
Diffstat (limited to '')
-rw-r--r--common/membuf.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/common/membuf.h b/common/membuf.h
new file mode 100644
index 000000000..c199363cc
--- /dev/null
+++ b/common/membuf.h
@@ -0,0 +1,41 @@
+/* membuf.h - A simple implementation of a dynamic buffer
+ * Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifndef GNUPG_COMMON_MEMBUF_H
+#define GNUPG_COMMON_MEMBUF_H
+
+/* The definition of the structure is private, we only need it here,
+ so it can be allocated on the stack. */
+struct private_membuf_s {
+ size_t len;
+ size_t size;
+ char *buf;
+ int out_of_core;
+};
+
+typedef struct private_membuf_s membuf_t;
+
+
+void init_membuf (membuf_t *mb, int initiallen);
+void put_membuf (membuf_t *mb, const void *buf, size_t len);
+void *get_membuf (membuf_t *mb, size_t *len);
+
+
+#endif /*GNUPG_COMMON_MEMBUF_H*/