mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-05 17:23:18 +02:00
NetBios: PositiveNameQueryResponse: Added read constructor
This commit is contained in:
parent
c3f00c5757
commit
254e78a969
1 changed files with 14 additions and 0 deletions
|
@ -21,6 +21,7 @@ namespace SMBLibrary.NetBios
|
|||
|
||||
public NameServicePacketHeader Header;
|
||||
public ResourceRecord Resource;
|
||||
// Resource Data:
|
||||
public KeyValuePairList<byte[], NameFlags> Addresses = new KeyValuePairList<byte[], NameFlags>();
|
||||
|
||||
public PositiveNameQueryResponse()
|
||||
|
@ -32,6 +33,19 @@ namespace SMBLibrary.NetBios
|
|||
Resource = new ResourceRecord(NameRecordType.NB);
|
||||
}
|
||||
|
||||
public PositiveNameQueryResponse(byte[] buffer, int offset)
|
||||
{
|
||||
Header = new NameServicePacketHeader(buffer, ref offset);
|
||||
Resource = new ResourceRecord(buffer, ref offset);
|
||||
int position = 0;
|
||||
while (position < Resource.Data.Length)
|
||||
{
|
||||
NameFlags nameFlags = (NameFlags)BigEndianReader.ReadUInt16(Resource.Data, ref position);
|
||||
byte[] address = ByteReader.ReadBytes(Resource.Data, ref position, 4);
|
||||
Addresses.Add(address, nameFlags);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] GetBytes()
|
||||
{
|
||||
Resource.Data = GetData();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue