OpenVPN
lzo.h
Go to the documentation of this file.
1/*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
7 *
8 * Copyright (C) 2002-2025 OpenVPN Inc <sales@openvpn.net>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef OPENVPN_LZO_H
24#define OPENVPN_LZO_H
25
26
33#if defined(ENABLE_LZO)
34
39#if defined(HAVE_LZO_LZO1X_H)
40#include <lzo/lzo1x.h>
41#elif defined(HAVE_LZO1X_H)
42/* The lzo.h magic gets confused and still wants
43 * to include lzo/lzoconf.h even if our include paths
44 * are setup to include the paths without lzo/
45 */
46#include <lzodefs.h>
47#include <lzoconf.h>
48#include <lzo1x.h>
49#endif
50
51#include "buffer.h"
52#include "mtu.h"
53#include "common.h"
54#include "status.h"
55
56extern const struct compress_alg lzo_alg;
57
58/**************************************************************************/
/***********************/
60#define LZO_COMPRESS lzo1x_1_15_compress
67#define LZO_WORKSPACE LZO1X_1_15_MEM_COMPRESS
71#define LZO_DECOMPRESS lzo1x_decompress_safe
/**************************************/
82
83
84/**************************************************************************/
/************************/
86#define AC_SAMP_SEC 2
87#define AC_MIN_BYTES \
88 1000
91#define AC_SAVE_PCT \
92 5
95#define AC_OFF_SEC \
96 60
/*******************************/
99
103struct lzo_adaptive_compress
104{
105 bool compress_state;
106 time_t next;
107 int n_total;
108 int n_comp;
109};
110
111
122struct lzo_compress_workspace
123{
124 lzo_voidp wmem;
125 int wmem_size;
126 struct lzo_adaptive_compress ac;
127};
128
132#endif /* ENABLE_LZO && USE_COMP */
133#endif /* ifndef OPENVPN_LZO_H */