aboutsummaryrefslogtreecommitdiff
path: root/src/lib/compress/compress_lzma.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-21 11:51:49 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-21 13:08:25 -0400
commit2d20cbf837263898ce45c1e0a0f11b9e1126eeba (patch)
tree3af09a830bb62117ec3ddc9d2ea907f861d289ff /src/lib/compress/compress_lzma.h
parentad7776f66d3e914a0842c20f31162c0e11befa34 (diff)
downloadtor-2d20cbf837263898ce45c1e0a0f11b9e1126eeba.tar.gz
tor-2d20cbf837263898ce45c1e0a0f11b9e1126eeba.zip
Extract compression functions into a new library.
Diffstat (limited to 'src/lib/compress/compress_lzma.h')
-rw-r--r--src/lib/compress/compress_lzma.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/lib/compress/compress_lzma.h b/src/lib/compress/compress_lzma.h
new file mode 100644
index 0000000000..9ef3382a25
--- /dev/null
+++ b/src/lib/compress/compress_lzma.h
@@ -0,0 +1,46 @@
+/* Copyright (c) 2003, Roger Dingledine
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file compress_lzma.h
+ * \brief Header for compress_lzma.c
+ **/
+
+#ifndef TOR_COMPRESS_LZMA_H
+#define TOR_COMPRESS_LZMA_H
+
+int tor_lzma_method_supported(void);
+
+const char *tor_lzma_get_version_str(void);
+
+const char *tor_lzma_get_header_version_str(void);
+
+/** Internal state for an incremental LZMA compression/decompression. */
+typedef struct tor_lzma_compress_state_t tor_lzma_compress_state_t;
+
+tor_lzma_compress_state_t *
+tor_lzma_compress_new(int compress,
+ compress_method_t method,
+ compression_level_t compression_level);
+
+tor_compress_output_t
+tor_lzma_compress_process(tor_lzma_compress_state_t *state,
+ char **out, size_t *out_len,
+ const char **in, size_t *in_len,
+ int finish);
+
+void tor_lzma_compress_free_(tor_lzma_compress_state_t *state);
+#define tor_lzma_compress_free(st) \
+ FREE_AND_NULL(tor_lzma_compress_state_t, \
+ tor_lzma_compress_free_, (st))
+
+size_t tor_lzma_compress_state_size(const tor_lzma_compress_state_t *state);
+
+size_t tor_lzma_get_total_allocation(void);
+
+void tor_lzma_init(void);
+
+#endif /* !defined(TOR_COMPRESS_LZMA_H) */
+