/// <summary> /// Constructor of the NetInfo class /// </summary> /// <param name="exceptionhandler">The exception handler, trigger when exception occurs</param> /// <param name="devicePath"> xenstore device path of NIC device</param> /// <param name="attrPath"> xenstore path NIC device data info report back to</param> /// <param name="session"> wmi session, mainly used to access xenstore</param> public NetInfo(IExceptionHandler exceptionhandler, string devicePath, string attrPath, AWmiSession session) { wmisession = session; this.exceptionhandler = exceptionhandler; updating = new Object(); this.devicePath = devicePath; this.attrPath = attrPath; netDeviceItem = wmisession.GetXenStoreItem(devicePath); netAttrItem = wmisession.GetXenStoreItem(attrPath); netDeviceItem.Watch(onXenstoreNetChanged); addrChangeHandler = new NetworkAddressChangedEventHandler(onVmNicAddrChange); NetworkChange.NetworkAddressChanged += addrChangeHandler; netStaticIpSetting = wmisession.GetXenStoreItem(STATIC_IP_FEATURE_MONITOR_KEY); netStaticIpSetting.Watch(onXenstoreStaticIpSettingChanged); // trigger the first update needsRefresh = true; }
public VfInfo(IExceptionHandler exceptionhandler, AWmiSession session) : base(exceptionhandler, DEVICE_PATH, ATTR_PATH, session) { }