From 67c0c32e91db0056fd3aaf5ee485880698d12702 Mon Sep 17 00:00:00 2001 From: Klaus Kurzmann Date: Fri, 8 Apr 2011 16:06:47 +0200 Subject: add and use a dissect_isi_common and use it for all resources Signed-off-by: Klaus Kurzmann --- src/isi-call.c | 3 ++ src/isi-gps.c | 3 ++ src/isi-gss.c | 23 +--------- src/isi-mtc.c | 4 +- src/isi-nameservice.c | 4 ++ src/isi-network.c | 3 ++ src/isi-phoneinfo.c | 3 ++ src/isi-sim.c | 17 +------ src/isi-sms.c | 23 +--------- src/isi-ss.c | 22 +-------- src/packet-isi.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++-- src/packet-isi.h | 1 + 12 files changed, 146 insertions(+), 83 deletions(-) diff --git a/src/isi-call.c b/src/isi-call.c index b7f9ecb..4a1e903 100644 --- a/src/isi-call.c +++ b/src/isi-call.c @@ -151,6 +151,9 @@ static void dissect_isi_call(tvbuff_t *tvb, packet_info *pinfo, proto_item *isit cmd = tvb_get_guint8(tvb, 0); switch (cmd) { + case 0xF0: /* CALL_COMMON_MESSAGE */ + dissect_isi_common("Call", tvb, pinfo, tree); + break; default: col_set_str(pinfo->cinfo, COL_INFO, "unknown Call packet"); expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "unsupported packet"); diff --git a/src/isi-gps.c b/src/isi-gps.c index 5961fc7..3ed3787 100644 --- a/src/isi-gps.c +++ b/src/isi-gps.c @@ -336,6 +336,9 @@ static void dissect_isi_gps(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitr col_set_str(pinfo->cinfo, COL_INFO, "GPS Data"); dissect_isi_gps_data(tvb, pinfo, item, tree); break; + case 0xF0: /* COMMON_MESSAGE */ + dissect_isi_common("GPS", tvb, pinfo, tree); + break; default: col_add_fstr(pinfo->cinfo, COL_INFO, "unknown GPS packet (0x%02x)", cmd); break; diff --git a/src/isi-gss.c b/src/isi-gss.c index b8058a6..a3fbcd6 100644 --- a/src/isi-gss.c +++ b/src/isi-gss.c @@ -154,27 +154,8 @@ static void dissect_isi_gss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitr } break; - case 0xF0: /* Common Message */ - proto_tree_add_item(tree, hf_isi_gss_common_message_id, tvb, 1, 1, FALSE); - //proto_tree_add_item(tree, hf_isi_gss_cause, tvb, 2, 1, FALSE); - code = tvb_get_guint8(tvb, 1); - switch(code) { - case 0x01: /* COMM_SERVICE_NOT_IDENTIFIED_RESP */ - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: Service Not Identified Response"); - break; - case 0x12: /* COMM_ISI_VERSION_GET_REQ */ - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: ISI Version Get Request"); - break; - case 0x13: /* COMM_ISI_VERSION_GET_RESP */ - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: ISI Version Get Response"); - break; - case 0x14: /* COMM_ISA_ENTITY_NOT_REACHABLE_RESP */ - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: ISA Entity Not Reachable"); - break; - default: - col_set_str(pinfo->cinfo, COL_INFO, "Common Message"); - break; - } + case 0xF0: /* COMMON_MESSAGE */ + dissect_isi_common("General Stack Server", tvb, pinfo, tree); break; diff --git a/src/isi-mtc.c b/src/isi-mtc.c index 4921131..be87a44 100644 --- a/src/isi-mtc.c +++ b/src/isi-mtc.c @@ -227,9 +227,9 @@ static void dissect_isi_mtc(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitr proto_tree_add_item(tree, hf_isi_mtc_action, tvb, 2, 1, FALSE); col_set_str(pinfo->cinfo, COL_INFO, "MTC RF Status Info Indication"); break; - case 0xF0: /* MTC_COMMON_MESSAGE */ + case 0xF0: /* COMMON_MESSAGE */ col_set_str(pinfo->cinfo, COL_INFO, "MTC Common Message"); - dissect_isi_common(tvb, pinfo, tree); + dissect_isi_common("MTC", tvb, pinfo, tree); break; default: col_set_str(pinfo->cinfo, COL_INFO, "unknown MTC packet"); diff --git a/src/isi-nameservice.c b/src/isi-nameservice.c index 5af9fb8..d0b9ec1 100644 --- a/src/isi-nameservice.c +++ b/src/isi-nameservice.c @@ -82,6 +82,10 @@ static void dissect_isi_nameservice(tvbuff_t *tvb, packet_info *pinfo, proto_ite col_set_str(pinfo->cinfo, COL_INFO, "Nameservice Add "); break; + case 0xF0: /* COMMON_MESSAGE */ + dissect_isi_common("Nameservice", tvb, pinfo, tree); + break; + default: col_set_str(pinfo->cinfo, COL_INFO, "unknown Nameservice packet"); expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "unsupported packet"); diff --git a/src/isi-network.c b/src/isi-network.c index 2e4a655..da7e7c3 100644 --- a/src/isi-network.c +++ b/src/isi-network.c @@ -320,6 +320,9 @@ static void dissect_isi_network(tvbuff_t *tvb, packet_info *pinfo, proto_item *i col_set_str(pinfo->cinfo, COL_INFO, "Network Cell Info Indication"); dissect_isi_network_cell_info_ind(tvb, pinfo, item, tree); break; + case 0xF0: + dissect_isi_common("Network", tvb, pinfo, 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"); diff --git a/src/isi-phoneinfo.c b/src/isi-phoneinfo.c index eca5207..b2b6a73 100644 --- a/src/isi-phoneinfo.c +++ b/src/isi-phoneinfo.c @@ -120,6 +120,9 @@ static void dissect_isi_phoneinfo(tvbuff_t *tvb, packet_info *pinfo, proto_item cmd = tvb_get_guint8(tvb, 0); switch (cmd) { + case 0xF0: /* COMMON_MESSAGE */ + dissect_isi_common("PhoneInfo", tvb, pinfo, tree); + break; default: col_set_str(pinfo->cinfo, COL_INFO, "unknown PhoneInfo packet"); expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "unsupported packet"); diff --git a/src/isi-sim.c b/src/isi-sim.c index c88fee2..f8ba227 100644 --- a/src/isi-sim.c +++ b/src/isi-sim.c @@ -462,21 +462,8 @@ static void dissect_isi_sim(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitr } break; - case 0xF0: /* SIM_COMMON_MESSAGE */ - proto_tree_add_item(tree, hf_isi_sim_cause, tvb, 1, 1, FALSE); - proto_tree_add_item(tree, hf_isi_sim_secondary_cause, tvb, 2, 1, FALSE); - code = tvb_get_guint8(tvb, 1); - switch(code) { - case 0x00: - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: SIM Server Not Available"); - break; - case 0x12: - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: PIN Enable OK"); - break; - default: - col_set_str(pinfo->cinfo, COL_INFO, "Common Message"); - break; - } + case 0xF0: /* COMMON_MESSAGE */ + dissect_isi_common("SIM", tvb, pinfo, tree); break; default: diff --git a/src/isi-sms.c b/src/isi-sms.c index 870c395..7b8545b 100644 --- a/src/isi-sms.c +++ b/src/isi-sms.c @@ -297,29 +297,10 @@ static void dissect_isi_sms(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitr } break; - case 0xF0: /* SS_COMMON_MESSAGE */ - proto_tree_add_item(tree, hf_isi_sms_common_message_id, tvb, 1, 1, FALSE); - code = tvb_get_guint8(tvb, 1); - switch(code) { - case 0x01: /* COMM_SERVICE_NOT_IDENTIFIED_RESP */ - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: Service Not Identified Response"); - break; - case 0x12: /* COMM_ISI_VERSION_GET_REQ */ - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: ISI Version Get Request"); - break; - case 0x13: /* COMM_ISI_VERSION_GET_RESP */ - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: ISI Version Get Response"); - break; - case 0x14: /* COMM_ISA_ENTITY_NOT_REACHABLE_RESP */ - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: ISA Entity Not Reachable"); - break; - default: - col_set_str(pinfo->cinfo, COL_INFO, "Common Message"); - break; - } + case 0xF0: /* COMMON_MESSAGE */ + dissect_isi_common("SMS", tvb, pinfo, tree); break; - default: col_set_str(pinfo->cinfo, COL_INFO, "Unknown type"); break; diff --git a/src/isi-ss.c b/src/isi-ss.c index 1f6938b..9a4f758 100644 --- a/src/isi-ss.c +++ b/src/isi-ss.c @@ -296,26 +296,8 @@ static void dissect_isi_ss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitre } break; - case 0xF0: /* SS_COMMON_MESSAGE */ - proto_tree_add_item(tree, hf_isi_ss_common_message_id, tvb, 1, 1, FALSE); - code = tvb_get_guint8(tvb, 1); - switch(code) { - case 0x01: /* COMM_SERVICE_NOT_IDENTIFIED_RESP */ - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: Service Not Identified Response"); - break; - case 0x12: /* COMM_ISI_VERSION_GET_REQ */ - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: ISI Version Get Request"); - break; - case 0x13: /* COMM_ISI_VERSION_GET_RESP */ - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: ISI Version Get Response"); - break; - case 0x14: /* COMM_ISA_ENTITY_NOT_REACHABLE_RESP */ - col_set_str(pinfo->cinfo, COL_INFO, "Common Message: ISA Entity Not Reachable"); - break; - default: - col_set_str(pinfo->cinfo, COL_INFO, "Common Message"); - break; - } + case 0xF0: /* COMMON_MESSAGE */ + dissect_isi_common("Subscriber Service", tvb, pinfo, tree); break; diff --git a/src/packet-isi.c b/src/packet-isi.c index 1e2eb42..2c17087 100644 --- a/src/packet-isi.c +++ b/src/packet-isi.c @@ -185,7 +185,7 @@ static const value_string hf_isi_resource[] = { {0x8E, "AT Modem Server"}, {0x8F, "AT Application Server"}, {0x90, "Modem LCS Server"}, - {0x91, "Modem Test Server"} + {0x91, "Modem Test Server"}, {0x94, "ODIN"}, {0x95, "Wireless Telephony Application"}, {0x9A, "CDMA DSP Layer 1 Data"}, @@ -216,7 +216,7 @@ static const value_string hf_isi_resource[] = { {0xB3, "News Delivery Server"}, {0xB4, "WCDMA Radio Factory Server"}, {0xB5, "EUTRAN L2 layers towards MACN layers server"}, - {0xB6, "EUTRAN L1 layer server */ + {0xB6, "EUTRAN L1 layer server"}, {0xB7, "RF control and tuning"}, {0xB8, "Instance Message Engine"}, {0xB9, "Timing & NAT Traversal (TNT)"}, @@ -287,6 +287,29 @@ static const value_string hf_isi_resource[] = { {0xFE, "DSP Music"}, }; +static const value_string isi_common_cmd[] = { + {0x14, "COMM_ISA_ENTITY_NOT_REACHABLE_RESP"}, + {0x01, "COMM_SERVICE_NOT_IDENTIFIED_RESP"}, + {0x02, "COMM_SERVER_VERSION_GET_REQ"}, + {0x03, "COMM_SERVER_VERSION_GET_RESP"}, + {0x12, "COMM_ISI_VERSION_GET_REQ"}, + {0x13, "COMM_ISI_VERSION_GET_RESP"}, + {0x04, "COMM_FTD_DATA_REQ"}, + {0x05, "COMM_FTD_DATA_RESP"}, + {0x06, "COMM_FTD_TEST_DATA_REQ"}, + {0x07, "COMM_FTD_TEST_DATA_RESP"}, + {0x08, "COMM_FTD_DATA_DEACTIVATE_REQ"}, + {0x09, "COMM_FTD_DATA_DEACTIVATE_RESP"}, + {0x0C, "COMM_PWR_OFF_CONFIRM_REQ"}, + {0x0D, "COMM_PWR_OFF_CONFIRM_RESP"}, + {0x0E, "COMM_NVD_SET_DEFAULT_REQ"}, + {0x0F, "COMM_NVD_SET_DEFAULT_RESP"}, + {0x10, "COMM_NVD_VERSION_CHK_REQ"}, + {0x11, "COMM_NVD_VERSION_CHK_RESP"}, + {0x15, "COMM_RF_CONTROL_REQ"}, + {0x16, "COMM_RF_CONTROL_RESP"}, + {0x17, "COMM_SERVICE_NOT_AUTHENTICATED_RESP"}, +}; static guint32 hf_isi_rdev = -1; @@ -296,6 +319,9 @@ static guint32 hf_isi_len = -1; static guint32 hf_isi_robj = -1; static guint32 hf_isi_sobj = -1; static guint32 hf_isi_id = -1; +static guint32 hf_isi_comcmd = -1; +static guint32 hf_isi_version_major = -1; +static guint32 hf_isi_version_minor = -1; /* Subtree handles: set by register_subtree_array */ static guint32 ett_isi = -1; @@ -375,7 +401,16 @@ void proto_register_isi(void) { NULL, 0x0, "Sender Object", HFILL }}, { &hf_isi_id, { "Packet ID", "isi.id", FT_UINT8, BASE_DEC, - NULL, 0x0, "Packet ID", HFILL }} + NULL, 0x0, "Packet ID", HFILL }}, + { &hf_isi_comcmd, + { "Sub Command", "isi.comcmd", FT_UINT8, BASE_HEX, + isi_common_cmd, 0x0, "Common Command", HFILL }}, + { &hf_isi_version_major, + { "ISI Version Major", "isi.version_major", FT_UINT8, BASE_HEX, + NULL, 0x0, "ISI Version Major", HFILL }}, + { &hf_isi_version_minor, + { "ISI Version Minor", "isi.version_minor", FT_UINT8, BASE_HEX, + NULL, 0x0, "ISI Version Minor", HFILL }}, }; static gint *ett[] = { @@ -384,7 +419,7 @@ void proto_register_isi(void) { &ett_isi_network_gsm_band_info }; - proto_isi = proto_register_protocol("Intelligent Service Interface", "ISI", "isi"); + proto_isi = proto_register_protocol("Intelligent Service Interface", "ISI", "isi"); proto_register_field_array(proto_isi, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -464,3 +499,83 @@ static void dissect_isi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { call_dissector(data_handle, content, pinfo, isi_tree); } } + +void dissect_isi_common(const char *resource, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { + char *c_subcmd = "unknown common command"; + guint8 comcmd = tvb_get_guint8(tvb, 1); + proto_tree_add_item(tree, hf_isi_comcmd, tvb, 1, 1, FALSE); + + switch(comcmd) { + case 0x01: /* COMM_SERVICE_NOT_IDENTIFIED_RESP */ + c_subcmd = "Service Not Identified Response"; + break; + case 0x02: /* COMM_SERVER_VERSION_GET_REQ */ + c_subcmd = "Server Version Get Request"; + break; + case 0x03: /* COMM_SERVER_VERSION_GET_RESP */ + c_subcmd = "Server Version Get Response"; + break; + case 0x04: /* COMM_FTD_DATA_REQ */ + c_subcmd = "FTD Data Request"; + break; + case 0x05: /* COMM_FTD_DATA_RESP */ + c_subcmd = "FTD Data Response"; + break; + case 0x06: /* COMM_FTD_TEST_DATA_REQ */ + c_subcmd = "FTD Test Data Request"; + break; + case 0x07: /* COMM_FTD_TEST_DATA_RESP */ + c_subcmd = "FTD Test Data Response"; + break; + case 0x08: /* COMM_FTD_DATA_DEACTIVATE_REQ */ + c_subcmd = "FTD Data Deactivate Request"; + break; + case 0x09: /* COMM_FTD_DATA_DEACTIVATE_RESP */ + c_subcmd = "FTD Data Deactivate Response"; + break; + case 0x0C: /* COMM_PWR_OFF_CONFIRM_REQ */ + c_subcmd = "Power Off Confirm Request"; + break; + case 0x0D: /* COMM_PWR_OFF_CONFIRM_RESP */ + c_subcmd = "Power Off Confirm Response"; + break; + case 0x0E: /* COMM_NVD_SET_DEFAULT_REQ */ + c_subcmd = "NVD Set Default Request"; + break; + case 0x0F: /* COMM_NVD_SET_DEFAULT_RESP */ + c_subcmd = "NVD Set Default Response"; + break; + case 0x10: /* COMM_NVD_VERSION_CHK_REQ */ + c_subcmd = "NVD Version Check Request"; + break; + case 0x11: /* COMM_NVD_VERSION_CHK_RESP */ + c_subcmd = "NVD Version Check Response"; + break; + case 0x12: /* COMM_ISI_VERSION_GET_REQ */ + c_subcmd = "ISI Version Get Request"; + break; + case 0x13: /* COMM_ISI_VERSION_GET_RESP */ + c_subcmd = "ISI Version Get Response"; + proto_tree_add_item(tree, hf_isi_version_major, tvb, 2, 1, FALSE); + proto_tree_add_item(tree, hf_isi_version_minor, tvb, 3, 1, FALSE); + break; + case 0x14: /* COMM_ISA_ENTITY_NOT_REACHABLE_RESP */ + c_subcmd = "ISA Entity Not Reachable Response"; + break; + case 0x15: /* COMM_RF_CONTROL_REQ */ + c_subcmd = "RF Control Request"; + break; + case 0x16: /* COMM_RF_CONTROL_RESP */ + c_subcmd = "RF Control Response"; + break; + case 0x17: /* COMM_SERVICE_NOT_AUTHENTICATED_RESP */ + c_subcmd = "Service Not Authenticated Response"; + break; + default: + //expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "unsupported packet"); + break; + } + + col_add_fstr(pinfo->cinfo, COL_INFO, "%s Common Message: %s", resource, c_subcmd); +} + diff --git a/src/packet-isi.h b/src/packet-isi.h index 1901c21..f104244 100644 --- a/src/packet-isi.h +++ b/src/packet-isi.h @@ -8,5 +8,6 @@ extern int proto_isi; extern guint32 ett_isi_msg; extern guint32 ett_isi_network_gsm_band_info; +void dissect_isi_common(const char *resource, tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); #endif -- cgit v1.2.3