public NodeStatusResponse() { Header = new NameServicePacketHeader(); Header.OpCode = NameServiceOperation.QueryResponse; Header.Flags = OperationFlags.AuthoritativeAnswer | OperationFlags.RecursionAvailable; Header.ANCount = 1; Resource = new ResourceRecord(NameRecordType.NBStat); 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); }