Add sub dissection of AVP MBMS Service Area.
authorAnders Broman <anders.broman@ericsson.com>
Sat, 12 Mar 2011 23:26:55 +0000 (23:26 -0000)
committerAnders Broman <anders.broman@ericsson.com>
Sat, 12 Mar 2011 23:26:55 +0000 (23:26 -0000)
svn path=/trunk/; revision=36181

epan/dissectors/packet-diameter_3gpp.c
epan/dissectors/packet-gtp.c

index 9a2874c326122fcb40bacd9a5586e1f977d18583..7156487f4943e4aefdf2a50742610a2ebb247562 100644 (file)
@@ -28,7 +28,7 @@
   * the content of AVP:s of the OctetString type(or similar).
   */
 
-  #ifdef HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
@@ -100,7 +100,6 @@ static int hf_diameter_3gpp_idr_flags_bit1 = -1;
 static int hf_diameter_3gpp_idr_flags_bit2 = -1;
 static int hf_diameter_3gpp_idr_flags_bit3 = -1;
 static int hf_diameter_3gpp_idr_flags_bit4 = -1;
-
 static gint diameter_3gpp_msisdn_ett                           = -1;
 static gint diameter_3gpp_tmgi_ett                                     = -1;
 static gint diameter_3gpp_ulr_flags_ett = -1;
@@ -189,6 +188,8 @@ dissect_diameter_3gpp_tmgi(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree
 
 }
 
+/* AVP Code: 903 MBMS-Service-Area */
+
 /* AVP Code: 918 MBMS-BMSC-SSM-IP-Address */
 static int
 dissect_diameter_3gpp_ipaddr(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
@@ -483,8 +484,10 @@ proto_reg_handoff_diameter_3gpp(void)
        /* AVP Code: 900 TMGI */
        dissector_add_uint("diameter.3gpp", 900, new_create_dissector_handle(dissect_diameter_3gpp_tmgi, proto_diameter_3gpp));
 
-       /* AVP Code: 904 MBMS-Session-Duration */
-       /* AVP Code: 911 MBMS-Time-To-Data-Transfer */
+       /* AVP Code: 904 MBMS-Session-Duration  Registered by packet-gtp.c */
+       /* AVP Code: 903 MBMS-Service-Area Registered by packet-gtp.c */
+
+       /* AVP Code: 911 MBMS-Time-To-Data-Transfer  Registered by packet-gtp.c */
        /* Registered by packet-gtp.c */
 
        /* AVP Code: 913 MBMS-Required-QoS */
index 45b9ceee34f1af6e33f92bf42290973ca8b2041f..374a992a636463d80a92d41f2200910c89503300 100644 (file)
@@ -5600,22 +5600,14 @@ static int decode_gtp_mbms_ses_dur(tvbuff_t * tvb, int offset, packet_info * pin
  * UMTS:        3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.60
  * MBMS Service Area
  */
-static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
-{
+static int
+dissect_gtp_3gpp_mbms_service_area(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
 
-    guint16 length;
-    proto_tree *ext_tree;
-    proto_item *te, *item;
-    guint8 no_of_mbms_sa_codes;
+       int offset = 0;
+       int length = tvb_length(tvb);
+       guint8 no_of_mbms_sa_codes;
     int i;
 
-    length = tvb_get_ntohs(tvb, offset + 1);
-    te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_SA, &gtp_val_ext, "Unknown"));
-    ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_sa);
-
-    offset++;
-    item = proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
-    offset = offset + 2;
     /* The MBMS Service Area is defined in 3GPP TS 23.246 [26].
      * The MBMS Service Area information element indicates the area over
      * which the Multimedia Broadcast/Multicast Service is to be distributed.
@@ -5629,21 +5621,38 @@ static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo _U
      * 256 binary value is '11111111'
      */
     no_of_mbms_sa_codes = tvb_get_guint8(tvb, offset) + 1;
-    if (length != ((no_of_mbms_sa_codes << 1) + 1)) {
-        expert_add_info_format(pinfo, item, PI_RESPONSE_CODE, PI_WARN,
-                               "Wrong length: %u. The length of an MBMS service area code is 2 octets", length);
-    }
-    proto_tree_add_uint(ext_tree, hf_gtp_no_of_mbms_sa_codes, tvb, offset, 1, no_of_mbms_sa_codes);
+    proto_tree_add_uint(tree, hf_gtp_no_of_mbms_sa_codes, tvb, offset, 1, no_of_mbms_sa_codes);
     offset++;
     /* A consecutive list of N MBMS service area codes
      * The MBMS Service Area Identity and its semantics are defined in 3GPP TS 23.003
      * The length of an MBMS service area code is 2 octets.
      */
     for (i = 0; i < no_of_mbms_sa_codes; i++) {
-        proto_tree_add_item(ext_tree, hf_gtp_mbms_sa_code, tvb, offset, 2, ENC_BIG_ENDIAN);
+        proto_tree_add_item(tree, hf_gtp_mbms_sa_code, tvb, offset, 2, ENC_BIG_ENDIAN);
         offset = offset + 2;
     }
 
+       return offset;
+}
+
+static int decode_gtp_mbms_sa(tvbuff_t * tvb, int offset, packet_info * pinfo _U_, proto_tree * tree)
+{
+
+       tvbuff_t *next_tvb;
+    guint16 length;
+    proto_tree *ext_tree;
+    proto_item *te;
+
+    length = tvb_get_ntohs(tvb, offset + 1);
+    te = proto_tree_add_text(tree, tvb, offset, 3 + length, "%s", val_to_str_ext_const(GTP_EXT_MBMS_SA, &gtp_val_ext, "Unknown"));
+    ext_tree = proto_item_add_subtree(te, ett_gtp_ext_mbms_sa);
+
+    offset++;
+    proto_tree_add_item(ext_tree, hf_gtp_ext_length, tvb, offset, 2, ENC_BIG_ENDIAN);
+    offset = offset + 2;
+       next_tvb = tvb_new_subset(tvb, offset, length-3, length-3);
+       dissect_gtp_3gpp_mbms_service_area(next_tvb, pinfo,ext_tree);
+
     return 3 + length;
 
 }
@@ -7471,6 +7480,8 @@ void proto_reg_handoff_gtp(void)
         bssap_pdu_type_table = find_dissector_table("bssap.pdu_type");
         /* AVP Code: 5 3GPP-GPRS Negotiated QoS profile */
         dissector_add_uint("diameter.3gpp", 5, new_create_dissector_handle(dissect_diameter_3gpp_qosprofile, proto_gtp));
+               /* AVP Code: 903 MBMS-Service-Area */
+               dissector_add_uint("diameter.3gpp", 903, new_create_dissector_handle(dissect_gtp_3gpp_mbms_service_area, proto_gtp));
         /* AVP Code: 904 MBMS-Session-Duration */
         dissector_add_uint("diameter.3gpp", 904, new_create_dissector_handle(dissect_gtp_mbms_ses_dur, proto_gtp));
         /* AVP Code: 911 MBMS-Time-To-Data-Transfer */