Make it possible to do subdissection of Diameter AVP:s and add dissection
authorAnders Broman <anders.broman@ericsson.com>
Sun, 27 Jan 2008 21:06:33 +0000 (21:06 -0000)
committerAnders Broman <anders.broman@ericsson.com>
Sun, 27 Jan 2008 21:06:33 +0000 (21:06 -0000)
of some 3GPP AVP:s.

svn path=/trunk/; revision=24211

epan/dissectors/Makefile.common
epan/dissectors/packet-diameter.c
epan/dissectors/packet-gsm_a.c
epan/dissectors/packet-gtp.c

index a8ade08358af69103142b2029430cf5111ba51d3..4c1609b08755e0551e6427f4ac8563c6daaf61f8 100644 (file)
@@ -340,6 +340,7 @@ CLEAN_DISSECTOR_SRC = \
        packet-dhcp-failover.c  \
        packet-dhcpv6.c         \
        packet-diameter.c       \
+       packet-diameter_3gpp.c  \
        packet-dis.c            \
        packet-dis-enums.c      \
        packet-dis-fields.c     \
index 1d05016a59fa40015fee510da1e278e2cf2ff338..7ce6a45ba58c46bca41fffce009bd0e4e341e0cd 100644 (file)
@@ -268,6 +268,10 @@ static range_t *diameter_tcp_port_range;
 /* desegmentation of Diameter over TCP */
 static gboolean gbl_diameter_desegment = TRUE;
 
+/* Dissector tables */
+#define VND_3GPP               10415
+static dissector_table_t diameter_3gpp_avp_dissector_table;
+
 static const char* avpflags_str[] = {
        "---",
        "--P",
@@ -398,6 +402,20 @@ static int dissect_diameter_avp(diam_ctx_t* c, tvbuff_t* tvb, int offset) {
 
        if (avp_str) proto_item_append_text(avp_item," val=%s", avp_str);
 
+       /* Call subdissectors for AVP:s */
+       switch (vendorid){
+       case 0:
+               break;
+       case VND_3GPP:
+               dissector_try_port(diameter_3gpp_avp_dissector_table, code, subtvb, c->pinfo, avp_tree);
+               break;
+       default:
+               break;
+       }
+       /* Debug
+       proto_tree_add_text(avp_tree, subtvb, 0, -1, "AVP %u data, Vendor Id %u ",code,vendorid);
+       */
+
        return len;
 }
 
@@ -1342,6 +1360,9 @@ proto_register_diameter(void)
 
        /* Allow dissector to find be found by name. */
        new_register_dissector("diameter", dissect_diameter, proto_diameter);
+       
+       /* Register dissector table(s) to do sub dissection of AVP:s ( OctetStrings) */ 
+       diameter_3gpp_avp_dissector_table = register_dissector_table("diameter.3gpp", "DIAMETER_3GPP_AVPS", FT_UINT32, BASE_DEC);
 
        /* Set default TCP ports */
        range_convert_str(&global_diameter_tcp_port_range, DEFAULT_DIAMETER_PORT_RANGE, MAX_UDP_PORT);
index 1f2d8272f2bdd4965af421f6171815ad7f98fc87..fc8ac8518012c567f43c17e72bbfa29a3fc98408 100644 (file)
@@ -1120,6 +1120,8 @@ static int hf_gsm_a_dtap_cause = -1;
 
 static int hf_gsm_a_MSC_rev = -1;
 static int hf_gsm_a_ES_IND                     = -1;
+static int hf_gsm_a_qos_delay_cls      = -1;
+static int hf_gsm_a_qos_qos_reliability_cls = -1;
 static int hf_gsm_a_qos_traffic_cls = -1;
 static int hf_gsm_a_qos_del_order = -1;
 static int hf_gsm_a_qos_del_of_err_sdu = -1;
@@ -11513,8 +11515,29 @@ de_sm_pdp_addr(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar
 }
 
 /*
- * [7] 10.5.6.5
+ * [7] 10.5.6.5 3GPP TS 24.008 version 7.8.0 Release 7
  */
+
+ static const value_string gsm_a_qos_delay_cls_vals[] = {
+       { 0x00, "Subscribed delay class (in MS to network direction)" },
+       { 0x01, "Delay class 1" },
+       { 0x02, "Delay class 2" },
+       { 0x03, "Delay class 3" },
+       { 0x04, "Delay class 4 (best effort)" },
+       { 0x07, "Reserved" },
+       { 0, NULL }
+};
+
+ static const value_string gsm_a_qos_reliability_vals[] = {
+       { 0x00, "Subscribed reliability class (in MS to network direction)" },
+       { 0x01, "Acknowledged GTP, LLC, and RLC; Protected data" },
+       { 0x02, "Unacknowledged GTP, Ack LLC/RLC, Protected data" },
+       { 0x03, "Unacknowledged GTP/LLC, Ack RLC, Protected data" },
+       { 0x04, "Unacknowledged GTP/LLC/RLC, Protected data" },
+       { 0x05, "Unacknowledged GTP/LLC/RLC, Unprotected data" },
+       { 0x07, "Reserved" },
+       { 0, NULL }
+};
  /* Delivery of erroneous SDUs, octet 6 (see 3GPP TS 23.107) Bits 3 2 1 */
 const value_string gsm_a_qos_del_of_err_sdu_vals[] = {
        { 0, "Subscribed delivery of erroneous SDUs/Reserved" },
@@ -11596,36 +11619,8 @@ de_sm_qos(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint len, gchar *add
 
     oct = tvb_get_guint8(tvb, curr_offset);
 
-    switch ( (oct>>3)&7 )
-    {
-       case 0x00: str="Subscribed delay class/reserved"; break;
-       case 0x01: str="Delay class 1"; break;
-       case 0x02: str="Delay class 2"; break;
-       case 0x03: str="Delay class 3"; break;
-       case 0x04: str="Delay class 4 (best effort)"; break;
-       case 0x07: str="Reserved"; break;
-       default: str="Delay class 4 (best effort)";
-    }
-
-    proto_tree_add_text(tree,
-       tvb, curr_offset, 1,
-       "Delay class: (%u) %s",(oct>>3)&7,str);
-
-    switch ( oct&0x7 )
-    {
-       case 0x00: str="Subscribed reliability class/reserved"; break;
-       case 0x01: str="Acknowledged GTP, LLC, and RLC; Protected data"; break;
-       case 0x02: str="Unacknowledged GTP; Acknowledged LLC and RLC, Protected data"; break;
-       case 0x03: str="Unacknowledged GTP and LLC; Acknowledged RLC, Protected data"; break;
-       case 0x04: str="Unacknowledged GTP, LLC, and RLC, Protected data"; break;
-       case 0x05: str="Unacknowledged GTP, LLC, and RLC, Unprotected data"; break;
-       case 0x07: str="Reserved"; break;
-       default: str="Unacknowledged GTP and LLC; Acknowledged RLC, Protected data";
-    }
-
-    proto_tree_add_text(tree,
-       tvb, curr_offset, 1,
-       "Reliability class: (%u) %s",oct&7,str);
+    proto_tree_add_item(tree, hf_gsm_a_qos_delay_cls, tvb, curr_offset, 1, FALSE);
+    proto_tree_add_item(tree, hf_gsm_a_qos_qos_reliability_cls, tvb, curr_offset, 1, FALSE);
 
     curr_offset+= 1;      
     curr_len-= 1;
@@ -19053,6 +19048,15 @@ proto_register_gsm_a(void)
                FT_UINT8,BASE_DEC,  VALS(ES_IND_vals), 0x10,          
                        "ES IND", HFILL }
        },
+       { &hf_gsm_a_qos_delay_cls, 
+     { "Delay class", "gsm_a.qos.delay_cls",
+               FT_UINT8, BASE_DEC, VALS(gsm_a_qos_delay_cls_vals), 0x38, 
+               "Quality of Service Delay Class", HFILL }},
+       { &hf_gsm_a_qos_qos_reliability_cls, 
+     { "Reliability class", "gsm_a.qos.delay_cls",
+               FT_UINT8, BASE_DEC, VALS(gsm_a_qos_delay_cls_vals), 0x07, 
+               "Reliability class", HFILL }},
+
     { &hf_gsm_a_qos_traffic_cls,
       { "Traffic class", "gsm_a.qos.traffic_cls",
         FT_UINT8, BASE_DEC, VALS(gsm_a_qos_traffic_cls_vals), 0xe0,
index 1dcc07e229d546957624be9b08799b0fd68cd871..589630675582680e18a4552c27b5156d3aed0721 100644 (file)
@@ -934,11 +934,11 @@ static const value_string qos_delay_type[] = {
 
 static const value_string qos_reliability_type[] = {
        { 0x00, "Subscribed reliability class (in MS to network direction)" },
-       { 0x01, "Ack GTP/LLC/RLC, Protected data" },
-       { 0x02, "Unack GTP, Ack LLC/RLC, Protected data" },
-       { 0x03, "Unack GTP/LLC, Ack RLC, Protected data" },
-       { 0x04, "Unack GTP/LLC/RLC, Protected data" },
-       { 0x05, "Unack GTP/LLC/RLC, Unprotected data" },
+       { 0x01, "Acknowledged GTP, LLC, and RLC; Protected data" },
+       { 0x02, "Unacknowledged GTP, Ack LLC/RLC, Protected data" },
+       { 0x03, "Unacknowledged GTP/LLC, Ack RLC, Protected data" },
+       { 0x04, "Unacknowledged GTP/LLC/RLC, Protected data" },
+       { 0x05, "Unacknowledged GTP/LLC/RLC, Unprotected data" },
        { 0x07, "Reserved" },
        { 0, NULL }
 };
@@ -5032,6 +5032,18 @@ decode_gtp_mbms_prot_conf_opt(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
  * UMTS:       3GPP TS 29.060 version 7.8.0 Release 7, chapter 7.7.59
  * MBMS Session Duration
  */
+/* Used for Diameter */
+static int dissect_gtp_mbms_ses_dur(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
+
+       int offset = 0;
+
+       proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_days, tvb, offset, 1, FALSE);
+       proto_tree_add_item(tree, hf_gtp_mbms_ses_dur_s, tvb, offset, 3, FALSE);
+
+       return 3;
+
+}
+
 static int
 decode_gtp_mbms_ses_dur(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
@@ -5355,6 +5367,19 @@ decode_gtp_mbms_ses_id_rep_no(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
  * UMTS:       3GPP TS 29.060 version 7.8.0 Release 7
  * MBMS Time To Data Transfer
  */
+/* Used for Diameter */
+static int dissect_gtp_mbms_time_to_data_tr(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
+
+       int offset = 0;
+       guint8 time_2_dta_tr;
+
+       time_2_dta_tr = tvb_get_guint8(tvb,offset) + 1;
+       proto_tree_add_uint(tree, hf_gtp_time_2_dta_tr, tvb, offset, 1, time_2_dta_tr);
+
+       return 3;
+
+}
+
 static int
 decode_gtp_mbms_time_to_data_tr(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) {
 
@@ -6397,5 +6422,11 @@ proto_reg_handoff_gtp(void)
        data_handle = find_dissector("data");
        gtpcdr_handle = find_dissector("gtpcdr");
        bssap_pdu_type_table = find_dissector_table("bssap.pdu_type");
+       /* AVP Code: 904 MBMS-Session-Duration */
+       dissector_add("diameter.3gpp", 904, new_create_dissector_handle(dissect_gtp_mbms_ses_dur, proto_gtp));
+       /* AVP Code: 911 MBMS-Time-To-Data-Transfer */
+       dissector_add("diameter.3gpp", 911, new_create_dissector_handle(dissect_gtp_mbms_time_to_data_tr, proto_gtp));
+
+       
 
 }