diff options
-rw-r--r-- | asn1/ranap/ranap.cnf | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-per.c | 75 | ||||
-rw-r--r-- | epan/dissectors/packet-per.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ranap.c | 15 |
4 files changed, 98 insertions, 5 deletions
diff --git a/asn1/ranap/ranap.cnf b/asn1/ranap/ranap.cnf index 86a393b532..bab451ea84 100644 --- a/asn1/ranap/ranap.cnf +++ b/asn1/ranap/ranap.cnf @@ -90,6 +90,17 @@ VAL_PTR = ¶meter_tvb return offset; dissect_e212_mcc_mnc(parameter_tvb, tree, 0); +#.FN_BODY PagingCause +# Remove once asn2eth is fixed to handle PER Enummeration extensions + offset = dissect_per_enumerated(tvb, offset, pinfo, tree, hf_index, + 0, 4, NULL, NULL, TRUE, 0, 0); + +#.FN_BODY Event +# Remove once asn2eth is fixed to handle PER Enummeration extensions + offset = dissect_per_enumerated(tvb, offset, pinfo, tree, hf_index, + 0, 2, NULL, NULL, TRUE, 0, 0); + + #.END #.TYPE_ATTR ProtocolExtensionID TYPE = FT_UINT8 DISPLAY = BASE_DEC STRINGS = VALS(ranap_ProtocolIE_ID_vals)
\ No newline at end of file diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index 7490137bf3..56b6baae76 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -798,7 +798,7 @@ DEBUG_ENTRY("dissect_per_constrained_integer"); if(extension_present){ offset=dissect_per_integer(tvb, offset, pinfo, tree, hf_index, - NULL, NULL); + value, NULL); return offset; } } @@ -948,6 +948,79 @@ DEBUG_ENTRY("dissect_per_constrained_integer"); if (value) *value = val; return offset;} +/* 13 Enemerated */ +guint32 +dissect_per_enumerated(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, guint32 min, guint32 max, guint32 *value, proto_item **item, gboolean has_extension, guint32 ext_min, guint32 ext_max) +{ + + proto_item *it=NULL; + guint32 val; + proto_item *pi; + guint32 start_offset = offset; + gboolean extension_present; + header_field_info *hfi; + + if (!has_extension){ + /* 13.2 */ + offset = dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_index, min, max, value, item, has_extension); + return offset; + } + /* Just get the extension bit, don't advance offset as it will be done in + * dissect_per_constrained_integer + */ + dissect_per_boolean(tvb, offset, pinfo, tree, -1, &extension_present, &pi); + if(extension_present){ + /* Add extension bit to the tree */ + offset = dissect_per_boolean(tvb, offset, pinfo, tree, -1, &extension_present, &pi); + if (!display_internal_per_fields) PROTO_ITEM_SET_HIDDEN(pi); + + hfi = proto_registrar_get_nth(hf_index); + /* 13.3 */ + if ( ext_min == ext_max ){ + + /* 10.5.4 If "range" has the value 1, + * then the result of the encoding shall be + * an empty bit-field (no bits). + */ + val = max + 1; + if (IS_FT_UINT(hfi->type)) { + it = proto_tree_add_uint(tree, hf_index, tvb, start_offset, 1, val); + } else { + THROW(ReportedBoundsError); + } + + /* byte aligned */ + BYTE_ALIGN_OFFSET(offset); + if (item) *item = it; + if (value) *value = val; + return offset; + + }else{ + /* 13.3 ".. and the value shall be added to the field-list as a + * normally small non-negative whole number whose value is the + * enumeration index of the additional enumeration and with "lb" set to 0.." + */ + offset=dissect_per_integer(tvb, offset, pinfo, tree, + hf_index, &val, item); + val = val + max; + if (IS_FT_UINT(hfi->type)) { + it = proto_tree_add_uint(tree, hf_index, tvb, start_offset, 1, val); + } else { + THROW(ReportedBoundsError); + } + if (item) *item = it; + if (value) *value = val; + return offset; + } + + } + /* Extension not present */ + + offset = dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_index, min, max, value, item, has_extension); + + return offset; +} + /* 22 Encoding the choice type */ guint32 dissect_per_choice(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, gint ett_index, const per_choice_t *choice, guint32 *value) diff --git a/epan/dissectors/packet-per.h b/epan/dissectors/packet-per.h index 8deda0661d..217c10b492 100644 --- a/epan/dissectors/packet-per.h +++ b/epan/dissectors/packet-per.h @@ -111,4 +111,6 @@ extern guint32 dissect_per_bit_string(tvbuff_t *tvb, guint32 offset, packet_info extern guint32 dissect_per_restricted_character_string(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, int min_len, int max_len, const char *alphabet, int alphabet_length, tvbuff_t **value_tvb); +extern guint32 dissect_per_enumerated(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, guint32 min, guint32 max, guint32 *value, proto_item **item, gboolean has_extension, guint32 ext_min, guint32 ext_max); + #endif /* __PACKET_PER_H__ */ diff --git a/epan/dissectors/packet-ranap.c b/epan/dissectors/packet-ranap.c index 9e1568987f..d26b359785 100644 --- a/epan/dissectors/packet-ranap.c +++ b/epan/dissectors/packet-ranap.c @@ -6456,8 +6456,11 @@ static const value_string ranap_PagingCause_vals[] = { static int dissect_ranap_PagingCause(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { - offset = dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_index, - 0, 5, NULL, NULL, TRUE); +#line 95 "ranap.cnf" + offset = dissect_per_enumerated(tvb, offset, pinfo, tree, hf_index, + 0, 4, NULL, NULL, TRUE, 0, 0); + + return offset; } @@ -8464,8 +8467,12 @@ static const value_string ranap_Event_vals[] = { static int dissect_ranap_Event(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { - offset = dissect_per_constrained_integer(tvb, offset, pinfo, tree, hf_index, - 0, 3, NULL, NULL, TRUE); +#line 100 "ranap.cnf" + offset = dissect_per_enumerated(tvb, offset, pinfo, tree, hf_index, + 0, 2, NULL, NULL, TRUE, 0, 0); + + + return offset; } |