コード例 #1
0
        private void OnEventImpl(ref NativeMethods.ovpn3_event oe)
        {
            if (oe.name != "CONNECTED" || (oe.data.ToInt64() == 0))
            {
                return;
            }

            NativeMethods.ovpn3_connection_data connectionData = Marshal.PtrToStructure <NativeMethods.ovpn3_connection_data>(oe.data);
            LogsManager.Instance.Debug("CONNECTED: defined={0}, user={1}, serverHost={2}, serverPort={3}, serverProto={4}, serverIp={5}, vpnIp4={6}, vpnIp6={7}, gw4={8}, gw6={9}, clientIp={10}, tunName={11}", connectionData.defined, connectionData.user, connectionData.serverHost, connectionData.serverPort, connectionData.serverProto, connectionData.serverIp, connectionData.vpnIp4, connectionData.vpnIp6, connectionData.gw4, connectionData.gw6, connectionData.clientIp, connectionData.tunName);
        }
コード例 #2
0
        private string GetEventContent(ref NativeMethods.ovpn3_event oe)
        {
            string name = oe.name;
            string info = oe.info;

            if (SupportTools.Empty(info))
            {
                return(name);
            }

            return(name + ": " + info);
        }
コード例 #3
0
        private void OnEvent(ref NativeMethods.ovpn3_event oe)
        {
            LogsManager.Instance.Debug("OnEvent(type={0}, name={1}, info={2}, data={3})", oe.type, oe.name, oe.info, oe.data.ToString());

            try
            {
                OnEventImpl(ref oe);
            }
            catch (Exception e)
            {
                LogsManager.Instance.Error("OnEvent", e);
            }
        }