From 44f826cb12db2c525c6ccb1c47d09ec4205321a6 Mon Sep 17 00:00:00 2001 From: Sergey Abramchuk Date: Sat, 15 Apr 2017 15:40:32 +0300 Subject: [PATCH] Declare tun factory and return its instance in new_tun_factory method --- OpenVPN Adapter/OpenVPNClient.mm | 3 ++- OpenVPN Adapter/TUNFactory.h | 18 ++++++++++++++++++ OpenVPN Adapter/TUNFactory.mm | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 OpenVPN Adapter/TUNFactory.h create mode 100644 OpenVPN Adapter/TUNFactory.mm diff --git a/OpenVPN Adapter/OpenVPNClient.mm b/OpenVPN Adapter/OpenVPNClient.mm index da45138..041baae 100644 --- a/OpenVPN Adapter/OpenVPNClient.mm +++ b/OpenVPN Adapter/OpenVPNClient.mm @@ -10,6 +10,7 @@ #import +#import "TUNFactory.h" #import "OpenVPNAdapter+Internal.h" #import "OpenVPNClient.h" @@ -18,7 +19,7 @@ OpenVPNClient::OpenVPNClient(void *adapter) : ClientAPI::OpenVPNClient() { } TunClientFactory* OpenVPNClient::new_tun_factory(const ExternalTun::Config& conf, const OptionList& opt) { - return nullptr; + return new TUNFactory(); } bool OpenVPNClient::tun_builder_new() { diff --git a/OpenVPN Adapter/TUNFactory.h b/OpenVPN Adapter/TUNFactory.h new file mode 100644 index 0000000..953ac63 --- /dev/null +++ b/OpenVPN Adapter/TUNFactory.h @@ -0,0 +1,18 @@ +// +// TUNFactory.h +// OpenVPN Adapter +// +// Created by Sergey Abramchuk on 15.04.17. +// +// + +#import + +using namespace openvpn; + +class TUNFactory: public TunClientFactory { +public: + virtual TunClient::Ptr new_tun_client_obj(openvpn_io::io_context& io_context, + TunClientParent& parent, + TransportClient* transcli) override; +}; diff --git a/OpenVPN Adapter/TUNFactory.mm b/OpenVPN Adapter/TUNFactory.mm new file mode 100644 index 0000000..8f05bb1 --- /dev/null +++ b/OpenVPN Adapter/TUNFactory.mm @@ -0,0 +1,18 @@ +// +// TUNFactory.m +// OpenVPN Adapter +// +// Created by Sergey Abramchuk on 15.04.17. +// +// + +#import "TUNFactory.h" + +// !!! tuncli.hpp may be used as example of implementation + +TunClient::Ptr TUNFactory::new_tun_client_obj(openvpn_io::io_context& io_context, + TunClientParent& parent, + TransportClient* transcli) +{ + return nullptr; +}