diff options
author | AndersBroman <anders.broman@ericsson.com> | 2017-08-17 16:54:29 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-08-18 08:14:08 +0000 |
commit | 6726d9e0cd61634c6bae95857efb2e549ab8f7be (patch) | |
tree | 8afff074030aca054b4c0cd0d32033154a78e000 /epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c | |
parent | 5f52e655002de5fa4ff29d32869cfca2b7eda214 (diff) |
[GSM MAP] Dissect Ext2-QoS-Subscribed, Ext3-QoS-Subscribed and
Ext4-QoS-Subscribed
Change-Id: Ic6a0f80d5f2339fd90284d1fddffe57b66c6771d
Reviewed-on: https://code.wireshark.org/review/23108
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c')
-rw-r--r-- | epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c | 288 |
1 files changed, 284 insertions, 4 deletions
diff --git a/epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c b/epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c index c8fd423354..d3617e45e3 100644 --- a/epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c +++ b/epan/dissectors/asn1/gsm_map/packet-gsm_map-template.c @@ -150,6 +150,22 @@ static int hf_gsm_map_ericsson_locationInformation_lac = -1; static int hf_gsm_map_ericsson_locationInformation_ci = -1; static int hf_gsm_map_ericsson_locationInformation_sac = -1; static int hf_gsm_map_ussd_string = -1; +static int hf_gsm_map_spare_bits = -1; +static int hf_gsm_map_qos_signalling_ind = -1; +static int hf_gsm_map_qos_source_stat_desc = - 1; +static int hf_gsm_map_qos_max_bitrate_upl_ext = -1; +static int hf_gsm_map_qos_max_bitrate_downl_ext = -1; +static int hf_gsm_map_qos_guar_bitrate_upl_ext = -1; +static int hf_gsm_map_qos_guar_bitrate_downl_ext = -1; +/* +static int hf_gsm_map_qos_max_bitrate_upl_ext2 = -1; +static int hf_gsm_map_qos_max_bitrate_downl_ext2 = -1; +static int hf_gsm_map_qos_guar_bitrate_upl_ext2 = -1; +static int hf_gsm_map_qos_guar_bitrate_downl_ext2 = -1; +*/ +static int hf_gsm_map_earp_pci = -1; +static int hf_gsm_map_earp_pl = -1; +static int hf_gsm_map_earp_pvi = -1; #include "packet-gsm_map-hf.c" @@ -182,6 +198,8 @@ static gint ett_gsm_map_ericsson_locationInformation = -1; static gint ett_gsm_map_extension_data = -1; static gint ett_gsm_map_tbcd_digits = -1; static gint ett_gsm_map_ussd_string = -1; +static gint ett_gsm_map_ext2_qos_subscribed = -1; +static gint ett_gsm_map_ext3_qos_subscribed = -1; #include "packet-gsm_map-ett.c" @@ -508,7 +526,7 @@ dissect_gsm_map_ext_qos_subscribed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_ */ octet = tvb_get_guint8(tvb,offset); if (octet == 0 ){ - proto_tree_add_uint_format_value(subtree, hf_gsm_map_guaranteed_max_brate_ulink, tvb, offset, 1, octet, "Reserved" ); + proto_tree_add_uint_format_value(subtree, hf_gsm_map_guaranteed_max_brate_ulink, tvb, offset, 1, octet, "Subscribed guaranteed bit rate for uplink/reserved"); }else{ proto_tree_add_uint(subtree, hf_gsm_map_guaranteed_max_brate_ulink, tvb, offset, 1, gsm_map_calc_bitrate(octet)); } @@ -519,13 +537,202 @@ dissect_gsm_map_ext_qos_subscribed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_ */ octet = tvb_get_guint8(tvb,offset); if (octet == 0 ){ - proto_tree_add_uint_format_value(subtree, hf_gsm_map_guaranteed_max_brate_dlink, tvb, offset, 1, octet, "Reserved" ); + proto_tree_add_uint_format_value(subtree, hf_gsm_map_guaranteed_max_brate_dlink, tvb, offset, 1, octet, "Subscribed guaranteed bit rate for downlink/reserved"); }else{ proto_tree_add_uint(subtree, hf_gsm_map_guaranteed_max_brate_dlink, tvb, offset, 1, gsm_map_calc_bitrate(octet)); } } +/* +Ext2-QoS-Subscribed ::= OCTET STRING (SIZE (1..3)) +-- Octets 1-3 are coded according to 3GPP TS 24.008 [35] Quality of Service Octets 14-16. +-- If Quality of Service information is structured with 14 octet length, then +-- Octet 1 is coded according to 3GPP TS 24.008 [35] Quality of Service Octet 14. + +*/ + +static const true_false_string gsm_map_qos_signalling_ind_value = { + "Optimised for signalling traffic", + "Not optimised for signalling traffic" +}; +#if 0 +/* Helper function returning the main bitrates in kbps */ +static guint32 +qos_calc_bitrate(guint8 oct) +{ + if (oct <= 0x3f) + return oct; + if (oct <= 0x7f) + return 64 + (oct - 0x40) * 8; + + return 576 + (oct - 0x80) * 64; +} +#endif +/* Helper function returning the extended bitrates in kbps */ +static guint32 +qos_calc_ext_bitrate(guint8 oct) +{ + if (oct <= 0x4a) + return 8600 + oct * 100; + if (oct <= 0xba) + return 16000 + (oct - 0x4a) * 1000; + + return 128000 + (oct - 0xba) * 2000; +} +#if 0 +static guint32 +qos_calc_ext2_bitrate(guint8 oct) +{ + if (oct <= 0x3d) + return (256 + oct * 4); + if (oct <= 0xa1) + return (500 + (oct - 0x3d) * 10); + if (oct <= 0xf6) + return (1500 + (oct - 0xa1) * 100); + + return 10000; +} +#endif +static void +dissect_gsm_map_ext2_qos_subscribed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx) { + + int offset = 0; + proto_tree *subtree; + const gchar *str; + guint8 oct, tmp_oct; + guint32 temp32; + int length = tvb_reported_length(tvb); + + subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_ext2_qos_subscribed); + + /* Ocet 14 */ + oct = tvb_get_guint8(tvb, offset); + proto_tree_add_bits_item(subtree, hf_gsm_map_spare_bits, tvb, (offset << 3), 3, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_gsm_map_qos_signalling_ind, tvb, offset, 1, ENC_BIG_ENDIAN); + + tmp_oct = oct & 7; + if (tmp_oct == 0x01) + str = "speech"; + else + str = "unknown"; + + proto_tree_add_uint_format_value(subtree, hf_gsm_map_qos_source_stat_desc, tvb, + offset, 1, oct, "%s (%u)", str, tmp_oct); + + offset += 1; + if (length == offset) { + return; + } + + /* Octet 15 */ + oct = tvb_get_guint8(tvb, offset); + + if (oct == 0x00) + str = "Use the value indicated by the Maximum bit rate for downlink"; + else + { + temp32 = qos_calc_ext_bitrate(oct); + if (temp32 % 1000 == 0) + str = wmem_strdup_printf(wmem_packet_scope(), "%u Mbps", temp32 / 1000); + else + str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", temp32); + } + proto_tree_add_uint_format_value(subtree, hf_gsm_map_qos_max_bitrate_downl_ext, tvb, + offset, 1, oct, "%s (%u)", str, oct); + + offset += 1; + if (length == offset) { + return; + } + + /* Octet 16 */ + oct = tvb_get_guint8(tvb, offset); + + if (oct == 0x00) + str = "Use the value indicated by the Guaranteed bit rate for downlink"; + else + { + temp32 = qos_calc_ext_bitrate(oct); + if (temp32 % 1000 == 0) + str = wmem_strdup_printf(wmem_packet_scope(), "%u Mbps", temp32 / 1000); + else + str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", temp32); + } + proto_tree_add_uint_format_value(subtree, hf_gsm_map_qos_guar_bitrate_downl_ext, tvb, + offset, 1, oct, "%s (%u)", str, oct); + +} + +/* +Ext3-QoS-Subscribed ::= OCTET STRING (SIZE (1..2)) +-- Octets 1-2 are coded according to 3GPP TS 24.008 [35] Quality of Service Octets 17-18. + +*/ +static void +dissect_gsm_map_ext3_qos_subscribed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx) { + + int offset = 0; + proto_tree *subtree; + const gchar *str; + guint8 oct; + guint32 temp32; + int length = tvb_reported_length(tvb); + + subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_ext3_qos_subscribed); + + /* Maximum bit rate for uplink (extended) Octet 17 */ + oct = tvb_get_guint8(tvb, offset); + + if (oct == 0x00) + str = "Use the value indicated by the Maximum bit rate for uplink"; + else + { + temp32 = qos_calc_ext_bitrate(oct); + if (temp32 % 1000 == 0) + str = wmem_strdup_printf(wmem_packet_scope(), "%u Mbps", temp32 / 1000); + else + str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", temp32); + } + proto_tree_add_uint_format_value(subtree, hf_gsm_map_qos_max_bitrate_upl_ext, tvb, + offset, 1, oct, "%s (%u)", str, oct); + + offset += 1; + if (length == offset) { + return; + } + + /* Guaranteed bit rate for uplink (extended) Octet 18 */ + oct = tvb_get_guint8(tvb, offset); + + if (oct == 0x00) + str = "Use the value indicated by the Guaranteed bit rate for uplink"; + else + { + temp32 = qos_calc_ext_bitrate(oct); + if (temp32 % 1000 == 0) + str = wmem_strdup_printf(wmem_packet_scope(), "%u Mbps", temp32 / 1000); + else + str = wmem_strdup_printf(wmem_packet_scope(), "%u kbps", temp32); + } + proto_tree_add_uint_format_value(subtree, hf_gsm_map_qos_guar_bitrate_upl_ext, tvb, + offset, 1, oct, "%s (%u)", str, oct); + + return; +} + +static void +dissect_gsm_map_ext4_qos_subscribed(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, asn1_ctx_t *actx) { + int offset = 0; + proto_tree *subtree; + + subtree = proto_item_add_subtree(actx->created_item, ett_gsm_map_ext3_qos_subscribed); + + proto_tree_add_item(subtree, hf_gsm_map_earp_pvi, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_gsm_map_earp_pl, tvb, offset, 1, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_gsm_map_earp_pci, tvb, offset, 1, ENC_BIG_ENDIAN); + +} #define ELLIPSOID_POINT 0 #define ELLIPSOID_POINT_WITH_UNCERT_CIRC 1 #define ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE 3 @@ -1136,7 +1343,7 @@ static int dissect_invokeData(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ if (application_context_version == 3){ offset=dissect_gsm_map_ch_SendRoutingInfoArg(FALSE, tvb, offset, actx, tree, -1); }else{ - offset=dissect_gsm_old_SendRoutingInfoArgV2(FALSE, tvb, offset, actx, tree, -1); + offset = dissect_gsm_old_SendRoutingInfoArgV2(FALSE, tvb, offset, actx, tree, -1); } break; case 23: /*updateGprsLocation*/ @@ -3127,7 +3334,78 @@ void proto_register_gsm_map(void) { { "USSD String", "gsm_map.ussd_string", FT_STRING, STR_UNICODE, NULL, 0, NULL, HFILL }}, - + { &hf_gsm_map_spare_bits, + { "Spare bit(s)", "gsm_map.spare_bits", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_gsm_map_qos_signalling_ind, + { "Signalling indication", "gsm_map.qos.signalling_ind", + FT_BOOLEAN, 8, TFS(&gsm_map_qos_signalling_ind_value), 0x10, + NULL, HFILL } + }, + { &hf_gsm_map_qos_source_stat_desc, + { "Source statistics description", "gsm_map.qos.source_stat_desc", + FT_UINT8, BASE_DEC, NULL, 0x0f, + NULL, HFILL } + }, + { &hf_gsm_map_qos_max_bitrate_upl_ext, + { "Maximum bitrate for uplink (extended)", "gsm_map.qos.max_bitrate_upl_ext", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_gsm_map_qos_max_bitrate_downl_ext, + { "Maximum bitrate for downlink (extended)", "gsm_map.qos.max_bitrate_downl_ext", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_gsm_map_qos_guar_bitrate_upl_ext, + { "Guaranteed bitrate for uplink (extended)", "gsm_map.qos.guar_bitrate_upl_ext", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_gsm_map_qos_guar_bitrate_downl_ext, + { "Guaranteed bitrate for downlink (extended)", "gsm_map.qos.guar_bitrate_downl_ext", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, +/* + { &hf_gsm_map_qos_max_bitrate_upl_ext2, + { "Maximum bitrate for uplink (extended-2)", "gsm_map.qos.max_bitrate_upl_ext2", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_gsm_map_qos_max_bitrate_downl_ext2, + { "Maximum bitrate for downlink (extended-2)", "gsm_map.qos.max_bitrate_downl_ext2", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_gsm_map_qos_guar_bitrate_upl_ext2, + { "Guaranteed bitrate for uplink (extended-2)", "gsm_map.qos.guar_bitrate_upl_ext2", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + { &hf_gsm_map_qos_guar_bitrate_downl_ext2, + { "Guaranteed bitrate for downlink (extended-2)", "gsm_map.qos.guar_bitrate_downl_ext2", + FT_UINT8, BASE_DEC, NULL, 0x0, + NULL, HFILL } + }, + */ + { &hf_gsm_map_earp_pvi, + { "PVI Pre-emption Vulnerability", "gsm_map.EARP_pre_emption_par_vulnerability", + FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x01, + NULL, HFILL } + }, + { &hf_gsm_map_earp_pl, + { "PL Priority Level", "gsm_map.EARP_priority_level", + FT_UINT8, BASE_DEC, NULL, 0x3C, + NULL, HFILL } + }, + { &hf_gsm_map_earp_pci, + { "PCI Pre-emption Capability", "gsm_map.EARP_pre_emption_Capability", + FT_BOOLEAN, 8, TFS(&tfs_disabled_enabled), 0x40, + NULL, HFILL } + }, #include "packet-gsm_map-hfarr.c" }; @@ -3162,6 +3440,8 @@ void proto_register_gsm_map(void) { &ett_gsm_map_extension_data, &ett_gsm_map_tbcd_digits, &ett_gsm_map_ussd_string, + &ett_gsm_map_ext2_qos_subscribed, + &ett_gsm_map_ext3_qos_subscribed, #include "packet-gsm_map-ettarr.c" }; |