示例#1
0
 public NameQueryRequest()
 {
     Header         = new NameServicePacketHeader();
     Header.OpCode  = NameServiceOperation.QueryRequest;
     Header.ARCount = 1;
     Question       = new QuestionSection();
 }
 public NodeStatusRequest()
 {
     Header        = new NameServicePacketHeader();
     Header.OpCode = NameServiceOperation.QueryRequest;
     Question      = new QuestionSection();
     Question.Type = NameRecordType.NBStat;
 }
 public PositiveNameQueryResponse()
 {
     Header         = new NameServicePacketHeader();
     Header.Flags   = OperationFlags.AuthoritativeAnswer | OperationFlags.RecursionDesired;
     Header.OpCode  = NameServiceOperation.QueryResponse;
     Header.ANCount = 1;
     Resource       = new ResourceRecord(NameRecordType.NB);
 }
示例#4
0
 public NameQueryRequest()
 {
     Header        = new NameServicePacketHeader();
     Header.OpCode = NameServiceOperation.QueryRequest;
     Header.Flags  = OperationFlags.RecursionDesired;
     Question      = new QuestionSection();
     Question.Type = NameRecordType.NB;
 }
示例#5
0
 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 byte[] Address; // IPv4 address

        public NameRegistrationRequest()
        {
            Header         = new NameServicePacketHeader();
            Header.OpCode  = NameServiceOperation.RegistrationRequest;
            Header.QDCount = 1;
            Header.ARCount = 1;
            Header.Flags   = OperationFlags.Broadcast | OperationFlags.RecursionDesired;
            Question       = new QuestionSection();
            Resource       = new ResourceRecord();
            Address        = new byte[4];
        }
示例#7
0
 public NodeStatusRequest()
 {
     Header = new NameServicePacketHeader
     {
         OpCode = NameServiceOperation.QueryRequest
     };
     Question = new QuestionSection
     {
         Type = NameRecordType.NBStat
     };
 }
示例#8
0
 public NameQueryRequest()
 {
     Header = new NameServicePacketHeader
     {
         OpCode = NameServiceOperation.QueryRequest,
         Flags  = OperationFlags.RecursionDesired
     };
     Question = new QuestionSection
     {
         Type = 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[] Address; // IPv4 address

        public NameRegistrationRequest()
        {
            Header = new NameServicePacketHeader
            {
                OpCode  = NameServiceOperation.RegistrationRequest,
                QDCount = 1,
                ARCount = 1,
                Flags   = OperationFlags.Broadcast | OperationFlags.RecursionDesired
            };
            Question = new QuestionSection();
            Resource = new ResourceRecord(NameRecordType.NB);
            Address  = new byte[4];
        }
示例#11
0
        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);
        }
示例#12
0
 public NodeStatusRequest(byte[] buffer, int offset)
 {
     Header   = new NameServicePacketHeader(buffer, ref offset);
     Question = new QuestionSection(buffer, ref offset);
 }