Ejemplo n.º 1
0
        public void AddDevice(INetworkDevice dev)
        {
            // поиск устройств с одинаковыми именами
            // ....
            // поиск конфликта адресов
            //.....

            dev.Lan = this;
            Devices.Add(dev);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NetworkDevicePacketBuffer"/> class.
 /// </summary>
 /// <param name="networkDevice">The network device.</param>
 /// <param name="maxTransmitQueue">The max transmit queue.</param>
 /// <param name="maxReceiveQueue">The max receive queue.</param>
 public NetworkDevicePacketBuffer(INetworkDevice networkDevice, uint maxTransmitQueue, uint maxReceiveQueue)
 {
     this.networkDevice       = networkDevice;
     this.maxReceiveQueue     = maxReceiveQueue;
     this.maxTransmitQueue    = maxTransmitQueue;
     this.transmitLock        = new SpinLock();
     this.receiveLock         = new SpinLock();
     countTransmitPackets     = 0;
     countReceivePackets      = 0;
     discardedTransmitPackets = 0;
     discardedReceivePackets  = 0;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NetworkDevicePacketBuffer"/> class.
 /// </summary>
 /// <param name="networkDevice">The network device.</param>
 public NetworkDevicePacketBuffer(INetworkDevice networkDevice)
 {
     this.networkDevice       = networkDevice;
     this.maxTransmitQueue    = 100;             // TODO: Lookup system default
     this.maxReceiveQueue     = 100;             // TODO: Lookup system default
     this.transmitLock        = new SpinLock();
     this.receiveLock         = new SpinLock();
     countTransmitPackets     = 0;
     countReceivePackets      = 0;
     discardedTransmitPackets = 0;
     discardedReceivePackets  = 0;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NetworkDevicePacketBuffer"/> class.
 /// </summary>
 /// <param name="networkDevice">The network device.</param>
 public NetworkDevicePacketBuffer(INetworkDevice networkDevice)
 {
     this.networkDevice = networkDevice;
     maxTransmitQueue = 100;    // TODO: Lookup system default
     maxReceiveQueue = 100;     // TODO: Lookup system default
     transmitLock = new SpinLock();
     receiveLock = new SpinLock();
     countTransmitPackets = 0;
     countReceivePackets = 0;
     discardedTransmitPackets = 0;
     discardedReceivePackets = 0;
 }
 internal void Add(NetworkDevice.PortTable port, INetworkDevice device)
 {
     if (port != null)
     {
         var dupe = this.FirstOrDefault(t => t.Port != null && t.Port.port_idx == port.port_idx);
         if (dupe != null)
         {
             if (dupe.Device is IUniFiNetworkDevice)
             {
                 return;
             }
             this.RemoveLocal(dupe);
         }
     }
     this.AddLocal(new ChildPortBinding(port, device));
 }
        public bool HasParentDevice(INetworkDevice device)
        {
            if (device is NonUniFiDevice)
            {
                return(false);
            }

            foreach (var searchDevice in this)
            {
                if (searchDevice.Children.HasChild(device))
                {
                    return(true);
                }
            }
            return(false);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NetworkDevicePacketBuffer"/> class.
 /// </summary>
 /// <param name="networkDevice">The network device.</param>
 /// <param name="maxTransmitQueue">The max transmit queue.</param>
 /// <param name="maxReceiveQueue">The max receive queue.</param>
 public NetworkDevicePacketBuffer(INetworkDevice networkDevice, uint maxTransmitQueue, uint maxReceiveQueue)
 {
     this.networkDevice = networkDevice;
     this.maxReceiveQueue = maxReceiveQueue;
     this.maxTransmitQueue = maxTransmitQueue;
     transmitLock = new SpinLock();
     receiveLock = new SpinLock();
     countTransmitPackets = 0;
     countReceivePackets = 0;
     discardedTransmitPackets = 0;
     discardedReceivePackets = 0;
 }
 internal ChildPortBinding(NetworkDevice.PortTable port, INetworkDevice device)
 {
     Port   = port;
     Device = device;
 }
 public bool HasChild(INetworkDevice device)
 {
     return(this.Any(c => c.Device.Identifier.Equals(device.Identifier)));
 }
Ejemplo n.º 10
0
 /// <summary>
 ///     Sends a subscribe message to the specified destination.
 /// </summary>
 /// <param name="destination">Device to send the message to.</param>
 public void SendSubscribeMessage(INetworkDevice destination)
 {
     _messageSender.Send(new OutboundSubscribeMessage(destination.MacAddress), destination.IPAddress);
 }
Ejemplo n.º 11
0
 /// <summary>
 ///     Sends an on message to the specified destination.
 /// </summary>
 /// <param name="destination">Device to send the message to.</param>
 public void SendOnMessage(INetworkDevice destination)
 {
     _messageSender.Send(new OutboundStateChangeMessage(destination.MacAddress, SocketState.On), destination.IPAddress);
 }