Ethereal-dev: [Ethereal-dev] LLC-XID and BSSGP patch

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Rene Pilz <rene.pilz@xxxxxx>
Date: Tue, 11 Oct 2005 18:16:03 +0200
Hi

It seems that I have forgotten to attach the last LLC XID patch (reaability patch). Between while I did another one
which fixes the dissection of the MS Radio Capabilities.

Please take a lot at it. If it's ok, then please check it in.

Regards

Rene

-- 
Dipl-Ing (FH) MSc. C.E René Pilz
ftw. Telekommunications Research Center Vienna http://www.ftw.at
Tech Gate Vienna, Donaucitystraße 1, A-1220 Wien
Mobile: +43 664 8269871 Office: +43 1 5052830-13  Fax: +43 1 5052830-99

Index: epan/dissectors/packet-gprs-llc.c
===================================================================
--- epan/dissectors/packet-gprs-llc.c	(revision 16153)
+++ epan/dissectors/packet-gprs-llc.c	(working copy)
@@ -890,7 +890,7 @@
 			m_bits = ctrl_fld_fb & 0x0F;
 
 			info_len = crc_start - offset;
-			
+
 			switch (m_bits)
 			{
 			case U_DM:
@@ -1054,10 +1054,24 @@
 
 						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, 
 							1, byte1);
Index: epan/dissectors/packet-bssgp.c
===================================================================
--- epan/dissectors/packet-bssgp.c	(revision 16153)
+++ epan/dissectors/packet-bssgp.c	(working copy)
@@ -572,7 +572,8 @@
   
   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,8 +589,10 @@
 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));
+  guint16 value;
+  if (( mask & 0xff ) == 0 ) value = tvb_get_guint8 ( tvb , get_start_octet(bo)) << 8;
+  else value = tvb_get_ntohs(tvb, get_start_octet(bo));
   char *label = get_bit_field_label16(value, mask);
   guint8 end_i;
   int i;
@@ -2116,11 +2119,7 @@
   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 +2141,11 @@
 	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 +2169,11 @@
       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 +2199,12 @@
 			     "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 +2226,11 @@
 	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 +2254,11 @@
       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;