aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-01-07 18:08:21 +0100
committerHarald Welte <laforge@osmocom.org>2023-03-11 15:02:01 +0100
commit52b015b1468755802965892c68dbfcaf58788e9e (patch)
tree39f00f8a6b16fe185fd9e6acf85fc3cf841b8769
parent3128d7534f574555e800546051439fdf67370146 (diff)
WIP: Qualcomm DIAG Protocol support
-rw-r--r--epan/dissectors/CMakeLists.txt4
-rw-r--r--epan/dissectors/packet-qcdiag.c359
-rw-r--r--epan/dissectors/packet-qcdiag.h249
-rw-r--r--epan/dissectors/packet-qcdiag_log.c358
-rw-r--r--epan/dissectors/packet-qcdiag_msg.c209
5 files changed, 1179 insertions, 0 deletions
diff --git a/epan/dissectors/CMakeLists.txt b/epan/dissectors/CMakeLists.txt
index 55d7c043f5..3416d4965c 100644
--- a/epan/dissectors/CMakeLists.txt
+++ b/epan/dissectors/CMakeLists.txt
@@ -536,6 +536,7 @@ set(DISSECTOR_PUBLIC_HEADERS
packet-q708.h
packet-q931.h
packet-q932.h
+ packet-qcdiag.h
packet-qsig.h
packet-quic.h
packet-radius.h
@@ -1699,6 +1700,9 @@ set(DISSECTOR_SRC
${CMAKE_CURRENT_SOURCE_DIR}/packet-q708.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-q931.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-q933.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/packet-qcdiag.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/packet-qcdiag_log.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/packet-qcdiag_msg.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-qllc.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-qnet6.c
${CMAKE_CURRENT_SOURCE_DIR}/packet-quake.c
diff --git a/epan/dissectors/packet-qcdiag.c b/epan/dissectors/packet-qcdiag.c
new file mode 100644
index 0000000000..6342219551
--- /dev/null
+++ b/epan/dissectors/packet-qcdiag.c
@@ -0,0 +1,359 @@
+/* packet-qcdiag.c
+ * Routines for Qualcomm DIAG packet handling
+ *
+ * (C) 2016-2017 by Harald Welte <laforge@gnumonks.org>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#include <epan/packet.h>
+#include "packet-gsmtap.h"
+#include "packet-qcdiag.h"
+
+static dissector_table_t qcdiag_dissector_table;
+static dissector_table_t qcdiag_subsys_dissector_table;
+
+static int proto_qcdiag = -1;
+
+static int hf_qcdiag_cmd = -1;
+static int hf_qcdiag_subsys_id = -1;
+static int hf_qcdiag_subsys_cmd_code = -1;
+
+static gint ett_qcdiag = -1;
+
+static const value_string qcdiag_cmds[] = {
+ { DIAG_VERNO_F, "Version Number" },
+ { DIAG_ESN_F, "MS ESN" },
+ { DIAG_PEEKB_F, "Peek Byte" },
+ { DIAG_PEEKW_F, "Peek Word" },
+ { DIAG_PEEKD_F, "Peek DWord" },
+ { DIAG_POKEB_F, "Poek Byte" },
+ { DIAG_POKEW_F, "Poke Word" },
+ { DIAG_POKED_F, "Poke DWord" },
+ { DIAG_OUTP_F, "Byte output" },
+ { DIAG_OUTPW_F, "Word output" },
+ { DIAG_INP_F, "Byte input" },
+ { DIAG_INPW_F, "Word input" },
+ { DIAG_STATUS_F, "Status" },
+ { DIAG_LOGMASK_F, "Set Logging Mask" },
+ { DIAG_LOG_F, "Log Packet" },
+ { DIAG_NV_PEEK_F, "Peek NV Memory" },
+ { DIAG_NV_POKE_F, "Poke NV Memory" },
+ { DIAG_BAD_CMD_F, "Bad Command" },
+ { DIAG_BAD_PARM_F, "Bad Parameter" },
+ { DIAG_BAD_LEN_F, "Bad Length" },
+ { DIAG_BAD_MODE_F, "Packet not allowed in current mode" },
+ { DIAG_TAGRAPH_F, "TA power and voice graphs" },
+ { DIAG_MARKOV_F, "Markov statistics" },
+ { DIAG_MARKOV_RESET_F, "Reset Markov statistics" },
+ { DIAG_DIAG_VER_F, "DIAG Version" },
+ { DIAG_TS_F, "Timestamp" },
+ { DIAG_TA_PARM_F, "Set TA Parameters" },
+ { DIAG_MSG_F, "Request for MSG report" },
+ { DIAG_HS_KEY_F, "Handset emulation: Keypress" },
+ { DIAG_HS_LOCK_F, "Handest emulation: Lock/Unlock" },
+ { DIAG_HS_SCREEN_F, "Handset emulation: Display" },
+ { DIAG_PARM_SET_F, "Parameter download" },
+ { DIAG_NV_READ_F, "Read NV item" },
+ { DIAG_NV_WRITE_F, "Write NV item" },
+ { DIAG_CONTROL_F, "Mode change request" },
+ { DIAG_ERR_READ_F, "Error record retrieval" },
+ { DIAG_ERR_CLEAR_F, "Error record clear" },
+ { DIAG_SER_RESET_F, "Symbol error rate counter reset" },
+ { DIAG_SER_REPORT_F, "Symbol error rate counter report" },
+ { DIAG_TEST_F, "Run a specified test" },
+ { DIAG_GET_DIPSW_F, "Get current DIP switch setting" },
+ { DIAG_SET_DIPSW_F, "Write new DIP switch setting" },
+ { DIAG_VOC_PCM_LB_F, "Start/Stop Vocoder PCM loopback" },
+ { DIAG_VOC_PKT_LB_F, "Start/Stop Vocoder PKT loopback" },
+ { DIAG_ORIG_F, "Originate a call" },
+ { DIAG_END_F, "End a call" },
+ { DIAG_DLOAD_F, "Switch to downloader" },
+ { DIAG_TMOB_F, "Test mode and FTM commands" },
+ { DIAG_STATE_F, "Return phone state" },
+ { DIAG_PILOT_SETS_F, "Return all current sets of pilots" },
+ { DIAG_SPC_F, "Send the Service Programming Code" },
+ { DIAG_BAD_SPC_MODE_F, "Invalid NV read/write because SP is locked" },
+ { DIAG_PARM_GET2_F, "Get parms" },
+ { DIAG_SERIAL_CHG_F, "Serial mode change" },
+ { DIAG_PASSWORD_F, "Send password" },
+ { DIAG_BAD_SEC_MODE_F, "Bad security mode" },
+ { DIAG_PR_LIST_WR_F, "Write preferred roaming list to phone" },
+ { DIAG_PR_LIST_RD_F, "Read preferred roaming list from phone" },
+ { DIAG_SUBSYS_CMD_F, "Subsystem Command" },
+ { DIAG_FEATURE_QUERY_F, "Feature Query" },
+ { DIAG_SMS_READ_F, "Read SMS from NV" },
+ { DIAG_SMS_WRITE_F, "Write SMS to NV" },
+ { DIAG_SUP_FER_F, "Frame Error Rate" },
+ { DIAG_SUP_WALSH_CODES_F, "Supplemental Channel Walsh Codes" },
+ { DIAG_SET_MAX_SUP_CH_F, "Set max. number of Supplemental Channels" },
+ { DIAG_PARM_GET_IS95B_F, "Get SUP and MUX2 Params" },
+ { DIAG_FS_OP_F, "EFS Operation" },
+ { DIAG_AKEY_VERIFY_F, "AKEY Verification" },
+ { DIAG_BMP_HS_SCREEN_F, "Handset emulation: Bitmap screen" },
+ { DIAG_CONFIG_COMM_F, "Configure communications" },
+ { DIAG_EXT_LOGMASK_F, "Extended logmask" },
+ { DIAG_EVENT_REPORT_F, "Event reporting" },
+ { DIAG_STREAMING_CONFIG_F, "Load Balancing" },
+ { DIAG_PARM_RETRIEVE_F, "Retrieve Parameter" },
+ { DIAG_STATUS_SNAPSHOT_F, "State snapshot of DMSS" },
+ { DIAG_RPC_F, "RPC" },
+ { DIAG_GET_PROPERTY_F, "Get Property" },
+ { DIAG_PUT_PROPERTY_F, "Put Property" },
+ { DIAG_GET_GUID_F, "Get GUID" },
+ { DIAG_USER_CMD_F, "Invocation of user callbacks" },
+ { DIAG_GET_PERM_PROPERTY_F, "Get permanent properties" },
+ { DIAG_PUT_PERM_PROPERTY_F, "Put permanent properties" },
+ { DIAG_PERM_USER_CMD_F, "Permanent user callbacks" },
+ { DIAG_GPS_SESS_CTRL_F, "GPS session control" },
+ { DIAG_GPS_GRID_F, "GPS search grid" },
+ { DIAG_GPS_STATISTICS_F, "GPS statistics" },
+ { DIAG_ROUTE_F, "DIAG Packet routing" },
+ { DIAG_IS2000_STATUS_F, "IS2000 status" },
+ { DIAG_RLP_STAT_RESET_F, "RPL statistics reset" },
+ { DIAG_TDSO_STAT_RESET_F, "(S)TDSO statistics reset" },
+ { DIAG_LOG_CONFIG_F, "Log configuration" },
+ { DIAG_TRACE_EVENT_REPORT_F, "Trace event reporting" },
+ { DIAG_SBI_READ_F, "SBI Read" },
+ { DIAG_SBI_WRITE_F, "SBI Write" },
+ { DIAG_SSD_VERIFY_F, "SSD Verify" },
+ { DIAG_LOG_ON_DEMAND_F, "Log on request" },
+ { DIAG_EXT_MSG_F, "Request extended MSG report" },
+ { DIAG_ONCRPC_F, "ONCRPC" },
+ { DIAG_PROTOCOL_LOOPBACK_F, "DIAG Loopback" },
+ { DIAG_EXT_BUILD_ID_F, "Extended Build ID" },
+ { DIAG_EXT_MSG_CONFIG_F, "Extended MSG configuration" },
+ { DIAG_EXT_MSG_TERSE_F, "Extended MSG in terse format" },
+ { DIAG_EXT_MSG_TERSE_XLATE_F, "Translate terse format MSG identifier" },
+ { DIAG_SUBSYS_CMD_VER_2_F, "Subsytem dispatcher V2" },
+ { DIAG_EVENT_MASK_GET_F, "Get event mask" },
+ { DIAG_EVENT_MASK_SET_F, "Set event mask" },
+ { DIAG_CHANGE_PORT_SETTINGS, "Change port settings" },
+ { DIAG_CNTRY_INFO_F, "Country network information" },
+ { DIAG_SUPS_REQ_F, "Supplementary Service" },
+ { DIAG_MMS_ORIG_SMS_REQUEST_F, "SMS request for MMS" },
+ { DIAG_MEAS_MODE_F, "Change measurement mode" },
+ { DIAG_MEAS_REQ_F, "Request measurements for HDR channels" },
+ { DIAG_QSR_EXT_MSG_TERSE_F, "Optimized F3 Message" },
+ { DIAG_DCI_CMD_REQ, "DCI Command" },
+ { DIAG_DCI_DELAYED_RSP, "DCI Delayed Response" },
+ { DIAG_BAD_TRANS_F, "DCI Error" },
+ { DIAG_SSM_DISALLOWED_CMD_F, "SSM Disallowed Command" },
+ { DIAG_LOG_ON_DEMAND_EXT_F, "Log on extended request" },
+ { DIAG_QSR4_EXT_MSG_TERSE_F, "QShrink" },
+ { 0, NULL }
+};
+
+static const value_string qcdiag_subsys[] = {
+ { DIAG_SUBSYS_OEM, "OEM" },
+ { DIAG_SUBSYS_ZREX, "ZREX" },
+ { DIAG_SUBSYS_SD, "System Determination" },
+ { DIAG_SUBSYS_BT, "Bluetooth" },
+ { DIAG_SUBSYS_WCDMA, "WCMDA" },
+ { DIAG_SUBSYS_HDR, "1xEvDO" },
+ { DIAG_SUBSYS_DIABLO, "DIABLO" },
+ { DIAG_SUBSYS_TREX, "TREX - Off-target testing" },
+ { DIAG_SUBSYS_GSM, "GSM" },
+ { DIAG_SUBSYS_UMTS, "UMTS" },
+ { DIAG_SUBSYS_HWTC, "HWTC" },
+ { DIAG_SUBSYS_FTM, "Factory Test Mode" },
+ { DIAG_SUBSYS_REX, "REX" },
+ { DIAG_SUBSYS_GPS, "GPS" },
+ { DIAG_SUBSYS_WMS, "Wireless Messaging Service" },
+ { DIAG_SUBSYS_CM, "Call Manager" },
+ { DIAG_SUBSYS_HS, "Handset" },
+ { DIAG_SUBSYS_AUDIO_SETTINGS, "Audio Settings" },
+ { DIAG_SUBSYS_DIAG_SERV, "DIAG Services" },
+ { DIAG_SUBSYS_FS, "EFS2" },
+ { DIAG_SUBSYS_PORT_MAP_SETTINGS, "Port Map Settings" },
+ { DIAG_SUBSYS_MEDIAPLAYER, "QCT Mediaplayer" },
+ { DIAG_SUBSYS_QCAMERA, "QCT QCamera" },
+ { DIAG_SUBSYS_MOBIMON, "QCT MobiMon" },
+ { DIAG_SUBSYS_GUNIMON, "QCT GuniMon" },
+ { DIAG_SUBSYS_LSM, "Location Services Manager" },
+ { DIAG_SUBSYS_QCAMCORDER, "QCT QCamcorder" },
+ { DIAG_SUBSYS_MUX1X, "Multiplexer (1x)" },
+ { DIAG_SUBSYS_DATA1X, "Data (1x)" },
+ { DIAG_SUBSYS_SRCH1X, "Searcher (1x)" },
+ { DIAG_SUBSYS_CALLP1X, "Call Processor (1x)" },
+ { DIAG_SUBSYS_APPS, "Applications" },
+ { DIAG_SUBSYS_SETTINGS, "Seettings" },
+ { DIAG_SUBSYS_GSDI, "Generic Sim Driver Interface" },
+ { DIAG_SUBSYS_TMC, "Task Main Controller" },
+ { DIAG_SUBSYS_USB, "USB" },
+ { DIAG_SUBSYS_PM, "Power Management" },
+ { DIAG_SUBSYS_DEBUG, "Debug" },
+ { DIAG_SUBSYS_CLKRGM, "Clock Regime" },
+ { DIAG_SUBSYS_WLAN, "WLAN" },
+ { DIAG_SUBSYS_PS_DATA_LOGGING, "PS Data Path Logging" },
+ { DIAG_SUBSYS_MFLO, "MediaFLO" },
+ { DIAG_SUBSYS_DTV, "Digital TV" },
+ { DIAG_SUBSYS_RRC, "WCDMA RRC" },
+ { DIAG_SUBSYS_PROF, "Profiling" },
+ { DIAG_SUBSYS_TCXOMGR, "TXCO Manager" },
+ { DIAG_SUBSYS_NV, "NV" },
+ { DIAG_SUBSYS_PARAMS, "Parameters" },
+ { DIAG_SUBSYS_MDDI, "MDDI" },
+ { DIAG_SUBSYS_DS_ATCOP, "Data Services AT Command Processor" },
+ { DIAG_SUBSYS_L4LINUX, "L4/Linux" },
+ { DIAG_SUBSYS_MVS, "Multimedia Voice Services" },
+ { DIAG_SUBSYS_CNV, "Compact NV" },
+ { DIAG_SUBSYS_APIONE_PROGRAM, "apiOne" },
+ { DIAG_SUBSYS_HIT, "Hardware Integration Test" },
+ { DIAG_SUBSYS_DRM, "Digital Restrictions Management" },
+ { DIAG_SUBSYS_DM, "Device Management" },
+ { DIAG_SUBSYS_FC, "Flow Controller" },
+ { DIAG_SUBSYS_MEMORY, "Malloc Manager" },
+ { DIAG_SUBSYS_FS_ALTERNATE, "Alternate Filesystem" },
+ { DIAG_SUBSYS_REGRESSION, "Regression Test Commands" },
+ { DIAG_SUBSYS_SENSORS, "Sensors" },
+ { DIAG_SUBSYS_FLUTE, "FLUTE" },
+ { DIAG_SUBSYS_ANALOG, "Analog" },
+ { DIAG_SUBSYS_APIONE_PROGRAM_MODEM, "apine Program on Modem Processor" },
+ { DIAG_SUBSYS_LTE, "LTE" },
+ { DIAG_SUBSYS_BREW, "BREW" },
+ { DIAG_SUBSYS_PWRDB, "Power Debug" },
+ { DIAG_SUBSYS_CHORD, "Chaos Coordinator" },
+ { DIAG_SUBSYS_SEC, "Security" },
+ { DIAG_SUBSYS_TIME, "Time" },
+ { DIAG_SUBSYS_Q6_CORE, "Q6 Core" },
+ { DIAG_SUBSYS_COREBSP, "Core BSP" },
+ { DIAG_SUBSYS_MFLO2, "MediaFLO2" },
+ { DIAG_SUBSYS_ULOG, "ULog Services" },
+ { DIAG_SUBSYS_APR, "Async Packet Router" },
+ { DIAG_SUBSYS_QNP, "QNP" },
+ { DIAG_SUBSYS_STRIDE, "STRIDE" },
+ { DIAG_SUBSYS_OEMDPP, "DPP Partition" },
+ { DIAG_SUBSYS_Q5_CORE, "Q5 Core" },
+ { DIAG_SUBSYS_USCRIPT, "USCRIPT" },
+ { DIAG_SUBSYS_NAS, "Non Access Stratum" },
+ { DIAG_SUBSYS_CMAPI, "CMAPI" },
+ { DIAG_SUBSYS_SSM, "SSM" },
+ { DIAG_SUBSYS_TDSCDMA, "TD-SCDMA" },
+ { DIAG_SUBSYS_SSM_TEST, "SSM Test" },
+ { DIAG_SUBSYS_MPOWER, "MPOWER" },
+ { DIAG_SUBSYS_QDSS, "QDSS" },
+ { DIAG_SUBSYS_CXM, "CXM" },
+ { DIAG_SUBSYS_GNSS_SOC, "Secondary GNSS" },
+ { DIAG_SUBSYS_TTLITE, "TTLITE" },
+ { DIAG_SUBSYS_FTM_ANT, "FTM ANT" },
+ { DIAG_SUBSYS_MLOG, "MLOG" },
+ { DIAG_SUBSYS_LIMITSMGR, "LIMITS MGR" },
+ { DIAG_SUBSYS_EFSMONITOR, "EFS Monitor" },
+ { DIAG_SUBSYS_DISPLAY_CALIBRATION, "Display Calibration" },
+ { DIAG_SUBSYS_VERSION_REPORT, "Version Report" },
+ { DIAG_SUBSYS_DS_IPA, "Internet Packet Accelerator" },
+ { DIAG_SUBSYS_SYSTEM_OPERATIONS, "System Operations" },
+ { DIAG_SUBSYS_CNSS_POWER, "CNSS Power" },
+ { DIAG_SUBSYS_LWIP, "LwIP" },
+ { DIAG_SUBSYS_IMS_QVP_RTP, "IMS QVP RTP" },
+ { 0, NULL }
+};
+
+static int
+dissect_qcdiag_subsys(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ gint offset = 0;
+ guint subsys_id;
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "QCDIAG-SUBSYS");
+
+ proto_tree_add_item_ret_uint(tree, hf_qcdiag_subsys_id, tvb, offset++, 1, ENC_NA, &subsys_id);
+ proto_tree_add_item(tree, hf_qcdiag_subsys_cmd_code, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset += 2;
+
+ return dissector_try_uint(qcdiag_subsys_dissector_table, subsys_id, tvb, pinfo, tree);
+}
+
+static int
+dissect_qcdiag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
+{
+ proto_item *ti;
+ proto_tree *diag_tree;
+ gint offset = 0;
+ guint cmd;
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "QCDIAG");
+
+ ti = proto_tree_add_item(tree, proto_qcdiag, tvb, 0, -1, ENC_NA);
+ diag_tree = proto_item_add_subtree(ti, ett_qcdiag);
+
+ proto_tree_add_item_ret_uint(diag_tree, hf_qcdiag_cmd, tvb, offset, 1, ENC_NA, &cmd);
+
+ switch (cmd) {
+ case DIAG_SUBSYS_CMD_F:
+ dissect_qcdiag_subsys(tvb, pinfo, diag_tree);
+ break;
+ default:
+ dissector_try_uint(qcdiag_dissector_table, cmd, tvb, pinfo, tree);
+ break;
+ }
+
+ return tvb_captured_length(tvb);
+}
+
+void
+proto_register_qcdiag(void)
+{
+ static hf_register_info hf[] = {
+ { &hf_qcdiag_cmd, { "Command", "qcdiag.cmd",
+ FT_UINT8, BASE_HEX, VALS(qcdiag_cmds), 0, NULL, HFILL } },
+ { &hf_qcdiag_subsys_id, { "Subsystem ID", "qcdiag.subsys_id",
+ FT_UINT8, BASE_DEC, VALS(qcdiag_subsys), 0, NULL, HFILL } },
+ { &hf_qcdiag_subsys_cmd_code, { "Subsystem Command Code", "qcdiag.subsys_cmd_code",
+ FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL } },
+ };
+ static gint *ett[] = {
+ &ett_qcdiag
+ };
+
+ proto_qcdiag = proto_register_protocol("Qualcomm DIAG", "QCDIAG", "qcdiag");
+ proto_register_field_array(proto_qcdiag, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+
+ qcdiag_dissector_table = register_dissector_table("qcdiag.cmd",
+ "QCDIAG Command", proto_qcdiag, FT_UINT8, BASE_DEC);
+
+ qcdiag_subsys_dissector_table = register_dissector_table("qcdiag.subsys_id",
+ "QCDIAG Subsystem", proto_qcdiag, FT_UINT8, BASE_DEC);
+}
+
+void
+proto_reg_handoff_qcdiag(void)
+{
+ dissector_handle_t qcdiag_handle;
+
+ qcdiag_handle = create_dissector_handle(dissect_qcdiag, proto_qcdiag);
+ dissector_add_uint("gsmtap.type", GSMTAP_TYPE_QC_DIAG, qcdiag_handle);
+}
+
+/*
+ * 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:
+ */
diff --git a/epan/dissectors/packet-qcdiag.h b/epan/dissectors/packet-qcdiag.h
new file mode 100644
index 0000000000..5958a5a88a
--- /dev/null
+++ b/epan/dissectors/packet-qcdiag.h
@@ -0,0 +1,249 @@
+#ifndef PACKET_QCDIAG_H
+#define PACKET_QCDIAG_H
+
+#define DIAG_VERNO_F 0
+#define DIAG_ESN_F 1
+#define DIAG_PEEKB_F 2
+#define DIAG_PEEKW_F 3
+#define DIAG_PEEKD_F 4
+#define DIAG_POKEB_F 5
+#define DIAG_POKEW_F 6
+#define DIAG_POKED_F 7
+#define DIAG_OUTP_F 8
+#define DIAG_OUTPW_F 9
+#define DIAG_INP_F 10
+#define DIAG_INPW_F 11
+#define DIAG_STATUS_F 12
+#define DIAG_LOGMASK_F 15
+#define DIAG_LOG_F 16
+#define DIAG_NV_PEEK_F 17
+#define DIAG_NV_POKE_F 18
+#define DIAG_BAD_CMD_F 19
+#define DIAG_BAD_PARM_F 20
+#define DIAG_BAD_LEN_F 21
+#define DIAG_BAD_MODE_F 24
+#define DIAG_TAGRAPH_F 25
+#define DIAG_MARKOV_F 26
+#define DIAG_MARKOV_RESET_F 27
+#define DIAG_DIAG_VER_F 28
+#define DIAG_TS_F 29
+#define DIAG_TA_PARM_F 30
+#define DIAG_MSG_F 31
+#define DIAG_HS_KEY_F 32
+#define DIAG_HS_LOCK_F 33
+#define DIAG_HS_SCREEN_F 34
+#define DIAG_PARM_SET_F 36
+#define DIAG_NV_READ_F 38
+#define DIAG_NV_WRITE_F 39
+#define DIAG_CONTROL_F 41
+#define DIAG_ERR_READ_F 42
+#define DIAG_ERR_CLEAR_F 43
+#define DIAG_SER_RESET_F 44
+#define DIAG_SER_REPORT_F 45
+#define DIAG_TEST_F 46
+#define DIAG_GET_DIPSW_F 47
+#define DIAG_SET_DIPSW_F 48
+#define DIAG_VOC_PCM_LB_F 49
+#define DIAG_VOC_PKT_LB_F 50
+#define DIAG_ORIG_F 53
+#define DIAG_END_F 54
+#define DIAG_DLOAD_F 58
+#define DIAG_TMOB_F 59
+#define DIAG_FTM_CMD_F 59
+#define DIAG_TEST_STATE_F 61
+#define DIAG_STATE_F 63
+#define DIAG_PILOT_SETS_F 64
+#define DIAG_SPC_F 65
+#define DIAG_BAD_SPC_MODE_F 66
+#define DIAG_PARM_GET2_F 67
+#define DIAG_SERIAL_CHG_F 68
+#define DIAG_PASSWORD_F 70
+#define DIAG_BAD_SEC_MODE_F 71
+#define DIAG_PR_LIST_WR_F 72
+#define DIAG_PR_LIST_RD_F 73
+#define DIAG_SUBSYS_CMD_F 75
+#define DIAG_FEATURE_QUERY_F 81
+#define DIAG_SMS_READ_F 83
+#define DIAG_SMS_WRITE_F 84
+#define DIAG_SUP_FER_F 85
+#define DIAG_SUP_WALSH_CODES_F 86
+#define DIAG_SET_MAX_SUP_CH_F 87
+#define DIAG_PARM_GET_IS95B_F 88
+#define DIAG_FS_OP_F 89
+#define DIAG_AKEY_VERIFY_F 90
+#define DIAG_BMP_HS_SCREEN_F 91
+#define DIAG_CONFIG_COMM_F 92
+#define DIAG_EXT_LOGMASK_F 93
+#define DIAG_EVENT_REPORT_F 96
+#define DIAG_STREAMING_CONFIG_F 97
+#define DIAG_PARM_RETRIEVE_F 98
+#define DIAG_STATUS_SNAPSHOT_F 99
+#define DIAG_RPC_F 100
+#define DIAG_GET_PROPERTY_F 101
+#define DIAG_PUT_PROPERTY_F 102
+#define DIAG_GET_GUID_F 103
+#define DIAG_USER_CMD_F 104
+#define DIAG_GET_PERM_PROPERTY_F 105
+#define DIAG_PUT_PERM_PROPERTY_F 106
+#define DIAG_PERM_USER_CMD_F 107
+#define DIAG_GPS_SESS_CTRL_F 108
+#define DIAG_GPS_GRID_F 109
+#define DIAG_GPS_STATISTICS_F 110
+#define DIAG_ROUTE_F 111
+#define DIAG_IS2000_STATUS_F 112
+#define DIAG_RLP_STAT_RESET_F 113
+#define DIAG_TDSO_STAT_RESET_F 114
+#define DIAG_LOG_CONFIG_F 115
+#define DIAG_TRACE_EVENT_REPORT_F 116
+#define DIAG_SBI_READ_F 117
+#define DIAG_SBI_WRITE_F 118
+#define DIAG_SSD_VERIFY_F 119
+#define DIAG_LOG_ON_DEMAND_F 120
+#define DIAG_EXT_MSG_F 121
+#define DIAG_ONCRPC_F 122
+#define DIAG_PROTOCOL_LOOPBACK_F 123
+#define DIAG_EXT_BUILD_ID_F 124
+#define DIAG_EXT_MSG_CONFIG_F 125
+#define DIAG_EXT_MSG_TERSE_F 126
+#define DIAG_EXT_MSG_TERSE_XLATE_F 127
+#define DIAG_SUBSYS_CMD_VER_2_F 128
+#define DIAG_EVENT_MASK_GET_F 129
+#define DIAG_EVENT_MASK_SET_F 130
+#define DIAG_CHANGE_PORT_SETTINGS 140
+#define DIAG_CNTRY_INFO_F 141
+#define DIAG_SUPS_REQ_F 142
+#define DIAG_MMS_ORIG_SMS_REQUEST_F 143
+#define DIAG_MEAS_MODE_F 144
+#define DIAG_MEAS_REQ_F 145
+#define DIAG_QSR_EXT_MSG_TERSE_F 146
+#define DIAG_DCI_CMD_REQ 147
+#define DIAG_DCI_DELAYED_RSP 148
+#define DIAG_BAD_TRANS_F 149
+#define DIAG_SSM_DISALLOWED_CMD_F 150
+#define DIAG_LOG_ON_DEMAND_EXT_F 151
+#define DIAG_MULTI_RADIO_CMD_F 152
+#define DIAG_QSR4_EXT_MSG_TERSE_F 153
+
+#define DIAG_MAX_F 255
+
+typedef enum {
+ DIAG_SUBSYS_OEM = 0,
+ DIAG_SUBSYS_ZREX = 1,
+ DIAG_SUBSYS_SD = 2,
+ DIAG_SUBSYS_BT = 3,
+ DIAG_SUBSYS_WCDMA = 4,
+ DIAG_SUBSYS_HDR = 5,
+ DIAG_SUBSYS_DIABLO = 6,
+ DIAG_SUBSYS_TREX = 7,
+ DIAG_SUBSYS_GSM = 8,
+ DIAG_SUBSYS_UMTS = 9,
+ DIAG_SUBSYS_HWTC = 10,
+ DIAG_SUBSYS_FTM = 11,
+ DIAG_SUBSYS_REX = 12,
+ DIAG_SUBSYS_OS = DIAG_SUBSYS_REX,
+ DIAG_SUBSYS_GPS = 13,
+ DIAG_SUBSYS_WMS = 14,
+ DIAG_SUBSYS_CM = 15,
+ DIAG_SUBSYS_HS = 16,
+ DIAG_SUBSYS_AUDIO_SETTINGS = 17,
+ DIAG_SUBSYS_DIAG_SERV = 18,
+ DIAG_SUBSYS_FS = 19,
+ DIAG_SUBSYS_PORT_MAP_SETTINGS = 20,
+ DIAG_SUBSYS_MEDIAPLAYER = 21,
+ DIAG_SUBSYS_QCAMERA = 22,
+ DIAG_SUBSYS_MOBIMON = 23,
+ DIAG_SUBSYS_GUNIMON = 24,
+ DIAG_SUBSYS_LSM = 25,
+ DIAG_SUBSYS_QCAMCORDER = 26,
+ DIAG_SUBSYS_MUX1X = 27,
+ DIAG_SUBSYS_DATA1X = 28,
+ DIAG_SUBSYS_SRCH1X = 29,
+ DIAG_SUBSYS_CALLP1X = 30,
+ DIAG_SUBSYS_APPS = 31,
+ DIAG_SUBSYS_SETTINGS = 32,
+ DIAG_SUBSYS_GSDI = 33,
+ DIAG_SUBSYS_UIMDIAG = DIAG_SUBSYS_GSDI,
+ DIAG_SUBSYS_TMC = 34,
+ DIAG_SUBSYS_USB = 35,
+ DIAG_SUBSYS_PM = 36,
+ DIAG_SUBSYS_DEBUG = 37,
+ DIAG_SUBSYS_QTV = 38,
+ DIAG_SUBSYS_CLKRGM = 39,
+ DIAG_SUBSYS_DEVICES = 40,
+ DIAG_SUBSYS_WLAN = 41,
+ DIAG_SUBSYS_PS_DATA_LOGGING = 42,
+ DIAG_SUBSYS_PS = DIAG_SUBSYS_PS_DATA_LOGGING,
+ DIAG_SUBSYS_MFLO = 43,
+ DIAG_SUBSYS_DTV = 44,
+ DIAG_SUBSYS_RRC = 45,
+ DIAG_SUBSYS_PROF = 46,
+ DIAG_SUBSYS_TCXOMGR = 47,
+ DIAG_SUBSYS_NV = 48,
+ DIAG_SUBSYS_AUTOCONFIG = 49,
+ DIAG_SUBSYS_PARAMS = 50,
+ DIAG_SUBSYS_MDDI = 51,
+ DIAG_SUBSYS_DS_ATCOP = 52,
+ DIAG_SUBSYS_L4LINUX = 53,
+ DIAG_SUBSYS_MVS = 54,
+ DIAG_SUBSYS_CNV = 55,
+ DIAG_SUBSYS_APIONE_PROGRAM = 56,
+ DIAG_SUBSYS_HIT = 57,
+ DIAG_SUBSYS_DRM = 58,
+ DIAG_SUBSYS_DM = 59,
+ DIAG_SUBSYS_FC = 60,
+ DIAG_SUBSYS_MEMORY = 61,
+ DIAG_SUBSYS_FS_ALTERNATE = 62,
+ DIAG_SUBSYS_REGRESSION = 63,
+ DIAG_SUBSYS_SENSORS = 64,
+ DIAG_SUBSYS_FLUTE = 65,
+ DIAG_SUBSYS_ANALOG = 66,
+ DIAG_SUBSYS_APIONE_PROGRAM_MODEM = 67,
+ DIAG_SUBSYS_LTE = 68,
+ DIAG_SUBSYS_BREW = 69,
+ DIAG_SUBSYS_PWRDB = 70,
+ DIAG_SUBSYS_CHORD = 71,
+ DIAG_SUBSYS_SEC = 72,
+ DIAG_SUBSYS_TIME = 73,
+ DIAG_SUBSYS_Q6_CORE = 74,
+ DIAG_SUBSYS_COREBSP = 75,
+ DIAG_SUBSYS_MFLO2 = 76,
+ DIAG_SUBSYS_ULOG = 77,
+ DIAG_SUBSYS_APR = 78,
+ DIAG_SUBSYS_QNP = 79,
+ DIAG_SUBSYS_STRIDE = 80,
+ DIAG_SUBSYS_OEMDPP = 81,
+ DIAG_SUBSYS_Q5_CORE = 82,
+ DIAG_SUBSYS_USCRIPT = 83,
+ DIAG_SUBSYS_NAS = 84,
+ DIAG_SUBSYS_CMAPI = 85,
+ DIAG_SUBSYS_SSM = 86,
+ DIAG_SUBSYS_TDSCDMA = 87,
+ DIAG_SUBSYS_SSM_TEST = 88,
+ DIAG_SUBSYS_MPOWER = 89,
+ DIAG_SUBSYS_QDSS = 90,
+ DIAG_SUBSYS_CXM = 91,
+ DIAG_SUBSYS_GNSS_SOC = 92,
+ DIAG_SUBSYS_TTLITE = 93,
+ DIAG_SUBSYS_FTM_ANT = 94,
+ DIAG_SUBSYS_MLOG = 95,
+ DIAG_SUBSYS_LIMITSMGR = 96,
+ DIAG_SUBSYS_EFSMONITOR = 97,
+ DIAG_SUBSYS_DISPLAY_CALIBRATION = 98,
+ DIAG_SUBSYS_VERSION_REPORT = 99,
+ DIAG_SUBSYS_DS_IPA = 100,
+ DIAG_SUBSYS_SYSTEM_OPERATIONS = 101,
+ DIAG_SUBSYS_CNSS_POWER = 102,
+ DIAG_SUBSYS_LWIP = 103,
+ DIAG_SUBSYS_IMS_QVP_RTP = 104,
+ DIAG_SUBSYS_LAST,
+
+ /* Subsystem IDs reserved for OEM use */
+ DIAG_SUBSYS_RESERVED_OEM_0 = 250,
+ DIAG_SUBSYS_RESERVED_OEM_1 = 251,
+ DIAG_SUBSYS_RESERVED_OEM_2 = 252,
+ DIAG_SUBSYS_RESERVED_OEM_3 = 253,
+ DIAG_SUBSYS_RESERVED_OEM_4 = 254,
+ DIAG_SUBSYS_LEGACY = 255
+} diagpkt_subsys_cmd_enum_type;
+
+#endif /* QCDIAG */
diff --git a/epan/dissectors/packet-qcdiag_log.c b/epan/dissectors/packet-qcdiag_log.c
new file mode 100644
index 0000000000..fea3a6ca04
--- /dev/null
+++ b/epan/dissectors/packet-qcdiag_log.c
@@ -0,0 +1,358 @@
+/* packet-qcdiag_log.c
+ * Routines for Qualcomm DIAG LOG packet handling
+ *
+ * (C) 2016-2017 by Harald Welte <laforge@gnumonks.org>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#include <epan/packet.h>
+#include "packet-qcdiag.h"
+
+static dissector_table_t qcdiag_log_code_dissector_table;
+
+static int proto_qcdiag_log = -1;
+
+static int hf_qcdiag_log_len = -1;
+static int hf_qcdiag_log_code = -1;
+
+static int hf_rr_chan_type = -1;
+static int hf_rr_downlink = -1;
+static int hf_rr_msg_type = -1;
+static int hf_msg_length = -1;
+
+static int hf_mac_chan_type = -1;
+static int hf_mac_msg_type = -1;
+
+static int hf_nas_msg_length = -1;
+static int hf_nas_direction = -1;
+
+static gint ett_qcdiag_log = -1;
+
+enum {
+ SUB_DATA = 0,
+ SUB_UM_CCCH,
+ SUB_UM_DTAP,
+ SUB_UM_SACCH,
+ SUB_UM_RLC_MAC_UL,
+ SUB_UM_RLC_MAC_DL,
+ SUB_CBCH,
+ SUB_SIM,
+ /* UMTS */
+ SUB_UMTS_RLC_MAC,
+ SUB_UMTS_RRC,
+
+ SUB_MAX
+};
+
+static dissector_handle_t sub_handles[SUB_MAX];
+
+enum diag_gsm_rr_chan_type {
+ DIAG_GSM_L2_CHAN_TYPE_DCCH = 0,
+ DIAG_GSM_L2_CHAN_TYPE_BCCH = 1,
+ DIAG_GSM_L2_CHAN_TYPE_RACH = 2,
+ DIAG_GSM_L2_CHAN_TYPE_CCCH = 3,
+ DIAG_GSM_L2_CHAN_TYPE_SACCH = 4,
+ DIAG_GSM_L2_CHAN_TYPE_SDCCH = 5,
+ DIAG_GSM_L2_CHAN_TYPE_FACCH_F = 6,
+ DIAG_GSM_L2_CHAN_TYPE_FACCH_H = 7,
+};
+
+static const value_string rr_chan_types[] = {
+ { DIAG_GSM_L2_CHAN_TYPE_DCCH, "DCCH" },
+ { DIAG_GSM_L2_CHAN_TYPE_BCCH, "BCCH" },
+ { DIAG_GSM_L2_CHAN_TYPE_RACH, "RACH" },
+ { DIAG_GSM_L2_CHAN_TYPE_CCCH, "CCCH" },
+ { DIAG_GSM_L2_CHAN_TYPE_SACCH, "SACCH" },
+ { DIAG_GSM_L2_CHAN_TYPE_SDCCH, "SDCCH" },
+ { DIAG_GSM_L2_CHAN_TYPE_FACCH_F,"FACCH/F" },
+ { DIAG_GSM_L2_CHAN_TYPE_FACCH_H,"FACCH/H" },
+ { 0, NULL }
+};
+
+static const true_false_string rr_direction_vals = {
+ "Downlink",
+ "Uplink",
+};
+
+static const true_false_string nas_direction_vals = {
+ "Uplink",
+ "Downlink",
+};
+
+enum gprs_mac_chan_type {
+ PRACH_11BIT_CHANNEL = 0x01,
+ PRACH_8BIT_CHANNEL = 0x02,
+ PACCH_RRBP_CHANNEL = 0x03,
+ UL_PACCH_CHANNEL = 0x04,
+ PCCCH_CHANNEL = 0x81,
+ PBCCH_CHANNEL = 0x82,
+ DL_PACCH_CHANNEL = 0x83,
+};
+
+static const value_string mac_chan_types[] = {
+ { PRACH_11BIT_CHANNEL, "PRACH(11bit)" },
+ { PRACH_8BIT_CHANNEL, "PRACH(8bit)" },
+ { PACCH_RRBP_CHANNEL, "PACCH(RRBP)" },
+ { UL_PACCH_CHANNEL, "PACCH(Uplink)" },
+ { PCCCH_CHANNEL, "PCCCH" },
+ { PBCCH_CHANNEL, "PBCCH" },
+ { DL_PACCH_CHANNEL, "PACCH(Downlink)" },
+ { 0, NULL }
+};
+
+static int
+dissect_qcdiag_log_rr(tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree)
+{
+ tvbuff_t *payload_tvb;
+ guint chan_type, rr_length;
+ gint sub_handle;
+
+ /* Byte 1 */
+ proto_tree_add_item_ret_uint(log_tree, hf_rr_chan_type, tvb, offset, 1, ENC_NA, &chan_type);
+ proto_tree_add_item(log_tree, hf_rr_downlink, tvb, offset++, 1, ENC_NA);
+
+ /* Byte 2 */
+ proto_tree_add_item(log_tree, hf_rr_msg_type, tvb, offset++, 1, ENC_NA);
+
+ /* Byte 3 */
+ proto_tree_add_item_ret_uint(log_tree, hf_msg_length, tvb, offset++, 1, ENC_NA, &rr_length);
+
+ /* Data: Raw RR Message */
+ payload_tvb = tvb_new_subset_length(tvb, offset, rr_length);
+
+ switch (chan_type) {
+ case DIAG_GSM_L2_CHAN_TYPE_BCCH:
+ case DIAG_GSM_L2_CHAN_TYPE_CCCH:
+ sub_handle = SUB_UM_CCCH;
+ break;
+ case DIAG_GSM_L2_CHAN_TYPE_SACCH:
+ sub_handle = SUB_UM_SACCH;
+ break;
+ case DIAG_GSM_L2_CHAN_TYPE_SDCCH:
+ case DIAG_GSM_L2_CHAN_TYPE_DCCH:
+ case DIAG_GSM_L2_CHAN_TYPE_FACCH_F:
+ case DIAG_GSM_L2_CHAN_TYPE_FACCH_H:
+ sub_handle = SUB_UM_DTAP;
+ break;
+ default:
+ sub_handle = SUB_DATA;
+ }
+
+ if (sub_handles[sub_handle])
+ call_dissector(sub_handles[sub_handle], payload_tvb, pinfo, tree);
+
+ return tvb_captured_length(tvb);
+}
+
+static int
+dissect_qcdiag_log_gmac(tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree)
+{
+ tvbuff_t *payload_tvb;
+ guint chan_type, mac_length;
+ gint sub_handle;
+
+ /* Byte 1 */
+ proto_tree_add_item_ret_uint(log_tree, hf_mac_chan_type, tvb, offset++, 1, ENC_NA, &chan_type);
+
+ /* Byte 2 */
+ proto_tree_add_item(log_tree, hf_mac_msg_type, tvb, offset++, 1, ENC_NA);
+
+ /* Byte 3 */
+ proto_tree_add_item_ret_uint(log_tree, hf_msg_length, tvb, offset++, 1, ENC_NA, &mac_length);
+
+ /* Data: Raw RR Message */
+ payload_tvb = tvb_new_subset_length(tvb, offset, mac_length);
+
+ switch (chan_type) {
+ case PRACH_11BIT_CHANNEL:
+ case PRACH_8BIT_CHANNEL:
+ case UL_PACCH_CHANNEL:
+ sub_handle = SUB_UM_RLC_MAC_UL;
+ break;
+ case PCCCH_CHANNEL:
+ case PBCCH_CHANNEL:
+ case DL_PACCH_CHANNEL:
+ sub_handle = SUB_UM_RLC_MAC_DL;
+ break;
+ case PACCH_RRBP_CHANNEL:
+ default:
+ sub_handle = SUB_DATA;
+ }
+
+ if (sub_handles[sub_handle])
+ call_dissector(sub_handles[sub_handle], payload_tvb, pinfo, tree);
+
+ return tvb_captured_length(tvb);
+}
+
+static int
+dissect_qcdiag_log_nas(tvbuff_t *tvb, guint offset, packet_info *pinfo, proto_tree *log_tree, proto_tree *tree)
+{
+ tvbuff_t *payload_tvb;
+ guint length;
+
+ /* Byte 1: Direction */
+ proto_tree_add_item(log_tree, hf_nas_direction, tvb, offset++, 1, ENC_NA);
+
+ /* Byte 2-5: Length */
+ proto_tree_add_item_ret_uint(log_tree, hf_nas_msg_length, tvb, offset, 4, ENC_LITTLE_ENDIAN, &length);
+ offset += 4;
+
+ /* Byte 6...: NAS Message */
+ payload_tvb = tvb_new_subset_length(tvb, offset, length);
+
+ if (sub_handles[SUB_UM_DTAP])
+ call_dissector(sub_handles[SUB_UM_DTAP], payload_tvb, pinfo, tree);
+
+ return tvb_captured_length(tvb);
+}
+
+
+static int
+dissect_qcdiag_log(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
+{
+ proto_item *ti;
+ proto_tree *diag_log_tree;
+ tvbuff_t *payload_tvb;
+ gint offset = 0;
+ guint len, code;
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "QCDIAG-LOG");
+
+ ti = proto_tree_add_item(tree, proto_qcdiag_log, tvb, 0, -1, ENC_NA);
+ diag_log_tree = proto_item_add_subtree(ti, ett_qcdiag_log);
+
+ /* 4 bytes common header */
+ offset += 4;
+
+ proto_tree_add_item_ret_uint(diag_log_tree, hf_qcdiag_log_len, tvb, offset, 2, ENC_LITTLE_ENDIAN, &len);
+ offset += 2;
+
+ proto_tree_add_item_ret_uint(diag_log_tree, hf_qcdiag_log_code, tvb, offset, 2, ENC_LITTLE_ENDIAN, &code);
+ offset += 2;
+
+ /* 8 bytes timestamp */
+ offset += 8;
+
+ switch (code) {
+ case 0x512f: /* GSM RR signaling message */
+ return dissect_qcdiag_log_rr(tvb, offset, pinfo, diag_log_tree, tree);
+ case 0x412f: /* 3G RRC */
+ break;
+ case 0x5202: /* LOG_GPRS_RLC_UL_STATS_C */
+ break;
+ case 0x520e: /* LOG_GPRS_RLC_DL_RELEASE_IND_C */
+ break;
+ case 0x5226: /* GPRS MAC signalling message */
+ return dissect_qcdiag_log_gmac(tvb, offset, pinfo, diag_log_tree, tree);
+ case 0x5230: /* GPRS GMM */
+ break;
+ case 0x713a:
+ return dissect_qcdiag_log_nas(tvb, offset, pinfo, diag_log_tree, tree);
+ break;
+ case 0xb0c0:
+ case 0xb0e0:
+ case 0xb0e1:
+ case 0xb0e2:
+ case 0xb0e3:
+ case 0xb0ea:
+ case 0xb0eb:
+ case 0xb0ec:
+ case 0xb0ed:
+ break;
+ default:
+ payload_tvb = tvb_new_subset_length(tvb, offset, len);
+ dissector_try_uint(qcdiag_log_code_dissector_table, code, payload_tvb, pinfo, diag_log_tree);
+ break;
+ }
+
+ return tvb_captured_length(tvb);
+}
+
+void
+proto_register_qcdiag_log(void)
+{
+ static hf_register_info hf[] = {
+ { &hf_qcdiag_log_len, { "Log Message Length", "qcdiag_log.length",
+ FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL } },
+ { &hf_qcdiag_log_code, { "Log Code", "qcdiag_log.code",
+ FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL } },
+ { &hf_rr_downlink, { "Direction", "qcdiag_log.downlink",
+ FT_BOOLEAN, 8, TFS(&rr_direction_vals), 0x80, NULL, HFILL } },
+ { &hf_msg_length, { "Message Length", "qcdiag_log.msg_len",
+ FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
+ /* RR */
+ { &hf_rr_chan_type, { "RR Channel Type", "qcdiag_log.rr.chan_type",
+ FT_UINT8, BASE_HEX, VALS(rr_chan_types), 0x7f, NULL, HFILL } },
+ { &hf_rr_msg_type, { "RR Message Type", "qcdiag_log.rr.msg_type",
+ FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL } },
+ /* GPRS MAC */
+ { &hf_mac_chan_type, { "GPRS MAC Channel Type", "qcdiag_log.gmac.chan_type",
+ FT_UINT8, BASE_HEX, VALS(mac_chan_types), 0, NULL, HFILL } },
+ { &hf_mac_msg_type, { "GPRS MAC Message Type", "qcdiag_log.gmac.msg_type",
+ FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL } },
+ /* NAS */
+ { &hf_nas_msg_length, { "NAS Message Length", "qcdiag_log.nas.msg_len",
+ FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL } },
+ { &hf_nas_direction, { "Direction", "qcdiag_log.nas.direction",
+ FT_BOOLEAN, 8, TFS(&nas_direction_vals), 0x01, NULL, HFILL } },
+ };
+ static gint *ett[] = {
+ &ett_qcdiag_log
+ };
+
+ proto_qcdiag_log = proto_register_protocol("Qualcomm DIAG Log", "QCDIAG LOG", "qcdiag_log");
+ proto_register_field_array(proto_qcdiag_log, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+
+ qcdiag_log_code_dissector_table = register_dissector_table("qcdiag_log.code",
+ "QCDIAG LOG code", proto_qcdiag_log, FT_UINT16, BASE_HEX);
+}
+
+void
+proto_reg_handoff_qcdiag_log(void)
+{
+ dissector_handle_t qcdiag_log_handle;
+
+ qcdiag_log_handle = create_dissector_handle(dissect_qcdiag_log, proto_qcdiag_log);
+ dissector_add_uint("qcdiag.cmd", DIAG_LOG_F, qcdiag_log_handle);
+
+ sub_handles[SUB_DATA] = find_dissector("data");
+ sub_handles[SUB_UM_CCCH] = find_dissector_add_dependency("gsm_a_ccch", proto_qcdiag_log);
+ sub_handles[SUB_UM_DTAP] = find_dissector_add_dependency("gsm_a_dtap", proto_qcdiag_log);
+ sub_handles[SUB_UM_SACCH] = find_dissector_add_dependency("gsm_a_sacch", proto_qcdiag_log);
+ sub_handles[SUB_UM_RLC_MAC_UL] = find_dissector_add_dependency("gsm_rlcmac_ul", proto_qcdiag_log);
+ sub_handles[SUB_UM_RLC_MAC_DL] = find_dissector_add_dependency("gsm_rlcmac_dl", proto_qcdiag_log);
+}
+
+/*
+ * 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:
+ */
diff --git a/epan/dissectors/packet-qcdiag_msg.c b/epan/dissectors/packet-qcdiag_msg.c
new file mode 100644
index 0000000000..280188dfe5
--- /dev/null
+++ b/epan/dissectors/packet-qcdiag_msg.c
@@ -0,0 +1,209 @@
+/* packet-qcdiag_msg.c
+ * Routines for Qualcomm DIAG MSG packet handling
+ *
+ * (C) 2016-2017 by Harald Welte <laforge@gnumonks.org>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#include <epan/packet.h>
+#include "packet-qcdiag.h"
+
+static int proto_qcdiag_msg = -1;
+
+static int hf_qcdiag_msg_ts_type = -1;
+static int hf_qcdiag_msg_num_args = -1;
+static int hf_qcdiag_msg_drop_cnt = -1;
+static int hf_qcdiag_msg_line_nr = -1;
+static int hf_qcdiag_msg_subsys_id = -1;
+static int hf_qcdiag_msg_subsys_mask = -1;
+static int hf_qcdiag_msg_fmt_str = -1;
+static int hf_qcdiag_msg_file_name = -1;
+static int hf_qcdiag_msg_argument = -1;
+
+static gint ett_qcdiag_msg = -1;
+
+#define MAX_ARGS 16
+
+static int
+dissect_qcdiag_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void * data _U_)
+{
+ proto_item *ti;
+ proto_tree *diag_msg_tree;
+ gint offset = 1; /* command already dissected by proto-qcdiag.c */
+ guint num_args, line_nr, subsys_id, subsys_mask, i;
+ const guint8 *fmtstr, *file_name;
+ guint args[MAX_ARGS];
+
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "QCDIAG-MSG");
+
+ ti = proto_tree_add_item(tree, proto_qcdiag_msg, tvb, 0, -1, ENC_NA);
+ diag_msg_tree = proto_item_add_subtree(ti, ett_qcdiag_msg);
+
+ proto_tree_add_item(diag_msg_tree, hf_qcdiag_msg_ts_type, tvb, offset++, 1, ENC_NA);
+ proto_tree_add_item_ret_uint(diag_msg_tree, hf_qcdiag_msg_num_args, tvb, offset++, 1, ENC_NA, &num_args);
+ proto_tree_add_item(diag_msg_tree, hf_qcdiag_msg_drop_cnt, tvb, offset++, 1, ENC_NA);
+ /* timestamp */
+ offset += 8;
+
+ proto_tree_add_item_ret_uint(diag_msg_tree, hf_qcdiag_msg_line_nr, tvb, offset, 2, ENC_LITTLE_ENDIAN, &line_nr);
+ offset += 2;
+
+ proto_tree_add_item_ret_uint(diag_msg_tree, hf_qcdiag_msg_subsys_id, tvb, offset, 2, ENC_LITTLE_ENDIAN, &subsys_id);
+ offset += 2;
+
+ proto_tree_add_item_ret_uint(diag_msg_tree, hf_qcdiag_msg_subsys_mask, tvb, offset, 4, ENC_LITTLE_ENDIAN, &subsys_mask);
+ offset += 4;
+
+ /* Append all arguments */
+ for (i = 0; i < num_args; i++) {
+ if (i < MAX_ARGS)
+ proto_tree_add_item_ret_uint(diag_msg_tree, hf_qcdiag_msg_argument, tvb, offset, 4, ENC_LITTLE_ENDIAN, &args[i]);
+ else
+ proto_tree_add_item(diag_msg_tree, hf_qcdiag_msg_argument, tvb, offset, 4, ENC_LITTLE_ENDIAN);
+ offset += 4;
+ }
+
+ proto_tree_add_item_ret_string(diag_msg_tree, hf_qcdiag_msg_fmt_str, tvb, offset, -1, ENC_ASCII, wmem_packet_scope(), &fmtstr);
+ offset += tvb_strsize(tvb, offset);
+
+ proto_tree_add_item_ret_string(diag_msg_tree, hf_qcdiag_msg_file_name, tvb, offset, -1, ENC_ASCII, wmem_packet_scope(), &file_name);
+ offset += tvb_strsize(tvb, offset);
+
+ col_append_fstr(pinfo->cinfo, COL_INFO, "%s:%u ", file_name, line_nr);
+ switch (num_args) {
+ case 0:
+ col_append_str(pinfo->cinfo, COL_INFO, fmtstr);
+ break;
+ case 1:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0]);
+ break;
+ case 2:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1]);
+ break;
+ case 3:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2]);
+ break;
+ case 4:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2], args[3]);
+ break;
+ case 5:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2], args[3], args[4]);
+ break;
+ case 6:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2], args[3], args[4], args[5]);
+ break;
+ case 7:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
+ break;
+ case 8:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
+ break;
+ case 9:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
+ args[8]);
+ break;
+ case 10:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
+ args[8], args[9]);
+ break;
+ case 11:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10]);
+ break;
+ case 12:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11]);
+ break;
+ case 13:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11], args[12]);
+ break;
+ case 14:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11], args[12], args[13]);
+ break;
+ case 15:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11], args[12], args[13], args[14]);
+ break;
+ case 16:
+ col_append_fstr(pinfo->cinfo, COL_INFO, fmtstr, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15]);
+ break;
+ }
+
+ return tvb_captured_length(tvb);
+}
+
+void
+proto_register_qcdiag_msg(void)
+{
+ static hf_register_info hf[] = {
+ { &hf_qcdiag_msg_ts_type, { "Timestamp Type", "qcdiag_msg.ts_type",
+ FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
+ { &hf_qcdiag_msg_num_args, { "Number of Arguments", "qcdiag_msg.num_args",
+ FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
+ { &hf_qcdiag_msg_drop_cnt, { "Dropped message count", "qcdiag_msg.num_drop_cnt",
+ FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL } },
+ { &hf_qcdiag_msg_line_nr, { "Line Number", "qcdiag_msg.line_nr",
+ FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL } },
+ { &hf_qcdiag_msg_subsys_id, { "Subsystem ID", "qcdiag_msg.subsys_id",
+ FT_UINT16, BASE_HEX, NULL, 0, NULL, HFILL } },
+ { &hf_qcdiag_msg_subsys_mask, { "Subsystem Mask", "qcdiag_msg.subsys_mask",
+ FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL } },
+ { &hf_qcdiag_msg_fmt_str, { "Format String", "qcdiag_msg.fmt_str",
+ FT_STRINGZ, BASE_NONE, NULL, 0, NULL, HFILL } },
+ { &hf_qcdiag_msg_file_name, { "File Name", "qcdiag_msg.fmt_str",
+ FT_STRINGZ, BASE_NONE, NULL, 0, NULL, HFILL } },
+ { &hf_qcdiag_msg_argument, { "Argument", "qcdiag_msg.argument",
+ FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL } },
+ };
+ static gint *ett[] = {
+ &ett_qcdiag_msg
+ };
+
+ proto_qcdiag_msg = proto_register_protocol("Qualcomm DIAG Msg", "QCDIAG MSG", "qcdiag_msg");
+ proto_register_field_array(proto_qcdiag_msg, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+}
+
+void
+proto_reg_handoff_qcdiag_msg(void)
+{
+ dissector_handle_t qcdiag_msg_handle;
+
+ qcdiag_msg_handle = create_dissector_handle(dissect_qcdiag_msg, proto_qcdiag_msg);
+ dissector_add_uint("qcdiag.cmd", DIAG_EXT_MSG_F, qcdiag_msg_handle);
+}
+
+/*
+ * 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:
+ */