Exemplo n.º 1
0
            public override bool Equals(Object obj)
            {
                if (obj == null || GetType() != obj.GetType())
                {
                    return(false);
                }

                IPAddress_v6 p = (IPAddress_v6)obj;

                return(this.ToString().CompareTo(p.ToString()) == 0);
            }
        public static void InterfaceDescriptionOption_IPAddress_v6_Test()
        {
            byte[]       preTab  = new byte[] { 0x20, 0x01, 0x0d, 0xb8, 0x85, 0xa3, 0x08, 0xd3, 0x13, 0x19, 0x8a, 0x2e, 0x03, 0x70, 0x73, 0x44, 0x40 };
            IPAddress_v6 address = new IPAddress_v6(preTab);

            Assert.IsNotNull(address);
            Assert.AreEqual(address.Address, "2001:0db8:85a3:08d3:1319:8a2e:0370:7344");
            Assert.AreEqual(address.PrefixLength, 64);
            Assert.AreEqual(address.ToString(), "2001:0db8:85a3:08d3:1319:8a2e:0370:7344/64");
            byte[] postTab = address.ConvertToByte();
            Assert.AreEqual(preTab, postTab);
        }
Exemplo n.º 3
0
 public InterfaceDescriptionOption(string Comment           = null, string Name = null, string Description = null, IPAddress IPv4Address_v4      = null,
                                   IPAddress_v6 IPv6Address = null, PhysicalAddress MacAddress = null, byte[] EuiAddress = null, long?Speed      = null, byte?TimestampResolution = 6,
                                   int?TimeZone             = null, byte[] Filter = null, string OperatingSystem = null, byte?FrameCheckSequence = null, long?TimeOffsetSeconds   = null)
 {
     CustomContract.Requires <ArgumentException>(EuiAddress == null || EuiAddress.Length == 8, "Invalid EuiAddress length. (Should be 8 bytes)");
     this.Comment             = Comment;
     this.Name                = Name;
     this.Description         = Description;
     this.IPv4Address         = IPv4Address;
     this.IPv6Address         = IPv6Address;
     this.MacAddress          = MacAddress;
     this.euiAddress          = EuiAddress;
     this.Speed               = Speed;
     this.TimestampResolution = TimestampResolution;
     this.TimeZone            = TimeZone;
     this.Filter              = Filter;
     this.OperatingSystem     = OperatingSystem;
     this.FrameCheckSequence  = FrameCheckSequence;
     this.TimeOffsetSeconds   = TimeOffsetSeconds;
 }
 public InterfaceDescriptionOption(string Comment = null, string Name = null, string Description = null, IPAddress IPv4Address_v4 = null,
     IPAddress_v6 IPv6Address = null, PhysicalAddress MacAddress = null, byte[] EuiAddress = null, long? Speed = null, byte? TimestampResolution = 6,
     int? TimeZone = null, byte[] Filter = null, string OperatingSystem = null, byte? FrameCheckSequence = null, long? TimeOffsetSeconds = null) 
 {
     Contract.Requires<ArgumentException>(EuiAddress == null || EuiAddress.Length == 8, "Invalid EuiAddress length. (Should be 8 bytes)");               
     this.Comment = Comment;
     this.Name = Name;
     this.Description = Description;
     this.IPv4Address = IPv4Address;
     this.IPv6Address = IPv6Address;
     this.MacAddress = MacAddress;
     this.euiAddress = EuiAddress;
     this.Speed = Speed;
     this.TimestampResolution = TimestampResolution;
     this.TimeZone = TimeZone;
     this.Filter = Filter;
     this.OperatingSystem = OperatingSystem;
     this.FrameCheckSequence = FrameCheckSequence;
     this.TimeOffsetSeconds = TimeOffsetSeconds;    
 }
 public static void InterfaceDescriptionOption_IPAddress_v6_Test()
 {
     byte[] preTab = new byte[] { 0x20, 0x01, 0x0d, 0xb8, 0x85, 0xa3, 0x08, 0xd3, 0x13, 0x19, 0x8a, 0x2e, 0x03, 0x70, 0x73, 0x44, 0x40 };
     IPAddress_v6 address = new IPAddress_v6(preTab);
     Assert.IsNotNull(address);
     Assert.AreEqual(address.Address, "2001:0db8:85a3:08d3:1319:8a2e:0370:7344");
     Assert.AreEqual(address.PrefixLength, 64);
     Assert.AreEqual(address.ToString(), "2001:0db8:85a3:08d3:1319:8a2e:0370:7344/64");
     byte[] postTab = address.ConvertToByte();
     Assert.AreEqual(preTab, postTab);
 }