diff options
author | Anders Broman <anders.broman@ericsson.com> | 2006-04-19 18:59:29 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2006-04-19 18:59:29 +0000 |
commit | a70b907c4acc004b7aaa3833b19e5f2207da84f0 (patch) | |
tree | 5a847f0b36e8dcbc3d1334aa81f3c1dbdd0b010c /epan | |
parent | 7fcc6f767bc374df3ef58157e7f13783dc764910 (diff) |
Handle 64bits signed/unsigned integers and get rid of some extra LF:s.
svn path=/trunk/; revision=17911
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-giop.c | 47 | ||||
-rw-r--r-- | epan/dissectors/packet-giop.h | 5 | ||||
-rw-r--r-- | epan/libethereal.def | 2 |
3 files changed, 49 insertions, 5 deletions
diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c index 8e6cbc2cad..3ac01c9055 100644 --- a/epan/dissectors/packet-giop.c +++ b/epan/dissectors/packet-giop.c @@ -2277,6 +2277,30 @@ gint32 get_CDR_long(tvbuff_t *tvb, int *offset, gboolean stream_is_big_endian, i return val; } +/* Copy a 8 octet sequence from the tvbuff + * which represents a signed long long value, and convert + * it to an signed long long vaule, 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 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 += 4; + return val; +} + /* * Decode an Object type, and display it on the tree. */ @@ -2567,6 +2591,29 @@ guint32 get_CDR_ulong(tvbuff_t *tvb, int *offset, gboolean stream_is_big_endian, return val; } +/* Copy a 8 octet sequence from the tvbuff + * which represents an unsigned long long value, and convert + * it to an unsigned long long vaule, 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 4, to indicate the 4 octets which + * have been processed. + */ + +guint64 get_CDR_ulong_long(tvbuff_t *tvb, int *offset, gboolean stream_is_big_endian, int boundary) { + + guint64 val; + + /* unsigned long 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 2 octet sequence from the tvbuff * which represents an unsigned short value, and convert diff --git a/epan/dissectors/packet-giop.h b/epan/dissectors/packet-giop.h index 52a2f0b4e2..6c672baf03 100644 --- a/epan/dissectors/packet-giop.h +++ b/epan/dissectors/packet-giop.h @@ -333,10 +333,8 @@ extern gdouble get_CDR_long_double(tvbuff_t *tvb, int *offset, * have been processed. */ -#ifdef G_HAVE_GINT64 extern gint64 get_CDR_long_long(tvbuff_t *tvb, int *offset, gboolean stream_is_big_endian, int boundary); -#endif /* * Decode an Object type, and display it on the tree. @@ -435,11 +433,8 @@ extern guint32 get_CDR_ulong(tvbuff_t *tvb, int *offset, * have been processed. */ -#ifdef G_HAVE_GINT64 extern guint64 get_CDR_ulong_long(tvbuff_t *tvb, int *offset, gboolean stream_is_big_endian, int boundary); -#endif - /* Copy a 2 octet sequence from the tvbuff * which represents an unsigned short value, and convert diff --git a/epan/libethereal.def b/epan/libethereal.def index f5bc6a38b9..5bbb619b43 100644 --- a/epan/libethereal.def +++ b/epan/libethereal.def @@ -316,6 +316,7 @@ get_CDR_fixed get_CDR_float get_CDR_interface get_CDR_long +get_CDR_long_long get_CDR_object get_CDR_octet get_CDR_octet_seq @@ -323,6 +324,7 @@ get_CDR_short get_CDR_string get_CDR_typeCode get_CDR_ulong +get_CDR_ulong_long get_CDR_ushort get_CDR_wchar get_CDR_wstring |