diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-02-29 20:38:39 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-02-29 20:38:39 +0000 |
commit | 872c2094c48230c9b53de8c5506de43db5062a34 (patch) | |
tree | 491ea8b43c6475397fe9b31f4659c0a48b5b5e01 /epan/dissectors/packet-csn1.c | |
parent | 380f3f54a7e805c0c7e5bad38cd298973c106070 (diff) |
From Mike Morrin:
The attached patches add the uses
proto_tree_add_split_bits_ret_val()
proto_tree_add_split_bits_crumb()
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6885
svn path=/trunk/; revision=41249
Diffstat (limited to 'epan/dissectors/packet-csn1.c')
-rw-r--r-- | epan/dissectors/packet-csn1.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/epan/dissectors/packet-csn1.c b/epan/dissectors/packet-csn1.c index 87209e8117..f9a3b549a1 100644 --- a/epan/dissectors/packet-csn1.c +++ b/epan/dissectors/packet-csn1.c @@ -371,6 +371,55 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t break; } + case CSN_SPLIT_BITS: + { + guint8 no_of_value_bits = (guint8) pDescr->i; + guint64 value; + + proto_tree_add_split_bits_ret_val(tree, *pDescr->serialize.hf_ptr, tvb, bit_offset, pDescr->descr.crumb_spec, &value); + if (no_of_value_bits <= 8) + { + pui8 = pui8DATA(data, pDescr->offset); + *pui8 = (guint8)value; + } + else if (no_of_value_bits <= 16) + { + pui16 = pui16DATA(data, pDescr->offset); + *pui16 = (guint16)value; + } + else if (no_of_value_bits <= 32) + { + pui32 = pui32DATA(data, pDescr->offset); + *pui32 = (guint32)value; + } + else + { + return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_GENERAL, pDescr); + } + + pDescr++; + break; + } + + case CSN_SPLIT_BITS_CRUMB: + { + if (remaining_bits_len >= pDescr->descr.crumb_spec[pDescr->i].crumb_bit_length) + { + proto_tree_add_split_bits_crumb(tree, *pDescr->serialize.hf_ptr, tvb, bit_offset, + pDescr->descr.crumb_spec, pDescr->i); + + remaining_bits_len -= pDescr->descr.crumb_spec[pDescr->i].crumb_bit_length; + bit_offset += pDescr->descr.crumb_spec[pDescr->i].crumb_bit_length; + } + else + { + return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr); + } + + pDescr++; + break; + } + case CSN_UINT_ARRAY: { guint8 no_of_bits = (guint8) pDescr->i; |