summaryrefslogtreecommitdiffstats
path: root/src/openvpn/comp.h
diff options
context:
space:
mode:
authorGert Doering <gert@greenie.muc.de>2014-01-01 22:57:58 +0100
committerGert Doering <gert@greenie.muc.de>2014-01-06 12:18:53 +0100
commit40efb6359aff0e4805c0439acd6e899c687ef058 (patch)
treeff119c7a017fa18f939f76e0f2577ef9a94f8d1d /src/openvpn/comp.h
parent56ab21091c0f1e07d0a6ef7815160f6ae072498d (diff)
downloadopenvpn-40efb6359aff0e4805c0439acd6e899c687ef058.tar.gz
openvpn-40efb6359aff0e4805c0439acd6e899c687ef058.tar.xz
openvpn-40efb6359aff0e4805c0439acd6e899c687ef058.zip
Implement LZ4 compression.
Implement LZ4 compression, similar to the existing snappy / push-peer-info model: a LZ4 capable client will send IV_LZ4=1 to the server, and the algorithm is selected by pushing "compress lz4" back. LZ4 does not compress as well as LZO or Snappy, but needs far less CPU and is much faster, thus better suited for mobile devices. See https://code.google.com/p/lz4/ for more details. LZ4 include and library path can be specified by specifying LZ4_LIBS=... and LZ4_CFLAGS=... on the configure command line. Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: Arne Schwabe <arne@rfc2549.org> Message-Id: <1388613479-22377-1-git-send-email-gert@greenie.muc.de> URL: http://article.gmane.org/gmane.network.openvpn.devel/8153
Diffstat (limited to 'src/openvpn/comp.h')
-rw-r--r--src/openvpn/comp.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/openvpn/comp.h b/src/openvpn/comp.h
index 0d2f1bc..bfa25fd 100644
--- a/src/openvpn/comp.h
+++ b/src/openvpn/comp.h
@@ -24,7 +24,7 @@
/*
* Generic compression support. Currently we support
- * Snappy and LZO 2.
+ * Snappy, LZO 2 and LZ4.
*/
#ifndef OPENVPN_COMP_H
#define OPENVPN_COMP_H
@@ -41,6 +41,7 @@
#define COMP_ALG_STUB 1 /* support compression command byte and framing without actual compression */
#define COMP_ALG_LZO 2 /* LZO algorithm */
#define COMP_ALG_SNAPPY 3 /* Snappy algorithm */
+#define COMP_ALG_LZ4 4 /* LZ4 algorithm */
/* Compression flags */
#define COMP_F_ADAPTIVE (1<<0) /* COMP_ALG_LZO only */
@@ -64,6 +65,7 @@
*
* LZO: len + len/8 + 128 + 3
* Snappy: len + len/6 + 32
+ * LZ4: len + len/255 + 16 (LZ4_COMPRESSBOUND(len))
*/
#define COMP_EXTRA_BUFFER(len) ((len)/6 + 128 + 3 + COMP_PREFIX_LEN)
@@ -103,6 +105,10 @@ struct compress_alg
#include "snappy.h"
#endif
+#ifdef ENABLE_LZ4
+#include "comp-lz4.h"
+#endif
+
/*
* Information that basically identifies a compression
* algorithm and related flags.
@@ -124,6 +130,9 @@ union compress_workspace_union
#ifdef ENABLE_SNAPPY
struct snappy_workspace snappy;
#endif
+#ifdef ENABLE_LZ4
+ struct lz4_workspace lz4;
+#endif
};
/*