Exemplo n.º 1
0
 public ConnectionRequestConfirmReplyMessage(List <DnmpNode> clients, ushort newId, IEndPoint newEndPoint, IEndPointFactory endPointFactory, ISymmetricKey key)
 {
     Clients              = clients;
     NewId                = newId;
     NewEndPoint          = newEndPoint;
     this.endPointFactory = endPointFactory;
     this.key             = key;
 }
Exemplo n.º 2
0
        public ConnectionNotificationMessage(byte[] data, IEndPointFactory endPointFactory)
        {
            var reader = new BigEndianBinaryReader(new MemoryStream(data));

            Client = new DnmpNode
            {
                Id         = reader.ReadUInt16(),
                EndPoint   = endPointFactory.DeserializeEndPoint(reader.ReadBytes(reader.ReadUInt16())),
                CustomData = reader.ReadBytes(reader.ReadUInt16())
            };
        }
Exemplo n.º 3
0
        public ConnectionRequestConfirmReplyMessage(byte[] data, IEndPointFactory endPointFactory, ISymmetricKey key)
        {
            var dataReader = new BigEndianBinaryReader(new MemoryStream(SymmetricHelper.Decrypt(key, data)));

            NewId       = dataReader.ReadUInt16();
            NewEndPoint = endPointFactory.DeserializeEndPoint(dataReader.ReadBytes(dataReader.ReadUInt16()));

            var clientCount = dataReader.ReadUInt16();

            for (var i = 0; i < clientCount; i++)
            {
                Clients.Add(new DnmpNode
                {
                    Id         = dataReader.ReadUInt16(),
                    ParentId   = dataReader.ReadUInt16(),
                    EndPoint   = endPointFactory.DeserializeEndPoint(dataReader.ReadBytes(dataReader.ReadUInt16())),
                    CustomData = dataReader.ReadBytes(dataReader.ReadUInt16())
                });
            }
        }
Exemplo n.º 4
0
 public ConnectionNotificationMessage(DnmpNode client, IEndPointFactory endPointFactory)
 {
     Client = client;
     this.endPointFactory = endPointFactory;
 }