NetBIOS: Added QuestionClass enum

This commit is contained in:
Tal Aloni 2020-01-25 18:12:35 +02:00
parent 2227b7f9ae
commit 53706a840a
3 changed files with 14 additions and 5 deletions

View file

@ -0,0 +1,8 @@
namespace SMBLibrary.NetBios
{
public enum QuestionClass : ushort
{
In = 0x0001,
}
}

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved. /* Copyright (C) 2014-2020 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
* *
* You can redistribute this program and/or modify it under the terms of * You can redistribute this program and/or modify it under the terms of
* the GNU Lesser Public License as published by the Free Software Foundation, * the GNU Lesser Public License as published by the Free Software Foundation,
@ -18,8 +18,8 @@ namespace SMBLibrary.NetBios
public class QuestionSection public class QuestionSection
{ {
public string Name; public string Name;
public NameRecordType Type = NameRecordType.NB; // NB public NameRecordType Type;
public ushort Class = 0x0001; // IN public QuestionClass Class;
public QuestionSection() public QuestionSection()
{ {
@ -29,7 +29,7 @@ namespace SMBLibrary.NetBios
{ {
Name = NetBiosUtils.DecodeName(buffer, ref offset); Name = NetBiosUtils.DecodeName(buffer, ref offset);
Type = (NameRecordType)BigEndianReader.ReadUInt16(buffer, ref offset); Type = (NameRecordType)BigEndianReader.ReadUInt16(buffer, ref offset);
Class = BigEndianReader.ReadUInt16(buffer, ref offset); Class = (QuestionClass)BigEndianReader.ReadUInt16(buffer, ref offset);
} }
public void WriteBytes(Stream stream) public void WriteBytes(Stream stream)
@ -37,7 +37,7 @@ namespace SMBLibrary.NetBios
byte[] encodedName = NetBiosUtils.EncodeName(Name, String.Empty); byte[] encodedName = NetBiosUtils.EncodeName(Name, String.Empty);
ByteWriter.WriteBytes(stream, encodedName); ByteWriter.WriteBytes(stream, encodedName);
BigEndianWriter.WriteUInt16(stream, (ushort)Type); BigEndianWriter.WriteUInt16(stream, (ushort)Type);
BigEndianWriter.WriteUInt16(stream, Class); BigEndianWriter.WriteUInt16(stream, (ushort)Class);
} }
} }
} }

View file

@ -77,6 +77,7 @@
<Compile Include="NetBios\NameServicePackets\Enums\NameServiceOperation.cs" /> <Compile Include="NetBios\NameServicePackets\Enums\NameServiceOperation.cs" />
<Compile Include="NetBios\NameServicePackets\Enums\NetBiosSuffix.cs" /> <Compile Include="NetBios\NameServicePackets\Enums\NetBiosSuffix.cs" />
<Compile Include="NetBios\NameServicePackets\Enums\OperationFlags.cs" /> <Compile Include="NetBios\NameServicePackets\Enums\OperationFlags.cs" />
<Compile Include="NetBios\NameServicePackets\Enums\QuestionClass.cs" />
<Compile Include="NetBios\NameServicePackets\EnumStructures\NameFlags.cs" /> <Compile Include="NetBios\NameServicePackets\EnumStructures\NameFlags.cs" />
<Compile Include="NetBios\NameServicePackets\NameQueryRequest.cs" /> <Compile Include="NetBios\NameServicePackets\NameQueryRequest.cs" />
<Compile Include="NetBios\NameServicePackets\NameRegistrationRequest.cs" /> <Compile Include="NetBios\NameServicePackets\NameRegistrationRequest.cs" />