diff options
author | kukosa <kukosa@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-04-27 14:17:14 +0000 |
---|---|---|
committer | kukosa <kukosa@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-04-27 14:17:14 +0000 |
commit | 6293534a4834a4daed9f27c72bca200b97295cf1 (patch) | |
tree | b9c621067d3eddd38e37a01790fdd464455966ed | |
parent | 66330f25369078b74691b2feca171adb646a192a (diff) |
NULL type decoders for PER and BER
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14201 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | epan/dissectors/packet-ber.c | 25 | ||||
-rw-r--r-- | epan/dissectors/packet-ber.h | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-per.c | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-per.h | 2 |
4 files changed, 39 insertions, 0 deletions
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index 69cec54361..13fdae8364 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -527,6 +527,31 @@ int dissect_ber_octet_string_wcb(gboolean implicit_tag, packet_info *pinfo, prot return offset; } +/* 8.8 Encoding of a null value */ +int +dissect_ber_null(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id) { + guint8 class; + gboolean pc; + guint32 tag, len; + int offset_old; + + offset_old = offset; + offset = dissect_ber_identifier(pinfo, tree, tvb, offset, &class, &pc, &tag); + if ((pc) || + (!implicit_tag && ((class != BER_CLASS_UNI) || (tag != BER_UNI_TAG_NULL)))) { + proto_tree_add_text(tree, tvb, offset_old, offset - offset_old, "BER Error: NULL expected but Class:%d(%s) PC:%d Tag:%d was unexpected", class,val_to_str(class,ber_class_codes,"Unknown"), pc, tag); + } + + offset_old = offset; + offset = dissect_ber_length(pinfo, tree, tvb, offset, &len, NULL); + if (len) { + proto_tree_add_text(tree, tvb, offset_old, offset - offset_old, "BER Error: NULL expect zero length but Length=%d", len); + proto_tree_add_text(tree, tvb, offset, len, "BER Error: unexpected data in NULL type"); + offset += len; + } + + return offset; +} int dissect_ber_integer(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, guint32 *value) diff --git a/epan/dissectors/packet-ber.h b/epan/dissectors/packet-ber.h index 2a65ca336d..333e95bdf0 100644 --- a/epan/dissectors/packet-ber.h +++ b/epan/dissectors/packet-ber.h @@ -90,6 +90,7 @@ extern int dissect_ber_octet_string_wcb(gboolean implicit_tag, packet_info *pinf extern int dissect_ber_integer(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, guint32 *value); +extern int dissect_ber_null(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id); extern int dissect_ber_boolean(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id); diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index 563952884b..90c8421f22 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -205,6 +205,17 @@ dissect_per_GeneralString(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, pro return offset; } +/* 17 Encoding the null type */ +guint32 +dissect_per_null(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index) { + proto_item *ti_tmp; + + ti_tmp = proto_tree_add_item(tree, hf_index, tvb, offset>>8, 0, FALSE); + proto_item_append_text(ti_tmp, ": NULL"); + + return offset; +} + /* 19 this function dissects a sequence of */ static guint32 dissect_per_sequence_of_helper(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int (*func)(tvbuff_t *, int , packet_info *, proto_tree *), guint32 length) diff --git a/epan/dissectors/packet-per.h b/epan/dissectors/packet-per.h index ce96e64ba8..6fec1d5375 100644 --- a/epan/dissectors/packet-per.h +++ b/epan/dissectors/packet-per.h @@ -64,6 +64,8 @@ typedef struct _per_sequence_t { extern guint32 dissect_per_length_determinant(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index, guint32 *length); +extern guint32 dissect_per_null(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index); + extern guint32 dissect_per_GeneralString(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *tree, int hf_index); extern guint32 dissect_per_sequence_of(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *parent_tree, int hf_index, gint ett_index, int (*func)(tvbuff_t *, int , packet_info *, proto_tree *)); |