├── README.md ├── airprobe_rtlsdr.py ├── gr-gsm ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── COPYING ├── LICENSE ├── README.md ├── apps │ ├── CMakeLists.txt │ ├── README │ ├── grgsm_decode │ ├── grgsm_livemon │ ├── grgsm_livemon.grc │ ├── grgsm_scanner │ └── helpers │ │ ├── CMakeLists.txt │ │ ├── README │ │ ├── grgsm_capture.py │ │ └── grgsm_channelize.py ├── cmake │ ├── Modules │ │ ├── CMakeParseArgumentsCopy.cmake │ │ ├── CreateSymlink.cmake │ │ ├── FindCppUnit.cmake │ │ ├── FindGnuradioRuntime.cmake │ │ ├── FindLibosmocore.cmake │ │ ├── FindVolk.cmake │ │ ├── GrMiscUtils.cmake │ │ ├── GrPlatform.cmake │ │ ├── GrPython.cmake │ │ ├── GrSwig.cmake │ │ ├── GrTest.cmake │ │ └── gr-gsmConfig.cmake │ └── cmake_uninstall.cmake.in ├── docs │ ├── CMakeLists.txt │ └── doxygen │ │ ├── CMakeLists.txt │ │ ├── Doxyfile.in │ │ ├── Doxyfile.swig_doc.in │ │ ├── doxyxml │ │ ├── __init__.py │ │ ├── base.py │ │ ├── doxyindex.py │ │ ├── generated │ │ │ ├── __init__.py │ │ │ ├── compound.py │ │ │ ├── compoundsuper.py │ │ │ ├── index.py │ │ │ └── indexsuper.py │ │ └── text.py │ │ ├── other │ │ ├── group_defs.dox │ │ └── main_page.dox │ │ └── swig_doc.py ├── grc │ ├── CMakeLists.txt │ ├── decoding │ │ ├── CMakeLists.txt │ │ ├── gsm_control_channels_decoder.xml │ │ └── gsm_tch_f_decoder.xml │ ├── decryption │ │ ├── CMakeLists.txt │ │ └── gsm_decryption.xml │ ├── demapping │ │ ├── CMakeLists.txt │ │ ├── gsm_bcch_ccch_demapper.xml │ │ ├── gsm_bcch_ccch_sdcch4_demapper.xml │ │ ├── gsm_sdcch8_demapper.xml │ │ ├── gsm_tch_f_chans_demapper.xml │ │ └── gsm_universal_ctrl_chans_demapper.xml │ ├── flow_control │ │ ├── CMakeLists.txt │ │ ├── gsm_burst_fnr_filter.xml │ │ ├── gsm_burst_sdcch_subslot_filter.xml │ │ ├── gsm_burst_sdcch_subslot_splitter.xml │ │ ├── gsm_burst_timeslot_filter.xml │ │ ├── gsm_burst_timeslot_splitter.xml │ │ └── gsm_dummy_burst_filter.xml │ ├── gsm_block_tree.xml │ ├── misc_utils │ │ ├── CMakeLists.txt │ │ ├── gsm_burst_file_sink.xml │ │ ├── gsm_burst_file_source.xml │ │ ├── gsm_bursts_printer.xml │ │ ├── gsm_clock_offset_corrector.xml │ │ ├── gsm_controlled_const_source_f.xml │ │ ├── gsm_controlled_rotator_cc.xml │ │ ├── gsm_extract_immediate_assignment.xml │ │ ├── gsm_extract_system_info.xml │ │ ├── gsm_message_file_sink.xml │ │ ├── gsm_message_file_source.xml │ │ ├── gsm_message_printer.xml │ │ └── gsm_tmsi_dumper.xml │ ├── qa_utils │ │ ├── CMakeLists.txt │ │ ├── gsm_burst_sink.xml │ │ ├── gsm_burst_source.xml │ │ ├── gsm_message_sink.xml │ │ └── gsm_message_source.xml │ └── receiver │ │ ├── CMakeLists.txt │ │ ├── gsm_clock_offset_control.xml │ │ ├── gsm_cx_channel_hopper.xml │ │ ├── gsm_fcch_burst_tagger.xml │ │ ├── gsm_fcch_detector.xml │ │ ├── gsm_input.xml │ │ ├── gsm_receiver.xml │ │ ├── gsm_sch_detector.xml │ │ └── gsm_wideband_input.xml ├── hier_blocks │ ├── misc_utils │ │ └── gsm_clock_offset_corrector.grc │ └── receiver │ │ ├── gsm_fcch_detector.grc │ │ └── gsm_input.grc ├── include │ └── grgsm │ │ ├── CMakeLists.txt │ │ ├── api.h │ │ ├── decoding │ │ ├── CMakeLists.txt │ │ ├── control_channels_decoder.h │ │ └── tch_f_decoder.h │ │ ├── decryption │ │ ├── CMakeLists.txt │ │ └── decryption.h │ │ ├── demapping │ │ ├── CMakeLists.txt │ │ ├── tch_f_chans_demapper.h │ │ └── universal_ctrl_chans_demapper.h │ │ ├── endian.h │ │ ├── flow_control │ │ ├── CMakeLists.txt │ │ ├── burst_fnr_filter.h │ │ ├── burst_sdcch_subslot_filter.h │ │ ├── burst_sdcch_subslot_splitter.h │ │ ├── burst_timeslot_filter.h │ │ ├── burst_timeslot_splitter.h │ │ └── dummy_burst_filter.h │ │ ├── gsmtap.h │ │ ├── misc_utils │ │ ├── CMakeLists.txt │ │ ├── burst_file_sink.h │ │ ├── burst_file_source.h │ │ ├── bursts_printer.h │ │ ├── controlled_const_source_f.h │ │ ├── controlled_rotator_cc.h │ │ ├── extract_immediate_assignment.h │ │ ├── extract_system_info.h │ │ ├── message_file_sink.h │ │ ├── message_file_source.h │ │ ├── message_printer.h │ │ └── tmsi_dumper.h │ │ ├── plotting.hpp │ │ ├── qa_utils │ │ ├── CMakeLists.txt │ │ ├── burst_sink.h │ │ ├── burst_source.h │ │ ├── message_sink.h │ │ └── message_source.h │ │ └── receiver │ │ ├── CMakeLists.txt │ │ ├── clock_offset_control.h │ │ ├── cx_channel_hopper.h │ │ └── receiver.h ├── lib │ ├── CMakeLists.txt │ ├── decoding │ │ ├── AmrCoder.cpp │ │ ├── AmrCoder.h │ │ ├── BitVector.cpp │ │ ├── BitVector.h │ │ ├── GSM503Tables.cpp │ │ ├── GSM503Tables.h │ │ ├── GSM610Tables.cpp │ │ ├── GSM610Tables.h │ │ ├── GSM660Tables.cpp │ │ ├── GSM660Tables.h │ │ ├── Vector.h │ │ ├── Viterbi.h │ │ ├── ViterbiR204.cpp │ │ ├── ViterbiR204.h │ │ ├── cch.c │ │ ├── cch.h │ │ ├── control_channels_decoder_impl.cc │ │ ├── control_channels_decoder_impl.h │ │ ├── fire_crc.c │ │ ├── fire_crc.h │ │ ├── interleave.c │ │ ├── interleave.h │ │ ├── tch_f_decoder_impl.cc │ │ └── tch_f_decoder_impl.h │ ├── decryption │ │ ├── decryption_impl.cc │ │ └── decryption_impl.h │ ├── demapping │ │ ├── tch_f_chans_demapper_impl.cc │ │ ├── tch_f_chans_demapper_impl.h │ │ ├── universal_ctrl_chans_demapper_impl.cc │ │ └── universal_ctrl_chans_demapper_impl.h │ ├── flow_control │ │ ├── burst_fnr_filter_impl.cc │ │ ├── burst_fnr_filter_impl.h │ │ ├── burst_sdcch_subslot_filter_impl.cc │ │ ├── burst_sdcch_subslot_filter_impl.h │ │ ├── burst_sdcch_subslot_splitter_impl.cc │ │ ├── burst_sdcch_subslot_splitter_impl.h │ │ ├── burst_timeslot_filter_impl.cc │ │ ├── burst_timeslot_filter_impl.h │ │ ├── burst_timeslot_splitter_impl.cc │ │ ├── burst_timeslot_splitter_impl.h │ │ ├── dummy_burst_filter_impl.cc │ │ └── dummy_burst_filter_impl.h │ ├── misc_utils │ │ ├── burst_file_sink_impl.cc │ │ ├── burst_file_sink_impl.h │ │ ├── burst_file_source_impl.cc │ │ ├── burst_file_source_impl.h │ │ ├── bursts_printer_impl.cc │ │ ├── bursts_printer_impl.h │ │ ├── controlled_const_source_f_impl.cc │ │ ├── controlled_const_source_f_impl.h │ │ ├── controlled_rotator_cc_impl.cc │ │ ├── controlled_rotator_cc_impl.h │ │ ├── extract_immediate_assignment_impl.cc │ │ ├── extract_immediate_assignment_impl.h │ │ ├── extract_system_info_impl.cc │ │ ├── extract_system_info_impl.h │ │ ├── message_file_sink_impl.cc │ │ ├── message_file_sink_impl.h │ │ ├── message_file_source_impl.cc │ │ ├── message_file_source_impl.h │ │ ├── message_printer_impl.cc │ │ ├── message_printer_impl.h │ │ ├── tmsi_dumper_impl.cc │ │ └── tmsi_dumper_impl.h │ ├── qa_utils │ │ ├── burst_sink_impl.cc │ │ ├── burst_sink_impl.h │ │ ├── burst_source_impl.cc │ │ ├── burst_source_impl.h │ │ ├── message_sink_impl.cc │ │ ├── message_sink_impl.h │ │ ├── message_source_impl.cc │ │ └── message_source_impl.h │ └── receiver │ │ ├── clock_offset_control_impl.cc │ │ ├── clock_offset_control_impl.h │ │ ├── cx_channel_hopper_impl.cc │ │ ├── cx_channel_hopper_impl.h │ │ ├── gsm_constants.h │ │ ├── receiver_config.cc │ │ ├── receiver_config.h │ │ ├── receiver_impl.cc │ │ ├── receiver_impl.h │ │ ├── sch.c │ │ ├── sch.h │ │ ├── viterbi_detector.cc │ │ └── viterbi_detector.h ├── python │ ├── CMakeLists.txt │ ├── __init__.py │ ├── build_utils.py │ ├── build_utils_codes.py │ ├── misc_utils │ │ ├── arfcn.py │ │ ├── clock_offset_corrector.py │ │ └── hier_block.py │ ├── qa_arfcn.py │ ├── qa_burst_fnr_filter.py │ ├── qa_burst_printer.py │ ├── qa_burst_sdcch_subslot_filter.py │ ├── qa_burst_sdcch_subslot_splitter.py │ ├── qa_burst_timeslot_filter.py │ ├── qa_burst_timeslot_splitter.py │ ├── qa_decryption.py │ ├── qa_dummy_burst_filter.py │ ├── qa_message_printer.py │ ├── qa_message_source_sink.py │ └── receiver │ │ ├── README │ │ ├── chirpz.py │ │ ├── fcch_burst_tagger.py │ │ ├── fcch_detector.py │ │ ├── gsm_input.py │ │ ├── gsm_wideband_input.py │ │ └── sch_detector.py └── swig │ ├── CMakeLists.txt │ └── grgsm_swig.i ├── gsmframecoder.tar.gz ├── gsmframecoder ├── .cproject ├── .project ├── BitVector.cpp ├── BitVector.h ├── GSMFrameCoder2.cpp ├── GSMFrameCoder2.h ├── Vector.h └── test │ ├── BitVector.d │ ├── BitVector.o │ ├── GSMFrameCoder2.d │ ├── GSMFrameCoder2.o │ ├── gsmframecoder │ ├── makefile │ ├── objects.mk │ ├── sources.mk │ └── subdir.mk ├── kali-gsm-step1.sh ├── kali-gsm-step3.sh ├── kalibrate-hackrf ├── .gitignore ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── aclocal.m4 ├── autom4te.cache │ ├── output.0 │ ├── output.1 │ ├── requests │ ├── traces.0 │ └── traces.1 ├── bootstrap ├── compile ├── config.guess ├── config.h ├── config.h.in ├── config.log ├── config.status ├── config.sub ├── configure ├── configure.ac ├── depcomp ├── install-sh ├── ltmain.sh ├── missing ├── src │ ├── .deps │ │ ├── kal-arfcn_freq.Po │ │ ├── kal-c0_detect.Po │ │ ├── kal-circular_buffer.Po │ │ ├── kal-fcch_detector.Po │ │ ├── kal-kal.Po │ │ ├── kal-offset.Po │ │ ├── kal-usrp_source.Po │ │ └── kal-util.Po │ ├── Makefile │ ├── Makefile.am │ ├── Makefile.in │ ├── arfcn_freq.cc │ ├── arfcn_freq.h │ ├── c0_detect.cc │ ├── c0_detect.h │ ├── circular_buffer.cc │ ├── circular_buffer.h │ ├── fcch_detector.cc │ ├── fcch_detector.h │ ├── kal │ ├── kal.cc │ ├── offset.cc │ ├── offset.h │ ├── usrp_complex.h │ ├── usrp_source.cc │ ├── usrp_source.h │ ├── util.cc │ ├── util.h │ └── version.h └── stamp-h1 └── kraken ├── Kraken ├── A5Cpu.so ├── DeltaLookup.cpp ├── DeltaLookup.h ├── Fragment.cpp ├── Fragment.h ├── Kraken.cpp ├── Kraken.h ├── NcqDevice.cpp ├── NcqDevice.h ├── ServerCore.cpp ├── ServerCore.h ├── build.sh └── kraken ├── TableConvert ├── BaseReader.h ├── BaseWriter.h ├── DeltaReader.cpp ├── DeltaReader.h ├── DeltaWriter.cpp ├── DeltaWriter.h ├── Factory.cpp ├── Factory.h ├── IndexWriter.cpp ├── IndexWriter.h ├── Makefile ├── Md5Writer.cpp ├── Md5Writer.h ├── MultiFileReader.cpp ├── MultiFileReader.h ├── MultiFileWriter.cpp ├── MultiFileWriter.h ├── SSDreader.cpp ├── SSDreader.h ├── SSDwriter.cpp ├── SSDwriter.h ├── TableCompare.cpp ├── TableConvert.cpp ├── TableDump.cpp ├── md5.cpp └── md5.h ├── TableGeneration ├── A5Brook.cpp ├── A5Brook.h ├── A5BrookStubs.cpp ├── A5BrookStubs.h ├── A5Slice.cpp ├── A5Slice.h ├── CalDevice.cpp ├── CalDevice.h ├── CalModule.cpp ├── CalModule.h ├── GenTable.py ├── Makefile ├── MultiFileWriter.py ├── MultiFileWriter.pyc ├── brook │ ├── a5_slice.br │ ├── a5_slice_dpX.br │ └── gen_compressed_kernels.py ├── kernelLib.cpp ├── kernelLib.h ├── manual3.il.Z ├── my_kernel_dp11.Z ├── my_kernel_dp12.Z ├── my_kernel_dp13.Z ├── my_kernel_dp14.Z └── self_test.py ├── Utilities ├── A5Cpu.so ├── Bidirectional.cpp ├── Bidirectional.h ├── DeltaLookup.cpp ├── DeltaLookup.h ├── Makefile ├── MultiFileWriter.cpp ├── MultiFileWriter.h ├── SSDexploder ├── SSDexploder.cpp ├── SSDlookup.cpp ├── SSDlookup.h ├── SSDwriter ├── SSDwriter.cpp ├── TheMatrix.cpp ├── TheMatrix.h ├── a5faster.cpp ├── a5lookup ├── a5lookup.cpp ├── btest.cpp ├── checktable ├── checktable.cpp ├── chopper.cpp ├── extract ├── extract.cpp ├── find_kc ├── find_kc.cpp ├── getstate ├── getstate.cpp ├── simpletest ├── simpletest.cpp ├── sort2 ├── sort2.cpp ├── weaver.cpp └── xor.py ├── a5_ati ├── A5Ati.cpp ├── A5Ati.h ├── A5AtiStubs.cpp ├── A5AtiStubs.h ├── A5Slice.cpp ├── A5Slice.h ├── Advance.cpp ├── Advance.h ├── CalDevice.cpp ├── CalDevice.h ├── CalModule.cpp ├── CalModule.h ├── Makefile ├── brook │ ├── a5_slice.br │ ├── a5_slice_dpX.br │ └── gen_compressed_kernels.py ├── kernelLib.cpp ├── kernelLib.h ├── manual3.il.Z ├── my_kernel_dp11.Z ├── my_kernel_dp12.Z ├── my_kernel_dp13.Z └── my_kernel_dp14.Z ├── a5_cpu ├── A5Cpu.cpp ├── A5Cpu.h ├── A5Cpu.so ├── A5CpuStubs.cpp ├── A5CpuStubs.h ├── Advance.cpp ├── Advance.h ├── a5cpu_test ├── a5cpu_test.cpp └── build.sh ├── indexes ├── Behemoth.py └── tables.conf.sample └── unistd.patch /gr-gsm/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | *.o 3 | *.log 4 | *~ 5 | *.pyc 6 | *.pyo 7 | .unittests 8 | 9 | -------------------------------------------------------------------------------- /gr-gsm/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "test_data"] 2 | path = test_data 3 | url = https://github.com/ptrkrysik/test_data.git 4 | [submodule "examples"] 5 | path = examples 6 | url = https://github.com/ptrkrysik/examples.git 7 | -------------------------------------------------------------------------------- /gr-gsm/LICENSE: -------------------------------------------------------------------------------- 1 | @file 2 | @author Piotr Krysik 3 | @section LICENSE 4 | 5 | Gr-gsm is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | Gr-gsm is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with gr-gsm; see the file COPYING. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, 18 | Boston, MA 02110-1301, USA. 19 | 20 | -------------------------------------------------------------------------------- /gr-gsm/apps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | include(GrPython) 21 | include(CreateSymlink) 22 | add_subdirectory(helpers) 23 | 24 | GR_PYTHON_INSTALL( 25 | PROGRAMS 26 | grgsm_livemon 27 | grgsm_scanner 28 | grgsm_decode 29 | DESTINATION bin 30 | ) 31 | 32 | CREATE_SYMLINK(grgsm_livemon airprobe_rtlsdr.py) 33 | CREATE_SYMLINK(grgsm_decode airprobe_decode.py) 34 | CREATE_SYMLINK(grgsm_scanner airprobe_rtlsdr_scanner.py) 35 | 36 | add_custom_target(apps_symlinks ALL DEPENDS ${symlinks}) 37 | 38 | install( 39 | PROGRAMS 40 | ${symlinks} 41 | DESTINATION bin 42 | ) 43 | 44 | -------------------------------------------------------------------------------- /gr-gsm/apps/README: -------------------------------------------------------------------------------- 1 | This directory contains programs based on gr-gsm: 2 | * grgsm_decode (old name: airprobe_decode.py) - program for decoding C0 channel 3 | which is most close in terms of functionality to the old gsm-receiver 4 | from Airprobe project, with ability to decode signalling channels and traffic channels with speech 5 | (analysis of the data can be performed in Wireshark, decoded sound is stored to an audio file), 6 | * grgsm_livemon (old name: airprobe_rtlsdr.py) - interactive monitor of a single C0 channel with analysis 7 | ` performed by Wireshark (command to run wireshark: sudo wireshark -k -f udp -Y gsmtap -i lo), 8 | * grgsm_scanner (old name: airprobe_rtlsdr_scanner.py) - an application that scans GSM bands and prints 9 | information about base transceiver stations transmitting in the area. 10 | 11 | There are following helper programs for grgsm_decode program: 12 | 13 | * grgsm_capture (old name: airprobe_rtlsdr_capture.py) - program for capturing GSM signal to a file 14 | that can be later processed by grgsm_decode, 15 | * grgsm_channelize (old name: gsm_channelize.py) - splits wideband capture file into multiple files - each contain 16 | single GSM channel. 17 | 18 | -------------------------------------------------------------------------------- /gr-gsm/apps/helpers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | include(GrPython) 21 | include(CreateSymlink) 22 | 23 | GR_PYTHON_INSTALL( 24 | PROGRAMS 25 | grgsm_capture.py 26 | grgsm_channelize.py 27 | DESTINATION bin 28 | ) 29 | 30 | CREATE_SYMLINK(grgsm_capture.py airprobe_rtlsdr_capture.py) 31 | 32 | add_custom_target(helpers_symlinks ALL DEPENDS ${symlinks}) 33 | 34 | install( 35 | PROGRAMS 36 | ${symlinks} 37 | DESTINATION bin 38 | ) 39 | 40 | -------------------------------------------------------------------------------- /gr-gsm/apps/helpers/README: -------------------------------------------------------------------------------- 1 | Helper programs for grgsm_decode: 2 | 3 | -grgsm_capture (old name: airprobe_rtlsdr_capture.py) - program for capturing GSM signal to a file that can be later processed by grgsm_decode, 4 | 5 | -grgsm_channelize (old name: gsm_channelize.py) - splits wideband capture file into multiple files - each contain single GSM channel, 6 | -------------------------------------------------------------------------------- /gr-gsm/cmake/Modules/CreateSymlink.cmake: -------------------------------------------------------------------------------- 1 | #create logical links in order to keep legacy names of apps 2 | macro(CREATE_SYMLINK _source _dest) 3 | set(source ${CMAKE_CURRENT_SOURCE_DIR}/${_source}) 4 | set(dest ${CMAKE_CURRENT_BINARY_DIR}/${_dest}) 5 | list(APPEND symlinks ${dest}) 6 | add_custom_command( 7 | DEPENDS ${source} OUTPUT ${dest} 8 | COMMAND ln -sf ${_source} ${_dest} 9 | ) 10 | endmacro(CREATE_SYMLINK) 11 | -------------------------------------------------------------------------------- /gr-gsm/cmake/Modules/FindCppUnit.cmake: -------------------------------------------------------------------------------- 1 | # http://www.cmake.org/pipermail/cmake/2006-October/011446.html 2 | # Modified to use pkg config and use standard var names 3 | 4 | # 5 | # Find the CppUnit includes and library 6 | # 7 | # This module defines 8 | # CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc. 9 | # CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit. 10 | # CPPUNIT_FOUND, If false, do not try to use CppUnit. 11 | 12 | INCLUDE(FindPkgConfig) 13 | PKG_CHECK_MODULES(PC_CPPUNIT "cppunit") 14 | 15 | FIND_PATH(CPPUNIT_INCLUDE_DIRS 16 | NAMES cppunit/TestCase.h 17 | HINTS ${PC_CPPUNIT_INCLUDE_DIR} 18 | PATHS 19 | /usr/local/include 20 | /usr/include 21 | ) 22 | 23 | FIND_LIBRARY(CPPUNIT_LIBRARIES 24 | NAMES cppunit 25 | HINTS ${PC_CPPUNIT_LIBDIR} 26 | PATHS 27 | ${CPPUNIT_INCLUDE_DIRS}/../lib 28 | /usr/local/lib 29 | /usr/lib 30 | ) 31 | 32 | LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS}) 33 | 34 | INCLUDE(FindPackageHandleStandardArgs) 35 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) 36 | MARK_AS_ADVANCED(CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) 37 | -------------------------------------------------------------------------------- /gr-gsm/cmake/Modules/FindGnuradioRuntime.cmake: -------------------------------------------------------------------------------- 1 | INCLUDE(FindPkgConfig) 2 | PKG_CHECK_MODULES(PC_GNURADIO_RUNTIME gnuradio-runtime) 3 | 4 | if(PC_GNURADIO_RUNTIME_FOUND) 5 | # look for include files 6 | FIND_PATH( 7 | GNURADIO_RUNTIME_INCLUDE_DIRS 8 | NAMES gnuradio/top_block.h 9 | HINTS $ENV{GNURADIO_RUNTIME_DIR}/include 10 | ${PC_GNURADIO_RUNTIME_INCLUDE_DIRS} 11 | ${CMAKE_INSTALL_PREFIX}/include 12 | PATHS /usr/local/include 13 | /usr/include 14 | ) 15 | 16 | # look for libs 17 | FIND_LIBRARY( 18 | GNURADIO_RUNTIME_LIBRARIES 19 | NAMES gnuradio-runtime 20 | HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib 21 | ${PC_GNURADIO_RUNTIME_LIBDIR} 22 | ${CMAKE_INSTALL_PREFIX}/lib/ 23 | ${CMAKE_INSTALL_PREFIX}/lib64/ 24 | PATHS /usr/local/lib 25 | /usr/local/lib64 26 | /usr/lib 27 | /usr/lib64 28 | ) 29 | 30 | set(GNURADIO_RUNTIME_FOUND ${PC_GNURADIO_RUNTIME_FOUND}) 31 | endif(PC_GNURADIO_RUNTIME_FOUND) 32 | 33 | INCLUDE(FindPackageHandleStandardArgs) 34 | # do not check GNURADIO_RUNTIME_INCLUDE_DIRS, is not set when default include path us used. 35 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES) 36 | MARK_AS_ADVANCED(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS) 37 | -------------------------------------------------------------------------------- /gr-gsm/cmake/Modules/FindLibosmocore.cmake: -------------------------------------------------------------------------------- 1 | find_package(PkgConfig) 2 | pkg_check_modules(PC_libosmocore libosmocore) 3 | set(LIBOSMOCORE_DEFINITIONS ${PC_LIBOSMOCORE_CFLAGS_OTHER}) 4 | 5 | find_path( 6 | LIBOSMOCORE_INCLUDE_DIR 7 | NAMES osmocom/core/application.h 8 | HINTS ${PC_libosmocore_INCLUDEDIR} 9 | ${PC_libosmocore_INCLUDE_DIRS} 10 | ${CMAKE_INSTALL_PREFIX}/include 11 | PATHS /usr/local/include 12 | /usr/include 13 | ) 14 | 15 | find_library( 16 | LIBOSMOCORE_LIBRARY 17 | NAMES libosmocore osmocore 18 | HINTS ${PC_libosmocore_LIBDIR} 19 | ${PC_libosmocore_LIBRARY_DIRS} 20 | ${CMAKE_INSTALL_PREFIX}/lib/ 21 | ${CMAKE_INSTALL_PREFIX}/lib64/ 22 | PATHS /usr/local/lib 23 | /usr/lib 24 | ) 25 | 26 | find_library( 27 | LIBOSMOCORE_GSM_LIBRARY 28 | NAMES libosmogsm osmogsm 29 | HINTS ${PC_libosmocore_LIBDIR} 30 | ${PC_libosmocore_LIBRARY_DIRS} 31 | ${CMAKE_INSTALL_PREFIX}/lib/ 32 | ${CMAKE_INSTALL_PREFIX}/lib64/ 33 | PATHS /usr/local/lib 34 | /usr/lib 35 | ) 36 | 37 | set(LIBOSMOCORE_LIBRARIES ${LIBOSMOCORE_LIBRARY} ${LIBOSMOCORE_GSM_LIBRARY}) 38 | set(LIBOSMOCORE_INCLUDE_DIRS ${LIBOSMOCORE_INCLUDE_DIR}) 39 | 40 | include(FindPackageHandleStandardArgs) 41 | find_package_handle_standard_args(libosmocore DEFAULT_MSG LIBOSMOCORE_LIBRARY LIBOSMOCORE_INCLUDE_DIR) 42 | mark_as_advanced(LIBOSMOCORE_INCLUDE_DIR LIBOSMOCORE_LIBRARY ) 43 | -------------------------------------------------------------------------------- /gr-gsm/cmake/Modules/FindVolk.cmake: -------------------------------------------------------------------------------- 1 | INCLUDE(FindPkgConfig) 2 | PKG_CHECK_MODULES(PC_VOLK volk) 3 | 4 | FIND_PATH( 5 | VOLK_INCLUDE_DIRS 6 | NAMES volk/volk.h 7 | HINTS $ENV{VOLK_DIR}/include 8 | ${PC_VOLK_INCLUDEDIR} 9 | PATHS /usr/local/include 10 | /usr/include 11 | ) 12 | 13 | FIND_LIBRARY( 14 | VOLK_LIBRARIES 15 | NAMES volk 16 | HINTS $ENV{VOLK_DIR}/lib 17 | ${PC_VOLK_LIBDIR} 18 | PATHS /usr/local/lib 19 | /usr/local/lib64 20 | /usr/lib 21 | /usr/lib64 22 | ) 23 | 24 | INCLUDE(FindPackageHandleStandardArgs) 25 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(VOLK DEFAULT_MSG VOLK_LIBRARIES VOLK_INCLUDE_DIRS) 26 | MARK_AS_ADVANCED(VOLK_LIBRARIES VOLK_INCLUDE_DIRS) 27 | -------------------------------------------------------------------------------- /gr-gsm/cmake/Modules/GrPlatform.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | if(DEFINED __INCLUDED_GR_PLATFORM_CMAKE) 21 | return() 22 | endif() 23 | set(__INCLUDED_GR_PLATFORM_CMAKE TRUE) 24 | 25 | ######################################################################## 26 | # Setup additional defines for OS types 27 | ######################################################################## 28 | if(CMAKE_SYSTEM_NAME STREQUAL "Linux") 29 | set(LINUX TRUE) 30 | endif() 31 | 32 | if(LINUX AND EXISTS "/etc/debian_version") 33 | set(DEBIAN TRUE) 34 | endif() 35 | 36 | if(LINUX AND EXISTS "/etc/redhat-release") 37 | set(REDHAT TRUE) 38 | endif() 39 | 40 | ######################################################################## 41 | # when the library suffix should be 64 (applies to redhat linux family) 42 | ######################################################################## 43 | if(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") 44 | set(LIB_SUFFIX 64) 45 | endif() 46 | set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") 47 | -------------------------------------------------------------------------------- /gr-gsm/cmake/Modules/gr-gsmConfig.cmake: -------------------------------------------------------------------------------- 1 | INCLUDE(FindPkgConfig) 2 | PKG_CHECK_MODULES(PC_GR_GSM grgsm) 3 | 4 | FIND_PATH( 5 | GR_GSM_INCLUDE_DIRS 6 | NAMES grgsm/api.h 7 | HINTS $ENV{GR_GSM_DIR}/include 8 | ${PC_GR_GSM_INCLUDEDIR} 9 | PATHS ${CMAKE_INSTALL_PREFIX}/include 10 | /usr/local/include 11 | /usr/include 12 | ) 13 | 14 | FIND_LIBRARY( 15 | GR_GSM_LIBRARIES 16 | NAMES grgsm 17 | HINTS $ENV{GR_GSM_DIR}/lib 18 | ${PC_GR_GSM_LIBDIR} 19 | PATHS ${CMAKE_INSTALL_PREFIX}/lib 20 | ${CMAKE_INSTALL_PREFIX}/lib64 21 | /usr/local/lib 22 | /usr/local/lib64 23 | /usr/lib 24 | /usr/lib64 25 | ) 26 | 27 | INCLUDE(FindPackageHandleStandardArgs) 28 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(GR_GSM DEFAULT_MSG GR_GSM_LIBRARIES GR_GSM_INCLUDE_DIRS) 29 | MARK_AS_ADVANCED(GR_GSM_LIBRARIES GR_GSM_INCLUDE_DIRS) 30 | 31 | -------------------------------------------------------------------------------- /gr-gsm/cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F 2 | 3 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 5 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 | 7 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 8 | STRING(REGEX REPLACE "\n" ";" files "${files}") 9 | FOREACH(file ${files}) 10 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | IF(EXISTS "$ENV{DESTDIR}${file}") 12 | EXEC_PROGRAM( 13 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 14 | OUTPUT_VARIABLE rm_out 15 | RETURN_VALUE rm_retval 16 | ) 17 | IF(NOT "${rm_retval}" STREQUAL 0) 18 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 19 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 20 | ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") 21 | EXEC_PROGRAM( 22 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 23 | OUTPUT_VARIABLE rm_out 24 | RETURN_VALUE rm_retval 25 | ) 26 | IF(NOT "${rm_retval}" STREQUAL 0) 27 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 28 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 29 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 30 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 31 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 32 | ENDFOREACH(file) 33 | -------------------------------------------------------------------------------- /gr-gsm/docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | ######################################################################## 21 | # Setup dependencies 22 | ######################################################################## 23 | find_package(Doxygen) 24 | 25 | ######################################################################## 26 | # Begin conditional configuration 27 | ######################################################################## 28 | if(ENABLE_DOXYGEN) 29 | 30 | ######################################################################## 31 | # Add subdirectories 32 | ######################################################################## 33 | add_subdirectory(doxygen) 34 | 35 | endif(ENABLE_DOXYGEN) 36 | -------------------------------------------------------------------------------- /gr-gsm/docs/doxygen/doxyxml/generated/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains generated files produced by generateDS.py. 3 | 4 | These do the real work of parsing the doxygen xml files but the 5 | resultant classes are not very friendly to navigate so the rest of the 6 | doxyxml module processes them further. 7 | """ 8 | -------------------------------------------------------------------------------- /gr-gsm/docs/doxygen/other/group_defs.dox: -------------------------------------------------------------------------------- 1 | /*! 2 | * \defgroup block GNU Radio GSM C++ Signal Processing Blocks 3 | * \brief All C++ blocks that can be used from the GSM GNU Radio 4 | * module are listed here or in the subcategories below. 5 | * 6 | */ 7 | 8 | -------------------------------------------------------------------------------- /gr-gsm/docs/doxygen/other/main_page.dox: -------------------------------------------------------------------------------- 1 | /*! \mainpage 2 | 3 | Welcome to the GNU Radio GSM Block 4 | 5 | This is the intro page for the Doxygen manual generated for the GSM 6 | block (docs/doxygen/other/main_page.dox). Edit it to add more detailed 7 | documentation about the new GNU Radio modules contained in this 8 | project. 9 | 10 | */ 11 | -------------------------------------------------------------------------------- /gr-gsm/grc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | add_subdirectory(decoding) 21 | add_subdirectory(decryption) 22 | add_subdirectory(demapping) 23 | add_subdirectory(receiver) 24 | add_subdirectory(flow_control) 25 | add_subdirectory(misc_utils) 26 | install(FILES 27 | gsm_block_tree.xml DESTINATION share/gnuradio/grc/blocks 28 | ) 29 | -------------------------------------------------------------------------------- /gr-gsm/grc/decoding/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | install(FILES 21 | gsm_control_channels_decoder.xml 22 | gsm_tch_f_decoder.xml DESTINATION share/gnuradio/grc/blocks 23 | ) 24 | -------------------------------------------------------------------------------- /gr-gsm/grc/decoding/gsm_control_channels_decoder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Control channels decoder 4 | gsm_control_channels_decoder 5 | import grgsm 6 | grgsm.control_channels_decoder() 7 | 8 | bursts 9 | message 10 | 11 | 12 | msgs 13 | message 14 | 1 15 | 16 | 17 | -------------------------------------------------------------------------------- /gr-gsm/grc/decryption/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | install(FILES 21 | gsm_decryption.xml DESTINATION share/gnuradio/grc/blocks 22 | ) 23 | -------------------------------------------------------------------------------- /gr-gsm/grc/decryption/gsm_decryption.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Decryption 4 | gsm_decryption 5 | import grgsm 6 | grgsm.decryption($k_c, $a5_version) 7 | 8 | 9 | Kc session key 10 | k_c 11 | [0,0,0,0,0,0,0,0] 12 | int_vector 13 | 14 | 15 | 16 | A5 version 17 | a5_version 18 | 1 19 | int 20 | 21 | 22 | $a5_version > 0 23 | $a5_version < 5 24 | 25 | 26 | bursts 27 | message 28 | 29 | 30 | bursts 31 | message 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gr-gsm/grc/demapping/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | install(FILES 21 | gsm_universal_ctrl_chans_demapper.xml 22 | gsm_bcch_ccch_demapper.xml 23 | gsm_bcch_ccch_sdcch4_demapper.xml 24 | gsm_sdcch8_demapper.xml 25 | gsm_tch_f_chans_demapper.xml DESTINATION share/gnuradio/grc/blocks 26 | ) 27 | -------------------------------------------------------------------------------- /gr-gsm/grc/demapping/gsm_bcch_ccch_demapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | BCCH + CCCH demapper 4 | gsm_bcch_ccch_demapper 5 | import grgsm 6 | grgsm.universal_ctrl_chans_demapper($timeslot_nr, $starts_fn_mod51, $channel_types) 7 | 8 | 9 | Timeslot 10 | timeslot_nr 11 | 0 12 | int 13 | none 14 | 15 | 16 | 17 | starts_fn_mod51 18 | starts_fn_mod51 19 | [2,6,12,16,22,26,32,36,42,46] 20 | int_vector 21 | all 22 | 23 | 24 | 25 | channel_types 26 | channel_types 27 | [1,2,2,2,2,2,2,2,2,2] 28 | int_vector 29 | all 30 | 31 | 32 | 33 | bursts 34 | message 35 | 36 | 37 | bursts 38 | message 39 | 40 | 41 | 42 | Demapper for BCCH + CCCH control channels. 43 | This corresponds to channel combination iv specified in GSM 05.02, section 6.4 44 | 45 | 46 | -------------------------------------------------------------------------------- /gr-gsm/grc/demapping/gsm_bcch_ccch_sdcch4_demapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | BCCH + CCCH + SDCCH/4 demapper 4 | gsm_bcch_ccch_sdcch4_demapper 5 | import grgsm 6 | grgsm.universal_ctrl_chans_demapper($timeslot_nr, $starts_fn_mod51, $channel_types) 7 | 8 | 9 | Timeslot 10 | timeslot_nr 11 | 0 12 | int 13 | none 14 | 15 | 16 | 17 | starts_fn_mod51 18 | starts_fn_mod51 19 | [2,6,12,16,22,26,32,36,42,46] 20 | int_vector 21 | all 22 | 23 | 24 | 25 | channel_types 26 | channel_types 27 | [1,2,2,2,7,7,7,7,135,135] 28 | int_vector 29 | all 30 | 31 | 32 | 33 | bursts 34 | message 35 | 36 | 37 | bursts 38 | message 39 | 40 | 41 | 42 | Demapper for BCCH + CCCH + SDCCH/4 + SACCH/C4 control channels. 43 | This corresponds to channel combination v specified in GSM 05.02, section 6.4 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /gr-gsm/grc/demapping/gsm_sdcch8_demapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | SDCCH/8 demapper 4 | gsm_sdcch8_demapper 5 | import grgsm 6 | grgsm.universal_ctrl_chans_demapper($timeslot_nr, $starts_fn_mod51, $channel_types) 7 | 8 | 9 | Timeslot 10 | timeslot_nr 11 | 1 12 | int 13 | none 14 | 15 | 16 | 17 | starts_fn_mod51 18 | starts_fn_mod51 19 | [0,4,8,12,16,20,24,28,32,36,40,44] 20 | int_vector 21 | all 22 | 23 | 24 | 25 | channel_types 26 | channel_types 27 | [8,8,8,8,8,8,8,8,136,136,136,136] 28 | int_vector 29 | all 30 | 31 | 32 | 33 | bursts 34 | message 35 | 36 | 37 | bursts 38 | message 39 | 40 | 41 | 42 | Demapper for SDCCH/8 + SACCH/C8 control channels. 43 | This corresponds to channel combination vii specified in GSM 05.02, section 6.4 44 | 45 | -------------------------------------------------------------------------------- /gr-gsm/grc/demapping/gsm_tch_f_chans_demapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | TCH/F chans demapper 4 | gsm_tch_f_chans_demapper 5 | import grgsm 6 | grgsm.tch_f_chans_demapper($timeslot_nr) 7 | 8 | 9 | timeslot_nr 10 | timeslot_nr 11 | 2 12 | int 13 | part 14 | 15 | 16 | 17 | bursts 18 | message 19 | 20 | 21 | tch_bursts 22 | message 23 | 24 | 25 | acch_bursts 26 | message 27 | 28 | 29 | -------------------------------------------------------------------------------- /gr-gsm/grc/demapping/gsm_universal_ctrl_chans_demapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Universal ctrl chans demapper 4 | gsm_universal_ctrl_chans_demapper 5 | import grgsm 6 | grgsm.universal_ctrl_chans_demapper($timeslot_nr, $starts_fn_mod51, $channel_types) 7 | 8 | 9 | timeslot_nr 10 | timeslot_nr 11 | 0 12 | int 13 | part 14 | 15 | 16 | 17 | starts_fn_mod51 18 | starts_fn_mod51 19 | [2,6,12,16,22,26,32,36,42,46] 20 | int_vector 21 | part 22 | 23 | 24 | 25 | channel_types 26 | channel_types 27 | [1,2,2,2,2,2,2,2,2,2] 28 | int_vector 29 | part 30 | 31 | 32 | 33 | bursts 34 | message 35 | 36 | 37 | bursts 38 | message 39 | 40 | 41 | -------------------------------------------------------------------------------- /gr-gsm/grc/flow_control/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | install(FILES 21 | gsm_burst_timeslot_splitter.xml 22 | gsm_burst_fnr_filter.xml 23 | gsm_burst_timeslot_filter.xml 24 | gsm_dummy_burst_filter.xml 25 | gsm_burst_sdcch_subslot_splitter.xml 26 | gsm_burst_sdcch_subslot_filter.xml DESTINATION share/gnuradio/grc/blocks 27 | ) 28 | -------------------------------------------------------------------------------- /gr-gsm/grc/flow_control/gsm_burst_fnr_filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Burst framenumber filter 4 | gsm_burst_fnr_filter 5 | import grgsm 6 | grgsm.burst_fnr_filter($mode, $fnr) 7 | 8 | 9 | Mode 10 | mode 11 | enum 12 | 16 | 20 | 21 | 22 | Framenumber 23 | fnr 24 | 1500123 25 | int 26 | 27 | 28 | 29 | in 30 | message 31 | 32 | 33 | 34 | out 35 | message 36 | 1 37 | 38 | 39 | 40 | Burst framenumber filter forwards only blocks with a framenumber satisfying the configured mode, i.e. if mode is "Less or equal", then only bursts with a smaller or equal framenumber are forwarded. 41 | 42 | 43 | -------------------------------------------------------------------------------- /gr-gsm/grc/flow_control/gsm_burst_sdcch_subslot_filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Burst SDCCH subslot filter 4 | gsm_burst_sdcch_subslot_filter 5 | import grgsm 6 | grgsm.burst_sdcch_subslot_filter($mode, $subslot) 7 | 8 | 9 | Mode 10 | mode 11 | enum 12 | 16 | 20 | 21 | 22 | 23 | Subslot 24 | subslot 25 | 0 26 | int 27 | none 28 | 29 | 30 | 31 | in 32 | message 33 | 34 | 35 | 36 | out 37 | message 38 | 1 39 | 40 | 41 | 42 | This block forwards only bursts in the subslot given by the parameter 43 | 44 | -------------------------------------------------------------------------------- /gr-gsm/grc/flow_control/gsm_burst_sdcch_subslot_splitter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Burst SDCCH subslot splitter 4 | gsm_burst_sdcch_subslot_splitter 5 | import grgsm 6 | grgsm.burst_sdcch_subslot_splitter( 7 | #if int($ports())==4 # 8 | grgsm.SPLITTER_SDCCH4 9 | #else 10 | grgsm.SPLITTER_SDCCH8 11 | #end if 12 | ) 13 | 14 | 15 | Mode 16 | ports 17 | enum 18 | 22 | 26 | 27 | 28 | 29 | in 30 | message 31 | 32 | 33 | 34 | out 35 | message 36 | $ports 37 | 1 38 | 39 | 40 | 41 | Burst SDCCH subslot splitter distributes bursts to eight different output ports depending on the subslots to which the bursts belong. 42 | This means subslot 0 bursts are sent to port out0, subslot 1 bursts on port out1, and so on. 43 | 44 | -------------------------------------------------------------------------------- /gr-gsm/grc/flow_control/gsm_burst_timeslot_filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Burst timeslot filter 4 | gsm_burst_timeslot_filter 5 | import grgsm 6 | grgsm.burst_timeslot_filter($timeslot) 7 | 8 | 9 | Timeslot 10 | timeslot 11 | 0 12 | int 13 | none 14 | 15 | 16 | 17 | in 18 | message 19 | 20 | 21 | 22 | out 23 | message 24 | 1 25 | 26 | 27 | 28 | This block forwards only bursts in the timeslot given by the parameter 29 | 30 | 31 | -------------------------------------------------------------------------------- /gr-gsm/grc/flow_control/gsm_burst_timeslot_splitter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Burst timeslot splitter 4 | gsm_burst_timeslot_splitter 5 | import grgsm 6 | grgsm.burst_timeslot_splitter() 7 | 8 | 9 | in 10 | message 11 | 12 | 13 | 14 | out 15 | message 16 | 8 17 | 1 18 | 19 | 20 | 21 | Burst timeslot splitter distributes bursts to eight different output ports depending on the timeslots of the bursts. 22 | This means timeslot 0 bursts are sent to port out0, timeslot 1 bursts on port out1, and so on. 23 | 24 | 25 | -------------------------------------------------------------------------------- /gr-gsm/grc/flow_control/gsm_dummy_burst_filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Dummy burst filter 4 | gsm_dummy_burst_filter 5 | import grgsm 6 | grgsm.dummy_burst_filter() 7 | 8 | 9 | in 10 | message 11 | 12 | 13 | 14 | out 15 | message 16 | 1 17 | 18 | 19 | 20 | This block filters dummy bursts. 21 | 22 | For more information on dummy bursts, see GSM 05.02. 23 | 24 | 25 | -------------------------------------------------------------------------------- /gr-gsm/grc/misc_utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | install(FILES 21 | gsm_extract_system_info.xml 22 | gsm_extract_immediate_assignment.xml 23 | gsm_controlled_rotator_cc.xml 24 | gsm_controlled_const_source_f.xml 25 | gsm_message_printer.xml 26 | gsm_bursts_printer.xml 27 | gsm_clock_offset_corrector.xml 28 | gsm_tmsi_dumper.xml 29 | gsm_burst_file_sink.xml 30 | gsm_burst_file_source.xml 31 | gsm_message_file_sink.xml 32 | gsm_message_file_source.xml DESTINATION share/gnuradio/grc/blocks 33 | ) 34 | -------------------------------------------------------------------------------- /gr-gsm/grc/misc_utils/gsm_burst_file_sink.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Burst file sink 4 | gsm_burst_file_sink 5 | import grgsm 6 | grgsm.burst_file_sink($filename) 7 | 8 | 9 | Destination file 10 | filename 11 | /tmp/bursts 12 | file_open 13 | 14 | 15 | 16 | in 17 | message 18 | 19 | 20 | -------------------------------------------------------------------------------- /gr-gsm/grc/misc_utils/gsm_burst_file_source.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Burst file source 4 | gsm_burst_file_source 5 | import grgsm 6 | grgsm.burst_file_source($filename) 7 | 8 | 9 | Source file 10 | filename 11 | /tmp/bursts 12 | file_open 13 | 14 | 15 | 16 | out 17 | message 18 | 19 | 20 | -------------------------------------------------------------------------------- /gr-gsm/grc/misc_utils/gsm_clock_offset_corrector.xml: -------------------------------------------------------------------------------- 1 | 2 | Clock offset corrector 3 | gsm_clock_offset_corrector 4 | import grgsm 5 | grgsm.clock_offset_corrector( 6 | fc=$fc, 7 | ppm=$ppm, 8 | samp_rate_in=$samp_rate_in, 9 | ) 10 | set_fc($fc) 11 | set_ppm($ppm) 12 | set_samp_rate_in($samp_rate_in) 13 | 14 | fc 15 | fc 16 | fc 17 | float 18 | 19 | 20 | ppm 21 | ppm 22 | ppm 23 | float 24 | 25 | 26 | samp_rate_in 27 | samp_rate_in 28 | samp_rate_in 29 | float 30 | 31 | 32 | in 33 | complex 34 | 1 35 | 36 | 37 | ppm_in 38 | message 39 | True 40 | 41 | 42 | out 43 | complex 44 | 1 45 | 46 | Piotr Krysik 47 | 48 | -------------------------------------------------------------------------------- /gr-gsm/grc/misc_utils/gsm_controlled_const_source_f.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Controlled const source 4 | gsm_controlled_const_source_f 5 | import grgsm 6 | grgsm.controlled_const_source_f($constant) 7 | set_constant($constant) 8 | 9 | 10 | constant 11 | constant 12 | 0 13 | float 14 | 15 | 16 | 17 | constant_msg 18 | message 19 | 1 20 | 21 | 22 | 23 | out 24 | float 25 | 26 | 27 | -------------------------------------------------------------------------------- /gr-gsm/grc/misc_utils/gsm_controlled_rotator_cc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Controlled rotator 4 | gsm_controlled_rotator_cc 5 | import grgsm 6 | grgsm.controlled_rotator_cc($phase_inc,$samp_rate) 7 | set_phase_inc($phase_inc) 8 | set_samp_rate($samp_rate) 9 | 10 | phase_inc 11 | phase_inc 12 | 0 13 | real 14 | 15 | 16 | 17 | samp_rate 18 | samp_rate 19 | samp_rate 20 | real 21 | 22 | 23 | 24 | in 25 | complex 26 | 27 | 28 | phase_inc 29 | float 30 | 31 | 32 | 33 | out 34 | complex 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /gr-gsm/grc/misc_utils/gsm_extract_system_info.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Extract system info 4 | gsm_extract_system_info 5 | import grgsm 6 | grgsm.extract_system_info() 7 | 8 | 9 | msgs 10 | message 11 | 12 | 13 | 14 | bursts 15 | message 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /gr-gsm/grc/misc_utils/gsm_message_file_sink.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Message file sink 4 | gsm_message_file_sink 5 | import grgsm 6 | grgsm.message_file_sink($filename) 7 | 8 | 9 | Destination file 10 | filename 11 | /tmp/output.msg 12 | file_open 13 | 14 | 15 | 16 | in 17 | message 18 | 19 | 20 | 21 | This block stores incoming gsm messages to a file. 22 | 23 | 24 | -------------------------------------------------------------------------------- /gr-gsm/grc/misc_utils/gsm_message_file_source.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Message file source 4 | gsm_message_file_source 5 | import grgsm 6 | grgsm.message_file_source($filename) 7 | 8 | 9 | Source file 10 | filename 11 | /tmp/output.msg 12 | file_open 13 | 14 | 15 | 16 | out 17 | message 18 | 19 | 20 | 21 | This block outputs gsm messages stored in a file. 22 | 23 | 24 | -------------------------------------------------------------------------------- /gr-gsm/grc/misc_utils/gsm_message_printer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Message printer 4 | gsm_message_printer 5 | import grgsm 6 | import pmt 7 | grgsm.message_printer(pmt.intern($prepend_string), $prepend_fnr, 8 | $prepend_frame_count, $print_gsmtap_header) 9 | 10 | 11 | Prepend String 12 | prepend_string 13 | 14 | string 15 | part 16 | 17 | 18 | Prepend Frame Number 19 | prepend_fnr 20 | False 21 | bool 22 | 26 | 30 | 31 | 32 | Prepend Frame Count 33 | prepend_frame_count 34 | False 35 | bool 36 | 40 | 44 | 45 | 46 | Print GSMTap header 47 | print_gsmtap_header 48 | False 49 | bool 50 | 54 | 58 | 59 | 60 | 61 | msgs 62 | message 63 | 64 | 65 | -------------------------------------------------------------------------------- /gr-gsm/grc/misc_utils/gsm_tmsi_dumper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | TMSI Dumper 4 | gsm_tmsi_dumper 5 | import grgsm 6 | import pmt 7 | grgsm.tmsi_dumper() 8 | 9 | 10 | msgs 11 | message 12 | 13 | 14 | -------------------------------------------------------------------------------- /gr-gsm/grc/qa_utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | install(FILES 21 | gsm_burst_source.xml 22 | gsm_burst_sink.xml 23 | gsm_message_source.xml 24 | gsm_message_sink.xml DESTINATION share/gnuradio/grc/blocks 25 | ) 26 | -------------------------------------------------------------------------------- /gr-gsm/grc/qa_utils/gsm_burst_sink.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Burst sink 4 | gsm_burst_sink 5 | import grgsm 6 | grgsm.burst_sink() 7 | 8 | 9 | in 10 | message 11 | 12 | 13 | -------------------------------------------------------------------------------- /gr-gsm/grc/qa_utils/gsm_burst_source.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Burst source 4 | gsm_burst_source 5 | import grgsm 6 | grgsm.burst_source($framenumbers, $timeslots, $bursts) 7 | 8 | 9 | Frame numbers 10 | framenumbers 11 | [] 12 | int_vector 13 | part 14 | 15 | 16 | 17 | Timeslots 18 | timeslots 19 | [] 20 | int_vector 21 | part 22 | 23 | 24 | 25 | Bursts 26 | bursts 27 | [[],] 28 | raw 29 | 30 | 31 | 32 | out 33 | message 34 | 35 | 36 | -------------------------------------------------------------------------------- /gr-gsm/grc/qa_utils/gsm_message_sink.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Message Sink 4 | gsm_message_sink 5 | import grgsm 6 | grgsm.message_sink() 7 | 8 | 9 | in 10 | message 11 | 12 | 13 | 14 | This block is a message sink for testing purposes. 15 | 16 | The data can be retrieved using function get_messages() 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /gr-gsm/grc/qa_utils/gsm_message_source.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Message Source 4 | gsm_message_source 5 | import grgsm 6 | grgsm.message_source($messages) 7 | 8 | 9 | Messages 10 | messages 11 | ["02 04 01 00 00 00 c9 00 00 1d 3c e5 02 00 01 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", 12 | "02 04 01 00 00 00 ca 00 00 1d 3c e9 02 00 02 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b", 13 | "02 04 01 00 00 00 cb 00 00 1d 3d 0e 01 00 00 00 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff e5 04 00", 14 | "02 04 01 00 00 00 cb 00 00 1d 3d 12 02 00 00 00 15 06 21 00 01 f0 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b"] 15 | raw 16 | true 17 | 18 | 19 | 20 | msgs 21 | message 22 | 23 | 24 | 25 | This block is a basic message source for testing purposes. 26 | 27 | It takes a list of strings as input, where each string 28 | is a whitespace-separated list of hexadecimal values representing the data bytes of a message including the gsmtap header. 29 | 30 | Such strings can be obtained using the message printer with option "Print GSMTap header" 31 | 32 | 33 | -------------------------------------------------------------------------------- /gr-gsm/grc/receiver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | install(FILES 21 | gsm_input.xml 22 | gsm_wideband_input.xml 23 | gsm_receiver.xml 24 | gsm_fcch_burst_tagger.xml 25 | gsm_sch_detector.xml 26 | gsm_fcch_detector.xml 27 | gsm_cx_channel_hopper.xml 28 | gsm_clock_offset_control.xml DESTINATION share/gnuradio/grc/blocks 29 | ) 30 | -------------------------------------------------------------------------------- /gr-gsm/grc/receiver/gsm_clock_offset_control.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | GSM clock offset control 4 | gsm_clock_offset_control 5 | import grgsm 6 | grgsm.clock_offset_control($fc) 7 | 8 | 9 | fc 10 | fc 11 | fc 12 | float 13 | 14 | 15 | 16 | measurements 17 | message 18 | 19 | 20 | 21 | ppm 22 | message 23 | 1 24 | 25 | 26 | -------------------------------------------------------------------------------- /gr-gsm/grc/receiver/gsm_cx_channel_hopper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | CX channel hopper 4 | gsm_cx_channel_hopper 5 | import grgsm 6 | grgsm.cx_channel_hopper($ma, $maio, $hsn) 7 | 8 | MA 9 | ma 10 | [] 11 | int_vector 12 | 13 | 14 | 15 | MAIO 16 | maio 17 | int 18 | 19 | 20 | 21 | HSN 22 | hsn 23 | int 24 | 25 | 26 | 27 | CX 28 | message 29 | 30 | 31 | 32 | bursts 33 | message 34 | 35 | 36 | -------------------------------------------------------------------------------- /gr-gsm/grc/receiver/gsm_fcch_burst_tagger.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | FCCH burst tagger 4 | gsm_fcch_burst_tagger 5 | import grgsm 6 | grgsm.fcch_burst_tagger($OSR) 7 | 8 | OSR 9 | OSR 10 | int 11 | 12 | 13 | 14 | in 15 | complex 16 | 17 | 18 | 19 | threshold 20 | float 21 | 22 | 23 | 24 | out 25 | complex 26 | 27 | 28 | -------------------------------------------------------------------------------- /gr-gsm/grc/receiver/gsm_fcch_detector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | FCCH bursts detector 4 | gsm_fcch_detector 5 | import grgsm 6 | grgsm.fcch_detector($OSR) 7 | set_OSR($OSR) 8 | 9 | OverSamplingRatio 10 | OSR 11 | 4 12 | int 13 | 14 | 15 | in 16 | complex 17 | 1 18 | 19 | 20 | out 21 | complex 22 | 1 23 | 24 | Piotr Krysik 25 | Detects positions of FCCH bursts. At the end of each detected FCCH burst adds to the stream a tag with key "fcch" and value which is a frequency offset estimate. The input sampling frequency should be integer multiply of GSM GMKS symbol rate - 1625000/6 Hz. 26 | /home/piotr/Odbiornik_gsm/gr-gsm/examples/gsm_fcch_detector.grc 27 | 28 | -------------------------------------------------------------------------------- /gr-gsm/grc/receiver/gsm_input.xml: -------------------------------------------------------------------------------- 1 | 2 | GSM input adaptor 3 | gsm_input 4 | 5 | import grgsm 6 | grgsm.gsm_input( 7 | ppm=$ppm, 8 | osr=$osr, 9 | fc=$fc, 10 | samp_rate_in=$samp_rate_in, 11 | ) 12 | set_ppm($ppm) 13 | set_osr($osr) 14 | set_fc($fc) 15 | set_samp_rate_in($samp_rate_in) 16 | 17 | ppm 18 | ppm 19 | ppm 20 | float 21 | part 22 | 23 | 24 | OSR 25 | osr 26 | osr 27 | int 28 | part 29 | 30 | 31 | fc 32 | fc 33 | fc 34 | float 35 | part 36 | 37 | 38 | samp_rate_in 39 | samp_rate_in 40 | samp_rate_in 41 | float 42 | part 43 | 44 | 45 | in 46 | complex 47 | 1 48 | 49 | 50 | ppm_in 51 | message 52 | True 53 | 54 | 55 | out 56 | complex 57 | 1 58 | 59 | Piotr Krysik 60 | Adaptor of input stream for the GSM receiver. Contains frequency offset corrector and resampler to correct carrier frequency and sampling frequency offsets. At the end it has LP filter for filtering of a GSM channel. 61 | 62 | -------------------------------------------------------------------------------- /gr-gsm/grc/receiver/gsm_receiver.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | GSM Receiver 4 | gsm_receiver 5 | import grgsm 6 | grgsm.receiver($osr, $cell_allocation, $tseq_nums) 7 | 8 | 9 | Oversampling ratio 10 | osr 11 | 4 12 | int 13 | 14 | 15 | 16 | Cell allocation 17 | cell_allocation 18 | [0] 19 | float_vector 20 | part 21 | 22 | 23 | 24 | TSEQ numbers 25 | tseq_nums 26 | [] 27 | int_vector 28 | part 29 | 30 | 31 | 32 | Num Streams 33 | num_streams 34 | 1 35 | int 36 | part 37 | 38 | $num_streams >= 0 39 | 40 | 41 | in 42 | complex 43 | $num_streams 44 | 45 | 46 | 47 | C0 48 | message 49 | 1 50 | 51 | 52 | 53 | CX 54 | message 55 | 1 56 | 57 | 58 | 59 | measurements 60 | message 61 | 1 62 | 63 | 64 | -------------------------------------------------------------------------------- /gr-gsm/grc/receiver/gsm_sch_detector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | SCH bursts detector 4 | gsm_sch_detector 5 | import grgsm 6 | grgsm.sch_detector($OSR) 7 | set_OSR($OSR) 8 | 9 | OSR 10 | OSR 11 | 4 12 | int 13 | 14 | 15 | 16 | in 17 | complex 18 | 19 | 20 | 21 | out 22 | complex 23 | 24 | 25 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | ######################################################################## 21 | # Install public header files 22 | ######################################################################## 23 | install(FILES 24 | plotting.hpp 25 | api.h 26 | gsmtap.h 27 | DESTINATION include/grgsm 28 | ) 29 | 30 | add_subdirectory(decoding) 31 | add_subdirectory(decryption) 32 | add_subdirectory(demapping) 33 | add_subdirectory(receiver) 34 | add_subdirectory(misc_utils) 35 | add_subdirectory(qa_utils) 36 | add_subdirectory(flow_control) 37 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/api.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * @file 4 | * @author Piotr Krysik 5 | * @section LICENSE 6 | * 7 | * Gr-gsm is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * Gr-gsm is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with gr-gsm; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_API_H 24 | #define INCLUDED_GSM_API_H 25 | 26 | #include 27 | 28 | #ifdef gnuradio_gsm_EXPORTS 29 | # define GSM_API __GR_ATTR_EXPORT 30 | #else 31 | # define GSM_API __GR_ATTR_IMPORT 32 | #endif 33 | 34 | #endif /* INCLUDED_GSM_API_H */ 35 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/decoding/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | ######################################################################## 21 | # Install public header files 22 | ######################################################################## 23 | install(FILES 24 | control_channels_decoder.h 25 | tch_f_decoder.h DESTINATION include/grgsm/decoding 26 | ) 27 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/decryption/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | ######################################################################## 21 | # Install public header files 22 | ######################################################################## 23 | install(FILES 24 | decryption.h DESTINATION include/grgsm/decoding 25 | ) 26 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/demapping/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | ######################################################################## 21 | # Install public header files 22 | ######################################################################## 23 | install(FILES 24 | universal_ctrl_chans_demapper.h 25 | tch_f_chans_demapper.h DESTINATION include/grgsm/demapping 26 | ) 27 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/flow_control/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | ######################################################################## 21 | # Install public header files 22 | ######################################################################## 23 | install(FILES 24 | burst_timeslot_splitter.h 25 | burst_sdcch_subslot_splitter.h 26 | burst_timeslot_filter.h 27 | burst_sdcch_subslot_filter.h 28 | burst_fnr_filter.h 29 | dummy_burst_filter.h DESTINATION include/grgsm/flow_control 30 | ) 31 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/flow_control/burst_timeslot_splitter.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_H 24 | #define INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | /*! 33 | * \brief <+description of block+> 34 | * \ingroup gsm 35 | * 36 | */ 37 | class GSM_API burst_timeslot_splitter : virtual public gr::block 38 | { 39 | public: 40 | typedef boost::shared_ptr sptr; 41 | 42 | /*! 43 | * \brief Return a shared_ptr to a new instance of grgsm::burst_timeslot_splitter. 44 | * 45 | * To avoid accidental use of raw pointers, grgsm::burst_timeslot_splitter's 46 | * constructor is in a private implementation 47 | * class. grgsm::burst_timeslot_splitter::make is the public interface for 48 | * creating new instances. 49 | */ 50 | static sptr make(); 51 | }; 52 | } // namespace gsm 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_H */ 56 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/flow_control/dummy_burst_filter.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_DUMMY_BURST_FILTER_H 24 | #define INCLUDED_GSM_DUMMY_BURST_FILTER_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | /*! 33 | * \brief <+description of block+> 34 | * \ingroup gsm 35 | * 36 | */ 37 | class GSM_API dummy_burst_filter : virtual public gr::block 38 | { 39 | public: 40 | typedef boost::shared_ptr sptr; 41 | 42 | /*! 43 | * \brief Return a shared_ptr to a new instance of grgsm::dummy_burst_filter. 44 | * 45 | * To avoid accidental use of raw pointers, grgsm::dummy_burst_filter's 46 | * constructor is in a private implementation 47 | * class. grgsm::dummy_burst_filter::make is the public interface for 48 | * creating new instances. 49 | */ 50 | static sptr make(); 51 | }; 52 | } // namespace gsm 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_GSM_DUMMY_BURST_FILTER_H */ 56 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/misc_utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | ######################################################################## 21 | # Install public header files 22 | ######################################################################## 23 | install(FILES 24 | bursts_printer.h 25 | burst_file_source.h 26 | burst_file_sink.h 27 | message_file_sink.h 28 | message_file_source.h 29 | extract_system_info.h 30 | extract_immediate_assignment.h 31 | controlled_rotator_cc.h 32 | controlled_const_source_f.h 33 | message_printer.h 34 | tmsi_dumper.h DESTINATION include/grgsm/misc_utils 35 | ) 36 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/misc_utils/burst_file_sink.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_BURST_FILE_SINK_H 24 | #define INCLUDED_GSM_BURST_FILE_SINK_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | /*! 33 | * \brief <+description of block+> 34 | * \ingroup gsm 35 | * 36 | */ 37 | class GSM_API burst_file_sink : virtual public gr::block 38 | { 39 | public: 40 | typedef boost::shared_ptr sptr; 41 | 42 | /*! 43 | * \brief Return a shared_ptr to a new instance of grgsm::burst_file_sink. 44 | * 45 | * To avoid accidental use of raw pointers, grgsm::burst_file_sink's 46 | * constructor is in a private implementation 47 | * class. grgsm::burst_file_sink::make is the public interface for 48 | * creating new instances. 49 | */ 50 | static sptr make(const std::string &filename); 51 | }; 52 | } // namespace gsm 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_GSM_BURST_FILE_SINK_H */ 56 | 57 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/misc_utils/burst_file_source.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_BURST_FILE_SOURCE_H 24 | #define INCLUDED_GSM_BURST_FILE_SOURCE_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | /*! 33 | * \brief <+description of block+> 34 | * \ingroup gsm 35 | * 36 | */ 37 | class GSM_API burst_file_source : virtual public gr::block 38 | { 39 | public: 40 | typedef boost::shared_ptr sptr; 41 | 42 | /*! 43 | * \brief Return a shared_ptr to a new instance of grgsm::burst_file_source. 44 | * 45 | * To avoid accidental use of raw pointers, grgsm::burst_file_source's 46 | * constructor is in a private implementation 47 | * class. grgsm::burst_file_source::make is the public interface for 48 | * creating new instances. 49 | */ 50 | static sptr make(const std::string &filename); 51 | }; 52 | 53 | } // namespace gsm 54 | } // namespace gr 55 | 56 | #endif /* INCLUDED_GSM_BURST_FILE_SOURCE_H */ 57 | 58 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/misc_utils/message_file_sink.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_MESSAGE_FILE_SINK_H 24 | #define INCLUDED_GSM_MESSAGE_FILE_SINK_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | /*! 33 | * \brief <+description of block+> 34 | * \ingroup gsm 35 | * 36 | */ 37 | class GSM_API message_file_sink : virtual public gr::block 38 | { 39 | public: 40 | typedef boost::shared_ptr sptr; 41 | 42 | /*! 43 | * \brief Return a shared_ptr to a new instance of grgsm::message_file_sink. 44 | * 45 | * To avoid accidental use of raw pointers, grgsm::message_file_sink's 46 | * constructor is in a private implementation 47 | * class. grgsm::message_file_sink::make is the public interface for 48 | * creating new instances. 49 | */ 50 | static sptr make(const std::string &filename); 51 | }; 52 | } // namespace gsm 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_GSM_MESSAGE_FILE_SINK_H */ 56 | 57 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/misc_utils/message_file_source.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_MESSAGE_FILE_SOURCE_H 24 | #define INCLUDED_GSM_MESSAGE_FILE_SOURCE_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | /*! 33 | * \brief <+description of block+> 34 | * \ingroup gsm 35 | * 36 | */ 37 | class GSM_API message_file_source : virtual public gr::block 38 | { 39 | public: 40 | typedef boost::shared_ptr sptr; 41 | 42 | /*! 43 | * \brief Return a shared_ptr to a new instance of grgsm::message_file_source. 44 | * 45 | * To avoid accidental use of raw pointers, grgsm::message_file_source's 46 | * constructor is in a private implementation 47 | * class. grgsm::message_file_source::make is the public interface for 48 | * creating new instances. 49 | */ 50 | static sptr make(const std::string &filename); 51 | }; 52 | 53 | } // namespace gsm 54 | } // namespace gr 55 | 56 | #endif /* INCLUDED_GSM_MESSAGE_FILE_SOURCE_H */ 57 | 58 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/misc_utils/tmsi_dumper.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Piotr Krysik 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | 24 | #ifndef INCLUDED_GSM_TMSI_DUMPER_H 25 | #define INCLUDED_GSM_TMSI_DUMPER_H 26 | 27 | #include 28 | #include 29 | 30 | namespace gr { 31 | namespace gsm { 32 | 33 | /*! 34 | * \brief <+description of block+> 35 | * \ingroup gsm 36 | * 37 | */ 38 | class GSM_API tmsi_dumper : virtual public gr::block 39 | { 40 | public: 41 | typedef boost::shared_ptr sptr; 42 | 43 | /*! 44 | * \brief Return a shared_ptr to a new instance of gsm::tmsi_dumper. 45 | * 46 | * To avoid accidental use of raw pointers, gsm::tmsi_dumper's 47 | * constructor is in a private implementation 48 | * class. gsm::tmsi_dumper::make is the public interface for 49 | * creating new instances. 50 | */ 51 | static sptr make(); 52 | }; 53 | 54 | } // namespace gsm 55 | } // namespace gr 56 | 57 | #endif /* INCLUDED_GSM_TMSI_DUMPER_H */ 58 | 59 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/qa_utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | ######################################################################## 21 | # Install public header files 22 | ######################################################################## 23 | install(FILES 24 | burst_sink.h 25 | burst_source.h 26 | message_source.h 27 | message_sink.h DESTINATION include/grgsm/qa_utils 28 | ) 29 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/qa_utils/message_sink.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | 24 | #ifndef INCLUDED_GSM_MESSAGE_SINK_H 25 | #define INCLUDED_GSM_MESSAGE_SINK_H 26 | 27 | #include 28 | #include 29 | 30 | namespace gr { 31 | namespace gsm { 32 | 33 | /*! 34 | * \brief <+description of block+> 35 | * \ingroup gsm 36 | * 37 | */ 38 | class GSM_API message_sink : virtual public gr::block 39 | { 40 | public: 41 | typedef boost::shared_ptr sptr; 42 | 43 | /*! 44 | * \brief Return a shared_ptr to a new instance of grgsm::message_sink. 45 | * 46 | * To avoid accidental use of raw pointers, grgsm::message_sink's 47 | * constructor is in a private implementation 48 | * class. grgsm::message_sink::make is the public interface for 49 | * creating new instances. 50 | */ 51 | static sptr make(); 52 | 53 | virtual std::vector get_messages() = 0; 54 | }; 55 | 56 | } // namespace gsm 57 | } // namespace gr 58 | 59 | #endif /* INCLUDED_GSM_MESSAGE_SINK_H */ 60 | 61 | -------------------------------------------------------------------------------- /gr-gsm/include/grgsm/receiver/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2011,2012 Free Software Foundation, Inc. 2 | # 3 | # This file is part of GNU Radio 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | ######################################################################## 21 | # Install public header files 22 | ######################################################################## 23 | install(FILES 24 | clock_offset_control.h 25 | cx_channel_hopper.h 26 | receiver.h DESTINATION include/grgsm/receiver 27 | ) 28 | -------------------------------------------------------------------------------- /gr-gsm/lib/decoding/GSM610Tables.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008 Free Software Foundation, Inc. 3 | * 4 | * This software is distributed under the terms of the GNU Public License. 5 | * See the COPYING file in the main directory for details. 6 | 7 | This program is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | This program is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this program. If not, see . 19 | 20 | */ 21 | 22 | 23 | 24 | #ifndef GSM610TABLES_H 25 | #define GSM610TABLES_H 26 | 27 | 28 | 29 | namespace GSM { 30 | 31 | /** Table #2 from GSM 05.03 */ 32 | extern unsigned int g610BitOrder[260]; 33 | 34 | } 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /gr-gsm/lib/decoding/GSM660Tables.h: -------------------------------------------------------------------------------- 1 | /* EFR (GSM 06.60) importance bit ordering */ 2 | 3 | /* 4 | * Copyright 2010 Sylvain Munaut 5 | * All Rights Reserved 6 | * 7 | * This program is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program. If not, see . 19 | */ 20 | 21 | #ifndef GSM660TABLES_H 22 | #define GSM660TABLES_H 23 | 24 | namespace GSM { 25 | 26 | /** Table #6 from GSM 05.03 */ 27 | extern unsigned int g660BitOrder[260]; 28 | 29 | } 30 | 31 | #endif /* GSM660TABLES_H */ 32 | -------------------------------------------------------------------------------- /gr-gsm/lib/decoding/Viterbi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013, 2014 Range Networks, Inc. 3 | * 4 | * This software is distributed under multiple licenses; 5 | * see the COPYING file in the main directory for licensing 6 | * information for this specific distribution. 7 | * 8 | * This use of this software may be subject to additional restrictions. 9 | * See the LEGAL file in the main directory for details. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 | 15 | */ 16 | 17 | 18 | #ifndef _VITERBI_H_ 19 | #define _VITERBI_H_ 1 20 | 21 | // (pat) Virtual base class for Viterbi and Turbo coder/decoders. 22 | class ViterbiBase { 23 | public: 24 | virtual void encode(const BitVector &in, BitVector& target) const = 0; 25 | virtual void decode(const SoftVector &in, BitVector& target) = 0; 26 | // (pat) Return error count from most recent decoder run. 27 | // If you get -1 from this, the method is not defined in the Viterbi class. 28 | virtual int getBEC() { return -1; } 29 | //virtual ~ViterbiBase(); Currently None of these have destructors. 30 | 31 | // These functions are logically part of the Viterbi functionality, even though they do not use any class variables. 32 | unsigned applyPoly(uint64_t val, uint64_t poly); 33 | unsigned applyPoly(uint64_t val, uint64_t poly, unsigned order); 34 | }; 35 | #endif 36 | -------------------------------------------------------------------------------- /gr-gsm/lib/decoding/cch.h: -------------------------------------------------------------------------------- 1 | /* 2 | The Hacker's Choice - http://www.thc.org 3 | Part of THC's GSM SCANNER PROJECT 4 | */ 5 | 6 | #ifndef __GSMSTACK_CCH_H__ 7 | #define __GSMSTACK_CCH_H__ 1 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | //#include "gsmstack.h" 14 | 15 | /* 16 | * decode_cch 17 | * 18 | * Decode a "common" control channel. Most control channels use 19 | * the same burst, interleave, Viterbi and parity configuration. 20 | * The documentation for the control channels defines SACCH first 21 | * and then just keeps referring to that. 22 | * 23 | * The current (investigated) list is as follows: 24 | * 25 | * BCCH Norm 26 | * BCCH Ext 27 | * PCH 28 | * AGCH 29 | * CBCH (SDCCH/4) 30 | * CBCH (SDCCH/8) 31 | * SDCCH/4 32 | * SACCH/C4 33 | * SDCCH/8 34 | * SACCH/C8 35 | * 36 | * We provide two functions, one for where all four bursts are 37 | * contiguous, and one where they aren't. 38 | */ 39 | 40 | #define DATA_BLOCK_SIZE 184 41 | #define PARITY_SIZE 40 42 | #define FLUSH_BITS_SIZE 4 43 | #define PARITY_OUTPUT_SIZE (DATA_BLOCK_SIZE + PARITY_SIZE + FLUSH_BITS_SIZE) 44 | 45 | #define CONV_INPUT_SIZE PARITY_OUTPUT_SIZE 46 | #define CONV_SIZE (2 * CONV_INPUT_SIZE) 47 | 48 | #define BLOCKS 4 49 | #define iBLOCK_SIZE (CONV_SIZE / BLOCKS) 50 | #define eBLOCK_SIZE (iBLOCK_SIZE + 2) 51 | 52 | int conv_decode(unsigned char *output, unsigned char *data); 53 | int parity_check(unsigned char *d); 54 | //unsigned char *decode_cch(GS_CTX *ctx, unsigned char *burst, unsigned int *len); 55 | //unsigned char *decode_facch(GS_CTX *ctx, unsigned char *burst, unsigned int *len, int offset); 56 | //unsigned char *decode_cch(GS_CTX *ctx, unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned int *len); 57 | //unsigned char *decode_cch(GS_CTX *ctx, unsigned char *, unsigned int *); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /gr-gsm/lib/decoding/control_channels_decoder_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * @file 4 | * @author Piotr Krysik 5 | * @section LICENSE 6 | * 7 | * Gr-gsm is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * Gr-gsm is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with gr-gsm; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_CONTROL_CHANNELS_DECODER_IMPL_H 24 | #define INCLUDED_GSM_CONTROL_CHANNELS_DECODER_IMPL_H 25 | 26 | #include 27 | #include "fire_crc.h" 28 | #include "cch.h" 29 | 30 | namespace gr { 31 | namespace gsm { 32 | 33 | class control_channels_decoder_impl : public control_channels_decoder 34 | { 35 | private: 36 | unsigned int d_collected_bursts_num; 37 | pmt::pmt_t d_bursts[4]; 38 | unsigned short interleave_trans[CONV_SIZE]; 39 | FC_CTX fc_ctx; 40 | void decode(pmt::pmt_t msg); 41 | public: 42 | control_channels_decoder_impl(); 43 | ~control_channels_decoder_impl(); 44 | }; 45 | 46 | } // namespace gsm 47 | } // namespace gr 48 | 49 | #endif /* INCLUDED_GSM_CONTROL_CHANNELS_DECODER_IMPL_H */ 50 | 51 | -------------------------------------------------------------------------------- /gr-gsm/lib/decoding/fire_crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | The Hacker's Choice - http://www.thc.org 3 | Part of THC's GSM SCANNER PROJECT 4 | */ 5 | 6 | 7 | 8 | #ifndef INCLUDED_FIRE_CRC_H 9 | #define INCLUDED_FIRE_CRC_H 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct 16 | { 17 | unsigned int crc_size; 18 | unsigned int data_size; 19 | unsigned int syn_start; 20 | int syndrome_reg[40]; 21 | } FC_CTX; 22 | 23 | int FC_init(FC_CTX *ctx, unsigned int crc_size, unsigned int data_size); 24 | int FC_check_crc(FC_CTX *ctx, unsigned char *input_bits, unsigned char *control_data); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /gr-gsm/lib/decoding/interleave.c: -------------------------------------------------------------------------------- 1 | /* 2 | The Hacker's Choice - http://www.thc.org 3 | Part of THC's GSM SCANNER PROJECT 4 | */ 5 | 6 | #include 7 | #include 8 | #include "interleave.h" 9 | 10 | int 11 | interleave_init(INTERLEAVE_CTX *ictx, int size, int block_size) 12 | { 13 | ictx->trans_size = size; 14 | ictx->trans = (unsigned short *)malloc(size * sizeof *ictx->trans); 15 | 16 | // DEBUGF("size: %d\n", size); 17 | // DEBUGF("Block size: %d\n", block_size); 18 | int j, k, B; 19 | for (k = 0; k < size; k++) 20 | { 21 | B = k % 4; 22 | j = 2 * ((49 * k) % 57) + ((k % 8) / 4); 23 | ictx->trans[k] = B * block_size + j; 24 | /* Mapping: pos1 goes to pos2: pos1 -> pos2 */ 25 | //printf("%d -> %d\n", ictx->trans[k], k); 26 | } 27 | // exit(0); 28 | return 0; 29 | } 30 | 31 | int 32 | interleave_init_facch_f(INTERLEAVE_CTX *ictx, int size, int block_size, int block_offset) 33 | { 34 | ictx->trans_size = size; 35 | ictx->trans = (unsigned short *)malloc(size * sizeof *ictx->trans); 36 | 37 | // DEBUGF("size: %d\n", size); 38 | // DEBUGF("Block size: %d\n", block_size); 39 | int j, k, B; 40 | for (k = 0; k < size; k++) 41 | { 42 | B = (k + block_offset) % 8; 43 | j = 2 * ((49 * k) % 57) + ((k % 8) / 4); 44 | ictx->trans[k] = B * block_size + j; 45 | /* Mapping: pos1 goes to pos2: pos1 -> pos2 */ 46 | // DEBUGF("%d -> %d\n", ictx->trans[k], k); 47 | } 48 | // exit(0); 49 | return 0; 50 | } 51 | 52 | int 53 | interleave_deinit(INTERLEAVE_CTX *ictx) 54 | { 55 | if (ictx->trans != NULL) 56 | { 57 | free(ictx->trans); 58 | ictx->trans = NULL; 59 | } 60 | 61 | return 0; 62 | } 63 | 64 | void 65 | interleave_decode(INTERLEAVE_CTX *ictx, unsigned char *dst, unsigned char *src) 66 | { 67 | printf("Lol\n"); 68 | int k; 69 | for (k = 0; k < ictx->trans_size; k++) 70 | { 71 | printf("k=%d, ictx->trans[k]=%d\n", k, ictx->trans[k]); 72 | dst[k] = src[ictx->trans[k]]; 73 | } 74 | } 75 | 76 | -------------------------------------------------------------------------------- /gr-gsm/lib/decoding/interleave.h: -------------------------------------------------------------------------------- 1 | /* 2 | The Hacker's Choice - http://www.thc.org 3 | Part of THC's GSM SCANNER PROJECT 4 | */ 5 | 6 | /* 7 | * $Id:$ 8 | */ 9 | 10 | #ifndef __GSMSP_INTERLEAVE_H__ 11 | #define __GSMSP_INTERLEAVE_H__ 1 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | typedef struct _interleave_ctx 18 | { 19 | unsigned short *trans; 20 | int trans_size; 21 | } INTERLEAVE_CTX; 22 | 23 | int interleave_init(INTERLEAVE_CTX *ictx, int size, int block_size); 24 | int interleave_init_facch_f(INTERLEAVE_CTX *ictx, int size, int block_size, int block_offset); 25 | int interleave_deinit(INTERLEAVE_CTX *ictx); 26 | void interleave_decode(INTERLEAVE_CTX *ictx, unsigned char *dst, unsigned char *src); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /gr-gsm/lib/decryption/decryption_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * Copyright 2014 <+YOU OR YOUR COMPANY+>. 4 | * 5 | * This is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3, or (at your option) 8 | * any later version. 9 | * 10 | * This software is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this software; see the file COPYING. If not, write to 17 | * the Free Software Foundation, Inc., 51 Franklin Street, 18 | * Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef INCLUDED_GSM_DECRYPTION_IMPL_H 22 | #define INCLUDED_GSM_DECRYPTION_IMPL_H 23 | 24 | #include 25 | #include 26 | 27 | namespace gr { 28 | namespace gsm { 29 | 30 | class decryption_impl : public decryption 31 | { 32 | private: 33 | std::vector d_k_c; 34 | bool d_k_c_valid; 35 | uint8_t d_a5_version; 36 | void decrypt(pmt::pmt_t msg); 37 | void validate_k_c(); 38 | public: 39 | decryption_impl(const std::vector & k_c, unsigned int a5_version); 40 | ~decryption_impl(); 41 | virtual void set_k_c(const std::vector & k_c); 42 | virtual void set_a5_version(unsigned int a5_version); 43 | }; 44 | } // namespace gsm 45 | } // namespace gr 46 | 47 | #endif /* INCLUDED_GSM_DECRYPTION_IMPL_H */ 48 | 49 | -------------------------------------------------------------------------------- /gr-gsm/lib/demapping/tch_f_chans_demapper_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * @file 4 | * @author Roman Khassraf 5 | * @section LICENSE 6 | * 7 | * Gr-gsm is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * Gr-gsm is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with gr-gsm; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_UNIVERSAL_TCH_CHANS_DEMAPPER_IMPL_H 24 | #define INCLUDED_GSM_UNIVERSAL_TCH_CHANS_DEMAPPER_IMPL_H 25 | 26 | #include 27 | 28 | namespace gr { 29 | namespace gsm { 30 | 31 | class tch_f_chans_demapper_impl : public tch_f_chans_demapper 32 | { 33 | private: 34 | unsigned int d_timeslot; 35 | uint32_t d_frame_numbers[3][8]; 36 | uint32_t d_frame_numbers_sacch[4]; 37 | pmt::pmt_t d_bursts[3][8]; 38 | pmt::pmt_t d_bursts_sacch[4]; 39 | bool d_bursts_stolen[3]; 40 | 41 | public: 42 | tch_f_chans_demapper_impl(unsigned int timeslot_nr); 43 | ~tch_f_chans_demapper_impl(); 44 | 45 | void filter_tch_chans(pmt::pmt_t msg); 46 | }; 47 | 48 | } // namespace gsm 49 | } // namespace gr 50 | 51 | #endif /* INCLUDED_GSM_UNIVERSAL_TCH_CHANS_DEMAPPER_IMPL_H */ 52 | 53 | -------------------------------------------------------------------------------- /gr-gsm/lib/demapping/universal_ctrl_chans_demapper_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * @file 4 | * @author Piotr Krysik 5 | * @section LICENSE 6 | * 7 | * Gr-gsm is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * Gr-gsm is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with gr-gsm; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_UNIVERSAL_CTRL_CHANS_DEMAPPER_IMPL_H 24 | #define INCLUDED_GSM_UNIVERSAL_CTRL_CHANS_DEMAPPER_IMPL_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | class universal_ctrl_chans_demapper_impl : public universal_ctrl_chans_demapper 33 | { 34 | private: 35 | unsigned int d_starts_fn_mod51[51]; 36 | unsigned int d_channel_types[51]; 37 | unsigned int d_subslots[102]; 38 | unsigned int d_timeslot; 39 | uint32_t d_frame_numbers[4]; 40 | pmt::pmt_t d_bursts[4]; 41 | public: 42 | universal_ctrl_chans_demapper_impl(unsigned int timeslot_nr, const std::vector &starts_fn_mod51, const std::vector &channel_types); 43 | ~universal_ctrl_chans_demapper_impl(); 44 | 45 | void filter_ctrl_chans(pmt::pmt_t msg); 46 | }; 47 | 48 | } // namespace gsm 49 | } // namespace gr 50 | 51 | #endif /* INCLUDED_GSM_UNIVERSAL_CTRL_CHANS_DEMAPPER_IMPL_H */ 52 | 53 | -------------------------------------------------------------------------------- /gr-gsm/lib/flow_control/burst_fnr_filter_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_BURST_FNR_FILTER_IMPL_H 24 | #define INCLUDED_GSM_BURST_FNR_FILTER_IMPL_H 25 | 26 | #include 27 | 28 | namespace gr { 29 | namespace gsm { 30 | 31 | class burst_fnr_filter_impl : public burst_fnr_filter 32 | { 33 | private: 34 | unsigned int d_framenr; 35 | filter_mode d_mode; 36 | public: 37 | burst_fnr_filter_impl(filter_mode mode, unsigned int fnr); 38 | ~burst_fnr_filter_impl(); 39 | void process_burst(pmt::pmt_t msg); 40 | }; 41 | 42 | } // namespace gsm 43 | } // namespace gr 44 | 45 | #endif /* INCLUDED_GSM_BURST_FNR_FILTER_IMPL_H */ 46 | 47 | -------------------------------------------------------------------------------- /gr-gsm/lib/flow_control/burst_timeslot_filter_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_BURST_TIMESLOT_FILTER_IMPL_H 24 | #define INCLUDED_GSM_BURST_TIMESLOT_FILTER_IMPL_H 25 | 26 | #include 27 | 28 | namespace gr { 29 | namespace gsm { 30 | 31 | class burst_timeslot_filter_impl : public burst_timeslot_filter 32 | { 33 | private: 34 | unsigned int d_timeslot; 35 | public: 36 | burst_timeslot_filter_impl(unsigned int timeslot); 37 | ~burst_timeslot_filter_impl(); 38 | void process_burst(pmt::pmt_t msg); 39 | }; 40 | 41 | } // namespace gsm 42 | } // namespace gr 43 | 44 | #endif /* INCLUDED_GSM_BURST_TIMESLOT_FILTER_IMPL_H */ 45 | 46 | -------------------------------------------------------------------------------- /gr-gsm/lib/flow_control/burst_timeslot_splitter_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_IMPL_H 24 | #define INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_IMPL_H 25 | 26 | #include 27 | 28 | namespace gr { 29 | namespace gsm { 30 | 31 | class burst_timeslot_splitter_impl : public burst_timeslot_splitter 32 | { 33 | public: 34 | burst_timeslot_splitter_impl(); 35 | ~burst_timeslot_splitter_impl(); 36 | void process_burst(pmt::pmt_t msg); 37 | }; 38 | 39 | } // namespace gsm 40 | } // namespace gr 41 | 42 | #endif /* INCLUDED_GSM_BURST_TIMESLOT_SPLITTER_IMPL_H */ 43 | 44 | -------------------------------------------------------------------------------- /gr-gsm/lib/flow_control/dummy_burst_filter_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_DUMMY_BURST_FILTER_IMPL_H 24 | #define INCLUDED_GSM_DUMMY_BURST_FILTER_IMPL_H 25 | 26 | #define DUMMY_BURST_LEN 148 27 | 28 | #include 29 | 30 | namespace gr { 31 | namespace gsm { 32 | 33 | class dummy_burst_filter_impl : public dummy_burst_filter 34 | { 35 | private: 36 | bool is_dummy_burst(int8_t *burst, size_t burst_len); 37 | static const int8_t d_dummy_burst[]; 38 | public: 39 | dummy_burst_filter_impl(); 40 | ~dummy_burst_filter_impl(); 41 | void process_burst(pmt::pmt_t msg); 42 | }; 43 | 44 | } // namespace gsm 45 | } // namespace gr 46 | 47 | #endif /* INCLUDED_GSM_DUMMY_BURST_FILTER_IMPL_H */ 48 | 49 | -------------------------------------------------------------------------------- /gr-gsm/lib/misc_utils/burst_file_sink_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_BURST_FILE_SINK_IMPL_H 24 | #define INCLUDED_GSM_BURST_FILE_SINK_IMPL_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | class burst_file_sink_impl : public burst_file_sink 33 | { 34 | private: 35 | std::ofstream d_output_file; 36 | public: 37 | burst_file_sink_impl(const std::string &filename); 38 | ~burst_file_sink_impl(); 39 | void process_burst(pmt::pmt_t msg); 40 | }; 41 | 42 | } // namespace gsm 43 | } // namespace gr 44 | 45 | #endif /* INCLUDED_GSM_BURST_FILE_SINK_IMPL_H */ 46 | 47 | -------------------------------------------------------------------------------- /gr-gsm/lib/misc_utils/burst_file_source_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_BURST_FILE_SOURCE_IMPL_H 24 | #define INCLUDED_GSM_BURST_FILE_SOURCE_IMPL_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | class burst_file_source_impl : public burst_file_source 33 | { 34 | private: 35 | boost::shared_ptr d_thread; 36 | std::ifstream d_input_file; 37 | bool d_finished; 38 | void run(); 39 | public: 40 | burst_file_source_impl(const std::string &filename); 41 | ~burst_file_source_impl(); 42 | bool start(); 43 | bool stop(); 44 | bool finished(); 45 | }; 46 | } // namespace gsm 47 | } // namespace gr 48 | 49 | #endif /* INCLUDED_GSM_BURST_FILE_SOURCE_IMPL_H */ 50 | 51 | -------------------------------------------------------------------------------- /gr-gsm/lib/misc_utils/bursts_printer_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * @file 4 | * @author Piotr Krysik 5 | * @section LICENSE 6 | * 7 | * Gr-gsm is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * Gr-gsm is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with gr-gsm; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_BURSTS_PRINTER_IMPL_H 24 | #define INCLUDED_GSM_BURSTS_PRINTER_IMPL_H 25 | 26 | #define DUMMY_BURST_LEN 148 27 | 28 | #include 29 | #include 30 | 31 | namespace gr { 32 | namespace gsm { 33 | 34 | class bursts_printer_impl : public bursts_printer 35 | { 36 | private: 37 | void bursts_print(pmt::pmt_t burst); 38 | pmt::pmt_t d_prepend_string; 39 | bool d_prepend_fnr; 40 | bool d_prepend_frame_count; 41 | bool d_print_payload_only; 42 | bool d_ignore_dummy_bursts; 43 | bool is_dummy_burst(int8_t *burst, size_t burst_len); 44 | static const int8_t d_dummy_burst[]; 45 | public: 46 | bursts_printer_impl(pmt::pmt_t prepend_string, bool prepend_fnr=false, 47 | bool prepend_frame_count=false, bool print_payload_only=false, 48 | bool ignore_dummy_bursts=false); 49 | ~bursts_printer_impl(); 50 | }; 51 | 52 | } // namespace gsm 53 | } // namespace gr 54 | 55 | #endif /* INCLUDED_GSM_BURSTS_PRINTER_IMPL_H */ 56 | 57 | -------------------------------------------------------------------------------- /gr-gsm/lib/misc_utils/controlled_const_source_f_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * @file 4 | * @author Piotr Krysik 5 | * @section LICENSE 6 | * 7 | * Gr-gsm is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * Gr-gsm is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with gr-gsm; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_CONTROLLED_CONST_SOURCE_F_IMPL_H 24 | #define INCLUDED_GSM_CONTROLLED_CONST_SOURCE_F_IMPL_H 25 | 26 | #include 27 | 28 | namespace gr { 29 | namespace gsm { 30 | 31 | class controlled_const_source_f_impl : public controlled_const_source_f 32 | { 33 | private: 34 | float d_constant; 35 | void set_constant_msg(pmt::pmt_t msg); 36 | 37 | public: 38 | controlled_const_source_f_impl(float constant); 39 | ~controlled_const_source_f_impl(); 40 | 41 | // Where all the action really happens 42 | int work(int noutput_items, 43 | gr_vector_const_void_star &input_items, 44 | gr_vector_void_star &output_items); 45 | 46 | virtual void set_constant(float constant); 47 | }; 48 | 49 | } // namespace gsm 50 | } // namespace gr 51 | 52 | #endif /* INCLUDED_GSM_CONTROLLED_CONST_SOURCE_F_IMPL_H */ 53 | 54 | -------------------------------------------------------------------------------- /gr-gsm/lib/misc_utils/controlled_rotator_cc_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * @file 4 | * @author Piotr Krysik 5 | * @section LICENSE 6 | * 7 | * Gr-gsm is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * Gr-gsm is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with gr-gsm; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_CONTROLLED_ROTATOR_CC_IMPL_H 24 | #define INCLUDED_GSM_CONTROLLED_ROTATOR_CC_IMPL_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | class controlled_rotator_cc_impl : public controlled_rotator_cc 33 | { 34 | private: 35 | gr_complex d_phase_inc; 36 | double d_samp_rate; 37 | blocks::rotator d_r; 38 | 39 | public: 40 | controlled_rotator_cc_impl(double phase_inc, double samp_rate); 41 | ~controlled_rotator_cc_impl(); 42 | 43 | virtual void set_phase_inc(double phase_inc); 44 | virtual void set_samp_rate(double samp_rate); 45 | // Where all the action really happens 46 | int work(int noutput_items, 47 | gr_vector_const_void_star &input_items, 48 | gr_vector_void_star &output_items); 49 | }; 50 | 51 | } // namespace gsm 52 | } // namespace gr 53 | 54 | #endif /* INCLUDED_GSM_CONTROLLED_ROTATOR_CC_IMPL_H */ 55 | 56 | -------------------------------------------------------------------------------- /gr-gsm/lib/misc_utils/message_file_sink_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_MESSAGE_FILE_SINK_IMPL_H 24 | #define INCLUDED_GSM_MESSAGE_FILE_SINK_IMPL_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | class message_file_sink_impl : public message_file_sink 33 | { 34 | private: 35 | std::ofstream d_output_file; 36 | public: 37 | message_file_sink_impl(const std::string &filename); 38 | ~message_file_sink_impl(); 39 | void process_message(pmt::pmt_t msg); 40 | }; 41 | 42 | } // namespace gsm 43 | } // namespace gr 44 | 45 | #endif /* INCLUDED_GSM_MESSAGE_FILE_SINK_IMPL_H */ 46 | 47 | -------------------------------------------------------------------------------- /gr-gsm/lib/misc_utils/message_file_source_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_MESSAGE_FILE_SOURCE_IMPL_H 24 | #define INCLUDED_GSM_MESSAGE_FILE_SOURCE_IMPL_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | class message_file_source_impl : public message_file_source 33 | { 34 | private: 35 | boost::shared_ptr d_thread; 36 | std::ifstream d_input_file; 37 | bool d_finished; 38 | void run(); 39 | public: 40 | message_file_source_impl(const std::string &filename); 41 | ~message_file_source_impl(); 42 | bool start(); 43 | bool stop(); 44 | bool finished(); 45 | }; 46 | } // namespace gsm 47 | } // namespace gr 48 | 49 | #endif /* INCLUDED_GSM_MESSAGE_FILE_SOURCE_IMPL_H */ 50 | 51 | -------------------------------------------------------------------------------- /gr-gsm/lib/misc_utils/message_printer_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* 3 | * @file 4 | * @author Piotr Krysik 5 | * @section LICENSE 6 | * 7 | * Gr-gsm is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 3, or (at your option) 10 | * any later version. 11 | * 12 | * Gr-gsm is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with gr-gsm; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_MESSAGE_PRINTER_IMPL_H 24 | #define INCLUDED_GSM_MESSAGE_PRINTER_IMPL_H 25 | 26 | #include 27 | 28 | namespace gr { 29 | namespace gsm { 30 | 31 | class message_printer_impl : public message_printer 32 | { 33 | private: 34 | void message_print(pmt::pmt_t msg); 35 | pmt::pmt_t d_prepend_string; 36 | bool d_prepend_fnr; 37 | bool d_prepend_frame_count; 38 | bool d_print_gsmtap_header; 39 | public: 40 | message_printer_impl(pmt::pmt_t prepend_string, bool prepend_fnr=false, 41 | bool prepend_frame_count=false, bool print_gsmtap_header=false); 42 | ~message_printer_impl(); 43 | }; 44 | 45 | } // namespace gsm 46 | } // namespace gr 47 | 48 | #endif /* INCLUDED_GSM_MESSAGE_PRINTER_IMPL_H */ 49 | 50 | -------------------------------------------------------------------------------- /gr-gsm/lib/misc_utils/tmsi_dumper_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Piotr Krysik 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_TMSI_DUMPER_IMPL_H 24 | #define INCLUDED_GSM_TMSI_DUMPER_IMPL_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | namespace gr { 31 | namespace gsm { 32 | 33 | class tmsi_dumper_impl : public tmsi_dumper 34 | { 35 | private: 36 | std::ofstream dump_file; 37 | void dump_tmsi(pmt::pmt_t msg); 38 | void write_timestamp(tm * now); 39 | void write_imsi(uint8_t * imsi); 40 | void write_tmsi(uint8_t * tmsi); 41 | public: 42 | tmsi_dumper_impl(); 43 | ~tmsi_dumper_impl(); 44 | }; 45 | } // namespace gsm 46 | } // namespace gr 47 | 48 | #endif /* INCLUDED_GSM_TMSI_DUMPER_IMPL_H */ 49 | 50 | -------------------------------------------------------------------------------- /gr-gsm/lib/qa_utils/burst_sink_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_BURST_SINK_IMPL_H 24 | #define INCLUDED_GSM_BURST_SINK_IMPL_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | class burst_sink_impl : public burst_sink 33 | { 34 | private: 35 | std::vector d_framenumbers; 36 | std::vector d_timeslots; 37 | std::vector d_burst_data; 38 | public: 39 | burst_sink_impl(); 40 | ~burst_sink_impl(); 41 | void process_burst(pmt::pmt_t msg); 42 | virtual std::vector get_framenumbers(); 43 | virtual std::vector get_timeslots(); 44 | virtual std::vector get_burst_data(); 45 | }; 46 | 47 | } // namespace gsm 48 | } // namespace gr 49 | 50 | #endif /* INCLUDED_GSM_BURST_SINK_IMPL_H */ 51 | 52 | -------------------------------------------------------------------------------- /gr-gsm/lib/qa_utils/message_sink_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_MESSAGE_SINK_IMPL_H 24 | #define INCLUDED_GSM_MESSAGE_SINK_IMPL_H 25 | 26 | #include 27 | 28 | namespace gr { 29 | namespace gsm { 30 | 31 | class message_sink_impl : public message_sink 32 | { 33 | private: 34 | std::vector d_messages; 35 | 36 | public: 37 | message_sink_impl(); 38 | ~message_sink_impl(); 39 | void process_message(pmt::pmt_t msg); 40 | virtual std::vector get_messages(); 41 | }; 42 | 43 | } // namespace gsm 44 | } // namespace gr 45 | 46 | #endif /* INCLUDED_GSM_MESSAGE_SINK_IMPL_H */ 47 | 48 | -------------------------------------------------------------------------------- /gr-gsm/lib/qa_utils/message_source_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Roman Khassraf 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_MESSAGE_SOURCE_IMPL_H 24 | #define INCLUDED_GSM_MESSAGE_SOURCE_IMPL_H 25 | 26 | #include 27 | 28 | namespace gr { 29 | namespace gsm { 30 | 31 | class message_source_impl : public message_source 32 | { 33 | private: 34 | boost::shared_ptr d_thread; 35 | std::vector > d_msgs; 36 | bool d_finished; 37 | void run(); 38 | public: 39 | message_source_impl(const std::vector &msg_data); 40 | ~message_source_impl(); 41 | virtual void set_msg_data(const std::vector &msg_data); 42 | bool start(); 43 | bool stop(); 44 | bool finished(); 45 | }; 46 | 47 | } // namespace grgsm 48 | } // namespace gr 49 | 50 | #endif /* INCLUDED_GSM_MESSAGE_SOURCE_IMPL_H */ 51 | 52 | -------------------------------------------------------------------------------- /gr-gsm/lib/receiver/cx_channel_hopper_impl.h: -------------------------------------------------------------------------------- 1 | /* -*- c++ -*- */ 2 | /* @file 3 | * @author Piotr Krysik 4 | * @section LICENSE 5 | * 6 | * Gr-gsm is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 3, or (at your option) 9 | * any later version. 10 | * 11 | * Gr-gsm is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with gr-gsm; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | * 21 | */ 22 | 23 | #ifndef INCLUDED_GSM_CX_CHANNEL_HOPPER_IMPL_H 24 | #define INCLUDED_GSM_CX_CHANNEL_HOPPER_IMPL_H 25 | 26 | #include 27 | #include 28 | 29 | namespace gr { 30 | namespace gsm { 31 | 32 | class cx_channel_hopper_impl : public cx_channel_hopper 33 | { 34 | private: 35 | std::vector d_ma; // Mobile Allocation list. Contains all channels that are used while channel hopping 36 | int d_maio; // Mobile Allocation Index Offset 37 | int d_hsn; // Hopping Sequence Number 38 | int d_narfcn; // Length of d_ma 39 | 40 | int calculate_ma_sfh(int maio, int hsn, int n, int fn); 41 | void assemble_bursts(pmt::pmt_t msg); 42 | 43 | public: 44 | cx_channel_hopper_impl(const std::vector &ma, int maio, int hsn); 45 | ~cx_channel_hopper_impl(); 46 | }; 47 | 48 | } // namespace gsm 49 | } // namespace gr 50 | 51 | #endif /* INCLUDED_GSM_CX_CHANNEL_HOPPER_IMPL_H */ 52 | 53 | -------------------------------------------------------------------------------- /gr-gsm/lib/receiver/sch.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SCH_H__ 3 | #define __SCH_H__ 1 4 | 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" 9 | { 10 | #endif 11 | 12 | GSM_API int decode_sch(const unsigned char *buf, int * t1_o, int * t2_o, int * t3_o, int * ncc, int * bcc); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /gr-gsm/python/build_utils_codes.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2004 Free Software Foundation, Inc. 3 | # 4 | # This file is part of GNU Radio 5 | # 6 | # GNU Radio is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 3, or (at your option) 9 | # any later version. 10 | # 11 | # GNU Radio is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with GNU Radio; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | 22 | def i_code (code3): 23 | return code3[0] 24 | 25 | def o_code (code3): 26 | if len (code3) >= 2: 27 | return code3[1] 28 | else: 29 | return code3[0] 30 | 31 | def tap_code (code3): 32 | if len (code3) >= 3: 33 | return code3[2] 34 | else: 35 | return code3[0] 36 | 37 | def i_type (code3): 38 | return char_to_type[i_code (code3)] 39 | 40 | def o_type (code3): 41 | return char_to_type[o_code (code3)] 42 | 43 | def tap_type (code3): 44 | return char_to_type[tap_code (code3)] 45 | 46 | 47 | char_to_type = {} 48 | char_to_type['s'] = 'short' 49 | char_to_type['i'] = 'int' 50 | char_to_type['f'] = 'float' 51 | char_to_type['c'] = 'gr_complex' 52 | char_to_type['b'] = 'unsigned char' 53 | -------------------------------------------------------------------------------- /gr-gsm/python/misc_utils/hier_block.py: -------------------------------------------------------------------------------- 1 | from gnuradio import gr 2 | from distutils.version import LooseVersion as version 3 | 4 | #class created to solve incompatibility of reginstration of message inputs 5 | #that was introduced in gnuradio 3.7.9 6 | 7 | class hier_block(gr.hier_block2): 8 | def message_port_register_hier_in(self, port_id): 9 | if version(gr.version()) >= version('3.7.9'): 10 | super(hier_block, self).message_port_register_hier_in(port_id) 11 | else: 12 | super(hier_block, self).message_port_register_hier_out(port_id) 13 | 14 | def message_port_register_hier_out(self, port_id): 15 | if version(gr.version()) >= version('3.7.9'): 16 | super(hier_block, self).message_port_register_hier_out(port_id) 17 | else: 18 | super(hier_block, self).message_port_register_hier_in(port_id) 19 | 20 | -------------------------------------------------------------------------------- /gr-gsm/python/receiver/README: -------------------------------------------------------------------------------- 1 | chirpz.py - implementation of chirpz transform 2 | gsm_input.py - adapts signal to the input of the gsm receiver, executes clock offset correction 3 | fcch_detector.py - (experimental componen for a new gsm receiver) detects fcch bursts 4 | fcch_burst_tagger.py - (experimental componen for a new gsm receiver) part of fcch_detector - add fcch tag when FCCH burst is found 5 | sch_detector.py - (experimental componen for a new gsm receiver) unfinished block that detects exact position of a SCH burst based on fcch tags, should probably also read content of SCH bursts -------------------------------------------------------------------------------- /gsmframecoder.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/gsmframecoder.tar.gz -------------------------------------------------------------------------------- /gsmframecoder/GSMFrameCoder2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GSMFrameCoder2.h 3 | * 4 | * Created on: 09.01.2011 5 | * Author: johann 6 | */ 7 | 8 | #ifndef GSMFRAMECODER2_H_ 9 | #define GSMFRAMECODER2_H_ 10 | 11 | #include "BitVector.h" 12 | class GSMFrameCoder2 { 13 | 14 | public: 15 | 16 | /**@name FEC signal processing state. */ 17 | /*//@{ 18 | Parity mBlockCoder; ///< block coder for this channel 19 | BitVector mI[4]; ///< i[][], as per GSM 05.03 2.2 20 | BitVector mC; ///< c[], as per GSM 05.03 2.2 21 | BitVector mU; ///< u[], as per GSM 05.03 2.2 22 | BitVector mD; ///< d[], as per GSM 05.03 2.2 23 | BitVector mP; ///< p[], as per GSM 05.03 2.2 24 | //@}*/ 25 | 26 | 27 | /** Offset from the start of mU to the start of the L2 frame. */ 28 | //virtual unsigned headerOffset() const { return 0; } 29 | 30 | /** 31 | Encode u[] to c[]. 32 | Includes LSB-MSB reversal within each octet. 33 | */ 34 | void encode(); 35 | 36 | /** 37 | Interleave c[] to i[]. 38 | GSM 05.03 4.1.4. 39 | */ 40 | virtual void interleave(); 41 | 42 | /** Just encode u[] to c[], interleave and return the interleaved bursts as BitVector[] */ 43 | BitVector* justencode(const BitVector&); 44 | 45 | }; 46 | 47 | #endif /* GSMFRAMECODER2_H_ */ 48 | -------------------------------------------------------------------------------- /gsmframecoder/test/BitVector.d: -------------------------------------------------------------------------------- 1 | BitVector.d BitVector.o: ../BitVector.cpp ../BitVector.h ../Vector.h 2 | 3 | ../BitVector.h: 4 | 5 | ../Vector.h: 6 | -------------------------------------------------------------------------------- /gsmframecoder/test/BitVector.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/gsmframecoder/test/BitVector.o -------------------------------------------------------------------------------- /gsmframecoder/test/GSMFrameCoder2.d: -------------------------------------------------------------------------------- 1 | GSMFrameCoder2.d GSMFrameCoder2.o: ../GSMFrameCoder2.cpp \ 2 | ../GSMFrameCoder2.h ../BitVector.h ../Vector.h 3 | 4 | ../GSMFrameCoder2.h: 5 | 6 | ../BitVector.h: 7 | 8 | ../Vector.h: 9 | -------------------------------------------------------------------------------- /gsmframecoder/test/GSMFrameCoder2.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/gsmframecoder/test/GSMFrameCoder2.o -------------------------------------------------------------------------------- /gsmframecoder/test/gsmframecoder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/gsmframecoder/test/gsmframecoder -------------------------------------------------------------------------------- /gsmframecoder/test/makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | -include ../makefile.init 6 | 7 | RM := rm 8 | 9 | # All of the sources participating in the build are defined here 10 | -include sources.mk 11 | -include subdir.mk 12 | -include objects.mk 13 | 14 | ifneq ($(MAKECMDGOALS),clean) 15 | ifneq ($(strip $(C++_DEPS)),) 16 | -include $(C++_DEPS) 17 | endif 18 | ifneq ($(strip $(C_DEPS)),) 19 | -include $(C_DEPS) 20 | endif 21 | ifneq ($(strip $(CC_DEPS)),) 22 | -include $(CC_DEPS) 23 | endif 24 | ifneq ($(strip $(CPP_DEPS)),) 25 | -include $(CPP_DEPS) 26 | endif 27 | ifneq ($(strip $(CXX_DEPS)),) 28 | -include $(CXX_DEPS) 29 | endif 30 | ifneq ($(strip $(C_UPPER_DEPS)),) 31 | -include $(C_UPPER_DEPS) 32 | endif 33 | endif 34 | 35 | -include ../makefile.defs 36 | 37 | # Add inputs and outputs from these tool invocations to the build variables 38 | 39 | # All Target 40 | all: gsmframecoder 41 | 42 | # Tool invocations 43 | gsmframecoder: $(OBJS) $(USER_OBJS) 44 | @echo 'Building target: $@' 45 | @echo 'Invoking: GCC C++ Linker' 46 | g++ -o"gsmframecoder" $(OBJS) $(USER_OBJS) $(LIBS) 47 | @echo 'Finished building target: $@' 48 | @echo ' ' 49 | 50 | # Other Targets 51 | clean: 52 | -$(RM) $(OBJS)$(C++_DEPS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) gsmframecoder 53 | -@echo ' ' 54 | 55 | .PHONY: all clean dependents 56 | .SECONDARY: 57 | 58 | -include ../makefile.targets 59 | -------------------------------------------------------------------------------- /gsmframecoder/test/objects.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | USER_OBJS := 6 | 7 | LIBS := 8 | -------------------------------------------------------------------------------- /gsmframecoder/test/sources.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | O_SRCS := 6 | CPP_SRCS := 7 | C_UPPER_SRCS := 8 | C_SRCS := 9 | S_UPPER_SRCS := 10 | OBJ_SRCS := 11 | ASM_SRCS := 12 | CXX_SRCS := 13 | C++_SRCS := 14 | CC_SRCS := 15 | OBJS := 16 | C++_DEPS := 17 | C_DEPS := 18 | CC_DEPS := 19 | CPP_DEPS := 20 | EXECUTABLES := 21 | CXX_DEPS := 22 | C_UPPER_DEPS := 23 | 24 | # Every subdirectory with source files must be described here 25 | SUBDIRS := \ 26 | . \ 27 | 28 | -------------------------------------------------------------------------------- /gsmframecoder/test/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | CPP_SRCS += \ 7 | ../BitVector.cpp \ 8 | ../GSMFrameCoder2.cpp 9 | 10 | OBJS += \ 11 | ./BitVector.o \ 12 | ./GSMFrameCoder2.o 13 | 14 | CPP_DEPS += \ 15 | ./BitVector.d \ 16 | ./GSMFrameCoder2.d 17 | 18 | 19 | # Each subdirectory must supply rules for building sources it contributes 20 | %.o: ../%.cpp 21 | @echo 'Building file: $<' 22 | @echo 'Invoking: GCC C++ Compiler' 23 | g++ -O2 -g -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 24 | @echo 'Finished building: $<' 25 | @echo ' ' 26 | 27 | 28 | -------------------------------------------------------------------------------- /kali-gsm-step1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Updating Fresh Kali Linux..." 4 | 5 | apt update 6 | apt upgrade -y 7 | apt-get install -y kali-linux-all 8 | apt-get install -y flashplugin-nonfree 9 | update-flashplugin-nonfree --install 10 | 11 | echo "Done Updating." 12 | 13 | echo "Skipping Updating Device Firmware. (Should Be Done By Hand)" 14 | echo "HackRF Users: Check Out https://github.com/mossmann/hackrf/wiki/Updating-Firmware" 15 | 16 | echo "STEP 1: Go to Package Downloader (Applications -> Packages (Blue Arrow)) and search for 'osmo'. Download all packages related to SDR, GSM, or GR-GSM." 17 | echo "STEP 2: In Package Downloader, search for 'talloc' and download ALL packages." 18 | 19 | echo "STEP 3: Run kali-gsm-step3.sh for remaining steps." 20 | -------------------------------------------------------------------------------- /kalibrate-hackrf/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *~ 3 | .*.swp 4 | .*.swo 5 | .*.swn 6 | -------------------------------------------------------------------------------- /kalibrate-hackrf/AUTHORS: -------------------------------------------------------------------------------- 1 | Joshua Lackey 2 | Alexander Chemeris 3 | Steve Markgraf 4 | Wang Kang 5 | -------------------------------------------------------------------------------- /kalibrate-hackrf/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, Joshua Lackey 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 | POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /kalibrate-hackrf/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kalibrate-hackrf/ChangeLog -------------------------------------------------------------------------------- /kalibrate-hackrf/INSTALL: -------------------------------------------------------------------------------- 1 | /usr/share/automake-1.15/INSTALL -------------------------------------------------------------------------------- /kalibrate-hackrf/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | -------------------------------------------------------------------------------- /kalibrate-hackrf/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kalibrate-hackrf/NEWS -------------------------------------------------------------------------------- /kalibrate-hackrf/README: -------------------------------------------------------------------------------- 1 | Kalibrate, or kal, can scan for GSM base stations in a given frequency band and 2 | can use those GSM base stations to calculate the local oscillator frequency 3 | offset. 4 | 5 | See http://thre.at/kalibrate 6 | 7 | Copyright (c) 2010, Joshua Lackey (jl@thre.at) 8 | 9 | Copyright (c) 2012, Steve Markgraf (steve@steve-m.de) 10 | 11 | modified for use with hackrf devices, 12 | Copyright (c) 2014, Wang Kang (scateu@gmail.com) 13 | http://hackrf.net : A Chinese HackRF Community 14 | 15 | 16 | 2014-8-23 Update: 17 | 18 | Thanks to chris.kuethe@gmail.com who did a bunch of tinkering with this port of kalibrate. 19 | 20 | https://github.com/ckuethe/kalibrate-hackrf/ 21 | 22 | This now runs as fast as kalibrate-rtl 23 | 24 | 25 | 2015-3-3 Update: 26 | 27 | Add ability to specify channel when scanning to check power output for a single channel. 28 | 29 | Author: [xorrbit](https://github.com/xorrbit) 30 | -------------------------------------------------------------------------------- /kalibrate-hackrf/bootstrap: -------------------------------------------------------------------------------- 1 | rm -rf config.cache autom4te*.cache 2 | #autoreconf --install 3 | 4 | case `uname` in Darwin*) glibtoolize --automake ;; 5 | *) libtoolize --automake ;; esac 6 | aclocal 7 | autoconf 8 | autoheader 9 | automake --add-missing 10 | -------------------------------------------------------------------------------- /kalibrate-hackrf/compile: -------------------------------------------------------------------------------- 1 | /usr/share/automake-1.15/compile -------------------------------------------------------------------------------- /kalibrate-hackrf/config.guess: -------------------------------------------------------------------------------- 1 | /usr/share/automake-1.15/config.guess -------------------------------------------------------------------------------- /kalibrate-hackrf/config.sub: -------------------------------------------------------------------------------- 1 | /usr/share/automake-1.15/config.sub -------------------------------------------------------------------------------- /kalibrate-hackrf/configure.ac: -------------------------------------------------------------------------------- 1 | AC_PREREQ([2.64]) 2 | AC_INIT([kalibrate], [0.4.1], [jl@thre.at], [kal]) 3 | AC_CONFIG_SRCDIR([src/fcch_detector.cc]) 4 | AM_INIT_AUTOMAKE([-Wall -Werror]) 5 | AC_CONFIG_HEADERS([config.h]) 6 | 7 | # Checks for programs. 8 | AC_PROG_CXX 9 | AC_PROG_CC 10 | AC_PROG_LN_S 11 | AC_PROG_RANLIB 12 | 13 | # Checks for header files. 14 | AC_CHECK_HEADERS([stdlib.h string.h sys/time.h unistd.h]) 15 | 16 | # Checks for typedefs, structures, and compiler characteristics. 17 | AC_HEADER_STDBOOL 18 | AC_C_INLINE 19 | 20 | # Checks for library functions. 21 | AC_FUNC_STRTOD 22 | AC_CHECK_FUNCS([floor getpagesize memset sqrt strtoul strtol]) 23 | 24 | # Checks for libraries. 25 | PKG_CHECK_MODULES(FFTW3, fftw3 >= 3.0) 26 | AC_SUBST(FFTW3_LIBS) 27 | AC_SUBST(FFTW3_CFLAGS) 28 | 29 | # Checks for hackrf 30 | PKG_CHECK_MODULES(LIBHACKRF, libhackrf) 31 | AC_SUBST(LIBHACKRF_LIBS) 32 | AC_SUBST(LIBHACKRF_CFLAGS) 33 | 34 | # OSX doesn't support System V shared memory 35 | AC_CANONICAL_HOST 36 | case "$host_os" in 37 | darwin*) 38 | AC_DEFINE([D_HOST_OSX], [], [building for OSX]) 39 | ;; 40 | esac 41 | 42 | case "$host_cpu" in 43 | arm*) 44 | AC_DEFINE([D_HOST_OSX], [], [building without shared memory]) 45 | ;; 46 | esac 47 | 48 | AC_CONFIG_FILES([Makefile 49 | src/Makefile]) 50 | AC_OUTPUT 51 | -------------------------------------------------------------------------------- /kalibrate-hackrf/depcomp: -------------------------------------------------------------------------------- 1 | /usr/share/automake-1.15/depcomp -------------------------------------------------------------------------------- /kalibrate-hackrf/install-sh: -------------------------------------------------------------------------------- 1 | /usr/share/automake-1.15/install-sh -------------------------------------------------------------------------------- /kalibrate-hackrf/ltmain.sh: -------------------------------------------------------------------------------- 1 | /usr/share/libtool/build-aux/ltmain.sh -------------------------------------------------------------------------------- /kalibrate-hackrf/missing: -------------------------------------------------------------------------------- 1 | /usr/share/automake-1.15/missing -------------------------------------------------------------------------------- /kalibrate-hackrf/src/Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = kal 2 | 3 | kal_SOURCES = \ 4 | arfcn_freq.cc \ 5 | c0_detect.cc \ 6 | circular_buffer.cc \ 7 | fcch_detector.cc \ 8 | kal.cc \ 9 | offset.cc \ 10 | usrp_source.cc \ 11 | util.cc\ 12 | arfcn_freq.h \ 13 | c0_detect.h \ 14 | circular_buffer.h \ 15 | fcch_detector.h \ 16 | offset.h \ 17 | usrp_complex.h \ 18 | usrp_source.h \ 19 | util.h\ 20 | version.h 21 | 22 | kal_CXXFLAGS = $(FFTW3_CFLAGS) $(LIBHACKRF_CFLAGS) 23 | kal_LDADD = $(FFTW3_LIBS) $(LIBHACKRF_LIBS) -lrt 24 | -------------------------------------------------------------------------------- /kalibrate-hackrf/src/arfcn_freq.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010, Joshua Lackey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | enum 29 | { 30 | BI_NOT_DEFINED, 31 | GSM_850, 32 | GSM_R_900, 33 | GSM_900, 34 | GSM_E_900, 35 | DCS_1800, 36 | PCS_1900 37 | }; 38 | 39 | const char *bi_to_str (int bi); 40 | int str_to_bi (char *s); 41 | double arfcn_to_freq (int n, int *bi = 0); 42 | int freq_to_arfcn (double freq, int *bi = 0); 43 | int first_chan (int bi); 44 | int next_chan (int chan, int bi); 45 | -------------------------------------------------------------------------------- /kalibrate-hackrf/src/c0_detect.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010, Joshua Lackey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | int c0_detect (usrp_source * u, int bi, int channel); 29 | -------------------------------------------------------------------------------- /kalibrate-hackrf/src/kal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kalibrate-hackrf/src/kal -------------------------------------------------------------------------------- /kalibrate-hackrf/src/offset.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010, Joshua Lackey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | int offset_detect (usrp_source * u); 29 | -------------------------------------------------------------------------------- /kalibrate-hackrf/src/usrp_complex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010, Joshua Lackey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #include 29 | 30 | typedef 31 | std::complex < float > 32 | complex; 33 | -------------------------------------------------------------------------------- /kalibrate-hackrf/src/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010, Joshua Lackey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | void display_freq (float f); 29 | void sort (float *b, unsigned int len); 30 | double avg (float *b, unsigned int len, float *stddev); 31 | -------------------------------------------------------------------------------- /kalibrate-hackrf/src/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010, Joshua Lackey 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | * POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #pragma once 29 | static const char *const kal_version_string = PACKAGE_VERSION; 30 | -------------------------------------------------------------------------------- /kalibrate-hackrf/stamp-h1: -------------------------------------------------------------------------------- 1 | timestamp for config.h 2 | -------------------------------------------------------------------------------- /kraken/Kraken/A5Cpu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/Kraken/A5Cpu.so -------------------------------------------------------------------------------- /kraken/Kraken/DeltaLookup.h: -------------------------------------------------------------------------------- 1 | #ifndef DELTA_LOOKUP_H 2 | #define DELTA_LOOKUP_H 3 | #include 4 | #include 5 | #include 6 | #include "NcqDevice.h" 7 | 8 | class DeltaLookup { 9 | public: 10 | DeltaLookup(NcqDevice *dev, std::string index); 11 | ~DeltaLookup(); 12 | 13 | void setBlockOffset(uint64_t bo) {mBlockOffset=bo;} 14 | 15 | uint64_t StartEndpointSearch(NcqRequestor* req, uint64_t end, uint64_t& blockstart); 16 | 17 | int CompleteEndpointSearch(const void* pDataBlock, uint64_t blockstart, 18 | uint64_t endpoint, uint64_t& result); 19 | 20 | private: 21 | NcqDevice* mDevice; 22 | 23 | int* mBlockIndex; 24 | uint64_t* mPrimaryIndex; 25 | int mNumBlocks; 26 | int64_t mStepSize; // avarage step pr block 27 | 28 | uint64_t mLowEndpoint; 29 | uint64_t mHighEndpoint; 30 | uint64_t mBlockOffset; 31 | 32 | static bool mInitStatics; 33 | static unsigned short mBase[256]; 34 | static unsigned char mBits[256]; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /kraken/Kraken/Fragment.h: -------------------------------------------------------------------------------- 1 | #ifndef FRAGMENT_H 2 | #define FRAGMENT_H 3 | 4 | /** 5 | * A class that encapsulates a search fragment 6 | * a frgment is a test for: 7 | * 1 known plaintext 8 | * against: 9 | * 1 table (id) 10 | * 1 colour (round) 11 | **/ 12 | 13 | #include "NcqDevice.h" 14 | #include "DeltaLookup.h" 15 | #include 16 | 17 | class Fragment : public NcqRequestor { 18 | public: 19 | Fragment(uint64_t plaintext, unsigned int round, 20 | DeltaLookup* table, unsigned int advance); 21 | void processBlock(const void* pDataBlock); 22 | 23 | void setBitPos(int pos) {mBitPos=pos;} 24 | int getBitPos() {return mBitPos;} 25 | 26 | void setJobNum(unsigned int j) {mJobNum=j;} 27 | unsigned int getJobNum() {return mJobNum;} 28 | void setClientId(int id) {mClientId=id;} 29 | int getClientId() {return mClientId;} 30 | 31 | void handleSearchResult(uint64_t result, int start_round); 32 | 33 | int getState() {return mState;} 34 | 35 | private: 36 | uint64_t mKnownPlaintext; 37 | unsigned int mNumRound; 38 | unsigned int mAdvance; 39 | DeltaLookup* mTable; 40 | int mBitPos; 41 | int mState; 42 | unsigned int mJobNum; 43 | int mClientId; 44 | 45 | uint64_t mEndpoint; 46 | uint64_t mBlockStart; 47 | uint64_t mStartIndex; 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /kraken/Kraken/Kraken.h: -------------------------------------------------------------------------------- 1 | #ifndef KRAKEN_H 2 | #define KRAKEN_H 3 | 4 | #include "NcqDevice.h" 5 | #include "DeltaLookup.h" 6 | #include "Fragment.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "ServerCore.h" 17 | 18 | using namespace std; 19 | 20 | class Kraken { 21 | public: 22 | Kraken(const char* config, int server_port=0); 23 | ~Kraken(); 24 | 25 | void Crack(int client, const char* plaintext); 26 | bool Tick(); 27 | 28 | static Kraken* getInstance() { return mInstance; } 29 | void removeFragment(Fragment* frag); 30 | 31 | bool isUsingAti() {return mUsingAti;} 32 | 33 | void reportFind(string, int client); 34 | static void serverCmd(int, string); 35 | 36 | void showFragments(void); 37 | 38 | private: 39 | int mNumDevices; 40 | vector mDevices; 41 | list< pair > mTables; 42 | typedef list< pair >::iterator tableListIt; 43 | map mFragments; 44 | static Kraken* mInstance; 45 | sem_t mMutex; 46 | queue mWorkOrders; 47 | queue mWorkClients; 48 | bool mUsingAti; 49 | bool mBusy; 50 | ServerCore* mServer; 51 | unsigned int mJobCounter; 52 | map mJobMap; 53 | map mTimingMap; 54 | map mActiveMap; 55 | string mTableInfo; 56 | }; 57 | 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /kraken/Kraken/NcqDevice.h: -------------------------------------------------------------------------------- 1 | #ifndef NCQ_DEVICE_H 2 | #define NCQ_DEVICE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #if defined(__APPLE__) 8 | #define mmap64 mmap 9 | #endif /* __APPLE__ */ 10 | 11 | using namespace std; 12 | 13 | class NcqDevice; 14 | 15 | class NcqRequestor { 16 | public: 17 | NcqRequestor() {}; 18 | virtual ~NcqRequestor() {}; 19 | 20 | private: 21 | friend class NcqDevice; 22 | virtual void processBlock(const void* pDataBlock) = 0; 23 | }; 24 | 25 | class NcqDevice { 26 | public: 27 | NcqDevice(const char* pzDevNode); 28 | ~NcqDevice(); 29 | 30 | void Request(class NcqRequestor*, uint64_t blockno); 31 | void Cancel(class NcqRequestor*); 32 | 33 | typedef struct { 34 | class NcqRequestor* req; 35 | uint64_t blockno; 36 | } request_t; 37 | 38 | typedef struct { 39 | class NcqRequestor* req; 40 | uint64_t blockno; 41 | void* addr; 42 | int next_free; 43 | } mapRequest_t; 44 | 45 | static void* thread_stub(void* arg); 46 | void WorkerThread(); 47 | 48 | private: 49 | int mDevice; 50 | unsigned char mBuffer[4096]; 51 | mapRequest_t mMappings[32]; 52 | queue< request_t > mRequests; 53 | int mFreeMap; 54 | sem_t mMutex; 55 | pthread_t mWorker; 56 | bool mRunning; 57 | char mDevC; 58 | }; 59 | 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /kraken/Kraken/ServerCore.h: -------------------------------------------------------------------------------- 1 | /*********************************************** 2 | * 3 | * Simple single threaded servercore 4 | * 5 | **********************************************/ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | using namespace std; 13 | 14 | typedef void (*dispatch)(int, std::string); 15 | 16 | class ClientConnection { 17 | public: 18 | ClientConnection(int); 19 | ~ClientConnection(); 20 | 21 | int getFd() {return mFd;} 22 | int Write(string data); 23 | int Read(string& data); 24 | 25 | private: 26 | int mFd; 27 | string mBuffer; 28 | }; 29 | 30 | 31 | class ServerCore { 32 | public: 33 | ServerCore(int,dispatch); 34 | ~ServerCore(); 35 | 36 | void Write(int, string); 37 | void Broadcast(string); 38 | 39 | private: 40 | void Serve(); 41 | 42 | bool mRunning; 43 | static void* thread_stub(void* arg); 44 | pthread_t mThread; 45 | dispatch mDispatch; 46 | 47 | int mListener; 48 | unsigned int mClientCount; 49 | map mClientMap; 50 | sem_t mMutex; 51 | }; 52 | 53 | -------------------------------------------------------------------------------- /kraken/Kraken/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd ../a5_cpu/;./build.sh;cd ../Kraken/;cp ../a5_cpu/A5Cpu.so . 3 | 4 | g++ -O2 -fPIC -o kraken Kraken.cpp NcqDevice.cpp DeltaLookup.cpp Fragment.cpp ServerCore.cpp ../a5_cpu/A5CpuStubs.cpp ../a5_ati/A5AtiStubs.cpp -lpthread -ldl 5 | -------------------------------------------------------------------------------- /kraken/Kraken/kraken: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/Kraken/kraken -------------------------------------------------------------------------------- /kraken/TableConvert/BaseReader.h: -------------------------------------------------------------------------------- 1 | #ifndef BASEREADER_H 2 | #define BASEREADER_H 3 | 4 | #include 5 | 6 | class BaseReader { 7 | public: 8 | BaseReader() {}; 9 | virtual ~BaseReader() {}; 10 | virtual bool Read(uint64_t& endpoint, uint64_t& index) = 0; 11 | virtual bool isOK() = 0; 12 | }; 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /kraken/TableConvert/BaseWriter.h: -------------------------------------------------------------------------------- 1 | #ifndef BASEWRITER_H 2 | #define BASEWRITER_H 3 | 4 | #include 5 | 6 | class BaseWriter { 7 | public: 8 | BaseWriter() {}; 9 | virtual ~BaseWriter() {}; 10 | virtual void Write(uint64_t endpoint, uint64_t index) = 0; 11 | virtual bool isOK() = 0; 12 | }; 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /kraken/TableConvert/DeltaReader.h: -------------------------------------------------------------------------------- 1 | #ifndef DELTAREADER_H 2 | #define DELTAREADER_H 3 | 4 | #include "BaseReader.h" 5 | #include 6 | #include 7 | 8 | class DeltaReader : public BaseReader { 9 | public: 10 | DeltaReader(std::string &path); 11 | virtual ~DeltaReader(); 12 | virtual bool Read(uint64_t& endpoint, uint64_t& index); 13 | virtual bool isOK() {return mIsOK;} 14 | 15 | private: 16 | FILE* mFile; 17 | unsigned char mBuffer[1024]; 18 | unsigned int mBufPos; 19 | unsigned int mBitBuffer; 20 | unsigned int mBitCount; 21 | bool mIsOK; 22 | uint64_t mLast; 23 | unsigned int mLastBlock; 24 | /* Compact size for cache coherency */ 25 | unsigned short mBase[256]; 26 | unsigned char mBits[256]; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /kraken/TableConvert/DeltaWriter.h: -------------------------------------------------------------------------------- 1 | #ifndef DELTAWRITER_H 2 | #define DELTAWRITER_H 3 | 4 | #include "BaseWriter.h" 5 | #include 6 | #include 7 | 8 | class DeltaWriter : public BaseWriter { 9 | public: 10 | DeltaWriter(std::string &path); 11 | virtual ~DeltaWriter(); 12 | virtual void Write(uint64_t endpoint, uint64_t index); 13 | virtual bool isOK() {return mIsOK;} 14 | 15 | private: 16 | FILE* mFile; 17 | unsigned char mBuffer[1024]; 18 | unsigned int mBufPos; 19 | unsigned int mBitBuffer; 20 | unsigned int mBitCount; 21 | bool mIsOK; 22 | uint64_t mLast; 23 | unsigned int mRadixCount; 24 | uint64_t mBitsWritten; 25 | uint64_t mChainsWritten; 26 | /* Compact size for cache coherency */ 27 | unsigned short mBase[4096]; 28 | unsigned char mBits[4096]; 29 | unsigned char mGroup[4096]; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /kraken/TableConvert/Factory.h: -------------------------------------------------------------------------------- 1 | #include "BaseReader.h" 2 | #include "BaseWriter.h" 3 | 4 | BaseReader* CreateReader(char type, const char* args[], int &consumed); 5 | 6 | BaseWriter* CreateWriter(char type, const char* args[], int &consumed); 7 | 8 | -------------------------------------------------------------------------------- /kraken/TableConvert/IndexWriter.h: -------------------------------------------------------------------------------- 1 | #ifndef INDEXWRITER_H 2 | #define INDEXWRITER_H 3 | 4 | #include "BaseWriter.h" 5 | #include 6 | #include 7 | 8 | class IndexWriter : public BaseWriter { 9 | public: 10 | IndexWriter(std::string &path, std::string &index, unsigned int blockSize); 11 | virtual ~IndexWriter(); 12 | virtual void Write(uint64_t endpoint, uint64_t index); 13 | virtual bool isOK() {return mIsOK;} 14 | 15 | private: 16 | FILE* mFile; 17 | FILE* mIndexFile; 18 | unsigned int mBlockSize; 19 | unsigned char* mBuffer; 20 | unsigned int mBufPos; 21 | unsigned int mBitBuffer; 22 | unsigned int mBitCount; 23 | bool mIsOK; 24 | uint64_t mLast; 25 | unsigned int mRadixCount; 26 | uint64_t mBitsWritten; 27 | uint64_t mChainsWritten; 28 | uint64_t mLastEnd; 29 | /* Compact size for cache coherency */ 30 | unsigned short mBase[4096]; 31 | unsigned char mBits[4096]; 32 | unsigned char mGroup[4096]; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /kraken/TableConvert/Makefile: -------------------------------------------------------------------------------- 1 | 2 | DEPS = BaseReader.h DeltaReader.h Factory.h MultiFileWriter.h \ 3 | BaseWriter.h DeltaWriter.h MultiFileReader.h SSDreader.h \ 4 | SSDwriter.h 5 | 6 | SRC = DeltaReader.cpp SSDreader.cpp SSDwriter.cpp \ 7 | DeltaWriter.cpp MultiFileReader.cpp \ 8 | Factory.cpp MultiFileWriter.cpp \ 9 | Md5Writer.cpp md5.cpp IndexWriter.cpp 10 | 11 | all: TableCompare TableConvert TableDump 12 | 13 | TableCompare: $(DEPS) $(SRC) TableCompare.cpp 14 | g++ -O2 -o TableCompare TableCompare.cpp $(SRC) 15 | 16 | TableConvert: $(DEPS) $(SRC) TableConvert.cpp 17 | g++ -O2 -o TableConvert TableConvert.cpp $(SRC) 18 | 19 | TableDump: $(DEPS) $(SRC) TableDump.cpp 20 | g++ -O2 -o TableDump TableDump.cpp $(SRC) 21 | 22 | 23 | clean: 24 | rm -f TableCompare TableConvert TableDump 25 | -------------------------------------------------------------------------------- /kraken/TableConvert/Md5Writer.cpp: -------------------------------------------------------------------------------- 1 | #include "Md5Writer.h" 2 | #include "md5.h" 3 | #include 4 | #include 5 | #include 6 | 7 | Md5Writer::Md5Writer() 8 | { 9 | mHash = new MD5(); 10 | mIsOK = (mHash!=NULL); 11 | } 12 | 13 | Md5Writer::~Md5Writer() 14 | { 15 | if (mHash) { 16 | mHash->finalize(); 17 | char* digest = mHash->hex_digest(); 18 | printf("md5hash: %s\n",digest); 19 | delete[] digest; 20 | delete mHash; 21 | } 22 | } 23 | 24 | 25 | void Md5Writer::Write(uint64_t endpoint, uint64_t index) 26 | { 27 | unsigned char chunk[16]; 28 | unsigned char* ch = chunk; 29 | // Force little endian 30 | for(int i=0;i<8;i++) { 31 | *ch++ = (unsigned char)endpoint; 32 | endpoint = endpoint >> 8; 33 | } 34 | for(int i=0;i<8;i++) { 35 | *ch++ = (unsigned char)index; 36 | index = index >> 8; 37 | } 38 | mHash->update(chunk,16); 39 | } 40 | -------------------------------------------------------------------------------- /kraken/TableConvert/Md5Writer.h: -------------------------------------------------------------------------------- 1 | #ifndef MD5_WRITER_H 2 | #define MD5_WRITER_H 3 | 4 | #include "BaseWriter.h" 5 | #include 6 | #include 7 | #include "md5.h" 8 | 9 | class Md5Writer : public BaseWriter { 10 | public: 11 | Md5Writer(); 12 | virtual ~Md5Writer(); 13 | virtual void Write(uint64_t endpoint, uint64_t index); 14 | virtual bool isOK() {return mIsOK;} 15 | 16 | private: 17 | bool mIsOK; 18 | class MD5* mHash; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /kraken/TableConvert/MultiFileReader.h: -------------------------------------------------------------------------------- 1 | #ifndef MULTI_FILE_READER_H 2 | #define MULTI_FILE_READER_H 3 | 4 | #include "BaseReader.h" 5 | #include 6 | #include 7 | 8 | class MultiFileReader : public BaseReader { 9 | public: 10 | MultiFileReader(std::string &path); 11 | virtual ~MultiFileReader(); 12 | virtual bool Read(uint64_t& endpoint, uint64_t& index); 13 | virtual bool isOK() {return mIsOK;} 14 | 15 | private: 16 | bool NextFile(); 17 | bool ReadFile(); 18 | 19 | FILE* mFile; 20 | unsigned char mBuffer[4096*11]; 21 | unsigned int mBufPos; 22 | bool mIsOK; 23 | uint64_t mFirst; 24 | unsigned int mNumFile; 25 | unsigned int mRemain; /* number of bytes left in current file */ 26 | std::string mBaseName; 27 | unsigned int mLast; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /kraken/TableConvert/MultiFileWriter.h: -------------------------------------------------------------------------------- 1 | #ifndef MULTIFILEWRITER_H 2 | #define MULTIFILEWRITER_H 3 | 4 | #include "BaseWriter.h" 5 | #include 6 | #include 7 | #include 8 | 9 | class MultiFileWriter : public BaseWriter { 10 | public: 11 | MultiFileWriter(std::string &path); 12 | virtual ~MultiFileWriter(); 13 | void Write(uint64_t endpoint, uint64_t index); 14 | bool isOK() {return mIsOK;} 15 | 16 | private: 17 | FILE* mFiles[256]; 18 | unsigned char* mBuffers[256]; 19 | unsigned int mBufSize[256]; 20 | bool mIsOK; 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /kraken/TableConvert/SSDreader.h: -------------------------------------------------------------------------------- 1 | #ifndef SSD_READER_H 2 | #define SSD_READER_H 3 | 4 | #include "BaseReader.h" 5 | #include 6 | #include 7 | 8 | class SSDreader : public BaseReader { 9 | public: 10 | SSDreader(std::string &path, std::string indexpath); 11 | virtual ~SSDreader(); 12 | virtual bool Read(uint64_t& endpoint, uint64_t& index); 13 | virtual bool isOK() {return mIsOK;} 14 | 15 | private: 16 | FILE* mFile; 17 | FILE* mIndexFile; 18 | uint64_t mBuffer[512]; 19 | unsigned int mBufPos; 20 | bool mIsOK; 21 | uint64_t mFirst; 22 | unsigned int mNumBlocks; /* number of block left */ 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /kraken/TableConvert/SSDwriter.h: -------------------------------------------------------------------------------- 1 | #ifndef SSD_WRITER_H 2 | #define SSD_WRITER_H 3 | 4 | #include "BaseWriter.h" 5 | #include 6 | #include 7 | 8 | class SSDwriter : public BaseWriter { 9 | public: 10 | SSDwriter(std::string &path, std::string indexpath); 11 | virtual ~SSDwriter(); 12 | virtual void Write(uint64_t endpoint, uint64_t index); 13 | virtual bool isOK() {return mIsOK;} 14 | 15 | private: 16 | void Flush(); 17 | 18 | FILE* mFile; 19 | FILE* mIndexFile; 20 | uint64_t mBuffer[512]; 21 | unsigned int mBufPos; 22 | bool mIsOK; 23 | uint64_t mFirst; 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /kraken/TableConvert/TableDump.cpp: -------------------------------------------------------------------------------- 1 | #include "Factory.h" 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, const char* argv[]) 7 | { 8 | const char* usage = "usage: %s x file1... file2...\n" \ 9 | " where xy are format codes for the input.\n" \ 10 | " m - Multifile\n" \ 11 | " s - SSD (blockdevice + index)\n" \ 12 | " d - Delta (transitional compressed format without index.)\n"; 13 | 14 | 15 | if (argc<3) { 16 | printf(usage,argv[0]); 17 | return -1; 18 | } 19 | int consume = argc-2; 20 | 21 | BaseReader* dr = CreateReader(argv[1][0],&argv[2],consume); 22 | if (dr==NULL) { 23 | printf("No reader for type %c found.\n",argv[1][0]); 24 | return -1; 25 | } 26 | 27 | if (!dr->isOK()) { 28 | printf("Error opening files.\n"); 29 | return -1; 30 | } 31 | 32 | uint64_t e,i; 33 | uint64_t e2,i2; 34 | /* Read the first chain */ 35 | bool more = dr->Read(e,i); 36 | printf("Dumping file."); 37 | // printf("%llx %llx\n",e,i); 38 | // printf("%llx %llx\n",e2,i2); 39 | uint64_t cnt = 0; 40 | while(more) { 41 | printf("%llx %llx\n",e,i); 42 | cnt++; 43 | more = dr->Read(e,i); 44 | } 45 | cnt++; 46 | 47 | printf("%lli chains read.\n",cnt); 48 | 49 | delete dr; 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /kraken/TableGeneration/A5BrookStubs.h: -------------------------------------------------------------------------------- 1 | #ifndef A5_BROOK_STUBS 2 | #define A5_BROOK_STUBS 3 | 4 | #include 5 | 6 | bool A5BrookPipelineInfo(int &length); 7 | bool A5BrookInit(int advance, int max_rounds, int condition, bool use_tables); 8 | int A5BrookSubmit(uint64_t start_value, unsigned int start_round); 9 | int A5BrookSubmitPartial(uint64_t start_value, unsigned int stop_round); 10 | bool A5BrookPopResult(uint64_t& start_value, uint64_t& stop_value, int& start_round); 11 | void A5BrookShutdown(); 12 | 13 | void ApplyIndexFunc(uint64_t& start_index, int bits); 14 | int ExtractIndex(uint64_t& start_value, int bits); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /kraken/TableGeneration/CalDevice.h: -------------------------------------------------------------------------------- 1 | #ifndef CALDEVICE_H 2 | #define CALDEVICE_H 3 | 4 | #include "cal.h" 5 | #include 6 | #include 7 | 8 | class CalDevice { 9 | public: 10 | static CalDevice* createDevice(int num); 11 | CALcontext* getContext() {return &mCtx;} 12 | 13 | static int getNumDevices(); 14 | 15 | CALresource* resAllocRemote1D( int, CALformat, CALuint f=0 ); 16 | CALresource* resAllocRemote2D( int, int, CALformat, CALuint f=0 ); 17 | 18 | CALresource* resAllocLocal1D( int, CALformat, CALuint f=0 ); 19 | CALresource* resAllocLocal2D( int, int, CALformat, CALuint f=0 ); 20 | 21 | static void refResource(CALresource*); 22 | static void unrefResource(CALresource*); 23 | 24 | const CALdeviceinfo* getDeviceInfo() { return &mInfo; } 25 | const CALdeviceattribs* getDeviceAttribs() { return &mAttribs; } 26 | 27 | ~CalDevice(); 28 | 29 | private: 30 | CalDevice(int); 31 | void freeResource(CALresource*); 32 | 33 | CALdevice mDevice; 34 | CALcontext mCtx; /* 1 context pr device */ 35 | int mNumDev; 36 | CALdeviceinfo mInfo; 37 | CALdeviceattribs mAttribs; 38 | std::list mResources; 39 | static std::map mRefs; 40 | static std::map mOwners; 41 | bool mHasContext; 42 | }; 43 | 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /kraken/TableGeneration/CalModule.h: -------------------------------------------------------------------------------- 1 | #ifndef CALMODULE_H 2 | #define CALMODULE_H 3 | 4 | #include "CalDevice.h" 5 | #include "calcl.h" 6 | #include 7 | #include 8 | 9 | class CalModule { 10 | public: 11 | CalModule(CALcontext* ctx); 12 | ~CalModule(); 13 | 14 | bool Load(CALimage &image); 15 | CALmem* Bind(const char* name, CALresource* pRes); 16 | bool Exec(CALdomain &dom, int groupsize = 0); 17 | bool Finished(); 18 | 19 | CALcontext* GetContext() {return mCtx;} 20 | 21 | private: 22 | void Cleanup(); 23 | 24 | CalDevice* mDev; 25 | CALcontext* mCtx; 26 | CALmodule mModule; 27 | CALfunc mEntry; 28 | bool mLoaded; 29 | typedef struct { 30 | CALresource* pRes; 31 | CALmem mem; 32 | CALname name; 33 | } stream_t; 34 | typedef std::map streamdict_t; 35 | streamdict_t mStreams; 36 | 37 | bool mRunning; 38 | CALevent mEvent; 39 | }; 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /kraken/TableGeneration/Makefile: -------------------------------------------------------------------------------- 1 | 2 | INCLUDES = -I/usr/local/atical/include 3 | LIBS = -laticalrt -laticalcl 4 | 5 | CPP_FLAGS = -O2 -fPIC 6 | 7 | all: A5Brook.so 8 | 9 | my_kernel_dp11.o: my_kernel_dp11.Z 10 | ld -s -r -o my_kernel_dp11.o -b binary my_kernel_dp11.Z 11 | 12 | my_kernel_dp12.o: my_kernel_dp12.Z 13 | ld -s -r -o my_kernel_dp12.o -b binary my_kernel_dp12.Z 14 | 15 | my_kernel_dp13.o: my_kernel_dp13.Z 16 | ld -s -r -o my_kernel_dp13.o -b binary my_kernel_dp13.Z 17 | 18 | my_kernel_dp14.o: my_kernel_dp14.Z 19 | ld -s -r -o my_kernel_dp14.o -b binary my_kernel_dp14.Z 20 | 21 | A5Slice.o: A5Slice.cpp A5Slice.h 22 | gcc $(CPP_FLAGS) -c A5Slice.cpp $(INCLUDES) 23 | 24 | kernelLib.o: kernelLib.cpp kernelLib.h 25 | gcc $(CPP_FLAGS) -c kernelLib.cpp $(INCLUDES) 26 | 27 | A5Brook.o: A5Brook.cpp A5Brook.h A5Slice.h CalDevice.o CalModule.o 28 | gcc $(CPP_FLAGS) -c A5Brook.cpp $(INCLUDES) -D BUILDING_DLL 29 | 30 | A5Brook.so: A5Slice.o A5Brook.o CalDevice.o CalModule.o kernelLib.o \ 31 | my_kernel_dp11.o my_kernel_dp12.o my_kernel_dp13.o my_kernel_dp14.o 32 | g++ -o A5Brook.so A5Brook.o A5Slice.o CalDevice.o \ 33 | my_kernel_dp11.o my_kernel_dp12.o my_kernel_dp13.o \ 34 | my_kernel_dp14.o CalModule.o kernelLib.o $(LIBS) -ldl -lz -shared 35 | 36 | CalDevice.o: CalDevice.cpp CalDevice.h 37 | gcc $(CPP_FLAGS) -c CalDevice.cpp $(INCLUDES) 38 | 39 | CalModule.o: CalModule.cpp CalModule.h CalDevice.h 40 | gcc $(CPP_FLAGS) -c CalModule.cpp $(INCLUDES) 41 | 42 | clean: 43 | rm -rf CalDevice.o CalModule.o A5Brook.o A5Slice.o \ 44 | A5Brook.so kernelLib.o my_kernel_dp*.o 45 | 46 | -------------------------------------------------------------------------------- /kraken/TableGeneration/MultiFileWriter.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/TableGeneration/MultiFileWriter.pyc -------------------------------------------------------------------------------- /kraken/TableGeneration/brook/gen_compressed_kernels.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys 3 | import zlib 4 | import os 5 | 6 | #if len(sys.argv)<2: 7 | # print "usage ", sys.argv[0], " IL file" 8 | # sys.exit(-1) 9 | 10 | def makebrz(dp_bits): 11 | try: 12 | os.unlink("a5_slice_dpX_a5slicer.il") 13 | except OSError: 14 | pass 15 | dpdefs="" 16 | for i in range(dp_bits-11): 17 | dpdefs = dpdefs + " -D DP_BIT_%i" % (i+12,) 18 | print "DP_DEFS: ", dpdefs 19 | os.system("/usr/local/atibrook/sdk/bin/brcc -k -pp %s a5_slice_dpX.br" % (dpdefs,) ) 20 | f = open("a5_slice_dpX_a5slicer.il") 21 | if f==None: 22 | print "Could not read ", sys.argv[1] 23 | sys.exit(-1) 24 | 25 | data = f.read() 26 | f.close() 27 | 28 | oname = "../my_kernel_dp%i.Z" % (dp_bits,) 29 | data2 = zlib.compress(data) 30 | fo = open( oname, "wb" ) 31 | fo.write(data2) 32 | fo.close() 33 | #os.system("ld -s -r -o ../%s.o -b binary %s" % (oname[:-2],oname)) 34 | 35 | makebrz(11) 36 | # makebrz(12) 37 | makebrz(13) 38 | makebrz(14) 39 | 40 | -------------------------------------------------------------------------------- /kraken/TableGeneration/kernelLib.h: -------------------------------------------------------------------------------- 1 | #ifndef KERNEL_LIB_H 2 | #define KERNEL_LIB_H 3 | 4 | unsigned char* getKernel(unsigned int dp); 5 | void freeKernel(unsigned char* k); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /kraken/TableGeneration/manual3.il.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/TableGeneration/manual3.il.Z -------------------------------------------------------------------------------- /kraken/TableGeneration/my_kernel_dp11.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/TableGeneration/my_kernel_dp11.Z -------------------------------------------------------------------------------- /kraken/TableGeneration/my_kernel_dp12.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/TableGeneration/my_kernel_dp12.Z -------------------------------------------------------------------------------- /kraken/TableGeneration/my_kernel_dp13.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/TableGeneration/my_kernel_dp13.Z -------------------------------------------------------------------------------- /kraken/TableGeneration/my_kernel_dp14.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/TableGeneration/my_kernel_dp14.Z -------------------------------------------------------------------------------- /kraken/Utilities/A5Cpu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/Utilities/A5Cpu.so -------------------------------------------------------------------------------- /kraken/Utilities/Bidirectional.h: -------------------------------------------------------------------------------- 1 | #ifndef BIDERECTIONAL_H 2 | #define BIDERECTIONAL_H 3 | 4 | #include 5 | #include 6 | 7 | #define MAX_STEPS 250 8 | 9 | class Bidirectional { 10 | public: 11 | Bidirectional(); 12 | 13 | void ClockBack(uint64_t final, int steps, int offset1=0, int offset2=0, int offset3=0); 14 | 15 | uint64_t Forwards(uint64_t start, int steps, unsigned char* out); 16 | static uint64_t ReverseBits(uint64_t r); 17 | bool PopCandidate(uint64_t& c); 18 | 19 | void doPrintCand(bool d) {mPrintCand=d;} 20 | 21 | private: 22 | void FillBack(uint64_t final); 23 | 24 | std::list mCandidates; 25 | uint64_t mBack1[MAX_STEPS]; 26 | uint64_t mBack2[MAX_STEPS]; 27 | uint64_t mBack3[MAX_STEPS]; 28 | bool mPrintCand; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /kraken/Utilities/DeltaLookup.h: -------------------------------------------------------------------------------- 1 | #ifndef DELTA_LOOKUP_H 2 | #define DELTA_LOOKUP_H 3 | #include 4 | #include 5 | #include 6 | 7 | class DeltaLookup { 8 | public: 9 | DeltaLookup(std::string index, std::string device); 10 | ~DeltaLookup(); 11 | int FindEndpoint(uint64_t end); 12 | 13 | bool PopResult(uint64_t & dst); 14 | void SetBlockOffset(uint64_t bo) {mBlockOffset=bo;} 15 | 16 | private: 17 | int mDevice; 18 | 19 | std::queue mHits; 20 | 21 | int* mBlockIndex; 22 | uint64_t* mPrimaryIndex; 23 | int mNumBlocks; 24 | int64_t mStepSize; // avarage step pr block 25 | unsigned char mBuffer[4096]; 26 | uint64_t mLowEndpoint; 27 | uint64_t mHighEndpoint; 28 | uint64_t mBlockOffset; 29 | 30 | static bool mInitStatics; 31 | static unsigned short mBase[256]; 32 | static unsigned char mBits[256]; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /kraken/Utilities/Makefile: -------------------------------------------------------------------------------- 1 | all: sort2 extract simpletest A5Cpu.so SSDwriter SSDexploder checktable a5lookup getstate find_kc 2 | 3 | sort2: sort2.cpp 4 | g++ -O2 -o sort2 sort2.cpp -lpthread 5 | 6 | extract: extract.cpp 7 | g++ -o extract extract.cpp 8 | 9 | simpletest: simpletest.cpp Bidirectional.cpp 10 | g++ -o simpletest simpletest.cpp Bidirectional.cpp 11 | 12 | getstate: getstate.cpp Bidirectional.cpp 13 | g++ -o getstate getstate.cpp Bidirectional.cpp 14 | 15 | A5Cpu.so: 16 | cd ../a5_cpu/;./build.sh;cd ../Utilities/;cp ../a5_cpu/A5Cpu.so . 17 | 18 | SSDwriter: SSDwriter.cpp 19 | g++ -O2 -o SSDwriter SSDwriter.cpp 20 | 21 | SSDexploder: MultiFileWriter.cpp SSDexploder.cpp MultiFileWriter.h 22 | g++ -O2 -o SSDexploder MultiFileWriter.cpp SSDexploder.cpp 23 | 24 | checktable: A5Cpu.so checktable.cpp 25 | g++ -O2 -o checktable checktable.cpp ../a5_cpu/A5CpuStubs.cpp -ldl 26 | 27 | a5lookup: a5lookup.cpp Bidirectional.cpp SSDlookup.cpp DeltaLookup.cpp 28 | g++ -g -o a5lookup a5lookup.cpp Bidirectional.cpp SSDlookup.cpp DeltaLookup.cpp \ 29 | ../a5_cpu/A5CpuStubs.cpp -ldl 30 | 31 | find_kc: find_kc.cpp Bidirectional.cpp TheMatrix.cpp Bidirectional.h TheMatrix.h 32 | g++ -o find_kc find_kc.cpp Bidirectional.cpp TheMatrix.cpp 33 | 34 | clean: 35 | rm -f sort2 extract simpletest A5Cpu.so SSDexploder checktable a5lookup find_kc getstate SSDwriter 36 | -------------------------------------------------------------------------------- /kraken/Utilities/MultiFileWriter.h: -------------------------------------------------------------------------------- 1 | #ifndef MULTIFILEWRITER_H 2 | #define MULTIFILEWRITER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class MultiFileWriter { 9 | public: 10 | MultiFileWriter(std::string &path); 11 | ~MultiFileWriter(); 12 | void Write(uint64_t endpoint, uint64_t index); 13 | bool isOK() {return mIsOK;} 14 | 15 | private: 16 | FILE* mFiles[256]; 17 | unsigned char* mBuffers[256]; 18 | unsigned int mBufSize[256]; 19 | bool mIsOK; 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /kraken/Utilities/SSDexploder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/Utilities/SSDexploder -------------------------------------------------------------------------------- /kraken/Utilities/SSDlookup.h: -------------------------------------------------------------------------------- 1 | #ifndef SSD_LOOKUP_H 2 | #define SSD_LOOKUP_H 3 | #include 4 | #include 5 | #include 6 | 7 | class SSDlookup { 8 | public: 9 | SSDlookup(std::string index, std::string device); 10 | ~SSDlookup(); 11 | int FindEndpoint(uint64_t end); 12 | 13 | bool PopResult(uint64_t & dst); 14 | 15 | private: 16 | int mDevice; 17 | 18 | std::queue mHits; 19 | 20 | uint64_t* mBlockIndex; 21 | int mNumBlocks; 22 | int mFirstStep; 23 | uint64_t* mData; 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /kraken/Utilities/SSDwriter: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/Utilities/SSDwriter -------------------------------------------------------------------------------- /kraken/Utilities/TheMatrix.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class TheMatrix { 4 | public: 5 | TheMatrix(); 6 | 7 | uint64_t KeyMix(uint64_t); 8 | uint64_t KeyUnmix(uint64_t); 9 | uint64_t KeyMixSlow(uint64_t); 10 | 11 | uint64_t CountMix(uint64_t, uint64_t); 12 | uint64_t CountUnmix(uint64_t, uint64_t ); 13 | 14 | uint64_t mMat1[64]; 15 | uint64_t mMat2[64]; 16 | uint64_t mMat3[64]; 17 | private: 18 | void Invert(); 19 | }; 20 | 21 | -------------------------------------------------------------------------------- /kraken/Utilities/a5lookup: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/Utilities/a5lookup -------------------------------------------------------------------------------- /kraken/Utilities/btest.cpp: -------------------------------------------------------------------------------- 1 | #include "Bidirectional.h" 2 | 3 | #include 4 | #include 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | long long out = 0; 9 | int lfsr1 = 0x1234; 10 | int lfsr2 = 0x5678; 11 | int lfsr3 = 0x9abc; 12 | 13 | Bidirectional back; 14 | 15 | if (argc==3) { 16 | unsigned int a,b; 17 | sscanf(argv[2],"%x:%x",&a,&b); 18 | // printf("%08x %08x\n",a,b); 19 | // uint64_t tst = back.Forwards(0x123456789abcdef0ULL, 230, NULL); 20 | uint64_t tst = ((uint64_t)a)<<32|b; 21 | // uint64_t tst = back.Forwards(0x8680a4cec29e70f5ULL, 110, NULL); 22 | std::cout << std::hex << tst << "\n"; 23 | back.ClockBack( tst , 110 ); 24 | std::cout << std::hex << tst << "\n"; 25 | } else { 26 | FILE *fd = fopen(argv[1],"wb"); 27 | if (fd==0) { 28 | printf("Can't write to %s\n", argv[1]); 29 | return -1; 30 | } 31 | FILE* rnd = fopen("/dev/urandom", "rb"); 32 | if (rnd==0) { 33 | printf("Can't read /dev/urandom\n"); 34 | fclose(fd); 35 | return -1; 36 | } 37 | 38 | for (int i=0; i < 1000; i++) { 39 | unsigned char cipherstream[15]; 40 | uint64_t key = 0xf5a472fcfa67c694ULL; 41 | fread( &key, sizeof(uint64_t), 1 , rnd); 42 | uint64_t mixed = back.Forwards(key, 100, NULL); 43 | back.Forwards(mixed, 114, cipherstream); 44 | 45 | fwrite(cipherstream,sizeof(unsigned char),15,fd); 46 | } 47 | fclose(rnd); 48 | fclose(fd); 49 | } 50 | 51 | #if 0 52 | 53 | printf("\nFinal state: %x %x %x\n", lfsr1, lfsr2, lfsr3); 54 | std::cout << std::hex << out << "\n"; 55 | 56 | #endif 57 | 58 | } 59 | -------------------------------------------------------------------------------- /kraken/Utilities/checktable: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/Utilities/checktable -------------------------------------------------------------------------------- /kraken/Utilities/extract: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/Utilities/extract -------------------------------------------------------------------------------- /kraken/Utilities/extract.cpp: -------------------------------------------------------------------------------- 1 | #include "SSDlookup.h" 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | unsigned char cipher[16]; 9 | 10 | if (argc<2) { 11 | printf("usage: %s frame\n views frame from challenge.bin\n",argv[0]); 12 | return 0; 13 | } 14 | FILE* fd=fopen("challenge.bin","r"); 15 | assert(fd); 16 | int frame = atoi(argv[1]); 17 | fseek(fd,15*(frame-1),SEEK_SET); 18 | fread(cipher, 1,15,fd); 19 | fclose(fd); 20 | for(int i=0;i<15;i++) printf("%02x ",cipher[i]); 21 | printf("\n"); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /kraken/Utilities/find_kc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/Utilities/find_kc -------------------------------------------------------------------------------- /kraken/Utilities/getstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/Utilities/getstate -------------------------------------------------------------------------------- /kraken/Utilities/getstate.cpp: -------------------------------------------------------------------------------- 1 | #include "Bidirectional.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char* argv[]) 8 | { 9 | Bidirectional back; 10 | 11 | if (argc==3) { 12 | uint64_t tst; 13 | uint64_t orig; 14 | int ticks = atoi(argv[1]); 15 | sscanf(argv[2],"%llx",&tst); 16 | orig = tst; 17 | std::cout << "Start: " << std::hex << tst << "\n"; 18 | tst = back.Forwards(tst, 100+ticks, NULL); 19 | std::cout << std::hex << tst << "\n"; 20 | uint64_t lfsr1 = tst & 0x7ffff; 21 | uint64_t lfsr2 = (tst>>19) & 0x3fffff; 22 | uint64_t lfsr3 = (tst>>41) & 0x7fffff; 23 | 24 | std::cout << "Lfsr1: " << std::hex << lfsr1 << "\n"; 25 | std::cout << "Lfsr2: " << std::hex << lfsr2 << "\n"; 26 | std::cout << "Lfsr3: " << std::hex << lfsr3 << "\n"; 27 | 28 | unsigned char cipherstream[16]; 29 | uint64_t mixed = back.Forwards(orig, 100, NULL); 30 | back.Forwards(mixed, 114, cipherstream); 31 | for (int i=0; i<15;i++) printf("%02x ",cipherstream[i]); 32 | printf("\n"); 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /kraken/Utilities/simpletest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/Utilities/simpletest -------------------------------------------------------------------------------- /kraken/Utilities/simpletest.cpp: -------------------------------------------------------------------------------- 1 | #include "Bidirectional.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int main(int argc, char* argv[]) 10 | { 11 | Bidirectional back; 12 | 13 | int frame = -1; 14 | bool match = false; 15 | unsigned char search_cipher[16]; 16 | 17 | if (argc>=4) { 18 | sscanf(argv[3],"%i",&frame); 19 | FILE* fd=fopen("challenge.bin","r"); 20 | assert(fd); 21 | fseek(fd,15*(frame-1),SEEK_SET); 22 | fread(search_cipher, 1,15,fd); 23 | fclose(fd); 24 | printf("Input ciper stream (%i): ",frame); 25 | for (int i=0; i<15;i++) printf("%02x ",search_cipher[i]); 26 | printf("\n"); 27 | } 28 | 29 | 30 | if (argc>=3) { 31 | uint64_t tst; 32 | int ticks = atoi(argv[1]); 33 | sscanf(argv[2],"%llx",&tst); 34 | std::cout << "Start: " << std::hex << tst << "\n"; 35 | tst = back.Forwards(tst, 100, NULL); 36 | printf("Stepping back 100 + %i ticks.\n", ticks); 37 | std::cout << std::hex << tst << "\n"; 38 | back.ClockBack( tst , ticks+100 ); 39 | while (back.PopCandidate(tst)) { 40 | unsigned char cipherstream[16]; 41 | std::cout << std::hex << tst << "\n"; 42 | uint64_t mixed = back.Forwards(tst, 100, NULL); 43 | back.Forwards(mixed, 114, cipherstream); 44 | for (int i=0; i<15;i++) printf("%02x ",cipherstream[i]); 45 | if ((frame>=0)&&(!match)) { 46 | match = (memcmp(search_cipher,cipherstream,15)==0); 47 | } 48 | printf("\n"); 49 | } 50 | } 51 | 52 | if (frame>=0) { 53 | printf( match ? "Complete match\n" : "partial match, false hit\n" ); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /kraken/Utilities/sort2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/Utilities/sort2 -------------------------------------------------------------------------------- /kraken/Utilities/xor.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import sys 4 | 5 | if len(sys.argv) >= 3: 6 | if len(sys.argv[1])>=114 and len(sys.argv[2])>=114: 7 | r = "" 8 | for i in range(114): 9 | a = ord(sys.argv[1][i]) 10 | b = ord(sys.argv[2][i]) 11 | r = r+chr(48^a^b) 12 | print r 13 | -------------------------------------------------------------------------------- /kraken/a5_ati/A5AtiStubs.h: -------------------------------------------------------------------------------- 1 | #ifndef A5_ATI_STUBS 2 | #define A5_ATI_STUBS 3 | 4 | #include 5 | 6 | bool A5AtiPipelineInfo(int &length); 7 | bool A5AtiInit(int max_rounds, int condition, unsigned int gpu_mask, 8 | int pipeline_mul); 9 | int A5AtiSubmit(uint64_t start_value, unsigned int start_round, 10 | uint32_t advance, void* context); 11 | int A5AtiSubmitPartial(uint64_t start_value, unsigned int stop_round, 12 | uint32_t advance, void* context); 13 | bool A5AtiPopResult(uint64_t& start_value, uint64_t& stop_value, 14 | void** context); 15 | void A5AtiShutdown(); 16 | 17 | void ApplyIndexFunc(uint64_t& start_index, int bits); 18 | int ExtractIndex(uint64_t& start_value, int bits); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /kraken/a5_ati/Advance.cpp: -------------------------------------------------------------------------------- 1 | #include "Advance.h" 2 | #include 3 | 4 | /* Reverse bit order of an unsigned 64 bits int */ 5 | uint64_t Advance::ReverseBits(uint64_t r) 6 | { 7 | uint64_t r1 = r; 8 | uint64_t r2 = 0; 9 | for (int j = 0; j < 64 ; j++ ) { 10 | r2 = (r2<<1) | (r1 & 0x01); 11 | r1 = r1 >> 1; 12 | } 13 | return r2; 14 | } 15 | 16 | /* Get next number from lfsr random number generator */ 17 | uint64_t Advance::AdvanceRFlfsr(uint64_t v) 18 | { 19 | for (int i = 0; i < 64; i++) { 20 | uint64_t fb = ( 21 | ~( 22 | ((v >> 63) & 1) ^ 23 | ((v >> 62) & 1) ^ 24 | ((v >> 60) & 1) ^ 25 | ((v >> 59) & 1) 26 | ) 27 | ) & 1; 28 | v <<= 1; 29 | v |= fb; 30 | } 31 | return v; 32 | } 33 | 34 | Advance::Advance(unsigned int id, unsigned int size) 35 | { 36 | mAdvances = new uint64_t[size]; 37 | mRFtable = new uint32_t[2*size]; 38 | 39 | uint64_t r = 0; 40 | for (int i=0; i>32); 47 | r = AdvanceRFlfsr(r); 48 | } 49 | } 50 | 51 | Advance::~Advance() 52 | { 53 | delete [] mAdvances; 54 | delete [] mRFtable; 55 | } 56 | -------------------------------------------------------------------------------- /kraken/a5_ati/Advance.h: -------------------------------------------------------------------------------- 1 | #ifndef ADVANCE_H 2 | #define ADVANCE_H 3 | 4 | #include 5 | 6 | class Advance { 7 | public: 8 | Advance(unsigned int id, unsigned int size); 9 | ~Advance(); 10 | 11 | const uint64_t* getAdvances() {return mAdvances;} 12 | const uint32_t* getRFtable() {return mRFtable;} 13 | 14 | private: 15 | uint64_t AdvanceRFlfsr(uint64_t v); 16 | uint64_t ReverseBits(uint64_t r); 17 | uint64_t* mAdvances; 18 | uint32_t* mRFtable; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /kraken/a5_ati/CalDevice.h: -------------------------------------------------------------------------------- 1 | #ifndef CALDEVICE_H 2 | #define CALDEVICE_H 3 | 4 | #include "cal.h" 5 | #include 6 | #include 7 | 8 | class CalDevice { 9 | public: 10 | static CalDevice* createDevice(int num); 11 | CALcontext* getContext() {return &mCtx;} 12 | 13 | static int getNumDevices(); 14 | 15 | CALresource* resAllocRemote1D( int, CALformat, CALuint f=0 ); 16 | CALresource* resAllocRemote2D( int, int, CALformat, CALuint f=0 ); 17 | 18 | CALresource* resAllocLocal1D( int, CALformat, CALuint f=0 ); 19 | CALresource* resAllocLocal2D( int, int, CALformat, CALuint f=0 ); 20 | 21 | static void refResource(CALresource*); 22 | static void unrefResource(CALresource*); 23 | 24 | const CALdeviceinfo* getDeviceInfo() { return &mInfo; } 25 | const CALdeviceattribs* getDeviceAttribs() { return &mAttribs; } 26 | 27 | ~CalDevice(); 28 | 29 | private: 30 | CalDevice(int); 31 | void freeResource(CALresource*); 32 | 33 | CALdevice mDevice; 34 | CALcontext mCtx; /* 1 context pr device */ 35 | int mNumDev; 36 | CALdeviceinfo mInfo; 37 | CALdeviceattribs mAttribs; 38 | std::list mResources; 39 | static std::map mRefs; 40 | static std::map mOwners; 41 | bool mHasContext; 42 | }; 43 | 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /kraken/a5_ati/CalModule.h: -------------------------------------------------------------------------------- 1 | #ifndef CALMODULE_H 2 | #define CALMODULE_H 3 | 4 | #include "CalDevice.h" 5 | #include "calcl.h" 6 | #include 7 | #include 8 | 9 | class CalModule { 10 | public: 11 | CalModule(CALcontext* ctx); 12 | ~CalModule(); 13 | 14 | bool Load(CALimage &image); 15 | CALmem* Bind(const char* name, CALresource* pRes); 16 | bool Exec(CALdomain &dom, int groupsize = 0); 17 | bool Finished(); 18 | 19 | CALcontext* GetContext() {return mCtx;} 20 | 21 | private: 22 | void Cleanup(); 23 | 24 | CalDevice* mDev; 25 | CALcontext* mCtx; 26 | CALmodule mModule; 27 | CALfunc mEntry; 28 | bool mLoaded; 29 | typedef struct { 30 | CALresource* pRes; 31 | CALmem mem; 32 | CALname name; 33 | } stream_t; 34 | typedef std::map streamdict_t; 35 | streamdict_t mStreams; 36 | 37 | bool mRunning; 38 | CALevent mEvent; 39 | }; 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /kraken/a5_ati/Makefile: -------------------------------------------------------------------------------- 1 | 2 | INCLUDES = -I/usr/local/atical/include 3 | LIBS = -laticalrt -laticalcl 4 | 5 | CPP_FLAGS = -O2 -fPIC 6 | 7 | all: A5Ati.so 8 | 9 | my_kernel_dp11.o: my_kernel_dp11.Z 10 | ld -s -r -o my_kernel_dp11.o -b binary my_kernel_dp11.Z 11 | 12 | my_kernel_dp12.o: my_kernel_dp12.Z 13 | ld -s -r -o my_kernel_dp12.o -b binary my_kernel_dp12.Z 14 | 15 | my_kernel_dp13.o: my_kernel_dp13.Z 16 | ld -s -r -o my_kernel_dp13.o -b binary my_kernel_dp13.Z 17 | 18 | my_kernel_dp14.o: my_kernel_dp14.Z 19 | ld -s -r -o my_kernel_dp14.o -b binary my_kernel_dp14.Z 20 | 21 | A5Slice.o: A5Slice.cpp A5Slice.h 22 | gcc $(CPP_FLAGS) -c A5Slice.cpp $(INCLUDES) 23 | 24 | kernelLib.o: kernelLib.cpp kernelLib.h 25 | gcc $(CPP_FLAGS) -c kernelLib.cpp $(INCLUDES) 26 | 27 | Advance.o: Advance.h Advance.cpp 28 | gcc $(CPP_FLAGS) -c Advance.cpp $(INCLUDES) -D BUILDING_DLL 29 | 30 | A5Ati.o: A5Ati.cpp A5Ati.h A5Slice.h CalDevice.o CalModule.o Advance.h 31 | gcc $(CPP_FLAGS) -c A5Ati.cpp $(INCLUDES) -D BUILDING_DLL 32 | 33 | A5Ati.so: A5Slice.o A5Ati.o CalDevice.o CalModule.o kernelLib.o \ 34 | my_kernel_dp11.o my_kernel_dp12.o my_kernel_dp13.o my_kernel_dp14.o \ 35 | Advance.o 36 | g++ -o A5Ati.so A5Ati.o A5Slice.o CalDevice.o Advance.o \ 37 | my_kernel_dp11.o my_kernel_dp12.o my_kernel_dp13.o \ 38 | my_kernel_dp14.o CalModule.o kernelLib.o $(LIBS) -ldl -lz -shared 39 | 40 | CalDevice.o: CalDevice.cpp CalDevice.h 41 | gcc $(CPP_FLAGS) -c CalDevice.cpp $(INCLUDES) 42 | 43 | CalModule.o: CalModule.cpp CalModule.h CalDevice.h 44 | gcc $(CPP_FLAGS) -c CalModule.cpp $(INCLUDES) 45 | 46 | clean: 47 | rm -rf CalDevice.o CalModule.o A5Ati.o A5Slice.o \ 48 | A5Ati.so Advance.o kernelLib.o my_kernel_dp*.o 49 | 50 | -------------------------------------------------------------------------------- /kraken/a5_ati/brook/gen_compressed_kernels.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import sys 3 | import zlib 4 | import os 5 | 6 | #if len(sys.argv)<2: 7 | # print "usage ", sys.argv[0], " IL file" 8 | # sys.exit(-1) 9 | 10 | def makebrz(dp_bits): 11 | try: 12 | os.unlink("a5_slice_dpX_a5slicer.il") 13 | except OSError: 14 | pass 15 | dpdefs="" 16 | for i in range(dp_bits-11): 17 | dpdefs = dpdefs + " -D DP_BIT_%i" % (i+12,) 18 | print "DP_DEFS: ", dpdefs 19 | os.system("/usr/local/atibrook/sdk/bin/brcc -k -pp %s a5_slice_dpX.br" % (dpdefs,) ) 20 | f = open("a5_slice_dpX_a5slicer.il") 21 | if f==None: 22 | print "Could not read ", sys.argv[1] 23 | sys.exit(-1) 24 | 25 | data = f.read() 26 | f.close() 27 | 28 | oname = "../my_kernel_dp%i.Z" % (dp_bits,) 29 | data2 = zlib.compress(data) 30 | fo = open( oname, "wb" ) 31 | fo.write(data2) 32 | fo.close() 33 | #os.system("ld -s -r -o ../%s.o -b binary %s" % (oname[:-2],oname)) 34 | 35 | makebrz(11) 36 | # makebrz(12) 37 | makebrz(13) 38 | makebrz(14) 39 | 40 | -------------------------------------------------------------------------------- /kraken/a5_ati/kernelLib.h: -------------------------------------------------------------------------------- 1 | #ifndef KERNEL_LIB_H 2 | #define KERNEL_LIB_H 3 | 4 | unsigned char* getKernel(unsigned int dp); 5 | void freeKernel(unsigned char* k); 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /kraken/a5_ati/manual3.il.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/a5_ati/manual3.il.Z -------------------------------------------------------------------------------- /kraken/a5_ati/my_kernel_dp11.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/a5_ati/my_kernel_dp11.Z -------------------------------------------------------------------------------- /kraken/a5_ati/my_kernel_dp12.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/a5_ati/my_kernel_dp12.Z -------------------------------------------------------------------------------- /kraken/a5_ati/my_kernel_dp13.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/a5_ati/my_kernel_dp13.Z -------------------------------------------------------------------------------- /kraken/a5_ati/my_kernel_dp14.Z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/a5_ati/my_kernel_dp14.Z -------------------------------------------------------------------------------- /kraken/a5_cpu/A5Cpu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/a5_cpu/A5Cpu.so -------------------------------------------------------------------------------- /kraken/a5_cpu/A5CpuStubs.h: -------------------------------------------------------------------------------- 1 | #ifndef A5_CPU_STUBS 2 | #define A5_CPU_STUBS 3 | 4 | #include 5 | 6 | bool A5CpuInit(int max_rounds, int condition, int threads); 7 | int A5CpuSubmit(uint64_t start_value, int32_t start_round, 8 | uint32_t advance, void* context); 9 | int A5CpuKeySearch(uint64_t start_value, uint64_t target, 10 | int32_t start_round, int32_t stop_round, 11 | uint32_t advance, void* context); 12 | bool A5CpuPopResult(uint64_t& start_value, uint64_t& stop_value, 13 | int32_t& start_round, void** context); 14 | void A5CpuShutdown(); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /kraken/a5_cpu/Advance.cpp: -------------------------------------------------------------------------------- 1 | #include "Advance.h" 2 | 3 | /* Reverse bit order of an unsigned 64 bits int */ 4 | uint64_t Advance::ReverseBits(uint64_t r) 5 | { 6 | uint64_t r1 = r; 7 | uint64_t r2 = 0; 8 | for (int j = 0; j < 64 ; j++ ) { 9 | r2 = (r2<<1) | (r1 & 0x01); 10 | r1 = r1 >> 1; 11 | } 12 | return r2; 13 | } 14 | 15 | /* Get next number from lfsr random number generator */ 16 | uint64_t Advance::AdvanceRFlfsr(uint64_t v) 17 | { 18 | for (int i = 0; i < 64; i++) { 19 | uint64_t fb = ( 20 | ~( 21 | ((v >> 63) & 1) ^ 22 | ((v >> 62) & 1) ^ 23 | ((v >> 60) & 1) ^ 24 | ((v >> 59) & 1) 25 | ) 26 | ) & 1; 27 | v <<= 1; 28 | v |= fb; 29 | } 30 | return v; 31 | } 32 | 33 | Advance::Advance(unsigned int id, unsigned int size) 34 | { 35 | mAdvances = new uint64_t[size]; 36 | mRFtable = new uint32_t[2*size]; 37 | 38 | uint64_t r = 0; 39 | for (int i=0; i>32); 46 | r = AdvanceRFlfsr(r); 47 | } 48 | 49 | 50 | } 51 | 52 | Advance::~Advance() 53 | { 54 | delete [] mAdvances; 55 | delete [] mRFtable; 56 | } 57 | -------------------------------------------------------------------------------- /kraken/a5_cpu/Advance.h: -------------------------------------------------------------------------------- 1 | #ifndef ADVANCE_H 2 | #define ADVANCE_H 3 | 4 | #include 5 | 6 | class Advance { 7 | public: 8 | Advance(unsigned int id, unsigned int size); 9 | ~Advance(); 10 | 11 | const uint64_t* getAdvances() {return mAdvances;} 12 | const uint32_t* getRFtable() {return mRFtable;} 13 | 14 | private: 15 | uint64_t AdvanceRFlfsr(uint64_t v); 16 | uint64_t ReverseBits(uint64_t r); 17 | uint64_t* mAdvances; 18 | uint32_t* mRFtable; 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /kraken/a5_cpu/a5cpu_test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookk2011/hackrf-gsm/fc3d690354e3bed8b7f8b2f70c3eaf0ecb74d88c/kraken/a5_cpu/a5cpu_test -------------------------------------------------------------------------------- /kraken/a5_cpu/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | g++ -O2 -fPIC -o A5Cpu.so A5Cpu.cpp Advance.cpp -D BUILDING_DLL -lpthread -shared 4 | 5 | g++ -O2 -fPIC -o a5cpu_test a5cpu_test.cpp A5CpuStubs.cpp -ldl 6 | -------------------------------------------------------------------------------- /kraken/indexes/tables.conf.sample: -------------------------------------------------------------------------------- 1 | #Devices: dev/node max_tables 2 | Device: /dev/sda1 10 3 | Device: /dev/sdb1 10 4 | Device: /dev/sdd1 10 5 | Device: /dev/sde1 10 6 | 7 | #Tables: dev id(advance) offset 8 | 9 | --------------------------------------------------------------------------------