public RouteTable this[IPAddress ip] { get { RouteTable t = null; foreach (RouteTable route in routeTable) { var net = SoftRouter.GetNetIpAddress(ip, route.MaskAddress); if (net.ToString() == route.NetAddress.ToString() || route.NetAddress.ToString() == IPAddress.Any.ToString()) { if (t == null) { t = route; } else { if (route.Level < t.Level) { t = route; } } } } return(t); } }
public Device(ICaptureDevice icd) { WinPcapDevice win = (WinPcapDevice)icd; this._interface = icd; this._mac = win.MacAddress; this._ip = win.Addresses[0].Addr.ipAddress; this._mask = win.Addresses[0].Netmask.ipAddress; this._net = SoftRouter.GetNetIpAddress(_ip, _mask); this._name = win.Interface.FriendlyName + " " + icd.Description.Split('\'')[1]; }
public MainForm() { InitializeComponent(); softRoute = new SoftRouter(); }