forked from osmocom/wireshark
Compare commits
2 Commits
master
...
pespin/csn
Author | SHA1 | Date |
---|---|---|
Pau Espin | 902531bd81 | |
Pau Espin | 23289dc2f7 |
|
@ -531,25 +531,26 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
|
|||
csnStream_t arT = *ar;
|
||||
proto_item *ti;
|
||||
proto_tree *test_tree;
|
||||
|
||||
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, ar->pinfo);
|
||||
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR*)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
|
||||
|
||||
if (Status >= 0)
|
||||
if (pDescr->may_be_null && remaining_bits_len == 0)
|
||||
{
|
||||
proto_item_set_len(ti,((arT.bit_offset-1)>>3) - (bit_offset>>3)+1);
|
||||
remaining_bits_len = arT.remaining_bits_len;
|
||||
bit_offset = arT.bit_offset;
|
||||
pDescr++;
|
||||
proto_tree_add_none_format(tree, hf_null_data, tvb, 0, 0, "[NULL data]: %s Not Present", pDescr->sz);
|
||||
} else {
|
||||
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, ar->pinfo);
|
||||
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR*)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
|
||||
if (Status >= 0)
|
||||
{
|
||||
proto_item_set_len(ti,((arT.bit_offset-1)>>3) - (bit_offset>>3)+1);
|
||||
remaining_bits_len = arT.remaining_bits_len;
|
||||
bit_offset = arT.bit_offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Has already been processed: ProcessError("csnStreamDissector", Status, pDescr); */
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Has already been processed: ProcessError("csnStreamDissector", Status, pDescr); */
|
||||
return Status;
|
||||
}
|
||||
|
||||
pDescr++;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1002,22 +1003,25 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
|
|||
proto_item *ti;
|
||||
proto_tree *test_tree;
|
||||
|
||||
test_tree = proto_tree_add_subtree(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, pDescr->sz);
|
||||
|
||||
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)
|
||||
if (pDescr->may_be_null && remaining_bits_len == 0)
|
||||
{
|
||||
proto_item_set_len(ti,((arT.bit_offset-1)>>3) - (bit_offset>>3)+1);
|
||||
remaining_bits_len = arT.remaining_bits_len;
|
||||
bit_offset = arT.bit_offset;
|
||||
pDescr++;
|
||||
proto_tree_add_none_format(tree, hf_null_data, tvb, 0, 0, "[NULL data]: %s Not Present", pDescr->sz);
|
||||
} else {
|
||||
test_tree = proto_tree_add_subtree(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, pDescr->sz);
|
||||
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)
|
||||
{
|
||||
proto_item_set_len(ti,((arT.bit_offset-1)>>3) - (bit_offset>>3)+1);
|
||||
remaining_bits_len = arT.remaining_bits_len;
|
||||
bit_offset = arT.bit_offset;
|
||||
}
|
||||
else
|
||||
{ /* return error code Has already been processed: */
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ /* return error code Has already been processed: */
|
||||
return Status;
|
||||
}
|
||||
|
||||
pDescr++;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1066,7 +1070,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
|
|||
|
||||
case CSN_NEXT_EXIST:
|
||||
{
|
||||
guint8 fExist;
|
||||
guint8 isnull;
|
||||
|
||||
pui8 = pui8DATA(data, pDescr->offset);
|
||||
|
||||
|
@ -1085,18 +1089,30 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
|
|||
/* the "regular" M_NEXT_EXIST description element */
|
||||
proto_tree_add_bits_item(tree, *(pDescr->hf_ptr), tvb, bit_offset, 1, ENC_BIG_ENDIAN);
|
||||
|
||||
fExist = 0x00;
|
||||
isnull = 1;
|
||||
if (tvb_get_bits8(tvb, bit_offset, 1))
|
||||
{
|
||||
fExist = 0x01;
|
||||
if (remaining_bits_len == 1)
|
||||
{
|
||||
/* If { 1 < end > } and all next items may be null, store it as { 0 } */
|
||||
const CSN_DESCR* pDescrNext = pDescr + 1;
|
||||
guint8 i;
|
||||
for (i = 0; i < pDescr->i; i++, pDescrNext++)
|
||||
{
|
||||
if (!pDescrNext->may_be_null)
|
||||
isnull = 0;
|
||||
}
|
||||
} else {
|
||||
isnull = 0;
|
||||
}
|
||||
}
|
||||
|
||||
*pui8 = fExist;
|
||||
*pui8 = !isnull;
|
||||
|
||||
remaining_bits_len --;
|
||||
bit_offset++;
|
||||
|
||||
if (fExist == 0)
|
||||
if (isnull)
|
||||
{ /* Skip 'i' entries */
|
||||
pDescr += pDescr->i;
|
||||
}
|
||||
|
@ -1107,7 +1123,7 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
|
|||
|
||||
case CSN_NEXT_EXIST_LH:
|
||||
{
|
||||
guint8 fExist;
|
||||
guint8 isnull;
|
||||
pui8 = pui8DATA(data, pDescr->offset);
|
||||
|
||||
/* this if-statement represents the M_NEXT_EXIST_OR_NULL_LH description element */
|
||||
|
@ -1125,14 +1141,29 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
|
|||
/* the "regular" M_NEXT_EXIST_LH description element */
|
||||
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);
|
||||
isnull = 1;
|
||||
if (tvb_get_masked_bits8(tvb, bit_offset, 1))
|
||||
{
|
||||
if (remaining_bits_len == 1) {
|
||||
/* If { 1 < end > } and all next items may be null, store it as { 0 } */
|
||||
const CSN_DESCR* pDescrNext = pDescr + 1;
|
||||
guint8 i;
|
||||
for (i = 0; i < pDescr->i; i++, pDescrNext++)
|
||||
{
|
||||
if (!pDescrNext->may_be_null)
|
||||
isnull = 0;
|
||||
}
|
||||
} else {
|
||||
isnull = 0;
|
||||
}
|
||||
}
|
||||
|
||||
*pui8++ = fExist;
|
||||
*pui8++ = !isnull;
|
||||
|
||||
remaining_bits_len --;
|
||||
bit_offset++;
|
||||
|
||||
if (fExist == 0)
|
||||
if (isnull)
|
||||
{ /* Skip 'i' entries */
|
||||
pDescr += pDescr->i;
|
||||
}
|
||||
|
|
|
@ -477,6 +477,17 @@ gint16 csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pD
|
|||
#define M_TYPE(_STRUCT, _MEMBER, _MEMBER_TYPE)\
|
||||
{CSN_TYPE, 0, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), FALSE, #_MEMBER, NULL, 0, NULL, NULL, NULL}
|
||||
|
||||
/******************************************************************************
|
||||
* M_TYPE_OR_NULL(Par1, Par2, Par3)
|
||||
* Similar to the M_TYPE except that not only the request set of bits but also the
|
||||
* end of the message may be encountered when looking for the next element in
|
||||
* the message.
|
||||
* Covers the case {null | 0 | 1 < IE >}
|
||||
*****************************************************************************/
|
||||
#define M_TYPE_OR_NULL(_STRUCT, _MEMBER, _MEMBER_TYPE)\
|
||||
{CSN_TYPE, 0, {(const void*)CSNDESCR_##_MEMBER_TYPE}, offsetof(_STRUCT, _MEMBER), TRUE, #_MEMBER, NULL, 0, NULL, NULL, NULL}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* M_TYPE_LABEL(Par1, Par2, Par3, Par4)
|
||||
* Same as M_TYPE but allows to define a custom string for the subtree
|
||||
|
|
|
@ -2750,7 +2750,7 @@ CSN_DESCR_BEGIN (Content_t)
|
|||
/* additions in release 7 */
|
||||
M_UINT_OR_NULL (Content_t, DTM_Handover_Capability, 1, &hf_content_dtm_handover_capability),
|
||||
M_NEXT_EXIST_OR_NULL(Content_t, Exist_DownlinkDualCarrierCapability_r7, 1, &hf_content_multislot_capability_reduction_for_dl_dual_carrier_exist),
|
||||
M_TYPE (Content_t, DownlinkDualCarrierCapability_r7, DownlinkDualCarrierCapability_r7_t),
|
||||
M_TYPE_OR_NULL (Content_t, DownlinkDualCarrierCapability_r7, DownlinkDualCarrierCapability_r7_t),
|
||||
|
||||
M_UINT_OR_NULL (Content_t, FlexibleTimeslotAssignment, 1, &hf_content_flexible_timeslot_assignment),
|
||||
M_UINT_OR_NULL (Content_t, GAN_PS_HandoverCapability, 1, &hf_content_gan_ps_handover_capability),
|
||||
|
|
Loading…
Reference in New Issue