public InterfaceAddress(EInterfaceType type, NetworkInterface nic, IPAddress address = null)
        {
            Type    = type;
            Address = address;
            Nic     = nic;

            if (Address == null && (Type == EInterfaceType.Any || Type == EInterfaceType.Specific))
            {
                throw new ArgumentNullException(
                          "address cannot be null for types: [Specific, Any]");
            }
        }
Esempio n. 2
0
        public static CiscoInterfaceId ToCiscoInterfaceId(EInterfaceType interfaceType, CiscoInterfaceNumber interfaceNumber, IList <int> channelNumber, IList <int> subinterfaceNumber)
        {
            var result = new CiscoInterfaceId
            {
                InterfaceType   = interfaceType,
                InterfaceNumber = interfaceNumber
            };

            if (channelNumber.Count > 0)
            {
                result.InterfaceNumber.Channel = channelNumber[0];
            }

            if (subinterfaceNumber.Count > 0)
            {
                result.InterfaceNumber.Subinterface = subinterfaceNumber[0];
            }

            return(result);
        }