Make CSN.1 dissectors more filterable.

The intent here is to remove proto_tree_add_text from packet-csn1.c, but the macros setup means A LOT more hf fields needs to be created.

Many of those new hf fields were created with a perl script

Bug: 11504
Change-Id: If12c7677185f18a7f684fd3746397be92b56b36d
Reviewed-on: https://code.wireshark.org/review/10391
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Michael Mann 2015-09-05 09:55:03 -04:00
parent 4ec8a06cae
commit 8626bb4cbb
4 changed files with 5351 additions and 1049 deletions

View File

@ -29,6 +29,18 @@
#include <epan/to_str.h>
#include "packet-csn1.h"
void proto_register_csn1(void);
int hf_null_data = -1;
static expert_field ei_csn1_more_bits_to_unpack = EI_INIT;
static expert_field ei_csn1_general = EI_INIT;
static expert_field ei_csn1_not_implemented = EI_INIT;
static expert_field ei_csn1_union_index = EI_INIT;
static expert_field ei_csn1_script_error = EI_INIT;
static expert_field ei_csn1_more32bits = EI_INIT;
static expert_field ei_csn1_fixed_not_matched = EI_INIT;
#define pvDATA(_pv, _offset) ((void*) ((unsigned char*)_pv + _offset))
#define pui8DATA(_pv, _offset) ((guint8*) pvDATA(_pv, _offset))
#define pui16DATA(_pv, _offset) ((guint16*) pvDATA(_pv, _offset))
@ -41,6 +53,7 @@
static const unsigned char ixBitsTab[] = {0, 1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5};
static gint proto_csn1 = -1;
/* Returns no_of_bits (up to 8) masked with 0x2B */
static guint8
@ -73,38 +86,18 @@ tvb_get_masked_bits8(tvbuff_t *tvb, gint bit_offset, const gint no_of_bits)
* ================================================================================================
*/
void
csnStreamInit(csnStream_t* ar, gint bit_offset, gint remaining_bits_len)
csnStreamInit(csnStream_t* ar, gint bit_offset, gint remaining_bits_len, packet_info* pinfo)
{
ar->remaining_bits_len = remaining_bits_len;
ar->bit_offset = bit_offset;
ar->pinfo = pinfo;
}
static const char* ErrCodes[] =
{
"General 0",
"General -1",
"DATA_NOT VALID",
"IN SCRIPT",
"INVALID UNION INDEX",
"NEED_MORE BITS TO UNPACK",
"ILLEGAL BIT VALUE",
"Internal",
"STREAM_NOT_SUPPORTED",
"MESSAGE_TOO_LONG"
};
static gint16
ProcessError(proto_tree *tree, tvbuff_t *tvb, gint bit_offset, const unsigned char* sz, gint16 err, const CSN_DESCR* pDescr)
ProcessError(proto_tree *tree, packet_info* pinfo, tvbuff_t *tvb, gint bit_offset, gint16 err, expert_field* err_field, const CSN_DESCR* pDescr)
{
gint16 i = MIN(-err, ((gint16) ElementsOf(ErrCodes)-1));
if (i >= 0)
{
proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "ERROR %s %s (%s)", sz, ErrCodes[i], pDescr?pDescr->sz:"-");
}
else
{
proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "ERROR %s (%s)", sz, pDescr?pDescr->sz:"-");
}
if (err_field != NULL)
proto_tree_add_expert_format(tree, pinfo, err_field, tvb, bit_offset>>3, 1, "%s (%s)", expert_get_summary(err_field), pDescr?pDescr->sz:"-");
return err;
}
@ -194,20 +187,18 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = tvb_get_bits8(tvb, bit_offset, 1);
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);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, 1, ENC_BIG_ENDIAN);
/* end add the bit value to protocol tree */
}
else if(pDescr->may_be_null)
{
*pui8 = 0;
proto_tree_add_text(tree, tvb, 0, 0, "[NULL data]: %s Not Present", pDescr->sz);
proto_tree_add_none_format(tree, hf_null_data, tvb, 0, 0, "[NULL data]: %s Not Present", proto_registrar_get_name(*(pDescr->hf_ptr)));
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
pDescr++;
@ -234,25 +225,25 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
guint8 ui8 = tvb_get_bits8(tvb, bit_offset, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8;
proto_tree_add_bits_item(tree, *(pDescr->format_p.hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else if (no_of_bits <= 16)
{
guint16 ui16 = tvb_get_bits16(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
pui16 = pui16DATA(data, pDescr->offset);
*pui16 = ui16;
proto_tree_add_bits_item(tree, *(pDescr->format_p.hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else if (no_of_bits <= 32)
{
guint32 ui32 = tvb_get_bits32(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32;
proto_tree_add_bits_item(tree, *(pDescr->format_p.hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_GENERAL, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_GENERAL, &ei_csn1_general, pDescr);
}
remaining_bits_len -= no_of_bits;
bit_offset += no_of_bits;
@ -274,11 +265,11 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = 0;
}
proto_tree_add_text(tree, tvb, 0, 0, "[NULL data]: %s Not Present", pDescr->sz);
proto_tree_add_none_format(tree, hf_null_data, tvb, 0, 0, "[NULL data]: %s Not Present", proto_registrar_get_name(*(pDescr->hf_ptr)));
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
pDescr++;
@ -297,10 +288,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8 + (guint8)pDescr->descr.value;
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s (%d)",
decode_bits_in_field(bit_offset, no_of_bits, ui8),
pDescr->sz, ui8);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else if (no_of_bits <= 16)
{
@ -308,9 +296,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
pui16 = pui16DATA(data, pDescr->offset);
*pui16 = ui16 + (guint16)pDescr->descr.value;
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s (%d)",
decode_bits_in_field(bit_offset, no_of_bits, ui16),
pDescr->sz, ui16);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else if (no_of_bits <= 32)
{
@ -318,18 +304,16 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32 + (guint16)pDescr->descr.value;
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s (%d)",
decode_bits_in_field(bit_offset, no_of_bits, ui32),
pDescr->sz, ui32);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_GENERAL, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_GENERAL, &ei_csn1_general, pDescr);
}
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
remaining_bits_len -= no_of_bits;
@ -349,17 +333,17 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
guint8 ui8 = tvb_get_masked_bits8(tvb, bit_offset, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8;
proto_tree_add_bits_item(tree, *(pDescr->format_p.hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else
{/* Maybe we should support more than 8 bits ? */
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_GENERAL, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_GENERAL, &ei_csn1_general, pDescr);
}
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
remaining_bits_len -= no_of_bits;
@ -373,7 +357,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
guint8 no_of_value_bits = (guint8) pDescr->i;
guint64 value;
proto_tree_add_split_bits_item_ret_val(tree, *pDescr->format_p.hf_ptr, tvb, bit_offset, pDescr->descr.crumb_spec, &value);
proto_tree_add_split_bits_item_ret_val(tree, *pDescr->hf_ptr, tvb, bit_offset, pDescr->descr.crumb_spec, &value);
if (no_of_value_bits <= 8)
{
pui8 = pui8DATA(data, pDescr->offset);
@ -391,7 +375,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_GENERAL, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_GENERAL, &ei_csn1_general, pDescr);
}
pDescr++;
@ -402,7 +386,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
{
if (remaining_bits_len >= pDescr->descr.crumb_spec[pDescr->i].crumb_bit_length)
{
proto_tree_add_split_bits_crumb(tree, *pDescr->format_p.hf_ptr, tvb, bit_offset,
proto_tree_add_split_bits_crumb(tree, *pDescr->hf_ptr, tvb, bit_offset,
pDescr->descr.crumb_spec, pDescr->i);
remaining_bits_len -= pDescr->descr.crumb_spec[pDescr->i].crumb_bit_length;
@ -410,7 +394,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
pDescr++;
@ -423,7 +407,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
guint16 nCount = (guint16)pDescr->descr.value; /* nCount supplied by value i.e. M_UINT_ARRAY(...) */
int i =0;
if (pDescr->format_p.value != 0)
if (pDescr->value != 0)
{ /* nCount specified by a reference to field holding value i.e. M_VAR_UINT_ARRAY(...) */
nCount = *pui16DATA(data, nCount);
}
@ -436,31 +420,27 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
do
{
*pui8++ = tvb_get_bits8(tvb, bit_offset, no_of_bits);
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>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++);
proto_tree_add_uint_bits_format_value(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, *pui8, " (Count %d)", i++);
remaining_bits_len -= no_of_bits;
bit_offset += no_of_bits;
} while (--nCount > 0);
}
else if (no_of_bits <= 16)
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector NOTIMPLEMENTED", 999, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, 999, &ei_csn1_not_implemented, pDescr);
}
else if (no_of_bits <= 32)
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector NOTIMPLEMENTED", 999, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, 999, &ei_csn1_not_implemented, pDescr);
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_GENERAL, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_GENERAL, &ei_csn1_general, pDescr);
}
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
pDescr++;
break;
@ -473,7 +453,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
gint16 Status;
csnStream_t arT = *ar;
gint16 nCount = pDescr->i;
guint16 nSize = (guint16)(gint32)pDescr->format_p.value;
guint16 nSize = (guint16)(gint32)pDescr->value;
int i =0;
pui8 = pui8DATA(data, pDescr->offset);
@ -496,7 +476,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
test_tree = proto_tree_add_subtree_format(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, "%s[%d]",pDescr->sz, i++);
csnStreamInit(&arT, bit_offset, remaining_bits_len);
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR*)pDescr->descr.ptr, tvb, pui8, ett_csn1);
if (Status >= 0)
{
@ -526,19 +506,15 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
if (no_of_bits <= 32)
{
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s",
decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits32(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN)),
pDescr->sz);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else if (no_of_bits <= 64)
{
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s",
decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits64(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN)),
pDescr->sz);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector NOT IMPLEMENTED", 999, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, 999, &ei_csn1_not_implemented, pDescr);
}
remaining_bits_len -= no_of_bits;
@ -560,7 +536,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
test_tree = proto_tree_add_subtree_format(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, "%s", pDescr->sz);
csnStreamInit(&arT, bit_offset, remaining_bits_len);
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR*)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
if (Status >= 0)
@ -605,9 +581,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
*pui8 = i;
if (pDescr->sz) {
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s Choice: %s (%d)",
decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
pDescr->sz, value);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
if (!pChoice->keep_bits) {
@ -621,7 +595,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
test_tree = tree;
}
csnStreamInit(&arT, bit_offset, remaining_bits_len);
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR*)descr, tvb, data, ett_csn1);
if (Status >= 0)
@ -660,9 +634,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
if (length_len) {
length = tvb_get_bits8(tvb, bit_offset, length_len);
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+length_len-1)>>3)-(bit_offset>>3)+1, "%s %s length: %d",
decode_bits_in_field(bit_offset, length_len, length),
pDescr->sz, length);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, length_len, ENC_BIG_ENDIAN);
bit_offset += length_len;
remaining_bits_len -= length_len;
@ -672,7 +644,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
test_tree = proto_tree_add_subtree(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, pDescr->sz);
}
csnStreamInit(&arT, bit_offset, length > 0 ? length : remaining_bits_len);
csnStreamInit(&arT, bit_offset, length > 0 ? length : remaining_bits_len, ar->pinfo);
Status = serialize(test_tree, &arT, tvb, pvDATA(data, pDescr->offset), ett_csn1);
if (Status >= 0)
@ -707,14 +679,12 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
pDescrNext += count + 1; /* now this is next after the union */
if ((count <= 0) || (count > 16))
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_INVALID_UNION_INDEX, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_INVALID_UNION_INDEX, &ei_csn1_union_index, pDescr);
}
/* Now get the bits to extract the index */
Bits = ixBitsTab[count];
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+Bits-1)>>3)-(bit_offset>>3)+1, "%s Union:%s",
decode_bits_in_field(bit_offset, Bits, tvb_get_bits8(tvb, bit_offset, Bits)),
pDescr->sz);
proto_tree_add_uint_bits_format_value(tree, *(pDescr->hf_ptr), tvb, bit_offset, Bits, tvb_get_bits8(tvb, bit_offset, Bits), " (Union)");
t_index = 0;
while (Bits > 0)
@ -751,9 +721,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
{
pui8 = pui8DATA(data, pDescr->offset);
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);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, 1, ENC_BIG_ENDIAN);
*pui8 = 0x00;
if (tvb_get_bits8(tvb, bit_offset, 1) > 0)
@ -783,7 +751,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
guint8 ui8 = tvb_get_bits8(tvb, bit_offset, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8;
proto_tree_add_bits_item(tree, *(pDescr->format_p.hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else if (no_of_bits <= 16)
@ -791,24 +759,24 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
guint16 ui16 = tvb_get_bits16(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
pui16 = pui16DATA(data, pDescr->offset);
*pui16 = ui16;
proto_tree_add_bits_item(tree, *(pDescr->format_p.hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else if (no_of_bits <= 32)
{
guint32 ui32 = tvb_get_bits32(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32;
proto_tree_add_bits_item(tree, *(pDescr->format_p.hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_GENERAL, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_GENERAL, &ei_csn1_general, pDescr);
}
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_GENERAL, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_GENERAL, &ei_csn1_general, pDescr);
}
remaining_bits_len -= no_of_bits;
@ -824,40 +792,34 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
if (remaining_bits_len >= no_of_bits)
{
if (no_of_bits <= 8)
{
guint8 ui8 = tvb_get_bits8(tvb, bit_offset, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8 + (guint8)pDescr->descr.value;
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s (%d)",
decode_bits_in_field(bit_offset, no_of_bits, ui8),
pDescr->sz, ui8);
}
else if (no_of_bits <= 16)
{
guint16 ui16 = tvb_get_bits16(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
pui16 = pui16DATA(data, pDescr->offset);
*pui16 = ui16 + (guint16)pDescr->descr.value;
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s (%d)",
decode_bits_in_field(bit_offset, no_of_bits, ui16),
pDescr->sz, ui16);
}
else if (no_of_bits <= 32)
{
guint32 ui32 = tvb_get_bits32(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32 + (guint16)pDescr->descr.value;
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s (%d)",
decode_bits_in_field(bit_offset, no_of_bits, ui32),
pDescr->sz, ui32);
{
guint8 ui8 = tvb_get_bits8(tvb, bit_offset, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8 + (guint8)pDescr->descr.value;
proto_tree_add_uint_bits_format_value(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ui8, "%d", ui8);
}
else if (no_of_bits <= 16)
{
guint16 ui16 = tvb_get_bits16(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
pui16 = pui16DATA(data, pDescr->offset);
*pui16 = ui16 + (guint16)pDescr->descr.value;
proto_tree_add_uint_bits_format_value(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ui16, "%d", ui16);
}
else if (no_of_bits <= 32)
{
guint32 ui32 = tvb_get_bits32(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
pui32 = pui32DATA(data, pDescr->offset);
*pui32 = ui32 + (guint16)pDescr->descr.value;
proto_tree_add_uint_bits_format_value(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ui32, "%d", ui32);
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_GENERAL, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_GENERAL, &ei_csn1_general, pDescr);
}
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
remaining_bits_len -= no_of_bits;
@ -877,16 +839,16 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
guint8 ui8 = tvb_get_masked_bits8(tvb, bit_offset, no_of_bits);
pui8 = pui8DATA(data, pDescr->offset);
*pui8 = ui8;
proto_tree_add_bits_item(tree, *(pDescr->format_p.hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else
{ /* Maybe we should support more than 8 bits ? */
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_GENERAL, pDescr);
ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_GENERAL, &ei_csn1_general, pDescr);
}
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
remaining_bits_len -= no_of_bits;
@ -901,7 +863,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
guint16 nCount = (guint16)pDescr->descr.value; /* nCount supplied by value i.e. M_UINT_ARRAY(...) */
gint i = 0;
if (pDescr->format_p.value != 0)
if (pDescr->value != 0)
{ /* nCount specified by a reference to field holding value i.e. M_VAR_UINT_ARRAY(...) */
nCount = *pui16DATA(data, nCount);
}
@ -915,10 +877,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
while (nCount > 0)
{
*pui8 = tvb_get_bits8(tvb, bit_offset, no_of_bits);
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s[%d]",
decode_bits_in_field(bit_offset, no_of_bits, *pui8),
pDescr->sz,
i++);
proto_tree_add_uint_bits_format_value(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, *pui8, " (Count %d)", i++);
pui8++;
remaining_bits_len -= no_of_bits;
bit_offset += no_of_bits;
@ -932,10 +891,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
while (nCount > 0)
{
*pui16 = tvb_get_bits16(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s[%d]",
decode_bits_in_field(bit_offset, no_of_bits, *pui16),
pDescr->sz,
i++);
proto_tree_add_uint_bits_format_value(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, *pui16, " (Count %d)", i++);
remaining_bits_len -= no_of_bits;
bit_offset += no_of_bits;
nCount--;
@ -943,16 +899,16 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
}
else if (no_of_bits <= 32)
{ /* not supported */
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector NOT IMPLEMENTED", 999, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, 999, &ei_csn1_not_implemented, pDescr);
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_GENERAL, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_GENERAL, &ei_csn1_general, pDescr);
}
}
else
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
pDescr++;
@ -966,7 +922,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
gint16 Status;
csnStream_t arT = *ar;
guint16 nCount = (guint16) pDescr->i;
guint16 nSize = (guint16)(guint32)pDescr->format_p.value;
guint16 nSize = (guint16)(guint32)pDescr->value;
gint i = 0;
pui8 = pui8DATA(data, pDescr->offset);
@ -988,7 +944,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
test_tree = proto_tree_add_subtree_format(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, "%s[%d]",pDescr->sz, i++);
csnStreamInit(&arT, bit_offset, remaining_bits_len);
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR *)pDescr->descr.ptr, tvb, pui8, ett_csn1);
if (Status >= 0)
{
@ -1013,15 +969,13 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
if (no_of_bits > 0)
{ /* a non empty bitmap */
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s",
decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
pDescr->sz);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
remaining_bits_len -= no_of_bits;
bit_offset += no_of_bits;
if (remaining_bits_len < 0)
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
}
@ -1040,7 +994,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
test_tree = proto_tree_add_subtree(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, pDescr->sz);
csnStreamInit(&arT, bit_offset, remaining_bits_len);
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR *)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
if (Status >= 0)
{
@ -1059,7 +1013,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
default:
{ /* descriptions of union elements other than above are illegal */
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_IN_SCRIPT, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_IN_SCRIPT, &ei_csn1_script_error, pDescr);
}
}
@ -1074,15 +1028,15 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
pui8 = pui8DATA(data, pDescr->offset);
proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "Exist:%s",pDescr->sz);
if (CSN_EXIST_LH == pDescr->type)
{
fExist = tvb_get_masked_bits8(tvb, bit_offset, 1);
proto_tree_add_uint(tree, *(pDescr->hf_ptr), tvb, bit_offset>>3, 1, fExist);
}
else
{
fExist = tvb_get_bits8(tvb, bit_offset, 1);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, 1, ENC_BIG_ENDIAN);
}
*pui8 = fExist;
@ -1119,9 +1073,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
}
/* the "regular" M_NEXT_EXIST description element */
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);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, 1, ENC_BIG_ENDIAN);
fExist = 0x00;
if (tvb_get_bits8(tvb, bit_offset, 1))
@ -1161,9 +1113,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
}
/* the "regular" M_NEXT_EXIST_LH description element */
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);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, 1, ENC_BIG_ENDIAN);
fExist = tvb_get_masked_bits8(tvb, bit_offset, 1);
@ -1202,12 +1152,11 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
if (no_of_bits > 0)
{
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)));
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, 1, ENC_BIG_ENDIAN);
if (remaining_bits_len < 0)
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
{ /* extract bits */
@ -1258,27 +1207,23 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
{
if (no_of_bits <= 32)
{
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s",
decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN)),
pDescr->sz);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else if (no_of_bits <= 64)
{
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s",
decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits64(tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN)),
pDescr->sz);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
}
else
{
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %u bits",
pDescr->sz, no_of_bits);
proto_tree_add_uint_format_value(tree, *(pDescr->hf_ptr), tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, no_of_bits, "%u bits",
no_of_bits);
}
bit_offset += no_of_bits;
remaining_bits_len -= no_of_bits;
if (remaining_bits_len < 0)
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
}
@ -1305,16 +1250,14 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
{
bits_to_handle -= (bit_offset%8);
}
proto_tree_add_text(padding_tree, tvb, bit_offset>>3, ((bit_offset+bits_to_handle-1)>>3)-(bit_offset>>3)+1, "%s %s",
decode_bits_in_field(bit_offset, bits_to_handle, tvb_get_bits(tvb, bit_offset, bits_to_handle, ENC_BIG_ENDIAN)),
pDescr->sz);
proto_tree_add_bits_item(padding_tree, *(pDescr->hf_ptr), tvb, bit_offset, bits_to_handle, ENC_BIG_ENDIAN);
bit_offset += bits_to_handle;
remaining_bits_len -= bits_to_handle;
}
}
if (remaining_bits_len < 0)
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
/* Padding was successfully extracted or it was empty */
@ -1337,16 +1280,14 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
{
if (remaining_bits_len < 0)
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
pui8 = pui8DATA(data, pDescr->offset);
while (count > 0)
{
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);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, 8, ENC_BIG_ENDIAN);
*pui8++ = tvb_get_bits8(tvb, bit_offset, 8);
bit_offset += 8;
remaining_bits_len -= 8;
@ -1374,9 +1315,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
while (existNextElement(tvb, bit_offset, Tag))
{ /* tag control shows existence of next list elements */
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);
proto_tree_add_bits_item(tree, *(pDescr->hf_exist_ptr), tvb, bit_offset, 1, ENC_BIG_ENDIAN);
bit_offset++;
remaining_bits_len--;
@ -1386,19 +1325,15 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
if (remaining_bits_len < 0)
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s",
decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
pDescr->sz);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
bit_offset += no_of_bits;
remaining_bits_len -= no_of_bits;
}
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);
proto_tree_add_bits_item(tree, *(pDescr->hf_exist_ptr), tvb, bit_offset, 1, ENC_BIG_ENDIAN);
/* existNextElement() returned FALSE, 1 bit consumed */
bit_offset++;
@ -1417,14 +1352,12 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
* 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)}
*/
gint16 nSizeElement = (gint16)(gint32)pDescr->format_p.value;
gint16 nSizeElement = (gint16)(gint32)pDescr->value;
guint8 ElementCount = 0;
while (existNextElement(tvb, bit_offset, Tag))
{ /* tag control shows existence of next list elements */
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);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, 1, ENC_BIG_ENDIAN);
/* existNextElement() returned TRUE, 1 bit consumed */
bit_offset++;
@ -1439,7 +1372,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
test_tree = proto_tree_add_subtree(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, pDescr->sz);
csnStreamInit(&arT, bit_offset, remaining_bits_len);
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR *)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
if (Status >= 0)
@ -1457,7 +1390,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
if (remaining_bits_len < 0)
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
}
@ -1487,7 +1420,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
* 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)}
*/
gint16 nSizeElement = (gint16)(gint32)pDescr->format_p.value;
gint16 nSizeElement = (gint16)(gint32)pDescr->value;
guint8 ElementCount = 0;
csnStream_t arT = *ar;
gboolean EndOfList = FALSE;
@ -1502,7 +1435,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
test_tree = proto_tree_add_subtree_format(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, "%s[%d]", pDescr->sz, ElementCount-1);
csnStreamInit(&arT, bit_offset, remaining_bits_len);
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR *)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
if (Status >= 0)
@ -1519,13 +1452,12 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
if (remaining_bits_len < 0)
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
/* control of next element's tag */
proto_tree_add_text(tree, tvb, bit_offset>>3, 1, "%s Exist:%s[%d]",
decode_bits_in_field(bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1)),
pDescr->sz, ElementCount);
proto_tree_add_uint_bits_format_value(tree, *(pDescr->hf_ptr), tvb, bit_offset, 1, tvb_get_bits8(tvb, bit_offset, 1), "%s[%d]",
proto_registrar_get_name(*(pDescr->hf_ptr)), ElementCount);
EndOfList = !(existNextElement(tvb, bit_offset, Tag));
bit_offset++;
@ -1559,15 +1491,13 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
}
else
{
return ProcessError(tree, tvb, bit_offset,"no_of_bits > 32", -1, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, -1, &ei_csn1_more32bits, pDescr);
}
if (ui32 != (unsigned)(gint32)pDescr->offset)
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector FIXED value does not match", -1, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, -1, &ei_csn1_fixed_not_matched, pDescr);
}
proto_tree_add_text(tree, tvb, bit_offset>>3, ((bit_offset+no_of_bits-1)>>3)-(bit_offset>>3)+1, "%s %s",
decode_bits_in_field(bit_offset, no_of_bits, tvb_get_bits8(tvb, bit_offset, no_of_bits)),
pDescr->sz);
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, no_of_bits, ENC_BIG_ENDIAN);
remaining_bits_len -= no_of_bits;
bit_offset += no_of_bits;
@ -1589,7 +1519,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
case CSN_TRAP_ERROR:
{
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", pDescr->i, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, -1, pDescr->error, pDescr);
}
case CSN_END:
@ -1609,7 +1539,39 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
} while (remaining_bits_len >= 0);
return ProcessError(tree, tvb, bit_offset,"csnStreamDissector", CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, pDescr);
return ProcessError(tree, ar->pinfo, tvb, bit_offset, CSN_ERROR_NEED_MORE_BITS_TO_UNPACK, &ei_csn1_more_bits_to_unpack, pDescr);
}
void
proto_register_csn1(void)
{
static hf_register_info hf[] = {
{ &hf_null_data,
{ "NULL data", "csn1.null_data",
FT_NONE, BASE_NONE, NULL, 0x00,
NULL, HFILL }
},
};
static ei_register_info ei[] = {
{ &ei_csn1_more_bits_to_unpack, { "csn1.more_bits_to_unpack", PI_MALFORMED, PI_ERROR, "NEED_MORE BITS TO UNPACK", EXPFILL }},
{ &ei_csn1_general, { "csn1.general_error", PI_PROTOCOL, PI_WARN, "General -1", EXPFILL }},
{ &ei_csn1_not_implemented, { "csn1.not_implemented", PI_UNDECODED, PI_WARN, "NOT IMPLEMENTED", EXPFILL }},
{ &ei_csn1_union_index, { "csn1.union_index_invalid", PI_PROTOCOL, PI_WARN, "INVALID UNION INDEX", EXPFILL }},
{ &ei_csn1_script_error, { "csn1.script_error", PI_MALFORMED, PI_ERROR, "ERROR IN SCRIPT", EXPFILL }},
{ &ei_csn1_more32bits, { "csn1.more32bits", PI_PROTOCOL, PI_WARN, "no_of_bits > 32", EXPFILL }},
{ &ei_csn1_fixed_not_matched, { "csn1.fixed_not_matched", PI_PROTOCOL, PI_WARN, "FIXED value does not match", EXPFILL }},
};
expert_module_t* expert_csn1;
proto_csn1 = proto_register_protocol("CSN.1", "CSN1", "csn1");
proto_register_field_array(proto_csn1, hf, array_length(hf));
expert_csn1 = expert_register_protocol(proto_csn1);
expert_register_field_array(expert_csn1, ei, array_length(ei));
proto_set_cant_toggle(proto_csn1);
}
/*

View File

@ -26,6 +26,8 @@
#ifndef _PACKET_CSN1_H_
#define _PACKET_CSN1_H_
#include <epan/expert.h>
/* Error codes */
#define CSN_OK 0
#define CSN_ERROR_GENERAL -1
@ -62,6 +64,7 @@ typedef struct
{
gint remaining_bits_len; /* IN to an csn stream operation */
gint bit_offset; /* IN/OUT to an csn stream operation */
packet_info* pinfo;
} csnStream_t;
typedef gint16 (*StreamSerializeFcn_t)(proto_tree *tree, csnStream_t* ar, tvbuff_t *tvb, void* data, int ett_csn1);
@ -184,12 +187,12 @@ typedef struct
size_t offset;
gboolean may_be_null;
const char* sz;
union
{
void * dummy; /* to eliminate --pedantic compiler warnings */
guint32 value;
int* hf_ptr;
} format_p;
expert_field* error;
guint32 value;
int* hf_ptr;
/* used in M_REC_ARRAY to distinguish between "field" and "field exists",
it's not used on fields that just "exist" */
int* hf_exist_ptr;
void_fn_t aux_fn;
} CSN_DESCR;
@ -201,7 +204,7 @@ typedef struct
CSN_DESCR descr;
} CSN_ChoiceElement_t;
void csnStreamInit(csnStream_t* ar,gint BitOffset,gint BitCount);
void csnStreamInit(csnStream_t* ar, gint BitOffset, gint BitCount, packet_info* pinfo);
/******************************************************************************
* FUNCTION: csnStreamDissector
@ -226,7 +229,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
CSN_DESCR CSNDESCR_##_STRUCT[] = {
#define CSN_DESCR_END(_STRUCT)\
{CSN_END, 0, {0}, 0, FALSE, "", {NULL}, NULL} };
{CSN_END, 0, {0}, 0, FALSE, "", NULL, 0, NULL, NULL, NULL} };
/******************************************************************************
* CSN_ERROR(Par1, Par2, Par3)
@ -236,8 +239,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par2: free text which will appear in the error handler
* Par3: Error code
*****************************************************************************/
#define CSN_ERROR(_STRUCT, _Text, _ERRCODE)\
{CSN_TRAP_ERROR, _ERRCODE, {_Text}, 0, FALSE, _Text, {NULL}, NULL}
#define CSN_ERROR(_STRUCT, _Text, _ERRCODE, _EI_ERROR)\
{CSN_TRAP_ERROR, _ERRCODE, {_Text}, 0, FALSE, _Text, _EI_ERROR, 0, NULL, NULL, NULL}
/******************************************************************************
* M_BIT(Par1, Par2, Par3)
@ -247,7 +250,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par3: pointer to the header field
*****************************************************************************/
#define M_BIT(_STRUCT, _MEMBER, _HF_PTR)\
{CSN_BIT, 0, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(int *)_HF_PTR}, NULL}
{CSN_BIT, 0, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_BIT_OR_NULL(Par1, Par2, Par3)
@ -257,7 +260,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Covers the case {null | 0 | 1}
*****************************************************************************/
#define M_BIT_OR_NULL(_STRUCT, _MEMBER, _HF_PTR)\
{CSN_BIT, 0, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, {(int *) _HF_PTR}, NULL}
{CSN_BIT, 0, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_NEXT_EXIST(Par1, Par2, Par3)
* Indicates whether the next element or a group of elements defined in the
@ -267,8 +270,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par3: number of lines to skip in the CSN_DESCR type specified if the
* element(s) does not exist
*****************************************************************************/
#define M_NEXT_EXIST(_STRUCT, _MEMBER, _NoOfExisting)\
{CSN_NEXT_EXIST, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL}
#define M_NEXT_EXIST(_STRUCT, _MEMBER, _NoOfExisting, _HF_PTR)\
{CSN_NEXT_EXIST, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_NEXT_EXIST_LH(Par1, Par2, Par3)
@ -277,8 +280,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* present in the message, the logical operation XOR with the background
* pattern 0x2B is performed on the read bit before the decision is made.
*****************************************************************************/
#define M_NEXT_EXIST_LH(_STRUCT, _MEMBER, _NoOfExisting)\
{CSN_NEXT_EXIST_LH, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL}
#define M_NEXT_EXIST_LH(_STRUCT, _MEMBER, _NoOfExisting, _HF_PTR)\
{CSN_NEXT_EXIST_LH, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_NEXT_EXIST_OR_NULL(Par1, Par2, Par3)
@ -287,8 +290,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* message.
* Covers the case {null | 0 | 1 < IE >}
*****************************************************************************/
#define M_NEXT_EXIST_OR_NULL(_STRUCT, _MEMBER, _NoOfExisting)\
{CSN_NEXT_EXIST, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, {NULL}, NULL}
#define M_NEXT_EXIST_OR_NULL(_STRUCT, _MEMBER, _NoOfExisting, _HF_PTR)\
{CSN_NEXT_EXIST, _NoOfExisting, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_NEXT_EXIST_OR_NULL_LH(Par1, Par2, Par3)
@ -297,8 +300,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* the message.
* Covers the case {null | L | H < IE >}
*****************************************************************************/
#define M_NEXT_EXIST_OR_NULL_LH(_STRUCT, _MEMBER, _NoOfExisting)\
{CSN_NEXT_EXIST_LH, _NoOfExisting, {(void*)1}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, {NULL}, NULL}
#define M_NEXT_EXIST_OR_NULL_LH(_STRUCT, _MEMBER, _NoOfExisting, _HF_PTR)\
{CSN_NEXT_EXIST_LH, _NoOfExisting, {(void*)1}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_UINT(Par1, Par2, Par3, Par4)
@ -309,7 +312,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par4: pointer to the header field
*****************************************************************************/
#define M_UINT(_STRUCT, _MEMBER, _BITS, _HF_PTR)\
{CSN_UINT, _BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(int *)_HF_PTR}, NULL}
{CSN_UINT, _BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_UINT_SPLIT(Par1, Par2, Par3, Par4)
@ -321,7 +324,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par4: pointer to the header field
*****************************************************************************/
#define M_SPLIT_BITS(_STRUCT, _MEMBER, _SPEC, _BITS, _HF_PTR)\
{CSN_SPLIT_BITS, _BITS, {_SPEC}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(int *) _HF_PTR}, NULL}
{CSN_SPLIT_BITS, _BITS, {_SPEC}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_NULL_SPLIT(Par1, Par2, Par3, Par4)
@ -332,7 +335,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par4: segment number (0 based)
*****************************************************************************/
#define M_BITS_CRUMB(_STRUCT, _MEMBER, _SPEC, _SEG, _HF_PTR)\
{CSN_SPLIT_BITS_CRUMB, _SEG, {_SPEC}, 0, FALSE, #_MEMBER, {(int *) _HF_PTR}, NULL}
{CSN_SPLIT_BITS_CRUMB, _SEG, {_SPEC}, 0, FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_UINT_OR_NULL(Par1, Par2, Par3, Par4)
@ -342,7 +345,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Covers the case {null | 0 | 1 < IE >}
*****************************************************************************/
#define M_UINT_OR_NULL(_STRUCT, _MEMBER, _BITS, _HF_PTR)\
{CSN_UINT, _BITS, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, {(int *) _HF_PTR}, NULL}
{CSN_UINT, _BITS, {0}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_UINT_LH(Par1, Par2, Par3, Par4)
@ -352,7 +355,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* received CSN.1 message
*****************************************************************************/
#define M_UINT_LH(_STRUCT, _MEMBER, _BITS, _HF_PTR)\
{CSN_UINT_LH, _BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(int *) _HF_PTR}, NULL}
{CSN_UINT_LH, _BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_UINT_OFFSET(Par1, Par2, Par3, Par4)
@ -362,8 +365,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par3: number of bits used to code the element (between 1 and 32)
* Par4: value added to the returned integer (offset)
*****************************************************************************/
#define M_UINT_OFFSET(_STRUCT, _MEMBER, _BITS, _OFFSET)\
{CSN_UINT_OFFSET, _BITS, {(void*)_OFFSET}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL}
#define M_UINT_OFFSET(_STRUCT, _MEMBER, _BITS, _OFFSET, _HF_PTR)\
{CSN_UINT_OFFSET, _BITS, {(void*)_OFFSET}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_UINT_ARRAY(Par1, Par2, Par3, Par4)
@ -373,8 +376,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par3: number of bits used to code the each integer element (between 1 and 32)
* Par4: number of elements in the array (fixed integer value)
*****************************************************************************/
#define M_UINT_ARRAY(_STRUCT, _MEMBER, _BITS, _ElementCount)\
{CSN_UINT_ARRAY, _BITS, {(void*)_ElementCount}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL}
#define M_UINT_ARRAY(_STRUCT, _MEMBER, _BITS, _ElementCount, _HF_PTR)\
{CSN_UINT_ARRAY, _BITS, {(void*)_ElementCount}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_VAR_UINT_ARRAY(Par1, Par2, Par3, Par4)
@ -385,8 +388,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par4: number of elements in the array supplied by reference to the
* structure member holding the length value
*****************************************************************************/
#define M_VAR_UINT_ARRAY(_STRUCT, _MEMBER, _BITS, _ElementCountField)\
{CSN_UINT_ARRAY, _BITS, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)1}, NULL}
#define M_VAR_UINT_ARRAY(_STRUCT, _MEMBER, _BITS, _ElementCountField, _HF_PTR)\
{CSN_UINT_ARRAY, _BITS, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 1, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_VAR_ARRAY(Par1, Par2, Par3, Par4)
@ -396,8 +399,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par3: name of the structure member holding the size of the array
* Par4: offset that is added to the Par3 to get the actual size of the array
*****************************************************************************/
#define M_VAR_ARRAY(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\
{CSN_VARIABLE_ARRAY, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL}
#define M_VAR_ARRAY(_STRUCT, _MEMBER, _ElementCountField, _OFFSET, _HF_PTR)\
{CSN_VARIABLE_ARRAY, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_VAR_TARRAY(Par1, Par2, Par3, Par4)
@ -408,14 +411,14 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par4: name of the structure member holding the size of the array
*****************************************************************************/
#define M_VAR_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\
{CSN_VARIABLE_TARRAY, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)sizeof(_MEMBER_TYPE)}, NULL}
{CSN_VARIABLE_TARRAY, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, sizeof(_MEMBER_TYPE), NULL, NULL, NULL}
/******************************************************************************
* M_VAR_TARRAY_OFFSET(Par1, Par2, Par3, Par4)
* Same as M_VAR_TARRAY with offset
*****************************************************************************/
#define M_VAR_TARRAY_OFFSET(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\
{CSN_VARIABLE_TARRAY_OFFSET, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)sizeof(_MEMBER_TYPE)}, NULL}
{CSN_VARIABLE_TARRAY_OFFSET, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, sizeof(_MEMBER_TYPE), NULL, NULL, NULL}
/******************************************************************************
* M_REC_ARRAY(Par1, Par2, Par3, Par4)
@ -432,8 +435,9 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* array will be stored
* Par4: length of each element in bits
*****************************************************************************/
#define M_REC_ARRAY(_STRUCT, _MEMBER, _ElementCountField, _BITS)\
{CSN_RECURSIVE_ARRAY, _BITS, {(const void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL}
/* XXX - need 2 hf support */
#define M_REC_ARRAY(_STRUCT, _MEMBER, _ElementCountField, _BITS, _HF_PTR, _HF_PTR_EXIST)\
{CSN_RECURSIVE_ARRAY, _BITS, {(const void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, _HF_PTR_EXIST, NULL}
/******************************************************************************
* M_VAR_TYPE_ARRAY(Par1, Par2, Par3, Par4)
@ -444,7 +448,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par4: number of elements in the array (fixed integer value)
*****************************************************************************/
#define M_TYPE_ARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCount)\
{CSN_TYPE_ARRAY, _ElementCount, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)sizeof(_MEMBER_TYPE)}, NULL}
{CSN_TYPE_ARRAY, _ElementCount, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, sizeof(_MEMBER_TYPE), NULL, NULL, NULL}
/******************************************************************************
* M_REC_TARRAY(Par1, Par2, Par3, Par4)
@ -455,16 +459,16 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par3: name of the structure
* Par4: will hold the number of element in the array after unpacking
*****************************************************************************/
#define M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\
{CSN_RECURSIVE_TARRAY, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)sizeof(_MEMBER_TYPE)}, NULL}
#define M_REC_TARRAY(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField, _HF_PTR)\
{CSN_RECURSIVE_TARRAY, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, sizeof(_MEMBER_TYPE), _HF_PTR, NULL, NULL}
/******************************************************************************
* M_REC_TARRAY1(Par1, Par2, Par3, Par4)
* Same as M_REC_TARRAY but first element always exist:
* <list> ::= <type> {1 <type>} ** 0 ;
*****************************************************************************/
#define M_REC_TARRAY_1(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\
{CSN_RECURSIVE_TARRAY_1, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)sizeof(_MEMBER_TYPE)}, NULL}
#define M_REC_TARRAY_1(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField, _HF_PTR)\
{CSN_RECURSIVE_TARRAY_1, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, sizeof(_MEMBER_TYPE), _HF_PTR, NULL, NULL}
/******************************************************************************
* M_REC_TARRAY2(Par1, Par2, Par3, Par4)
@ -472,7 +476,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* <lists> ::= <type> { 0 <type> } ** 1 ;
*****************************************************************************/
#define M_REC_TARRAY_2(_STRUCT, _MEMBER, _MEMBER_TYPE, _ElementCountField)\
{CSN_RECURSIVE_TARRAY_2, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {(void *)sizeof(_MEMBER_TYPE)}, NULL}
{CSN_RECURSIVE_TARRAY_2, offsetof(_STRUCT, _ElementCountField), {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, sizeof(_MEMBER_TYPE), NULL, NULL, NULL}
/******************************************************************************
* M_TYPE(Par1, Par2, Par3)
@ -483,7 +487,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par3: type of member
*****************************************************************************/
#define M_TYPE(_STRUCT, _MEMBER, _MEMBER_TYPE)\
{CSN_TYPE, 0, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL}
{CSN_TYPE, 0, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, NULL, NULL, NULL}
/******************************************************************************
* M_TYPE_LABEL(Par1, Par2, Par3, Par4)
@ -495,7 +499,7 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par4: C string for the text
*****************************************************************************/
#define M_TYPE_LABEL(_STRUCT, _MEMBER, _MEMBER_TYPE, _LABEL)\
{CSN_TYPE, 0, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, _LABEL, {NULL}, NULL}
{CSN_TYPE, 0, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, _LABEL, NULL, 0, NULL, NULL, NULL}
/******************************************************************************
* M_UNION(Par1, Par2)
@ -507,15 +511,15 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par1: C structure name
* Par2: number of possible choice in the union
*****************************************************************************/
#define M_UNION(_STRUCT, _COUNT)\
{CSN_UNION, _COUNT, {0}, offsetof(_STRUCT, UnionType), FALSE, "UnionType", {NULL}, NULL}
#define M_UNION(_STRUCT, _COUNT, _HF_PTR)\
{CSN_UNION, _COUNT, {0}, offsetof(_STRUCT, UnionType), FALSE, "UnionType", NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_UNION_LH(Par1, Par2)
* Same as M_UNION but masked with background value 0x2B
*****************************************************************************/
#define M_UNION_LH(_STRUCT, _COUNT)\
{CSN_UNION_LH, _COUNT, {0}, offsetof(_STRUCT, UnionType), FALSE, "UnionType", {NULL}, NULL}
#define M_UNION_LH(_STRUCT, _COUNT, _HF_PTR)\
{CSN_UNION_LH, _COUNT, {0}, offsetof(_STRUCT, UnionType), FALSE, "UnionType", NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_CHOICE(Par1, Par2, Par3, Par4)
@ -543,16 +547,16 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* the variable pointed out by the _MEMBER
* Par4: number of possible choices in the union
*****************************************************************************/
#define M_CHOICE(_STRUCT, _MEMBER, _CHOICE, _ElementCount)\
{CSN_CHOICE, _ElementCount, {(const void*)_CHOICE}, offsetof(_STRUCT, _MEMBER), FALSE, #_CHOICE, {NULL}, NULL}
#define M_CHOICE(_STRUCT, _MEMBER, _CHOICE, _ElementCount, _HF_PTR)\
{CSN_CHOICE, _ElementCount, {(const void*)_CHOICE}, offsetof(_STRUCT, _MEMBER), FALSE, #_CHOICE, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_CHOICE_IL(Par1, Par2, Par3, Par4)
* See M_CHOICE above, but displayed inline (i.e. no specific elements are
* displayed to show there was a choice
*****************************************************************************/
#define M_CHOICE_IL(_STRUCT, _MEMBER, _CHOICE, _ElementCount)\
{CSN_CHOICE, _ElementCount, {(void*)_CHOICE}, offsetof(_STRUCT, _MEMBER), FALSE, NULL, {NULL}, NULL}
#define M_CHOICE_IL(_STRUCT, _MEMBER, _CHOICE, _ElementCount, _HF_PTR)\
{CSN_CHOICE, _ElementCount, {(void*)_CHOICE}, offsetof(_STRUCT, _MEMBER), FALSE, NULL, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_FIXED(Par1, Par2, Par3)
@ -563,8 +567,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par3: the value of the number. If the expected value is not present in
* the message the unpacking procedure is aborted
*****************************************************************************/
#define M_FIXED(_STRUCT, _BITS, _BITVALUE)\
{CSN_FIXED, _BITS, {0}, _BITVALUE, FALSE, #_BITVALUE, {NULL}, NULL}
#define M_FIXED(_STRUCT, _BITS, _BITVALUE, _HF_PTR)\
{CSN_FIXED, _BITS, {0}, _BITVALUE, FALSE, #_BITVALUE, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_FIXED_LABEL(Par1, Par2, Par3, Par4)
@ -575,8 +579,8 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* the message the unpacking procedure is aborted
* Par4: C string for the text
*****************************************************************************/
#define M_FIXED_LABEL(_STRUCT, _BITS, _BITVALUE, _LABEL)\
{CSN_FIXED, _BITS, {0}, _BITVALUE, FALSE, _LABEL, {NULL}, NULL}
#define M_FIXED_LABEL(_STRUCT, _BITS, _BITVALUE, _LABEL, _HF_PTR)\
{CSN_FIXED, _BITS, {0}, _BITVALUE, FALSE, _LABEL, NULL, 0, _HF_PTR, NULL, NULL}
/******************************************************************************
* M_SERIALIZE(Par1, Par2, Par3)
@ -588,11 +592,11 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* data to or from the message is finished by the function the CSNstream gets
* back control over the data stream and continues to work with the message.
*****************************************************************************/
#define M_SERIALIZE(_STRUCT, _MEMBER, _LENGTH_LEN, _SERIALIZEFCN)\
{CSN_SERIALIZE, _LENGTH_LEN, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, (void_fn_t)_SERIALIZEFCN}
#define M_SERIALIZE(_STRUCT, _MEMBER, _LENGTH_LEN, _HF_PTR, _SERIALIZEFCN)\
{CSN_SERIALIZE, _LENGTH_LEN, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, (void_fn_t)_SERIALIZEFCN}
#define M_CALLBACK(_STRUCT, _CSNCALLBACKFCN, _PARAM1, _PARAM2)\
{CSN_CALLBACK, offsetof(_STRUCT, _PARAM1), {0}, offsetof(_STRUCT, _PARAM2), FALSE, "CallBack_"#_CSNCALLBACKFCN, {NULL}, (void_fn_t)_CSNCALLBACKFCN}
{CSN_CALLBACK, offsetof(_STRUCT, _PARAM1), {0}, offsetof(_STRUCT, _PARAM2), FALSE, "CallBack_"#_CSNCALLBACKFCN, NULL, 0, NULL, NULL, (void_fn_t)_CSNCALLBACKFCN}
/******************************************************************************
* M_BITMAP(Par1, Par2, Par3)
@ -602,43 +606,43 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
* Par2: C structure element name
* Par3: length of the bitmap expressed in bits
*****************************************************************************/
#define M_BITMAP(_STRUCT, _MEMBER, _BITS)\
{CSN_BITMAP, _BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL}
#define M_BITMAP(_STRUCT, _MEMBER, _BITS, _HF_PTR)\
{CSN_BITMAP, _BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/* variable length, right aligned bitmap i.e. _ElementCountField = 11 => 00000111 11111111 */
#define M_VAR_BITMAP(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\
{CSN_VARIABLE_BITMAP, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL}
#define M_VAR_BITMAP(_STRUCT, _MEMBER, _ElementCountField, _OFFSET, _HF_PTR)\
{CSN_VARIABLE_BITMAP, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/* variable length, right aligned bitmap filling the rest of message
* - when unpacking the _ElementCountField will be set in runtime
* - when packing _ElementCountField contains the size of bitmap
*/
#define M_VAR_BITMAP_1(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\
{CSN_VARIABLE_BITMAP_1, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL}
{CSN_VARIABLE_BITMAP_1, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, NULL, NULL, NULL}
/* variable length, left aligned bitmap i.e. _ElementCountField = 11 => 11111111 11100000 */
#define M_LEFT_VAR_BMP(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\
{CSN_LEFT_ALIGNED_VAR_BMP, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL}
#define M_LEFT_VAR_BMP(_STRUCT, _MEMBER, _ElementCountField, _OFFSET, _HF_PTR)\
{CSN_LEFT_ALIGNED_VAR_BMP, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, _HF_PTR, NULL, NULL}
/* variable length, left aligned bitmap filling the rest of message
*- when unpacking the _ElementCountField will be set in runtime
* - when packing _ElementCountField contains the size of bitmap
*/
#define M_LEFT_VAR_BMP_1(_STRUCT, _MEMBER, _ElementCountField, _OFFSET)\
{CSN_LEFT_ALIGNED_VAR_BMP_1, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL}
{CSN_LEFT_ALIGNED_VAR_BMP_1, _OFFSET, {(void*)offsetof(_STRUCT, _ElementCountField)}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, NULL, NULL, NULL}
/* todo: dissect padding bits looking for unexpected extensions */
#define M_PADDING_BITS(_STRUCT)\
{CSN_PADDING_BITS, 0, {0}, 0, TRUE, "Padding", {NULL}, NULL}
#define M_PADDING_BITS(_STRUCT, _HF_PTR)\
{CSN_PADDING_BITS, 0, {0}, 0, TRUE, "Padding", NULL, 0, _HF_PTR, NULL, NULL}
#define M_NULL(_STRUCT, _MEMBER, _SKIP_BITS)\
{CSN_NULL, _SKIP_BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, {NULL}, NULL}
{CSN_NULL, _SKIP_BITS, {0}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, NULL, NULL, NULL}
#define M_THIS_EXIST(_STRUCT)\
{CSN_EXIST, 0, {0}, offsetof(_STRUCT, Exist), FALSE, "Exist", {NULL}, NULL}
#define M_THIS_EXIST(_STRUCT, _HF_PTR)\
{CSN_EXIST, 0, {0}, offsetof(_STRUCT, Exist), FALSE, "Exist", NULL, 0, _HF_PTR, NULL, NULL}
#define M_THIS_EXIST_LH(_STRUCT)\
{CSN_EXIST_LH, 0, {0}, offsetof(_STRUCT, Exist), FALSE, "Exist", {NULL}, NULL}
#define M_THIS_EXIST_LH(_STRUCT, _HF_PTR)\
{CSN_EXIST_LH, 0, {0}, offsetof(_STRUCT, Exist), FALSE, "Exist", NULL, 0, _HF_PTR, NULL, NULL}
/* return value 0 if ok else discontionue the unpacking */
typedef gint16 (*CsnCallBackFcn_t)(void* pv ,...);

View File

@ -30,6 +30,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#include "packet-csn1.h"
void proto_register_gmr1_bcch(void);
@ -40,6 +41,7 @@ static int proto_gmr1_bcch = -1;
/* GMR-1 BCCH sub tree */
static gint ett_gmr1_bcch = -1;
static expert_field ei_unknown_segment = EI_INIT;
/* ------------------------------------------------------------------------ */
/* CSN1 fields */
@ -91,10 +93,19 @@ static int hf_seg2a_lainfo_imsi_attach_detach_ind = -1;
static int hf_seg2a_lainfo_ecsc_indication = -1;
static int hf_seg2a_lainfo_si_update_ind = -1;
static int hf_seg2a_class_type = -1;
static int hf_seg2a_segment_type_a = -1;
static int hf_seg2a_segment_type_abis = -1;
/* Segment 2B fields */
static int hf_seg2b_segment_type_b = -1;
/* Segment 2Bbis fields */
static int hf_seg2b_segment_type_bbis = -1;
/* Segment 3A fields - [1] 11.5.2.71 */
static int hf_seg3a_class_type = -1;
static int hf_seg3a_segment_type_a = -1;
static int hf_seg3a_lai_dissector = -1;
static int hf_seg3a_lai_mcc = -1;
static int hf_seg3a_lai_mnc = -1;
static int hf_seg3a_lai_lac = -1;
@ -115,6 +126,33 @@ static int hf_seg3a_miscinfo_sb_reselection_timer = -1;
static int hf_seg3a_spare = -1;
static int hf_seg3b_segment_type_b = -1;
static int hf_seg3b_segment_type_bbis = -1;
static int hf_seg3c_segment_type_c = -1;
static int hf_seg3d_segment_type_d = -1;
static int hf_seg3e_segment_type_e = -1;
static int hf_seg3e_segment_type_ebis = -1;
static int hf_seg3f_segment_type_f = -1;
static int hf_seg3g_segment_type_g = -1;
static int hf_seg3g_segment_type_gbis = -1;
static int hf_seg3h_segment_type_h = -1;
static int hf_seg3i_segment_type_i = -1;
static int hf_seg3j_segment_type_j = -1;
static int hf_seg3j_segment_type_jbis = -1;
static int hf_seg3k_segment_type_kbis = -1;
static int hf_seg4a_class_type = -1;
static int hf_seg4a_segment_type_a = -1;
static int hf_seg4b_segment_type_b = -1;
static int hf_seg4c_segment_type_c = -1;
static int hf_seg4d_segment_type_d = -1;
static int hf_seg4e_segment_type_e = -1;
static int hf_seg4f_segment_type_f = -1;
static int hf_seg4g_segment_type_g = -1;
static int hf_seg4h_segment_type_h = -1;
static int hf_seg4i_segment_type_i = -1;
static int hf_seg4j_segment_type_j = -1;
static int hf_seg4k_segment_type_k = -1;
/* Segment 3B fields */
/* Segment 3Bbis fields */
/* Segment 3C fields */
@ -144,6 +182,7 @@ static int hf_seg3a_spare = -1;
/* Segment 4K fields */
/* System Information fields [1] 10.1.31 & 10.1.32 */
static int hf_si1_segment_choice = -1;
static int hf_si_protocol_version = -1;
static int hf_si_block_type = -1;
static int hf_si_spare = -1;
@ -567,8 +606,8 @@ CSN_DESCR_END (Seg2A_LAInfo_t)
static const
CSN_DESCR_BEGIN(Segment2A_t)
M_FIXED_LABEL(Segment2A_t, 2, 0x2, "= Class type: 2"),
M_FIXED_LABEL(Segment2A_t, 4, 0x0, "= Segment type: A"),
M_FIXED_LABEL(Segment2A_t, 2, 0x2, "Class type: 2", &hf_seg2a_class_type),
M_FIXED_LABEL(Segment2A_t, 4, 0x0, "Segment type: A", &hf_seg2a_segment_type_a),
M_UINT (Segment2A_t, Class_4_version, 3, &hf_seg2a_class_4_version),
M_TYPE_LABEL (Segment2A_t, SyncInfo, Seg2A_SyncInfo_t, "Synchronization Info Class 2"),
M_TYPE_LABEL (Segment2A_t, SelectionCriterion, Seg2A_SelectionCriterion_t, "Selection Criterion"),
@ -578,8 +617,8 @@ CSN_DESCR_END (Segment2A_t)
static const
CSN_DESCR_BEGIN(Segment2Abis_t)
M_FIXED_LABEL(Segment2Abis_t, 2, 0x2, "= Class type: 2"),
M_FIXED_LABEL(Segment2Abis_t, 4, 0x0, "= Segment type: Abis"),
M_FIXED_LABEL(Segment2Abis_t, 2, 0x2, "Class type: 2", &hf_seg2a_class_type),
M_FIXED_LABEL(Segment2Abis_t, 4, 0x0, "Segment type: Abis", &hf_seg2a_segment_type_abis),
M_UINT (Segment2Abis_t, Class_4_version, 3, &hf_seg2a_class_4_version),
M_TYPE_LABEL (Segment2Abis_t, SyncInfo, Seg2A_SyncInfo_t, "Synchronization Info Class 2"),
M_TYPE_LABEL (Segment2Abis_t, SelectionCriterion, Seg2A_SelectionCriterion_t, "Selection Criterion"),
@ -589,14 +628,14 @@ CSN_DESCR_END (Segment2Abis_t)
static const
CSN_DESCR_BEGIN(Segment2B_t)
M_FIXED_LABEL(Segment2B_t, 2, 0x2, "= Class type: 2"),
M_FIXED_LABEL(Segment2B_t, 4, 0x1, "= Segment type: B"),
M_FIXED_LABEL(Segment2B_t, 2, 0x2, "Class type: 2", &hf_seg2a_class_type),
M_FIXED_LABEL(Segment2B_t, 4, 0x1, "Segment type: B", &hf_seg2b_segment_type_b),
CSN_DESCR_END (Segment2B_t)
static const
CSN_DESCR_BEGIN(Segment2Bbis_t)
M_FIXED_LABEL(Segment2Bbis_t, 2, 0x2, "= Class type: 2"),
M_FIXED_LABEL(Segment2Bbis_t, 4, 0x1, "= Segment type: B bis"),
M_FIXED_LABEL(Segment2Bbis_t, 2, 0x2, "Class type: 2", &hf_seg2a_class_type),
M_FIXED_LABEL(Segment2Bbis_t, 4, 0x1, "Segment type: B bis", &hf_seg2b_segment_type_bbis),
CSN_DESCR_END (Segment2Bbis_t)
/* Segment 3A - [1] 11.5.2.71 */
@ -663,9 +702,9 @@ CSN_DESCR_END (Seg3A_MiscInfo_t)
static const
CSN_DESCR_BEGIN(Segment3A_t)
M_FIXED_LABEL(Segment3A_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3A_t, 4, 0x0, "= Segment type: A"),
M_SERIALIZE (Segment3A_t, LAI, 0, Seg3A_LAI_Dissector),
M_FIXED_LABEL(Segment3A_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3A_t, 4, 0x0, "Segment type: A", &hf_seg3a_segment_type_a),
M_SERIALIZE (Segment3A_t, LAI, 0, &hf_seg3a_lai_dissector, Seg3A_LAI_Dissector),
M_TYPE_LABEL (Segment3A_t, System, Seg3A_System_t, "System"),
M_TYPE_LABEL (Segment3A_t, SatellitePosition, Seg3A_SatellitePosition_t, "Satellite Position"),
M_TYPE_LABEL (Segment3A_t, BeamPosition, Seg3A_BeamPosition_t, "Beam Center Position"),
@ -675,168 +714,168 @@ CSN_DESCR_END (Segment3A_t)
static const
CSN_DESCR_BEGIN(Segment3B_t)
M_FIXED_LABEL(Segment3B_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3B_t, 4, 0x1, "= Segment type: B"),
M_FIXED_LABEL(Segment3B_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3B_t, 4, 0x1, "Segment type: B", &hf_seg3b_segment_type_b),
CSN_DESCR_END (Segment3B_t)
static const
CSN_DESCR_BEGIN(Segment3Bbis_t)
M_FIXED_LABEL(Segment3Bbis_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3Bbis_t, 4, 0x1, "= Segment type: B bis"),
M_FIXED_LABEL(Segment3Bbis_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3Bbis_t, 4, 0x1, "Segment type: B bis", &hf_seg3b_segment_type_bbis),
CSN_DESCR_END (Segment3Bbis_t)
static const
CSN_DESCR_BEGIN(Segment3C_t)
M_FIXED_LABEL(Segment3C_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3C_t, 4, 0x2, "= Segment type: C"),
M_FIXED_LABEL(Segment3C_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3C_t, 4, 0x2, "Segment type: C", &hf_seg3c_segment_type_c),
CSN_DESCR_END (Segment3C_t)
static const
CSN_DESCR_BEGIN(Segment3D_t)
M_FIXED_LABEL(Segment3D_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3D_t, 4, 0x3, "= Segment type: D"),
M_FIXED_LABEL(Segment3D_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3D_t, 4, 0x3, "Segment type: D", &hf_seg3d_segment_type_d),
CSN_DESCR_END (Segment3D_t)
static const
CSN_DESCR_BEGIN(Segment3E_t)
M_FIXED_LABEL(Segment3E_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3E_t, 4, 0x4, "= Segment type: E"),
M_FIXED_LABEL(Segment3E_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3E_t, 4, 0x4, "Segment type: E", &hf_seg3e_segment_type_e),
CSN_DESCR_END (Segment3E_t)
static const
CSN_DESCR_BEGIN(Segment3Ebis_t)
M_FIXED_LABEL(Segment3Ebis_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3Ebis_t, 4, 0x4, "= Segment type: E bis"),
M_FIXED_LABEL(Segment3Ebis_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3Ebis_t, 4, 0x4, "Segment type: E bis", &hf_seg3e_segment_type_ebis),
CSN_DESCR_END (Segment3Ebis_t)
static const
CSN_DESCR_BEGIN(Segment3F_t)
M_FIXED_LABEL(Segment3F_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3F_t, 4, 0x5, "= Segment type: F"),
M_FIXED_LABEL(Segment3F_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3F_t, 4, 0x5, "Segment type: F", &hf_seg3f_segment_type_f),
CSN_DESCR_END (Segment3F_t)
static const
CSN_DESCR_BEGIN(Segment3G_t)
M_FIXED_LABEL(Segment3G_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3G_t, 4, 0x6, "= Segment type: G"),
M_FIXED_LABEL(Segment3G_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3G_t, 4, 0x6, "Segment type: G", &hf_seg3g_segment_type_g),
CSN_DESCR_END (Segment3G_t)
static const
CSN_DESCR_BEGIN(Segment3Gbis_t)
M_FIXED_LABEL(Segment3Gbis_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3Gbis_t, 4, 0x6, "= Segment type: G bis"),
M_FIXED_LABEL(Segment3Gbis_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3Gbis_t, 4, 0x6, "Segment type: G bis", &hf_seg3g_segment_type_gbis),
CSN_DESCR_END (Segment3Gbis_t)
static const
CSN_DESCR_BEGIN(Segment3H_t)
M_FIXED_LABEL(Segment3H_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3H_t, 4, 0x7, "= Segment type: H"),
M_FIXED_LABEL(Segment3H_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3H_t, 4, 0x7, "Segment type: H", &hf_seg3h_segment_type_h),
CSN_DESCR_END (Segment3H_t)
static const
CSN_DESCR_BEGIN(Segment3I_t)
M_FIXED_LABEL(Segment3I_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3I_t, 4, 0x9, "= Segment type: I"),
M_FIXED_LABEL(Segment3I_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3I_t, 4, 0x9, "Segment type: I", &hf_seg3i_segment_type_i),
CSN_DESCR_END (Segment3I_t)
static const
CSN_DESCR_BEGIN(Segment3J_t)
M_FIXED_LABEL(Segment3J_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3J_t, 4, 0xa, "= Segment type: J"),
M_FIXED_LABEL(Segment3J_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3J_t, 4, 0xa, "Segment type: J", &hf_seg3j_segment_type_j),
CSN_DESCR_END (Segment3J_t)
static const
CSN_DESCR_BEGIN(Segment3Jbis_t)
M_FIXED_LABEL(Segment3Jbis_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3Jbis_t, 4, 0xa, "= Segment type: J bis"),
M_FIXED_LABEL(Segment3Jbis_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3Jbis_t, 4, 0xa, "Segment type: J bis", &hf_seg3j_segment_type_jbis),
CSN_DESCR_END (Segment3Jbis_t)
static const
CSN_DESCR_BEGIN(Segment3Kbis_t)
M_FIXED_LABEL(Segment3Kbis_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3Kbis_t, 4, 0xb, "= Segment type: K bis"),
M_FIXED_LABEL(Segment3Kbis_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3Kbis_t, 4, 0xb, "Segment type: K bis", &hf_seg3k_segment_type_kbis),
CSN_DESCR_END (Segment3Kbis_t)
#if 0
static const
CSN_DESCR_BEGIN(Segment3L_t)
M_FIXED_LABEL(Segment3L_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3L_t, 4, 0xc, "= Segment type: L"),
M_FIXED_LABEL(Segment3L_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3L_t, 4, 0xc, "Segment type: L", &hf_seg3l_segment_type_l),
CSN_DESCR_END (Segment3L_t)
#endif
#if 0
static const
CSN_DESCR_BEGIN(Segment3M_t)
M_FIXED_LABEL(Segment3M_t, 1, 0x0, "= Class type: 3"),
M_FIXED_LABEL(Segment3M_t, 4, 0xd, "= Segment type: M"),
M_FIXED_LABEL(Segment3M_t, 1, 0x0, "Class type: 3", &hf_seg3a_class_type),
M_FIXED_LABEL(Segment3M_t, 4, 0xd, "Segment type: M", &hf_seg3m_segment_type_m),
CSN_DESCR_END (Segment3M_t)
#endif
static const
CSN_DESCR_BEGIN(Segment4A_t)
M_FIXED_LABEL(Segment4A_t, 3, 0x6, "= Class type: 4"),
M_FIXED_LABEL(Segment4A_t, 4, 0x0, "= Segment type: A"),
M_FIXED_LABEL(Segment4A_t, 3, 0x6, "Class type: 4", &hf_seg4a_class_type),
M_FIXED_LABEL(Segment4A_t, 4, 0x0, "Segment type: A", &hf_seg4a_segment_type_a),
CSN_DESCR_END (Segment4A_t)
static const
CSN_DESCR_BEGIN(Segment4B_t)
M_FIXED_LABEL(Segment4B_t, 3, 0x6, "= Class type: 4"),
M_FIXED_LABEL(Segment4B_t, 4, 0x1, "= Segment type: B"),
M_FIXED_LABEL(Segment4B_t, 3, 0x6, "Class type: 4", &hf_seg4a_class_type),
M_FIXED_LABEL(Segment4B_t, 4, 0x1, "Segment type: B", &hf_seg4b_segment_type_b),
CSN_DESCR_END (Segment4B_t)
static const
CSN_DESCR_BEGIN(Segment4C_t)
M_FIXED_LABEL(Segment4C_t, 3, 0x6, "= Class type: 4"),
M_FIXED_LABEL(Segment4C_t, 4, 0x2, "= Segment type: C"),
M_FIXED_LABEL(Segment4C_t, 3, 0x6, "Class type: 4", &hf_seg4a_class_type),
M_FIXED_LABEL(Segment4C_t, 4, 0x2, "Segment type: C", &hf_seg4c_segment_type_c),
CSN_DESCR_END (Segment4C_t)
static const
CSN_DESCR_BEGIN(Segment4D_t)
M_FIXED_LABEL(Segment4D_t, 3, 0x6, "= Class type: 4"),
M_FIXED_LABEL(Segment4D_t, 4, 0x3, "= Segment type: D"),
M_FIXED_LABEL(Segment4D_t, 3, 0x6, "Class type: 4", &hf_seg4a_class_type),
M_FIXED_LABEL(Segment4D_t, 4, 0x3, "Segment type: D", &hf_seg4d_segment_type_d),
CSN_DESCR_END (Segment4D_t)
static const
CSN_DESCR_BEGIN(Segment4E_t)
M_FIXED_LABEL(Segment4E_t, 3, 0x6, "= Class type: 4"),
M_FIXED_LABEL(Segment4E_t, 4, 0x4, "= Segment type: E"),
M_FIXED_LABEL(Segment4E_t, 3, 0x6, "Class type: 4", &hf_seg4a_class_type),
M_FIXED_LABEL(Segment4E_t, 4, 0x4, "Segment type: E", &hf_seg4e_segment_type_e),
CSN_DESCR_END (Segment4E_t)
static const
CSN_DESCR_BEGIN(Segment4F_t)
M_FIXED_LABEL(Segment4F_t, 3, 0x6, "= Class type: 4"),
M_FIXED_LABEL(Segment4F_t, 4, 0x5, "= Segment type: F"),
M_FIXED_LABEL(Segment4F_t, 3, 0x6, "Class type: 4", &hf_seg4a_class_type),
M_FIXED_LABEL(Segment4F_t, 4, 0x5, "Segment type: F", &hf_seg4f_segment_type_f),
CSN_DESCR_END (Segment4F_t)
static const
CSN_DESCR_BEGIN(Segment4G_t)
M_FIXED_LABEL(Segment4G_t, 3, 0x6, "= Class type: 4"),
M_FIXED_LABEL(Segment4G_t, 4, 0x6, "= Segment type: G"),
M_FIXED_LABEL(Segment4G_t, 3, 0x6, "Class type: 4", &hf_seg4a_class_type),
M_FIXED_LABEL(Segment4G_t, 4, 0x6, "Segment type: G", &hf_seg4g_segment_type_g),
CSN_DESCR_END (Segment4G_t)
static const
CSN_DESCR_BEGIN(Segment4H_t)
M_FIXED_LABEL(Segment4H_t, 3, 0x6, "= Class type: 4"),
M_FIXED_LABEL(Segment4H_t, 4, 0x7, "= Segment type: H"),
M_FIXED_LABEL(Segment4H_t, 3, 0x6, "Class type: 4", &hf_seg4a_class_type),
M_FIXED_LABEL(Segment4H_t, 4, 0x7, "Segment type: H", &hf_seg4h_segment_type_h),
CSN_DESCR_END (Segment4H_t)
static const
CSN_DESCR_BEGIN(Segment4I_t)
M_FIXED_LABEL(Segment4I_t, 3, 0x6, "= Class type: 4"),
M_FIXED_LABEL(Segment4I_t, 4, 0x8, "= Segment type: I"),
M_FIXED_LABEL(Segment4I_t, 3, 0x6, "Class type: 4", &hf_seg4a_class_type),
M_FIXED_LABEL(Segment4I_t, 4, 0x8, "Segment type: I", &hf_seg4i_segment_type_i),
CSN_DESCR_END (Segment4I_t)
static const
CSN_DESCR_BEGIN(Segment4J_t)
M_FIXED_LABEL(Segment4J_t, 3, 0x6, "= Class type: 4"),
M_FIXED_LABEL(Segment4J_t, 4, 0x9, "= Segment type: J"),
M_FIXED_LABEL(Segment4J_t, 3, 0x6, "Class type: 4", &hf_seg4a_class_type),
M_FIXED_LABEL(Segment4J_t, 4, 0x9, "Segment type: J", &hf_seg4j_segment_type_j),
CSN_DESCR_END (Segment4J_t)
static const
CSN_DESCR_BEGIN(Segment4K_t)
M_FIXED_LABEL(Segment4K_t, 3, 0x6, "= Class type: 4"),
M_FIXED_LABEL(Segment4K_t, 4, 0xa, "= Segment type: K"),
M_FIXED_LABEL(Segment4K_t, 3, 0x6, "Class type: 4", &hf_seg4a_class_type),
M_FIXED_LABEL(Segment4K_t, 4, 0xa, "Segment type: K", &hf_seg4k_segment_type_k),
CSN_DESCR_END (Segment4K_t)
@ -879,14 +918,14 @@ CSN_ChoiceElement_t SI1_SegmentChoice[] =
{7, 0x68, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4I, Segment4I_t, "Segment 4I")},
{7, 0x69, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4J, Segment4J_t, "Segment 4J")},
{7, 0x6a, 1, M_TYPE_LABEL(SystemInformation1_t, u.Segment4K, Segment4K_t, "Segment 4K")},
{0, 0x00, 1, CSN_ERROR(SystemInformation1_t, "Unknown segment !", -1)},
{0, 0x00, 1, CSN_ERROR(SystemInformation1_t, "Unknown segment !", -1, &ei_unknown_segment)},
};
static const
CSN_DESCR_BEGIN(SystemInformation1_t)
M_TYPE_LABEL (SystemInformation1_t, Block_Header, SI1_Block_Header_t, "Block Header"),
M_TYPE_LABEL (SystemInformation1_t, Segment1A, Segment1A_t, "Segment 1A"),
M_CHOICE_IL (SystemInformation1_t, SegmentType, SI1_SegmentChoice, ElementsOf(SI1_SegmentChoice)),
M_CHOICE_IL (SystemInformation1_t, SegmentType, SI1_SegmentChoice, ElementsOf(SI1_SegmentChoice), &hf_si1_segment_choice),
CSN_DESCR_END (SystemInformation1_t)
/* System Information type 2 - [1] 10.1.32 */
@ -906,13 +945,13 @@ CSN_ChoiceElement_t SI2_SegmentChoice[] =
{5, 0x04, 1, M_TYPE_LABEL(SystemInformation2_t, u.Segment3E, Segment3E_t, "Segment 3E")},
{5, 0x06, 1, M_TYPE_LABEL(SystemInformation2_t, u.Segment3G, Segment3G_t, "Segment 3G")},
{5, 0x0a, 1, M_TYPE_LABEL(SystemInformation2_t, u.Segment3J, Segment3J_t, "Segment 3J")},
{0, 0x00, 1, CSN_ERROR(SystemInformation2_t, "Unknown segment !", -1)},
{0, 0x00, 1, CSN_ERROR(SystemInformation2_t, "Unknown segment !", -1, &ei_unknown_segment)},
};
static const
CSN_DESCR_BEGIN(SystemInformation2_t)
M_TYPE_LABEL (SystemInformation2_t, Block_Header, SI2_Block_Header_t, "Block Header"),
M_CHOICE_IL (SystemInformation2_t, SegmentType, SI2_SegmentChoice, ElementsOf(SI2_SegmentChoice)),
M_CHOICE_IL (SystemInformation2_t, SegmentType, SI2_SegmentChoice, ElementsOf(SI2_SegmentChoice), &hf_si1_segment_choice),
CSN_DESCR_END (SystemInformation2_t)
@ -1039,7 +1078,7 @@ dissect_gmr1_bcch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
);
bcch_tree = proto_item_add_subtree(bcch_item, ett_gmr1_bcch);
csnStreamInit(&ar, 0, tvb_captured_length(tvb)*8);
csnStreamInit(&ar, 0, tvb_captured_length(tvb)*8, pinfo);
/* SI1 or SI2 */
if (is_si1) {
@ -1318,8 +1357,48 @@ proto_register_gmr1_bcch(void)
FT_UINT8, BASE_DEC, NULL, 0x00,
"Flag for BACH reorganization. Value changes after each reorganization", HFILL }
},
{ &hf_seg2a_class_type,
{ "Class type: 2", "gmr1.bcch.seg2a.class_type",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg2a_segment_type_a,
{ "Segment type: A", "gmr1.bcch.seg2a.segment_type_a",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg2a_segment_type_abis,
{ "Segment type: Abis", "gmr1.bcch.seg2a.segment_type_abis",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg2b_segment_type_b,
{ "Segment type: B", "gmr1.bcch.seg2b.segment_type_b",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg2b_segment_type_bbis,
{ "Segment type: B bis", "gmr1.bcch.seg2b.segment_type_bbis",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
/* Segment 3A - [1] 11.5.2.71 */
{ &hf_seg3a_class_type,
{ "Class type: 3", "gmr1.bcch.seg3a.class_type",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3a_segment_type_a,
{ "Segment type: A", "gmr1.bcch.seg3a.segment_type_a",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3a_lai_dissector,
{ "LAI Dissector length", "gmr1.bcch.seg3a.lai_dissector",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3a_lai_mcc,
{ "Mobile Country Code (MCC)", "gmr1.bcch.seg3a.lai.mcc",
FT_UINT16, BASE_DEC, NULL, 0x00,
@ -1391,7 +1470,144 @@ proto_register_gmr1_bcch(void)
NULL, HFILL }
},
{ &hf_seg3b_segment_type_b,
{ "Segment type: B", "gmr1.bcch.seg3b.segment_type_b",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3b_segment_type_bbis,
{ "Segment type: B bis", "gmr1.bcch.seg3b.segment_type_bbis",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3c_segment_type_c,
{ "Segment type: C", "gmr1.bcch.seg3c.segment_type_c",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3d_segment_type_d,
{ "Segment type: D", "gmr1.bcch.seg3d.segment_type_d",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3e_segment_type_e,
{ "Segment type: E", "gmr1.bcch.seg3e.segment_type_e",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3e_segment_type_ebis,
{ "Segment type: E bis", "gmr1.bcch.seg3e.segment_type_ebis",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3f_segment_type_f,
{ "Segment type: F", "gmr1.bcch.seg3f.segment_type_f",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3g_segment_type_g,
{ "Segment type: G", "gmr1.bcch.seg3g.segment_type_g",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3g_segment_type_gbis,
{ "Segment type: G bis", "gmr1.bcch.seg3g.segment_type_gbis",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3h_segment_type_h,
{ "Segment type: H", "gmr1.bcch.seg3h.segment_type_h",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3i_segment_type_i,
{ "Segment type: I", "gmr1.bcch.seg3i.segment_type_i",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3j_segment_type_j,
{ "Segment type: J", "gmr1.bcch.seg3j.segment_type_j",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3j_segment_type_jbis,
{ "Segment type: J bis", "gmr1.bcch.seg3j.segment_type_jbis",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg3k_segment_type_kbis,
{ "Segment type: K bis", "gmr1.bcch.seg3k.segment_type_kbis",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg4a_class_type,
{ "Class type: 4", "gmr1.bcch.seg4a.class_type",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg4a_segment_type_a,
{ "Segment type: A", "gmr1.bcch.seg3a.segment_type_a",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg4b_segment_type_b,
{ "Segment type: B", "gmr1.bcch.seg3b.segment_type_b",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg4c_segment_type_c,
{ "Segment type: C", "gmr1.bcch.seg3c.segment_type_c",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg4d_segment_type_d,
{ "Segment type: D", "gmr1.bcch.seg3d.segment_type_d",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg4e_segment_type_e,
{ "Segment type: E", "gmr1.bcch.seg3e.segment_type_e",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg4f_segment_type_f,
{ "Segment type: F", "gmr1.bcch.seg3f.segment_type_f",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg4g_segment_type_g,
{ "Segment type: G", "gmr1.bcch.seg3g.segment_type_g",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg4h_segment_type_h,
{ "Segment type: H", "gmr1.bcch.seg3h.segment_type_h",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg4i_segment_type_i,
{ "Segment type: I", "gmr1.bcch.seg3i.segment_type_i",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg4j_segment_type_j,
{ "Segment type: J", "gmr1.bcch.seg3j.segment_type_j",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_seg4k_segment_type_k,
{ "Segment type: K", "gmr1.bcch.seg3k.segment_type_k",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
/* System Information fields - [1] 10.1.31 & 10.1.32 */
{ &hf_si1_segment_choice,
{ "Segment Choice", "gmr1.bcch.si.segment_choice",
FT_UINT8, BASE_DEC, NULL, 0x00,
NULL, HFILL }
},
{ &hf_si_protocol_version,
{ "Protocol version", "gmr1.bcch.si.protocol_version",
FT_UINT8, BASE_DEC, NULL, 0x00,
@ -1418,10 +1634,18 @@ proto_register_gmr1_bcch(void)
&ett_gmr1_bcch,
};
static ei_register_info ei[] = {
{ &ei_unknown_segment, { "gmr1.bcch.unknown_segment", PI_PROTOCOL, PI_WARN, "Unknown segment!", EXPFILL }},
};
expert_module_t* expert_gmr1_bcch;
proto_gmr1_bcch = proto_register_protocol("GEO-Mobile Radio (1) BCCH", "GMR-1 BCCH", "gmr1.bcch");
proto_register_field_array(proto_gmr1_bcch, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_gmr1_bcch = expert_register_protocol(proto_gmr1_bcch);
expert_register_field_array(expert_gmr1_bcch, ei, array_length(ei));
register_dissector("gmr1_bcch", dissect_gmr1_bcch, proto_gmr1_bcch);
}

File diff suppressed because it is too large Load Diff