Esempio n. 1
0
 /// <summary>
 /// Initialize IPv4 address
 /// </summary>
 /// <param name="addr">A string of IPv4 address. It looks like 192.168.0.0.</param>
 /// <param name="prefix">An integer number less than 32.</param>
 /// <param name="ipClass">Class of IPv4 address.</param>
 public IPv4Address(string addr, int prefix, IPv4Class ipClass)
     : base(addr)
 {
     _mask = new NetworkMask(prefix);
     _class = ipClass;
 }
Esempio n. 2
0
 /// <summary>
 /// Initialize IPv4 address
 /// </summary>
 /// <param name="addr">A string of IPv4 address. It looks like 192.168.0.0.</param>
 /// <param name="subnetMask">A string of subnet mask of IPv4 address. It looks like 255.255.255.0.</param>
 /// <param name="ipClass">Class of IPv4 address.</param>
 public IPv4Address(string addr, string subnetMask, IPv4Class ipClass)
     : base(addr)
 {
     _mask = new NetworkMask(subnetMask);
     _class = ipClass;
 }
Esempio n. 3
0
 /// <summary>
 /// Initialize IPv4 address
 /// </summary>
 /// <param name="addr">A string of IPv4 address. It looks like 192.168.0.0.</param>
 /// <param name="prefix">An integer number less than 32.</param>
 public IPv4Address(string addr, int prefix)
     : base(addr)
 {
     _mask = new NetworkMask(prefix);
     _class = ToNetworkClass(_octet);
 }
Esempio n. 4
0
 /// <summary>
 /// Initialize IPv4 address
 /// </summary>
 /// <param name="addr">A string of IPv4 address. It looks like 192.168.0.0.</param>
 /// <param name="subnetMask">A string of subnet mask of IPv4 address. It looks like 255.255.255.0.</param>
 public IPv4Address(string addr, string subnetMask)
     : base(addr)
 {
     _mask = new NetworkMask(subnetMask);
     _class = ToNetworkClass(_octet);
 }
Esempio n. 5
0
        /// <summary>
        /// Sets address with decimal value of octets.
        /// </summary>
        /// <param name="octet1">The first octet.</param>
        /// <param name="octet2">The second octet.</param>
        /// <param name="octet3">The third octet.</param>
        /// <param name="octet4">The fourth octet.</param>
        public override void SetAddress(int octet1, int octet2, int octet3, int octet4)
        {
            base.SetAddress(octet1, octet2, octet3, octet4);

            _mask = new NetworkMask(_octet);
            _class = ToNetworkClass(_octet);
        }
Esempio n. 6
0
 /// <summary>
 /// Initialize IPv4 address with IPv4 class.
 /// </summary>
 /// <param name="ipClass">Class of IPv4 address.</param>
 public IPv4Address(IPv4Class ipClass)
 {
     _class = ipClass;
     switch (_class)
     {
         case IPv4Class.A:
             Octet = ToOctet(1, 0, 0, 0);
             _mask = new NetworkMask(8);
             break;
         case IPv4Class.B:
             Octet = ToOctet(128, 0, 0, 0);
             _mask = new NetworkMask(16);
             break;
         case IPv4Class.C:
             Octet = ToOctet(192, 0, 0, 0);
             _mask = new NetworkMask(24);
             break;
         case IPv4Class.D:
             Octet = ToOctet(224, 0, 0, 0);
             _mask = new NetworkMask(32);
             break;
         case IPv4Class.E:
             Octet = ToOctet(240, 0, 0, 0);
             _mask = new NetworkMask(32);
             break;
         default:
             break;
     }
 }
Esempio n. 7
0
 /// <summary>
 /// Initialize IPv4 address
 /// </summary>
 /// <param name="addr">An array of octet of IPv4 address.</param>
 /// <param name="subnetMask">Subnet mask of IPv4 address.</param>
 /// <param name="ipClass">Class of IPv4 address.</param>
 public IPv4Address(Octet[] addr, SubnetMask subnetMask, IPv4Class ipClass)
 {
     Octet = addr;
     _mask = new NetworkMask(subnetMask);
     _class = ipClass;
 }
Esempio n. 8
0
 /// <summary>
 /// Initialize IPv4 address
 /// </summary>
 /// <param name="octet1">The first octet.</param>
 /// <param name="octet2">The second octet.</param>
 /// <param name="octet3">The third octet.</param>
 /// <param name="octet4">The fourth octet.</param>
 public IPv4Address(int octet1, int octet2, int octet3, int octet4)
     : base(octet1, octet2, octet3, octet4)
 {
     _mask = new NetworkMask(_octet);
     _class = ToNetworkClass(_octet);
 }