ptrkrysik | 8038b2e | 2014-12-15 23:10:48 +0100 | [diff] [blame] | 1 | /* |
| 2 | The Hacker's Choice - http://www.thc.org |
| 3 | Part of THC's GSM SCANNER PROJECT |
| 4 | */ |
| 5 | |
piotr | faacc72 | 2014-07-20 23:48:32 +0200 | [diff] [blame] | 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 |