0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 04:02:15 +02:00
Commit Graph

17 Commits

Author SHA1 Message Date
Charlie Vigue
ef8da98bd4 Buffer: Prepare to decouple allocated buffer / RC
Rename BufferAllocated --> BufferAllocatedRc

Buffer: split RC from BufferAllocated
Also make changes as needed where BufferAllocated is used

Buffer: Split allocation flags into own struct
Leaving flags in template causes each alias to have identical flags
by different names, which requires each type to pointlessly use
the nested name.

Make RC: Clean up headers buffer.hpp, make_rc.hpp

Signed-off-by: Charlie Vigue <charlie.vigue@openvpn.com>
2024-09-11 13:23:28 +00:00
Leonard Ossa
3646265d15 Refactor nested namespace to C++17 style
Signed-off-by: Leonard Ossa <leonard.ossa@openvpn.com>
2024-07-03 10:20:11 +00:00
Mark Deric
22af472e8a
Improve names
-- disambiguate new_obj(): new_man_obj(), new_tun_obj
-- remove obfuscatory typedef <class> Base; use <class>
-- in servproto.hpp typedef ProtoContext::ProtoConfig to ProtoConfig
   since Arne's already disambiguated Config
-- disambiguate Link<>: TCPLink<>, UDPLink<>

Added TODO comment on unneeded version of control_net_recv()

Signed-off-by: Mark Deric <jmark@openvpn.net>
2023-10-11 18:49:23 +02:00
Frank Lichtenheld
0ba4910509
Address warning C4101 (unreferenced local variable)
Usually caused by the only use being in macros that do not
necessarily expand to code depending on the preprocessor
flags.

While here, convert existing work-arounds to [[maybe_unused]]
as well.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
2023-09-28 11:33:35 +02:00
James Yonan
36f8122389 PacketStream: templatize stream segment length word
PacketStream was originally used in the OpenVPN protocol
to segment a TCP stream into packets.  Then we realized
it could perform the same function for the DNS protocol.
Now there are other protocols of interest (such as the
Vici protocol in Strongswan) that also use stream
segmentation, but use a different word size for the
stream length as represented on the wire protocol.
OpenVPN and DNS use a 16 bit word size, while Vici uses
a 32 bit word size.  Both use network-endian encoding
of the word size.

So this patch makes the stream length word size a
template parameter.

Signed-off-by: James Yonan <james@openvpn.net>
2023-09-17 10:08:36 -06:00
Charlie Vigue
b6b8282d33 Addressed 2nd set of -Wconversion warnings
- Used static_cast instead of direct type conversions in places where
it's safe
- Used numeric_cast where failure is possible
- Changed types of arguments and locals when practical

Signed-off-by: Charlie Vigue <charlie.vigue@openvpn.com>
2023-08-21 13:51:50 +00:00
David Sommerseth
dde1574596
Reformatting source code to new coding style
This is the result after running 'clang-format -i' on all C++ files and
headers, with the defined formatting rules in .clang-format.

Only the openvpn/common/unicode-impl.hpp has been excluded, as that is
mostly a copy of an external project.

Signed-off-by: David Sommerseth <davids@openvpn.net>
2023-01-18 19:24:15 +01:00
David Sommerseth
8c94a8f774
copyright: Update to 2022
Signed-off-by: David Sommerseth <davids@openvpn.net>
2022-09-29 12:00:26 +02:00
James Yonan
95b277ca58 TCPTransport::LinkCommon: updated initialization of halt to use C++11 member initializer
Signed-off-by: James Yonan <james@openvpn.net>
2021-05-31 13:34:44 -06:00
James Yonan
38ed30d4ad TCPTransport::LinkCommon: updated comment to reflect the fact that non-raw mode can be used for DNS as well as OpenVPN protocol over TCP
Signed-off-by: James Yonan <james@openvpn.net>
2021-05-31 13:34:44 -06:00
Arne Schwabe
35d01b8a71 Fix indentation and unused variables related warnings from Clang 10
Signed-off-by: Arne Schwabe <arne@openvpn.net>
2020-04-29 11:55:38 +02:00
David Sommerseth
3fbe0a2701
Update copyrights
Signed-off-by: David Sommerseth <davids@openvpn.net>
2020-03-18 19:37:32 +01:00
James Yonan
1b3402aec3 tcplinkcommon.hpp: added missing include
Signed-off-by: James Yonan <james@openvpn.net>
2019-09-06 22:24:57 -06:00
Antonio Quartulli
1d6bae4b5b
tcplinkcommon: bubble up real exception error
In case of error along the TCP RX path it is better to grab the error
coming with the exception and report it back up.

For this reason, catch ExceptionCode objects rather than std::exception
as the former carries the error code together with the text message.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2019-06-25 11:47:35 +02:00
Lev Stipakov
ccc17a5631 [OVPN3-211] bigmutex: introduce macro to ensure thread-safety
Platforms like UWP and iOS may call core methods
from another threads. Since core is not thread-safe,
we provide OPENVPN_ASYNC_HANDLER macro which instantiates
lock guard. It follows RAII principle and locks global
mutex in constructor and unlocks in destructor. This
guarantees that code in block protected with this macro
won't be called simultaneously from different threads.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2018-06-07 21:17:42 +03:00
Antonio Quartulli
e0e76bb283
[OVPN3-169] tcplink: introduce LinkBase abstract class
This class is an "interface" for TCP Links. It can be used by Transport
layers instead of the actual concrete Link class.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2018-04-19 17:38:18 +08:00
Antonio Quartulli
a71014d407
[OVPN3-169] tcplink: create LinkCommon class and inherit from it
To allow other types of TCP Link to be implemented,
factor out code that can be re-used by other implementations
and move it to the LinkCommon class.

TCPTransport::Link now inherits from LinkCommon.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2018-04-19 17:31:51 +08:00