aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-at.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2018-09-06 09:10:02 +0200
committerAnders Broman <a.broman58@gmail.com>2018-09-06 08:31:57 +0000
commit555d911bb09cb4d818a49a8b70682b8bf7948a3b (patch)
tree1cf49e3dad65abd45090fe37d48b46477f36b0d7 /epan/dissectors/packet-at.c
parent8c5a65c47a772d5330e032767ec9a5ee41485ba0 (diff)
AT: Add CGMI and CGMR command
Change-Id: Ifc4f02fcd0def6280a62c0485389a5ca5a2c98d4 Reviewed-on: https://code.wireshark.org/review/29443 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-at.c')
-rw-r--r--epan/dissectors/packet-at.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/epan/dissectors/packet-at.c b/epan/dissectors/packet-at.c
index e31f933f34..0499052c15 100644
--- a/epan/dissectors/packet-at.c
+++ b/epan/dissectors/packet-at.c
@@ -97,7 +97,9 @@ static int hf_ccwa_mode = -1;
static int hf_ccwa_class = -1;
static int hf_cfun_fun = -1;
static int hf_cfun_rst = -1;
+static int hf_cgmi_model_id = -1;
static int hf_cgmm_model_id = -1;
+static int hf_cgmr_model_id = -1;
static int hf_indicator[20] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
static expert_field ei_unknown_command = EI_INIT;
@@ -489,6 +491,13 @@ static gboolean check_cfun(gint role, guint16 type) {
return FALSE;
}
+static gboolean check_cgmi(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_cgmm(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;
@@ -496,6 +505,13 @@ static gboolean check_cgmm(gint role, guint16 type) {
return FALSE;
}
+static gboolean check_cgmr(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_cgsn(gint role, guint16 type) {
if (role == ROLE_DTE && (type == TYPE_ACTION_SIMPLY || type == TYPE_TEST)) return TRUE;
@@ -756,6 +772,22 @@ dissect_cfun_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
static gint
+dissect_cgmi_parameter(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+ gint offset, gint role, guint16 type, guint8 *parameter_stream _U_,
+ guint parameter_number, gint parameter_length, void **data _U_)
+{
+ if (!(role == ROLE_DCE && type == TYPE_RESPONSE)) {
+ return FALSE;
+ }
+
+ if (parameter_number > 1) return FALSE;
+
+ proto_tree_add_item(tree, hf_cgmi_model_id, tvb, offset, parameter_length, ENC_NA | ENC_ASCII);
+
+ return TRUE;
+}
+
+static gint
dissect_cgmm_parameter(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
gint offset, gint role, guint16 type, guint8 *parameter_stream _U_,
guint parameter_number, gint parameter_length, void **data _U_)
@@ -772,6 +804,22 @@ dissect_cgmm_parameter(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
}
static gint
+dissect_cgmr_parameter(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+ gint offset, gint role, guint16 type, guint8 *parameter_stream _U_,
+ guint parameter_number, gint parameter_length, void **data _U_)
+{
+ if (!(role == ROLE_DCE && type == TYPE_RESPONSE)) {
+ return FALSE;
+ }
+
+ if (parameter_number > 1) return FALSE;
+
+ proto_tree_add_item(tree, hf_cgmr_model_id, tvb, offset, parameter_length, ENC_NA | ENC_ASCII);
+
+ return TRUE;
+}
+
+static gint
dissect_chld_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_)
@@ -1422,7 +1470,9 @@ dissect_no_parameter(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree
static const at_cmd_t at_cmds[] = {
{ "+CCWA", "Call Waiting Notification", check_ccwa, dissect_ccwa_parameter },
{ "+CFUN", "Set Phone Functionality", check_cfun, dissect_cfun_parameter },
+ { "+CGMI", "Request manufacturer identification", check_cgmi, dissect_cgmi_parameter },
{ "+CGMM", "Request model identification", check_cgmm, dissect_cgmm_parameter },
+ { "+CGMR", "Request revision identification", check_cgmr, dissect_cgmr_parameter },
{ "+CGSN", "Request Product Serial Number Identification (ESN/IMEI)", check_cgsn, dissect_no_parameter },
{ "+CHLD", "Call Hold and Multiparty Handling", check_chld, dissect_chld_parameter },
{ "+CHUP", "Call Hang-up", check_chup, dissect_no_parameter },
@@ -2242,11 +2292,21 @@ proto_register_at_command(void)
FT_UINT8, BASE_DEC, VALS(cfun_rst_vals), 0,
NULL, HFILL}
},
+ { &hf_cgmi_model_id,
+ { "Manufacturer Identification", "at.cgmi.manufacturer_id",
+ FT_STRING, BASE_NONE, NULL, 0,
+ NULL, HFILL}
+ },
{ &hf_cgmm_model_id,
{ "Model Identification", "at.cgmm.model_id",
FT_STRING, BASE_NONE, NULL, 0,
NULL, HFILL}
},
+ { &hf_cgmr_model_id,
+ { "Revision Identification", "at.cgmr.revision_id",
+ FT_STRING, BASE_NONE, NULL, 0,
+ NULL, HFILL}
+ },
{ &hf_indicator[0],
{ "Indicator 1", "at.indicator.1",
FT_STRING, BASE_NONE, NULL, 0,