gsmtap: Introduce a new packet-gsmtap.h header file

Move the GSMTAP protocol related #defines to packet-gsmtap.h, as there
are other dissectors (like packet-gsm_sim.c and future dissectors) need
access to some of those #defines.

Change-Id: Ibb3517bd773be63b7e3cd30104a5351427e22ebf
Reviewed-on: https://code.wireshark.org/review/19185
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Harald Welte 2016-12-09 13:21:13 -05:00 committed by Michael Mann
parent 2dfa603333
commit 4097c1075b
4 changed files with 174 additions and 133 deletions

View File

@ -1572,6 +1572,7 @@ DISSECTOR_INCLUDES = \
packet-gsm_osmux.h \
packet-gsm_rlcmac.h \
packet-gsm_sms.h \
packet-gsmtap.h \
packet-gssapi.h \
packet-gtp.h \
packet-gtpv2.h \

View File

@ -28,6 +28,8 @@
#include <epan/packet.h>
#include "packet-gsmtap.h"
void proto_register_gsm_sim(void);
void proto_reg_handoff_gsm_sim(void);
@ -2935,7 +2937,7 @@ proto_reg_handoff_gsm_sim(void)
{
dissector_handle_t sim_handle;
sim_handle = find_dissector("gsm_sim");
dissector_add_uint("gsmtap.type", 4, sim_handle);
dissector_add_uint("gsmtap.type", GSMTAP_TYPE_SIM, sim_handle);
sub_handle_cap = find_dissector_add_dependency("etsi_cat", proto_gsm_sim);
}

View File

@ -42,143 +42,12 @@
#include <epan/packet.h>
#include "packet-gsmtap.h"
#include "packet-tetra.h"
void proto_register_gsmtap(void);
void proto_reg_handoff_gsmtap(void);
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
/* The following types and definitions are imported from libosmocore,
* the original source of the GSMTAP format.
*
* prior to getting them accepted/included into the official Osmocom
* GSMTAP definition, available from
* http://cgit.osmocom.org/cgit/libosmocore/tree/include/osmocom/core/gsmtap.h
*
* The GSMTAP maintainer can be contacted via the
* openbsc@lists.osmocom.org mailing list, or by private e-mail
* to laforge@gnumonks.org
*/
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
#define GSMTAP_TYPE_UM 0x01
#define GSMTAP_TYPE_ABIS 0x02
#define GSMTAP_TYPE_UM_BURST 0x03 /* raw burst bits */
#define GSMTAP_TYPE_SIM 0x04
#define GSMTAP_TYPE_TETRA_I1 0x05 /* tetra air interface */
#define GSMTAP_TTPE_TETRA_I1_BURST 0x06 /* tetra air interface */
#define GSMTAP_TYPE_WMX_BURST 0x07 /* WiMAX burst */
#define GSMTAP_TYPE_GB_LLC 0x08 /* GPRS Gb interface: LLC */
#define GSMTAP_TYPE_GB_SNDCP 0x09 /* GPRS Gb interface: SNDCP */
#define GSMTAP_TYPE_GMR1_UM 0x0a /* GMR-1 L2 packets */
#define GSMTAP_TYPE_UMTS_RLC_MAC 0x0b
#define GSMTAP_TYPE_UMTS_RRC 0x0c
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
#define GSMTAP_BURST_UNKNOWN 0x00
#define GSMTAP_BURST_FCCH 0x01
#define GSMTAP_BURST_PARTIAL_SCH 0x02
#define GSMTAP_BURST_SCH 0x03
#define GSMTAP_BURST_CTS_SCH 0x04
#define GSMTAP_BURST_COMPACT_SCH 0x05
#define GSMTAP_BURST_NORMAL 0x06
#define GSMTAP_BURST_DUMMY 0x07
#define GSMTAP_BURST_ACCESS 0x08
#define GSMTAP_BURST_NONE 0x09
/* WiMAX bursts */
#define GSMTAP_BURST_CDMA_CODE 0x10 /* WiMAX CDMA Code Attribute burst */
#define GSMTAP_BURST_FCH 0x11 /* WiMAX FCH burst */
#define GSMTAP_BURST_FFB 0x12 /* WiMAX Fast Feedback burst */
#define GSMTAP_BURST_PDU 0x13 /* WiMAX PDU burst */
#define GSMTAP_BURST_HACK 0x14 /* WiMAX HARQ ACK burst */
#define GSMTAP_BURST_PHY_ATTRIBUTES 0x15 /* WiMAX PHY Attributes burst */
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
/* sub-types for TYPE_UM */
#define GSMTAP_CHANNEL_UNKNOWN 0x00
#define GSMTAP_CHANNEL_BCCH 0x01
#define GSMTAP_CHANNEL_CCCH 0x02
#define GSMTAP_CHANNEL_RACH 0x03
#define GSMTAP_CHANNEL_AGCH 0x04
#define GSMTAP_CHANNEL_PCH 0x05
#define GSMTAP_CHANNEL_SDCCH 0x06
#define GSMTAP_CHANNEL_SDCCH4 0x07
#define GSMTAP_CHANNEL_SDCCH8 0x08
#define GSMTAP_CHANNEL_TCH_F 0x09
#define GSMTAP_CHANNEL_TCH_H 0x0a
#define GSMTAP_CHANNEL_PACCH 0x0b
#define GSMTAP_CHANNEL_CBCH52 0x0c
#define GSMTAP_CHANNEL_PDCH 0x0d
#define GSMTAP_CHANNEL_PTCCH 0x0e
#define GSMTAP_CHANNEL_CBCH51 0x0f
/* GPRS Coding Scheme CS1..4 */
#define GSMTAP_GPRS_CS_BASE 0x20
#define GSMTAP_GPRS_CS(N) (GSMTAP_GPRS_CS_BASE + N)
/* (E) GPRS Coding Scheme MCS0..9 */
#define GSMTAP_GPRS_MCS_BASE 0x30
#define GSMTAP_GPRS_MCS(N) (GSMTAP_GPRS_MCS_BASE + N)
#define GSMTAP_CHANNEL_ACCH 0x80
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
/* sub-types for TYPE_TETRA_AIR */
#define GSMTAP_TETRA_BSCH 0x01
#define GSMTAP_TETRA_AACH 0x02
#define GSMTAP_TETRA_SCH_HU 0x03
#define GSMTAP_TETRA_SCH_HD 0x04
#define GSMTAP_TETRA_SCH_F 0x05
#define GSMTAP_TETRA_BNCH 0x06
#define GSMTAP_TETRA_STCH 0x07
#define GSMTAP_TETRA_TCH_F 0x08
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
/* sub-types for TYPE_GMR1 */
#define GSMTAP_GMR1_UNKNOWN 0x00
#define GSMTAP_GMR1_BCCH 0x01
#define GSMTAP_GMR1_CCCH 0x02 /* either AGCH or PCH */
#define GSMTAP_GMR1_PCH 0x03
#define GSMTAP_GMR1_AGCH 0x04
#define GSMTAP_GMR1_BACH 0x05
#define GSMTAP_GMR1_RACH 0x06
#define GSMTAP_GMR1_CBCH 0x07
#define GSMTAP_GMR1_SDCCH 0x08
#define GSMTAP_GMR1_TACCH 0x09
#define GSMTAP_GMR1_GBCH 0x0a
#define GSMTAP_GMR1_SACCH 0x01 /* to be combined with _TCH{6,9} */
#define GSMTAP_GMR1_FACCH 0x02 /* to be combines with _TCH{3,6,9} */
#define GSMTAP_GMR1_DKAB 0x03 /* to be combined with _TCH3 */
#define GSMTAP_GMR1_TCH3 0x10
#define GSMTAP_GMR1_TCH6 0x14
#define GSMTAP_GMR1_TCH9 0x18
#define GSMTAP_ARFCN_F_PCS 0x8000
#define GSMTAP_ARFCN_F_UPLINK 0x4000
#define GSMTAP_ARFCN_MASK 0x3fff
#define GSMTAP_UDP_PORT 4729
/* This is the header as it is used by gsmtap-generating software.
* It is not used by the wireshark dissector and provided for reference only.
struct gsmtap_hdr {
guint8 version; // version, set to 0x01 currently
guint8 hdr_len; // length in number of 32bit words
guint8 type; // see GSMTAP_TYPE_*
guint8 timeslot; // timeslot (0..7 on Um)
guint16 arfcn; // ARFCN (frequency)
gint8 signal_dbm; // signal level in dBm
gint8 snr_db; // signal/noise ratio in dB
guint32 frame_number; // GSM Frame Number (FN)
guint8 sub_type; // Type of burst/channel, see above
guint8 antenna_nr; // Antenna Number
guint8 sub_slot; // sub-slot within timeslot
guint8 res; // reserved for future use (RFU)
}
*/
static int proto_gsmtap = -1;
static int hf_gsmtap_version = -1;

View File

@ -0,0 +1,169 @@
/* packet-gsmtap.h
* Routines for GSMTAP packet disassembly
*
* (C) 2008-2016 Harald Welte <laforge@gnumonks.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _PACKET_GSMTAP_H
#define _PACKET_GSMTAP_H
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
/* The following types and definitions are imported from libosmocore,
* the original source of the GSMTAP format.
*
* prior to getting them accepted/included into the official Osmocom
* GSMTAP definition, available from
* http://cgit.osmocom.org/cgit/libosmocore/tree/include/osmocom/core/gsmtap.h
*
* The GSMTAP maintainer can be contacted via the
* openbsc@lists.osmocom.org mailing list, or by private e-mail
* to laforge@gnumonks.org
*/
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
#define GSMTAP_TYPE_UM 0x01
#define GSMTAP_TYPE_ABIS 0x02
#define GSMTAP_TYPE_UM_BURST 0x03 /* raw burst bits */
#define GSMTAP_TYPE_SIM 0x04
#define GSMTAP_TYPE_TETRA_I1 0x05 /* tetra air interface */
#define GSMTAP_TTPE_TETRA_I1_BURST 0x06 /* tetra air interface */
#define GSMTAP_TYPE_WMX_BURST 0x07 /* WiMAX burst */
#define GSMTAP_TYPE_GB_LLC 0x08 /* GPRS Gb interface: LLC */
#define GSMTAP_TYPE_GB_SNDCP 0x09 /* GPRS Gb interface: SNDCP */
#define GSMTAP_TYPE_GMR1_UM 0x0a /* GMR-1 L2 packets */
#define GSMTAP_TYPE_UMTS_RLC_MAC 0x0b
#define GSMTAP_TYPE_UMTS_RRC 0x0c
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
#define GSMTAP_BURST_UNKNOWN 0x00
#define GSMTAP_BURST_FCCH 0x01
#define GSMTAP_BURST_PARTIAL_SCH 0x02
#define GSMTAP_BURST_SCH 0x03
#define GSMTAP_BURST_CTS_SCH 0x04
#define GSMTAP_BURST_COMPACT_SCH 0x05
#define GSMTAP_BURST_NORMAL 0x06
#define GSMTAP_BURST_DUMMY 0x07
#define GSMTAP_BURST_ACCESS 0x08
#define GSMTAP_BURST_NONE 0x09
/* WiMAX bursts */
#define GSMTAP_BURST_CDMA_CODE 0x10 /* WiMAX CDMA Code Attribute burst */
#define GSMTAP_BURST_FCH 0x11 /* WiMAX FCH burst */
#define GSMTAP_BURST_FFB 0x12 /* WiMAX Fast Feedback burst */
#define GSMTAP_BURST_PDU 0x13 /* WiMAX PDU burst */
#define GSMTAP_BURST_HACK 0x14 /* WiMAX HARQ ACK burst */
#define GSMTAP_BURST_PHY_ATTRIBUTES 0x15 /* WiMAX PHY Attributes burst */
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
/* sub-types for TYPE_UM */
#define GSMTAP_CHANNEL_UNKNOWN 0x00
#define GSMTAP_CHANNEL_BCCH 0x01
#define GSMTAP_CHANNEL_CCCH 0x02
#define GSMTAP_CHANNEL_RACH 0x03
#define GSMTAP_CHANNEL_AGCH 0x04
#define GSMTAP_CHANNEL_PCH 0x05
#define GSMTAP_CHANNEL_SDCCH 0x06
#define GSMTAP_CHANNEL_SDCCH4 0x07
#define GSMTAP_CHANNEL_SDCCH8 0x08
#define GSMTAP_CHANNEL_TCH_F 0x09
#define GSMTAP_CHANNEL_TCH_H 0x0a
#define GSMTAP_CHANNEL_PACCH 0x0b
#define GSMTAP_CHANNEL_CBCH52 0x0c
#define GSMTAP_CHANNEL_PDCH 0x0d
#define GSMTAP_CHANNEL_PTCCH 0x0e
#define GSMTAP_CHANNEL_CBCH51 0x0f
/* GPRS Coding Scheme CS1..4 */
#define GSMTAP_GPRS_CS_BASE 0x20
#define GSMTAP_GPRS_CS(N) (GSMTAP_GPRS_CS_BASE + N)
/* (E) GPRS Coding Scheme MCS0..9 */
#define GSMTAP_GPRS_MCS_BASE 0x30
#define GSMTAP_GPRS_MCS(N) (GSMTAP_GPRS_MCS_BASE + N)
#define GSMTAP_CHANNEL_ACCH 0x80
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
/* sub-types for TYPE_TETRA_AIR */
#define GSMTAP_TETRA_BSCH 0x01
#define GSMTAP_TETRA_AACH 0x02
#define GSMTAP_TETRA_SCH_HU 0x03
#define GSMTAP_TETRA_SCH_HD 0x04
#define GSMTAP_TETRA_SCH_F 0x05
#define GSMTAP_TETRA_BNCH 0x06
#define GSMTAP_TETRA_STCH 0x07
#define GSMTAP_TETRA_TCH_F 0x08
/* ====== DO NOT MAKE UNAPPROVED MODIFICATIONS HERE ===== */
/* sub-types for TYPE_GMR1 */
#define GSMTAP_GMR1_UNKNOWN 0x00
#define GSMTAP_GMR1_BCCH 0x01
#define GSMTAP_GMR1_CCCH 0x02 /* either AGCH or PCH */
#define GSMTAP_GMR1_PCH 0x03
#define GSMTAP_GMR1_AGCH 0x04
#define GSMTAP_GMR1_BACH 0x05
#define GSMTAP_GMR1_RACH 0x06
#define GSMTAP_GMR1_CBCH 0x07
#define GSMTAP_GMR1_SDCCH 0x08
#define GSMTAP_GMR1_TACCH 0x09
#define GSMTAP_GMR1_GBCH 0x0a
#define GSMTAP_GMR1_SACCH 0x01 /* to be combined with _TCH{6,9} */
#define GSMTAP_GMR1_FACCH 0x02 /* to be combines with _TCH{3,6,9} */
#define GSMTAP_GMR1_DKAB 0x03 /* to be combined with _TCH3 */
#define GSMTAP_GMR1_TCH3 0x10
#define GSMTAP_GMR1_TCH6 0x14
#define GSMTAP_GMR1_TCH9 0x18
#define GSMTAP_ARFCN_F_PCS 0x8000
#define GSMTAP_ARFCN_F_UPLINK 0x4000
#define GSMTAP_ARFCN_MASK 0x3fff
#define GSMTAP_UDP_PORT 4729
/* This is the header as it is used by gsmtap-generating software.
* It is not used by the wireshark dissector and provided for reference only.
struct gsmtap_hdr {
guint8 version; // version, set to 0x01 currently
guint8 hdr_len; // length in number of 32bit words
guint8 type; // see GSMTAP_TYPE_*
guint8 timeslot; // timeslot (0..7 on Um)
guint16 arfcn; // ARFCN (frequency)
gint8 signal_dbm; // signal level in dBm
gint8 snr_db; // signal/noise ratio in dB
guint32 frame_number; // GSM Frame Number (FN)
guint8 sub_type; // Type of burst/channel, see above
guint8 antenna_nr; // Antenna Number
guint8 sub_slot; // sub-slot within timeslot
guint8 res; // reserved for future use (RFU)
}
*/
#endif /* _PACKET_GSMTAP_H */
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/