aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-at.c
diff options
context:
space:
mode:
authorDarien Spencer <cusneud@mail.com>2018-08-03 11:56:33 +0300
committerPeter Wu <peter@lekensteyn.nl>2018-08-05 09:43:46 +0000
commit93eaa1d64819e7c99fdb379238b32383a512116b (patch)
tree7a59448bab52871d47c22e18eae548c508f29ee5 /epan/dissectors/packet-at.c
parentef15155bbfc1ba1e3ee2aec056a1b8abc61a9de8 (diff)
AT: Add CIMI command
Change-Id: I7a03add8b48d0f360fbe5434fef866461804c2f3 Reviewed-on: https://code.wireshark.org/review/28940 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'epan/dissectors/packet-at.c')
-rw-r--r--epan/dissectors/packet-at.c75
1 files changed, 53 insertions, 22 deletions
diff --git a/epan/dissectors/packet-at.c b/epan/dissectors/packet-at.c
index eab47b9552..e76028023a 100644
--- a/epan/dissectors/packet-at.c
+++ b/epan/dissectors/packet-at.c
@@ -18,6 +18,8 @@
#include <epan/packet.h>
#include <epan/expert.h>
+#include "packet-e212.h"
+
void proto_register_at_command(void);
void proto_reg_handoff_at_command(void);
@@ -408,6 +410,13 @@ static gboolean check_chup(gint role, guint16 type) {
return FALSE;
}
+static gboolean check_cimi(gint role, guint16 type) {
+ if (role == ROLE_DTE && (type == TYPE_ACTION_SIMPLY || type == TYPE_TEST)) return TRUE;
+ if (role == ROLE_DCE && type == TYPE_RESPONSE) return TRUE;
+
+ return FALSE;
+}
+
static gboolean check_clcc(gint role, guint16 type) {
if (role == ROLE_DTE && (type == TYPE_ACTION_SIMPLY || type == TYPE_TEST)) return TRUE;
if (role == ROLE_DCE && type == TYPE_RESPONSE) return TRUE;
@@ -533,6 +542,27 @@ dissect_chld_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
static gint
+dissect_cimi_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ gint offset, gint role, guint16 type, guint8 *parameter_stream _U_,
+ guint parameter_number, gint parameter_length, void **data _U_)
+{
+ proto_item *pitem;
+
+ if (!check_cimi(role, type)) return FALSE;
+
+ if (role == ROLE_DTE) return FALSE;
+ if (parameter_number > 0) return FALSE;
+
+ /* Only parameter is found in the response from DCE - the IMSI */
+ pitem = proto_tree_add_item(tree, hf_cimi_imsi, tvb, offset, parameter_length, ENC_NA | ENC_ASCII);
+ /* Hiding the AT IMSI item because we are showing the detailed E.212 item */
+ PROTO_ITEM_SET_HIDDEN(pitem);
+ dissect_e212_utf8_imsi(tvb, pinfo, tree, offset, parameter_length);
+
+ return TRUE;
+}
+
+static gint
dissect_ccwa_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gint offset, gint role, guint16 type, guint8 *parameter_stream,
guint parameter_number, gint parameter_length, void **data _U_)
@@ -1040,29 +1070,30 @@ dissect_no_parameter(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree
Some commands can use TYPE_TEST respose to properly dissect parameters,
for example: AT+CIND=?, AT+CIND? */
static const at_cmd_t at_cmds[] = {
- { "+CCWA", "Call Waiting Notification", check_ccwa, dissect_ccwa_parameter },
- { "+CGMM", "Request model identification", check_cgmm, dissect_cgmm_parameter },
- { "+CHLD", "Call Hold and Multiparty Handling", check_chld, dissect_chld_parameter },
- { "+CHUP", "Call Hang-up", check_chup, dissect_no_parameter },
- { "+CIND", "Phone Indicators", check_cind, dissect_cind_parameter },
- { "+CLCC", "Current Calls", check_clcc, dissect_clcc_parameter },
- { "+COPS", "Reading Network Operator", check_cops, dissect_cops_parameter },
- { "+CMEE", "Mobile Equipment Error", check_cmee, dissect_cmee_parameter },
- { "+CME ERROR", "Mobile Termination Error Result Code", check_cme, dissect_cme_error_parameter },
- { "+CLIP", "Calling Line Identification Notification", check_clip, dissect_clip_parameter },
- { "+CMER", "Event Reporting Activation/Deactivation", check_cmer, dissect_cmer_parameter },
- { "+CIEV", "Indicator Events Reporting", check_ciev, dissect_ciev_parameter },
- { "+VTS", "DTMF and tone generation", check_vts, dissect_vts_parameter },
- { "+CNUM", "Subscriber Number Information", check_cnum, dissect_cnum_parameter },
- { "ERROR", "ERROR", check_only_dce_role, dissect_no_parameter },
- { "RING", "Incoming Call Indication", check_only_dce_role, dissect_no_parameter },
- { "OK", "OK", check_only_dce_role, dissect_no_parameter },
- { "D", "Dial", check_only_dte_role, NULL },
- { "A", "Call Answer", check_only_dte_role, dissect_no_parameter },
- { "E0", "Disable Echo", check_only_dte_role, dissect_no_parameter },
- { "E1", "Enable Echo", check_only_dte_role, dissect_no_parameter },
- { "I", "Product Identification Information", check_only_dte_role, dissect_no_parameter },
+ { "+CCWA", "Call Waiting Notification", check_ccwa, dissect_ccwa_parameter },
+ { "+CGMM", "Request model identification", check_cgmm, dissect_cgmm_parameter },
+ { "+CHLD", "Call Hold and Multiparty Handling", check_chld, dissect_chld_parameter },
+ { "+CHUP", "Call Hang-up", check_chup, dissect_no_parameter },
+ { "+CIMI", "Request International Mobile Subsciber Identity (IMSI)", check_cimi, dissect_cimi_parameter },
+ { "+CIND", "Phone Indicators", check_cind, dissect_cind_parameter },
+ { "+CLCC", "Current Calls", check_clcc, dissect_clcc_parameter },
+ { "+COPS", "Reading Network Operator", check_cops, dissect_cops_parameter },
{ "+CSIM", "Generic SIM access", check_csim, dissect_csim_parameter },
+ { "+CMEE", "Mobile Equipment Error", check_cmee, dissect_cmee_parameter },
+ { "+CME ERROR", "Mobile Termination Error Result Code", check_cme, dissect_cme_error_parameter },
+ { "+CLIP", "Calling Line Identification Notification", check_clip, dissect_clip_parameter },
+ { "+CMER", "Event Reporting Activation/Deactivation", check_cmer, dissect_cmer_parameter },
+ { "+CIEV", "Indicator Events Reporting", check_ciev, dissect_ciev_parameter },
+ { "+VTS", "DTMF and tone generation", check_vts, dissect_vts_parameter },
+ { "+CNUM", "Subscriber Number Information", check_cnum, dissect_cnum_parameter },
+ { "ERROR", "ERROR", check_only_dce_role, dissect_no_parameter },
+ { "RING", "Incoming Call Indication", check_only_dce_role, dissect_no_parameter },
+ { "OK", "OK", check_only_dce_role, dissect_no_parameter },
+ { "D", "Dial", check_only_dte_role, NULL },
+ { "A", "Call Answer", check_only_dte_role, dissect_no_parameter },
+ { "E0", "Disable Echo", check_only_dte_role, dissect_no_parameter },
+ { "E1", "Enable Echo", check_only_dte_role, dissect_no_parameter },
+ { "I", "Product Identification Information", check_only_dte_role, dissect_no_parameter },
{ NULL, NULL, NULL, NULL }
};