Beispiel #1
0
        /// <summary>
        /// Initializes a new OVPN Object.
        /// </summary>
        /// <param name="host">Host to connect to which holds the management interface</param>
        /// <param name="port">Port to connect to</param>
        /// <param name="earlyLogEvent">Delegate to a event processor</param>
        /// <param name="earlyLogLevel">Log level</param>
        /// <param name="receiveOldLogs">Should old log lines be received?</param>
        /// <seealso cref="Logs"/>
        protected void Init(string host, int port,
                            EventHandler <LogEventArgs> earlyLogEvent,
                            int earlyLogLevel, bool receiveOldLogs)
        {
            this.Host = host;
            this.Port = port;
            m_state   = new State(this);

            m_logs            = new LogManager(this);
            m_logs.DebugLevel = earlyLogLevel;
            if (earlyLogEvent != null)
            {
                m_logs.LogEvent += earlyLogEvent;
            }

            m_ovpnMLogic = new ManagementLogic(this, host, port, m_logs, receiveOldLogs);
            m_state.ChangeState(VPNConnectionState.Stopped);
        }
Beispiel #2
0
        /// <summary>
        /// Destructor. Disposes the object.
        /// </summary>
        /// <param name="disposing">true if called from Dispose()</param>
        private void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (m_state != null && m_state.ConnectionState != VPNConnectionState.Stopped)
                {
                    Disconnect();
                }

                if (disposing && m_ovpnMLogic != null)
                {
                    m_ovpnMLogic.Dispose();
                }
                m_logs       = null;
                m_ovpnMLogic = null;
                disposed     = true;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Destructor. Disposes the object.
        /// </summary>
        /// <param name="disposing">true if called from Dispose()</param>
        private void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (m_state != null && m_state.ConnectionState != VPNConnectionState.Stopped)
                    Disconnect();

                if (disposing && m_ovpnMLogic != null)
                {
                    m_ovpnMLogic.Dispose();
                }
                m_logs = null;
                m_ovpnMLogic = null;
                disposed = true;
            }
        }
Beispiel #4
0
        /// <summary>
        /// Initializes a new OVPN Object.
        /// </summary>
        /// <param name="host">Host to connect to which holds the management interface</param>
        /// <param name="port">Port to connect to</param>
        /// <param name="earlyLogEvent">Delegate to a event processor</param>
        /// <param name="earlyLogLevel">Log level</param>
        /// <param name="receiveOldLogs">Should old log lines be received?</param>
        /// <seealso cref="Logs"/>
        protected void Init(string host, int port,
            EventHandler<LogEventArgs> earlyLogEvent,
            int earlyLogLevel, bool receiveOldLogs)
        {
            this.Host = host;
            this.Port = port;
            m_state = new State(this);

            m_logs = new LogManager(this);
            m_logs.DebugLevel = earlyLogLevel;
            if (earlyLogEvent != null)
                m_logs.LogEvent += earlyLogEvent;

            m_ovpnMLogic = new ManagementLogic(this, host, port, m_logs, receiveOldLogs);
            m_state.ChangeState(VPNConnectionState.Stopped);
        }
 /// <summary>
 /// Creates a new management parser.
 /// </summary>
 /// <param name="oc">reference to the network communicator</param>
 /// <param name="ol">reference to the management logic</param>
 internal ManagementParser(Communicator oc, ManagementLogic ol)
 {
     m_logic = ol;
     oc.gotLine += new helper.Action<object,GotLineEventArgs>(oc_gotLine);
 }
 /// <summary>
 /// Creates a new management parser.
 /// </summary>
 /// <param name="oc">reference to the network communicator</param>
 /// <param name="ol">reference to the management logic</param>
 internal ManagementParser(Communicator oc, ManagementLogic ol)
 {
     m_logic     = ol;
     oc.gotLine += new helper.Action <object, GotLineEventArgs>(oc_gotLine);
 }