Skip to content

Commit

Permalink
Version 2.0.2
Browse files Browse the repository at this point in the history
Renamed class and method(s) with "v4". Dhcpv6 is comming soon.
  • Loading branch information
maxlluky committed Dec 5, 2020
1 parent 2496bc1 commit edb8768
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 12 deletions.
Binary file modified DhcpDotNet/.vs/DhcpDotNet/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified DhcpDotNet/.vs/DhcpDotNet/v16/.suo
Binary file not shown.
2 changes: 1 addition & 1 deletion DhcpDotNet/DhcpDotNet/DhcpDotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Copyright>Copyright 2020</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/Marschall-dev/DhcpDotNet</RepositoryUrl>
<Version>2.0.1</Version>
<Version>2.0.2</Version>
<PackageTags>DHCP, DHCP Packet, DHCP Server, DHCP Client, Dynamic Host Configuration Protocol</PackageTags>
<NeutralLanguage>en</NeutralLanguage>
<PackageIcon>logo.png</PackageIcon>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

Expand All @@ -9,7 +8,7 @@ namespace DhcpDotNet
/// <summary>
/// Creates an empty predefined DHCP packet in the form of a byte array. Please visit RFC 2131 for detaied information: https://tools.ietf.org/html/rfc2131
/// </summary>
public class DhcpPacket
public class Dhcpv4Packet
{
/// <summary>
/// Message op code / message type. 1 = BOOTREQUEST, 2 = BOOTREPLY
Expand Down Expand Up @@ -164,12 +163,12 @@ public bool parsePacket(byte[] pPayload)
/// <summary>
/// Create a DHCP option, as listed in RFC 2132[13] and IANA registry with optionId-Enum
/// </summary>
public class DhcpOption
public class Dhcpv4Option
{
/// <summary>
/// Define the DHCP options to be created by name
/// </summary>
public dhcpOptionIds optionId { get; set; } = new dhcpOptionIds();
public dhcpv4OptionIds optionId { get; set; } = new dhcpv4OptionIds();

/// <summary>
/// Represents the optionId (enum) in bytes. This field is not required if you set optionId with enum.
Expand All @@ -192,7 +191,7 @@ public class DhcpOption
/// <returns></returns>
public byte[] buildDhcpOption()
{
if (Enum.IsDefined(typeof(dhcpOptionIds), optionId))
if (Enum.IsDefined(typeof(dhcpv4OptionIds), optionId))
{
object selected = Convert.ChangeType(optionId, optionId.GetTypeCode());
optionIdBytes = Convert.ToByte(selected, null);
Expand All @@ -202,9 +201,9 @@ public byte[] buildDhcpOption()
return result.Concat(optionValue).ToArray();
}

public List<DhcpOption> parseDhcpOptions(byte[] pPayload)
public List<Dhcpv4Option> parseDhcpOptions(byte[] pPayload)
{
List<DhcpOption> dhcpOptionList = new List<DhcpOption>();
List<Dhcpv4Option> dhcpOptionList = new List<Dhcpv4Option>();

using (MemoryStream memoryStream = new MemoryStream(pPayload))
{
Expand All @@ -223,7 +222,7 @@ public List<DhcpOption> parseDhcpOptions(byte[] pPayload)
dhcpOptionValueLength = binaryReader.ReadByte();
dhcpOptionValue = binaryReader.ReadBytes(Convert.ToInt32(dhcpOptionValueLength));

DhcpOption dhcpOption = new DhcpOption
Dhcpv4Option dhcpOption = new Dhcpv4Option
{
optionIdBytes = dhcpOptionID,
optionLength = dhcpOptionValueLength,
Expand All @@ -245,7 +244,7 @@ public List<DhcpOption> parseDhcpOptions(byte[] pPayload)
}
}

public enum dhcpOptionIds : ushort
public enum dhcpv4OptionIds : ushort
{
// BOOTP Vendor Information Extensions
Padding = 0,
Expand Down
24 changes: 24 additions & 0 deletions DhcpDotNet/DhcpDotNet/obj/Debug/DhcpDotNet.2.0.1.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>DhcpDotNet</id>
<version>2.0.1</version>
<authors>Marschall TM</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<licenseUrl>https://licenses.nuget.org/MIT</licenseUrl>
<icon>logo.png</icon>
<projectUrl>https://github.com/Marschall-dev/DhcpDotNet</projectUrl>
<description>Fully managed, cross platform (Windows, Mac, Linux) .NET library for creating DHCP packets</description>
<copyright>Copyright 2020</copyright>
<tags>DHCP, DHCP Packet, DHCP Server, DHCP Client, Dynamic Host Configuration Protocol</tags>
<repository url="https://github.com/Marschall-dev/DhcpDotNet" />
<dependencies>
<group targetFramework=".NETStandard2.0" />
</dependencies>
</metadata>
<files>
<file src="G:\Desktop\DhcpDotNet\DhcpDotNet\DhcpDotNet\bin\Debug\netstandard2.0\DhcpDotNet.dll" target="lib\netstandard2.0\DhcpDotNet.dll" />
<file src="G:\Desktop\DhcpDotNet\DhcpDotNet\logo.png" target="logo.png" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"projects": {
"G:\\Desktop\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet.csproj": {
"version": "2.0.1",
"version": "2.0.2",
"restore": {
"projectUniqueName": "G:\\Desktop\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet.csproj",
"projectName": "DhcpDotNet",
Expand Down
2 changes: 1 addition & 1 deletion DhcpDotNet/DhcpDotNet/obj/project.assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
"C:\\Users\\mluck\\.nuget\\packages\\": {}
},
"project": {
"version": "2.0.1",
"version": "2.0.2",
"restore": {
"projectUniqueName": "G:\\Desktop\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet\\DhcpDotNet.csproj",
"projectName": "DhcpDotNet",
Expand Down

0 comments on commit edb8768

Please sign in to comment.