示例#1
0
        public LinkDriver(NetIfManager manager, ILinkNetIf netIfDevice, byte netIfIndex,
                          bool mappingEnabled, bool threaded, bool doesIO, bool hasTasks)
        {
            Manager            = manager;
            IoNetIfDevice      = netIfDevice;
            NetIfIndex         = netIfIndex;
            MappingEnabled     = mappingEnabled;
            DoesIO             = doesIO;
            HasTasks           = hasTasks;
            NumTasks           = 0;
            DeviceContextIndex = 0;
            duplexKind         = (byte)LinkMonitor.LINK_DUPLEX_KIND.LINK_DUPLEX_KIND_NONE;
            duplexApply        = 0;
            Monitor            = (DoesIO ? new LinkMonitor(this) : null);
            Parser             = (DoesIO ? new PacketParser(this) : null);
            IOThreads          = (threaded ? new LinkIOThreads(this) : null);

            NotStale          = false;
            HasRead           = false;
            SerialIndex       = -1;
            SchedulerInterval = SchedulerIntervalDefault;
            ResponseInterval  = ResponseIntervalDefault;

            LinkWriteQueue   = new DequeBlockingCollection <int>(LinkWriteQSize, -1);
            LinkVerifyQueue  = new DequeBlockingCollection <int>(LinkVerifyQSize, -1);
            LinkMissingQueue = new DequeBlockingCollection <byte>(LinkMissingQSize, ProtocolConstants.VNO_NULL);

            OutputMapBuffer = (mappingEnabled ? new byte[LinkMappingBufferSize] : null);

            ClearLinkDriver();

            manager.SerialNumberManager.NetIfSerialNumberSetup(NetIfIndex);
        }
示例#2
0
 public virtual void Close()
 {
     StopLinkDriver();
     ResetLinkDriver();
     if (IoNetIfDevice != null)
     {
         IoNetIfDevice.Close();
         IoNetIfDevice = null;
     }
 }