Esempio n. 1
0
        public TcpPcb(TcpFrame frame, ILayerLocator locator)
        {
            if (frame == null)
            {
                throw new ArgumentNullException(nameof(frame));
            }

            this.Locator              = locator ?? throw new ArgumentNullException(nameof(locator));
            this.AcknowledgeNo        = frame.AcknowledgeNo;
            this.SequenceNo           = frame.SequenceNo;
            this.AddressFamily        = frame.AddressFamily;
            this.Destination          = frame.Destination;
            this.Source               = frame.Source;
            this.Ttl                  = frame.Ttl;
            this.Aborted              = false;
            this.Estableshed          = false;
            this.SendBufferSize       = frame.WindowSize;
            this.ReceiveBufferSize    = frame.WindowSize;
            this.InputStream          = new TcpInputStream(this);
            this.InputStream.Receive += (sender, e) =>
            {
                uint ackNo = Convert.ToUInt32(e.SequenceNo + e.Payload.Length);
                uint seqNo = e.AcknowledgeNo;
                this.SequenceNo = ackNo;
                {
                    this.Post(TcpFlags.TCP_ACK, ackNo, seqNo, 0);
                }
                this.OnMessage(e.Payload);
            };
        }
Esempio n. 2
0
 public IPv4Layer(ILayerLocator locator)
 {
     this.Locator = locator ?? throw new ArgumentNullException(nameof(locator));
     this.Tcp     = locator.Tcp;
     this.Udp     = locator.Udp;
     this.Icmp    = locator.Icmp;
 }
Esempio n. 3
0
 public TcpLayer(ILayerLocator locator)
 {
     this.Locator = locator ?? throw new ArgumentNullException(nameof(locator));
     new Thread(WorkThread)
     {
         IsBackground = true, Priority = ThreadPriority.Lowest
     }.Start();
 }
Esempio n. 4
0
 public Layer3Netif(ILayerLocator locator, string componentId)
 {
     if (locator == null)
     {
         throw new ArgumentNullException(nameof(locator));
     }
     this.Handle = OpenTunDev(componentId);
     if (IntPtr.Zero == this.Handle)
     {
         throw new SystemException("Unable to open netif specifying componentId");
     }
     this.IPv4  = locator.IPv4;
     this.Index = GetAdapterIndex(componentId);
     this.Name  = GetAdapterName(componentId);
 }
 public TUN2SocksSocketScheduler(TUN2Socks tun2socks, ILayerLocator locator) : base(locator)
 {
     this.m_tun2socks = tun2socks ?? throw new ArgumentNullException(nameof(tun2socks));
 }
Esempio n. 6
0
 public IcmpLayer(ILayerLocator locator)
 {
     this.Locator = locator ?? throw new ArgumentNullException(nameof(locator));
 }
Esempio n. 7
0
 protected internal virtual TUN2SocksSocketScheduler CreateSocketScheduler(ILayerLocator locator)
 {
     return(new TUN2SocksSocketScheduler(this, locator));
 }
Esempio n. 8
0
 public SocketScheduler(ILayerLocator locator)
 {
     this.Locator = locator ?? throw new ArgumentNullException(nameof(locator));
 }