ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: [Ethereal-dev] Patches for GIOP Dissection

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

Date: Sun, 17 Aug 2003 14:56:38 +0200 (MEST)
I would like to suggest a couple of changes for GIOP-Dissection:
The patches below provide support for dissection of 64-Bit Values "long
long" and "unsigned long long" in GIOP protocols.
I hope, I didn't make a complete mess with diff (Windows-User:-) - If you
need complete files, just send me an e-mail.

I tested some of the changes with Windows 2000 and "unsigned long long", so
both loading the
plugins and disssection should work fine. I didn't test little endian
support in GIOP nor "long long".

If there are platforms which do not support G_HAVE_GINT64 then all my
changes need to be encapsulated with #ifdef G_HAVE_GINT64! Is there still such a
platform supported?

BTW: I've tested the recent modification regarding
giop_register_user_module: explicit dissection now works fine for the Windows platform.
Though for automatic generation of explicit dissectors from IDL with
idl2eth, idl2eth resp. the scripts need to be modified as they do not support
explicit dissection.

Kind regards,

Jens Nissen ~ Frodo

Changes in the Directory plugins:

Index: plugin_api_list.c
===================================================================
RCS file: /cvsroot/ethereal/plugins/plugin_api_list.c,v
retrieving revision 1.5
diff -r1.5 plugin_api_list.c
4c4
<  * $Id: plugin_api_list.c,v 1.5 2003/08/16 00:38:13 guy Exp $
---
>  * $Id: plugin_api_list.c,v 1.4 2003/08/06 18:16:21 guy Exp $
349c349
< void new_register_dissector(const char *, new_dissector_t, int); 
---
> void new_register_dissector(const char *, new_dissector_t, int);
352a353,357
> 
> guint64 tvb_get_letoh64 (tvbuff_t *, gint);
> guint64 tvb_get_ntoh64 (tvbuff_t *, gint);
> guint64 get_CDR_ulong_long (tvbuff_t *, int *, gboolean, int );
> gint64 get_CDR_long_long (tvbuff_t *, int *, gboolean, int );
Index: Xepan_plugins.c
===================================================================
RCS file: /cvsroot/ethereal/plugins/Xepan_plugins.c,v
retrieving revision 1.4
diff -r1.4 Xepan_plugins.c
216a217,220
> patable.p_tvb_get_letoh64 = tvb_get_letoh64;
> patable.p_tvb_get_ntoh64 = tvb_get_ntoh64;
> patable.p_get_CDR_ulong_long = get_CDR_ulong_long;
> patable.p_get_CDR_long_long = get_CDR_long_long;
Index: Xplugin_api.c
===================================================================
RCS file: /cvsroot/ethereal/plugins/Xplugin_api.c,v
retrieving revision 1.4
diff -r1.4 Xplugin_api.c
216a217,220
> p_tvb_get_letoh64 = pat->p_tvb_get_letoh64;
> p_tvb_get_ntoh64 = pat->p_tvb_get_ntoh64;
> p_get_CDR_ulong_long = pat->p_get_CDR_ulong_long;
> p_get_CDR_long_long = pat->p_get_CDR_long_long;
Index: Xplugin_api.h
===================================================================
RCS file: /cvsroot/ethereal/plugins/Xplugin_api.h,v
retrieving revision 1.4
diff -r1.4 Xplugin_api.h
216a217,220
> #define tvb_get_letoh64 (*p_tvb_get_letoh64)
> #define tvb_get_ntoh64 (*p_tvb_get_ntoh64)
> #define get_CDR_ulong_long (*p_get_CDR_ulong_long)
> #define get_CDR_long_long (*p_get_CDR_long_long)
Index: Xplugin_api_decls.h
===================================================================
RCS file: /cvsroot/ethereal/plugins/Xplugin_api_decls.h,v
retrieving revision 1.4
diff -r1.4 Xplugin_api_decls.h
216a217,220
> addr_tvb_get_letoh64 p_tvb_get_letoh64;
> addr_tvb_get_ntoh64 p_tvb_get_ntoh64;
> addr_get_CDR_ulong_long p_get_CDR_ulong_long;
> addr_get_CDR_long_long p_get_CDR_long_long;
Index: Xplugin_table.h
===================================================================
RCS file: /cvsroot/ethereal/plugins/Xplugin_table.h,v
retrieving revision 1.4
diff -r1.4 Xplugin_table.h
216a217,220
> typedef guint64 (*addr_tvb_get_letoh64) (tvbuff_t *, gint);
> typedef guint64 (*addr_tvb_get_ntoh64) (tvbuff_t *, gint);
> typedef guint64 (*addr_get_CDR_ulong_long) (tvbuff_t *, int *, gboolean,
int);
> typedef gint64 (*addr_get_CDR_long_long) (tvbuff_t *, int *, gboolean,
int);



And another set of changes in the root directory:
Index: packet-giop.c
===================================================================
RCS file: /cvsroot/ethereal/packet-giop.c,v
retrieving revision 1.72
diff -r1.72 packet-giop.c
2570a2571,2578
> /* Copy a 8 octet sequence from the tvbuff
>  * which represents an unsigned long long value, and convert
>  * it to an unsigned long long value, taking into account byte order.
>  * offset is first incremented so that it falls on a proper alignment
>  * boundary for unsigned long long values.
>  * offset is then incremented by 8, to indicate the 8 octets which
>  * have been processed.
>  */
2571a2580,2617
> guint64 get_CDR_ulong_long(tvbuff_t *tvb, int *offset, gboolean
stream_is_big_endian, int boundary) {
> 
>   guint64 val;
> 
>   /* unsigned long values must be aligned on a 8 byte boundary */
>   while( ( (*offset + boundary) % 8) != 0)
> 	  ++(*offset);
> 
>   val = (stream_is_big_endian) ? tvb_get_ntoh64 (tvb, *offset) :
>                                  tvb_get_letoh64 (tvb, *offset);
> 
>   *offset += 8;
>   return val;
> }
> 
> /* Copy a 8 octet sequence from the tvbuff
>  * which represents a long long value, and convert
>  * it to a long long value, taking into account byte order.
>  * offset is first incremented so that it falls on a proper alignment
>  * boundary for long long values.
>  * offset is then incremented by 8, to indicate the 8 octets which
>  * have been processed.
>  */
> 
> gint64 get_CDR_long_long(tvbuff_t *tvb, int *offset, gboolean
stream_is_big_endian, int boundary) {
> 
>   gint64 val;
> 
>   /* unsigned long values must be aligned on a 8 byte boundary */
>   while( ( (*offset + boundary) % 8) != 0)
> 	  ++(*offset);
> 
>   val = (stream_is_big_endian) ? tvb_get_ntoh64 (tvb, *offset) :
>                                  tvb_get_letoh64 (tvb, *offset);
> 
>   *offset += 8;
>   return val;
> }
Index: packet-giop.h
===================================================================
RCS file: /cvsroot/ethereal/packet-giop.h,v
retrieving revision 1.10
diff -r1.10 packet-giop.h
336d335
< #ifdef G_HAVE_GINT64
339d337
< #endif
438d435
< #ifdef G_HAVE_GINT64
441d437
< #endif



And finally a set of changes in the epan directory:
Index: pint.h
===================================================================
RCS file: /cvsroot/ethereal/epan/pint.h,v
retrieving revision 1.8
diff -r1.8 pint.h
49a50,58
> #define pntoh64(p)  ((guint64)*((const guint8 *)(p)+0)<<56|  \
> 		     (guint64)*((const guint8 *)(p)+1)<<48|  \
>                      (guint64)*((const guint8 *)(p)+2)<<40|  \
>                      (guint64)*((const guint8 *)(p)+3)<<32|  \
> 		     (guint64)*((const guint8 *)(p)+4)<<24|  \
>                      (guint64)*((const guint8 *)(p)+5)<<16|  \
>                      (guint64)*((const guint8 *)(p)+6)<<8|   \
>                      (guint64)*((const guint8 *)(p)+7)<<0)
> 
63a73,81
> 
> #define pletoh64(p) ((guint64)*((const guint8 *)(p)+7)<<56|  \
>                      (guint64)*((const guint8 *)(p)+6)<<48|  \
>                      (guint64)*((const guint8 *)(p)+5)<<40|  \
>                      (guint64)*((const guint8 *)(p)+4)<<32|  \
>                      (guint64)*((const guint8 *)(p)+3)<<24|  \
>                      (guint64)*((const guint8 *)(p)+2)<<16|  \
>                      (guint64)*((const guint8 *)(p)+1)<<8|   \
>                      (guint64)*((const guint8 *)(p)+0)<<0)
Index: tvbuff.c
===================================================================
RCS file: /cvsroot/ethereal/epan/tvbuff.c,v
retrieving revision 1.48
diff -r1.48 tvbuff.c
1095a1096,1104
> guint64
> tvb_get_ntoh64(tvbuff_t *tvb, gint offset)
> {
> 	guint8* ptr;
> 
> 	ptr = ensure_contiguous(tvb, offset, sizeof(guint64));
> 	return pntoh64(ptr);
> }
> 
1323a1333,1341
> }
> 
> guint64
> tvb_get_letoh64(tvbuff_t *tvb, gint offset)
> {
> 	guint8* ptr;
> 
> 	ptr = ensure_contiguous(tvb, offset, sizeof(guint64));
> 	return pletoh64(ptr);
Index: tvbuff.h
===================================================================
RCS file: /cvsroot/ethereal/epan/tvbuff.h,v
retrieving revision 1.33
diff -r1.33 tvbuff.h
236a237
> extern guint64 tvb_get_ntoh64(tvbuff_t*, gint offset);
242a244
> extern guint64 tvb_get_letoh64(tvbuff_t*, gint offset);


-- 
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--------------------------------------------------
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualit�tssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post