Ethereal-dev: [Ethereal-dev] giop minor addition

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

From: Frank Singleton <frank.singleton@xxxxxxxxxxxx>
Date: Mon, 13 Nov 2000 12:49:43 -0600
Hi, 

Added get_CDR_short to giop.

Is this diff format ok ?

Cheers / Frank..



<snip>


--- packet-giop.c.orig	Mon Nov 13 12:39:08 2000
+++ packet-giop.c	Mon Nov 13 12:41:59 2000
@@ -345,6 +345,35 @@
   return val; 
 }
 
+
+/* Copy a 2 octet sequence from the tvbuff 
+ * which represents a signed short value, and convert
+ * it to a signed short value, taking into account byte order.
+ * offset is first incremented so that it falls on a proper alignment
+ * boundary for unsigned short values.
+ * offset is then incremented by 2, to indicate the 2 octets which
+ * have been processed.
+ */
+
+gint16
+get_CDR_short(tvbuff_t *tvb, int *offset)
+{
+  gint16 val;
+
+  /* short values must be aligned on a 2 byte boundary */
+
+  while( ( (*offset + GIOP_HEADER_SIZE) % 2) != 0)
+	  ++(*offset);
+
+  val = (stream_is_big_endian) ? tvb_get_ntohs (tvb, *offset) :
+                                 tvb_get_letohs (tvb, *offset);
+
+  *offset += 2; 
+  return val; 
+}
+
+
+
 /* Copy a sequence of octets from the tvbuff.
  * Caller of this function must remember to free the 
  * array pointed to by seq.



<snip>

-- 
EUS/SV/Z Frank Singleton      ASO Americas BSS
Office : +1 972 583 3251      ECN 800 33251  
Pager  : +1 800 651 1184      Email : eusfrsi@xxxxxxxxxxxxxxx 
Amateur Radio: VK3FCS/KM5WS   Email : frank.singleton@xxxxxxxxxxxx

Hardware: HP Omnibook 4150 running Redhat Linux 6.2 (2.2.16 kernel).