summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2010-12-31 19:11:01 +0100
committerSebastian Reichel <sre@ring0.de>2010-12-31 19:11:01 +0100
commit3352724ad7ad9aedae92dd78d52b9ddb4aa79b3c (patch)
treea8ccac7b3a3389518f5e95c7f2c0b7a04909c0b9
parent2e702b4bf06cf2f9f80065faeed8b3afbd567104 (diff)
downloadisi-wireshark-plugin-3352724ad7ad9aedae92dd78d52b9ddb4aa79b3c.tar.bz2
add support for gsm cell info packets
-rw-r--r--src/isi-network.c114
-rw-r--r--src/packet-isi.c4
-rw-r--r--src/packet-isi.h1
3 files changed, 112 insertions, 7 deletions
diff --git a/src/isi-network.c b/src/isi-network.c
index 2dfe53d..d19b410 100644
--- a/src/isi-network.c
+++ b/src/isi-network.c
@@ -32,9 +32,11 @@ static const value_string isi_network_id[] = {
{0x0B, "NET_RSSI_GET_REQ"},
{0x0C, "NET_RSSI_GET_RESP"},
{0x1E, "NET_RSSI_IND"},
+ {0x20, "NET_CIPHERING_IND"},
{0x35, "NET_RAT_IND"},
{0x36, "NET_RAT_REQ"},
{0x37, "NET_RAT_RESP"},
+ {0x42, "NET_CELL_INFO_IND"},
{0xE0, "NET_REG_STATUS_GET_REQ"},
{0xE1, "NET_REG_STATUS_GET_RESP"},
{0xE2, "NET_REG_STATUS_IND"},
@@ -43,7 +45,7 @@ static const value_string isi_network_id[] = {
{0xE5, "NET_OPER_NAME_READ_REQ"},
{0xE6, "NET_OPER_NAME_READ_RESP"},
{0xF0, "NET_COMMON_MESSAGE"},
- {0x00, NULL }
+ {0x00, NULL}
};
static const value_string isi_network_status_sub_id[] = {
@@ -57,7 +59,14 @@ static const value_string isi_network_status_sub_id[] = {
{0x2C, "NET_RAT_INFO"},
{0xE1, "NET_AVAIL_NETWORK_INFO_COMMON"},
{0xE7, "NET_OPER_NAME_INFO"},
- {0x00, NULL }
+ {0x00, NULL}
+};
+
+static const value_string isi_network_cell_info_sub_id[] = {
+ {0x46, "NET_GSM_CELL_INFO"},
+ {0x47, "NET_WCDMA_CELL_INFO"},
+ {0x50, "NET_EPS_CELL_INFO"},
+ {0x00, NULL}
};
static dissector_handle_t isi_network_handle;
@@ -70,6 +79,22 @@ static guint32 hf_isi_network_status_sub_len = -1;
static guint32 hf_isi_network_status_sub_lac = -1;
static guint32 hf_isi_network_status_sub_cid = -1;
static guint32 hf_isi_network_status_sub_msg = -1;
+static guint32 hf_isi_network_status_sub_msg_len = -1;
+static guint32 hf_isi_network_cell_info_sub_type = -1;
+static guint32 hf_isi_network_cell_info_sub_len = -1;
+static guint32 hf_isi_network_cell_info_sub_operator = -1;
+static guint32 hf_isi_network_gsm_band_900 = -1;
+static guint32 hf_isi_network_gsm_band_1800 = -1;
+static guint32 hf_isi_network_gsm_band_1900 = -1;
+static guint32 hf_isi_network_gsm_band_850 = -1;
+
+static const int *gsm_band_fields[] = {
+ &hf_isi_network_gsm_band_900,
+ &hf_isi_network_gsm_band_1800,
+ &hf_isi_network_gsm_band_1900,
+ &hf_isi_network_gsm_band_850,
+ NULL
+};
void proto_reg_handoff_isi_network(void) {
static gboolean initialized=FALSE;
@@ -94,8 +119,24 @@ void proto_register_isi_network(void) {
{ "Location Area Code (LAC)", "isi.network.sub.lac", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, "Location Area Code (LAC)", HFILL }},
{ &hf_isi_network_status_sub_cid,
{ "Cell ID (CID)", "isi.network.sub.cid", FT_UINT32, BASE_HEX_DEC, NULL, 0x0, "Cell ID (CID)", HFILL }},
- { & hf_isi_network_status_sub_msg,
- { "Text", "isi.network.sub.msg", FT_STRING, BASE_NONE, NULL, 0x0, "Text", HFILL }}
+ { &hf_isi_network_status_sub_msg_len,
+ { "Message Length", "isi.network.sub.msg", FT_UINT16, BASE_DEC, NULL, 0x0, "Message Length", HFILL }},
+ { &hf_isi_network_status_sub_msg,
+ { "Message", "isi.network.sub.msg", FT_STRING, BASE_NONE, NULL, 0x0, "Message", HFILL }},
+ { &hf_isi_network_cell_info_sub_type,
+ { "Subpacket Type", "isi.network.sub.type", FT_UINT8, BASE_HEX, isi_network_cell_info_sub_id, 0x0, "Subpacket Type", HFILL }},
+ { &hf_isi_network_cell_info_sub_len,
+ { "Subpacket Length", "isi.network.sub.len", FT_UINT8, BASE_DEC, NULL, 0x0, "Subpacket Length", HFILL }},
+ { &hf_isi_network_cell_info_sub_operator,
+ { "Operator Code", "isi.network.sub.operator", FT_UINT24, BASE_HEX, NULL, 0x0, "Operator Code", HFILL }},
+ { &hf_isi_network_gsm_band_900,
+ { "900 Mhz Band", "isi.network.sub.gsm_band_900", FT_BOOLEAN, 32, NULL, 0x00000001, "", HFILL }},
+ { &hf_isi_network_gsm_band_1800,
+ { "1800 Mhz Band", "isi.network.sub.gsm_band_1800", FT_BOOLEAN, 32, NULL, 0x00000002, "", HFILL }},
+ { &hf_isi_network_gsm_band_1900,
+ { "1900 Mhz Band", "isi.network.sub.gsm_band_1900", FT_BOOLEAN, 32, NULL, 0x00000004, "", HFILL }},
+ { &hf_isi_network_gsm_band_850,
+ { "850 Mhz Band", "isi.network.sub.gsm_band_850", FT_BOOLEAN, 32, NULL, 0x00000008, "", HFILL }}
};
proto_register_field_array(proto_isi, hf, array_length(hf));
@@ -146,9 +187,11 @@ static void dissect_isi_network_status(tvbuff_t *tvb, packet_info *pinfo, proto_
/* FIXME: TODO */
break;
case 0xe3: ; // UNKNOWN
- /* FIXME: TODO, byte 0-2: ???, encoding is UTF-16 */
+ /* FIXME: TODO: byte 0: message type (provider name / network name) ? */
+
guint16 strlen = tvb_get_ntohs(tvb, offset+2);
- /* TODO: output string length */
+ proto_tree_add_item(subtree, hf_isi_network_status_sub_msg_len, tvb, offset+2, 2, FALSE);
+
char *utf16 = tvb_memdup(tvb, offset+4, strlen*2);
char *ascii = utf16_to_ascii(utf16, strlen);
proto_item *subitem = proto_tree_add_string(subtree, hf_isi_network_status_sub_msg, tvb, offset+4, strlen*2, ascii);
@@ -161,6 +204,52 @@ static void dissect_isi_network_status(tvbuff_t *tvb, packet_info *pinfo, proto_
}
}
+static void dissect_isi_network_cell_info_ind(tvbuff_t *tvb, packet_info *pinfo, proto_item *item, proto_tree *tree) {
+ guint8 len = tvb->length;
+ int i;
+
+ guint8 pkgcount = tvb_get_guint8(tvb, 0x02);
+ proto_tree_add_item(tree, hf_isi_network_data_sub_pkgs, tvb, 0x02, 1, FALSE);
+
+ size_t offset = 0x03;
+
+ for(i=0; i<pkgcount; i++) {
+ guint8 sptype = tvb_get_guint8(tvb, offset+0);
+ guint8 splen = tvb_get_guint8(tvb, offset+1);
+
+ proto_item *subitem = proto_tree_add_text(tree, tvb, offset, splen, "Subpacket (%s)", val_to_str(sptype, isi_network_cell_info_sub_id, "unknown: 0x%x"));
+ proto_tree *subtree = proto_item_add_subtree(subitem, ett_isi_msg);
+
+ proto_tree_add_item(subtree, hf_isi_network_cell_info_sub_type, tvb, offset+0, 1, FALSE);
+ proto_tree_add_item(subtree, hf_isi_network_cell_info_sub_len, tvb, offset+1, 1, FALSE);
+
+ offset += 2;
+
+ switch(sptype) {
+ case 0x50: // NET_EPS_CELL_INFO
+ /* TODO: not yet implemented */
+ expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "unsupported packet");
+ break;
+ case 0x46: // NET_GSM_CELL_INFO
+ proto_tree_add_item(subtree, hf_isi_network_status_sub_lac, tvb, offset+0, 2, FALSE);
+ proto_tree_add_item(subtree, hf_isi_network_status_sub_cid, tvb, offset+2, 4, FALSE);
+ proto_tree_add_bitmask_text(subtree, tvb, offset+6, 4, "GSM Bands: ", "all bands, since none is selected", ett_isi_network_gsm_band_info, gsm_band_fields, FALSE, BMT_NO_FALSE | BMT_NO_TFS);
+ proto_tree_add_item(subtree, hf_isi_network_cell_info_sub_operator, tvb, offset+10, 3, FALSE);
+ /* TODO: analysis of the following 5 bytes (which were 0x00 in my dumps) */
+ break;
+ case 0x47: // NET_WCDMA_CELL_INFO
+ /* TODO: not yet implemented */
+ expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "unsupported packet");
+ break;
+ default:
+ expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "unsupported packet");
+ break;
+ }
+
+ offset += splen - 2;
+ }
+}
+
static void dissect_isi_network(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree) {
proto_item *item = NULL;
proto_tree *tree = NULL;
@@ -174,12 +263,25 @@ static void dissect_isi_network(tvbuff_t *tvb, packet_info *pinfo, proto_item *i
cmd = tvb_get_guint8(tvb, 0);
switch(cmd) {
+ case 0x07:
+ col_set_str(pinfo->cinfo, COL_INFO, "Network Selection Request");
+ expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "unsupported packet");
+ break;
+ case 0x20:
+ col_set_str(pinfo->cinfo, COL_INFO, "Network Ciphering Indication");
+ expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "unsupported packet");
+ break;
case 0xE2:
col_set_str(pinfo->cinfo, COL_INFO, "Network Status Indication");
dissect_isi_network_status(tvb, pinfo, item, tree);
break;
+ case 0x42:
+ col_set_str(pinfo->cinfo, COL_INFO, "Network Cell Info Indication");
+ dissect_isi_network_cell_info_ind(tvb, pinfo, item, tree);
+ break;
default:
col_set_str(pinfo->cinfo, COL_INFO, "unknown Network packet");
+ expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "unsupported packet");
break;
}
}
diff --git a/src/packet-isi.c b/src/packet-isi.c
index 6e06413..8c88f15 100644
--- a/src/packet-isi.c
+++ b/src/packet-isi.c
@@ -75,6 +75,7 @@ static guint32 hf_isi_id = -1;
/* Subtree handles: set by register_subtree_array */
static guint32 ett_isi = -1;
guint32 ett_isi_msg = -1;
+guint32 ett_isi_network_gsm_band_info = -1;
/* Handler registration */
void proto_reg_handoff_isi(void) {
@@ -125,7 +126,8 @@ void proto_register_isi(void) {
static gint *ett[] = {
&ett_isi,
- &ett_isi_msg
+ &ett_isi_msg,
+ &ett_isi_network_gsm_band_info
};
proto_isi = proto_register_protocol("Intelligent Service Interface", "ISI", "isi");
diff --git a/src/packet-isi.h b/src/packet-isi.h
index 08356db..1901c21 100644
--- a/src/packet-isi.h
+++ b/src/packet-isi.h
@@ -6,6 +6,7 @@ extern int proto_isi;
/* Subtree variables */
extern guint32 ett_isi_msg;
+extern guint32 ett_isi_network_gsm_band_info;
#endif