Esempio n. 1
0
        private void DoStartTunnel(Bundle data)
        {
            if (m_tunnel != null)
            {
                throw new Exception("internal error (m_tunnel already initialized)");
            }

            if (data == null)
            {
                throw new Exception("internal error (data bundle is null)");
            }

            m_tunnel = new OpenVPNTunnel(this);
            m_tunnel.Init();

            string profile = data.GetString(PARAM_PROFILE, "");

            if (profile.Length == 0)
            {
                throw new Exception("no profile defined");
            }

            m_tunnel.LoadProfileString(profile);
            m_tunnel.BindOptions();

            TaskEx vpnTask = m_tasksManager.Add((CancellationToken c) =>
            {
                m_tunnel.Run(c);
            });

            lock (m_vpnTaskSync)
            {
                m_vpnTask = vpnTask;
            }
        }
Esempio n. 2
0
        private void TunnelSetup(Bundle data)
        {
            if (vpnTunnel != null)
            {
                throw new Exception("internal error (m_tunnel already initialized)");
            }

            if (data == null)
            {
                throw new Exception("internal error (data bundle is null)");
            }

            vpnTunnel = new OpenVPNTunnel(this);

            vpnTunnel.Init();

            string profile = data.GetString(PARAM_PROFILE, "");

            if (profile.Length == 0)
            {
                throw new Exception("no profile defined");
            }

            vpnTunnel.LoadProfileString(profile);

            vpnTunnel.BindOptions();
        }