Beispiel #1
0
        /// <summary>
        /// Parse the module information.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the module information.</param>
        /// <param name="index">Index of the first byte of the module information in the MPEG2 section.</param>
        public void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                moduleTimeout = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex    += 4;

                blockTimeout = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex   += 4;

                minimumBlockTime = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex       += 4;

                tapsCount = (int)byteData[lastIndex];
                lastIndex++;

                if (tapsCount != 0)
                {
                    taps = new Collection <BIOPTap>();

                    while (taps.Count < tapsCount)
                    {
                        BIOPTap tap = new BIOPTap();
                        tap.Process(byteData, lastIndex);
                        taps.Add(tap);

                        lastIndex = tap.Index;
                    }
                }

                userInfoLength = (int)byteData[lastIndex];
                lastIndex++;

                if (userInfoLength != 0)
                {
                    descriptors = new Collection <BIOPDescriptor>();

                    while (userInfoLength > 0)
                    {
                        BIOPDescriptor descriptor = BIOPDescriptor.Create(byteData, lastIndex);
                        descriptors.Add(descriptor);

                        userInfoLength -= (descriptor.Index - lastIndex);
                        lastIndex       = descriptor.Index;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The BIOP Module Info message is short"));
            }
        }
Beispiel #2
0
        /// <summary>
        /// Parse the connection binder.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the connection binder.</param>
        /// <param name="index">Index of the first byte of the connection binder in the MPEG2 section.</param>
        public void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                componentIDTag = Utils.GetBytes(byteData, lastIndex, 4);
                lastIndex     += 4;

                dataLength = (int)byteData[lastIndex];
                lastIndex++;

                tapsCount = (int)byteData[lastIndex];
                lastIndex++;

                if (tapsCount != 0)
                {
                    taps = new Collection <BIOPTap>();

                    while (taps.Count != tapsCount)
                    {
                        BIOPTap tap = new BIOPTap();
                        tap.Process(byteData, lastIndex);
                        taps.Add(tap);

                        lastIndex = tap.Index;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The DSM Conn Binder message is short"));
            }
        }
Beispiel #3
0
        /// <summary>
        /// Parse the connection binder.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the connection binder.</param>
        /// <param name="index">Index of the first byte of the connection binder in the MPEG2 section.</param>
        public void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                componentIDTag = Utils.GetBytes(byteData, lastIndex, 4);
                lastIndex += 4;

                dataLength = (int)byteData[lastIndex];
                lastIndex++;

                tapsCount = (int)byteData[lastIndex];
                lastIndex++;

                if (tapsCount != 0)
                {
                    taps = new Collection<BIOPTap>();

                    while (taps.Count != tapsCount)
                    {
                        BIOPTap tap = new BIOPTap();
                        tap.Process(byteData, lastIndex);
                        taps.Add(tap);

                        lastIndex = tap.Index;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The DSM Conn Binder message is short"));
            }
        }
        /// <summary>
        /// Parse the gateway information.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the gateway information.</param>
        /// <param name="index">Index of the byte in the MPEG2 section following the gateway information.</param>
        public void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                iopIor = new IOPIOR();
                iopIor.Process(byteData, lastIndex);
                lastIndex = iopIor.Index;

                tapsCount = (int)byteData[lastIndex];
                lastIndex++;

                if (tapsCount != 0)
                {
                    taps = new Collection<BIOPTap>();

                    while (taps.Count < tapsCount)
                    {
                        BIOPTap tap = new BIOPTap();
                        tap.Process(byteData, lastIndex);
                        taps.Add(tap);

                        lastIndex = tap.Index;
                    }
                }

                serviceContextCount = (int)byteData[lastIndex];
                lastIndex++;

                if (serviceContextCount != 0)
                {
                    serviceContexts = new Collection<BIOPServiceContext>();

                    while (serviceContexts.Count < serviceContextCount)
                    {
                        BIOPServiceContext serviceContext = new BIOPServiceContext();
                        serviceContext.Process(byteData, lastIndex);
                        serviceContexts.Add(serviceContext);

                        lastIndex = serviceContext.Index;
                    }
                }

                userInfoLength = Utils.Convert2BytesToInt(byteData, lastIndex);
                lastIndex += 2;

                if (userInfoLength != 0)
                {
                    userInfo = Utils.GetBytes(byteData, lastIndex, userInfoLength);
                    lastIndex += userInfoLength;
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The Service Gateway Info message is short"));
            }
        }
Beispiel #5
0
        /// <summary>
        /// Parse the module information.
        /// </summary>
        /// <param name="byteData">The MPEG2 section containing the module information.</param>
        /// <param name="index">Index of the first byte of the module information in the MPEG2 section.</param>
        public void Process(byte[] byteData, int index)
        {
            lastIndex = index;

            try
            {
                moduleTimeout = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex += 4;

                blockTimeout = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex += 4;

                minimumBlockTime = Utils.Convert4BytesToInt(byteData, lastIndex);
                lastIndex += 4;

                tapsCount = (int)byteData[lastIndex];
                lastIndex++;

                if (tapsCount != 0)
                {
                    taps = new Collection<BIOPTap>();

                    while (taps.Count < tapsCount)
                    {
                        BIOPTap tap = new BIOPTap();
                        tap.Process(byteData, lastIndex);
                        taps.Add(tap);

                        lastIndex = tap.Index;
                    }
                }

                userInfoLength = (int)byteData[lastIndex];
                lastIndex++;

                if (userInfoLength != 0)
                {
                    descriptors = new Collection<BIOPDescriptor>();

                    while (userInfoLength > 0)
                    {
                        BIOPDescriptor descriptor = BIOPDescriptor.Create(byteData, lastIndex);
                        descriptors.Add(descriptor);

                        userInfoLength -= (descriptor.Index - lastIndex);
                        lastIndex = descriptor.Index;
                    }
                }

                Validate();
            }
            catch (IndexOutOfRangeException)
            {
                throw (new ArgumentOutOfRangeException("The BIOP Module Info message is short"));
            }
        }