Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 1 | #ifndef _GSMTAP_H |
| 2 | #define _GSMTAP_H |
| 3 | |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 4 | /* gsmtap header, pseudo-header in front of the actua GSM payload */ |
| 5 | |
| 6 | /* GSMTAP is a generic header format for GSM protocol captures, |
| 7 | * it uses the IANA-assigned UDP port number 4729 and carries |
| 8 | * payload in various formats of GSM interfaces such as Um MAC |
| 9 | * blocks or Um bursts. |
| 10 | * |
| 11 | * Example programs generating GSMTAP data are airprobe |
| 12 | * (http://airprobe.org/) or OsmocomBB (http://bb.osmocom.org/) |
| 13 | */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 14 | |
| 15 | #include <stdint.h> |
| 16 | |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 17 | #define GSMTAP_VERSION 0x02 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 18 | |
| 19 | #define GSMTAP_TYPE_UM 0x01 |
| 20 | #define GSMTAP_TYPE_ABIS 0x02 |
| 21 | #define GSMTAP_TYPE_UM_BURST 0x03 /* raw burst bits */ |
Harald Welte | fe851ff | 2010-11-18 23:54:20 +0100 | [diff] [blame] | 22 | #define GSMTAP_TYPE_SIM 0x04 |
Harald Welte | c035ec6 | 2011-01-19 09:40:59 +0100 | [diff] [blame] | 23 | #define GSMTAP_TYPE_TETRA_I1 0x05 /* tetra air interface */ |
| 24 | #define GSMTAP_TYPE_TETRA_I1_BURST 0x06 /* tetra air interface */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 25 | |
Harald Welte | dba8478 | 2011-01-18 21:38:12 +0100 | [diff] [blame] | 26 | /* sub-types for TYPE_UM_BURST */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 27 | #define GSMTAP_BURST_UNKNOWN 0x00 |
| 28 | #define GSMTAP_BURST_FCCH 0x01 |
| 29 | #define GSMTAP_BURST_PARTIAL_SCH 0x02 |
| 30 | #define GSMTAP_BURST_SCH 0x03 |
| 31 | #define GSMTAP_BURST_CTS_SCH 0x04 |
| 32 | #define GSMTAP_BURST_COMPACT_SCH 0x05 |
| 33 | #define GSMTAP_BURST_NORMAL 0x06 |
| 34 | #define GSMTAP_BURST_DUMMY 0x07 |
| 35 | #define GSMTAP_BURST_ACCESS 0x08 |
| 36 | #define GSMTAP_BURST_NONE 0x09 |
| 37 | |
Harald Welte | dba8478 | 2011-01-18 21:38:12 +0100 | [diff] [blame] | 38 | /* sub-types for TYPE_UM */ |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 39 | #define GSMTAP_CHANNEL_UNKNOWN 0x00 |
| 40 | #define GSMTAP_CHANNEL_BCCH 0x01 |
| 41 | #define GSMTAP_CHANNEL_CCCH 0x02 |
| 42 | #define GSMTAP_CHANNEL_RACH 0x03 |
| 43 | #define GSMTAP_CHANNEL_AGCH 0x04 |
| 44 | #define GSMTAP_CHANNEL_PCH 0x05 |
| 45 | #define GSMTAP_CHANNEL_SDCCH 0x06 |
| 46 | #define GSMTAP_CHANNEL_SDCCH4 0x07 |
| 47 | #define GSMTAP_CHANNEL_SDCCH8 0x08 |
| 48 | #define GSMTAP_CHANNEL_TCH_F 0x09 |
| 49 | #define GSMTAP_CHANNEL_TCH_H 0x0a |
Harald Welte | aa244bf | 2011-09-26 00:24:59 +0200 | [diff] [blame] | 50 | #define GSMTAP_CHANNEL_CBCH51 0x0b |
| 51 | #define GSMTAP_CHANNEL_CBCH52 0x0c |
| 52 | #define GSMTAP_CHANNEL_PDCH 0x0d |
| 53 | #define GSMTAP_CHANNEL_PTCCH 0x0e |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 54 | #define GSMTAP_CHANNEL_ACCH 0x80 |
| 55 | |
Harald Welte | c035ec6 | 2011-01-19 09:40:59 +0100 | [diff] [blame] | 56 | /* sub-types for TYPE_TETRA_AIR */ |
| 57 | #define GSMTAP_TETRA_BSCH 0x01 |
| 58 | #define GSMTAP_TETRA_AACH 0x02 |
Holger Hans Peter Freyther | e750908 | 2011-01-28 10:13:41 +0100 | [diff] [blame] | 59 | #define GSMTAP_TETRA_SCH_HU 0x03 |
| 60 | #define GSMTAP_TETRA_SCH_HD 0x04 |
| 61 | #define GSMTAP_TETRA_SCH_F 0x05 |
| 62 | #define GSMTAP_TETRA_BNCH 0x06 |
| 63 | #define GSMTAP_TETRA_STCH 0x07 |
| 64 | #define GSMTAP_TETRA_TCH_F 0x08 |
Harald Welte | c035ec6 | 2011-01-19 09:40:59 +0100 | [diff] [blame] | 65 | |
Harald Welte | dba8478 | 2011-01-18 21:38:12 +0100 | [diff] [blame] | 66 | /* flags for the ARFCN */ |
Harald Welte | 4e12879 | 2010-03-04 15:15:37 +0100 | [diff] [blame] | 67 | #define GSMTAP_ARFCN_F_PCS 0x8000 |
| 68 | #define GSMTAP_ARFCN_F_UPLINK 0x4000 |
| 69 | #define GSMTAP_ARFCN_MASK 0x3fff |
| 70 | |
Harald Welte | dba8478 | 2011-01-18 21:38:12 +0100 | [diff] [blame] | 71 | /* IANA-assigned well-known UDP port for GSMTAP messages */ |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 72 | #define GSMTAP_UDP_PORT 4729 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 73 | |
| 74 | struct gsmtap_hdr { |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 75 | uint8_t version; /* version, set to 0x01 currently */ |
| 76 | uint8_t hdr_len; /* length in number of 32bit words */ |
| 77 | uint8_t type; /* see GSMTAP_TYPE_* */ |
| 78 | uint8_t timeslot; /* timeslot (0..7 on Um) */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 79 | |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 80 | uint16_t arfcn; /* ARFCN (frequency) */ |
| 81 | int8_t signal_dbm; /* signal level in dBm */ |
| 82 | int8_t snr_db; /* signal/noise ratio in dB */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 83 | |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 84 | uint32_t frame_number; /* GSM Frame Number (FN) */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 85 | |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 86 | uint8_t sub_type; /* Type of burst/channel, see above */ |
| 87 | uint8_t antenna_nr; /* Antenna Number */ |
| 88 | uint8_t sub_slot; /* sub-slot within timeslot */ |
| 89 | uint8_t res; /* reserved for future use (RFU) */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 90 | |
| 91 | } __attribute__((packed)); |
| 92 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 93 | #endif /* _GSMTAP_H */ |