12#ifndef OPENVPN_TUN_PERSIST_TUNPERSIST_H
13#define OPENVPN_TUN_PERSIST_TUNPERSIST_H
24template <
typename SCOPED_OBJ,
typename STATE = TunProp::State::Ptr>
78#if OPENVPN_DEBUG_TUN_BUILDER > 0
87 catch (
const std::exception &e)
89 OPENVPN_LOG(
"*** TUN BUILDER CAPTURE exception: " << e.what());
103 catch (
const std::exception &)
void reset() noexcept
Points this RCPtr<T> to nullptr safely.
T * get() const noexcept
Returns the raw pointer to the object T, or nullptr.
TunBuilder methods, loosely based on the Android VpnService.Builder abstraction.
virtual bool tun_builder_persist()
Determines if the TUN interface can be persisted.
virtual void tun_builder_teardown(bool disconnect)
Indicates that tunnel is being torn down.
std::string to_string() const
const std::string & options()
RCPtr< TunPersistTemplate > Ptr
const bool enable_persistence_
const STATE & state() const
TunBuilderCapture::Ptr copt_
bool persist_tun_state(const typename SCOPED_OBJ::base_type obj, const STATE &state, bool save_replace_sock=true)
TunPersistTemplate(const bool enable_persistence, const TunWrapObjRetain retain_obj, TunBuilderBase *tb)
TunBuilderBase *const tb_
bool use_persisted_tun(const IP::Addr server_addr, const TunProp::Config &tun_prop, const OptionList &opt)
virtual ~TunPersistTemplate()
static void configure_builder(TunBuilderBase *tb, State *state, SessionStats *stats, const IP::Addr &server_addr, const Config &config, const OptionList &opt, const EmulateExcludeRouteFactory *eer_factory, const bool quiet)
void save_replace_sock(const typename SCOPED_OBJ::base_type obj)
SCOPED_OBJ::base_type obj() const
#define OPENVPN_LOG(args)
Support deferred server-side state creation when client connects.