Beispiel #1
0
        public virtual Security.AuthenticationBlock CreateAuthenticationBlock(SlpReader reader)
        {
            var result = new Security.AuthenticationBlock();
            result.Descriptor = reader.ReadInt16();
            var length = reader.ReadInt16();
            result.TimeStamp = reader.ReadDateTime();
            result.SpiString = reader.ReadString();

            result.Data = reader.ReadBytes(length);

            return result;
        }
Beispiel #2
0
        public virtual Security.AuthenticationBlock CreateAuthenticationBlock(SlpReader reader)
        {
            var result = new Security.AuthenticationBlock();

            result.Descriptor = reader.ReadInt16();
            var length = reader.ReadInt16();

            result.TimeStamp = reader.ReadDateTime();
            result.SpiString = reader.ReadString();

            result.Data = reader.ReadBytes(length);

            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Parses the binary data and returns an extension
        /// </summary>
        /// <param name="data">Data to parse. The data may contain multiple extensions, but only the first one is returned</param>
        /// <returns>New extension if the extension is supported</returns>
        internal ExtensionBase GetExtension(SlpReader reader)
        {
            var id = reader.ReadInt16();

            if (id < 0 || id > 0x8ff)
            {
                throw new ServiceProtocolException(ServiceErrorCode.OptionNotUnderstood, "The ID was out of the allowed range of possible values.");
            }

            if (id >= 0x400 && id < 0x800)
            {
                if (!_RegisteredExtensions.ContainsKey(id))
                {
                    throw new ServiceProtocolException(ServiceErrorCode.OptionNotUnderstood);
                }
            }

            if (!_RegisteredExtensions.ContainsKey(id))
            {
                return(null);
            }

            var result = (ExtensionBase)Services.Locator.GetInstance(_RegisteredExtensions[id]);

            return(result.Create(reader));
        }
Beispiel #4
0
        internal override void Create(SlpReader reader)
        {
            base.Create(reader);

            ErrorCode  = (ServiceErrorCode)reader.ReadInt16();
            Attributes = Services.Locator.GetInstance <AttributeCollection>(reader);
            ReadAuthBlocks(reader, AuthBlocks);
        }
Beispiel #5
0
        internal override void Create(SlpReader reader)
        {
            base.Create(reader);

            ErrorCode = (ServiceErrorCode)reader.ReadInt16();
            Attributes = Services.Locator.GetInstance<AttributeCollection>(reader);
            ReadAuthBlocks(reader, AuthBlocks);
        }
Beispiel #6
0
        /// <summary>
        /// Initalises a new extension from the received data
        /// </summary>
        /// <param name="data">byte array of data to parse</param>
        /// <returns>new UserDefined Extension</returns>
        internal override ExtensionBase Create(SlpReader reader)
        {
            var result = new UnknownExtension();
            result._Id = reader.ReadInt16();
            result.Offset = reader.ReadInt24();
            result.Data = reader.ReadBytes(result.Offset);

            return result;
        }
Beispiel #7
0
        /// <summary>
        /// Initalises a new extension from the received data
        /// </summary>
        /// <param name="data">byte array of data to parse</param>
        /// <returns>new UserDefined Extension</returns>
        internal override ExtensionBase Create(SlpReader reader)
        {
            var result = new UnknownExtension();

            result._Id    = reader.ReadInt16();
            result.Offset = reader.ReadInt24();
            result.Data   = reader.ReadBytes(result.Offset);

            return(result);
        }
Beispiel #8
0
        internal override void Create(SlpReader reader)
        {
            base.Create(reader);

            var tmp = reader.ReadInt16();
            var result = new ServiceEntry[tmp];
            for (int i = 0; i < tmp; i++)
            {
                result[i] = Slp.Services.Locator.GetInstance<ServiceEntry>(reader);
            }

            Services = new ReadOnlyCollection<ServiceEntry>(result);
        }
Beispiel #9
0
        internal override void Create(SlpReader reader)
        {
            base.Create(reader);

            ErrorCode     = (ServiceErrorCode)reader.ReadInt16();
            BootTimeStamp = reader.ReadDateTime();
            var url = reader.ReadString();

            Scopes.AddRange(reader.ReadList());
            Uri = new ServiceUri(url, Services.Locator.GetInstance <AttributeCollection>(reader));
            SpiStrings.AddRange(reader.ReadList());
            ReadAuthBlocks(reader, AuthBlocks);
        }
Beispiel #10
0
        internal override void Create(SlpReader reader)
        {
            base.Create(reader);

            var tmp    = reader.ReadInt16();
            var result = new ServiceEntry[tmp];

            for (int i = 0; i < tmp; i++)
            {
                result[i] = Slp.Services.Locator.GetInstance <ServiceEntry>(reader);
            }

            Services = new ReadOnlyCollection <ServiceEntry>(result);
        }
Beispiel #11
0
        /// <summary>
        /// Read the message bytes and set the properties on this instance
        /// </summary>
        /// <param name="reader"></param>
        internal virtual void Create(SlpReader reader)
        {
            reader.ReadInt24();

            var flags = reader.ReadByte();

            IsOverFlow  = (flags & 0x80) == 0x80;
            IsFresh     = (flags & 0x40) == 0x40;
            IsMulticast = (flags & 0x20) == 0x20;

            reader.ReadByte();
            _ExtensionOffset = reader.ReadInt24();
            MessageId        = reader.ReadInt16();
            Language         = reader.ReadString();
        }
Beispiel #12
0
        internal override void Create(SlpReader reader)
        {
            base.Create(reader);

            var tmp = reader.ReadInt16();

            if (tmp == 0xfff)
            {
                GetAllAuthorities = true;
            }
            else
            {
                NamingAuthority = reader.ReadString(tmp);
            }

            Scopes.AddRange(reader.ReadList());
        }
Beispiel #13
0
        /// <summary>
        /// Read the message bytes and set the properties on this instance
        /// </summary>
        /// <param name="reader"></param>
        internal virtual void Create(SlpReader reader)
        {
            reader.ReadInt24();

            var flags = reader.ReadByte();
            IsOverFlow = (flags & 0x80) == 0x80;
            IsFresh = (flags & 0x40) == 0x40;
            IsMulticast = (flags & 0x20) == 0x20;

            reader.ReadByte();
            _ExtensionOffset = reader.ReadInt24();
            MessageId = reader.ReadInt16();
            Language = reader.ReadString();
        }
Beispiel #14
0
        internal override void Create(SlpReader reader)
        {
            base.Create(reader);

            var tmp = reader.ReadInt16();
            if (tmp == 0xfff)
                GetAllAuthorities = true;
            else
                NamingAuthority = reader.ReadString(tmp);

            Scopes.AddRange(reader.ReadList());
        }
Beispiel #15
0
        internal override void Create(SlpReader reader)
        {
            base.Create(reader);

            ErrorCode = (ServiceErrorCode)reader.ReadInt16();
            BootTimeStamp = reader.ReadDateTime();
            var url = reader.ReadString();
            Scopes.AddRange(reader.ReadList());
            Uri = new ServiceUri(url, Services.Locator.GetInstance<AttributeCollection>(reader));
            SpiStrings.AddRange(reader.ReadList());
            ReadAuthBlocks(reader, AuthBlocks);
        }