Exemple #1
0
        public NativeMethods.ovpn3_transport_stats GetTransportStats()
        {
            lock (clientSync)
            {
                if (openVPNClient == null)
                {
                    string errMsg = "OpenVPNTunnel::GetTransportStats(): OpenVPN client is not initialized";

                    EddieLogger.Error(errMsg);

                    throw new Exception(errMsg);
                }

                NativeMethods.ovpn3_transport_stats stats = new NativeMethods.ovpn3_transport_stats();

                NativeMethods.EddieLibraryResult result = openVPNClient.GetTransportStats(ref stats);

                if (result.code != NativeMethods.ResultCode.SUCCESS)
                {
                    string errMsg = string.Format("OpenVPNTunnel::GetTransportStats(): Failed to get OpenVPN transport stats. {0}", result.description);

                    EddieLogger.Error(errMsg);

                    throw new Exception(errMsg);
                }

                return(stats);
            }
        }
Exemple #2
0
        public NativeMethods.ovpn3_transport_stats GetTransportStats()
        {
            lock (m_clientSync)
            {
                if (m_client == null)
                {
                    throw new Exception("client not initialized");
                }

                NativeMethods.ovpn3_transport_stats stats = new NativeMethods.ovpn3_transport_stats();
                if (!m_client.GetTransportStats(ref stats))
                {
                    throw new Exception("failed to get transport stats");
                }

                return(stats);
            }
        }