# include "config.h"
#endif
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-
#include <glib.h>
#include <epan/packet.h>
#include "packet-csn1.h"
#define pui32DATA(_pv, _offset) ((guint32*) pvDATA(_pv, _offset))
/* used to tag existence of next element in variable length lists */
-#define STANDARD_TAG 1
+#define STANDARD_TAG 1
#define REVERSED_TAG 0
-const unsigned char ixBitsTab[] = {0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5};
+static const unsigned char ixBitsTab[] = {0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5};
static guint8 Tag = STANDARD_TAG;
/* Returns no_of_bits (up to 8) masked with 0x2B */
-guint8 tvb_get_masked_bits8(tvbuff_t *tvb, gint bit_offset, const gint no_of_bits)
+static guint8
+tvb_get_masked_bits8(tvbuff_t *tvb, gint bit_offset, const gint no_of_bits)
{
static const guint8 maskBits[] = {0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF};
gint byte_offset = bit_offset >> 3; /* divide by 8 */
* set initial/start values in help data structure used for packing/unpacking operation
* ================================================================================================
*/
-void csnStreamInit(csnStream_t* ar, gint bit_offset, gint remaining_bits_len)
+void
+csnStreamInit(csnStream_t* ar, gint bit_offset, gint remaining_bits_len)
{
ar->remaining_bits_len = remaining_bits_len;
ar->bit_offset = bit_offset;
"MESSAGE_TOO_LONG"
};
-gint16 ProcessError(proto_tree *tree, tvbuff_t *tvb, gint bit_offset, unsigned char* sz, gint16 err, const CSN_DESCR* pDescr)
+static gint16
+ProcessError(proto_tree *tree, tvbuff_t *tvb, gint bit_offset, unsigned char* sz, gint16 err, const CSN_DESCR* pDescr)
{
gint16 i = MIN(-err, ((gint16) ElementsOf(ErrCodes)-1));
proto_item *ti;
}
}
-
+
return err;
}
* ================================================================================================
*/
-static gboolean existNextElement(tvbuff_t *tvb, gint bit_offset, guint8 Tag_v)
+static gboolean
+existNextElement(tvbuff_t *tvb, gint bit_offset, guint8 Tag_v)
{
guint8 res = tvb_get_bits8(tvb, bit_offset, 1);
- if (Tag_v == STANDARD_TAG)
+ if (Tag_v == STANDARD_TAG)
{
return (res > 0);
}
}
-gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, tvbuff_t *tvb, void* data, int ett_csn1)
+gint16
+csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, tvbuff_t *tvb, void* data, int ett_csn1)
{
gint remaining_bits_len = ar->remaining_bits_len;
gint bit_offset = ar->bit_offset;
{
return 0;
}
-
+
do
{
switch (pDescr->type)
pui8 = pui8DATA(data, pDescr->offset);
pDescr++;
- *pui8 = tvb_get_bits8(tvb, bit_offset, 1);
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s %s",
- decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
+ *pui8 = tvb_get_bits8(tvb, bit_offset, 1);
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s %s",
+ decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
pDescr->sz);
-
+
/* end add the bit value to protocol tree */
}
guint8 ui8 = tvb_get_bits8(tvb, bit_offset, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8;
-
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s: %d",
- decode_bits_in_field(bit_offset, no_of_bits, *pui8),
+
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s: %d",
+ decode_bits_in_field(bit_offset, no_of_bits, *pui8),
pDescr->sz,
*pui8);
}
pui16 = pui16DATA(data, pDescr->offset);
*pui16 = ui16;
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s: %d",
- decode_bits_in_field(bit_offset, no_of_bits, *pui16),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s: %d",
+ decode_bits_in_field(bit_offset, no_of_bits, *pui16),
pDescr->sz,
*pui16);
}
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32;
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s: %d",
- decode_bits_in_field(bit_offset, no_of_bits, *pui32),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s: %d",
+ decode_bits_in_field(bit_offset, no_of_bits, *pui32),
pDescr->sz,
*pui32);
}
guint8 ui8 = tvb_get_bits8(tvb, bit_offset, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8 + (guint8)pDescr->descr.value;
-
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, ui8),
+
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, ui8),
pDescr->sz);
-
+
}
else if (no_of_bits <= 16)
{
guint16 ui16 = tvb_get_bits16(tvb, bit_offset, no_of_bits, FALSE);
pui16 = pui16DATA(data, pDescr->offset);
*pui16 = ui16 + (guint16)pDescr->descr.value;
-
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, ui16),
+
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, ui16),
pDescr->sz);
}
else if (no_of_bits <= 32)
guint32 ui32 = tvb_get_bits32(tvb, bit_offset, no_of_bits, FALSE);
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32 + (guint16)pDescr->descr.value;
-
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, ui32),
+
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, ui32),
pDescr->sz);
}
else
case CSN_UINT_LH:
{
guint8 no_of_bits = (guint8) pDescr->i;
-
+
if (remaining_bits_len >= no_of_bits)
{
remaining_bits_len -= no_of_bits;
guint8 ui8 = tvb_get_masked_bits8(tvb, bit_offset, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8;
-
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
+
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
pDescr->sz);
}
else
{ /* nCount specified by a reference to field holding value i.e. M_VAR_UINT_ARRAY(...) */
nCount = *pui16DATA(data, nCount);
}
-
+
if (remaining_bits_len >= no_of_bits)
{
remaining_bits_len -= (no_of_bits*nCount);
do
{
*pui8++ = tvb_get_bits8(tvb, bit_offset, no_of_bits);
-
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s[%d]",
- decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
+
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s[%d]",
+ decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
pDescr->sz,
i++);
bit_offset += no_of_bits;
pui8 = pui8DATA(data, pDescr->offset);
if (pDescr->type == CSN_VARIABLE_TARRAY)
{ /* Count specified in field */
- nCount = *pui8DATA(data, pDescr->i);
+ nCount = *pui8DATA(data, pDescr->i);
}
else if (pDescr->type == CSN_VARIABLE_TARRAY_OFFSET)
{ /* Count specified in field */
}
while (nCount > 0)
- { /* resulting array of length 0 is possible
+ { /* resulting array of length 0 is possible
* but no bits shall be read from bitstream
*/
proto_item *ti;
if (no_of_bits > 0)
{
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits32(tvb, bit_offset, no_of_bits, FALSE)),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits32(tvb, bit_offset, no_of_bits, FALSE)),
pDescr->sz);
remaining_bits_len -= no_of_bits;
DISSECTOR_ASSERT(remaining_bits_len >= 0);
ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s", pDescr->sz);
test_tree = proto_item_add_subtree(ti, ett_csn1);
-
+
csnStreamInit(&arT, bit_offset, remaining_bits_len);
Status = csnStreamDissector(test_tree, &arT, pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
descr[1].type = CSN_END;
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = i;
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s Choice: %s",
- decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s Choice: %s",
+ decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
pDescr->sz);
bit_offset += no_of_bits;
remaining_bits_len -= no_of_bits;
-
+
ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s", pDescr->sz);
test_tree = proto_item_add_subtree(ti, ett_csn1);
pChoice++;
i++;
}
-
+
pDescr++;
break;
}
proto_item *ti;
proto_tree *test_tree;
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s %s length",
- decode_bits_in_field(bit_offset, 7, tvb_get_bits8(tvb, bit_offset, 7)),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s %s length",
+ decode_bits_in_field(bit_offset, 7, tvb_get_bits8(tvb, bit_offset, 7)),
pDescr->sz);
bit_offset += 7;
remaining_bits_len -= 7;
-
+
ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s", pDescr->sz);
test_tree = proto_item_add_subtree(ti, ett_csn1);
/* Now get the bits to extract the index */
Bits = ixBitsTab[count];
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (Bits>>3)+1, "%s Union:%s",
- decode_bits_in_field(bit_offset, Bits, tvb_get_bits8(tvb, bit_offset, Bits)),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (Bits>>3)+1, "%s Union:%s",
+ decode_bits_in_field(bit_offset, Bits, tvb_get_bits8(tvb, bit_offset, Bits)),
pDescr->sz);
index = 0;
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = index;
-
+
/* script index to continue on, limited in case we do not have a power of 2 */
- pDescr += (MIN(index + 1, count));
+ pDescr += (MIN(index + 1, count));
switch (pDescr->type)
pui8 = pui8DATA(data, pDescr->offset);
pDescr++;
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s %s",
- decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s %s",
+ decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
pDescr->sz);
*pui8 = 0x00;
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8;
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, *pui8),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, *pui8),
pDescr->sz);
-
+
}
else if (no_of_bits <= 16)
{
pui16 = pui16DATA(data, pDescr->offset);
*pui16 = ui16;
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, *pui16),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, *pui16),
pDescr->sz);
}
else if (no_of_bits <= 32)
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32;
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, *pui32),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, *pui32),
pDescr->sz);
-
+
}
else
{
guint8 ui8 = tvb_get_bits8(tvb, bit_offset, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8 + (guint8)pDescr->descr.value;
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, ui8),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, ui8),
pDescr->sz);
}
else if (no_of_bits <= 16)
guint16 ui16 = tvb_get_bits16(tvb, bit_offset, no_of_bits, FALSE);
pui16 = pui16DATA(data, pDescr->offset);
*pui16 = ui16 + (guint16)pDescr->descr.value;
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, ui16),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, ui16),
pDescr->sz);
}
else if (no_of_bits <= 32)
guint32 ui32 = tvb_get_bits32(tvb, bit_offset, no_of_bits, FALSE);
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32 + (guint16)pDescr->descr.value;
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, ui32),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, ui32),
pDescr->sz);
}
else
guint8 ui8 = tvb_get_masked_bits8(tvb, bit_offset, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8;
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, *pui8),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, *pui8),
pDescr->sz);
}
else
if (no_of_bits <= 8)
{
pui8 = pui8DATA(data, pDescr->offset);
-
+
while (nCount > 0)
{
*pui8 = tvb_get_bits8(tvb, bit_offset, no_of_bits);
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s[%d]",
- decode_bits_in_field(bit_offset, no_of_bits, *pui8),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s[%d]",
+ decode_bits_in_field(bit_offset, no_of_bits, *pui8),
pDescr->sz,
i++);
pui8++;
else if (no_of_bits <= 16)
{
pui16 = pui16DATA(data, pDescr->offset);
-
+
while (nCount > 0)
{
*pui16 = tvb_get_bits16(tvb, bit_offset, no_of_bits, FALSE);
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s[%d]",
- decode_bits_in_field(bit_offset, no_of_bits, *pui16),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s[%d]",
+ decode_bits_in_field(bit_offset, no_of_bits, *pui16),
pDescr->sz,
i++);
bit_offset += no_of_bits;
gint i = 0;
pui8 = pui8DATA(data, pDescr->offset);
-
+
if (CSN_VARIABLE_TARRAY == pDescr->type)
{ /* Count specified in field */
nCount = *pui8DATA(data, pDescr->i);
nCount = *pui8DATA(data, pDescr->i);
nCount--; /* Offset 1 */
}
-
+
while (nCount--) /* Changed to handle length = 0. */
{
proto_item *ti;
proto_tree *test_tree;
-
+
ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s[%d]",pDescr->sz, i++);
test_tree = proto_item_add_subtree(ti, ett_csn1);
if (no_of_bits > 0)
{ /* a non empty bitmap */
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
pDescr->sz);
remaining_bits_len -= no_of_bits;
if (remaining_bits_len < 0)
break;
}
-
+
default:
{ /* descriptions of union elements other than above are illegal */
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_IN_SCRIPT, pDescr);
ar->bit_offset = bit_offset;
return remaining_bits_len;
}
-
+
break;
}
/* this if-statement represents the M_NEXT_EXIST_OR_NULL description element */
if ((pDescr->descr.ptr != NULL) && (remaining_bits_len == 0))
{ /* no more bits to decode is fine here - end of message detected and allowed */
-
+
/* Skip i entries + this entry */
pDescr += pDescr->i + 1;
-
+
/* pDescr now must be pointing to a CSN_END entry, if not this is an error */
if ( pDescr->type != CSN_END )
{ /* Substract one more bit from remaining_bits_len to make the "not enough bits" error to be triggered */
remaining_bits_len--;
}
-
+
/* Set the data member to "not exist" */
*pui8 = 0;
break;
}
-
+
/* the "regular" M_NEXT_EXIST description element */
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s Next exist: %s",
- decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s Next exist: %s",
+ decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
pDescr->sz);
fExist = 0x00;
/* this if-statement represents the M_NEXT_EXIST_OR_NULL_LH description element */
if ((pDescr->descr.ptr != NULL) && (remaining_bits_len == 0))
{ /* no more bits to decode is fine here - end of message detected and allowed */
-
+
/* skip 'i' entries + this entry */
pDescr += pDescr->i + 1;
{ /* substract one more bit from remaining_bits_len to make the "not enough bits" error to be triggered */
remaining_bits_len--;
}
-
+
/* set the data member to "not exist" */
*pui8 = 0;
break;
}
/* the "regular" M_NEXT_EXIST_LH description element */
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s Next exist: %s",
- decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s Next exist: %s",
+ decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
pDescr->sz);
fExist = tvb_get_masked_bits8(tvb, bit_offset, 1);
case CSN_VARIABLE_BITMAP_1:
{ /* Bitmap from here and to the end of message */
-
+
*pui8DATA(data, (gint16)pDescr->descr.value) = (guint8) remaining_bits_len; /* length of bitmap == remaining bits */
- /*no break -
+ /*no break -
* with a length set we have a regular variable length bitmap so we continue */
}
if (no_of_bits > 0)
{
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s",
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s",
decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)));
remaining_bits_len -= no_of_bits;
guint8* pui8 = pui8DATA(data, pDescr->offset);
gint16 nB1 = no_of_bits & 0x07;/* no_of_bits Mod 8 */
- if (nB1 > 0)
+ if (nB1 > 0)
{ /* take care of the first byte - it will be right aligned */
*pui8++ = tvb_get_bits8(tvb, bit_offset, nB1);
no_of_bits -= nB1;
{ /* Bitmap from here and to the end of message */
*pui8DATA(data, (gint16)pDescr->descr.value) = (guint8) remaining_bits_len; /* length of bitmap == remaining bits */
-
- /* no break -
+
+ /* no break -
* with a length set we have a regular left aligned variable length bitmap so we continue
*/
}
if (no_of_bits > 0)
{ /* a non empty bitmap */
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
pDescr->sz);
remaining_bits_len -= no_of_bits;
while (count > 0)
{
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s %s",
- decode_bits_in_field(bit_offset, 8, tvb_get_bits8(tvb, bit_offset, 8)),
- pDescr->sz);
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s %s",
+ decode_bits_in_field(bit_offset, 8, tvb_get_bits8(tvb, bit_offset, 8)),
+ pDescr->sz);
*pui8++ = tvb_get_bits8(tvb, bit_offset, 8);
bit_offset += 8;
count--;
}
case CSN_RECURSIVE_ARRAY:
- { /* Recursive way to specify an array: <list> ::= {1 <number: bit (4)> <list> | 0}
+ { /* Recursive way to specify an array: <list> ::= {1 <number: bit (4)> <list> | 0}
* or more generally: <list> ::= { <tag> <element> <list> | <EndTag> }
* where <element> ::= bit(value)
* <tag> ::= 0 | 1
while (existNextElement(tvb, bit_offset, Tag))
{ /* tag control shows existence of next list elements */
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s Exist:%s",
- decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s Exist:%s",
+ decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
pDescr->sz);
bit_offset++;
remaining_bits_len--;
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
}
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
- pDescr->sz);
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
+ pDescr->sz);
bit_offset += no_of_bits;
}
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s Exist:%s",
- decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s Exist:%s",
+ decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
pDescr->sz);
/* existNextElement() returned FALSE, 1 bit consumed */
while (existNextElement(tvb, bit_offset, Tag))
{ /* tag control shows existence of next list elements */
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s Exist:%s",
- decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s Exist:%s",
+ decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
pDescr->sz);
/* existNextElement() returned TRUE, 1 bit consumed */
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
}
- }
+ }
/* Store the counted number of elements of the array */
*pui8DATA(data, (gint16)(gint32)pDescr->i) = ElementCount;
break;
}
- case CSN_RECURSIVE_TARRAY_2:
+ case CSN_RECURSIVE_TARRAY_2:
{ /* Recursive way to specify an array of type: <list> ::= <type> { 0 <type> } ** 1 ; */
Tag = REVERSED_TAG;
- /* NO break -
+ /* NO break -
* handling is exactly the same as for CSN_RECURSIVE_TARRAY_1 so we continue
*/
}
- case CSN_RECURSIVE_TARRAY_1:
+ case CSN_RECURSIVE_TARRAY_1:
{ /* Recursive way to specify an array of type: <lists> ::= <type> { 1 <type> } ** 0 ;
* M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)
* {t, offsetof(_STRUCT, _ElementCountField), (void*)CSNDESCR_##_MEMBER_TYPE, offsetof(_STRUCT, _MEMBER), #_MEMBER, (StreamSerializeFcn_t)sizeof(_MEMBER_TYPE)}
ti = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s",pDescr->sz);
test_tree = proto_item_add_subtree(ti, ett_csn1);
-
+
csnStreamInit(&arT, bit_offset, remaining_bits_len);
Status = csnStreamDissector(test_tree, &arT, pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
}
/* control of next element's tag */
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s Exist:%s",
- decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s Exist:%s",
+ decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
pDescr->sz);
EndOfList = !(existNextElement(tvb, bit_offset, Tag));
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector FIXED value does not match", -1, pDescr);
}
- item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
- decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
- pDescr->sz);
+ item = proto_tree_add_text(tree, tvb, bit_offset>>3, (no_of_bits>>3)+1, "%s %s",
+ decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
+ pDescr->sz);
remaining_bits_len -= no_of_bits;
bit_offset += no_of_bits;