forked from osmocom/wireshark
use proto_tree_add_item()
Change-Id: I7642295721e886eef4682c602ad96b61bc85b3b6 Reviewed-on: https://code.wireshark.org/review/3128 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
This commit is contained in:
parent
ab2922b7e5
commit
450f491652
|
@ -1370,9 +1370,6 @@ static void
|
|||
dissect_oampdu_event_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
{
|
||||
guint8 raw_octet;
|
||||
guint16 raw_word;
|
||||
guint32 dword;
|
||||
guint64 big;
|
||||
|
||||
guint8 event_type;
|
||||
guint32 offset;
|
||||
|
@ -1384,10 +1381,8 @@ dissect_oampdu_event_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree
|
|||
offset = OAMPDU_HEADER_SIZE;
|
||||
|
||||
/* Display the sequence number before displaying the TLVs */
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(tree, hf_oampdu_event_sequence,
|
||||
tvb, offset, 2, raw_word);
|
||||
|
||||
proto_tree_add_item(tree, hf_oampdu_event_sequence,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EVENT_SEQUENCE_SZ;
|
||||
|
||||
while (1)
|
||||
|
@ -1407,200 +1402,137 @@ dissect_oampdu_event_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree
|
|||
switch (event_type)
|
||||
{
|
||||
case OAMPDU_EVENT_TYPE_ESPE:
|
||||
{
|
||||
event_tree = proto_item_add_subtree(event_item,
|
||||
ett_oampdu_event_espe);
|
||||
event_tree = proto_item_add_subtree(event_item,
|
||||
ett_oampdu_event_espe);
|
||||
|
||||
raw_octet = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_length,
|
||||
tvb, offset, 1, raw_octet);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_length,
|
||||
tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EVENT_LENGTH_SZ;
|
||||
|
||||
offset += OAMPDU_EVENT_LENGTH_SZ;
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_timeStamp,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EVENT_TIMESTAMP_SZ;
|
||||
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_timeStamp,
|
||||
tvb, offset, 2, raw_word);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_espeWindow,
|
||||
tvb, offset, 8, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_ESPE_WINDOW_SZ;
|
||||
|
||||
offset += OAMPDU_EVENT_TIMESTAMP_SZ;
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_espeThreshold,
|
||||
tvb, offset, 8, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_ESPE_THRESHOLD_SZ;
|
||||
|
||||
big = tvb_get_ntoh64(tvb, offset);
|
||||
proto_tree_add_uint64(event_tree, hf_oampdu_event_espeWindow,
|
||||
tvb, offset, 8, big);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_espeErrors,
|
||||
tvb, offset, 8, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_ESPE_ERRORS_SZ;
|
||||
|
||||
offset += OAMPDU_ESPE_WINDOW_SZ;
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_espeTotalErrors,
|
||||
tvb, offset, 8, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_ESPE_ERR_TOTAL_SZ;
|
||||
|
||||
big = tvb_get_ntoh64(tvb, offset);
|
||||
proto_tree_add_uint64(event_tree, hf_oampdu_event_espeThreshold,
|
||||
tvb, offset, 8, big);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_espeTotalEvents,
|
||||
tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_ESPE_TOTAL_SZ;
|
||||
break;
|
||||
|
||||
offset += OAMPDU_ESPE_THRESHOLD_SZ;
|
||||
|
||||
big = tvb_get_ntoh64(tvb, offset);
|
||||
proto_tree_add_uint64(event_tree, hf_oampdu_event_espeErrors,
|
||||
tvb, offset, 8, big);
|
||||
|
||||
offset += OAMPDU_ESPE_ERRORS_SZ;
|
||||
|
||||
big = tvb_get_ntoh64(tvb, offset);
|
||||
proto_tree_add_uint64(event_tree, hf_oampdu_event_espeTotalErrors,
|
||||
tvb, offset, 8, big);
|
||||
|
||||
offset += OAMPDU_ESPE_ERR_TOTAL_SZ;
|
||||
|
||||
dword = tvb_get_ntohl(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_espeTotalEvents,
|
||||
tvb, offset, 4, dword);
|
||||
|
||||
offset += OAMPDU_ESPE_TOTAL_SZ;
|
||||
break;
|
||||
}
|
||||
case OAMPDU_EVENT_TYPE_EFE:
|
||||
{
|
||||
event_tree = proto_item_add_subtree(event_item,
|
||||
ett_oampdu_event_efe);
|
||||
event_tree = proto_item_add_subtree(event_item,
|
||||
ett_oampdu_event_efe);
|
||||
|
||||
raw_octet = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_length,
|
||||
tvb, offset, 1, raw_octet);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_length,
|
||||
tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EVENT_LENGTH_SZ;
|
||||
|
||||
offset += OAMPDU_EVENT_LENGTH_SZ;
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_timeStamp,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EVENT_TIMESTAMP_SZ;
|
||||
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_timeStamp,
|
||||
tvb, offset, 2, raw_word);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efeWindow,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFE_WINDOW_SZ;
|
||||
|
||||
offset += OAMPDU_EVENT_TIMESTAMP_SZ;
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efeThreshold,
|
||||
tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFE_THRESHOLD_SZ;
|
||||
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_efeWindow,
|
||||
tvb, offset, 2, raw_word);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efeErrors,
|
||||
tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFE_ERRORS_SZ;
|
||||
|
||||
offset += OAMPDU_EFE_WINDOW_SZ;
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efeTotalErrors,
|
||||
tvb, offset, 8, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFE_ERR_TOTAL_SZ;
|
||||
|
||||
dword = tvb_get_ntohl(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_efeThreshold,
|
||||
tvb, offset, 4, dword);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efeTotalEvents,
|
||||
tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFE_TOTAL_SZ;
|
||||
break;
|
||||
|
||||
offset += OAMPDU_EFE_THRESHOLD_SZ;
|
||||
|
||||
dword = tvb_get_ntohl(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_efeErrors,
|
||||
tvb, offset, 4, dword);
|
||||
|
||||
offset += OAMPDU_EFE_ERRORS_SZ;
|
||||
|
||||
big = tvb_get_ntoh64(tvb, offset);
|
||||
proto_tree_add_uint64(event_tree, hf_oampdu_event_efeTotalErrors,
|
||||
tvb, offset, 8, big);
|
||||
|
||||
offset += OAMPDU_EFE_ERR_TOTAL_SZ;
|
||||
|
||||
dword = tvb_get_ntohl(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_efeTotalEvents,
|
||||
tvb, offset, 4, dword);
|
||||
|
||||
offset += OAMPDU_EFE_TOTAL_SZ;
|
||||
|
||||
break;
|
||||
}
|
||||
case OAMPDU_EVENT_TYPE_EFPE:
|
||||
{
|
||||
event_tree = proto_item_add_subtree(event_item,
|
||||
ett_oampdu_event_efpe);
|
||||
event_tree = proto_item_add_subtree(event_item,
|
||||
ett_oampdu_event_efpe);
|
||||
|
||||
raw_octet = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_length,
|
||||
tvb, offset, 1, raw_octet);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_length,
|
||||
tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EVENT_LENGTH_SZ;
|
||||
|
||||
offset += OAMPDU_EVENT_LENGTH_SZ;
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_timeStamp,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EVENT_TIMESTAMP_SZ;
|
||||
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_timeStamp,
|
||||
tvb, offset, 2, raw_word);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efpeWindow,
|
||||
tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFPE_WINDOW_SZ;
|
||||
|
||||
offset += OAMPDU_EVENT_TIMESTAMP_SZ;
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efpeThreshold,
|
||||
tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFPE_THRESHOLD_SZ;
|
||||
|
||||
dword = tvb_get_ntohl(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_efpeWindow,
|
||||
tvb, offset, 4, dword);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efpeErrors,
|
||||
tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFPE_ERRORS_SZ;
|
||||
|
||||
offset += OAMPDU_EFPE_WINDOW_SZ;
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efpeTotalErrors,
|
||||
tvb, offset, 8, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFPE_ERR_TOTAL_SZ;
|
||||
|
||||
dword = tvb_get_ntohl(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_efpeThreshold,
|
||||
tvb, offset, 4, dword);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efpeTotalEvents,
|
||||
tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFPE_TOTAL_SZ;
|
||||
break;
|
||||
|
||||
offset += OAMPDU_EFPE_THRESHOLD_SZ;
|
||||
|
||||
dword = tvb_get_ntohl(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_efpeErrors,
|
||||
tvb, offset, 4, dword);
|
||||
|
||||
offset += OAMPDU_EFPE_ERRORS_SZ;
|
||||
|
||||
big = tvb_get_ntoh64(tvb, offset);
|
||||
proto_tree_add_uint64(event_tree, hf_oampdu_event_efpeTotalErrors,
|
||||
tvb, offset, 8, big);
|
||||
|
||||
offset += OAMPDU_EFPE_ERR_TOTAL_SZ;
|
||||
|
||||
dword = tvb_get_ntohl(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_efpeTotalEvents,
|
||||
tvb, offset, 4, dword);
|
||||
|
||||
offset += OAMPDU_EFPE_TOTAL_SZ;
|
||||
|
||||
break;
|
||||
}
|
||||
case OAMPDU_EVENT_TYPE_EFSSE:
|
||||
{
|
||||
event_tree = proto_item_add_subtree(event_item,
|
||||
ett_oampdu_event_efsse);
|
||||
event_tree = proto_item_add_subtree(event_item,
|
||||
ett_oampdu_event_efsse);
|
||||
|
||||
raw_octet = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_length,
|
||||
tvb, offset, 1, raw_octet);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_length,
|
||||
tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EVENT_LENGTH_SZ;
|
||||
|
||||
offset += OAMPDU_EVENT_LENGTH_SZ;
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_timeStamp,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EVENT_TIMESTAMP_SZ;
|
||||
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_timeStamp,
|
||||
tvb, offset, 2, raw_word);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efsseWindow,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFSSE_WINDOW_SZ;
|
||||
|
||||
offset += OAMPDU_EVENT_TIMESTAMP_SZ;
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efsseThreshold,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFSSE_THRESHOLD_SZ;
|
||||
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_efsseWindow,
|
||||
tvb, offset, 2, raw_word);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efsseErrors,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFSSE_ERRORS_SZ;
|
||||
|
||||
offset += OAMPDU_EFSSE_WINDOW_SZ;
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efsseTotalErrors,
|
||||
tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFSSE_ERR_TOTAL_SZ;
|
||||
|
||||
dword = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_efsseThreshold,
|
||||
tvb, offset, 2, dword);
|
||||
proto_tree_add_item(event_tree, hf_oampdu_event_efsseTotalEvents,
|
||||
tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += OAMPDU_EFSSE_TOTAL_SZ;
|
||||
break;
|
||||
|
||||
offset += OAMPDU_EFSSE_THRESHOLD_SZ;
|
||||
|
||||
dword = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_efsseErrors,
|
||||
tvb, offset, 2, dword);
|
||||
|
||||
offset += OAMPDU_EFSSE_ERRORS_SZ;
|
||||
|
||||
dword = tvb_get_ntohl(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_efsseTotalErrors,
|
||||
tvb, offset, 4, dword);
|
||||
|
||||
offset += OAMPDU_EFSSE_ERR_TOTAL_SZ;
|
||||
|
||||
dword = tvb_get_ntohl(tvb, offset);
|
||||
proto_tree_add_uint(event_tree, hf_oampdu_event_efsseTotalEvents,
|
||||
tvb, offset, 4, dword);
|
||||
|
||||
offset += OAMPDU_EFSSE_TOTAL_SZ;
|
||||
|
||||
break;
|
||||
}
|
||||
case OAMPDU_EVENT_TYPE_OSE:
|
||||
{
|
||||
event_tree = proto_item_add_subtree(event_item,
|
||||
|
@ -1649,7 +1581,6 @@ dissect_oampdu_event_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree
|
|||
static void
|
||||
dissect_oampdu_variable_request(tvbuff_t *tvb, proto_tree *tree)
|
||||
{
|
||||
guint16 raw_word;
|
||||
guint8 raw_octet;
|
||||
guint32 offset;
|
||||
|
||||
|
@ -1670,33 +1601,21 @@ dissect_oampdu_variable_request(tvbuff_t *tvb, proto_tree *tree)
|
|||
switch (raw_octet)
|
||||
{
|
||||
case OAMPDU_VARS_OBJECT:
|
||||
{
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(tree, hf_oampdu_variable_object,
|
||||
tvb, offset, 2, raw_word);
|
||||
break;
|
||||
}
|
||||
proto_tree_add_item(tree, hf_oampdu_variable_object,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
break;
|
||||
case OAMPDU_VARS_PACKAGE:
|
||||
{
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(tree, hf_oampdu_variable_package,
|
||||
tvb, offset, 2, raw_word);
|
||||
break;
|
||||
}
|
||||
proto_tree_add_item(tree, hf_oampdu_variable_package,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
break;
|
||||
case OAMPDU_VARS_BINDING:
|
||||
{
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(tree, hf_oampdu_variable_binding,
|
||||
tvb, offset, 2, raw_word);
|
||||
break;
|
||||
}
|
||||
proto_tree_add_item(tree, hf_oampdu_variable_binding,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
break;
|
||||
case OAMPDU_VARS_ATTRIBUTE:
|
||||
{
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(tree, hf_oampdu_variable_attribute,
|
||||
tvb, offset, 2, raw_word);
|
||||
break;
|
||||
}
|
||||
proto_tree_add_item(tree, hf_oampdu_variable_attribute,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1726,11 +1645,9 @@ dissect_oampdu_variable_request(tvbuff_t *tvb, proto_tree *tree)
|
|||
static void
|
||||
dissect_oampdu_variable_response(tvbuff_t *tvb, proto_tree *tree)
|
||||
{
|
||||
guint16 raw_word;
|
||||
guint8 branch, raw_octet;
|
||||
guint32 offset;
|
||||
|
||||
|
||||
offset = OAMPDU_HEADER_SIZE;
|
||||
|
||||
while (1)
|
||||
|
@ -1747,37 +1664,24 @@ dissect_oampdu_variable_response(tvbuff_t *tvb, proto_tree *tree)
|
|||
switch (branch)
|
||||
{
|
||||
case OAMPDU_VARS_OBJECT:
|
||||
{
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(tree, hf_oampdu_variable_object,
|
||||
tvb, offset, 2, raw_word);
|
||||
break;
|
||||
}
|
||||
proto_tree_add_item(tree, hf_oampdu_variable_object,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
break;
|
||||
case OAMPDU_VARS_PACKAGE:
|
||||
{
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(tree, hf_oampdu_variable_package,
|
||||
tvb, offset, 2, raw_word);
|
||||
break;
|
||||
}
|
||||
proto_tree_add_item(tree, hf_oampdu_variable_package,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
break;
|
||||
case OAMPDU_VARS_BINDING:
|
||||
{
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(tree, hf_oampdu_variable_binding,
|
||||
tvb, offset, 2, raw_word);
|
||||
break;
|
||||
}
|
||||
proto_tree_add_item(tree, hf_oampdu_variable_binding,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
break;
|
||||
case OAMPDU_VARS_ATTRIBUTE:
|
||||
{
|
||||
raw_word = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(tree, hf_oampdu_variable_attribute,
|
||||
tvb, offset, 2, raw_word);
|
||||
break;
|
||||
}
|
||||
proto_tree_add_item(tree, hf_oampdu_variable_attribute,
|
||||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
offset+=2;
|
||||
|
||||
do {
|
||||
|
|
Loading…
Reference in New Issue