OpenVPN 3 Core Library
Loading...
Searching...
No Matches
bufclamp.hpp
Go to the documentation of this file.
1
// OpenVPN -- An application to securely tunnel IP networks
2
// over a single port, with support for SSL/TLS-based
3
// session authentication and key exchange,
4
// packet encryption, packet authentication, and
5
// packet compression.
6
//
7
// Copyright (C) 2012- OpenVPN Inc.
8
//
9
// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception
10
//
11
12
// For debugging, reduce effective buffer size for I/O.
13
// Enable by defining OPENVPN_BUF_CLAMP_READ and/or OPENVPN_BUF_CLAMP_WRITE
14
15
#ifndef OPENVPN_BUFFER_BUFCLAMP_H
16
#define OPENVPN_BUFFER_BUFCLAMP_H
17
18
#include <algorithm>
19
20
#include <
openvpn/common/size.hpp
>
21
22
namespace
openvpn
{
23
inline
size_t
buf_clamp_read
(
const
size_t
size)
24
{
25
#ifdef OPENVPN_BUF_CLAMP_READ
26
return
std::min(size,
size_t
(OPENVPN_BUF_CLAMP_READ));
27
#else
28
return
size;
29
#endif
30
}
31
32
inline
size_t
buf_clamp_write
(
const
size_t
size)
33
{
34
#ifdef OPENVPN_BUF_CLAMP_WRITE
35
return
std::min(size,
size_t
(OPENVPN_BUF_CLAMP_WRITE));
36
#else
37
return
size;
38
#endif
39
}
40
}
// namespace openvpn
41
42
#endif
openvpn
Support deferred server-side state creation when client connects.
Definition
ovpncli.cpp:95
openvpn::buf_clamp_read
size_t buf_clamp_read(const size_t size)
Definition
bufclamp.hpp:23
openvpn::buf_clamp_write
size_t buf_clamp_write(const size_t size)
Definition
bufclamp.hpp:32
size.hpp
openvpn
buffer
bufclamp.hpp
Generated by
1.9.8