From f5fb3686ba01a2b30f5759a5f8ebc60111a60723 Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Tue, 28 Oct 2008 20:23:23 +0000 Subject: [PATCH] Move dissect_geographical_description() from gsm_map to gsm_a_common to make it easier to use it in other dissectors including it from gsm_map makes in neccesarry to include asn1.h. Fix some bugs in the code, use it from bssmap. (Forgotten files). svn path=/trunk/; revision=26610 --- asn1/gsmmap/packet-gsmmap-template.c | 272 --------------------------- asn1/gsmmap/packet-gsmmap-template.h | 2 - 2 files changed, 274 deletions(-) diff --git a/asn1/gsmmap/packet-gsmmap-template.c b/asn1/gsmmap/packet-gsmmap-template.c index f01b58348c..3397430524 100644 --- a/asn1/gsmmap/packet-gsmmap-template.c +++ b/asn1/gsmmap/packet-gsmmap-template.c @@ -49,7 +49,6 @@ #endif #include -#include #include #include #include @@ -121,23 +120,6 @@ static int hf_gsm_map_guaranteed_max_brate_ulink = -1; static int hf_gsm_map_guaranteed_max_brate_dlink = -1; static int hf_gsm_map_GSNAddress_IPv4 = -1; static int hf_gsm_map_GSNAddress_IPv6 = -1; -static int hf_gsm_map_geo_loc_type_of_shape = -1; -static int hf_gsm_map_geo_loc_sign_of_lat = -1; -static int hf_gsm_map_geo_loc_deg_of_lat =-1; -static int hf_gsm_map_geo_loc_deg_of_long =-1; -static int hf_gsm_map_geo_loc_uncertainty_code = -1; -static int hf_gsm_map_geo_loc_uncertainty_semi_major = -1; -static int hf_gsm_map_geo_loc_uncertainty_semi_minor = -1; -static int hf_gsm_map_geo_loc_orientation_of_major_axis = -1; -static int hf_gsm_map_geo_loc_uncertainty_altitude = -1; -static int hf_gsm_map_geo_loc_confidence = -1; -static int hf_gsm_map_geo_loc_no_of_points = -1; -static int hf_gsm_map_geo_loc_D = -1; -static int hf_gsm_map_geo_loc_altitude = -1; -static int hf_gsm_map_geo_loc_inner_radius = -1; -static int hf_gsm_map_geo_loc_uncertainty_radius = -1; -static int hf_gsm_map_geo_loc_offset_angle = -1; -static int hf_gsm_map_geo_loc_included_angle = -1; static int hf_gsm_map_ranap_service_Handover = -1; static int hf_gsm_map_IntegrityProtectionInformation = -1; static int hf_gsm_map_EncryptionInformation = -1; @@ -471,174 +453,6 @@ static const value_string dir_of_alt_vals[] = { { 0, NULL } }; - -void -dissect_geographical_description(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree){ - - proto_item *lat_item, *long_item, *major_item, *minor_item, *alt_item; - /*proto_tree *subtree; */ - - guint8 type_of_shape; - guint8 no_of_points; - int offset = 0; - int length; - guint8 value; - guint32 value32; - - /*subtree = proto_item_add_subtree(item, ett_gsm_map_geo_desc);*/ - - length = tvb_reported_length_remaining(tvb,0); - /* Geographical Location - * The Location Estimate field is composed of 1 or more octets with an internal structure - * according to section 7 in [23.032]. - */ - proto_tree_add_item(tree, hf_gsm_map_geo_loc_type_of_shape, tvb, 0, 1, FALSE); - if (length<2) - return; - type_of_shape = tvb_get_guint8(tvb,offset)>>4; - switch (type_of_shape){ - case ELLIPSOID_POINT: - /* Ellipsoid Point */ - case ELLIPSOID_POINT_WITH_UNCERT_CIRC: - /* Ellipsoid Point with uncertainty Circle */ - case ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE: - /* Ellipsoid Point with uncertainty Ellipse */ - case ELLIPSOID_POINT_WITH_ALT: - /* Ellipsoid Point with Altitude */ - case ELLIPSOID_POINT_WITH_ALT_AND_UNCERT_ELLIPSOID: - /* Ellipsoid Point with altitude and uncertainty ellipsoid */ - case ELLIPSOID_ARC: - /* Ellipsoid Arc */ - offset++; - if (length<4) - return; - proto_tree_add_item(tree, hf_gsm_map_geo_loc_sign_of_lat, tvb, offset, 1, FALSE); - - value32 = tvb_get_ntoh24(tvb,offset)&0x7fffff; - /* convert degrees (X/0x7fffff) * 90 = degrees */ - lat_item = proto_tree_add_item(tree, hf_gsm_map_geo_loc_deg_of_lat, tvb, offset, 3, FALSE); - proto_item_append_text(lat_item,"(%.5f degrees)", (((double)value32/8388607) * 90)); - if (length<7) - return; - offset = offset + 3; - value32 = tvb_get_ntoh24(tvb,offset)&0x7fffff; - long_item = proto_tree_add_item(tree, hf_gsm_map_geo_loc_deg_of_long, tvb, offset, 3, FALSE); - /* (X/0xffffff) *360 = degrees */ - proto_item_append_text(long_item,"(%.5f degrees)", (((double)value32/16777215) * 360)); - offset = offset + 3; - if(type_of_shape==2){ - /* Ellipsoid Point with uncertainty Circle */ - if (length<8) - return; - /* Uncertainty code */ - proto_tree_add_item(tree, hf_gsm_map_geo_loc_uncertainty_code, tvb, offset, 1, FALSE); - }else if(type_of_shape==3){ - /* Ellipsoid Point with uncertainty Ellipse */ - /* Uncertainty semi-major octet 10 - * To convert to metres 10*(((1.1)^X)-1) - */ - value = tvb_get_guint8(tvb,offset)&0x7f; - major_item = proto_tree_add_item(tree, hf_gsm_map_geo_loc_uncertainty_semi_major, tvb, offset, 1, FALSE); - proto_item_append_text(major_item,"(%.1f m)", 10 * (pow(1.1, (double)value) - 1)); - offset++; - /* Uncertainty semi-minor Octet 11 - * To convert to metres 10*(((1.1)^X)-1) - */ - value = tvb_get_guint8(tvb,offset)&0x7f; - minor_item = proto_tree_add_item(tree, hf_gsm_map_geo_loc_uncertainty_semi_minor, tvb, offset, 1, FALSE); - proto_item_append_text(minor_item,"(%.1f m)", 10 * (pow(1.1, (double)value) - 1)); - offset++; - /* Orientation of major axis octet 12 - * allowed value from 0-179 to convert - * to actual degrees multiply by 2. - */ - value = tvb_get_guint8(tvb,offset)&0x7f; - proto_tree_add_uint(tree, hf_gsm_map_geo_loc_orientation_of_major_axis, tvb, offset, 1, value*2); - offset++; - /* Confidence */ - proto_tree_add_item(tree, hf_gsm_map_geo_loc_confidence, tvb, offset, 1, FALSE); - offset++; - }else if(type_of_shape==8){ - /* Ellipsoid Point with Altitude */ - /*D: Direction of Altitude */ - proto_tree_add_item(tree, hf_gsm_map_geo_loc_D, tvb, offset, 1, FALSE); - /* Altitude */ - proto_tree_add_item(tree, hf_gsm_map_geo_loc_altitude, tvb, offset, 2, FALSE); - }else if(type_of_shape==9){ - /* Ellipsoid Point with altitude and uncertainty ellipsoid */ - /*D: Direction of Altitude octet 8,9 */ - proto_tree_add_item(tree, hf_gsm_map_geo_loc_D, tvb, offset, 1, FALSE); - /* Altitude Octet 8,9*/ - proto_tree_add_item(tree, hf_gsm_map_geo_loc_altitude, tvb, offset, 2, FALSE); - offset = offset +2; - /* Uncertainty semi-major octet 10 - * To convert to metres 10*(((1.1)^X)-1) - */ - value = tvb_get_guint8(tvb,offset)&0x7f; - major_item = proto_tree_add_item(tree, hf_gsm_map_geo_loc_uncertainty_semi_major, tvb, offset, 1, FALSE); - proto_item_append_text(major_item,"(%.1f m)", 10 * (pow(1.1, (double)value) - 1)); - offset++; - /* Uncertainty semi-minor Octet 11 - * To convert to metres 10*(((1.1)^X)-1) - */ - value = tvb_get_guint8(tvb,offset)&0x7f; - minor_item = proto_tree_add_item(tree, hf_gsm_map_geo_loc_uncertainty_semi_minor, tvb, offset, 1, FALSE); - proto_item_append_text(minor_item,"(%.1f m)", 10 * (pow(1.1, (double)value) - 1)); - offset++; - /* Orientation of major axis octet 12 - * allowed value from 0-179 to convert - * to actual degrees multiply by 2. - */ - value = tvb_get_guint8(tvb,offset)&0x7f; - proto_tree_add_uint(tree, hf_gsm_map_geo_loc_orientation_of_major_axis, tvb, offset, 1, value*2); - offset++; - /* Uncertainty Altitude 13 - * to convert to metres 45*(((1.025)^X)-1) - */ - value = tvb_get_guint8(tvb,offset)&0x7f; - alt_item = proto_tree_add_item(tree, hf_gsm_map_geo_loc_uncertainty_altitude, tvb, offset, 1, FALSE); - proto_item_append_text(alt_item,"(%.1f m)", 45 * (pow(1.025, (double)value) - 1)); - offset++; - /* Confidence octet 14 - */ - proto_tree_add_item(tree, hf_gsm_map_geo_loc_confidence, tvb, offset, 1, FALSE); - }else if(type_of_shape==10){ - /* Ellipsoid Arc */ - /* Inner radius */ - proto_tree_add_item(tree, hf_gsm_map_geo_loc_inner_radius, tvb, offset, 2, FALSE); - offset= offset +2; - /* Uncertainty radius */ - proto_tree_add_item(tree, hf_gsm_map_geo_loc_uncertainty_radius, tvb, offset, 1, FALSE); - offset++; - /* Offset angle */ - proto_tree_add_item(tree, hf_gsm_map_geo_loc_offset_angle, tvb, offset, 1, FALSE); - offset++; - /* Included angle */ - proto_tree_add_item(tree, hf_gsm_map_geo_loc_included_angle, tvb, offset, 1, FALSE); - offset++; - /* Confidence */ - proto_tree_add_item(tree, hf_gsm_map_geo_loc_confidence, tvb, offset, 1, FALSE); - } - - break; - case POLYGON: /* Polygon */ - /* Number of points */ - no_of_points = tvb_get_guint8(tvb,offset)&0x0f; - proto_tree_add_item(tree, hf_gsm_map_geo_loc_no_of_points, tvb, offset, 1, FALSE); - /* - while ( no_of_points > 0){ - offset++; - - no_of_points--; - } - */ - break; - default: - break; - } - -} - static const value_string gsm_map_cbs_data_coding_scheme_coding_grp_vals[] = { { 0, "Coding Group 0(Language using the GSM 7 bit default alphabet)" }, { 1, "Coding Group 1" }, @@ -2498,92 +2312,6 @@ void proto_register_gsm_map(void) { { "GSN Address IPv6", "gsm_map.gsnaddress_ipv6", FT_IPv4, BASE_NONE, NULL, 0, "IPAddress IPv6", HFILL }}, - { &hf_gsm_map_geo_loc_type_of_shape, - { "Location estimate","gsm_map.gad.location_estimate", - FT_UINT8,BASE_DEC, VALS(type_of_shape_vals), 0xf0, - "Location estimate", HFILL } - }, - { &hf_gsm_map_geo_loc_sign_of_lat, - { "Sign of latitude","gsm_map.gad.sign_of_latitude", - FT_UINT8,BASE_DEC, VALS(sign_of_latitude_vals), 0x80, - "Sign of latitude", HFILL } - }, - { &hf_gsm_map_geo_loc_deg_of_lat, - { "Degrees of latitude","gsm_map.gad.sign_of_latitude", - FT_UINT24,BASE_DEC, NULL, 0x7fffff, - "Degrees of latitude", HFILL } - }, - { &hf_gsm_map_geo_loc_deg_of_long, - { "Degrees of longitude","gsm_map.gad.sign_of_longitude", - FT_UINT24,BASE_DEC, NULL, 0xffffff, - "Degrees of longitude", HFILL } - }, - { &hf_gsm_map_geo_loc_uncertainty_code, - { "Uncertainty code","gsm_map.gad.uncertainty_code", - FT_UINT8,BASE_DEC, NULL, 0x7f, - "Uncertainty code", HFILL } - }, - { &hf_gsm_map_geo_loc_uncertainty_semi_major, - { "Uncertainty semi-major","gsm_map.gad.uncertainty_semi_major", - FT_UINT8,BASE_DEC, NULL, 0x7f, - "Uncertainty semi-major", HFILL } - }, - { &hf_gsm_map_geo_loc_uncertainty_semi_minor, - { "Uncertainty semi-minor","gsm_map.gad.uncertainty_semi_minor", - FT_UINT8,BASE_DEC, NULL, 0x7f, - "Uncertainty semi-minor", HFILL } - }, - { &hf_gsm_map_geo_loc_orientation_of_major_axis, - { "Orientation of major axis","gsm_map.gad.orientation_of_major_axis", - FT_UINT8,BASE_DEC, NULL, 0x0, - "Orientation of major axis", HFILL } - }, - { &hf_gsm_map_geo_loc_uncertainty_altitude, - { "Uncertainty Altitude","gsm_map.gad.uncertainty_altitude", - FT_UINT8,BASE_DEC, NULL, 0x7f, - "Uncertainty Altitude", HFILL } - }, - { &hf_gsm_map_geo_loc_confidence, - { "Confidence(%)","gsm_map.gad.confidence", - FT_UINT8,BASE_DEC, NULL, 0x7f, - "Confidence(%)", HFILL } - }, - { &hf_gsm_map_geo_loc_no_of_points, - { "Number of points","gsm_map.gad.no_of_points", - FT_UINT8,BASE_DEC, NULL, 0x0f, - "Number of points", HFILL } - }, - { &hf_gsm_map_geo_loc_D, - { "D: Direction of Altitude","gsm_map.gad.D", - FT_UINT16,BASE_DEC, VALS(dir_of_alt_vals), 0x8000, - "D: Direction of Altitude", HFILL } - }, - { &hf_gsm_map_geo_loc_altitude, - { "Altitude in meters","gsm_map.gad.altitude", - FT_UINT16,BASE_DEC, NULL, 0x7fff, - "Altitude", HFILL } - }, - { &hf_gsm_map_geo_loc_inner_radius, - { "Inner radius","gsm_map.gad.altitude", - FT_UINT16,BASE_DEC, NULL, 0x0, - "Inner radius", HFILL } - }, - { &hf_gsm_map_geo_loc_uncertainty_radius, - { "Uncertainty radius","gsm_map.gad.no_of_points", - FT_UINT8,BASE_DEC, NULL, 0x7f, - "Uncertainty radius", HFILL } - }, - { &hf_gsm_map_geo_loc_offset_angle, - { "Offset angle","gsm_map.gad.offset_angle", - FT_UINT8,BASE_DEC, NULL, 0x0, - "Offset angle", HFILL } - }, - { &hf_gsm_map_geo_loc_included_angle, - { "Included angle","gsm_map.gad.included_angle", - FT_UINT8,BASE_DEC, NULL, 0x0, - "Included angle", HFILL } - }, - { &hf_gsm_map_ranap_service_Handover, { "service-Handover", "gsm_map.ranap.service_Handover", FT_UINT32, BASE_DEC, VALS(ranap_Service_Handover_vals), 0, diff --git a/asn1/gsmmap/packet-gsmmap-template.h b/asn1/gsmmap/packet-gsmmap-template.h index 48880d3b17..c48103c929 100644 --- a/asn1/gsmmap/packet-gsmmap-template.h +++ b/asn1/gsmmap/packet-gsmmap-template.h @@ -46,8 +46,6 @@ typedef struct _gsm_map_tap_rec_t { WS_VAR_IMPORT const value_string gsm_map_opr_code_strings[]; char* unpack_digits(tvbuff_t *tvb, int offset); -void dissect_geographical_description(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); - extern const value_string ssCode_vals[]; extern const value_string gsm_map_PDP_Type_Organisation_vals[]; extern const value_string gsm_map_ietf_defined_pdp_vals[];