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 | ccd040f | 2011-10-08 14:39:22 +0200 | [diff] [blame] | 17 | /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */ |
| 18 | |
| 19 | /* The GSMTAP format definition is maintained in libosmocore, |
| 20 | * specifically the latest version can always be obtained from |
| 21 | * http://cgit.osmocom.org/cgit/libosmocore/tree/include/osmocom/core/gsmtap.h |
| 22 | * |
| 23 | * If you want to introduce new protocol/burst/channel types or extend |
| 24 | * GSMTAP in any way, please contact the GSMTAP maintainer at either the |
| 25 | * public openbsc@lists.osmocom.org mailing list, or privately at |
| 26 | * Harald Welte <laforge@gnumonks.org>. |
| 27 | * |
| 28 | * Your cooperation ensures that all projects will use the same GSMTAP |
| 29 | * definitions and remain compatible with each other. |
| 30 | */ |
| 31 | |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 32 | #define GSMTAP_VERSION 0x02 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 33 | |
| 34 | #define GSMTAP_TYPE_UM 0x01 |
| 35 | #define GSMTAP_TYPE_ABIS 0x02 |
| 36 | #define GSMTAP_TYPE_UM_BURST 0x03 /* raw burst bits */ |
Harald Welte | fe851ff | 2010-11-18 23:54:20 +0100 | [diff] [blame] | 37 | #define GSMTAP_TYPE_SIM 0x04 |
Harald Welte | c035ec6 | 2011-01-19 09:40:59 +0100 | [diff] [blame] | 38 | #define GSMTAP_TYPE_TETRA_I1 0x05 /* tetra air interface */ |
| 39 | #define GSMTAP_TYPE_TETRA_I1_BURST 0x06 /* tetra air interface */ |
Harald Welte | fae779a | 2011-10-08 14:35:51 +0200 | [diff] [blame] | 40 | #define GSMTAP_TYPE_WMX_BURST 0x07 /* WiMAX burst */ |
| 41 | #define GSMTAP_TYPE_GB_LLC 0x08 /* GPRS Gb interface: LLC */ |
| 42 | #define GSMTAP_TYPE_GB_SNDCP 0x09 /* GPRS Gb interface: SNDCP */ |
Sylvain Munaut | f84571d | 2011-10-09 16:57:33 +0200 | [diff] [blame] | 43 | #define GSMTAP_TYPE_GMR1_UM 0x0a /* GMR-1 L2 packets */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 44 | |
Harald Welte | ccd040f | 2011-10-08 14:39:22 +0200 | [diff] [blame] | 45 | /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */ |
| 46 | |
Harald Welte | dba8478 | 2011-01-18 21:38:12 +0100 | [diff] [blame] | 47 | /* sub-types for TYPE_UM_BURST */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 48 | #define GSMTAP_BURST_UNKNOWN 0x00 |
| 49 | #define GSMTAP_BURST_FCCH 0x01 |
| 50 | #define GSMTAP_BURST_PARTIAL_SCH 0x02 |
| 51 | #define GSMTAP_BURST_SCH 0x03 |
| 52 | #define GSMTAP_BURST_CTS_SCH 0x04 |
| 53 | #define GSMTAP_BURST_COMPACT_SCH 0x05 |
| 54 | #define GSMTAP_BURST_NORMAL 0x06 |
| 55 | #define GSMTAP_BURST_DUMMY 0x07 |
| 56 | #define GSMTAP_BURST_ACCESS 0x08 |
| 57 | #define GSMTAP_BURST_NONE 0x09 |
Harald Welte | fae779a | 2011-10-08 14:35:51 +0200 | [diff] [blame] | 58 | /* WiMAX bursts */ |
| 59 | #define GSMTAP_BURST_CDMA_CODE 0x10 /* WiMAX CDMA Code Attribute burst */ |
| 60 | #define GSMTAP_BURST_FCH 0x11 /* WiMAX FCH burst */ |
| 61 | #define GSMTAP_BURST_FFB 0x12 /* WiMAX Fast Feedback burst */ |
| 62 | #define GSMTAP_BURST_PDU 0x13 /* WiMAX PDU burst */ |
| 63 | #define GSMTAP_BURST_HACK 0x14 /* WiMAX HARQ ACK burst */ |
| 64 | #define GSMTAP_BURST_PHY_ATTRIBUTES 0x15 /* WiMAX PHY Attributes burst */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 65 | |
Harald Welte | ccd040f | 2011-10-08 14:39:22 +0200 | [diff] [blame] | 66 | /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */ |
| 67 | |
Harald Welte | dba8478 | 2011-01-18 21:38:12 +0100 | [diff] [blame] | 68 | /* sub-types for TYPE_UM */ |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 69 | #define GSMTAP_CHANNEL_UNKNOWN 0x00 |
| 70 | #define GSMTAP_CHANNEL_BCCH 0x01 |
| 71 | #define GSMTAP_CHANNEL_CCCH 0x02 |
| 72 | #define GSMTAP_CHANNEL_RACH 0x03 |
| 73 | #define GSMTAP_CHANNEL_AGCH 0x04 |
| 74 | #define GSMTAP_CHANNEL_PCH 0x05 |
| 75 | #define GSMTAP_CHANNEL_SDCCH 0x06 |
| 76 | #define GSMTAP_CHANNEL_SDCCH4 0x07 |
| 77 | #define GSMTAP_CHANNEL_SDCCH8 0x08 |
| 78 | #define GSMTAP_CHANNEL_TCH_F 0x09 |
| 79 | #define GSMTAP_CHANNEL_TCH_H 0x0a |
Harald Welte | aa244bf | 2011-09-26 00:24:59 +0200 | [diff] [blame] | 80 | #define GSMTAP_CHANNEL_CBCH51 0x0b |
| 81 | #define GSMTAP_CHANNEL_CBCH52 0x0c |
| 82 | #define GSMTAP_CHANNEL_PDCH 0x0d |
| 83 | #define GSMTAP_CHANNEL_PTCCH 0x0e |
Harald Welte | fae779a | 2011-10-08 14:35:51 +0200 | [diff] [blame] | 84 | #define GSMTAP_CHANNEL_PACCH 0x0f |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 85 | #define GSMTAP_CHANNEL_ACCH 0x80 |
| 86 | |
Harald Welte | ccd040f | 2011-10-08 14:39:22 +0200 | [diff] [blame] | 87 | /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */ |
| 88 | |
Harald Welte | c035ec6 | 2011-01-19 09:40:59 +0100 | [diff] [blame] | 89 | /* sub-types for TYPE_TETRA_AIR */ |
| 90 | #define GSMTAP_TETRA_BSCH 0x01 |
| 91 | #define GSMTAP_TETRA_AACH 0x02 |
Holger Hans Peter Freyther | e750908 | 2011-01-28 10:13:41 +0100 | [diff] [blame] | 92 | #define GSMTAP_TETRA_SCH_HU 0x03 |
| 93 | #define GSMTAP_TETRA_SCH_HD 0x04 |
| 94 | #define GSMTAP_TETRA_SCH_F 0x05 |
| 95 | #define GSMTAP_TETRA_BNCH 0x06 |
| 96 | #define GSMTAP_TETRA_STCH 0x07 |
| 97 | #define GSMTAP_TETRA_TCH_F 0x08 |
Harald Welte | c035ec6 | 2011-01-19 09:40:59 +0100 | [diff] [blame] | 98 | |
Harald Welte | ccd040f | 2011-10-08 14:39:22 +0200 | [diff] [blame] | 99 | /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */ |
| 100 | |
Sylvain Munaut | f84571d | 2011-10-09 16:57:33 +0200 | [diff] [blame] | 101 | /* sub-types for TYPE_GMR1_UM */ |
| 102 | #define GSMTAP_GMR1_UNKNOWN 0x00 |
| 103 | #define GSMTAP_GMR1_BCCH 0x01 |
| 104 | #define GSMTAP_GMR1_CCCH 0x02 /* either AGCH or PCH */ |
| 105 | #define GSMTAP_GMR1_PCH 0x03 |
| 106 | #define GSMTAP_GMR1_AGCH 0x04 |
| 107 | #define GSMTAP_GMR1_BACH 0x05 |
| 108 | #define GSMTAP_GMR1_RACH 0x06 |
| 109 | #define GSMTAP_GMR1_CBCH 0x07 |
| 110 | #define GSMTAP_GMR1_SDCCH 0x08 |
| 111 | #define GSMTAP_GMR1_TACCH 0x09 |
| 112 | #define GSMTAP_GMR1_GBCH 0x0a |
| 113 | |
| 114 | #define GSMTAP_GMR1_SACCH 0x01 /* to be combined with _TCH{6,9} */ |
| 115 | #define GSMTAP_GMR1_FACCH 0x02 /* to be combines with _TCH{3,6,9} */ |
| 116 | #define GSMTAP_GMR1_DKAB 0x03 /* to be combined with _TCH3 */ |
| 117 | #define GSMTAP_GMR1_TCH3 0x10 |
| 118 | #define GSMTAP_GMR1_TCH6 0x14 |
| 119 | #define GSMTAP_GMR1_TCH9 0x18 |
| 120 | |
| 121 | /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */ |
| 122 | |
Harald Welte | dba8478 | 2011-01-18 21:38:12 +0100 | [diff] [blame] | 123 | /* flags for the ARFCN */ |
Harald Welte | 4e12879 | 2010-03-04 15:15:37 +0100 | [diff] [blame] | 124 | #define GSMTAP_ARFCN_F_PCS 0x8000 |
| 125 | #define GSMTAP_ARFCN_F_UPLINK 0x4000 |
| 126 | #define GSMTAP_ARFCN_MASK 0x3fff |
| 127 | |
Harald Welte | dba8478 | 2011-01-18 21:38:12 +0100 | [diff] [blame] | 128 | /* IANA-assigned well-known UDP port for GSMTAP messages */ |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 129 | #define GSMTAP_UDP_PORT 4729 |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 130 | |
Harald Welte | ccd040f | 2011-10-08 14:39:22 +0200 | [diff] [blame] | 131 | /* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 132 | struct gsmtap_hdr { |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 133 | uint8_t version; /* version, set to 0x01 currently */ |
| 134 | uint8_t hdr_len; /* length in number of 32bit words */ |
| 135 | uint8_t type; /* see GSMTAP_TYPE_* */ |
| 136 | uint8_t timeslot; /* timeslot (0..7 on Um) */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 137 | |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 138 | uint16_t arfcn; /* ARFCN (frequency) */ |
| 139 | int8_t signal_dbm; /* signal level in dBm */ |
| 140 | int8_t snr_db; /* signal/noise ratio in dB */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 141 | |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 142 | uint32_t frame_number; /* GSM Frame Number (FN) */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 143 | |
Harald Welte | 8c8caaa | 2010-03-04 15:02:54 +0100 | [diff] [blame] | 144 | uint8_t sub_type; /* Type of burst/channel, see above */ |
| 145 | uint8_t antenna_nr; /* Antenna Number */ |
| 146 | uint8_t sub_slot; /* sub-slot within timeslot */ |
| 147 | uint8_t res; /* reserved for future use (RFU) */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 148 | |
| 149 | } __attribute__((packed)); |
| 150 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 151 | #endif /* _GSMTAP_H */ |