mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-02-20 06:45:46 +00:00
ClientIdentifierOption: implemented Parse() and ToString() helper methods.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user