Exemplo n.º 1
0
        public eSuccessState ParseFACCHData(GSMParameters param, bool[] burstBufferC)
        {
            /* decode */
            if (Deconvolution(burstBufferC) == eCorrectionResult.Failed)
            {
                ErrorMessage = "(FACCH: Error in ConvolutionalCoder, maybe encrypted)";
                CryptedFrames++;
                return(eSuccessState.Unknown);
            }

            /* CRC check/fix */
            switch (CRCCheck())
            {
            case eCorrectionResult.Fixed:
                StatusMessage = "(FACCH: CRC Error recovered)";
                break;

            case eCorrectionResult.Failed:
                ErrorMessage = "(FACCH: CRC Error)";
                return(eSuccessState.Failed);
            }

            /* convert u[] to d[] bytes */
            PackBytes();
            DataBursts++;

            L2.Handle(param, this, L3, BurstBufferD);

            return(eSuccessState.Succeeded);
        }
Exemplo n.º 2
0
        public override eSuccessState ParseData(GSMParameters param, bool[] decodedBurst, int sequence)
        {
            /* ignore uplink to check if kraken still working */
            if (param.Dir == eLinkDirection.Uplink)
            {
                return(eSuccessState.Succeeded);
            }

            if (IsDummy(decodedBurst))
            {
                State = eBurstState.Idle;
                DummyBursts++;

                DummyBurstReceived(param);

                if (DumpRawData)
                {
                    StatusMessage = "Dummy Burst";
                }
                return(eSuccessState.Succeeded);
            }



            StoreBurstContext(param, decodedBurst, sequence);

            /* if FNs are consecutive */
            if (AllBurstsReceived())
            {
                ClearBurstContext();

                /* try to decrypt buffer if this is enabled */
                if (!HandleEncryption(param))
                {
                    State = eBurstState.CryptedTraffic;

                    if (param.ReportL1EncryptionErrors)
                    {
                        StatusMessage = "(Error in decryption)";
                    }

                    /* encrypted but no decryptor available, silently return */
                    return(eSuccessState.Unknown);
                }

                /* deinterleave the 4 bursts. the result is a 456 bit block. i[] to c[] */
                Deinterleave();

                /* undo convolutional coding c[] to u[] */
                if (Deconvolution() == eCorrectionResult.Failed)
                {
                    if (param.ReportL1EncryptionErrors)
                    {
                        if (!ChannelEncrypted)
                        {
                            StatusMessage = "(Error in ConvolutionalCoder - not encrypted)";
                        }
                        else
                        {
                            StatusMessage = "(Error in ConvolutionalCoder - encrypted, wrong keystream?)";
                        }
                    }

                    State = eBurstState.Failed;
                    return(eSuccessState.Unknown);
                }

                /* CRC check/fix */
                switch (CRCCheck())
                {
                case eCorrectionResult.Fixed:
                    StatusMessage = "(CRC Error recovered)";
                    break;

                case eCorrectionResult.Failed:
                    State        = eBurstState.Failed;
                    ErrorMessage = "(CRC Error)";
                    return(eSuccessState.Failed);
                }

                if (ChannelEncrypted)
                {
                    State = eBurstState.DecryptedTraffic;
                }
                else
                {
                    State = eBurstState.PlainTraffic;
                }

                if (ChannelEncrypted && DumpEncryptedMessageBits)
                {
                    if (StatusMessage != null)
                    {
                        StatusMessage += EncryptionBitString;
                    }
                    else
                    {
                        StatusMessage = EncryptionBitString;
                    }
                }

                EncryptionBitString = "";

                /* convert u[] to d[] bytes */
                PackBytes();

                DataBursts++;
                L2.Handle(param, this, L3, BurstBufferD);

                return(eSuccessState.Succeeded);
            }
            else
            {
                StatusMessage = null;
            }

            return(eSuccessState.Unknown);
        }
Exemplo n.º 3
0
        public override eSuccessState ParseData(GSMParameters param, bool[] decodedBurst, int sequence)
        {
            if (IsDummy(decodedBurst))
            {
                DummyBursts++;
                if (DumpRawData)
                {
                    StatusMessage = "Dummy Burst";
                }
                return(eSuccessState.Succeeded);
            }

            StoreBurstContext(param, decodedBurst, sequence);

            /* if FNs are consecutive */
            if (AllBurstsReceived())
            {
                /* clean up */
                ClearBurstContext();

                /* get all e[] bits and place in i[] */
                CopyEToI();

                /* deinterleave the 4 bursts. the result is a 456 bit block. i[] to c[] */
                Deinterleave();
                DataBursts++;

                if (Deconvolution() == eCorrectionResult.Failed)
                {
                    ErrorMessage = "(Error in ConvolutionalCoder)";
                    return(eSuccessState.Failed);
                }

                /* CRC check/fix */
                switch (CRCCheck())
                {
                case eCorrectionResult.Fixed:
                    StatusMessage = "(CRC Error recovered)";
                    break;

                case eCorrectionResult.Failed:
                    ErrorMessage = "(CRC Error)";
                    return(eSuccessState.Failed);
                }

                /* convert u[] to d[] bytes */
                PackBytes();

                /* BCCH and CCCH have L2 Pseudo Length */
                if ((BurstBufferD[0] & 3) != 1)
                {
                    ErrorMessage = "(Error in L2 Pseudo Length)";
                    return(eSuccessState.Failed);
                }
                L2.Handle(param, this, L3, BurstBufferD);

                return(eSuccessState.Succeeded);
            }
            else
            {
                StatusMessage = null;
            }

            return(eSuccessState.Unknown);
        }
Exemplo n.º 4
0
        public override eSuccessState ParseData(GSMParameters param, bool[] decodedBurst, int sequence)
        {
            if (IsDummy(decodedBurst))
            {
                State = eBurstState.Idle;
                DummyBursts++;

                /* don't treat SACCHs as a reliable source for end-of-connection detection */
                //DummyBurstReceived(param);

                if (DumpRawData)
                {
                    StatusMessage = "Dummy Burst";
                }

                TCHSeq = 0;
                return(eSuccessState.Succeeded);
            }

            bool isComplete;

            /* decide between normal SACCH and SACCH/TCH */
            if (!TCHType)
            {
                /* thats a SACCH */

                /* use the normal sequence parameter */
                StoreBurstContext(param, decodedBurst, sequence);

                /* the block is complete when 4 bursts of 4 consecutive FN were buffered */
                isComplete = AllBurstsReceived();
            }
            else
            {
                /* thats a SACCH/TCH */

                /* use an own counter */
                StoreBurstContext(param, decodedBurst, TCHSeq);

                /* when we caught four bursts, the block is complete */
                TCHSeq++;
                isComplete = TCHSeq > 3;
            }

            if (isComplete)
            {
                /* clean up */
                TCHSeq = 0;
                ClearBurstContext();

                /* try to decrypt buffer if this is enabled */
                if (!HandleEncryption(param))
                {
                    State = eBurstState.CryptedTraffic;

                    if (param.ReportL1EncryptionErrors)
                    {
                        StatusMessage = "(Error in decryption)";
                    }

                    /* encrypted but no decryptor available, silently return */
                    return(eSuccessState.Unknown);
                }

                /* deinterleave the 4 bursts. the result is a 456 bit block. i[] to c[] */
                Deinterleave();

                if (Deconvolution() == eCorrectionResult.Failed)
                {
                    if (param.ReportL1EncryptionErrors)
                    {
                        if (!ChannelEncrypted)
                        {
                            StatusMessage = "(Error in ConvolutionalCoder - not encrypted)";
                        }
                        else
                        {
                            StatusMessage = "(Error in ConvolutionalCoder - encrypted, wrong keystream?)";
                        }
                    }

                    State = eBurstState.Failed;
                    return(eSuccessState.Unknown);
                }

                /* CRC check/fix */
                switch (CRCCheck())
                {
                case eCorrectionResult.Fixed:
                    StatusMessage = "(CRC Error recovered)";
                    break;

                case eCorrectionResult.Failed:
                    State        = eBurstState.Failed;
                    ErrorMessage = "(CRC Error)";
                    return(eSuccessState.Failed);
                }

                if (ChannelEncrypted)
                {
                    State = eBurstState.DecryptedTraffic;
                }
                else
                {
                    State = eBurstState.PlainTraffic;
                }

                if (ChannelEncrypted && DumpEncryptedMessageBits)
                {
                    if (StatusMessage != null)
                    {
                        StatusMessage += EncryptionBitString;
                    }
                    else
                    {
                        StatusMessage = EncryptionBitString;
                    }
                }

                /* convert u[] to d[] bytes */
                PackBytes();

                DataBursts++;

                /* payload starts at octet 3 (GSM 04.04 7.1) */
                L2.Handle(param, this, L3, BurstBufferD, 2);

                return(eSuccessState.Succeeded);
            }
            else
            {
                StatusMessage = null;
            }

            return(eSuccessState.Unknown);
        }