From Rene Pilz:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 12 Oct 2005 05:34:36 +0000 (05:34 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 12 Oct 2005 05:34:36 +0000 (05:34 +0000)
- LLC XID patch (reaability patch).
- Dissection of the MS Radio Capabilities.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16199 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-bssgp.c
epan/dissectors/packet-gprs-llc.c

index 4eb401eb94156bad40bb6c008441176128f0e6a1..1688d397feb0951b23a738fd4d21d3a9788cddb6 100644 (file)
@@ -572,7 +572,8 @@ tvb_get_bits8(tvbuff_t *tvb, guint64 bo, guint8 num_bits) {
   
   shift_value = get_byte_offset(bo);
   mask = make_mask(num_bits, shift_value);
-  data = tvb_get_ntohs(tvb, get_start_octet(bo));
+  if (( mask & 0xff ) == 0 ) data = tvb_get_guint8(tvb, get_start_octet(bo)) << 8;
+  else data = tvb_get_ntohs(tvb, get_start_octet(bo));
   return (data & mask) >> (16 - shift_value - num_bits);
 }
 
@@ -588,12 +589,15 @@ static proto_item *
 bit_proto_tree_add_bit_field8(proto_tree *tree, tvbuff_t *tvb,
                              guint64 bo, guint8 bl) {
   /* XXX: Use varargs */
-  guint16 value = tvb_get_ntohs(tvb, get_start_octet(bo));
   guint16 mask = make_mask(bl, get_byte_offset(bo));
-  char *label = get_bit_field_label16(value, mask);
+  guint16 value;
   guint8 end_i;
   int i;
   proto_item *pi;
+  char *label;
+  if (( mask & 0xff ) == 0 ) value = tvb_get_guint8 ( tvb , get_start_octet(bo)) << 8;
+  else value = tvb_get_ntohs(tvb, get_start_octet(bo));
+  label = get_bit_field_label16(value, mask);
 
   DISSECTOR_ASSERT(bl < 9);
   
@@ -2116,11 +2120,7 @@ decode_msrac_access_capabilities(proto_tree *tree, tvbuff_t *tvb,
   value = tvb_get_bits8(tvb, bo, bl);
   if (value == 1) {
     bo += bl;
-    bl = 1;
-    if (!struct_bits_exist(start_bo, struct_length, bo, bl)) return;
     ti = bit_proto_tree_add_text(tree, tvb, bo, bl, "Multislot capability"); 
-    /* Temporary length */
-    bo += bl;
     tf = proto_item_add_subtree(ti, ett_bssgp_msrac_multislot_capability);
 
     /* HSCSD Multislot Class */
@@ -2142,6 +2142,11 @@ decode_msrac_access_capabilities(proto_tree *tree, tvbuff_t *tvb,
        proto_item_append_text(pi, ": Reserved");
       }
     }
+    else
+    {
+      pi = bit_proto_tree_add_bit_field8(tf, tvb, bo-1, bl);
+      proto_item_append_text(pi, "HSCSD Multislot Class - Bits are not available" );
+    }
     
     /* GPRS Multislot Class, GPRS Extended Dynamic Allocation Capability */
     bl = 1;
@@ -2165,6 +2170,11 @@ decode_msrac_access_capabilities(proto_tree *tree, tvbuff_t *tvb,
       proto_item_append_text(pi, "GPRS Extended Dynamic Allocation Capability: Extended Dynamic Allocation for GPRS is%s implemented",
                             value == 0 ? " not" : "");
     }
+    else
+    {
+      pi = bit_proto_tree_add_bit_field8(tf, tvb, bo-1, bl);
+      proto_item_append_text(pi, "GPRS Multislot Class: Multislot Class - Bits are not available" );
+    }
 
     /* SMS Value, SM Value */
     bl = 1;
@@ -2190,6 +2200,12 @@ decode_msrac_access_capabilities(proto_tree *tree, tvbuff_t *tvb,
                             "SM_VALUE: %u/4 timeslot (~%u microseconds)", 
                             value + 1, (value + 1) * 144);
     }
+    else
+    {
+      pi = bit_proto_tree_add_bit_field8(tf, tvb, bo-1, bl);
+      proto_item_append_text(pi, "SMS Value, SM Value - Bits are not available" );
+    }
+
     /* Additions in release 99 */
 
     /* ECSD Multislot Class */
@@ -2211,6 +2227,11 @@ decode_msrac_access_capabilities(proto_tree *tree, tvbuff_t *tvb,
        proto_item_append_text(pi, ": Reserved");
       }
     }
+    else
+    {
+      pi = bit_proto_tree_add_bit_field8(tf, tvb, bo-1, bl);
+      proto_item_append_text(pi, "ECSD Multislot Class - Bits are not available" );
+    }
 
     /* EGPRS Multislot Class, EGPRS Extended Dynamic Allocation Capability */
     bl = 1;
@@ -2234,6 +2255,11 @@ decode_msrac_access_capabilities(proto_tree *tree, tvbuff_t *tvb,
       proto_item_append_text(pi, "EGPRS Extended Dynamic Allocation Capability: Extended Dynamic Allocation for EGPRS is%s implemented",
                             value == 0 ? " not" : "");
     }
+    else
+    {
+      pi = bit_proto_tree_add_bit_field8(tf, tvb, bo-1, bl);
+      proto_item_append_text(pi, "EGPRS Multislot Class: Multislot Class - Bits are not available");
+    }
 
     /* DTM GPRS Multislot Class */
     bl = 1;
index 8c84e4b442ff97ec3a4471e4752c2abbfd7a2aa7..cb11d1a0cc72c26497fea2b739b8333d1b0f05d7 100644 (file)
@@ -890,7 +890,7 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                        m_bits = ctrl_fld_fb & 0x0F;
 
                        info_len = crc_start - offset;
-                       
+
                        switch (m_bits)
                        {
                        case U_DM:
@@ -1054,9 +1054,23 @@ dissect_llcgprs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 
                                                tmp =  byte1 & 0x7C;
                                                tmp = tmp >> 2;
-                                               uinfo_field = proto_tree_add_text(ui_tree, tvb, location, (ending - 1), 
-                                                       "XID Parameter Type: %s", 
-                                                       val_to_str(tmp, xid_param_type_str,"Reserved Type:%X"));
+
+                                               if (( xid_param_len > 0 ) && ( xid_param_len <=4 ))
+                                               {
+                                                       unsigned long value = 0;
+                                                       int i;
+                                                       for (i=1;i<=xid_param_len;i++) {
+                                                               value <<= 8;
+                                                               value |= (unsigned long)tvb_get_guint8(tvb, location+i );
+                                                       }
+                                                       uinfo_field = proto_tree_add_text(ui_tree, tvb, location, (ending - 1), 
+                                                               "XID Parameter Type: %s - Value: %lu", 
+                                                               val_to_str(tmp, xid_param_type_str,"Reserved Type:%X"),value);
+                                               }
+                                               else
+                                                       uinfo_field = proto_tree_add_text(ui_tree, tvb, location, (ending - 1), 
+                                                               "XID Parameter Type: %s", 
+                                                               val_to_str(tmp, xid_param_type_str,"Reserved Type:%X"));
 
                                                uinfo_tree = proto_item_add_subtree(uinfo_field, ett_ui);
                                                proto_tree_add_uint(uinfo_tree, hf_llcgprs_xid_xl, tvb, location,