mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-12 12:28:09 +02:00
NetBios: NodeStatusResponse: Added read constructor
This commit is contained in:
parent
156e9a0631
commit
c3f00c5757
1 changed files with 17 additions and 0 deletions
|
@ -19,6 +19,7 @@ namespace SMBLibrary.NetBios
|
|||
{
|
||||
public NameServicePacketHeader Header;
|
||||
public ResourceRecord Resource;
|
||||
// Resource Data:
|
||||
// byte NumberOfNames;
|
||||
public KeyValuePairList<string, NameFlags> Names = new KeyValuePairList<string, NameFlags>();
|
||||
public NodeStatistics Statistics;
|
||||
|
@ -33,6 +34,22 @@ namespace SMBLibrary.NetBios
|
|||
Statistics = new NodeStatistics();
|
||||
}
|
||||
|
||||
public NodeStatusResponse(byte[] buffer, int offset)
|
||||
{
|
||||
Header = new NameServicePacketHeader(buffer, ref offset);
|
||||
Resource = new ResourceRecord(buffer, ref offset);
|
||||
|
||||
int position = 0;
|
||||
byte numberOfNames = ByteReader.ReadByte(Resource.Data, ref position);
|
||||
for (int index = 0; index < numberOfNames; index++)
|
||||
{
|
||||
string name = ByteReader.ReadAnsiString(Resource.Data, ref position, 16);
|
||||
NameFlags nameFlags = (NameFlags)BigEndianReader.ReadUInt16(Resource.Data, ref position);
|
||||
Names.Add(name, nameFlags);
|
||||
}
|
||||
Statistics = new NodeStatistics(Resource.Data, ref position);
|
||||
}
|
||||
|
||||
public byte[] GetBytes()
|
||||
{
|
||||
Resource.Data = GetData();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue