ClientIdentifierOption: implemented Parse() and ToString() helper methods.

This commit is contained in:
Shreyas Zare
2022-04-30 12:01:48 +05:30
parent d1b528b0d6
commit 02242a9bdf

View File

@@ -1,6 +1,6 @@
/*
Technitium DNS Server
Copyright (C) 2021 Shreyas Zare (shreyas@technitium.com)
Copyright (C) 2022 Shreyas Zare (shreyas@technitium.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -47,6 +47,16 @@ namespace DnsServerCore.Dhcp.Options
#endregion
#region static
public static ClientIdentifierOption Parse(string clientIdentifier)
{
string[] parts = clientIdentifier.Split('-');
return new ClientIdentifierOption(byte.Parse(parts[0]), Convert.FromHexString(parts[1]));
}
#endregion
#region protected
protected override void ParseOptionValue(Stream s)
@@ -111,6 +121,11 @@ namespace DnsServerCore.Dhcp.Options
return hashCode;
}
public override string ToString()
{
return _type.ToString() + "-" + Convert.ToHexString(_identifier);
}
#endregion
#region properties