Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the Interface class using the specified
        /// parameters.
        /// </summary>
        /// <param name="nic">The network interface card (NIC) this interface
        /// represents.</param>
        /// <param name="name">A unique name (such as eth0) for identifing the
        /// interface.</param>
        /// <param name="cidrIpAddress">The IPv4 address to associate with this
        /// interface in CIDR notation.</param>
        /// <param name="gateway">The IPv4 address of the default gateway to
        /// configure this interface with.</param>
        /// <exception cref="ArgumentNullException">Thrown if any of the arguments
        /// is null.</exception>
        public Interface(Nic nic, string name, string cidrIpAddress,
			string gateway = null) {
			var t = IpAddress.ParseCIDRNotation(cidrIpAddress);
			Init(nic, name, t.Item1, t.Item2, gateway != null ?
				new IpAddress(gateway) : null);
		}
Exemplo n.º 2
0
        /// <summary>
        /// Initializes the interface.
        /// </summary>
		/// <param name="nic">The network interface card (NIC) this interface
		/// represents.</param>
		/// <param name="name">A unique name (such as eth0) for identifing the
		/// interface.</param>
		/// <param name="ipAddress">The IPv4 address to associate with this
		/// interface.</param>
		/// <param name="netmask">The subnetmask to assign to this interface.</param>
		/// <param name="gateway">The IPv4 address of the default gateway to
		/// configure this interface with.</param>
		void Init(Nic nic, string name, IpAddress ipAddress, IpAddress netmask,
			IpAddress gateway) {
			nic.ThrowIfNull("nic");
			name.ThrowIfNull("name");
			ipAddress.ThrowIfNull("ipAddress");
			netmask.ThrowIfNull("netmask");
			Nic = nic;
			Name = name;
			IpAddress = ipAddress;
			Netmask = netmask;
			Gateway = gateway;
			Nic.Interrupt += OnInterrupt;
		}
Exemplo n.º 3
0
		/// <summary>
		/// Initializes a new instance of the Interface class using the specified
		/// parameters.
		/// </summary>
		/// <param name="nic">The network interface card (NIC) this interface
		/// represents.</param>
		/// <param name="name">A unique name (such as eth0) for identifing the
		/// interface.</param>
		/// <param name="ipAddress">The IPv4 address to associate with this
		/// interface.</param>
		/// <param name="netmask">The subnetmask to assign to this interface.</param>
		/// <param name="gateway">The IPv4 address of the default gateway to
		/// configure this interface with.</param>
		/// <exception cref="ArgumentNullException">Thrown if any of the arguments
		/// is null.</exception>
		public Interface(Nic nic, string name, IpAddress ipAddress, IpAddress netmask,
			IpAddress gateway = null) {
				Init(nic, name, ipAddress, netmask, gateway);
		}