using System;
using System.Threading;
namespace Renci.SshNet
{
    /// 
    /// Provides functionality for local port forwarding
    /// 
    public partial class ForwardedPortLocal : ForwardedPort, IDisposable
    {
        private EventWaitHandle _listenerTaskCompleted;
        /// 
        /// Gets the bound host.
        /// 
        public string BoundHost { get; private set; }
        /// 
        /// Gets the bound port.
        /// 
        public uint BoundPort { get; private set; }
        /// 
        /// Gets the forwarded host.
        /// 
        public string Host { get; private set; }
        /// 
        /// Gets the forwarded port.
        /// 
        public uint Port { get; private set; }
        /// 
        /// Gets or sets a value indicating whether port forwarding is started.
        /// 
        /// 
        /// true if port forwarding is started; otherwise, false.
        /// 
        public override bool IsStarted
        {
            get { return _listenerTaskCompleted != null && !_listenerTaskCompleted.WaitOne(0); }
        }
        /// 
        /// Initializes a new instance of the  class.
        /// 
        /// The bound port.
        /// The host.
        /// The port.
        ///  is greater than .
        ///  is null.
        ///  is greater than .
        /// 
        ///