public static bool isIPXE(this DHCPMessage message) { try { return(message.Options .Where(x => x.OptionType == (TDHCPOption)77) .Cast <DHCPOptionGeneric>() .Select(x => Encoding.ASCII.GetString(x.Data)) .Any(x => x.Equals("iPXE", StringComparison.InvariantCultureIgnoreCase))); } catch { return(false); } }
public static byte GetArch(this DHCPMessage message) { try { return(message.Options .Where(x => x.OptionType == TDHCPOption.ClientSystemArchitectureType) .Cast <DHCPOptionGeneric>() .Select(x => x.Data[1]) .First()); } catch { return(0); } }
public static string GetVendorClass(this DHCPMessage message) { var sb = new StringBuilder(); var strings = message.Options .Where(x => x.OptionType == TDHCPOption.VendorClassIdentifier) .Cast <DHCPOptionVendorClassIdentifier>() .Select(x => Encoding.ASCII.GetString(x.Data)); try { foreach (var s in strings) { sb.AppendLine(s); } } catch { } return(sb.ToString()); }
public static bool isPXE(this DHCPMessage message) => GetVendorClass(message).Contains("PXEClient");
public static bool isHTTP(this DHCPMessage message) => GetVendorClass(message).Contains("HTTPClient");