public void SetUInt32(DhcpPacketOptionId id, UInt32 value) { value = (UInt32)IPAddress.HostToNetworkOrder((int)value); SetBytes(id, BitConverter.GetBytes(value)); }
public void SetString(DhcpPacketOptionId id, String value) { var bytes = Encoding.ASCII.GetBytes(value); SetBytes(id, bytes); }
public Byte[] GetBytes(DhcpPacketOptionId id) { return(_options.ContainsKey(id) ? _options[id].Data : null); }
public void SetByte(DhcpPacketOptionId id, Byte value) { SetBytes(id, new Byte[] { value }); }
public String GetString(DhcpPacketOptionId id, String defaultValue = null) { return(_options.ContainsKey(id) ? Encoding.ASCII.GetString(_options[id].Data, 0, _options[id].Data.Length) : defaultValue); }
public IPAddress GetIpAAddress(DhcpPacketOptionId id, IPAddress defaultValue = null) { return(_options.ContainsKey(id) ? new IPAddress(_options[id].Data) : defaultValue); }
public Byte GetByte(DhcpPacketOptionId id, Byte defaultValue = 0) { return(_options.ContainsKey(id) ? _options[id].Data[0] : defaultValue); }
public UInt32 GetUInt32(DhcpPacketOptionId id, UInt32 defaultValue = 0) { var number = _options.ContainsKey(id) ? BitConverter.ToUInt32(_options[id].Data, 0) : defaultValue; return((UInt32)IPAddress.NetworkToHostOrder((int)number)); }
public Boolean Remove(DhcpPacketOptionId id) { return(_options.Remove(id)); }
public Boolean Exists(DhcpPacketOptionId id) { return(_options.ContainsKey(id)); }
public DhcpPacketOption(DhcpPacketOptionId id, Byte[] data) { Id = id; Data = data; }
public void SetBytes(DhcpPacketOptionId id, Byte[] value) { var option = new DhcpPacketOption(id, value); _options[id] = option; }
public void SetIpAAddress(DhcpPacketOptionId id, IPAddress value) { var bytes = value.GetAddressBytes(); SetBytes(id, bytes); }