OpenVPN 3 Core Library
Loading...
Searching...
No Matches
setupbase.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
13// Client tun setup base class for Windows
14
15#ifndef OPENVPN_TUN_WIN_CLIENT_SETUPBASE_H
16#define OPENVPN_TUN_WIN_CLIENT_SETUPBASE_H
17
18#include <windows.h> // for HANDLE
19
20#include <functional>
21
22#include <openvpn/io/io.hpp>
23
27
29
30namespace openvpn::TunWin {
32{
34
35 OPENVPN_EXCEPTION(tun_win_setup);
36
37 virtual HANDLE get_handle(std::ostream &os) = 0;
38
39 // clang-format off
40 virtual HANDLE establish(const TunBuilderCapture &pull,
41 const std::wstring &openvpn_app_path,
42 Stop *stop,
43 std::ostream &os,
44 RingBuffer::Ptr rings) = 0;
45 // clang-format on
46
47 virtual bool l2_ready(const TunBuilderCapture &pull) = 0;
48
49 // clang-format off
50 virtual void l2_finish(const TunBuilderCapture &pull,
51 Stop *stop,
52 std::ostream &os) = 0;
53 // clang-format on
54
55 virtual void confirm()
56 {
57 }
58
59 virtual void set_service_fail_handler(std::function<void()> &&handler)
60 {
61 }
62
64
65 virtual void set_adapter_state(const Util::TapNameGuidPair &state) = 0;
66};
67
68struct SetupFactory : public RC<thread_unsafe_refcount>
69{
71
72 // clang-format off
73 virtual SetupBase::Ptr new_setup_obj(openvpn_io::io_context &io_context,
74 const TunWin::Type tun_type,
75 bool allow_local_dns_resolvers) = 0;
76 // clang-format on
77};
78} // namespace openvpn::TunWin
79
80#endif
The smart pointer class.
Definition rc.hpp:119
Reference count base class for objects tracked by RCPtr. Disallows copying and assignment.
Definition rc.hpp:912
static void handler(int signum)
Definition cli.cpp:961
DNS utilities for Windows.
virtual bool l2_ready(const TunBuilderCapture &pull)=0
virtual void set_adapter_state(const Util::TapNameGuidPair &state)=0
virtual HANDLE establish(const TunBuilderCapture &pull, const std::wstring &openvpn_app_path, Stop *stop, std::ostream &os, RingBuffer::Ptr rings)=0
virtual HANDLE get_handle(std::ostream &os)=0
OPENVPN_EXCEPTION(tun_win_setup)
virtual Util::TapNameGuidPair get_adapter_state()=0
virtual void l2_finish(const TunBuilderCapture &pull, Stop *stop, std::ostream &os)=0
RCPtr< SetupBase > Ptr
Definition setupbase.hpp:33
virtual void set_service_fail_handler(std::function< void()> &&handler)
Definition setupbase.hpp:59
virtual SetupBase::Ptr new_setup_obj(openvpn_io::io_context &io_context, const TunWin::Type tun_type, bool allow_local_dns_resolvers)=0
RCPtr< SetupFactory > Ptr
Definition setupbase.hpp:70