/// <summary> /// Creates a new querier to the given address using the given options. /// </summary> /// <param name="address">The IP address of the device to query.</param> /// <param name="options">The options for the query.</param> /// <returns>An <see cref="IHamnetQuerier" /> that talks to the given address.</returns> public IHamnetQuerier Create(IPAddress address, IQuerierOptions options) { if (address == null) { throw new ArgumentNullException(nameof(address), "address is null"); } ISnmpLowerLayer lowerLayer = new SnmpLowerLayer(new IpAddress(address), options); return(this.Create(lowerLayer, options)); }
/// <inheritdoc /> public virtual IDeviceHandler CreateHandler(IpAddress address, IQuerierOptions options) { if (this.circularCreateHandler++ > 1) { var ex = new InvalidOperationException($"Internal Error: DetectableDevice {this.GetType().Name} seems to neither implement CreateHandler(ISnmpLowerLayer lowerLayer, IQuerierOptions options) nor CreateHandler(IpAddress address, IQuerierOptions options)"); this.CollectException("CreateHandler(IpAddress, IQuerierOptions) circular call", ex); throw ex; } var lowerLayer = new SnmpLowerLayer(address, options); return(this.CreateHandler(lowerLayer, options)); }