OpenVPN
comp.h File Reference
#include "error.h"
Include dependency graph for comp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  compress_options

Macros

#define COMP_F_SWAP   (1u << 2)
 initial command byte is swapped with last byte in buffer to preserve payload alignment
#define COMP_F_ADVERTISE_STUBS_ONLY   (1u << 3)
 tell server that we only support compression stubs
#define COMP_F_ALLOW_STUB_ONLY   (1u << 4)
 Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY we still accept other compressions to be pushed.
#define COMP_F_MIGRATE   (1u << 5)
 push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ
#define COMP_F_ALLOW_ASYM   (1u << 6)
 Compression was explicitly set to allow asymetric compression.
#define COMP_F_ALLOW_NOCOMP_ONLY   (1u << 7)
 Do not allow compression framing (breaks DCO).
#define COMP_ALG_UNDEF   0
#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 (no longer supported).
#define COMP_ALG_LZ4   4
 LZ4 algorithm.
#define COMP_ALGV2_UNCOMPRESSED   10
#define COMP_ALGV2_LZ4   11

Functions

static bool comp_non_stub_enabled (const struct compress_options *info)
bool check_compression_settings_valid (const struct compress_options *info, msglvl_t msglevel)
 Checks if the compression settings are valid.

Macro Definition Documentation

◆ COMP_ALG_LZ4

#define COMP_ALG_LZ4   4

LZ4 algorithm.

Definition at line 59 of file comp.h.

Referenced by add_option(), check_compression_settings_valid(), and frame_calculate_payload_overhead().

◆ COMP_ALG_LZO

#define COMP_ALG_LZO   2

◆ COMP_ALG_SNAPPY

#define COMP_ALG_SNAPPY   3

Snappy algorithm (no longer supported).

Definition at line 58 of file comp.h.

◆ COMP_ALG_STUB

#define COMP_ALG_STUB   1

support compression command byte and framing without actual compression

Definition at line 56 of file comp.h.

Referenced by add_option(), comp_non_stub_enabled(), frame_calculate_payload_overhead(), and multi_client_connect_compress_migrate().

◆ COMP_ALG_UNDEF

◆ COMP_ALGV2_LZ4

#define COMP_ALGV2_LZ4   11

Definition at line 64 of file comp.h.

Referenced by add_option(), and check_compression_settings_valid().

◆ COMP_ALGV2_UNCOMPRESSED

#define COMP_ALGV2_UNCOMPRESSED   10

Definition at line 63 of file comp.h.

Referenced by add_option(), check_compression_settings_valid(), and comp_non_stub_enabled().

◆ COMP_F_ADVERTISE_STUBS_ONLY

#define COMP_F_ADVERTISE_STUBS_ONLY   (1u << 3)

tell server that we only support compression stubs

Definition at line 42 of file comp.h.

Referenced by add_option(), and options_set_backwards_compatible_options().

◆ COMP_F_ALLOW_ASYM

#define COMP_F_ALLOW_ASYM   (1u << 6)

Compression was explicitly set to allow asymetric compression.

Definition at line 49 of file comp.h.

Referenced by add_option().

◆ COMP_F_ALLOW_NOCOMP_ONLY

#define COMP_F_ALLOW_NOCOMP_ONLY   (1u << 7)

Do not allow compression framing (breaks DCO).

Definition at line 51 of file comp.h.

Referenced by check_compression_settings_valid(), options_postprocess_mutate(), and options_set_backwards_compatible_options().

◆ COMP_F_ALLOW_STUB_ONLY

#define COMP_F_ALLOW_STUB_ONLY   (1u << 4)

Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY we still accept other compressions to be pushed.

Definition at line 45 of file comp.h.

Referenced by add_option(), check_compression_settings_valid(), and options_set_backwards_compatible_options().

◆ COMP_F_MIGRATE

#define COMP_F_MIGRATE   (1u << 5)

push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ

Definition at line 47 of file comp.h.

Referenced by add_option(), key_method_2_read(), key_method_2_write(), and multi_client_connect_compress_migrate().

◆ COMP_F_SWAP

#define COMP_F_SWAP   (1u << 2)

initial command byte is swapped with last byte in buffer to preserve payload alignment

Definition at line 40 of file comp.h.

Referenced by add_option().

Function Documentation

◆ check_compression_settings_valid()

bool check_compression_settings_valid ( const struct compress_options * info,
msglvl_t msglevel )

Checks if the compression settings are valid.

Takes into account the flags of allow-compression and also the whether algorithms are compiled in

Definition at line 162 of file comp.c.

References compress_options::alg, COMP_ALG_LZ4, COMP_ALG_LZO, COMP_ALG_UNDEF, COMP_ALGV2_LZ4, COMP_ALGV2_UNCOMPRESSED, COMP_F_ALLOW_NOCOMP_ONLY, COMP_F_ALLOW_STUB_ONLY, comp_non_stub_enabled(), compress_options::flags, and msg.

Referenced by do_deferred_options(), multi_connection_established(), and options_postprocess_mutate().

◆ comp_non_stub_enabled()

bool comp_non_stub_enabled ( const struct compress_options * info)
inlinestatic